@bigduu/lotus 2026.7.12 → 2026.7.13

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 (53) hide show
  1. package/dist/assets/{ChildApprovalDialog-B_n6Ybdv.js → ChildApprovalDialog-B8LV5Brg.js} +1 -1
  2. package/dist/assets/{CommandPalette-DjzI2pTn.js → CommandPalette-Bv7nlRLt.js} +1 -1
  3. package/dist/assets/{CommandSelector-BekiEqh5.js → CommandSelector-C3ulsDEO.js} +1 -1
  4. package/dist/assets/{ContextBar-CnIYvaBh.js → ContextBar-BZbSoylh.js} +1 -1
  5. package/dist/assets/{HomeDashboard-oH5yd1vb.js → HomeDashboard-CgF7UUMa.js} +1 -1
  6. package/dist/assets/{MetricsService-C89VqmCU.js → MetricsService-D9UHnvd2.js} +9 -9
  7. package/dist/assets/{QuestionDialog-BGmc5T2Q.js → QuestionDialog--OHAcOEw.js} +1 -1
  8. package/dist/assets/{SessionSummaryCard-CkJ4Ogvy.js → SessionSummaryCard-k8eqS5lA.js} +1 -1
  9. package/dist/assets/{SubAgentsPanel-CAeEPWG3.js → SubAgentsPanel-DrzlO9tS.js} +1 -1
  10. package/dist/assets/{SystemPromptSelector-D2ootx2k.js → SystemPromptSelector-Cgw6oRAS.js} +1 -1
  11. package/dist/assets/SystemSettingsPage-CBDYfyHt.js +22 -0
  12. package/dist/assets/{TodoList-T6kky_4B.js → TodoList-Bf7mCaiV.js} +1 -1
  13. package/dist/assets/{WorkspacePathModal-CUjPDoc_.js → WorkspacePathModal-BAca14jc.js} +1 -1
  14. package/dist/assets/{architectureDiagram-3BPJPVTR-DLK1gMqj.js → architectureDiagram-3BPJPVTR-Cc0X2SOX.js} +1 -1
  15. package/dist/assets/{blockDiagram-GPEHLZMM-C0NrEsKt.js → blockDiagram-GPEHLZMM-C0KHavBI.js} +1 -1
  16. package/dist/assets/{c4Diagram-AAUBKEIU-EMtKW39L.js → c4Diagram-AAUBKEIU-CUf6i_A7.js} +1 -1
  17. package/dist/assets/{chunk-4BX2VUAB-C3d--VIN.js → chunk-4BX2VUAB-BJh4D-bi.js} +1 -1
  18. package/dist/assets/{chunk-QZHKN3VN-Dk0mCz9-.js → chunk-QZHKN3VN-BPX3Wbyh.js} +1 -1
  19. package/dist/assets/{classDiagram-v2-Q7XG4LA2-CWS9sLNc.js → classDiagram-v2-Q7XG4LA2-BJbnmQ0y.js} +1 -1
  20. package/dist/assets/{cose-bilkent-S5V4N54A-BmOdcRKt.js → cose-bilkent-S5V4N54A-zbmmH2SQ.js} +1 -1
  21. package/dist/assets/{dagre-BM42HDAG-D-bUMkRu.js → dagre-BM42HDAG-D2ARftVi.js} +1 -1
  22. package/dist/assets/{diagram-2AECGRRQ-DqDRXgPN.js → diagram-2AECGRRQ-DS_VIDcC.js} +1 -1
  23. package/dist/assets/{diagram-5GNKFQAL-b5E-6nFQ.js → diagram-5GNKFQAL-DdKodxQe.js} +1 -1
  24. package/dist/assets/{diagram-KO2AKTUF-DdY7JK_0.js → diagram-KO2AKTUF-DyYogOtU.js} +1 -1
  25. package/dist/assets/{diagram-LMA3HP47-DgatY2IG.js → diagram-LMA3HP47-CRsDsyq7.js} +1 -1
  26. package/dist/assets/{diagram-OG6HWLK6-24xCofgD.js → diagram-OG6HWLK6-B8vR2DMt.js} +1 -1
  27. package/dist/assets/{erDiagram-TEJ5UH35-D0Gey1BE.js → erDiagram-TEJ5UH35-Bli7r7qi.js} +1 -1
  28. package/dist/assets/{flowDiagram-I6XJVG4X-B6U9ME1L.js → flowDiagram-I6XJVG4X-CYBm2UVK.js} +1 -1
  29. package/dist/assets/{ganttDiagram-6RSMTGT7-DilFRMw7.js → ganttDiagram-6RSMTGT7-C1M6PTcZ.js} +1 -1
  30. package/dist/assets/{gitGraphDiagram-PVQCEYII-DaVyEvTc.js → gitGraphDiagram-PVQCEYII-CfzDNeeT.js} +1 -1
  31. package/dist/assets/{ishikawaDiagram-YF4QCWOH-BGdlijUg.js → ishikawaDiagram-YF4QCWOH-CXNXjWYv.js} +1 -1
  32. package/dist/assets/{journeyDiagram-JHISSGLW-CWLMxmKi.js → journeyDiagram-JHISSGLW-k2I2en9e.js} +1 -1
  33. package/dist/assets/{kanban-definition-UN3LZRKU-D_a7lScw.js → kanban-definition-UN3LZRKU-fBzcWVq1.js} +1 -1
  34. package/dist/assets/{main-C8a7IHwC.js → main-CMBp6TFR.js} +7 -7
  35. package/dist/assets/{mindmap-definition-RKZ34NQL-BasBmfec.js → mindmap-definition-RKZ34NQL-C0aMOvXZ.js} +1 -1
  36. package/dist/assets/{pieDiagram-4H26LBE5-S4w4FbtF.js → pieDiagram-4H26LBE5-3JdASr15.js} +1 -1
  37. package/dist/assets/{quadrantDiagram-W4KKPZXB-91BUCW0p.js → quadrantDiagram-W4KKPZXB-DjWz9ih0.js} +1 -1
  38. package/dist/assets/{requirementDiagram-4Y6WPE33-BWvY5mIA.js → requirementDiagram-4Y6WPE33-Cuya5SaT.js} +1 -1
  39. package/dist/assets/{sankeyDiagram-5OEKKPKP-OiIZ5WXk.js → sankeyDiagram-5OEKKPKP-DYfSOmpL.js} +1 -1
  40. package/dist/assets/{sequenceDiagram-3UESZ5HK-CT1uCTgf.js → sequenceDiagram-3UESZ5HK-B5UJcnmP.js} +1 -1
  41. package/dist/assets/{stateDiagram-AJRCARHV--aI5VQEx.js → stateDiagram-AJRCARHV-DZXWrQl1.js} +1 -1
  42. package/dist/assets/{stateDiagram-v2-BHNVJYJU-DSpEO8P2.js → stateDiagram-v2-BHNVJYJU-DVbPbZiG.js} +1 -1
  43. package/dist/assets/{timeline-definition-PNZ67QCA-CPj-ecmC.js → timeline-definition-PNZ67QCA-B40Lgfp8.js} +1 -1
  44. package/dist/assets/{vendor-charts-CoZ00Nsw.js → vendor-charts-CNLSFcom.js} +1 -1
  45. package/dist/assets/{vendor-mermaid-BYH4D4XO.js → vendor-mermaid-GjPwPGd2.js} +3 -3
  46. package/dist/assets/{vendor-pdf-t-TK5evW.js → vendor-pdf-B2zC5nd1.js} +3 -3
  47. package/dist/assets/{vennDiagram-CIIHVFJN-Bs7RWHXR.js → vennDiagram-CIIHVFJN-CZvfEIkq.js} +1 -1
  48. package/dist/assets/{wardley-L42UT6IY-DZQ4GuLZ.js → wardley-L42UT6IY-BiXJ6t8a.js} +1 -1
  49. package/dist/assets/{wardleyDiagram-YWT4CUSO-BpCITa50.js → wardleyDiagram-YWT4CUSO-D49vkhGv.js} +1 -1
  50. package/dist/assets/{xychartDiagram-2RQKCTM6-BVY9sNsk.js → xychartDiagram-2RQKCTM6-DPMEuY_W.js} +1 -1
  51. package/dist/index.html +2 -2
  52. package/package.json +1 -1
  53. package/dist/assets/SystemSettingsPage-Cj-26_Nm.js +0 -22
@@ -1 +1 @@
1
- import{j as o}from"./vendor-markdown-Bz_2-zkk.js";import{u as q,R as J,a as B}from"./vendor-i18n-Dm-c3D_C.js";import{u as y,I as X}from"./MetricsService-C89VqmCU.js";import{t as O,j as h,V as Q,T as V,W as v,n as f,X as Y,Y as F,l as I,Z,J as G,P as U,$ as oo,a0 as w,u as so,a1 as eo,v as E,a2 as to,a3 as no,F as ro,q as lo,a4 as io,N as ao}from"./vendor-antd-IzIw5qDM.js";import"./vendor-mermaid-BYH4D4XO.js";import"./main-C8a7IHwC.js";const{Text:p}=V,co=a=>({pending:{icon:o.jsx(ao,{}),color:a.colorTextTertiary,textKey:"components.todoList.status.pending",tagColor:"default"},in_progress:{icon:o.jsx(v,{spin:!0}),color:a.colorPrimary,textKey:"components.todoList.status.inProgress",tagColor:"processing"},completed:{icon:o.jsx(F,{}),color:a.colorSuccess,textKey:"components.todoList.status.completed",tagColor:"success"},blocked:{icon:o.jsx(io,{}),color:a.colorError,textKey:"components.todoList.status.blocked",tagColor:"error"}}),fo=({sessionId:a,initialCollapsed:K=!0,compact:t=!1})=>{const{t:n}=q(),{token:e}=O.useToken(),W=J.useMemo(()=>co(e),[e]),g=y(s=>s.chats.find(c=>c.id===a)),j=(g==null?void 0:g.kind)==="child"&&(g.parentSessionId||g.rootSessionId)||a,l=y(s=>s.taskLists[j]),A=y(s=>s.activeItems[j]),x=y(s=>s.evaluationStates[j]),[r,R]=B.useState(K),[i,H]=B.useState(!1),m=(x==null?void 0:x.isEvaluating)||!1,S=(x==null?void 0:x.reasoning)||null,T=l?{session_id:l.session_id,title:l.title,items:l.items,progress:{completed:l.items.filter(s=>s.status==="completed").length,total:l.items.length,percentage:l.items.length>0?Math.round(l.items.filter(s=>s.status==="completed").length/l.items.length*100):0}}:null;if(!T)return null;const C=()=>{i||R(!r)},M=s=>{s.stopPropagation(),H(!i),i||R(!1)},{title:D,items:N,progress:d}=T,L=d.percentage===100,_=o.jsxs(h,{onClick:C,style:{cursor:"pointer",width:"100%"},size:t?6:8,children:[o.jsx(Q,{style:{color:e.colorPrimary}}),o.jsx(p,{strong:!0,style:{fontSize:t?14:15},children:D||n("components.todoList.title")}),m&&(t?o.jsx(X,{nowrap:!0,items:[o.jsxs(o.Fragment,{children:[o.jsx(v,{spin:!0,style:{color:e.colorPrimary,marginRight:4}}),n("components.todoList.evaluating")]})]}):o.jsx(f,{icon:o.jsx(v,{spin:!0}),color:"processing",children:n("components.todoList.evaluating")})),!r&&d.total>0&&o.jsx(Y,{count:`${d.completed}/${d.total}`,style:{backgroundColor:L?e.colorSuccess:e.colorPrimary}})]}),k=o.jsxs(h,{size:t?6:8,children:[d.total>0&&r&&o.jsxs(p,{type:"secondary",style:{fontSize:t?12:13},children:[d.completed,"/",d.total,L&&o.jsx(F,{style:{color:e.colorSuccess,marginLeft:4}})]}),o.jsx(I,{title:n(i?"components.todoList.unpin":"components.todoList.pin"),children:o.jsx("span",{onClick:M,style:{cursor:"pointer",color:i?e.colorPrimary:e.colorTextSecondary,fontSize:t?14:16},children:i?o.jsx(Z,{}):o.jsx(G,{})})}),!i&&o.jsx("span",{onClick:C,style:{cursor:"pointer",color:e.colorTextSecondary,fontSize:12,transform:r?"rotate(-90deg)":void 0,transition:"transform 0.2s"},children:r?o.jsx(U,{}):o.jsx(oo,{})})]}),b=r?null:o.jsxs(o.Fragment,{children:[S?t?o.jsxs(p,{type:"secondary",style:{display:"block",marginBottom:e.marginXS,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorPrimaryBorder}`,lineHeight:1.45},children:[o.jsx(w,{style:{marginRight:6}}),S]}):o.jsx(so,{icon:o.jsx(w,{}),message:n("components.todoList.llmEvaluation"),description:S,type:"info",showIcon:!0,style:{marginBottom:16}}):null,d.total>0&&o.jsx("div",{style:{marginBottom:t?e.marginXS:16},children:o.jsx(eo,{percent:d.percentage,size:"small",status:L?"success":"active",format:s=>o.jsxs(p,{type:"secondary",children:[s,"%"]})})}),o.jsx(E,{size:"small",split:!1,dataSource:N,renderItem:s=>{var z,P;const c=W[s.status],u=A===s.id,$=n(c.textKey);return o.jsx(E.Item,{style:{padding:t?"6px 0":"12px 0",borderLeft:u?`3px solid ${e.colorPrimary}`:"3px solid transparent",paddingLeft:u?t?8:12:t?10:15,backgroundColor:t?"transparent":u?e.colorPrimaryBg:"transparent",borderRadius:t?0:4,marginBottom:t?0:4},children:o.jsx("div",{style:{width:"100%"},children:o.jsxs(h,{align:"start",style:{width:"100%"},size:t?6:8,children:[o.jsx(I,{title:$,children:o.jsx("span",{style:{color:c.color,fontSize:t?14:16},children:c.icon})}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx(p,{style:{textDecoration:s.status==="completed"?"line-through":"none",color:s.status==="completed"?e.colorTextSecondary:e.colorText,fontWeight:u?500:400,fontSize:t?13:void 0},children:s.description}),o.jsx("div",{style:{marginTop:t?3:4},children:t?o.jsx(X,{block:!0,items:[o.jsx("span",{style:{color:c.color},children:$}),s.tool_calls_count!==void 0&&s.tool_calls_count>0?`${s.tool_calls_count} ${n("components.todoList.tools")}`:null,((z=s.depends_on)==null?void 0:z.length)>0?`${s.depends_on.length} ${n("components.todoList.dependencies")}`:null]}):o.jsxs(h,{size:t?6:8,wrap:!0,children:[o.jsx(f,{color:c.tagColor,children:$}),s.tool_calls_count!==void 0&&s.tool_calls_count>0&&o.jsxs(f,{icon:o.jsx(to,{}),color:"processing",children:[s.tool_calls_count," ",n("components.todoList.tools")]}),((P=s.depends_on)==null?void 0:P.length)>0&&o.jsx(I,{title:n("components.todoList.dependsOn",{deps:s.depends_on.join(", ")}),children:o.jsxs(f,{icon:o.jsx(no,{}),children:[s.depends_on.length," ",n("components.todoList.dependencies")]})})]})}),s.status==="completed"&&s.summary&&o.jsx(p,{type:"secondary",style:t?{display:"block",marginTop:4,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorSuccessBorder}`,color:e.colorSuccess,lineHeight:1.45}:{display:"block",marginTop:6,fontSize:12,padding:"4px 8px",backgroundColor:e.colorSuccessBg,borderRadius:4,color:e.colorSuccess},children:s.summary}),s.notes&&o.jsx(p,{type:"secondary",style:t?{display:"block",marginTop:4,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorBorderSecondary}`,lineHeight:1.45}:{display:"block",marginTop:6,fontSize:12,padding:"4px 8px",backgroundColor:e.colorFillQuaternary,borderRadius:4},children:s.notes})]})]})})})}})]});return t?o.jsxs("section",{"data-testid":"todo-list-panel",style:{width:"100%",minWidth:0,marginBottom:e.marginXS,overflow:"hidden",opacity:r&&!i?.9:1},children:[o.jsxs(ro,{align:"center",justify:"space-between",gap:e.marginXS,style:{padding:`${e.paddingXXS??2}px 0 ${e.paddingXS}px`,borderBottom:r?void 0:`1px solid ${m?e.colorPrimaryBorder:e.colorBorderSecondary}`},children:[o.jsx("div",{style:{flex:1,minWidth:0},children:_}),o.jsx("div",{style:{flex:"0 0 auto"},children:k})]}),b?o.jsx("div",{style:{padding:`0 0 ${e.paddingXS}px`},children:b}):null]}):o.jsx(lo,{size:"small",className:"lotus-settings-card",style:{marginBottom:16,borderRadius:8,boxShadow:m?`0 0 0 2px ${e.colorPrimaryBorder}`:"0 2px 8px rgba(0, 0, 0, 0.06)",opacity:r&&!i?.9:1},styles:{body:{padding:r?"12px 16px":16}},title:_,extra:k,children:b})};export{fo as TodoList,fo as default};
1
+ import{j as o}from"./vendor-markdown-Bz_2-zkk.js";import{u as q,R as J,a as B}from"./vendor-i18n-Dm-c3D_C.js";import{u as y,I as X}from"./MetricsService-D9UHnvd2.js";import{t as O,j as h,V as Q,T as V,W as v,n as f,X as Y,Y as F,l as I,Z,J as G,P as U,$ as oo,a0 as w,u as so,a1 as eo,v as E,a2 as to,a3 as no,F as ro,q as lo,a4 as io,N as ao}from"./vendor-antd-IzIw5qDM.js";import"./vendor-mermaid-GjPwPGd2.js";import"./main-CMBp6TFR.js";const{Text:p}=V,co=a=>({pending:{icon:o.jsx(ao,{}),color:a.colorTextTertiary,textKey:"components.todoList.status.pending",tagColor:"default"},in_progress:{icon:o.jsx(v,{spin:!0}),color:a.colorPrimary,textKey:"components.todoList.status.inProgress",tagColor:"processing"},completed:{icon:o.jsx(F,{}),color:a.colorSuccess,textKey:"components.todoList.status.completed",tagColor:"success"},blocked:{icon:o.jsx(io,{}),color:a.colorError,textKey:"components.todoList.status.blocked",tagColor:"error"}}),fo=({sessionId:a,initialCollapsed:K=!0,compact:t=!1})=>{const{t:n}=q(),{token:e}=O.useToken(),W=J.useMemo(()=>co(e),[e]),g=y(s=>s.chats.find(c=>c.id===a)),j=(g==null?void 0:g.kind)==="child"&&(g.parentSessionId||g.rootSessionId)||a,l=y(s=>s.taskLists[j]),A=y(s=>s.activeItems[j]),x=y(s=>s.evaluationStates[j]),[r,R]=B.useState(K),[i,H]=B.useState(!1),m=(x==null?void 0:x.isEvaluating)||!1,S=(x==null?void 0:x.reasoning)||null,T=l?{session_id:l.session_id,title:l.title,items:l.items,progress:{completed:l.items.filter(s=>s.status==="completed").length,total:l.items.length,percentage:l.items.length>0?Math.round(l.items.filter(s=>s.status==="completed").length/l.items.length*100):0}}:null;if(!T)return null;const C=()=>{i||R(!r)},M=s=>{s.stopPropagation(),H(!i),i||R(!1)},{title:D,items:N,progress:d}=T,L=d.percentage===100,_=o.jsxs(h,{onClick:C,style:{cursor:"pointer",width:"100%"},size:t?6:8,children:[o.jsx(Q,{style:{color:e.colorPrimary}}),o.jsx(p,{strong:!0,style:{fontSize:t?14:15},children:D||n("components.todoList.title")}),m&&(t?o.jsx(X,{nowrap:!0,items:[o.jsxs(o.Fragment,{children:[o.jsx(v,{spin:!0,style:{color:e.colorPrimary,marginRight:4}}),n("components.todoList.evaluating")]})]}):o.jsx(f,{icon:o.jsx(v,{spin:!0}),color:"processing",children:n("components.todoList.evaluating")})),!r&&d.total>0&&o.jsx(Y,{count:`${d.completed}/${d.total}`,style:{backgroundColor:L?e.colorSuccess:e.colorPrimary}})]}),k=o.jsxs(h,{size:t?6:8,children:[d.total>0&&r&&o.jsxs(p,{type:"secondary",style:{fontSize:t?12:13},children:[d.completed,"/",d.total,L&&o.jsx(F,{style:{color:e.colorSuccess,marginLeft:4}})]}),o.jsx(I,{title:n(i?"components.todoList.unpin":"components.todoList.pin"),children:o.jsx("span",{onClick:M,style:{cursor:"pointer",color:i?e.colorPrimary:e.colorTextSecondary,fontSize:t?14:16},children:i?o.jsx(Z,{}):o.jsx(G,{})})}),!i&&o.jsx("span",{onClick:C,style:{cursor:"pointer",color:e.colorTextSecondary,fontSize:12,transform:r?"rotate(-90deg)":void 0,transition:"transform 0.2s"},children:r?o.jsx(U,{}):o.jsx(oo,{})})]}),b=r?null:o.jsxs(o.Fragment,{children:[S?t?o.jsxs(p,{type:"secondary",style:{display:"block",marginBottom:e.marginXS,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorPrimaryBorder}`,lineHeight:1.45},children:[o.jsx(w,{style:{marginRight:6}}),S]}):o.jsx(so,{icon:o.jsx(w,{}),message:n("components.todoList.llmEvaluation"),description:S,type:"info",showIcon:!0,style:{marginBottom:16}}):null,d.total>0&&o.jsx("div",{style:{marginBottom:t?e.marginXS:16},children:o.jsx(eo,{percent:d.percentage,size:"small",status:L?"success":"active",format:s=>o.jsxs(p,{type:"secondary",children:[s,"%"]})})}),o.jsx(E,{size:"small",split:!1,dataSource:N,renderItem:s=>{var z,P;const c=W[s.status],u=A===s.id,$=n(c.textKey);return o.jsx(E.Item,{style:{padding:t?"6px 0":"12px 0",borderLeft:u?`3px solid ${e.colorPrimary}`:"3px solid transparent",paddingLeft:u?t?8:12:t?10:15,backgroundColor:t?"transparent":u?e.colorPrimaryBg:"transparent",borderRadius:t?0:4,marginBottom:t?0:4},children:o.jsx("div",{style:{width:"100%"},children:o.jsxs(h,{align:"start",style:{width:"100%"},size:t?6:8,children:[o.jsx(I,{title:$,children:o.jsx("span",{style:{color:c.color,fontSize:t?14:16},children:c.icon})}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx(p,{style:{textDecoration:s.status==="completed"?"line-through":"none",color:s.status==="completed"?e.colorTextSecondary:e.colorText,fontWeight:u?500:400,fontSize:t?13:void 0},children:s.description}),o.jsx("div",{style:{marginTop:t?3:4},children:t?o.jsx(X,{block:!0,items:[o.jsx("span",{style:{color:c.color},children:$}),s.tool_calls_count!==void 0&&s.tool_calls_count>0?`${s.tool_calls_count} ${n("components.todoList.tools")}`:null,((z=s.depends_on)==null?void 0:z.length)>0?`${s.depends_on.length} ${n("components.todoList.dependencies")}`:null]}):o.jsxs(h,{size:t?6:8,wrap:!0,children:[o.jsx(f,{color:c.tagColor,children:$}),s.tool_calls_count!==void 0&&s.tool_calls_count>0&&o.jsxs(f,{icon:o.jsx(to,{}),color:"processing",children:[s.tool_calls_count," ",n("components.todoList.tools")]}),((P=s.depends_on)==null?void 0:P.length)>0&&o.jsx(I,{title:n("components.todoList.dependsOn",{deps:s.depends_on.join(", ")}),children:o.jsxs(f,{icon:o.jsx(no,{}),children:[s.depends_on.length," ",n("components.todoList.dependencies")]})})]})}),s.status==="completed"&&s.summary&&o.jsx(p,{type:"secondary",style:t?{display:"block",marginTop:4,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorSuccessBorder}`,color:e.colorSuccess,lineHeight:1.45}:{display:"block",marginTop:6,fontSize:12,padding:"4px 8px",backgroundColor:e.colorSuccessBg,borderRadius:4,color:e.colorSuccess},children:s.summary}),s.notes&&o.jsx(p,{type:"secondary",style:t?{display:"block",marginTop:4,fontSize:12,paddingLeft:e.paddingXS,borderLeft:`2px solid ${e.colorBorderSecondary}`,lineHeight:1.45}:{display:"block",marginTop:6,fontSize:12,padding:"4px 8px",backgroundColor:e.colorFillQuaternary,borderRadius:4},children:s.notes})]})]})})})}})]});return t?o.jsxs("section",{"data-testid":"todo-list-panel",style:{width:"100%",minWidth:0,marginBottom:e.marginXS,overflow:"hidden",opacity:r&&!i?.9:1},children:[o.jsxs(ro,{align:"center",justify:"space-between",gap:e.marginXS,style:{padding:`${e.paddingXXS??2}px 0 ${e.paddingXS}px`,borderBottom:r?void 0:`1px solid ${m?e.colorPrimaryBorder:e.colorBorderSecondary}`},children:[o.jsx("div",{style:{flex:1,minWidth:0},children:_}),o.jsx("div",{style:{flex:"0 0 auto"},children:k})]}),b?o.jsx("div",{style:{padding:`0 0 ${e.paddingXS}px`},children:b}):null]}):o.jsx(lo,{size:"small",className:"lotus-settings-card",style:{marginBottom:16,borderRadius:8,boxShadow:m?`0 0 0 2px ${e.colorPrimaryBorder}`:"0 2px 8px rgba(0, 0, 0, 0.06)",opacity:r&&!i?.9:1},styles:{body:{padding:r?"12px 16px":16}},title:_,extra:k,children:b})};export{fo as TodoList,fo as default};
@@ -1 +1 @@
1
- var te=Object.defineProperty;var se=(i,t,s)=>t in i?te(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var D=(i,t,s)=>se(i,typeof t!="symbol"?t+"":t,s);import{j as e}from"./vendor-markdown-Bz_2-zkk.js";import{u as C,a as o,i as Y}from"./vendor-i18n-Dm-c3D_C.js";import{H as L,J as ae}from"./MetricsService-C89VqmCU.js";import{A as O,t as Q,T as V,aa as N,j as k,B as I,aq as Z,ar as re,p as ie,as as J,q as ne,y as q,E as W,v as B,w as E,F as M,at as U,au as ce,Y as oe,a4 as le,u as $,ao as de,av as he}from"./vendor-antd-IzIw5qDM.js";import"./main-C8a7IHwC.js";import"./vendor-mermaid-BYH4D4XO.js";const pe=({visible:i,onClose:t,onSelect:s})=>{const{t:c}=C(),{message:r}=O.useApp(),{token:a}=Q.useToken(),{Text:n}=V,[u,j]=o.useState(!1),[l,m]=o.useState(""),[g,v]=o.useState(),[T,w]=o.useState([]),[b,f]=o.useState([]);o.useEffect(()=>{i&&y()},[i]);const y=async d=>{j(!0);try{const p=await L.browseFolder(d);m(p.current_path),v(p.parent_path),w(p.folders)}catch(p){console.error(c("chat.folderBrowser.readFolderError"),p),r.error(c("chat.folderBrowser.readFolderError"))}finally{j(!1)}},x=d=>{f([...b,l]),y(d.path)},F=()=>{g&&(f(b.slice(0,-1)),y(g))},R=()=>{f([]),y()},P=()=>{s(l),t()},S=()=>{if(!l)return[];const d=l.split(/[/\\]/).filter(Boolean);return l.startsWith("/")&&d.unshift("/"),d},_=d=>{const z=S().slice(0,d+1).join("/"),H=(l.startsWith("/"),z);y(H)};return e.jsx(N,{title:c("chat.folderBrowser.title"),open:i,onCancel:t,width:700,footer:null,children:e.jsxs(k,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsxs(k,{children:[e.jsx(I,{icon:e.jsx(Z,{}),onClick:R,size:"small",children:c("common.home")}),e.jsx(I,{icon:e.jsx(re,{}),onClick:F,disabled:!g,size:"small",children:c("common.parentDirectory")}),e.jsx(I,{type:"primary",icon:e.jsx(ie,{}),onClick:P,size:"small",children:c("chat.folderBrowser.selectCurrent")})]}),e.jsx(J,{children:S().map((d,p)=>e.jsx(J.Item,{children:e.jsx(I,{type:"link",size:"small",onClick:()=>_(p),style:{padding:0},children:d==="/"?e.jsx(Z,{}):d})},S().slice(0,p+1).join("/")))}),e.jsxs(ne,{size:"small",styles:{body:{padding:a.paddingXS}},children:[e.jsx(n,{type:"secondary",style:{fontSize:12},children:c("common.currentPath")})," ",e.jsx(n,{code:!0,children:l})]}),e.jsx(q,{spinning:u,children:T.length===0&&!u?e.jsx(W,{image:W.PRESENTED_IMAGE_SIMPLE,description:e.jsx(n,{type:"secondary",children:c("chat.folderBrowser.emptyFolder")})}):e.jsx(B,{dataSource:T,style:{maxHeight:400,overflowY:"auto"},renderItem:d=>e.jsx(B.Item,{style:{padding:0},children:e.jsx(I,{type:"text",icon:e.jsx(E,{}),onClick:()=>x(d),style:{width:"100%",textAlign:"left",padding:`${a.paddingXS}px ${a.paddingSM}px`},children:d.name})})})}),e.jsx(n,{type:"secondary",style:{fontSize:12},children:c("chat.folderBrowser.tip")})]})})};class ue{constructor(t={}){D(this,"cache",new Map);D(this,"pendingValidations",new Map);D(this,"options");this.options={debounceMs:t.debounceMs??300,cacheTimeoutMs:t.cacheTimeoutMs??5*60*1e3,maxRetries:t.maxRetries??3}}async validateWorkspace(t){if(!t||t.trim().length===0)return{path:"",is_valid:!1,error_message:Y.t("chat.workspace.errorEnterPath")};const s=t.trim(),c=this.getCachedResult(s);if(c)return c;const r=this.pendingValidations.get(s);if(r)return r;const a=this.performValidation(s);this.pendingValidations.set(s,a);try{const n=await a;return this.setCachedResult(s,n),n}finally{this.pendingValidations.delete(s)}}validateWorkspaceDebounced(t,s){const r=setTimeout(async()=>{try{const a=await this.validateWorkspace(t);s(a)}catch(a){const n={path:t,is_valid:!1,error_message:a instanceof Error?a.message:Y.t("chat.workspace.checkDescription")};s(n)}},this.options.debounceMs);return()=>{clearTimeout(r)}}clearCache(){this.cache.clear()}getCachedResult(t){const s=this.cache.get(t);return s?Date.now()-s.timestamp>this.options.cacheTimeoutMs?(this.cache.delete(t),null):s.result:null}setCachedResult(t,s){this.cache.set(t,{result:s,timestamp:Date.now()})}async performValidation(t,s=0){try{return await ae.post("workspace/validate",{path:t})}catch(c){if(s<this.options.maxRetries&&this.isRetryableError(c))return await this.delay(Math.pow(2,s)*1e3),this.performValidation(t,s+1);throw c}}isRetryableError(t){return t instanceof Error?t.message.includes("Failed to fetch")||t.message.includes("HTTP error! status: 5"):!1}delay(t){return new Promise(s=>setTimeout(s,t))}async validateMultiplePaths(t){const c=[];for(let r=0;r<t.length;r+=5){const a=t.slice(r,r+5),n=await Promise.all(a.map(u=>this.validateWorkspace(u)));c.push(...n),r+5<t.length&&await this.delay(100)}return c}}const ge=new ue,me=({value:i="",onChange:t,showRecentWorkspaces:s,showSuggestions:c,onValidationChange:r})=>{const{message:a}=O.useApp(),{t:n}=C(),[u,j]=o.useState(i),[l,m]=o.useState({isValidating:!1,result:null}),[g,v]=o.useState([]),[T,w]=o.useState(!1),[b,f]=o.useState([]),[y,x]=o.useState(!1),[F,R]=o.useState(!1),P=o.useRef(null),S=o.useRef(null);o.useEffect(()=>{j(i)},[i]);const _=o.useCallback(async()=>{x(!0);try{const h=await L.getRecentWorkspaces();v(h.slice(0,5))}catch(h){console.error("Failed to load recent workspaces:",h),v([])}finally{x(!1)}},[]),d=o.useCallback(async()=>{R(!0);try{const h=await L.getPathSuggestions();f(h.suggestions.slice(0,8))}catch(h){console.error("Failed to load suggestions:",h),f([])}finally{R(!1)}},[]);o.useEffect(()=>{s&&_(),c&&d();const h=P.current,A=S.current;return()=>{h&&h.abort(),A&&A()}},[s,c,_,d]);const p=o.useCallback(h=>{j(h),t&&t(h),P.current&&P.current.abort(),S.current&&S.current(),h.trim()?(m({isValidating:!0,result:null}),S.current=ge.validateWorkspaceDebounced(h.trim(),A=>{m({isValidating:!1,result:A}),r&&r(A)})):(m({isValidating:!1,result:null}),r&&r(null))},[t,r]),z=o.useCallback(()=>{w(!0)},[]),H=o.useCallback(h=>{p(h),a.success(n("chat.workspace.folderSelected"))},[p,a,n]),ee=o.useCallback(h=>{p(h)},[p]);return{path:u,validationStatus:l,recentWorkspaces:g,suggestions:b,isLoadingRecent:y,isLoadingSuggestions:F,folderBrowserVisible:T,setFolderBrowserVisible:w,handlePathChange:p,handleBrowseClick:z,handleFolderSelect:H,handleWorkspaceSelect:ee}},{Text:X}=V,xe=({show:i,isLoading:t,recentWorkspaces:s,onSelect:c,token:r})=>{const{t:a}=C();return i?e.jsxs(M,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(k,{style:{paddingInline:r.paddingSM},children:[e.jsx(U,{}),e.jsx(X,{strong:!0,children:a("chat.workspace.recentTitle")})]}),t?e.jsx(M,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(q,{size:"small"})}):s.length===0?e.jsx(W,{description:a("chat.workspace.noRecentWorkspaces"),image:W.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(B,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(B.Item,{style:{padding:0},children:e.jsx(I,{type:"text",onClick:()=>c(n.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(M,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(k,{children:[e.jsx(E,{style:{color:r.colorWarning}}),e.jsx(X,{strong:!0,children:n.workspace_name||n.path.split("/").pop()||a("chat.workspace.defaultWorkspaceName")})]}),e.jsx(X,{type:"secondary",ellipsis:{tooltip:n.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:n.path})]})})})})]}):null},{Text:G}=V,fe=(i,t)=>{switch(i.suggestion_type){case"home":return e.jsx(Z,{style:{color:t.colorPrimary}});case"documents":case"desktop":case"downloads":return e.jsx(E,{style:{color:t.colorSuccess}});case"recent":return e.jsx(U,{style:{color:t.colorWarning}});default:return e.jsx(E,{})}},ye=({show:i,isLoading:t,suggestions:s,onSelect:c,token:r})=>{const{t:a}=C();return i?e.jsxs(M,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(k,{style:{paddingInline:r.paddingSM},children:[e.jsx(E,{}),e.jsx(G,{strong:!0,children:a("chat.workspace.suggestedTitle")})]}),t?e.jsx(M,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(q,{size:"small"})}):s.length===0?e.jsx(W,{description:a("chat.workspace.noSuggestions"),image:W.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(B,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(B.Item,{style:{padding:0},children:e.jsx(I,{type:"text",onClick:()=>c(n.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(M,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(k,{children:[fe(n,r),e.jsx(G,{strong:!0,children:n.name})]}),e.jsx(G,{type:"secondary",ellipsis:{tooltip:n.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:n.path})]})})})})]}):null},je=({isValidating:i,result:t,token:s})=>i?e.jsx(ce,{style:{color:s.colorPrimary}}):t?t.is_valid?e.jsx(oe,{style:{color:s.colorSuccess}}):e.jsx(le,{style:{color:s.colorError}}):null,{Text:K}=V,we=({result:i,token:t})=>{const{t:s}=C();return i?e.jsx("div",{style:{marginTop:t.marginXS},children:i.is_valid?e.jsx($,{type:"success",message:e.jsxs(k,{children:[e.jsx("span",{children:s("chat.workspace.validWorkspace")}),i.workspace_name&&e.jsxs(K,{type:"secondary",children:["(",i.workspace_name,")"]}),i.file_count!==void 0&&e.jsx(K,{type:"secondary",children:s("chat.workspace.fileCount",{count:i.file_count})})]}),showIcon:!0}):e.jsx($,{type:"error",message:i.error_message||s("validation.invalidPath"),showIcon:!0})}):null},{Text:Se}=V,ke=({value:i="",onChange:t,placeholder:s,disabled:c=!1,allowBrowse:r=!0,showRecentWorkspaces:a=!0,showSuggestions:n=!0,onValidationChange:u,className:j,style:l})=>{const{t:m}=C(),{token:g}=Q.useToken(),v=s??m("chat.workspace.placeholder"),{path:T,validationStatus:w,recentWorkspaces:b,suggestions:f,isLoadingRecent:y,isLoadingSuggestions:x,folderBrowserVisible:F,setFolderBrowserVisible:R,handlePathChange:P,handleBrowseClick:S,handleFolderSelect:_,handleWorkspaceSelect:d}=me({value:i,onChange:t,showRecentWorkspaces:a,showSuggestions:n,onValidationChange:u});return e.jsxs("div",{className:j,style:l,children:[e.jsx(de,{value:T,onChange:p=>P(p.target.value),placeholder:v,disabled:c,size:"middle",style:{width:"100%"},suffix:e.jsx(je,{isValidating:w.isValidating,result:w.result,token:g}),addonBefore:e.jsxs(k,{children:[e.jsx(E,{}),e.jsx(Se,{children:m("chat.workspace.label")})]}),addonAfter:r?e.jsx(I,{"aria-label":m("chat.workspace.browseFolder"),title:m("chat.workspace.browseFolder"),icon:e.jsx(E,{}),onClick:S,disabled:c,type:"text",size:"middle",style:{display:"inline-flex",alignItems:"center"}}):void 0}),e.jsx(we,{result:w.result,token:g}),(a||n)&&e.jsxs(e.Fragment,{children:[e.jsx(he,{style:{margin:"16px 0 12px 0"}}),e.jsx(xe,{show:a,isLoading:y,recentWorkspaces:b,onSelect:d,token:g}),e.jsx(ye,{show:n,isLoading:x,suggestions:f,onSelect:d,token:g})]}),e.jsx(pe,{visible:F,onClose:()=>R(!1),onSelect:_})]})},{Title:ve}=V,_e=({open:i,initialPath:t="",loading:s=!1,onSubmit:c,onCancel:r})=>{const{t:a}=C(),{message:n}=O.useApp(),[u,j]=o.useState(t),[l,m]=o.useState(null),[g,v]=o.useState(!1);o.useEffect(()=>{i&&(j(t),m(null))},[i,t]);const T=x=>{j(x)},w=x=>{m(x)},b=async()=>{if(!u.trim()){n.error(a("chat.workspace.errorEnterPath"));return}l&&!l.is_valid?N.confirm({title:a("chat.workspace.invalidTitle"),content:e.jsxs("div",{children:[e.jsx("p",{children:a("chat.workspace.issuesDetected")}),e.jsx("p",{children:l.error_message||a("chat.workspace.invalidTitle")}),e.jsx("p",{children:a("chat.workspace.confirmSaveInvalid")})]}),okText:a("common.saveAnyway"),cancelText:a("common.cancel"),onOk:()=>f()}):f()},f=async()=>{v(!0);try{l!=null&&l.is_valid&&await L.addRecentWorkspace(u.trim(),{workspace_name:l.workspace_name}),c(u.trim())}catch(x){console.error("Failed to save workspace path:",x),n.error(a("chat.workspace.errorSaveFailed"))}finally{v(!1)}},y=!u.trim()||s||g;return e.jsx(N,{open:i,title:e.jsx(k,{children:e.jsx(ve,{level:4,style:{margin:0},children:a("chat.workspace.modalTitle")})}),okText:a("common.save"),cancelText:a("common.cancel"),onOk:b,onCancel:r,okButtonProps:{disabled:y,loading:g||s},width:600,destroyOnClose:!0,children:e.jsxs(k,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsx($,{message:a("chat.workspace.descriptionTitle"),description:e.jsxs("div",{children:[e.jsx("p",{children:a("chat.workspace.descriptionP1")}),e.jsx("p",{children:a("chat.workspace.descriptionP2")})]}),type:"info",showIcon:!0}),e.jsx(ke,{value:u,onChange:T,onValidationChange:w,placeholder:a("chat.workspace.placeholder"),disabled:g,allowBrowse:!0,showRecentWorkspaces:!0,showSuggestions:!0}),l&&!l.is_valid&&e.jsx($,{message:a("chat.workspace.checkTitle"),description:l.error_message||a("chat.workspace.checkDescription"),type:"warning",showIcon:!0})]})})};export{_e as default};
1
+ var te=Object.defineProperty;var se=(i,t,s)=>t in i?te(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var D=(i,t,s)=>se(i,typeof t!="symbol"?t+"":t,s);import{j as e}from"./vendor-markdown-Bz_2-zkk.js";import{u as C,a as o,i as Y}from"./vendor-i18n-Dm-c3D_C.js";import{H as L,J as ae}from"./MetricsService-D9UHnvd2.js";import{A as O,t as Q,T as V,aa as N,j as k,B as I,aq as Z,ar as re,p as ie,as as J,q as ne,y as q,E as W,v as B,w as E,F as M,at as U,au as ce,Y as oe,a4 as le,u as $,ao as de,av as he}from"./vendor-antd-IzIw5qDM.js";import"./main-CMBp6TFR.js";import"./vendor-mermaid-GjPwPGd2.js";const pe=({visible:i,onClose:t,onSelect:s})=>{const{t:c}=C(),{message:r}=O.useApp(),{token:a}=Q.useToken(),{Text:n}=V,[u,j]=o.useState(!1),[l,m]=o.useState(""),[g,v]=o.useState(),[T,w]=o.useState([]),[b,f]=o.useState([]);o.useEffect(()=>{i&&y()},[i]);const y=async d=>{j(!0);try{const p=await L.browseFolder(d);m(p.current_path),v(p.parent_path),w(p.folders)}catch(p){console.error(c("chat.folderBrowser.readFolderError"),p),r.error(c("chat.folderBrowser.readFolderError"))}finally{j(!1)}},x=d=>{f([...b,l]),y(d.path)},F=()=>{g&&(f(b.slice(0,-1)),y(g))},R=()=>{f([]),y()},P=()=>{s(l),t()},S=()=>{if(!l)return[];const d=l.split(/[/\\]/).filter(Boolean);return l.startsWith("/")&&d.unshift("/"),d},_=d=>{const z=S().slice(0,d+1).join("/"),H=(l.startsWith("/"),z);y(H)};return e.jsx(N,{title:c("chat.folderBrowser.title"),open:i,onCancel:t,width:700,footer:null,children:e.jsxs(k,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsxs(k,{children:[e.jsx(I,{icon:e.jsx(Z,{}),onClick:R,size:"small",children:c("common.home")}),e.jsx(I,{icon:e.jsx(re,{}),onClick:F,disabled:!g,size:"small",children:c("common.parentDirectory")}),e.jsx(I,{type:"primary",icon:e.jsx(ie,{}),onClick:P,size:"small",children:c("chat.folderBrowser.selectCurrent")})]}),e.jsx(J,{children:S().map((d,p)=>e.jsx(J.Item,{children:e.jsx(I,{type:"link",size:"small",onClick:()=>_(p),style:{padding:0},children:d==="/"?e.jsx(Z,{}):d})},S().slice(0,p+1).join("/")))}),e.jsxs(ne,{size:"small",styles:{body:{padding:a.paddingXS}},children:[e.jsx(n,{type:"secondary",style:{fontSize:12},children:c("common.currentPath")})," ",e.jsx(n,{code:!0,children:l})]}),e.jsx(q,{spinning:u,children:T.length===0&&!u?e.jsx(W,{image:W.PRESENTED_IMAGE_SIMPLE,description:e.jsx(n,{type:"secondary",children:c("chat.folderBrowser.emptyFolder")})}):e.jsx(B,{dataSource:T,style:{maxHeight:400,overflowY:"auto"},renderItem:d=>e.jsx(B.Item,{style:{padding:0},children:e.jsx(I,{type:"text",icon:e.jsx(E,{}),onClick:()=>x(d),style:{width:"100%",textAlign:"left",padding:`${a.paddingXS}px ${a.paddingSM}px`},children:d.name})})})}),e.jsx(n,{type:"secondary",style:{fontSize:12},children:c("chat.folderBrowser.tip")})]})})};class ue{constructor(t={}){D(this,"cache",new Map);D(this,"pendingValidations",new Map);D(this,"options");this.options={debounceMs:t.debounceMs??300,cacheTimeoutMs:t.cacheTimeoutMs??5*60*1e3,maxRetries:t.maxRetries??3}}async validateWorkspace(t){if(!t||t.trim().length===0)return{path:"",is_valid:!1,error_message:Y.t("chat.workspace.errorEnterPath")};const s=t.trim(),c=this.getCachedResult(s);if(c)return c;const r=this.pendingValidations.get(s);if(r)return r;const a=this.performValidation(s);this.pendingValidations.set(s,a);try{const n=await a;return this.setCachedResult(s,n),n}finally{this.pendingValidations.delete(s)}}validateWorkspaceDebounced(t,s){const r=setTimeout(async()=>{try{const a=await this.validateWorkspace(t);s(a)}catch(a){const n={path:t,is_valid:!1,error_message:a instanceof Error?a.message:Y.t("chat.workspace.checkDescription")};s(n)}},this.options.debounceMs);return()=>{clearTimeout(r)}}clearCache(){this.cache.clear()}getCachedResult(t){const s=this.cache.get(t);return s?Date.now()-s.timestamp>this.options.cacheTimeoutMs?(this.cache.delete(t),null):s.result:null}setCachedResult(t,s){this.cache.set(t,{result:s,timestamp:Date.now()})}async performValidation(t,s=0){try{return await ae.post("workspace/validate",{path:t})}catch(c){if(s<this.options.maxRetries&&this.isRetryableError(c))return await this.delay(Math.pow(2,s)*1e3),this.performValidation(t,s+1);throw c}}isRetryableError(t){return t instanceof Error?t.message.includes("Failed to fetch")||t.message.includes("HTTP error! status: 5"):!1}delay(t){return new Promise(s=>setTimeout(s,t))}async validateMultiplePaths(t){const c=[];for(let r=0;r<t.length;r+=5){const a=t.slice(r,r+5),n=await Promise.all(a.map(u=>this.validateWorkspace(u)));c.push(...n),r+5<t.length&&await this.delay(100)}return c}}const ge=new ue,me=({value:i="",onChange:t,showRecentWorkspaces:s,showSuggestions:c,onValidationChange:r})=>{const{message:a}=O.useApp(),{t:n}=C(),[u,j]=o.useState(i),[l,m]=o.useState({isValidating:!1,result:null}),[g,v]=o.useState([]),[T,w]=o.useState(!1),[b,f]=o.useState([]),[y,x]=o.useState(!1),[F,R]=o.useState(!1),P=o.useRef(null),S=o.useRef(null);o.useEffect(()=>{j(i)},[i]);const _=o.useCallback(async()=>{x(!0);try{const h=await L.getRecentWorkspaces();v(h.slice(0,5))}catch(h){console.error("Failed to load recent workspaces:",h),v([])}finally{x(!1)}},[]),d=o.useCallback(async()=>{R(!0);try{const h=await L.getPathSuggestions();f(h.suggestions.slice(0,8))}catch(h){console.error("Failed to load suggestions:",h),f([])}finally{R(!1)}},[]);o.useEffect(()=>{s&&_(),c&&d();const h=P.current,A=S.current;return()=>{h&&h.abort(),A&&A()}},[s,c,_,d]);const p=o.useCallback(h=>{j(h),t&&t(h),P.current&&P.current.abort(),S.current&&S.current(),h.trim()?(m({isValidating:!0,result:null}),S.current=ge.validateWorkspaceDebounced(h.trim(),A=>{m({isValidating:!1,result:A}),r&&r(A)})):(m({isValidating:!1,result:null}),r&&r(null))},[t,r]),z=o.useCallback(()=>{w(!0)},[]),H=o.useCallback(h=>{p(h),a.success(n("chat.workspace.folderSelected"))},[p,a,n]),ee=o.useCallback(h=>{p(h)},[p]);return{path:u,validationStatus:l,recentWorkspaces:g,suggestions:b,isLoadingRecent:y,isLoadingSuggestions:F,folderBrowserVisible:T,setFolderBrowserVisible:w,handlePathChange:p,handleBrowseClick:z,handleFolderSelect:H,handleWorkspaceSelect:ee}},{Text:X}=V,xe=({show:i,isLoading:t,recentWorkspaces:s,onSelect:c,token:r})=>{const{t:a}=C();return i?e.jsxs(M,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(k,{style:{paddingInline:r.paddingSM},children:[e.jsx(U,{}),e.jsx(X,{strong:!0,children:a("chat.workspace.recentTitle")})]}),t?e.jsx(M,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(q,{size:"small"})}):s.length===0?e.jsx(W,{description:a("chat.workspace.noRecentWorkspaces"),image:W.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(B,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(B.Item,{style:{padding:0},children:e.jsx(I,{type:"text",onClick:()=>c(n.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(M,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(k,{children:[e.jsx(E,{style:{color:r.colorWarning}}),e.jsx(X,{strong:!0,children:n.workspace_name||n.path.split("/").pop()||a("chat.workspace.defaultWorkspaceName")})]}),e.jsx(X,{type:"secondary",ellipsis:{tooltip:n.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:n.path})]})})})})]}):null},{Text:G}=V,fe=(i,t)=>{switch(i.suggestion_type){case"home":return e.jsx(Z,{style:{color:t.colorPrimary}});case"documents":case"desktop":case"downloads":return e.jsx(E,{style:{color:t.colorSuccess}});case"recent":return e.jsx(U,{style:{color:t.colorWarning}});default:return e.jsx(E,{})}},ye=({show:i,isLoading:t,suggestions:s,onSelect:c,token:r})=>{const{t:a}=C();return i?e.jsxs(M,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(k,{style:{paddingInline:r.paddingSM},children:[e.jsx(E,{}),e.jsx(G,{strong:!0,children:a("chat.workspace.suggestedTitle")})]}),t?e.jsx(M,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(q,{size:"small"})}):s.length===0?e.jsx(W,{description:a("chat.workspace.noSuggestions"),image:W.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(B,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:n=>e.jsx(B.Item,{style:{padding:0},children:e.jsx(I,{type:"text",onClick:()=>c(n.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(M,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(k,{children:[fe(n,r),e.jsx(G,{strong:!0,children:n.name})]}),e.jsx(G,{type:"secondary",ellipsis:{tooltip:n.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:n.path})]})})})})]}):null},je=({isValidating:i,result:t,token:s})=>i?e.jsx(ce,{style:{color:s.colorPrimary}}):t?t.is_valid?e.jsx(oe,{style:{color:s.colorSuccess}}):e.jsx(le,{style:{color:s.colorError}}):null,{Text:K}=V,we=({result:i,token:t})=>{const{t:s}=C();return i?e.jsx("div",{style:{marginTop:t.marginXS},children:i.is_valid?e.jsx($,{type:"success",message:e.jsxs(k,{children:[e.jsx("span",{children:s("chat.workspace.validWorkspace")}),i.workspace_name&&e.jsxs(K,{type:"secondary",children:["(",i.workspace_name,")"]}),i.file_count!==void 0&&e.jsx(K,{type:"secondary",children:s("chat.workspace.fileCount",{count:i.file_count})})]}),showIcon:!0}):e.jsx($,{type:"error",message:i.error_message||s("validation.invalidPath"),showIcon:!0})}):null},{Text:Se}=V,ke=({value:i="",onChange:t,placeholder:s,disabled:c=!1,allowBrowse:r=!0,showRecentWorkspaces:a=!0,showSuggestions:n=!0,onValidationChange:u,className:j,style:l})=>{const{t:m}=C(),{token:g}=Q.useToken(),v=s??m("chat.workspace.placeholder"),{path:T,validationStatus:w,recentWorkspaces:b,suggestions:f,isLoadingRecent:y,isLoadingSuggestions:x,folderBrowserVisible:F,setFolderBrowserVisible:R,handlePathChange:P,handleBrowseClick:S,handleFolderSelect:_,handleWorkspaceSelect:d}=me({value:i,onChange:t,showRecentWorkspaces:a,showSuggestions:n,onValidationChange:u});return e.jsxs("div",{className:j,style:l,children:[e.jsx(de,{value:T,onChange:p=>P(p.target.value),placeholder:v,disabled:c,size:"middle",style:{width:"100%"},suffix:e.jsx(je,{isValidating:w.isValidating,result:w.result,token:g}),addonBefore:e.jsxs(k,{children:[e.jsx(E,{}),e.jsx(Se,{children:m("chat.workspace.label")})]}),addonAfter:r?e.jsx(I,{"aria-label":m("chat.workspace.browseFolder"),title:m("chat.workspace.browseFolder"),icon:e.jsx(E,{}),onClick:S,disabled:c,type:"text",size:"middle",style:{display:"inline-flex",alignItems:"center"}}):void 0}),e.jsx(we,{result:w.result,token:g}),(a||n)&&e.jsxs(e.Fragment,{children:[e.jsx(he,{style:{margin:"16px 0 12px 0"}}),e.jsx(xe,{show:a,isLoading:y,recentWorkspaces:b,onSelect:d,token:g}),e.jsx(ye,{show:n,isLoading:x,suggestions:f,onSelect:d,token:g})]}),e.jsx(pe,{visible:F,onClose:()=>R(!1),onSelect:_})]})},{Title:ve}=V,_e=({open:i,initialPath:t="",loading:s=!1,onSubmit:c,onCancel:r})=>{const{t:a}=C(),{message:n}=O.useApp(),[u,j]=o.useState(t),[l,m]=o.useState(null),[g,v]=o.useState(!1);o.useEffect(()=>{i&&(j(t),m(null))},[i,t]);const T=x=>{j(x)},w=x=>{m(x)},b=async()=>{if(!u.trim()){n.error(a("chat.workspace.errorEnterPath"));return}l&&!l.is_valid?N.confirm({title:a("chat.workspace.invalidTitle"),content:e.jsxs("div",{children:[e.jsx("p",{children:a("chat.workspace.issuesDetected")}),e.jsx("p",{children:l.error_message||a("chat.workspace.invalidTitle")}),e.jsx("p",{children:a("chat.workspace.confirmSaveInvalid")})]}),okText:a("common.saveAnyway"),cancelText:a("common.cancel"),onOk:()=>f()}):f()},f=async()=>{v(!0);try{l!=null&&l.is_valid&&await L.addRecentWorkspace(u.trim(),{workspace_name:l.workspace_name}),c(u.trim())}catch(x){console.error("Failed to save workspace path:",x),n.error(a("chat.workspace.errorSaveFailed"))}finally{v(!1)}},y=!u.trim()||s||g;return e.jsx(N,{open:i,title:e.jsx(k,{children:e.jsx(ve,{level:4,style:{margin:0},children:a("chat.workspace.modalTitle")})}),okText:a("common.save"),cancelText:a("common.cancel"),onOk:b,onCancel:r,okButtonProps:{disabled:y,loading:g||s},width:600,destroyOnClose:!0,children:e.jsxs(k,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsx($,{message:a("chat.workspace.descriptionTitle"),description:e.jsxs("div",{children:[e.jsx("p",{children:a("chat.workspace.descriptionP1")}),e.jsx("p",{children:a("chat.workspace.descriptionP2")})]}),type:"info",showIcon:!0}),e.jsx(ke,{value:u,onChange:T,onValidationChange:w,placeholder:a("chat.workspace.placeholder"),disabled:g,allowBrowse:!0,showRecentWorkspaces:!0,showSuggestions:!0}),l&&!l.is_valid&&e.jsx($,{message:a("chat.workspace.checkTitle"),description:l.error_message||a("chat.workspace.checkDescription"),type:"warning",showIcon:!0})]})})};export{_e as default};