@markus-global/cli 0.12.3 → 0.12.4

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.
Files changed (66) hide show
  1. package/dist/markus.mjs +31 -8
  2. package/dist/web-ui/assets/{AsyncState-_UC7xcxJ.js → AsyncState-BTLUPIr1.js} +1 -1
  3. package/dist/web-ui/assets/{ChatComponents-Ca9tWI9W.js → ChatComponents-DTB3H_n2.js} +1 -1
  4. package/dist/web-ui/assets/{ContentRenderer-C-V5k_3K.js → ContentRenderer-BZXRiKE3.js} +2 -2
  5. package/dist/web-ui/assets/{DeliverableShareModal-BvpyowYJ.js → DeliverableShareModal-BwZP39nd.js} +1 -1
  6. package/dist/web-ui/assets/{Deliverables-CQnWqbTb.js → Deliverables-3Y3zjT_1.js} +1 -1
  7. package/dist/web-ui/assets/{MarkdownMessage-DedA8Zob.js → MarkdownMessage-DVfFMzM9.js} +1 -1
  8. package/dist/web-ui/assets/{Search-CVYQIy_D.js → Search-BI3hk-5j.js} +1 -1
  9. package/dist/web-ui/assets/{SendToChat-IOAvuta-.js → SendToChat-D_5zHO-k.js} +1 -1
  10. package/dist/web-ui/assets/{Settings-BQDqf4q5.js → Settings-DTUjLhJY.js} +1 -1
  11. package/dist/web-ui/assets/{Store-BEsLd_RN.js → Store-B8ksRjHF.js} +1 -1
  12. package/dist/web-ui/assets/{Switch-C6InTNUi.js → Switch-RmZHA47D.js} +1 -1
  13. package/dist/web-ui/assets/{Team-nfNyWj-s.js → Team-BRgI1zM9.js} +4 -4
  14. package/dist/web-ui/assets/{Work-BQvgkynj.js → Work-nah0UYFz.js} +1 -1
  15. package/dist/web-ui/assets/{arc-DP1Vf7Sx.js → arc-VmvI7TpW.js} +1 -1
  16. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-Buq8JYN8.js → architectureDiagram-3BPJPVTR-CTUtPasm.js} +1 -1
  17. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-BCa2p2_X.js → blockDiagram-GPEHLZMM-xeYAqtZJ.js} +1 -1
  18. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-BxsgggQY.js → c4Diagram-AAUBKEIU-BiFgoGY5.js} +1 -1
  19. package/dist/web-ui/assets/channel-s7K3KXLr.js +1 -0
  20. package/dist/web-ui/assets/{chunk-2J33WTMH-BJZZ60c9.js → chunk-2J33WTMH-DueHBqOn.js} +1 -1
  21. package/dist/web-ui/assets/{chunk-4BX2VUAB-C5hc4E6J.js → chunk-4BX2VUAB-B8zgDfSV.js} +1 -1
  22. package/dist/web-ui/assets/{chunk-55IACEB6-CbyvZ6Mk.js → chunk-55IACEB6-DieD55CP.js} +1 -1
  23. package/dist/web-ui/assets/{chunk-727SXJPM-JmNt9TVA.js → chunk-727SXJPM-Do4Z9LQ0.js} +1 -1
  24. package/dist/web-ui/assets/{chunk-AQP2D5EJ-BTk0v5ba.js → chunk-AQP2D5EJ-qrYsW5ml.js} +1 -1
  25. package/dist/web-ui/assets/{chunk-FMBD7UC4-BO-dhB1U.js → chunk-FMBD7UC4-BSz3QT1q.js} +1 -1
  26. package/dist/web-ui/assets/{chunk-ND2GUHAM-BdjCcLdb.js → chunk-ND2GUHAM-utDWSydt.js} +1 -1
  27. package/dist/web-ui/assets/{chunk-QZHKN3VN-BAzRC82n.js → chunk-QZHKN3VN-Cd86CYHV.js} +1 -1
  28. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-B2mHhFY8.js +1 -0
  29. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-B2mHhFY8.js +1 -0
  30. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-CVffmErT.js → cose-bilkent-S5V4N54A-Dc6cP9WW.js} +1 -1
  31. package/dist/web-ui/assets/{dagre-BM42HDAG-Dd9pB2fX.js → dagre-BM42HDAG-4b0Wf_6D.js} +1 -1
  32. package/dist/web-ui/assets/{diagram-2AECGRRQ-BG_AUqzM.js → diagram-2AECGRRQ-zS_j1Kf4.js} +1 -1
  33. package/dist/web-ui/assets/{diagram-5GNKFQAL-D5qFMRFf.js → diagram-5GNKFQAL-CPo-_Ime.js} +1 -1
  34. package/dist/web-ui/assets/{diagram-KO2AKTUF-B3qTxSWl.js → diagram-KO2AKTUF-CjHOA4_j.js} +1 -1
  35. package/dist/web-ui/assets/{diagram-LMA3HP47-BrxC1636.js → diagram-LMA3HP47-CalZRF6K.js} +1 -1
  36. package/dist/web-ui/assets/{diagram-OG6HWLK6-BvXyEQ9-.js → diagram-OG6HWLK6-DnLAhsLX.js} +1 -1
  37. package/dist/web-ui/assets/{docx-preview-DBAZFeEb.js → docx-preview-uRVPnxwM.js} +1 -1
  38. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-CMap9oy_.js → erDiagram-TEJ5UH35-L0nzlMSn.js} +1 -1
  39. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-BZerJtvk.js → flowDiagram-I6XJVG4X-Bdc3UwtW.js} +1 -1
  40. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-CagPMHMO.js → ganttDiagram-6RSMTGT7-CFRmj_qc.js} +1 -1
  41. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-DZ5dDKRu.js → gitGraphDiagram-PVQCEYII-B5hZwcoJ.js} +1 -1
  42. package/dist/web-ui/assets/{index-CKPQYzzR.js → index-TPf50ZeO.js} +6 -6
  43. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-CHLdsDUZ.js → infoDiagram-5YYISTIA-DVT4RgPd.js} +1 -1
  44. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-SdeinQaS.js → ishikawaDiagram-YF4QCWOH-Bf7pvUY_.js} +1 -1
  45. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-BtlL2fi0.js → journeyDiagram-JHISSGLW-NVRjJlnd.js} +1 -1
  46. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-BKPQYXkB.js → kanban-definition-UN3LZRKU-Co7BKMut.js} +1 -1
  47. package/dist/web-ui/assets/{mermaid.core-MkJR6w4B.js → mermaid.core-CCf28Hq6.js} +5 -5
  48. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-CbOmHX_u.js → mindmap-definition-RKZ34NQL-DepMhVEb.js} +1 -1
  49. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CypGjJP1.js → pieDiagram-4H26LBE5-Cq9ANaI0.js} +1 -1
  50. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-CGtemfUz.js → quadrantDiagram-W4KKPZXB-CUY0BWhQ.js} +1 -1
  51. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-N7YfpCvE.js → requirementDiagram-4Y6WPE33-D9fU5rCm.js} +1 -1
  52. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-CYnSrei-.js → sankeyDiagram-5OEKKPKP-CMHhuSQF.js} +1 -1
  53. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-CsB7dCPF.js → sequenceDiagram-3UESZ5HK-Bjx53SID.js} +1 -1
  54. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-DTDFUXFP.js → stateDiagram-AJRCARHV-DVvatKnO.js} +1 -1
  55. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-92MmE2MZ.js +1 -0
  56. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-C_bWAN9B.js → timeline-definition-PNZ67QCA-9I80LG9m.js} +1 -1
  57. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-CX_qAuUT.js → vennDiagram-CIIHVFJN-B82Deutq.js} +1 -1
  58. package/dist/web-ui/assets/{wardley-L42UT6IY-q53jQ293.js → wardley-L42UT6IY-BKXtp57W.js} +1 -1
  59. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-D34dKCJU.js → wardleyDiagram-YWT4CUSO-DzqTzfYa.js} +1 -1
  60. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-BFAngp66.js → xychartDiagram-2RQKCTM6-TowyDWYu.js} +1 -1
  61. package/dist/web-ui/index.html +1 -1
  62. package/package.json +1 -1
  63. package/dist/web-ui/assets/channel-BTSrOo6c.js +0 -1
  64. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-BSYlcnF9.js +0 -1
  65. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-BSYlcnF9.js +0 -1
  66. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-AVnDjlzF.js +0 -1
@@ -1,4 +1,4 @@
1
- import{u as Qe,j as e,r as a,a as Bs,b as As,Q as Ms,R as ns,c as $s,k as h,U as wt,V as as,W as Ds,P as I,n as J,X as Vs,Y as Fs,Z as Hs,h as Ws,i as ls,N as _s}from"./index-CKPQYzzR.js";import{MarkdownMessage as Nt}from"./MarkdownMessage-DedA8Zob.js";import{resolveFormat as Us,ContentRenderer as Os}from"./ContentRenderer-C-V5k_3K.js";import{c as Ks,a as zs,D as Gs}from"./DeliverableShareModal-BvpyowYJ.js";import{S as Ys,s as qs}from"./SendToChat-IOAvuta-.js";import"./chatChips-DVIRVTpT.js";function M(o){return Array.isArray(o)?o.map(d=>String(d).trim()).filter(Boolean):typeof o=="string"&&o?o.split(",").map(d=>d.trim()).filter(Boolean):[]}function Qs(o){return o.files&&typeof o.files=="object"&&!Array.isArray(o.files)?o.files:null}function ee({label:o,value:d}){return d?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:o}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:d})]}):null}function xe({label:o,value:d,color:u}){if(!d)return null;const s={purple:"bg-brand-500/15 text-brand-500",cyan:"bg-blue-500/15 text-blue-600",indigo:"bg-brand-500/15 text-brand-500",gray:"bg-gray-500/15 text-fg-secondary",emerald:"bg-green-500/15 text-green-600"};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:o}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${s[u]??s.gray} capitalize inline-block`,children:d})]})}function St({files:o}){const{t:d}=Qe(["builder","common"]),[u,s]=a.useState(Object.keys(o)[0]??""),c=Object.keys(o);return c.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d("builder:artifact.files",{count:c.length})}),e.jsxs("div",{className:"mt-1 bg-surface-elevated/50 rounded-lg border border-border-default/30 overflow-hidden",children:[e.jsx("div",{className:"flex gap-0.5 px-1.5 py-1 border-b border-border-default/30 overflow-x-auto",children:c.map(b=>e.jsx("button",{onClick:()=>s(b),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${u===b?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:b},b))}),u&&o[u]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:o[u]})]})]})}function Xs({artifact:o,mode:d}){const{t:u}=Qe(["builder","common"]),s=Qs(o),c=o.agent,b=o.team,S=o.dependencies,w=o.displayName??o.name;if(d==="agent"){const j=c?.roleName,P=c?.agentRole,k=c?.llmProvider,R=c?.llmModel,g=M(S?.env),E=M(S?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[j&&e.jsx(xe,{label:u("builder:artifact.baseTemplate"),value:j,color:"indigo"}),e.jsx(xe,{label:u("builder:artifact.agentRole"),value:P,color:P==="manager"?"purple":"cyan"})]}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.tags).map(N=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:N},N))}),(k||R)&&e.jsxs("div",{className:"flex gap-2",children:[k&&e.jsx(xe,{label:u("builder:artifact.llmProvider"),value:k,color:"gray"}),R&&e.jsx(xe,{label:u("builder:artifact.llmModel"),value:R,color:"gray"})]}),g.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:g.map(N=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:N},N))})]}),E.length>0&&e.jsx(ee,{label:u("builder:artifact.skills"),value:E.join(", ")}),s&&e.jsx(St,{files:s})]})}if(d==="team"){const P=b?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(xe,{label:u("builder:artifact.category"),value:o.category,color:"indigo"})}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.tags).map(k=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:k},k))}),s&&e.jsx(St,{files:s}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u("builder:artifact.members",{count:P.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:P.map((k,R)=>e.jsxs("div",{className:"bg-surface-elevated/30 rounded-lg px-2 py-1.5 border border-border-default/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center text-[10px] font-bold ${k.role==="manager"?"bg-brand-500/20 text-brand-500":"bg-blue-500/20 text-blue-600"}`,children:k.role==="manager"?"★":R+1}),e.jsx("span",{className:"text-xs text-fg-secondary flex-1 truncate",children:k.name}),typeof k.roleName=="string"&&k.roleName&&e.jsx("span",{className:"text-[10px] text-brand-500/70 font-mono",children:k.roleName}),e.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["x",String(k.count??1)]})]}),M(k.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:M(k.skills).map(g=>e.jsx("span",{className:"px-1 py-0.5 text-[9px] bg-green-500/10 text-green-600 rounded font-mono",children:g},g))})]},R))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(xe,{label:u("builder:artifact.category"),value:o.category,color:"indigo"})}),s&&e.jsx(St,{files:s}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.tags).map(j=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:j},j))})]})}function is(o){const d=document.scrollingElement,s=!!o&&o.scrollHeight>o.clientHeight+1?o:d,c=s?.scrollTop??0,b=s?.clientHeight??window.innerHeight,S=s?.scrollHeight??document.body.scrollHeight;return{scrollTop:c,clientHeight:b,scrollHeight:S,atTop:c<=0,atBottom:c+b>=S-1}}const fe={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},Zs=["file","directory"];function qe(o){return/^https?:\/\//i.test(o)}function L(o){return o?.shareStatus??null}function Js(o,d){const u=Date.now(),s=new Date(o).getTime(),c=u-s,b=Math.floor(c/6e4);if(b<1)return d("time.justNow");if(b<60)return d("time.minutesAgo",{count:b});const S=Math.floor(b/60);if(S<24)return d("time.hoursAgo",{count:S});const w=Math.floor(S/24);if(w===1)return d("time.yesterday");if(w<30)return d("time.daysAgo",{count:w});const j=Math.floor(w/30);return j<12?d("time.monthsAgo",{count:j}):d("time.yearsAgo",{count:Math.floor(j/12)})}function Ct(o){const d=o.title?.trim()||o.id;return{kind:"deliverable",label:`📄 ${qs(d)}`,content:["[deliverable]",`ID: ${o.id}`,`Title: ${o.title??""}`,o.reference?`Reference: ${o.reference}`:"",o.taskId?`Task: ${o.taskId}`:"",o.projectId?`Project: ${o.projectId}`:""].filter(Boolean).join(`
1
+ import{u as Qe,j as e,r as a,a as Bs,b as As,Q as Ms,R as ns,c as $s,k as h,U as wt,V as as,W as Ds,P as I,n as J,X as Vs,Y as Fs,Z as Hs,h as Ws,i as ls,N as _s}from"./index-TPf50ZeO.js";import{MarkdownMessage as Nt}from"./MarkdownMessage-DVfFMzM9.js";import{resolveFormat as Us,ContentRenderer as Os}from"./ContentRenderer-BZXRiKE3.js";import{c as Ks,a as zs,D as Gs}from"./DeliverableShareModal-BwZP39nd.js";import{S as Ys,s as qs}from"./SendToChat-D_5zHO-k.js";import"./chatChips-DVIRVTpT.js";function M(o){return Array.isArray(o)?o.map(d=>String(d).trim()).filter(Boolean):typeof o=="string"&&o?o.split(",").map(d=>d.trim()).filter(Boolean):[]}function Qs(o){return o.files&&typeof o.files=="object"&&!Array.isArray(o.files)?o.files:null}function ee({label:o,value:d}){return d?e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:o}),e.jsx("div",{className:"text-xs text-fg-secondary mt-0.5",children:d})]}):null}function xe({label:o,value:d,color:u}){if(!d)return null;const s={purple:"bg-brand-500/15 text-brand-500",cyan:"bg-blue-500/15 text-blue-600",indigo:"bg-brand-500/15 text-brand-500",gray:"bg-gray-500/15 text-fg-secondary",emerald:"bg-green-500/15 text-green-600"};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:o}),e.jsx("div",{className:`mt-0.5 px-2 py-0.5 rounded-full text-[10px] font-medium ${s[u]??s.gray} capitalize inline-block`,children:d})]})}function St({files:o}){const{t:d}=Qe(["builder","common"]),[u,s]=a.useState(Object.keys(o)[0]??""),c=Object.keys(o);return c.length===0?null:e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:d("builder:artifact.files",{count:c.length})}),e.jsxs("div",{className:"mt-1 bg-surface-elevated/50 rounded-lg border border-border-default/30 overflow-hidden",children:[e.jsx("div",{className:"flex gap-0.5 px-1.5 py-1 border-b border-border-default/30 overflow-x-auto",children:c.map(b=>e.jsx("button",{onClick:()=>s(b),className:`px-2 py-0.5 text-[10px] rounded whitespace-nowrap transition-colors ${u===b?"bg-brand-600/30 text-brand-500":"text-fg-tertiary hover:text-fg-secondary"}`,children:b},b))}),u&&o[u]!=null&&e.jsx("pre",{className:"p-2 text-[10px] text-fg-secondary max-h-[120px] overflow-auto whitespace-pre-wrap font-mono",children:o[u]})]})]})}function Xs({artifact:o,mode:d}){const{t:u}=Qe(["builder","common"]),s=Qs(o),c=o.agent,b=o.team,S=o.dependencies,w=o.displayName??o.name;if(d==="agent"){const j=c?.roleName,P=c?.agentRole,k=c?.llmProvider,R=c?.llmModel,g=M(S?.env),E=M(S?.skills);return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[j&&e.jsx(xe,{label:u("builder:artifact.baseTemplate"),value:j,color:"indigo"}),e.jsx(xe,{label:u("builder:artifact.agentRole"),value:P,color:P==="manager"?"purple":"cyan"})]}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.tags).map(N=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:N},N))}),(k||R)&&e.jsxs("div",{className:"flex gap-2",children:[k&&e.jsx(xe,{label:u("builder:artifact.llmProvider"),value:k,color:"gray"}),R&&e.jsx(xe,{label:u("builder:artifact.llmModel"),value:R,color:"gray"})]}),g.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u("builder:artifact.requiredEnv")}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:g.map(N=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-amber-500/10 text-amber-600 rounded font-mono",children:N},N))})]}),E.length>0&&e.jsx(ee,{label:u("builder:artifact.skills"),value:E.join(", ")}),s&&e.jsx(St,{files:s})]})}if(d==="team"){const P=b?.members??[];return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsx(xe,{label:u("builder:artifact.category"),value:o.category,color:"indigo"})}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.tags).map(k=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:k},k))}),s&&e.jsx(St,{files:s}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary uppercase tracking-wider",children:u("builder:artifact.members",{count:P.length})}),e.jsx("div",{className:"mt-1.5 space-y-1.5",children:P.map((k,R)=>e.jsxs("div",{className:"bg-surface-elevated/30 rounded-lg px-2 py-1.5 border border-border-default/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded flex items-center justify-center text-[10px] font-bold ${k.role==="manager"?"bg-brand-500/20 text-brand-500":"bg-blue-500/20 text-blue-600"}`,children:k.role==="manager"?"★":R+1}),e.jsx("span",{className:"text-xs text-fg-secondary flex-1 truncate",children:k.name}),typeof k.roleName=="string"&&k.roleName&&e.jsx("span",{className:"text-[10px] text-brand-500/70 font-mono",children:k.roleName}),e.jsxs("span",{className:"text-[10px] text-fg-tertiary",children:["x",String(k.count??1)]})]}),M(k.skills).length>0&&e.jsx("div",{className:"mt-1 ml-7 flex flex-wrap gap-1",children:M(k.skills).map(g=>e.jsx("span",{className:"px-1 py-0.5 text-[9px] bg-green-500/10 text-green-600 rounded font-mono",children:g},g))})]},R))})]})]})}return e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(ee,{label:u("builder:artifact.name"),value:w}),e.jsx(ee,{label:u("builder:artifact.description"),value:o.description}),e.jsx("div",{className:"flex gap-2",children:e.jsx(xe,{label:u("builder:artifact.category"),value:o.category,color:"indigo"})}),s&&e.jsx(St,{files:s}),M(o.tags).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:M(o.tags).map(j=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] bg-surface-elevated text-fg-tertiary rounded",children:j},j))})]})}function is(o){const d=document.scrollingElement,s=!!o&&o.scrollHeight>o.clientHeight+1?o:d,c=s?.scrollTop??0,b=s?.clientHeight??window.innerHeight,S=s?.scrollHeight??document.body.scrollHeight;return{scrollTop:c,clientHeight:b,scrollHeight:S,atTop:c<=0,atBottom:c+b>=S-1}}const fe={file:{icon:"📄",color:"bg-green-500/10 text-green-600"},directory:{icon:"📁",color:"bg-blue-500/10 text-blue-600"}},Zs=["file","directory"];function qe(o){return/^https?:\/\//i.test(o)}function L(o){return o?.shareStatus??null}function Js(o,d){const u=Date.now(),s=new Date(o).getTime(),c=u-s,b=Math.floor(c/6e4);if(b<1)return d("time.justNow");if(b<60)return d("time.minutesAgo",{count:b});const S=Math.floor(b/60);if(S<24)return d("time.hoursAgo",{count:S});const w=Math.floor(S/24);if(w===1)return d("time.yesterday");if(w<30)return d("time.daysAgo",{count:w});const j=Math.floor(w/30);return j<12?d("time.monthsAgo",{count:j}):d("time.yearsAgo",{count:Math.floor(j/12)})}function Ct(o){const d=o.title?.trim()||o.id;return{kind:"deliverable",label:`📄 ${qs(d)}`,content:["[deliverable]",`ID: ${o.id}`,`Title: ${o.title??""}`,o.reference?`Reference: ${o.reference}`:"",o.taskId?`Task: ${o.taskId}`:"",o.projectId?`Project: ${o.projectId}`:""].filter(Boolean).join(`
2
2
  `)}}const z={agent:{icon:"✦",color:"bg-brand-500/10 text-brand-500"},team:{icon:"◈",color:"bg-blue-500/10 text-blue-600"},skill:{icon:"⬡",color:"bg-amber-500/10 text-amber-600"}};function ir({authUser:o,previewMode:d,previewData:u}={}){const{t:s}=Qe(["deliverables","common"]),c=Bs(),b=As(I.DELIVERABLES),S=Ms({side:"left",defaultWidth:384,minWidth:280,maxWidth:600,storageKey:"markus_deliverables_list"}),[w,j]=a.useState(!1),P=a.useRef(w);P.current=w,a.useEffect(()=>(ns(I.DELIVERABLES,c&&w?1:0),()=>ns(I.DELIVERABLES,0)),[c,w]),a.useEffect(()=>{if(!c)return;const t=()=>{P.current&&j(!1)};return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[c]);const k=20,R=60,[g,E]=a.useState(u?.items??[]),[N,D]=a.useState(u?.items?.length??0),[m,te]=a.useState(!1),[Xe,It]=a.useState(u?.projects??[]),[Ze,Lt]=a.useState(u?.agents??[]),[cs,ds]=a.useState([]),[us,Rt]=a.useState(!1),[Et,xs]=a.useState([]),[me,Pt]=a.useState(!u),[Pe,Te]=a.useState(""),[pe,Be]=a.useState(""),[V,ge]=a.useState(""),[F,be]=a.useState(""),[H,W]=a.useState(""),[se,Ae]=a.useState(""),[fs,Je]=a.useState(!1),[$,hs]=a.useState("date"),[n,T]=a.useState(()=>u?.initialSelectedId&&u.items?u.items.find(t=>t.id===u.initialSelectedId)??u.items[0]??null:u?.items?.[0]??null),[et,Tt]=a.useState(null),[Bt,At]=a.useState(""),[re,ms]=a.useState(!0),[Mt,ye]=a.useState(()=>{const t=new Date,r=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;return new Set([r])}),[tt,ps]=a.useState(!1),[st,$t]=a.useState(!1),Me=a.useRef(null),[$e,ne]=a.useState(null),[De,Dt]=a.useState("markdown"),[ve,rt]=a.useState(null),[je,nt]=a.useState(null),[ae,at]=a.useState(null),[G,ke]=a.useState(null),[lt,le]=a.useState(!1),[Vt,Y]=a.useState(!1),[we,Ft]=a.useState(!1),[Ht,Ve]=a.useState(null),[it,Fe]=a.useState(null),[ot,He]=a.useState(null),[gs,ct]=a.useState(!1),[dt,bs]=a.useState(""),[Wt,ys]=a.useState(new Set),_t=ae&&n?.type==="file",We=_t||!!G&&n?.type==="directory",[_,q]=a.useState(!1),A=$s(),ie=A?.keyboardPane??"content",[Ne,oe]=a.useState(null),[ce,Q]=a.useState(!1),[Se,ut]=a.useState(""),[U,X]=a.useState(!1),[xt,Ut]=a.useState(!1),[ft,Z]=a.useState(null),ht=a.useRef(null),Ot=a.useCallback(t=>{t&&(t.style.height="auto",t.style.height=t.scrollHeight+"px")},[]),Kt=a.useRef(void 0);a.useEffect(()=>{Ot(ht.current)},[Se,ce,Ot]);const B=(t,r)=>{Tt({type:t,text:r}),setTimeout(()=>Tt(null),3e3)},_e=async t=>{await _s(t)?(Ft(!0),setTimeout(()=>Ft(!1),1500)):B("error",s("detail.copyFailed"))},Ue=a.useMemo(()=>new Map(Ze.map(t=>[t.id,t])),[Ze]),mt=a.useMemo(()=>new Map(Xe.map(t=>[t.id,t])),[Xe]),zt=a.useMemo(()=>new Map(Et.map(t=>[t.id,t])),[Et]),Ce=a.useCallback(t=>{if(!t||t==="default")return null;const r=mt.get(t)?.name;return!r||r==="default"?null:r},[mt]);a.useEffect(()=>{d||(h.projects.list().then(t=>It(t.projects)).catch(()=>{}),h.agents.list().then(t=>Lt(t.agents??[])).catch(()=>{}),h.users.list().then(t=>ds(t.users??[])).catch(()=>{}),h.teams.list().then(t=>xs(t.teams??[])).catch(()=>{}),h.system.info().then(t=>bs(t.dataDir+"/shared")).catch(()=>{}),h.deliverables.checkHealth().then(t=>ys(new Set(t.missingFiles))).catch(()=>{}))},[d]),a.useEffect(()=>(Kt.current=setTimeout(()=>Be(Pe),300),()=>clearTimeout(Kt.current)),[Pe]);const de=a.useMemo(()=>({q:pe||void 0,projectId:se||void 0,type:V||void 0,artifactType:F||void 0,source:H||void 0}),[pe,V,F,se,H]),ue=$==="date"?k:R,pt=a.useCallback((t,r)=>r?{...r,hubShareId:r.hubShareId!=null?r.hubShareId:t.hubShareId??null,shareStatus:r.shareStatus!=null?r.shareStatus:t.shareStatus??null,shareUrl:r.shareUrl!=null?r.shareUrl:t.shareUrl??null,shareVisibility:r.shareVisibility!=null?r.shareVisibility:t.shareVisibility??null,shareReason:r.shareReason!=null?r.shareReason:t.shareReason}:t,[]),Oe=a.useCallback(async()=>{try{const{results:t,total:r}=await h.deliverables.search({...de,offset:0,limit:ue});E(i=>i.map(l=>{const f=t.find(x=>x.id===l.id);return f?pt(l,f):l})),D(r),T(i=>{if(!i)return null;const l=t.find(f=>f.id===i.id);return l?pt(i,l):i})}catch{}},[de,ue,pt]),O=a.useCallback(async()=>{Pt(!0),Me.current?.scrollTo({top:0,behavior:"instant"}),window.scrollY>0&&window.scrollTo({top:0,behavior:"instant"});try{const{results:t,total:r}=await h.deliverables.search({...de,offset:0,limit:ue});E(t),D(r),T(i=>i&&t.some(l=>l.id===i.id)?i:null)}catch{E([]),D(0),T(null)}Pt(!1)},[de,ue]),vs=a.useCallback(async()=>{if(!(m||g.length>=N)){te(!0);try{const{results:t,total:r}=await h.deliverables.search({...de,offset:g.length,limit:ue});E(i=>[...i,...t]),D(r)}catch{}te(!1)}},[de,ue,g.length,N,m]);a.useEffect(()=>{d||O()},[O,d]),a.useEffect(()=>{!d||!u||(E(u.items??[]),D(u.items?.length??0),It(u.projects??[]),Lt(u.agents??[]),u.initialSelectedId&&T(u.items?.find(t=>t.id===u.initialSelectedId)??u.items?.[0]??null))},[d,u]);const gt=a.useRef(n);gt.current=n,a.useEffect(()=>{if(d||!b)return;const t=wt.on("deliverable:created",()=>O()),r=wt.on("deliverable:updated",l=>{Oe();const f=l.payload?.deliverableId;f&&gt.current?.id===f&&h.deliverables.get(f).then(x=>{x.deliverable&&(T(p=>({...p??x.deliverable,...x.deliverable,hubShareId:p?.hubShareId??x.deliverable.hubShareId??null,shareStatus:p?.shareStatus??x.deliverable.shareStatus??null,shareUrl:p?.shareUrl??x.deliverable.shareUrl??null,shareVisibility:p?.shareVisibility??x.deliverable.shareVisibility??null,shareReason:p?.shareReason??x.deliverable.shareReason??null})),Yt(x.deliverable))}).catch(()=>{})}),i=wt.on("deliverable:removed",()=>O());return()=>{t(),r(),i()}},[Oe,b,d]);const Gt=a.useMemo(()=>Ks(as,Ws.getUrl()),[]);a.useEffect(()=>{if(d||!b||!as())return;let t=!1;const r=async()=>{try{const l=await Gt.listMine();if(t)return;const f=new Map,x=new Map;for(const v of l)v.id&&f.set(v.id,v),v.localId&&x.set(v.localId,v);const p=new Map;E(v=>v.map(y=>{const C=y.hubShareId&&f.get(y.hubShareId)||x.get(y.id);if(!C)return y;const Ee={hubShareId:y.hubShareId??C.id??null,shareStatus:C.status??null,shareUrl:C.url??null,shareVisibility:y.shareVisibility??C.visibility??null,...C.reason!=null?{shareReason:C.reason}:{}};return p.set(y.id,Ee),{...y,...Ee}})),T(v=>{if(!v)return v;const y=p.get(v.id);return y?{...v,...y}:v});for(const[v,y]of p)h.deliverables.update(v,y).catch(C=>{console.warn("[deliverables] Hub 分享状态本地持久化失败:",C)})}catch{}};r();const i=setInterval(r,3e4);return()=>{t=!0,clearInterval(i)}},[Gt,b,d]);const Ke=a.useRef(null),bt=a.useRef(g);bt.current=g;const Ie=a.useCallback(t=>{const r=l=>{T(l),c&&(j(!0),history.pushState({mobileDetail:I.DELIVERABLES},"",window.location.hash))},i=bt.current.find(l=>l.id===t);if(i){r(i);return}h.deliverables.get(t).then(l=>{l.deliverable&&r(l.deliverable)}).catch(()=>{})},[c]);a.useEffect(()=>{if(d)return;const t=window.location.hash.slice(1).split("/"),r=Ds(t[0])===I.DELIVERABLES?t[1]:void 0,i=localStorage.getItem("markus_nav_projectId"),l=localStorage.getItem("markus_nav_source");i&&(localStorage.removeItem("markus_nav_projectId"),Ae(i)),(l==="knowledge"||l==="agent")&&(localStorage.removeItem("markus_nav_source"),W(l));const f=localStorage.getItem("markus_nav_openDeliverable")||r;f&&(localStorage.removeItem("markus_nav_openDeliverable"),bt.current.length>0?Ie(f):Ke.current=f);const x=p=>{const y=p.detail?.params;y?.projectId&&Ae(y.projectId),(y?.source==="knowledge"||y?.source==="agent")&&W(y.source),y?.openDeliverable&&(localStorage.removeItem("markus_nav_openDeliverable"),Ie(y.openDeliverable))};return window.addEventListener("markus:navigate",x),()=>window.removeEventListener("markus:navigate",x)},[Ie,d]),a.useEffect(()=>{const t=Ke.current;!t||g.length===0||(Ke.current=null,Ie(t))},[g,Ie]);const K=a.useMemo(()=>{const t=new Map;for(const i of g){let l,f;if($==="project"){const x=Ce(i.projectId);l=x?i.projectId??"_none":"_none",f=x??s("noProject")}else if($==="team"){const p=(i.agentId?Ue.get(i.agentId):void 0)?.teamId??"_none";l=p,f=p!=="_none"?zt.get(p)?.name??p:s("noTeam")}else if($==="agent")l=i.agentId??"_none",f=i.agentId?Ue.get(i.agentId)?.name??i.agentId:s("common:unknown");else{const x=new Date(i.updatedAt);l=`${x.getFullYear()}-${String(x.getMonth()+1).padStart(2,"0")}-${String(x.getDate()).padStart(2,"0")}`,f=l}t.has(l)||t.set(l,{label:f,items:[]}),t.get(l).items.push(i)}const r=[...t.entries()];return $==="date"?r.sort((i,l)=>l[0].localeCompare(i[0])):r.sort((i,l)=>i[1].label.localeCompare(l[1].label)),r},[g,$,mt,Ue,zt,s]);a.useEffect(()=>{if($==="date"&&re){const t=new Date,r=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;ye(new Set([r]))}else ye(new Set)},[$]);const js=async t=>{At("remove");try{await h.deliverables.remove(t.id),B("success",s("removed")),T(null),O()}catch(r){B("error",s("common:error",{message:String(r)}))}At("")},ks=a.useCallback(t=>{const r=gt.current,i=r?.id;if(!i)return;const l={hubShareId:t.id??null,shareStatus:t.status??null,shareUrl:t.url??null,shareVisibility:t.visibility??null,...t.reason!=null||t.status==="rejected"?{shareReason:t.reason??r?.shareReason??null}:{}},f={...l,shareStatus:l.shareStatus??r?.shareStatus??null};T(x=>x&&x.id===i?{...x,...f}:x),E(x=>x.map(p=>p.id===i?{...p,...f}:p)),(async()=>{try{await h.deliverables.update(i,l)}catch(x){console.warn("[deliverables] 分享状态本地回写失败,将由 Hub 轮询补偿:",x)}Oe()})()},[Oe]),ws=()=>{J.navigate(I.BUILDER)},Le=a.useCallback(async(t,r,i)=>{if(t.type==="directory"&&Array.isArray(t.entries))ke({path:t.path,name:t.name,entries:t.entries});else if(t.type==="image"&&t.mimeType){const l=t.streamUrl||(t.path?h.files.streamUrl(t.path):h.files.streamUrl(r));rt({src:l,name:t.name})}else if(t.type==="audio"||t.type==="video"){const l=t.streamUrl||(t.path?h.files.streamUrl(t.path):h.files.streamUrl(r));nt({kind:t.type,src:l,name:t.name})}else if(t.type==="office"){const l=t.streamUrl||(t.path?h.files.streamUrl(t.path):h.files.streamUrl(r));at({format:t.format||String(t.extension||"").replace(/^\./,"")||"pdf",streamUrl:l,name:t.name,size:t.size,reference:t.path||r})}else t.type==="binary"?Y(!0):typeof t.content=="string"?(ne(t.content),Dt(Us({format:i,reference:r,content:t.content}))):Y(!0)},[]),yt=a.useCallback(async t=>{le(!0),ne(null),rt(null),nt(null),at(null),Y(!1),ke(null),Ve(null),Fe(null);try{const r=await h.files.preview(t);r.type==="directory"&&Array.isArray(r.entries)?ke({path:r.path,name:r.name,entries:r.entries}):await Le(r,t)}catch{Y(!0)}le(!1)},[Le]),Ns=a.useCallback(async(t,r)=>{le(!0),Ve(r??null),Fe(t),ke(null);try{const i=await h.files.preview(t);await Le(i,t)}catch{ne(null),Y(!0)}le(!1)},[Le]),Yt=async t=>{if(t.reference&&!qe(t.reference)){if(t.type==="directory"){yt(t.reference);return}le(!0);try{const r=await h.files.preview(t.reference);await Le(r,t.reference,t.format)}catch{ne(null),t.type==="file"&&Y(!0)}le(!1)}};a.useEffect(()=>{d||(ne(null),Dt("markdown"),rt(null),nt(null),at(null),ke(null),Y(!1),Ve(null),Fe(null),n&&Yt(n))},[n?.id,d]);const qt=a.useCallback(t=>re!==Mt.has(t),[re,Mt]),Qt=K.length>0&&K.every(([t])=>qt(t)),Ss=a.useCallback(t=>{ye(r=>{const i=new Set(r);return i.has(t)?i.delete(t):i.add(t),i})},[]),Xt=a.useCallback(t=>{ye(r=>{if(r.has(t)===re)return r;const i=new Set(r);return re?i.add(t):i.delete(t),i})},[re]),Cs=a.useCallback(()=>{ms(t=>!t),ye(new Set)},[]),ze=!!(V||F||H||se||pe),Zt=a.useCallback(()=>{ge(""),be(""),W(""),Ae(""),Te(""),Be("")},[]),Re=a.useMemo(()=>K.flatMap(([,t])=>t.items),[K]);a.useEffect(()=>{d||c||me||n||Ke.current||Re.length!==0&&T(Re[0])},[d,c,me,n,Re]);const vt=a.useRef(null);a.useEffect(()=>{if(!n){vt.current=null;return}if(vt.current===n.id)return;const t=K.find(([,r])=>r.items.some(i=>i.id===n.id));t&&(vt.current=n.id,Xt(t[0]))},[n?.id,K,Xt]);const Jt=a.useRef(null),es=a.useRef(null),Ge=a.useRef(!1),ts=a.useRef(ie);a.useEffect(()=>{if(d||c||!b)return;const t=ts.current;ts.current=ie,!(ie!=="l1"||t==="l1")&&_&&(Ge.current=!0,q(!1))},[ie,d,c,b,_]),a.useEffect(()=>{if(d||c||!b)return;const t=r=>{if(r.metaKey||r.ctrlKey){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement){r.key==="Escape"&&(r.target.blur(),r.preventDefault());return}if(ls(r.target))return;if(r.key==="f"){r.preventDefault(),Jt.current?.focus();return}if(r.key.toLowerCase()==="b"){r.preventDefault(),q(C=>{const Ee=!C;return Ee&&(Ge.current=!0,A?.setKeyboardPane("l1"),requestAnimationFrame(()=>es.current?.focus())),Ee});return}if(r.key.toLowerCase()==="l"){r.preventDefault(),kt();return}return r.altKey,void 0}if(A?.keyboardPane==="l0")return;if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement){r.key==="Escape"&&(r.target.blur(),r.preventDefault());return}if(ls(r.target)||r.metaKey||r.ctrlKey||r.altKey)return;const l=r.key.length===1?r.key.toLowerCase():r.key;if(l==="h"||l==="ArrowLeft"){r.preventDefault(),_&&q(!1),A?.setL0FocusPageId(I.DELIVERABLES),A?.setLeftCollapsed(!1),A?.setKeyboardPane("l0");return}if(l==="l"||l==="ArrowRight"){r.preventDefault(),_&&q(!1),A?.keyboardPane!=="l1"&&A?.setKeyboardPane("l1");return}const f=l==="j"||l==="ArrowDown"?1:l==="k"||l==="ArrowUp"?-1:0;if(!f)return;r.preventDefault(),A?.setKeyboardPane("l1"),_&&(Ge.current=!0,q(!1));const x=Re;if(x.length===0)return;const p=n?x.findIndex(C=>C.id===n.id):-1,v=p<0?f>0?-1:0:p,y=Math.max(0,Math.min(x.length-1,v+f));ss(x[y]),requestAnimationFrame(()=>{document.querySelector(`[data-deliverable-id="${x[y].id}"]`)?.scrollIntoView({block:"nearest"})})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[Re,n,d,c,b,A,_]);const Ye=a.useRef(null),Is=a.useCallback(t=>{if(!c||!is(Me.current).atTop)return;const r=t.touches[0];r&&(Ye.current={y:r.clientY,x:r.clientX})},[c]),Ls=a.useCallback(t=>{if(!c||!Ye.current||st)return;const r=t.changedTouches[0],i=Ye.current;if(Ye.current=null,!r)return;const l=r.clientY-i.y,f=Math.abs(r.clientX-i.x);l<72||f>l||is(Me.current).atTop&&($t(!0),O().finally(()=>$t(!1)))},[c,st,O]),ss=t=>{const r=()=>{T(t),ct(!1),Q(!1),X(!1),c&&(j(!0),history.pushState({mobileDetail:I.DELIVERABLES},"",window.location.hash))};U?Z({action:r}):r()},Rs=()=>{if(!U){const t=$e??n?.summary??"";ut(t)}Q(!0)},Es=()=>{U?Z({action:()=>{Q(!1),X(!1)}}):Q(!1)},rs=async()=>{if(!(!n?.reference||xt)){Ut(!0);try{await h.files.write(n.reference,Se),ne(Se),X(!1),Q(!1),B("success",s("detail.saved"))}catch(t){B("error",s("detail.saveFailed")+": "+String(t))}Ut(!1)}},Ps=()=>{Q(!1),X(!1),Z(null)};a.useEffect(()=>{if(!U)return;const t=r=>{r.preventDefault()};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[U]),a.useEffect(()=>{if(!U)return;const t=r=>{r.preventDefault(),r.stopImmediatePropagation(),Z({action:()=>{Q(!1),X(!1);const{page:i,params:l}=r.detail||{};i&&J.navigate(i,l)}})};return window.addEventListener("markus:navigate",t),()=>window.removeEventListener("markus:navigate",t)},[U]);const jt=a.useRef(null),kt=a.useCallback((t,r)=>{const i=n?.agentId??"",l=n?.id??"",f={};l&&(f.openDeliverable=l);const x=[];if(n&&x.push(Ct(n)),t?.trim()){const p=t.trim().length>40?`${t.trim().slice(0,24)}…${t.trim().slice(-12)}`:t.trim();if(r){const v=n?.reference??"";x.push({label:`🌐 ${p}`,content:["[html-selection]",`Text: "${t.trim()}"`,`CSS Selector: ${r.cssSelector}`,`XPath: ${r.xpath}`,v?`File: ${v}`:""].filter(Boolean).join(`
3
3
  `)})}else x.push({label:`📝 ${p}`,content:t.trim()})}x.length>0&&(f.chatChips=JSON.stringify(x)),i&&(f.agentId=i),oe(null),window.getSelection()?.removeAllRanges(),J.navigate(I.TEAM,f)},[n]),Ts=a.useCallback(t=>{if(!t.text.trim())return;const i=jt.current?.querySelector("iframe")?.getBoundingClientRect(),l=(i?.left??0)+t.rect.x+t.rect.width/2,f=(i?.top??0)+t.rect.y;oe({x:l,y:f,text:t.text,htmlMeta:{xpath:t.xpath,cssSelector:t.cssSelector}})},[]);return a.useEffect(()=>{const t=jt.current;if(!t)return;const r=()=>{requestAnimationFrame(()=>{const l=window.getSelection(),f=l?.toString().trim();if(!f||!l?.rangeCount){oe(null);return}const x=l.getRangeAt(0);if(!t.contains(x.commonAncestorContainer)){oe(null);return}const p=x.getBoundingClientRect();oe({x:p.left+p.width/2,y:p.top,text:f})})},i=l=>{const f=document.getElementById("selection-toolbar");f&&f.contains(l.target)||oe(null)};return t.addEventListener("mouseup",r),document.addEventListener("mousedown",i),()=>{t.removeEventListener("mouseup",r),document.removeEventListener("mousedown",i)}},[]),e.jsxs("div",{className:"flex-1 overflow-hidden flex",children:[e.jsxs("div",{ref:es,tabIndex:-1,"data-keyboard-pane":"l1",className:`${c?"flex-1 min-w-0":"shrink-0"} flex flex-col bg-surface-secondary rounded-xl m-1 mr-0 outline-none ${!c&&ie==="l1"?"ring-1 ring-inset ring-brand-500/30":""}`,style:c?w?{display:"none"}:void 0:_?{display:"none"}:{width:S.width},children:[e.jsxs("div",{"data-electron-drag":!0,className:"p-4 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c&&e.jsx(Vs,{}),!c&&e.jsx("button",{onClick:()=>q(!0),className:"w-8 h-8 flex items-center justify-center rounded-lg transition-colors shrink-0 bg-brand-500/15 text-brand-500 hover:bg-brand-500/25",title:s("sidebar.collapse"),children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]})}),e.jsxs("h2",{className:"text-sm font-semibold text-fg-secondary truncate",children:[s("title"),N>0&&e.jsxs("span",{className:"ml-1.5 text-fg-tertiary font-normal",children:["(",N,")"]})]})]})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-muted pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:Jt,value:Pe,onChange:t=>Te(t.target.value),placeholder:s("searchPlaceholder"),className:"w-full bg-surface-elevated border border-border-default rounded-lg pl-8 pr-8 py-2 text-sm text-fg-primary focus:border-brand-500 focus:outline-none transition-colors"}),Pe&&e.jsx("button",{onClick:()=>{Te(""),Be("")},className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 flex items-center justify-center rounded-full bg-surface-overlay text-fg-tertiary hover:text-fg-secondary transition-colors",children:e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),dt&&!c&&e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 bg-surface-elevated rounded-lg text-[10px] text-fg-tertiary",children:[e.jsx("span",{className:"truncate font-mono",children:dt}),e.jsx("button",{onClick:()=>{h.system.openPath(dt)},className:"shrink-0 underline hover:text-fg-secondary transition-colors",children:s("common:open")})]}),c&&e.jsxs("button",{onClick:()=>ps(t=>!t),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors ${tt||ze?"bg-brand-500/15 text-brand-500":"bg-surface-elevated text-fg-secondary"}`,children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),e.jsx("line",{x1:"12",y1:"18",x2:"20",y2:"18"})]}),s("filters.filtersLabel"),ze&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-brand-500"}),e.jsx("svg",{className:`w-3 h-3 ml-auto transition-transform ${tt?"rotate-180":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),e.jsxs("div",{className:c&&!tt?"hidden":"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-hide filter-pills-fade",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:s("filters.source")}),e.jsx(he,{label:s("filters.allSources"),value:"",current:H,onClick:()=>W("")}),e.jsx(he,{label:s("filters.sourceAgent"),value:"agent",current:H,onClick:t=>W(t||"")}),e.jsx(he,{label:s("filters.sourceKnowledge"),value:"knowledge",current:H,onClick:t=>W(t||"")}),e.jsxs("button",{type:"button",onClick:()=>Je(!0),className:"ml-auto shrink-0 flex items-center gap-1 px-2 py-1 rounded text-[10px] text-fg-tertiary hover:text-brand-500 hover:bg-surface-elevated transition-colors",title:s("filters.bindKnowledgeBase"),children:[e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),s("filters.bindKnowledgeBase")]})]}),e.jsxs("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide filter-pills-fade",children:[e.jsx(he,{label:s("filters.allTypes"),value:"",current:V||F||"",onClick:()=>{ge(""),be("")}}),Zs.map(t=>e.jsx(he,{label:`${fe[t]?.icon??""} ${t}`,value:t,current:V,onClick:r=>{ge(r),be("")}},t)),["agent","team","skill"].map(t=>e.jsx(he,{label:`${z[t].icon} ${s(`artifactTypes.${t}`)}`,value:t,current:F,onClick:r=>{be(r),ge("")}},t))]}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary",children:s("filters.group")}),["date","project","team","agent"].map(t=>e.jsx("button",{onClick:()=>{hs(t)},className:`px-2 py-1 rounded text-xs transition-colors ${$===t?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:bg-surface-overlay"}`,children:s(`groupBy.${t}`)},t)),K.length>1&&e.jsx("button",{onClick:Cs,className:"ml-auto px-1.5 py-1 rounded text-[10px] text-fg-tertiary hover:text-fg-secondary hover:bg-surface-elevated transition-colors",title:s(Qt?"expandAllTooltip":"collapseAllTooltip"),children:s(Qt?"expandAll":"collapseAll")})]})]}),ze&&e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[pe&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:["“",pe,"”",e.jsx("button",{onClick:()=>{Te(""),Be("")},className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),V&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[fe[V]?.icon," ",V,e.jsx("button",{onClick:()=>ge(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),F&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[z[F]?.icon," ",s(`artifactTypes.${F}`),e.jsx("button",{onClick:()=>be(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),H&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[s(H==="knowledge"?"filters.sourceKnowledge":"filters.sourceAgent"),e.jsx("button",{onClick:()=>W(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),se&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-brand-500/10 text-brand-500 text-[10px]",children:[Ce(se)??se,e.jsx("button",{onClick:()=>Ae(""),className:"hover:text-brand-400",children:e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("button",{onClick:Zt,className:"text-[10px] text-fg-tertiary hover:text-brand-500 ml-auto transition-colors",children:s("filters.clearAll")})]})]}),et&&e.jsx("div",{className:`mx-4 mt-2 px-3 py-1.5 text-xs rounded-lg ${et.type==="success"?"bg-green-500/15 text-green-600":"bg-red-500/15 text-red-500"}`,children:et.text}),e.jsxs("div",{ref:Me,className:"flex-1 overflow-y-auto p-2 space-y-1 transition-opacity duration-150",style:{opacity:me?.5:1},onTouchStart:c?Is:void 0,onTouchEnd:c?Ls:void 0,children:[st&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-brand-500",children:[e.jsx(os,{})," ",e.jsx("span",{className:"text-[10px]",children:s("filters.refreshing")})]}),me?e.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(t=>e.jsxs("div",{className:"animate-pulse space-y-2",children:[e.jsx("div",{className:"h-4 bg-surface-elevated rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-surface-elevated rounded w-1/2"})]},t))}):g.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6 text-center",children:[e.jsx("svg",{className:"w-12 h-12 text-fg-muted mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),ze?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:s("empty.noResults")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:s("empty.noResultsHint")}),e.jsx("button",{onClick:Zt,className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand transition-colors",children:s("filters.clearAll")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-fg-secondary",children:s("empty.title")}),e.jsx("p",{className:"text-xs text-fg-tertiary mt-1 mb-3",children:s("empty.subtitle")}),e.jsx("button",{onClick:()=>J.navigate(I.WORK),className:"text-xs px-3 py-1.5 rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand transition-colors",children:s("empty.goToWork")})]})]}):K.map(([t,r])=>{const i=qt(t);return e.jsxs("div",{className:"mb-1 cv-row",children:[e.jsxs("button",{onClick:()=>Ss(t),className:"w-full flex items-center gap-1.5 px-2 py-2 rounded-md hover:bg-surface-elevated/50 transition-colors group/header border-b border-border-subtle/50",children:[e.jsx("svg",{className:`w-3 h-3 text-fg-tertiary transition-transform duration-200 shrink-0 ${i?"":"rotate-90"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),e.jsx("span",{className:"text-[11px] font-semibold text-fg-tertiary uppercase tracking-wider truncate",children:r.label}),e.jsxs("span",{className:"text-[10px] text-fg-muted bg-surface-elevated px-1.5 py-0.5 rounded-full shrink-0",children:[r.items.length,g.length<N?"+":""]})]}),e.jsx("div",{className:`overflow-hidden transition-all duration-200 ${i?"max-h-0 opacity-0":"max-h-[5000px] opacity-100"}`,children:r.items.map(l=>e.jsx("button",{"data-deliverable-id":l.id,onClick:()=>ss(l),className:`cv-row w-full text-left px-3 py-2 rounded-lg transition-all duration-150 ${n?.id===l.id?ie==="l1"?"bg-brand-500/25 ring-1 ring-inset ring-brand-500/40 border-l-2 border-l-brand-500 border-y border-r border-y-brand-500/20 border-r-brand-500/20":"bg-brand-600/15 border-l-2 border-l-brand-500 border-y border-r border-y-brand-500/20 border-r-brand-500/20":"hover:bg-surface-elevated/60 border-l-2 border-l-transparent border-y border-r border-transparent"}`,children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.artifactType&&z[l.artifactType]?e.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded font-medium shrink-0 ${z[l.artifactType].color}`,children:z[l.artifactType].icon}):e.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded font-medium uppercase shrink-0 ${fe[l.type]?.color??"bg-surface-overlay text-fg-secondary"}`,children:fe[l.type]?.icon??l.type.charAt(0)}),e.jsx("span",{className:"text-sm font-medium text-fg-primary truncate flex-1",children:l.title}),L(l)==="published"&&e.jsxs("svg",{className:"shrink-0 text-green-500",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":s("share.published",{defaultValue:"已发布到 Hub"}),children:[e.jsx("title",{children:s("share.published",{defaultValue:"已发布到 Hub"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),L(l)==="pending_review"&&e.jsxs("svg",{className:"shrink-0 text-amber-500 animate-pulse",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":s("share.pendingReview",{defaultValue:"Hub 审核中"}),children:[e.jsx("title",{children:s("share.pendingReview",{defaultValue:"Hub 审核中"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),L(l)==="rejected"&&e.jsxs("svg",{className:"shrink-0 text-red-500",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-label":s("share.rejected",{defaultValue:"Hub 已拒绝"}),children:[e.jsx("title",{children:s("share.rejected",{defaultValue:"Hub 已拒绝"})}),e.jsx("circle",{cx:"18",cy:"5",r:"3"}),e.jsx("circle",{cx:"6",cy:"12",r:"3"}),e.jsx("circle",{cx:"18",cy:"19",r:"3"}),e.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),e.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),Wt.has(l.id)&&e.jsx("span",{className:"shrink-0 text-amber-500",title:s("detail.fileMissing"),children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),e.jsx("span",{className:"text-[10px] text-fg-muted shrink-0",children:Js(l.updatedAt,s)})]})},l.id))})]},t)}),g.length<N&&e.jsx("div",{className:"flex justify-center py-3",children:e.jsx("button",{type:"button",disabled:m,onClick:()=>{vs()},className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium rounded-lg
4
4
  border border-border-default text-fg-secondary bg-surface-elevated/60
@@ -1,4 +1,4 @@
1
- import{u as T,r as i,j as e,c as z,m as x,o as H,E as A,M as S,p as D,q as _,s as U,v as B,w as O,x as G,y as $,z as W,B as K,C as q,D as V,F as Y,G as J,H as Q,J as X,K as Z,L as ee,N as te,O as re}from"./index-CKPQYzzR.js";const R="markus-copy-typography",C={fontFamily:"default",fontSize:15,headingScale:"standard"};function P(){try{const t=localStorage.getItem(R);if(t)return{...C,...JSON.parse(t)}}catch{}return C}function se(t){localStorage.setItem(R,JSON.stringify(t))}function ne(t){const r={default:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",serif:"Georgia, 'Times New Roman', Times, serif","sans-serif":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",mono:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"},n={compact:{h1:1.3,h2:1.15,h3:1.05,h4:1},standard:{h1:1.6,h2:1.35,h3:1.15,h4:1},large:{h1:2,h2:1.6,h3:1.3,h4:1.1}};return{fontFamily:r[t.fontFamily]??r.default,fontSize:`${t.fontSize}px`,headingScales:n[t.headingScale]??n.standard}}function ae({onClose:t}){const{t:r}=T("common"),[n,s]=i.useState(P);i.useEffect(()=>{se(n)},[n]);const l=i.useCallback((o,u)=>{s(d=>({...d,[o]:u}))},[]);return e.jsxs("div",{className:"px-3 py-2 space-y-3 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:r("markdown.typographySettings")}),e.jsx("button",{onClick:t,className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("p",{className:"text-[10px] text-fg-tertiary",children:r("markdown.typographyDesc")}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.fontFamily")}),e.jsxs("select",{value:n.fontFamily,onChange:o=>l("fontFamily",o.target.value),className:"w-full px-2 py-1 text-xs rounded bg-surface-primary border border-border-subtle text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50",children:[e.jsx("option",{value:"default",children:r("markdown.fontDefault")}),e.jsx("option",{value:"serif",children:r("markdown.fontSerif")}),e.jsx("option",{value:"sans-serif",children:r("markdown.fontSansSerif")}),e.jsx("option",{value:"mono",children:r("markdown.fontMono")})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:[r("markdown.fontSize"),": ",n.fontSize,"px"]}),e.jsx("input",{type:"range",min:10,max:24,step:1,value:n.fontSize,onChange:o=>l("fontSize",Number(o.target.value)),className:"w-full h-1 rounded-full appearance-none bg-border-subtle [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-brand-500"}),e.jsxs("div",{className:"flex justify-between text-[9px] text-fg-tertiary mt-0.5",children:[e.jsx("span",{children:"10px"}),e.jsx("span",{children:"24px"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.headingScale")}),e.jsx("div",{className:"flex gap-1",children:["compact","standard","large"].map(o=>e.jsx("button",{onClick:()=>l("headingScale",o),className:`flex-1 px-2 py-1 rounded text-[10px] font-medium transition-colors ${n.headingScale===o?"bg-brand-600/20 text-brand-500":"bg-surface-primary text-fg-tertiary hover:text-fg-secondary border border-border-subtle"}`,children:r(`markdown.scale${o.charAt(0).toUpperCase()+o.slice(1)}`)},o))})]})]})}const M=[B,O,G],L=[D,[_,{strict:"ignore"}],[U,{detect:!0,ignoreMissing:!0}]];function E(t){if(/^(deliverable|task|requirement|project|agent|team|workflow):/i.test(t))return t;const n=W(t);return K(n)?n:q(t)}const oe=/(?:<thinking>| thinking)([\s\S]*?)<\/thinking>/g;function ie(t){const r=[];let n=t.replace(oe,(s,l)=>{const o=l.trim();return o&&r.push(o),""});return n=n.replace(/<thinking>/gi,"").replace(/<\/thinking>/gi,""),{thinking:r,rest:n.trim()}}const le={inline:{wrapper:"absolute top-1 right-1 z-10 opacity-0 focus-within:opacity-100 group-hover/md:opacity-100 transition-opacity",button:"p-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-sm transition-colors",icon:"w-4 h-4",labelled:!1},preview:{wrapper:"absolute top-2 right-2 z-10",button:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-md text-xs font-medium transition-colors",icon:"w-4 h-4",labelled:!0}},ce={inline:"pr-2 sm:pr-8",preview:"pr-2 sm:pr-24"};function de(t=640){const[r,n]=i.useState(()=>window.innerWidth<t);return i.useEffect(()=>{const s=window.matchMedia(`(max-width: ${t-1}px)`),l=o=>n(o.matches);return s.addEventListener("change",l),n(s.matches),()=>s.removeEventListener("change",l)},[t]),r}function me({content:t,contentRef:r,variant:n}){const{t:s}=T("common"),[l,o]=i.useState(!1),[u,d]=i.useState(!1),[g,h]=i.useState(!1),[y,w]=i.useState(null),f=i.useRef(null),p=de();i.useEffect(()=>{if(!l)return;const a=m=>{f.current&&!f.current.contains(m.target)&&(o(!1),d(!1),h(!1))};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[l]);const k=i.useCallback(a=>{w(a),setTimeout(()=>w(null),1500)},[]),v=async()=>{const a=await te(t);k(s(a?"markdown.copied":"markdown.failed")),o(!1)},b=async a=>{const m=r.current?.firstElementChild;if(!m)return;const I=P(),j=ne(I),N=await re(m,a,t,{fontFamily:j.fontFamily,fontSize:j.fontSize,headingScales:j.headingScales}),F=s(a==="light"?"markdown.themeLight":"markdown.themeDark");k(N.ok?N.method==="html"?s("markdown.htmlCopied",{theme:F}):s("markdown.textCopied"):s("markdown.failed")),o(!1)},c=le[n];return e.jsxs("div",{className:c.wrapper,ref:f,"data-copy-variant":n,children:[y&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-20 px-2 py-0.5 rounded bg-surface-elevated border border-border-default text-[10px] text-fg-secondary whitespace-nowrap shadow-lg",children:y}),e.jsxs("button",{onClick:()=>o(a=>!a),className:c.button,title:s("markdown.copyContent"),children:[e.jsx("svg",{className:c.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),c.labelled&&e.jsx("span",{className:"leading-none",children:s("markdown.copy")})]}),l&&e.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[180px]",children:g?e.jsx(ae,{onClose:()=>h(!1)}):u?e.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-secondary space-y-2 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:s("markdown.infoTitle")}),e.jsx("button",{onClick:()=>d(!1),className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:s("markdown.mdAbbrev")})," — ",s("markdown.infoMdDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"☀️"})," — ",s("markdown.infoHtmlLightDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"🌙"})," — ",s("markdown.infoHtmlDarkDesc")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-border-subtle mb-1",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium",children:s("markdown.copyContent")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>h(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:s("markdown.typographySettings"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("button",{onClick:()=>d(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:s("markdown.infoTitle"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{strokeLinecap:"round",d:"M12 16v-4m0-4h.01"})]})})]})]}),e.jsxs("button",{onClick:v,className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center text-fg-tertiary shrink-0 font-mono text-[10px]",children:s("markdown.mdAbbrev")}),s(p?"markdown.copyMdSourceShort":"markdown.copyMdSource")]}),e.jsxs("button",{onClick:()=>b("light"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"☀️"}),s(p?"markdown.copyHtmlLightShort":"markdown.copyHtmlLight")]}),e.jsxs("button",{onClick:()=>b("dark"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"🌙"}),s(p?"markdown.copyHtmlDarkShort":"markdown.copyHtmlDark")]})]})})]})}const xe=i.memo(function({content:r,className:n="",onMentionClick:s,knownNames:l,basePath:o,copyVariant:u="inline"}){const{thinking:d,rest:g}=ie(r),h=i.useRef(null),[y,w]=i.useState(null),f=z(),p=i.useCallback(c=>{let a=x(c,V);return a=x(a,Y),a=x(a,J),a=x(a,Q),a=x(a,X),a=x(a,m=>Z(m,l)),a=x(a,ee),a},[l]),k=i.useMemo(()=>p(g),[g,p]),v=ce[u],b=H({onMentionClick:s,basePath:o,onImagePreview:w,contentRef:h,hostAvailable:f?.hostAvailable,openRightPanel:f?.openRightPanel});return e.jsxs("div",{className:"relative group/md",children:[e.jsx(me,{content:r,contentRef:h,variant:u}),e.jsx("div",{ref:h,children:e.jsx(A,{resetKeys:[k],fallback:e.jsx("div",{className:`prose prose-sm max-w-none break-words whitespace-pre-wrap ${v} text-fg-secondary ${n}`,children:g}),children:e.jsxs("div",{className:`prose prose-sm max-w-none break-words ${v} text-fg-secondary ${n}`,children:[d.length>0&&(()=>{const c=d.join(`
1
+ import{u as T,r as i,j as e,c as z,m as x,o as H,E as A,M as S,p as D,q as _,s as U,v as B,w as O,x as G,y as $,z as W,B as K,C as q,D as V,F as Y,G as J,H as Q,J as X,K as Z,L as ee,N as te,O as re}from"./index-TPf50ZeO.js";const R="markus-copy-typography",C={fontFamily:"default",fontSize:15,headingScale:"standard"};function P(){try{const t=localStorage.getItem(R);if(t)return{...C,...JSON.parse(t)}}catch{}return C}function se(t){localStorage.setItem(R,JSON.stringify(t))}function ne(t){const r={default:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",serif:"Georgia, 'Times New Roman', Times, serif","sans-serif":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",mono:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace"},n={compact:{h1:1.3,h2:1.15,h3:1.05,h4:1},standard:{h1:1.6,h2:1.35,h3:1.15,h4:1},large:{h1:2,h2:1.6,h3:1.3,h4:1.1}};return{fontFamily:r[t.fontFamily]??r.default,fontSize:`${t.fontSize}px`,headingScales:n[t.headingScale]??n.standard}}function ae({onClose:t}){const{t:r}=T("common"),[n,s]=i.useState(P);i.useEffect(()=>{se(n)},[n]);const l=i.useCallback((o,u)=>{s(d=>({...d,[o]:u}))},[]);return e.jsxs("div",{className:"px-3 py-2 space-y-3 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:r("markdown.typographySettings")}),e.jsx("button",{onClick:t,className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("p",{className:"text-[10px] text-fg-tertiary",children:r("markdown.typographyDesc")}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.fontFamily")}),e.jsxs("select",{value:n.fontFamily,onChange:o=>l("fontFamily",o.target.value),className:"w-full px-2 py-1 text-xs rounded bg-surface-primary border border-border-subtle text-fg-secondary focus:outline-none focus:ring-1 focus:ring-brand-500/50",children:[e.jsx("option",{value:"default",children:r("markdown.fontDefault")}),e.jsx("option",{value:"serif",children:r("markdown.fontSerif")}),e.jsx("option",{value:"sans-serif",children:r("markdown.fontSansSerif")}),e.jsx("option",{value:"mono",children:r("markdown.fontMono")})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:[r("markdown.fontSize"),": ",n.fontSize,"px"]}),e.jsx("input",{type:"range",min:10,max:24,step:1,value:n.fontSize,onChange:o=>l("fontSize",Number(o.target.value)),className:"w-full h-1 rounded-full appearance-none bg-border-subtle [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-brand-500"}),e.jsxs("div",{className:"flex justify-between text-[9px] text-fg-tertiary mt-0.5",children:[e.jsx("span",{children:"10px"}),e.jsx("span",{children:"24px"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-fg-tertiary font-medium block mb-1",children:r("markdown.headingScale")}),e.jsx("div",{className:"flex gap-1",children:["compact","standard","large"].map(o=>e.jsx("button",{onClick:()=>l("headingScale",o),className:`flex-1 px-2 py-1 rounded text-[10px] font-medium transition-colors ${n.headingScale===o?"bg-brand-600/20 text-brand-500":"bg-surface-primary text-fg-tertiary hover:text-fg-secondary border border-border-subtle"}`,children:r(`markdown.scale${o.charAt(0).toUpperCase()+o.slice(1)}`)},o))})]})]})}const M=[B,O,G],L=[D,[_,{strict:"ignore"}],[U,{detect:!0,ignoreMissing:!0}]];function E(t){if(/^(deliverable|task|requirement|project|agent|team|workflow):/i.test(t))return t;const n=W(t);return K(n)?n:q(t)}const oe=/(?:<thinking>| thinking)([\s\S]*?)<\/thinking>/g;function ie(t){const r=[];let n=t.replace(oe,(s,l)=>{const o=l.trim();return o&&r.push(o),""});return n=n.replace(/<thinking>/gi,"").replace(/<\/thinking>/gi,""),{thinking:r,rest:n.trim()}}const le={inline:{wrapper:"absolute top-1 right-1 z-10 opacity-0 focus-within:opacity-100 group-hover/md:opacity-100 transition-opacity",button:"p-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-sm transition-colors",icon:"w-4 h-4",labelled:!1},preview:{wrapper:"absolute top-2 right-2 z-10",button:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-brand-600 text-on-brand hover:bg-brand-500 shadow-md text-xs font-medium transition-colors",icon:"w-4 h-4",labelled:!0}},ce={inline:"pr-2 sm:pr-8",preview:"pr-2 sm:pr-24"};function de(t=640){const[r,n]=i.useState(()=>window.innerWidth<t);return i.useEffect(()=>{const s=window.matchMedia(`(max-width: ${t-1}px)`),l=o=>n(o.matches);return s.addEventListener("change",l),n(s.matches),()=>s.removeEventListener("change",l)},[t]),r}function me({content:t,contentRef:r,variant:n}){const{t:s}=T("common"),[l,o]=i.useState(!1),[u,d]=i.useState(!1),[g,h]=i.useState(!1),[y,w]=i.useState(null),f=i.useRef(null),p=de();i.useEffect(()=>{if(!l)return;const a=m=>{f.current&&!f.current.contains(m.target)&&(o(!1),d(!1),h(!1))};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[l]);const k=i.useCallback(a=>{w(a),setTimeout(()=>w(null),1500)},[]),v=async()=>{const a=await te(t);k(s(a?"markdown.copied":"markdown.failed")),o(!1)},b=async a=>{const m=r.current?.firstElementChild;if(!m)return;const I=P(),j=ne(I),N=await re(m,a,t,{fontFamily:j.fontFamily,fontSize:j.fontSize,headingScales:j.headingScales}),F=s(a==="light"?"markdown.themeLight":"markdown.themeDark");k(N.ok?N.method==="html"?s("markdown.htmlCopied",{theme:F}):s("markdown.textCopied"):s("markdown.failed")),o(!1)},c=le[n];return e.jsxs("div",{className:c.wrapper,ref:f,"data-copy-variant":n,children:[y&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-20 px-2 py-0.5 rounded bg-surface-elevated border border-border-default text-[10px] text-fg-secondary whitespace-nowrap shadow-lg",children:y}),e.jsxs("button",{onClick:()=>o(a=>!a),className:c.button,title:s("markdown.copyContent"),children:[e.jsx("svg",{className:c.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),c.labelled&&e.jsx("span",{className:"leading-none",children:s("markdown.copy")})]}),l&&e.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-elevated border border-border-default rounded-lg shadow-xl py-1 min-w-[180px]",children:g?e.jsx(ae,{onClose:()=>h(!1)}):u?e.jsxs("div",{className:"px-3 py-2 text-[11px] text-fg-secondary space-y-2 max-w-[260px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-medium text-fg-primary text-xs",children:s("markdown.infoTitle")}),e.jsx("button",{onClick:()=>d(!1),className:"text-fg-tertiary hover:text-fg-primary p-0.5",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:s("markdown.mdAbbrev")})," — ",s("markdown.infoMdDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"☀️"})," — ",s("markdown.infoHtmlLightDesc")]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-fg-primary",children:"🌙"})," — ",s("markdown.infoHtmlDarkDesc")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-b border-border-subtle mb-1",children:[e.jsx("span",{className:"text-[10px] text-fg-tertiary font-medium",children:s("markdown.copyContent")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>h(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:s("markdown.typographySettings"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("button",{onClick:()=>d(!0),className:"p-0.5 rounded text-fg-tertiary hover:text-fg-primary transition-colors",title:s("markdown.infoTitle"),children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{strokeLinecap:"round",d:"M12 16v-4m0-4h.01"})]})})]})]}),e.jsxs("button",{onClick:v,className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center text-fg-tertiary shrink-0 font-mono text-[10px]",children:s("markdown.mdAbbrev")}),s(p?"markdown.copyMdSourceShort":"markdown.copyMdSource")]}),e.jsxs("button",{onClick:()=>b("light"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"☀️"}),s(p?"markdown.copyHtmlLightShort":"markdown.copyHtmlLight")]}),e.jsxs("button",{onClick:()=>b("dark"),className:"w-full px-3 py-2 text-left text-xs text-fg-secondary hover:bg-surface-overlay hover:text-fg-primary transition-colors flex items-center gap-2",children:[e.jsx("span",{className:"w-4 text-center shrink-0 text-[10px]",children:"🌙"}),s(p?"markdown.copyHtmlDarkShort":"markdown.copyHtmlDark")]})]})})]})}const xe=i.memo(function({content:r,className:n="",onMentionClick:s,knownNames:l,basePath:o,copyVariant:u="inline"}){const{thinking:d,rest:g}=ie(r),h=i.useRef(null),[y,w]=i.useState(null),f=z(),p=i.useCallback(c=>{let a=x(c,V);return a=x(a,Y),a=x(a,J),a=x(a,Q),a=x(a,X),a=x(a,m=>Z(m,l)),a=x(a,ee),a},[l]),k=i.useMemo(()=>p(g),[g,p]),v=ce[u],b=H({onMentionClick:s,basePath:o,onImagePreview:w,contentRef:h,hostAvailable:f?.hostAvailable,openRightPanel:f?.openRightPanel});return e.jsxs("div",{className:"relative group/md",children:[e.jsx(me,{content:r,contentRef:h,variant:u}),e.jsx("div",{ref:h,children:e.jsx(A,{resetKeys:[k],fallback:e.jsx("div",{className:`prose prose-sm max-w-none break-words whitespace-pre-wrap ${v} text-fg-secondary ${n}`,children:g}),children:e.jsxs("div",{className:`prose prose-sm max-w-none break-words ${v} text-fg-secondary ${n}`,children:[d.length>0&&(()=>{const c=d.join(`
2
2
 
3
3
  `),a=c.split(`
4
4
  `)[0]??"",m=a.length>80?a.slice(0,80)+"…":a;return e.jsxs("details",{className:"mb-3 rounded-lg bg-surface-elevated/60 border border-border-default/50 overflow-hidden group/think",children:[e.jsxs("summary",{className:"cursor-pointer select-none px-3 py-2 text-xs text-fg-secondary hover:text-fg-secondary transition-colors flex items-center gap-1.5 min-w-0",children:[e.jsx("svg",{className:"w-3 h-3 shrink-0 transition-transform group-open/think:rotate-90",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})}),e.jsx("span",{className:"shrink-0",children:"Thinking"}),e.jsx("span",{className:"truncate text-fg-tertiary ml-1 group-open/think:hidden",children:m})]}),e.jsx("div",{className:"px-3 pb-3 border-t border-border-default/50",children:e.jsx("div",{className:"mt-2 pl-3 border-l-2 border-brand-500/40 text-xs text-fg-secondary leading-relaxed",children:e.jsx(S,{remarkPlugins:M,rehypePlugins:L,components:b,urlTransform:E,children:p(c)})})})]})})(),e.jsx(S,{remarkPlugins:M,rehypePlugins:L,components:b,urlTransform:E,children:k})]})})}),y&&e.jsx($,{src:y,onClose:()=>w(null)})]})},(t,r)=>t.content===r.content&&t.className===r.className&&t.basePath===r.basePath&&t.copyVariant===r.copyVariant&&t.onMentionClick===r.onMentionClick&&he(t.knownNames,r.knownNames));function he(t,r){if(t===r)return!0;if(!t||!r||t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n])return!1;return!0}export{$ as ImagePreviewModal,xe as MarkdownMessage,E as chatUrlTransform};
@@ -1 +1 @@
1
- import{u as z,r as i,k as c,j as e,n as d,P as x,A as O,l as I,t as K}from"./index-CKPQYzzR.js";import{P as $,E as D}from"./AsyncState-_UC7xcxJ.js";function J(){const{t:l}=z(["common","home","work"]),[u,y]=i.useState(""),[a,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,b]=i.useState(!1),[w,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}b(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,L,R,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),q=N.status==="fulfilled"?N.value.agents.filter(r=>r.name?.toLowerCase().includes(n)||r.role?.toLowerCase().includes(n)):[],T=C.status==="fulfilled"?C.value.tasks:[],M=V.status==="fulfilled"?V.value.requirements.filter(r=>r.title?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],H=L.status==="fulfilled"?L.value.projects.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],P=R.status==="fulfilled"?R.value.results:[],S=[];if(A.status==="fulfilled"){const r=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of r)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:q,tasks:T,requirements:M,projects:H,deliverables:P,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{b(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},E=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{y(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:E.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${a===s.id?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx($,{className:"py-12"}),!h&&w&&!k&&e.jsx(D,{className:"py-12",icon:e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),title:l("common:noResults",{defaultValue:"没有找到相关结果"})}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(a==="all"||a==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(O,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx(U,{status:s.status})]},s.id))}),a==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(a==="all"||a==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(F,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(a==="all"||a==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(a==="all"||a==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),a==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(a==="all"||a==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),a==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(a==="all"||a==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),a==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function U({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function F({status:l}){const u=I[K(l)].chip;return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{J as SearchPage};
1
+ import{u as z,r as i,k as c,j as e,n as d,P as x,A as O,l as I,t as K}from"./index-TPf50ZeO.js";import{P as $,E as D}from"./AsyncState-BTLUPIr1.js";function J(){const{t:l}=z(["common","home","work"]),[u,y]=i.useState(""),[a,o]=i.useState("all"),[t,m]=i.useState({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),[h,b]=i.useState(!1),[w,p]=i.useState(!1),v=i.useRef(null),j=i.useRef(void 0);i.useEffect(()=>{setTimeout(()=>v.current?.focus(),100)},[]);const W=i.useCallback(async s=>{if(!s.trim()){m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1);return}b(!0),p(!0);const n=s.toLowerCase();try{const[N,C,V,L,R,A]=await Promise.allSettled([c.agents.list(),c.tasks.list({search:s,pageSize:20}),c.requirements.list(),c.projects.list(),c.deliverables.search({q:s,limit:20}),c.teams.list()]),q=N.status==="fulfilled"?N.value.agents.filter(r=>r.name?.toLowerCase().includes(n)||r.role?.toLowerCase().includes(n)):[],T=C.status==="fulfilled"?C.value.tasks:[],M=V.status==="fulfilled"?V.value.requirements.filter(r=>r.title?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],H=L.status==="fulfilled"?L.value.projects.filter(r=>r.name?.toLowerCase().includes(n)||r.description?.toLowerCase().includes(n)):[],P=R.status==="fulfilled"?R.value.results:[],S=[];if(A.status==="fulfilled"){const r=await Promise.allSettled(A.value.teams.map(f=>c.workflows.list(f.id)));for(const f of r)if(f.status==="fulfilled")for(const g of f.value.workflows)(g.name.toLowerCase().includes(n)||(g.displayName||"").toLowerCase().includes(n)||g.description?.toLowerCase().includes(n))&&S.push(g)}m({agents:q,tasks:T,requirements:M,projects:H,deliverables:P,workflows:S})}catch{m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]})}finally{b(!1)}},[]),B=s=>{y(s),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>W(s),400)},E=[{id:"all",label:l("common:all",{defaultValue:"全部"})},{id:"agents",label:l("common:agents",{defaultValue:"智能体"})},{id:"tasks",label:l("common:tasks",{defaultValue:"任务"})},{id:"requirements",label:l("common:requirements",{defaultValue:"需求"})},{id:"projects",label:l("common:projects",{defaultValue:"项目"})},{id:"deliverables",label:l("common:deliverables",{defaultValue:"交付物"})},{id:"workflows",label:l("common:workflows",{defaultValue:"工作流"})}],k=t.agents.length>0||t.tasks.length>0||t.requirements.length>0||t.projects.length>0||t.deliverables.length>0||t.workflows.length>0;return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 px-4 pt-4 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>d.navigate(x.HOME),className:"p-1.5 rounded-lg hover:bg-surface-overlay transition-colors shrink-0",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("polyline",{points:"12 19 5 12 12 5"})]})}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-fg-tertiary",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:v,value:u,onChange:s=>B(s.target.value),placeholder:l("common:search"),className:"w-full bg-surface-elevated border border-border-default rounded-xl pl-9 pr-3 py-2.5 text-sm text-fg-primary placeholder:text-fg-tertiary focus:border-brand-500 focus:outline-none transition-colors"}),u&&e.jsx("button",{onClick:()=>{y(""),m({agents:[],tasks:[],requirements:[],projects:[],deliverables:[],workflows:[]}),p(!1),v.current?.focus()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg-tertiary hover:text-fg-secondary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsx("div",{className:"flex gap-1 overflow-x-auto scrollbar-hide",children:E.map(s=>e.jsx("button",{onClick:()=>o(s.id),className:`px-3 py-1.5 text-xs rounded-lg whitespace-nowrap transition-colors ${a===s.id?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:s.label},s.id))})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:[h&&e.jsx($,{className:"py-12"}),!h&&w&&!k&&e.jsx(D,{className:"py-12",icon:e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),title:l("common:noResults",{defaultValue:"没有找到相关结果"})}),!h&&k&&e.jsxs("div",{className:"space-y-4",children:[(a==="all"||a==="agents")&&t.agents.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:agents",{defaultValue:"智能体"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.agents.slice(0,8):t.agents).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.TEAM,{agentId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(O,{name:s.name||"Agent",avatarUrl:s.avatarUrl,size:32}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-fg-primary truncate",children:s.name}),e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.role||s.status})]}),e.jsx(U,{status:s.status})]},s.id))}),a==="all"&&t.agents.length>8&&e.jsxs("button",{onClick:()=>o("agents"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.agents.length,")"]})]}),(a==="all"||a==="tasks")&&t.tasks.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:tasks",{defaultValue:"任务"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.tasks.slice(0,8):t.tasks).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openTask:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx(F,{status:s.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.tasks.length>8&&e.jsxs("button",{onClick:()=>o("tasks"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.tasks.length,")"]})]}),(a==="all"||a==="requirements")&&t.requirements.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:requirements",{defaultValue:"需求"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.requirements.slice(0,8):t.requirements).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{openRequirement:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${s.status==="approved"?"text-green-500 bg-green-500/15":s.status==="pending"?"text-amber-500 bg-amber-500/15":s.status==="rejected"?"text-red-500 bg-red-500/15":"text-fg-tertiary bg-surface-elevated"}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.status," · ",s.priority||""]})]})]},s.id))}),a==="all"&&t.requirements.length>8&&e.jsxs("button",{onClick:()=>o("requirements"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.requirements.length,")"]})]}),(a==="all"||a==="projects")&&t.projects.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:projects",{defaultValue:"项目"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.projects.slice(0,8):t.projects).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{projectId:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand-500/15 flex items-center justify-center shrink-0",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-brand-500",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.name}),s.description&&e.jsx("div",{className:"text-xs text-fg-tertiary truncate",children:s.description})]})]},s.id))}),a==="all"&&t.projects.length>8&&e.jsxs("button",{onClick:()=>o("projects"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.projects.length,")"]})]}),(a==="all"||a==="deliverables")&&t.deliverables.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:deliverables",{defaultValue:"交付物"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.deliverables.slice(0,8):t.deliverables).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.DELIVERABLES,{openDeliverable:s.id}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-purple-500",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.title}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.type," · ",s.status]})]})]},s.id))}),a==="all"&&t.deliverables.length>8&&e.jsxs("button",{onClick:()=>o("deliverables"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.deliverables.length,")"]})]}),(a==="all"||a==="workflows")&&t.workflows.length>0&&e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium text-fg-tertiary uppercase mb-2",children:l("common:workflows",{defaultValue:"工作流"})}),e.jsx("div",{className:"space-y-1",children:(a==="all"?t.workflows.slice(0,8):t.workflows).map(s=>e.jsxs("button",{onClick:()=>d.navigate(x.WORK,{boardType:"workflows"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl hover:bg-surface-overlay transition-colors text-left",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-teal-500/15 flex items-center justify-center shrink-0",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-teal-500",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-fg-primary truncate",children:s.displayName||s.name}),e.jsxs("div",{className:"text-xs text-fg-tertiary truncate",children:[s.stepCount," steps · v",s.version]})]})]},s.name))}),a==="all"&&t.workflows.length>8&&e.jsxs("button",{onClick:()=>o("workflows"),className:"mt-1 w-full text-xs text-brand-500 hover:text-brand-400 py-1.5 rounded-lg hover:bg-surface-overlay transition-colors",children:[l("common:showAll",{defaultValue:"查看全部"})," (",t.workflows.length,")"]})]})]}),!h&&!w&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-fg-tertiary mb-3",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("p",{className:"text-sm text-fg-tertiary",children:l("common:search")})]})]})]})}function U({status:l}){const u=l==="active"||l==="idle"?"bg-green-500":l==="working"||l==="busy"?"bg-blue-500":"bg-gray-400";return e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${u}`})}function F({status:l}){const u=I[K(l)].chip;return e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0 ${u}`,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M9 11l3 3L22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})})}export{J as SearchPage};
@@ -1 +1 @@
1
- import{u as z,r as c,j as e,A as D,n as H,P as W,k as M}from"./index-CKPQYzzR.js";import{i as B}from"./chatChips-DVIRVTpT.js";const E=80;function G(i){const n=i.replace(/<think>[\s\S]*?<\/think>/g," ").replace(/\[(?:terminal|html|file|deliverable|task|requirement)-?[a-z]*\]/gi," ").replace(/\s+/g," ").trim();return n.length>E?`${n.slice(0,E)}…`:n}async function R(i){const d=(await M.sessions.listByAgent(i,20,1)).sessions??[];return await Promise.all(d.map(async l=>{try{const m=(await M.sessions.getMessages(l.id,1)).messages?.[0];return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:m?.content&&G(m.content)||null,snippetFailed:!1}}catch{return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:null,snippetFailed:!0}}}))}function J(i,n,d){if(i){if(n.some(u=>u.id===i))return`agent:${i}`;if(d.some(u=>u.id===i))return`human:${i}`}return n[0]?`agent:${n[0].id}`:d[0]?`human:${d[0].id}`:""}function Q(i){const n=i.trim();return n.length>40?`${n.slice(0,24)}…${n.slice(-12)}`:n}function X({onClick:i,label:n,className:d}){return e.jsxs("button",{type:"button",onClick:i,title:n,"aria-label":n,className:d??"shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-border-default text-xs text-fg-secondary hover:text-brand-500 hover:border-brand-500/40 hover:bg-brand-500/10 transition-colors",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"}),e.jsx("line",{x1:"10",y1:"9",x2:"14",y2:"9"})]}),e.jsx("span",{className:"hidden sm:inline",children:n})]})}function _({chipKind:i,chipLabel:n,chipContent:d,agents:u,users:l,defaultTarget:j,onClose:m}){const{t:s}=z(["work","common"]),[x,L]=c.useState(()=>j||J(void 0,u,l)),[v,q]=c.useState(""),[f,N]=c.useState(!1),[b,p]=c.useState("idle"),[w,k]=c.useState([]),h=c.useRef(0),y=c.useMemo(()=>{const t=v.trim().toLowerCase(),r=a=>!t||a.toLowerCase().includes(t);return[...u.filter(a=>r(a.name)).map(a=>({value:`agent:${a.id}`,name:a.name,meta:a.status,isAgent:!0,avatarUrl:a.avatarUrl})),...l.filter(a=>r(a.name)).map(a=>({value:`human:${a.id}`,name:a.name,meta:"",isAgent:!1,avatarUrl:a.avatarUrl}))]},[u,l,v]),C=c.useRef(null),S=c.useRef(!1);c.useEffect(()=>{if(S.current)return;const t=C.current;if(!t)return;const r=t.querySelector('[data-selected="true"]');if(r){S.current=!0;try{r.scrollIntoView({block:"nearest"})}catch{}}},[y]);const[P,T]=x.split(":"),V=P==="agent"?u.find(t=>t.id===T)?.name??"":l.find(t=>t.id===T)?.name??"",A=i??B(d,n),g=t=>{if(!x)return;const[r,a]=x.split(":"),o={chatChips:JSON.stringify([{kind:A,label:n,content:d}])};r==="agent"?o.agentId=a:o.dm=a,t&&(o.sessionId=t),H.navigate(W.TEAM,o),m()},U=async t=>{const r=++h.current;p("loading");try{const a=await R(t);if(r!==h.current)return;k(a),p("ok")}catch{if(r!==h.current)return;k([]),p("error")}},F=()=>{if(!x)return;const[t,r]=x.split(":");if(t!=="agent"){g();return}(async()=>{const a=++h.current;N(!0),p("loading");try{const o=await R(r);if(a!==h.current)return;if(k(o),p("ok"),o.length===0){g();return}if(o.length===1){g(o[0].id);return}}catch{if(a!==h.current)return;k([]),p("error")}})()},I=t=>{const r=new Date(t);if(Number.isNaN(r.getTime()))return"";const a=Date.now()-r.getTime(),o=Math.floor(a/6e4);if(o<1)return s("common:justNow",{defaultValue:"just now"});if(o<60)return`${o}m`;const $=Math.floor(o/60);return $<24?`${$}h`:r.toLocaleDateString()};return e.jsx("div",{className:"fixed inset-0 z-[10050] flex items-center justify-center bg-black/60 p-4",onClick:m,children:e.jsxs("div",{className:"w-full max-w-md max-h-[85vh] flex flex-col bg-surface-primary border border-border-default rounded-2xl shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-5 pt-4 pb-3 border-b border-border-default shrink-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg-primary",children:s("work:task.sendToChatTitle",{defaultValue:"发送到对话"})}),e.jsx("button",{onClick:m,className:"text-fg-tertiary hover:text-fg-secondary text-xl leading-none -mt-1","aria-label":s("common:close"),children:"×"})]}),e.jsx("p",{className:"mt-1 text-xs text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatHint",{defaultValue:"选择要发送到的对话,它会作为上下文标签加入输入框,你可以接着补充说明。"})})]}),f&&e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-2","data-send-to-sessions":!0,children:[e.jsx("div",{className:"px-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:s("work:task.sendToChatSessions",{defaultValue:"Conversation"})}),e.jsx("p",{className:"px-2 pb-2 text-[11px] text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatSessionHint",{defaultValue:"This agent has several conversations — pick the one to send into."})}),b==="loading"&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-loading":!0,children:s("common:loading",{defaultValue:"Loading…"})}),b==="error"&&e.jsxs("div",{className:"mx-1 mb-2 px-3 py-2 rounded-lg border border-amber-500/40 bg-amber-500/10 text-xs text-amber-500 leading-relaxed","data-send-to-sessions-error":!0,children:[s("work:task.sendToChatSessionError",{defaultValue:"Could not load the conversations — sending to the default conversation instead."}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{const[,t]=x.split(":");t&&U(t)},className:"underline hover:no-underline","data-send-to-sessions-retry":!0,children:s("work:task.sendToChatSessionRetry",{defaultValue:"Retry"})}),e.jsx("button",{type:"button",onClick:()=>g(),className:"underline hover:no-underline","data-send-to-default-session":!0,children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]}),b==="ok"&&w.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-empty":!0,children:s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})}),b==="ok"&&w.map(t=>e.jsxs("button",{type:"button",onClick:()=>g(t.id),"data-session-id":t.id,className:"w-full text-left px-3 py-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-fg-primary",children:t.title?.trim()||s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})}),e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:I(t.lastMessageAt)})]}),e.jsx("div",{className:"text-[11px] text-fg-tertiary truncate",children:t.snippetFailed?s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"}):t.snippet??s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})})]},t.id)),b==="ok"&&w.length>0&&e.jsxs("button",{type:"button",onClick:()=>g(),className:"w-full text-left px-3 py-2 mt-1 rounded-lg text-xs text-fg-secondary hover:bg-surface-elevated transition-colors","data-send-to-new-session":!0,children:["+ ",s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})]})]}),e.jsxs("div",{className:`px-5 pt-3 pb-2 shrink-0 ${f?"hidden":""}`,children:[e.jsx("label",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatTarget",{defaultValue:"发送给"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-tertiary pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{value:v,onChange:t=>q(t.target.value),placeholder:s("work:task.sendToChatSearch",{defaultValue:"搜索智能体或成员…"}),className:"w-full pl-8 pr-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary outline-none focus:border-brand-500 placeholder:text-fg-tertiary"})]}),e.jsx("div",{className:"mt-1.5 text-[11px] text-fg-tertiary truncate",children:V?`${s("work:task.sendToChatTarget",{defaultValue:"发送给"})}:${V}`:s("work:task.sendToChatNoTarget",{defaultValue:"当前没有可发送的对象"})})]}),e.jsx("div",{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2 ${f?"hidden":""}`,ref:C,children:y.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary",children:s("work:task.sendToChatEmpty",{defaultValue:"没有匹配的对象"})}):y.map((t,r)=>{const a=r===0||y[r-1].isAgent!==t.isAgent,o=t.value===x;return e.jsxs("div",{children:[a&&e.jsx("div",{className:"px-3 pt-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:t.isAgent?s("work:task.sendToChatAgents",{defaultValue:"智能体"}):s("work:task.sendToChatHumans",{defaultValue:"成员"})}),e.jsxs("button",{type:"button",onClick:()=>L(t.value),"data-selected":o?"true":"false","aria-current":o?"true":void 0,className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${o?"bg-brand-500/15 text-brand-500 font-medium":"text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsx(D,{name:t.name,avatarUrl:t.avatarUrl,size:22,fallback:t.isAgent?"initials":"icon"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm",children:t.name}),t.meta&&e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:t.meta}),o&&e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]})]},t.value)})}),e.jsxs("div",{className:"px-5 py-3 border-t border-border-default bg-surface-secondary/40 shrink-0",children:[e.jsx("span",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatContext",{defaultValue:"将加入的上下文标签"})}),e.jsx("span",{className:"inline-flex items-center gap-1 max-w-full pl-2 pr-2 py-1 rounded-lg bg-brand-500/10 text-brand-500 text-xs border border-brand-500/20",title:d,"data-chip-kind":A,children:e.jsx("span",{className:"truncate",children:n})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:f?()=>N(!1):m,className:"px-3 py-1.5 text-xs rounded-lg border border-border-default text-fg-secondary hover:bg-surface-elevated transition-colors",children:f?s("common:back",{defaultValue:"Back"}):s("common:cancel")}),!f&&e.jsx("button",{type:"button",onClick:F,disabled:!x,"data-send-to-confirm":!0,"aria-label":s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"}),className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]})]})})}export{_ as S,X as a,J as r,Q as s};
1
+ import{u as z,r as c,j as e,A as D,n as H,P as W,k as M}from"./index-TPf50ZeO.js";import{i as B}from"./chatChips-DVIRVTpT.js";const E=80;function G(i){const n=i.replace(/<think>[\s\S]*?<\/think>/g," ").replace(/\[(?:terminal|html|file|deliverable|task|requirement)-?[a-z]*\]/gi," ").replace(/\s+/g," ").trim();return n.length>E?`${n.slice(0,E)}…`:n}async function R(i){const d=(await M.sessions.listByAgent(i,20,1)).sessions??[];return await Promise.all(d.map(async l=>{try{const m=(await M.sessions.getMessages(l.id,1)).messages?.[0];return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:m?.content&&G(m.content)||null,snippetFailed:!1}}catch{return{id:l.id,title:l.title,lastMessageAt:l.lastMessageAt,snippet:null,snippetFailed:!0}}}))}function J(i,n,d){if(i){if(n.some(u=>u.id===i))return`agent:${i}`;if(d.some(u=>u.id===i))return`human:${i}`}return n[0]?`agent:${n[0].id}`:d[0]?`human:${d[0].id}`:""}function Q(i){const n=i.trim();return n.length>40?`${n.slice(0,24)}…${n.slice(-12)}`:n}function X({onClick:i,label:n,className:d}){return e.jsxs("button",{type:"button",onClick:i,title:n,"aria-label":n,className:d??"shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border border-border-default text-xs text-fg-secondary hover:text-brand-500 hover:border-brand-500/40 hover:bg-brand-500/10 transition-colors",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"}),e.jsx("line",{x1:"10",y1:"9",x2:"14",y2:"9"})]}),e.jsx("span",{className:"hidden sm:inline",children:n})]})}function _({chipKind:i,chipLabel:n,chipContent:d,agents:u,users:l,defaultTarget:j,onClose:m}){const{t:s}=z(["work","common"]),[x,L]=c.useState(()=>j||J(void 0,u,l)),[v,q]=c.useState(""),[f,N]=c.useState(!1),[b,p]=c.useState("idle"),[w,k]=c.useState([]),h=c.useRef(0),y=c.useMemo(()=>{const t=v.trim().toLowerCase(),r=a=>!t||a.toLowerCase().includes(t);return[...u.filter(a=>r(a.name)).map(a=>({value:`agent:${a.id}`,name:a.name,meta:a.status,isAgent:!0,avatarUrl:a.avatarUrl})),...l.filter(a=>r(a.name)).map(a=>({value:`human:${a.id}`,name:a.name,meta:"",isAgent:!1,avatarUrl:a.avatarUrl}))]},[u,l,v]),C=c.useRef(null),S=c.useRef(!1);c.useEffect(()=>{if(S.current)return;const t=C.current;if(!t)return;const r=t.querySelector('[data-selected="true"]');if(r){S.current=!0;try{r.scrollIntoView({block:"nearest"})}catch{}}},[y]);const[P,T]=x.split(":"),V=P==="agent"?u.find(t=>t.id===T)?.name??"":l.find(t=>t.id===T)?.name??"",A=i??B(d,n),g=t=>{if(!x)return;const[r,a]=x.split(":"),o={chatChips:JSON.stringify([{kind:A,label:n,content:d}])};r==="agent"?o.agentId=a:o.dm=a,t&&(o.sessionId=t),H.navigate(W.TEAM,o),m()},U=async t=>{const r=++h.current;p("loading");try{const a=await R(t);if(r!==h.current)return;k(a),p("ok")}catch{if(r!==h.current)return;k([]),p("error")}},F=()=>{if(!x)return;const[t,r]=x.split(":");if(t!=="agent"){g();return}(async()=>{const a=++h.current;N(!0),p("loading");try{const o=await R(r);if(a!==h.current)return;if(k(o),p("ok"),o.length===0){g();return}if(o.length===1){g(o[0].id);return}}catch{if(a!==h.current)return;k([]),p("error")}})()},I=t=>{const r=new Date(t);if(Number.isNaN(r.getTime()))return"";const a=Date.now()-r.getTime(),o=Math.floor(a/6e4);if(o<1)return s("common:justNow",{defaultValue:"just now"});if(o<60)return`${o}m`;const $=Math.floor(o/60);return $<24?`${$}h`:r.toLocaleDateString()};return e.jsx("div",{className:"fixed inset-0 z-[10050] flex items-center justify-center bg-black/60 p-4",onClick:m,children:e.jsxs("div",{className:"w-full max-w-md max-h-[85vh] flex flex-col bg-surface-primary border border-border-default rounded-2xl shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-5 pt-4 pb-3 border-b border-border-default shrink-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-fg-primary",children:s("work:task.sendToChatTitle",{defaultValue:"发送到对话"})}),e.jsx("button",{onClick:m,className:"text-fg-tertiary hover:text-fg-secondary text-xl leading-none -mt-1","aria-label":s("common:close"),children:"×"})]}),e.jsx("p",{className:"mt-1 text-xs text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatHint",{defaultValue:"选择要发送到的对话,它会作为上下文标签加入输入框,你可以接着补充说明。"})})]}),f&&e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-2","data-send-to-sessions":!0,children:[e.jsx("div",{className:"px-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:s("work:task.sendToChatSessions",{defaultValue:"Conversation"})}),e.jsx("p",{className:"px-2 pb-2 text-[11px] text-fg-tertiary leading-relaxed",children:s("work:task.sendToChatSessionHint",{defaultValue:"This agent has several conversations — pick the one to send into."})}),b==="loading"&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-loading":!0,children:s("common:loading",{defaultValue:"Loading…"})}),b==="error"&&e.jsxs("div",{className:"mx-1 mb-2 px-3 py-2 rounded-lg border border-amber-500/40 bg-amber-500/10 text-xs text-amber-500 leading-relaxed","data-send-to-sessions-error":!0,children:[s("work:task.sendToChatSessionError",{defaultValue:"Could not load the conversations — sending to the default conversation instead."}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{const[,t]=x.split(":");t&&U(t)},className:"underline hover:no-underline","data-send-to-sessions-retry":!0,children:s("work:task.sendToChatSessionRetry",{defaultValue:"Retry"})}),e.jsx("button",{type:"button",onClick:()=>g(),className:"underline hover:no-underline","data-send-to-default-session":!0,children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]}),b==="ok"&&w.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary","data-send-to-sessions-empty":!0,children:s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})}),b==="ok"&&w.map(t=>e.jsxs("button",{type:"button",onClick:()=>g(t.id),"data-session-id":t.id,className:"w-full text-left px-3 py-2 rounded-lg hover:bg-surface-elevated transition-colors",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-fg-primary",children:t.title?.trim()||s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})}),e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:I(t.lastMessageAt)})]}),e.jsx("div",{className:"text-[11px] text-fg-tertiary truncate",children:t.snippetFailed?s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"}):t.snippet??s("work:task.sendToChatSessionNoSummary",{defaultValue:"No message yet"})})]},t.id)),b==="ok"&&w.length>0&&e.jsxs("button",{type:"button",onClick:()=>g(),className:"w-full text-left px-3 py-2 mt-1 rounded-lg text-xs text-fg-secondary hover:bg-surface-elevated transition-colors","data-send-to-new-session":!0,children:["+ ",s("work:task.sendToChatSessionEmpty",{defaultValue:"No conversations yet — this goes to a new one."})]})]}),e.jsxs("div",{className:`px-5 pt-3 pb-2 shrink-0 ${f?"hidden":""}`,children:[e.jsx("label",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatTarget",{defaultValue:"发送给"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-fg-tertiary pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{value:v,onChange:t=>q(t.target.value),placeholder:s("work:task.sendToChatSearch",{defaultValue:"搜索智能体或成员…"}),className:"w-full pl-8 pr-3 py-2 bg-surface-elevated border border-border-default rounded-lg text-sm text-fg-primary outline-none focus:border-brand-500 placeholder:text-fg-tertiary"})]}),e.jsx("div",{className:"mt-1.5 text-[11px] text-fg-tertiary truncate",children:V?`${s("work:task.sendToChatTarget",{defaultValue:"发送给"})}:${V}`:s("work:task.sendToChatNoTarget",{defaultValue:"当前没有可发送的对象"})})]}),e.jsx("div",{className:`flex-1 min-h-0 overflow-y-auto px-2 pb-2 ${f?"hidden":""}`,ref:C,children:y.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-xs text-fg-tertiary",children:s("work:task.sendToChatEmpty",{defaultValue:"没有匹配的对象"})}):y.map((t,r)=>{const a=r===0||y[r-1].isAgent!==t.isAgent,o=t.value===x;return e.jsxs("div",{children:[a&&e.jsx("div",{className:"px-3 pt-2 pb-1 text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider",children:t.isAgent?s("work:task.sendToChatAgents",{defaultValue:"智能体"}):s("work:task.sendToChatHumans",{defaultValue:"成员"})}),e.jsxs("button",{type:"button",onClick:()=>L(t.value),"data-selected":o?"true":"false","aria-current":o?"true":void 0,className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${o?"bg-brand-500/15 text-brand-500 font-medium":"text-fg-secondary hover:bg-surface-elevated"}`,children:[e.jsx(D,{name:t.name,avatarUrl:t.avatarUrl,size:22,fallback:t.isAgent?"initials":"icon"}),e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm",children:t.name}),t.meta&&e.jsx("span",{className:"text-[10px] text-fg-tertiary shrink-0",children:t.meta}),o&&e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]})]},t.value)})}),e.jsxs("div",{className:"px-5 py-3 border-t border-border-default bg-surface-secondary/40 shrink-0",children:[e.jsx("span",{className:"block text-[10px] font-semibold text-fg-tertiary uppercase tracking-wider mb-1",children:s("work:task.sendToChatContext",{defaultValue:"将加入的上下文标签"})}),e.jsx("span",{className:"inline-flex items-center gap-1 max-w-full pl-2 pr-2 py-1 rounded-lg bg-brand-500/10 text-brand-500 text-xs border border-brand-500/20",title:d,"data-chip-kind":A,children:e.jsx("span",{className:"truncate",children:n})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:f?()=>N(!1):m,className:"px-3 py-1.5 text-xs rounded-lg border border-border-default text-fg-secondary hover:bg-surface-elevated transition-colors",children:f?s("common:back",{defaultValue:"Back"}):s("common:cancel")}),!f&&e.jsx("button",{type:"button",onClick:F,disabled:!x,"data-send-to-confirm":!0,"aria-label":s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"}),className:"px-3 py-1.5 text-xs rounded-lg bg-brand-600 hover:bg-brand-500 text-on-brand font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:s("work:task.sendToChatConfirm",{defaultValue:"发送到对话"})})]})]})]})})}export{_ as S,X as a,J as r,Q as s};