agentstudio 0.3.0 → 0.3.2

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 (122) hide show
  1. package/bin/agentstudio.js +101 -1
  2. package/bin/agentstudio.js.map +1 -1
  3. package/config/sdkConfig.d.ts +62 -0
  4. package/config/sdkConfig.d.ts.map +1 -0
  5. package/config/sdkConfig.js +157 -0
  6. package/config/sdkConfig.js.map +1 -0
  7. package/index.d.ts.map +1 -1
  8. package/index.js +3 -0
  9. package/index.js.map +1 -1
  10. package/package.json +1 -1
  11. package/public/assets/{AgentsPage-Cl2yOPj5.js → AgentsPage-ChTeSZQM.js} +1 -1
  12. package/public/assets/{Button-DPVn3zDJ.js → Button-Bd_ElvlE.js} +1 -1
  13. package/public/assets/{ChatPage-BAslLt2l.js → ChatPage-4A05aP3x.js} +4 -4
  14. package/public/assets/{CommandsPage-DakxsAcv.js → CommandsPage-BMqBL5Ss.js} +1 -1
  15. package/public/assets/{DashboardPage-Dz5tihOs.js → DashboardPage-C13k8VA6.js} +1 -1
  16. package/public/assets/{FileBrowser-BXtVLz8h.js → FileBrowser-BbQchc_7.js} +1 -1
  17. package/public/assets/GeneralSettingsPage-D1tdeoEo.js +1 -0
  18. package/public/assets/{LandingPage-BDKkpXK0.js → LandingPage-B4lDvIdq.js} +1 -1
  19. package/public/assets/{LoginPage-1PbdWrXW.js → LoginPage-BZckHH8M.js} +1 -1
  20. package/public/assets/{McpAdminSettingsPage-BlTO82W3.js → McpAdminSettingsPage-KVRY0MqF.js} +1 -1
  21. package/public/assets/{McpPage-Bix7CnMS.js → McpPage-DztfuUC4.js} +1 -1
  22. package/public/assets/{MemorySettingsPage-Dzq3vCns.js → MemorySettingsPage-Cn-HSyWt.js} +1 -1
  23. package/public/assets/{PluginsPage-oYSGDv3z.js → PluginsPage-BGWVTQOf.js} +1 -1
  24. package/public/assets/{ProjectSelector-Bp1q7dra.js → ProjectSelector-GmS-1-C-.js} +1 -1
  25. package/public/assets/{ProjectsPage-BKpI8KE2.js → ProjectsPage-v58WHxJc.js} +5 -5
  26. package/public/assets/{ScheduledTasksPage-D2rYw_Qf.js → ScheduledTasksPage-DKG8bjzx.js} +1 -1
  27. package/public/assets/{SettingsLayout-CfmsuehF.js → SettingsLayout-_m4X7JF9.js} +1 -1
  28. package/public/assets/{SkillsPage-D01PYcoW.js → SkillsPage-CZAxG8SU.js} +1 -1
  29. package/public/assets/{SubagentsPage-CDaYnbfn.js → SubagentsPage-DW0COnVY.js} +1 -1
  30. package/public/assets/{SystemInfoPage-DAeYkq91.js → SystemInfoPage-ogvHiOrs.js} +1 -1
  31. package/public/assets/{TelemetrySettingsPage-BPuPqJPR.js → TelemetrySettingsPage-r9NhMxSu.js} +1 -1
  32. package/public/assets/{ToastTestPage-DkZ9D943.js → ToastTestPage-DJBKYs9_.js} +1 -1
  33. package/public/assets/{VersionSettingsPage-DHUbqInQ.js → VersionSettingsPage-DTIgBhQ_.js} +1 -1
  34. package/public/assets/{WebSocketTunnelPage-BGeVdEp8.js → WebSocketTunnelPage-C3mRJxS2.js} +1 -1
  35. package/public/assets/{_basePickBy-BFNUdIR5.js → _basePickBy-BTSO2Pkt.js} +1 -1
  36. package/public/assets/{_baseUniq-DP62Yq8R.js → _baseUniq-D89fR3NG.js} +1 -1
  37. package/public/assets/{arc-CkNwuwWZ.js → arc-XgUOTLxV.js} +1 -1
  38. package/public/assets/{architectureDiagram-VXUJARFQ-7Ky7pc6T.js → architectureDiagram-VXUJARFQ-DrSsIdf2.js} +1 -1
  39. package/public/assets/{blockDiagram-VD42YOAC-Ax8FYBYm.js → blockDiagram-VD42YOAC-DnsJI7gJ.js} +1 -1
  40. package/public/assets/{c4Diagram-YG6GDRKO-CyNR39OO.js → c4Diagram-YG6GDRKO-Dcw9Cs9G.js} +1 -1
  41. package/public/assets/channel-CUQXq8tY.js +1 -0
  42. package/public/assets/{chunk-4BX2VUAB-zM0Al_rU.js → chunk-4BX2VUAB-CuAIZ2Cr.js} +1 -1
  43. package/public/assets/{chunk-55IACEB6-CCDkr_yY.js → chunk-55IACEB6-CO5u6wMx.js} +1 -1
  44. package/public/assets/{chunk-B4BG7PRW-yOb-P7Po.js → chunk-B4BG7PRW-C4JF4UyZ.js} +1 -1
  45. package/public/assets/{chunk-DI55MBZ5-zGH8m4eb.js → chunk-DI55MBZ5-bfTEspLo.js} +1 -1
  46. package/public/assets/{chunk-FMBD7UC4-DI1MjWfw.js → chunk-FMBD7UC4-BN14QGw5.js} +1 -1
  47. package/public/assets/{chunk-QN33PNHL-C_FDNT8n.js → chunk-QN33PNHL-xWN6BqD9.js} +1 -1
  48. package/public/assets/{chunk-QZHKN3VN-V_K-gce9.js → chunk-QZHKN3VN-5-grYB4H.js} +1 -1
  49. package/public/assets/{chunk-TZMSLE5B-BnNBbkNq.js → chunk-TZMSLE5B-C2vW6017.js} +1 -1
  50. package/public/assets/{classDiagram-2ON5EDUG-DWylXt6j.js → classDiagram-2ON5EDUG-Ivmc_BXS.js} +1 -1
  51. package/public/assets/{classDiagram-v2-WZHVMYZB-DWylXt6j.js → classDiagram-v2-WZHVMYZB-Ivmc_BXS.js} +1 -1
  52. package/public/assets/clone-DTBJjony.js +1 -0
  53. package/public/assets/{cose-bilkent-S5V4N54A-DrNb0vKp.js → cose-bilkent-S5V4N54A-D4tCdQ5W.js} +1 -1
  54. package/public/assets/{dagre-6UL2VRFP-CtKFNLmb.js → dagre-6UL2VRFP-BGaPpMOL.js} +1 -1
  55. package/public/assets/{diagram-PSM6KHXK-DpQfOKt-.js → diagram-PSM6KHXK-B5MJHcOR.js} +1 -1
  56. package/public/assets/{diagram-QEK2KX5R-DscZmfZJ.js → diagram-QEK2KX5R-W49QXse-.js} +1 -1
  57. package/public/assets/{diagram-S2PKOQOG-UbEZAQ1u.js → diagram-S2PKOQOG-J_VMf6C2.js} +1 -1
  58. package/public/assets/{erDiagram-Q2GNP2WA-mmTcLBrY.js → erDiagram-Q2GNP2WA-CgK8jP0L.js} +1 -1
  59. package/public/assets/{flowDiagram-NV44I4VS-BsIXhV1w.js → flowDiagram-NV44I4VS-CXavqXYu.js} +1 -1
  60. package/public/assets/{ganttDiagram-LVOFAZNH-CaHkiTYy.js → ganttDiagram-LVOFAZNH-DdA4uXow.js} +1 -1
  61. package/public/assets/{gitGraphDiagram-NY62KEGX-B-ctMH3l.js → gitGraphDiagram-NY62KEGX-BHeHA2_6.js} +1 -1
  62. package/public/assets/{graph-CtuWuGCI.js → graph-CkRZhtax.js} +1 -1
  63. package/public/assets/{index-DBxcQY5U.css → index-BgR-BTTw.css} +1 -1
  64. package/public/assets/{index-D9bAK8SN.js → index-UPEozv-J.js} +21 -21
  65. package/public/assets/{infoDiagram-F6ZHWCRC-DMsG_8YD.js → infoDiagram-F6ZHWCRC-Cefi13nY.js} +1 -1
  66. package/public/assets/{journeyDiagram-XKPGCS4Q-XnBAE0k9.js → journeyDiagram-XKPGCS4Q-CAfRMHa8.js} +1 -1
  67. package/public/assets/{kanban-definition-3W4ZIXB7-DY1J_CQA.js → kanban-definition-3W4ZIXB7-DW5IlHJE.js} +1 -1
  68. package/public/assets/{layout-BBAqRBns.js → layout-nYP7m9RV.js} +1 -1
  69. package/public/assets/{linear-DXGOqRyX.js → linear--koZbfLt.js} +1 -1
  70. package/public/assets/{mindmap-definition-VGOIOE7T-D8LYlQnr.js → mindmap-definition-VGOIOE7T-BIt3RkSU.js} +1 -1
  71. package/public/assets/{pieDiagram-ADFJNKIX-DqZw-HeQ.js → pieDiagram-ADFJNKIX-Dgv5DD0S.js} +1 -1
  72. package/public/assets/{quadrantDiagram-AYHSOK5B-CfjEkg6d.js → quadrantDiagram-AYHSOK5B-BDAI4LQZ.js} +1 -1
  73. package/public/assets/{requirementDiagram-UZGBJVZJ-CEbDefgn.js → requirementDiagram-UZGBJVZJ-BtlBBsGB.js} +1 -1
  74. package/public/assets/{sankeyDiagram-TZEHDZUN-DOU4OJks.js → sankeyDiagram-TZEHDZUN-C5CTA-m2.js} +1 -1
  75. package/public/assets/{sequenceDiagram-WL72ISMW-BmjWQ4oi.js → sequenceDiagram-WL72ISMW-Zxi4nOIv.js} +1 -1
  76. package/public/assets/{stateDiagram-FKZM4ZOC-C7lI7uz2.js → stateDiagram-FKZM4ZOC-XoPlf0Vy.js} +1 -1
  77. package/public/assets/{stateDiagram-v2-4FDKWEC3-C8Eo5YFb.js → stateDiagram-v2-4FDKWEC3-r4Duovdx.js} +1 -1
  78. package/public/assets/{table-F592JIUY.js → table-BWrnBcPF.js} +1 -1
  79. package/public/assets/{timeline-definition-IT6M3QCI-BltidY3A.js → timeline-definition-IT6M3QCI-UHDY1Jjf.js} +1 -1
  80. package/public/assets/{treemap-KMMF4GRG-CXskbtZo.js → treemap-KMMF4GRG-CBW5iWMJ.js} +1 -1
  81. package/public/assets/{xychartDiagram-PRI3JC2R-Bk3p1DGz.js → xychartDiagram-PRI3JC2R-C2ylYAJK.js} +1 -1
  82. package/public/index.html +2 -2
  83. package/routes/cloudflareTunnel.d.ts.map +1 -1
  84. package/routes/cloudflareTunnel.js +2 -2
  85. package/routes/cloudflareTunnel.js.map +1 -1
  86. package/routes/commands.d.ts.map +1 -1
  87. package/routes/commands.js +7 -5
  88. package/routes/commands.js.map +1 -1
  89. package/routes/mcp.d.ts.map +1 -1
  90. package/routes/mcp.js +4 -5
  91. package/routes/mcp.js.map +1 -1
  92. package/routes/sessions.d.ts.map +1 -1
  93. package/routes/sessions.js +5 -5
  94. package/routes/sessions.js.map +1 -1
  95. package/routes/settings.d.ts.map +1 -1
  96. package/routes/settings.js +2 -1
  97. package/routes/settings.js.map +1 -1
  98. package/routes/subagents.d.ts.map +1 -1
  99. package/routes/subagents.js +7 -5
  100. package/routes/subagents.js.map +1 -1
  101. package/routes/version.d.ts.map +1 -1
  102. package/routes/version.js +6 -0
  103. package/routes/version.js.map +1 -1
  104. package/services/a2a/a2aConfigService.d.ts.map +1 -1
  105. package/services/a2a/a2aConfigService.js +3 -2
  106. package/services/a2a/a2aConfigService.js.map +1 -1
  107. package/services/pluginPaths.d.ts +12 -9
  108. package/services/pluginPaths.d.ts.map +1 -1
  109. package/services/pluginPaths.js +20 -17
  110. package/services/pluginPaths.js.map +1 -1
  111. package/services/projectMetadataStorage.d.ts.map +1 -1
  112. package/services/projectMetadataStorage.js +5 -5
  113. package/services/projectMetadataStorage.js.map +1 -1
  114. package/services/sessionManager.d.ts.map +1 -1
  115. package/services/sessionManager.js +2 -3
  116. package/services/sessionManager.js.map +1 -1
  117. package/services/skillStorage.d.ts.map +1 -1
  118. package/services/skillStorage.js +2 -1
  119. package/services/skillStorage.js.map +1 -1
  120. package/public/assets/GeneralSettingsPage-CWWgquA9.js +0 -1
  121. package/public/assets/channel-BKv1iINC.js +0 -1
  122. package/public/assets/clone-BnTQiQb4.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-CtKFNLmb.js","assets/graph-CtuWuGCI.js","assets/_baseUniq-DP62Yq8R.js","assets/layout-BBAqRBns.js","assets/_basePickBy-BFNUdIR5.js","assets/clone-BnTQiQb4.js","assets/data-structures-C0h9Oap1.js","assets/monaco-editor-DHKm5-VF.js","assets/syntax-highlighting-CnREyncB.js","assets/agents-DG431Wop.js","assets/tools-C0JOzoE_.js","assets/ui-components-CRCmgMKc.js","assets/agents-DwCY2K8p.css","assets/useAgents-Bp5Ry-Dk.js","assets/useSessions-EknKfdIv.js","assets/index-D9bAK8SN.js","assets/index-DBxcQY5U.css","assets/useCommands-B0s3JzZs.js","assets/useClaudeVersions-DYM2HCGW.js","assets/FileExplorer-DFQ7ynXa.js","assets/UnifiedToolSelector-CKjY_qjS.js","assets/FileBrowser-BXtVLz8h.js","assets/ProjectSelector-Bp1q7dra.js","assets/cose-bilkent-S5V4N54A-DrNb0vKp.js","assets/cytoscape.esm-DtBltrT8.js","assets/c4Diagram-YG6GDRKO-CyNR39OO.js","assets/chunk-TZMSLE5B-BnNBbkNq.js","assets/flowDiagram-NV44I4VS-BsIXhV1w.js","assets/chunk-FMBD7UC4-DI1MjWfw.js","assets/chunk-55IACEB6-CCDkr_yY.js","assets/chunk-QN33PNHL-C_FDNT8n.js","assets/channel-BKv1iINC.js","assets/erDiagram-Q2GNP2WA-mmTcLBrY.js","assets/gitGraphDiagram-NY62KEGX-B-ctMH3l.js","assets/chunk-4BX2VUAB-zM0Al_rU.js","assets/chunk-QZHKN3VN-V_K-gce9.js","assets/treemap-KMMF4GRG-CXskbtZo.js","assets/ganttDiagram-LVOFAZNH-CaHkiTYy.js","assets/linear-DXGOqRyX.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-C4B-KCzX.js","assets/infoDiagram-F6ZHWCRC-DMsG_8YD.js","assets/pieDiagram-ADFJNKIX-DqZw-HeQ.js","assets/arc-CkNwuwWZ.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AYHSOK5B-CfjEkg6d.js","assets/xychartDiagram-PRI3JC2R-Bk3p1DGz.js","assets/requirementDiagram-UZGBJVZJ-CEbDefgn.js","assets/sequenceDiagram-WL72ISMW-BmjWQ4oi.js","assets/classDiagram-2ON5EDUG-DWylXt6j.js","assets/chunk-B4BG7PRW-yOb-P7Po.js","assets/classDiagram-v2-WZHVMYZB-DWylXt6j.js","assets/stateDiagram-FKZM4ZOC-C7lI7uz2.js","assets/chunk-DI55MBZ5-zGH8m4eb.js","assets/stateDiagram-v2-4FDKWEC3-C8Eo5YFb.js","assets/journeyDiagram-XKPGCS4Q-XnBAE0k9.js","assets/timeline-definition-IT6M3QCI-BltidY3A.js","assets/mindmap-definition-VGOIOE7T-D8LYlQnr.js","assets/kanban-definition-3W4ZIXB7-DY1J_CQA.js","assets/sankeyDiagram-TZEHDZUN-DOU4OJks.js","assets/diagram-S2PKOQOG-UbEZAQ1u.js","assets/diagram-QEK2KX5R-DscZmfZJ.js","assets/blockDiagram-VD42YOAC-Ax8FYBYm.js","assets/architectureDiagram-VXUJARFQ-7Ky7pc6T.js","assets/diagram-PSM6KHXK-DpQfOKt-.js"])))=>i.map(i=>d[i]);
2
- import{j as p}from"./data-structures-C0h9Oap1.js";import{r as O,g as Au,W as xr}from"./monaco-editor-DHKm5-VF.js";import{o as sg,A as qa,a as Ua,u as Mu,h as f1,l as p1,d as g1,p as m1,S as x1}from"./agents-DG431Wop.js";import{g as y1,h as b1,i as k1,j as w1,k as v1}from"./useAgents-Bp5Ry-Dk.js";import{u as C1}from"./useSessions-EknKfdIv.js";import{u as ve,B as Qe,T as Ve,b as S1,K as _1,c as T1}from"./tools-C0JOzoE_.js";import{m as Zr,g as ld,at as E1,o as A1,Y as ag,I as sc,a_ as og,a$ as lg,X as En,k as fi,l as Ps,ay as Sa,L as _a,C as Jr,n as Ta,j as ac,Z as Ea,b0 as M1,_ as bl,b1 as N1,b2 as aa,b3 as L1,E as I1,ar as cg,aC as $1,az as j1,U as ug,b4 as cd,d as ud,w as Nu,V as B1,e as hg,ak as hd,S as dd,b5 as D1,as as dg,b6 as P1,y as R1,v as fg,r as F1,ax as O1,b7 as ks,ab as pg,i as gg,z as fd,ae as z1,ac as pd,u as W1}from"./ui-components-CRCmgMKc.js";import{c as H1,m as mg,k as q1,b as xg,n as U1,u as V1}from"./index-D9bAK8SN.js";import{u as oc,f as lc}from"./useCommands-B0s3JzZs.js";import{u as G1}from"./useClaudeVersions-DYM2HCGW.js";import{e as cc,E as uc,F as gd}from"./FileExplorer-DFQ7ynXa.js";import{c as Oe,h as yg}from"./syntax-highlighting-CnREyncB.js";import{U as Lu}from"./UnifiedToolSelector-CKjY_qjS.js";import{F as Y1}from"./FileBrowser-BXtVLz8h.js";import{P as X1}from"./ProjectSelector-Bp1q7dra.js";const Ke=sg((e,t)=>({currentAgent:null,messages:[],isAiTyping:!1,currentSessionId:null,mcpStatus:{hasError:!1,connectedServers:[],connectionErrors:[],lastError:null,lastErrorDetails:void 0,lastUpdated:void 0},pendingUserQuestion:null,activeA2AStreams:{},sidebarCollapsed:!1,setCurrentAgent:r=>e(n=>({currentAgent:r,...n.currentAgent?.id!==r?.id?{messages:[],isAiTyping:!1,currentSessionId:null}:{}})),addMessage:r=>e(n=>({messages:[...n.messages,{...r,id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,timestamp:Date.now(),agentId:n.currentAgent?.id||"unknown",messageParts:[]}]})),updateMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,...n}:s)})),addTextPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"text",content:n,order:(s.messageParts||[]).length}]}:s)})),addThinkingPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"thinking",content:n,order:(s.messageParts||[]).length}]}:s)})),updateTextPartInMessage:(r,n,i)=>e(s=>({messages:s.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="text"&&o.id===n?{...o,content:i}:o)}:a)})),updateThinkingPartInMessage:(r,n,i)=>e(s=>({messages:s.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="thinking"&&o.id===n?{...o,content:i}:o)}:a)})),addCompactSummaryPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"compactSummary",content:n,order:(s.messageParts||[]).length}]}:s)})),addCommandPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"command",content:n,order:(s.messageParts||[]).length}]}:s)})),addToolPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"tool",toolData:{...n,id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,isExecuting:n.isExecuting??!1},order:(s.messageParts||[]).length}]}:s)})),updateToolPartInMessage:(r,n,i)=>e(s=>({messages:s.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="tool"&&o.toolData?.id===n?{...o,toolData:o.toolData?{...o.toolData,...i}:void 0}:o)}:a)})),interruptAllExecutingTools:()=>e(r=>({messages:r.messages.map(n=>({...n,messageParts:n.messageParts?.map(i=>i.type==="tool"&&i.toolData?.isExecuting?{...i,toolData:{...i.toolData,isExecuting:!1,isInterrupted:!0}}:i)}))})),setAiTyping:r=>e({isAiTyping:r}),setCurrentSessionId:r=>e({currentSessionId:r}),clearMessages:()=>e({messages:[]}),loadSessionMessages:r=>e({messages:r}),updateMcpStatus:r=>e(n=>({mcpStatus:{...n.mcpStatus,...r,lastUpdated:Date.now()}})),clearMcpStatus:()=>e({mcpStatus:{hasError:!1,connectedServers:[],connectionErrors:[],lastError:null,lastErrorDetails:void 0,lastUpdated:void 0}}),setPendingUserQuestion:r=>e({pendingUserQuestion:r}),setA2AStreamStart:(r,n,i)=>e(s=>({activeA2AStreams:{...s.activeA2AStreams,[r]:{sessionId:n,agentUrl:r,message:i,startedAt:Date.now(),isStreaming:!0,events:[]}}})),setA2AStreamEnd:r=>e(n=>{const i=n.activeA2AStreams[r];return i?{activeA2AStreams:{...n.activeA2AStreams,[r]:{...i,isStreaming:!1}}}:n}),addA2AStreamEvent:(r,n)=>e(i=>{const s=i.activeA2AStreams[r];return s?{activeA2AStreams:{...i.activeA2AStreams,[r]:{...s,events:[...s.events,n]}}}:{activeA2AStreams:{...i.activeA2AStreams,[r]:{sessionId:n.sessionId||"",agentUrl:r,message:"",startedAt:Date.now(),isStreaming:!0,events:[n]}}}}),getA2AStreamByUrl:r=>t().activeA2AStreams[r],setSidebarCollapsed:r=>e({sidebarCollapsed:r})}));class nt{static instance;static STORAGE_KEY="active_chat_tabs";static WAKEUP_SIGNAL_KEY="tab_wakeup_signal";static WAKEUP_RESPONSE_KEY="tab_wakeup_response";static TAB_TIMEOUT=300*1e3;currentTabId;cleanupInterval;lastKnownSession=null;sessionResumeHistory=[];constructor(){this.currentTabId=this.generateTabId(),this.startCleanupTimer(),this.setupBeforeUnloadHandler(),console.log(`📱 TabManager initialized with ID: ${this.currentTabId}`)}static getInstance(){return nt.instance||(nt.instance=new nt),nt.instance}registerCurrentTab(t,r){const n=this.getActiveTabs(),i=this.getTabKey(t,r),s={agentId:t,sessionId:r,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title};n[i]=s,this.saveActiveTabs(n),console.log(`📱 Tab registered: ${this.currentTabId} for session ${r}`),this.lastKnownSession={agentId:t,sessionId:r}}updateCurrentTabActivity(t,r){const n=this.getActiveTabs(),i=this.getTabKey(t,r);n[i]&&n[i].tabId===this.currentTabId&&(n[i].lastSeen=Date.now(),n[i].url=window.location.href,n[i].title=document.title,this.saveActiveTabs(n),this.lastKnownSession={agentId:t,sessionId:r})}hasActiveTab(t,r){return this.findActiveTabForSession(t,r)!==null}findActiveTabForSession(t,r){const n=this.getActiveTabs(),i=this.getTabKey(t,r);if(n[i]&&Date.now()-n[i].lastSeen<nt.TAB_TIMEOUT)return n[i];for(const[s,a]of Object.entries(n))if(a.agentId===t&&a.sessionId===r){if(Date.now()-a.lastSeen<nt.TAB_TIMEOUT)return a;delete n[s],this.saveActiveTabs(n),console.log(`🗑️ Cleaned up expired tab: ${r}`)}return null}async wakeupExistingTab(t,r,n){if(!this.findActiveTabForSession(t,r))return!1;const s={type:"WAKEUP",agentId:t,sessionId:r,requestId:this.generateRequestId(),timestamp:Date.now(),sourceUrl:n||window.location.href};return console.log(`🔔 Sending wakeup signal for session: ${r}`),localStorage.setItem(nt.WAKEUP_SIGNAL_KEY,JSON.stringify(s)),new Promise(a=>{const o=setTimeout(()=>{console.log(`⏰ Wakeup timeout for session ${r}`),a(!1)},2e3),c=setInterval(()=>{const u=localStorage.getItem(nt.WAKEUP_RESPONSE_KEY);if(u)try{const h=JSON.parse(u);if(h.requestId===s.requestId){clearTimeout(o),localStorage.removeItem(nt.WAKEUP_RESPONSE_KEY),console.log(`✅ Tab awakened successfully: ${r}`),a(h.success);return}}catch(h){console.error("Error parsing wakeup response:",h)}},100);setTimeout(()=>clearInterval(c),2e3)})}setupWakeupListener(t,r){const n=s=>{if(s.key===nt.WAKEUP_SIGNAL_KEY&&s.newValue)try{const a=JSON.parse(s.newValue);a.type==="WAKEUP"&&a.agentId===t&&a.sessionId===r&&this.handleWakeupSignal(a)}catch(a){console.error("Error handling wakeup signal:",a)}};window.addEventListener("storage",n);const i=setInterval(()=>{const s=localStorage.getItem(nt.WAKEUP_SIGNAL_KEY);if(s)try{const a=JSON.parse(s);a.type==="WAKEUP"&&a.agentId===t&&a.sessionId===r&&Date.now()-a.timestamp<5e3&&this.handleWakeupSignal(a)}catch(a){console.error("Error polling wakeup signal:",a)}},500);return console.log(`🎯 Wakeup listener setup for session: ${r}`),()=>{window.removeEventListener("storage",n),clearInterval(i),console.log(`🎯 Wakeup listener cleaned up for session: ${r}`)}}updateCurrentTabSession(t,r,n,i){const s=this.getActiveTabs(),a=this.getTabKey(t,r);s[a]&&s[a].tabId===this.currentTabId&&delete s[a];const o=this.getTabKey(n,i);s[o]={agentId:n,sessionId:i,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title},this.saveActiveTabs(s),console.log(`🔄 Tab session updated: ${r} → ${i}`),this.lastKnownSession={agentId:n,sessionId:i}}unregisterCurrentTabSession(t,r){const n=this.getActiveTabs(),i=this.getTabKey(t,r);n[i]&&n[i].tabId===this.currentTabId&&(delete n[i],this.saveActiveTabs(n),console.log(`📤 Unregistered current tab from session: ${r}`)),this.lastKnownSession&&this.lastKnownSession.agentId===t&&this.lastKnownSession.sessionId===r&&(this.lastKnownSession=null)}handleSessionResume(t,r,n){const i=this.getActiveTabs(),s=this.getTabKey(t,r),a=this.getTabKey(t,n);i[s]&&i[s].tabId===this.currentTabId?(delete i[s],i[a]={agentId:t,sessionId:n,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title},this.saveActiveTabs(i),console.log(`🔄 Session resumed: ${r} → ${n}`),this.lastKnownSession={agentId:t,sessionId:n}):(this.registerCurrentTab(t,n),console.log(`🆕 Resumed session registered: ${n}`))}recordSessionResume(t,r,n){this.sessionResumeHistory.push({originalSessionId:r,newSessionId:n,timestamp:Date.now(),agentId:t}),this.sessionResumeHistory.length>100&&(this.sessionResumeHistory=this.sessionResumeHistory.slice(-100)),console.log(`📝 Recorded session resume: ${r} → ${n}`)}smartUpdateCurrentTab(){const t=window.location.href,r=this.parseSessionFromUrl(t);if(!r){this.lastKnownSession&&(this.unregisterCurrentTabSession(this.lastKnownSession.agentId,this.lastKnownSession.sessionId),this.lastKnownSession=null);return}const{agentId:n,sessionId:i}=r;if(this.lastKnownSession){const{agentId:s,sessionId:a}=this.lastKnownSession;a!==i||s!==n?this.sessionResumeHistory.find(l=>l.originalSessionId===a&&l.newSessionId===i&&l.agentId===n&&Date.now()-l.timestamp<3e4)?(this.handleSessionResume(n,a,i),console.log(`🔄 Detected session resume via URL: ${a} → ${i}`)):(this.updateCurrentTabSession(s,a,n,i),console.log(`🎯 Regular session switch: ${a} → ${i}`)):this.updateCurrentTabActivity(n,i)}else this.registerCurrentTab(n,i),console.log(`🎯 Initial session register: ${i}`);this.lastKnownSession={agentId:n,sessionId:i}}startSmartMonitoring(){this.smartUpdateCurrentTab();const t=()=>{setTimeout(()=>this.smartUpdateCurrentTab(),100)};window.addEventListener("popstate",t);const r=history.pushState,n=history.replaceState;return history.pushState=function(...i){r.apply(this,i),t()},history.replaceState=function(...i){n.apply(this,i),t()},console.log(`🎯 Smart monitoring started for tab: ${this.currentTabId}`),()=>{window.removeEventListener("popstate",t),history.pushState=r,history.replaceState=n,console.log(`🛑 Smart monitoring stopped for tab: ${this.currentTabId}`)}}handleWakeupSignal(t){console.log(`🔔 Received wakeup signal for session: ${t.sessionId}`);try{if(window.focus(),window.parent&&window.parent!==window&&window.parent.focus(),document.hidden){const n=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}}catch(n){console.log("Focus attempt failed:",n)}this.flashPageTitle(),this.playNotificationSound(),t.sourceUrl&&t.sourceUrl!==window.location.href?this.isSameSession(t.sourceUrl,window.location.href)?(console.log("🎯 URLs point to same session, forcing visibility"),this.makePageVisible()):(console.log(`🔄 Navigating to: ${t.sourceUrl}`),window.history.replaceState(null,"",t.sourceUrl),window.location.reload()):this.makePageVisible();const r={requestId:t.requestId,agentId:t.agentId,sessionId:t.sessionId,success:!0,timestamp:Date.now()};localStorage.setItem(nt.WAKEUP_RESPONSE_KEY,JSON.stringify(r)),localStorage.removeItem(nt.WAKEUP_SIGNAL_KEY),this.updateCurrentTabActivity(t.agentId,t.sessionId),console.log(`✅ Wakeup signal processed successfully for session: ${t.sessionId}`)}flashPageTitle(){const t=document.title;let r=0;const n=setInterval(()=>{document.title=r%2===0?"🔔 会话已唤起":t,r++,r>6&&(clearInterval(n),document.title=t)},500),i=()=>{clearInterval(n),document.title=t,window.removeEventListener("focus",i)};window.addEventListener("focus",i)}playNotificationSound(){try{const t=new(window.AudioContext||window.webkitAudioContext),r=t.createOscillator(),n=t.createGain();r.connect(n),n.connect(t.destination),r.frequency.setValueAtTime(800,t.currentTime),r.frequency.setValueAtTime(600,t.currentTime+.1),n.gain.setValueAtTime(.1,t.currentTime),n.gain.exponentialRampToValueAtTime(.01,t.currentTime+.2),r.start(t.currentTime),r.stop(t.currentTime+.2)}catch(t){console.log("Audio notification not supported:",t)}}makePageVisible(){try{window.scrollTo(0,0),document.fullscreenEnabled&&document.documentElement.requestFullscreen?.()?.then(()=>{setTimeout(()=>{document.exitFullscreen?.()},100)}).catch(n=>console.log("Fullscreen toggle failed:",n));const t=document.createElement("div");t.style.cssText=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-BGaPpMOL.js","assets/graph-CkRZhtax.js","assets/_baseUniq-D89fR3NG.js","assets/layout-nYP7m9RV.js","assets/_basePickBy-BTSO2Pkt.js","assets/clone-DTBJjony.js","assets/data-structures-C0h9Oap1.js","assets/monaco-editor-DHKm5-VF.js","assets/syntax-highlighting-CnREyncB.js","assets/agents-DG431Wop.js","assets/tools-C0JOzoE_.js","assets/ui-components-CRCmgMKc.js","assets/agents-DwCY2K8p.css","assets/useAgents-Bp5Ry-Dk.js","assets/useSessions-EknKfdIv.js","assets/index-UPEozv-J.js","assets/index-BgR-BTTw.css","assets/useCommands-B0s3JzZs.js","assets/useClaudeVersions-DYM2HCGW.js","assets/FileExplorer-DFQ7ynXa.js","assets/UnifiedToolSelector-CKjY_qjS.js","assets/FileBrowser-BbQchc_7.js","assets/ProjectSelector-GmS-1-C-.js","assets/cose-bilkent-S5V4N54A-D4tCdQ5W.js","assets/cytoscape.esm-DtBltrT8.js","assets/c4Diagram-YG6GDRKO-Dcw9Cs9G.js","assets/chunk-TZMSLE5B-C2vW6017.js","assets/flowDiagram-NV44I4VS-CXavqXYu.js","assets/chunk-FMBD7UC4-BN14QGw5.js","assets/chunk-55IACEB6-CO5u6wMx.js","assets/chunk-QN33PNHL-xWN6BqD9.js","assets/channel-CUQXq8tY.js","assets/erDiagram-Q2GNP2WA-CgK8jP0L.js","assets/gitGraphDiagram-NY62KEGX-BHeHA2_6.js","assets/chunk-4BX2VUAB-CuAIZ2Cr.js","assets/chunk-QZHKN3VN-5-grYB4H.js","assets/treemap-KMMF4GRG-CBW5iWMJ.js","assets/ganttDiagram-LVOFAZNH-DdA4uXow.js","assets/linear--koZbfLt.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-C4B-KCzX.js","assets/infoDiagram-F6ZHWCRC-Cefi13nY.js","assets/pieDiagram-ADFJNKIX-Dgv5DD0S.js","assets/arc-XgUOTLxV.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AYHSOK5B-BDAI4LQZ.js","assets/xychartDiagram-PRI3JC2R-C2ylYAJK.js","assets/requirementDiagram-UZGBJVZJ-BtlBBsGB.js","assets/sequenceDiagram-WL72ISMW-Zxi4nOIv.js","assets/classDiagram-2ON5EDUG-Ivmc_BXS.js","assets/chunk-B4BG7PRW-C4JF4UyZ.js","assets/classDiagram-v2-WZHVMYZB-Ivmc_BXS.js","assets/stateDiagram-FKZM4ZOC-XoPlf0Vy.js","assets/chunk-DI55MBZ5-bfTEspLo.js","assets/stateDiagram-v2-4FDKWEC3-r4Duovdx.js","assets/journeyDiagram-XKPGCS4Q-CAfRMHa8.js","assets/timeline-definition-IT6M3QCI-UHDY1Jjf.js","assets/mindmap-definition-VGOIOE7T-BIt3RkSU.js","assets/kanban-definition-3W4ZIXB7-DW5IlHJE.js","assets/sankeyDiagram-TZEHDZUN-C5CTA-m2.js","assets/diagram-S2PKOQOG-J_VMf6C2.js","assets/diagram-QEK2KX5R-W49QXse-.js","assets/blockDiagram-VD42YOAC-DnsJI7gJ.js","assets/architectureDiagram-VXUJARFQ-DrSsIdf2.js","assets/diagram-PSM6KHXK-B5MJHcOR.js"])))=>i.map(i=>d[i]);
2
+ import{j as p}from"./data-structures-C0h9Oap1.js";import{r as O,g as Au,W as xr}from"./monaco-editor-DHKm5-VF.js";import{o as sg,A as qa,a as Ua,u as Mu,h as f1,l as p1,d as g1,p as m1,S as x1}from"./agents-DG431Wop.js";import{g as y1,h as b1,i as k1,j as w1,k as v1}from"./useAgents-Bp5Ry-Dk.js";import{u as C1}from"./useSessions-EknKfdIv.js";import{u as ve,B as Qe,T as Ve,b as S1,K as _1,c as T1}from"./tools-C0JOzoE_.js";import{m as Zr,g as ld,at as E1,o as A1,Y as ag,I as sc,a_ as og,a$ as lg,X as En,k as fi,l as Ps,ay as Sa,L as _a,C as Jr,n as Ta,j as ac,Z as Ea,b0 as M1,_ as bl,b1 as N1,b2 as aa,b3 as L1,E as I1,ar as cg,aC as $1,az as j1,U as ug,b4 as cd,d as ud,w as Nu,V as B1,e as hg,ak as hd,S as dd,b5 as D1,as as dg,b6 as P1,y as R1,v as fg,r as F1,ax as O1,b7 as ks,ab as pg,i as gg,z as fd,ae as z1,ac as pd,u as W1}from"./ui-components-CRCmgMKc.js";import{c as H1,m as mg,k as q1,b as xg,n as U1,u as V1}from"./index-UPEozv-J.js";import{u as oc,f as lc}from"./useCommands-B0s3JzZs.js";import{u as G1}from"./useClaudeVersions-DYM2HCGW.js";import{e as cc,E as uc,F as gd}from"./FileExplorer-DFQ7ynXa.js";import{c as Oe,h as yg}from"./syntax-highlighting-CnREyncB.js";import{U as Lu}from"./UnifiedToolSelector-CKjY_qjS.js";import{F as Y1}from"./FileBrowser-BbQchc_7.js";import{P as X1}from"./ProjectSelector-GmS-1-C-.js";const Ke=sg((e,t)=>({currentAgent:null,messages:[],isAiTyping:!1,currentSessionId:null,mcpStatus:{hasError:!1,connectedServers:[],connectionErrors:[],lastError:null,lastErrorDetails:void 0,lastUpdated:void 0},pendingUserQuestion:null,activeA2AStreams:{},sidebarCollapsed:!1,setCurrentAgent:r=>e(n=>({currentAgent:r,...n.currentAgent?.id!==r?.id?{messages:[],isAiTyping:!1,currentSessionId:null}:{}})),addMessage:r=>e(n=>({messages:[...n.messages,{...r,id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,timestamp:Date.now(),agentId:n.currentAgent?.id||"unknown",messageParts:[]}]})),updateMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,...n}:s)})),addTextPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"text",content:n,order:(s.messageParts||[]).length}]}:s)})),addThinkingPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"thinking",content:n,order:(s.messageParts||[]).length}]}:s)})),updateTextPartInMessage:(r,n,i)=>e(s=>({messages:s.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="text"&&o.id===n?{...o,content:i}:o)}:a)})),updateThinkingPartInMessage:(r,n,i)=>e(s=>({messages:s.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="thinking"&&o.id===n?{...o,content:i}:o)}:a)})),addCompactSummaryPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"compactSummary",content:n,order:(s.messageParts||[]).length}]}:s)})),addCommandPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"command",content:n,order:(s.messageParts||[]).length}]}:s)})),addToolPartToMessage:(r,n)=>e(i=>({messages:i.messages.map(s=>s.id===r?{...s,messageParts:[...s.messageParts||[],{id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:"tool",toolData:{...n,id:`${Date.now()}_${Math.random().toString(36).substr(2,9)}`,isExecuting:n.isExecuting??!1},order:(s.messageParts||[]).length}]}:s)})),updateToolPartInMessage:(r,n,i)=>e(s=>({messages:s.messages.map(a=>a.id===r?{...a,messageParts:a.messageParts?.map(o=>o.type==="tool"&&o.toolData?.id===n?{...o,toolData:o.toolData?{...o.toolData,...i}:void 0}:o)}:a)})),interruptAllExecutingTools:()=>e(r=>({messages:r.messages.map(n=>({...n,messageParts:n.messageParts?.map(i=>i.type==="tool"&&i.toolData?.isExecuting?{...i,toolData:{...i.toolData,isExecuting:!1,isInterrupted:!0}}:i)}))})),setAiTyping:r=>e({isAiTyping:r}),setCurrentSessionId:r=>e({currentSessionId:r}),clearMessages:()=>e({messages:[]}),loadSessionMessages:r=>e({messages:r}),updateMcpStatus:r=>e(n=>({mcpStatus:{...n.mcpStatus,...r,lastUpdated:Date.now()}})),clearMcpStatus:()=>e({mcpStatus:{hasError:!1,connectedServers:[],connectionErrors:[],lastError:null,lastErrorDetails:void 0,lastUpdated:void 0}}),setPendingUserQuestion:r=>e({pendingUserQuestion:r}),setA2AStreamStart:(r,n,i)=>e(s=>({activeA2AStreams:{...s.activeA2AStreams,[r]:{sessionId:n,agentUrl:r,message:i,startedAt:Date.now(),isStreaming:!0,events:[]}}})),setA2AStreamEnd:r=>e(n=>{const i=n.activeA2AStreams[r];return i?{activeA2AStreams:{...n.activeA2AStreams,[r]:{...i,isStreaming:!1}}}:n}),addA2AStreamEvent:(r,n)=>e(i=>{const s=i.activeA2AStreams[r];return s?{activeA2AStreams:{...i.activeA2AStreams,[r]:{...s,events:[...s.events,n]}}}:{activeA2AStreams:{...i.activeA2AStreams,[r]:{sessionId:n.sessionId||"",agentUrl:r,message:"",startedAt:Date.now(),isStreaming:!0,events:[n]}}}}),getA2AStreamByUrl:r=>t().activeA2AStreams[r],setSidebarCollapsed:r=>e({sidebarCollapsed:r})}));class nt{static instance;static STORAGE_KEY="active_chat_tabs";static WAKEUP_SIGNAL_KEY="tab_wakeup_signal";static WAKEUP_RESPONSE_KEY="tab_wakeup_response";static TAB_TIMEOUT=300*1e3;currentTabId;cleanupInterval;lastKnownSession=null;sessionResumeHistory=[];constructor(){this.currentTabId=this.generateTabId(),this.startCleanupTimer(),this.setupBeforeUnloadHandler(),console.log(`📱 TabManager initialized with ID: ${this.currentTabId}`)}static getInstance(){return nt.instance||(nt.instance=new nt),nt.instance}registerCurrentTab(t,r){const n=this.getActiveTabs(),i=this.getTabKey(t,r),s={agentId:t,sessionId:r,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title};n[i]=s,this.saveActiveTabs(n),console.log(`📱 Tab registered: ${this.currentTabId} for session ${r}`),this.lastKnownSession={agentId:t,sessionId:r}}updateCurrentTabActivity(t,r){const n=this.getActiveTabs(),i=this.getTabKey(t,r);n[i]&&n[i].tabId===this.currentTabId&&(n[i].lastSeen=Date.now(),n[i].url=window.location.href,n[i].title=document.title,this.saveActiveTabs(n),this.lastKnownSession={agentId:t,sessionId:r})}hasActiveTab(t,r){return this.findActiveTabForSession(t,r)!==null}findActiveTabForSession(t,r){const n=this.getActiveTabs(),i=this.getTabKey(t,r);if(n[i]&&Date.now()-n[i].lastSeen<nt.TAB_TIMEOUT)return n[i];for(const[s,a]of Object.entries(n))if(a.agentId===t&&a.sessionId===r){if(Date.now()-a.lastSeen<nt.TAB_TIMEOUT)return a;delete n[s],this.saveActiveTabs(n),console.log(`🗑️ Cleaned up expired tab: ${r}`)}return null}async wakeupExistingTab(t,r,n){if(!this.findActiveTabForSession(t,r))return!1;const s={type:"WAKEUP",agentId:t,sessionId:r,requestId:this.generateRequestId(),timestamp:Date.now(),sourceUrl:n||window.location.href};return console.log(`🔔 Sending wakeup signal for session: ${r}`),localStorage.setItem(nt.WAKEUP_SIGNAL_KEY,JSON.stringify(s)),new Promise(a=>{const o=setTimeout(()=>{console.log(`⏰ Wakeup timeout for session ${r}`),a(!1)},2e3),c=setInterval(()=>{const u=localStorage.getItem(nt.WAKEUP_RESPONSE_KEY);if(u)try{const h=JSON.parse(u);if(h.requestId===s.requestId){clearTimeout(o),localStorage.removeItem(nt.WAKEUP_RESPONSE_KEY),console.log(`✅ Tab awakened successfully: ${r}`),a(h.success);return}}catch(h){console.error("Error parsing wakeup response:",h)}},100);setTimeout(()=>clearInterval(c),2e3)})}setupWakeupListener(t,r){const n=s=>{if(s.key===nt.WAKEUP_SIGNAL_KEY&&s.newValue)try{const a=JSON.parse(s.newValue);a.type==="WAKEUP"&&a.agentId===t&&a.sessionId===r&&this.handleWakeupSignal(a)}catch(a){console.error("Error handling wakeup signal:",a)}};window.addEventListener("storage",n);const i=setInterval(()=>{const s=localStorage.getItem(nt.WAKEUP_SIGNAL_KEY);if(s)try{const a=JSON.parse(s);a.type==="WAKEUP"&&a.agentId===t&&a.sessionId===r&&Date.now()-a.timestamp<5e3&&this.handleWakeupSignal(a)}catch(a){console.error("Error polling wakeup signal:",a)}},500);return console.log(`🎯 Wakeup listener setup for session: ${r}`),()=>{window.removeEventListener("storage",n),clearInterval(i),console.log(`🎯 Wakeup listener cleaned up for session: ${r}`)}}updateCurrentTabSession(t,r,n,i){const s=this.getActiveTabs(),a=this.getTabKey(t,r);s[a]&&s[a].tabId===this.currentTabId&&delete s[a];const o=this.getTabKey(n,i);s[o]={agentId:n,sessionId:i,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title},this.saveActiveTabs(s),console.log(`🔄 Tab session updated: ${r} → ${i}`),this.lastKnownSession={agentId:n,sessionId:i}}unregisterCurrentTabSession(t,r){const n=this.getActiveTabs(),i=this.getTabKey(t,r);n[i]&&n[i].tabId===this.currentTabId&&(delete n[i],this.saveActiveTabs(n),console.log(`📤 Unregistered current tab from session: ${r}`)),this.lastKnownSession&&this.lastKnownSession.agentId===t&&this.lastKnownSession.sessionId===r&&(this.lastKnownSession=null)}handleSessionResume(t,r,n){const i=this.getActiveTabs(),s=this.getTabKey(t,r),a=this.getTabKey(t,n);i[s]&&i[s].tabId===this.currentTabId?(delete i[s],i[a]={agentId:t,sessionId:n,url:window.location.href,lastSeen:Date.now(),tabId:this.currentTabId,title:document.title},this.saveActiveTabs(i),console.log(`🔄 Session resumed: ${r} → ${n}`),this.lastKnownSession={agentId:t,sessionId:n}):(this.registerCurrentTab(t,n),console.log(`🆕 Resumed session registered: ${n}`))}recordSessionResume(t,r,n){this.sessionResumeHistory.push({originalSessionId:r,newSessionId:n,timestamp:Date.now(),agentId:t}),this.sessionResumeHistory.length>100&&(this.sessionResumeHistory=this.sessionResumeHistory.slice(-100)),console.log(`📝 Recorded session resume: ${r} → ${n}`)}smartUpdateCurrentTab(){const t=window.location.href,r=this.parseSessionFromUrl(t);if(!r){this.lastKnownSession&&(this.unregisterCurrentTabSession(this.lastKnownSession.agentId,this.lastKnownSession.sessionId),this.lastKnownSession=null);return}const{agentId:n,sessionId:i}=r;if(this.lastKnownSession){const{agentId:s,sessionId:a}=this.lastKnownSession;a!==i||s!==n?this.sessionResumeHistory.find(l=>l.originalSessionId===a&&l.newSessionId===i&&l.agentId===n&&Date.now()-l.timestamp<3e4)?(this.handleSessionResume(n,a,i),console.log(`🔄 Detected session resume via URL: ${a} → ${i}`)):(this.updateCurrentTabSession(s,a,n,i),console.log(`🎯 Regular session switch: ${a} → ${i}`)):this.updateCurrentTabActivity(n,i)}else this.registerCurrentTab(n,i),console.log(`🎯 Initial session register: ${i}`);this.lastKnownSession={agentId:n,sessionId:i}}startSmartMonitoring(){this.smartUpdateCurrentTab();const t=()=>{setTimeout(()=>this.smartUpdateCurrentTab(),100)};window.addEventListener("popstate",t);const r=history.pushState,n=history.replaceState;return history.pushState=function(...i){r.apply(this,i),t()},history.replaceState=function(...i){n.apply(this,i),t()},console.log(`🎯 Smart monitoring started for tab: ${this.currentTabId}`),()=>{window.removeEventListener("popstate",t),history.pushState=r,history.replaceState=n,console.log(`🛑 Smart monitoring stopped for tab: ${this.currentTabId}`)}}handleWakeupSignal(t){console.log(`🔔 Received wakeup signal for session: ${t.sessionId}`);try{if(window.focus(),window.parent&&window.parent!==window&&window.parent.focus(),document.hidden){const n=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});document.dispatchEvent(n)}}catch(n){console.log("Focus attempt failed:",n)}this.flashPageTitle(),this.playNotificationSound(),t.sourceUrl&&t.sourceUrl!==window.location.href?this.isSameSession(t.sourceUrl,window.location.href)?(console.log("🎯 URLs point to same session, forcing visibility"),this.makePageVisible()):(console.log(`🔄 Navigating to: ${t.sourceUrl}`),window.history.replaceState(null,"",t.sourceUrl),window.location.reload()):this.makePageVisible();const r={requestId:t.requestId,agentId:t.agentId,sessionId:t.sessionId,success:!0,timestamp:Date.now()};localStorage.setItem(nt.WAKEUP_RESPONSE_KEY,JSON.stringify(r)),localStorage.removeItem(nt.WAKEUP_SIGNAL_KEY),this.updateCurrentTabActivity(t.agentId,t.sessionId),console.log(`✅ Wakeup signal processed successfully for session: ${t.sessionId}`)}flashPageTitle(){const t=document.title;let r=0;const n=setInterval(()=>{document.title=r%2===0?"🔔 会话已唤起":t,r++,r>6&&(clearInterval(n),document.title=t)},500),i=()=>{clearInterval(n),document.title=t,window.removeEventListener("focus",i)};window.addEventListener("focus",i)}playNotificationSound(){try{const t=new(window.AudioContext||window.webkitAudioContext),r=t.createOscillator(),n=t.createGain();r.connect(n),n.connect(t.destination),r.frequency.setValueAtTime(800,t.currentTime),r.frequency.setValueAtTime(600,t.currentTime+.1),n.gain.setValueAtTime(.1,t.currentTime),n.gain.exponentialRampToValueAtTime(.01,t.currentTime+.2),r.start(t.currentTime),r.stop(t.currentTime+.2)}catch(t){console.log("Audio notification not supported:",t)}}makePageVisible(){try{window.scrollTo(0,0),document.fullscreenEnabled&&document.documentElement.requestFullscreen?.()?.then(()=>{setTimeout(()=>{document.exitFullscreen?.()},100)}).catch(n=>console.log("Fullscreen toggle failed:",n));const t=document.createElement("div");t.style.cssText=`
3
3
  position: fixed;
4
4
  top: 50%;
5
5
  left: 50%;
@@ -374,8 +374,8 @@ Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error
374
374
  node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const n=e.x,i=e.y,s=Math.abs(n-r.x),a=e.width/2;let o=r.x<t.x?a-s:a+s;const l=e.height/2,c=Math.abs(t.y-r.y),u=Math.abs(t.x-r.x);if(Math.abs(i-t.y)*a>Math.abs(n-t.x)*l){let h=r.y<t.y?t.y-l-i:i-l-t.y;o=u*h/c;const d={x:r.x<t.x?r.x+o:r.x-u+o,y:r.y<t.y?r.y+c-h:r.y-c+h};return o===0&&(d.x=t.x,d.y=t.y),u===0&&(d.x=t.x),c===0&&(d.y=t.y),K.debug(`abc89 top/bottom calc, Q ${c}, q ${h}, R ${u}, r ${o}`,d),d}else{r.x<t.x?o=t.x-a-n:o=n-a-t.x;let h=c*o/u,d=r.x<t.x?r.x+u-o:r.x-u+o,f=r.y<t.y?r.y+h:r.y-h;return K.debug(`sides calc abc89, Q ${c}, q ${h}, R ${u}, r ${o}`,{_x:d,_y:f}),o===0&&(d=t.x,f=t.y),u===0&&(d=t.x),c===0&&(f=t.y),{x:d,y:f}}},"intersection"),Ep=x((e,t)=>{K.warn("abc88 cutPathAtIntersect",e,t);let r=[],n=e[0],i=!1;return e.forEach(s=>{if(K.info("abc88 checking point",s,t),!K5(t,s)&&!i){const a=Q5(t,n,s);K.debug("abc88 inside",s,n,a),K.debug("abc88 intersection",a,t);let o=!1;r.forEach(l=>{o=o||l.x===a.x&&l.y===a.y}),r.some(l=>l.x===a.x&&l.y===a.y)?K.warn("abc88 no intersect",a,r):r.push(a),i=!0}else K.warn("abc88 outside",s,n),n=s,i||r.push(s)}),K.debug("returning points",r),r},"cutPathAtIntersect");function Uk(e){const t=[],r=[];for(let n=1;n<e.length-1;n++){const i=e[n-1],s=e[n],a=e[n+1];(i.x===s.x&&s.y===a.y&&Math.abs(s.x-a.x)>5&&Math.abs(s.y-i.y)>5||i.y===s.y&&s.x===a.x&&Math.abs(s.x-i.x)>5&&Math.abs(s.y-a.y)>5)&&(t.push(s),r.push(n))}return{cornerPoints:t,cornerPointPositions:r}}x(Uk,"extractCornerPoints");var Ap=x(function(e,t,r){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i),a=r/s;return{x:t.x-a*n,y:t.y-a*i}},"findAdjacentPoint"),Z5=x(function(e){const{cornerPointPositions:t}=Uk(e),r=[];for(let n=0;n<e.length;n++)if(t.includes(n)){const i=e[n-1],s=e[n+1],a=e[n],o=Ap(i,a,5),l=Ap(s,a,5),c=l.x-o.x,u=l.y-o.y;r.push(o);const h=Math.sqrt(2)*2;let d={x:a.x,y:a.y};if(Math.abs(s.x-i.x)>10&&Math.abs(s.y-i.y)>=10){K.debug("Corner point fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));const f=5;a.x===o.x?d={x:c<0?o.x-f+h:o.x+f-h,y:u<0?o.y-h:o.y+h}:d={x:c<0?o.x-h:o.x+h,y:u<0?o.y-f+h:o.y+f-h}}else K.debug("Corner point skipping fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));r.push(d,l)}else r.push(e[n]);return r},"fixCorners"),J5=x((e,t,r)=>{const n=e-t-r,i=2,s=2,a=i+s,o=Math.floor(n/a),l=Array(o).fill(`${i} ${s}`).join(" ");return`0 ${t} ${l} ${r}`},"generateDashArray"),eP=x(function(e,t,r,n,i,s,a,o=!1){const{handDrawnSeed:l}=Re();let c=t.points,u=!1;const h=i;var d=s;const f=[];for(const $ in t.cssCompiledStyles)vy($)||f.push(t.cssCompiledStyles[$]);K.debug("UIO intersect check",t.points,d.x,h.x),d.intersect&&h.intersect&&!o&&(c=c.slice(1,t.points.length-1),c.unshift(h.intersect(c[0])),K.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],d,d.intersect(c[c.length-1])),c.push(d.intersect(c[c.length-1])));const g=btoa(JSON.stringify(c));t.toCluster&&(K.info("to cluster abc88",r.get(t.toCluster)),c=Ep(t.points,r.get(t.toCluster).node),u=!0),t.fromCluster&&(K.debug("from cluster abc88",r.get(t.fromCluster),JSON.stringify(c,null,2)),c=Ep(c.reverse(),r.get(t.fromCluster).node).reverse(),u=!0);let m=c.filter($=>!Number.isNaN($.y));m=Z5(m);let b=Da;switch(b=oo,t.curve){case"linear":b=oo;break;case"basis":b=Da;break;case"cardinal":b=T0;break;case"bumpX":b=w0;break;case"bumpY":b=v0;break;case"catmullRom":b=A0;break;case"monotoneX":b=j0;break;case"monotoneY":b=B0;break;case"natural":b=P0;break;case"step":b=R0;break;case"stepAfter":b=O0;break;case"stepBefore":b=F0;break;default:b=Da}const{x:y,y:k}=Z$(t),v=BI().x(y).y(k).curve(b);let S;switch(t.thickness){case"normal":S="edge-thickness-normal";break;case"thick":S="edge-thickness-thick";break;case"invisible":S="edge-thickness-invisible";break;default:S="edge-thickness-normal"}switch(t.pattern){case"solid":S+=" edge-pattern-solid";break;case"dotted":S+=" edge-pattern-dotted";break;case"dashed":S+=" edge-pattern-dashed";break;default:S+=" edge-pattern-solid"}let C,w=t.curve==="rounded"?Vk(Gk(m,t),5):v(m);const T=Array.isArray(t.style)?t.style:[t.style];let I=T.find($=>$?.startsWith("stroke:")),M=!1;if(t.look==="handDrawn"){const $=ae.svg(e);Object.assign([],m);const F=$.path(w,{roughness:.3,seed:l});S+=" transition",C=$e(F).select("path").attr("id",t.id).attr("class"," "+S+(t.classes?" "+t.classes:"")).attr("style",T?T.reduce((R,W)=>R+";"+W,""):"");let L=C.attr("d");C.attr("d",L),e.node().appendChild(C.node())}else{const $=f.join(";"),F=T?T.reduce((te,A)=>te+A+";",""):"";let L="";t.animate&&(L=" edge-animation-fast"),t.animation&&(L=" edge-animation-"+t.animation);const R=($?$+";"+F+";":F)+";"+(T?T.reduce((te,A)=>te+";"+A,""):"");C=e.append("path").attr("d",w).attr("id",t.id).attr("class"," "+S+(t.classes?" "+t.classes:"")+(L??"")).attr("style",R),I=R.match(/stroke:([^;]+)/)?.[1],M=t.animate===!0||!!t.animation||$.includes("animation");const W=C.node(),X=typeof W.getTotalLength=="function"?W.getTotalLength():0,_=Uf[t.arrowTypeStart]||0,j=Uf[t.arrowTypeEnd]||0;if(t.look==="neo"&&!M){const A=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?J5(X,_,j):`0 ${_} ${X-_-j} ${j}`}; stroke-dashoffset: 0;`;C.attr("style",A+C.attr("style"))}}C.attr("data-edge",!0),C.attr("data-et","edge"),C.attr("data-id",t.id),C.attr("data-points",g),t.showPoints&&m.forEach($=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",$.x).attr("cy",$.y)});let E="";(Re().flowchart.arrowMarkerAbsolute||Re().state.arrowMarkerAbsolute)&&(E=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,E=E.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),K.info("arrowTypeStart",t.arrowTypeStart),K.info("arrowTypeEnd",t.arrowTypeEnd),V5(C,t,E,a,n,I);const N=Math.floor(c.length/2),D=c[N];hr.isLabelCoordinateInPath(D,C.attr("d"))||(u=!0);let P={};return u&&(P.updatedPath=c),P.originalPath=t.points,P},"insertEdge");function Vk(e,t){if(e.length<2)return"";let r="";const n=e.length,i=1e-5;for(let s=0;s<n;s++){const a=e[s],o=e[s-1],l=e[s+1];if(s===0)r+=`M${a.x},${a.y}`;else if(s===n-1)r+=`L${a.x},${a.y}`;else{const c=a.x-o.x,u=a.y-o.y,h=l.x-a.x,d=l.y-a.y,f=Math.hypot(c,u),g=Math.hypot(h,d);if(f<i||g<i){r+=`L${a.x},${a.y}`;continue}const m=c/f,b=u/f,y=h/g,k=d/g,v=m*y+b*k,S=Math.max(-1,Math.min(1,v)),C=Math.acos(S);if(C<i||Math.abs(Math.PI-C)<i){r+=`L${a.x},${a.y}`;continue}const w=Math.min(t/Math.sin(C/2),f/2,g/2),T=a.x-m*w,I=a.y-b*w,M=a.x+y*w,E=a.y+k*w;r+=`L${T},${I}`,r+=`Q${a.x},${a.y} ${M},${E}`}}return r}x(Vk,"generateRoundedPath");function fu(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};const r=t.x-e.x,n=t.y-e.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}x(fu,"calculateDeltaAndAngle");function Gk(e,t){const r=e.map(i=>({...i}));if(e.length>=2&&Tt[t.arrowTypeStart]){const i=Tt[t.arrowTypeStart],s=e[0],a=e[1],{angle:o}=fu(s,a),l=i*Math.cos(o),c=i*Math.sin(o);r[0].x=s.x+l,r[0].y=s.y+c}const n=e.length;if(n>=2&&Tt[t.arrowTypeEnd]){const i=Tt[t.arrowTypeEnd],s=e[n-1],a=e[n-2],{angle:o}=fu(a,s),l=i*Math.cos(o),c=i*Math.sin(o);r[n-1].x=s.x-l,r[n-1].y=s.y-c}return r}x(Gk,"applyMarkerOffsetsToPoints");var tP=x((e,t,r,n)=>{t.forEach(i=>{xP[i](e,r,n)})},"insertMarkers"),rP=x((e,t,r)=>{K.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),nP=x((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),iP=x((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),sP=x((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),aP=x((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),oP=x((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),lP=x((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),cP=x((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),uP=x((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),hP=x((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),dP=x((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),fP=x((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),pP=x((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),gP=x((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
375
375
  L20,10
376
376
  M20,10
377
- L0,20`)},"requirement_arrow"),mP=x((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),xP={extension:rP,composition:nP,aggregation:iP,dependency:sP,lollipop:aP,point:oP,circle:lP,cross:cP,barb:uP,only_one:hP,zero_or_one:dP,one_or_more:fP,zero_or_more:pP,requirement_arrow:gP,requirement_contains:mP},yP=tP,bP={common:Ti,getConfig:At,insertCluster:E5,insertEdge:eP,insertEdgeLabel:Y5,insertMarkers:yP,insertNode:qk,interpolateToCurve:Ah,labelHelper:ye,log:K,positionEdgeLabel:X5},js={},Yk=x(e=>{for(const t of e)js[t.name]=t},"registerLayoutLoaders"),kP=x(()=>{Yk([{name:"dagre",loader:x(async()=>await Oe(()=>import("./dagre-6UL2VRFP-CtKFNLmb.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),"loader")},{name:"cose-bilkent",loader:x(async()=>await Oe(()=>import("./cose-bilkent-S5V4N54A-DrNb0vKp.js"),__vite__mapDeps([23,24,7,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),"loader")}])},"registerDefaultLayoutLoaders");kP();var R6=x(async(e,t)=>{if(!(e.layoutAlgorithm in js))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=js[e.layoutAlgorithm];return(await r.loader()).render(e,t,bP,{algorithm:r.algorithm})},"render"),F6=x((e="",{fallback:t="dagre"}={})=>{if(e in js)return e;if(t in js)return K.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Xk="comm",Kk="rule",Qk="decl",wP="@import",vP="@namespace",CP="@keyframes",SP="@layer",Zk=Math.abs,Yh=String.fromCharCode;function Jk(e){return e.trim()}function za(e,t,r){return e.replace(t,r)}function _P(e,t,r){return e.indexOf(t,r)}function ii(e,t){return e.charCodeAt(t)|0}function vi(e,t,r){return e.slice(t,r)}function wr(e){return e.length}function TP(e){return e.length}function va(e,t){return t.push(e),e}var ul=1,Ci=1,ew=0,ar=0,lt=0,Li="";function Xh(e,t,r,n,i,s,a,o){return{value:e,root:t,parent:r,type:n,props:i,children:s,line:ul,column:Ci,length:a,return:"",siblings:o}}function EP(){return lt}function AP(){return lt=ar>0?ii(Li,--ar):0,Ci--,lt===10&&(Ci=1,ul--),lt}function pr(){return lt=ar<ew?ii(Li,ar++):0,Ci++,lt===10&&(Ci=1,ul++),lt}function Qr(){return ii(Li,ar)}function Wa(){return ar}function hl(e,t){return vi(Li,e,t)}function Bs(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function MP(e){return ul=Ci=1,ew=wr(Li=e),ar=0,[]}function NP(e){return Li="",e}function rc(e){return Jk(hl(ar-1,pu(e===91?e+2:e===40?e+1:e)))}function LP(e){for(;(lt=Qr())&&lt<33;)pr();return Bs(e)>2||Bs(lt)>3?"":" "}function IP(e,t){for(;--t&&pr()&&!(lt<48||lt>102||lt>57&&lt<65||lt>70&&lt<97););return hl(e,Wa()+(t<6&&Qr()==32&&pr()==32))}function pu(e){for(;pr();)switch(lt){case e:return ar;case 34:case 39:e!==34&&e!==39&&pu(lt);break;case 40:e===41&&pu(e);break;case 92:pr();break}return ar}function $P(e,t){for(;pr()&&e+lt!==57;)if(e+lt===84&&Qr()===47)break;return"/*"+hl(t,ar-1)+"*"+Yh(e===47?e:pr())}function jP(e){for(;!Bs(Qr());)pr();return hl(e,ar)}function BP(e){return NP(Ha("",null,null,null,[""],e=MP(e),0,[0],e))}function Ha(e,t,r,n,i,s,a,o,l){for(var c=0,u=0,h=a,d=0,f=0,g=0,m=1,b=1,y=1,k=0,v="",S=i,C=s,w=n,T=v;b;)switch(g=k,k=pr()){case 40:if(g!=108&&ii(T,h-1)==58){_P(T+=za(rc(k),"&","&\f"),"&\f",Zk(c?o[c-1]:0))!=-1&&(y=-1);break}case 34:case 39:case 91:T+=rc(k);break;case 9:case 10:case 13:case 32:T+=LP(g);break;case 92:T+=IP(Wa()-1,7);continue;case 47:switch(Qr()){case 42:case 47:va(DP($P(pr(),Wa()),t,r,l),l),(Bs(g||1)==5||Bs(Qr()||1)==5)&&wr(T)&&vi(T,-1,void 0)!==" "&&(T+=" ");break;default:T+="/"}break;case 123*m:o[c++]=wr(T)*y;case 125*m:case 59:case 0:switch(k){case 0:case 125:b=0;case 59+u:y==-1&&(T=za(T,/\f/g,"")),f>0&&(wr(T)-h||m===0&&g===47)&&va(f>32?Np(T+";",n,r,h-1,l):Np(za(T," ","")+";",n,r,h-2,l),l);break;case 59:T+=";";default:if(va(w=Mp(T,t,r,c,u,i,o,v,S=[],C=[],h,s),s),k===123)if(u===0)Ha(T,t,w,w,S,s,h,o,C);else{switch(d){case 99:if(ii(T,3)===110)break;case 108:if(ii(T,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Ha(e,w,w,n&&va(Mp(e,w,w,0,0,i,o,v,i,S=[],h,C),C),i,C,h,o,n?S:C):Ha(T,w,w,w,[""],C,0,o,C)}}c=u=f=0,m=y=1,v=T="",h=a;break;case 58:h=1+wr(T),f=g;default:if(m<1){if(k==123)--m;else if(k==125&&m++==0&&AP()==125)continue}switch(T+=Yh(k),k*m){case 38:y=u>0?1:(T+="\f",-1);break;case 44:o[c++]=(wr(T)-1)*y,y=1;break;case 64:Qr()===45&&(T+=rc(pr())),d=Qr(),u=h=wr(v=T+=jP(Wa())),k++;break;case 45:g===45&&wr(T)==2&&(m=0)}}return s}function Mp(e,t,r,n,i,s,a,o,l,c,u,h){for(var d=i-1,f=i===0?s:[""],g=TP(f),m=0,b=0,y=0;m<n;++m)for(var k=0,v=vi(e,d+1,d=Zk(b=a[m])),S=e;k<g;++k)(S=Jk(b>0?f[k]+" "+v:za(v,/&\f/g,f[k])))&&(l[y++]=S);return Xh(e,t,r,i===0?Kk:o,l,c,u,h)}function DP(e,t,r,n){return Xh(e,t,r,Xk,Yh(EP()),vi(e,2,-2),0,n)}function Np(e,t,r,n,i){return Xh(e,t,r,Qk,vi(e,0,n),vi(e,n+1,-1),n,i)}function gu(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function PP(e,t,r,n){switch(e.type){case SP:if(e.children.length)break;case wP:case vP:case Qk:return e.return=e.return||e.value;case Xk:return"";case CP:return e.return=e.value+"{"+gu(e.children,n)+"}";case Kk:if(!wr(e.value=e.props.join(",")))return""}return wr(r=gu(e.children,n))?e.return=e.value+"{"+r+"}":""}var RP=Ty(Object.keys,Object),FP=Object.prototype,OP=FP.hasOwnProperty;function zP(e){if(!el(e))return RP(e);var t=[];for(var r in Object(e))OP.call(e,r)&&r!="constructor"&&t.push(r);return t}var mu=Fn(Ar,"DataView"),xu=Fn(Ar,"Promise"),yu=Fn(Ar,"Set"),bu=Fn(Ar,"WeakMap"),Lp="[object Map]",WP="[object Object]",Ip="[object Promise]",$p="[object Set]",jp="[object WeakMap]",Bp="[object DataView]",HP=Rn(mu),qP=Rn(Is),UP=Rn(xu),VP=Rn(yu),GP=Rn(bu),bn=Ai;(mu&&bn(new mu(new ArrayBuffer(1)))!=Bp||Is&&bn(new Is)!=Lp||xu&&bn(xu.resolve())!=Ip||yu&&bn(new yu)!=$p||bu&&bn(new bu)!=jp)&&(bn=function(e){var t=Ai(e),r=t==WP?e.constructor:void 0,n=r?Rn(r):"";if(n)switch(n){case HP:return Bp;case qP:return Lp;case UP:return Ip;case VP:return $p;case GP:return jp}return t});var YP="[object Map]",XP="[object Set]",KP=Object.prototype,QP=KP.hasOwnProperty;function Dp(e){if(e==null)return!0;if(tl(e)&&(wo(e)||typeof e=="string"||typeof e.splice=="function"||Th(e)||Eh(e)||ko(e)))return!e.length;var t=bn(e);if(t==YP||t==XP)return!e.size;if(el(e))return!zP(e).length;for(var r in e)if(QP.call(e,r))return!1;return!0}var tw="c4",ZP=x(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),JP=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-CyNR39OO.js");return{diagram:t}},__vite__mapDeps([25,26,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:tw,diagram:e}},"loader"),e4={id:tw,detector:ZP,loader:JP},t4=e4,rw="flowchart",r4=x((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),n4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-BsIXhV1w.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:rw,diagram:e}},"loader"),i4={id:rw,detector:r4,loader:n4},s4=i4,nw="flowchart-v2",a4=x((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),o4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-BsIXhV1w.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:nw,diagram:e}},"loader"),l4={id:nw,detector:a4,loader:o4},c4=l4,iw="er",u4=x(e=>/^\s*erDiagram/.test(e),"detector"),h4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-mmTcLBrY.js");return{diagram:t}},__vite__mapDeps([32,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:iw,diagram:e}},"loader"),d4={id:iw,detector:u4,loader:h4},f4=d4,sw="gitGraph",p4=x(e=>/^\s*gitGraph/.test(e),"detector"),g4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-B-ctMH3l.js");return{diagram:t}},__vite__mapDeps([33,34,35,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:sw,diagram:e}},"loader"),m4={id:sw,detector:p4,loader:g4},x4=m4,aw="gantt",y4=x(e=>/^\s*gantt/.test(e),"detector"),b4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./ganttDiagram-LVOFAZNH-CaHkiTYy.js");return{diagram:t}},__vite__mapDeps([37,7,38,39,40,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:aw,diagram:e}},"loader"),k4={id:aw,detector:y4,loader:b4},w4=k4,ow="info",v4=x(e=>/^\s*info/.test(e),"detector"),C4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./infoDiagram-F6ZHWCRC-DMsG_8YD.js");return{diagram:t}},__vite__mapDeps([41,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:ow,diagram:e}},"loader"),S4={id:ow,detector:v4,loader:C4},lw="pie",_4=x(e=>/^\s*pie/.test(e),"detector"),T4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-DqZw-HeQ.js");return{diagram:t}},__vite__mapDeps([42,34,36,8,7,2,4,5,43,44,39,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:lw,diagram:e}},"loader"),E4={id:lw,detector:_4,loader:T4},cw="quadrantChart",A4=x(e=>/^\s*quadrantChart/.test(e),"detector"),M4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-CfjEkg6d.js");return{diagram:t}},__vite__mapDeps([45,38,39,40,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:cw,diagram:e}},"loader"),N4={id:cw,detector:A4,loader:M4},L4=N4,uw="xychart",I4=x(e=>/^\s*xychart(-beta)?/.test(e),"detector"),$4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-Bk3p1DGz.js");return{diagram:t}},__vite__mapDeps([46,39,44,38,40,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:uw,diagram:e}},"loader"),j4={id:uw,detector:I4,loader:$4},B4=j4,hw="requirement",D4=x(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),P4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-CEbDefgn.js");return{diagram:t}},__vite__mapDeps([47,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:hw,diagram:e}},"loader"),R4={id:hw,detector:D4,loader:P4},F4=R4,dw="sequence",O4=x(e=>/^\s*sequenceDiagram/.test(e),"detector"),z4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-BmjWQ4oi.js");return{diagram:t}},__vite__mapDeps([48,26,35,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:dw,diagram:e}},"loader"),W4={id:dw,detector:O4,loader:z4},H4=W4,fw="class",q4=x((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),U4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-DWylXt6j.js");return{diagram:t}},__vite__mapDeps([49,50,28,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:fw,diagram:e}},"loader"),V4={id:fw,detector:q4,loader:U4},G4=V4,pw="classDiagram",Y4=x((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),X4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-DWylXt6j.js");return{diagram:t}},__vite__mapDeps([51,50,28,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:pw,diagram:e}},"loader"),K4={id:pw,detector:Y4,loader:X4},Q4=K4,gw="state",Z4=x((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),J4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-C7lI7uz2.js");return{diagram:t}},__vite__mapDeps([52,53,29,30,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:gw,diagram:e}},"loader"),eR={id:gw,detector:Z4,loader:J4},tR=eR,mw="stateDiagram",rR=x((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),nR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-C8Eo5YFb.js");return{diagram:t}},__vite__mapDeps([54,53,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:mw,diagram:e}},"loader"),iR={id:mw,detector:rR,loader:nR},sR=iR,xw="journey",aR=x(e=>/^\s*journey/.test(e),"detector"),oR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-XnBAE0k9.js");return{diagram:t}},__vite__mapDeps([55,26,28,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:xw,diagram:e}},"loader"),lR={id:xw,detector:aR,loader:oR},cR=lR,uR=x((e,t,r)=>{K.debug(`rendering svg for syntax error
378
- `);const n=qI(t),i=n.append("g");n.attr("viewBox","0 0 2412 512"),qm(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),yw={draw:uR},hR=yw,dR={db:{},renderer:yw,parser:{parse:x(()=>{},"parse")}},fR=dR,bw="flowchart-elk",pR=x((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),gR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-BsIXhV1w.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:bw,diagram:e}},"loader"),mR={id:bw,detector:pR,loader:gR},xR=mR,kw="timeline",yR=x(e=>/^\s*timeline/.test(e),"detector"),bR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-BltidY3A.js");return{diagram:t}},__vite__mapDeps([56,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:kw,diagram:e}},"loader"),kR={id:kw,detector:yR,loader:bR},wR=kR,ww="mindmap",vR=x(e=>/^\s*mindmap/.test(e),"detector"),CR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-D8LYlQnr.js");return{diagram:t}},__vite__mapDeps([57,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:ww,diagram:e}},"loader"),SR={id:ww,detector:vR,loader:CR},_R=SR,vw="kanban",TR=x(e=>/^\s*kanban/.test(e),"detector"),ER=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-DY1J_CQA.js");return{diagram:t}},__vite__mapDeps([58,28,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:vw,diagram:e}},"loader"),AR={id:vw,detector:TR,loader:ER},MR=AR,Cw="sankey",NR=x(e=>/^\s*sankey(-beta)?/.test(e),"detector"),LR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-DOU4OJks.js");return{diagram:t}},__vite__mapDeps([59,44,39,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Cw,diagram:e}},"loader"),IR={id:Cw,detector:NR,loader:LR},$R=IR,Sw="packet",jR=x(e=>/^\s*packet(-beta)?/.test(e),"detector"),BR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-UbEZAQ1u.js");return{diagram:t}},__vite__mapDeps([60,34,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Sw,diagram:e}},"loader"),DR={id:Sw,detector:jR,loader:BR},_w="radar",PR=x(e=>/^\s*radar-beta/.test(e),"detector"),RR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-DscZmfZJ.js");return{diagram:t}},__vite__mapDeps([61,34,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:_w,diagram:e}},"loader"),FR={id:_w,detector:PR,loader:RR},Tw="block",OR=x(e=>/^\s*block(-beta)?/.test(e),"detector"),zR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-Ax8FYBYm.js");return{diagram:t}},__vite__mapDeps([62,28,5,2,1,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Tw,diagram:e}},"loader"),WR={id:Tw,detector:OR,loader:zR},HR=WR,Ew="architecture",qR=x(e=>/^\s*architecture/.test(e),"detector"),UR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-7Ky7pc6T.js");return{diagram:t}},__vite__mapDeps([63,34,36,8,7,2,4,5,24,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Ew,diagram:e}},"loader"),VR={id:Ew,detector:qR,loader:UR},GR=VR,Aw="treemap",YR=x(e=>/^\s*treemap/.test(e),"detector"),XR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-DpQfOKt-.js");return{diagram:t}},__vite__mapDeps([64,30,34,36,8,7,2,4,5,40,44,39,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Aw,diagram:e}},"loader"),KR={id:Aw,detector:YR,loader:XR},Pp=!1,dl=x(()=>{Pp||(Pp=!0,eo("error",fR,e=>e.toLowerCase().trim()==="error"),eo("---",{db:{clear:x(()=>{},"clear")},styles:{},renderer:{draw:x(()=>{},"draw")},parser:{parse:x(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:x(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Tc(xR,_R,GR),Tc(t4,MR,Q4,G4,f4,w4,S4,E4,F4,H4,c4,s4,wR,x4,sR,tR,cR,L4,$R,DR,B4,HR,FR,KR))},"addDiagrams"),QR=x(async()=>{K.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Mn).map(async([r,{detector:n,loader:i}])=>{if(i)try{Nc(r)}catch{try{const{diagram:s,id:a}=await i();eo(a,s,n)}catch(s){throw K.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Mn[r],s}}}))).filter(r=>r.status==="rejected");if(t.length>0){K.error(`Failed to load ${t.length} external diagrams`);for(const r of t)K.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),ZR="graphics-document document";function Mw(e,t){e.attr("role",ZR),t!==""&&e.attr("aria-roledescription",t)}x(Mw,"setA11yDiagramInfo");function Nw(e,t,r,n){if(e.insert!==void 0){if(r){const i=`chart-desc-${n}`;e.attr("aria-describedby",i),e.insert("desc",":first-child").attr("id",i).text(r)}if(t){const i=`chart-title-${n}`;e.attr("aria-labelledby",i),e.insert("title",":first-child").attr("id",i).text(t)}}}x(Nw,"addSVGa11yTitleDescription");var Tn,ku=(Tn=class{constructor(t,r,n,i,s){this.type=t,this.text=r,this.db=n,this.parser=i,this.renderer=s}static async fromText(t,r={}){const n=At(),i=Qu(t,n);t=KD(t)+`
377
+ L0,20`)},"requirement_arrow"),mP=x((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),xP={extension:rP,composition:nP,aggregation:iP,dependency:sP,lollipop:aP,point:oP,circle:lP,cross:cP,barb:uP,only_one:hP,zero_or_one:dP,one_or_more:fP,zero_or_more:pP,requirement_arrow:gP,requirement_contains:mP},yP=tP,bP={common:Ti,getConfig:At,insertCluster:E5,insertEdge:eP,insertEdgeLabel:Y5,insertMarkers:yP,insertNode:qk,interpolateToCurve:Ah,labelHelper:ye,log:K,positionEdgeLabel:X5},js={},Yk=x(e=>{for(const t of e)js[t.name]=t},"registerLayoutLoaders"),kP=x(()=>{Yk([{name:"dagre",loader:x(async()=>await Oe(()=>import("./dagre-6UL2VRFP-BGaPpMOL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),"loader")},{name:"cose-bilkent",loader:x(async()=>await Oe(()=>import("./cose-bilkent-S5V4N54A-D4tCdQ5W.js"),__vite__mapDeps([23,24,7,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])),"loader")}])},"registerDefaultLayoutLoaders");kP();var R6=x(async(e,t)=>{if(!(e.layoutAlgorithm in js))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=js[e.layoutAlgorithm];return(await r.loader()).render(e,t,bP,{algorithm:r.algorithm})},"render"),F6=x((e="",{fallback:t="dagre"}={})=>{if(e in js)return e;if(t in js)return K.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Xk="comm",Kk="rule",Qk="decl",wP="@import",vP="@namespace",CP="@keyframes",SP="@layer",Zk=Math.abs,Yh=String.fromCharCode;function Jk(e){return e.trim()}function za(e,t,r){return e.replace(t,r)}function _P(e,t,r){return e.indexOf(t,r)}function ii(e,t){return e.charCodeAt(t)|0}function vi(e,t,r){return e.slice(t,r)}function wr(e){return e.length}function TP(e){return e.length}function va(e,t){return t.push(e),e}var ul=1,Ci=1,ew=0,ar=0,lt=0,Li="";function Xh(e,t,r,n,i,s,a,o){return{value:e,root:t,parent:r,type:n,props:i,children:s,line:ul,column:Ci,length:a,return:"",siblings:o}}function EP(){return lt}function AP(){return lt=ar>0?ii(Li,--ar):0,Ci--,lt===10&&(Ci=1,ul--),lt}function pr(){return lt=ar<ew?ii(Li,ar++):0,Ci++,lt===10&&(Ci=1,ul++),lt}function Qr(){return ii(Li,ar)}function Wa(){return ar}function hl(e,t){return vi(Li,e,t)}function Bs(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function MP(e){return ul=Ci=1,ew=wr(Li=e),ar=0,[]}function NP(e){return Li="",e}function rc(e){return Jk(hl(ar-1,pu(e===91?e+2:e===40?e+1:e)))}function LP(e){for(;(lt=Qr())&&lt<33;)pr();return Bs(e)>2||Bs(lt)>3?"":" "}function IP(e,t){for(;--t&&pr()&&!(lt<48||lt>102||lt>57&&lt<65||lt>70&&lt<97););return hl(e,Wa()+(t<6&&Qr()==32&&pr()==32))}function pu(e){for(;pr();)switch(lt){case e:return ar;case 34:case 39:e!==34&&e!==39&&pu(lt);break;case 40:e===41&&pu(e);break;case 92:pr();break}return ar}function $P(e,t){for(;pr()&&e+lt!==57;)if(e+lt===84&&Qr()===47)break;return"/*"+hl(t,ar-1)+"*"+Yh(e===47?e:pr())}function jP(e){for(;!Bs(Qr());)pr();return hl(e,ar)}function BP(e){return NP(Ha("",null,null,null,[""],e=MP(e),0,[0],e))}function Ha(e,t,r,n,i,s,a,o,l){for(var c=0,u=0,h=a,d=0,f=0,g=0,m=1,b=1,y=1,k=0,v="",S=i,C=s,w=n,T=v;b;)switch(g=k,k=pr()){case 40:if(g!=108&&ii(T,h-1)==58){_P(T+=za(rc(k),"&","&\f"),"&\f",Zk(c?o[c-1]:0))!=-1&&(y=-1);break}case 34:case 39:case 91:T+=rc(k);break;case 9:case 10:case 13:case 32:T+=LP(g);break;case 92:T+=IP(Wa()-1,7);continue;case 47:switch(Qr()){case 42:case 47:va(DP($P(pr(),Wa()),t,r,l),l),(Bs(g||1)==5||Bs(Qr()||1)==5)&&wr(T)&&vi(T,-1,void 0)!==" "&&(T+=" ");break;default:T+="/"}break;case 123*m:o[c++]=wr(T)*y;case 125*m:case 59:case 0:switch(k){case 0:case 125:b=0;case 59+u:y==-1&&(T=za(T,/\f/g,"")),f>0&&(wr(T)-h||m===0&&g===47)&&va(f>32?Np(T+";",n,r,h-1,l):Np(za(T," ","")+";",n,r,h-2,l),l);break;case 59:T+=";";default:if(va(w=Mp(T,t,r,c,u,i,o,v,S=[],C=[],h,s),s),k===123)if(u===0)Ha(T,t,w,w,S,s,h,o,C);else{switch(d){case 99:if(ii(T,3)===110)break;case 108:if(ii(T,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Ha(e,w,w,n&&va(Mp(e,w,w,0,0,i,o,v,i,S=[],h,C),C),i,C,h,o,n?S:C):Ha(T,w,w,w,[""],C,0,o,C)}}c=u=f=0,m=y=1,v=T="",h=a;break;case 58:h=1+wr(T),f=g;default:if(m<1){if(k==123)--m;else if(k==125&&m++==0&&AP()==125)continue}switch(T+=Yh(k),k*m){case 38:y=u>0?1:(T+="\f",-1);break;case 44:o[c++]=(wr(T)-1)*y,y=1;break;case 64:Qr()===45&&(T+=rc(pr())),d=Qr(),u=h=wr(v=T+=jP(Wa())),k++;break;case 45:g===45&&wr(T)==2&&(m=0)}}return s}function Mp(e,t,r,n,i,s,a,o,l,c,u,h){for(var d=i-1,f=i===0?s:[""],g=TP(f),m=0,b=0,y=0;m<n;++m)for(var k=0,v=vi(e,d+1,d=Zk(b=a[m])),S=e;k<g;++k)(S=Jk(b>0?f[k]+" "+v:za(v,/&\f/g,f[k])))&&(l[y++]=S);return Xh(e,t,r,i===0?Kk:o,l,c,u,h)}function DP(e,t,r,n){return Xh(e,t,r,Xk,Yh(EP()),vi(e,2,-2),0,n)}function Np(e,t,r,n,i){return Xh(e,t,r,Qk,vi(e,0,n),vi(e,n+1,-1),n,i)}function gu(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function PP(e,t,r,n){switch(e.type){case SP:if(e.children.length)break;case wP:case vP:case Qk:return e.return=e.return||e.value;case Xk:return"";case CP:return e.return=e.value+"{"+gu(e.children,n)+"}";case Kk:if(!wr(e.value=e.props.join(",")))return""}return wr(r=gu(e.children,n))?e.return=e.value+"{"+r+"}":""}var RP=Ty(Object.keys,Object),FP=Object.prototype,OP=FP.hasOwnProperty;function zP(e){if(!el(e))return RP(e);var t=[];for(var r in Object(e))OP.call(e,r)&&r!="constructor"&&t.push(r);return t}var mu=Fn(Ar,"DataView"),xu=Fn(Ar,"Promise"),yu=Fn(Ar,"Set"),bu=Fn(Ar,"WeakMap"),Lp="[object Map]",WP="[object Object]",Ip="[object Promise]",$p="[object Set]",jp="[object WeakMap]",Bp="[object DataView]",HP=Rn(mu),qP=Rn(Is),UP=Rn(xu),VP=Rn(yu),GP=Rn(bu),bn=Ai;(mu&&bn(new mu(new ArrayBuffer(1)))!=Bp||Is&&bn(new Is)!=Lp||xu&&bn(xu.resolve())!=Ip||yu&&bn(new yu)!=$p||bu&&bn(new bu)!=jp)&&(bn=function(e){var t=Ai(e),r=t==WP?e.constructor:void 0,n=r?Rn(r):"";if(n)switch(n){case HP:return Bp;case qP:return Lp;case UP:return Ip;case VP:return $p;case GP:return jp}return t});var YP="[object Map]",XP="[object Set]",KP=Object.prototype,QP=KP.hasOwnProperty;function Dp(e){if(e==null)return!0;if(tl(e)&&(wo(e)||typeof e=="string"||typeof e.splice=="function"||Th(e)||Eh(e)||ko(e)))return!e.length;var t=bn(e);if(t==YP||t==XP)return!e.size;if(el(e))return!zP(e).length;for(var r in e)if(QP.call(e,r))return!1;return!0}var tw="c4",ZP=x(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),JP=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-Dcw9Cs9G.js");return{diagram:t}},__vite__mapDeps([25,26,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:tw,diagram:e}},"loader"),e4={id:tw,detector:ZP,loader:JP},t4=e4,rw="flowchart",r4=x((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),n4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-CXavqXYu.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:rw,diagram:e}},"loader"),i4={id:rw,detector:r4,loader:n4},s4=i4,nw="flowchart-v2",a4=x((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),o4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-CXavqXYu.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:nw,diagram:e}},"loader"),l4={id:nw,detector:a4,loader:o4},c4=l4,iw="er",u4=x(e=>/^\s*erDiagram/.test(e),"detector"),h4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-CgK8jP0L.js");return{diagram:t}},__vite__mapDeps([32,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:iw,diagram:e}},"loader"),d4={id:iw,detector:u4,loader:h4},f4=d4,sw="gitGraph",p4=x(e=>/^\s*gitGraph/.test(e),"detector"),g4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-BHeHA2_6.js");return{diagram:t}},__vite__mapDeps([33,34,35,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:sw,diagram:e}},"loader"),m4={id:sw,detector:p4,loader:g4},x4=m4,aw="gantt",y4=x(e=>/^\s*gantt/.test(e),"detector"),b4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./ganttDiagram-LVOFAZNH-DdA4uXow.js");return{diagram:t}},__vite__mapDeps([37,7,38,39,40,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:aw,diagram:e}},"loader"),k4={id:aw,detector:y4,loader:b4},w4=k4,ow="info",v4=x(e=>/^\s*info/.test(e),"detector"),C4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./infoDiagram-F6ZHWCRC-Cefi13nY.js");return{diagram:t}},__vite__mapDeps([41,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:ow,diagram:e}},"loader"),S4={id:ow,detector:v4,loader:C4},lw="pie",_4=x(e=>/^\s*pie/.test(e),"detector"),T4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-Dgv5DD0S.js");return{diagram:t}},__vite__mapDeps([42,34,36,8,7,2,4,5,43,44,39,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:lw,diagram:e}},"loader"),E4={id:lw,detector:_4,loader:T4},cw="quadrantChart",A4=x(e=>/^\s*quadrantChart/.test(e),"detector"),M4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-BDAI4LQZ.js");return{diagram:t}},__vite__mapDeps([45,38,39,40,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:cw,diagram:e}},"loader"),N4={id:cw,detector:A4,loader:M4},L4=N4,uw="xychart",I4=x(e=>/^\s*xychart(-beta)?/.test(e),"detector"),$4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-C2ylYAJK.js");return{diagram:t}},__vite__mapDeps([46,39,44,38,40,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:uw,diagram:e}},"loader"),j4={id:uw,detector:I4,loader:$4},B4=j4,hw="requirement",D4=x(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),P4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-BtlBBsGB.js");return{diagram:t}},__vite__mapDeps([47,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:hw,diagram:e}},"loader"),R4={id:hw,detector:D4,loader:P4},F4=R4,dw="sequence",O4=x(e=>/^\s*sequenceDiagram/.test(e),"detector"),z4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-Zxi4nOIv.js");return{diagram:t}},__vite__mapDeps([48,26,35,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:dw,diagram:e}},"loader"),W4={id:dw,detector:O4,loader:z4},H4=W4,fw="class",q4=x((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),U4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-Ivmc_BXS.js");return{diagram:t}},__vite__mapDeps([49,50,28,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:fw,diagram:e}},"loader"),V4={id:fw,detector:q4,loader:U4},G4=V4,pw="classDiagram",Y4=x((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),X4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-Ivmc_BXS.js");return{diagram:t}},__vite__mapDeps([51,50,28,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:pw,diagram:e}},"loader"),K4={id:pw,detector:Y4,loader:X4},Q4=K4,gw="state",Z4=x((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),J4=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-XoPlf0Vy.js");return{diagram:t}},__vite__mapDeps([52,53,29,30,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:gw,diagram:e}},"loader"),eR={id:gw,detector:Z4,loader:J4},tR=eR,mw="stateDiagram",rR=x((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),nR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-r4Duovdx.js");return{diagram:t}},__vite__mapDeps([54,53,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:mw,diagram:e}},"loader"),iR={id:mw,detector:rR,loader:nR},sR=iR,xw="journey",aR=x(e=>/^\s*journey/.test(e),"detector"),oR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-CAfRMHa8.js");return{diagram:t}},__vite__mapDeps([55,26,28,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:xw,diagram:e}},"loader"),lR={id:xw,detector:aR,loader:oR},cR=lR,uR=x((e,t,r)=>{K.debug(`rendering svg for syntax error
378
+ `);const n=qI(t),i=n.append("g");n.attr("viewBox","0 0 2412 512"),qm(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),yw={draw:uR},hR=yw,dR={db:{},renderer:yw,parser:{parse:x(()=>{},"parse")}},fR=dR,bw="flowchart-elk",pR=x((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),gR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-CXavqXYu.js");return{diagram:t}},__vite__mapDeps([27,28,29,30,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:bw,diagram:e}},"loader"),mR={id:bw,detector:pR,loader:gR},xR=mR,kw="timeline",yR=x(e=>/^\s*timeline/.test(e),"detector"),bR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-UHDY1Jjf.js");return{diagram:t}},__vite__mapDeps([56,43,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:kw,diagram:e}},"loader"),kR={id:kw,detector:yR,loader:bR},wR=kR,ww="mindmap",vR=x(e=>/^\s*mindmap/.test(e),"detector"),CR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-BIt3RkSU.js");return{diagram:t}},__vite__mapDeps([57,29,30,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:ww,diagram:e}},"loader"),SR={id:ww,detector:vR,loader:CR},_R=SR,vw="kanban",TR=x(e=>/^\s*kanban/.test(e),"detector"),ER=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-DW5IlHJE.js");return{diagram:t}},__vite__mapDeps([58,28,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:vw,diagram:e}},"loader"),AR={id:vw,detector:TR,loader:ER},MR=AR,Cw="sankey",NR=x(e=>/^\s*sankey(-beta)?/.test(e),"detector"),LR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-C5CTA-m2.js");return{diagram:t}},__vite__mapDeps([59,44,39,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Cw,diagram:e}},"loader"),IR={id:Cw,detector:NR,loader:LR},$R=IR,Sw="packet",jR=x(e=>/^\s*packet(-beta)?/.test(e),"detector"),BR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-J_VMf6C2.js");return{diagram:t}},__vite__mapDeps([60,34,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Sw,diagram:e}},"loader"),DR={id:Sw,detector:jR,loader:BR},_w="radar",PR=x(e=>/^\s*radar-beta/.test(e),"detector"),RR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-W49QXse-.js");return{diagram:t}},__vite__mapDeps([61,34,36,8,7,2,4,5,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:_w,diagram:e}},"loader"),FR={id:_w,detector:PR,loader:RR},Tw="block",OR=x(e=>/^\s*block(-beta)?/.test(e),"detector"),zR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-DnsJI7gJ.js");return{diagram:t}},__vite__mapDeps([62,28,5,2,1,31,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Tw,diagram:e}},"loader"),WR={id:Tw,detector:OR,loader:zR},HR=WR,Ew="architecture",qR=x(e=>/^\s*architecture/.test(e),"detector"),UR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-DrSsIdf2.js");return{diagram:t}},__vite__mapDeps([63,34,36,8,7,2,4,5,24,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Ew,diagram:e}},"loader"),VR={id:Ew,detector:qR,loader:UR},GR=VR,Aw="treemap",YR=x(e=>/^\s*treemap/.test(e),"detector"),XR=x(async()=>{const{diagram:e}=await Oe(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-B5MJHcOR.js");return{diagram:t}},__vite__mapDeps([64,30,34,36,8,7,2,4,5,40,44,39,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22]));return{id:Aw,diagram:e}},"loader"),KR={id:Aw,detector:YR,loader:XR},Pp=!1,dl=x(()=>{Pp||(Pp=!0,eo("error",fR,e=>e.toLowerCase().trim()==="error"),eo("---",{db:{clear:x(()=>{},"clear")},styles:{},renderer:{draw:x(()=>{},"draw")},parser:{parse:x(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:x(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Tc(xR,_R,GR),Tc(t4,MR,Q4,G4,f4,w4,S4,E4,F4,H4,c4,s4,wR,x4,sR,tR,cR,L4,$R,DR,B4,HR,FR,KR))},"addDiagrams"),QR=x(async()=>{K.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Mn).map(async([r,{detector:n,loader:i}])=>{if(i)try{Nc(r)}catch{try{const{diagram:s,id:a}=await i();eo(a,s,n)}catch(s){throw K.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Mn[r],s}}}))).filter(r=>r.status==="rejected");if(t.length>0){K.error(`Failed to load ${t.length} external diagrams`);for(const r of t)K.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),ZR="graphics-document document";function Mw(e,t){e.attr("role",ZR),t!==""&&e.attr("aria-roledescription",t)}x(Mw,"setA11yDiagramInfo");function Nw(e,t,r,n){if(e.insert!==void 0){if(r){const i=`chart-desc-${n}`;e.attr("aria-describedby",i),e.insert("desc",":first-child").attr("id",i).text(r)}if(t){const i=`chart-title-${n}`;e.attr("aria-labelledby",i),e.insert("title",":first-child").attr("id",i).text(t)}}}x(Nw,"addSVGa11yTitleDescription");var Tn,ku=(Tn=class{constructor(t,r,n,i,s){this.type=t,this.text=r,this.db=n,this.parser=i,this.renderer=s}static async fromText(t,r={}){const n=At(),i=Qu(t,n);t=KD(t)+`
379
379
  `;try{Nc(i)}catch{const c=kA(i);if(!c)throw new Im(`Diagram ${i} not found.`);const{id:u,diagram:h}=await c();eo(u,h)}const{db:s,parser:a,renderer:o,init:l}=Nc(i);return a.parser&&(a.parser.yy=s),s.clear?.(),l?.(n),r.title&&s.setDiagramTitle?.(r.title),await a.parse(t),new Tn(i,t,s,a,o)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},x(Tn,"Diagram"),Tn),Rp=[],JR=x(()=>{Rp.forEach(e=>{e()}),Rp=[]},"attachFunctions"),eF=x(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Lw(e){const t=e.match(Lm);if(!t)return{text:e,metadata:{}};let r=Q$(t[1],{schema:K$})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:e.slice(t[0].length),metadata:n}}x(Lw,"extractFrontMatter");var tF=x(e=>e.replace(/\r\n?/g,`
380
380
  `).replace(/<(\w+)([^>]*)>/g,(t,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),rF=x(e=>{const{text:t,metadata:r}=Lw(e),{displayMode:n,title:i,config:s={}}=r;return n&&(s.gantt||(s.gantt={}),s.gantt.displayMode=n),{title:i,config:s,text:t}},"processFrontmatter"),nF=x(e=>{const t=hr.detectInit(e)??{},r=hr.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:n})=>n==="wrap"):r?.type==="wrap"&&(t.wrap=!0),{text:PD(e),directive:t}},"processDirectives");function Kh(e){const t=tF(e),r=rF(t),n=nF(r.text),i=$h(r.config,n.directive);return e=eF(n.text),{code:e,title:r.title,config:i}}x(Kh,"preprocessDiagram");function Iw(e){const t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(r)}x(Iw,"toBase64");var iF=5e4,sF="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",aF="sandbox",oF="loose",lF="http://www.w3.org/2000/svg",cF="http://www.w3.org/1999/xlink",uF="http://www.w3.org/1999/xhtml",hF="100%",dF="100%",fF="border:0;margin:0;",pF="margin:0",gF="allow-top-navigation-by-user-activation allow-popups",mF='The "iframe" tag is not supported by your browser.',xF=["foreignobject"],yF=["dominant-baseline"];function Qh(e){const t=Kh(e);return Za(),DA(t.config??{}),t}x(Qh,"processAndSetConfigs");async function $w(e,t){dl();try{const{code:r,config:n}=Qh(e);return{diagramType:(await Bw(r)).type,config:n}}catch(r){if(t?.suppressErrors)return!1;throw r}}x($w,"parse");var Fp=x((e,t,r=[])=>`
381
381
  .${e} ${t} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),bF=x((e,t=new Map)=>{let r="";if(e.themeCSS!==void 0&&(r+=`
@@ -1 +1 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{T as P,a as D,b as j,c as m,d as B,e as x}from"./table-F592JIUY.js";import{u as L,a as R}from"./useCommands-B0s3JzZs.js";import{C as q}from"./CommandForm-C8RL-p7h.js";import{f as N}from"./dateFormat-CXa8VnEC.js";import{b as z}from"./index-D9bAK8SN.js";import{T as f}from"./ToolsList-Ci2lqPin.js";import{u as J}from"./tools-C0JOzoE_.js";import{j as v,g as G,v as I,o as k,m as w,J as C,y as $,E as K}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";import"./UnifiedToolSelector-CKjY_qjS.js";const re=()=>{const{t}=J("pages"),{isMobile:a}=z(),[d]=i.useState({scope:"user"}),[n,T]=i.useState(""),[S,r]=i.useState(!1),[F,l]=i.useState(null),[g,o]=i.useState(null),[u,b]=i.useState({}),{data:A=[],isLoading:M,error:E,refetch:y}=L({...d,search:n.trim()||void 0}),h=R(),H=async s=>{try{await h.mutateAsync(s.id),o(null)}catch(c){console.error("Failed to delete command:",c)}},p=A.filter(s=>!(d.scope&&d.scope!=="all"&&s.scope!==d.scope||d.namespace&&s.namespace!==d.namespace));return M?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-blue-500 mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:t("commands.loading")})]})}):E?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(v,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),e.jsx("p",{className:"text-red-600 text-lg mb-2",children:t("commands.error.loadFailed")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:t("commands.error.cannotLoadCommands")}),e.jsx("button",{onClick:()=>y(),className:"bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg transition-colors",children:t("commands.error.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:`${a?"mb-4":"flex items-center justify-between mb-6"}`,children:e.jsxs("div",{children:[e.jsx("h1",{className:`${a?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:t("commands.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mt-1":"mt-2"}`,children:t("commands.subtitle")})]})}),e.jsxs("div",{className:`${a?"space-y-3":"flex items-center space-x-4"}`,children:[e.jsxs("div",{className:`${a?"":"flex-1"} relative`,children:[e.jsx(G,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:t("commands.searchPlaceholder"),value:n,onChange:s=>T(s.target.value),className:`pl-10 pr-4 ${a?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${a?"text-sm":""}`})]}),e.jsxs("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-2.5 px-4":"flex items-center space-x-2 px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors ${a?"text-sm":""}`,children:[e.jsx(I,{className:`${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:t("commands.createButton")})]})]})]}),p.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:`${a?"text-4xl":"text-6xl"} mb-4`,children:"⚡"}),e.jsx("h3",{className:`${a?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:t(n?"commands.empty.noMatchingCommands":"commands.empty.noCommands")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:t(n?"commands.empty.adjustSearch":"commands.empty.createFirst")}),!n&&e.jsx("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-3 px-4":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:t("commands.createButton")})]}):e.jsx(e.Fragment,{children:a?e.jsx("div",{className:"space-y-4",children:p.map((s,c)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`${a?"text-lg":"text-xl"} mr-3`,children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:`${a?"text-sm":"text-base"} font-medium text-gray-900 dark:text-white`,children:[s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`,s.argumentHint&&e.jsx("code",{className:"ml-2 bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:s.description})]})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.model"),":"]}),s.model?e.jsxs("div",{className:"flex items-center text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-sm",children:s.model})]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})]}),e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2 mt-1",children:[t("commands.table.tools"),":"]}),e.jsx("div",{className:"flex-1",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!0,emptyMessage:t("commands.table.inheritSettings")})})]})}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.createdAt"),":"]}),e.jsxs("div",{className:"flex items-center text-gray-500 dark:text-gray-400",children:[e.jsx(w,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end space-x-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})]},s.id+"-"+c))}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(P,{children:[e.jsx(D,{children:e.jsxs(j,{children:[e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.command")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.model")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.tools")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.createdAt")}),e.jsx(m,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.actions")})]})}),e.jsx(B,{children:p.map((s,c)=>e.jsxs(j,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(x,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${s.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:s.source==="plugin"?t("commands.source.plugin"):t("commands.source.local")}),s.argumentHint&&e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs mt-1",children:s.description})]})]})}),e.jsx(x,{className:"px-6 py-4",children:s.model?e.jsxs("div",{className:"text-sm text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 inline mr-1"}),s.model]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!1,emptyMessage:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(w,{className:"w-4 h-4"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.source==="plugin"?e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:t("commands.actions.view"),children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),t("commands.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:t("commands.actions.editCommand"),children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})})})]},s.id+"-"+c))})]})})}),S&&e.jsx(q,{command:F,onClose:()=>{r(!1),l(null)},onSuccess:()=>{r(!1),l(null),y()}}),g&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl ${a?"w-full max-w-sm":"max-w-md w-full mx-4"} p-6`,children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(v,{className:`${a?"h-5 w-5":"h-6 w-6"} text-red-600`})}),e.jsx("div",{className:"flex-1",children:e.jsx("h3",{className:`${a?"text-base":"text-lg"} font-medium text-gray-900 dark:text-white`,children:t("commands.delete.title")})})]}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mb-4 text-sm":"mb-6"}`,children:t("commands.delete.confirmMessage",{name:g.name})}),e.jsxs("div",{className:`${a?"grid grid-cols-2 gap-2":"flex justify-end space-x-3"}`,children:[e.jsx("button",{onClick:()=>o(null),className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg transition-colors`,children:t("commands.delete.cancel")}),e.jsx("button",{onClick:()=>H(g),disabled:h.isPending,className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors disabled:opacity-50`,children:h.isPending?t("commands.delete.deleting"):t("commands.delete.delete")})]})]})})]})};export{re as CommandsPage};
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{T as P,a as D,b as j,c as m,d as B,e as x}from"./table-BWrnBcPF.js";import{u as L,a as R}from"./useCommands-B0s3JzZs.js";import{C as q}from"./CommandForm-C8RL-p7h.js";import{f as N}from"./dateFormat-CXa8VnEC.js";import{b as z}from"./index-UPEozv-J.js";import{T as f}from"./ToolsList-Ci2lqPin.js";import{u as J}from"./tools-C0JOzoE_.js";import{j as v,g as G,v as I,o as k,m as w,J as C,y as $,E as K}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";import"./UnifiedToolSelector-CKjY_qjS.js";const re=()=>{const{t}=J("pages"),{isMobile:a}=z(),[d]=i.useState({scope:"user"}),[n,T]=i.useState(""),[S,r]=i.useState(!1),[F,l]=i.useState(null),[g,o]=i.useState(null),[u,b]=i.useState({}),{data:A=[],isLoading:M,error:E,refetch:y}=L({...d,search:n.trim()||void 0}),h=R(),H=async s=>{try{await h.mutateAsync(s.id),o(null)}catch(c){console.error("Failed to delete command:",c)}},p=A.filter(s=>!(d.scope&&d.scope!=="all"&&s.scope!==d.scope||d.namespace&&s.namespace!==d.namespace));return M?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-blue-500 mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:t("commands.loading")})]})}):E?e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(v,{className:"h-16 w-16 text-red-500 mx-auto mb-4"}),e.jsx("p",{className:"text-red-600 text-lg mb-2",children:t("commands.error.loadFailed")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:t("commands.error.cannotLoadCommands")}),e.jsx("button",{onClick:()=>y(),className:"bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg transition-colors",children:t("commands.error.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:`${a?"mb-4":"flex items-center justify-between mb-6"}`,children:e.jsxs("div",{children:[e.jsx("h1",{className:`${a?"text-2xl":"text-3xl"} font-bold text-gray-900 dark:text-white`,children:t("commands.title")}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mt-1":"mt-2"}`,children:t("commands.subtitle")})]})}),e.jsxs("div",{className:`${a?"space-y-3":"flex items-center space-x-4"}`,children:[e.jsxs("div",{className:`${a?"":"flex-1"} relative`,children:[e.jsx(G,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 ${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("input",{type:"text",placeholder:t("commands.searchPlaceholder"),value:n,onChange:s=>T(s.target.value),className:`pl-10 pr-4 ${a?"py-2":"py-3"} w-full border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white ${a?"text-sm":""}`})]}),e.jsxs("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-2.5 px-4":"flex items-center space-x-2 px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors ${a?"text-sm":""}`,children:[e.jsx(I,{className:`${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:t("commands.createButton")})]})]})]}),p.length===0?e.jsxs("div",{className:"text-center py-16 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:`${a?"text-4xl":"text-6xl"} mb-4`,children:"⚡"}),e.jsx("h3",{className:`${a?"text-lg":"text-xl"} font-medium text-gray-900 dark:text-white mb-2`,children:t(n?"commands.empty.noMatchingCommands":"commands.empty.noCommands")}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:t(n?"commands.empty.adjustSearch":"commands.empty.createFirst")}),!n&&e.jsx("button",{onClick:()=>{l(null),r(!0)},className:`${a?"w-full py-3 px-4":"px-6 py-3"} bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors`,children:t("commands.createButton")})]}):e.jsx(e.Fragment,{children:a?e.jsx("div",{className:"space-y-4",children:p.map((s,c)=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`${a?"text-lg":"text-xl"} mr-3`,children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:`${a?"text-sm":"text-base"} font-medium text-gray-900 dark:text-white`,children:[s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`,s.argumentHint&&e.jsx("code",{className:"ml-2 bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:s.description})]})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.model"),":"]}),s.model?e.jsxs("div",{className:"flex items-center text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-sm",children:s.model})]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})]}),e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2 mt-1",children:[t("commands.table.tools"),":"]}),e.jsx("div",{className:"flex-1",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!0,emptyMessage:t("commands.table.inheritSettings")})})]})}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsxs("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:[t("commands.table.createdAt"),":"]}),e.jsxs("div",{className:"flex items-center text-gray-500 dark:text-gray-400",children:[e.jsx(w,{className:"w-4 h-4 mr-1"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end space-x-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})]},s.id+"-"+c))}):e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsxs(P,{children:[e.jsx(D,{children:e.jsxs(j,{children:[e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.command")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.model")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.tools")}),e.jsx(m,{className:"px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.createdAt")}),e.jsx(m,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider",children:t("commands.table.actions")})]})}),e.jsx(B,{children:p.map((s,c)=>e.jsxs(j,{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors",children:[e.jsx(x,{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"text-xl mr-3",children:"⚡"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:s.namespace?`/${s.namespace}:${s.name}`:`/${s.name}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${s.source==="plugin"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"}`,children:s.source==="plugin"?t("commands.source.plugin"):t("commands.source.local")}),s.argumentHint&&e.jsx("code",{className:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300 px-1.5 py-0.5 rounded text-xs",children:s.argumentHint})]}),s.description&&e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 truncate max-w-xs mt-1",children:s.description})]})]})}),e.jsx(x,{className:"px-6 py-4",children:s.model?e.jsxs("div",{className:"text-sm text-gray-900 dark:text-white",children:[e.jsx(k,{className:"w-3 h-3 inline mr-1"}),s.model]}):e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4",children:e.jsx(f,{tools:s.allowedTools||[],id:s.id,expandedTools:u,setExpandedTools:b,isMobile:!1,emptyMessage:t("commands.table.inheritSettings")})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(w,{className:"w-4 h-4"}),e.jsx("span",{children:N(s.createdAt||s.updatedAt)})]})}),e.jsx(x,{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsx("div",{className:"flex items-center justify-end space-x-2",children:s.source==="plugin"?e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:t("commands.actions.view"),children:[e.jsx(K,{className:"w-3 h-3 mr-1"}),t("commands.actions.view")]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{l(s),r(!0)},className:"inline-flex items-center px-3 py-1.5 text-xs font-medium text-blue-600 bg-blue-50 dark:bg-blue-900/50 rounded-md hover:bg-blue-100 dark:hover:bg-blue-900/70 transition-colors",title:t("commands.actions.editCommand"),children:[e.jsx(C,{className:"w-3 h-3 mr-1"}),t("commands.actions.edit")]}),e.jsx("button",{onClick:()=>o(s),className:"p-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/50 rounded-lg transition-colors",title:t("commands.actions.deleteCommand"),children:e.jsx($,{className:"w-4 h-4"})})]})})})]},s.id+"-"+c))})]})})}),S&&e.jsx(q,{command:F,onClose:()=>{r(!1),l(null)},onSuccess:()=>{r(!1),l(null),y()}}),g&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg shadow-xl ${a?"w-full max-w-sm":"max-w-md w-full mx-4"} p-6`,children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(v,{className:`${a?"h-5 w-5":"h-6 w-6"} text-red-600`})}),e.jsx("div",{className:"flex-1",children:e.jsx("h3",{className:`${a?"text-base":"text-lg"} font-medium text-gray-900 dark:text-white`,children:t("commands.delete.title")})})]}),e.jsx("p",{className:`text-gray-600 dark:text-gray-400 ${a?"mb-4 text-sm":"mb-6"}`,children:t("commands.delete.confirmMessage",{name:g.name})}),e.jsxs("div",{className:`${a?"grid grid-cols-2 gap-2":"flex justify-end space-x-3"}`,children:[e.jsx("button",{onClick:()=>o(null),className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} text-gray-700 dark:text-gray-300 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-lg transition-colors`,children:t("commands.delete.cancel")}),e.jsx("button",{onClick:()=>H(g),disabled:h.isPending,className:`${a?"px-3 py-2.5 text-sm":"px-4 py-2"} bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors disabled:opacity-50`,children:h.isPending?t("commands.delete.deleting"):t("commands.delete.delete")})]})]})})]})};export{re as CommandsPage};
@@ -1 +1 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{u as B}from"./useProjects-DuCnMeYt.js";import{u as O,a as Q}from"./useAgents-Bp5Ry-Dk.js";import{u as _,c as W,a as X}from"./useSessions-EknKfdIv.js";import{u as G}from"./agents-DG431Wop.js";import{u as J,s as x,a as P}from"./index-D9bAK8SN.js";import{u as Y}from"./tools-C0JOzoE_.js";import{p as Z,h as ee,e as ae,o as se,q as re,S as te,f as le,r as de,s as oe,t as ne,u as h,L as b,v as ie,k as ce,w as ue,x as ge,y as me,j as xe,X as he}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";const Ve=()=>{const{t:s}=Y("pages"),A=J(),I=G(),{data:$,isLoading:F}=B(),{data:D}=O(!0),{data:M,refetch:p}=_(),T=Q(),[i,f]=d.useState(""),[t,u]=d.useState(null),[j,g]=d.useState(!1),[y,k]=d.useState(!1),[w,v]=d.useState(!1),[N,C]=d.useState(null),o=$?.projects||[],n=D?.agents||[],c=M?.sessions||[];d.useEffect(()=>{o.length>0&&!t&&u(o[0])},[o,t]);const m=a=>{if(!a)return n[0];if(a.defaultAgent){const r=n.find(l=>l.id===a.defaultAgent);if(r)return r}return n[0]},q=async()=>{const a=n.find(r=>r.id==="claude-code")||n[0];if(a){k(!0);try{const r="default-workspace",l=await T.mutateAsync({agentId:a.id,projectName:r});await I.invalidateQueries({queryKey:["projects"]}),u(l.project),x(s("dashboard.projectCreated.title",{defaultValue:"项目创建成功"}),s("dashboard.projectCreated.message",{defaultValue:"已经为您创建项目:{{name}},你现在可以开始与 Agent 工作了。",name:r}))}catch(r){console.error("Failed to create default project:",r)}finally{k(!1)}}},V=()=>{const a=m(t);if(!i.trim()||!t||!a)return;const r=encodeURIComponent(i),l=`/chat/${a.id}?project=${encodeURIComponent(t.path)}&message=${r}`;window.open(l,"_blank")},E=async a=>{C(a);try{await X(a),await p(),x(s("dashboard.sessions.closed",{defaultValue:"会话已关闭"}),s("dashboard.sessions.closedMessage",{defaultValue:"会话已成功关闭"}))}catch(r){console.error("Failed to close session:",r),P(s("dashboard.sessions.closeFailed",{defaultValue:"关闭失败"}),r instanceof Error?r.message:s("dashboard.sessions.closeError",{defaultValue:"无法关闭会话"}))}finally{C(null)}},L=async()=>{if(c.length!==0){v(!0);try{const a=await W();await p(),x(s("dashboard.sessions.allCleared",{defaultValue:"全部清除"}),s("dashboard.sessions.allClearedMessage",{defaultValue:"已清除 {{count}} 个会话",count:a.clearedCount}))}catch(a){console.error("Failed to clear all sessions:",a),P(s("dashboard.sessions.clearFailed",{defaultValue:"清除失败"}),a instanceof Error?a.message:s("dashboard.sessions.clearError",{defaultValue:"无法清除会话"}))}finally{v(!1)}}},R=[{icon:Z,label:s("dashboard.templates.organizeFiles",{defaultValue:"整理文件"}),prompt:"帮我整理一下当前目录下的文件。请先分析目录结构,然后提出整理方案让我确认,最后再执行。"},{icon:ee,label:s("dashboard.templates.analyzeFiles",{defaultValue:"文件分析"}),prompt:"帮我分析一下当前项目的文件结构和代码情况,给出概要报告。"},{icon:ae,label:s("dashboard.templates.writeDoc",{defaultValue:"写一份文档"}),prompt:"帮我为这个项目写一份 README 文档,包含项目介绍、安装步骤和使用说明。"},{icon:se,label:s("dashboard.templates.codeReview",{defaultValue:"代码审查"}),prompt:"帮我审查一下这个项目的代码质量,包括代码风格、潜在问题和改进建议。"},{icon:re,label:s("dashboard.templates.checkWeather",{defaultValue:"查深圳天气"}),prompt:"查一下深圳现在的天气情况。"},{icon:te,label:s("dashboard.templates.quickTask",{defaultValue:"自由提问"}),prompt:""}],z=[{icon:le,label:s("dashboard.quickLinks.projects",{defaultValue:"项目管理"}),path:"/projects",color:"text-blue-500 bg-blue-50 dark:bg-blue-900/30"},{icon:de,label:s("dashboard.quickLinks.modelSettings",{defaultValue:"模型供应商"}),path:"/settings/suppliers",color:"text-purple-500 bg-purple-50 dark:bg-purple-900/30"},{icon:oe,label:s("dashboard.quickLinks.scheduledTasks",{defaultValue:"定时任务"}),path:"/scheduled-tasks",color:"text-green-500 bg-green-50 dark:bg-green-900/30"},{icon:ne,label:s("dashboard.quickLinks.customAgents",{defaultValue:"自定义 Agent"}),path:"/agents",color:"text-orange-500 bg-orange-50 dark:bg-orange-900/30"}],U=a=>{if(a){const r=m(t);if(t&&r){const l=encodeURIComponent(a),S=`/chat/${r.id}?project=${encodeURIComponent(t.path)}&message=${l}`;window.open(S,"_blank")}else f(a)}},H=!F&&o.length===0,K=a=>{const r=Math.floor(a/1e3);if(r<60)return`${r}s`;const l=Math.floor(r/60);return l<60?`${l}m`:`${Math.floor(l/60)}h`};return e.jsx("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-auto",children:e.jsxs("div",{className:"flex-1 flex flex-col items-center px-6 py-8",children:[e.jsx("div",{className:"text-center mb-8",children:e.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 dark:text-white",children:s("dashboard.welcome.title",{defaultValue:"让我们开始工作吧"})})}),e.jsxs("div",{className:"w-full max-w-2xl",children:[H&&e.jsxs("div",{className:"mb-6 p-6 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-2xl text-center",children:[e.jsx(h,{className:"w-12 h-12 text-amber-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-lg font-medium text-amber-800 dark:text-amber-200 mb-2",children:s("dashboard.noProjectsHint.title",{defaultValue:"还没有项目"})}),e.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-300 mb-4",children:s("dashboard.noProjectsHint.description",{defaultValue:"创建一个项目来开始与 AI 协作"})}),e.jsx("button",{onClick:q,disabled:y||n.length===0,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-amber-600 hover:bg-amber-700 disabled:bg-amber-400 text-white rounded-xl font-medium transition-colors",children:y?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:s("dashboard.noProjectsHint.creating",{defaultValue:"创建中..."})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4"}),e.jsx("span",{children:s("dashboard.noProjectsHint.createButton",{defaultValue:"一键创建默认项目"})})]})})]}),e.jsx("div",{className:"mb-6 grid grid-cols-2 md:grid-cols-3 gap-3",children:R.map((a,r)=>e.jsxs("button",{onClick:()=>U(a.prompt),className:"flex items-center gap-3 px-4 py-3.5 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-600/50 hover:border-gray-300 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-700 hover:shadow-md text-left transition-all group",children:[e.jsx("div",{className:"flex-shrink-0 p-2 bg-gray-100 dark:bg-gray-700 rounded-lg",children:e.jsx(a.icon,{className:"w-5 h-5 text-gray-500 dark:text-gray-300"})}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200 group-hover:text-gray-900 dark:group-hover:text-white transition-colors",children:a.label})]},r))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("textarea",{value:i,onChange:a=>f(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),V())},placeholder:s("dashboard.inputPlaceholder",{defaultValue:"描述你想要完成的任务..."}),className:"w-full px-5 py-4 text-base bg-transparent border-none outline-none resize-none text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500",rows:3}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-100 dark:border-gray-700",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>g(!j),className:"flex items-center gap-2 px-3 py-1.5 bg-gray-50 dark:bg-gray-700/50 rounded-lg border border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500 transition-colors",children:[e.jsx(h,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 max-w-[150px] truncate",children:t?.name||s("dashboard.selectProject",{defaultValue:"选择项目"})}),e.jsx(ce,{className:"w-3.5 h-3.5 text-gray-400"})]}),j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>g(!1)}),e.jsxs("div",{className:"absolute left-0 top-full mt-2 w-72 bg-white dark:bg-gray-800 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 z-20 max-h-64 overflow-y-auto",children:[o.map(a=>e.jsxs("button",{onClick:()=>{u(a),g(!1)},className:`w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700/50 flex items-center gap-3 first:rounded-t-xl last:rounded-b-xl ${t?.id===a.id?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[e.jsx(h,{className:`w-4 h-4 flex-shrink-0 ${t?.id===a.id?"text-blue-500":"text-gray-400"}`}),e.jsx("span",{className:`text-sm truncate ${t?.id===a.id?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"}`,children:a.name})]},a.id)),o.length===0&&e.jsx("div",{className:"px-4 py-6 text-center text-gray-500 text-sm",children:s("dashboard.noProjects",{defaultValue:"暂无项目"})})]})]})]}),e.jsxs("button",{onClick:V,disabled:!i.trim()||!t||!m(t),className:"flex items-center gap-2 px-5 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 dark:disabled:bg-gray-600 text-white rounded-xl font-medium transition-colors disabled:cursor-not-allowed",children:[e.jsx("span",{children:s("dashboard.startChat",{defaultValue:"开始对话"})}),e.jsx(ue,{className:"w-4 h-4"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 text-sm text-gray-400 dark:text-gray-500",children:[e.jsx(ge,{className:"w-4 h-4 animate-bounce"}),e.jsx("span",{children:s("dashboard.welcome.subtitle",{defaultValue:"选择一个项目,开始与 AI 协作完成任务"})})]})]}),e.jsxs("div",{className:"mt-10",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-4 text-center",children:s("dashboard.quickLinks.title",{defaultValue:"快捷入口"})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:z.map((a,r)=>e.jsxs("button",{onClick:()=>A(a.path),className:"flex flex-col items-center gap-2 p-4 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-md transition-all group",children:[e.jsx("div",{className:`p-2.5 rounded-lg ${a.color}`,children:e.jsx(a.icon,{className:"w-5 h-5"})}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white transition-colors",children:a.label})]},r))})]}),c.length>0&&e.jsxs("div",{className:"mt-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:[s("dashboard.sessions.title",{defaultValue:"活跃会话"})," (",c.length,")"]}),e.jsxs("button",{onClick:L,disabled:w,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-50",children:[w?e.jsx(b,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(me,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:s("dashboard.sessions.clearAll",{defaultValue:"清除全部"})})]})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 divide-y divide-gray-100 dark:divide-gray-700 max-h-64 overflow-y-auto",children:c.map(a=>{const r=a.projectPath?a.projectPath.split("/").pop()||a.projectPath:"-",l=a.sessionTitle||`${s("dashboard.sessions.session",{defaultValue:"会话"})} ${a.sessionId.slice(0,8)}`;return e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${a.status==="confirmed"?"bg-green-500":"bg-amber-500"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 truncate font-medium",children:l}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 mt-0.5",children:[e.jsx("span",{className:"truncate max-w-[120px]",title:r,children:r}),e.jsx("span",{children:"•"}),e.jsx("span",{children:a.agentId}),a.modelId&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{className:"bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded",children:a.modelId.replace("claude-","").replace(/-\d{8}$/,"")})]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:K(a.idleTimeMs)}),a.heartbeatTimedOut&&e.jsx("span",{className:"text-amber-500 flex items-center gap-1",children:e.jsx(xe,{className:"w-3 h-3"})})]})]})]}),e.jsx("button",{onClick:()=>E(a.sessionId),disabled:N===a.sessionId,className:"p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-50",title:s("dashboard.sessions.close",{defaultValue:"关闭会话"}),children:N===a.sessionId?e.jsx(b,{className:"w-4 h-4 animate-spin"}):e.jsx(he,{className:"w-4 h-4"})})]},a.sessionId)})})]})]})]})})};export{Ve as DashboardPage};
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{r as d}from"./monaco-editor-DHKm5-VF.js";import{u as B}from"./useProjects-DuCnMeYt.js";import{u as O,a as Q}from"./useAgents-Bp5Ry-Dk.js";import{u as _,c as W,a as X}from"./useSessions-EknKfdIv.js";import{u as G}from"./agents-DG431Wop.js";import{u as J,s as x,a as P}from"./index-UPEozv-J.js";import{u as Y}from"./tools-C0JOzoE_.js";import{p as Z,h as ee,e as ae,o as se,q as re,S as te,f as le,r as de,s as oe,t as ne,u as h,L as b,v as ie,k as ce,w as ue,x as ge,y as me,j as xe,X as he}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";const Ve=()=>{const{t:s}=Y("pages"),A=J(),I=G(),{data:$,isLoading:F}=B(),{data:D}=O(!0),{data:M,refetch:p}=_(),T=Q(),[i,f]=d.useState(""),[t,u]=d.useState(null),[j,g]=d.useState(!1),[y,k]=d.useState(!1),[w,v]=d.useState(!1),[N,C]=d.useState(null),o=$?.projects||[],n=D?.agents||[],c=M?.sessions||[];d.useEffect(()=>{o.length>0&&!t&&u(o[0])},[o,t]);const m=a=>{if(!a)return n[0];if(a.defaultAgent){const r=n.find(l=>l.id===a.defaultAgent);if(r)return r}return n[0]},q=async()=>{const a=n.find(r=>r.id==="claude-code")||n[0];if(a){k(!0);try{const r="default-workspace",l=await T.mutateAsync({agentId:a.id,projectName:r});await I.invalidateQueries({queryKey:["projects"]}),u(l.project),x(s("dashboard.projectCreated.title",{defaultValue:"项目创建成功"}),s("dashboard.projectCreated.message",{defaultValue:"已经为您创建项目:{{name}},你现在可以开始与 Agent 工作了。",name:r}))}catch(r){console.error("Failed to create default project:",r)}finally{k(!1)}}},V=()=>{const a=m(t);if(!i.trim()||!t||!a)return;const r=encodeURIComponent(i),l=`/chat/${a.id}?project=${encodeURIComponent(t.path)}&message=${r}`;window.open(l,"_blank")},E=async a=>{C(a);try{await X(a),await p(),x(s("dashboard.sessions.closed",{defaultValue:"会话已关闭"}),s("dashboard.sessions.closedMessage",{defaultValue:"会话已成功关闭"}))}catch(r){console.error("Failed to close session:",r),P(s("dashboard.sessions.closeFailed",{defaultValue:"关闭失败"}),r instanceof Error?r.message:s("dashboard.sessions.closeError",{defaultValue:"无法关闭会话"}))}finally{C(null)}},L=async()=>{if(c.length!==0){v(!0);try{const a=await W();await p(),x(s("dashboard.sessions.allCleared",{defaultValue:"全部清除"}),s("dashboard.sessions.allClearedMessage",{defaultValue:"已清除 {{count}} 个会话",count:a.clearedCount}))}catch(a){console.error("Failed to clear all sessions:",a),P(s("dashboard.sessions.clearFailed",{defaultValue:"清除失败"}),a instanceof Error?a.message:s("dashboard.sessions.clearError",{defaultValue:"无法清除会话"}))}finally{v(!1)}}},R=[{icon:Z,label:s("dashboard.templates.organizeFiles",{defaultValue:"整理文件"}),prompt:"帮我整理一下当前目录下的文件。请先分析目录结构,然后提出整理方案让我确认,最后再执行。"},{icon:ee,label:s("dashboard.templates.analyzeFiles",{defaultValue:"文件分析"}),prompt:"帮我分析一下当前项目的文件结构和代码情况,给出概要报告。"},{icon:ae,label:s("dashboard.templates.writeDoc",{defaultValue:"写一份文档"}),prompt:"帮我为这个项目写一份 README 文档,包含项目介绍、安装步骤和使用说明。"},{icon:se,label:s("dashboard.templates.codeReview",{defaultValue:"代码审查"}),prompt:"帮我审查一下这个项目的代码质量,包括代码风格、潜在问题和改进建议。"},{icon:re,label:s("dashboard.templates.checkWeather",{defaultValue:"查深圳天气"}),prompt:"查一下深圳现在的天气情况。"},{icon:te,label:s("dashboard.templates.quickTask",{defaultValue:"自由提问"}),prompt:""}],z=[{icon:le,label:s("dashboard.quickLinks.projects",{defaultValue:"项目管理"}),path:"/projects",color:"text-blue-500 bg-blue-50 dark:bg-blue-900/30"},{icon:de,label:s("dashboard.quickLinks.modelSettings",{defaultValue:"模型供应商"}),path:"/settings/suppliers",color:"text-purple-500 bg-purple-50 dark:bg-purple-900/30"},{icon:oe,label:s("dashboard.quickLinks.scheduledTasks",{defaultValue:"定时任务"}),path:"/scheduled-tasks",color:"text-green-500 bg-green-50 dark:bg-green-900/30"},{icon:ne,label:s("dashboard.quickLinks.customAgents",{defaultValue:"自定义 Agent"}),path:"/agents",color:"text-orange-500 bg-orange-50 dark:bg-orange-900/30"}],U=a=>{if(a){const r=m(t);if(t&&r){const l=encodeURIComponent(a),S=`/chat/${r.id}?project=${encodeURIComponent(t.path)}&message=${l}`;window.open(S,"_blank")}else f(a)}},H=!F&&o.length===0,K=a=>{const r=Math.floor(a/1e3);if(r<60)return`${r}s`;const l=Math.floor(r/60);return l<60?`${l}m`:`${Math.floor(l/60)}h`};return e.jsx("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-auto",children:e.jsxs("div",{className:"flex-1 flex flex-col items-center px-6 py-8",children:[e.jsx("div",{className:"text-center mb-8",children:e.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 dark:text-white",children:s("dashboard.welcome.title",{defaultValue:"让我们开始工作吧"})})}),e.jsxs("div",{className:"w-full max-w-2xl",children:[H&&e.jsxs("div",{className:"mb-6 p-6 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-2xl text-center",children:[e.jsx(h,{className:"w-12 h-12 text-amber-500 mx-auto mb-3"}),e.jsx("h3",{className:"text-lg font-medium text-amber-800 dark:text-amber-200 mb-2",children:s("dashboard.noProjectsHint.title",{defaultValue:"还没有项目"})}),e.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-300 mb-4",children:s("dashboard.noProjectsHint.description",{defaultValue:"创建一个项目来开始与 AI 协作"})}),e.jsx("button",{onClick:q,disabled:y||n.length===0,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-amber-600 hover:bg-amber-700 disabled:bg-amber-400 text-white rounded-xl font-medium transition-colors",children:y?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:s("dashboard.noProjectsHint.creating",{defaultValue:"创建中..."})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4"}),e.jsx("span",{children:s("dashboard.noProjectsHint.createButton",{defaultValue:"一键创建默认项目"})})]})})]}),e.jsx("div",{className:"mb-6 grid grid-cols-2 md:grid-cols-3 gap-3",children:R.map((a,r)=>e.jsxs("button",{onClick:()=>U(a.prompt),className:"flex items-center gap-3 px-4 py-3.5 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-600/50 hover:border-gray-300 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-700 hover:shadow-md text-left transition-all group",children:[e.jsx("div",{className:"flex-shrink-0 p-2 bg-gray-100 dark:bg-gray-700 rounded-lg",children:e.jsx(a.icon,{className:"w-5 h-5 text-gray-500 dark:text-gray-300"})}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200 group-hover:text-gray-900 dark:group-hover:text-white transition-colors",children:a.label})]},r))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-700",children:[e.jsx("textarea",{value:i,onChange:a=>f(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),V())},placeholder:s("dashboard.inputPlaceholder",{defaultValue:"描述你想要完成的任务..."}),className:"w-full px-5 py-4 text-base bg-transparent border-none outline-none resize-none text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500",rows:3}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-100 dark:border-gray-700",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>g(!j),className:"flex items-center gap-2 px-3 py-1.5 bg-gray-50 dark:bg-gray-700/50 rounded-lg border border-gray-200 dark:border-gray-600 hover:border-gray-300 dark:hover:border-gray-500 transition-colors",children:[e.jsx(h,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300 max-w-[150px] truncate",children:t?.name||s("dashboard.selectProject",{defaultValue:"选择项目"})}),e.jsx(ce,{className:"w-3.5 h-3.5 text-gray-400"})]}),j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>g(!1)}),e.jsxs("div",{className:"absolute left-0 top-full mt-2 w-72 bg-white dark:bg-gray-800 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700 z-20 max-h-64 overflow-y-auto",children:[o.map(a=>e.jsxs("button",{onClick:()=>{u(a),g(!1)},className:`w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700/50 flex items-center gap-3 first:rounded-t-xl last:rounded-b-xl ${t?.id===a.id?"bg-blue-50 dark:bg-blue-900/20":""}`,children:[e.jsx(h,{className:`w-4 h-4 flex-shrink-0 ${t?.id===a.id?"text-blue-500":"text-gray-400"}`}),e.jsx("span",{className:`text-sm truncate ${t?.id===a.id?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"}`,children:a.name})]},a.id)),o.length===0&&e.jsx("div",{className:"px-4 py-6 text-center text-gray-500 text-sm",children:s("dashboard.noProjects",{defaultValue:"暂无项目"})})]})]})]}),e.jsxs("button",{onClick:V,disabled:!i.trim()||!t||!m(t),className:"flex items-center gap-2 px-5 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 dark:disabled:bg-gray-600 text-white rounded-xl font-medium transition-colors disabled:cursor-not-allowed",children:[e.jsx("span",{children:s("dashboard.startChat",{defaultValue:"开始对话"})}),e.jsx(ue,{className:"w-4 h-4"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 text-sm text-gray-400 dark:text-gray-500",children:[e.jsx(ge,{className:"w-4 h-4 animate-bounce"}),e.jsx("span",{children:s("dashboard.welcome.subtitle",{defaultValue:"选择一个项目,开始与 AI 协作完成任务"})})]})]}),e.jsxs("div",{className:"mt-10",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-4 text-center",children:s("dashboard.quickLinks.title",{defaultValue:"快捷入口"})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:z.map((a,r)=>e.jsxs("button",{onClick:()=>A(a.path),className:"flex flex-col items-center gap-2 p-4 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:shadow-md transition-all group",children:[e.jsx("div",{className:`p-2.5 rounded-lg ${a.color}`,children:e.jsx(a.icon,{className:"w-5 h-5"})}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white transition-colors",children:a.label})]},r))})]}),c.length>0&&e.jsxs("div",{className:"mt-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:[s("dashboard.sessions.title",{defaultValue:"活跃会话"})," (",c.length,")"]}),e.jsxs("button",{onClick:L,disabled:w,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-50",children:[w?e.jsx(b,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(me,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:s("dashboard.sessions.clearAll",{defaultValue:"清除全部"})})]})]}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 divide-y divide-gray-100 dark:divide-gray-700 max-h-64 overflow-y-auto",children:c.map(a=>{const r=a.projectPath?a.projectPath.split("/").pop()||a.projectPath:"-",l=a.sessionTitle||`${s("dashboard.sessions.session",{defaultValue:"会话"})} ${a.sessionId.slice(0,8)}`;return e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${a.status==="confirmed"?"bg-green-500":"bg-amber-500"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 truncate font-medium",children:l}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 mt-0.5",children:[e.jsx("span",{className:"truncate max-w-[120px]",title:r,children:r}),e.jsx("span",{children:"•"}),e.jsx("span",{children:a.agentId}),a.modelId&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{className:"bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded",children:a.modelId.replace("claude-","").replace(/-\d{8}$/,"")})]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:K(a.idleTimeMs)}),a.heartbeatTimedOut&&e.jsx("span",{className:"text-amber-500 flex items-center gap-1",children:e.jsx(xe,{className:"w-3 h-3"})})]})]})]}),e.jsx("button",{onClick:()=>E(a.sessionId),disabled:N===a.sessionId,className:"p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-50",title:s("dashboard.sessions.close",{defaultValue:"关闭会话"}),children:N===a.sessionId?e.jsx(b,{className:"w-4 h-4 animate-spin"}):e.jsx(he,{className:"w-4 h-4"})})]},a.sessionId)})})]})]})]})})};export{Ve as DashboardPage};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./data-structures-C0h9Oap1.js";import{r as o}from"./monaco-editor-DHKm5-VF.js";import{a as K,A as W}from"./agents-DG431Wop.js";import{a as de}from"./index-D9bAK8SN.js";import{u as ee}from"./tools-C0JOzoE_.js";import{X as T,aq as te,ar as X,g as Y,as as _,l as q,at as ae,au as Z,Y as ce,I as xe,H as ge,k as he,av as ye,x as me,ag as be,a8 as ue,E as pe,u as re,e as fe,aw as we}from"./ui-components-CRCmgMKc.js";const ve=({filePath:F,onClose:h})=>{const{t}=ee("components"),[p,A]=o.useState([]),[N,U]=o.useState(!0),[M,s]=o.useState(null),[d,V]=o.useState(""),[i,b]=o.useState(1),[P,$]=o.useState(!1),[v]=o.useState(50),[O,H]=o.useState(""),z=c=>{const n=c.split(`
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{r as o}from"./monaco-editor-DHKm5-VF.js";import{a as K,A as W}from"./agents-DG431Wop.js";import{a as de}from"./index-UPEozv-J.js";import{u as ee}from"./tools-C0JOzoE_.js";import{X as T,aq as te,ar as X,g as Y,as as _,l as q,at as ae,au as Z,Y as ce,I as xe,H as ge,k as he,av as ye,x as me,ag as be,a8 as ue,E as pe,u as re,e as fe,aw as we}from"./ui-components-CRCmgMKc.js";const ve=({filePath:F,onClose:h})=>{const{t}=ee("components"),[p,A]=o.useState([]),[N,U]=o.useState(!0),[M,s]=o.useState(null),[d,V]=o.useState(""),[i,b]=o.useState(1),[P,$]=o.useState(!1),[v]=o.useState(50),[O,H]=o.useState(""),z=c=>{const n=c.split(`
2
2
  `).filter(x=>x.trim()),g=[];for(const x of n){const u=[];let S="",D=!1;for(let L=0;L<x.length;L++){const R=x[L];R==='"'?D&&x[L+1]==='"'?(S+='"',L++):D=!D:R===","&&!D?(u.push(S.trim()),S=""):S+=R}u.push(S.trim()),g.push(u)}return g};o.useEffect(()=>{(async()=>{try{U(!0),s(null);const n=F.split(/[/\\]/).pop()||"unknown.csv";H(n);const g=await K(`${W}/files/read?path=${encodeURIComponent(F)}`);if(!g.ok)throw new Error(t("csvPreview.errors.loadFailed"));const x=await g.json(),u=z(x.content);A(u)}catch(n){console.error("Failed to load CSV:",n),s(n instanceof Error?n.message:t("csvPreview.errors.unknownError"))}finally{U(!1)}})()},[F,t]);const j=o.useMemo(()=>{if(!d)return p;const c=d.toLowerCase();return p.filter(n=>n.some(g=>g.toLowerCase().includes(c)))},[p,d]),y=Math.ceil(j.length/v),f=(i-1)*v,C=f+v,m=j.slice(f,C);o.useEffect(()=>{b(1)},[d]),o.useEffect(()=>{const c=n=>{n.key==="Escape"?h():n.key==="ArrowLeft"&&i>1?b(i-1):n.key==="ArrowRight"&&i<y?b(i+1):n.ctrlKey&&n.key==="f"&&(n.preventDefault(),document.getElementById("csv-search")?.focus())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[h,i,y]);const k=()=>{const c=p.map(x=>x.map(u=>u.includes(",")||u.includes('"')||u.includes(`
3
3
  `)?`"${u.replace(/"/g,'""')}"`:u).join(",")).join(`
4
4
  `),n=new Blob([c],{type:"text/csv;charset=utf-8;"}),g=document.createElement("a");g.href=URL.createObjectURL(n),g.download=O,g.click(),URL.revokeObjectURL(g.href)};if(N)return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 flex items-center space-x-4",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:t("csvPreview.loading")})]})});if(M)return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t("csvPreview.errors.title")}),e.jsx("button",{onClick:h,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(T,{className:"w-5 h-5"})})]}),e.jsx("p",{className:"text-red-600 dark:text-red-400",children:M}),e.jsx("button",{onClick:h,className:"mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",children:t("csvPreview.actions.close")})]})});const I=P?"fixed inset-4 bg-white dark:bg-gray-900 flex flex-col z-50":"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50";return e.jsx("div",{className:I,children:P?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:O}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t("csvPreview.info.rowCount",{count:j.length}),d&&` (${t("csvPreview.info.filtered")})`]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>$(!1),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.minimize"),children:e.jsx(te,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:k,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.download"),children:e.jsx(X,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors",title:t("csvPreview.actions.close"),children:e.jsx(T,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(Y,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{id:"csv-search",type:"text",value:d,onChange:c=>V(c.target.value),placeholder:t("csvPreview.search.placeholder"),className:"w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-800 dark:text-white dark:placeholder-gray-400"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:m.length>0?e.jsx("div",{className:"min-w-full",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 sticky top-0",children:e.jsx("tr",{children:m[0]?.map((c,n)=>e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700",children:c||t("csvPreview.table.untitled")},n))})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700",children:m.slice(1).map((c,n)=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800",children:c.map((g,x)=>e.jsx("td",{className:"px-4 py-2 text-sm text-gray-900 dark:text-white whitespace-nowrap border-b border-gray-100 dark:border-gray-800",children:g||"-"},x))},n))})]})}):e.jsx("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:t("csvPreview.empty.noData")})})}),y>1&&e.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("csvPreview.pagination.showing",{start:f+1,end:Math.min(C,j.length),total:j.length})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>b(Math.max(1,i-1)),disabled:i===1,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.previous"),children:e.jsx(_,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 px-3",children:[i," / ",y]}),e.jsx("button",{onClick:()=>b(Math.min(y,i+1)),disabled:i===y,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.next"),children:e.jsx(q,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})]})]})]}):e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg w-full max-w-6xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:O}),e.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t("csvPreview.info.rowCount",{count:j.length}),d&&` (${t("csvPreview.info.filtered")})`]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>$(!0),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.maximize"),children:e.jsx(ae,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:k,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.download"),children:e.jsx(X,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{onClick:h,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:t("csvPreview.actions.close"),children:e.jsx(T,{className:"w-5 h-5 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"p-4 border-b border-gray-100 dark:border-gray-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(Y,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{id:"csv-search",type:"text",value:d,onChange:c=>V(c.target.value),placeholder:t("csvPreview.search.placeholder"),className:"w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:m.length>0?e.jsx("div",{className:"min-w-full",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800 sticky top-0",children:e.jsx("tr",{children:m[0]?.map((c,n)=>e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700",children:c||t("csvPreview.table.untitled")},n))})}),e.jsx("tbody",{className:"bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700",children:m.slice(1).map((c,n)=>e.jsx("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800",children:c.map((g,x)=>e.jsx("td",{className:"px-4 py-2 text-sm text-gray-900 dark:text-white whitespace-nowrap border-b border-gray-100 dark:border-gray-800",children:g||"-"},x))},n))})]})}):e.jsx("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:t("csvPreview.empty.noData")})})}),y>1&&e.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:t("csvPreview.pagination.showing",{start:f+1,end:Math.min(C,j.length),total:j.length})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:()=>b(Math.max(1,i-1)),disabled:i===1,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.previous"),children:e.jsx(_,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 px-3",children:[i," / ",y]}),e.jsx("button",{onClick:()=>b(Math.min(y,i+1)),disabled:i===y,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:t("csvPreview.pagination.next"),children:e.jsx(q,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})})]})]}),e.jsx("div",{className:"px-4 py-2 text-xs text-gray-500 dark:text-gray-400 text-center border-t border-gray-100 dark:border-gray-700",children:t("csvPreview.instructions")})]})})},je=({filePath:F,onClose:h})=>{const{t}=ee("components"),[p,A]=o.useState([]),[N,U]=o.useState(!0),[M,s]=o.useState(null),[d,V]=o.useState(""),[i,b]=o.useState(1),[P,$]=o.useState(!1),[v]=o.useState(20),[O,H]=o.useState(""),[z,j]=o.useState(new Set),[y,f]=o.useState(null),C=a=>{const l=a.split(`
@@ -0,0 +1 @@
1
+ import{j as e}from"./data-structures-C0h9Oap1.js";import{r as i}from"./monaco-editor-DHKm5-VF.js";import{b as T,d as A,e as D,i as U,f as V}from"./index-UPEozv-J.js";import{u as L}from"./tools-C0JOzoE_.js";import{r as h,K as G,M,N as b,O as R,Q as W,G as _,R as F,U as O,V as c,Y as P,_ as K,$ as H,e as Q,a0 as u,a1 as y,a2 as z,j as p}from"./ui-components-CRCmgMKc.js";import"./syntax-highlighting-CnREyncB.js";import"./agents-DG431Wop.js";const te=()=>{const{t:s,i18n:d}=L("pages"),{isMobile:a}=T(),[n,k]=i.useState(()=>localStorage.getItem("theme")||"auto"),[j,g]=i.useState(d.language),{currentVersion:x,latestVersion:o,hasUpdate:N,forceCheck:f,isChecking:m,dismissUpdate:v,showUpdateNotification:w}=A(),{systemInfo:r,refetch:C}=D(),[l,$]=i.useState(U());i.useEffect(()=>{g(d.language)},[d.language]),i.useEffect(()=>{(()=>{n==="dark"?document.documentElement.classList.add("dark"):n==="light"?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")})(),localStorage.setItem("theme",n),window.dispatchEvent(new Event("themechange"))},[n]);const S=t=>{g(t),d.changeLanguage(t)},E=()=>{f(),C()},I=()=>{const t=!l;V(t),$(t)};return e.jsxs("div",{className:`${a?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsxs("h1",{className:`${a?"text-xl":"text-2xl"} font-bold text-gray-900 dark:text-white mb-2 flex items-center gap-2`,children:[e.jsx(h,{className:"w-6 h-6"}),s("settings.general.title")]}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:s("settings.general.description")})]}),w&&o&&e.jsx("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/30 dark:to-indigo-900/30 border border-blue-200 dark:border-blue-800 rounded-xl p-4",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-800 rounded-full",children:e.jsx(G,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-blue-900 dark:text-blue-100",children:s("settings.systemInfo.updateAvailable")}),e.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 mt-1",children:s("version.newVersionAvailable",{version:o})}),e.jsxs("div",{className:"mt-3 flex space-x-2",children:[e.jsxs("a",{href:"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700",children:[e.jsx(M,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.viewReleases")]}),e.jsx("button",{onClick:v,className:"px-3 py-1.5 text-blue-700 dark:text-blue-300 text-sm bg-blue-100 dark:bg-blue-800 hover:bg-blue-200 dark:hover:bg-blue-700 rounded-lg",children:s("version.dismiss")})]})]})]})})}),e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 ${a?"p-4":"p-6"}`,children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2`,children:[e.jsx(b,{className:"w-5 h-5"}),s("settings.general.interfaceSettings")]}),e.jsxs("div",{className:`${a?"space-y-4":"space-y-6"}`,children:[e.jsxs("div",{children:[e.jsx("label",{className:"block font-medium text-gray-900 dark:text-white mb-2",children:s("settings.general.theme.label")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:s("settings.general.theme.description")}),e.jsx("div",{className:`${a?"grid grid-cols-1 gap-2":"grid grid-cols-3 gap-3"}`,children:[{value:"auto",label:s("settings.general.theme.auto"),icon:b},{value:"light",label:s("settings.general.theme.light"),icon:R},{value:"dark",label:s("settings.general.theme.dark"),icon:W}].map(t=>e.jsxs("button",{onClick:()=>k(t.value),className:`${a?"p-3":"p-4"} border-2 rounded-lg flex items-center ${a?"flex-row space-x-3":"flex-col space-y-2"} transition-all ${n===t.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx(t.icon,{className:`${a?"w-5 h-5":"w-6 h-6"}`}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]},t.value))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block font-medium text-gray-900 dark:text-white mb-2 flex items-center space-x-2",children:[e.jsx(_,{className:`${a?"w-4 h-4":"w-5 h-5"}`}),e.jsx("span",{children:s("settings.general.language.label")})]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-3",children:s("settings.general.language.description")}),e.jsx("div",{className:`${a?"grid grid-cols-1 gap-2":"grid grid-cols-2 gap-3"}`,children:[{value:"zh-CN",label:"中文简体",flag:"🇨🇳"},{value:"en-US",label:"English",flag:"🇺🇸"}].map(t=>e.jsxs("button",{onClick:()=>S(t.value),className:`${a?"p-3":"p-4"} border-2 rounded-lg flex items-center space-x-3 transition-all ${j===t.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:border-gray-300 dark:hover:border-gray-500"}`,children:[e.jsx("span",{className:`${a?"text-xl":"text-2xl"}`,children:t.flag}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]},t.value))})]})]})]}),e.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 ${a?"p-4":"p-6"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white flex items-center gap-2`,children:[e.jsx(F,{className:"w-5 h-5"}),s("settings.systemInfo.title")]}),e.jsxs("button",{onClick:E,disabled:m,className:"inline-flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700 disabled:opacity-50",children:[e.jsx(O,{className:`w-3 h-3 mr-1 ${m?"animate-spin":""}`}),s("settings.systemInfo.checkUpdate")]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(c,{className:"w-4 h-4"}),s("settings.systemInfo.currentVersion")]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs("span",{className:"font-mono text-gray-900 dark:text-white",children:["v",x||r?.app.version||"-"]}),!N&&x&&e.jsxs("span",{className:"ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx(P,{className:"w-3 h-3 mr-1"}),s("settings.systemInfo.upToDate")]})]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(K,{className:"w-4 h-4"}),"Node.js"]}),e.jsx("p",{className:"font-mono text-gray-900 dark:text-white",children:r?.runtime.nodeVersion||"-"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4",children:[e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-1",children:s("settings.systemInfo.platform")}),e.jsxs("p",{className:"text-gray-900 dark:text-white capitalize",children:[r?.runtime.platform||"-"," (",r?.runtime.arch||"-",")"]})]})]}),r?.sdk&&e.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsxs("h3",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-3 flex items-center gap-2",children:[e.jsx(h,{className:"w-4 h-4"}),"Agent SDK Configuration"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-blue-700 dark:text-blue-300 mb-1",children:"SDK Engine"}),e.jsxs("div",{className:"font-mono text-sm text-blue-900 dark:text-blue-100 font-medium",children:[r.sdk.engine==="claude-code"&&"🤖 Claude Code (Default)",r.sdk.engine==="claude-internal"&&"🔒 Claude Internal",r.sdk.engine==="code-buddy"&&"🤝 Code Buddy (Coming Soon)",!["claude-code","claude-internal","code-buddy"].includes(r.sdk.engine)&&r.sdk.engine]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-blue-700 dark:text-blue-300 mb-1",children:"SDK Directory"}),e.jsx("div",{className:"font-mono text-xs text-blue-900 dark:text-blue-100 break-all",children:r.sdk.directory})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("a",{href:r?.links.github||"https://github.com/okguitar/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(H,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"GitHub"})]}),e.jsxs("a",{href:r?.links.releases||"https://github.com/okguitar/agentstudio/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(c,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Releases"})]}),e.jsxs("a",{href:r?.links.changelog||"https://github.com/okguitar/agentstudio/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(Q,{className:"w-4 h-4 text-gray-700 dark:text-gray-300"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Changelog"})]}),e.jsxs("a",{href:r?.links.npm||"https://www.npmjs.com/package/agentstudio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors text-sm",children:[e.jsx(c,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"npm"})]})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:[e.jsxs("div",{className:`${a?"p-4":"p-6"}`,children:[e.jsxs("h2",{className:`${a?"text-base":"text-lg"} font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2`,children:[e.jsx(u,{className:"w-5 h-5"}),s("settings.telemetry.title","Telemetry & Analytics")]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${l?"bg-blue-100 dark:bg-blue-900/30":"bg-gray-100 dark:bg-gray-700"}`,children:e.jsx(u,{className:`w-5 h-5 ${l?"text-blue-600 dark:text-blue-400":"text-gray-500"}`})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:s("settings.telemetry.enableTelemetry","Enable Anonymous Telemetry")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:s("settings.telemetry.enableDescription","Help improve AgentStudio by sharing anonymous usage data")})]})]}),e.jsx("button",{onClick:I,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${l?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${l?"translate-x-6":"translate-x-1"}`})})]})]}),e.jsx("div",{className:`px-4 py-2 border-t ${l?"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800":"bg-gray-50 dark:bg-gray-700/50 border-gray-200 dark:border-gray-700"}`,children:e.jsx("div",{className:"flex items-center gap-2 text-sm",children:l?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-green-700 dark:text-green-400",children:s("settings.telemetry.statusEnabled","Telemetry is enabled. Thank you for helping improve AgentStudio!")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("settings.telemetry.statusDisabled","Telemetry is disabled. No data is being collected.")})]})})}),e.jsxs("details",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("summary",{className:"px-4 py-3 cursor-pointer text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 flex items-center gap-2",children:[e.jsx(p,{className:"w-4 h-4"}),s("settings.telemetry.privacyDetails","Privacy & Data Collection Details")]}),e.jsxs("div",{className:"px-4 pb-4 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2 flex items-center gap-2 text-sm",children:[e.jsx(y,{className:"w-4 h-4 text-green-500"}),s("settings.telemetry.whatWeCollect","What We Collect")]}),e.jsxs("ul",{className:"space-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.installId","Anonymous Installation ID")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.version","App Version & OS")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.features","Feature Usage")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"✓"}),s("settings.telemetry.collect.errors","Error Reports")]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-gray-900 dark:text-white mb-2 flex items-center gap-2 text-sm",children:[e.jsx(p,{className:"w-4 h-4 text-red-500"}),s("settings.telemetry.whatWeNeverCollect","What We Never Collect")]}),e.jsxs("ul",{className:"space-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.files","File contents, code, or project data")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.keys","API keys, passwords, or credentials")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.pii","Personal identifying information")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-500",children:"✗"}),s("settings.telemetry.neverCollect.conversations","Chat conversations or AI responses")]})]})]})]})]})]})]})};export{te as GeneralSettingsPage};