agent-tower 0.7.0 → 0.7.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime/__tests__/acp-process-manager.test.js +62 -11
- package/dist/runtime/__tests__/acp-process-manager.test.js.map +1 -1
- package/dist/runtime/__tests__/deepseek-hermes-definition.test.js +6 -3
- package/dist/runtime/__tests__/deepseek-hermes-definition.test.js.map +1 -1
- package/dist/runtime/__tests__/tool-frame-normalizer.test.d.ts +2 -0
- package/dist/runtime/__tests__/tool-frame-normalizer.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/tool-frame-normalizer.test.js +120 -0
- package/dist/runtime/__tests__/tool-frame-normalizer.test.js.map +1 -0
- package/dist/runtime/acp/agents/codex.js +3 -3
- package/dist/runtime/acp/agents/codex.js.map +1 -1
- package/dist/runtime/acp/agents/deepseek-hermes.d.ts +0 -1
- package/dist/runtime/acp/agents/deepseek-hermes.d.ts.map +1 -1
- package/dist/runtime/acp/agents/deepseek-hermes.js +7 -10
- package/dist/runtime/acp/agents/deepseek-hermes.js.map +1 -1
- package/dist/runtime/acp/agents/native-agent.d.ts +3 -1
- package/dist/runtime/acp/agents/native-agent.d.ts.map +1 -1
- package/dist/runtime/acp/agents/native-agent.js +1 -0
- package/dist/runtime/acp/agents/native-agent.js.map +1 -1
- package/dist/runtime/acp/agents/tool-frame-normalizer.d.ts +25 -0
- package/dist/runtime/acp/agents/tool-frame-normalizer.d.ts.map +1 -0
- package/dist/runtime/acp/agents/tool-frame-normalizer.js +192 -0
- package/dist/runtime/acp/agents/tool-frame-normalizer.js.map +1 -0
- package/dist/runtime/acp/process-manager.js +14 -6
- package/dist/runtime/acp/process-manager.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-B_9OhUu7.js → AgentDemoPage-B6pABvRL.js} +1 -1
- package/dist/web/assets/{AgentEnvironmentSettingsPage-D7pZQLiC.js → AgentEnvironmentSettingsPage-CqMfdwkM.js} +1 -1
- package/dist/web/assets/{AgentLogo-C0bPAxbG.js → AgentLogo-Ntqe3_Mx.js} +1 -1
- package/dist/web/assets/{ConversationPage-BkIJfuUB.js → ConversationPage-BINGA8XL.js} +1 -1
- package/dist/web/assets/{CreateTaskInput-CS9ktr5a.js → CreateTaskInput-8bLhHYOc.js} +1 -1
- package/dist/web/assets/{DemoPage-D5HfzpfS.js → DemoPage-D1Ki6sJ0.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-CKFLk4bt.js → GeneralSettingsPage-DoAXPabw.js} +1 -1
- package/dist/web/assets/{Icons-CqVh1zOu.js → Icons-KJJd6C8K.js} +1 -1
- package/dist/web/assets/{LoadingPreviewPage-DWr9Bc06.js → LoadingPreviewPage-BqCKBvgv.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-GDNWUFUx.js → McpSettingsPage-QXVD4XCW.js} +1 -1
- package/dist/web/assets/{MemberAvatar-BA3zVRhl.js → MemberAvatar-kbJEoyh0.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-OpJo7zJ4.js → NotificationSettingsPage-BrqSeU--.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-DYV5Up2y.js → ProfileSettingsPage-BmWgVdnG.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-DNhv4WcA.js → ProjectKanbanPage-D7RJm4yg.js} +3 -3
- package/dist/web/assets/{ProjectSettingsPage-DJ5LIrW5.js → ProjectSettingsPage-BVINN99w.js} +1 -1
- package/dist/web/assets/{ProviderSettingsPage-DkKvjXXL.js → ProviderSettingsPage-BlgfQMwe.js} +1 -1
- package/dist/web/assets/{SettingsMasterDetail-nkWk1iMZ.js → SettingsMasterDetail-OF28cvPV.js} +1 -1
- package/dist/web/assets/{TeamSettingsPage-B6paYIi8.js → TeamSettingsPage-BWGm0m7s.js} +1 -1
- package/dist/web/assets/{arc-D6K3W0ZB.js → arc-CqFgRaZU.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-CnyQ4xAO.js → architectureDiagram-3BPJPVTR-C0PMdIZJ.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-BFL71oe3.js → blockDiagram-GPEHLZMM-SqqtxqkX.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-Cv39zyqp.js → c4Diagram-AAUBKEIU-DYJXB3xL.js} +1 -1
- package/dist/web/assets/channel-B8s9dqlX.js +1 -0
- package/dist/web/assets/check-C1zWgxFO.js +1 -0
- package/dist/web/assets/{chevron-down-F0HaYv4G.js → chevron-down-BZfpVhYr.js} +1 -1
- package/dist/web/assets/{chevron-right-CPwvo275.js → chevron-right-D52zUyOF.js} +1 -1
- package/dist/web/assets/{chevron-up-DS7W1CS_.js → chevron-up-CFOy5dmW.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-o03x4Lwh.js → chunk-2J33WTMH-DQCbv8W_.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-OMTDHlMp.js → chunk-4BX2VUAB-B_68_oNW.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-BYhGICji.js → chunk-55IACEB6-Bb-pPIxs.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-DzoqZgN8.js → chunk-727SXJPM-CAiaySk6.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-RWSpIm7i.js → chunk-AQP2D5EJ-ChCLJ4Wv.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-A8Ezik8l.js → chunk-FMBD7UC4-Kz0Cc0mv.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-l8t1S54b.js → chunk-ND2GUHAM-BttoT7UR.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-CfzOWd9g.js → chunk-QZHKN3VN-BcVhzXXK.js} +1 -1
- package/dist/web/assets/{circle-alert-D_JK6Nsk.js → circle-alert-D67xfWMs.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-61bPx188.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-61bPx188.js +1 -0
- package/dist/web/assets/{code-block-OCS4YCEC-DOp940bN.js → code-block-OCS4YCEC-CMA1utSp.js} +1 -1
- package/dist/web/assets/{confirm-dialog-BOmXWU-c.js → confirm-dialog-BWvZEHpu.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-D2t-do1X.js → cose-bilkent-S5V4N54A-B391zTey.js} +1 -1
- package/dist/web/assets/{cssMode-BtqVF1ly.js → cssMode-CNU1q_Gl.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-BtYlmBNC.js → dagre-BM42HDAG-CymH_FEZ.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-WDOcMaWr.js → diagram-2AECGRRQ-DXOIiLDr.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-LbMipgIf.js → diagram-5GNKFQAL-B9ocgjdh.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-DsKCSLdx.js → diagram-KO2AKTUF-DLMpk9Wg.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-DUkuN6RR.js → diagram-LMA3HP47-BBnF83je.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-DLyJH0mw.js → diagram-OG6HWLK6-AK4FunVI.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-kZ9_YLwi.js → erDiagram-TEJ5UH35-B1mryURg.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-CtWP6zim.js → flowDiagram-I6XJVG4X-BjIG_1l5.js} +1 -1
- package/dist/web/assets/{folder-picker-ClBdFSv_.js → folder-picker-CaM_drIJ.js} +1 -1
- package/dist/web/assets/{freemarker2-Cz_cflgL.js → freemarker2-Dj1C_6Ng.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-Cpsrbddz.js → ganttDiagram-6RSMTGT7-DjR6lyIQ.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-Z2AN7JLu.js → gitGraphDiagram-PVQCEYII-BpW2L4ry.js} +1 -1
- package/dist/web/assets/{handlebars-DXQ11OYe.js → handlebars-DNXOgRZc.js} +1 -1
- package/dist/web/assets/{html-CPKzsFQJ.js → html-C20FgNS-.js} +1 -1
- package/dist/web/assets/{htmlMode-BuLIJ65E.js → htmlMode-CtcV1Ktd.js} +1 -1
- package/dist/web/assets/{index-BPuQ0J75.js → index-DaRxJqVy.js} +4 -4
- package/dist/web/assets/{index-DJqjl4es.js → index-oC5eh7mZ.js} +3 -3
- package/dist/web/assets/{infoDiagram-5YYISTIA-CG5Z1SIw.js → infoDiagram-5YYISTIA-Cu-PA_-6.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-CI-1kybP.js → ishikawaDiagram-YF4QCWOH-S6Esbkdw.js} +1 -1
- package/dist/web/assets/javascript-CFAVZ6Tb.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-Yf0W6ar4.js → journeyDiagram-JHISSGLW-wPF9FT9V.js} +1 -1
- package/dist/web/assets/{jsonMode-D7mGQAMX.js → jsonMode-D6IoFlQF.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-CSo-Ej3T.js → kanban-definition-UN3LZRKU-C4jl9zOj.js} +1 -1
- package/dist/web/assets/{layers-E7xs4_fY.js → layers-hQUUT3Gb.js} +1 -1
- package/dist/web/assets/{linear-bYzPbs_W.js → linear-D83xDp0H.js} +1 -1
- package/dist/web/assets/{liquid-D1dGDf_h.js → liquid-CuzuRJIN.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-Fa-E2Zl-.js → lspLanguageFeatures-CUyibjAN.js} +1 -1
- package/dist/web/assets/{mdx-CRf_kl0j.js → mdx-C3rxTvel.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-9Sp0Awb9.js → mermaid-NOHMQCX5-CGCWmHha.js} +5 -5
- package/dist/web/assets/{message-square-CQV6Jqyx.js → message-square-B-uYQiTq.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-DfqJHEQn.js → mindmap-definition-RKZ34NQL-D5v2uvjn.js} +1 -1
- package/dist/web/assets/{modal-BUKaDX-v.js → modal-D87uszzb.js} +1 -1
- package/dist/web/assets/{monaco-uSRaugmx.js → monaco-B25-2nEB.js} +3 -3
- package/dist/web/assets/{pencil-BRpoyX8s.js → pencil-CY2RnQrx.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-D6mZqc_7.js → pieDiagram-4H26LBE5-6wdFz_7x.js} +1 -1
- package/dist/web/assets/{python-b877PDdg.js → python-BYGLbOzO.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-DCcabkRn.js → quadrantDiagram-W4KKPZXB-C1CrGMEK.js} +1 -1
- package/dist/web/assets/{razor-Bi1FXUoZ.js → razor-m0U9iUAj.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-CP6GHzII.js → requirementDiagram-4Y6WPE33-mDtZrxpp.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-BNJypqP0.js → sankeyDiagram-5OEKKPKP-hBlj0XoH.js} +1 -1
- package/dist/web/assets/{select-DQiySo8W.js → select-D7WkUiad.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-CTceFzh8.js → sequenceDiagram-3UESZ5HK-DsWmMm20.js} +1 -1
- package/dist/web/assets/{server-Du56rX8Y.js → server-qlZupTvg.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-CW_WR-7F.js → stateDiagram-AJRCARHV-VNyX1L66.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-DHz3oGyD.js +1 -0
- package/dist/web/assets/{switch-Bmbr34G9.js → switch-1pvXCcP-.js} +1 -1
- package/dist/web/assets/{textarea-SORnJi9y.js → textarea-D9oaz-Ba.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-YMyJrcx3.js → timeline-definition-PNZ67QCA-DuBxxd9E.js} +1 -1
- package/dist/web/assets/{trash-2-BeXtY9XM.js → trash-2-C0P8jNpJ.js} +1 -1
- package/dist/web/assets/{tsMode-PVZGxtwF.js → tsMode-ogL-3MSe.js} +1 -1
- package/dist/web/assets/{typescript-Lb9pWYyY.js → typescript-rHoDxTY8.js} +1 -1
- package/dist/web/assets/{upload-mXU9O8ZR.js → upload-BYgsDplu.js} +1 -1
- package/dist/web/assets/{use-profiles-CwhDBM9-.js → use-profiles-BkGnmson.js} +1 -1
- package/dist/web/assets/{use-projects-FC2A-qiG.js → use-projects-B4w00h5I.js} +1 -1
- package/dist/web/assets/{use-providers-BzZ7Dpm4.js → use-providers-B70-BYNu.js} +1 -1
- package/dist/web/assets/{useNormalizedLogs-Cxh15U2o.js → useNormalizedLogs-MsDkcnRQ.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-2FtrQsyg.js → vennDiagram-CIIHVFJN-RbPPOLBo.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-DzhpFsrC.js → wardley-L42UT6IY-DXzUbdMF.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-SWglvyXQ.js → wardleyDiagram-YWT4CUSO-B0QXobQM.js} +1 -1
- package/dist/web/assets/{xml-aN9gPs-U.js → xml-BqnpQrAq.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-BMScKGN8.js → xychartDiagram-2RQKCTM6-C7bFJItM.js} +1 -1
- package/dist/web/assets/{yaml-iYUoM2EE.js → yaml-mz2Zn_K2.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/runtime/acp/agents/codex-frame-normalizer.d.ts +0 -4
- package/dist/runtime/acp/agents/codex-frame-normalizer.d.ts.map +0 -1
- package/dist/runtime/acp/agents/codex-frame-normalizer.js +0 -120
- package/dist/runtime/acp/agents/codex-frame-normalizer.js.map +0 -1
- package/dist/web/assets/channel-DIRGk9YF.js +0 -1
- package/dist/web/assets/check-D0G5G0XX.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-B7c8qeN5.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-B7c8qeN5.js +0 -1
- package/dist/web/assets/javascript-CWV4KdLq.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Veali8j7.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-block-OCS4YCEC-
|
|
2
|
-
import{k as Ti,r as A,D as Hc,ad as gu,j as m,aN as Uc,aO as jc,aA as xi,P as xt,l as kn,u as sr,ae as zc,Q as $c,X as Yc,m as qc,p as Vc,aP as Wc}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-block-OCS4YCEC-CMA1utSp.js","assets/index-oC5eh7mZ.js","assets/index-dElqH2UR.css","assets/chevron-right-D52zUyOF.js","assets/chevron-down-BZfpVhYr.js","assets/index-DaRxJqVy.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{k as Ti,r as A,D as Hc,ad as gu,j as m,aN as Uc,aO as jc,aA as xi,P as xt,l as kn,u as sr,ae as zc,Q as $c,X as Yc,m as qc,p as Vc,aP as Wc}from"./index-oC5eh7mZ.js";import{C as _n}from"./chevron-right-D52zUyOF.js";import{C as Eu}from"./chevron-down-BZfpVhYr.js";const Gc=[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]],Kc=Ti("chart-no-axes-combined",Gc);const Qc=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Xc=Ti("file-text",Qc);const Zc=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Jc=Ti("image",Zc);var fs;(function(e){e.TODO="TODO",e.IN_PROGRESS="IN_PROGRESS",e.IN_REVIEW="IN_REVIEW",e.DONE="DONE",e.CANCELLED="CANCELLED"})(fs||(fs={}));var ps;(function(e){e[e.LOW=-1]="LOW",e[e.NORMAL=0]="NORMAL",e[e.HIGH=1]="HIGH",e[e.URGENT=2]="URGENT"})(ps||(ps={}));var ms;(function(e){e.ACTIVE="ACTIVE",e.MERGED="MERGED",e.ABANDONED="ABANDONED",e.HIBERNATED="HIBERNATED"})(ms||(ms={}));var gs;(function(e){e.WORKTREE="WORKTREE",e.MAIN_DIRECTORY="MAIN_DIRECTORY"})(gs||(gs={}));var Y;(function(e){e.CLAUDE_CODE="CLAUDE_CODE",e.GEMINI_CLI="GEMINI_CLI",e.CURSOR_AGENT="CURSOR_AGENT",e.CODEX="CODEX",e.QWEN_CODE="QWEN_CODE",e.KIRO_CLI="KIRO_CLI",e.OPENCODE="OPENCODE",e.PI_CODING_AGENT="PI_CODING_AGENT",e.GROK_BUILD="GROK_BUILD",e.MINION_CODE="MINION_CODE",e.DEEPSEEK_HERMES="DEEPSEEK_HERMES"})(Y||(Y={}));var Te;(function(e){e.CLI="CLI",e.ACP="ACP"})(Te||(Te={}));var Es;(function(e){e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED"})(Es||(Es={}));var bs;(function(e){e.CHAT="CHAT",e.COMMIT_MSG="COMMIT_MSG"})(bs||(bs={}));var Ts;(function(e){e.WORKSPACE="WORKSPACE",e.CONVERSATION="CONVERSATION"})(Ts||(Ts={}));var xs;(function(e){e.REBASE="REBASE",e.MERGE="MERGE"})(xs||(xs={}));var ee;(function(e){e.Action="Action",e.Assistant="Assistant",e.Info="Info",e.Tool="Tool",e.User="User",e.Cursor="Cursor",e.Error="Error",e.Warning="Warning"})(ee||(ee={}));function eh(e){const t=e.metadata?.toolName||"Tool",n=e.metadata?.action,r=e.metadata?.status,i={file_read:"Read File",file_edit:"Edit File",command_run:"Run Command",search:"Search",web_fetch:"Fetch URL",tool:"Tool",task_create:"Create Task",plan_presentation:"Present Plan",todo_management:"Manage Todo",other:"Action"},s=e.metadata?.toolKind?t:n?i[n]:t;return r==="success"?`${s} ✓`:r==="failed"?`${s} ✗`:r==="pending_approval"?`${s} (待审批)`:s}function ks(e){switch(e.entryType){case"user_message":case"user_feedback":return{id:e.id,timestamp:e.timestamp,type:ee.User,content:e.content};case"assistant_message":return{id:e.id,timestamp:e.timestamp,type:ee.Assistant,content:e.content};case"next_action":return{id:e.id,timestamp:e.timestamp,type:ee.Action,content:e.content};case"thinking":return{id:e.id,timestamp:e.timestamp,type:ee.Info,title:"Thinking",content:e.content};case"tool_use":return{id:e.id,timestamp:e.timestamp,type:ee.Tool,title:eh(e),content:e.content,isCollapsed:e.metadata?.status==="success",tool:{action:e.metadata?.action,name:e.metadata?.toolName,id:e.metadata?.toolId,kind:e.metadata?.toolKind,status:e.metadata?.status,content:e.metadata?.toolContent,locations:e.metadata?.toolLocations,inputSummary:e.metadata?.toolInputSummary,outputSummary:e.metadata?.toolOutputSummary}};case"error_message":return{id:e.id,timestamp:e.timestamp,type:ee.Error,content:e.content};case"warning_message":return{id:e.id,timestamp:e.timestamp,type:ee.Warning,content:e.content};case"system_message":return{id:e.id,timestamp:e.timestamp,type:ee.Info,content:e.content};case"loading":return{id:e.id,timestamp:e.timestamp,type:ee.Cursor,content:"",cursorActivity:{processingStartedAt:e.timestamp}};case"token_usage_info":if(e.metadata?.tokenUsage){const{totalTokens:t=0,modelContextWindow:n}=e.metadata.tokenUsage;return{id:e.id,timestamp:e.timestamp,type:ee.Info,content:e.content,tokenUsage:{totalTokens:t,modelContextWindow:n}}}return null;default:return null}}const _s=new WeakMap;function th(e){if(typeof e!="object"||e===null)return ks(e);const t=_s.get(e);if(t!==void 0)return t;const n=ks(e);return _s.set(e,n),n}function g3(e){const t=[];for(const n of e){const r=th(n);r!==null&&t.push(r)}return t}function E3(e){return{id:`cursor-${Date.now()}`,timestamp:e?.processingStartedAt??Date.now(),type:ee.Cursor,content:"",cursorActivity:e}}const nh=["oss","ollama","lmstudio","amazon-bedrock"];function b3(e){return nh.includes(e)}const T3={[Y.CLAUDE_CODE]:{agentType:Y.CLAUDE_CODE,apiBaseUrl:{kind:"env",path:"ANTHROPIC_BASE_URL",placeholder:"https://api.anthropic.com"},apiKey:{kind:"env",path:"ANTHROPIC_API_KEY"},model:{kind:"config",path:"model",placeholder:"claude-sonnet-4-20250514"},reasoningEffort:{kind:"config",path:"effort",options:["low","medium","high","xhigh","max"]},executionPermission:{kind:"config",path:"dangerouslySkipPermissions",riskKind:"skip-permissions"},settingsFormat:"json"},[Y.CODEX]:{agentType:Y.CODEX,apiBaseUrl:{kind:"settings",path:"openai_base_url",placeholder:"https://api.openai.com/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model",placeholder:"gpt-5.3-codex"},reasoningEffort:{kind:"settings",path:"model_reasoning_effort",options:["minimal","low","medium","high","xhigh"]},executionPermission:{kind:"config",path:"dangerouslyBypassApprovalsAndSandbox",riskKind:"bypass-approvals-and-sandbox"},fastMode:{kind:"config",path:"fastMode"},disableResponsesWebsocket:{kind:"config",path:"disableResponsesWebsocket"},settingsFormat:"toml"},[Y.GEMINI_CLI]:{agentType:Y.GEMINI_CLI,apiKey:{kind:"env",path:"GEMINI_API_KEY"},model:{kind:"config",path:"model",placeholder:"gemini-2.5-pro"},executionPermission:{kind:"config",path:"yolo",riskKind:"auto-approve"}},[Y.CURSOR_AGENT]:{agentType:Y.CURSOR_AGENT,model:{kind:"config",path:"model"},executionPermission:{kind:"config",path:"force",riskKind:"force-execution"}},[Y.QWEN_CODE]:{agentType:Y.QWEN_CODE,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://dashscope.aliyuncs.com/compatible-mode/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model",placeholder:"qwen3-coder-plus"},executionPermission:{kind:"config",path:"yolo",riskKind:"auto-approve"}},[Y.KIRO_CLI]:{agentType:Y.KIRO_CLI,model:{kind:"config",path:"model"},reasoningEffort:{kind:"config",path:"effort",options:["low","medium","high","xhigh","max"]},executionPermission:{kind:"config",path:"trustAllTools",riskKind:"auto-approve"}},[Y.OPENCODE]:{agentType:Y.OPENCODE,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://api.openai.com/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model"},executionPermission:{kind:"config",path:"autoApprove",riskKind:"auto-approve"}},[Y.PI_CODING_AGENT]:{agentType:Y.PI_CODING_AGENT,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://api.openai.com/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model"},reasoningEffort:{kind:"config",path:"effort",options:["minimal","low","medium","high","xhigh"]},executionPermission:{kind:"config",path:"autoApprove",riskKind:"auto-approve"}},[Y.GROK_BUILD]:{agentType:Y.GROK_BUILD,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://api.x.ai/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model"},executionPermission:{kind:"config",path:"alwaysApprove",riskKind:"auto-approve"}},[Y.MINION_CODE]:{agentType:Y.MINION_CODE,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://api.openai.com/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model"},executionPermission:{kind:"config",path:"dangerouslySkipPermissions",riskKind:"skip-permissions"}},[Y.DEEPSEEK_HERMES]:{agentType:Y.DEEPSEEK_HERMES,apiBaseUrl:{kind:"env",path:"DEEPSEEK_BASE_URL",placeholder:"https://api.deepseek.com"},apiKey:{kind:"env",path:"DEEPSEEK_API_KEY"},model:{kind:"config",path:"model",placeholder:"deepseek-v4-pro"},reasoningEffort:{kind:"config",path:"effort",options:["off","low","high","max"]},executionPermission:{kind:"config",riskKind:"auto-approve"}}},x3={[Y.CLAUDE_CODE]:[Te.CLI,Te.ACP],[Y.GEMINI_CLI]:[Te.CLI,Te.ACP],[Y.CURSOR_AGENT]:[Te.CLI,Te.ACP],[Y.CODEX]:[Te.CLI,Te.ACP],[Y.QWEN_CODE]:[Te.ACP],[Y.KIRO_CLI]:[Te.ACP],[Y.OPENCODE]:[Te.ACP],[Y.PI_CODING_AGENT]:[Te.ACP],[Y.GROK_BUILD]:[Te.ACP],[Y.MINION_CODE]:[Te.ACP],[Y.DEEPSEEK_HERMES]:[Te.ACP]},rh=Object.freeze(Object.values(Y).filter(e=>e!==Y.MINION_CODE));new Set(rh);const ih=/^[ \t]{0,3}::agent-download\{file="([^"\r\n]+)"\}[ \t]*$/,sh=/^[a-zA-Z]:[\\/]/,ah=1024;function bu(e){if(!e||e.length>ah||e!==e.trim()||e.includes("\\")||/[\0-\x1f\x7f]/.test(e)||e.startsWith("/")||sh.test(e))return null;const t=e.split("/");return t.some(n=>!n||n==="."||n==="..")?null:t.join("/")}function uh(e){const t=e.match(ih);return t?bu(t[1]):null}function St(e,t,n){let r=n.initialDeps??[],i,s=!0;function a(){var u,o,c;let h;n.key&&((u=n.debug)!=null&&u.call(n))&&(h=Date.now());const d=e();if(!(d.length!==r.length||d.some((E,_)=>r[_]!==E)))return i;r=d;let p;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(p=Date.now()),i=t(...d),n.key&&((c=n.debug)!=null&&c.call(n))){const E=Math.round((Date.now()-h)*100)/100,_=Math.round((Date.now()-p)*100)/100,I=_/16,C=(w,O)=>{for(w=String(w);w.length<O;)w=" "+w;return w};console.info(`%c⏱ ${C(_,5)} /${C(E,5)} ms`,`
|
|
3
3
|
font-size: .6rem;
|
|
4
4
|
font-weight: bold;
|
|
5
5
|
color: hsl(${Math.max(0,Math.min(120-120*I,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(i),s=!1,i}return a.updateDeps=u=>{r=u},a}function As(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const oh=(e,t)=>Math.abs(e-t)<1.01,lh=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Cs=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},ch=e=>e,hh=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},dh=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=a=>{const{width:u,height:o}=a;t({width:Math.round(u),height:Math.round(o)})};if(i(Cs(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const u=()=>{const o=a[0];if(o?.borderBoxSize){const c=o.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(Cs(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},ys={passive:!0},Is=typeof window>"u"?!0:"onscrollend"in window,fh=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const s=e.options.useScrollendEvent&&Is?()=>{}:lh(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:d,isRtl:f}=e.options;i=d?n.scrollLeft*(f&&-1||1):n.scrollTop,s(),t(i,h)},u=a(!0),o=a(!1);n.addEventListener("scroll",u,ys);const c=e.options.useScrollendEvent&&Is;return c&&n.addEventListener("scrollend",o,ys),()=>{n.removeEventListener("scroll",u),c&&n.removeEventListener("scrollend",o)}},ph=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},mh=(e,{adjustments:t=0,behavior:n},r)=>{var i,s;const a=e+t;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class gh{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const a=()=>{this._measureElement(s.target,s)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var s;return(s=r())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=r())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ch,rangeExtractor:hh,onChange:()=>{},measureElement:ph,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=St(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=s,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const i=new Map,s=new Map;for(let a=r-1;a>=0;a--){const u=n[a];if(i.has(u.lane))continue;const o=s.get(u.lane);if(o==null||u.end>o.end?s.set(u.lane,u):u.end<o.end&&i.set(u.lane,!0),i.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,u)=>a.end===u.end?a.index-u.index:a.end-u.end)[0]:void 0},this.getMeasurementOptions=St(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,i,s,a,u)=>(this.prevLanes!==void 0&&this.prevLanes!==u&&(this.lanesChangedFlag=!0),this.prevLanes=u,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:u}),{key:!1}),this.getMeasurements=St(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:u},o)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const f of this.laneAssignments.keys())f>=n&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,c),d=new Array(u).fill(void 0);for(let f=0;f<c;f++){const p=h[f];p&&(d[p.lane]=f)}for(let f=c;f<n;f++){const p=s(f),E=this.laneAssignments.get(f);let _,I;if(E!==void 0&&this.options.lanes>1){_=E;const F=d[_],z=F!==void 0?h[F]:void 0;I=z?z.end+this.options.gap:r+i}else{const F=this.options.lanes===1?h[f-1]:this.getFurthestMeasurement(h,f);I=F?F.end+this.options.gap:r+i,_=F?F.lane:f%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(f,_)}const C=o.get(p),w=typeof C=="number"?C:this.options.estimateSize(f),O=I+w;h[f]={index:f,start:I,size:w,end:O,key:p,lane:_},d[_]=f}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=St(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,s)=>this.range=n.length>0&&r>0?Eh({measurements:n,outerSize:r,scrollOffset:i,lanes:s}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=St(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,s,a)=>s===null||a===null?[]:n({startIndex:s,endIndex:a,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const i=this.indexFromElement(n),s=this.measurementsCache[i];if(!s)return;const a=s.key,u=this.elementsCache.get(a);u!==n&&(u&&this.observer.unobserve(u),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(i,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const i=this.measurementsCache[n];if(!i)return;const s=this.itemSizeCache.get(i.key)??i.size,a=r-s;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,a,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,i)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(i))});return}this._measureElement(n,void 0)},this.getVirtualItems=St(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let s=0,a=n.length;s<a;s++){const u=n[s],o=r[u];i.push(o)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return As(r[Tu(0,r.length-1,i=>As(r[i]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+s?"end":"start"),r==="center"?n+=(i-s)/2:r==="end"&&(n-=s);const u=this.getMaxScrollOffset();return Math.max(Math.min(u,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.measurementsCache[n];if(!i)return;const s=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(i.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(i.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const u=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(u,r,i.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:r="auto",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let s=0;const a=10,u=c=>{if(!this.targetWindow)return;const h=this.getOffsetForIndex(n,c);if(!h){console.warn("Failed to get offset for index:",n);return}const[d,f]=h;this._scrollToOffset(d,{adjustments:void 0,behavior:i}),this.targetWindow.requestAnimationFrame(()=>{const p=()=>{if(this.currentScrollToIndex!==n)return;const E=this.getScrollOffset(),_=this.getOffsetForIndex(n,f);if(!_){console.warn("Failed to get offset for index:",n);return}oh(_[0],E)||o(f)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(p):p()})},o=c=>{this.targetWindow&&this.currentScrollToIndex===n&&(s++,s<a?this.targetWindow.requestAnimationFrame(()=>u(c)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};u(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((n=r[r.length-1])==null?void 0:n.end)??0;else{const s=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&s.some(u=>u===null);){const u=r[a];s[u.lane]===null&&(s[u.lane]=u.end),a--}i=Math.max(...s.filter(u=>u!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const Tu=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,s=n(i);if(s<r)e=i+1;else if(s>r)t=i-1;else return i}return e>0?e-1:0};function Eh({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const i=e.length-1,s=o=>e[o].start;if(e.length<=r)return{startIndex:0,endIndex:i};let a=Tu(0,i,s,n),u=a;if(r===1)for(;u<i&&e[u].end<n+t;)u++;else if(r>1){const o=Array(r).fill(0);for(;u<i&&o.some(h=>h<n+t);){const h=e[u];o[h.lane]=h.end,u++}const c=Array(r).fill(n+t);for(;a>=0&&c.some(h=>h>=n);){const h=e[a];c[h.lane]=h.start,a--}a=Math.max(0,a-a%r),u=Math.min(i,u+(r-1-u%r))}return{startIndex:a,endIndex:u}}const Ns=typeof document<"u"?A.useLayoutEffect:A.useEffect;function bh({useFlushSync:e=!0,...t}){const n=A.useReducer(()=>({}),{})[1],r={...t,onChange:(s,a)=>{var u;e&&a?Hc.flushSync(n):n(),(u=t.onChange)==null||u.call(t,s,a)}},[i]=A.useState(()=>new gh(r));return i.setOptions(r),Ns(()=>i._didMount(),[]),Ns(()=>i._willUpdate()),i}function Th(e){return bh({observeElementRect:dh,observeElementOffset:fh,scrollToFn:mh,...e})}function xh(e,t,n){const r=n,i=r.getScrollOffset()+r.scrollAdjustments;return e.end+t<=i}const ar=(function(e){if(e==null)return Ch;if(typeof e=="function")return ur(e);if(typeof e=="object")return Array.isArray(e)?kh(e):_h(e);if(typeof e=="string")return Ah(e);throw new Error("Expected function, string, or object as test")});function kh(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ar(e[n]);return ur(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function _h(e){const t=e;return ur(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function Ah(e){return ur(t);function t(n){return n&&n.type===e}}function ur(e){return t;function t(n,r,i){return!!(yh(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Ch(){return!0}function yh(e){return e!==null&&typeof e=="object"&&"type"in e}const xu=[],en=!0,Vr=!1,Vn="skip";function ki(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=ar(i),a=r?-1:1;u(e,void 0,[])();function u(o,c,h){const d=o&&typeof o=="object"?o:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(o.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=xu,E,_,I;if((!t||s(o,c,h[h.length-1]||void 0))&&(p=Ih(n(o,h)),p[0]===Vr))return p;if("children"in o&&o.children){const C=o;if(C.children&&p[0]!==Vn)for(_=(r?C.children.length:-1)+a,I=h.concat(C);_>-1&&_<C.children.length;){const w=C.children[_];if(E=u(w,_,I)(),E[0]===Vr)return E;_=typeof E[1]=="number"?E[1]:_+a}}return p}}}function Ih(e){return Array.isArray(e)?e:typeof e=="number"?[en,e]:e==null?xu:[e]}function at(e,t,n,r){let i,s,a;typeof t=="function"&&typeof n!="function"?(s=void 0,a=t,i=n):(s=t,a=n,i=r),ki(e,s,u,i);function u(o,c){const h=c[c.length-1],d=h?h.children.indexOf(o):void 0;return a(o,d,h)}}function Nh({defaultOrigin:e="",allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:s="inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm",blockedLinkClass:a="text-gray-500"}){const u=t.length&&!t.every(c=>c==="*"),o=n.length&&!n.every(c=>c==="*");if(!e&&(u||o))throw new Error("defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided");return c=>{const h=Oh(e,t,n,r,i,s,a);at(c,h)}}function Ss(e,t){if(typeof e!="string")return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))try{return new URL(e,"http://example.com")}catch{return null}return null}}function Sh(e){return typeof e!="string"?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}const wh=new Set(["https:","http:","irc:","ircs:","mailto:","xmpp:","blob:"]),Lh=new Set(["javascript:","data:","file:","vbscript:"]);function ws(e,t,n,r=!1,i=!1,s=[]){if(!e)return null;if(typeof e=="string"&&e.startsWith("#")&&!i)try{if(new URL(e,"http://example.com").hash===e)return e}catch{}if(typeof e=="string"&&e.startsWith("data:"))return i&&r&&e.startsWith("data:image/")?e:null;if(typeof e=="string"&&e.startsWith("blob:")){try{if(new URL(e).protocol==="blob:"&&e.length>5){const h=e.substring(5);if(h&&h.length>0&&h!=="invalid")return e}}catch{return null}return null}const a=Ss(e,n);if(!a||Lh.has(a.protocol)||!(wh.has(a.protocol)||s.includes(a.protocol)||s.includes("*")))return null;if(a.protocol==="mailto:"||!a.protocol.match(/^https?:$/))return a.href;const o=Sh(e);return a&&t.some(c=>{const h=Ss(c,n);return!h||h.origin!==a.origin?!1:a.href.startsWith(h.href)})?o?a.pathname+a.search+a.hash:a.href:t.includes("*")?a.protocol!=="https:"&&a.protocol!=="http:"?null:o?a.pathname+a.search+a.hash:a.href:null}const Ar=Symbol("node-seen"),Oh=(e,t,n,r,i,s,a)=>{const u=(o,c,h)=>{if(o.type!=="element"||o[Ar])return en;if(o.tagName==="a"){const d=ws(o.properties.href,t,e,!1,!1,i);return d===null?(o[Ar]=!0,at(o,u),h&&typeof c=="number"&&(h.children[c]={type:"element",tagName:"span",properties:{title:"Blocked URL: "+String(o.properties.href),class:a},children:[...o.children,{type:"text",value:" [blocked]"}]}),Vn):(o.properties.href=d,o.properties.target="_blank",o.properties.rel="noopener noreferrer",en)}if(o.tagName==="img"){const d=ws(o.properties.src,n,e,r,!0,i);return d===null?(o[Ar]=!0,at(o,u),h&&typeof c=="number"&&(h.children[c]={type:"element",tagName:"span",properties:{class:s},children:[{type:"text",value:"[Image blocked: "+String(o.properties.alt||"No description")+"]"}]}),Vn):(o.properties.src=d,en)}return en};return u},ku=-1,or=0,rn=1,Wn=2,_i=3,Ai=4,Ci=5,yi=6,_u=7,Au=8,Ls=typeof self=="object"?self:globalThis,Rh=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case or:case ku:return n(a,i);case rn:{const u=n([],i);for(const o of a)u.push(r(o));return u}case Wn:{const u=n({},i);for(const[o,c]of a)u[r(o)]=r(c);return u}case _i:return n(new Date(a),i);case Ai:{const{source:u,flags:o}=a;return n(new RegExp(u,o),i)}case Ci:{const u=n(new Map,i);for(const[o,c]of a)u.set(r(o),r(c));return u}case yi:{const u=n(new Set,i);for(const o of a)u.add(r(o));return u}case _u:{const{name:u,message:o}=a;return n(new Ls[u](o),i)}case Au:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return n(new DataView(u),a)}}return n(new Ls[s](a),i)};return r},Os=e=>Rh(new Map,e)(0),wt="",{toString:Dh}={},{keys:Ph}=Object,Vt=e=>{const t=typeof e;if(t!=="object"||!e)return[or,t];const n=Dh.call(e).slice(8,-1);switch(n){case"Array":return[rn,wt];case"Object":return[Wn,wt];case"Date":return[_i,wt];case"RegExp":return[Ai,wt];case"Map":return[Ci,wt];case"Set":return[yi,wt];case"DataView":return[rn,n]}return n.includes("Array")?[rn,n]:n.includes("Error")?[_u,n]:[Wn,n]},Rn=([e,t])=>e===or&&(t==="function"||t==="symbol"),Mh=(e,t,n,r)=>{const i=(a,u)=>{const o=r.push(a)-1;return n.set(u,o),o},s=a=>{if(n.has(a))return n.get(a);let[u,o]=Vt(a);switch(u){case or:{let h=a;switch(o){case"bigint":u=Au,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+o);h=null;break;case"undefined":return i([ku],a)}return i([u,h],a)}case rn:{if(o){let f=a;return o==="DataView"?f=new Uint8Array(a.buffer):o==="ArrayBuffer"&&(f=new Uint8Array(a)),i([o,[...f]],a)}const h=[],d=i([u,h],a);for(const f of a)h.push(s(f));return d}case Wn:{if(o)switch(o){case"BigInt":return i([o,a.toString()],a);case"Boolean":case"Number":case"String":return i([o,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const h=[],d=i([u,h],a);for(const f of Ph(a))(e||!Rn(Vt(a[f])))&&h.push([s(f),s(a[f])]);return d}case _i:return i([u,a.toISOString()],a);case Ai:{const{source:h,flags:d}=a;return i([u,{source:h,flags:d}],a)}case Ci:{const h=[],d=i([u,h],a);for(const[f,p]of a)(e||!(Rn(Vt(f))||Rn(Vt(p))))&&h.push([s(f),s(p)]);return d}case yi:{const h=[],d=i([u,h],a);for(const f of a)(e||!Rn(Vt(f)))&&h.push(s(f));return d}}const{message:c}=a;return i([u,{name:o,message:c}],a)};return s},Rs=(e,{json:t,lossy:n}={})=>{const r=[];return Mh(!(t||n),!!t,new Map,r)(e),r},gt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Os(Rs(e,t)):structuredClone(e):(e,t)=>Os(Rs(e,t));class An{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}An.prototype.normal={};An.prototype.property={};An.prototype.space=void 0;function Cu(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new An(n,r,t)}function gn(e){return e.toLowerCase()}class Se{constructor(t,n){this.attribute=n,this.property=t}}Se.prototype.attribute="";Se.prototype.booleanish=!1;Se.prototype.boolean=!1;Se.prototype.commaOrSpaceSeparated=!1;Se.prototype.commaSeparated=!1;Se.prototype.defined=!1;Se.prototype.mustUseProperty=!1;Se.prototype.number=!1;Se.prototype.overloadedBoolean=!1;Se.prototype.property="";Se.prototype.spaceSeparated=!1;Se.prototype.space=void 0;let vh=0;const J=kt(),me=kt(),Wr=kt(),v=kt(),he=kt(),Pt=kt(),Oe=kt();function kt(){return 2**++vh}const Gr=Object.freeze(Object.defineProperty({__proto__:null,boolean:J,booleanish:me,commaOrSpaceSeparated:Oe,commaSeparated:Pt,number:v,overloadedBoolean:Wr,spaceSeparated:he},Symbol.toStringTag,{value:"Module"})),Cr=Object.keys(Gr);class Ii extends Se{constructor(t,n,r,i){let s=-1;if(super(t,n),Ds(this,"space",i),typeof r=="number")for(;++s<Cr.length;){const a=Cr[s];Ds(this,Cr[s],(r&Gr[a])===Gr[a])}}}Ii.prototype.defined=!0;function Ds(e,t,n){n&&(e[t]=n)}function Ft(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Ii(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[gn(r)]=r,n[gn(s.attribute)]=r}return new An(t,n,e.space)}const yu=Ft({properties:{ariaActiveDescendant:null,ariaAtomic:me,ariaAutoComplete:null,ariaBusy:me,ariaChecked:me,ariaColCount:v,ariaColIndex:v,ariaColSpan:v,ariaControls:he,ariaCurrent:null,ariaDescribedBy:he,ariaDetails:null,ariaDisabled:me,ariaDropEffect:he,ariaErrorMessage:null,ariaExpanded:me,ariaFlowTo:he,ariaGrabbed:me,ariaHasPopup:null,ariaHidden:me,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:he,ariaLevel:v,ariaLive:null,ariaModal:me,ariaMultiLine:me,ariaMultiSelectable:me,ariaOrientation:null,ariaOwns:he,ariaPlaceholder:null,ariaPosInSet:v,ariaPressed:me,ariaReadOnly:me,ariaRelevant:null,ariaRequired:me,ariaRoleDescription:he,ariaRowCount:v,ariaRowIndex:v,ariaRowSpan:v,ariaSelected:me,ariaSetSize:v,ariaSort:null,ariaValueMax:v,ariaValueMin:v,ariaValueNow:v,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Iu(e,t){return t in e?e[t]:t}function Nu(e,t){return Iu(e,t.toLowerCase())}const Bh=Ft({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Pt,acceptCharset:he,accessKey:he,action:null,allow:null,allowFullScreen:J,allowPaymentRequest:J,allowUserMedia:J,alt:null,as:null,async:J,autoCapitalize:null,autoComplete:he,autoFocus:J,autoPlay:J,blocking:he,capture:null,charSet:null,checked:J,cite:null,className:he,cols:v,colSpan:null,content:null,contentEditable:me,controls:J,controlsList:he,coords:v|Pt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:J,defer:J,dir:null,dirName:null,disabled:J,download:Wr,draggable:me,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:J,formTarget:null,headers:he,height:v,hidden:Wr,high:v,href:null,hrefLang:null,htmlFor:he,httpEquiv:he,id:null,imageSizes:null,imageSrcSet:null,inert:J,inputMode:null,integrity:null,is:null,isMap:J,itemId:null,itemProp:he,itemRef:he,itemScope:J,itemType:he,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:J,low:v,manifest:null,max:null,maxLength:v,media:null,method:null,min:null,minLength:v,multiple:J,muted:J,name:null,nonce:null,noModule:J,noValidate:J,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:J,optimum:v,pattern:null,ping:he,placeholder:null,playsInline:J,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:J,referrerPolicy:null,rel:he,required:J,reversed:J,rows:v,rowSpan:v,sandbox:he,scope:null,scoped:J,seamless:J,selected:J,shadowRootClonable:J,shadowRootDelegatesFocus:J,shadowRootMode:null,shape:null,size:v,sizes:null,slot:null,span:v,spellCheck:me,src:null,srcDoc:null,srcLang:null,srcSet:null,start:v,step:null,style:null,tabIndex:v,target:null,title:null,translate:null,type:null,typeMustMatch:J,useMap:null,value:me,width:v,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:he,axis:null,background:null,bgColor:null,border:v,borderColor:null,bottomMargin:v,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:J,declare:J,event:null,face:null,frame:null,frameBorder:null,hSpace:v,leftMargin:v,link:null,longDesc:null,lowSrc:null,marginHeight:v,marginWidth:v,noResize:J,noHref:J,noShade:J,noWrap:J,object:null,profile:null,prompt:null,rev:null,rightMargin:v,rules:null,scheme:null,scrolling:me,standby:null,summary:null,text:null,topMargin:v,valueType:null,version:null,vAlign:null,vLink:null,vSpace:v,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:J,disableRemotePlayback:J,prefix:null,property:null,results:v,security:null,unselectable:null},space:"html",transform:Nu}),Fh=Ft({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Oe,accentHeight:v,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:v,amplitude:v,arabicForm:null,ascent:v,attributeName:null,attributeType:null,azimuth:v,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:v,by:null,calcMode:null,capHeight:v,className:he,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:v,diffuseConstant:v,direction:null,display:null,dur:null,divisor:v,dominantBaseline:null,download:J,dx:null,dy:null,edgeMode:null,editable:null,elevation:v,enableBackground:null,end:null,event:null,exponent:v,externalResourcesRequired:null,fill:null,fillOpacity:v,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pt,g2:Pt,glyphName:Pt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:v,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:v,horizOriginX:v,horizOriginY:v,id:null,ideographic:v,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:v,k:v,k1:v,k2:v,k3:v,k4:v,kernelMatrix:Oe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:v,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:v,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:v,overlineThickness:v,paintOrder:null,panose1:null,path:null,pathLength:v,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:he,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:v,pointsAtY:v,pointsAtZ:v,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Oe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Oe,rev:Oe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Oe,requiredFeatures:Oe,requiredFonts:Oe,requiredFormats:Oe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:v,specularExponent:v,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:v,strikethroughThickness:v,string:null,stroke:null,strokeDashArray:Oe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:v,strokeOpacity:v,strokeWidth:null,style:null,surfaceScale:v,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Oe,tabIndex:v,tableValues:null,target:null,targetX:v,targetY:v,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Oe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:v,underlineThickness:v,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:v,values:null,vAlphabetic:v,vMathematical:v,vectorEffect:null,vHanging:v,vIdeographic:v,version:null,vertAdvY:v,vertOriginX:v,vertOriginY:v,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:v,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Iu}),Su=Ft({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),wu=Ft({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Nu}),Lu=Ft({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Hh={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Uh=/[A-Z]/g,Ps=/-[a-z]/g,jh=/^data[-\w.:]+$/i;function lr(e,t){const n=gn(t);let r=t,i=Se;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&jh.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ps,$h);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ps.test(s)){let a=s.replace(Uh,zh);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Ii}return new i(r,t)}function zh(e){return"-"+e.toLowerCase()}function $h(e){return e.charAt(1).toUpperCase()}const Cn=Cu([yu,Bh,Su,wu,Lu],"html"),ot=Cu([yu,Fh,Su,wu,Lu],"svg");function Ms(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&t.push(a),i=r+1,r=n.indexOf(",",i)}return t}function Ou(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const vs=/[#.]/g;function Yh(e,t){const n=e||"",r={};let i=0,s,a;for(;i<n.length;){vs.lastIndex=i;const u=vs.exec(n),o=n.slice(i,u?u.index:n.length);o&&(s?s==="#"?r.id=o:Array.isArray(r.className)?r.className.push(o):r.className=[o]:a=o,i+=o.length),u&&(s=u[0],i++)}return{type:"element",tagName:a||t||"div",properties:r,children:[]}}function Bs(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Ru(e){return e.join(" ").trim()}function Du(e,t,n){const r=n?Gh(n):void 0;function i(s,a,...u){let o;if(s==null){o={type:"root",children:[]};const c=a;u.unshift(c)}else{o=Yh(s,t);const c=o.tagName.toLowerCase(),h=r?r.get(c):void 0;if(o.tagName=h||c,qh(a))u.unshift(a);else for(const[d,f]of Object.entries(a))Vh(e,o.properties,d,f)}for(const c of u)Kr(o.children,c);return o.type==="element"&&o.tagName==="template"&&(o.content={type:"root",children:o.children},o.children=[]),o}return i}function qh(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const i=t[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const a of s)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Vh(e,t,n,r){const i=lr(e,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=Bs(r):i.commaSeparated?s=Ms(r):i.commaOrSpaceSeparated?s=Bs(Ms(r).join(" ")):s=Fs(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?Wh(r):String(r);if(Array.isArray(s)){const a=[];for(const u of s)a.push(Fs(i,i.property,u));s=a}i.property==="className"&&Array.isArray(t.className)&&(s=t.className.concat(s)),t[i.property]=s}}function Kr(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)Kr(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?Kr(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function Fs(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||gn(n)===gn(t)))return!0}return n}function Wh(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function Gh(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Kh=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],Qh=Du(Cn,"div"),Xh=Du(ot,"g",Kh);function Zh(e){const t=String(e),n=[];return{toOffset:i,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=t.length){let a=0;for(;;){let u=n[a];if(u===void 0){const o=Hs(t,n[a-1]);u=o===-1?t.length+1:o+1,n[a]=u}if(u>s)return{line:a+1,column:s-(a>0?n[a-1]:0)+1,offset:s};a++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const u=n[n.length-1],o=Hs(t,u),c=o===-1?t.length+1:o+1;if(u===c)break;n.push(c)}const a=(s.line>1?n[s.line-2]:0)+s.column-1;if(a<n[s.line-1])return a}}}function Hs(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
|
|
@@ -116,9 +116,9 @@ Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error
|
|
|
116
116
|
`||h==="\r"){o=!0;break}if(!o)return u;let c=[];for(let h of u)h===" "?c.push("\\t"):h===`
|
|
117
117
|
`?c.push("\\n"):h==="\r"?c.push("\\r"):c.push(h);return c.join("")},i=t.length>0?n.length+1:n.length,s=new Array(i),a=0;t.length>0&&(s[a]=t.map(r).join(" "),a+=1);for(let u of n)s[a]=u.map(r).join(" "),a+=1;return s.join(`
|
|
118
118
|
`)},Yr=e=>{let t=!1;for(let r of e)if(r==="\\"||r==="|"){t=!0;break}if(!t)return e;let n=[];for(let r of e)r==="\\"?n.push("\\\\"):r==="|"?n.push("\\|"):n.push(r);return n.join("")},Cx=e=>{let{headers:t,rows:n}=e;if(t.length===0)return"";let r=new Array(n.length+2),i=0,s=t.map(u=>Yr(u));r[i]=`| ${s.join(" | ")} |`,i+=1;let a=new Array(t.length);for(let u=0;u<t.length;u+=1)a[u]="---";r[i]=`| ${a.join(" | ")} |`,i+=1;for(let u of n)if(u.length<t.length){let o=new Array(t.length);for(let c=0;c<t.length;c+=1)o[c]=c<u.length?Yr(u[c]):"";r[i]=`| ${o.join(" | ")} |`,i+=1}else{let o=u.map(c=>Yr(c));r[i]=`| ${o.join(" | ")} |`,i+=1}return r.join(`
|
|
119
|
-
`)},yx=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let[s,a]=A.useState(!1),[u,o]=A.useState(!1),c=A.useRef(null),h=A.useRef(0),{isAnimating:d}=A.useContext(ve),f=async E=>{var _,I;if(typeof window>"u"||!((_=navigator?.clipboard)!=null&&_.write)){r?.(new Error("Clipboard API not available"));return}try{let C=(I=c.current)==null?void 0:I.closest('[data-streamdown="table-wrapper"]'),w=C?.querySelector("table");if(!w){r?.(new Error("Table not found"));return}let O=Pl(w),F=E==="csv"?Ml(O):Ax(O),z=new ClipboardItem({"text/plain":new Blob([F],{type:"text/plain"}),"text/html":new Blob([w.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),o(!0),a(!1),n?.(E),h.current=window.setTimeout(()=>o(!1),i)}catch(C){r?.(C)}};A.useEffect(()=>{let E=_=>{let I=_.composedPath();c.current&&!I.includes(c.current)&&a(!1)};return document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E),window.clearTimeout(h.current)}},[]);let p=u?Ji:es;return m.jsxs("div",{className:"relative",ref:c,children:[m.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:d,onClick:()=>a(!s),title:"Copy table",type:"button",children:e??m.jsx(p,{size:14})}),s?m.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[m.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),m.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})},Ix=({children:e,className:t,onDownload:n,onError:r})=>{let[i,s]=A.useState(!1),a=A.useRef(null),{isAnimating:u}=A.useContext(ve),o=c=>{var h;try{let d=(h=a.current)==null?void 0:h.closest('[data-streamdown="table-wrapper"]'),f=d?.querySelector("table");if(!f){r?.(new Error("Table not found"));return}let p=Pl(f),E=c==="csv"?Ml(p):Cx(p);Mt(`table.${c==="csv"?"csv":"md"}`,E,c==="csv"?"text/csv":"text/markdown"),s(!1),n?.(c)}catch(d){r?.(d)}};return A.useEffect(()=>{let c=h=>{let d=h.composedPath();a.current&&!d.includes(a.current)&&s(!1)};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]),m.jsxs("div",{className:"relative",ref:a,children:[m.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>s(!i),title:"Download table",type:"button",children:e??m.jsx(xr,{size:14})}),i?m.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[m.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),m.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})},Nx=({children:e,className:t,showControls:n,...r})=>m.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[n?m.jsxs("div",{className:"flex items-center justify-end gap-1",children:[m.jsx(yx,{}),m.jsx(Ix,{})]}):null,m.jsx("div",{className:"overflow-x-auto overscroll-y-auto",children:m.jsx("table",{className:Q("w-full border-collapse border border-border",t),"data-streamdown":"table",...r,children:e})})]}),Sx=A.lazy(()=>xi(()=>import("./code-block-OCS4YCEC-DOp940bN.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeBlock}))),wx=A.lazy(()=>xi(()=>Promise.resolve().then(()=>d3),void 0).then(e=>({default:e.Mermaid}))),Lx=/language-([^\s]+)/;function kr(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,s=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===s?.line&&i?.column===s?.column}function fe(e,t){return e.className===t.className&&kr(e.node,t.node)}var fi=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,Fn=(e,t)=>{if(typeof e=="boolean")return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},ns=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("ol",{className:Q("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...r,children:e}),(e,t)=>fe(e,t));ns.displayName="MarkdownOl";var vl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("li",{className:Q("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...r,children:e}),(e,t)=>e.className===t.className&&kr(e.node,t.node));vl.displayName="MarkdownLi";var Bl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("ul",{className:Q("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...r,children:e}),(e,t)=>fe(e,t));Bl.displayName="MarkdownUl";var Fl=A.memo(({className:e,node:t,...n})=>m.jsx("hr",{className:Q("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n}),(e,t)=>fe(e,t));Fl.displayName="MarkdownHr";var Hl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("span",{className:Q("font-semibold",t),"data-streamdown":"strong",...r,children:e}),(e,t)=>fe(e,t));Hl.displayName="MarkdownStrong";var Ox=({children:e,className:t,href:n,node:r,...i})=>{let{linkSafety:s}=A.useContext(ve),[a,u]=A.useState(!1),o=n==="streamdown:incomplete-link",c=A.useCallback(async p=>{if(!(!(s!=null&&s.enabled&&n)||o)){if(p.preventDefault(),s.onLinkCheck&&await s.onLinkCheck(n)){window.open(n,"_blank","noreferrer");return}u(!0)}},[s,n,o]),h=A.useCallback(()=>{n&&window.open(n,"_blank","noreferrer")},[n]),d=A.useCallback(()=>{u(!1)},[]),f={url:n??"",isOpen:a,onClose:d,onConfirm:h};return s!=null&&s.enabled&&n?m.jsxs(m.Fragment,{children:[m.jsx("button",{className:Q("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",onClick:c,type:"button",children:e}),s.renderModal?s.renderModal(f):m.jsx(Ex,{...f})]}):m.jsx("a",{className:Q("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...i,children:e})},Ul=A.memo(Ox,(e,t)=>fe(e,t)&&e.href===t.href);Ul.displayName="MarkdownA";var jl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h1",{className:Q("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...r,children:e}),(e,t)=>fe(e,t));jl.displayName="MarkdownH1";var zl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h2",{className:Q("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...r,children:e}),(e,t)=>fe(e,t));zl.displayName="MarkdownH2";var $l=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h3",{className:Q("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...r,children:e}),(e,t)=>fe(e,t));$l.displayName="MarkdownH3";var Yl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h4",{className:Q("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...r,children:e}),(e,t)=>fe(e,t));Yl.displayName="MarkdownH4";var ql=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h5",{className:Q("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...r,children:e}),(e,t)=>fe(e,t));ql.displayName="MarkdownH5";var Vl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h6",{className:Q("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...r,children:e}),(e,t)=>fe(e,t));Vl.displayName="MarkdownH6";var Wl=A.memo(({children:e,className:t,node:n,...r})=>{let{controls:i}=A.useContext(ve),s=fi(i,"table");return m.jsx(Nx,{className:t,showControls:s,...r,children:e})},(e,t)=>fe(e,t));Wl.displayName="MarkdownTable";var Gl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("thead",{className:Q("bg-muted/80",t),"data-streamdown":"table-header",...r,children:e}),(e,t)=>fe(e,t));Gl.displayName="MarkdownThead";var Kl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("tbody",{className:Q("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...r,children:e}),(e,t)=>fe(e,t));Kl.displayName="MarkdownTbody";var Ql=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("tr",{className:Q("border-border border-b",t),"data-streamdown":"table-row",...r,children:e}),(e,t)=>fe(e,t));Ql.displayName="MarkdownTr";var Xl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("th",{className:Q("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,children:e}),(e,t)=>fe(e,t));Xl.displayName="MarkdownTh";var Zl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("td",{className:Q("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...r,children:e}),(e,t)=>fe(e,t));Zl.displayName="MarkdownTd";var Jl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("blockquote",{className:Q("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...r,children:e}),(e,t)=>fe(e,t));Jl.displayName="MarkdownBlockquote";var ec=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("sup",{className:Q("text-sm",t),"data-streamdown":"superscript",...r,children:e}),(e,t)=>fe(e,t));ec.displayName="MarkdownSup";var tc=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("sub",{className:Q("text-sm",t),"data-streamdown":"subscript",...r,children:e}),(e,t)=>fe(e,t));tc.displayName="MarkdownSub";var nc=A.memo(({children:e,className:t,node:n,...r})=>{if("data-footnotes"in r){let i=a=>{var u,o;if(!A.isValidElement(a))return!1;let c=Array.isArray(a.props.children)?a.props.children:[a.props.children],h=!1,d=!1;for(let f of c)if(f){if(typeof f=="string")f.trim()!==""&&(h=!0);else if(A.isValidElement(f))if(((u=f.props)==null?void 0:u["data-footnote-backref"])!==void 0)d=!0;else{let p=Array.isArray(f.props.children)?f.props.children:[f.props.children];for(let E of p){if(typeof E=="string"&&E.trim()!==""){h=!0;break}if(A.isValidElement(E)&&((o=E.props)==null?void 0:o["data-footnote-backref"])===void 0){h=!0;break}}}}return d&&!h},s=Array.isArray(e)?e.map(a=>{if(!A.isValidElement(a))return a;if(a.type===ns){let u=(Array.isArray(a.props.children)?a.props.children:[a.props.children]).filter(o=>!i(o));return u.length===0?null:{...a,props:{...a.props,children:u}}}return a}):e;return(Array.isArray(s)?s.some(a=>a!==null):s!==null)?m.jsx("section",{className:t,...r,children:s}):null}return m.jsx("section",{className:t,...r,children:e})},(e,t)=>fe(e,t));nc.displayName="MarkdownSection";var Rx=({node:e,className:t,children:n,...r})=>{var i;let s=!("data-block"in r),{mermaid:a,controls:u}=A.useContext(ve),o=ts();if(s)return m.jsx("code",{className:Q("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...r,children:n});let c=t?.match(Lx),h=(i=c?.at(1))!=null?i:"",d="";if(A.isValidElement(n)&&n.props&&typeof n.props=="object"&&"children"in n.props&&typeof n.props.children=="string"?d=n.props.children:typeof n=="string"&&(d=n),h==="mermaid"&&o){let p=fi(u,"mermaid"),E=Fn(u,"download"),_=Fn(u,"copy"),I=Fn(u,"fullscreen"),C=Fn(u,"panZoom"),w=p&&(E||_||I);return m.jsx(A.Suspense,{fallback:m.jsx(Za,{}),children:m.jsxs("div",{className:Q("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[w?m.jsxs("div",{className:"flex items-center justify-end gap-2",children:[E?m.jsx(Tx,{chart:d,config:a?.config}):null,_?m.jsx(Qa,{code:d}):null,I?m.jsx(_x,{chart:d,config:a?.config}):null]}):null,m.jsx(wx,{chart:d,config:a?.config,showControls:C})]})})}let f=fi(u,"code");return m.jsx(A.Suspense,{fallback:m.jsx(Za,{}),children:m.jsx(Sx,{className:Q("overflow-x-auto border-border border-t",t),code:d,language:h,children:f?m.jsxs(m.Fragment,{children:[m.jsx(dx,{code:d,language:h}),m.jsx(Qa,{})]}):null})})},rc=A.memo(Rx,(e,t)=>e.className===t.className&&kr(e.node,t.node));rc.displayName="MarkdownCode";var ic=A.memo(px,(e,t)=>e.className===t.className&&kr(e.node,t.node));ic.displayName="MarkdownImg";var sc=A.memo(({children:e,className:t,node:n,...r})=>{let i=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(i.length===1&&A.isValidElement(i[0])){let s=i[0].props.node,a=s?.tagName;if(a==="img")return m.jsx(m.Fragment,{children:e});if(a==="code"&&"data-block"in i[0].props)return m.jsx(m.Fragment,{children:e})}return m.jsx("p",{className:t,...r,children:e})},(e,t)=>fe(e,t));sc.displayName="MarkdownParagraph";var Dx={ol:ns,li:vl,ul:Bl,hr:Fl,strong:Hl,a:Ul,h1:jl,h2:zl,h3:$l,h4:Yl,h5:ql,h6:Vl,table:Wl,thead:Gl,tbody:Kl,tr:Ql,th:Xl,td:Zl,blockquote:Jl,code:rc,img:ic,pre:({children:e})=>A.isValidElement(e)?A.cloneElement(e,{"data-block":"true"}):e,sup:ec,sub:tc,p:sc,section:nc},Px=()=>e=>{at(e,"html",(t,n,r)=>{!r||typeof n!="number"||(r.children[n]={type:"text",value:t.value})})},Ja=[],eu={allowDangerousHtml:!0},Hn=new WeakMap,Mx=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let h="default";return this.keyCache.set(e,h),h}let s=h=>{if(!h||h.length===0)return"";let d="";for(let f=0;f<h.length;f+=1){let p=h[f];if(f>0&&(d+=","),Array.isArray(p)){let[E,_]=p;if(typeof E=="function"){let I=Hn.get(E);I||(I=E.name,Hn.set(E,I)),d+=I}else d+=String(E);d+=":",d+=JSON.stringify(_)}else if(typeof p=="function"){let E=Hn.get(p);E||(E=p.name,Hn.set(p,E)),d+=E}else d+=String(p)}return d},a=s(n),u=s(r),o=i?JSON.stringify(i):"",c=`${u}::${a}::${o}`;return this.keyCache.set(e,c),c}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r)}this.cache.set(n,t)}clear(){this.cache.clear()}},tu=new Mx,ac=e=>{let t=vx(e),n=e.children||"";return $x(t.runSync(t.parse(n),n),e)},vx=e=>{let t=tu.get(e);if(t)return t;let n=Fx(e);return tu.set(e,n),n},Bx=e=>e.some(t=>Array.isArray(t)?t[0]===ei:t===ei),Fx=e=>{let t=e.rehypePlugins||Ja,n=e.remarkPlugins||Ja,r=Bx(t)?n:[...n,Px],i=e.remarkRehypeOptions?{...eu,...e.remarkRehypeOptions}:eu;return u2().use(aT).use(r).use(zT,i).use(t)},Hx=e=>e,Ux=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:"text",value:r}},jx=(e,t)=>{var n;for(let r in Mr)if(Object.hasOwn(Mr,r)&&Object.hasOwn(e.properties,r)){let i=e.properties[r],s=Mr[r];(s===null||s.includes(e.tagName))&&(e.properties[r]=(n=t(String(i||""),r,e))!=null?n:void 0)}},zx=(e,t,n,r,i,s)=>{let a=!1;return r?a=!r.includes(e.tagName):i&&(a=i.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,n)),a},$x=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:s,unwrapDisallowed:a,urlTransform:u}=t;if(n||r||i||s||u){let o=u||Hx;at(e,(c,h,d)=>{if(c.type==="raw"&&d&&typeof h=="number")return Ux(d,h,s,c.value),h;if(c.type==="element"&&(jx(c,o),zx(c,h,d,r,i,n)&&d&&typeof h=="number"))return a&&c.children?d.children.splice(h,1,...c.children):d.children.splice(h,1),h})}return pb(e,{Fragment:m.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0})},Yx=/\[\^[\w-]{1,200}\](?!:)/,qx=/\[\^[\w-]{1,200}\]:/,Vx=/<\/(\w+)>/,Wx=/<(\w+)[\s>]/,Gx=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Kx=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]==="$"&&e[n+1]==="$"&&(t+=1,n+=1);return t},Qx=e=>{let t=Yx.test(e),n=qx.test(e);if(t||n)return[e];let r=Me.lex(e,{gfm:!0}),i=[],s=[],a=!1;for(let u of r){let o=u.raw,c=i.length;if(s.length>0){if(i[c-1]+=o,u.type==="html"){let h=o.match(Vx);if(h){let d=h[1];s.at(-1)===d&&s.pop()}}continue}if(u.type==="html"&&u.block){let h=o.match(Wx);if(h){let d=h[1];o.includes(`</${d}>`)||Gx.has(d.toLowerCase())||s.push(d)}}if(c>0&&!a){let h=i[c-1];if(Kx(h)%2===1){i[c-1]=h+o;continue}}i.push(o),u.type!=="space"&&(a=u.type==="code")}return i},nu,ru,Yn={...cn,protocols:{...cn.protocols,href:[...(ru=(nu=cn.protocols)==null?void 0:nu.href)!=null?ru:[],"tel"]}},pi={raw:ei,sanitize:[ko,Yn],harden:[Nh,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},Xx={gfm:[Yg,{}]},iu=Object.values(pi),Zx=Object.values(Xx),Jx={block:" ▋",circle:" ●"},ek={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},ve=A.createContext(ek),uc=A.memo(({content:e,shouldParseIncompleteMarkdown:t,index:n,...r})=>m.jsx(ac,{...r,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(i=>{var s,a;return((s=e.components)==null?void 0:s[i])!==((a=t.components)==null?void 0:a[i])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});uc.displayName="Block";var tk=["github-light","github-dark"],oc=A.memo(({children:e,mode:t="streaming",parseIncompleteMarkdown:n=!0,components:r,rehypePlugins:i=iu,remarkPlugins:s=Zx,className:a,shikiTheme:u=tk,mermaid:o,controls:c=!0,isAnimating:h=!1,animated:d,BlockComponent:f=uc,parseMarkdownIntoBlocksFn:p=Qx,caret:E,plugins:_,remend:I,linkSafety:C={enabled:!0},allowedTags:w,...O})=>{let F=A.useId(),[z,L]=A.useTransition(),K=A.useMemo(()=>typeof e!="string"?"":t==="streaming"&&n?ZE(e,I):e,[e,t,n,I]),G=A.useMemo(()=>p(K),[K,p]),[X,N]=A.useState(G);A.useEffect(()=>{t==="streaming"?L(()=>{N(G)}):N(G)},[G,t]);let U=t==="streaming"?X:G,M=A.useMemo(()=>U.map((se,x)=>`${F}-${x}`),[U.length,F]),V=A.useMemo(()=>d?d===!0?hi():hi(d):null,[d]),$=A.useMemo(()=>{var se,x;return{shikiTheme:(x=(se=_?.code)==null?void 0:se.getThemes())!=null?x:u,controls:c,isAnimating:h,mode:t,mermaid:o,linkSafety:C}},[u,c,h,t,o,C,_?.code]),j=A.useMemo(()=>({...Dx,...r}),[r]),B=A.useMemo(()=>{let se=[];return _!=null&&_.cjk&&(se=[...se,..._.cjk.remarkPluginsBefore]),se=[...se,...s],_!=null&&_.cjk&&(se=[...se,..._.cjk.remarkPluginsAfter]),_!=null&&_.math&&(se=[...se,_.math.remarkPlugin]),se},[s,_?.math,_?.cjk]),W=A.useMemo(()=>{var se;let x=i;if(w&&Object.keys(w).length>0&&i===iu){let we={...Yn,tagNames:[...(se=Yn.tagNames)!=null?se:[],...Object.keys(w)],attributes:{...Yn.attributes,...w}};x=[pi.raw,[ko,we],pi.harden]}return _!=null&&_.math&&(x=[...x,_.math.rehypePlugin]),V&&h&&(x=[...x,V.rehypePlugin]),x},[i,_?.math,V,h,w]),oe=A.useMemo(()=>E&&h?{"--streamdown-caret":`"${Jx[E]}"`}:void 0,[E,h]);return t==="static"?m.jsx(di.Provider,{value:_??null,children:m.jsx(ve.Provider,{value:$,children:m.jsx("div",{className:Q("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",a),children:m.jsx(ac,{components:j,rehypePlugins:W,remarkPlugins:B,...O,children:e})})})}):m.jsx(di.Provider,{value:_??null,children:m.jsx(ve.Provider,{value:$,children:m.jsxs("div",{className:Q("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",E?"*:last:after:inline *:last:after:align-baseline *:last:after:content-[var(--streamdown-caret)]":null,a),style:oe,children:[U.length===0&&E&&h&&m.jsx("span",{}),U.map((se,x)=>m.jsx(f,{components:j,content:se,index:x,rehypePlugins:W,remarkPlugins:B,shouldParseIncompleteMarkdown:n,...O},M[x]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);oc.displayName="Streamdown";var nk=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:s=!0,initialZoom:a=1,fullscreen:u=!1})=>{let o=A.useRef(null),c=A.useRef(null),[h,d]=A.useState(a),[f,p]=A.useState({x:0,y:0}),[E,_]=A.useState(!1),[I,C]=A.useState({x:0,y:0}),[w,O]=A.useState({x:0,y:0}),F=A.useCallback(M=>{d(V=>Math.max(n,Math.min(r,V+M)))},[n,r]),z=A.useCallback(()=>{F(i)},[F,i]),L=A.useCallback(()=>{F(-i)},[F,i]),K=A.useCallback(()=>{d(a),p({x:0,y:0})},[a]),G=A.useCallback(M=>{M.preventDefault();let V=M.deltaY>0?-i:i;F(V)},[F,i]),X=A.useCallback(M=>{if(M.button!==0||M.isPrimary===!1)return;_(!0),C({x:M.clientX,y:M.clientY}),O(f);let V=M.currentTarget;V instanceof HTMLElement&&V.setPointerCapture(M.pointerId)},[f]),N=A.useCallback(M=>{if(!E)return;M.preventDefault();let V=M.clientX-I.x,$=M.clientY-I.y;p({x:w.x+V,y:w.y+$})},[E,I,w]),U=A.useCallback(M=>{_(!1);let V=M.currentTarget;V instanceof HTMLElement&&V.releasePointerCapture(M.pointerId)},[]);return A.useEffect(()=>{let M=o.current;if(M)return M.addEventListener("wheel",G,{passive:!1}),()=>{M.removeEventListener("wheel",G)}},[G]),A.useEffect(()=>{let M=c.current;if(M&&E)return document.body.style.userSelect="none",M.addEventListener("pointermove",N,{passive:!1}),M.addEventListener("pointerup",U),M.addEventListener("pointercancel",U),()=>{document.body.style.userSelect="",M.removeEventListener("pointermove",N),M.removeEventListener("pointerup",U),M.removeEventListener("pointercancel",U)}},[E,N,U]),m.jsxs("div",{className:Q("relative flex flex-col",u?"h-full w-full":"min-h-28 w-full",t),ref:o,style:{cursor:E?"grabbing":"grab"},children:[s?m.jsxs("div",{className:Q("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",u?"bottom-4 left-4":"bottom-2 left-2"),children:[m.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:h>=r,onClick:z,title:"Zoom in",type:"button",children:m.jsx(lx,{size:16})}),m.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:h<=n,onClick:L,title:"Zoom out",type:"button",children:m.jsx(cx,{size:16})}),m.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:K,title:"Reset zoom and pan",type:"button",children:m.jsx(ox,{size:16})})]}):null,m.jsx("div",{className:Q("flex-1 origin-center transition-transform duration-150 ease-out",u?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:X,ref:c,role:"application",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${h})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},lc=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let[s,a]=A.useState(null),[u,o]=A.useState(!1),[c,h]=A.useState(""),[d,f]=A.useState(""),[p,E]=A.useState(0),{mermaid:_}=A.useContext(ve),I=ts(),C=_?.errorComponent,{shouldRender:w,containerRef:O}=X2({immediate:r});if(A.useEffect(()=>{if(w){if(!I){a("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{a(null),o(!0);let z=I.getMermaid(n),L=e.split("").reduce((X,N)=>(X<<5)-X+N.charCodeAt(0)|0,0),K=`mermaid-${Math.abs(L)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:G}=await z.render(K,e);h(G),f(G)}catch(z){if(!(d||c)){let L=z instanceof Error?z.message:"Failed to render Mermaid chart";a(L)}}finally{o(!1)}})()}},[e,n,p,w,I]),!(w||c||d))return m.jsx("div",{className:Q("my-4 min-h-[200px]",t),ref:O});if(u&&!c&&!d)return m.jsx("div",{className:Q("my-4 flex justify-center p-4",t),ref:O,children:m.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[m.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),m.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(s&&!c&&!d){let z=()=>E(L=>L+1);return C?m.jsx("div",{ref:O,children:m.jsx(C,{chart:e,error:s,retry:z})}):m.jsxs("div",{className:Q("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:O,children:[m.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",s]}),m.jsxs("details",{className:"mt-2",children:[m.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),m.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]})}let F=c||d;return m.jsx("div",{className:Q("size-full",t),"data-streamdown":"mermaid",ref:O,children:m.jsx(nk,{className:Q(r?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:m.jsx("div",{"aria-label":"Mermaid chart",className:Q("flex justify-center",r?"size-full items-center":null),dangerouslySetInnerHTML:{__html:F},role:"img"})})})};function rk({content:e,children:t,className:n="",side:r="top",align:i="center"}){const s=r==="bottom"?"top-full mt-2":"bottom-full mb-2",a=r==="bottom"?"bottom-full border-b-neutral-900":"top-full border-t-neutral-900",u=i==="start"?"left-0":i==="end"?"right-0":"left-1/2 -translate-x-1/2",o=i==="start"?"left-4":i==="end"?"right-4":"left-1/2 -translate-x-1/2";return m.jsxs("div",{className:`group/tooltip relative inline-block ${n}`,children:[t,m.jsxs("div",{className:`invisible absolute ${s} ${u} max-w-[260px] px-3 py-2 bg-neutral-900 text-white text-xs leading-relaxed rounded-lg opacity-0 group-hover/tooltip:visible group-hover/tooltip:opacity-100 group-focus-within/tooltip:visible group-focus-within/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-normal z-[100] shadow-lg`,children:[e,m.jsx("div",{className:`absolute ${a} ${o} border-4 border-transparent`})]})]})}const cc=/^[a-zA-Z]:[\\/]/,ik=/[/\\](attachments|conversations)[/\\]/,sk=/^\/(Users|home|tmp|private|var|opt|mnt|Volumes)(\/|$)/;function su(e){return e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")}function ak(e){const t=e.match(/^(.*)#L([1-9]\d*)(?:C([1-9]\d*))?$/i);if(t)return{path:t[1],line:Number(t[2]),column:t[3]?Number(t[3]):void 0};const n=e.match(/^(.*?):(\d+)(?::(\d+))?$/);if(n&&n[1]){const r=Number(n[2]),i=n[3]?Number(n[3]):void 0;if(r>0&&(!n[3]||i&&i>0))return{path:n[1],line:r,column:i}}return{path:e}}function uk(e,t){if(!t)return null;const n=su(e),r=su(t).replace(/\/$/,"");return n===r?null:n.startsWith(`${r}/`)?n.slice(r.length+1):n.startsWith("./")?n.slice(2):!n.startsWith("/")&&!cc.test(e)&&!n.startsWith("../")?n:null}function ok(e){return`${xt()}/attachments/by-path?path=${encodeURIComponent(e)}`}function hc(e,t){if(/^https?:\/\//i.test(e))return{type:"external",url:e};if(/^(mailto|tel):/i.test(e))return{type:"external",url:e};if(e.startsWith("/api/")||e.startsWith("#"))return{type:"internal",url:e};const n=ak(e),r=uk(n.path,t);return r?{type:"workspace-file",path:r,line:n.line,column:n.column}:ik.test(e)?{type:"attachment",path:e,url:ok(e)}:sk.test(e)||cc.test(e)?{type:"unknown-local",path:e}:{type:"internal",url:e}}function lk(e,t){const n=new URLSearchParams({workingDir:e,path:t});return`${xt()}/files/image?${n.toString()}`}function ck(e){const t=new URLSearchParams({path:e});return`${xt()}/files/image?${t.toString()}`}const dc="/__agent-tower/message-intent/codex-inline-vis",fc="/__agent-tower/message-intent/agent-download",hk=/^[ \t]{0,3}::codex-inline-vis\{file="([^"\r\n]+)"\}[ \t]*$/,pc=/^[a-z0-9][a-z0-9-]*\.html$/,dk=/^[ \t]{0,3}(`{3,}|~{3,})/;function fk(e,t){const n=t[0]==="`"?"`":"~";return new RegExp(`^[ \\t]{0,3}${n}{${t.length},}[ \\t]*$`).test(e)}function pk(e){let t=null;return e.split(/\r?\n/).map(n=>{if(t)return fk(n,t)&&(t=null),n;const r=n.match(dk);if(r)return t=r[1],n;const i=n.match(hk);if(i&&pc.test(i[1])){const u=`${dc}?file=${encodeURIComponent(i[1])}`;return`[${i[1]}](${u})`}const s=uh(n);if(!s)return n;const a=`${fc}?file=${encodeURIComponent(s)}`;return`[${s}](${a})`}).join(`
|
|
120
|
-
`)}function mk(e){try{const t=new URL(e,"http://agent-tower.local"),n=t.searchParams.get("file");if(!n)return null;if(t.pathname===dc&&pc.test(n))return{type:"codex-inline-visualization",file:n};if(t.pathname===fc){const r=bu(n);return r?{type:"agent-download",file:r}:null}return null}catch{return null}}function A3(e,t){return`${xt()}/sessions/${encodeURIComponent(e)}/visualizations/${encodeURIComponent(t)}`}function gk(e,t){const n=new URLSearchParams({path:t});return`${xt()}/sessions/${encodeURIComponent(e)}/artifacts/download?${n.toString()}`}const mc=new Set(["localhost","127.0.0.1","::1","[::1]","0.0.0.0"]);function Ek(e){return/^\d+$/.test(e)?`http://127.0.0.1:${e}`:/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(e)?e:`http://${e}`}function mi(e){try{return new URL(Ek(e.trim()))}catch{return null}}function au(e){return mc.has(e.hostname.toLowerCase())?"loopback":e.hostname.toLowerCase()}function uu(e){return e.port?e.port:e.protocol==="https:"?"443":"80"}function bk(e,t){return e.protocol===t.protocol&&au(e)===au(t)&&uu(e)===uu(t)}function gc(e){return!e||e==="/"?"":e.endsWith("/")?e.slice(0,-1):e}function Tk(e,t){return t?e===t||e.startsWith(`${t}/`):!0}function Un(e,t){return t?{kind:"target",target:t.origin,path:`${t.pathname}${t.search}${t.hash}`}:{kind:"target",target:e,path:null}}function ou(e,t){try{const i=new URL(e),s=i.searchParams.get("__agent_tower_preview_token"),a=new URL(t.startsWith("/")?t:`/${t}`,"http://preview.local");return i.pathname=a.pathname,i.search=a.search,i.hash=a.hash,s&&i.searchParams.set("__agent_tower_preview_token",s),i.toString()}catch{}const n=e.endsWith("/")?e:`${e}/`,r=t.startsWith("/")?t.slice(1):t;return`${n}${r}`}function C3(e,t,n){const r=e.trim();if(!r)return null;if(r.startsWith("/"))return n?{kind:"proxy",url:ou(n,r)}:null;const i=mi(r);if(!i)return Un(r,null);if(!t||!n)return Un(r,i);const s=mi(t);if(!s||!bk(i,s))return Un(r,i);const a=gc(s.pathname);if(!Tk(i.pathname,a))return Un(r,i);const u=i.pathname.slice(a.length)||"/";return{kind:"proxy",url:ou(n,`${u}${i.search}${i.hash}`)}}function y3(e,t,n,r){if(!e||!t)return null;try{const i=new URL(e),s=new URL(t,r),a=new URL(n,r),u=s.pathname==="/"?"":s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname;if(a.origin!==s.origin||u&&a.pathname!==u&&!a.pathname.startsWith(`${u}/`))return a.toString();const o=a.pathname.slice(u.length)||"/",c=gc(i.pathname);return i.pathname=`${c}${o}`.replace(/\/{2,}/g,"/")||"/",i.search=a.search,i.hash=a.hash,i.toString()}catch{return null}}function xk(e){const t=mi(e);return!!(t&&mc.has(t.hostname.toLowerCase()))}const Ec=({src:e,alt:t,className:n,node:r,...i})=>m.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:m.jsx("img",{src:e,alt:t,...i,className:kn("max-w-[300px] max-h-[200px] object-contain rounded-lg border border-neutral-200 cursor-pointer hover:opacity-90 active:opacity-90 transition-opacity",n)})}),kk=({href:e="",children:t,node:n,onClick:r,className:i,...s})=>{const{t:a}=sr(),{workingDir:u,onOpenWorkspaceFile:o,onOpenPreviewUrl:c,onOpenVisualization:h,downloadSessionId:d}=s,f=mk(e),p=hc(e,u),E={...s};delete E.workingDir,delete E.onOpenWorkspaceFile,delete E.onOpenPreviewUrl,delete E.onOpenVisualization,delete E.downloadSessionId;const _=kn("text-blue-600 underline decoration-blue-300 underline-offset-2 transition-colors hover:text-blue-700 hover:decoration-blue-500",i);if(f?.type==="codex-inline-visualization")return h?m.jsxs("button",{type:"button",onClick:()=>h(f.file),title:a("Open visualization"),className:"inline-flex max-w-full items-center gap-1.5 align-middle font-medium text-blue-600 underline decoration-blue-300 underline-offset-2 transition-colors hover:text-blue-700 hover:decoration-blue-500",children:[m.jsx(Kc,{className:"size-4 shrink-0","aria-hidden":!0}),m.jsx("span",{className:"truncate",children:f.file})]}):m.jsx("code",{title:f.file,children:f.file});if(f?.type==="agent-download")return d?m.jsxs("a",{href:gk(d,f.file),download:f.file.split("/").at(-1),title:a("Download file"),className:"inline-flex max-w-full items-center gap-1.5 align-middle font-medium text-blue-600 underline decoration-blue-300 underline-offset-2 transition-colors hover:text-blue-700 hover:decoration-blue-500",children:[m.jsx(zc,{className:"size-4 shrink-0","aria-hidden":!0}),m.jsx("span",{className:"truncate",children:f.file.split("/").at(-1)})]}):m.jsx("code",{title:f.file,children:f.file});if(c&&xk(e)){const C=w=>{r?.(w),!w.defaultPrevented&&(w.preventDefault(),c(e))};return m.jsx("a",{href:e,onClick:C,className:_,...E,children:t})}if(p.type==="workspace-file"&&o){const C=w=>{r?.(w),!w.defaultPrevented&&(w.preventDefault(),o(p.path,p.line,p.column))};return m.jsx("a",{href:e,onClick:C,className:_,...E,children:t})}if(p.type==="unknown-local"||p.type==="workspace-file"){const C=p.path;return m.jsx("code",{title:C,children:t})}const I=p.url;return m.jsx("a",{href:I,onClick:r,className:_,...E,children:t})},_k=({children:e,className:t,node:n,...r})=>m.jsx("li",{className:kn("py-0 pl-0 [&>p]:inline",t),...r,children:e}),Ak={img:Ec,li:_k};function Ck({workingDir:e,onOpenWorkspaceFile:t,onOpenPreviewUrl:n,onOpenVisualization:r,downloadSessionId:i}){return{...Ak,a:s=>m.jsx(kk,{...s,workingDir:e,onOpenWorkspaceFile:t,onOpenPreviewUrl:n,onOpenVisualization:r,downloadSessionId:i}),img:s=>{const a=hc(s.src??"",e),u=a.type==="workspace-file"&&e?lk(e,a.path):a.type==="attachment"?a.url:a.type==="unknown-local"?ck(a.path):s.src;return m.jsx(Ec,{...s,src:u})}}}const yk={mermaid:{download:!0,copy:!0,fullscreen:!0,panZoom:!0}},Ik=/(^|\n)(```|~~~)[^\S\r\n]*mermaid(?:[\s\r\n]|$)/i;let gi=null;function Nk(e){return Ik.test(e)}function Sk(){return gi??=xi(async()=>{const{mermaid:e}=await import("./index-BPuQ0J75.js").then(t=>t.bm);return{mermaid:e}},__vite__mapDeps([5,1,2])).then(({mermaid:e})=>({mermaid:e})),gi}function wk(e){const t=Nk(e),[n,r]=A.useState();return A.useEffect(()=>{if(!t){r(void 0);return}let i=!0;return Sk().then(s=>{i&&r(s)}).catch(()=>{gi=null,i&&r(void 0)}),()=>{i=!1}},[t]),t?n:void 0}function bc(e){if(e.tool?.status)return e.tool.status;if(e.title?.endsWith("✓"))return"success";if(e.title?.endsWith("✗"))return"failed";if(e.title?.includes("待审批"))return"pending_approval"}function Lk(e){return bc(e)==="success"}function Ok(e){const t=bc(e);return t==="failed"||t==="timed_out"}function _r(e){return e.title==="Thinking"||e.content.startsWith("Thinking:")}function Rk(e){return e.type===ee.Tool&&!!e.children?.length}function Dk(e){return e.type!==ee.Cursor&&!e.children?.length&&e.content.trim()===""}function rs(e){return!!e.tokenUsage||Dk(e)}function Pk(e){const t=e.tool?.status;return t==="pending_approval"||t==="denied"}function Mk(e){return e.type===ee.Cursor||e.type===ee.User||e.type===ee.Assistant||e.type===ee.Error||e.type===ee.Warning?!0:e.type===ee.Info&&e.tokenUsage?!1:Pk(e)}function lu(e){return _r(e)?!0:Rk(e)||e.type!==ee.Tool&&e.type!==ee.Action?!1:!Mk(e)}function is(e){return!_r(e)&&(e.type===ee.Tool||e.type===ee.Action)}function qn(e){const t=e.filter(i=>!rs(i)),n=[];let r=0;for(;r<t.length;){const i=t[r];if(lu(i)){const s=[i];let a=r+1;for(;a<t.length;){const u=t[a];if(lu(u))s.push(u),a++;else break}s.some(is)?n.push({kind:"execution-group",logs:s,key:s[0].id}):s.forEach(u=>n.push({kind:"single",log:u,key:u.id})),r=a}else n.push({kind:"single",log:i,key:i.id}),r++}return n}function vk(e){const t=[];let n,r=[];const i=()=>{!n&&r.length===0||t.push({key:n?`turn-${n.id}`:`turn-${r[0]?.id??t.length}`,user:n,agentLogs:r})};for(const s of e)s.type===ee.User?(i(),n=s,r=[]):r.push(s);return i(),t}function Bk(e){let t=-1;for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.content.trim()){if(r.type===ee.Assistant)return n;t===-1&&r.type===ee.Error&&(t=n)}}return t}function Fk(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return null;const n=Math.max(0,t-e),r=n===0?0:Math.max(1,Math.round(n/1e3)),i=Math.floor(r/3600),s=Math.floor(r%3600/60),a=r%60;return i>0?`${i}h${s>0?` ${s}m`:""}`:s>0?`${s}m${a>0?` ${a}s`:""}`:`${a}s`}function Hk(e){const t=e.agentLogs.reduce((i,s)=>Number.isFinite(s.cursorActivity?.processingStartedAt)?s.cursorActivity?.processingStartedAt:i,void 0),n=e.user?.timestamp??t??e.agentLogs.find(i=>Number.isFinite(i.timestamp))?.timestamp,r=e.agentLogs.reduce((i,s)=>Number.isFinite(s.timestamp)?i===void 0?s.timestamp:Math.max(i,s.timestamp):i,void 0);return{startedAt:n,latestLogAt:r}}function Uk(e,t,n,r){const i=t&&n===!0,s=Hk(e),a=i?null:t?r??s.latestLogAt??null:s.latestLogAt??null,u={start:s.startedAt,end:a};if(i)return{key:e.key,user:e.user??null,running:!0,duration:u,showSummary:!0,summaryCollapsible:!1,inlineItems:qn(e.agentLogs),processedItems:[],finalItems:[]};if(e.agentLogs.length===0)return{key:e.key,user:e.user??null,running:!1,duration:u,showSummary:!1,summaryCollapsible:!1,inlineItems:[],processedItems:[],finalItems:[]};const o=Bk(e.agentLogs),c=o>=0?e.agentLogs.slice(0,o):e.agentLogs,h=o>=0?e.agentLogs.slice(o):[],d=c.some(f=>!rs(f));return{key:e.key,user:e.user??null,running:!1,duration:u,showSummary:!0,summaryCollapsible:d,inlineItems:[],processedItems:d?qn(c):[],finalItems:qn(h)}}function qr(e){return`item:${e.key}`}function jk(e,t){const n=[];for(const r of e){if(r.user&&n.push({kind:"user",key:`user:${r.user.id}`,log:r.user}),r.showSummary&&n.push({kind:"summary",key:`summary:${r.key}`,turnKey:r.key,duration:r.duration,collapsible:r.summaryCollapsible}),r.running){for(const i of r.inlineItems)n.push({kind:"item",key:qr(i),item:i,processed:!1});continue}if(t.has(r.key))for(const i of r.processedItems)n.push({kind:"item",key:qr(i),item:i,processed:!0});for(const i of r.finalItems)n.push({kind:"item",key:qr(i),item:i,processed:!1})}return n}function zk(e){if(!e)return 40;switch(e.kind){case"user":return 72;case"summary":return 44;default:return 32}}function $k(e){let t=e?.parentElement??null;for(;t;){const n=window.getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}const ss=A.memo(({content:e,className:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})=>{const u=A.useMemo(()=>s||a?pk(e):e,[e,a,s]),o=wk(u),c=A.useMemo(()=>Ck({workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a}),[a,i,s,r,n]);return m.jsx(oc,{className:kn("session-log-message-markdown",t),components:c,plugins:o,controls:o?yk:void 0,children:u})});ss.displayName="MarkdownMessage";const as=A.memo(({content:e,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i})=>m.jsx("div",{className:t?"flex justify-end mb-4 mt-2":"flex justify-end mb-8 mt-4",children:m.jsx("div",{className:`relative bg-neutral-200 text-neutral-900 rounded-2xl rounded-tr-sm max-w-[85%] min-w-0 leading-relaxed ${t?"px-3.5 py-2.5 text-[13px]":"px-5 py-3.5 text-sm"}`,children:m.jsx(ss,{content:e,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i})})}));as.displayName="UserMessage";const us=A.memo(({content:e,isOpenDefault:t=!0})=>{const[n,r]=A.useState(t),i=A.useRef(null),[s,a]=A.useState(0);A.useEffect(()=>{i.current&&a(i.current.scrollHeight)},[e,n]);const u=A.useMemo(()=>{const c=e.replace(/^Thinking:\s*/i,"").trim().split(`
|
|
119
|
+
`)},yx=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let[s,a]=A.useState(!1),[u,o]=A.useState(!1),c=A.useRef(null),h=A.useRef(0),{isAnimating:d}=A.useContext(ve),f=async E=>{var _,I;if(typeof window>"u"||!((_=navigator?.clipboard)!=null&&_.write)){r?.(new Error("Clipboard API not available"));return}try{let C=(I=c.current)==null?void 0:I.closest('[data-streamdown="table-wrapper"]'),w=C?.querySelector("table");if(!w){r?.(new Error("Table not found"));return}let O=Pl(w),F=E==="csv"?Ml(O):Ax(O),z=new ClipboardItem({"text/plain":new Blob([F],{type:"text/plain"}),"text/html":new Blob([w.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),o(!0),a(!1),n?.(E),h.current=window.setTimeout(()=>o(!1),i)}catch(C){r?.(C)}};A.useEffect(()=>{let E=_=>{let I=_.composedPath();c.current&&!I.includes(c.current)&&a(!1)};return document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E),window.clearTimeout(h.current)}},[]);let p=u?Ji:es;return m.jsxs("div",{className:"relative",ref:c,children:[m.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:d,onClick:()=>a(!s),title:"Copy table",type:"button",children:e??m.jsx(p,{size:14})}),s?m.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[m.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),m.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>f("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})},Ix=({children:e,className:t,onDownload:n,onError:r})=>{let[i,s]=A.useState(!1),a=A.useRef(null),{isAnimating:u}=A.useContext(ve),o=c=>{var h;try{let d=(h=a.current)==null?void 0:h.closest('[data-streamdown="table-wrapper"]'),f=d?.querySelector("table");if(!f){r?.(new Error("Table not found"));return}let p=Pl(f),E=c==="csv"?Ml(p):Cx(p);Mt(`table.${c==="csv"?"csv":"md"}`,E,c==="csv"?"text/csv":"text/markdown"),s(!1),n?.(c)}catch(d){r?.(d)}};return A.useEffect(()=>{let c=h=>{let d=h.composedPath();a.current&&!d.includes(a.current)&&s(!1)};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]),m.jsxs("div",{className:"relative",ref:a,children:[m.jsx("button",{className:Q("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>s(!i),title:"Download table",type:"button",children:e??m.jsx(xr,{size:14})}),i?m.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[m.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),m.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})},Nx=({children:e,className:t,showControls:n,...r})=>m.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[n?m.jsxs("div",{className:"flex items-center justify-end gap-1",children:[m.jsx(yx,{}),m.jsx(Ix,{})]}):null,m.jsx("div",{className:"overflow-x-auto overscroll-y-auto",children:m.jsx("table",{className:Q("w-full border-collapse border border-border",t),"data-streamdown":"table",...r,children:e})})]}),Sx=A.lazy(()=>xi(()=>import("./code-block-OCS4YCEC-CMA1utSp.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeBlock}))),wx=A.lazy(()=>xi(()=>Promise.resolve().then(()=>d3),void 0).then(e=>({default:e.Mermaid}))),Lx=/language-([^\s]+)/;function kr(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,s=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===s?.line&&i?.column===s?.column}function fe(e,t){return e.className===t.className&&kr(e.node,t.node)}var fi=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,Fn=(e,t)=>{if(typeof e=="boolean")return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},ns=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("ol",{className:Q("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...r,children:e}),(e,t)=>fe(e,t));ns.displayName="MarkdownOl";var vl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("li",{className:Q("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...r,children:e}),(e,t)=>e.className===t.className&&kr(e.node,t.node));vl.displayName="MarkdownLi";var Bl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("ul",{className:Q("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...r,children:e}),(e,t)=>fe(e,t));Bl.displayName="MarkdownUl";var Fl=A.memo(({className:e,node:t,...n})=>m.jsx("hr",{className:Q("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n}),(e,t)=>fe(e,t));Fl.displayName="MarkdownHr";var Hl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("span",{className:Q("font-semibold",t),"data-streamdown":"strong",...r,children:e}),(e,t)=>fe(e,t));Hl.displayName="MarkdownStrong";var Ox=({children:e,className:t,href:n,node:r,...i})=>{let{linkSafety:s}=A.useContext(ve),[a,u]=A.useState(!1),o=n==="streamdown:incomplete-link",c=A.useCallback(async p=>{if(!(!(s!=null&&s.enabled&&n)||o)){if(p.preventDefault(),s.onLinkCheck&&await s.onLinkCheck(n)){window.open(n,"_blank","noreferrer");return}u(!0)}},[s,n,o]),h=A.useCallback(()=>{n&&window.open(n,"_blank","noreferrer")},[n]),d=A.useCallback(()=>{u(!1)},[]),f={url:n??"",isOpen:a,onClose:d,onConfirm:h};return s!=null&&s.enabled&&n?m.jsxs(m.Fragment,{children:[m.jsx("button",{className:Q("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",onClick:c,type:"button",children:e}),s.renderModal?s.renderModal(f):m.jsx(Ex,{...f})]}):m.jsx("a",{className:Q("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...i,children:e})},Ul=A.memo(Ox,(e,t)=>fe(e,t)&&e.href===t.href);Ul.displayName="MarkdownA";var jl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h1",{className:Q("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...r,children:e}),(e,t)=>fe(e,t));jl.displayName="MarkdownH1";var zl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h2",{className:Q("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...r,children:e}),(e,t)=>fe(e,t));zl.displayName="MarkdownH2";var $l=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h3",{className:Q("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...r,children:e}),(e,t)=>fe(e,t));$l.displayName="MarkdownH3";var Yl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h4",{className:Q("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...r,children:e}),(e,t)=>fe(e,t));Yl.displayName="MarkdownH4";var ql=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h5",{className:Q("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...r,children:e}),(e,t)=>fe(e,t));ql.displayName="MarkdownH5";var Vl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("h6",{className:Q("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...r,children:e}),(e,t)=>fe(e,t));Vl.displayName="MarkdownH6";var Wl=A.memo(({children:e,className:t,node:n,...r})=>{let{controls:i}=A.useContext(ve),s=fi(i,"table");return m.jsx(Nx,{className:t,showControls:s,...r,children:e})},(e,t)=>fe(e,t));Wl.displayName="MarkdownTable";var Gl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("thead",{className:Q("bg-muted/80",t),"data-streamdown":"table-header",...r,children:e}),(e,t)=>fe(e,t));Gl.displayName="MarkdownThead";var Kl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("tbody",{className:Q("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...r,children:e}),(e,t)=>fe(e,t));Kl.displayName="MarkdownTbody";var Ql=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("tr",{className:Q("border-border border-b",t),"data-streamdown":"table-row",...r,children:e}),(e,t)=>fe(e,t));Ql.displayName="MarkdownTr";var Xl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("th",{className:Q("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,children:e}),(e,t)=>fe(e,t));Xl.displayName="MarkdownTh";var Zl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("td",{className:Q("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...r,children:e}),(e,t)=>fe(e,t));Zl.displayName="MarkdownTd";var Jl=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("blockquote",{className:Q("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...r,children:e}),(e,t)=>fe(e,t));Jl.displayName="MarkdownBlockquote";var ec=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("sup",{className:Q("text-sm",t),"data-streamdown":"superscript",...r,children:e}),(e,t)=>fe(e,t));ec.displayName="MarkdownSup";var tc=A.memo(({children:e,className:t,node:n,...r})=>m.jsx("sub",{className:Q("text-sm",t),"data-streamdown":"subscript",...r,children:e}),(e,t)=>fe(e,t));tc.displayName="MarkdownSub";var nc=A.memo(({children:e,className:t,node:n,...r})=>{if("data-footnotes"in r){let i=a=>{var u,o;if(!A.isValidElement(a))return!1;let c=Array.isArray(a.props.children)?a.props.children:[a.props.children],h=!1,d=!1;for(let f of c)if(f){if(typeof f=="string")f.trim()!==""&&(h=!0);else if(A.isValidElement(f))if(((u=f.props)==null?void 0:u["data-footnote-backref"])!==void 0)d=!0;else{let p=Array.isArray(f.props.children)?f.props.children:[f.props.children];for(let E of p){if(typeof E=="string"&&E.trim()!==""){h=!0;break}if(A.isValidElement(E)&&((o=E.props)==null?void 0:o["data-footnote-backref"])===void 0){h=!0;break}}}}return d&&!h},s=Array.isArray(e)?e.map(a=>{if(!A.isValidElement(a))return a;if(a.type===ns){let u=(Array.isArray(a.props.children)?a.props.children:[a.props.children]).filter(o=>!i(o));return u.length===0?null:{...a,props:{...a.props,children:u}}}return a}):e;return(Array.isArray(s)?s.some(a=>a!==null):s!==null)?m.jsx("section",{className:t,...r,children:s}):null}return m.jsx("section",{className:t,...r,children:e})},(e,t)=>fe(e,t));nc.displayName="MarkdownSection";var Rx=({node:e,className:t,children:n,...r})=>{var i;let s=!("data-block"in r),{mermaid:a,controls:u}=A.useContext(ve),o=ts();if(s)return m.jsx("code",{className:Q("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...r,children:n});let c=t?.match(Lx),h=(i=c?.at(1))!=null?i:"",d="";if(A.isValidElement(n)&&n.props&&typeof n.props=="object"&&"children"in n.props&&typeof n.props.children=="string"?d=n.props.children:typeof n=="string"&&(d=n),h==="mermaid"&&o){let p=fi(u,"mermaid"),E=Fn(u,"download"),_=Fn(u,"copy"),I=Fn(u,"fullscreen"),C=Fn(u,"panZoom"),w=p&&(E||_||I);return m.jsx(A.Suspense,{fallback:m.jsx(Za,{}),children:m.jsxs("div",{className:Q("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[w?m.jsxs("div",{className:"flex items-center justify-end gap-2",children:[E?m.jsx(Tx,{chart:d,config:a?.config}):null,_?m.jsx(Qa,{code:d}):null,I?m.jsx(_x,{chart:d,config:a?.config}):null]}):null,m.jsx(wx,{chart:d,config:a?.config,showControls:C})]})})}let f=fi(u,"code");return m.jsx(A.Suspense,{fallback:m.jsx(Za,{}),children:m.jsx(Sx,{className:Q("overflow-x-auto border-border border-t",t),code:d,language:h,children:f?m.jsxs(m.Fragment,{children:[m.jsx(dx,{code:d,language:h}),m.jsx(Qa,{})]}):null})})},rc=A.memo(Rx,(e,t)=>e.className===t.className&&kr(e.node,t.node));rc.displayName="MarkdownCode";var ic=A.memo(px,(e,t)=>e.className===t.className&&kr(e.node,t.node));ic.displayName="MarkdownImg";var sc=A.memo(({children:e,className:t,node:n,...r})=>{let i=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(i.length===1&&A.isValidElement(i[0])){let s=i[0].props.node,a=s?.tagName;if(a==="img")return m.jsx(m.Fragment,{children:e});if(a==="code"&&"data-block"in i[0].props)return m.jsx(m.Fragment,{children:e})}return m.jsx("p",{className:t,...r,children:e})},(e,t)=>fe(e,t));sc.displayName="MarkdownParagraph";var Dx={ol:ns,li:vl,ul:Bl,hr:Fl,strong:Hl,a:Ul,h1:jl,h2:zl,h3:$l,h4:Yl,h5:ql,h6:Vl,table:Wl,thead:Gl,tbody:Kl,tr:Ql,th:Xl,td:Zl,blockquote:Jl,code:rc,img:ic,pre:({children:e})=>A.isValidElement(e)?A.cloneElement(e,{"data-block":"true"}):e,sup:ec,sub:tc,p:sc,section:nc},Px=()=>e=>{at(e,"html",(t,n,r)=>{!r||typeof n!="number"||(r.children[n]={type:"text",value:t.value})})},Ja=[],eu={allowDangerousHtml:!0},Hn=new WeakMap,Mx=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let h="default";return this.keyCache.set(e,h),h}let s=h=>{if(!h||h.length===0)return"";let d="";for(let f=0;f<h.length;f+=1){let p=h[f];if(f>0&&(d+=","),Array.isArray(p)){let[E,_]=p;if(typeof E=="function"){let I=Hn.get(E);I||(I=E.name,Hn.set(E,I)),d+=I}else d+=String(E);d+=":",d+=JSON.stringify(_)}else if(typeof p=="function"){let E=Hn.get(p);E||(E=p.name,Hn.set(p,E)),d+=E}else d+=String(p)}return d},a=s(n),u=s(r),o=i?JSON.stringify(i):"",c=`${u}::${a}::${o}`;return this.keyCache.set(e,c),c}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r)}this.cache.set(n,t)}clear(){this.cache.clear()}},tu=new Mx,ac=e=>{let t=vx(e),n=e.children||"";return $x(t.runSync(t.parse(n),n),e)},vx=e=>{let t=tu.get(e);if(t)return t;let n=Fx(e);return tu.set(e,n),n},Bx=e=>e.some(t=>Array.isArray(t)?t[0]===ei:t===ei),Fx=e=>{let t=e.rehypePlugins||Ja,n=e.remarkPlugins||Ja,r=Bx(t)?n:[...n,Px],i=e.remarkRehypeOptions?{...eu,...e.remarkRehypeOptions}:eu;return u2().use(aT).use(r).use(zT,i).use(t)},Hx=e=>e,Ux=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:"text",value:r}},jx=(e,t)=>{var n;for(let r in Mr)if(Object.hasOwn(Mr,r)&&Object.hasOwn(e.properties,r)){let i=e.properties[r],s=Mr[r];(s===null||s.includes(e.tagName))&&(e.properties[r]=(n=t(String(i||""),r,e))!=null?n:void 0)}},zx=(e,t,n,r,i,s)=>{let a=!1;return r?a=!r.includes(e.tagName):i&&(a=i.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,n)),a},$x=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:s,unwrapDisallowed:a,urlTransform:u}=t;if(n||r||i||s||u){let o=u||Hx;at(e,(c,h,d)=>{if(c.type==="raw"&&d&&typeof h=="number")return Ux(d,h,s,c.value),h;if(c.type==="element"&&(jx(c,o),zx(c,h,d,r,i,n)&&d&&typeof h=="number"))return a&&c.children?d.children.splice(h,1,...c.children):d.children.splice(h,1),h})}return pb(e,{Fragment:m.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0})},Yx=/\[\^[\w-]{1,200}\](?!:)/,qx=/\[\^[\w-]{1,200}\]:/,Vx=/<\/(\w+)>/,Wx=/<(\w+)[\s>]/,Gx=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Kx=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]==="$"&&e[n+1]==="$"&&(t+=1,n+=1);return t},Qx=e=>{let t=Yx.test(e),n=qx.test(e);if(t||n)return[e];let r=Me.lex(e,{gfm:!0}),i=[],s=[],a=!1;for(let u of r){let o=u.raw,c=i.length;if(s.length>0){if(i[c-1]+=o,u.type==="html"){let h=o.match(Vx);if(h){let d=h[1];s.at(-1)===d&&s.pop()}}continue}if(u.type==="html"&&u.block){let h=o.match(Wx);if(h){let d=h[1];o.includes(`</${d}>`)||Gx.has(d.toLowerCase())||s.push(d)}}if(c>0&&!a){let h=i[c-1];if(Kx(h)%2===1){i[c-1]=h+o;continue}}i.push(o),u.type!=="space"&&(a=u.type==="code")}return i},nu,ru,Yn={...cn,protocols:{...cn.protocols,href:[...(ru=(nu=cn.protocols)==null?void 0:nu.href)!=null?ru:[],"tel"]}},pi={raw:ei,sanitize:[ko,Yn],harden:[Nh,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},Xx={gfm:[Yg,{}]},iu=Object.values(pi),Zx=Object.values(Xx),Jx={block:" ▋",circle:" ●"},ek={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},ve=A.createContext(ek),uc=A.memo(({content:e,shouldParseIncompleteMarkdown:t,index:n,...r})=>m.jsx(ac,{...r,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(i=>{var s,a;return((s=e.components)==null?void 0:s[i])!==((a=t.components)==null?void 0:a[i])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});uc.displayName="Block";var tk=["github-light","github-dark"],oc=A.memo(({children:e,mode:t="streaming",parseIncompleteMarkdown:n=!0,components:r,rehypePlugins:i=iu,remarkPlugins:s=Zx,className:a,shikiTheme:u=tk,mermaid:o,controls:c=!0,isAnimating:h=!1,animated:d,BlockComponent:f=uc,parseMarkdownIntoBlocksFn:p=Qx,caret:E,plugins:_,remend:I,linkSafety:C={enabled:!0},allowedTags:w,...O})=>{let F=A.useId(),[z,L]=A.useTransition(),K=A.useMemo(()=>typeof e!="string"?"":t==="streaming"&&n?ZE(e,I):e,[e,t,n,I]),G=A.useMemo(()=>p(K),[K,p]),[X,N]=A.useState(G);A.useEffect(()=>{t==="streaming"?L(()=>{N(G)}):N(G)},[G,t]);let U=t==="streaming"?X:G,M=A.useMemo(()=>U.map((se,x)=>`${F}-${x}`),[U.length,F]),V=A.useMemo(()=>d?d===!0?hi():hi(d):null,[d]),$=A.useMemo(()=>{var se,x;return{shikiTheme:(x=(se=_?.code)==null?void 0:se.getThemes())!=null?x:u,controls:c,isAnimating:h,mode:t,mermaid:o,linkSafety:C}},[u,c,h,t,o,C,_?.code]),j=A.useMemo(()=>({...Dx,...r}),[r]),B=A.useMemo(()=>{let se=[];return _!=null&&_.cjk&&(se=[...se,..._.cjk.remarkPluginsBefore]),se=[...se,...s],_!=null&&_.cjk&&(se=[...se,..._.cjk.remarkPluginsAfter]),_!=null&&_.math&&(se=[...se,_.math.remarkPlugin]),se},[s,_?.math,_?.cjk]),W=A.useMemo(()=>{var se;let x=i;if(w&&Object.keys(w).length>0&&i===iu){let we={...Yn,tagNames:[...(se=Yn.tagNames)!=null?se:[],...Object.keys(w)],attributes:{...Yn.attributes,...w}};x=[pi.raw,[ko,we],pi.harden]}return _!=null&&_.math&&(x=[...x,_.math.rehypePlugin]),V&&h&&(x=[...x,V.rehypePlugin]),x},[i,_?.math,V,h,w]),oe=A.useMemo(()=>E&&h?{"--streamdown-caret":`"${Jx[E]}"`}:void 0,[E,h]);return t==="static"?m.jsx(di.Provider,{value:_??null,children:m.jsx(ve.Provider,{value:$,children:m.jsx("div",{className:Q("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",a),children:m.jsx(ac,{components:j,rehypePlugins:W,remarkPlugins:B,...O,children:e})})})}):m.jsx(di.Provider,{value:_??null,children:m.jsx(ve.Provider,{value:$,children:m.jsxs("div",{className:Q("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",E?"*:last:after:inline *:last:after:align-baseline *:last:after:content-[var(--streamdown-caret)]":null,a),style:oe,children:[U.length===0&&E&&h&&m.jsx("span",{}),U.map((se,x)=>m.jsx(f,{components:j,content:se,index:x,rehypePlugins:W,remarkPlugins:B,shouldParseIncompleteMarkdown:n,...O},M[x]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);oc.displayName="Streamdown";var nk=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:s=!0,initialZoom:a=1,fullscreen:u=!1})=>{let o=A.useRef(null),c=A.useRef(null),[h,d]=A.useState(a),[f,p]=A.useState({x:0,y:0}),[E,_]=A.useState(!1),[I,C]=A.useState({x:0,y:0}),[w,O]=A.useState({x:0,y:0}),F=A.useCallback(M=>{d(V=>Math.max(n,Math.min(r,V+M)))},[n,r]),z=A.useCallback(()=>{F(i)},[F,i]),L=A.useCallback(()=>{F(-i)},[F,i]),K=A.useCallback(()=>{d(a),p({x:0,y:0})},[a]),G=A.useCallback(M=>{M.preventDefault();let V=M.deltaY>0?-i:i;F(V)},[F,i]),X=A.useCallback(M=>{if(M.button!==0||M.isPrimary===!1)return;_(!0),C({x:M.clientX,y:M.clientY}),O(f);let V=M.currentTarget;V instanceof HTMLElement&&V.setPointerCapture(M.pointerId)},[f]),N=A.useCallback(M=>{if(!E)return;M.preventDefault();let V=M.clientX-I.x,$=M.clientY-I.y;p({x:w.x+V,y:w.y+$})},[E,I,w]),U=A.useCallback(M=>{_(!1);let V=M.currentTarget;V instanceof HTMLElement&&V.releasePointerCapture(M.pointerId)},[]);return A.useEffect(()=>{let M=o.current;if(M)return M.addEventListener("wheel",G,{passive:!1}),()=>{M.removeEventListener("wheel",G)}},[G]),A.useEffect(()=>{let M=c.current;if(M&&E)return document.body.style.userSelect="none",M.addEventListener("pointermove",N,{passive:!1}),M.addEventListener("pointerup",U),M.addEventListener("pointercancel",U),()=>{document.body.style.userSelect="",M.removeEventListener("pointermove",N),M.removeEventListener("pointerup",U),M.removeEventListener("pointercancel",U)}},[E,N,U]),m.jsxs("div",{className:Q("relative flex flex-col",u?"h-full w-full":"min-h-28 w-full",t),ref:o,style:{cursor:E?"grabbing":"grab"},children:[s?m.jsxs("div",{className:Q("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",u?"bottom-4 left-4":"bottom-2 left-2"),children:[m.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:h>=r,onClick:z,title:"Zoom in",type:"button",children:m.jsx(lx,{size:16})}),m.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:h<=n,onClick:L,title:"Zoom out",type:"button",children:m.jsx(cx,{size:16})}),m.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:K,title:"Reset zoom and pan",type:"button",children:m.jsx(ox,{size:16})})]}):null,m.jsx("div",{className:Q("flex-1 origin-center transition-transform duration-150 ease-out",u?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:X,ref:c,role:"application",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${h})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},lc=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let[s,a]=A.useState(null),[u,o]=A.useState(!1),[c,h]=A.useState(""),[d,f]=A.useState(""),[p,E]=A.useState(0),{mermaid:_}=A.useContext(ve),I=ts(),C=_?.errorComponent,{shouldRender:w,containerRef:O}=X2({immediate:r});if(A.useEffect(()=>{if(w){if(!I){a("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{a(null),o(!0);let z=I.getMermaid(n),L=e.split("").reduce((X,N)=>(X<<5)-X+N.charCodeAt(0)|0,0),K=`mermaid-${Math.abs(L)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:G}=await z.render(K,e);h(G),f(G)}catch(z){if(!(d||c)){let L=z instanceof Error?z.message:"Failed to render Mermaid chart";a(L)}}finally{o(!1)}})()}},[e,n,p,w,I]),!(w||c||d))return m.jsx("div",{className:Q("my-4 min-h-[200px]",t),ref:O});if(u&&!c&&!d)return m.jsx("div",{className:Q("my-4 flex justify-center p-4",t),ref:O,children:m.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[m.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),m.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(s&&!c&&!d){let z=()=>E(L=>L+1);return C?m.jsx("div",{ref:O,children:m.jsx(C,{chart:e,error:s,retry:z})}):m.jsxs("div",{className:Q("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:O,children:[m.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",s]}),m.jsxs("details",{className:"mt-2",children:[m.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),m.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]})}let F=c||d;return m.jsx("div",{className:Q("size-full",t),"data-streamdown":"mermaid",ref:O,children:m.jsx(nk,{className:Q(r?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:m.jsx("div",{"aria-label":"Mermaid chart",className:Q("flex justify-center",r?"size-full items-center":null),dangerouslySetInnerHTML:{__html:F},role:"img"})})})};function rk({content:e,children:t,className:n="",side:r="top",align:i="center"}){const s=r==="bottom"?"top-full mt-2":"bottom-full mb-2",a=r==="bottom"?"bottom-full border-b-neutral-900":"top-full border-t-neutral-900",u=i==="start"?"left-0":i==="end"?"right-0":"left-1/2 -translate-x-1/2",o=i==="start"?"left-4":i==="end"?"right-4":"left-1/2 -translate-x-1/2";return m.jsxs("div",{className:`group/tooltip relative inline-block ${n}`,children:[t,m.jsxs("div",{className:`invisible absolute ${s} ${u} max-w-[260px] px-3 py-2 bg-neutral-900 text-white text-xs leading-relaxed rounded-lg opacity-0 group-hover/tooltip:visible group-hover/tooltip:opacity-100 group-focus-within/tooltip:visible group-focus-within/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-normal z-[100] shadow-lg`,children:[e,m.jsx("div",{className:`absolute ${a} ${o} border-4 border-transparent`})]})]})}const cc=/^[a-zA-Z]:[\\/]/,ik=/[/\\](attachments|conversations)[/\\]/,sk=/^\/(Users|home|tmp|private|var|opt|mnt|Volumes)(\/|$)/;function su(e){return e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")}function ak(e){const t=e.match(/^(.*)#L([1-9]\d*)(?:C([1-9]\d*))?$/i);if(t)return{path:t[1],line:Number(t[2]),column:t[3]?Number(t[3]):void 0};const n=e.match(/^(.*?):(\d+)(?::(\d+))?$/);if(n&&n[1]){const r=Number(n[2]),i=n[3]?Number(n[3]):void 0;if(r>0&&(!n[3]||i&&i>0))return{path:n[1],line:r,column:i}}return{path:e}}function uk(e,t){if(!t)return null;const n=su(e),r=su(t).replace(/\/$/,"");return n===r?null:n.startsWith(`${r}/`)?n.slice(r.length+1):n.startsWith("./")?n.slice(2):!n.startsWith("/")&&!cc.test(e)&&!n.startsWith("../")?n:null}function ok(e){return`${xt()}/attachments/by-path?path=${encodeURIComponent(e)}`}function hc(e,t){if(/^https?:\/\//i.test(e))return{type:"external",url:e};if(/^(mailto|tel):/i.test(e))return{type:"external",url:e};if(e.startsWith("/api/")||e.startsWith("#"))return{type:"internal",url:e};const n=ak(e),r=uk(n.path,t);return r?{type:"workspace-file",path:r,line:n.line,column:n.column}:ik.test(e)?{type:"attachment",path:e,url:ok(e)}:sk.test(e)||cc.test(e)?{type:"unknown-local",path:e}:{type:"internal",url:e}}function lk(e,t){const n=new URLSearchParams({workingDir:e,path:t});return`${xt()}/files/image?${n.toString()}`}function ck(e){const t=new URLSearchParams({path:e});return`${xt()}/files/image?${t.toString()}`}const dc="/__agent-tower/message-intent/codex-inline-vis",fc="/__agent-tower/message-intent/agent-download",hk=/^[ \t]{0,3}::codex-inline-vis\{file="([^"\r\n]+)"\}[ \t]*$/,pc=/^[a-z0-9][a-z0-9-]*\.html$/,dk=/^[ \t]{0,3}(`{3,}|~{3,})/;function fk(e,t){const n=t[0]==="`"?"`":"~";return new RegExp(`^[ \\t]{0,3}${n}{${t.length},}[ \\t]*$`).test(e)}function pk(e){let t=null;return e.split(/\r?\n/).map(n=>{if(t)return fk(n,t)&&(t=null),n;const r=n.match(dk);if(r)return t=r[1],n;const i=n.match(hk);if(i&&pc.test(i[1])){const u=`${dc}?file=${encodeURIComponent(i[1])}`;return`[${i[1]}](${u})`}const s=uh(n);if(!s)return n;const a=`${fc}?file=${encodeURIComponent(s)}`;return`[${s}](${a})`}).join(`
|
|
120
|
+
`)}function mk(e){try{const t=new URL(e,"http://agent-tower.local"),n=t.searchParams.get("file");if(!n)return null;if(t.pathname===dc&&pc.test(n))return{type:"codex-inline-visualization",file:n};if(t.pathname===fc){const r=bu(n);return r?{type:"agent-download",file:r}:null}return null}catch{return null}}function A3(e,t){return`${xt()}/sessions/${encodeURIComponent(e)}/visualizations/${encodeURIComponent(t)}`}function gk(e,t){const n=new URLSearchParams({path:t});return`${xt()}/sessions/${encodeURIComponent(e)}/artifacts/download?${n.toString()}`}const mc=new Set(["localhost","127.0.0.1","::1","[::1]","0.0.0.0"]);function Ek(e){return/^\d+$/.test(e)?`http://127.0.0.1:${e}`:/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(e)?e:`http://${e}`}function mi(e){try{return new URL(Ek(e.trim()))}catch{return null}}function au(e){return mc.has(e.hostname.toLowerCase())?"loopback":e.hostname.toLowerCase()}function uu(e){return e.port?e.port:e.protocol==="https:"?"443":"80"}function bk(e,t){return e.protocol===t.protocol&&au(e)===au(t)&&uu(e)===uu(t)}function gc(e){return!e||e==="/"?"":e.endsWith("/")?e.slice(0,-1):e}function Tk(e,t){return t?e===t||e.startsWith(`${t}/`):!0}function Un(e,t){return t?{kind:"target",target:t.origin,path:`${t.pathname}${t.search}${t.hash}`}:{kind:"target",target:e,path:null}}function ou(e,t){try{const i=new URL(e),s=i.searchParams.get("__agent_tower_preview_token"),a=new URL(t.startsWith("/")?t:`/${t}`,"http://preview.local");return i.pathname=a.pathname,i.search=a.search,i.hash=a.hash,s&&i.searchParams.set("__agent_tower_preview_token",s),i.toString()}catch{}const n=e.endsWith("/")?e:`${e}/`,r=t.startsWith("/")?t.slice(1):t;return`${n}${r}`}function C3(e,t,n){const r=e.trim();if(!r)return null;if(r.startsWith("/"))return n?{kind:"proxy",url:ou(n,r)}:null;const i=mi(r);if(!i)return Un(r,null);if(!t||!n)return Un(r,i);const s=mi(t);if(!s||!bk(i,s))return Un(r,i);const a=gc(s.pathname);if(!Tk(i.pathname,a))return Un(r,i);const u=i.pathname.slice(a.length)||"/";return{kind:"proxy",url:ou(n,`${u}${i.search}${i.hash}`)}}function y3(e,t,n,r){if(!e||!t)return null;try{const i=new URL(e),s=new URL(t,r),a=new URL(n,r),u=s.pathname==="/"?"":s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname;if(a.origin!==s.origin||u&&a.pathname!==u&&!a.pathname.startsWith(`${u}/`))return a.toString();const o=a.pathname.slice(u.length)||"/",c=gc(i.pathname);return i.pathname=`${c}${o}`.replace(/\/{2,}/g,"/")||"/",i.search=a.search,i.hash=a.hash,i.toString()}catch{return null}}function xk(e){const t=mi(e);return!!(t&&mc.has(t.hostname.toLowerCase()))}const Ec=({src:e,alt:t,className:n,node:r,...i})=>m.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:m.jsx("img",{src:e,alt:t,...i,className:kn("max-w-[300px] max-h-[200px] object-contain rounded-lg border border-neutral-200 cursor-pointer hover:opacity-90 active:opacity-90 transition-opacity",n)})}),kk=({href:e="",children:t,node:n,onClick:r,className:i,...s})=>{const{t:a}=sr(),{workingDir:u,onOpenWorkspaceFile:o,onOpenPreviewUrl:c,onOpenVisualization:h,downloadSessionId:d}=s,f=mk(e),p=hc(e,u),E={...s};delete E.workingDir,delete E.onOpenWorkspaceFile,delete E.onOpenPreviewUrl,delete E.onOpenVisualization,delete E.downloadSessionId;const _=kn("text-blue-600 underline decoration-blue-300 underline-offset-2 transition-colors hover:text-blue-700 hover:decoration-blue-500",i);if(f?.type==="codex-inline-visualization")return h?m.jsxs("button",{type:"button",onClick:()=>h(f.file),title:a("Open visualization"),className:"inline-flex max-w-full items-center gap-1.5 align-middle font-medium text-blue-600 underline decoration-blue-300 underline-offset-2 transition-colors hover:text-blue-700 hover:decoration-blue-500",children:[m.jsx(Kc,{className:"size-4 shrink-0","aria-hidden":!0}),m.jsx("span",{className:"truncate",children:f.file})]}):m.jsx("code",{title:f.file,children:f.file});if(f?.type==="agent-download")return d?m.jsxs("a",{href:gk(d,f.file),download:f.file.split("/").at(-1),title:a("Download file"),className:"inline-flex max-w-full items-center gap-1.5 align-middle font-medium text-blue-600 underline decoration-blue-300 underline-offset-2 transition-colors hover:text-blue-700 hover:decoration-blue-500",children:[m.jsx(zc,{className:"size-4 shrink-0","aria-hidden":!0}),m.jsx("span",{className:"truncate",children:f.file.split("/").at(-1)})]}):m.jsx("code",{title:f.file,children:f.file});if(c&&xk(e)){const C=w=>{r?.(w),!w.defaultPrevented&&(w.preventDefault(),c(e))};return m.jsx("a",{href:e,onClick:C,className:_,...E,children:t})}if(p.type==="workspace-file"&&o){const C=w=>{r?.(w),!w.defaultPrevented&&(w.preventDefault(),o(p.path,p.line,p.column))};return m.jsx("a",{href:e,onClick:C,className:_,...E,children:t})}if(p.type==="unknown-local"||p.type==="workspace-file"){const C=p.path;return m.jsx("code",{title:C,children:t})}const I=p.url;return m.jsx("a",{href:I,onClick:r,className:_,...E,children:t})},_k=({children:e,className:t,node:n,...r})=>m.jsx("li",{className:kn("py-0 pl-0 [&>p]:inline",t),...r,children:e}),Ak={img:Ec,li:_k};function Ck({workingDir:e,onOpenWorkspaceFile:t,onOpenPreviewUrl:n,onOpenVisualization:r,downloadSessionId:i}){return{...Ak,a:s=>m.jsx(kk,{...s,workingDir:e,onOpenWorkspaceFile:t,onOpenPreviewUrl:n,onOpenVisualization:r,downloadSessionId:i}),img:s=>{const a=hc(s.src??"",e),u=a.type==="workspace-file"&&e?lk(e,a.path):a.type==="attachment"?a.url:a.type==="unknown-local"?ck(a.path):s.src;return m.jsx(Ec,{...s,src:u})}}}const yk={mermaid:{download:!0,copy:!0,fullscreen:!0,panZoom:!0}},Ik=/(^|\n)(```|~~~)[^\S\r\n]*mermaid(?:[\s\r\n]|$)/i;let gi=null;function Nk(e){return Ik.test(e)}function Sk(){return gi??=xi(async()=>{const{mermaid:e}=await import("./index-DaRxJqVy.js").then(t=>t.bm);return{mermaid:e}},__vite__mapDeps([5,1,2])).then(({mermaid:e})=>({mermaid:e})),gi}function wk(e){const t=Nk(e),[n,r]=A.useState();return A.useEffect(()=>{if(!t){r(void 0);return}let i=!0;return Sk().then(s=>{i&&r(s)}).catch(()=>{gi=null,i&&r(void 0)}),()=>{i=!1}},[t]),t?n:void 0}function bc(e){if(e.tool?.status)return e.tool.status;if(e.title?.endsWith("✓"))return"success";if(e.title?.endsWith("✗"))return"failed";if(e.title?.includes("待审批"))return"pending_approval"}function Lk(e){return bc(e)==="success"}function Ok(e){const t=bc(e);return t==="failed"||t==="timed_out"}function _r(e){return e.title==="Thinking"||e.content.startsWith("Thinking:")}function Rk(e){return e.type===ee.Tool&&!!e.children?.length}function Dk(e){return e.type!==ee.Cursor&&!e.children?.length&&e.content.trim()===""}function rs(e){return!!e.tokenUsage||Dk(e)}function Pk(e){const t=e.tool?.status;return t==="pending_approval"||t==="denied"}function Mk(e){return e.type===ee.Cursor||e.type===ee.User||e.type===ee.Assistant||e.type===ee.Error||e.type===ee.Warning?!0:e.type===ee.Info&&e.tokenUsage?!1:Pk(e)}function lu(e){return _r(e)?!0:Rk(e)||e.type!==ee.Tool&&e.type!==ee.Action?!1:!Mk(e)}function is(e){return!_r(e)&&(e.type===ee.Tool||e.type===ee.Action)}function qn(e){const t=e.filter(i=>!rs(i)),n=[];let r=0;for(;r<t.length;){const i=t[r];if(lu(i)){const s=[i];let a=r+1;for(;a<t.length;){const u=t[a];if(lu(u))s.push(u),a++;else break}s.some(is)?n.push({kind:"execution-group",logs:s,key:s[0].id}):s.forEach(u=>n.push({kind:"single",log:u,key:u.id})),r=a}else n.push({kind:"single",log:i,key:i.id}),r++}return n}function vk(e){const t=[];let n,r=[];const i=()=>{!n&&r.length===0||t.push({key:n?`turn-${n.id}`:`turn-${r[0]?.id??t.length}`,user:n,agentLogs:r})};for(const s of e)s.type===ee.User?(i(),n=s,r=[]):r.push(s);return i(),t}function Bk(e){let t=-1;for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(r.content.trim()){if(r.type===ee.Assistant)return n;t===-1&&r.type===ee.Error&&(t=n)}}return t}function Fk(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return null;const n=Math.max(0,t-e),r=n===0?0:Math.max(1,Math.round(n/1e3)),i=Math.floor(r/3600),s=Math.floor(r%3600/60),a=r%60;return i>0?`${i}h${s>0?` ${s}m`:""}`:s>0?`${s}m${a>0?` ${a}s`:""}`:`${a}s`}function Hk(e){const t=e.agentLogs.reduce((i,s)=>Number.isFinite(s.cursorActivity?.processingStartedAt)?s.cursorActivity?.processingStartedAt:i,void 0),n=e.user?.timestamp??t??e.agentLogs.find(i=>Number.isFinite(i.timestamp))?.timestamp,r=e.agentLogs.reduce((i,s)=>Number.isFinite(s.timestamp)?i===void 0?s.timestamp:Math.max(i,s.timestamp):i,void 0);return{startedAt:n,latestLogAt:r}}function Uk(e,t,n,r){const i=t&&n===!0,s=Hk(e),a=i?null:t?r??s.latestLogAt??null:s.latestLogAt??null,u={start:s.startedAt,end:a};if(i)return{key:e.key,user:e.user??null,running:!0,duration:u,showSummary:!0,summaryCollapsible:!1,inlineItems:qn(e.agentLogs),processedItems:[],finalItems:[]};if(e.agentLogs.length===0)return{key:e.key,user:e.user??null,running:!1,duration:u,showSummary:!1,summaryCollapsible:!1,inlineItems:[],processedItems:[],finalItems:[]};const o=Bk(e.agentLogs),c=o>=0?e.agentLogs.slice(0,o):e.agentLogs,h=o>=0?e.agentLogs.slice(o):[],d=c.some(f=>!rs(f));return{key:e.key,user:e.user??null,running:!1,duration:u,showSummary:!0,summaryCollapsible:d,inlineItems:[],processedItems:d?qn(c):[],finalItems:qn(h)}}function qr(e){return`item:${e.key}`}function jk(e,t){const n=[];for(const r of e){if(r.user&&n.push({kind:"user",key:`user:${r.user.id}`,log:r.user}),r.showSummary&&n.push({kind:"summary",key:`summary:${r.key}`,turnKey:r.key,duration:r.duration,collapsible:r.summaryCollapsible}),r.running){for(const i of r.inlineItems)n.push({kind:"item",key:qr(i),item:i,processed:!1});continue}if(t.has(r.key))for(const i of r.processedItems)n.push({kind:"item",key:qr(i),item:i,processed:!0});for(const i of r.finalItems)n.push({kind:"item",key:qr(i),item:i,processed:!1})}return n}function zk(e){if(!e)return 40;switch(e.kind){case"user":return 72;case"summary":return 44;default:return 32}}function $k(e){let t=e?.parentElement??null;for(;t;){const n=window.getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}const ss=A.memo(({content:e,className:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})=>{const u=A.useMemo(()=>s||a?pk(e):e,[e,a,s]),o=wk(u),c=A.useMemo(()=>Ck({workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a}),[a,i,s,r,n]);return m.jsx(oc,{className:kn("session-log-message-markdown",t),components:c,plugins:o,controls:o?yk:void 0,children:u})});ss.displayName="MarkdownMessage";const as=A.memo(({content:e,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i})=>m.jsx("div",{className:t?"flex justify-end mb-4 mt-2":"flex justify-end mb-8 mt-4",children:m.jsx("div",{className:`relative bg-neutral-200 text-neutral-900 rounded-2xl rounded-tr-sm max-w-[85%] min-w-0 leading-relaxed ${t?"px-3.5 py-2.5 text-[13px]":"px-5 py-3.5 text-sm"}`,children:m.jsx(ss,{content:e,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i})})}));as.displayName="UserMessage";const us=A.memo(({content:e,isOpenDefault:t=!0})=>{const[n,r]=A.useState(t),i=A.useRef(null),[s,a]=A.useState(0);A.useEffect(()=>{i.current&&a(i.current.scrollHeight)},[e,n]);const u=A.useMemo(()=>{const c=e.replace(/^Thinking:\s*/i,"").trim().split(`
|
|
121
121
|
`)[0]||"";return c.length>80?c.slice(0,80)+"…":c},[e]);return m.jsxs("div",{className:"my-1.5",children:[m.jsxs("button",{onClick:()=>r(!n),className:"group flex items-center gap-1.5 py-1 text-xs text-neutral-400 hover:text-neutral-500 transition-colors select-none w-full text-left",children:[m.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-transform duration-200",style:{transform:n?"rotate(90deg)":"rotate(0deg)"},children:m.jsx(_n,{size:11,strokeWidth:2})}),m.jsx("span",{className:"font-medium",children:"Thinking"}),!n&&u&&m.jsx("span",{className:"truncate text-neutral-300 ml-1 font-normal",children:u})]}),m.jsx("div",{className:"overflow-hidden relative",style:{maxHeight:n?s+16:0},children:m.jsx("div",{ref:i,className:"pl-5 pt-1 pb-2 before:absolute before:left-[7px] before:top-1 before:bottom-2 before:w-px before:bg-neutral-100",children:m.jsx("div",{className:"text-xs text-neutral-400 leading-relaxed whitespace-pre-wrap min-w-0",children:e.replace(/^Thinking:\s*/i,"").trim()})})})]})});us.displayName="ThinkingBlock";function Tc(e,t=140){return(e.split(`
|
|
122
122
|
`)[0]||"").slice(0,t)}function xc(e){const t=e.title?.replace(/\s*[✓✗]$/,"").replace(/\s*\(待审批\)$/,"");return e.tool?.kind?e.tool.name||t||"Tool":Tc(e.content,140)||e.tool?.name||t||"Tool"}const Yk=new Set(["bash","shell","read","write","edit","glob","grep"]);function qk(e){const t=xc(e),n=e.tool?.name?.trim().toLowerCase();if(!n||!Yk.has(n))return t;const r=e.content.match(/(?:^|\n)Input\n([\s\S]*?)(?:\n\nContent\n|$)/i)?.[1]?.trim();if(r)try{const i=JSON.parse(r);if(typeof i.command=="string"){const s=i.command.split(/\s*(?:&&|\|\||;)\s*/)[0]?.trim();if(s)return s.length>72?`${s.slice(0,72)}…`:s}if(typeof i.file_path=="string")return i.file_path.split("/").pop()||i.file_path;if(typeof i.pattern=="string")return i.pattern}catch{}return t}function Vk(e){const t=e.flatMap(n=>{if(_r(n)){const r=Tc(n.content.replace(/^Thinking:\s*/i,"").trim(),72);return r?[r]:[]}return is(n)?[qk(n)]:[]});return t.filter((n,r)=>r===0||n!==t[r-1])}const Ei=A.memo(({title:e,content:t,type:n})=>{const[r,i]=A.useState(!1);if(n===ee.Action)return m.jsxs("div",{className:"flex items-center gap-1.5 py-0.5 text-xs text-neutral-400",children:[m.jsx("span",{className:"shrink-0 w-1 h-1 rounded-full bg-neutral-300"}),m.jsx("span",{children:t})]});const a=e.endsWith("✓"),u=e.endsWith("✗"),o=u?"text-red-400":a?"text-emerald-400":"text-neutral-400",c=t?.split(`
|
|
123
|
-
`)[0]||"",h=c!==e?c:"";return m.jsxs("div",{className:"my-2",children:[m.jsxs("button",{onClick:()=>i(!r),className:"group flex items-center gap-1.5 py-1 text-xs w-full text-left transition-colors",children:[m.jsx("span",{className:`shrink-0 w-3.5 h-3.5 flex items-center justify-center ${o}`,children:u?m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:m.jsx("path",{d:"M2 2l6 6M8 2l-6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}):a?m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:m.jsx("path",{d:"M2 5.5l2 2 4-4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):m.jsx("span",{className:"w-1 h-1 rounded-full bg-neutral-300"})}),m.jsx("span",{className:"font-medium text-neutral-500 shrink-0",children:e.replace(/\s*[✓✗]$/,"")}),h&&m.jsx("span",{className:"truncate text-neutral-300 font-mono",children:h}),t&&m.jsx("span",{className:"ml-auto shrink-0 opacity-0 group-hover:opacity-100 transition-opacity text-neutral-300",children:r?m.jsx(Eu,{size:10}):m.jsx(_n,{size:10})})]}),r&&t&&m.jsx("div",{className:"ml-5 mt-0.5 mb-1.5 rounded-md bg-neutral-50 border border-neutral-100 overflow-x-auto",children:m.jsx("code",{className:"block p-2.5 text-[11px] font-mono text-neutral-500 leading-relaxed whitespace-pre-wrap break-all",children:t})})]})});Ei.displayName="ToolBlock";const kc=A.memo(({count:e})=>{const[t,n]=A.useState(()=>({current:e,previous:null}));return t.current!==e&&n({current:e,previous:t.current}),m.jsxs("span",{className:"agent-tool-count inline-flex items-center justify-center px-1.5 rounded-full bg-neutral-100 text-neutral-400 text-[10px] font-medium leading-none tabular-nums",children:[m.jsxs("span",{className:"agent-tool-count__window",style:{width:`${String(e).length}ch`},"aria-hidden":"true",children:[t.previous!==null&&m.jsx("span",{className:"agent-tool-count__value agent-tool-count__value--out",onAnimationEnd:()=>n(r=>r.previous===null?r:{...r,previous:null}),children:t.previous},`out-${t.previous}`),m.jsx("span",{className:kn("agent-tool-count__value agent-tool-count__value--in",t.previous!==null&&"agent-tool-count__value--rolling"),children:t.current},`in-${t.current}`)]}),m.jsx("span",{className:"sr-only",children:e})]})});kc.displayName="ToolCountBadge";const bi=A.memo(({logs:e,onBeforeToggle:t})=>{const{t:n}=sr(),[r,i]=A.useState(!1),s=e.filter(is),a=Vk(e),u=s.length;return m.jsxs("div",{className:"my-2",children:[m.jsxs("button",{type:"button",onClick:()=>{t?.(),i(!r)},"aria-expanded":r,className:"group flex items-center gap-1.5 py-1 text-xs w-full text-left transition-colors",children:[m.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-transform duration-200",style:{transform:r?"rotate(90deg)":"rotate(0deg)"},children:m.jsx(_n,{size:11,strokeWidth:2,className:"text-neutral-400"})}),m.jsx("span",{className:"font-medium text-neutral-500 shrink-0",children:n("工具调用")}),m.jsx("span",{className:"shrink-0 inline-flex items-center gap-1",children:m.jsx(kc,{count:u})}),!r&&m.jsxs("span",{className:"truncate text-neutral-300 font-mono",children:[a.slice(-3).join(", "),a.length>3?" …":""]})]}),r&&m.jsx("div",{className:"ml-5 mt-0.5 mb-1.5",children:e.map(o=>_r(o)?m.jsx(us,{content:o.content,isOpenDefault:!1},o.id):m.jsx(_c,{log:o,title:xc(o),onBeforeToggle:t},o.id))})]})});bi.displayName="ExecutionDetailsGroup";const _c=A.memo(({log:e,title:t,onBeforeToggle:n})=>{const[r,i]=A.useState(!1),s=!!e.content.trim()&&e.content.trim()!==t.trim(),a=Lk(e),u=Ok(e)||e.type===ee.Error;return m.jsxs("div",{children:[m.jsxs("button",{type:"button",onClick:()=>{s&&(n?.(),i(!r))},"aria-expanded":s?r:void 0,className:`group flex items-center gap-1.5 py-0.5 text-xs w-full text-left ${s?"cursor-pointer":"cursor-default"}`,children:[m.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center",children:u?m.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",children:m.jsx("path",{d:"M2 2l6 6M8 2l-6 6",stroke:"rgb(248 113 113)",strokeWidth:"1.5",strokeLinecap:"round"})}):a?m.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",children:m.jsx("path",{d:"M2 5.5l2 2 4-4.5",stroke:"rgb(52 211 153)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):m.jsx("span",{className:"w-1 h-1 rounded-full bg-neutral-300"})}),m.jsx("span",{className:"truncate text-neutral-400 font-mono",children:t}),s&&m.jsx("span",{className:"ml-auto shrink-0 opacity-0 group-hover:opacity-100 transition-opacity text-neutral-300",children:r?m.jsx(Eu,{size:10}):m.jsx(_n,{size:10})})]}),r&&s&&m.jsx("div",{className:"ml-5 mt-0.5 mb-1 rounded-md bg-neutral-50 border border-neutral-100 overflow-x-auto",children:m.jsx("code",{className:"block p-2.5 text-[11px] font-mono text-neutral-500 leading-relaxed whitespace-pre-wrap break-all",children:e.content})})]})});_c.displayName="ToolGroupItem";const Ac=A.memo(({content:e,compact:t})=>m.jsx("div",{className:`text-neutral-900 whitespace-pre-wrap min-w-0 ${t?"text-[13px] leading-5":"text-sm leading-6"}`,children:e}));Ac.displayName="AgentText";const Cc=A.memo(({content:e,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})=>m.jsx("div",{className:`text-neutral-900 min-w-0 ${t?"text-[13px] leading-5":"text-sm leading-6"}`,children:m.jsx(ss,{className:"space-y-2",content:e,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})}));Cc.displayName="AssistantMessage";const yc=A.memo(({content:e})=>m.jsx("div",{className:"my-2 rounded-lg border border-red-200 bg-red-50 px-4 py-3",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("svg",{className:"shrink-0 mt-0.5 w-4 h-4 text-red-500",viewBox:"0 0 16 16",fill:"currentColor",children:m.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM7.25 5a.75.75 0 011.5 0v3a.75.75 0 01-1.5 0V5zm.75 6.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})}),m.jsx("pre",{className:"text-xs text-red-700 leading-relaxed whitespace-pre-wrap break-all min-w-0",children:e})]})}));yc.displayName="ErrorMessage";const Ic=A.memo(({content:e})=>m.jsx("div",{className:"my-2 rounded-lg border border-amber-200 bg-amber-50/70 px-4 py-3",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("svg",{className:"shrink-0 mt-0.5 w-4 h-4 text-amber-500",viewBox:"0 0 16 16",fill:"currentColor",children:m.jsx("path",{fillRule:"evenodd",d:"M7.13 2.05a1 1 0 011.74 0l5.55 9.87A1 1 0 0113.55 13H2.45a1 1 0 01-.87-1.08l5.55-9.87zM7.25 6a.75.75 0 011.5 0v2.5a.75.75 0 01-1.5 0V6zM8 11.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})}),m.jsx("pre",{className:"text-xs text-amber-800 leading-relaxed whitespace-pre-wrap break-all min-w-0",children:e})]})}));Ic.displayName="WarningMessage";function cu(e,t){const n=Math.max(0,Math.floor(e/1e3));if(n<60)return t("{count} 秒",{count:n});const r=Math.floor(n/60),i=n%60;if(r<60)return t("{minutes} 分 {seconds} 秒",{minutes:r,seconds:i});const s=Math.floor(r/60),a=r%60;return t("{hours} 小时 {minutes} 分",{hours:s,minutes:a})}const Nc=A.memo(({activity:e})=>{const{t}=sr(),n=A.useRef(Date.now()),[r,i]=A.useState(()=>Date.now()),s=e?.processingStartedAt??n.current;A.useEffect(()=>{const c=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(c)},[]);const a=cu(r-s,t),u=e?.lastOutputAt==null?null:cu(r-e.lastOutputAt,t),o=t("正在思考");return m.jsx(rk,{align:"start",content:m.jsxs("div",{className:"flex min-w-max flex-col gap-0.5",children:[m.jsx("span",{children:t("已处理 {duration}",{duration:a})}),m.jsx("span",{className:"text-neutral-300",children:u?t("最后一次输出于 {duration}前",{duration:u}):t("等待首次输出")})]}),children:m.jsx("span",{tabIndex:0,"aria-label":o,className:"inline-flex cursor-help select-none py-1 text-sm font-normal outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:m.jsx("span",{className:"agent-thinking-shimmer","aria-hidden":"true",children:Array.from(o).map((c,h)=>m.jsx("span",{className:"agent-thinking-char",style:{animationDelay:`${h*45}ms`},children:c},`${c}-${h}`))})})})});Nc.displayName="ThinkingIndicator";const Sc=A.memo(({turnKey:e,duration:t,collapsible:n,isOpen:r,onToggle:i,onBeforeToggle:s})=>{const{t:a}=sr(),u=t?a("已处理 {duration}",{duration:t}):a("已处理"),o=m.jsxs(m.Fragment,{children:[m.jsx("span",{children:u}),n&&m.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center transition-transform duration-200 motion-reduce:transition-none",style:{transform:r?"rotate(90deg)":"rotate(0deg)"},children:m.jsx(_n,{size:14,strokeWidth:2})})]});return n?m.jsx("div",{className:"mb-3 mt-1",children:m.jsx("button",{type:"button","data-at-group-header":e,"aria-expanded":r,onClick:()=>{s?.(),i(e)},className:"group flex w-full items-center gap-1.5 border-b border-neutral-100 py-2 text-left text-sm leading-6 text-neutral-500 transition-colors hover:text-neutral-700",children:o})}):m.jsx("div",{className:"mb-3 mt-1",children:m.jsx("div",{role:"status",className:"flex w-full items-center gap-1.5 border-b border-neutral-100 py-2 text-sm leading-6 text-neutral-500",children:o})})});Sc.displayName="ProcessedGroupSummary";function Wk(e,t,n,r,i,s,a,u){if(e.kind==="execution-group")return m.jsx(bi,{logs:e.logs,onBeforeToggle:u});const o=e.log;if(o.type===ee.Tool&&o.children?.length)return m.jsx(bi,{logs:o.children,onBeforeToggle:u});if(rs(o))return null;if(o.title==="Thinking"||o.content.startsWith("Thinking:"))return m.jsx(us,{content:o.content,isOpenDefault:!0});switch(o.type){case ee.User:return m.jsx(as,{content:o.content,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i});case ee.Tool:return m.jsx(Ei,{type:o.type,title:o.title||"Tool",content:o.content});case ee.Action:return m.jsx(Ei,{type:o.type,title:"Action",content:o.content});case ee.Assistant:return m.jsx(Cc,{content:o.content,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a});case ee.Info:return o.tokenUsage?null:m.jsx(Ac,{content:o.content,compact:t});case ee.Error:return m.jsx(yc,{content:o.content});case ee.Warning:return m.jsx(Ic,{content:o.content});case ee.Cursor:return m.jsx(Nc,{activity:o.cursorActivity});default:return null}}const Gk=8,I3=A.forwardRef(function({logs:t,isOutputActive:n,lastExitAt:r,onUserToggleDetails:i,scrollElementRef:s,workingDir:a,onOpenWorkspaceFile:u,onOpenPreviewUrl:o,onOpenVisualization:c,downloadSessionId:h},d){const[f,p]=A.useState(null),[E,_]=A.useState(!1),[I,C]=A.useState(0),[w,O]=A.useState(()=>new Set),[F,z]=A.useState(()=>Date.now());A.useEffect(()=>{if(!n)return;const B=()=>z(Date.now()),W=window.setTimeout(B,0),oe=window.setInterval(B,1e3);return()=>{window.clearTimeout(W),window.clearInterval(oe)}},[n]);const L=A.useCallback(B=>{if(!B)return;const W=s?.current??$k(B);p(oe=>oe===W?oe:W),C(W?.clientHeight??0),_(!0)},[s]);A.useEffect(()=>{if(!f)return;const B=()=>C(f.clientHeight);if(B(),typeof ResizeObserver>"u")return;const W=new ResizeObserver(B);return W.observe(f),()=>W.disconnect()},[f]);const K=A.useCallback(B=>{O(W=>{const oe=new Set(W);return oe.has(B)?oe.delete(B):oe.add(B),oe})},[]),G=A.useMemo(()=>{if(n===void 0)return null;const B=vk(t),W=B.length-1;return B.map((oe,se)=>Uk(oe,se===W,n,r))},[t,n,r]),X=A.useMemo(()=>n===void 0?qn(t):null,[n,t]),N=A.useMemo(()=>X?X.map(B=>({kind:"item",key:`legacy:${B.key}`,item:B,processed:!1})):jk(G??[],w),[w,X,G]),U=Th({count:N.length,getScrollElement:()=>f,estimateSize:B=>zk(N[B]),getItemKey:B=>N[B]?.key??B,overscan:Gk,measureElement:B=>B.getBoundingClientRect().height});U.shouldAdjustScrollPositionOnItemSizeChange=xh;const M=f!==null&&I>0;A.useImperativeHandle(d,()=>({scrollToBottom:(B="instant")=>{const W=s?.current;if(!W||(M&&N.length>0&&U.scrollToIndex(N.length-1,{align:"end"}),W.scrollTo({top:W.scrollHeight,behavior:B}),B!=="instant"))return;let oe=0;const se=()=>{const x=s?.current;x&&(x.scrollHeight-x.scrollTop-x.clientHeight<=1||(x.scrollTop=x.scrollHeight,++oe<5&&requestAnimationFrame(se)))};requestAnimationFrame(se)}}),[M,N.length,s,U]);const V=A.useCallback(B=>{const W=B.end===null?F:B.end;return Fk(B.start,W)},[F]),$=A.useCallback(B=>{switch(B.kind){case"user":return m.jsx(as,{content:B.log.content,workingDir:a,onOpenWorkspaceFile:u,onOpenPreviewUrl:o});case"summary":return m.jsx(Sc,{turnKey:B.turnKey,duration:V(B.duration),collapsible:B.collapsible,isOpen:w.has(B.turnKey),onToggle:K,onBeforeToggle:i});case"item":return Wk(B.item,!1,a,u,o,c,h,i);default:return null}},[h,V,w,o,c,u,i,K,a]),j=U.getVirtualItems();return E?m.jsx("div",{ref:L,className:"w-full mx-auto pb-4 min-w-0",style:{overflowWrap:"anywhere"},children:M?m.jsx("div",{style:{height:U.getTotalSize(),width:"100%",position:"relative"},children:j.map(B=>{const W=N[B.index];return W?m.jsx("div",{"data-index":B.index,"data-at-row":W.key,...W.kind==="item"&&W.processed?{"data-processed-content":""}:{},ref:U.measureElement,style:{position:"absolute",top:B.start,left:0,width:"100%"},children:$(W)},W.key):null})},"virtualized"):m.jsx("div",{children:N.map(B=>m.jsx("div",{"data-at-row":B.key,...B.kind==="item"&&B.processed?{"data-processed-content":""}:{},children:$(B)},B.key))},"static")}):m.jsx("div",{ref:L,className:"w-full mx-auto pb-4 min-w-0",style:{overflowWrap:"anywhere"}})}),Kk=xt();function Qk(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function N3({files:e,onRemove:t}){return e.length===0?null:m.jsx("div",{"aria-label":"Attachments",className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:e.map(n=>m.jsx(Xk,{item:n,onRemove:t},n.tempId))})}function Xk({item:e,onRemove:t}){const n=e.file.type.startsWith("image/"),r=e.status==="error",i=e.status==="uploading";return m.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${r?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[n&&e.status==="done"&&e.attachment?m.jsx("img",{src:`${Kk}${e.attachment.url}`,alt:e.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):m.jsx("span",{className:"flex-shrink-0",children:i?m.jsx($c,{size:16,className:"animate-spin text-neutral-400"}):n?m.jsx(Jc,{size:16,className:"text-neutral-400"}):m.jsx(Xc,{size:16,className:"text-neutral-400"})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:"truncate font-medium",children:e.file.name}),r?m.jsx("div",{className:"truncate text-red-500",children:e.error}):m.jsx("div",{className:"text-neutral-400",children:Qk(e.file.size)})]}),m.jsx("button",{onClick:()=>t(e.tempId),className:"absolute -top-1.5 -right-1.5 hidden group-hover:flex items-center justify-center w-5 h-5 rounded-full bg-neutral-700 text-white hover:bg-neutral-900 transition-colors",children:m.jsx(Yc,{size:10})})]})}const Zk=xt();async function Jk(e){const t=new FormData;t.append("file",e);const n=await fetch(`${Zk}/attachments/upload`,{method:"POST",body:t});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Upload failed (${n.status})`)}return n.json()}let e3=0;function S3(){const[e,t]=A.useState([]),n=A.useRef(e);n.current=e;const r=A.useCallback(async d=>{const f=d.map(p=>({tempId:`tmp-${++e3}`,file:p,progress:0,status:"uploading"}));t(p=>[...p,...f]),await Promise.allSettled(f.map(async p=>{try{const E=await Jk(p.file);t(_=>_.map(I=>I.tempId===p.tempId?{...I,status:"done",progress:100,attachment:E}:I))}catch(E){t(_=>_.map(I=>I.tempId===p.tempId?{...I,status:"error",error:E instanceof Error?E.message:"Upload failed"}:I))}}))},[]),i=A.useCallback(()=>n.current.filter(d=>d.status==="done"&&d.attachment).map(d=>d.attachment),[]),s=A.useCallback(d=>{t(f=>f.filter(p=>p.tempId!==d))},[]),a=A.useCallback(()=>{t([])},[]),u=A.useCallback(d=>{d.length!==0&&t(f=>{const p=new Set(f.map(_=>_.attachment?.id??_.tempId)),E=d.filter(_=>{const I=_.attachment?.id??_.tempId;return p.has(I)?!1:(p.add(I),!0)});return E.length>0?[...f,...E]:f})},[]),o=A.useCallback(()=>{const d=i();return d.length===0?"":d.map(f=>`${f.mimeType.startsWith("image/")?"!":""}[${f.originalName}](${f.storagePath})`).join(`
|
|
123
|
+
`)[0]||"",h=c!==e?c:"";return m.jsxs("div",{className:"my-2",children:[m.jsxs("button",{onClick:()=>i(!r),className:"group flex items-center gap-1.5 py-1 text-xs w-full text-left transition-colors",children:[m.jsx("span",{className:`shrink-0 w-3.5 h-3.5 flex items-center justify-center ${o}`,children:u?m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:m.jsx("path",{d:"M2 2l6 6M8 2l-6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}):a?m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:m.jsx("path",{d:"M2 5.5l2 2 4-4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):m.jsx("span",{className:"w-1 h-1 rounded-full bg-neutral-300"})}),m.jsx("span",{className:"font-medium text-neutral-500 shrink-0",children:e.replace(/\s*[✓✗]$/,"")}),h&&m.jsx("span",{className:"truncate text-neutral-300 font-mono",children:h}),t&&m.jsx("span",{className:"ml-auto shrink-0 opacity-0 group-hover:opacity-100 transition-opacity text-neutral-300",children:r?m.jsx(Eu,{size:10}):m.jsx(_n,{size:10})})]}),r&&t&&m.jsx("div",{className:"ml-5 mt-0.5 mb-1.5 rounded-md bg-neutral-50 border border-neutral-100 overflow-x-auto",children:m.jsx("code",{className:"block p-2.5 text-[11px] font-mono text-neutral-500 leading-relaxed whitespace-pre-wrap break-all",children:t})})]})});Ei.displayName="ToolBlock";const kc=A.memo(({count:e})=>{const[t,n]=A.useState(()=>({current:e,previous:null}));return t.current!==e&&n({current:e,previous:t.current}),m.jsxs("span",{className:"agent-tool-count inline-flex items-center justify-center px-1.5 rounded-full bg-neutral-100 text-neutral-400 text-[10px] font-medium leading-none tabular-nums",children:[m.jsxs("span",{className:"agent-tool-count__window",style:{width:`${String(e).length}ch`},"aria-hidden":"true",children:[t.previous!==null&&m.jsx("span",{className:"agent-tool-count__value agent-tool-count__value--out whitespace-nowrap min-w-max",onAnimationEnd:()=>n(r=>r.previous===null?r:{...r,previous:null}),children:t.previous},`out-${t.previous}`),m.jsx("span",{className:kn("agent-tool-count__value agent-tool-count__value--in whitespace-nowrap min-w-max",t.previous!==null&&"agent-tool-count__value--rolling"),children:t.current},`in-${t.current}`)]}),m.jsx("span",{className:"sr-only",children:e})]})});kc.displayName="ToolCountBadge";const bi=A.memo(({logs:e,onBeforeToggle:t})=>{const{t:n}=sr(),[r,i]=A.useState(!1),s=e.filter(is),a=Vk(e),u=s.length;return m.jsxs("div",{className:"my-2",children:[m.jsxs("button",{type:"button",onClick:()=>{t?.(),i(!r)},"aria-expanded":r,className:"group flex items-center gap-1.5 py-1 text-xs w-full text-left transition-colors",children:[m.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center transition-transform duration-200",style:{transform:r?"rotate(90deg)":"rotate(0deg)"},children:m.jsx(_n,{size:11,strokeWidth:2,className:"text-neutral-400"})}),m.jsx("span",{className:"font-medium text-neutral-500 shrink-0",children:n("工具调用")}),m.jsx("span",{className:"shrink-0 inline-flex items-center gap-1",children:m.jsx(kc,{count:u})}),!r&&m.jsxs("span",{className:"truncate text-neutral-300 font-mono",children:[a.slice(-3).join(", "),a.length>3?" …":""]})]}),r&&m.jsx("div",{className:"ml-5 mt-0.5 mb-1.5",children:e.map(o=>_r(o)?m.jsx(us,{content:o.content,isOpenDefault:!1},o.id):m.jsx(_c,{log:o,title:xc(o),onBeforeToggle:t},o.id))})]})});bi.displayName="ExecutionDetailsGroup";const _c=A.memo(({log:e,title:t,onBeforeToggle:n})=>{const[r,i]=A.useState(!1),s=!!e.content.trim()&&e.content.trim()!==t.trim(),a=Lk(e),u=Ok(e)||e.type===ee.Error;return m.jsxs("div",{children:[m.jsxs("button",{type:"button",onClick:()=>{s&&(n?.(),i(!r))},"aria-expanded":s?r:void 0,className:`group flex items-center gap-1.5 py-0.5 text-xs w-full text-left ${s?"cursor-pointer":"cursor-default"}`,children:[m.jsx("span",{className:"shrink-0 w-3.5 h-3.5 flex items-center justify-center",children:u?m.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",children:m.jsx("path",{d:"M2 2l6 6M8 2l-6 6",stroke:"rgb(248 113 113)",strokeWidth:"1.5",strokeLinecap:"round"})}):a?m.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",children:m.jsx("path",{d:"M2 5.5l2 2 4-4.5",stroke:"rgb(52 211 153)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):m.jsx("span",{className:"w-1 h-1 rounded-full bg-neutral-300"})}),m.jsx("span",{className:"truncate text-neutral-400 font-mono",children:t}),s&&m.jsx("span",{className:"ml-auto shrink-0 opacity-0 group-hover:opacity-100 transition-opacity text-neutral-300",children:r?m.jsx(Eu,{size:10}):m.jsx(_n,{size:10})})]}),r&&s&&m.jsx("div",{className:"ml-5 mt-0.5 mb-1 rounded-md bg-neutral-50 border border-neutral-100 overflow-x-auto",children:m.jsx("code",{className:"block p-2.5 text-[11px] font-mono text-neutral-500 leading-relaxed whitespace-pre-wrap break-all",children:e.content})})]})});_c.displayName="ToolGroupItem";const Ac=A.memo(({content:e,compact:t})=>m.jsx("div",{className:`text-neutral-900 whitespace-pre-wrap min-w-0 ${t?"text-[13px] leading-5":"text-sm leading-6"}`,children:e}));Ac.displayName="AgentText";const Cc=A.memo(({content:e,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})=>m.jsx("div",{className:`text-neutral-900 min-w-0 ${t?"text-[13px] leading-5":"text-sm leading-6"}`,children:m.jsx(ss,{className:"space-y-2",content:e,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a})}));Cc.displayName="AssistantMessage";const yc=A.memo(({content:e})=>m.jsx("div",{className:"my-2 rounded-lg border border-red-200 bg-red-50 px-4 py-3",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("svg",{className:"shrink-0 mt-0.5 w-4 h-4 text-red-500",viewBox:"0 0 16 16",fill:"currentColor",children:m.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM7.25 5a.75.75 0 011.5 0v3a.75.75 0 01-1.5 0V5zm.75 6.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})}),m.jsx("pre",{className:"text-xs text-red-700 leading-relaxed whitespace-pre-wrap break-all min-w-0",children:e})]})}));yc.displayName="ErrorMessage";const Ic=A.memo(({content:e})=>m.jsx("div",{className:"my-2 rounded-lg border border-amber-200 bg-amber-50/70 px-4 py-3",children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("svg",{className:"shrink-0 mt-0.5 w-4 h-4 text-amber-500",viewBox:"0 0 16 16",fill:"currentColor",children:m.jsx("path",{fillRule:"evenodd",d:"M7.13 2.05a1 1 0 011.74 0l5.55 9.87A1 1 0 0113.55 13H2.45a1 1 0 01-.87-1.08l5.55-9.87zM7.25 6a.75.75 0 011.5 0v2.5a.75.75 0 01-1.5 0V6zM8 11.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})}),m.jsx("pre",{className:"text-xs text-amber-800 leading-relaxed whitespace-pre-wrap break-all min-w-0",children:e})]})}));Ic.displayName="WarningMessage";function cu(e,t){const n=Math.max(0,Math.floor(e/1e3));if(n<60)return t("{count} 秒",{count:n});const r=Math.floor(n/60),i=n%60;if(r<60)return t("{minutes} 分 {seconds} 秒",{minutes:r,seconds:i});const s=Math.floor(r/60),a=r%60;return t("{hours} 小时 {minutes} 分",{hours:s,minutes:a})}const Nc=A.memo(({activity:e})=>{const{t}=sr(),n=A.useRef(Date.now()),[r,i]=A.useState(()=>Date.now()),s=e?.processingStartedAt??n.current;A.useEffect(()=>{const c=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(c)},[]);const a=cu(r-s,t),u=e?.lastOutputAt==null?null:cu(r-e.lastOutputAt,t),o=t("正在思考");return m.jsx(rk,{align:"start",content:m.jsxs("div",{className:"flex min-w-max flex-col gap-0.5",children:[m.jsx("span",{children:t("已处理 {duration}",{duration:a})}),m.jsx("span",{className:"text-neutral-300",children:u?t("最后一次输出于 {duration}前",{duration:u}):t("等待首次输出")})]}),children:m.jsx("span",{tabIndex:0,"aria-label":o,className:"inline-flex cursor-help select-none py-1 text-sm font-normal outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:m.jsx("span",{className:"agent-thinking-shimmer","aria-hidden":"true",children:Array.from(o).map((c,h)=>m.jsx("span",{className:"agent-thinking-char",style:{animationDelay:`${h*45}ms`},children:c},`${c}-${h}`))})})})});Nc.displayName="ThinkingIndicator";const Sc=A.memo(({turnKey:e,duration:t,collapsible:n,isOpen:r,onToggle:i,onBeforeToggle:s})=>{const{t:a}=sr(),u=t?a("已处理 {duration}",{duration:t}):a("已处理"),o=m.jsxs(m.Fragment,{children:[m.jsx("span",{children:u}),n&&m.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center transition-transform duration-200 motion-reduce:transition-none",style:{transform:r?"rotate(90deg)":"rotate(0deg)"},children:m.jsx(_n,{size:14,strokeWidth:2})})]});return n?m.jsx("div",{className:"mb-3 mt-1",children:m.jsx("button",{type:"button","data-at-group-header":e,"aria-expanded":r,onClick:()=>{s?.(),i(e)},className:"group flex w-full items-center gap-1.5 border-b border-neutral-100 py-2 text-left text-sm leading-6 text-neutral-500 transition-colors hover:text-neutral-700",children:o})}):m.jsx("div",{className:"mb-3 mt-1",children:m.jsx("div",{role:"status",className:"flex w-full items-center gap-1.5 border-b border-neutral-100 py-2 text-sm leading-6 text-neutral-500",children:o})})});Sc.displayName="ProcessedGroupSummary";function Wk(e,t,n,r,i,s,a,u){if(e.kind==="execution-group")return m.jsx(bi,{logs:e.logs,onBeforeToggle:u});const o=e.log;if(o.type===ee.Tool&&o.children?.length)return m.jsx(bi,{logs:o.children,onBeforeToggle:u});if(rs(o))return null;if(o.title==="Thinking"||o.content.startsWith("Thinking:"))return m.jsx(us,{content:o.content,isOpenDefault:!0});switch(o.type){case ee.User:return m.jsx(as,{content:o.content,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i});case ee.Tool:return m.jsx(Ei,{type:o.type,title:o.title||"Tool",content:o.content});case ee.Action:return m.jsx(Ei,{type:o.type,title:"Action",content:o.content});case ee.Assistant:return m.jsx(Cc,{content:o.content,compact:t,workingDir:n,onOpenWorkspaceFile:r,onOpenPreviewUrl:i,onOpenVisualization:s,downloadSessionId:a});case ee.Info:return o.tokenUsage?null:m.jsx(Ac,{content:o.content,compact:t});case ee.Error:return m.jsx(yc,{content:o.content});case ee.Warning:return m.jsx(Ic,{content:o.content});case ee.Cursor:return m.jsx(Nc,{activity:o.cursorActivity});default:return null}}const Gk=8,I3=A.forwardRef(function({logs:t,isOutputActive:n,lastExitAt:r,onUserToggleDetails:i,scrollElementRef:s,workingDir:a,onOpenWorkspaceFile:u,onOpenPreviewUrl:o,onOpenVisualization:c,downloadSessionId:h},d){const[f,p]=A.useState(null),[E,_]=A.useState(!1),[I,C]=A.useState(0),[w,O]=A.useState(()=>new Set),[F,z]=A.useState(()=>Date.now());A.useEffect(()=>{if(!n)return;const B=()=>z(Date.now()),W=window.setTimeout(B,0),oe=window.setInterval(B,1e3);return()=>{window.clearTimeout(W),window.clearInterval(oe)}},[n]);const L=A.useCallback(B=>{if(!B)return;const W=s?.current??$k(B);p(oe=>oe===W?oe:W),C(W?.clientHeight??0),_(!0)},[s]);A.useEffect(()=>{if(!f)return;const B=()=>C(f.clientHeight);if(B(),typeof ResizeObserver>"u")return;const W=new ResizeObserver(B);return W.observe(f),()=>W.disconnect()},[f]);const K=A.useCallback(B=>{O(W=>{const oe=new Set(W);return oe.has(B)?oe.delete(B):oe.add(B),oe})},[]),G=A.useMemo(()=>{if(n===void 0)return null;const B=vk(t),W=B.length-1;return B.map((oe,se)=>Uk(oe,se===W,n,r))},[t,n,r]),X=A.useMemo(()=>n===void 0?qn(t):null,[n,t]),N=A.useMemo(()=>X?X.map(B=>({kind:"item",key:`legacy:${B.key}`,item:B,processed:!1})):jk(G??[],w),[w,X,G]),U=Th({count:N.length,getScrollElement:()=>f,estimateSize:B=>zk(N[B]),getItemKey:B=>N[B]?.key??B,overscan:Gk,measureElement:B=>B.getBoundingClientRect().height});U.shouldAdjustScrollPositionOnItemSizeChange=xh;const M=f!==null&&I>0;A.useImperativeHandle(d,()=>({scrollToBottom:(B="instant")=>{const W=s?.current;if(!W||(M&&N.length>0&&U.scrollToIndex(N.length-1,{align:"end"}),W.scrollTo({top:W.scrollHeight,behavior:B}),B!=="instant"))return;let oe=0;const se=()=>{const x=s?.current;x&&(x.scrollHeight-x.scrollTop-x.clientHeight<=1||(x.scrollTop=x.scrollHeight,++oe<5&&requestAnimationFrame(se)))};requestAnimationFrame(se)}}),[M,N.length,s,U]);const V=A.useCallback(B=>{const W=B.end===null?F:B.end;return Fk(B.start,W)},[F]),$=A.useCallback(B=>{switch(B.kind){case"user":return m.jsx(as,{content:B.log.content,workingDir:a,onOpenWorkspaceFile:u,onOpenPreviewUrl:o});case"summary":return m.jsx(Sc,{turnKey:B.turnKey,duration:V(B.duration),collapsible:B.collapsible,isOpen:w.has(B.turnKey),onToggle:K,onBeforeToggle:i});case"item":return Wk(B.item,!1,a,u,o,c,h,i);default:return null}},[h,V,w,o,c,u,i,K,a]),j=U.getVirtualItems();return E?m.jsx("div",{ref:L,className:"w-full mx-auto pb-4 min-w-0",style:{overflowWrap:"anywhere"},children:M?m.jsx("div",{style:{height:U.getTotalSize(),width:"100%",position:"relative"},children:j.map(B=>{const W=N[B.index];return W?m.jsx("div",{"data-index":B.index,"data-at-row":W.key,...W.kind==="item"&&W.processed?{"data-processed-content":""}:{},ref:U.measureElement,style:{position:"absolute",top:B.start,left:0,width:"100%"},children:$(W)},W.key):null})},"virtualized"):m.jsx("div",{children:N.map(B=>m.jsx("div",{"data-at-row":B.key,...B.kind==="item"&&B.processed?{"data-processed-content":""}:{},children:$(B)},B.key))},"static")}):m.jsx("div",{ref:L,className:"w-full mx-auto pb-4 min-w-0",style:{overflowWrap:"anywhere"}})}),Kk=xt();function Qk(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function N3({files:e,onRemove:t}){return e.length===0?null:m.jsx("div",{"aria-label":"Attachments",className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:e.map(n=>m.jsx(Xk,{item:n,onRemove:t},n.tempId))})}function Xk({item:e,onRemove:t}){const n=e.file.type.startsWith("image/"),r=e.status==="error",i=e.status==="uploading";return m.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${r?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[n&&e.status==="done"&&e.attachment?m.jsx("img",{src:`${Kk}${e.attachment.url}`,alt:e.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):m.jsx("span",{className:"flex-shrink-0",children:i?m.jsx($c,{size:16,className:"animate-spin text-neutral-400"}):n?m.jsx(Jc,{size:16,className:"text-neutral-400"}):m.jsx(Xc,{size:16,className:"text-neutral-400"})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:"truncate font-medium",children:e.file.name}),r?m.jsx("div",{className:"truncate text-red-500",children:e.error}):m.jsx("div",{className:"text-neutral-400",children:Qk(e.file.size)})]}),m.jsx("button",{onClick:()=>t(e.tempId),className:"absolute -top-1.5 -right-1.5 hidden group-hover:flex items-center justify-center w-5 h-5 rounded-full bg-neutral-700 text-white hover:bg-neutral-900 transition-colors",children:m.jsx(Yc,{size:10})})]})}const Zk=xt();async function Jk(e){const t=new FormData;t.append("file",e);const n=await fetch(`${Zk}/attachments/upload`,{method:"POST",body:t});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Upload failed (${n.status})`)}return n.json()}let e3=0;function S3(){const[e,t]=A.useState([]),n=A.useRef(e);n.current=e;const r=A.useCallback(async d=>{const f=d.map(p=>({tempId:`tmp-${++e3}`,file:p,progress:0,status:"uploading"}));t(p=>[...p,...f]),await Promise.allSettled(f.map(async p=>{try{const E=await Jk(p.file);t(_=>_.map(I=>I.tempId===p.tempId?{...I,status:"done",progress:100,attachment:E}:I))}catch(E){t(_=>_.map(I=>I.tempId===p.tempId?{...I,status:"error",error:E instanceof Error?E.message:"Upload failed"}:I))}}))},[]),i=A.useCallback(()=>n.current.filter(d=>d.status==="done"&&d.attachment).map(d=>d.attachment),[]),s=A.useCallback(d=>{t(f=>f.filter(p=>p.tempId!==d))},[]),a=A.useCallback(()=>{t([])},[]),u=A.useCallback(d=>{d.length!==0&&t(f=>{const p=new Set(f.map(_=>_.attachment?.id??_.tempId)),E=d.filter(_=>{const I=_.attachment?.id??_.tempId;return p.has(I)?!1:(p.add(I),!0)});return E.length>0?[...f,...E]:f})},[]),o=A.useCallback(()=>{const d=i();return d.length===0?"":d.map(f=>`${f.mimeType.startsWith("image/")?"!":""}[${f.originalName}](${f.storagePath})`).join(`
|
|
124
124
|
`)},[i]),c=e.length>0,h=e.some(d=>d.status==="uploading");return{files:e,addFiles:r,removeFile:s,clear:a,restoreFiles:u,buildMarkdownLinks:o,getDoneAttachments:i,hasFiles:c,isUploading:h}}function w3(e){const t=A.useMemo(()=>Array.from(new Set(e.filter(Boolean))),[e]);return qc({queryKey:["attachments","metadata",t],queryFn:()=>Vc.get("/attachments/metadata",{params:{ids:t.join(",")}}),enabled:t.length>0,staleTime:300*1e3})}const t3=/^(0|[1-9]\d*)$/,n3=2147483647;function r3(e,t){if(!Array.isArray(t))return Ue("patch sequence must be an array");let n=e;for(const r of t){const i=i3(n,r);if(!i.ok)return i;n=i.conversation}return{ok:!0,conversation:n}}function i3(e,t){if(!rr(t))return Ue("operation is not an object");const n=u3(t.path);return n?t.op==="add"?s3(e,n,t):t.op==="replace"?a3(e,n,t):qe(t):qe(t)}function s3(e,t,n){if(n.value===void 0)return Ue("operation value is required");if(ir(n.value))return Ue("operation value cannot contain undefined");if(t.length===1&&t[0]==="sessionId")return Dt({...e,sessionId:n.value});if(t[0]!=="entries"||t.length!==2)return qe(n);const r=wc(t[1]);if(r===void 0)return qe(n);if(!Array.isArray(e.entries))return Ue("entries is not an array");if(r>e.entries.length)return qe(n);const i=e.entries.slice();return i.splice(r,0,n.value),Dt(nr(e,i))}function a3(e,t,n){if(n.value===void 0)return Ue("operation value is required");if(ir(n.value))return Ue("operation value cannot contain undefined");if(t.length===1&&t[0]==="entries"){const h=n.value,d=Array.isArray(h)?h.slice():h;return Dt(nr(e,d))}if(t[0]!=="entries")return qe(n);const r=wc(t[1]);if(r===void 0)return qe(n);if(!Array.isArray(e.entries))return Ue("entries is not an array");const i=t.length===2,s=t.length===3&&t[2]==="content",a=t.length===4&&t[2]==="metadata"&&t[3]==="status";if(!i&&!s&&!a)return qe(n);if(i){if(r>=e.entries.length)return qe(n);const h=e.entries.slice();return h[r]=n.value,Dt(nr(e,h))}const u=e.entries[r];if(!rr(u))return Ue("entry does not exist");if(s)return u.content===void 0?Ue("entry content does not exist"):Dt(hu(e,r,{...u,content:n.value}));const o=u.metadata;if(!rr(o)||o.status===void 0)return Ue("entry metadata status does not exist");const c={...o,status:n.value};return Dt(hu(e,r,{...u,metadata:c}))}function hu(e,t,n){const r=e.entries.slice();return r[t]=n,nr(e,r)}function nr(e,t){return{...e,entries:t}}function u3(e){if(!(typeof e!="string"||!e.startsWith("/")))return e.slice(1).split("/")}function wc(e){if(!t3.test(e))return;const t=Number(e);if(Number.isSafeInteger(t))return t<=n3?t:void 0}function rr(e){return typeof e=="object"&&e!==null}function ir(e){return e===void 0?!0:Array.isArray(e)?e.some(ir):rr(e)?Object.keys(e).some(t=>ir(e[t])):!1}function Dt(e){return{ok:!0,conversation:e}}function Ue(e){return{ok:!1,kind:"failed",reason:e}}function qe(e){return console.warn("[sessionLogStore] unsupported conversation patch op/path",{op:e.op,path:e.path}),{ok:!1,kind:"unsupported",reason:`unsupported op/path: ${String(e.op)} ${String(e.path)}`}}const L3={entries:[],isTruncated:!1},o3=50,du=500;function fu(e){return typeof e?.seq=="number"?e.seq:0}function pu(e){return e?.entries.at(-1)?.id}function mu(e){const t=e?.entries.at(-1);if(t)return JSON.stringify(t)}function O3(e){return{...e,entries:Array.isArray(e.entries)?e.entries:[],isTruncated:!1}}function R3(e,t){if(!e||e.isTruncated)return!0;const n=fu(e),r=fu(t);if(r>n)return!0;if(r<n)return!1;if(t.entries.length>e.entries.length)return!0;if(t.entries.length<e.entries.length)return!1;const i=pu(e),s=pu(t);if(s&&i&&s!==i)return!0;const a=mu(e),u=mu(t);return!!(u&&a&&u!==a)}function l3(e,t){for(;t.length>o3;){const n=t[0];t=t.slice(1);const{[n]:r,...i}=e;e=i}return{conversations:e,accessOrder:t}}const D3=Wc((e,t)=>({conversations:{},accessOrder:[],setConversation:(n,r)=>{e(i=>{const s=i.accessOrder.filter(u=>u!==n);s.push(n);const a={...i.conversations,[n]:{...r,isTruncated:r.isTruncated??!1}};return l3(a,s)})},applyPatch:(n,r,i)=>{const s=t().conversations[n];if(!s)return!1;if(typeof i=="number"&&typeof s.seq=="number"&&i<=s.seq)return!0;const a=r3(s,r);if(!a.ok)return a.kind==="failed"&&console.error("[sessionLogStore] applyPatch failed:",a.reason),!1;const u={...a.conversation,seq:typeof i=="number"?i:s.seq,isTruncated:s.isTruncated??!1};return e(o=>({conversations:{...o.conversations,[n]:u}})),!0},touchAccess:n=>{e(r=>{const i=r.accessOrder.indexOf(n);if(i===-1||i===r.accessOrder.length-1)return r;const s=[...r.accessOrder];return s.splice(i,1),s.push(n),{accessOrder:s}})},truncateSession:n=>{e(r=>{const i=r.conversations[n];return!i||i.entries.length<=du?r:{conversations:{...r.conversations,[n]:{...i,entries:i.entries.slice(-du),isTruncated:!0}}}})},removeSession:n=>{e(r=>{const{[n]:i,...s}=r.conversations;return{conversations:s,accessOrder:r.accessOrder.filter(a=>a!==n)}})},getConversation:n=>t().conversations[n],clear:()=>{e({conversations:{},accessOrder:[]})}})),c3={[Y.CLAUDE_CODE]:{agentType:Y.CLAUDE_CODE,label:"Claude Code",logoSrc:"/agent-icons/claude-code.svg"},[Y.GEMINI_CLI]:{agentType:Y.GEMINI_CLI,label:"Gemini CLI",logoSrc:"/agent-icons/gemini-cli.svg"},[Y.CURSOR_AGENT]:{agentType:Y.CURSOR_AGENT,label:"Cursor Agent",logoSrc:"/agent-icons/cursor-agent.svg"},[Y.CODEX]:{agentType:Y.CODEX,label:"Codex",logoSrc:"/agent-icons/codex.svg"},[Y.QWEN_CODE]:{agentType:Y.QWEN_CODE,label:"Qwen Code",logoSrc:"/agent-icons/qwen-code.svg"},[Y.KIRO_CLI]:{agentType:Y.KIRO_CLI,label:"Kiro CLI",logoSrc:"/agent-icons/kiro-cli.svg"},[Y.OPENCODE]:{agentType:Y.OPENCODE,label:"OpenCode",logoSrc:"/agent-icons/opencode.svg"},[Y.PI_CODING_AGENT]:{agentType:Y.PI_CODING_AGENT,label:"Pi Coding Agent",logoSrc:"/agent-icons/pi-coding-agent.svg"},[Y.GROK_BUILD]:{agentType:Y.GROK_BUILD,label:"Grok Build",logoSrc:"/agent-icons/grok-build.svg"},[Y.MINION_CODE]:{agentType:Y.MINION_CODE,label:"Minion Code"},[Y.DEEPSEEK_HERMES]:{agentType:Y.DEEPSEEK_HERMES,label:"DeepSeek Harness",logoSrc:"/agent-icons/deepseek-hermes.svg"}};function h3(e){return e?c3[e]??null:null}function P3(e,t){return h3(e)?.label??t??(e?String(e):"")}const d3=Object.freeze(Object.defineProperty({__proto__:null,Mermaid:lc},Symbol.toStringTag,{value:"Module"}));export{N3 as A,Ak as B,xs as C,fs as D,L3 as E,Xc as F,hx as I,ve as L,T3 as P,oc as Q,Te as R,Es as S,rk as T,rh as U,gs as W,_3 as Z,Q as a,I3 as b,D3 as c,E3 as d,O3 as e,r3 as f,h3 as g,Y as h,b3 as i,x3 as j,P3 as k,ps as l,w3 as m,g3 as n,wk as o,pk as p,Ck as q,yk as r,R3 as s,ms as t,S3 as u,Jc as v,C3 as w,ou as x,A3 as y,y3 as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as a}from"./index-
|
|
1
|
+
import{k as a}from"./index-oC5eh7mZ.js";const e=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],o=a("message-square",e);export{o as M};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as ae}from"./chunk-55IACEB6-
|
|
1
|
+
import{g as ae}from"./chunk-55IACEB6-Bb-pPIxs.js";import{s as ce}from"./chunk-2J33WTMH-DQCbv8W_.js";import{_ as h,l as I,o as le,r as he,D as de,G as j,c as P,i as G,b3 as ge,ac as ue,ad as pe,ae as fe}from"./index-DaRxJqVy.js";import"./index-oC5eh7mZ.js";const _=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function me(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}const ye=new Uint8Array(16);function Ee(){return crypto.getRandomValues(ye)}function _e(t,e,a){return crypto.randomUUID?crypto.randomUUID():be(t)}function be(t,e,a){t=t||{};const l=t.random??t.rng?.()??Ee();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,me(l)}var q=(function(){var t=h(function(L,s,i,o){for(i=i||{},o=L.length;o--;i[L[o]]=s);return i},"o"),e=[1,4],a=[1,13],l=[1,12],n=[1,15],d=[1,16],f=[1,20],y=[1,19],E=[6,7,8],b=[1,26],v=[1,24],R=[1,25],g=[6,7,11],A=[1,6,13,15,16,19,22],J=[1,33],K=[1,34],$=[1,6,7,11,13,15,16,19,22],H={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:h(function(s,i,o,c,p,r,B){var u=r.length-1;switch(p){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[u].id),c.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:c.getLogger().trace("Icon: ",r[u]),c.decorateNode({icon:r[u]});break;case 17:case 21:c.decorateNode({class:r[u]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[u].id),c.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:c.decorateNode({icon:r[u]});break;case 25:c.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:c.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:c.getType(r[u-2],r[u])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:a,7:[1,10],9:9,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:a,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},{6:a,9:22,12:11,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},{6:b,7:v,10:23,11:R},t(g,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:f,22:y}),t(g,[2,18]),t(g,[2,19]),t(g,[2,20]),t(g,[2,21]),t(g,[2,23]),t(g,[2,24]),t(g,[2,26],{19:[1,30]}),{20:[1,31]},{6:b,7:v,10:32,11:R},{1:[2,7],6:a,12:21,13:l,14:14,15:n,16:d,17:17,18:18,19:f,22:y},t(A,[2,14],{7:J,11:K}),t($,[2,8]),t($,[2,9]),t($,[2,10]),t(g,[2,15]),t(g,[2,16]),t(g,[2,17]),{20:[1,35]},{21:[1,36]},t(A,[2,13],{7:J,11:K}),t($,[2,11]),t($,[2,12]),{21:[1,37]},t(g,[2,25]),t(g,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:h(function(s,i){if(i.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=i,o}},"parseError"),parse:h(function(s){var i=this,o=[0],c=[],p=[null],r=[],B=this.table,u="",U=0,Q=0,ie=2,Z=1,se=r.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var W in this.yy)Object.prototype.hasOwnProperty.call(this.yy,W)&&(T.yy[W]=this.yy[W]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var z=m.yylloc;r.push(z);var re=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function oe(S){o.length=o.length-2*S,p.length=p.length-S,r.length=r.length-S}h(oe,"popStack");function ee(){var S;return S=c.pop()||m.lex()||Z,typeof S!="number"&&(S instanceof Array&&(c=S,S=c.pop()),S=i.symbols_[S]||S),S}h(ee,"lex");for(var k,O,x,X,C={},V,N,te,F;;){if(O=o[o.length-1],this.defaultActions[O]?x=this.defaultActions[O]:((k===null||typeof k>"u")&&(k=ee()),x=B[O]&&B[O][k]),typeof x>"u"||!x.length||!x[0]){var Y="";F=[];for(V in B[O])this.terminals_[V]&&V>ie&&F.push("'"+this.terminals_[V]+"'");m.showPosition?Y="Parse error on line "+(U+1)+`:
|
|
2
2
|
`+m.showPosition()+`
|
|
3
3
|
Expecting `+F.join(", ")+", got '"+(this.terminals_[k]||k)+"'":Y="Parse error on line "+(U+1)+": Unexpected "+(k==Z?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(Y,{text:m.match,token:this.terminals_[k]||k,line:m.yylineno,loc:z,expected:F})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+k);switch(x[0]){case 1:o.push(k),p.push(m.yytext),r.push(m.yylloc),o.push(x[1]),k=null,Q=m.yyleng,u=m.yytext,U=m.yylineno,z=m.yylloc;break;case 2:if(N=this.productions_[x[1]][1],C.$=p[p.length-N],C._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},re&&(C._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),X=this.performAction.apply(C,[u,Q,U,T.yy,x[1],p,r].concat(se)),typeof X<"u")return X;N&&(o=o.slice(0,-1*N*2),p=p.slice(0,-1*N),r=r.slice(0,-1*N)),o.push(this.productions_[x[1]][0]),p.push(C.$),r.push(C._$),te=B[o[o.length-2]][o[o.length-1]],o.push(te);break;case 3:return!0}}return!0},"parse")},ne=(function(){var L={EOF:1,parseError:h(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:h(function(s,i){return this.yy=i||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var i=s.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:h(function(s){var i=s.length,o=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===c.length?this.yylloc.first_column:0)+c[c.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:h(function(s){this.unput(this.match.slice(s))},"less"),pastInput:h(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var s=this.pastInput(),i=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,y as b,z as i,D as h,j as t,X as y,l as u}from"./index-
|
|
1
|
+
import{r as a,y as b,z as i,D as h,j as t,X as y,l as u}from"./index-oC5eh7mZ.js";const p=({isOpen:r,onClose:l,title:f,children:d,action:n,className:x})=>{const[m,o]=a.useState(!1),c=a.useRef(null),s=a.useRef(!1);return a.useEffect(()=>{if(r){const e=setTimeout(()=>o(!0),0);return s.current||(b(),s.current=!0),()=>clearTimeout(e)}else{const e=setTimeout(()=>o(!1),200);return s.current&&(i(),s.current=!1),()=>clearTimeout(e)}},[r]),a.useEffect(()=>()=>{s.current&&(i(),s.current=!1)},[]),a.useEffect(()=>{if(!r)return;const e=c.current;!e||e.contains(document.activeElement)||e.focus()},[r]),!m&&!r?null:h.createPortal(t.jsxs("div",{className:u("fixed inset-0 z-[60] flex items-center justify-center p-4 transition-opacity duration-200",r?"opacity-100":"opacity-0"),onKeyDown:e=>{e.key==="Escape"&&(e.stopPropagation(),l())},children:[t.jsx("div",{className:"absolute inset-0 bg-white/80 backdrop-blur-sm",onClick:l}),t.jsxs("div",{ref:c,tabIndex:-1,className:u("relative flex max-h-[calc(100vh-2rem)] w-full max-w-lg flex-col overflow-hidden bg-white rounded-xl shadow-2xl shadow-neutral-200/50 border border-neutral-100 transform transition-all duration-200 outline-none",r?"scale-100 translate-y-0":"scale-95 translate-y-2",x),children:[t.jsxs("div",{className:"flex shrink-0 items-center justify-between px-6 py-4 border-b border-neutral-50",children:[t.jsx("h3",{className:"font-semibold text-neutral-900",children:f}),t.jsx("button",{onClick:l,className:"text-neutral-400 hover:text-neutral-900 transition-colors",children:t.jsx(y,{size:18})})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-6",children:d}),n?t.jsx("div",{className:"shrink-0 px-6 py-4 bg-neutral-50 rounded-b-xl border-t border-neutral-100 flex justify-end gap-3",children:n}):null]})]}),document.body)};export{p as M};
|