@bigduu/lotus 2026.5.4 → 2026.5.7

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 (114) hide show
  1. package/dist/assets/{App-DJeBpzcc.css → App-D9R-_Pem.css} +1 -1
  2. package/dist/assets/App-DaOPoP5b.js +223 -0
  3. package/dist/assets/FeatureGuide-BNBq_PLn.js +1 -0
  4. package/dist/assets/SubAgentsPanel-CpKXYYmB.js +1 -0
  5. package/dist/assets/_baseUniq-DVrw3Tro.js +1 -0
  6. package/dist/assets/architectureDiagram-Q4EWVU46-BZE_2gaA.js +36 -0
  7. package/dist/assets/{blockDiagram-DXYQGD6D-B9y1uS9R.js → blockDiagram-DXYQGD6D-CI8uSrzU.js} +4 -4
  8. package/dist/assets/{c4Diagram-AHTNJAMY-BRoJcx0b.js → c4Diagram-AHTNJAMY-DYfj69gY.js} +2 -2
  9. package/dist/assets/chunk-4BX2VUAB-Cw-2rap4.js +1 -0
  10. package/dist/assets/{chunk-4TB4RGXK-D95yqR9H.js → chunk-4TB4RGXK-jxTPHq0D.js} +3 -3
  11. package/dist/assets/chunk-55IACEB6-DmAIxchJ.js +1 -0
  12. package/dist/assets/chunk-EDXVE4YY-FvClTRCF.js +1 -0
  13. package/dist/assets/{chunk-FMBD7UC4-B0r7CE0W.js → chunk-FMBD7UC4-Dv-f6b4O.js} +1 -1
  14. package/dist/assets/{chunk-OYMX7WX6-2_Im5UU8.js → chunk-OYMX7WX6-CUAa_Yz6.js} +3 -3
  15. package/dist/assets/chunk-QZHKN3VN-D1FDs1aQ.js +1 -0
  16. package/dist/assets/chunk-YZCP3GAM-C2iPLYG9.js +1 -0
  17. package/dist/assets/classDiagram-6PBFFD2Q-DVvX4wPS.js +1 -0
  18. package/dist/assets/classDiagram-v2-HSJHXN6E-DVvX4wPS.js +1 -0
  19. package/dist/assets/clone-DRAA6Q7k.js +1 -0
  20. package/dist/assets/cose-bilkent-S5V4N54A-CidaofdU.js +1 -0
  21. package/dist/assets/dagre-KV5264BT-B5okAMLc.js +4 -0
  22. package/dist/assets/diagram-5BDNPKRD-DqlBY-17.js +10 -0
  23. package/dist/assets/diagram-G4DWMVQ6-BuAFDD-X.js +24 -0
  24. package/dist/assets/diagram-MMDJMWI5-CFv_32_w.js +43 -0
  25. package/dist/assets/diagram-TYMM5635-CEU-9NCq.js +24 -0
  26. package/dist/assets/en-US-DLwJLted.js +3 -0
  27. package/dist/assets/{erDiagram-SMLLAGMA-DFjajcpE.js → erDiagram-SMLLAGMA-BGcZ-Hfc.js} +2 -2
  28. package/dist/assets/{flowDiagram-DWJPFMVM-CmdYRxD2.js → flowDiagram-DWJPFMVM-CCSeCjR1.js} +2 -2
  29. package/dist/assets/{ganttDiagram-T4ZO3ILL-BdeV_JQv.js → ganttDiagram-T4ZO3ILL-BqAoxnNO.js} +4 -4
  30. package/dist/assets/gitGraphDiagram-UUTBAWPF-DJ0V7_Rv.js +106 -0
  31. package/dist/assets/{graph-BZhdALnM.js → graph-BxbYGKIB.js} +1 -1
  32. package/dist/assets/index-AIUPRSCn.css +1 -0
  33. package/dist/assets/index-B1KXzc0W.js +8 -0
  34. package/dist/assets/index-B6OABT-M.css +1 -0
  35. package/dist/assets/index-BEkwZ-K8.js +1 -0
  36. package/dist/assets/index-BJC7afG8.js +1 -0
  37. package/dist/assets/index-BylZylqP.js +1 -0
  38. package/dist/assets/index-CLYKYSO0.css +1 -0
  39. package/dist/assets/index-CSqXTBwc.js +1 -0
  40. package/dist/assets/index-Cj9EZ-Bm.js +1 -0
  41. package/dist/assets/index-CucuFwVZ.css +1 -0
  42. package/dist/assets/index-D1aobBlB.js +1 -0
  43. package/dist/assets/index-DLBYvmHv.js +1 -0
  44. package/dist/assets/index-DNsNCcgt.css +1 -0
  45. package/dist/assets/index-DPYLJuvQ.js +1 -0
  46. package/dist/assets/index-D_SsVUqJ.js +21 -0
  47. package/dist/assets/index-DaK9qR94.js +1 -0
  48. package/dist/assets/index-Dkb_XCk_.js +1 -0
  49. package/dist/assets/index-RkUQwJrg.js +1 -0
  50. package/dist/assets/{index.es-Cn1_mau_.js → index.es-BhiHSeCT.js} +1 -1
  51. package/dist/assets/infoDiagram-42DDH7IO-Cemw9omR.js +2 -0
  52. package/dist/assets/{ishikawaDiagram-UXIWVN3A-mjLLHcYj.js → ishikawaDiagram-UXIWVN3A-BYRE-suN.js} +5 -5
  53. package/dist/assets/{journeyDiagram-VCZTEJTY-DKAns2QR.js → journeyDiagram-VCZTEJTY-BRkAfzxG.js} +3 -3
  54. package/dist/assets/{kanban-definition-6JOO6SKY-_8RYarrG.js → kanban-definition-6JOO6SKY-DrTcKNPa.js} +7 -7
  55. package/dist/assets/{layout-BJQnEdOR.js → layout-B2E_GeCC.js} +1 -1
  56. package/dist/assets/main-CuvqMgTQ.js +6 -0
  57. package/dist/assets/min-5KBdYKFY.js +1 -0
  58. package/dist/assets/{mindmap-definition-QFDTVHPH-B8Fqmn2S.js → mindmap-definition-QFDTVHPH-sq4qw8uy.js} +10 -10
  59. package/dist/assets/onboardingStorage-BVcEpmTy.js +1 -0
  60. package/dist/assets/pieDiagram-DEJITSTG-C8vOtX53.js +30 -0
  61. package/dist/assets/{quadrantDiagram-34T5L4WZ-ea-ItGVk.js → quadrantDiagram-34T5L4WZ-LV5yQE3M.js} +3 -3
  62. package/dist/assets/{requirementDiagram-MS252O5E-DoJ6ZjPU.js → requirementDiagram-MS252O5E-Bq6y8VCF.js} +4 -4
  63. package/dist/assets/sankeyDiagram-XADWPNL6-DvABiNaK.js +10 -0
  64. package/dist/assets/{sequenceDiagram-FGHM5R23-CnFMNFdv.js → sequenceDiagram-FGHM5R23-Bv9Ckauz.js} +2 -2
  65. package/dist/assets/stateDiagram-FHFEXIEX-CwYUsnc5.js +1 -0
  66. package/dist/assets/stateDiagram-v2-QKLJ7IA2-aegiqwuH.js +1 -0
  67. package/dist/assets/{timeline-definition-GMOUNBTQ-Dgx0wfE4.js → timeline-definition-GMOUNBTQ-BgidC49j.js} +3 -3
  68. package/dist/assets/{vendor-antd-BpW-8RO2.js → vendor-antd-DODjfilb.js} +85 -85
  69. package/dist/assets/vendor-charts-BYce7JXy.js +65 -0
  70. package/dist/assets/{vendor-markdown-yOmFo5hK.js → vendor-markdown-DzaXAW9Q.js} +23 -23
  71. package/dist/assets/vendor-mermaid-De-Yacw-.js +309 -0
  72. package/dist/assets/{vendor-pdf-xt0MLWhy.js → vendor-pdf-DHgAFQ2M.js} +4 -4
  73. package/dist/assets/vennDiagram-DHZGUBPP-Bzkbjibi.js +34 -0
  74. package/dist/assets/{wardley-RL74JXVD-DIGH9Gor.js → wardley-RL74JXVD-CBRp4POe.js} +2 -2
  75. package/dist/assets/{wardleyDiagram-NUSXRM2D-CMAuUksM.js → wardleyDiagram-NUSXRM2D-DAhT4-uz.js} +3 -3
  76. package/dist/assets/{xychartDiagram-5P7HB3ND-B4_9m2II.js → xychartDiagram-5P7HB3ND-CXfA4uSx.js} +4 -4
  77. package/dist/assets/zh-CN-B74Ip0pW.js +3 -0
  78. package/dist/favicon.png +0 -0
  79. package/dist/index.html +5 -4
  80. package/package.json +2 -1
  81. package/dist/assets/App-CIBUzKFV.js +0 -254
  82. package/dist/assets/_baseUniq-C-LHgpwK.js +0 -1
  83. package/dist/assets/architectureDiagram-Q4EWVU46-knT7SmxI.js +0 -36
  84. package/dist/assets/chunk-4BX2VUAB-Dg65rhkh.js +0 -1
  85. package/dist/assets/chunk-55IACEB6-CUbVVgja.js +0 -1
  86. package/dist/assets/chunk-EDXVE4YY-B_pb0EHW.js +0 -1
  87. package/dist/assets/chunk-QZHKN3VN-DbGqS_ab.js +0 -1
  88. package/dist/assets/chunk-YZCP3GAM-DdAJ9t55.js +0 -1
  89. package/dist/assets/classDiagram-6PBFFD2Q-hQqJj1FL.js +0 -1
  90. package/dist/assets/classDiagram-v2-HSJHXN6E-hQqJj1FL.js +0 -1
  91. package/dist/assets/clone-BnNFRj9O.js +0 -1
  92. package/dist/assets/cose-bilkent-S5V4N54A-BDxVvsWm.js +0 -1
  93. package/dist/assets/dagre-KV5264BT-vzGZtZ_w.js +0 -4
  94. package/dist/assets/diagram-5BDNPKRD-CGYBSS7a.js +0 -10
  95. package/dist/assets/diagram-G4DWMVQ6-DBeNrz6n.js +0 -24
  96. package/dist/assets/diagram-MMDJMWI5-CCt9wdnx.js +0 -43
  97. package/dist/assets/diagram-TYMM5635-B-q2z4os.js +0 -24
  98. package/dist/assets/gitGraphDiagram-UUTBAWPF-Bv1bpmVh.js +0 -106
  99. package/dist/assets/index-8MhLoQym.js +0 -1
  100. package/dist/assets/index-BR-Jz13T.js +0 -1
  101. package/dist/assets/index-Byt6VrzO.js +0 -1
  102. package/dist/assets/index-CTVpEC_u.js +0 -1
  103. package/dist/assets/index-jIgpBMFj.js +0 -1
  104. package/dist/assets/infoDiagram-42DDH7IO-COrckp6q.js +0 -2
  105. package/dist/assets/main-_fs1sZGu.js +0 -10
  106. package/dist/assets/min-CEPPgGqS.js +0 -1
  107. package/dist/assets/pieDiagram-DEJITSTG-BCklzk2d.js +0 -30
  108. package/dist/assets/sankeyDiagram-XADWPNL6-CtYEK_8E.js +0 -10
  109. package/dist/assets/stateDiagram-FHFEXIEX-B_kOGWb-.js +0 -1
  110. package/dist/assets/stateDiagram-v2-QKLJ7IA2-DL6DUSmq.js +0 -1
  111. package/dist/assets/vendor-charts-fIPNnfk-.js +0 -65
  112. package/dist/assets/vendor-mermaid-DA4JIJaA.js +0 -309
  113. package/dist/assets/vennDiagram-DHZGUBPP-DcJGrLhu.js +0 -34
  114. package/dist/vite.svg +0 -1
@@ -0,0 +1 @@
1
+ import{j as n}from"./vendor-markdown-DzaXAW9Q.js";import{S as s,D as l,j as d,k as c,l as p,E as x,F as m,t as u}from"./vendor-antd-DODjfilb.js";import"./vendor-i18n-BNURlJ23.js";const{Text:g}=d,{useToken:h}=u,w=({files:o,onRemove:i,onClear:r})=>{const{token:e}=h();return o.length===0?null:n.jsx("div",{style:{marginBottom:e.marginSM,padding:`${e.paddingXXS}px ${e.paddingXS}px`,borderRadius:999,background:e.colorFillSecondary,border:`1px solid ${e.colorBorderSecondary}`},children:n.jsxs(s,{align:"center",size:e.marginXS,style:{width:"100%",justifyContent:"space-between"},children:[n.jsxs(s,{align:"center",wrap:!0,size:e.marginXS,children:[n.jsx(l,{style:{color:e.colorTextSecondary}}),n.jsxs(g,{type:"secondary",style:{fontSize:e.fontSizeSM},children:[o.length," file",o.length>1?"s":""]}),o.map(t=>n.jsx(c,{title:`${t.type||"unknown"} • ${(t.size/1024).toFixed(1)} KB`,children:n.jsx(p,{closable:!0,onClose:a=>{a.preventDefault(),i(t.id)},style:{borderRadius:999,marginInlineEnd:0,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})},t.id))]}),r?n.jsx(x,{type:"text",size:"small",icon:n.jsx(m,{}),onClick:r,style:{borderRadius:999},children:"Clear"}):null]})})};export{w as default};
@@ -0,0 +1 @@
1
+ import{j as n}from"./vendor-markdown-DzaXAW9Q.js";import{u as U,a}from"./vendor-i18n-BNURlJ23.js";import{u as k,a as H,b as B,c as P,d as V,A as W,g as z,s as G,o as Y}from"./App-DaOPoP5b.js";import{t as X,K as Z,X as J,N as ee,Y as te,Z as se,$ as ne,a0 as oe,a1 as ae,a2 as ie,V as le,a3 as ce,W as re,j as de,z as me,a4 as ue,l as pe}from"./vendor-antd-DODjfilb.js";import"./vendor-mermaid-De-Yacw-.js";import"./main-CuvqMgTQ.js";const ge=[{id:"settings-provider",tabKey:"provider",titleKey:"commandPalette.actions.openProviderSettings",fallbackTitle:"Open Provider Settings",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"AI",keywords:["api","key","openai","anthropic","gemini","model"]},{id:"settings-model-limits",tabKey:"model-limits",titleKey:"commandPalette.actions.openModelLimits",fallbackTitle:"Open Model Limits",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"AI",keywords:["token","context","window","budget","limit"]},{id:"settings-prompts",tabKey:"prompts",titleKey:"commandPalette.actions.openPrompts",fallbackTitle:"Open System Prompts",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"AI",keywords:["system","prompt","persona","instruction"]},{id:"settings-skills",tabKey:"skills",titleKey:"commandPalette.actions.openSkills",fallbackTitle:"Open Skills",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Tools",keywords:["skill","capability","plugin"]},{id:"settings-mcp",tabKey:"mcp",titleKey:"commandPalette.actions.openMcpSettings",fallbackTitle:"Open MCP Settings",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Tools",keywords:["mcp","server","tool","external"]},{id:"settings-workflows",tabKey:"workflows",titleKey:"commandPalette.actions.openWorkflowSettings",fallbackTitle:"Open Workflow Settings",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Tools",keywords:["workflow","automation","template"]},{id:"settings-hooks",tabKey:"hooks",titleKey:"commandPalette.actions.openHooks",fallbackTitle:"Open Hooks",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Tools",keywords:["hook","event","trigger","callback"]},{id:"settings-schedules",tabKey:"schedules",titleKey:"commandPalette.actions.openSchedulesSettings",fallbackTitle:"Open Schedules",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Ops",keywords:["schedule","cron","recurring","timer","automated"]},{id:"settings-sessions",tabKey:"sessions",titleKey:"commandPalette.actions.openSessionsSettings",fallbackTitle:"Open Session Monitor",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Monitor",keywords:["session","monitor","cleanup","history"]},{id:"settings-metrics",tabKey:"metrics",titleKey:"commandPalette.actions.openMetrics",fallbackTitle:"Open Metrics Dashboard",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"Monitor",keywords:["metrics","dashboard","analytics","usage","stats"]},{id:"settings-masking",tabKey:"masking",titleKey:"commandPalette.actions.openMasking",fallbackTitle:"Open Keyword Masking",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"Security & privacy",badge:"Security",keywords:["mask","redact","privacy","keyword","sensitive"]},{id:"settings-env",tabKey:"env-vars",titleKey:"commandPalette.actions.openEnvVars",fallbackTitle:"Open Environment Variables",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"System",keywords:["env","environment","variable","config"]},{id:"settings-config",tabKey:"config",titleKey:"commandPalette.actions.openConfig",fallbackTitle:"Open Configuration",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"System",keywords:["config","json","bamboo","data","path"]},{id:"settings-app",tabKey:"app",titleKey:"commandPalette.actions.openAppSettings",fallbackTitle:"Open App Settings",subtitleKey:"commandPalette.groups.settings",fallbackSubtitle:"System settings",badge:"System",keywords:["app","application","reset","theme","language"]}],be=(t,c)=>{const i=[t.title,t.id,t.kind||"root"];return t.pinned&&i.push("pinned","pin"),c&&i.push("running","processing"),t.config.workspacePath&&i.push(t.config.workspacePath),t.updatedAt&&i.push(t.updatedAt),i.filter(Boolean)},fe=(t,c,i)=>{const l=[];if(t.kind==="child"?l.push(c):l.push(i),t.config.workspacePath&&l.push(t.config.workspacePath),t.updatedAt)try{l.push(new Date(t.updatedAt).toLocaleString())}catch{l.push(t.updatedAt)}return l.join(" • ")},ye=(t,c)=>{const i=c.trim().toLowerCase();return i?t.filter(l=>[l.title,l.subtitle||"",...l.keywords].join(" ").toLowerCase().includes(i)):t},ke=t=>{if(!(t instanceof HTMLElement))return!1;const c=t.tagName.toLowerCase();return t.isContentEditable?!0:c==="input"||c==="textarea"||c==="select"},K="__LOTUS_COMMAND_PALETTE_FORCE_OPEN__",Te=()=>{const{t}=U(),{token:c}=X.useToken(),i=typeof document<"u"&&document.body.getAttribute("data-vdi-safe")==="true",{message:l}=Z.useApp(),x=k(e=>e.chats),j=k(e=>e.addChat),v=k(e=>e.lastSelectedPromptId),m=k(e=>e.systemPrompts),I=k(e=>e.executionBySession),[u,p]=a.useState(()=>typeof window>"u"?!1:window[K]?(delete window[K],!0):!1),[T,S]=a.useState(""),[b,f]=a.useState(0),A=a.useRef(null),M=a.useRef(null),C=H(e=>e.open),O=B(e=>e.toggleTheme),E=B(e=>e.themeMode),w=P(e=>e.sidebar.collapsed),N=P(e=>e.setSidebarCollapsed),h=V(e=>e.mode),L=V(e=>e.toggleMode),R=a.useCallback(async()=>{var F,q;const e=m.find(y=>y.id===v),s=(e==null?void 0:e.id)||(m.length>0?((F=m.find(y=>y.id==="general_assistant"))==null?void 0:F.id)||m[0].id:""),d=await j({title:t("chat.sidebar.newSession"),createdAt:Date.now(),messages:[],config:{systemPromptId:s,baseSystemPrompt:(e==null?void 0:e.content)||(m.length>0?((q=m.find(y=>y.id==="general_assistant"))==null?void 0:q.content)||m[0].content:""),lastUsedEnhancedPrompt:null}}),{activeLeafId:o,setLeafSessionId:g,setActiveLeafId:Q}=P.getState();g(o,d),Q(o)},[j,v,m,t]),_=a.useMemo(()=>{const e=ge.filter(s=>!(h==="simple"&&W.has(s.tabKey))).map(s=>({id:s.id,kind:"action",title:t(s.titleKey,s.fallbackTitle),subtitle:t(s.subtitleKey||"commandPalette.groups.settings",s.fallbackSubtitle||"System settings"),keywords:[s.tabKey,s.badge||"","settings","config",...s.keywords||[]],icon:n.jsx(J,{}),badge:s.badge,onSelect:()=>{C("chat",s.tabKey)}}));return[{id:"new-session",kind:"action",title:t("commandPalette.actions.newSession","Create New Session"),subtitle:t("commandPalette.groups.quickActions","Quick actions"),keywords:["new","create","session","chat","conversation"],icon:n.jsx(ee,{}),badge:t("commandPalette.badges.quickAction","Action"),onSelect:async()=>{await R()}},{id:"toggle-theme",kind:"action",title:E==="dark"?t("commandPalette.actions.switchToLight","Switch to Light Mode"):t("commandPalette.actions.switchToDark","Switch to Dark Mode"),subtitle:t("commandPalette.groups.quickActions","Quick actions"),keywords:["theme","dark","light","mode","appearance","toggle","color"],icon:n.jsx(te,{}),badge:E==="dark"?"☀️":"🌙",onSelect:()=>{O()}},{id:"toggle-sidebar",kind:"action",title:w?t("commandPalette.actions.showSidebar","Show Sidebar"):t("commandPalette.actions.hideSidebar","Hide Sidebar"),subtitle:t("commandPalette.groups.quickActions","Quick actions"),keywords:["sidebar","toggle","hide","show","panel","menu"],icon:w?n.jsx(se,{}):n.jsx(ne,{}),badge:"Layout",onSelect:()=>{N(!w)}},{id:"split-pane",kind:"action",title:t("commandPalette.actions.splitPane","Split Pane"),subtitle:t("commandPalette.groups.quickActions","Quick actions"),keywords:["split","pane","multi","dual","side","layout"],icon:n.jsx(oe,{}),badge:"Layout",onSelect:()=>{const{tree:s,activeLeafId:d,splitLeaf:o}=P.getState();z(s).length<4&&o(d,"vertical")}},...e,{id:"toggle-experience-mode",kind:"action",title:h==="simple"?t("commandPalette.actions.switchToAdvanced","Switch to Advanced Mode"):t("commandPalette.actions.switchToSimple","Switch to Simple Mode"),subtitle:t("commandPalette.groups.quickActions","Quick actions"),keywords:["mode","simple","advanced","beginner","expert","experience","complexity"],icon:n.jsx(ae,{}),badge:h==="simple"?"Simple":"Advanced",onSelect:()=>{L()}}]},[R,C,O,E,w,N,h,L,t]),D=a.useMemo(()=>x.map(e=>{const s=G(e.id)({executionBySession:I});return{id:`session-${e.id}`,kind:"session",title:e.title,subtitle:fe(e,t("commandPalette.badges.childSession","Child session"),t("commandPalette.badges.rootSession","Session")),keywords:be(e,s),icon:n.jsx(ie,{}),badge:e.pinned?t("commandPalette.badges.pinned","Pinned"):s?t("commandPalette.badges.running","Running"):e.kind==="child"?t("commandPalette.badges.child","Child"):void 0,onSelect:()=>{Y(e.id)}}}),[x,I,t]),$=a.useMemo(()=>[..._,...D],[_,D]),r=a.useMemo(()=>ye($,T).slice(0,40),[$,T]);return a.useEffect(()=>{f(e=>r.length===0?0:Math.min(e,r.length-1))},[r.length]),a.useEffect(()=>{if(!u)return;const e=window.setTimeout(()=>{var s,d;(s=A.current)==null||s.focus(),(d=A.current)==null||d.select()},0);return()=>window.clearTimeout(e)},[u]),a.useEffect(()=>{if(typeof window>"u")return;const e=s=>{if((s.metaKey||s.ctrlKey)&&s.key.toLowerCase()==="k"){s.preventDefault(),p(o=>!o);return}if(u){if(s.key==="Escape"){s.preventDefault(),p(!1);return}if(!(ke(s.target)&&s.key!=="ArrowUp"&&s.key!=="ArrowDown"&&s.key!=="Enter")){if(s.key==="ArrowDown"){s.preventDefault(),f(o=>r.length===0?0:(o+1)%r.length);return}if(s.key==="ArrowUp"){s.preventDefault(),f(o=>r.length===0?0:o===0?r.length-1:o-1);return}if(s.key==="Enter"){const o=r[b];if(!o)return;s.preventDefault(),(async()=>{try{await o.onSelect(),p(!1),S("")}catch(g){console.error("[CommandPalette] action failed",g),l.error(g instanceof Error?g.message:t("commandPalette.errors.actionFailed","Command failed"))}})()}}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,l,u,b,t]),a.useEffect(()=>{u||(S(""),f(0))},[u]),a.useEffect(()=>{typeof window>"u"||!window[K]||(delete window[K],p(!0))},[]),a.useEffect(()=>{const e=M.current;if(!e)return;const s=e.querySelector(`[data-command-index="${b}"]`);s==null||s.scrollIntoView({block:"nearest"})},[b]),n.jsx(le,{open:u,onCancel:()=>p(!1),footer:null,centered:!0,width:680,destroyOnClose:!0,className:"lotus-command-palette-modal",title:null,closable:!1,styles:{content:{padding:12,borderRadius:c.borderRadiusLG,overflow:"hidden",background:c.colorBgElevated,backdropFilter:i?"none":"blur(18px)",WebkitBackdropFilter:i?"none":"blur(18px)"},body:{padding:0},mask:{backdropFilter:i?"none":"blur(6px)",WebkitBackdropFilter:i?"none":"blur(6px)"}},children:n.jsxs("div",{className:"lotus-command-palette-shell",children:[n.jsxs("div",{className:"lotus-command-palette-search",children:[n.jsx(ce,{style:{color:c.colorTextTertiary,fontSize:16}}),n.jsx(re,{ref:A,value:T,onChange:e=>S(e.target.value),variant:"borderless",placeholder:t("commandPalette.searchPlaceholder","Search sessions, settings, and actions"),"aria-label":t("commandPalette.searchPlaceholder","Search sessions, settings, and actions"),suffix:n.jsx(de.Text,{type:"secondary",style:{fontSize:12},children:"⌘K"})})]}),n.jsxs("div",{className:"lotus-command-palette-hint",children:[n.jsx(me,{}),n.jsx("span",{children:t("commandPalette.navigationHint","Use ↑↓ to navigate, Enter to open, and Esc to close.")})]}),n.jsx("div",{ref:M,className:"lotus-command-palette-list",role:"listbox",children:r.length===0?n.jsxs("div",{className:"lotus-command-palette-empty",children:[n.jsx(ue,{}),n.jsx("span",{children:t("commandPalette.empty","No matching commands")})]}):r.map((e,s)=>{const d=s===b;return n.jsxs("button",{type:"button",className:`lotus-command-palette-item ${d?"is-selected":""}`,"data-command-index":s,onMouseEnter:()=>f(s),onClick:()=>{(async()=>{try{await e.onSelect(),p(!1),S("")}catch(o){console.error("[CommandPalette] action failed",o),l.error(o instanceof Error?o.message:t("commandPalette.errors.actionFailed","Command failed"))}})()},children:[n.jsx("span",{className:"lotus-command-palette-item-icon",children:e.icon}),n.jsxs("span",{className:"lotus-command-palette-item-content",children:[n.jsxs("span",{className:"lotus-command-palette-item-title-row",children:[n.jsx("span",{className:"lotus-command-palette-item-title",children:e.title}),e.badge?n.jsx(pe,{bordered:!1,children:e.badge}):null]}),e.subtitle?n.jsx("span",{className:"lotus-command-palette-item-subtitle",children:e.subtitle}):null]})]},e.id)})})]})})};export{Te as CommandPalette,Te as default};
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-markdown-DzaXAW9Q.js";import{u as b,a as x}from"./vendor-i18n-BNURlJ23.js";import{u as i}from"./App-DaOPoP5b.js";import{K as w,M as n,E as l,N as T,L as c,l as E,O as L,Q as R,U as k,V as v,W as d}from"./vendor-antd-DODjfilb.js";import"./vendor-mermaid-De-Yacw-.js";import"./main-CuvqMgTQ.js";const B=()=>{const{t:s}=b(),{message:r}=w.useApp(),f=i(e=>e.systemPrompts),P=i(e=>e.addSystemPrompt),M=i(e=>e.updateSystemPrompt),j=i(e=>e.deleteSystemPrompt),[h,u]=x.useState(!1),[a,p]=x.useState(null),[o]=n.useForm(),g=(e=null)=>{if(e!=null&&e.isDefault){r.warning(s("settings.systemPromptManager.defaultPromptLocked"));return}p(e),o.setFieldsValue(e||{name:"",description:"",content:""}),u(!0)},y=()=>{u(!1),p(null),o.resetFields()},S=async()=>{if(a!=null&&a.isDefault){r.warning(s("settings.systemPromptManager.defaultPromptLocked"));return}try{const e=await o.validateFields();a?(await M({...a,...e}),r.success(s("settings.systemPromptManager.updateSuccess"))):(await P(e),r.success(s("settings.systemPromptManager.addSuccess"))),y()}catch(e){console.error("Failed to save prompt:",e),r.error(e instanceof Error?e.message:s("settings.systemPromptManager.saveError"))}},I=async e=>{try{await j(e),r.success(s("settings.systemPromptManager.deleteSuccess"))}catch(m){console.error("Failed to delete prompt:",m),r.error(m instanceof Error?m.message:s("settings.systemPromptManager.deleteError"))}};return t.jsxs("div",{children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[t.jsx("h2",{children:s("settings.systemPromptManager.title")}),t.jsx(l,{type:"primary",icon:t.jsx(T,{}),onClick:()=>g(),children:s("settings.systemPromptManager.addButton")})]}),t.jsx(c,{itemLayout:"horizontal",dataSource:f,renderItem:e=>t.jsxs(c.Item,{actions:[e.isDefault?null:t.jsx(l,{type:"text",icon:t.jsx(L,{}),onClick:()=>g(e)}),e.isDefault?null:t.jsx(R,{title:s("settings.systemPromptManager.deleteConfirm"),onConfirm:()=>I(e.id),okText:s("common.yes"),cancelText:s("common.no"),children:t.jsx(l,{type:"text",danger:!0,icon:t.jsx(k,{}),"aria-label":s("common.delete")})})],children:[t.jsx(c.Item.Meta,{title:e.name,description:e.description||e.content.substring(0,200)+(e.content.length>200?"...":"")}),e.isDefault&&t.jsx(E,{children:s("settings.systemPromptManager.defaultTag")})]})}),t.jsx(v,{title:s(a?"settings.systemPromptManager.editTitle":"settings.systemPromptManager.addTitle"),open:h,onOk:S,onCancel:y,width:"60%",forceRender:!0,children:t.jsxs(n,{form:o,layout:"vertical",name:"system_prompt_form",children:[t.jsx(n.Item,{name:"name",label:s("settings.systemPromptManager.nameLabel"),rules:[{required:!0,message:s("settings.systemPromptManager.nameRequired")}],children:t.jsx(d,{})}),t.jsx(n.Item,{name:"description",label:s("settings.systemPromptManager.descriptionLabel"),rules:[{required:!1,message:s("settings.systemPromptManager.descriptionRequired")}],children:t.jsx(d.TextArea,{rows:3})}),t.jsx(n.Item,{name:"content",label:s("settings.systemPromptManager.contentLabel"),rules:[{required:!0,message:s("settings.systemPromptManager.contentRequired")}],children:t.jsx(d.TextArea,{rows:10})})]})})]})};export{B as default};
@@ -0,0 +1 @@
1
+ .lotus-command-palette-shell{display:flex;flex-direction:column;gap:8px}.lotus-command-palette-search{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:14px;background:var(--lotus-overlay-bg, rgba(255, 255, 255, .82));border:1px solid var(--lotus-surface-border, rgba(255, 255, 255, .72))}.lotus-command-palette-search .ant-input{font-size:15px}.lotus-command-palette-hint{display:inline-flex;align-items:center;gap:8px;padding:0 4px;font-size:12px;color:var(--ant-color-text-tertiary)}.lotus-command-palette-list{display:flex;flex-direction:column;gap:6px;max-height:min(60vh,560px);overflow-y:auto;padding:4px}.lotus-command-palette-item{display:flex;align-items:flex-start;gap:12px;width:100%;padding:12px 14px;border-radius:14px;border:1px solid transparent;background:transparent;text-align:left;cursor:pointer;transition:background-color .18s ease-out,border-color .18s ease-out,transform .18s ease-out,box-shadow .18s ease-out}.lotus-command-palette-item:hover,.lotus-command-palette-item.is-selected{background:#ccfbf1b8;border-color:#0d94882e;box-shadow:0 8px 18px #0d948814}.lotus-command-palette-item:focus-visible{outline:2px solid var(--lotus-focus-ring, rgba(13, 148, 136, .22));outline-offset:2px}.lotus-command-palette-item-icon{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;flex:0 0 auto;border-radius:12px;color:var(--lotus-primary, #0d9488);background:#0d94881a}.lotus-command-palette-item-content{display:flex;flex:1;min-width:0;flex-direction:column;gap:4px}.lotus-command-palette-item-title-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.lotus-command-palette-item-title{color:var(--ant-color-text);font-size:14px;font-weight:600;line-height:1.4}.lotus-command-palette-item-subtitle{color:var(--ant-color-text-secondary);font-size:12px;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lotus-command-palette-empty{display:flex;align-items:center;justify-content:center;gap:8px;padding:28px 16px;color:var(--ant-color-text-tertiary);font-size:13px}.lotus-command-palette-modal .ant-tag{margin-inline-end:0;border-radius:999px;font-size:11px}[data-theme=dark] .lotus-command-palette-search{background:#0b1612b3;border-color:#ffffff14}[data-theme=dark] .lotus-command-palette-item:hover,[data-theme=dark] .lotus-command-palette-item.is-selected{background:#0d948829;border-color:#2dd4bf38;box-shadow:0 10px 24px #02061747}[data-theme=dark] .lotus-command-palette-item-icon{background:#2dd4bf24;color:#99f6e4}@media (prefers-reduced-motion: reduce){.lotus-command-palette-item{transition:none}}
@@ -0,0 +1 @@
1
+ import{j as a}from"./vendor-markdown-DzaXAW9Q.js";import{m as $,n as v,p as B}from"./App-DaOPoP5b.js";import{a as l,u as E}from"./vendor-i18n-BNURlJ23.js";import{J as T,t as M,l as L,af as D,a6 as K,H as F}from"./vendor-antd-DODjfilb.js";import"./vendor-mermaid-De-Yacw-.js";import"./main-CuvqMgTQ.js";const z=({visible:p,searchText:k,onSelect:j,onCancel:f,onAutoComplete:g})=>{const[o,i]=l.useState([]),[c,R]=l.useState([]),[d,u]=l.useState(0),[N,I]=l.useState(!1),S=l.useRef(null),h=l.useRef(null);l.useEffect(()=>{if(!p)return;const s=$.getInstance();(async()=>{I(!0);try{const r=await s.listCommands();v("[CommandSelector]","[CommandSelector] Fetched commands:",r),i(r),u(0)}catch(r){console.error("[CommandSelector] Failed to fetch commands:",r),i([])}finally{I(!1)}})()},[p]),l.useEffect(()=>{const s=o.filter(e=>{var x,y,b,C,w;const r=k.toLowerCase(),n=(e.displayName??"").toLowerCase();return e.name.toLowerCase().includes(r)||n.includes(r)||e.description.toLowerCase().includes(r)||e.type==="mcp"&&[(x=e.metadata)==null?void 0:x.serverId,(y=e.metadata)==null?void 0:y.serverName,(b=e.metadata)==null?void 0:b.originalName].filter(m=>typeof m=="string").some(m=>m.toLowerCase().includes(r))||(((C=e.category)==null?void 0:C.toLowerCase().includes(r))??!1)||(((w=e.tags)==null?void 0:w.some(m=>m.toLowerCase().includes(r)))??!1)});R(s),u(0)},[o,k]),l.useEffect(()=>{if(!h.current||!S.current)return;const s=S.current,e=h.current,r=s.getBoundingClientRect(),n=e.getBoundingClientRect();n.top<r.top?e.scrollIntoView({block:"start",behavior:"smooth"}):n.bottom>r.bottom&&e.scrollIntoView({block:"end",behavior:"smooth"})},[d,c]);const t=l.useCallback(async s=>{try{j({name:s.name,type:s.type,id:s.id})}catch(e){console.error(`[CommandSelector] Failed to select command '${s.name}':`,e)}},[j]);return l.useEffect(()=>{const s=e=>{if(p)switch(e.key){case"ArrowDown":case"n":if(e.key==="n"&&!e.ctrlKey)break;e.preventDefault(),e.stopPropagation(),u(r=>r<c.length-1?r+1:0);break;case"ArrowUp":case"p":if(e.key==="p"&&!e.ctrlKey)break;e.preventDefault(),e.stopPropagation(),u(r=>r>0?r-1:c.length-1);break;case"Enter":e.preventDefault(),e.stopPropagation(),c[d]&&t(c[d]);break;case" ":case"Tab":e.preventDefault(),e.stopPropagation(),c[d]&&g&&g(c[d].name);break;case"Escape":e.preventDefault(),e.stopPropagation(),f();break}};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[p,c,d,f,g,t]),{containerRef:S,selectedItemRef:h,filteredCommands:c,selectedIndex:d,setSelectedIndex:u,isLoading:N,handleCommandSelect:t}},{useToken:X}=M,P={workflow:{color:"blue",icon:a.jsx(F,{}),labelKey:"chat.commandSelector.types.workflow"},skill:{color:"green",icon:a.jsx(K,{}),labelKey:"chat.commandSelector.types.skill"},mcp:{color:"purple",icon:a.jsx(D,{}),labelKey:"chat.commandSelector.types.mcp"}},Q=({visible:p,onSelect:k,onCancel:j,searchText:f,onAutoComplete:g})=>{const{token:o}=X(),{t:i}=E(),{containerRef:c,selectedItemRef:R,filteredCommands:d,selectedIndex:u,setSelectedIndex:N,isLoading:I,handleCommandSelect:S}=z({visible:p,searchText:f,onSelect:k,onCancel:j,onAutoComplete:g});if(!p)return null;if(I)return a.jsxs("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary,padding:`${o.paddingSM}px ${o.paddingMD}px`,zIndex:1e3,marginBottom:o.marginXS,textAlign:"center"},children:[a.jsx(T,{size:"small"})," ",i("chat.commandSelector.loading")]});if(d.length===0)return a.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,right:0,background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary,padding:`${o.paddingSM}px ${o.paddingMD}px`,zIndex:1e3,marginBottom:o.marginXS,textAlign:"center",color:o.colorTextSecondary},children:f?i("chat.commandSelector.emptyWithSearch",{search:f}):i("chat.commandSelector.empty")});const h=(t,s)=>{var b,C,w;const e=P[t.type],r=s===u,n=t.type==="mcp"?B(t.name):null,x=t.type==="mcp"?((b=t.metadata)==null?void 0:b.originalName)||(n==null?void 0:n.toolName)||t.displayName||t.name:null,y=t.type==="mcp"&&(((C=t.metadata)==null?void 0:C.serverName)||((w=t.metadata)==null?void 0:w.serverId)||(n==null?void 0:n.serverId))||null;return a.jsxs("div",{ref:r?R:null,className:`command-selector-item ${r?"selected":""}`,onClick:()=>S(t),onMouseEnter:()=>N(s),children:[a.jsxs("div",{className:"command-selector-item-header",children:[a.jsxs("div",{className:"command-selector-item-name",style:{color:o.colorPrimary},children:["/",t.type==="mcp"&&x?x:t.name]}),a.jsxs("div",{style:{display:"flex",gap:o.marginXS},children:[t.type==="mcp"&&y&&a.jsx(L,{color:"processing",children:y}),a.jsxs(L,{color:e.color,children:[e.icon," ",i(e.labelKey)]})]})]}),a.jsx("div",{className:"command-selector-item-description",style:{color:o.colorTextSecondary},children:t.description}),t.type==="mcp"&&y&&a.jsxs("div",{className:"command-selector-item-category",style:{color:o.colorTextTertiary},children:[i("common.server")," ",y]}),t.category&&a.jsxs("div",{className:"command-selector-item-category",style:{color:o.colorTextTertiary},children:[i("common.category")," ",t.category]}),t.tags&&t.tags.length>0&&a.jsx("div",{className:"command-selector-item-tags",children:t.tags.slice(0,3).map(m=>a.jsx(L,{children:m},m))})]},t.id)};return a.jsxs("div",{ref:c,className:"command-selector-container",style:{background:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`,borderRadius:o.borderRadiusSM,boxShadow:o.boxShadowSecondary},children:[a.jsx("div",{style:{padding:`${o.paddingXXS}px ${o.paddingSM}px`,borderBottom:`1px solid ${o.colorBorderSecondary}`,background:o.colorFillQuaternary,fontSize:o.fontSizeSM,color:o.colorTextTertiary},children:i("chat.commandSelector.navigationHint")}),d.map((t,s)=>h(t,s))]})};export{Q as default};
@@ -0,0 +1 @@
1
+ import{j as s}from"./vendor-markdown-DzaXAW9Q.js";import{u as g,a as u}from"./vendor-i18n-BNURlJ23.js";import{u as d,e as j}from"./App-DaOPoP5b.js";import{a7 as h,k as i,l as m,H as y,a8 as b,a9 as B,t as _}from"./vendor-antd-DODjfilb.js";import"./vendor-mermaid-De-Yacw-.js";import"./main-CuvqMgTQ.js";const{useToken:P}=_,k=n=>{const o=n.replace(/\/$/,"").split("/").filter(Boolean);return o.length<=2?n:`~/${o.slice(-2).join("/")}`},E=({sessionId:n})=>{const{t:o}=g(),{token:f}=P(),e=d(j(n)),p=d(t=>t.systemPrompts),r=e==null?void 0:e.config.workspacePath,a=e==null?void 0:e.config.systemPromptId,l=u.useMemo(()=>{if(!a)return null;const t=p.find(x=>x.id===a);return(t==null?void 0:t.name)||a},[a,p]),c=u.useMemo(()=>e!=null&&e.messages?e.messages.filter(t=>t.role==="user"&&"type"in t&&t.type==="file_reference").length:0,[e==null?void 0:e.messages]);return!e||!(r||l||c>0)?null:s.jsx("div",{className:"lotus-context-bar",style:{borderBottomColor:f.colorBorderSecondary,backgroundColor:f.colorBgContainer},children:s.jsxs(h,{align:"center",gap:6,wrap:"wrap",className:"lotus-context-bar__content",children:[r&&s.jsx(i,{title:r,children:s.jsx(m,{className:"lotus-context-bar__tag",icon:s.jsx(y,{}),bordered:!1,children:k(r)})}),c>0&&s.jsx(i,{title:o("chat.contextBar.fileRefsTooltip",{count:c,defaultValue:"{{count}} file reference(s) in this session"}),children:s.jsxs(m,{className:"lotus-context-bar__tag",icon:s.jsx(b,{}),bordered:!1,children:[c," ",o("chat.contextBar.files","files")]})}),l&&s.jsx(i,{title:o("chat.contextBar.promptTooltip",{name:l,defaultValue:"System prompt: {{name}}"}),children:s.jsx(m,{className:"lotus-context-bar__tag",icon:s.jsx(B,{}),bordered:!1,children:l})})]})})};export{E as ContextBar,E as default};
@@ -0,0 +1 @@
1
+ .lotus-session-summary{border:1px solid var(--lotus-summary-border, rgba(0, 0, 0, .06));border-radius:12px;padding:14px 16px;background:var(--lotus-summary-bg, rgba(0, 0, 0, .02));overflow:hidden;transition:border-color .2s ease}.lotus-session-summary:hover{border-color:var(--lotus-summary-hover-border, rgba(0, 0, 0, .12))}.lotus-session-summary-header{display:flex;align-items:center;gap:10px;cursor:pointer;-webkit-user-select:none;user-select:none}.lotus-session-summary-header-icon{font-size:16px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.lotus-session-summary-header-title{flex:1;min-width:0;font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.lotus-session-summary-toggle{font-size:12px;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:transform .2s ease}.lotus-session-summary-toggle.is-expanded{transform:rotate(180deg)}.lotus-session-summary-body{margin-top:12px;display:flex;flex-direction:column;gap:10px;animation:lotus-summary-fade-in .2s ease}@keyframes lotus-summary-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.lotus-session-summary-stats{display:flex;flex-wrap:wrap;gap:12px}.lotus-session-summary-stat{display:flex;align-items:center;gap:6px;font-size:12px;white-space:nowrap}.lotus-session-summary-stat-icon{font-size:13px;display:flex;align-items:center}.lotus-session-summary-stat-value{font-weight:600}.lotus-session-summary-files{display:flex;flex-wrap:wrap;gap:4px}.lotus-session-summary-file-tag{font-size:11px;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lotus-session-summary-conclusion{font-size:12px;line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}
@@ -0,0 +1 @@
1
+ import{j as t,M as D,r as E,h as F}from"./vendor-markdown-DzaXAW9Q.js";import{u as I,a as p}from"./vendor-i18n-BNURlJ23.js";import{S as y,E as v,C as H,j as T,L as X,ae as A,l as j,ag as O,ah as Y,ai as q,aj as K,V,G as J,m as N,t as Q}from"./vendor-antd-DODjfilb.js";import{q as U,u as z,t as W}from"./App-DaOPoP5b.js";import"./vendor-mermaid-De-Yacw-.js";import"./main-CuvqMgTQ.js";const Z=({buttons:r,className:e,style:m,size:l="middle",align:i="right"})=>{const h={className:e,style:{width:"100%",justifyContent:i==="left"?"flex-start":i==="center"?"center":"flex-end",...m}};return t.jsx(y,{...h,children:r.map(a=>t.jsx(v,{type:a.type||"default",disabled:a.disabled,loading:a.loading,danger:a.danger,onClick:a.onClick,size:l,icon:a.icon,children:a.text},a.key))})},_=(r,e)=>({key:"cancel",text:e||"Cancel",type:"default",onClick:r}),k=(r,e)=>({key:"ok",text:(e==null?void 0:e.text)||"OK",type:"primary",disabled:e==null?void 0:e.disabled,loading:e==null?void 0:e.loading,onClick:r}),{Text:b,Paragraph:ee}=T,te=({content:r,token:e,showGradient:m,onClick:l})=>t.jsx(H,{size:"small",style:{marginLeft:e.marginLG,marginTop:e.marginXS,backgroundColor:e.colorBgLayout,borderColor:e.colorBorderSecondary},styles:{body:{padding:e.paddingMD}},onClick:l,children:t.jsxs("div",{style:{maxHeight:"60vh",overflowY:"auto",position:"relative",paddingRight:e.paddingXS},children:[t.jsx(D,{remarkPlugins:[E],components:{p:({children:i})=>t.jsx(ee,{style:{marginBottom:e.marginSM},children:i}),ol:({children:i})=>t.jsx("ol",{style:{marginBottom:e.marginSM,paddingLeft:e.paddingLG},children:i}),ul:({children:i})=>t.jsx("ul",{style:{marginBottom:e.marginSM,paddingLeft:e.paddingLG},children:i}),li:({children:i})=>t.jsx("li",{style:{marginBottom:e.marginXS},children:i}),h1:({children:i})=>t.jsx(b,{strong:!0,style:{fontSize:e.fontSizeHeading3,marginBottom:e.marginSM,display:"block"},children:i}),h2:({children:i})=>t.jsx(b,{strong:!0,style:{fontSize:e.fontSizeHeading4,marginBottom:e.marginSM,display:"block"},children:i}),code:({inline:i,className:h,children:a,...n})=>{const o=/language-(\w+)/.exec(h||"");return i?t.jsx("code",{className:h,style:{backgroundColor:e.colorFillTertiary,padding:"0 4px",borderRadius:e.borderRadiusSM,fontSize:e.fontSizeSM},...n,children:a}):t.jsx(F,{style:U,language:(o==null?void 0:o[1])||"text",PreTag:"div",wrapLongLines:!0,children:String(a).replace(/\n$/,"")})}},children:r||"No content available."}),m?t.jsx("div",{style:{position:"sticky",bottom:0,height:48,background:`linear-gradient(180deg, transparent, ${e.colorBgLayout})`,pointerEvents:"none",marginTop:-48}}):null]})}),{Text:M,Paragraph:re}=T,se=({prompt:r,token:e,isSelected:m,isExpanded:l,onSelect:i,onToggleExpand:h,onCopy:a})=>{const{t:n}=I(),o=r.content||"",{nonEmptyLineCount:f,wordCount:u,characterCount:P,showGradient:x}=p.useMemo(()=>{const S=(o?o.split(/\r?\n/):[]).filter(w=>w.trim().length>0).length,C=o.trim()?o.trim().split(/\s+/).filter(Boolean).length:0,g=o.length;return{nonEmptyLineCount:S,wordCount:C,characterCount:g,showGradient:!l&&g>600}},[o,l]);return t.jsx(X.Item,{style:{cursor:"pointer",padding:e.paddingMD,borderRadius:e.borderRadius,border:m?`2px solid ${e.colorPrimary}`:`1px solid ${e.colorBorderSecondary}`,marginBottom:e.marginXS,backgroundColor:m?e.colorPrimaryBg:e.colorBgContainer,transition:"all 0.2s ease"},onClick:()=>i(r.id),children:t.jsxs(y,{direction:"vertical",style:{width:"100%"},size:e.marginSM,children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",width:"100%",gap:e.marginSM},children:[t.jsxs(y,{align:"start",children:[t.jsx(A,{checked:m,onChange:()=>i(r.id),onClick:c=>c.stopPropagation()}),t.jsxs("div",{children:[t.jsx(M,{strong:!0,children:r.name||r.id}),t.jsx("div",{children:t.jsx(M,{code:!0,style:{fontSize:e.fontSizeSM,color:e.colorTextSecondary},children:r.id})})]}),r.isDefault?t.jsx(j,{color:"warning",children:n("chat.systemPromptSelector.defaultTag")}):null]}),t.jsxs(y,{size:"small",children:[t.jsx(v,{type:"text",size:"small",icon:l?t.jsx(O,{}):t.jsx(Y,{}),onClick:c=>{c.stopPropagation(),h(r.id)},children:n(l?"chat.systemPromptSelector.hide":"chat.systemPromptSelector.preview")}),t.jsx(v,{type:"text",size:"small",icon:t.jsx(q,{}),onClick:c=>a(c,r),children:n("chat.systemPromptSelector.copy")})]})]}),r.description?t.jsx(M,{type:"secondary",style:{marginLeft:e.marginLG,fontSize:e.fontSizeSM},children:r.description}):null,t.jsxs(y,{size:"small",wrap:!0,style:{marginLeft:e.marginLG},children:[t.jsx(j,{color:"processing",children:n("chat.systemPromptSelector.lines",{count:f})}),t.jsx(j,{color:"purple",children:n("chat.systemPromptSelector.words",{count:u})}),t.jsx(j,{color:"success",children:n("chat.systemPromptSelector.chars",{count:P})})]}),l?t.jsx(te,{content:o,token:e,showGradient:x,onClick:c=>c.stopPropagation()}):t.jsx(re,{type:"secondary",ellipsis:{rows:3},style:{marginLeft:e.marginLG,marginBottom:0,color:e.colorTextSecondary},children:o||n("chat.systemPromptSelector.noContent")})]})},r.id)},{Text:ie}=T,{useToken:ae}=Q,me=({open:r,onClose:e,onSelect:m,prompts:l,title:i,showCancelButton:h=!0})=>{const{t:a}=I(),{token:n}=ae(),[o,f]=K.useMessage(),u=z(s=>s.lastSelectedPromptId),P=z(s=>s.setLastSelectedPromptId),[x,c]=p.useState(null),[S,C]=p.useState(null),g=p.useMemo(()=>l.filter(s=>s.id&&s.id.trim()!==""),[l]),w=async(s,d)=>{s.stopPropagation();const L=d.content??"";try{await W(L),o.success(a("success.promptCopied",{name:d.name}))}catch($){console.error("[SystemPromptSelector] Failed to copy prompt:",$),o.error(a("error.copyPromptFailed"))}},G=i??a("chat.prompt.selectorTitle");p.useEffect(()=>{if(r){const s=g.find(L=>L.isDefault),d=u||(s==null?void 0:s.id)||(g.length>0?g[0].id:null);c(d)}},[r,u,g.length]);const R=s=>{c(s.id),P(s.id),m(s),e()},B=()=>{e()};return t.jsxs(t.Fragment,{children:[f,t.jsxs(V,{title:t.jsxs(y,{children:[t.jsx(N,{}),G]}),open:r,onCancel:B,width:700,footer:t.jsx(Z,{buttons:[...h?[_(B)]:[],k(()=>{const s=g.find(d=>d.id===x);s&&R(s)},{text:a("chat.prompt.createButton"),disabled:!x})]}),styles:{body:{maxHeight:"70vh",overflowY:"auto",padding:n.paddingMD}},children:[t.jsx("div",{style:{marginBottom:n.marginMD},children:t.jsx(ie,{type:"secondary",style:{fontSize:n.fontSizeSM},children:a("chat.prompt.helperText")})}),g.length===0?t.jsx(J,{description:a("chat.prompt.emptyDescription"),style:{margin:n.marginLG}}):t.jsx("div",{children:g.map(s=>t.jsx(se,{prompt:s,token:n,isSelected:x===s.id,isExpanded:S===s.id,onSelect:d=>c(d),onToggleExpand:d=>C(S===d?null:d),onCopy:w},s.id))})]})]})};export{me as default};
@@ -0,0 +1 @@
1
+ var ee=Object.defineProperty;var te=(i,t,s)=>t in i?ee(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var z=(i,t,s)=>te(i,typeof t!="symbol"?t+"":t,s);import{j as e}from"./vendor-markdown-DzaXAW9Q.js";import{u as V,a as o,i as J}from"./vendor-i18n-BNURlJ23.js";import{y as D,v as se}from"./App-DaOPoP5b.js";import{K as Z,t as Y,j as B,V as G,S as j,E as P,an as N,ao as ae,ap as re,aq as K,C as ie,J as O,G as M,L as W,H as C,a7 as _,ar as Q,as as ne,o as ce,y as oe,A as L,W as le,at as de}from"./vendor-antd-DODjfilb.js";import"./main-CuvqMgTQ.js";import"./vendor-mermaid-De-Yacw-.js";const he=({visible:i,onClose:t,onSelect:s})=>{const{t:n}=V(),{message:r}=Z.useApp(),{token:a}=Y.useToken(),{Text:c}=B,[p,w]=o.useState(!1),[l,x]=o.useState(""),[u,I]=o.useState(),[S,k]=o.useState([]),[v,y]=o.useState([]);o.useEffect(()=>{i&&m()},[i]);const m=async d=>{w(!0);try{const g=await D.browseFolder(d);x(g.current_path),I(g.parent_path),k(g.folders)}catch(g){console.error("Failed to load directory:",g),r.error("Unable to read folder")}finally{w(!1)}},f=d=>{y([...v,l]),m(d.path)},E=()=>{u&&(y(v.slice(0,-1)),m(u))},T=()=>{y([]),m()},b=()=>{s(l),t()},R=()=>{if(!l)return[];const d=l.split(/[/\\]/).filter(Boolean);return l.startsWith("/")&&d.unshift("/"),d},A=d=>{const F=R().slice(0,d+1).join("/"),$=(l.startsWith("/"),F);m($)};return e.jsx(G,{title:n("chat.folderBrowser.title"),open:i,onCancel:t,width:700,footer:null,children:e.jsxs(j,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsxs(j,{children:[e.jsx(P,{icon:e.jsx(N,{}),onClick:T,size:"small",children:n("common.home")}),e.jsx(P,{icon:e.jsx(ae,{}),onClick:E,disabled:!u,size:"small",children:n("common.parentDirectory")}),e.jsx(P,{type:"primary",icon:e.jsx(re,{}),onClick:b,size:"small",children:n("chat.folderBrowser.selectCurrent")})]}),e.jsx(K,{children:R().map((d,g)=>e.jsx(K.Item,{children:e.jsx(P,{type:"link",size:"small",onClick:()=>A(g),style:{padding:0},children:d==="/"?e.jsx(N,{}):d})},g))}),e.jsxs(ie,{size:"small",styles:{body:{padding:a.paddingXS}},children:[e.jsx(c,{type:"secondary",style:{fontSize:12},children:n("common.currentPath")})," ",e.jsx(c,{code:!0,children:l})]}),e.jsx(O,{spinning:p,children:S.length===0&&!p?e.jsx(M,{image:M.PRESENTED_IMAGE_SIMPLE,description:e.jsx(c,{type:"secondary",children:n("chat.folderBrowser.emptyFolder")})}):e.jsx(W,{dataSource:S,style:{maxHeight:400,overflowY:"auto"},renderItem:d=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(P,{type:"text",icon:e.jsx(C,{}),onClick:()=>f(d),style:{width:"100%",textAlign:"left",padding:`${a.paddingXS}px ${a.paddingSM}px`},children:d.name})})})}),e.jsx(c,{type:"secondary",style:{fontSize:12},children:n("chat.folderBrowser.tip")})]})})};class pe{constructor(t={}){z(this,"cache",new Map);z(this,"pendingValidations",new Map);z(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:J.t("chat.workspace.errorEnterPath")};const s=t.trim(),n=this.getCachedResult(s);if(n)return n;const r=this.pendingValidations.get(s);if(r)return r;const a=this.performValidation(s);this.pendingValidations.set(s,a);try{const c=await a;return this.setCachedResult(s,c),c}finally{this.pendingValidations.delete(s)}}validateWorkspaceDebounced(t,s){let n;return n=setTimeout(async()=>{try{const a=await this.validateWorkspace(t);s(a)}catch(a){const c={path:t,is_valid:!1,error_message:a instanceof Error?a.message:J.t("chat.workspace.checkDescription")};s(c)}},this.options.debounceMs),()=>{clearTimeout(n)}}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 se.post("workspace/validate",{path:t})}catch(n){if(s<this.options.maxRetries&&this.isRetryableError(n))return await this.delay(Math.pow(2,s)*1e3),this.performValidation(t,s+1);throw n}}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 n=[];for(let r=0;r<t.length;r+=5){const a=t.slice(r,r+5),c=await Promise.all(a.map(p=>this.validateWorkspace(p)));n.push(...c),r+5<t.length&&await this.delay(100)}return n}}const ue=new pe,ge=({value:i="",onChange:t,showRecentWorkspaces:s,showSuggestions:n,onValidationChange:r})=>{const{message:a}=Z.useApp(),[c,p]=o.useState(i),[w,l]=o.useState({isValidating:!1,result:null}),[x,u]=o.useState([]),[I,S]=o.useState(!1),[k,v]=o.useState([]),[y,m]=o.useState(!1),[f,E]=o.useState(!1),T=o.useRef(null),b=o.useRef(null);o.useEffect(()=>{p(i)},[i]),o.useEffect(()=>(s&&R(),n&&A(),()=>{T.current&&T.current.abort(),b.current&&b.current()}),[s,n]);const R=o.useCallback(async()=>{m(!0);try{const h=await D.getRecentWorkspaces();u(h.slice(0,5))}catch(h){console.error("Failed to load recent workspaces:",h),u([])}finally{m(!1)}},[]),A=o.useCallback(async()=>{E(!0);try{const h=await D.getPathSuggestions();v(h.suggestions.slice(0,8))}catch(h){console.error("Failed to load suggestions:",h),v([])}finally{E(!1)}},[]),d=o.useCallback(h=>{p(h),t&&t(h),T.current&&T.current.abort(),b.current&&b.current(),h.trim()?(l({isValidating:!0,result:null}),b.current=ue.validateWorkspaceDebounced(h.trim(),q=>{l({isValidating:!1,result:q}),r&&r(q)})):(l({isValidating:!1,result:null}),r&&r(null))},[t,r]),g=o.useCallback(()=>{S(!0)},[]),F=o.useCallback(h=>{d(h),a.success("Folder selected successfully")},[d]),$=o.useCallback(h=>{d(h)},[d]);return{path:c,validationStatus:w,recentWorkspaces:x,suggestions:k,isLoadingRecent:y,isLoadingSuggestions:f,folderBrowserVisible:I,setFolderBrowserVisible:S,handlePathChange:d,handleBrowseClick:g,handleFolderSelect:F,handleWorkspaceSelect:$}},{Text:H}=B,me=({show:i,isLoading:t,recentWorkspaces:s,onSelect:n,token:r})=>{const{t:a}=V();return i?e.jsxs(_,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(j,{style:{paddingInline:r.paddingSM},children:[e.jsx(Q,{}),e.jsx(H,{strong:!0,children:a("chat.workspace.recentTitle")})]}),t?e.jsx(_,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(O,{size:"small"})}):s.length===0?e.jsx(M,{description:a("chat.workspace.noRecentWorkspaces"),image:M.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(W,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:c=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(P,{type:"text",onClick:()=>n(c.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(_,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(j,{children:[e.jsx(C,{style:{color:r.colorWarning}}),e.jsx(H,{strong:!0,children:c.workspace_name||c.path.split("/").pop()||a("chat.workspace.defaultWorkspaceName")})]}),e.jsx(H,{type:"secondary",ellipsis:{tooltip:c.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:c.path})]})})})})]}):null},{Text:X}=B,xe=(i,t)=>{switch(i.suggestion_type){case"home":return e.jsx(N,{style:{color:t.colorPrimary}});case"documents":case"desktop":case"downloads":return e.jsx(C,{style:{color:t.colorSuccess}});case"recent":return e.jsx(Q,{style:{color:t.colorWarning}});default:return e.jsx(C,{})}},fe=({show:i,isLoading:t,suggestions:s,onSelect:n,token:r})=>{const{t:a}=V();return i?e.jsxs(_,{vertical:!0,gap:r.marginXS,style:{marginTop:r.marginMD},children:[e.jsxs(j,{style:{paddingInline:r.paddingSM},children:[e.jsx(C,{}),e.jsx(X,{strong:!0,children:a("chat.workspace.suggestedTitle")})]}),t?e.jsx(_,{justify:"center",style:{padding:r.paddingSM},children:e.jsx(O,{size:"small"})}):s.length===0?e.jsx(M,{description:a("chat.workspace.noSuggestions"),image:M.PRESENTED_IMAGE_SIMPLE,style:{padding:r.paddingSM}}):e.jsx(W,{size:"small",dataSource:s,style:{paddingInline:r.paddingSM},renderItem:c=>e.jsx(W.Item,{style:{padding:0},children:e.jsx(P,{type:"text",onClick:()=>n(c.path),style:{width:"100%",textAlign:"left",padding:`${r.paddingXS}px 0`,height:"auto"},children:e.jsxs(_,{justify:"space-between",align:"center",style:{width:"100%"},children:[e.jsxs(j,{children:[xe(c,r),e.jsx(X,{strong:!0,children:c.name})]}),e.jsx(X,{type:"secondary",ellipsis:{tooltip:c.path},style:{fontSize:12,maxWidth:"55%",textAlign:"right"},children:c.path})]})})})})]}):null},ye=({isValidating:i,result:t,token:s})=>i?e.jsx(ne,{style:{color:s.colorPrimary}}):t?t.is_valid?e.jsx(ce,{style:{color:s.colorSuccess}}):e.jsx(oe,{style:{color:s.colorError}}):null,{Text:U}=B,je=({result:i,token:t})=>{const{t:s}=V();return i?e.jsx("div",{style:{marginTop:t.marginXS},children:i.is_valid?e.jsx(L,{type:"success",message:e.jsxs(j,{children:[e.jsx("span",{children:s("chat.workspace.validWorkspace")}),i.workspace_name&&e.jsxs(U,{type:"secondary",children:["(",i.workspace_name,")"]}),i.file_count!==void 0&&e.jsx(U,{type:"secondary",children:s("chat.workspace.fileCount",{count:i.file_count})})]}),showIcon:!0}):e.jsx(L,{type:"error",message:i.error_message||s("validation.invalidPath"),showIcon:!0})}):null},{Text:we}=B,Se=({value:i="",onChange:t,placeholder:s,disabled:n=!1,allowBrowse:r=!0,showRecentWorkspaces:a=!0,showSuggestions:c=!0,onValidationChange:p,className:w,style:l})=>{const{t:x}=V(),{token:u}=Y.useToken(),I=s??x("chat.workspace.placeholder"),{path:S,validationStatus:k,recentWorkspaces:v,suggestions:y,isLoadingRecent:m,isLoadingSuggestions:f,folderBrowserVisible:E,setFolderBrowserVisible:T,handlePathChange:b,handleBrowseClick:R,handleFolderSelect:A,handleWorkspaceSelect:d}=ge({value:i,onChange:t,showRecentWorkspaces:a,showSuggestions:c,onValidationChange:p});return e.jsxs("div",{className:w,style:l,children:[e.jsx(le,{value:S,onChange:g=>b(g.target.value),placeholder:I,disabled:n,size:"middle",style:{width:"100%"},suffix:e.jsx(ye,{isValidating:k.isValidating,result:k.result,token:u}),addonBefore:e.jsxs(j,{children:[e.jsx(C,{}),e.jsx(we,{children:x("chat.workspace.label")})]}),addonAfter:r?e.jsx(P,{"aria-label":x("chat.workspace.browseFolder"),title:x("chat.workspace.browseFolder"),icon:e.jsx(C,{}),onClick:R,disabled:n,type:"text",size:"middle",style:{display:"inline-flex",alignItems:"center"}}):void 0}),e.jsx(je,{result:k.result,token:u}),(a||c)&&e.jsxs(e.Fragment,{children:[e.jsx(de,{style:{margin:"16px 0 12px 0"}}),e.jsx(me,{show:a,isLoading:m,recentWorkspaces:v,onSelect:d,token:u}),e.jsx(fe,{show:c,isLoading:f,suggestions:y,onSelect:d,token:u})]}),e.jsx(he,{visible:E,onClose:()=>T(!1),onSelect:A})]})},{Title:ke}=B,Re=({open:i,initialPath:t="",loading:s=!1,onSubmit:n,onCancel:r})=>{const{t:a}=V(),{message:c}=Z.useApp(),[p,w]=o.useState(t),[l,x]=o.useState(null),[u,I]=o.useState(!1);o.useEffect(()=>{i&&(w(t),x(null))},[i,t]);const S=f=>{w(f)},k=f=>{x(f)},v=async()=>{if(!p.trim()){c.error(a("chat.workspace.errorEnterPath"));return}l&&!l.is_valid?G.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:()=>y()}):y()},y=async()=>{I(!0);try{l!=null&&l.is_valid&&await D.addRecentWorkspace(p.trim(),{workspace_name:l.workspace_name}),n(p.trim())}catch(f){console.error("Failed to save workspace path:",f),c.error(a("chat.workspace.errorSaveFailed"))}finally{I(!1)}},m=!p.trim()||s||u;return e.jsx(G,{open:i,title:e.jsx(j,{children:e.jsx(ke,{level:4,style:{margin:0},children:a("chat.workspace.modalTitle")})}),okText:a("common.save"),cancelText:a("common.cancel"),onOk:v,onCancel:r,okButtonProps:{disabled:m,loading:u||s},width:600,destroyOnClose:!0,children:e.jsxs(j,{direction:"vertical",size:"middle",style:{width:"100%"},children:[e.jsx(L,{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(Se,{value:p,onChange:S,onValidationChange:k,placeholder:a("chat.workspace.placeholder"),disabled:u,allowBrowse:!0,showRecentWorkspaces:!0,showSuggestions:!0}),l&&!l.is_valid&&e.jsx(L,{message:a("chat.workspace.checkTitle"),description:l.error_message||a("chat.workspace.checkDescription"),type:"warning",showIcon:!0})]})})};export{Re as default};
@@ -0,0 +1 @@
1
+ .lotus-context-bar{display:flex;align-items:center;min-height:36px;padding:4px 16px;border-bottom:1px solid transparent;flex-shrink:0}.lotus-context-bar__content{width:100%;overflow-x:auto;-ms-overflow-style:none;scrollbar-width:none}.lotus-context-bar__content::-webkit-scrollbar{display:none}.lotus-context-bar__tag{font-size:12px;cursor:default;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media (max-width: 768px){.lotus-context-bar{padding:4px 8px}.lotus-context-bar__tag{max-width:140px}}
@@ -0,0 +1 @@
1
+ import{j as s}from"./vendor-markdown-DzaXAW9Q.js";import{u as y,a as c}from"./vendor-i18n-BNURlJ23.js";import{u as x,s as j,E as N}from"./App-DaOPoP5b.js";import{t as T,a5 as v,a6 as R,q as S,z as w,H as k,a2 as I,l as b,u as A}from"./vendor-antd-DODjfilb.js";import"./vendor-mermaid-De-Yacw-.js";import"./main-CuvqMgTQ.js";const M=5,$=5,C=5,D=o=>{if(!o)return"";try{const l=Date.now()-new Date(o).getTime();if(l<0)return"";const t=Math.floor(l/1e3);if(t<60)return"just now";const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const r=Math.floor(i/24);return r<30?`${r}d ago`:new Date(o).toLocaleDateString()}catch{return""}},E=(o,l)=>l?"is-running":o.lastRunStatus==="error"?"is-error":o.pinned?"is-pinned":"is-idle",h=({chat:o,onOpen:l,textSecondary:t})=>{const n=x(j(o.id)),i=o.config.workspacePath?o.config.workspacePath.split("/").pop()||o.config.workspacePath:null;return s.jsxs("button",{type:"button",className:"lotus-home-session-item",onClick:()=>l(o.id),children:[s.jsx("span",{className:`lotus-home-session-status ${E(o,n)}`}),s.jsxs("span",{className:"lotus-home-session-content",children:[s.jsx("span",{className:"lotus-home-session-title",children:o.title}),s.jsxs("span",{className:"lotus-home-session-meta",style:{color:t},children:[s.jsx("span",{children:D(o.updatedAt)}),i?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lotus-home-session-meta-sep"}),s.jsxs("span",{children:[s.jsx(k,{style:{marginRight:3}}),i]})]}):null,o.messageCount!=null?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"lotus-home-session-meta-sep"}),s.jsxs("span",{children:[s.jsx(I,{style:{marginRight:3}}),o.messageCount]})]}):null]})]}),n?s.jsx(b,{color:"green",bordered:!1,style:{margin:0,fontSize:11},children:"Running"}):null,s.jsx(A,{className:"lotus-home-session-arrow"})]})},F=({onOpenSession:o})=>{const{t:l}=y(),{token:t}=T.useToken(),n=x(e=>e.chats),i=c.useCallback(e=>j(e)(x.getState()),[]),r=c.useMemo(()=>n.filter(e=>i(e.id)).slice(0,$),[n,i]),d=c.useMemo(()=>n.filter(e=>e.pinned&&!i(e.id)).slice(0,C),[n,i]),p=c.useMemo(()=>{const e=new Set(r.map(a=>a.id)),f=new Set(d.map(a=>a.id));return n.filter(a=>a.kind!=="child"&&!e.has(a.id)&&!f.has(a.id)).sort((a,u)=>{const g=a.updatedAt?new Date(a.updatedAt).getTime():a.createdAt;return(u.updatedAt?new Date(u.updatedAt).getTime():u.createdAt)-g}).slice(0,M)},[n,r,d]),m=c.useCallback(e=>{o(e)},[o]);return s.jsx("div",{className:"lotus-home-dashboard",children:s.jsxs("div",{className:"lotus-home-dashboard-inner",children:[s.jsxs("div",{className:"lotus-home-header",children:[s.jsx("span",{className:"lotus-home-header-icon",style:{background:`${t.colorPrimary}15`,color:t.colorPrimary},children:s.jsx(v,{})}),s.jsxs("div",{className:"lotus-home-header-text",children:[s.jsx("h2",{style:{color:t.colorText},children:l("home.title","Welcome to Bodhi")}),s.jsx("p",{style:{color:t.colorTextSecondary},children:l("home.subtitle","Here's an overview of your workspace.")})]})]}),s.jsx("div",{className:"lotus-home-launcher-shell","data-tour-id":"task-templates",children:s.jsx(N,{embedded:!0,layoutMode:"staggered"})}),s.jsxs("div",{className:"lotus-home-secondary-sections",children:[r.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(R,{className:"lotus-home-section-icon",style:{color:"#52c41a"}}),s.jsx("span",{children:l("home.sections.running","Running Now")})]}),s.jsx("div",{className:"lotus-home-session-list",children:r.map(e=>s.jsx(h,{chat:e,onOpen:m,textSecondary:t.colorTextTertiary},e.id))})]}):null,d.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(S,{className:"lotus-home-section-icon",style:{color:"#faad14"}}),s.jsx("span",{children:l("home.sections.pinned","Pinned")})]}),s.jsx("div",{className:"lotus-home-session-list",children:d.map(e=>s.jsx(h,{chat:e,onOpen:m,textSecondary:t.colorTextTertiary},e.id))})]}):null,p.length>0?s.jsxs("div",{className:"lotus-home-section",children:[s.jsxs("div",{className:"lotus-home-section-title",style:{color:t.colorTextSecondary},children:[s.jsx(w,{className:"lotus-home-section-icon"}),s.jsx("span",{children:l("home.sections.recent","Recent Sessions")})]}),s.jsx("div",{className:"lotus-home-session-list",children:p.map(e=>s.jsx(h,{chat:e,onOpen:m,textSecondary:t.colorTextTertiary},e.id))})]}):null,n.length===0?s.jsx("div",{className:"lotus-home-empty-hint",style:{color:t.colorTextTertiary},children:l("home.empty","No sessions yet. Create one to get started!")}):null]})]})})};export{F as HomeDashboard,F as default};