cortex-react-components 2.18.4 → 2.18.6
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/{chunk-2SMCWU5D.mjs → chunk-275W7H4O.mjs} +1 -1
- package/dist/chunk-347B45ZS.mjs +1 -0
- package/dist/{chunk-3QSJWNSG.mjs → chunk-JEWBD2UD.mjs} +1 -1
- package/dist/{chunk-4KQPMKRD.mjs → chunk-JSHD7QTU.mjs} +1 -1
- package/dist/{chunk-32V5QT3S.mjs → chunk-PAEL4O5F.mjs} +1 -1
- package/dist/{chunk-IYJOABIM.mjs → chunk-WAVVCASZ.mjs} +1 -1
- package/dist/chunk-WRZP5K5X.mjs +1 -0
- package/dist/{chunk-UG72MXTU.mjs → chunk-XYJ4S67W.mjs} +1 -1
- package/dist/components/Chat/ChatInterface.js +1 -1
- package/dist/components/Chat/ChatInterface.mjs +1 -1
- package/dist/components/Chat/CopilotInterface.js +1 -1
- package/dist/components/Chat/CopilotInterface.mjs +1 -1
- package/dist/components/Chat/PartTypes/MessageHandler.js +6 -6
- package/dist/components/Chat/PartTypes/MessageHandler.mjs +1 -1
- package/dist/components/Chat/PartTypes/PartApprovalTool.d.ts +1 -0
- package/dist/components/Chat/PartTypes/PartApprovalTool.js +2 -2
- package/dist/components/Chat/PartTypes/PartApprovalTool.mjs +1 -1
- package/dist/components/Chat/PartTypes/index.js +1 -1
- package/dist/components/Chat/PartTypes/index.mjs +1 -1
- package/dist/components/Chat/demo-long-messages.js +2 -2
- package/dist/components/Chat/demo-long-messages.mjs +1 -1
- package/dist/components/Chat/demo-tests.js +1 -1
- package/dist/components/Chat/demo-tests.mjs +1 -1
- package/dist/components/Chat/demo.js +1 -1
- package/dist/components/Chat/demo.mjs +1 -1
- package/dist/components/Chat/example-usage.js +1 -1
- package/dist/components/Chat/example-usage.mjs +1 -1
- package/dist/components/Chat/example-with-vercel-ai.js +1 -1
- package/dist/components/Chat/example-with-vercel-ai.mjs +1 -1
- package/dist/components/Chat/index.js +1 -1
- package/dist/components/Chat/index.mjs +1 -1
- package/dist/components/DigitalColleagues/MainPage.mjs +1 -1
- package/dist/components/DigitalColleagues/index.mjs +1 -1
- package/dist/components/Foundary/MainPage.mjs +1 -1
- package/dist/components/Foundary/Pages/dashboardpage.mjs +1 -1
- package/dist/components/Foundary/Views/ColleaguesView.mjs +1 -1
- package/dist/components/Foundary/Views/index.mjs +1 -1
- package/dist/components/Foundary/index.mjs +1 -1
- package/dist/components/HeaderFooter/index.mjs +1 -1
- package/dist/components/Heros/RenderHero.mjs +1 -1
- package/dist/components/Heros/index.mjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/Blog.mjs +1 -1
- package/dist/pages/Documentation.mjs +1 -1
- package/dist/pages/IndexPage.mjs +1 -1
- package/dist/pages/Intranet.mjs +1 -1
- package/dist/pages/LandingPage.mjs +1 -1
- package/dist/pages/Page.mjs +1 -1
- package/dist/pages/Publish.mjs +1 -1
- package/dist/pages/Website.mjs +1 -1
- package/dist/sections/PageSections.mjs +1 -1
- package/dist/sections/ServiceSection.mjs +1 -1
- package/dist/sections/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-CEAEO2FN.mjs +0 -1
- package/dist/chunk-EH3PJU6C.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
import{a as
|
|
4
|
+
import{a as _}from"./chunk-M2REXGQW.mjs";import{a as x}from"./chunk-ATBKMJU6.mjs";import{a as O}from"./chunk-H3RVI2OI.mjs";import{a as Y}from"./chunk-FSCDCSVK.mjs";import{a as Z}from"./chunk-NDZ26EG6.mjs";import{a as R}from"./chunk-Z22NSJMF.mjs";import{a as ee}from"./chunk-Y7H3EUBR.mjs";import{a as X}from"./chunk-FGEFYI5E.mjs";import{a as U,c as $,d as k,g as F,i as p}from"./chunk-YFAZQYK4.mjs";import{a as Q}from"./chunk-L5JPAKPM.mjs";import{b as H}from"./chunk-ZUA4KNIR.mjs";import{a as c,b as h,c as w,e as u}from"./chunk-YO3GQYRJ.mjs";import{useEffect as pe,useState as o}from"react";import{Plus as Ce,Search as fe,Users as le,Bot as ve,User as ye,Filter as he}from"lucide-react";import{motion as we,AnimatePresence as xe}from"motion/react";import{jsx as l,jsxs as t}from"react/jsx-runtime";function Se({initialColleagues:S,onColleagueAdd:N,onColleagueEdit:K,onColleagueDelete:te,compactView:n=!1,departments:ae=["Design","Engineering","Marketing","Product","Sales","Operations"],className:ie,availableUsers:I=[],existingDigitalColleagues:L=[],availableKnowledgeDocuments:P=[]}){let[s,r]=o(S||[]),[d,j]=o(""),[D,B]=o("all"),[b,M]=o("all"),[v,oe]=o("all"),[G,C]=o(null),[A,y]=o(null);pe(()=>{r(S||[])},[S]);let ne=Array.isArray(I)?I:[],se=Array.isArray(L)?L:[],[g,a]=o("main"),f=s.filter(e=>!e||!e.name?!1:e.name.toLowerCase().includes(d.toLowerCase())||e.type==="human"&&e.email?.toLowerCase().includes(d.toLowerCase())||e.type==="digital"&&e.jobDescription?.toLowerCase().includes(d.toLowerCase())),W=f.filter(e=>e.type==="human"),q=f.filter(e=>e.type==="digital"),z=()=>{a("typeSelection")},T=e=>{e.type==="digital"&&(C(e),a("form")),console.log("Editing colleague:",e),K?.(e)},E=e=>{e.type==="digital"&&(y(e),a("view"))},re=e=>{let i={id:`human-${Date.now()}`,type:"human",name:e.name,email:e.email,updatedAt:e.updatedAt,createdAt:e.createdAt,accounts:e.accounts};r(m=>[...m,i]),N?.(i),a("main")},de=e=>{if(!e||!e.id){console.error("Invalid cloned colleague provided to handleDigitalColleagueClone:",e);return}r(i=>[...i,{...e,type:"digital"}]),N?.({...e,type:"digital"}),a("main")},ge=()=>{C(null),a("form")},J=e=>{if(!e||!e.id){console.error("Invalid colleague provided to handleSaveColleague:",e);return}G?(r(i=>i.map(m=>m.id===e.id?{...e,type:"digital"}:m)),K?.({...e,type:"digital"})):(r(i=>[...i,{...e,type:"digital"}]),N?.({...e,type:"digital"})),a("main"),C(null)},me=()=>{a("main"),C(null),y(null)},ce=()=>{a("main"),y(null)},Ne=()=>{A&&(C(A),y(null),a("form"))},V=e=>{console.log("deleting",e,s),te?.(e,s.find(i=>i.id.toString()===e.toString())?.type),r(i=>i.filter(m=>m.id!==e))},ue=()=>{j(""),B("all"),M("all")};return g==="typeSelection"?l(Y,{onSelectHuman:()=>a("userSelection"),onSelectDigital:()=>a("digitalOptions"),onCancel:()=>a("main")}):g==="userSelection"?l(ee,{users:ne,onUserSelect:re,onCancel:()=>a("typeSelection")}):g==="digitalOptions"?l(_,{onCloneExisting:()=>a("digitalClone"),onCreateNew:ge,onCancel:()=>a("typeSelection")}):g==="digitalClone"?l(Z,{digitalColleagues:se,onColleagueClone:de,onCancel:()=>a("digitalOptions")}):g==="form"?l(O,{colleague:G||void 0,onSave:J,onCancel:me,availableKnowledgeDocuments:P}):g==="view"?l(O,{colleague:A||void 0,onSave:J,onCancel:ce,readOnly:!0,availableKnowledgeDocuments:P}):l("div",{className:"px-2 md:px-4 py-4 space-y-8",children:l(xe,{mode:"wait",children:l(we.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:t("div",{className:`space-y-6 ${ie||""}`,children:[l(R,{title:"Colleagues",description:"Manage your team members and digital colleagues.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Add colleague",onClick:z}}),t("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t(c,{children:[t(h,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l(w,{className:"text-sm font-medium",children:"Total Colleagues"}),l(le,{className:"h-4 w-4 text-muted-foreground"})]}),t(u,{children:[l("div",{className:"text-2xl font-bold",children:s.length}),l("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]}),t(c,{children:[t(h,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l(w,{className:"text-sm font-medium",children:"Human Members"}),l(ye,{className:"h-4 w-4 text-muted-foreground"})]}),t(u,{children:[l("div",{className:"text-2xl font-bold",children:s.filter(e=>e.type==="human").length}),l("p",{className:"text-xs text-muted-foreground",children:"active"})]})]}),t(c,{children:[t(h,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l(w,{className:"text-sm font-medium",children:"Digital Colleagues"}),l(ve,{className:"h-4 w-4 text-muted-foreground"})]}),t(u,{children:[l("div",{className:"text-2xl font-bold",children:s.filter(e=>e.type==="digital").length}),l("p",{className:"text-xs text-muted-foreground",children:"0 active"})]})]})]}),l(c,{children:l(u,{className:"pt-6",children:t("div",{className:"flex flex-col md:flex-row gap-4",children:[l("div",{className:"flex-1",children:t("div",{className:"relative",children:[l(fe,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),l(Q,{placeholder:"Search colleagues...",value:d,onChange:e=>j(e.target.value),className:"pl-9"})]})}),t(U,{value:D,onValueChange:B,children:[l(k,{className:"w-full md:w-[180px]",children:l($,{placeholder:"Department"})}),t(F,{children:[l(p,{value:"all",children:"All Departments"}),ae.map(e=>l(p,{value:e,children:e},e))]})]}),t(U,{value:b,onValueChange:M,children:[l(k,{className:"w-full md:w-[140px]",children:l($,{placeholder:"Status"})}),t(F,{children:[l(p,{value:"all",children:"All Status"}),l(p,{value:"active",children:"Active"}),l(p,{value:"inactive",children:"Inactive"})]})]}),(d||D!=="all"||b!=="all")&&t(H,{variant:"outline",onClick:ue,className:"gap-2",children:[l(he,{className:"h-4 w-4"}),"Clear"]})]})})}),t("div",{className:"space-y-4",children:[l(X,{activeTab:v,onTabChange:oe,tabOptions:[{value:"all",label:`All (${f.length})`},{value:"human",label:`Human (${W.length})`},{value:"digital",label:`Digital (${q.length})`}],maxWidth:"400px",gridCols:3}),v==="all"&&l("div",{className:`grid gap-4 ${n?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:f.map(e=>l(x,{colleague:e,onEdit:T,onDelete:V,onViewDetails:E,compact:n},`${e}-${e.id}`))}),v==="human"&&l("div",{className:`grid gap-4 ${n?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:W.map(e=>l(x,{colleague:e,onEdit:T,onDelete:V,onViewDetails:E,compact:n},e.id))}),v==="digital"&&l("div",{className:`grid gap-4 ${n?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3"}`,children:q.map(e=>l(x,{colleague:e,onEdit:T,onDelete:V,onViewDetails:E,compact:n},e.id))})]}),f.length===0&&l(c,{children:l(u,{className:"pt-6",children:t("div",{className:"text-center py-8",children:[l(le,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),l("h3",{className:"text-lg font-semibold mb-2",children:"No colleagues found"}),l("p",{className:"text-muted-foreground mb-4",children:d||D!=="all"||b!=="all"?"Try adjusting your filters to see more results.":"Get started by adding your first colleague."}),t(H,{onClick:z,className:"gap-2",children:[l(Ce,{className:"h-4 w-4"}),"Add Colleague"]})]})})})]})},"projects-index-view")})})}export{Se as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as C}from"./chunk-WRZP5K5X.mjs";import{a as f}from"./chunk-V5VE3EIY.mjs";import{a as T,b,c as w}from"./chunk-5Y6FKL5W.mjs";import{a as y}from"./chunk-EW6KWAHS.mjs";import{a as h,b as P,c as k,d as I,e as R}from"./chunk-7JDMW5R3.mjs";import{a as x}from"./chunk-YPZAYXNQ.mjs";import{a as g}from"./chunk-RL6365DN.mjs";import{b as m}from"./chunk-ZUA4KNIR.mjs";import{b as N}from"./chunk-CSBGSBEU.mjs";import{a as l,b as u,c,e as d}from"./chunk-YO3GQYRJ.mjs";import{FileText as A,Image as E,File as L,Download as S,ExternalLink as U}from"lucide-react";import{jsx as t,jsxs as r}from"react/jsx-runtime";var $=n=>n.startsWith("image/")?t(E,{className:"h-4 w-4"}):n.startsWith("text/")?t(A,{className:"h-4 w-4"}):t(L,{className:"h-4 w-4"}),Z=({message:n,addToolResult:p,status:B,messages:H})=>n.parts.map((a,s)=>{if(a.type==="text")return t(y,{children:a.text},`${s}`);if(a.type==="file"){let e=a;return t("div",{className:"mb-2 p-2 bg-background/50 rounded-lg",children:r("div",{className:"flex items-center gap-2",children:[$(e.mediaType||"application/octet-stream"),t("div",{className:"flex-1 min-w-0",children:t("p",{className:"text-sm font-medium truncate",children:e.filename||e.url?.split("/").pop()||"File"})}),e.url&&t(m,{variant:"ghost",size:"sm",onClick:()=>window.open(e.url,"_blank"),className:"h-8 w-8 p-0",children:t(S,{className:"h-4 w-4"})})]})},s)}if(a.type.startsWith("tool-")){let e=a,i=a.type.replace("tool-","");if(i==="task")switch(e.state){case"input-available":return t("div",{className:"text-sm opacity-70",children:"Loading task..."},s);case"output-available":return t("div",{className:"mb-2",children:t(g,{data:{id:e.output?.id||e.input?.id,fetchLatest:!1,taskData:e.output||e.input}})},s);case"output-error":return r("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},s);default:return null}if(a.type==="tool-requestEndpointLogin")return t("div",{className:"mb-2",children:t(f,{toolPart:e,index:s,addToolResult:p??(()=>{})})},s);if(a.type==="tool-authenticate")return t("div",{className:"mb-2",children:t(f,{toolPart:e,index:s,addToolResult:p??(()=>{})})},s);if(a.type==="tool-requestApproval")return console.log("Rendering PartApprovalTool with toolPart:",e),t("div",{className:"mb-2",children:t(C,{toolPart:e,index:s,addToolResult:p??(()=>{})})},s);if(i==="artefact")switch(e.state){case"input-available":return t("div",{className:"text-sm opacity-70",children:"Loading artefact..."},s);case"output-available":return t("div",{className:"mb-2",children:t(x,{artefact:e.output?.description||"",taskId:e.output?.id||e.input?.id,taskData:e.output||e.input})},s);case"output-error":return r("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},s);default:return null}return t("div",{className:"mb-2",children:r(l,{className:"w-full max-w-md",children:[t(u,{children:t(c,{className:"text-lg",children:i})}),r(d,{children:[e.state==="input-available"&&r("p",{className:"text-sm",children:["Processing ",i,"..."]}),e.state==="output-available"&&t("pre",{className:"text-sm",children:JSON.stringify(e.output,null,2)}),e.state==="output-error"&&r("p",{className:"text-sm text-red-500",children:["Error: ",e.errorText]})]})]})},s)}if(a.type.startsWith("data-")){let e=a,i=a.type.replace("data-","");return i==="reference"?t("div",{className:"mb-2",children:t(l,{className:"w-full",children:t(d,{className:"p-4",children:t("div",{className:"space-y-2",children:e.data?.references?.map((o,v)=>r("div",{className:"flex items-center gap-2 p-2 rounded-md bg-muted/50",children:[t(N,{variant:"outline",children:o.type||"link"}),r("div",{className:"flex-1 min-w-0",children:[t("p",{className:"text-sm font-medium truncate",children:o.title}),o.description&&t("p",{className:"text-xs text-muted-foreground truncate",children:o.description})]}),o.url&&t(m,{variant:"ghost",size:"sm",onClick:()=>window.open(o.url,"_blank"),className:"h-8 w-8 p-0",children:t(U,{className:"h-4 w-4"})})]},v))})})})},s):i==="menu"?t("div",{className:"mb-2",children:r(l,{className:"w-full",children:[t(u,{children:t(c,{className:"text-lg",children:e.data?.title})}),t(d,{children:t("div",{className:"space-y-2",children:e.data?.items?.map((o,v)=>t(m,{variant:"outline",className:"w-full justify-start",onClick:o.action,children:r("div",{className:"text-left",children:[t("p",{className:"font-medium",children:o.label}),o.description&&t("p",{className:"text-xs text-muted-foreground",children:o.description})]})},v))})})]})},s):t("div",{className:"mb-2",children:r(l,{className:"w-full max-w-md",children:[t(u,{children:t(c,{className:"text-lg",children:i})}),t(d,{children:t("pre",{className:"text-sm",children:JSON.stringify(e.data,null,2)})})]})},s)}if(a.type==="reasoning")return r(T,{className:"w-full",isStreaming:B==="streaming"&&s===n.parts.length-1&&n.id===H.at(-1)?.id,children:[t(b,{}),t(w,{children:a.text})]},`${s}`);if(a.type==="dynamic-tool")return r(h,{defaultOpen:a.state!=="output-available",children:[t(P,{type:`tool-${a.toolName}`,state:a.state}),r(k,{children:[t(I,{input:a.input}),t(R,{output:a.output,errorText:a.errorText})]})]},`${n.id}-${s}`)});export{Z as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
import{a as S,b as w}from"./chunk-33CHGT4N.mjs";import{a as k}from"./chunk-CTC6WSB6.mjs";import{a as C}from"./chunk-H5VFV6Q4.mjs";import{a as g}from"./chunk-MZP7RIQZ.mjs";import{a as
|
|
4
|
+
import{a as S,b as w}from"./chunk-33CHGT4N.mjs";import{a as k}from"./chunk-CTC6WSB6.mjs";import{a as C}from"./chunk-H5VFV6Q4.mjs";import{a as g}from"./chunk-MZP7RIQZ.mjs";import{a as u}from"./chunk-MGSTQLZC.mjs";import{a as v}from"./chunk-6EKGV4I2.mjs";import{a as f}from"./chunk-VQBOJHZF.mjs";import{c as m,f as p}from"./chunk-MFUZNS7C.mjs";import{a as d}from"./chunk-2BR55L74.mjs";import{a as x}from"./chunk-6C4WESLL.mjs";import{a as N}from"./chunk-LAQ3QAUW.mjs";import{a as s}from"./chunk-7WIO2CIC.mjs";import{a as h}from"./chunk-FMJBJ3HN.mjs";import{a as n}from"./chunk-MDJREBVI.mjs";import{a as b}from"./chunk-WU3JMLSC.mjs";import{a as y}from"./chunk-BZAYEKYC.mjs";import z from"next/image";import{jsx as e,jsxs as o}from"react/jsx-runtime";var H=t=>({root:{type:"root",format:"",indent:0,version:1,children:[{type:"paragraph",format:"",indent:0,version:1,children:[{mode:"normal",text:t,type:"text",style:"",detail:0,format:0,version:1}],direction:"ltr",textStyle:"",textFormat:0}],direction:"ltr"}}),T=({children:t})=>e("div",{children:o("div",{className:"sticky top-0 h-screen",children:[t,e(s,{className:"text-black z-10",position:"header"})]})}),R=()=>o(T,{children:[o("video",{className:"fixed inset-0 object-cover w-full h-full z-0",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,children:[e("source",{src:"assets/videos/background2.mp4",type:"video/mp4"}),"Your browser does not support the video tag."]}),e("div",{className:"fixed inset-0 h-full z-10 flex flex-col items-start justify-center text-white px-4",children:e(h,{children:o("div",{className:"flex flex-col items-start md:w-1/2 mb-10 z-0 md:mb-0",children:[e("h1",{className:"text-5xl md:text-7xl mb-6",children:"Lorum ipsum."}),e("div",{className:"text-lg md:text-2xl text-gray-300 mb-8 max-w-lg",children:"Lorum ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec dui ac odio."})]})})})]}),L={highImpact:u,lowImpact:v,mediumImpact:f,sectionHero:g,dummy:R};function P({...t}){let i=t.style;return o("div",{className:"relative overflow-y-none scroll-smooth snap-y snap-mandatory",children:[e(N,{isMenuOpen:!0,logoLight:y,logoDark:b,...t.header}),e(I,{...t.hero}),e(c,{theme:"light",style:i,children:e(k,{...t.service})}),e(c,{theme:"dark",style:i,image:t.service.services[0].image,children:e(j,{})}),e(c,{theme:"light",style:i,children:e(j,{})}),e(c,{theme:"dark",style:i,children:e(S,{...t.contact})}),e(c,{theme:"light",style:i,children:e(w,{...t.contact})}),e(c,{theme:"last",style:i,children:e(C,{...t.blog})}),e(m,{...t.cta}),e(x,{...t.footer})]})}var I=t=>{let{type:i}=t||{};if(!i||i==="none")return null;let l=L[i];return l?e(l,{...t}):null},j=()=>{let t={blurDataURL:"/assets/props/Cortex-Handshake-BG.jpg",height:1315,url:"/assets/props/Cortex-Handshake-BG.jpg",width:1920};return e("div",{className:"container",children:o("div",{className:"w-full grid grid-cols-1 md:grid-cols-2 gap-1 items-center justify-center",children:[o("div",{className:n("w-full text-left"),children:[e("h2",{className:"text-3xl md:text-5xl text-primary",children:"Lorum ipsum..."}),e("p",{className:"mt-4 text-gray-700 text-lg",children:e(p,{enableGutter:!1,content:H("Lorum ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec dui ac odio. Nulla facilisi. Nullam nec nisi nec odio ultricies ultricies. Nullam nec nisi nec odio ultricies ultricies. Nullam nec nisi nec odio ultricies ultricies. Lorum ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec dui ac odio. Nulla facilisi. Nullam nec nisi nec odio ultricies ultricies. Nullam nec nisi nec odio ultricies ultricies. Nullam nec nisi nec odio ultricies ultricies."),enableProse:!1,className:n("prose prose-headings:text-foreground prose-p:text-foreground")})}),e("button",{className:"mt-6 px-6 py-3 border border-1 border-accent text-foreground rounded-full text-base hover:bg-accent hover:text-accent-foreground transition",children:"Click here"})]}),e("div",{className:"w-full h-full min-h-96 p-6 md:p-6 flex justify-center",children:e(z,{src:t.url,alt:"image",width:t.width,height:t.height,className:"max-w-full"})})]})})},c=({children:t,theme:i,style:l,neighbours:M,shape:D,image:B,id:r,continueTheme:F})=>{let G=a=>o("div",{className:"select-none",children:[a&&typeof a=="object"&&e(d,{fill:!0,imgClassName:"z-5 object-cover",priority:!1,loading:"lazy",resource:a}),a&&typeof a=="string"&&e("div",{children:e(z,{className:"-z-10 object-cover",alt:"",fill:!0,priority:!0,src:a})})]});if(i==="dark"&&l==="slide")return e("section",{id:r||"next-section",className:"sticky md:top-0 h-screen",children:o("div",{className:"dark pt-0 min-h-[80vh]",children:[e(s,{className:"z-10",position:"dark-top"}),o("div",{className:"relative",children:[e("div",{className:"flex items-center bg-black justify-center pt-12",children:e("div",{className:"container",children:t})}),e(s,{className:"z-10",position:"dark-bottom"})]})]})});if(i==="light"&&l==="slide")return e("section",{id:r||"next-section",className:"sticky top-0 light pt-0 h-screen",children:o("div",{className:"sticky top-0 light pt-0 h-screen",children:[e(s,{className:"z-10",position:"light-top"}),o("div",{className:"relative bg-white",children:[e("div",{className:"flex items-center bg-white justify-center pt-12",children:e("div",{className:"container",children:t})}),e("div",{className:"h-[200px] bg-white"})]})]})});if(i==="first")return e("section",{id:r||"next-section",className:"",children:e("div",{className:"sticky top-0 light bg-background pt-6 min-h-[80vh]",children:o("div",{className:"relative",children:[e("div",{className:"flex items-center justify-center pt-12",children:e("div",{className:"container",children:t})}),e(s,{className:"text-black z-10",position:"bottom-right"})]})})});if(i==="light")return e("section",{id:r||"next-section",className:"",children:e("div",{className:n("sticky top-0 light bg-background min-h-[50vh]","pb-10"),children:e("div",{className:"flex items-center pt-8 justify-center",children:e("div",{className:"container",children:t})})})});if(i==="dark")return e("section",{id:r||"next-section",className:"",children:o("div",{className:"sticky -top-[1px] dark min-h-[80vh] bg-white",children:[e(s,{className:"text-black z-10",position:"bottom-right"}),e("div",{className:"flex items-center justify-center pt-12 bg-black",children:e("div",{className:"container",children:t})}),e(s,{className:"text-accent z-10",position:"top"})]})});if(i==="last")return e("section",{id:r||"next-section",className:"",children:o("div",{className:"sticky -top-[1px] dark min-h-[80vh] bg-white",children:[e(s,{className:"text-black z-10",position:"bottom-right"}),e("div",{className:"flex items-center justify-center pb-12 bg-black min-h-[80vh]",children:e("div",{className:"container",children:t})})]})})};export{P as a,c as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
import{a as b}from"./chunk-CTTBF7F4.mjs";import{a as I}from"./chunk-56X4PU43.mjs";import{a as S}from"./chunk-
|
|
4
|
+
import{a as b}from"./chunk-CTTBF7F4.mjs";import{a as I}from"./chunk-56X4PU43.mjs";import{a as S}from"./chunk-WAVVCASZ.mjs";import{useChat as me}from"@ai-sdk/react";import{useState as l}from"react";import{motion as fe,AnimatePresence as he}from"motion/react";import{Users as ye}from"lucide-react";import{jsx as n,jsxs as Ce}from"react/jsx-runtime";function Le({aiConfig:w,useCustomChat:F,enableAI:T=!0,messages:D=[],businessUnits:R=[],capabilities:B=[],sidebarItems:x=[],notifications:N=[],sessions:M=[],onNewChat:A,onSessionSelect:L,onSessionDelete:P,onSessionEdit:k=()=>{},onBusinessUnitChange:E=()=>{},onNotificationRemove:K=()=>{},onRemoveAll:O=()=>{},onActionClick:$=()=>{},onSearch:q=p=>console.log("Search query:",p),initialTeam:z="design",currentSession:m=null,showCapabilities:ve=!0,title:W="Digital Colleagues",enableFileUpload:f=!0,maxFileSize:h=10,allowedFileTypes:y=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:H="/headerlogo.png",appName:X="Nuvia",tagline:G="AI-Powered Workspace",actionIcon:J=n(ye,{className:"mr-2 h-4 w-4"}),actionText:Q="Collaborate",sidebarInitiallyClosed:V=!1}){let p={...w,onError:e=>{i?.setMessages(t=>[...t,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:e.message}]}]),console.error("Error in CopilotInterface:",e)}},Y=me(p||{}),i=T?F||Y:null,[Z,u]=l(""),[_,C]=l(!1),j=i?.messages||D,r=Z,ee=i?.status==="submitted"||_,se=i?.addToolResult?(e,t,s)=>{i.addToolResult({tool:t,toolCallId:e,output:s}),console.log("Tool result added:",{toolCallId:e,tool:t,output:s}),i.sendMessage()}:()=>{console.log("addToolResult not available")},o=R||[],te={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[ie,ne]=l(()=>o.length===0?te:o.find(e=>e.id===z)||o[0]),[a,c]=l([]),[oe,ae]=l(!1),le=e=>{if(!e||!f)return;let t=[];Array.from(e).forEach(s=>{if(s.size>h*1024*1024){alert(`File ${s.name} is too large. Maximum size is ${h}MB.`);return}if(y.length>0&&!y.some(d=>s.type.match(d))){alert(`File type ${s.type} is not allowed.`);return}let U={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:s,status:"pending",progress:0};if(s.type.startsWith("image/")){let d=new FileReader;d.onload=ue=>{c(ge=>ge.map(g=>g.id===U.id?{...g,preview:ue.target?.result}:g))},d.readAsDataURL(s)}t.push(U)}),c(s=>[...s,...t])},re=e=>{c(t=>t.filter(s=>s.id!==e))},v=()=>{if(!(!r.trim()&&a.length===0)){if(i){let e=a.length>0?ce(a.map(t=>t.file)):void 0;i.sendMessage({text:r,files:e},{body:{timestamp:Date.now()}}),u("")}else console.log("Message to send:",r),console.log("Files to upload:",a),u(""),C(!0),setTimeout(()=>{C(!1)},1500);c([])}},ce=e=>{let t=new DataTransfer;return e.forEach(s=>t.items.add(s)),t.files},de=e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),v())},pe=e=>{u(e)};return n(b,{sidebarItems:x||[],title:W,notifications:N||[],businessUnits:o,currentBusinessUnit:ie,onBusinessUnitChange:e=>{e&&(ne(e),E?.(e))},onSearch:q,showTabs:!1,onActionClick:$,actionIcon:J,actionText:Q,onNotificationRemove:K,onRemoveAll:O,logo:H,appName:X,tagline:G,sidebarInitiallyClosed:V,children:n(he,{mode:"wait",children:n(fe.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:Ce("div",{className:"h-full flex",children:[n("div",{className:"w-80 flex-shrink-0 h-full p-2",children:n(I,{sessions:M||[],currentSession:m,teams:o,onNewChat:A,onSessionSelect:L,onSessionEdit:k,onSessionDelete:P})}),n("div",{className:"flex-1 h-full p-2",children:n(S,{messages:j||[],input:r,isTyping:ee,currentSessionTitle:m?.title,capabilities:B||[],onInputChange:pe,addToolResult:se,onSendMessage:v,onKeyPress:de,fileUploads:a,isDragOver:oe,enableFileUpload:f,onFileUpload:le,onRemoveFile:re,onDragOver:ae})})]})},"chat-interface")})})}export{Le as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
import{a as N}from"./chunk-
|
|
4
|
+
import{a as N}from"./chunk-275W7H4O.mjs";import{a as x}from"./chunk-3ZQFJ5WD.mjs";import{a as f,b as y}from"./chunk-I4GYQZGM.mjs";import{a as g}from"./chunk-CRAFZGCI.mjs";import{a as n}from"./chunk-R4SE63GR.mjs";import{a as b}from"./chunk-KPTGYVDM.mjs";import{a as u}from"./chunk-JXQRVEQB.mjs";import{a as r,b as h,d as v}from"./chunk-DXRAJQMA.mjs";import{a}from"./chunk-Z22NSJMF.mjs";import{useState as C}from"react";import{motion as G,AnimatePresence as Y}from"motion/react";import{Bot as z}from"lucide-react";import{jsx as e,jsxs as o}from"react/jsx-runtime";function K({title:k="Digital Colleagues",businessUnits:c,projects:m,fileCount:A,teamMemberCount:w,onCreateProject:P,onOpenProject:j,sidebarItems:W,initialColleagues:F,users:T,onColleagueAdd:S,onColleagueEdit:U,onColleagueDelete:I}){let[i,s]=C("home"),[l,O]=C(c[0]),d=t=>{console.log("Opening app:",t.name)},p=t=>{console.log("Favoriting app:",t.name)},B=t=>{console.log("Opening file:",t.name)},_=t=>{console.log("Sharing file:",t.name)},D=t=>{console.log("Opening project:",t.name),j(t)},R=t=>{console.log("Sharing project:",t.name)},L=t=>{O(t),console.log("Business unit changed to:",t.name)},E=()=>{console.log("Copilot clicked - navigating to chat"),s("chat")},H=t=>{console.log("Notification removed:",t)},M=()=>{console.log("All notifications removed")},V=()=>{switch(i){case"home":return o("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[o("section",{className:"text-center py-12",children:[o("h1",{className:"text-4xl font-bold mb-4",children:["Welcome to the ",l.name," team"]}),e("p",{className:"text-xl text-muted-foreground mb-8",children:"This is your collaborative workspace for productivity and knowledge sharing."})]}),o("section",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[o("div",{className:"bg-card p-6 rounded-lg border",children:[e("h3",{className:"text-lg font-semibold mb-2",children:"Projects"}),e("p",{className:"text-3xl font-bold text-primary",children:m.length}),e("p",{className:"text-sm text-muted-foreground",children:"Active projects"})]}),o("div",{className:"bg-card p-6 rounded-lg border",children:[e("h3",{className:"text-lg font-semibold mb-2",children:"Team Members"}),e("p",{className:"text-3xl font-bold text-primary",children:w}),e("p",{className:"text-sm text-muted-foreground",children:"Collaborators"})]}),o("div",{className:"bg-card p-6 rounded-lg border",children:[e("h3",{className:"text-lg font-semibold mb-2",children:"Files"}),e("p",{className:"text-3xl font-bold text-primary",children:A}),e("p",{className:"text-sm text-muted-foreground",children:"Project files"})]})]}),e(a,{title:"Chat with your team",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Go",onClick:()=>s("chat")}})]});case"colleagues":return e(N,{initialColleagues:F,availableUsers:T,onColleagueAdd:S,onColleagueEdit:U,onColleagueDelete:I});case"chat":return o("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[o("section",{className:"text-center py-12",children:[e("h1",{className:"text-4xl font-bold mb-4",children:"Team Chat"}),o("p",{className:"text-xl text-muted-foreground mb-8",children:["Connect with your ",l.name," team members and collaborate in real-time."]})]}),e(a,{title:"Launch Full Chat Interface",description:"Access the complete chat experience with AI assistance.",gradient:"bg-gradient-to-r from-blue-600 via-purple-600 to-pink-600",primaryAction:{label:"Open Chat",onClick:()=>console.log("Open full chat interface")}})]});case"apps":return o("div",{className:"space-y-8",children:[e(a,{title:"Creative Apps Collection",description:"Discover our full suite of professional design and creative applications.",gradient:"bg-gradient-to-r from-pink-600 via-red-600 to-orange-600",primaryAction:{label:"Install Desktop App",onClick:()=>console.log("Install desktop app clicked")}}),o("section",{className:"space-y-4",children:[e("h2",{className:"text-2xl font-semibold",children:"New Releases"}),e("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:r.filter(t=>t.new).map(t=>e(n,{app:t,showProgress:!0,onOpen:d,onFavorite:p},t.name))})]}),o("section",{className:"space-y-4",children:[e("h2",{className:"text-2xl font-semibold",children:"All Apps"}),e("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:r.map(t=>e(n,{app:t,onOpen:d,onFavorite:p},t.name))})]})]});case"knowledge":return e(x,{});case"files":return o("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[e(a,{title:"Your Creative Files",description:"Access, manage, and share all your design files in one place.",gradient:"bg-gradient-to-r from-teal-600 via-cyan-600 to-blue-600",primaryAction:{label:"Upload Files",onClick:()=>console.log("Upload files clicked")}}),o("section",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:e("h2",{className:"text-2xl font-semibold",children:"All Files"})}),e(u,{files:h,onFileClick:B})]})]});case"projects":return o("div",{className:"px-2 md:px-4 py-4 space-y-8",children:[e(a,{title:"Project Management",description:"Organize your creative work into projects and collaborate with your team.",gradient:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600",primaryAction:{label:"New Project",onClick:P}}),o("section",{className:"space-y-4",children:[e("h2",{className:"text-2xl font-semibold",children:"Active Projects"}),e("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:m.map(t=>e(b,{project:t,onOpen:D,onShare:R},t.name))})]})]});case"learn":return o("div",{className:"space-y-8",children:[e(a,{title:"Learn & Grow",description:"Expand your creative skills with tutorials, courses, and resources.",gradient:"bg-gradient-to-r from-green-600 via-emerald-600 to-teal-600",primaryAction:{label:"Upgrade to Pro",onClick:()=>console.log("Upgrade to pro clicked")}}),o("section",{className:"space-y-4",children:[e("h2",{className:"text-2xl font-semibold",children:"Featured Tutorials"}),e("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3",children:v.slice(0,3).map(t=>o("div",{className:"rounded-3xl border p-6",children:[e("h3",{className:"font-semibold mb-2",children:t.title}),e("p",{className:"text-sm text-muted-foreground mb-4",children:t.description}),o("div",{className:"flex items-center justify-between text-sm",children:[e("span",{children:t.duration}),e("span",{children:t.level})]})]},t.title))})]})]});default:return null}};return e(g,{sidebarItems:f,title:k,notifications:y,businessUnits:c,currentBusinessUnit:l,onBusinessUnitChange:L,activeTab:i,onTabChange:s,showTabs:!0,onActionClick:E,actionIcon:e(z,{className:"mr-2 h-4 w-4"}),actionText:"Start Chat",onNotificationRemove:H,onRemoveAll:M,children:e(Y,{mode:"wait",children:e(G.div,{className:"flex-1 h-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:V()},i)})})}export{K as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R}from"./chunk-
|
|
1
|
+
import{a as R}from"./chunk-347B45ZS.mjs";import{a as S,b as z}from"./chunk-7TSR2LQB.mjs";import{a as F}from"./chunk-2LINLX4S.mjs";import{d as y}from"./chunk-Q2DPE66H.mjs";import{a as B}from"./chunk-FT3AE7L2.mjs";import{a as E}from"./chunk-L5JPAKPM.mjs";import{b as s}from"./chunk-ZUA4KNIR.mjs";import{a as b,c as x}from"./chunk-SOLZ4VQH.mjs";import{a as A}from"./chunk-MDJREBVI.mjs";import{useRef as N,useEffect as T,useState as O}from"react";import*as l from"motion/react-client";import{Send as ie,Bot as H,Menu as oe,Paperclip as se,X as ne,FileText as le,Image as re,File as ce}from"lucide-react";import{jsx as t,jsxs as i}from"react/jsx-runtime";function ke({messages:r,input:C,isTyping:d=!1,currentSessionTitle:L,capabilities:u,fileUploads:f,isDragOver:$,enableFileUpload:w,onInputChange:P,addToolResult:K,onSendMessage:U,onKeyPress:V,onFileUpload:k,onRemoveFile:J,onDragOver:p,className:Q,status:W="ready"}){let g=N(null),G=N(null),I=N(null),[n,c]=O(!1),[v,me]=O({path:[],selectedItems:[],filters:{}});T(()=>{g.current?.scrollIntoView({behavior:"smooth"})},[r]),T(()=>{n&&setTimeout(()=>{g.current?.scrollIntoView({behavior:"smooth"})},100)},[n]);let M=()=>y(v),D=()=>{let e=[];return u.forEach(a=>{a.actions&&a.actions.forEach(o=>{e.push({label:o.label,action:()=>h(o.id,{path:[a],selectedItems:[],filters:{}})})}),a.children&&a.children.forEach(o=>{o.type==="list"&&o.data&&e.push({label:`View ${o.name}`,action:()=>c(!0)})})}),e.slice(0,5)},h=(e,a)=>{console.log("Capability action:",e,a);let o=`Executing ${e} with context: ${JSON.stringify(a.path.map(m=>m.name))}`;c(!1)},X=y({path:[],selectedItems:[],filters:{}}),q=e=>{k(e.target.files),e.target.files&&(e.target.value="")},Y=e=>{e.preventDefault(),p(!0)},Z=e=>{e.preventDefault(),p(!1)},_=e=>{e.preventDefault(),p(!1),k(e.dataTransfer.files)},j=e=>{if(e===0)return"0 Bytes";let a=1024,o=["Bytes","KB","MB","GB"],m=Math.floor(Math.log(e)/Math.log(a));return parseFloat((e/Math.pow(a,m)).toFixed(2))+" "+o[m]},ee=e=>e.startsWith("image/")?t(re,{className:"h-4 w-4"}):e.startsWith("text/")?t(le,{className:"h-4 w-4"}):t(ce,{className:"h-4 w-4"}),te={messages:r,currentSessionTitle:L,capabilities:u,currentCapabilityContext:v,contextualActions:X,getQuickSuggestions:D().map(e=>e.label)},ae=()=>{navigator.clipboard.writeText(JSON.stringify(te,null,2)),alert("Debug info copied to clipboard")};return i("div",{className:`h-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${Q||""}`,children:[i(B,{ref:G,className:"flex-1 p-4 bg-background border-0",onDragOver:Y,onDragLeave:Z,onDrop:_,children:[i("div",{className:A("space-y-4",$&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[t(l.animate,{children:r.map(e=>t(l.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:t(S,{from:e.role,children:t(z,{variant:"flat",children:R({message:e,addToolResult:K??(()=>{}),status:W,messages:r})})},e.id)},e.id))}),n&&i(l.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[t(b,{className:"h-8 w-8",children:t(x,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:t(H,{className:"h-4 w-4"})})}),t("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:t(F,{capabilities:u,isOpen:n,onToggle:()=>c(!n),onActionSelect:h,className:"w-full"})})]}),d&&i(l.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[t(b,{className:"h-8 w-8",children:t(x,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:t(H,{className:"h-4 w-4"})})}),t("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:i("div",{className:"flex space-x-1",children:[t("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce"}),t("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),t("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),t("div",{ref:g})]}),f.length>0&&t("div",{className:"p-4 border-t bg-muted/10",children:t("div",{className:"flex flex-wrap gap-2",children:f.map(e=>i("div",{className:"flex items-center gap-2 bg-background rounded-lg p-2 border",children:[ee(e.file.type),t("span",{className:"text-sm font-medium",children:e.file.name}),t("span",{className:"text-xs text-muted-foreground",children:j(e.file.size)}),t(s,{variant:"ghost",size:"sm",onClick:()=>J(e.id),className:"h-6 w-6 p-0",children:t(ne,{className:"h-4 w-4"})})]},e.id))})}),i("div",{className:"border rounded-2xl p-4 bg-muted/20",children:[i("div",{className:"flex gap-3",children:[t(E,{value:C,onChange:e=>P(e.target.value),onKeyPress:V,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:d}),w&&t(s,{variant:"outline",size:"icon",onClick:()=>I.current?.click(),className:"rounded-2xl h-10 w-10 shadow-sm",children:t(se,{className:"h-4 w-4"})}),t(s,{onClick:U,disabled:!C.trim()&&f.length===0||d,size:"icon",className:"rounded-2xl h-10 w-10 shadow-sm",children:t(ie,{className:"h-4 w-4"})})]}),i("div",{className:"flex items-center gap-3 mt-3",children:[i(s,{onClick:()=>c(!n),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[t(oe,{className:"h-3 w-3 mr-1"}),n?"Hide":"Show"," Capabilities"]}),i("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[M().map((e,a)=>t(s,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>h(e.id,v),children:e.label},`context-${e.id}`)),M().length===0&&D().map((e,a)=>t(s,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:e.action,children:e.label},`suggestion-${a}`)),t(s,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:ae,children:"Debug"})]})]}),w&&t("input",{ref:I,type:"file",multiple:!0,onChange:q,className:"hidden"})]})]})}export{ke as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./chunk-6OT5PQXV.mjs";import p from"react";import{Fragment as c,jsx as t,jsxs as r}from"react/jsx-runtime";var y=({toolPart:e,index:n,addToolResult:s})=>{let[a,o]=p.useState(!0),[i,l]=p.useState(null),u=()=>{s(e.toolCallId,e.type,"Approved"),o(!1),l("approve")},v=()=>{s(e.toolCallId,e.type,"Denied"),o(!1),l("deny")};switch(e.state){case"input-available":return r("div",{className:"mb-2",children:[t(d,{isOpen:a,onApprove:u,onDeny:v,onClose:()=>o(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&r(c,{children:[i==="approve"&&t("div",{className:"flex items-center justify-center mt-3",children:r("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[t("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&t("div",{className:"flex items-center justify-center mt-3",children:r("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[t("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},n);case"output-error":return r("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},n);default:return null}};export{y as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-MZP7RIQZ.mjs";import{a as
|
|
1
|
+
import{a as n}from"./chunk-MZP7RIQZ.mjs";import{a as i}from"./chunk-MGSTQLZC.mjs";import{a as l}from"./chunk-6EKGV4I2.mjs";import{a as m}from"./chunk-VQBOJHZF.mjs";import{ChevronRightIcon as c,HomeIcon as f}from"@heroicons/react/20/solid";import{Fragment as h,jsx as e,jsxs as a}from"react/jsx-runtime";var d={highImpact:i,lowImpact:l,mediumImpact:m,sectionHero:n},H=t=>{let{type:o}=t||{};if(!o||o==="none")return null;let r=d[o];return r?e(r,{...t}):null};function N({breadcrumbItems:t}){if(t&&t.length>0){let o=t.filter(r=>r.label.toLowerCase()!=="home");return e("nav",{"aria-label":"Breadcrumb",className:"flex",children:a("ol",{role:"list",className:"flex items-center space-x-4",children:[e("li",{children:e("div",{children:a("a",{href:"/",className:"text-foreground hover:text-accent",children:[e(f,{"aria-hidden":"true",className:"size-5 shrink-0"}),e("span",{className:"sr-only",children:"Home"})]})})}),o.map((r,s)=>e("li",{children:a("div",{className:"flex items-center",children:[e(c,{"aria-hidden":"true",className:"size-5 shrink-0 text-gray-400"}),r.href?e("a",{href:r.href,className:"ml-4 text-sm font-medium text-foreground hover:text-accent",children:r.label}):e("div",{className:"ml-4 text-sm font-medium text-foreground hover:text-accent",children:r.label})]})},s))]})})}return e(h,{})}export{H as a,N as b};
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
`,children:n?"Processing...":"Deny"}),(0,Be.jsx)("button",{onClick:h,disabled:n,className:`
|
|
19
19
|
px-4 py-2 text-white border-none rounded text-sm
|
|
20
20
|
${n?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
|
|
21
|
-
`,children:"Cancel"})]})]}):null};var Dt=({toolPart:e,index:t,addToolResult:o})=>{let[r,s]=tt.default.useState(!0),[a,n]=tt.default.useState(null),i=()=>{o(e.input?.toolCallId,e.input?.tool,"Approved"),s(!1),n("approve")},c=()=>{o(e.input?.toolCallId,e.input?.tool,"Denied"),s(!1),n("deny")};switch(e.state){case"input-available":return(0,Be.jsxs)("div",{className:"mb-2",children:[(0,Be.jsx)(Lt,{isOpen:r,onApprove:i,onDeny:c,onClose:()=>s(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!r&&(0,Be.jsxs)(Be.Fragment,{children:[a==="approve"&&(0,Be.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Be.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Be.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Be.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),a==="deny"&&(0,Be.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Be.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Be.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Be.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Be.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var ot=require("@radix-ui/react-use-controllable-state");var he=V(require("@radix-ui/react-collapsible")),He=he.Root,Oe=he.CollapsibleTrigger,Fe=he.CollapsibleContent;var zt=require("streamdown"),Te=(0,_.memo)(({className:e,...t})=>(0,Be.jsx)(zt.Streamdown,{className:d("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);Te.displayName="Response";var Ht=(0,_.createContext)(null),_o=()=>{let e=(0,_.useContext)(Ht);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},qo=1e3,Ko=1e3,rt=(0,_.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:r=!0,onOpenChange:s,duration:a,children:n,...i})=>{let[c,g]=(0,ot.useControllableState)({prop:o,defaultProp:r,onChange:s}),[h,f]=(0,ot.useControllableState)({prop:a,defaultProp:0}),[v,R]=(0,_.useState)(!1),[P,x]=(0,_.useState)(null);(0,_.useEffect)(()=>{t?P===null&&x(Date.now()):P!==null&&(f(Math.ceil((Date.now()-P)/Ko)),x(null))},[t,P,f]),(0,_.useEffect)(()=>{if(r&&!t&&c&&!v){let C=setTimeout(()=>{g(!1),R(!0)},qo);return()=>clearTimeout(C)}},[t,c,r,g,v]);let y=C=>{g(C)};return(0,Be.jsx)(Ht.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:g,duration:h},children:(0,Be.jsx)(He,{className:d("not-prose mb-4",e),onOpenChange:y,open:c,...i,children:n})})}),Jo=(e,t)=>e||t===0?(0,Be.jsx)("Be",{children:"Thinking..."}):t===void 0?(0,Be.jsx)("Be",{children:"Thought for a few seconds"}):(0,Be.jsxs)("Be",{children:["Thought for ",t," seconds"]}),at=(0,_.memo)(({className:e,children:t,...o})=>{let{isStreaming:r,isOpen:s,duration:a}=_o();return(0,Be.jsx)(Oe,{className:d("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(I.BrainIcon,{className:"size-4"}),Jo(r,a),(0,Be.jsx)(I.ChevronDownIcon,{className:d("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),nt=(0,_.memo)(({className:e,children:t,...o})=>(0,Be.jsx)(Fe,{className:d("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,Be.jsx)(Te,{className:"grid gap-2",children:t})}));rt.displayName="Reasoning";at.displayName="ReasoningTrigger";nt.displayName="ReasoningContent";var st=require("react-syntax-highlighter"),Ge=require("react-syntax-highlighter/dist/esm/styles/prism"),Qo=(0,_.createContext)({code:""}),$e=({code:e,language:t,showLineNumbers:o=!1,className:r,children:s,...a})=>(0,Be.jsx)(Qo.Provider,{value:{code:e},children:(0,Be.jsx)("div",{className:d("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",r),...a,children:(0,Be.jsxs)("div",{className:"relative",children:[(0,Be.jsx)(st.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ge.oneLight,children:e}),(0,Be.jsx)(st.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ge.oneDark,children:e}),s&&(0,Be.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:s})]})})});var Ft=({className:e,...t})=>(0,Be.jsx)(He,{className:d("not-prose mb-4 w-full",e),...t}),Xo=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Be.jsxs)(X,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Be.jsx)(I.CircleIcon,{className:"size-4"}),"input-available":(0,Be.jsx)(I.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Be.jsx)(I.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Be.jsx)(I.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Vt=({className:e,type:t,state:o,...r})=>(0,Be.jsxs)(Oe,{className:d("flex w-full items-center justify-between gap-4 Be-3 pl-0 w-2xl",e),...r,children:[(0,Be.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Be.jsx)(I.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Be.jsx)("span",{className:"font-medium text-sm",children:t}),Xo(o)]}),(0,Be.jsx)(I.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Ut=({className:e,...t})=>(0,Be.jsx)(Fe,{className:d("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Gt=({className:e,input:t,...o})=>(0,Be.jsxs)("div",{className:d("space-y-2 overflow-hidden Be-4",e),...o,children:[(0,Be.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Be.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Be.jsx)($e,{code:JSON.stringify(t,null,2),language:"json"})})]}),$t=({className:e,output:t,errorText:o,...r})=>{if(!(t||o))return null;let s=(0,Be.jsx)("div",{children:t});return typeof t=="object"?s=(0,Be.jsx)($e,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(s=(0,Be.jsx)($e,{code:t,language:"json"})),(0,Be.jsxs)("div",{className:d("space-y-2 Be-4",e),...r,children:[(0,Be.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Be.jsxs)("div",{className:d("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,Be.jsx)("div",{children:o}),s]})]})};var de=V(require("react"));var $=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("rounded-xl border bg-card text-card-foreground shadow",e),...t}));$.displayName="Card";var te=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("flex flex-col space-y-1.5 Be-6",e),...t}));te.displayName="CardHeader";var oe=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("font-semibold leading-none tracking-tight",e),...t}));oe.displayName="CardTitle";var it=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("text-sm text-muted-foreground",e),...t}));it.displayName="CardDescription";var j=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("Be-6 pt-0",e),...t}));j.displayName="CardContent";var Re=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("flex items-center Be-6 pt-0",e),...t}));Re.displayName="CardFooter";var _t=require("date-fns");function jt({taskId:e,polling:t=!0,system:o="payload"}){let[r,s]=(0,_.useState)(null),[a,n]=(0,_.useState)(!1),[i,c]=(0,_.useState)(null),g=async(f=!0)=>{if(e){f&&n(!0);try{let v=await fetch(`/api/tasks/${e}`);if(!v.ok)throw new Error(`Failed to fetch task: ${v.statusText}`);let R=await v.json();s(R)}catch(v){console.error("Error fetching task:",v),c(v instanceof Error?v:new Error("Unknown error occurred"))}finally{f&&n(!1)}}},h=()=>g(!1);return(0,_.useEffect)(()=>{e&&g(!0);let f=null;return e&&t&&(f=setInterval(h,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:r,loading:a,error:i}}var Yo=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},Zo=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function qt({data:e}){let{id:t,system:o,fetchLatest:r,taskData:s,error:a}=e||{};if(!t)return null;let n=null,i=!0,c=a,g=r!==void 0?r:!0;if(n=s||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:r,system:o,fetchLatest:g,taskData:n,error:c}),g){let{task:R,loading:P,error:x}=jt({taskId:t,system:o});n=R,i=P,c=x}else i=!1;let h=Yo(n?.status||"todo"),f=Zo(n?.status||"todo"),v=n?.dateLogged||new Date().toISOString();try{let R=new Date(n?.dateLogged||"");isNaN(R.getTime())||(v=(0,_t.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Be.jsxs)($,{className:d("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Be.jsxs)(te,{className:"pb-2",children:[(0,Be.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Be.jsx)(oe,{className:"text-lg font-semibold",children:i?"Loading...":n?.name||"Task"}),(0,Be.jsx)(X,{className:`${h}`,children:f})]}),n?.project&&(0,Be.jsxs)(it,{className:"text-sm text-gray-500",children:["Project: ",n.project.name]})]}),(0,Be.jsx)(j,{className:"pb-2",children:i?(0,Be.jsx)("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Be.jsx)("Be",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Be.jsx)("Be",{className:"text-sm text-foreground",children:n?.description||"......."})}),(0,Be.jsx)(Re,{className:"pt-2 flex items-center justify-between",children:(0,Be.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Be.jsx)(I.Clock,{className:"h-3 w-3 mr-1"}),(0,Be.jsxs)("span",{children:["Created ",v]}),(0,Be.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Be.jsxs)("span",{children:["Task #",t]})]})})]})}function Qt({artefact:e,taskId:t,taskData:o,loading:r=!1,error:s=null}){let a=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},n=a.dateLogged;try{let i=new Date(a.dateLogged);isNaN(i.getTime())||(n=(0,_t.formatDistanceToNow)(i,{addSuffix:!0}))}catch{}return(0,Be.jsxs)($,{className:"w-full max-w-md shadow-md",children:[(0,Be.jsx)(te,{className:"pb-2",children:(0,Be.jsx)("div",{className:"flex justify-between items-start",children:(0,Be.jsx)(oe,{className:"text-lg font-semibold",children:r?"Loading...":a.name})})}),(0,Be.jsx)(j,{className:"pb-2",children:r?(0,Be.jsx)("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4 mb-2"}):s?(0,Be.jsx)("Be",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Be.jsx)("Be",{className:"text-sm text-foreground",children:e})}),(0,Be.jsx)(Re,{className:"pt-2 flex items-center justify-between",children:(0,Be.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Be.jsx)(I.Clock,{className:"h-3 w-3 mr-1"}),(0,Be.jsxs)("span",{children:["Created ",n]}),(0,Be.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Be.jsxs)("span",{children:["Task #",a.id]})]})})]})}var er=e=>e.startsWith("image/")?(0,Be.jsx)(I.Image,{className:"h-4 w-4"}):e.startsWith("text/")?(0,Be.jsx)(I.FileText,{className:"h-4 w-4"}):(0,Be.jsx)(I.File,{className:"h-4 w-4"}),Xt=({message:e,addToolResult:t,status:o,messages:r})=>e.parts.map((s,a)=>{if(s.type==="text")return(0,Be.jsx)(Te,{children:s.text},`${a}`);if(s.type==="file"){let n=s;return(0,Be.jsx)("div",{className:"mb-2 Be-2 bg-background/50 rounded-lg",children:(0,Be.jsxs)("div",{className:"flex items-center gap-2",children:[er(n.mediaType||"application/octet-stream"),(0,Be.jsx)("div",{className:"flex-1 min-w-0",children:(0,Be.jsx)("Be",{className:"text-sm font-medium truncate",children:n.filename||n.url?.split("/").pop()||"File"})}),n.url&&(0,Be.jsx)(z,{variant:"ghost",size:"sm",onClick:()=>window.open(n.url,"_blank"),className:"h-8 w-8 Be-0",children:(0,Be.jsx)(I.Download,{className:"h-4 w-4"})})]})},a)}if(s.type.startsWith("tool-")){let n=s,i=s.type.replace("tool-","");if(i==="task")switch(n.state){case"input-available":return(0,Be.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},a);case"output-available":return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(qt,{data:{id:n.output?.id||n.input?.id,fetchLatest:!1,taskData:n.output||n.input}})},a);case"output-error":return(0,Be.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",n.errorText]},a);default:return null}if(s.type==="tool-requestEndpointLogin")return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(et,{toolPart:n,index:a,addToolResult:t??(()=>{})})},a);if(s.type==="tool-authenticate")return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(et,{toolPart:n,index:a,addToolResult:t??(()=>{})})},a);if(s.type==="tool-requestApproval")return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(Dt,{toolPart:n,index:a,addToolResult:t??(()=>{})})},a);if(i==="artefact")switch(n.state){case"input-available":return(0,Be.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},a);case"output-available":return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(Qt,{artefact:n.output?.description||"",taskId:n.output?.id||n.input?.id,taskData:n.output||n.input})},a);case"output-error":return(0,Be.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",n.errorText]},a);default:return null}return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsxs)($,{className:"w-full max-w-md",children:[(0,Be.jsx)(te,{children:(0,Be.jsx)(oe,{className:"text-lg",children:i})}),(0,Be.jsxs)(j,{children:[n.state==="input-available"&&(0,Be.jsxs)("Be",{className:"text-sm",children:["Processing ",i,"..."]}),n.state==="output-available"&&(0,Be.jsx)("pre",{className:"text-sm",children:JSON.stringify(n.output,null,2)}),n.state==="output-error"&&(0,Be.jsxs)("Be",{className:"text-sm text-red-500",children:["Error: ",n.errorText]})]})]})},a)}if(s.type.startsWith("data-")){let n=s,i=s.type.replace("data-","");return i==="reference"?(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)($,{className:"w-full",children:(0,Be.jsx)(j,{className:"Be-4",children:(0,Be.jsx)("div",{className:"space-y-2",children:n.data?.references?.map((c,g)=>(0,Be.jsxs)("div",{className:"flex items-center gap-2 Be-2 rounded-md bg-muted/50",children:[(0,Be.jsx)(X,{variant:"outline",children:c.type||"link"}),(0,Be.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Be.jsx)("Be",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Be.jsx)("Be",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Be.jsx)(z,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"h-8 w-8 Be-0",children:(0,Be.jsx)(I.ExternalLink,{className:"h-4 w-4"})})]},g))})})})},a):i==="menu"?(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsxs)($,{className:"w-full",children:[(0,Be.jsx)(te,{children:(0,Be.jsx)(oe,{className:"text-lg",children:n.data?.title})}),(0,Be.jsx)(j,{children:(0,Be.jsx)("div",{className:"space-y-2",children:n.data?.items?.map((c,g)=>(0,Be.jsx)(z,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Be.jsxs)("div",{className:"text-left",children:[(0,Be.jsx)("Be",{className:"font-medium",children:c.label}),c.description&&(0,Be.jsx)("Be",{className:"text-xs text-muted-foreground",children:c.description})]})},g))})})]})},a):(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsxs)($,{className:"w-full max-w-md",children:[(0,Be.jsx)(te,{children:(0,Be.jsx)(oe,{className:"text-lg",children:i})}),(0,Be.jsx)(j,{children:(0,Be.jsx)("pre",{className:"text-sm",children:JSON.stringify(n.data,null,2)})})]})},a)}if(s.type==="reasoning")return(0,Be.jsxs)(rt,{className:"w-full",isStreaming:o==="streaming"&&a===e.parts.length-1&&e.id===r.at(-1)?.id,children:[(0,Be.jsx)(at,{}),(0,Be.jsx)(nt,{children:s.text})]},`${a}`);if(s.type==="dynamic-tool")return(0,Be.jsxs)(Ft,{defaultOpen:s.state!=="output-available",children:[(0,Be.jsx)(Vt,{type:`tool-${s.toolName}`,state:s.state}),(0,Be.jsxs)(Ut,{children:[(0,Be.jsx)(Gt,{input:s.input}),(0,Be.jsx)($t,{output:s.output,errorText:s.errorText})]})]},`${e.id}-${a}`)});var Zt=({className:e,from:t,...o})=>(0,Be.jsx)("div",{className:d("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...o}),tr=(0,yt.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),eo=({children:e,className:t,variant:o,...r})=>(0,Be.jsx)("div",{className:d(tr({variant:o,className:t})),...r,children:e});function or({messages:e,input:t,isTyping:o=!1,currentSessionTitle:r,capabilities:s,fileUploads:a,isDragOver:n,enableFileUpload:i,onInputChange:c,addToolResult:g,onSendMessage:h,onKeyPress:f,onFileUpload:v,onRemoveFile:R,onDragOver:P,className:x,status:y="ready"}){let C=(0,_.useRef)(null),E=(0,_.useRef)(null),A=(0,_.useRef)(null),[S,q]=(0,_.useState)(!1),[ue,We]=(0,_.useState)({path:[],selectedItems:[],filters:{}});(0,_.useEffect)(()=>{C.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,_.useEffect)(()=>{S&&setTimeout(()=>{C.current?.scrollIntoView({behavior:"smooth"})},100)},[S]);let Ce=()=>Ye(ue),me=()=>{let u=[];return s.forEach(T=>{T.actions&&T.actions.forEach(K=>{u.push({label:K.label,action:()=>ie(K.id,{path:[T],selectedItems:[],filters:{}})})}),T.children&&T.children.forEach(K=>{K.type==="list"&&K.data&&u.push({label:`View ${K.name}`,action:()=>q(!0)})})}),u.slice(0,5)},ie=(u,T)=>{console.log("Capability action:",u,T);let K=`Executing ${u} with context: ${JSON.stringify(T.path.map(Ie=>Ie.name))}`;q(!1)},we=Ye({path:[],selectedItems:[],filters:{}}),w=u=>{v(u.target.files),u.target.files&&(u.target.value="")},Ae=u=>{u.preventDefault(),P(!0)},ge=u=>{u.preventDefault(),P(!1)},Se=u=>{u.preventDefault(),P(!1),v(u.dataTransfer.files)},fe=u=>{if(u===0)return"0 Bytes";let T=1024,K=["Bytes","KB","MB","GB"],Ie=Math.floor(Math.log(u)/Math.log(T));return parseFloat((u/Math.pow(T,Ie)).toFixed(2))+" "+K[Ie]},Me=u=>u.startsWith("image/")?(0,Be.jsx)(I.Image,{className:"h-4 w-4"}):u.startsWith("text/")?(0,Be.jsx)(I.FileText,{className:"h-4 w-4"}):(0,Be.jsx)(I.File,{className:"h-4 w-4"}),Ne={messages:e,currentSessionTitle:r,capabilities:s,currentCapabilityContext:ue,contextualActions:we,getQuickSuggestions:me().map(u=>u.label)},le=()=>{navigator.clipboard.writeText(JSON.stringify(Ne,null,2)),alert("Debug info copied to clipboard")};return(0,Be.jsxs)("div",{className:`h-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${x||""}`,children:[(0,Be.jsxs)(Xe,{ref:E,className:"flex-1 Be-4 bg-background border-0",onDragOver:Ae,onDragLeave:ge,onDrop:Se,children:[(0,Be.jsxs)("div",{className:d("space-y-4",n&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Be.jsx)(xe.animate,{children:e.map(u=>(0,Be.jsx)(xe.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Be.jsx)(Zt,{from:u.role,children:(0,Be.jsx)(eo,{variant:"flat",children:Xt({message:u,addToolResult:g??(()=>{}),status:y,messages:e})})},u.id)},u.id))}),S&&(0,Be.jsxs)(xe.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Be.jsx)(Ee,{className:"h-8 w-8",children:(0,Be.jsx)(ze,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Be.jsx)(I.Bot,{className:"h-4 w-4"})})}),(0,Be.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Be.jsx)(At,{capabilities:s,isOpen:S,onToggle:()=>q(!S),onActionSelect:ie,className:"w-full"})})]}),o&&(0,Be.jsxs)(xe.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Be.jsx)(Ee,{className:"h-8 w-8",children:(0,Be.jsx)(ze,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Be.jsx)(I.Bot,{className:"h-4 w-4"})})}),(0,Be.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Be.jsxs)("div",{className:"flex space-x-1",children:[(0,Be.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Be.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Be.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Be.jsx)("div",{ref:C})]}),a.length>0&&(0,Be.jsx)("div",{className:"Be-4 border-t bg-muted/10",children:(0,Be.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(u=>(0,Be.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Be-2 border",children:[Me(u.file.type),(0,Be.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Be.jsx)("span",{className:"text-xs text-muted-foreground",children:fe(u.file.size)}),(0,Be.jsx)(z,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"h-6 w-6 Be-0",children:(0,Be.jsx)(I.X,{className:"h-4 w-4"})})]},u.id))})}),(0,Be.jsxs)("div",{className:"border rounded-2xl Be-4 bg-muted/20",children:[(0,Be.jsxs)("div",{className:"flex gap-3",children:[(0,Be.jsx)(Je,{value:t,onChange:u=>c(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:o}),i&&(0,Be.jsx)(z,{variant:"outline",size:"icon",onClick:()=>A.current?.click(),className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Be.jsx)(I.Paperclip,{className:"h-4 w-4"})}),(0,Be.jsx)(z,{onClick:h,disabled:!t.trim()&&a.length===0||o,size:"icon",className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Be.jsx)(I.Send,{className:"h-4 w-4"})})]}),(0,Be.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Be.jsxs)(z,{onClick:()=>q(!S),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Be.jsx)(I.Menu,{className:"h-3 w-3 mr-1"}),S?"Hide":"Show"," Capabilities"]}),(0,Be.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[Ce().map((u,T)=>(0,Be.jsx)(z,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>ie(u.id,ue),children:u.label},`context-${u.id}`)),Ce().length===0&&me().map((u,T)=>(0,Be.jsx)(z,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${T}`)),(0,Be.jsx)(z,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:le,children:"Debug"})]})]}),i&&(0,Be.jsx)("input",{ref:A,type:"file",multiple:!0,onChange:w,className:"hidden"})]})]})}0&&(module.exports={ChatInterface});
|
|
21
|
+
`,children:"Cancel"})]})]}):null};var Dt=({toolPart:e,index:t,addToolResult:o})=>{let[r,s]=tt.default.useState(!0),[a,n]=tt.default.useState(null),i=()=>{o(e.toolCallId,e.type,"Approved"),s(!1),n("approve")},c=()=>{o(e.toolCallId,e.type,"Denied"),s(!1),n("deny")};switch(e.state){case"input-available":return(0,Be.jsxs)("div",{className:"mb-2",children:[(0,Be.jsx)(Lt,{isOpen:r,onApprove:i,onDeny:c,onClose:()=>s(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!r&&(0,Be.jsxs)(Be.Fragment,{children:[a==="approve"&&(0,Be.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Be.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Be.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Be.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),a==="deny"&&(0,Be.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Be.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Be.jsx)("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Be.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Be.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var ot=require("@radix-ui/react-use-controllable-state");var he=V(require("@radix-ui/react-collapsible")),He=he.Root,Oe=he.CollapsibleTrigger,Fe=he.CollapsibleContent;var zt=require("streamdown"),Te=(0,_.memo)(({className:e,...t})=>(0,Be.jsx)(zt.Streamdown,{className:d("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);Te.displayName="Response";var Ht=(0,_.createContext)(null),_o=()=>{let e=(0,_.useContext)(Ht);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},qo=1e3,Ko=1e3,rt=(0,_.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:r=!0,onOpenChange:s,duration:a,children:n,...i})=>{let[c,g]=(0,ot.useControllableState)({prop:o,defaultProp:r,onChange:s}),[h,f]=(0,ot.useControllableState)({prop:a,defaultProp:0}),[v,R]=(0,_.useState)(!1),[P,x]=(0,_.useState)(null);(0,_.useEffect)(()=>{t?P===null&&x(Date.now()):P!==null&&(f(Math.ceil((Date.now()-P)/Ko)),x(null))},[t,P,f]),(0,_.useEffect)(()=>{if(r&&!t&&c&&!v){let C=setTimeout(()=>{g(!1),R(!0)},qo);return()=>clearTimeout(C)}},[t,c,r,g,v]);let y=C=>{g(C)};return(0,Be.jsx)(Ht.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:g,duration:h},children:(0,Be.jsx)(He,{className:d("not-prose mb-4",e),onOpenChange:y,open:c,...i,children:n})})}),Jo=(e,t)=>e||t===0?(0,Be.jsx)("Be",{children:"Thinking..."}):t===void 0?(0,Be.jsx)("Be",{children:"Thought for a few seconds"}):(0,Be.jsxs)("Be",{children:["Thought for ",t," seconds"]}),at=(0,_.memo)(({className:e,children:t,...o})=>{let{isStreaming:r,isOpen:s,duration:a}=_o();return(0,Be.jsx)(Oe,{className:d("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(I.BrainIcon,{className:"size-4"}),Jo(r,a),(0,Be.jsx)(I.ChevronDownIcon,{className:d("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),nt=(0,_.memo)(({className:e,children:t,...o})=>(0,Be.jsx)(Fe,{className:d("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,Be.jsx)(Te,{className:"grid gap-2",children:t})}));rt.displayName="Reasoning";at.displayName="ReasoningTrigger";nt.displayName="ReasoningContent";var st=require("react-syntax-highlighter"),Ge=require("react-syntax-highlighter/dist/esm/styles/prism"),Qo=(0,_.createContext)({code:""}),$e=({code:e,language:t,showLineNumbers:o=!1,className:r,children:s,...a})=>(0,Be.jsx)(Qo.Provider,{value:{code:e},children:(0,Be.jsx)("div",{className:d("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",r),...a,children:(0,Be.jsxs)("div",{className:"relative",children:[(0,Be.jsx)(st.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ge.oneLight,children:e}),(0,Be.jsx)(st.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ge.oneDark,children:e}),s&&(0,Be.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:s})]})})});var Ft=({className:e,...t})=>(0,Be.jsx)(He,{className:d("not-prose mb-4 w-full",e),...t}),Xo=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Be.jsxs)(X,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Be.jsx)(I.CircleIcon,{className:"size-4"}),"input-available":(0,Be.jsx)(I.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Be.jsx)(I.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Be.jsx)(I.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},Vt=({className:e,type:t,state:o,...r})=>(0,Be.jsxs)(Oe,{className:d("flex w-full items-center justify-between gap-4 Be-3 pl-0 w-2xl",e),...r,children:[(0,Be.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Be.jsx)(I.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Be.jsx)("span",{className:"font-medium text-sm",children:t}),Xo(o)]}),(0,Be.jsx)(I.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Ut=({className:e,...t})=>(0,Be.jsx)(Fe,{className:d("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Gt=({className:e,input:t,...o})=>(0,Be.jsxs)("div",{className:d("space-y-2 overflow-hidden Be-4",e),...o,children:[(0,Be.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Be.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Be.jsx)($e,{code:JSON.stringify(t,null,2),language:"json"})})]}),$t=({className:e,output:t,errorText:o,...r})=>{if(!(t||o))return null;let s=(0,Be.jsx)("div",{children:t});return typeof t=="object"?s=(0,Be.jsx)($e,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(s=(0,Be.jsx)($e,{code:t,language:"json"})),(0,Be.jsxs)("div",{className:d("space-y-2 Be-4",e),...r,children:[(0,Be.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Be.jsxs)("div",{className:d("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,Be.jsx)("div",{children:o}),s]})]})};var de=V(require("react"));var $=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("rounded-xl border bg-card text-card-foreground shadow",e),...t}));$.displayName="Card";var te=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("flex flex-col space-y-1.5 Be-6",e),...t}));te.displayName="CardHeader";var oe=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("font-semibold leading-none tracking-tight",e),...t}));oe.displayName="CardTitle";var it=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("text-sm text-muted-foreground",e),...t}));it.displayName="CardDescription";var j=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("Be-6 pt-0",e),...t}));j.displayName="CardContent";var Re=de.forwardRef(({className:e,...t},o)=>(0,Be.jsx)("div",{ref:o,className:d("flex items-center Be-6 pt-0",e),...t}));Re.displayName="CardFooter";var _t=require("date-fns");function jt({taskId:e,polling:t=!0,system:o="payload"}){let[r,s]=(0,_.useState)(null),[a,n]=(0,_.useState)(!1),[i,c]=(0,_.useState)(null),g=async(f=!0)=>{if(e){f&&n(!0);try{let v=await fetch(`/api/tasks/${e}`);if(!v.ok)throw new Error(`Failed to fetch task: ${v.statusText}`);let R=await v.json();s(R)}catch(v){console.error("Error fetching task:",v),c(v instanceof Error?v:new Error("Unknown error occurred"))}finally{f&&n(!1)}}},h=()=>g(!1);return(0,_.useEffect)(()=>{e&&g(!0);let f=null;return e&&t&&(f=setInterval(h,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:r,loading:a,error:i}}var Yo=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},Zo=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function qt({data:e}){let{id:t,system:o,fetchLatest:r,taskData:s,error:a}=e||{};if(!t)return null;let n=null,i=!0,c=a,g=r!==void 0?r:!0;if(n=s||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:r,system:o,fetchLatest:g,taskData:n,error:c}),g){let{task:R,loading:P,error:x}=jt({taskId:t,system:o});n=R,i=P,c=x}else i=!1;let h=Yo(n?.status||"todo"),f=Zo(n?.status||"todo"),v=n?.dateLogged||new Date().toISOString();try{let R=new Date(n?.dateLogged||"");isNaN(R.getTime())||(v=(0,_t.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Be.jsxs)($,{className:d("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Be.jsxs)(te,{className:"pb-2",children:[(0,Be.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Be.jsx)(oe,{className:"text-lg font-semibold",children:i?"Loading...":n?.name||"Task"}),(0,Be.jsx)(X,{className:`${h}`,children:f})]}),n?.project&&(0,Be.jsxs)(it,{className:"text-sm text-gray-500",children:["Project: ",n.project.name]})]}),(0,Be.jsx)(j,{className:"pb-2",children:i?(0,Be.jsx)("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Be.jsx)("Be",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Be.jsx)("Be",{className:"text-sm text-foreground",children:n?.description||"......."})}),(0,Be.jsx)(Re,{className:"pt-2 flex items-center justify-between",children:(0,Be.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Be.jsx)(I.Clock,{className:"h-3 w-3 mr-1"}),(0,Be.jsxs)("span",{children:["Created ",v]}),(0,Be.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Be.jsxs)("span",{children:["Task #",t]})]})})]})}function Qt({artefact:e,taskId:t,taskData:o,loading:r=!1,error:s=null}){let a=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},n=a.dateLogged;try{let i=new Date(a.dateLogged);isNaN(i.getTime())||(n=(0,_t.formatDistanceToNow)(i,{addSuffix:!0}))}catch{}return(0,Be.jsxs)($,{className:"w-full max-w-md shadow-md",children:[(0,Be.jsx)(te,{className:"pb-2",children:(0,Be.jsx)("div",{className:"flex justify-between items-start",children:(0,Be.jsx)(oe,{className:"text-lg font-semibold",children:r?"Loading...":a.name})})}),(0,Be.jsx)(j,{className:"pb-2",children:r?(0,Be.jsx)("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4 mb-2"}):s?(0,Be.jsx)("Be",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Be.jsx)("Be",{className:"text-sm text-foreground",children:e})}),(0,Be.jsx)(Re,{className:"pt-2 flex items-center justify-between",children:(0,Be.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Be.jsx)(I.Clock,{className:"h-3 w-3 mr-1"}),(0,Be.jsxs)("span",{children:["Created ",n]}),(0,Be.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Be.jsxs)("span",{children:["Task #",a.id]})]})})]})}var er=e=>e.startsWith("image/")?(0,Be.jsx)(I.Image,{className:"h-4 w-4"}):e.startsWith("text/")?(0,Be.jsx)(I.FileText,{className:"h-4 w-4"}):(0,Be.jsx)(I.File,{className:"h-4 w-4"}),Xt=({message:e,addToolResult:t,status:o,messages:r})=>e.parts.map((s,a)=>{if(s.type==="text")return(0,Be.jsx)(Te,{children:s.text},`${a}`);if(s.type==="file"){let n=s;return(0,Be.jsx)("div",{className:"mb-2 Be-2 bg-background/50 rounded-lg",children:(0,Be.jsxs)("div",{className:"flex items-center gap-2",children:[er(n.mediaType||"application/octet-stream"),(0,Be.jsx)("div",{className:"flex-1 min-w-0",children:(0,Be.jsx)("Be",{className:"text-sm font-medium truncate",children:n.filename||n.url?.split("/").pop()||"File"})}),n.url&&(0,Be.jsx)(z,{variant:"ghost",size:"sm",onClick:()=>window.open(n.url,"_blank"),className:"h-8 w-8 Be-0",children:(0,Be.jsx)(I.Download,{className:"h-4 w-4"})})]})},a)}if(s.type.startsWith("tool-")){let n=s,i=s.type.replace("tool-","");if(i==="task")switch(n.state){case"input-available":return(0,Be.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},a);case"output-available":return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(qt,{data:{id:n.output?.id||n.input?.id,fetchLatest:!1,taskData:n.output||n.input}})},a);case"output-error":return(0,Be.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",n.errorText]},a);default:return null}if(s.type==="tool-requestEndpointLogin")return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(et,{toolPart:n,index:a,addToolResult:t??(()=>{})})},a);if(s.type==="tool-authenticate")return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(et,{toolPart:n,index:a,addToolResult:t??(()=>{})})},a);if(s.type==="tool-requestApproval")return console.log("Rendering PartApprovalTool with toolPart:",n),(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(Dt,{toolPart:n,index:a,addToolResult:t??(()=>{})})},a);if(i==="artefact")switch(n.state){case"input-available":return(0,Be.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},a);case"output-available":return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)(Qt,{artefact:n.output?.description||"",taskId:n.output?.id||n.input?.id,taskData:n.output||n.input})},a);case"output-error":return(0,Be.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",n.errorText]},a);default:return null}return(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsxs)($,{className:"w-full max-w-md",children:[(0,Be.jsx)(te,{children:(0,Be.jsx)(oe,{className:"text-lg",children:i})}),(0,Be.jsxs)(j,{children:[n.state==="input-available"&&(0,Be.jsxs)("Be",{className:"text-sm",children:["Processing ",i,"..."]}),n.state==="output-available"&&(0,Be.jsx)("pre",{className:"text-sm",children:JSON.stringify(n.output,null,2)}),n.state==="output-error"&&(0,Be.jsxs)("Be",{className:"text-sm text-red-500",children:["Error: ",n.errorText]})]})]})},a)}if(s.type.startsWith("data-")){let n=s,i=s.type.replace("data-","");return i==="reference"?(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsx)($,{className:"w-full",children:(0,Be.jsx)(j,{className:"Be-4",children:(0,Be.jsx)("div",{className:"space-y-2",children:n.data?.references?.map((c,g)=>(0,Be.jsxs)("div",{className:"flex items-center gap-2 Be-2 rounded-md bg-muted/50",children:[(0,Be.jsx)(X,{variant:"outline",children:c.type||"link"}),(0,Be.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Be.jsx)("Be",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Be.jsx)("Be",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Be.jsx)(z,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"h-8 w-8 Be-0",children:(0,Be.jsx)(I.ExternalLink,{className:"h-4 w-4"})})]},g))})})})},a):i==="menu"?(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsxs)($,{className:"w-full",children:[(0,Be.jsx)(te,{children:(0,Be.jsx)(oe,{className:"text-lg",children:n.data?.title})}),(0,Be.jsx)(j,{children:(0,Be.jsx)("div",{className:"space-y-2",children:n.data?.items?.map((c,g)=>(0,Be.jsx)(z,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Be.jsxs)("div",{className:"text-left",children:[(0,Be.jsx)("Be",{className:"font-medium",children:c.label}),c.description&&(0,Be.jsx)("Be",{className:"text-xs text-muted-foreground",children:c.description})]})},g))})})]})},a):(0,Be.jsx)("div",{className:"mb-2",children:(0,Be.jsxs)($,{className:"w-full max-w-md",children:[(0,Be.jsx)(te,{children:(0,Be.jsx)(oe,{className:"text-lg",children:i})}),(0,Be.jsx)(j,{children:(0,Be.jsx)("pre",{className:"text-sm",children:JSON.stringify(n.data,null,2)})})]})},a)}if(s.type==="reasoning")return(0,Be.jsxs)(rt,{className:"w-full",isStreaming:o==="streaming"&&a===e.parts.length-1&&e.id===r.at(-1)?.id,children:[(0,Be.jsx)(at,{}),(0,Be.jsx)(nt,{children:s.text})]},`${a}`);if(s.type==="dynamic-tool")return(0,Be.jsxs)(Ft,{defaultOpen:s.state!=="output-available",children:[(0,Be.jsx)(Vt,{type:`tool-${s.toolName}`,state:s.state}),(0,Be.jsxs)(Ut,{children:[(0,Be.jsx)(Gt,{input:s.input}),(0,Be.jsx)($t,{output:s.output,errorText:s.errorText})]})]},`${e.id}-${a}`)});var Zt=({className:e,from:t,...o})=>(0,Be.jsx)("div",{className:d("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...o}),tr=(0,yt.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),eo=({children:e,className:t,variant:o,...r})=>(0,Be.jsx)("div",{className:d(tr({variant:o,className:t})),...r,children:e});function or({messages:e,input:t,isTyping:o=!1,currentSessionTitle:r,capabilities:s,fileUploads:a,isDragOver:n,enableFileUpload:i,onInputChange:c,addToolResult:g,onSendMessage:h,onKeyPress:f,onFileUpload:v,onRemoveFile:R,onDragOver:P,className:x,status:y="ready"}){let C=(0,_.useRef)(null),E=(0,_.useRef)(null),A=(0,_.useRef)(null),[S,q]=(0,_.useState)(!1),[ue,We]=(0,_.useState)({path:[],selectedItems:[],filters:{}});(0,_.useEffect)(()=>{C.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,_.useEffect)(()=>{S&&setTimeout(()=>{C.current?.scrollIntoView({behavior:"smooth"})},100)},[S]);let Ce=()=>Ye(ue),me=()=>{let u=[];return s.forEach(T=>{T.actions&&T.actions.forEach(K=>{u.push({label:K.label,action:()=>ie(K.id,{path:[T],selectedItems:[],filters:{}})})}),T.children&&T.children.forEach(K=>{K.type==="list"&&K.data&&u.push({label:`View ${K.name}`,action:()=>q(!0)})})}),u.slice(0,5)},ie=(u,T)=>{console.log("Capability action:",u,T);let K=`Executing ${u} with context: ${JSON.stringify(T.path.map(Ie=>Ie.name))}`;q(!1)},we=Ye({path:[],selectedItems:[],filters:{}}),w=u=>{v(u.target.files),u.target.files&&(u.target.value="")},Ae=u=>{u.preventDefault(),P(!0)},ge=u=>{u.preventDefault(),P(!1)},Se=u=>{u.preventDefault(),P(!1),v(u.dataTransfer.files)},fe=u=>{if(u===0)return"0 Bytes";let T=1024,K=["Bytes","KB","MB","GB"],Ie=Math.floor(Math.log(u)/Math.log(T));return parseFloat((u/Math.pow(T,Ie)).toFixed(2))+" "+K[Ie]},Me=u=>u.startsWith("image/")?(0,Be.jsx)(I.Image,{className:"h-4 w-4"}):u.startsWith("text/")?(0,Be.jsx)(I.FileText,{className:"h-4 w-4"}):(0,Be.jsx)(I.File,{className:"h-4 w-4"}),Ne={messages:e,currentSessionTitle:r,capabilities:s,currentCapabilityContext:ue,contextualActions:we,getQuickSuggestions:me().map(u=>u.label)},le=()=>{navigator.clipboard.writeText(JSON.stringify(Ne,null,2)),alert("Debug info copied to clipboard")};return(0,Be.jsxs)("div",{className:`h-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${x||""}`,children:[(0,Be.jsxs)(Xe,{ref:E,className:"flex-1 Be-4 bg-background border-0",onDragOver:Ae,onDragLeave:ge,onDrop:Se,children:[(0,Be.jsxs)("div",{className:d("space-y-4",n&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Be.jsx)(xe.animate,{children:e.map(u=>(0,Be.jsx)(xe.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Be.jsx)(Zt,{from:u.role,children:(0,Be.jsx)(eo,{variant:"flat",children:Xt({message:u,addToolResult:g??(()=>{}),status:y,messages:e})})},u.id)},u.id))}),S&&(0,Be.jsxs)(xe.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Be.jsx)(Ee,{className:"h-8 w-8",children:(0,Be.jsx)(ze,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Be.jsx)(I.Bot,{className:"h-4 w-4"})})}),(0,Be.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Be.jsx)(At,{capabilities:s,isOpen:S,onToggle:()=>q(!S),onActionSelect:ie,className:"w-full"})})]}),o&&(0,Be.jsxs)(xe.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Be.jsx)(Ee,{className:"h-8 w-8",children:(0,Be.jsx)(ze,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Be.jsx)(I.Bot,{className:"h-4 w-4"})})}),(0,Be.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Be.jsxs)("div",{className:"flex space-x-1",children:[(0,Be.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Be.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Be.jsx)("div",{className:"w-2 h-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Be.jsx)("div",{ref:C})]}),a.length>0&&(0,Be.jsx)("div",{className:"Be-4 border-t bg-muted/10",children:(0,Be.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(u=>(0,Be.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Be-2 border",children:[Me(u.file.type),(0,Be.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Be.jsx)("span",{className:"text-xs text-muted-foreground",children:fe(u.file.size)}),(0,Be.jsx)(z,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"h-6 w-6 Be-0",children:(0,Be.jsx)(I.X,{className:"h-4 w-4"})})]},u.id))})}),(0,Be.jsxs)("div",{className:"border rounded-2xl Be-4 bg-muted/20",children:[(0,Be.jsxs)("div",{className:"flex gap-3",children:[(0,Be.jsx)(Je,{value:t,onChange:u=>c(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:o}),i&&(0,Be.jsx)(z,{variant:"outline",size:"icon",onClick:()=>A.current?.click(),className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Be.jsx)(I.Paperclip,{className:"h-4 w-4"})}),(0,Be.jsx)(z,{onClick:h,disabled:!t.trim()&&a.length===0||o,size:"icon",className:"rounded-2xl h-10 w-10 shadow-sm",children:(0,Be.jsx)(I.Send,{className:"h-4 w-4"})})]}),(0,Be.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Be.jsxs)(z,{onClick:()=>q(!S),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Be.jsx)(I.Menu,{className:"h-3 w-3 mr-1"}),S?"Hide":"Show"," Capabilities"]}),(0,Be.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[Ce().map((u,T)=>(0,Be.jsx)(z,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>ie(u.id,ue),children:u.label},`context-${u.id}`)),Ce().length===0&&me().map((u,T)=>(0,Be.jsx)(z,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${T}`)),(0,Be.jsx)(z,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:le,children:"Debug"})]})]}),i&&(0,Be.jsx)("input",{ref:A,type:"file",multiple:!0,onChange:w,className:"hidden"})]})]})}0&&(module.exports={ChatInterface});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-WAVVCASZ.mjs";import"../../chunk-347B45ZS.mjs";import"../../chunk-WRZP5K5X.mjs";import"../../chunk-V5VE3EIY.mjs";import"../../chunk-6OCLRAHU.mjs";import"../../chunk-5Y6FKL5W.mjs";import"../../chunk-EW6KWAHS.mjs";import"../../chunk-7JDMW5R3.mjs";import"../../chunk-6OT5PQXV.mjs";import"../../chunk-YPZAYXNQ.mjs";import"../../chunk-7TSR2LQB.mjs";import"../../chunk-QM5FOQHG.mjs";import"../../chunk-UA2E23AS.mjs";import"../../chunk-2LINLX4S.mjs";import"../../chunk-RL6365DN.mjs";import"../../chunk-LTTO57ZK.mjs";import"../../chunk-Q2DPE66H.mjs";import"../../chunk-FT3AE7L2.mjs";import"../../chunk-YNCJATT7.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-YEKQJ4YC.mjs";export{a as ChatInterface};
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
`,children:r?"Processing...":"Deny"}),(0,Bo.jsx)("button",{onClick:w,disabled:r,className:`
|
|
19
19
|
px-4 py-2 text-white border-none rounded text-sm
|
|
20
20
|
${r?"bg-gray-400 cursor-not-allowed":"bg-gray-500 hover:bg-gray-600 cursor-pointer"}
|
|
21
|
-
`,children:"Cancel"})]})]}):null};var va=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=go.default.useState(!0),[i,r]=go.default.useState(null),s=()=>{o(e.input?.toolCallId,e.input?.tool,"Approved"),n(!1),r("approve")},c=()=>{o(e.input?.toolCallId,e.input?.tool,"Denied"),n(!1),r("deny")};switch(e.state){case"input-available":return(0,Bo.jsxs)("div",{className:"mb-2",children:[(0,Bo.jsx)(ba,{isOpen:a,onApprove:s,onDeny:c,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,Bo.jsxs)(Bo.Fragment,{children:[i==="approve"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Bo.jsx)("svg",{className:"Bo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Bo.jsx)("svg",{className:"Bo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var fo=require("@radix-ui/react-use-controllable-state");var nt=V(require("@radix-ui/react-collapsible")),zt=nt.Root,Ut=nt.CollapsibleTrigger,Ft=nt.CollapsibleContent;var ya=require("streamdown"),yt=(0,ct.memo)(({className:e,...t})=>(0,Bo.jsx)(ya.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);yt.displayName="Response";var wa=(0,ct.createContext)(null),ar=()=>{let e=(0,ct.useContext)(wa);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},ir=1e3,rr=1e3,bo=(0,ct.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[c,m]=(0,fo.useControllableState)({prop:o,defaultProp:a,onChange:n}),[w,f]=(0,fo.useControllableState)({prop:i,defaultProp:0}),[y,R]=(0,ct.useState)(!1),[A,T]=(0,ct.useState)(null);(0,ct.useEffect)(()=>{t?A===null&&T(Date.now()):A!==null&&(f(Math.ceil((Date.now()-A)/rr)),T(null))},[t,A,f]),(0,ct.useEffect)(()=>{if(a&&!t&&c&&!y){let N=setTimeout(()=>{m(!1),R(!0)},ir);return()=>clearTimeout(N)}},[t,c,a,m,y]);let C=N=>{m(N)};return(0,Bo.jsx)(wa.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:w},children:(0,Bo.jsx)(zt,{className:l("not-prose mb-4",e),onOpenChange:C,open:c,...s,children:r})})}),nr=(e,t)=>e||t===0?(0,Bo.jsx)("Bo",{children:"Thinking..."}):t===void 0?(0,Bo.jsx)("Bo",{children:"Thought for a few seconds"}):(0,Bo.jsxs)("Bo",{children:["Thought for ",t," seconds"]}),vo=(0,ct.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:n,duration:i}=ar();return(0,Bo.jsx)(Ut,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(Oa.BrainIcon,{className:"size-4"}),nr(a,i),(0,Bo.jsx)(Oa.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),ho=(0,ct.memo)(({className:e,children:t,...o})=>(0,Bo.jsx)(Ft,{className:l("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,Bo.jsx)(yt,{className:"grid gap-2",children:t})}));bo.displayName="Reasoning";vo.displayName="ReasoningTrigger";ho.displayName="ReasoningContent";var yo=require("react-syntax-highlighter"),Ot=require("react-syntax-highlighter/dist/esm/styles/prism"),sr=(0,ct.createContext)({code:""}),Vt=({code:e,language:t,showLineNumbers:o=!1,className:a,children:n,...i})=>(0,Bo.jsx)(sr.Provider,{value:{code:e},children:(0,Bo.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(yo.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneLight,children:e}),(0,Bo.jsx)(yo.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneDark,children:e}),n&&(0,Bo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Na=({className:e,...t})=>(0,Bo.jsx)(zt,{className:l("not-prose mb-4 w-full",e),...t}),lr=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Bo.jsxs)(ae,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Bo.jsx)(Oa.CircleIcon,{className:"size-4"}),"input-available":(0,Bo.jsx)(Oa.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Bo.jsx)(Oa.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Bo.jsx)(Oa.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},ka=({className:e,type:t,state:o,...a})=>(0,Bo.jsxs)(Ut,{className:l("flex w-full items-center justify-between gap-4 Bo-3 pl-0 w-2xl",e),...a,children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(Oa.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Bo.jsx)("span",{className:"font-medium text-sm",children:t}),lr(o)]}),(0,Bo.jsx)(Oa.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Pa=({className:e,...t})=>(0,Bo.jsx)(Ft,{className:l("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Ta=({className:e,input:t,...o})=>(0,Bo.jsxs)("div",{className:l("space-y-2 overflow-hidden Bo-4",e),...o,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Bo.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Bo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"})})]}),Da=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let n=(0,Bo.jsx)("div",{children:t});return typeof t=="object"?n=(0,Bo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,Bo.jsx)(Vt,{code:t,language:"json"})),(0,Bo.jsxs)("div",{className:l("space-y-2 Bo-4",e),...a,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Bo.jsxs)("div",{className:l("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,Bo.jsx)("div",{children:o}),n]})]})};var Aa=require("date-fns");function Ra({taskId:e,polling:t=!0,system:o="payload"}){let[a,n]=(0,ct.useState)(null),[i,r]=(0,ct.useState)(!1),[s,c]=(0,ct.useState)(null),m=async(f=!0)=>{if(e){f&&r(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let R=await y.json();n(R)}catch(y){console.error("Error fetching task:",y),c(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&r(!1)}}},w=()=>m(!1);return(0,ct.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:a,loading:i,error:s}}var cr=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},dr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Ma({data:e}){let{id:t,system:o,fetchLatest:a,taskData:n,error:i}=e||{};if(!t)return null;let r=null,s=!0,c=i,m=a!==void 0?a:!0;if(r=n||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:a,system:o,fetchLatest:m,taskData:r,error:c}),m){let{task:R,loading:A,error:T}=Ra({taskId:t,system:o});r=R,s=A,c=T}else s=!1;let w=cr(r?.status||"todo"),f=dr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let R=new Date(r?.dateLogged||"");isNaN(R.getTime())||(y=(0,Aa.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Bo.jsxs)(ge,{className:l("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Bo.jsxs)(Le,{className:"pb-2",children:[(0,Bo.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Bo.jsx)(Ee,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,Bo.jsx)(ae,{className:`${w}`,children:f})]}),r?.project&&(0,Bo.jsxs)(co,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,Bo.jsx)(Pe,{className:"pb-2",children:s?(0,Bo.jsx)("div",{className:"animate-pulse Bo-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Bo.jsx)("Bo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Bo.jsx)("Bo",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,Bo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Bo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Bo.jsx)(Oa.Clock,{className:"Bo-3 w-3 mr-1"}),(0,Bo.jsxs)("span",{children:["Created ",y]}),(0,Bo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Bo.jsxs)("span",{children:["Task #",t]})]})})]})}function La({artefact:e,taskId:t,taskData:o,loading:a=!1,error:n=null}){let i=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=i.dateLogged;try{let s=new Date(i.dateLogged);isNaN(s.getTime())||(r=(0,Aa.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,Bo.jsxs)(ge,{className:"w-full max-w-md shadow-md",children:[(0,Bo.jsx)(Le,{className:"pb-2",children:(0,Bo.jsx)("div",{className:"flex justify-between items-start",children:(0,Bo.jsx)(Ee,{className:"text-lg font-semibold",children:a?"Loading...":i.name})})}),(0,Bo.jsx)(Pe,{className:"pb-2",children:a?(0,Bo.jsx)("div",{className:"animate-pulse Bo-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,Bo.jsx)("Bo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Bo.jsx)("Bo",{className:"text-sm text-foreground",children:e})}),(0,Bo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Bo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Bo.jsx)(Oa.Clock,{className:"Bo-3 w-3 mr-1"}),(0,Bo.jsxs)("span",{children:["Created ",r]}),(0,Bo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Bo.jsxs)("span",{children:["Task #",i.id]})]})})]})}var pr=e=>e.startsWith("image/")?(0,Bo.jsx)(Oa.Image,{className:"Bo-4 w-4"}):e.startsWith("text/")?(0,Bo.jsx)(Oa.FileText,{className:"Bo-4 w-4"}):(0,Bo.jsx)(Oa.File,{className:"Bo-4 w-4"}),Ea=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,Bo.jsx)(yt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,Bo.jsx)("div",{className:"mb-2 Bo-2 bg-background/50 rounded-lg",children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[pr(r.mediaType||"application/octet-stream"),(0,Bo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Bo.jsx)("Bo",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"Bo-8 w-8 Bo-0",children:(0,Bo.jsx)(Oa.Download,{className:"Bo-4 w-4"})})]})},i)}if(n.type.startsWith("tool-")){let r=n,s=n.type.replace("tool-","");if(s==="task")switch(r.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(Ma,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(va,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(La,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Bo.jsxs)(Pe,{children:[r.state==="input-available"&&(0,Bo.jsxs)("Bo",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,Bo.jsxs)("Bo",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},i)}if(n.type.startsWith("data-")){let r=n,s=n.type.replace("data-","");return s==="reference"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(ge,{className:"w-full",children:(0,Bo.jsx)(Pe,{className:"Bo-4",children:(0,Bo.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((c,m)=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 Bo-2 rounded-md bg-muted/50",children:[(0,Bo.jsx)(ae,{variant:"outline",children:c.type||"link"}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("Bo",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Bo.jsx)("Bo",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"Bo-8 w-8 Bo-0",children:(0,Bo.jsx)(Oa.ExternalLink,{className:"Bo-4 w-4"})})]},m))})})})},i):s==="menu"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:r.data?.title})}),(0,Bo.jsx)(Pe,{children:(0,Bo.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((c,m)=>(0,Bo.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Bo.jsxs)("div",{className:"text-left",children:[(0,Bo.jsx)("Bo",{className:"font-medium",children:c.label}),c.description&&(0,Bo.jsx)("Bo",{className:"text-xs text-muted-foreground",children:c.description})]})},m))})})]})},i):(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Bo.jsx)(Pe,{children:(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}if(n.type==="reasoning")return(0,Bo.jsxs)(bo,{className:"w-full",isStreaming:o==="streaming"&&i===e.parts.length-1&&e.id===a.at(-1)?.id,children:[(0,Bo.jsx)(vo,{}),(0,Bo.jsx)(ho,{children:n.text})]},`${i}`);if(n.type==="dynamic-tool")return(0,Bo.jsxs)(Na,{defaultOpen:n.state!=="output-available",children:[(0,Bo.jsx)(ka,{type:`tool-${n.toolName}`,state:n.state}),(0,Bo.jsxs)(Pa,{children:[(0,Bo.jsx)(Ta,{input:n.input}),(0,Bo.jsx)(Da,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`)});var Ua=({className:e,from:t,...o})=>(0,Bo.jsx)("div",{className:l("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...o}),mr=(0,Io.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),Fa=({children:e,className:t,variant:o,...a})=>(0,Bo.jsx)("div",{className:l(mr({variant:o,className:t})),...a,children:e});function ja({messages:e,input:t,isTyping:o=!1,currentSessionTitle:a,capabilities:n,fileUploads:i,isDragOver:r,enableFileUpload:s,onInputChange:c,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:y,onRemoveFile:R,onDragOver:A,className:T,status:C="ready"}){let N=(0,ct.useRef)(null),j=(0,ct.useRef)(null),S=(0,ct.useRef)(null),[M,_]=(0,ct.useState)(!1),[$,se]=(0,ct.useState)({path:[],selectedItems:[],filters:{}});(0,ct.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,ct.useEffect)(()=>{M&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[M]);let J=()=>po($),W=()=>{let u=[];return n.forEach(U=>{U.actions&&U.actions.forEach(ve=>{u.push({label:ve.label,action:()=>X(ve.id,{path:[U],selectedItems:[],filters:{}})})}),U.children&&U.children.forEach(ve=>{ve.type==="list"&&ve.data&&u.push({label:`View ${ve.name}`,action:()=>_(!0)})})}),u.slice(0,5)},X=(u,U)=>{console.log("Capability action:",u,U);let ve=`Executing ${u} with context: ${JSON.stringify(U.path.map(Ae=>Ae.name))}`;_(!1)},le=po({path:[],selectedItems:[],filters:{}}),I=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Se=u=>{u.preventDefault(),A(!0)},d=u=>{u.preventDefault(),A(!1)},L=u=>{u.preventDefault(),A(!1),y(u.dataTransfer.files)},E=u=>{if(u===0)return"0 Bytes";let U=1024,ve=["Bytes","KB","MB","GB"],Ae=Math.floor(Math.log(u)/Math.log(U));return parseFloat((u/Math.pow(U,Ae)).toFixed(2))+" "+ve[Ae]},G=u=>u.startsWith("image/")?(0,Bo.jsx)(Oa.Image,{className:"Bo-4 w-4"}):u.startsWith("text/")?(0,Bo.jsx)(Oa.FileText,{className:"Bo-4 w-4"}):(0,Bo.jsx)(Oa.File,{className:"Bo-4 w-4"}),Z={messages:e,currentSessionTitle:a,capabilities:n,currentCapabilityContext:$,contextualActions:le,getQuickSuggestions:W().map(u=>u.label)},be=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,Bo.jsxs)("div",{className:`Bo-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Bo.jsxs)(Ce,{ref:j,className:"flex-1 Bo-4 bg-background border-0",onDragOver:Se,onDragLeave:d,onDrop:L,children:[(0,Bo.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Bo.jsx)(lt.animate,{children:e.map(u=>(0,Bo.jsx)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Bo.jsx)(Ua,{from:u.role,children:(0,Bo.jsx)(Fa,{variant:"flat",children:Ea({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),M&&(0,Bo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Bo.jsx)(et,{className:"Bo-8 w-8",children:(0,Bo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(Oa.Bot,{className:"Bo-4 w-4"})})}),(0,Bo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsx)(ma,{capabilities:n,isOpen:M,onToggle:()=>_(!M),onActionSelect:X,className:"w-full"})})]}),o&&(0,Bo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Bo.jsx)(et,{className:"Bo-8 w-8",children:(0,Bo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(Oa.Bot,{className:"Bo-4 w-4"})})}),(0,Bo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsxs)("div",{className:"flex space-x-1",children:[(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Bo.jsx)("div",{ref:N})]}),i.length>0&&(0,Bo.jsx)("div",{className:"Bo-4 border-t bg-muted/10",children:(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Bo-2 border",children:[G(u.file.type),(0,Bo.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:E(u.file.size)}),(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"Bo-6 w-6 Bo-0",children:(0,Bo.jsx)(Oa.X,{className:"Bo-4 w-4"})})]},u.id))})}),(0,Bo.jsxs)("div",{className:"border rounded-2xl Bo-4 bg-muted/20",children:[(0,Bo.jsxs)("div",{className:"flex gap-3",children:[(0,Bo.jsx)(gt,{value:t,onChange:u=>c(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:o}),s&&(0,Bo.jsx)(D,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl Bo-10 w-10 shadow-sm",children:(0,Bo.jsx)(Oa.Paperclip,{className:"Bo-4 w-4"})}),(0,Bo.jsx)(D,{onClick:w,disabled:!t.trim()&&i.length===0||o,size:"icon",className:"rounded-2xl Bo-10 w-10 shadow-sm",children:(0,Bo.jsx)(Oa.Send,{className:"Bo-4 w-4"})})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Bo.jsxs)(D,{onClick:()=>_(!M),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Bo.jsx)(Oa.Menu,{className:"Bo-3 w-3 mr-1"}),M?"Hide":"Show"," Capabilities"]}),(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,U)=>(0,Bo.jsx)(D,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>X(u.id,$),children:u.label},`context-${u.id}`)),J().length===0&&W().map((u,U)=>(0,Bo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${U}`)),(0,Bo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:be,children:"Debug"})]})]}),s&&(0,Bo.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:I,className:"hidden"})]})]})}function ur({aiConfig:e,useCustomChat:t,enableAI:o=!0,messages:a=[],businessUnits:n=[],capabilities:i=[],sidebarItems:r=[],notifications:s=[],sessions:c=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:R=()=>{},onNotificationRemove:A=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=L=>console.log("Search query:",L),initialTeam:j="design",currentSession:S=null,showCapabilities:M=!0,title:_="Digital Colleagues",enableFileUpload:$=!0,maxFileSize:se=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:X="Nuvia",tagline:le="AI-Powered Workspace",actionIcon:I=(0,Bo.jsx)(Oa.Users,{className:"mr-2 Bo-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let L={...e,onError:F=>{G?.setMessages(ce=>[...ce,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:F.message}]}]),console.error("Error in CopilotInterface:",F)}},E=(0,Ha.useChat)(L||{}),G=o?t||E:null,[Z,be]=(0,ct.useState)(""),[u,U]=(0,ct.useState)(!1),ve=G?.messages||a,Ae=Z,Va=G?.status==="submitted"||u,Wa=G?.addToolResult?(F,ce,ee)=>{G.addToolResult({tool:ce,toolCallId:F,output:ee}),console.log("Tool result added:",{toolCallId:F,tool:ce,output:ee}),G.sendMessage()}:()=>{console.log("addToolResult not available")},dt=n||[],Ga={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[$a,qa]=(0,ct.useState)(()=>dt.length===0?Ga:dt.find(F=>F.id===j)||dt[0]),[pt,xt]=(0,ct.useState)([]),[Ka,_a]=(0,ct.useState)(!1),Ja=F=>{if(!F||!$)return;let ce=[];Array.from(F).forEach(ee=>{if(ee.size>se*1024*1024){alert(`File ${ee.name} is too large. Maximum size is ${se}MB.`);return}if(J.length>0&&!J.some(wt=>ee.type.match(wt))){alert(`File type ${ee.type} is not allowed.`);return}let wo={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ee,status:"pending",progress:0};if(ee.type.startsWith("image/")){let wt=new FileReader;wt.onload=ei=>{xt(ti=>ti.map($t=>$t.id===wo.id?{...$t,preview:ei.target?.result}:$t))},wt.readAsDataURL(ee)}ce.push(wo)}),xt(ee=>[...ee,...ce])},Xa=F=>{xt(ce=>ce.filter(ee=>ee.id!==F))},xo=()=>{if(!(!Ae.trim()&&pt.length===0)){if(G){let F=pt.length>0?Qa(pt.map(ce=>ce.file)):void 0;G.sendMessage({text:Ae,files:F},{body:{timestamp:Date.now()}}),be("")}else console.log("Message to send:",Ae),console.log("Files to upload:",pt),be(""),U(!0),setTimeout(()=>{U(!1)},1500);xt([])}},Qa=F=>{let ce=new DataTransfer;return F.forEach(ee=>ce.items.add(ee)),ce.files},Ya=F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),xo())},Za=F=>{be(F)};return(0,Bo.jsx)(ca,{sidebarItems:r||[],title:_,notifications:s||[],businessUnits:dt,currentBusinessUnit:$a,onBusinessUnitChange:F=>{F&&(qa(F),R?.(F))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:I,actionText:Se,onNotificationRemove:A,onRemoveAll:T,logo:W,appName:X,tagline:le,sidebarInitiallyClosed:d,children:(0,Bo.jsx)(Gt.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Gt.motion.div,{className:"flex-1 Bo-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:"Bo-full flex",children:[(0,Bo.jsx)("div",{className:"w-80 flex-shrink-0 Bo-full Bo-2",children:(0,Bo.jsx)(da,{sessions:c||[],currentSession:S,teams:dt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,Bo.jsx)("div",{className:"flex-1 Bo-full Bo-2",children:(0,Bo.jsx)(ja,{messages:ve||[],input:Ae,isTyping:Va,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:Za,addToolResult:Wa,onSendMessage:xo,onKeyPress:Ya,fileUploads:pt,isDragOver:Ka,enableFileUpload:$,onFileUpload:Ja,onRemoveFile:Xa,onDragOver:_a})})]})},"chat-interface")})})}0&&(module.exports={CopilotInterface});
|
|
21
|
+
`,children:"Cancel"})]})]}):null};var va=({toolPart:e,index:t,addToolResult:o})=>{let[a,n]=go.default.useState(!0),[i,r]=go.default.useState(null),s=()=>{o(e.toolCallId,e.type,"Approved"),n(!1),r("approve")},c=()=>{o(e.toolCallId,e.type,"Denied"),n(!1),r("deny")};switch(e.state){case"input-available":return(0,Bo.jsxs)("div",{className:"mb-2",children:[(0,Bo.jsx)(ba,{isOpen:a,onApprove:s,onDeny:c,onClose:()=>n(!1),title:e.input?.title||"Approval Required",reason:e.output?.reason||e.input?.reason}),!a&&(0,Bo.jsxs)(Bo.Fragment,{children:[i==="approve"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-green-100 text-green-800 text-sm font-medium border border-green-200",children:[(0,Bo.jsx)("svg",{className:"Bo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Approved"]})}),i==="deny"&&(0,Bo.jsx)("div",{className:"flex items-center justify-center mt-3",children:(0,Bo.jsxs)("div",{className:"inline-flex items-center px-4 py-2 rounded-full bg-red-100 text-red-800 text-sm font-medium border border-red-200",children:[(0,Bo.jsx)("svg",{className:"Bo-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,Bo.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Denied"]})})]})]},t);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",e.errorText]},t);default:return null}};var fo=require("@radix-ui/react-use-controllable-state");var nt=V(require("@radix-ui/react-collapsible")),zt=nt.Root,Ut=nt.CollapsibleTrigger,Ft=nt.CollapsibleContent;var ya=require("streamdown"),yt=(0,ct.memo)(({className:e,...t})=>(0,Bo.jsx)(ya.Streamdown,{className:l("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);yt.displayName="Response";var wa=(0,ct.createContext)(null),ar=()=>{let e=(0,ct.useContext)(wa);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},ir=1e3,rr=1e3,bo=(0,ct.memo)(({className:e,isStreaming:t=!1,open:o,defaultOpen:a=!0,onOpenChange:n,duration:i,children:r,...s})=>{let[c,m]=(0,fo.useControllableState)({prop:o,defaultProp:a,onChange:n}),[w,f]=(0,fo.useControllableState)({prop:i,defaultProp:0}),[y,R]=(0,ct.useState)(!1),[A,T]=(0,ct.useState)(null);(0,ct.useEffect)(()=>{t?A===null&&T(Date.now()):A!==null&&(f(Math.ceil((Date.now()-A)/rr)),T(null))},[t,A,f]),(0,ct.useEffect)(()=>{if(a&&!t&&c&&!y){let N=setTimeout(()=>{m(!1),R(!0)},ir);return()=>clearTimeout(N)}},[t,c,a,m,y]);let C=N=>{m(N)};return(0,Bo.jsx)(wa.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:m,duration:w},children:(0,Bo.jsx)(zt,{className:l("not-prose mb-4",e),onOpenChange:C,open:c,...s,children:r})})}),nr=(e,t)=>e||t===0?(0,Bo.jsx)("Bo",{children:"Thinking..."}):t===void 0?(0,Bo.jsx)("Bo",{children:"Thought for a few seconds"}):(0,Bo.jsxs)("Bo",{children:["Thought for ",t," seconds"]}),vo=(0,ct.memo)(({className:e,children:t,...o})=>{let{isStreaming:a,isOpen:n,duration:i}=ar();return(0,Bo.jsx)(Ut,{className:l("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(Oa.BrainIcon,{className:"size-4"}),nr(a,i),(0,Bo.jsx)(Oa.ChevronDownIcon,{className:l("size-4 transition-transform",n?"rotate-180":"rotate-0")})]})})}),ho=(0,ct.memo)(({className:e,children:t,...o})=>(0,Bo.jsx)(Ft,{className:l("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...o,children:(0,Bo.jsx)(yt,{className:"grid gap-2",children:t})}));bo.displayName="Reasoning";vo.displayName="ReasoningTrigger";ho.displayName="ReasoningContent";var yo=require("react-syntax-highlighter"),Ot=require("react-syntax-highlighter/dist/esm/styles/prism"),sr=(0,ct.createContext)({code:""}),Vt=({code:e,language:t,showLineNumbers:o=!1,className:a,children:n,...i})=>(0,Bo.jsx)(sr.Provider,{value:{code:e},children:(0,Bo.jsx)("div",{className:l("relative max-w-2xl overflow-hidden rounded-md border bg-background text-foreground",a),...i,children:(0,Bo.jsxs)("div",{className:"relative",children:[(0,Bo.jsx)(yo.Prism,{className:"overflow-hidden dark:hidden",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneLight,children:e}),(0,Bo.jsx)(yo.Prism,{className:"hidden overflow-hidden dark:block",codeTagProps:{className:"font-mono text-sm"},customStyle:{margin:0,padding:"1rem",fontSize:"0.875rem",background:"hsl(var(--background))",color:"hsl(var(--foreground))"},language:t,lineNumberStyle:{color:"hsl(var(--muted-foreground))",paddingRight:"1rem",minWidth:"2.5rem"},showLineNumbers:o,style:Ot.oneDark,children:e}),n&&(0,Bo.jsx)("div",{className:"absolute top-2 right-2 flex items-center gap-2",children:n})]})})});var Na=({className:e,...t})=>(0,Bo.jsx)(zt,{className:l("not-prose mb-4 w-full",e),...t}),lr=e=>{let t={"input-streaming":"Pending","input-available":"Running","output-available":"Completed","output-error":"Error"};return(0,Bo.jsxs)(ae,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[{"input-streaming":(0,Bo.jsx)(Oa.CircleIcon,{className:"size-4"}),"input-available":(0,Bo.jsx)(Oa.ClockIcon,{className:"size-4 animate-pulse"}),"output-available":(0,Bo.jsx)(Oa.CheckCircleIcon,{className:"size-4 text-green-600"}),"output-error":(0,Bo.jsx)(Oa.XCircleIcon,{className:"size-4 text-red-600"})}[e],t[e]]})},ka=({className:e,type:t,state:o,...a})=>(0,Bo.jsxs)(Ut,{className:l("flex w-full items-center justify-between gap-4 Bo-3 pl-0 w-2xl",e),...a,children:[(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Bo.jsx)(Oa.WrenchIcon,{className:"size-4 text-muted-foreground"}),(0,Bo.jsx)("span",{className:"font-medium text-sm",children:t}),lr(o)]}),(0,Bo.jsx)(Oa.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),Pa=({className:e,...t})=>(0,Bo.jsx)(Ft,{className:l("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),Ta=({className:e,input:t,...o})=>(0,Bo.jsxs)("div",{className:l("space-y-2 overflow-hidden Bo-4",e),...o,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,Bo.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,Bo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"})})]}),Da=({className:e,output:t,errorText:o,...a})=>{if(!(t||o))return null;let n=(0,Bo.jsx)("div",{children:t});return typeof t=="object"?n=(0,Bo.jsx)(Vt,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(n=(0,Bo.jsx)(Vt,{code:t,language:"json"})),(0,Bo.jsxs)("div",{className:l("space-y-2 Bo-4",e),...a,children:[(0,Bo.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:o?"Error":"Result"}),(0,Bo.jsxs)("div",{className:l("overflow-x-auto rounded-md text-xs [&_table]:w-full",o?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[o&&(0,Bo.jsx)("div",{children:o}),n]})]})};var Aa=require("date-fns");function Ra({taskId:e,polling:t=!0,system:o="payload"}){let[a,n]=(0,ct.useState)(null),[i,r]=(0,ct.useState)(!1),[s,c]=(0,ct.useState)(null),m=async(f=!0)=>{if(e){f&&r(!0);try{let y=await fetch(`/api/tasks/${e}`);if(!y.ok)throw new Error(`Failed to fetch task: ${y.statusText}`);let R=await y.json();n(R)}catch(y){console.error("Error fetching task:",y),c(y instanceof Error?y:new Error("Unknown error occurred"))}finally{f&&r(!1)}}},w=()=>m(!1);return(0,ct.useEffect)(()=>{e&&m(!0);let f=null;return e&&t&&(f=setInterval(w,5e3)),()=>{f&&clearInterval(f)}},[e,t]),{task:a,loading:i,error:s}}var cr=e=>{switch(e){case"backlog":return"bg-gray-200 text-gray-800";case"todo":return"bg-blue-200 text-blue-800";case"inProgress":return"bg-yellow-200 text-yellow-800";case"done":return"bg-green-200 text-green-800";case"cancelled":return"bg-red-200 text-red-800";default:return"bg-gray-200 text-gray-800"}},dr=e=>{switch(e){case"inProgress":return"In Progress";default:return e.charAt(0).toUpperCase()+e.slice(1)}};function Ma({data:e}){let{id:t,system:o,fetchLatest:a,taskData:n,error:i}=e||{};if(!t)return null;let r=null,s=!0,c=i,m=a!==void 0?a:!0;if(r=n||{id:t,name:"Loading...",description:"",status:"todo",dateLogged:new Date().toISOString(),project:void 0},console.log("ChatCardTask",{data:e,id:t,initialFetchLatest:a,system:o,fetchLatest:m,taskData:r,error:c}),m){let{task:R,loading:A,error:T}=Ra({taskId:t,system:o});r=R,s=A,c=T}else s=!1;let w=cr(r?.status||"todo"),f=dr(r?.status||"todo"),y=r?.dateLogged||new Date().toISOString();try{let R=new Date(r?.dateLogged||"");isNaN(R.getTime())||(y=(0,Aa.formatDistanceToNow)(R,{addSuffix:!0}))}catch{}return(0,Bo.jsxs)(ge,{className:l("w-full max-w-md shadow-md",c&&"border border-destructive"),children:[(0,Bo.jsxs)(Le,{className:"pb-2",children:[(0,Bo.jsxs)("div",{className:"flex justify-between items-start",children:[(0,Bo.jsx)(Ee,{className:"text-lg font-semibold",children:s?"Loading...":r?.name||"Task"}),(0,Bo.jsx)(ae,{className:`${w}`,children:f})]}),r?.project&&(0,Bo.jsxs)(co,{className:"text-sm text-gray-500",children:["Project: ",r.project.name]})]}),(0,Bo.jsx)(Pe,{className:"pb-2",children:s?(0,Bo.jsx)("div",{className:"animate-pulse Bo-4 bg-gray-200 rounded w-3/4 mb-2"}):c?(0,Bo.jsx)("Bo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Bo.jsx)("Bo",{className:"text-sm text-foreground",children:r?.description||"......."})}),(0,Bo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Bo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Bo.jsx)(Oa.Clock,{className:"Bo-3 w-3 mr-1"}),(0,Bo.jsxs)("span",{children:["Created ",y]}),(0,Bo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Bo.jsxs)("span",{children:["Task #",t]})]})})]})}function La({artefact:e,taskId:t,taskData:o,loading:a=!1,error:n=null}){let i=o||{id:t,name:"Loading...",description:"",status:"done",dateLogged:new Date().toISOString(),project:{id:-1,name:""}},r=i.dateLogged;try{let s=new Date(i.dateLogged);isNaN(s.getTime())||(r=(0,Aa.formatDistanceToNow)(s,{addSuffix:!0}))}catch{}return(0,Bo.jsxs)(ge,{className:"w-full max-w-md shadow-md",children:[(0,Bo.jsx)(Le,{className:"pb-2",children:(0,Bo.jsx)("div",{className:"flex justify-between items-start",children:(0,Bo.jsx)(Ee,{className:"text-lg font-semibold",children:a?"Loading...":i.name})})}),(0,Bo.jsx)(Pe,{className:"pb-2",children:a?(0,Bo.jsx)("div",{className:"animate-pulse Bo-4 bg-gray-200 rounded w-3/4 mb-2"}):n?(0,Bo.jsx)("Bo",{className:"text-sm text-red-500",children:"Error loading task details"}):(0,Bo.jsx)("Bo",{className:"text-sm text-foreground",children:e})}),(0,Bo.jsx)(ht,{className:"pt-2 flex items-center justify-between",children:(0,Bo.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[(0,Bo.jsx)(Oa.Clock,{className:"Bo-3 w-3 mr-1"}),(0,Bo.jsxs)("span",{children:["Created ",r]}),(0,Bo.jsx)("span",{className:"mx-2",children:"\u2022"}),(0,Bo.jsxs)("span",{children:["Task #",i.id]})]})})]})}var pr=e=>e.startsWith("image/")?(0,Bo.jsx)(Oa.Image,{className:"Bo-4 w-4"}):e.startsWith("text/")?(0,Bo.jsx)(Oa.FileText,{className:"Bo-4 w-4"}):(0,Bo.jsx)(Oa.File,{className:"Bo-4 w-4"}),Ea=({message:e,addToolResult:t,status:o,messages:a})=>e.parts.map((n,i)=>{if(n.type==="text")return(0,Bo.jsx)(yt,{children:n.text},`${i}`);if(n.type==="file"){let r=n;return(0,Bo.jsx)("div",{className:"mb-2 Bo-2 bg-background/50 rounded-lg",children:(0,Bo.jsxs)("div",{className:"flex items-center gap-2",children:[pr(r.mediaType||"application/octet-stream"),(0,Bo.jsx)("div",{className:"flex-1 min-w-0",children:(0,Bo.jsx)("Bo",{className:"text-sm font-medium truncate",children:r.filename||r.url?.split("/").pop()||"File"})}),r.url&&(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(r.url,"_blank"),className:"Bo-8 w-8 Bo-0",children:(0,Bo.jsx)(Oa.Download,{className:"Bo-4 w-4"})})]})},i)}if(n.type.startsWith("tool-")){let r=n,s=n.type.replace("tool-","");if(s==="task")switch(r.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading task..."},i);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(Ma,{data:{id:r.output?.id||r.input?.id,fetchLatest:!1,taskData:r.output||r.input}})},i);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}if(n.type==="tool-requestEndpointLogin")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-authenticate")return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(uo,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(n.type==="tool-requestApproval")return console.log("Rendering PartApprovalTool with toolPart:",r),(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(va,{toolPart:r,index:i,addToolResult:t??(()=>{})})},i);if(s==="artefact")switch(r.state){case"input-available":return(0,Bo.jsx)("div",{className:"text-sm opacity-70",children:"Loading artefact..."},i);case"output-available":return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(La,{artefact:r.output?.description||"",taskId:r.output?.id||r.input?.id,taskData:r.output||r.input})},i);case"output-error":return(0,Bo.jsxs)("div",{className:"text-sm text-red-500",children:["Error: ",r.errorText]},i);default:return null}return(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Bo.jsxs)(Pe,{children:[r.state==="input-available"&&(0,Bo.jsxs)("Bo",{className:"text-sm",children:["Processing ",s,"..."]}),r.state==="output-available"&&(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.output,null,2)}),r.state==="output-error"&&(0,Bo.jsxs)("Bo",{className:"text-sm text-red-500",children:["Error: ",r.errorText]})]})]})},i)}if(n.type.startsWith("data-")){let r=n,s=n.type.replace("data-","");return s==="reference"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsx)(ge,{className:"w-full",children:(0,Bo.jsx)(Pe,{className:"Bo-4",children:(0,Bo.jsx)("div",{className:"space-y-2",children:r.data?.references?.map((c,m)=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 Bo-2 rounded-md bg-muted/50",children:[(0,Bo.jsx)(ae,{variant:"outline",children:c.type||"link"}),(0,Bo.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,Bo.jsx)("Bo",{className:"text-sm font-medium truncate",children:c.title}),c.description&&(0,Bo.jsx)("Bo",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),c.url&&(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>window.open(c.url,"_blank"),className:"Bo-8 w-8 Bo-0",children:(0,Bo.jsx)(Oa.ExternalLink,{className:"Bo-4 w-4"})})]},m))})})})},i):s==="menu"?(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:r.data?.title})}),(0,Bo.jsx)(Pe,{children:(0,Bo.jsx)("div",{className:"space-y-2",children:r.data?.items?.map((c,m)=>(0,Bo.jsx)(D,{variant:"outline",className:"w-full justify-start",onClick:c.action,children:(0,Bo.jsxs)("div",{className:"text-left",children:[(0,Bo.jsx)("Bo",{className:"font-medium",children:c.label}),c.description&&(0,Bo.jsx)("Bo",{className:"text-xs text-muted-foreground",children:c.description})]})},m))})})]})},i):(0,Bo.jsx)("div",{className:"mb-2",children:(0,Bo.jsxs)(ge,{className:"w-full max-w-md",children:[(0,Bo.jsx)(Le,{children:(0,Bo.jsx)(Ee,{className:"text-lg",children:s})}),(0,Bo.jsx)(Pe,{children:(0,Bo.jsx)("pre",{className:"text-sm",children:JSON.stringify(r.data,null,2)})})]})},i)}if(n.type==="reasoning")return(0,Bo.jsxs)(bo,{className:"w-full",isStreaming:o==="streaming"&&i===e.parts.length-1&&e.id===a.at(-1)?.id,children:[(0,Bo.jsx)(vo,{}),(0,Bo.jsx)(ho,{children:n.text})]},`${i}`);if(n.type==="dynamic-tool")return(0,Bo.jsxs)(Na,{defaultOpen:n.state!=="output-available",children:[(0,Bo.jsx)(ka,{type:`tool-${n.toolName}`,state:n.state}),(0,Bo.jsxs)(Pa,{children:[(0,Bo.jsx)(Ta,{input:n.input}),(0,Bo.jsx)(Da,{output:n.output,errorText:n.errorText})]})]},`${e.id}-${i}`)});var Ua=({className:e,from:t,...o})=>(0,Bo.jsx)("div",{className:l("group flex w-full items-end justify-end gap-2 py-4",t==="user"?"is-user":"is-assistant flex-row-reverse justify-end",e),...o}),mr=(0,Io.cva)("is-user:dark flex flex-col gap-2 overflow-hidden rounded-lg text-sm",{variants:{variant:{contained:["max-w-[80%] px-4 py-3","group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground","group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground"],flat:["group-[.is-user]:max-w-[80%] group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground"]}},defaultVariants:{variant:"contained"}}),Fa=({children:e,className:t,variant:o,...a})=>(0,Bo.jsx)("div",{className:l(mr({variant:o,className:t})),...a,children:e});function ja({messages:e,input:t,isTyping:o=!1,currentSessionTitle:a,capabilities:n,fileUploads:i,isDragOver:r,enableFileUpload:s,onInputChange:c,addToolResult:m,onSendMessage:w,onKeyPress:f,onFileUpload:y,onRemoveFile:R,onDragOver:A,className:T,status:C="ready"}){let N=(0,ct.useRef)(null),j=(0,ct.useRef)(null),S=(0,ct.useRef)(null),[M,_]=(0,ct.useState)(!1),[$,se]=(0,ct.useState)({path:[],selectedItems:[],filters:{}});(0,ct.useEffect)(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,ct.useEffect)(()=>{M&&setTimeout(()=>{N.current?.scrollIntoView({behavior:"smooth"})},100)},[M]);let J=()=>po($),W=()=>{let u=[];return n.forEach(U=>{U.actions&&U.actions.forEach(ve=>{u.push({label:ve.label,action:()=>X(ve.id,{path:[U],selectedItems:[],filters:{}})})}),U.children&&U.children.forEach(ve=>{ve.type==="list"&&ve.data&&u.push({label:`View ${ve.name}`,action:()=>_(!0)})})}),u.slice(0,5)},X=(u,U)=>{console.log("Capability action:",u,U);let ve=`Executing ${u} with context: ${JSON.stringify(U.path.map(Ae=>Ae.name))}`;_(!1)},le=po({path:[],selectedItems:[],filters:{}}),I=u=>{y(u.target.files),u.target.files&&(u.target.value="")},Se=u=>{u.preventDefault(),A(!0)},d=u=>{u.preventDefault(),A(!1)},L=u=>{u.preventDefault(),A(!1),y(u.dataTransfer.files)},E=u=>{if(u===0)return"0 Bytes";let U=1024,ve=["Bytes","KB","MB","GB"],Ae=Math.floor(Math.log(u)/Math.log(U));return parseFloat((u/Math.pow(U,Ae)).toFixed(2))+" "+ve[Ae]},G=u=>u.startsWith("image/")?(0,Bo.jsx)(Oa.Image,{className:"Bo-4 w-4"}):u.startsWith("text/")?(0,Bo.jsx)(Oa.FileText,{className:"Bo-4 w-4"}):(0,Bo.jsx)(Oa.File,{className:"Bo-4 w-4"}),Z={messages:e,currentSessionTitle:a,capabilities:n,currentCapabilityContext:$,contextualActions:le,getQuickSuggestions:W().map(u=>u.label)},be=()=>{navigator.clipboard.writeText(JSON.stringify(Z,null,2)),alert("Debug info copied to clipboard")};return(0,Bo.jsxs)("div",{className:`Bo-full flex flex-col relative size-full shadow-sm max-w-4xl mx-auto ${T||""}`,children:[(0,Bo.jsxs)(Ce,{ref:j,className:"flex-1 Bo-4 bg-background border-0",onDragOver:Se,onDragLeave:d,onDrop:L,children:[(0,Bo.jsxs)("div",{className:l("space-y-4",r&&"ring-2 ring-primary ring-offset-2 bg-primary/5"),children:[(0,Bo.jsx)(lt.animate,{children:e.map(u=>(0,Bo.jsx)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:(0,Bo.jsx)(Ua,{from:u.role,children:(0,Bo.jsx)(Fa,{variant:"flat",children:Ea({message:u,addToolResult:m??(()=>{}),status:C,messages:e})})},u.id)},u.id))}),M&&(0,Bo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex gap-3",children:[(0,Bo.jsx)(et,{className:"Bo-8 w-8",children:(0,Bo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(Oa.Bot,{className:"Bo-4 w-4"})})}),(0,Bo.jsx)("div",{className:"flex-1 bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsx)(ma,{capabilities:n,isOpen:M,onToggle:()=>_(!M),onActionSelect:X,className:"w-full"})})]}),o&&(0,Bo.jsxs)(lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex gap-3",children:[(0,Bo.jsx)(et,{className:"Bo-8 w-8",children:(0,Bo.jsx)(tt,{className:"bg-gradient-to-br from-purple-600 to-blue-600 text-white",children:(0,Bo.jsx)(Oa.Bot,{className:"Bo-4 w-4"})})}),(0,Bo.jsx)("div",{className:"bg-muted rounded-2xl px-4 py-3 shadow-sm",children:(0,Bo.jsxs)("div",{className:"flex space-x-1",children:[(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce"}),(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,Bo.jsx)("div",{className:"w-2 Bo-2 bg-muted-foreground/50 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})]})]}),(0,Bo.jsx)("div",{ref:N})]}),i.length>0&&(0,Bo.jsx)("div",{className:"Bo-4 border-t bg-muted/10",children:(0,Bo.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(u=>(0,Bo.jsxs)("div",{className:"flex items-center gap-2 bg-background rounded-lg Bo-2 border",children:[G(u.file.type),(0,Bo.jsx)("span",{className:"text-sm font-medium",children:u.file.name}),(0,Bo.jsx)("span",{className:"text-xs text-muted-foreground",children:E(u.file.size)}),(0,Bo.jsx)(D,{variant:"ghost",size:"sm",onClick:()=>R(u.id),className:"Bo-6 w-6 Bo-0",children:(0,Bo.jsx)(Oa.X,{className:"Bo-4 w-4"})})]},u.id))})}),(0,Bo.jsxs)("div",{className:"border rounded-2xl Bo-4 bg-muted/20",children:[(0,Bo.jsxs)("div",{className:"flex gap-3",children:[(0,Bo.jsx)(gt,{value:t,onChange:u=>c(u.target.value),onKeyPress:f,placeholder:"How can I help you today?",className:"flex-1 rounded-2xl bg-background shadow-sm",disabled:o}),s&&(0,Bo.jsx)(D,{variant:"outline",size:"icon",onClick:()=>S.current?.click(),className:"rounded-2xl Bo-10 w-10 shadow-sm",children:(0,Bo.jsx)(Oa.Paperclip,{className:"Bo-4 w-4"})}),(0,Bo.jsx)(D,{onClick:w,disabled:!t.trim()&&i.length===0||o,size:"icon",className:"rounded-2xl Bo-10 w-10 shadow-sm",children:(0,Bo.jsx)(Oa.Send,{className:"Bo-4 w-4"})})]}),(0,Bo.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,Bo.jsxs)(D,{onClick:()=>_(!M),variant:"outline",size:"sm",className:"rounded-full text-xs flex-shrink-0",children:[(0,Bo.jsx)(Oa.Menu,{className:"Bo-3 w-3 mr-1"}),M?"Hide":"Show"," Capabilities"]}),(0,Bo.jsxs)("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:[J().map((u,U)=>(0,Bo.jsx)(D,{variant:"default",size:"sm",className:"rounded-full text-xs bg-accent hover:bg-accent/80",onClick:()=>X(u.id,$),children:u.label},`context-${u.id}`)),J().length===0&&W().map((u,U)=>(0,Bo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs",onClick:u.action,children:u.label},`suggestion-${U}`)),(0,Bo.jsx)(D,{variant:"outline",size:"sm",className:"rounded-full text-xs ml-auto",onClick:be,children:"Debug"})]})]}),s&&(0,Bo.jsx)("input",{ref:S,type:"file",multiple:!0,onChange:I,className:"hidden"})]})]})}function ur({aiConfig:e,useCustomChat:t,enableAI:o=!0,messages:a=[],businessUnits:n=[],capabilities:i=[],sidebarItems:r=[],notifications:s=[],sessions:c=[],onNewChat:m,onSessionSelect:w,onSessionDelete:f,onSessionEdit:y=()=>{},onBusinessUnitChange:R=()=>{},onNotificationRemove:A=()=>{},onRemoveAll:T=()=>{},onActionClick:C=()=>{},onSearch:N=L=>console.log("Search query:",L),initialTeam:j="design",currentSession:S=null,showCapabilities:M=!0,title:_="Digital Colleagues",enableFileUpload:$=!0,maxFileSize:se=10,allowedFileTypes:J=["image/*","text/*","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],logo:W="/headerlogo.png",appName:X="Nuvia",tagline:le="AI-Powered Workspace",actionIcon:I=(0,Bo.jsx)(Oa.Users,{className:"mr-2 Bo-4 w-4"}),actionText:Se="Collaborate",sidebarInitiallyClosed:d=!1}){let L={...e,onError:F=>{G?.setMessages(ce=>[...ce,{role:"assistant",id:`error-${Date.now()}`,createdAt:new Date,parts:[{type:"text",text:F.message}]}]),console.error("Error in CopilotInterface:",F)}},E=(0,Ha.useChat)(L||{}),G=o?t||E:null,[Z,be]=(0,ct.useState)(""),[u,U]=(0,ct.useState)(!1),ve=G?.messages||a,Ae=Z,Va=G?.status==="submitted"||u,Wa=G?.addToolResult?(F,ce,ee)=>{G.addToolResult({tool:ce,toolCallId:F,output:ee}),console.log("Tool result added:",{toolCallId:F,tool:ce,output:ee}),G.sendMessage()}:()=>{console.log("addToolResult not available")},dt=n||[],Ga={id:"default",name:"Default Team",description:"Default team when no business units are available",icon:"\u{1F3E2}",color:"bg-gray-500",accentColor:"bg-gray-600"},[$a,qa]=(0,ct.useState)(()=>dt.length===0?Ga:dt.find(F=>F.id===j)||dt[0]),[pt,xt]=(0,ct.useState)([]),[Ka,_a]=(0,ct.useState)(!1),Ja=F=>{if(!F||!$)return;let ce=[];Array.from(F).forEach(ee=>{if(ee.size>se*1024*1024){alert(`File ${ee.name} is too large. Maximum size is ${se}MB.`);return}if(J.length>0&&!J.some(wt=>ee.type.match(wt))){alert(`File type ${ee.type} is not allowed.`);return}let wo={id:Date.now().toString()+Math.random().toString(36).substr(2,9),file:ee,status:"pending",progress:0};if(ee.type.startsWith("image/")){let wt=new FileReader;wt.onload=ei=>{xt(ti=>ti.map($t=>$t.id===wo.id?{...$t,preview:ei.target?.result}:$t))},wt.readAsDataURL(ee)}ce.push(wo)}),xt(ee=>[...ee,...ce])},Xa=F=>{xt(ce=>ce.filter(ee=>ee.id!==F))},xo=()=>{if(!(!Ae.trim()&&pt.length===0)){if(G){let F=pt.length>0?Qa(pt.map(ce=>ce.file)):void 0;G.sendMessage({text:Ae,files:F},{body:{timestamp:Date.now()}}),be("")}else console.log("Message to send:",Ae),console.log("Files to upload:",pt),be(""),U(!0),setTimeout(()=>{U(!1)},1500);xt([])}},Qa=F=>{let ce=new DataTransfer;return F.forEach(ee=>ce.items.add(ee)),ce.files},Ya=F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),xo())},Za=F=>{be(F)};return(0,Bo.jsx)(ca,{sidebarItems:r||[],title:_,notifications:s||[],businessUnits:dt,currentBusinessUnit:$a,onBusinessUnitChange:F=>{F&&(qa(F),R?.(F))},onSearch:N,showTabs:!1,onActionClick:C,actionIcon:I,actionText:Se,onNotificationRemove:A,onRemoveAll:T,logo:W,appName:X,tagline:le,sidebarInitiallyClosed:d,children:(0,Bo.jsx)(Gt.AnimatePresence,{mode:"wait",children:(0,Bo.jsx)(Gt.motion.div,{className:"flex-1 Bo-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:(0,Bo.jsxs)("div",{className:"Bo-full flex",children:[(0,Bo.jsx)("div",{className:"w-80 flex-shrink-0 Bo-full Bo-2",children:(0,Bo.jsx)(da,{sessions:c||[],currentSession:S,teams:dt,onNewChat:m,onSessionSelect:w,onSessionEdit:y,onSessionDelete:f})}),(0,Bo.jsx)("div",{className:"flex-1 Bo-full Bo-2",children:(0,Bo.jsx)(ja,{messages:ve||[],input:Ae,isTyping:Va,currentSessionTitle:S?.title,capabilities:i||[],onInputChange:Za,addToolResult:Wa,onSendMessage:xo,onKeyPress:Ya,fileUploads:pt,isDragOver:Ka,enableFileUpload:$,onFileUpload:Ja,onRemoveFile:Xa,onDragOver:_a})})]})},"chat-interface")})})}0&&(module.exports={CopilotInterface});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";import{a}from"../../chunk-
|
|
2
|
+
"use strict";import{a}from"../../chunk-JSHD7QTU.mjs";import"../../chunk-CTTBF7F4.mjs";import"../../chunk-56X4PU43.mjs";import"../../chunk-WAVVCASZ.mjs";import"../../chunk-347B45ZS.mjs";import"../../chunk-WRZP5K5X.mjs";import"../../chunk-V5VE3EIY.mjs";import"../../chunk-6OCLRAHU.mjs";import"../../chunk-5Y6FKL5W.mjs";import"../../chunk-EW6KWAHS.mjs";import"../../chunk-7JDMW5R3.mjs";import"../../chunk-6OT5PQXV.mjs";import"../../chunk-YPZAYXNQ.mjs";import"../../chunk-7TSR2LQB.mjs";import"../../chunk-QM5FOQHG.mjs";import"../../chunk-UA2E23AS.mjs";import"../../chunk-2LINLX4S.mjs";import"../../chunk-RL6365DN.mjs";import"../../chunk-LTTO57ZK.mjs";import"../../chunk-4WA47ZQA.mjs";import"../../chunk-NPVUICIF.mjs";import"../../chunk-VDN4LQSS.mjs";import"../../chunk-FGEFYI5E.mjs";import"../../chunk-MU5WPW4N.mjs";import"../../chunk-AZKOVKSK.mjs";import"../../chunk-Q2DPE66H.mjs";import"../../chunk-INCYANPB.mjs";import"../../chunk-RLVKIMGU.mjs";import"../../chunk-OCPX4QPC.mjs";import"../../chunk-FT3AE7L2.mjs";import"../../chunk-3UMMMQEH.mjs";import"../../chunk-YNCJATT7.mjs";import"../../chunk-L5JPAKPM.mjs";import"../../chunk-KY7WQYN4.mjs";import"../../chunk-ZUA4KNIR.mjs";import"../../chunk-SOLZ4VQH.mjs";import"../../chunk-CSBGSBEU.mjs";import"../../chunk-YO3GQYRJ.mjs";import"../../chunk-EGEO3FNE.mjs";import"../../chunk-MDJREBVI.mjs";import"../../chunk-ZWHGOTSF.mjs";import"../../chunk-Q3G5UAAD.mjs";import"../../chunk-XGRRLABA.mjs";import"../../chunk-FLHDNCNY.mjs";import"../../chunk-YEKQJ4YC.mjs";export{a as CopilotInterface};
|