@qwen-code/qwen-code 0.25.2-preview.1 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/{MaxSizedBox-CF4NN4Y7.js → MaxSizedBox-CGJP7S5S.js} +1 -1
- package/chunks/{StandaloneSessionPicker-Q23KTB6U.js → StandaloneSessionPicker-H6NONKPP.js} +1 -1
- package/chunks/{acp-subagent-executor-LXOLDTFY.js → acp-subagent-executor-7OCKCTA5.js} +1 -1
- package/chunks/{acpAgent-QRKZVQAG.js → acpAgent-VCKTBLFO.js} +3 -3
- package/chunks/{advisor-VZZJU7BR.js → advisor-UQJ45FLG.js} +1 -1
- package/chunks/{agent-LP66VBC4.js → agent-KMSCVRSG.js} +1 -1
- package/chunks/{agent-headless-W5P4KPX4.js → agent-headless-3FWQ5QNO.js} +1 -1
- package/chunks/{agent-host-client-OW4HBXRL.js → agent-host-client-PXIIFCCS.js} +1 -1
- package/chunks/{agent-host-connections-D7IC6WWL.js → agent-host-connections-QUYGQNJX.js} +1 -1
- package/chunks/{anthropicContentGenerator-6I25Q3Y6.js → anthropicContentGenerator-MDETV5LU.js} +1 -1
- package/chunks/{batch-7E5KJ625.js → batch-RQO2HWFV.js} +1 -1
- package/chunks/{bridge-BITC2AVN.js → bridge-OA3GEU2I.js} +1 -1
- package/chunks/{channel-settings-store-VAVG6ONF.js → channel-settings-store-YN23NP2H.js} +1 -1
- package/chunks/{chunk-4NCTKE4Z.js → chunk-2PQ5ZRTI.js} +1 -1
- package/chunks/{chunk-OJHTHXBC.js → chunk-32UFT5HU.js} +1 -1
- package/chunks/{chunk-2HJZ3OYW.js → chunk-3C34EMBZ.js} +1 -1
- package/chunks/{chunk-UXFLNZNB.js → chunk-3FPPMGVC.js} +1 -1
- package/chunks/{chunk-74YXI5IJ.js → chunk-445NIH5T.js} +1 -1
- package/chunks/{chunk-MXXYBMBZ.js → chunk-45EKBDFD.js} +1 -1
- package/chunks/{chunk-JV5FCFG4.js → chunk-4WFWZWR3.js} +1 -1
- package/chunks/{chunk-AAOAX46J.js → chunk-56NX3ASC.js} +1 -1
- package/chunks/{chunk-IBS4PHD2.js → chunk-5FY6TL3Z.js} +1 -1
- package/chunks/{chunk-UGI3XPRM.js → chunk-5GJPVNHI.js} +1 -1
- package/chunks/{chunk-7BZGY7AH.js → chunk-5XAVUYY6.js} +6 -6
- package/chunks/{chunk-V3WNU4F5.js → chunk-655XEN5H.js} +1 -1
- package/chunks/{chunk-APX7ODYT.js → chunk-6PHAGUA6.js} +1 -1
- package/chunks/{chunk-CD6C4OHZ.js → chunk-7YX6LW5H.js} +1 -1
- package/chunks/{chunk-C2NFZSGI.js → chunk-AAVRYR5T.js} +1 -1
- package/chunks/{chunk-EO35BRIG.js → chunk-ANUAITTH.js} +1 -1
- package/chunks/{chunk-CNQ6AOFN.js → chunk-AZ5GFEKG.js} +1 -1
- package/chunks/{chunk-KAEW65QP.js → chunk-B5XDGUAK.js} +1 -1
- package/chunks/{chunk-X6QHNKUW.js → chunk-BCNBZOGV.js} +1 -1
- package/chunks/{chunk-W5DIWPQB.js → chunk-BDXWLZJD.js} +1 -1
- package/chunks/{chunk-ZASVUARY.js → chunk-BPX4A433.js} +1 -1
- package/chunks/{chunk-CDSI44GJ.js → chunk-BUI6W6CU.js} +1 -1
- package/chunks/{chunk-ZEYCGUHI.js → chunk-BVARURDD.js} +1 -1
- package/chunks/{chunk-PZ5UPKIG.js → chunk-BW5CHWEJ.js} +2 -2
- package/chunks/{chunk-7TUP75C2.js → chunk-C4DSH4A3.js} +1 -1
- package/chunks/{chunk-R4KMBENY.js → chunk-CCBWBPJL.js} +1 -1
- package/chunks/{chunk-TU6DWKVI.js → chunk-CKJ3OUIV.js} +2 -2
- package/chunks/{chunk-SG5P4CK4.js → chunk-CRZ7QRFB.js} +1 -1
- package/chunks/{chunk-UYFL7K4Z.js → chunk-CTEBIP2S.js} +1 -1
- package/chunks/{chunk-WSIDVWGO.js → chunk-DBOWUORN.js} +1 -1
- package/chunks/{chunk-NAHKSVYI.js → chunk-DPBXGGQX.js} +1 -1
- package/chunks/{chunk-BMOJDKDZ.js → chunk-DSSSLNXD.js} +3 -3
- package/chunks/{chunk-FP2RLPWJ.js → chunk-EKGFFEH4.js} +1 -1
- package/chunks/{chunk-L7W3J427.js → chunk-EMEQR2LX.js} +1 -1
- package/chunks/{chunk-YRYMLJAC.js → chunk-ENUYA7BO.js} +1 -1
- package/chunks/{chunk-4CWBH6LP.js → chunk-EORORGZC.js} +1 -1
- package/chunks/{chunk-RBH3BOVF.js → chunk-EUK64V6Z.js} +1 -1
- package/chunks/{chunk-AII4DN7M.js → chunk-FBV4LUUL.js} +1 -1
- package/chunks/{chunk-YVEPPENZ.js → chunk-FFLFTXO7.js} +1 -1
- package/chunks/{chunk-2HSFO66N.js → chunk-FHXH3GSI.js} +1 -1
- package/chunks/{chunk-RH6PMH32.js → chunk-FVBDVZD7.js} +1 -1
- package/chunks/{chunk-Y2HLDUZG.js → chunk-I2D2ZUKF.js} +1 -1
- package/chunks/{chunk-6PUZWUMQ.js → chunk-I3FZ733S.js} +1 -1
- package/chunks/{chunk-GG7RNHZW.js → chunk-IFAUFERF.js} +5 -5
- package/chunks/{chunk-JQ7BCB3L.js → chunk-IYFUH3JB.js} +1 -1
- package/chunks/{chunk-VAMQAYF3.js → chunk-JB5I5QAD.js} +1 -1
- package/chunks/{chunk-Z3UZTCKY.js → chunk-JD3QDS7D.js} +1 -1
- package/chunks/{chunk-TFVPY43T.js → chunk-JG2UNQOW.js} +1 -1
- package/chunks/{chunk-E4MRBL4O.js → chunk-JSXHTTFE.js} +1 -1
- package/chunks/{chunk-QTYA6TES.js → chunk-LJLS3MDJ.js} +1 -1
- package/chunks/{chunk-RZISIEQL.js → chunk-MEIW5WVJ.js} +1 -1
- package/chunks/{chunk-ZD4U3GR4.js → chunk-MGL36H3B.js} +1 -1
- package/chunks/{chunk-HXA3X4PB.js → chunk-MJUFVFH3.js} +1 -1
- package/chunks/{chunk-SYIDPXVT.js → chunk-MSR6LYHS.js} +1 -1
- package/chunks/{chunk-4MJ67O5W.js → chunk-MTXJRB7G.js} +2 -2
- package/chunks/{chunk-F5P3BWS7.js → chunk-MXFBSMIM.js} +1 -1
- package/chunks/{chunk-W6TNBCKX.js → chunk-MYHJ4WUH.js} +1 -1
- package/chunks/{chunk-CWU5NJOB.js → chunk-NHXKNS7F.js} +1 -1
- package/chunks/{chunk-6OIJIF6G.js → chunk-NT74NPQT.js} +1 -1
- package/chunks/{chunk-O47FCWNF.js → chunk-NWXW4UNC.js} +1 -1
- package/chunks/{chunk-JASL4RZR.js → chunk-O77LM4EW.js} +1 -1
- package/chunks/{chunk-ZDNTENP2.js → chunk-OB7T2MDO.js} +1 -1
- package/chunks/{chunk-L7WFW57T.js → chunk-PODFLAH7.js} +1 -1
- package/chunks/{chunk-R3ZMQ7WR.js → chunk-Q2G675WT.js} +1 -1
- package/chunks/{chunk-H3QROVUO.js → chunk-QT27SK62.js} +1 -1
- package/chunks/{chunk-UELAXFT7.js → chunk-QZPNBV4F.js} +1 -1
- package/chunks/{chunk-B3L4LODR.js → chunk-RV54BGL2.js} +1 -1
- package/chunks/{chunk-KLXL3FSI.js → chunk-SFETIBPP.js} +1 -1
- package/chunks/{chunk-F3YGAXZ5.js → chunk-SGKINIQB.js} +1 -1
- package/chunks/{chunk-MBPT3YYO.js → chunk-SHJNP7OV.js} +1 -1
- package/chunks/{chunk-U3YSYIQE.js → chunk-SPFRORFN.js} +1 -1
- package/chunks/{chunk-S3B4TZVJ.js → chunk-SPLINFM7.js} +1 -1
- package/chunks/{chunk-ORIS5AVH.js → chunk-SYO5FPHL.js} +1 -1
- package/chunks/{chunk-AGHGPOH6.js → chunk-TEE4MM5S.js} +1 -1
- package/chunks/{chunk-WHF3HYZI.js → chunk-TPZTO4K3.js} +1 -1
- package/chunks/{chunk-KJO757RN.js → chunk-UY2CSL5W.js} +1 -1
- package/chunks/{chunk-VCTZRPKP.js → chunk-W7QYXFWW.js} +1 -1
- package/chunks/{chunk-T3ECMT6I.js → chunk-WQOZJ6V7.js} +2 -2
- package/chunks/{chunk-INEI2ZW2.js → chunk-WZK7RC36.js} +1 -1
- package/chunks/{chunk-Y5JLH3SN.js → chunk-X22435IN.js} +4 -4
- package/chunks/{chunk-WHNAY3QQ.js → chunk-X2KF6AUQ.js} +1 -1
- package/chunks/{chunk-MUEIZGTI.js → chunk-YHPHQX6M.js} +1 -1
- package/chunks/{chunk-5OOO3YIH.js → chunk-YL7QMYOX.js} +1 -1
- package/chunks/{chunk-43E3XC2W.js → chunk-YQEOEO5V.js} +1 -1
- package/chunks/{chunk-624P32LD.js → chunk-YZ374XTK.js} +1 -1
- package/chunks/{codex-subagent-executor-2MPLWNLD.js → codex-subagent-executor-MC3QB2AN.js} +1 -1
- package/chunks/{config-utils-MJEEBLQW.js → config-utils-FYT7PUIC.js} +1 -1
- package/chunks/{contextCommand-BP566QVE.js → contextCommand-DXMSMSR7.js} +1 -1
- package/chunks/{core-runtime-BOAIFYAZ.js → core-runtime-ZLB6QZ3Z.js} +1 -1
- package/chunks/{create-sub-session-HJVK7AXV.js → create-sub-session-YUI3G5AF.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-KA2Y6FHL.js → daemon-git-worktree-guard-5PYZMC6T.js} +1 -1
- package/chunks/{daemon-status-provider-JGR5JT2T.js → daemon-status-provider-GC567FVE.js} +1 -1
- package/chunks/{daemon-trust-policy-EP4DHXOW.js → daemon-trust-policy-LLD2UMPF.js} +1 -1
- package/chunks/{daemon-trust-policy-monitor-W3VZRKOK.js → daemon-trust-policy-monitor-MRMB2CRJ.js} +1 -1
- package/chunks/{deferred-core-runtime-Q3JH7XDL.js → deferred-core-runtime-4HLTINJ6.js} +1 -1
- package/chunks/{edit-S7DCBMAL.js → edit-CZ6FEXDU.js} +1 -1
- package/chunks/{enterPlanMode-UX7B6KWX.js → enterPlanMode-O3CJ3I2J.js} +1 -1
- package/chunks/{environment-ZBW6HDG3.js → environment-OJWH4FYL.js} +1 -1
- package/chunks/{errors-7ZRLUHEB.js → errors-NWKSQVL3.js} +1 -1
- package/chunks/{execution-tool-R244Q3GW.js → execution-tool-7UCADALN.js} +1 -1
- package/chunks/{execution-worker-JR44JTC4.js → execution-worker-LWHQMPBV.js} +1 -1
- package/chunks/{exitPlanMode-2PTTZXGO.js → exitPlanMode-JDM6ZZWI.js} +1 -1
- package/chunks/{fast-path-NQQ42XUR.js → fast-path-4WHPMNMD.js} +1 -1
- package/chunks/{glob-4JP6RQNK.js → glob-LAU4YJ6J.js} +1 -1
- package/chunks/{goal-tools-MO7NIH7B.js → goal-tools-AF2FQO3H.js} +1 -1
- package/chunks/{handleAutoUpdate-STUVMCIU.js → handleAutoUpdate-WBWK4775.js} +1 -1
- package/chunks/{i18n-UTIILRKE.js → i18n-O4Q2KHOA.js} +1 -1
- package/chunks/{initializer-YI2WT6LZ.js → initializer-2AH3EKBL.js} +1 -1
- package/chunks/{installationInfo-PW2JHHJV.js → installationInfo-77WYXG4W.js} +1 -1
- package/chunks/{list-SAOL2OZI.js → list-RAU3ZJQS.js} +1 -1
- package/chunks/{llm-LMY62H6Z.js → llm-MJMQ34KB.js} +4 -4
- package/chunks/{llm-content-generator-6RPOZ2YR.js → llm-content-generator-MJPR2TWC.js} +1 -1
- package/chunks/{loadedSettingsAdapter-RNXWDDE2.js → loadedSettingsAdapter-WRWWNGHZ.js} +1 -1
- package/chunks/{local-execution-environment-GIWY2LO6.js → local-execution-environment-VVJ7OYBT.js} +1 -1
- package/chunks/{loggingContentGenerator-AOKEDXK6.js → loggingContentGenerator-722BJL7T.js} +1 -1
- package/chunks/{manage-memory-WKPWLYDD.js → manage-memory-GN56UQHG.js} +1 -1
- package/chunks/{managed-npm-update-LFFWFATA.js → managed-npm-update-5VE662JS.js} +1 -1
- package/chunks/{managed-runtime-attestation-worker-IV6ZNIAK.js → managed-runtime-attestation-worker-ASGGZMFM.js} +1 -1
- package/chunks/{managed-runtime-session-worker-3NU4FOXD.js → managed-runtime-session-worker-YUSO7WFB.js} +1 -1
- package/chunks/{mcp-RDDGN4JK.js → mcp-6D236MEH.js} +1 -1
- package/chunks/{model-call-collection-JARTJD6S.js → model-call-collection-UAE2W6VV.js} +1 -1
- package/chunks/{model-configuration-7H6PEOLY.js → model-configuration-VHPSBCQI.js} +1 -1
- package/chunks/{modelConfigUtils-Q63ZZTXY.js → modelConfigUtils-XKDXYQRJ.js} +1 -1
- package/chunks/{monitor-HLO366TQ.js → monitor-JIKXBXDK.js} +1 -1
- package/chunks/{nonInteractiveCli-JO5EG6OK.js → nonInteractiveCli-IXTK5V4Q.js} +1 -1
- package/chunks/{nonInteractiveToolExecutor-T7AKBX25.js → nonInteractiveToolExecutor-3MSROJV5.js} +1 -1
- package/chunks/{notebook-edit-XKULPMG7.js → notebook-edit-VDWBIBMG.js} +1 -1
- package/chunks/{omni-H3GFC6KR.js → omni-MEUE65XC.js} +1 -1
- package/chunks/{openaiContentGenerator-RT4S6OYR.js → openaiContentGenerator-KNZTYVNK.js} +1 -1
- package/chunks/{openaiResponsesContentGenerator-JD4ZBCAL.js → openaiResponsesContentGenerator-G7GRJXES.js} +1 -1
- package/chunks/{pidfile-JXCPPGC6.js → pidfile-HMEKKPWO.js} +1 -1
- package/chunks/{processUtils-FF7LHGHW.js → processUtils-KHWNT3KU.js} +1 -1
- package/chunks/{prompt-terminal-ledger-VLIEJ5BB.js → prompt-terminal-ledger-EY72RU3D.js} +1 -1
- package/chunks/{qwenContentGenerator-6SGQI4ES.js → qwenContentGenerator-A7WREYLV.js} +1 -1
- package/chunks/{reactive-degrade-2UJPX4AU.js → reactive-degrade-O6WBGQ5X.js} +1 -1
- package/chunks/{read-file-27DWTM5N.js → read-file-A4MQWC6T.js} +1 -1
- package/chunks/{resumeHistoryUtils-KRF2LD7T.js → resumeHistoryUtils-KNUVMH5J.js} +1 -1
- package/chunks/{review-IPFFTVGV.js → review-OC76PLQ4.js} +1 -1
- package/chunks/{ripGrep-75QL35XD.js → ripGrep-JR6DHTIW.js} +1 -1
- package/chunks/{run-qwen-serve-WW74NSUL.js → run-qwen-serve-NFPGPJJ2.js} +2 -2
- package/chunks/{runtime-Z2NIOF6Y.js → runtime-BPHFAZOP.js} +1 -1
- package/chunks/{sandboxConfig-WMQAKX7Q.js → sandboxConfig-KXTV3QBG.js} +1 -1
- package/chunks/{scheduled-tasks-LMJJ5ZM7.js → scheduled-tasks-2GNFZH4N.js} +1 -1
- package/chunks/{scheduler-KHWWXW6H.js → scheduler-CKLZCETX.js} +1 -1
- package/chunks/{search-memory-WEO3M674.js → search-memory-ICNU2EJA.js} +1 -1
- package/chunks/{send-message-E2EVXDU4.js → send-message-T32PFXX5.js} +1 -1
- package/chunks/{serve-E7ZGE7PD.js → serve-O7XBFM36.js} +1 -1
- package/chunks/{server-SSHP5IO4.js → server-7H2EGX7C.js} +3 -3
- package/chunks/{session-UWUQU3NV.js → session-SO4TKKO3.js} +1 -1
- package/chunks/{session-attachments-root-I35OUD7P.js → session-attachments-root-QPBJB3Y2.js} +1 -1
- package/chunks/{session-execution-engine-selector-S7HXLYKG.js → session-execution-engine-selector-73JQ7AG6.js} +1 -1
- package/chunks/{session-pr-refresh-34FLQB2Z.js → session-pr-refresh-XPDBRBQV.js} +1 -1
- package/chunks/{sessionService-BBC2563F.js → sessionService-DDLWVLNC.js} +1 -1
- package/chunks/{settings-BXCTAYMU.js → settings-TUEKBNAX.js} +1 -1
- package/chunks/{shell-ORZNRZKX.js → shell-SXSN7UYK.js} +1 -1
- package/chunks/{skill-3MJ6V2VQ.js → skill-XAYT7HGV.js} +1 -1
- package/chunks/{skill-settings-A7TTYJGH.js → skill-settings-X3O75XUN.js} +1 -1
- package/chunks/{spawnChannel-UPHPUPIJ.js → spawnChannel-3523LPUW.js} +1 -1
- package/chunks/{standalone-update-GGHQ54QB.js → standalone-update-T7AUODLV.js} +1 -1
- package/chunks/{start-opentui-ui-O6WMWLGS.js → start-opentui-ui-IKBADQQS.js} +1 -1
- package/chunks/{startInteractiveUI-N3ZPR2FK.js → startInteractiveUI-PV2JETB4.js} +1 -1
- package/chunks/{team-create-EYLFAQVU.js → team-create-ZKTBFE7Z.js} +1 -1
- package/chunks/{team-plan-approval-2WFSX4XE.js → team-plan-approval-SCTAN2HM.js} +1 -1
- package/chunks/{terminal-image-renderer-A5HEJZTW.js → terminal-image-renderer-EDBYTK3B.js} +1 -1
- package/chunks/{theme-manager-TQHNJSKQ.js → theme-manager-ZLXHLO2Y.js} +1 -1
- package/chunks/{tool-call-UBLAA45C.js → tool-call-ULUE3W3P.js} +1 -1
- package/chunks/{tool-result-media-53AD3EHK.js → tool-result-media-VXS7QTX7.js} +1 -1
- package/chunks/{tool-search-D6PSBDDZ.js → tool-search-VWM6VCVU.js} +1 -1
- package/chunks/{total-session-admission-CUMMWSM2.js → total-session-admission-FZDBG232.js} +1 -1
- package/chunks/{trustedFolders-TERXKVJ6.js → trustedFolders-VIPEDZNB.js} +1 -1
- package/chunks/{update-relaunch-PXCI66U2.js → update-relaunch-N6TNUHQE.js} +1 -1
- package/chunks/{updateCheck-2P4ANPL7.js → updateCheck-367IR3FW.js} +1 -1
- package/chunks/{upload-config-G2WZG4DM.js → upload-config-5W4WTLML.js} +1 -1
- package/chunks/{useAutoAcceptIndicator-H7I7JP34.js → useAutoAcceptIndicator-SGT7EBCJ.js} +1 -1
- package/chunks/{validateNonInterActiveAuth-VLRV5LCK.js → validateNonInterActiveAuth-7WEBPZ4S.js} +1 -1
- package/chunks/{version-AOKDKXXZ.js → version-3OKRQ6LC.js} +1 -1
- package/chunks/{web-fetch-OUJS56AV.js → web-fetch-BV7BK5NT.js} +1 -1
- package/chunks/{web-search-3S4ZIGLP.js → web-search-DFQ74G7V.js} +1 -1
- package/chunks/{workflow-6W4WB4L5.js → workflow-EXSCHLQK.js} +1 -1
- package/chunks/{workspace-agents-7GB2RLY5.js → workspace-agents-HPOPFXKJ.js} +1 -1
- package/chunks/{workspace-providers-status-OMD57CUW.js → workspace-providers-status-UQCSR2PB.js} +1 -1
- package/chunks/{workspace-registration-store-WKLFVMQ2.js → workspace-registration-store-Q5U4WD5M.js} +1 -1
- package/chunks/{workspace-registry-6WJOPYIS.js → workspace-registry-I2O2LXTZ.js} +1 -1
- package/chunks/{workspace-runtime-coordinator-XG7G7DG3.js → workspace-runtime-coordinator-MVVDZYYX.js} +1 -1
- package/chunks/{workspace-service-YLX46RJM.js → workspace-service-CFJ2EUB7.js} +1 -1
- package/chunks/{workspace-skills-status-JZZR7QHN.js → workspace-skills-status-LLNIK3NS.js} +1 -1
- package/chunks/{workspace-trust-reconciler-AO3I5KYO.js → workspace-trust-reconciler-VLGJXLCZ.js} +1 -1
- package/chunks/{write-file-MGYLC32T.js → write-file-RG7HHIYP.js} +1 -1
- package/chunks/{zoom-image-TZ527ASZ.js → zoom-image-AKW6CA4K.js} +1 -1
- package/cli.js +2 -2
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +3 -3
- package/web-shell/assets/{PierreFilePreview-Cq9imG0c.js → PierreFilePreview-Cij36lF-.js} +1 -1
- package/web-shell/assets/{SpreadsheetPreview-Blho0kkO.js → SpreadsheetPreview-kDlHrK21.js} +1 -1
- package/web-shell/assets/{WorkspaceFileBrowser-DjeX-ArR.js → WorkspaceFileBrowser-DBXW9l-s.js} +1 -1
- package/web-shell/assets/{abnfDiagram-VCTEODGH-mEfLgGao.js → abnfDiagram-VCTEODGH-DBrfOx4O.js} +1 -1
- package/web-shell/assets/{agents-route-Bg4_tLdL.js → agents-route-6E_3XRjk.js} +1 -1
- package/web-shell/assets/{arc-DEVpMJqB.js → arc-RwrvKU6y.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-CGhqKvd1.js → architectureDiagram-5GKGNRK7-B2_hfNn6.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-DxpWdCdl.js → blockDiagram-NRAW4CY4-C755qTFO.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-CE1W0_yu.js → c4Diagram-UCG6FXSJ-CARC2uHQ.js} +1 -1
- package/web-shell/assets/channel-U9JRrjem.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-ibHTXjoH.js → chunk-2Q5K7J3B-BS1ldEp9.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-BEZ2-gCE.js → chunk-5VM5RSS4-DckOEd3N.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CKyPZ7Jh.js → chunk-F27PBJKO-fZstOLLL.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-WHNRb7iQ.js → chunk-G27WJ6UU-Bf4QkrJ7.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-Dm4G-fLP.js → chunk-JWPE2WC7-uBW51XO_.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-BvTm39E-.js → chunk-LCL6LL3I-D2MYZdE_.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-C0zAbzIo.js → chunk-POPQ4Y6H-CzTHTST7.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-B36K-VPq.js → chunk-SVP7TREG-fL48tjL5.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-D1opdtZ1.js → chunk-XXDRQBXY-R1jjDz-e.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-r255RW6f.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-r255RW6f.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-S_IO4ZW5.js → cose-bilkent-JH36ORCC-DTK6Alrt.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-CGUKfurr.js → cynefin-OW5HDTMX-C1JYDjN4.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BqUpO_VD.js → cynefinDiagram-5FMLGOSQ-C3bR18IM.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-CiKqZpUi.js → dagre-3AP2YEHR-D4oUlW7g.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-B3CQED4o.js → diagram-S7CK7UJ4-m-a-vk_2.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-BewunX5H.js → diagram-UQ7AKVKN-CVGSVvpJ.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-C5j1hiVn.js → diagram-VSXAHHWV-DcLovKfd.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-CWDIIA61.js → diagram-VX7I27RA-DAwY09qQ.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-COa1V8UD.js → diagram-Z3DM3KII-D4BWV8Yb.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-CP33EIO8.js → ebnfDiagram-PWID7BFC-AhqQLlAR.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-V2pL2JAp.js → erDiagram-SSCWMZ5O-DcIpsPuK.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CF-YQlR_.js → flowDiagram-A5DVABFB-Cdu3v56D.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-TXUid-Q2.js → ganttDiagram-EL5Y4UJY-D8o98Muo.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-QNcIYsgn.js → gitGraphDiagram-WWUBYQGX-fIAd56jC.js} +1 -1
- package/web-shell/assets/{index-CKa6aZMZ.js → index-CJmvuO8Q.js} +1 -1
- package/web-shell/assets/{index-N9F4X44H.js → index-DSh5Yfsf.js} +5 -5
- package/web-shell/assets/{infoDiagram-RXCK75RN-Dn1biwuc.js → infoDiagram-RXCK75RN-dPnP0Koe.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-iBYO7WCt.js → ishikawaDiagram-5VMMS53U-f9Oq8YH7.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-D98LzO4k.js → journeyDiagram-EYS64GPL-CqwSlUQ1.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-lQMIgDSM.js → kanban-definition-3QL26DDD-Bh_KTp2S.js} +1 -1
- package/web-shell/assets/{layout-BgOy6tFo.js → layout-0e-hGnuM.js} +1 -1
- package/web-shell/assets/{linear-En8RXsBs.js → linear-BtxWFISv.js} +1 -1
- package/web-shell/assets/{mermaid.core-BneKXyZr.js → mermaid.core-Dik4l-jM.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-NkP_9BC4.js → mindmap-definition-FBJOCRG2-B7gext3e.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-B0ie-nkt.js → pegDiagram-XKGWAZYB-BfyKzGY0.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-Qa86cFZc.js → pieDiagram-E7YTZNPT-vfeVyHgh.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CkjUzR0e.js → quadrantDiagram-AXDQQJYC-DGAZmngq.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-mN7KpgJG.js → railroadDiagram-O6MQD6OU-Dgxiy8W5.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Bmn2z6x2.js → requirementDiagram-EFPCY7ZU-D7TFokdR.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CYWnwpoW.js → sankeyDiagram-P5KCCOFB-BZU_UYd-.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BFyWlR1P.js → sequenceDiagram-WJ2MYXX4-Bz94qtvq.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BwCPrn2w.js → sizeCapture-X5ZJPWSS-DVlzIShY.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-oqL3E0Ws.js → stateDiagram-HBIQ2CUA-CE9Il33j.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BVL1rIGD.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-C3FAVL8g.js → swimlanes-XN3QIQJK-Cr2CyF9L.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BeWJAUmf.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-BdwxFsPJ.js → timeline-definition-24CTP7MA-DWbRlUDe.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-j_G2AbSj.js → vennDiagram-4TSXK5OY-Bp5BiaRL.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-Dy_fHHBq.js → wardleyDiagram-VM6X3IG4-DoQIUrT8.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-CnLgG50x.js → xychartDiagram-S5SC5T6Z-BTO308Vv.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-CHCXOu89.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DXIqcod_.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DXIqcod_.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Cmho6gw2.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D9Sfkn7b.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-LfdN0zeE.js","assets/html-C2L_23MC.js","assets/javascript-ySlJ1b_l.js","assets/css-BPhBrDlE.js","assets/angular-ts-CKsD7JZE.js","assets/scss-C31hgJw-.js","assets/apl-BBq3IX1j.js","assets/xml-e3z08dGr.js","assets/java-xI-RfyKK.js","assets/json-BQoSv7ci.js","assets/astro-CqkE3fuf.js","assets/typescript-Dj6nwHGl.js","assets/postcss-B3ZDOciz.js","assets/blade-a8OxSdnT.js","assets/sql-COK4E0Yg.js","assets/bsl-Dgyn0ogV.js","assets/sdbl-BLhTXw86.js","assets/cairo--RitsXJZ.js","assets/python-DhUJRlN_.js","assets/cobol-PTqiYgYu.js","assets/coffee-dyiR41kL.js","assets/cpp-BksuvNSY.js","assets/regexp-DWJ3fJO_.js","assets/glsl-DBO2IWDn.js","assets/c-C3t2pwGQ.js","assets/crystal-DtDmRg-F.js","assets/shellscript-atvbtKCR.js","assets/edge-D5gP-w-T.js","assets/html-derivative-CSfWNPLT.js","assets/elixir-CLiX3zqd.js","assets/elm-CmHSxxaM.js","assets/erb-BYTLMnw6.js","assets/ruby-DeZ3UC14.js","assets/haml-B2EZWmdv.js","assets/graphql-cDcHW_If.js","assets/jsx-BAng5TT0.js","assets/tsx-B6W0miNI.js","assets/lua-CvWAzNxB.js","assets/yaml-CVw76BM1.js","assets/fortran-fixed-form-TqA4NnZg.js","assets/fortran-free-form-DKXYxT9g.js","assets/fsharp-XplgxFYe.js","assets/markdown-UIAJJxZW.js","assets/gdresource-BHYsBjWJ.js","assets/gdshader-SKMF96pI.js","assets/gdscript-DfxzS6Rs.js","assets/git-commit-i4q6IMui.js","assets/diff-BgYniUM_.js","assets/git-rebase-B-v9cOL2.js","assets/glimmer-js-D-cwc0-E.js","assets/glimmer-ts-pgjy16dm.js","assets/hack-D1yCygmZ.js","assets/handlebars-BQGss363.js","assets/http-FRrOvY1W.js","assets/hxml-TIA70rKU.js","assets/haxe-C5wWYbrZ.js","assets/imba-bv_oIlVt.js","assets/jinja-DGy0s7-h.js","assets/jison-BqZprYcd.js","assets/julia-BBuGR-5E.js","assets/r-CwjWoCRV.js","assets/latex-C-cWTeAZ.js","assets/tex-rYs2v40G.js","assets/liquid-D3W5UaiH.js","assets/marko-z0MBrx5-.js","assets/less-BfCpw3nA.js","assets/mdc-DB_EDNY_.js","assets/nginx-D_VnBJ67.js","assets/nim-ZlGxZxc3.js","assets/perl-CHQXSrWU.js","assets/php-B5ebYQev.js","assets/pug-CM9l7STV.js","assets/qml-D8XfuvdV.js","assets/razor-CNLDkMZG.js","assets/csharp-D9R-vmeu.js","assets/rst-4NLicBqY.js","assets/cmake-DbXoA79R.js","assets/sas-BmTFh92c.js","assets/shaderlab-B7qAK45m.js","assets/hlsl-ifBTmRxC.js","assets/shellsession-C_rIy8kc.js","assets/soy-C-lX7w71.js","assets/sparql-bYkjHRlG.js","assets/turtle-BMR_PYu6.js","assets/stata-DorPZHa4.js","assets/svelte-MSaWC3Je.js","assets/templ-dwX3ZSMB.js","assets/go-B1SYOhNW.js","assets/ts-tags-CipyTH0X.js","assets/twig-NC5TFiHP.js","assets/vue-BuYVFjOK.js","assets/vue-html-xdeiXROB.js","assets/xsl-Dd0NUgwM.js","assets/agents-route-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-LfdN0zeE.js","assets/html-C2L_23MC.js","assets/javascript-ySlJ1b_l.js","assets/css-BPhBrDlE.js","assets/angular-ts-CKsD7JZE.js","assets/scss-C31hgJw-.js","assets/apl-BBq3IX1j.js","assets/xml-e3z08dGr.js","assets/java-xI-RfyKK.js","assets/json-BQoSv7ci.js","assets/astro-CqkE3fuf.js","assets/typescript-Dj6nwHGl.js","assets/postcss-B3ZDOciz.js","assets/blade-a8OxSdnT.js","assets/sql-COK4E0Yg.js","assets/bsl-Dgyn0ogV.js","assets/sdbl-BLhTXw86.js","assets/cairo--RitsXJZ.js","assets/python-DhUJRlN_.js","assets/cobol-PTqiYgYu.js","assets/coffee-dyiR41kL.js","assets/cpp-BksuvNSY.js","assets/regexp-DWJ3fJO_.js","assets/glsl-DBO2IWDn.js","assets/c-C3t2pwGQ.js","assets/crystal-DtDmRg-F.js","assets/shellscript-atvbtKCR.js","assets/edge-D5gP-w-T.js","assets/html-derivative-CSfWNPLT.js","assets/elixir-CLiX3zqd.js","assets/elm-CmHSxxaM.js","assets/erb-BYTLMnw6.js","assets/ruby-DeZ3UC14.js","assets/haml-B2EZWmdv.js","assets/graphql-cDcHW_If.js","assets/jsx-BAng5TT0.js","assets/tsx-B6W0miNI.js","assets/lua-CvWAzNxB.js","assets/yaml-CVw76BM1.js","assets/fortran-fixed-form-TqA4NnZg.js","assets/fortran-free-form-DKXYxT9g.js","assets/fsharp-XplgxFYe.js","assets/markdown-UIAJJxZW.js","assets/gdresource-BHYsBjWJ.js","assets/gdshader-SKMF96pI.js","assets/gdscript-DfxzS6Rs.js","assets/git-commit-i4q6IMui.js","assets/diff-BgYniUM_.js","assets/git-rebase-B-v9cOL2.js","assets/glimmer-js-D-cwc0-E.js","assets/glimmer-ts-pgjy16dm.js","assets/hack-D1yCygmZ.js","assets/handlebars-BQGss363.js","assets/http-FRrOvY1W.js","assets/hxml-TIA70rKU.js","assets/haxe-C5wWYbrZ.js","assets/imba-bv_oIlVt.js","assets/jinja-DGy0s7-h.js","assets/jison-BqZprYcd.js","assets/julia-BBuGR-5E.js","assets/r-CwjWoCRV.js","assets/latex-C-cWTeAZ.js","assets/tex-rYs2v40G.js","assets/liquid-D3W5UaiH.js","assets/marko-z0MBrx5-.js","assets/less-BfCpw3nA.js","assets/mdc-DB_EDNY_.js","assets/nginx-D_VnBJ67.js","assets/nim-ZlGxZxc3.js","assets/perl-CHQXSrWU.js","assets/php-B5ebYQev.js","assets/pug-CM9l7STV.js","assets/qml-D8XfuvdV.js","assets/razor-CNLDkMZG.js","assets/csharp-D9R-vmeu.js","assets/rst-4NLicBqY.js","assets/cmake-DbXoA79R.js","assets/sas-BmTFh92c.js","assets/shaderlab-B7qAK45m.js","assets/hlsl-ifBTmRxC.js","assets/shellsession-C_rIy8kc.js","assets/soy-C-lX7w71.js","assets/sparql-bYkjHRlG.js","assets/turtle-BMR_PYu6.js","assets/stata-DorPZHa4.js","assets/svelte-MSaWC3Je.js","assets/templ-dwX3ZSMB.js","assets/go-B1SYOhNW.js","assets/ts-tags-CipyTH0X.js","assets/twig-NC5TFiHP.js","assets/vue-BuYVFjOK.js","assets/vue-html-xdeiXROB.js","assets/xsl-Dd0NUgwM.js","assets/agents-route-6E_3XRjk.js","assets/agents-route-B7Dp-NvE.css","assets/WorkspaceFileBrowser-DBXW9l-s.js","assets/WorkspaceFileBrowser-Bgjjk7jz.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var hVe=Object.defineProperty;var zue=e=>{throw TypeError(e)};var fVe=(e,t,n)=>t in e?hVe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ot=(e,t,n)=>fVe(e,typeof t!="symbol"?t+"":t,n),que=(e,t,n)=>t.has(e)||zue("Cannot "+n);var Ti=(e,t,n)=>(que(e,t,"read from private field"),n?n.call(e):t.get(e)),pv=(e,t,n)=>t.has(e)?zue("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),kc=(e,t,n,s)=>(que(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);var Hue=(e,t,n,s)=>({set _(r){kc(e,t,r,n)},get _(){return Ti(e,t,s)}});function pVe(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(s,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var f3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ZN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var XSe={exports:{}},w$={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -1281,7 +1281,7 @@ ${n}`:n}function Qhe(e){const t=e.data.indexOf(","),n=e.data.startsWith("data:")
|
|
|
1281
1281
|
</head><body><iframe title="${LA(t)}" src="${LA(e.href)}" sandbox="allow-scripts allow-same-origin allow-forms" referrerpolicy="no-referrer"></iframe></body></html>`}function Cse(e,t){const n=j5(t);if(Tse.has(n))return"Audio";switch(n){case".htm":case".html":return"HTML";case".md":case".markdown":case".mdx":return"Markdown";case".pdf":return"PDF";case".avif":case".bmp":case".gif":case".ico":case".jpeg":case".jpg":case".png":case".svg":case".webp":return"Image";case".mov":case".mp4":case".webm":return"Video";case".doc":case".docx":case".docm":case".dotx":case".odt":return"Word";case".xls":case".xlsx":case".xlsm":case".xlsb":case".ods":return"Excel";case".ppt":case".pptx":case".pptm":case".odp":return"PowerPoint";case".csv":return"CSV"}switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";case"document":return"Document";default:return e||"artifact"}}const bvt=new Set([".doc",".docx",".docm",".dotx",".xls",".xlsx",".xlsm",".xlsb",".ppt",".pptx",".pptm",".odt",".ods",".odp"]),Tse=new Set([".m4a",".mp3",".ogg",".wav"]),xvt=new Set([...bvt,...Tse,".pdf",".mp4",".mov",".webm"]);function E5(e,t){const n=j5(e);return n?n===".xlsx":yw(t)==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}function qNe(e){if(E5(e.workspacePath,e.mimeType))return!1;const t=j5(e.workspacePath),n=yw(e.mimeType);return t===".svg"||n==="image/svg+xml"||xvt.has(t)?!0:UNe(e)||t===".md"||t===".markdown"||t===".html"||t===".htm"||n==="text/markdown"||n==="text/html"?!1:e.kind==="image"||e.kind==="document"||e.kind==="pdf"||e.kind==="video"||e.kind==="audio"}function j5(e){const n=(e??"").split(/[?#]/,1)[0].split(/[/\\]/).pop()??"",s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function kvt(e,t){return Tse.has(j5(e))||yw(t).startsWith("audio/")}const _vt="qwen.workspace.sha256";function lme(e){const t=e.metadata?.[_vt],n=typeof t=="string"?t:"";return`${e.status}:${e.updatedAt}:${n}`}function Svt(e){const t=e.metadata?.artifactType;return typeof t=="string"&&t?t:Cse(e.kind,e.workspacePath??e.url??e.title)}function UB(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const HNe={avif:"image/avif",bmp:"image/bmp",gif:"image/gif",ico:"image/x-icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",webp:"image/webp"},Cvt=100*1024*1024,Tvt=256*1024;function yw(e){return e?.split(";",1)[0]?.trim().toLowerCase()??""}function UNe(e){const t=yw(e.mimeType);return t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(HNe).includes(t)?t:void 0:Jx(e.workspacePath??"")}function Jx(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?HNe[n]:void 0}function Ivt(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function BR(e,t,n,s){const r=[],o=s.maxBytes??Cvt,i=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(i.type==="directory")throw new Error("Directories cannot be opened or downloaded as artifacts.");if(i.sizeBytes>o)throw new Error("File is too large to preview or download.");let l=0;for(;;){if(s.isCancelled?.())throw new Error("File loading was cancelled.");const c=await e(t,{offset:l,maxBytes:Tvt});if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(c.sizeBytes!==i.sizeBytes)throw new Error("File changed while loading. Please retry.");if(c.returnedBytes<=0&&l<i.sizeBytes)throw new Error("File loading made no progress.");const u=atob(c.contentBase64),h=new Uint8Array(u.length);for(let f=0;f<u.length;f++)h[f]=u.charCodeAt(f);if(r.push(h),l=c.offset+c.returnedBytes,l>=i.sizeBytes){const f=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(f.sizeBytes!==i.sizeBytes||f.modifiedMs!==i.modifiedMs)throw new Error("File changed while loading. Please retry.");return new Blob(r,{type:n})}}}async function WB(e,t,n="application/octet-stream",s){const r=await BR((i,l)=>e.readFileBytes(i,l),t,n,{statFile:i=>e.stat(i),isCancelled:s}),o=URL.createObjectURL(r);try{const i=document.createElement("a");i.href=o,i.download=WNe(t)??t,i.addEventListener("click",l=>l.stopPropagation()),document.body.appendChild(i),i.click(),i.remove()}finally{setTimeout(()=>URL.revokeObjectURL(o),1e3)}}function Rvt(e){return e.workspacePath??e.url??e.managedId??""}function A5(e){return WNe(e.workspacePath)||e.title||"Artifact"}function WNe(e){return e?.split("/").at(-1)||void 0}function eC(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),s=[];for(const o of t.split("/"))if(!(!o||o===".")){if(o===".."){s.length>0&&s.at(-1)!==".."?s.pop():n||s.push(o);continue}s.push(o)}const r=s.join("/");return n?`/${r}`:r}function Z3(e,t){const n=eC(e),s=eC(t);if(!s)return n;if(n===s)return n.split("/").pop()??n;const r=`${s}/`;return n.startsWith(r)?n.slice(r.length):n}function Ise(e,t,n){const s=Z3(e??"",n),r=Z3(t??"",n);return!!s&&s===r}const AX="default-src 'none'; base-uri 'none'; form-action 'none'; script-src 'unsafe-inline' data:; style-src 'unsafe-inline' data:; img-src data: blob:; font-src data:; media-src data:;";function VNe(e,t){return NX(MX(e),t)}function NX(e,t){return`<!doctype html><html><head>
|
|
1282
1282
|
<meta http-equiv="Content-Security-Policy" content="${AX} frame-src 'none';">
|
|
1283
1283
|
<style>html,body,iframe{width:100%;height:100%;margin:0;border:0;display:block;overflow:hidden}</style>
|
|
1284
|
-
</head><body><iframe title="${LA(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${LA(e)}"></iframe></body></html>`}let G8;async function Evt(e,t,n){if(G8?.content===e&&G8.title===t)return G8.document;const s=await jvt(e,t,n);return G8={content:e,title:t,document:s},s}async function jvt(e,t,n){if(typeof DOMParser>"u")return VNe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return NX(MX(s),t);const r=new AbortController,o=()=>r.abort();n.addEventListener("abort",o,{once:!0}),n.aborted&&r.abort();try{await Promise.all([["script#transcript-renderer","src","js","text/javascript"],['link#transcript-stylesheet[rel="stylesheet"]',"href","css","text/css"]].map(async([i,l,c,u])=>{const h=s.querySelector(i),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@qwen-code/qwen-code@0.25.2-preview.1/export-transcript-document.${c}`;if(f!==m||!/^sha384-[A-Za-z0-9+/]{64}$/.test(p))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const g=await fetch(f,{integrity:p,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!g.ok)throw new Error(`Could not load export renderer (${g.status}).`);const v=new Blob([await g.arrayBuffer()],{type:u}),b=await new Promise((w,y)=>{const x=new FileReader;x.onload=()=>w(x.result),x.onerror=()=>y(x.error),x.readAsDataURL(v)});h.setAttribute(l,b),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return NX(MX(s),t)}function MX(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${AX}"></head><body>${Avt(e)}</body></html>`;const t=typeof e=="string"?new DOMParser().parseFromString(e,"text/html"):e;t.querySelectorAll('noscript, meta[http-equiv="refresh" i], meta[http-equiv="Content-Security-Policy" i]').forEach(s=>s.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=AX,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function Avt(e){return e.replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?refresh["']?)[^>]*>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?Content-Security-Policy["']?)[^>]*>/gi,"")}const GNe={csv:cvt,file:uvt,html:dvt,image:hvt,link:fvt,md:pvt,pdf:mvt,spreadsheet:gvt,video:vvt,word:wvt},Nvt={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Mvt={audio:mse,document:$R,notebook:cgt},cme={avif:"image",bmp:"image",csv:"csv",doc:"word",docm:"word",docx:"word",dotx:"word",gif:"image",htm:"html",html:"html",ico:"image",jpeg:"image",jpg:"image",md:"md",markdown:"md",mdx:"md",mov:"video",mp4:"video",ods:"spreadsheet",odt:"word",pdf:"pdf",png:"image",svg:"image",webm:"video",webp:"image",xls:"spreadsheet",xlsb:"spreadsheet",xlsm:"spreadsheet",xlsx:"spreadsheet"};function KNe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=j5(t).slice(1);if(n&&cme[n])return cme[n];const s=yw(e.mimeType);return s==="application/pdf"?"pdf":s.startsWith("image/")?"image":s.startsWith("video/")?"video":s==="text/csv"?"csv":s.includes("spreadsheet")||s.includes("ms-excel")?"spreadsheet":s.includes("wordprocessingml")||s==="application/msword"?"word":s==="text/html"?"html":s==="text/markdown"?"md":Nvt[e.kind]??"file"}function YNe({artifact:e,className:t}){const{artifact:n}=Vd(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=KNe(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?kvt(o,e.mimeType)?"audio":e.kind:void 0,l=i?Mvt[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:GNe[r],"data-artifact-icon":r,alt:""})}const Pvt=[[new Set(["json","jsonl","geojson"]),jft],[new Set(["js","jsx","ts","tsx","mjs","cjs","css","html","htm","xml","svg","py","rb","go","rs","java","c","cc","cpp","h","hpp","sh","sql","yaml","yml","toml"]),mD],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),Tpt],[new Set(["csv","tsv","xls","xlsx","ods"]),Lpt],[new Set(["ppt","pptx","odp"]),Egt],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),rNe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),mse],[new Set(["mp4","mov","webm","avi","mkv"]),oNe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),$R]];function Lvt(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of Pvt)if(s.has(n))return r;return t?.startsWith("image/")?rNe:t?.startsWith("audio/")?mse:t?.startsWith("video/")?oNe:t?.startsWith("text/")?$R:iNe}function L0({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=Lvt(e,t),i=KNe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===iNe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:GNe[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const Dvt="_panel_19vsn_1",Ovt="_floating_19vsn_16",$vt="_section_19vsn_26",Bvt="_sectionHeader_19vsn_40",Fvt="_sectionHeaderRow_19vsn_59",zvt="_sectionAction_19vsn_70",qvt="_sectionContent_19vsn_111",Hvt="_row_19vsn_115",Uvt="_workspaceIcon_19vsn_158",Wvt="_rowActionIcon_19vsn_162",Vvt="_label_19vsn_168",Gvt="_branchName_19vsn_173",Kvt="_value_19vsn_181",Yvt="_tasks_19vsn_191",Xvt="_task_19vsn_191",Qvt="_taskIcon_19vsn_229",Zvt="_taskLabel_19vsn_240",Jvt="_agentName_19vsn_248",ewt="_taskName_19vsn_249",twt="_agentColor_19vsn_260",nwt="_agentTag_19vsn_269",swt="_taskStatus_19vsn_280",rwt="_statusRunning_19vsn_301",owt="_attachmentFiles_19vsn_311",iwt="_attachmentFile_19vsn_311",awt="_attachmentFileIcon_19vsn_344",lwt="_attachmentFileName_19vsn_348",cwt="_emptyDescription_19vsn_356",uwt="_sourceTitle_19vsn_363",Ir={panel:Dvt,floating:Ovt,section:$vt,sectionHeader:Bvt,sectionHeaderRow:Fvt,sectionAction:zvt,sectionContent:qvt,row:Hvt,workspaceIcon:Uvt,rowActionIcon:Wvt,label:Vvt,branchName:Gvt,value:Kvt,tasks:Yvt,task:Xvt,taskIcon:Qvt,taskLabel:Zvt,agentName:Jvt,taskName:ewt,agentColor:twt,agentTag:nwt,taskStatus:swt,statusRunning:rwt,attachmentFiles:owt,attachmentFile:iwt,attachmentFileIcon:awt,attachmentFileName:lwt,emptyDescription:cwt,sourceTitle:uwt};function XNe({entries:e,onOpen:t}){const{t:n}=dt();return a.jsx("ul",{className:Ir.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:Ir.attachmentFile,title:ime(s),"aria-label":s.type==="source"?`${n("sources.open")} ${ome(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(uNe,{size:16,strokeWidth:1.7,className:Ir.attachmentFileIcon}):a.jsx(L0,{name:ime(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:Ir.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:Ir.attachmentFileName,children:ome(s)})]})},v7(s)))})}function Yv({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Zn("animate-pulse rounded-md bg-muted",e),...t})}function dwt(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function hwt({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:o,onOpen:i,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p}){const{t:m}=dt(),[g,v]=d.useState(!1),[b,w]=d.useState(!1);d.useEffect(()=>{e&&w(!1)},[e]),d.useEffect(()=>{w(!1),v(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(b&&t?.supported===!0),()=>c?.(!1)),[b,c,t?.supported]);const y=t?.supported?t.sources:[],x=FNe(y,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const _=s||t?.supported&&t.loading;return a.jsxs("section",{className:Ir.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:Ir.sectionHeaderRow,children:[a.jsxs("h3",{className:`${Ir.sectionHeader} ${Ir.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&dwt()&&a.jsx("button",{type:"button",className:Ir.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(bh,{})})]}),l&&a.jsxs("div",{className:Ir.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(Ze,{size:"sm",variant:"link",onClick:()=>void l(),children:m("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(Ze,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:m("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[m("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(Ze,{size:"sm",variant:"link",onClick:o,children:m("common.retry")})]}),a.jsx(XNe,{entries:g?x:x.slice(0,3),onOpen:S=>QNe(S,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),_&&!x.length&&a.jsx("ul",{className:Ir.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(S=>a.jsxs("li",{className:Ir.attachmentFile,children:[a.jsx(Yv,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(Yv,{className:"h-4",style:{width:`${S}%`}})]},S))}),!_&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:Ir.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:Ir.attachmentFile,"aria-expanded":g,onClick:()=>v(S=>!S),children:m(g?"common.collapse":"sources.viewAll")}),b&&t?.supported&&a.jsx(fwt,{state:t,onClose:()=>w(!1)})]})}function fwt({state:e,onClose:t}){const{t:n}=dt(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,p]=d.useState(),[m,g]=d.useState(!1),v=async()=>{g(!0),p(void 0);try{const b=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,w=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||b.trim().slice(0,200),locator:w,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(b){e.owner.isCurrent()&&p(b instanceof Error?b.message:String(b))}finally{e.owner.isCurrent()&&g(!1)}};return a.jsx(la,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:b=>{b.preventDefault(),v()},children:[a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.type"),a.jsxs("select",{className:"h-8 rounded-lg border border-input bg-background px-2",value:s,onChange:b=>{r(b.target.value),i(""),p(void 0)},children:[a.jsx("option",{value:"workspace_file",children:n("sources.workspaceFile")}),a.jsx("option",{value:"url",children:n("sources.link")})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.location"),a.jsx(Mr,{value:o,onChange:b=>i(b.target.value),required:!0,maxLength:s==="url"?2048:500,placeholder:s==="url"?"https://example.com":"docs/requirements.md"})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.name"),a.jsx(Mr,{value:l,maxLength:200,onChange:b=>c(b.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(Mr,{value:u,maxLength:1e3,onChange:b=>h(b.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(Ze,{type:"submit",disabled:m||!o,children:n("sources.add")})]})})}function QNe(e,t){if(e.type==="source"){t.onOpen?.(e.source);return}const n=e.attachment;if(n.type==="image"){t.onReadImage?.(n.attachmentId).then(s=>t.onImagePreview?.(s,n.attachmentId,{kind:"attachment",attachmentId:n.attachmentId})).catch(s=>t.onAttachmentPreviewError?.(s));return}t.onAttachmentPreview?.({name:n.attachmentId,mimeType:n.mimeType,attachmentId:n.attachmentId})}/**
|
|
1284
|
+
</head><body><iframe title="${LA(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${LA(e)}"></iframe></body></html>`}let G8;async function Evt(e,t,n){if(G8?.content===e&&G8.title===t)return G8.document;const s=await jvt(e,t,n);return G8={content:e,title:t,document:s},s}async function jvt(e,t,n){if(typeof DOMParser>"u")return VNe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return NX(MX(s),t);const r=new AbortController,o=()=>r.abort();n.addEventListener("abort",o,{once:!0}),n.aborted&&r.abort();try{await Promise.all([["script#transcript-renderer","src","js","text/javascript"],['link#transcript-stylesheet[rel="stylesheet"]',"href","css","text/css"]].map(async([i,l,c,u])=>{const h=s.querySelector(i),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@qwen-code/qwen-code@0.25.2/export-transcript-document.${c}`;if(f!==m||!/^sha384-[A-Za-z0-9+/]{64}$/.test(p))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const g=await fetch(f,{integrity:p,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!g.ok)throw new Error(`Could not load export renderer (${g.status}).`);const v=new Blob([await g.arrayBuffer()],{type:u}),b=await new Promise((w,y)=>{const x=new FileReader;x.onload=()=>w(x.result),x.onerror=()=>y(x.error),x.readAsDataURL(v)});h.setAttribute(l,b),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return NX(MX(s),t)}function MX(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${AX}"></head><body>${Avt(e)}</body></html>`;const t=typeof e=="string"?new DOMParser().parseFromString(e,"text/html"):e;t.querySelectorAll('noscript, meta[http-equiv="refresh" i], meta[http-equiv="Content-Security-Policy" i]').forEach(s=>s.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=AX,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function Avt(e){return e.replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?refresh["']?)[^>]*>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?Content-Security-Policy["']?)[^>]*>/gi,"")}const GNe={csv:cvt,file:uvt,html:dvt,image:hvt,link:fvt,md:pvt,pdf:mvt,spreadsheet:gvt,video:vvt,word:wvt},Nvt={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Mvt={audio:mse,document:$R,notebook:cgt},cme={avif:"image",bmp:"image",csv:"csv",doc:"word",docm:"word",docx:"word",dotx:"word",gif:"image",htm:"html",html:"html",ico:"image",jpeg:"image",jpg:"image",md:"md",markdown:"md",mdx:"md",mov:"video",mp4:"video",ods:"spreadsheet",odt:"word",pdf:"pdf",png:"image",svg:"image",webm:"video",webp:"image",xls:"spreadsheet",xlsb:"spreadsheet",xlsm:"spreadsheet",xlsx:"spreadsheet"};function KNe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=j5(t).slice(1);if(n&&cme[n])return cme[n];const s=yw(e.mimeType);return s==="application/pdf"?"pdf":s.startsWith("image/")?"image":s.startsWith("video/")?"video":s==="text/csv"?"csv":s.includes("spreadsheet")||s.includes("ms-excel")?"spreadsheet":s.includes("wordprocessingml")||s==="application/msword"?"word":s==="text/html"?"html":s==="text/markdown"?"md":Nvt[e.kind]??"file"}function YNe({artifact:e,className:t}){const{artifact:n}=Vd(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=KNe(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?kvt(o,e.mimeType)?"audio":e.kind:void 0,l=i?Mvt[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:GNe[r],"data-artifact-icon":r,alt:""})}const Pvt=[[new Set(["json","jsonl","geojson"]),jft],[new Set(["js","jsx","ts","tsx","mjs","cjs","css","html","htm","xml","svg","py","rb","go","rs","java","c","cc","cpp","h","hpp","sh","sql","yaml","yml","toml"]),mD],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),Tpt],[new Set(["csv","tsv","xls","xlsx","ods"]),Lpt],[new Set(["ppt","pptx","odp"]),Egt],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),rNe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),mse],[new Set(["mp4","mov","webm","avi","mkv"]),oNe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),$R]];function Lvt(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of Pvt)if(s.has(n))return r;return t?.startsWith("image/")?rNe:t?.startsWith("audio/")?mse:t?.startsWith("video/")?oNe:t?.startsWith("text/")?$R:iNe}function L0({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=Lvt(e,t),i=KNe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===iNe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:GNe[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const Dvt="_panel_19vsn_1",Ovt="_floating_19vsn_16",$vt="_section_19vsn_26",Bvt="_sectionHeader_19vsn_40",Fvt="_sectionHeaderRow_19vsn_59",zvt="_sectionAction_19vsn_70",qvt="_sectionContent_19vsn_111",Hvt="_row_19vsn_115",Uvt="_workspaceIcon_19vsn_158",Wvt="_rowActionIcon_19vsn_162",Vvt="_label_19vsn_168",Gvt="_branchName_19vsn_173",Kvt="_value_19vsn_181",Yvt="_tasks_19vsn_191",Xvt="_task_19vsn_191",Qvt="_taskIcon_19vsn_229",Zvt="_taskLabel_19vsn_240",Jvt="_agentName_19vsn_248",ewt="_taskName_19vsn_249",twt="_agentColor_19vsn_260",nwt="_agentTag_19vsn_269",swt="_taskStatus_19vsn_280",rwt="_statusRunning_19vsn_301",owt="_attachmentFiles_19vsn_311",iwt="_attachmentFile_19vsn_311",awt="_attachmentFileIcon_19vsn_344",lwt="_attachmentFileName_19vsn_348",cwt="_emptyDescription_19vsn_356",uwt="_sourceTitle_19vsn_363",Ir={panel:Dvt,floating:Ovt,section:$vt,sectionHeader:Bvt,sectionHeaderRow:Fvt,sectionAction:zvt,sectionContent:qvt,row:Hvt,workspaceIcon:Uvt,rowActionIcon:Wvt,label:Vvt,branchName:Gvt,value:Kvt,tasks:Yvt,task:Xvt,taskIcon:Qvt,taskLabel:Zvt,agentName:Jvt,taskName:ewt,agentColor:twt,agentTag:nwt,taskStatus:swt,statusRunning:rwt,attachmentFiles:owt,attachmentFile:iwt,attachmentFileIcon:awt,attachmentFileName:lwt,emptyDescription:cwt,sourceTitle:uwt};function XNe({entries:e,onOpen:t}){const{t:n}=dt();return a.jsx("ul",{className:Ir.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:Ir.attachmentFile,title:ime(s),"aria-label":s.type==="source"?`${n("sources.open")} ${ome(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(uNe,{size:16,strokeWidth:1.7,className:Ir.attachmentFileIcon}):a.jsx(L0,{name:ime(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:Ir.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:Ir.attachmentFileName,children:ome(s)})]})},v7(s)))})}function Yv({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Zn("animate-pulse rounded-md bg-muted",e),...t})}function dwt(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function hwt({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:o,onOpen:i,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p}){const{t:m}=dt(),[g,v]=d.useState(!1),[b,w]=d.useState(!1);d.useEffect(()=>{e&&w(!1)},[e]),d.useEffect(()=>{w(!1),v(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(b&&t?.supported===!0),()=>c?.(!1)),[b,c,t?.supported]);const y=t?.supported?t.sources:[],x=FNe(y,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const _=s||t?.supported&&t.loading;return a.jsxs("section",{className:Ir.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:Ir.sectionHeaderRow,children:[a.jsxs("h3",{className:`${Ir.sectionHeader} ${Ir.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&dwt()&&a.jsx("button",{type:"button",className:Ir.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(bh,{})})]}),l&&a.jsxs("div",{className:Ir.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(Ze,{size:"sm",variant:"link",onClick:()=>void l(),children:m("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(Ze,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:m("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[m("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(Ze,{size:"sm",variant:"link",onClick:o,children:m("common.retry")})]}),a.jsx(XNe,{entries:g?x:x.slice(0,3),onOpen:S=>QNe(S,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),_&&!x.length&&a.jsx("ul",{className:Ir.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(S=>a.jsxs("li",{className:Ir.attachmentFile,children:[a.jsx(Yv,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(Yv,{className:"h-4",style:{width:`${S}%`}})]},S))}),!_&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:Ir.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:Ir.attachmentFile,"aria-expanded":g,onClick:()=>v(S=>!S),children:m(g?"common.collapse":"sources.viewAll")}),b&&t?.supported&&a.jsx(fwt,{state:t,onClose:()=>w(!1)})]})}function fwt({state:e,onClose:t}){const{t:n}=dt(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,p]=d.useState(),[m,g]=d.useState(!1),v=async()=>{g(!0),p(void 0);try{const b=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,w=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||b.trim().slice(0,200),locator:w,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(b){e.owner.isCurrent()&&p(b instanceof Error?b.message:String(b))}finally{e.owner.isCurrent()&&g(!1)}};return a.jsx(la,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:b=>{b.preventDefault(),v()},children:[a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.type"),a.jsxs("select",{className:"h-8 rounded-lg border border-input bg-background px-2",value:s,onChange:b=>{r(b.target.value),i(""),p(void 0)},children:[a.jsx("option",{value:"workspace_file",children:n("sources.workspaceFile")}),a.jsx("option",{value:"url",children:n("sources.link")})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.location"),a.jsx(Mr,{value:o,onChange:b=>i(b.target.value),required:!0,maxLength:s==="url"?2048:500,placeholder:s==="url"?"https://example.com":"docs/requirements.md"})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.name"),a.jsx(Mr,{value:l,maxLength:200,onChange:b=>c(b.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(Mr,{value:u,maxLength:1e3,onChange:b=>h(b.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(Ze,{type:"submit",disabled:m||!o,children:n("sources.add")})]})})}function QNe(e,t){if(e.type==="source"){t.onOpen?.(e.source);return}const n=e.attachment;if(n.type==="image"){t.onReadImage?.(n.attachmentId).then(s=>t.onImagePreview?.(s,n.attachmentId,{kind:"attachment",attachmentId:n.attachmentId})).catch(s=>t.onAttachmentPreviewError?.(s));return}t.onAttachmentPreview?.({name:n.attachmentId,mimeType:n.mimeType,attachmentId:n.attachmentId})}/**
|
|
1285
1285
|
* @license
|
|
1286
1286
|
* Copyright 2026 Qwen Team
|
|
1287
1287
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -1805,7 +1805,7 @@ License: MIT
|
|
|
1805
1805
|
})();`,q3t=`<!doctype html>
|
|
1806
1806
|
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${B3t}"></head>
|
|
1807
1807
|
<body><script>${z3t}<\/script></body></html>`;function H3t(){const e=globalThis.crypto;if(!e?.getRandomValues)throw new Ls("LEGACY_SANDBOX_UNAVAILABLE","Secure random values are required by the temporary legacy sandbox");const t=new Uint32Array(4);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(8,"0")).join("")}function q0e(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function U3t(e){if(e.signal.aborted)return Promise.reject(q0e());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new Ls("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new Ls("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=H3t(),n=document.createElement("iframe");return n.hidden=!0,n.setAttribute("aria-hidden","true"),n.setAttribute("title","Temporary chart sandbox"),n.setAttribute("sandbox","allow-scripts"),n.srcdoc=q3t,new Promise((s,r)=>{let o=!1,i=!1,l;const c=()=>{window.removeEventListener("message",p),e.signal.removeEventListener("abort",f),n.onload=null,n.onerror=null,l!==void 0&&clearTimeout(l),n.remove()},u=(m,g)=>{o||(o=!0,c(),m(g))},h=m=>{o||(o=!0,c(),r(m))},f=()=>h(q0e()),p=m=>{if(!(m.source!==n.contentWindow||!ca(m.data))&&!(m.data.channel!==AQ||m.data.requestId!==t)){if(m.data.type==="error"){h(new Ls("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(m.data.type==="result")try{const g=Q5e(m.data.option);if(!ca(g))throw new Ls("SCHEMA_INVALID","Temporary legacy chart source must produce a JSON object option");u(s,g)}catch(g){h(g)}}};window.addEventListener("message",p),e.signal.addEventListener("abort",f,{once:!0}),n.onerror=()=>h(new Ls("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to load")),n.onload=()=>{if(!i){if(i=!0,n.onload=null,o||e.signal.aborted){f();return}n.contentWindow?.postMessage({channel:AQ,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>h(new Ls("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var L8e=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);ot(this,"code");ot(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s?.cause}},W3t=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function V3t(e,t){const n={...W3t,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new Ls("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function D8e(e){let t;try{t=await e.resolveContent()}catch(o){throw e.signal.aborted||e.preserveLegacySandboxError&&o instanceof L8e?o:new Ls("REF_RESOLUTION_FAILED",e.resolutionError,{cause:o})}if(typeof t!="string")throw new Ls("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=L3t(t,e.limits),s=$3t(e.source);if(!s)throw new Ls("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await U3t({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:r}}async function G3t(e){return D8e({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveArtifactContent({language:e.block.language,jobId:e.block.jobId,index:e.block.index,signal:e.signal}),resolutionError:"The temporary ChatBI ArtifactContent could not be resolved",returnTypeError:"resolveLegacyArtifactContent must return the raw CSV ArtifactContent string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}async function K3t(e){return D8e({source:e.block.source,signal:e.signal,limits:e.limits,resolveContent:()=>e.resolveSandboxFileContent({language:e.block.language,filePath:e.block.filePath,signal:e.signal}),resolutionError:"The temporary ChatBI sandbox file could not be resolved",returnTypeError:"resolveLegacySandboxFileContent must return a raw CSV string",preserveLegacySandboxError:e.preserveLegacySandboxError===!0})}var Y3t=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),X3t=new Set(["angleAxis","aria","animation","animationDelay","animationDelayUpdate","animationDuration","animationDurationUpdate","animationEasing","animationEasingUpdate","animationThreshold","axisPointer","backgroundColor","blendMode","brush","calendar","color","darkMode","dataset","dataZoom","geo","grid","hoverLayerThreshold","legend","parallel","parallelAxis","polar","progressive","progressiveChunkMode","progressiveThreshold","radar","radiusAxis","series","singleAxis","stateAnimation","textStyle","title","tooltip","useUTC","visualMap","xAxis","yAxis"]),Q3t=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),Z3t=/(?:url|uri|href|src|link)$/i,J3t=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,H0e=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,eNt=/\burl\s*\(/i,tNt=/<\s*\/?\s*[a-z][^>]*>/i,nNt=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,sNt=/^[A-Za-z_][A-Za-z0-9_]*$/;function Sa(e){throw new Ls("SCHEMA_INVALID",e)}function NQ(e,t,n){for(const s of Object.keys(e))t.has(s)||Sa(`${n}.${s} is not allowed`)}function U0e(e,t){if(!Array.isArray(e)||e.length===0)return Sa(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!sNt.test(s)?Sa(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?Sa(`${t} must not contain duplicate dimensions`):n}function rNt(e,t){if(!ca(e)||typeof e.kind!="string")return Sa("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){NQ(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=U0e(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return Sa("echarts-fulldata.data.source must be an array");e.source.forEach((r,o)=>{Array.isArray(r)||Sa(`echarts-fulldata.data.source[${o}] must be an array`),r.length!==n.length&&Sa(`echarts-fulldata.data.source[${o}] must contain ${n.length} cells`)});const s=gF(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(NQ(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return Sa("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return Sa("echarts-fulldata.data.format must be csv or json");const n=U0e(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return Sa(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function O8e(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!ca(r)||typeof r.text!="string")continue;const o=r.text.trim();if(o)return{index:s,isArray:t,title:r,text:o}}}function oNt(e){return O8e(e)?.text}function iNt(e,t){const n=O8e(e);if(!(!n||n.text!==t.trim())){if(Object.prototype.hasOwnProperty.call(n.title,"subtext")){delete n.title.text;return}if(n.isArray){e.title.splice(n.index,1);return}delete e.title}}function bb(e){return Array.isArray(e)?e.map(t=>bb(t)):ca(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,bb(n)])):e}function $8e(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&Sa(`${t} must be an array of non-empty strings`),[...e]}function gF(e,t,n){if(Array.isArray(e)||Sa(`${n} must be an array`),e.length>t.maxRows)throw new Ls("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxRows} row limit`);let s=0;const r=e.map((o,i)=>{if(Array.isArray(o)){const l=o.map((c,u)=>(c!==null&&!["string","number","boolean"].includes(typeof c)&&Sa(`${n}[${i}][${u}] must be a JSON scalar`),c));return s+=l.length,l}if(ca(o)){const l={};for(const[c,u]of Object.entries(o))u!==null&&!["string","number","boolean"].includes(typeof u)&&Sa(`${n}[${i}].${c} must be a JSON scalar`),l[c]=u,s+=1;return l}return Sa(`${n}[${i}] must be an array or object`)});if(s>t.maxCells)throw new Ls("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function aNt(e,t){if(!ca(e)||typeof e.kind!="string")return Sa("echarts.data must be an inline or ref dataset object");const n=$8e(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const s=gF(e.source,t,"echarts.data.source");return n?{kind:"inline",dimensions:n,source:s}:{kind:"inline",source:s}}return e.kind==="ref"?typeof e.ref!="string"||e.ref.length===0?Sa("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?Sa("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:Sa(`Unsupported echarts.data.kind: ${e.kind}`)}function W0e(e,t){if(J3t.test(e))throw new Ls("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(H0e.test(s)||H0e.test(n.trim())||eNt.test(e)||tNt.test(e)||nNt.test(e))throw new Ls("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function lNt(e,t){for(const r of Object.keys(e))if(!X3t.has(r))throw new Ls("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,o,i)=>{if(n+=1,n>t.maxNodes)throw new Ls("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(i>t.maxDepth)throw new Ls("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){W0e(r,o);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${o}[${c}]`,i+1));return}if(ca(r))for(const[l,c]of Object.entries(r)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new Ls("UNSAFE_SPEC",`${o}.${l} must be a string`);W0e(c,`${o}.${l}`);continue}if(Q3t.has(u)||Z3t.test(l))throw new Ls("UNSAFE_SPEC",`${o}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new Ls("UNSAFE_SPEC","Custom ECharts series are not allowed");s(c,`${o}.${l}`,i+1)}};if(s(e,"echarts.option",0),Array.isArray(e.series)&&e.series.length>t.maxSeries)throw new Ls("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxSeries} series limit`);e.dataset!==void 0&&(Array.isArray(e.dataset)?e.dataset:[e.dataset]).forEach((o,i)=>{ca(o)||Sa(`echarts.option.dataset[${i}] must be an object`),o.source!==void 0&&gF(o.source,t,`echarts.option.dataset[${i}].source`)})}function MQ(e,t,n){if(!ca(e))return Sa("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return Sa("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=bb(e),r=t===void 0?void 0:aNt(t,n);return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?Sa("echarts.option.dataset cannot be combined with echarts.data"):(lNt(s,n),{option:s,data:r})}function cNt(e,t){if(!ca(e))return Sa("echarts-fulldata must contain an object");if(NQ(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new Ls("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return Sa("echarts-fulldata.data is required");if(!ca(e.option))return Sa("echarts-fulldata.option must be an object");const n=rNt(e.data,t);return MQ(e.option,n,t)}function uNt(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new Ls("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function V0e(e,t){const n=gF(e.source,t,"resolvedDataset.source"),s=e.dimensions?$8e(e.dimensions,"resolvedDataset.dimensions"):void 0;return s?{data:{kind:"inline",dimensions:s,source:n},option:{dimensions:s,source:n}}:{data:{kind:"inline",source:n},option:{source:n}}}var dNt={light:{background:"#ffffff",foreground:"#343434",legendText:"#555555",titleText:"#343434",subtext:"#aaaaaa",axisLine:"#5d666f",valueAxisLine:"#6E7079",axisLabel:"#838d95",splitLine:"#e0e6f1",splitAreaA:"rgba(250,250,250,0.2)",splitAreaB:"rgba(210,219,238,0.2)",seriesBorder:"#ffffff",pointer:"#7c8a96",tooltipBg:"#ffffff",primary:"#6250f9",palette:["#6250F9","#33AFA9","#AB7BFF","#5F99F9","#A9AFFF","#60CCC5","#C2A5FF","#8EB8FE","#E0E3FE","#98E3DD","#E8E1FA","#D7E6FF"]},dark:{background:"#0d0d0d",foreground:"#f4f7ff",legendText:"#c8cad0",titleText:"#e0e2e8",subtext:"#8a8d93",axisLine:"#555a63",valueAxisLine:"#555a63",axisLabel:"#9da1a8",splitLine:"#3a3e47",splitAreaA:"rgba(60,60,70,0.2)",splitAreaB:"rgba(80,80,90,0.2)",seriesBorder:"#2a2d35",pointer:"#6a707a",tooltipBg:"rgba(30, 32, 40, 0.95)",primary:"#8aa0ff",palette:["#8EA0FF","#61D6D1","#C8A7FF","#8EB8FE","#C7CCFF","#8DE7E2","#D8C5FF","#B8D2FF","#EEF0FF","#C2F0ED","#F0EAFE","#E8F1FF"]}};function A0(e,t){const n={...bb(e),...t};for(const[s,r]of Object.entries(e)){const o=t[s];ca(r)&&ca(o)&&(n[s]=A0(r,o))}return n}function Vj(e,t){return Array.isArray(e)?e.map(n=>ca(n)?A0(t,n):n):ca(e)?A0(t,e):e??bb(t)}function B8e(e){const t=n=>ca(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function hN(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function hNt(e,t){const n=s=>{if(!hN(s,"top")&&!hN(s,"bottom"))return A0(t,s);const r=bb(t);return delete r.top,delete r.bottom,A0(r,s)};return Array.isArray(e)?e.map(s=>ca(s)?n(s):s):ca(e)?n(e):e??bb(t)}var fNt=740,F8e=10,G0e=fNt*F8e/100,pNt=24,mNt=24,K0e=16,gNt=24;function z8e(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=G0e?e:null;if(typeof e!="string")return null;const t=e.trim();if(t==="top")return 0;const n=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+))%$/.exec(t);if(!n)return null;const s=Number(n[1]);return Number.isFinite(s)&&s>=0&&s<=F8e?G0e:null}function vNt(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function wNt(e){return e.show===!1||!vNt(e)?null:hN(e,"top")?z8e(e.top):hN(e,"bottom")?null:0}function yNt(e){return e.show===!1||!hN(e,"top")?null:z8e(e.top)}function Y0e(e){return Array.isArray(e)?e.filter(ca):ca(e)?[e]:[]}function bNt(e,t){const n=Y0e(e).flatMap(r=>{const o=wNt(r);return o===null?[]:[o+pNt+K0e]}),s=Y0e(t).flatMap(r=>{const o=yNt(r);return o===null?[]:[o+mNt+K0e]});return Math.max(gNt,...n,...s)}function X0e(e,t){return Array.isArray(e)?e.map((n,s)=>ca(n)?A0(t(s),n):n):ca(e)?A0(t(0),e):e}function Q0e(e,t){const n=typeof e.type=="string"?e.type:void 0;let s={emphasis:{focus:"series",itemStyle:{borderColor:t.seriesBorder,borderWidth:2}},labelLayout:{hideOverlap:!0}};n==="line"?s=A0(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=A0(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=A0(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=A0(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=B8e(Vj(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var q8e=new Set(["pie","funnel","gauge","radar","treemap"]),xNt=new Set([...q8e,"graph","chord","themeRiver"]);function H8e(e){return Array.isArray(e.series)?e.series.filter(ca):ca(e.series)?[e.series]:[]}function kNt(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=H8e(e);return t.some(n=>typeof n.type=="string"&&xNt.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function _Nt(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=H8e(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&q8e.has(n.type))?"item":"axis"}function SNt(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function CNt(e,t="light"){const n=dNt[t],s=bb(e);return s.backgroundColor??=n.background,s.color??=[...n.palette],s.textStyle=Vj(s.textStyle,{color:n.foreground,fontFamily:"'pingfang SC', 'helvetica neue', arial, 'hiragino sans gb', 'microsoft yahei ui', 'microsoft yahei', sans-serif"}),s.title!==void 0&&(s.title=Vj(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=B8e(Vj(s.tooltip,{trigger:_Nt(e),appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText",backgroundColor:n.tooltipBg,borderColor:n.splitLine,borderWidth:1,padding:[8,10],textStyle:{color:n.titleText,fontSize:12},axisPointer:{lineStyle:{color:n.pointer,width:1},crossStyle:{color:n.pointer,width:1}}})),kNt(e)&&(s.legend=hNt(s.legend,{type:"scroll",bottom:8,padding:[4,16],textStyle:{color:n.legendText,fontSize:12},pageIconColor:n.primary,pageIconInactiveColor:n.splitLine,pageTextStyle:{color:n.legendText}})),s.grid=Vj(s.grid,{top:bNt(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=X0e(s.xAxis,()=>({axisLine:{show:!0,lineStyle:{color:n.axisLine}},axisTick:{show:!0,lineStyle:{color:n.axisLine}},axisLabel:{color:n.axisLabel,fontSize:12,hideOverlap:!0},splitLine:{show:!1,lineStyle:{color:n.splitLine}},splitArea:{show:!1,areaStyle:{color:[n.splitAreaA,n.splitAreaB]}},nameTextStyle:{color:n.axisLabel}}))),s.yAxis!==void 0&&(s.yAxis=X0e(s.yAxis,r=>({alignTicks:!0,axisLine:{show:!1,lineStyle:{color:n.valueAxisLine}},axisTick:{show:!1,lineStyle:{color:n.valueAxisLine}},axisLabel:{color:n.axisLabel,fontSize:12,hideOverlap:!0},splitLine:{show:r===0,lineStyle:{color:n.splitLine}},splitArea:{show:!1,areaStyle:{color:[n.splitAreaA,n.splitAreaB]}},nameGap:12,nameTextStyle:{color:n.axisLabel,align:r===0?"left":"right"}}))),Array.isArray(s.series)?s.series=s.series.map(r=>ca(r)?Q0e(r,n):r):ca(s.series)&&(s.series=Q0e(s.series,n)),s}var jW={dispose(){}};function TNt(e={}){const t={...Y3t,...e.limits},n=e.legacySandbox?.resolveLegacyArtifactContent,s=e.legacySandbox?.resolveLegacySandboxFileContent,r=e.legacySandbox?V3t({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,o=e.loadECharts??(async()=>await nt(()=>import("./index-DohPy72Z.js"),[])),i=async(l,c)=>{if(e.validateDataRef&&!e.validateDataRef(l.ref))throw new Ls("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new Ls("REF_RESOLVER_MISSING","A resolveDataRef callback is required");let u;try{u=await e.resolveDataRef(l.ref,{format:l.format,dimensions:l.dimensions,signal:c})}catch(f){if(c.aborted)return;throw new Ls("REF_RESOLUTION_FAILED","The chart dataset could not be resolved",{cause:f})}if(c.aborted)return;const h=u.dimensions||!l.dimensions?u:{...u,dimensions:l.dimensions};return V0e(h,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:A3t,parse(l,c){return c.language==="echarts-fulldata"?cNt(l,t):MQ(l,c.data,t)},parseSource(l,c){return P8e(c.language)?{option:{},data:void 0,legacyEChartSandboxFile:M3t(c.rawLanguage??c.language,l)}:{option:{},data:void 0,legacyEChartQuery:N3t(c.language,l)}},getTitle(l){return oNt(l.option)},async materialize(l,c){if(!l.legacyEChartQuery&&!l.legacyEChartSandboxFile){if(l.data?.kind==="ref"){const p=await i(l.data,c.signal);return p?{parsed:{...l,data:p},data:p}:{parsed:l,data:c.data}}return{parsed:l,data:l.data}}if(l.legacyEChartQuery&&!n)throw new Ls("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(l.legacyEChartSandboxFile&&!s)throw new Ls("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let u;try{l.legacyEChartSandboxFile?u=await K3t({block:l.legacyEChartSandboxFile,signal:c.signal,resolveSandboxFileContent:s,limits:r,preserveLegacySandboxError:e.legacySandbox!==void 0}):u=await G3t({block:l.legacyEChartQuery,signal:c.signal,resolveArtifactContent:n,limits:r,preserveLegacySandboxError:!0})}catch(p){if(c.signal.aborted)return{parsed:l,data:c.data};throw p instanceof Ls||p instanceof L8e?p:new Ls("REF_RESOLUTION_FAILED","The temporary ChatBI chart could not be resolved",{cause:p})}if(c.signal.aborted)return{parsed:l,data:c.data};let h;try{h=Q5e(u,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(p){throw p instanceof Ls?p:new Ls("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:p})}if(!ca(h))return Sa("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(h,"data")||!Object.prototype.hasOwnProperty.call(h,"spec"))return Sa("Temporary ChatBI resolver must return data and spec");const f=MQ(h.spec,h.data,t);return f.data?.kind!=="inline"?Sa("Temporary ChatBI resolver must return inline data"):{parsed:f,data:f.data}},async mount(l,c,u){if(c.legacyEChartQuery||c.legacyEChartSandboxFile)return Sa("Temporary ChatBI charts must be materialized before mounting");const h=bb(c.option);if(u.externalizedTitle&&iNt(h,u.externalizedTitle),c.data){let b;if(c.data.kind==="inline")b=c.data;else{const y=await i(c.data,u.signal);if(!y)return jW;b=y}const w=V0e(b,t);h.dataset=w.option}if(u.signal.aborted)return jW;let f;try{f=uNt(await o())}catch(b){throw b instanceof Ls?b:new Ls("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:b})}if(u.signal.aborted)return jW;let p,m;try{const b=typeof u.theme=="string"||ca(u.theme)?u.theme:void 0;p=f.init(l,b);const w=SNt(u.theme),y=e.defaultStyle===!1||!w?h:CNt(h,w);p.setOption(y,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(m=new ResizeObserver(()=>p?.resize()),m.observe(l))}catch(b){try{m?.disconnect()}catch{}try{p?.dispose()}catch{}throw new Ls("RENDER_FAILED","ECharts failed to render the chart",{cause:b})}const g=p;let v=!1;return{resize:()=>g.resize(),dispose(){v||(v=!0,m?.disconnect(),g.dispose())}}}}}var Mre=d.createContext(null);function INt(e){if(d.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function RNt(e){const t=e.source??INt(e.children),n=d.useMemo(()=>({registry:e.registry,theme:e.theme,streaming:e.streaming??!1,source:t,loadingLabel:e.loadingLabel,labels:e.labels,onError:e.onError}),[e.registry,e.theme,e.streaming,t,e.loadingLabel,e.labels,e.onError]);return d.createElement(Mre.Provider,{value:n},e.children)}function ENt(e){const t=d.useContext(Mre);if(!t)throw new Error("MarkdownChartBlock must be rendered inside MarkdownChartProvider");const n=d.useRef(null),s=e.streaming??t.streaming,r=e.loadingLabel??t.loadingLabel,o=e.labels??t.labels,i=d.useMemo(()=>J5e(o),[o]);d.useEffect(()=>{const c=n.current;if(!c)return;const u=new y_t(t.registry);let h=!1;return u.render(c,{language:e.language,source:e.source,theme:t.theme,streaming:s,...r!==void 0?{loadingLabel:r}:{},...o!==void 0?{labels:o}:{}}).catch(f=>{h||(c.classList.add("markdown-chart-error"),c.setAttribute("role","alert"),c.textContent=i.chartUnavailable,t.onError?.(f,{language:e.language,source:e.source}))}),()=>{h=!0,u.dispose()}},[t.registry,t.theme,t.onError,r,o,i,e.language,e.source,s]);const l=["markdown-chart-placeholder",s?"markdown-chart-streaming":void 0,e.className].filter(Boolean).join(" ");return d.createElement("div",{ref:n,className:l,style:e.style,"aria-label":i.chart,"aria-busy":s||void 0,"data-markdown-chart-complete":String(!s)})}function jNt(e,t){const n=t?.position?.start?.offset,s=t?.position?.end?.offset;if(e===void 0||n===void 0||s===void 0)return!1;const r=e.lastIndexOf(`
|
|
1808
|
-
`,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return tMe(e.slice(i,s))||e.slice(s).trim().length>0}function U8e(e,t){return e===b7||t?.has(e)===!0}function ANt(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(Mre);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&U8e(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(ENt,{language:u,source:f,streaming:i?.streaming===!0&&!jNt(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const NNt=3e4,MNt=["artifact://","session-file://"],PNt=/^[a-z]:/i;function LNt(e={}){const{resolveDataRef:t,validateDataRef:n=FNt,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?W8e(i):i;if(!c)throw new Error("Chart data reference is not supported.");return zNt(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new s_t().register(TNt({...s,resolveDataRef:o,validateDataRef:n}))}const DNt={registry:LNt()};function ONt(e,t={}){const n=ANt(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...o}){if(d.isValidElement(r)){const i=r,c=/(?:^|\s)language-([^\s]+)/.exec(i.props.className??"")?.[1]?.toLowerCase();if(c&&U8e(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function $Nt({customization:e,source:t,streaming:n,theme:s,children:r}){const o=BNt(e.labels),{t:i}=dt();return a.jsx(RNt,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function BNt(e){const{t}=dt();return d.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o,omittedRows:s-n,omittedColumns:o-r}),...e}),[e,t])}function Z0e(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function W8e(e){if(e.trim()!==e||!e||Z0e(e))return;const t=e.toLowerCase(),n=MNt.find(i=>t.startsWith(i));if(!n)return;const s=e.slice(n.length);if(!s||/[?#\\]/.test(s))return;let r;try{r=decodeURIComponent(s)}catch{return}if(/[%?#\\]/.test(r)||Z0e(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||PNt.test(i)))return`${n}${o.join("/")}`}function FNt(e){return W8e(e)!==void 0}function zNt(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),NNt);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const qNt=32e3,HNt=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","fsharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),J0e={"c++":"cpp","c#":"csharp","f#":"fsharp",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function Pre(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(J0e,t)?J0e[t]:t,s=HNt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const V8e=/^(https?:|mailto:)/i,UNt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,G8e=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function KR(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:V8e.test(t):!1}function Bw(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?G8e.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||UNt.test(n)?!0:V8e.test(n):!1}let eve,tve=Promise.resolve(),WNt=0;const VNt=5e4,GNt=500,KNt=1e4,nve=16;function YNt({code:e}){const{t}=dt(),n=Ib(),s=hl()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=ek(),[p,m]=d.useState(1),[g,v]=d.useState(!1),b=d.useRef(null),[w,y]=d.useState(!1),[x,_]=d.useState(!1),[S,I]=d.useState(null),E=d.useRef(null),N=d.useRef(null),T=n==="light"?"default":"dark",j=.5,C=3,A=.25,R=()=>{m(U=>Math.min(C,Math.round((U+A)*100)/100))},P=()=>{m(U=>Math.max(j,Math.round((U-A)*100)/100))},M=d.useCallback(()=>{N.current=null,v(!1),m(1);const U=b.current;U&&(U.scrollLeft=0,U.scrollTop=0),y(!1)},[]),$=d.useCallback(U=>{const J=b.current;J&&(U.preventDefault(),v(!0),N.current={startX:U.clientX,startY:U.clientY,startLeft:J.scrollLeft,startTop:J.scrollTop})},[]),L=d.useCallback(U=>{const{scrollLeft:J,scrollTop:B}=U.currentTarget;y(J!==0||B!==0)},[]),F=d.useCallback(()=>{const U=b.current;U&&(_(U.scrollWidth>U.clientWidth||U.scrollHeight>U.clientHeight),y(U.scrollLeft!==0||U.scrollTop!==0))},[]),H=d.useCallback(()=>{const U=b.current,J=E.current?.querySelector("svg");if(!U||!J)return;const[,,B,oe]=(J.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),K=(J.getAttribute("width")??"").trim(),ie=Number.parseFloat(J.getAttribute("height")??""),z=B>0&&oe>0,Y=z?B:Number.parseFloat(K),ee=z?oe:ie;if(!(Y>0)||!(ee>0)){I(null);return}const q=U.clientWidth-nve*2,ne=K.endsWith("%")&&q>0?Math.min(Y,q):Y,X=Math.max(0,U.offsetHeight-U.clientHeight);I({stageWidth:ne,canvasHeight:ne*ee/Y+nve*2+X})},[]);d.useEffect(()=>{if(!g)return;const U=B=>{const oe=b.current,K=N.current;!oe||!K||(oe.scrollLeft=K.startLeft-(B.clientX-K.startX),oe.scrollTop=K.startTop-(B.clientY-K.startY),y(oe.scrollLeft!==0||oe.scrollTop!==0))},J=()=>{N.current=null,v(!1)};return window.addEventListener("mousemove",U),window.addEventListener("mouseup",J),window.addEventListener("blur",J),()=>{window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",J),window.removeEventListener("blur",J)}},[g]),d.useEffect(()=>{M()},[e,M]),d.useLayoutEffect(()=>{H(),F()},[r,p,c,H,F]),d.useEffect(()=>{const U=b.current;if(!U)return;const J=new ResizeObserver(()=>{H(),F()});return J.observe(U),()=>J.disconnect()},[r,c,H,F]),d.useEffect(()=>{let U=!1;o(null),l(null);const J=setTimeout(()=>{nt(()=>import("./mermaid.core-BneKXyZr.js").then(B=>B.cb),[]).then(async B=>{if(U)return;const oe=B.default,K=`${T}:${s?"hardened":"runtime"}`,ie=tve.then(async()=>{if(U)throw new Error("Mermaid render skipped");eve!==K&&(oe.initialize({startOnLoad:!1,theme:T,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:VNt,maxEdges:GNt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),eve=K);const Y=`mermaid-${++WNt}`;if(!s)return oe.render(Y,e.trim());let ee;try{return await Promise.race([oe.render(Y,e.trim()),new Promise((q,ne)=>{ee=setTimeout(()=>ne(new Error("Mermaid render timed out")),KNt)})])}finally{ee!==void 0&&clearTimeout(ee)}});tve=ie.then(()=>{},()=>{});const{svg:z}=await ie;U||o(z)}).catch(B=>{U||l(B instanceof Error?B.message:"Mermaid render failed")})},150);return()=>{U=!0,clearTimeout(J)}},[e,s,T]);const D=()=>{Wh(e).then(()=>{f()}).catch(Ag)};return i?a.jsxs("div",{className:Bo.codeBlock,"data-selection-code-language":"mermaid",children:[a.jsx("div",{className:Bo.codeBlockHeader,"data-selection-copy-ignore":!0,children:a.jsx("span",{className:Bo.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Bo.codeBlockContent} ${Bo.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Bo.codeBlock,"data-selection-code-language":"mermaid",children:[a.jsxs("div",{className:Bo.codeBlockHeader,"data-selection-copy-ignore":!0,children:[a.jsx("span",{className:Bo.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Bo.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Bo.codeBlockCopy,onClick:P,title:t("mermaid.zoomOut"),disabled:p<=j,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:M,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:R,title:t("mermaid.zoomIn"),disabled:p>=C,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:D,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Bo.codeBlockContent} ${Bo.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Bo.mermaidZoomWrapper} ${x?Bo.mermaidPannable:""} ${x&&g?Bo.mermaidDragging:""}`,ref:b,"data-selection-copy-ignore":!0,"data-selection-copy-gesture":!0,style:S?{height:S.canvasHeight}:void 0,onMouseDown:$,onDoubleClick:M,onScroll:L,children:a.jsx("div",{className:`${Bo.mermaidBlock} ${Bo.mermaidStage}`,ref:E,style:{...S?{width:S.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Bo.mermaidBlock} ${Bo.mermaidLoading} ${Bo.mermaidInline}`,"data-selection-copy-ignore":!0,"data-selection-copy-gesture":!0,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function XNt({className:e,children:t,isStreaming:n}){const{t:s}=dt(),r=Ib(),o=hl()==="document",[i,l]=d.useState(null),[c,u]=ek(),{label:h,lang:f,resolvedLang:p}=Pre(K8e(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||p==="text"||IQ(m)){l(null);return}const b=U4t(m,p,g);if(b!==null){l(b);return}const w=M0e(m,p,g,!0);if(w!==null){l(w);return}l(null);let y=!1;return v8e(p).then(()=>{if(y)return;const x=M0e(m,p,g,!0);x!==null&&l(x)}).catch(x=>{y||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{y=!0}},[m,o,f,p,g,n]);const v=()=>{Wh(m).then(()=>{u()}).catch(Ag)};return f==="mermaid"&&!n&&!o?a.jsx(YNt,{code:m}):a.jsxs("div",{className:Bo.codeBlock,"data-selection-code-language":f,children:[a.jsxs("div",{className:Bo.codeBlockHeader,"data-selection-copy-ignore":!0,children:[a.jsx("span",{className:Bo.codeBlockLang,children:h}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:Bo.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${Bo.codeBlockContent} ${Bo.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function K8e(e){const t=e?.match(/(?:^|\s)language-([^\s]+)/)?.[1]??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const s=n[1]??"",r=t[s.length];return!r||r==="{"||r===":"?s:""}function QNt({children:e}){return a.jsx("code",{className:Bo.inlineCode,children:e})}function sve({children:e}){return a.jsx("div",{className:Bo.tableWrapper,children:a.jsx("table",{className:Bo.table,children:e})})}const Y8e=d.createContext(!1),X8e=d.createContext(void 0),Q8e=d.createContext(void 0);function ZNt(e,t,n){if(!n||e===void 0)return!1;const s=t?.position?.start.offset,r=t?.position?.end.offset;return s===void 0||r===void 0?!1:!tMe(e.slice(s,r))&&e.slice(r).trim().length===0}function JNt({className:e,children:t,node:n}){const s=d.useContext(Y8e),r=d.useContext(Q8e);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1808
|
+
`,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return tMe(e.slice(i,s))||e.slice(s).trim().length>0}function U8e(e,t){return e===b7||t?.has(e)===!0}function ANt(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(Mre);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&U8e(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(ENt,{language:u,source:f,streaming:i?.streaming===!0&&!jNt(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const NNt=3e4,MNt=["artifact://","session-file://"],PNt=/^[a-z]:/i;function LNt(e={}){const{resolveDataRef:t,validateDataRef:n=FNt,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?W8e(i):i;if(!c)throw new Error("Chart data reference is not supported.");return zNt(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new s_t().register(TNt({...s,resolveDataRef:o,validateDataRef:n}))}const DNt={registry:LNt()};function ONt(e,t={}){const n=ANt(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...o}){if(d.isValidElement(r)){const i=r,c=/(?:^|\s)language-([^\s]+)/.exec(i.props.className??"")?.[1]?.toLowerCase();if(c&&U8e(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function $Nt({customization:e,source:t,streaming:n,theme:s,children:r}){const o=BNt(e.labels),{t:i}=dt();return a.jsx(RNt,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function BNt(e){const{t}=dt();return d.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o,omittedRows:s-n,omittedColumns:o-r}),...e}),[e,t])}function Z0e(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function W8e(e){if(e.trim()!==e||!e||Z0e(e))return;const t=e.toLowerCase(),n=MNt.find(i=>t.startsWith(i));if(!n)return;const s=e.slice(n.length);if(!s||/[?#\\]/.test(s))return;let r;try{r=decodeURIComponent(s)}catch{return}if(/[%?#\\]/.test(r)||Z0e(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||PNt.test(i)))return`${n}${o.join("/")}`}function FNt(e){return W8e(e)!==void 0}function zNt(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),NNt);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const qNt=32e3,HNt=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","fsharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),J0e={"c++":"cpp","c#":"csharp","f#":"fsharp",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function Pre(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(J0e,t)?J0e[t]:t,s=HNt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const V8e=/^(https?:|mailto:)/i,UNt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,G8e=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function KR(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:V8e.test(t):!1}function Bw(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?G8e.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||UNt.test(n)?!0:V8e.test(n):!1}let eve,tve=Promise.resolve(),WNt=0;const VNt=5e4,GNt=500,KNt=1e4,nve=16;function YNt({code:e}){const{t}=dt(),n=Ib(),s=hl()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=ek(),[p,m]=d.useState(1),[g,v]=d.useState(!1),b=d.useRef(null),[w,y]=d.useState(!1),[x,_]=d.useState(!1),[S,I]=d.useState(null),E=d.useRef(null),N=d.useRef(null),T=n==="light"?"default":"dark",j=.5,C=3,A=.25,R=()=>{m(U=>Math.min(C,Math.round((U+A)*100)/100))},P=()=>{m(U=>Math.max(j,Math.round((U-A)*100)/100))},M=d.useCallback(()=>{N.current=null,v(!1),m(1);const U=b.current;U&&(U.scrollLeft=0,U.scrollTop=0),y(!1)},[]),$=d.useCallback(U=>{const J=b.current;J&&(U.preventDefault(),v(!0),N.current={startX:U.clientX,startY:U.clientY,startLeft:J.scrollLeft,startTop:J.scrollTop})},[]),L=d.useCallback(U=>{const{scrollLeft:J,scrollTop:B}=U.currentTarget;y(J!==0||B!==0)},[]),F=d.useCallback(()=>{const U=b.current;U&&(_(U.scrollWidth>U.clientWidth||U.scrollHeight>U.clientHeight),y(U.scrollLeft!==0||U.scrollTop!==0))},[]),H=d.useCallback(()=>{const U=b.current,J=E.current?.querySelector("svg");if(!U||!J)return;const[,,B,oe]=(J.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),K=(J.getAttribute("width")??"").trim(),ie=Number.parseFloat(J.getAttribute("height")??""),z=B>0&&oe>0,Y=z?B:Number.parseFloat(K),ee=z?oe:ie;if(!(Y>0)||!(ee>0)){I(null);return}const q=U.clientWidth-nve*2,ne=K.endsWith("%")&&q>0?Math.min(Y,q):Y,X=Math.max(0,U.offsetHeight-U.clientHeight);I({stageWidth:ne,canvasHeight:ne*ee/Y+nve*2+X})},[]);d.useEffect(()=>{if(!g)return;const U=B=>{const oe=b.current,K=N.current;!oe||!K||(oe.scrollLeft=K.startLeft-(B.clientX-K.startX),oe.scrollTop=K.startTop-(B.clientY-K.startY),y(oe.scrollLeft!==0||oe.scrollTop!==0))},J=()=>{N.current=null,v(!1)};return window.addEventListener("mousemove",U),window.addEventListener("mouseup",J),window.addEventListener("blur",J),()=>{window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",J),window.removeEventListener("blur",J)}},[g]),d.useEffect(()=>{M()},[e,M]),d.useLayoutEffect(()=>{H(),F()},[r,p,c,H,F]),d.useEffect(()=>{const U=b.current;if(!U)return;const J=new ResizeObserver(()=>{H(),F()});return J.observe(U),()=>J.disconnect()},[r,c,H,F]),d.useEffect(()=>{let U=!1;o(null),l(null);const J=setTimeout(()=>{nt(()=>import("./mermaid.core-Dik4l-jM.js").then(B=>B.cb),[]).then(async B=>{if(U)return;const oe=B.default,K=`${T}:${s?"hardened":"runtime"}`,ie=tve.then(async()=>{if(U)throw new Error("Mermaid render skipped");eve!==K&&(oe.initialize({startOnLoad:!1,theme:T,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:VNt,maxEdges:GNt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),eve=K);const Y=`mermaid-${++WNt}`;if(!s)return oe.render(Y,e.trim());let ee;try{return await Promise.race([oe.render(Y,e.trim()),new Promise((q,ne)=>{ee=setTimeout(()=>ne(new Error("Mermaid render timed out")),KNt)})])}finally{ee!==void 0&&clearTimeout(ee)}});tve=ie.then(()=>{},()=>{});const{svg:z}=await ie;U||o(z)}).catch(B=>{U||l(B instanceof Error?B.message:"Mermaid render failed")})},150);return()=>{U=!0,clearTimeout(J)}},[e,s,T]);const D=()=>{Wh(e).then(()=>{f()}).catch(Ag)};return i?a.jsxs("div",{className:Bo.codeBlock,"data-selection-code-language":"mermaid",children:[a.jsx("div",{className:Bo.codeBlockHeader,"data-selection-copy-ignore":!0,children:a.jsx("span",{className:Bo.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Bo.codeBlockContent} ${Bo.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Bo.codeBlock,"data-selection-code-language":"mermaid",children:[a.jsxs("div",{className:Bo.codeBlockHeader,"data-selection-copy-ignore":!0,children:[a.jsx("span",{className:Bo.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Bo.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Bo.codeBlockCopy,onClick:P,title:t("mermaid.zoomOut"),disabled:p<=j,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:M,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:R,title:t("mermaid.zoomIn"),disabled:p>=C,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:D,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Bo.codeBlockContent} ${Bo.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Bo.mermaidZoomWrapper} ${x?Bo.mermaidPannable:""} ${x&&g?Bo.mermaidDragging:""}`,ref:b,"data-selection-copy-ignore":!0,"data-selection-copy-gesture":!0,style:S?{height:S.canvasHeight}:void 0,onMouseDown:$,onDoubleClick:M,onScroll:L,children:a.jsx("div",{className:`${Bo.mermaidBlock} ${Bo.mermaidStage}`,ref:E,style:{...S?{width:S.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Bo.mermaidBlock} ${Bo.mermaidLoading} ${Bo.mermaidInline}`,"data-selection-copy-ignore":!0,"data-selection-copy-gesture":!0,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function XNt({className:e,children:t,isStreaming:n}){const{t:s}=dt(),r=Ib(),o=hl()==="document",[i,l]=d.useState(null),[c,u]=ek(),{label:h,lang:f,resolvedLang:p}=Pre(K8e(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||p==="text"||IQ(m)){l(null);return}const b=U4t(m,p,g);if(b!==null){l(b);return}const w=M0e(m,p,g,!0);if(w!==null){l(w);return}l(null);let y=!1;return v8e(p).then(()=>{if(y)return;const x=M0e(m,p,g,!0);x!==null&&l(x)}).catch(x=>{y||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{y=!0}},[m,o,f,p,g,n]);const v=()=>{Wh(m).then(()=>{u()}).catch(Ag)};return f==="mermaid"&&!n&&!o?a.jsx(YNt,{code:m}):a.jsxs("div",{className:Bo.codeBlock,"data-selection-code-language":f,children:[a.jsxs("div",{className:Bo.codeBlockHeader,"data-selection-copy-ignore":!0,children:[a.jsx("span",{className:Bo.codeBlockLang,children:h}),a.jsx("button",{className:Bo.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:Bo.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${Bo.codeBlockContent} ${Bo.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function K8e(e){const t=e?.match(/(?:^|\s)language-([^\s]+)/)?.[1]??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const s=n[1]??"",r=t[s.length];return!r||r==="{"||r===":"?s:""}function QNt({children:e}){return a.jsx("code",{className:Bo.inlineCode,children:e})}function sve({children:e}){return a.jsx("div",{className:Bo.tableWrapper,children:a.jsx("table",{className:Bo.table,children:e})})}const Y8e=d.createContext(!1),X8e=d.createContext(void 0),Q8e=d.createContext(void 0);function ZNt(e,t,n){if(!n||e===void 0)return!1;const s=t?.position?.start.offset,r=t?.position?.end.offset;return s===void 0||r===void 0?!1:!tMe(e.slice(s,r))&&e.slice(r).trim().length===0}function JNt({className:e,children:t,node:n}){const s=d.useContext(Y8e),r=d.useContext(Q8e);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1809
1809
|
`)?a.jsx(e5t,{className:e,isStreaming:s,isIncomplete:ZNt(r,n,s),children:t}):a.jsx(QNt,{children:t})}function e5t({className:e,children:t,isStreaming:n,isIncomplete:s}){const r=d.useContext(X8e),o=Ib(),{markdown:i}=Vd(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(XNt,{className:e,isStreaming:n,children:l}),h=K8e(e),{resolvedLang:f}=Pre(h);if(!!r&&!!e&&!!h)try{const m=i?.renderCodeBlock?.({language:h,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!s,source:r,theme:o});if(m!=null&&typeof m!="boolean")return a.jsx(Sp,{fallback:u,label:`custom code block component render (lang=${h})`,resetKeys:[h,r,o,n?"streaming":"settled",s?"incomplete":"complete",c],children:m})}catch(m){console.error("[web-shell] custom code block renderer call failed (lang=%s):",h,m)}return u}function t5t({children:e}){return a.jsx(a.Fragment,{children:e})}const PQ=/^qwen-session:\/\//i;function rve(e,t=!1){return t&&G8e.test(e.trim())||PQ.test(e.trim())?e:Y5e(e)}function Z8e({href:e,children:t,node:n,id:s,"aria-label":r,"aria-describedby":o}){const i=hl(),l=Ap();if((n?.properties.dataFootnoteRef!==void 0||n?.properties.dataFootnoteBackref!==void 0)&&e?.startsWith("#"))return a.jsx("a",{id:s,href:e,className:Bo.link,"aria-label":r,"aria-describedby":o,"data-footnote-ref":n?.properties.dataFootnoteRef!==void 0?"":void 0,"data-footnote-backref":n?.properties.dataFootnoteBackref!==void 0?"":void 0,onClick:h=>{const p=h.currentTarget.getRootNode().getElementById(e.slice(1));p&&(h.preventDefault(),p.scrollIntoView({block:"nearest"}),!p.hasAttribute("tabindex")&&p.tagName!=="BUTTON"&&(p.tabIndex=-1),p.focus({preventScroll:!0}))},children:t});if(e&&PQ.test(e.trim())){if(i!=="interactive")return a.jsx("span",{className:Bo.link,children:t});const h=e.trim().replace(PQ,"");return a.jsx("a",{href:"#",role:"button",className:Bo.link,onClick:f=>{f.preventDefault(),f.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:h}))},children:t})}const u=KR(e)?e:void 0;return a.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:Bo.link,onClick:h=>l(h,u),children:t})}function n5t({src:e,alt:t}){const n=hl(),s=Bw(e,n==="document")?e:void 0;return a.jsx("img",{src:s,alt:t||"",className:Bo.image})}function s5t(e,t,n=80){const[s,r]=d.useState(e),o=d.useRef(s);o.current=s;const i=d.useRef(0),l=d.useRef(null),c=d.useRef(e);return c.current=e,d.useEffect(()=>{if(!t){l.current&&(clearTimeout(l.current),l.current=null),o.current!==e&&r(e);return}const u=Date.now(),h=u-i.current;h>=n?(i.current=u,r(c.current)):l.current||(l.current=setTimeout(()=>{i.current=Date.now(),l.current=null,r(c.current)},n-h))},[e,t,n]),d.useEffect(()=>()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),!t||typeof e=="string"&&typeof s=="string"&&!e.startsWith(s)?e:s}function J8e(e="basic",t=""){return{code:JNt,pre:t5t,a:Z8e,img:n5t,sup:E8e,section:j8e,table({children:n}){if(e==="advanced"){const s=a.jsx(sve,{children:n});return a.jsx(Sp,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(y3t,{fallback:s,children:n})})}return a.jsx(sve,{children:n})}}}const r5t=J8e(),o5t=d.memo(function({content:t,components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o}){return a.jsx(Gkt,{components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o,children:t})}),Jh=d.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:o,markdownTableMode:i}=Vd(),l=Ib(),c=hl()==="document",u=`footnote-${d.useId()}-`,h=n?o:void 0,f=s5t(t??"",s),p=s===!0&&f.length>qNt,m=d.useMemo(()=>f&&n&&h?.transformMarkdown?h.transformMarkdown(f,{source:n,isStreaming:s===!0}):f,[n,h,f,s]),g=s?"basic":r??i??"basic",v=d.useMemo(()=>g==="advanced"?J8e("advanced",m):r5t,[g,m]),b=h?.components,w=h?.getInlineFootnoteIcon,y=h?.mountFootnotePreview,x=d.useMemo(()=>{if(!b&&!w&&!y)return v;const A={...v,...b,...g==="advanced"?{table:v.table}:{}},R=b?.a;return b&&(A.a=P=>{if(P.node?.properties.dataFootnoteRef!==void 0||P.node?.properties.dataFootnoteBackref!==void 0||!R)return a.jsx(Z8e,{...P});if(typeof R!="string")return d.createElement(R,P);const{node:$,...L}=P;return d.createElement(R,L)}),b?.sup||(A.sup=P=>a.jsx(E8e,{...P,linkComponent:R,iconResolver:w,mountPreview:y}),A.section=P=>a.jsx(j8e,{...P,sectionComponent:b?.section})),A},[v,g,b,w,y]),_=!c&&n==="assistant"&&!b?.code&&!b?.pre?h?.chart??(h?.renderCodeBlock?void 0:DNt):void 0,S=d.useMemo(()=>_?ONt(_.registry,{chartClassName:_.chartClassName,chartStyle:{minHeight:360,..._.chartStyle}}):void 0,[_]),I=d.useMemo(()=>S?{...x,pre:S}:x,[S,x]),E=d.useMemo(()=>h?.remarkPlugins?[mge,t0e,p0e,...h.remarkPlugins]:[mge,t0e,p0e],[h?.remarkPlugins]),N=d.useMemo(()=>[iIt,...h?.rehypePlugins??[],[I3t,{prefix:u,group:!c&&!b?.sup,safeHref:KR,safeImage:Bw,transformUrl:rve}]],[h?.rehypePlugins,u,c,b?.sup]),T=d.useMemo(()=>A=>rve(A,c),[c]);if(!t)return null;if(p)return a.jsx("div",{className:n!=="thinking"?Bo.content:void 0,"data-markdown-source":n,"data-markdown-streaming-plain-text":"true",children:a.jsx("pre",{className:Bo.streamingPlainText,children:m})});const j=a.jsx(o5t,{content:m,components:I,remarkPlugins:E,rehypePlugins:N,urlTransform:T}),C=_?a.jsx($Nt,{customization:_,source:m,streaming:!!s,theme:l,children:j}):j;return a.jsx("div",{className:n!=="thinking"?Bo.content:void 0,"data-markdown-source":n,children:a.jsx(Y8e.Provider,{value:!!s,children:a.jsx(X8e.Provider,{value:n,children:a.jsx(Q8e.Provider,{value:m,children:C})})})})}),AW=/https?:\/\/[A-Za-z0-9\-._~:/?#[\]{}@!$&'()*+,;=%]+/gi,i5t=new Set([...".,;:!?'*_~"]),a5t={")":"(","]":"[","}":"{"},l5t=/^https?:\/\/./i;function ove(e,t){let n=0;for(const s of e)s===t&&(n+=1);return n}function c5t(e){const t={};for(const[s,r]of Object.entries(a5t))t[s]=ove(e,s)-ove(e,r);let n=e.length;for(;n>0;){const s=e.charAt(n-1);if(Object.hasOwn(t,s)){if(t[s]<=0)break;t[s]--,n--;continue}if(!i5t.has(s))break;n--}return e.slice(0,n)}function u5t(e){const t=[];let n=0;AW.lastIndex=0;for(let s=AW.exec(e);s!==null;s=AW.exec(e)){const r=c5t(s[0]);if(!l5t.test(r))continue;const o=s.index;o>n&&t.push({type:"text",value:e.slice(n,o)}),t.push({type:"url",value:r}),n=o+r.length}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const ZD=d.memo(function({text:t}){const n=Ap(),s=d.useMemo(()=>u5t(t),[t]);return s.every(r=>r.type==="text")?t:s.map((r,o)=>{if(r.type==="text")return r.value;const i=r.value.replace(/%(?![0-9A-Za-z]{2})/g,"%25"),l=KR(i)?i:void 0;return a.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:Bo.link,onClick:c=>n(c,l),children:r.value},o)})}),d5t="_avatar_l9qar_1",h5t="_sm_l9qar_20",f5t="_md_l9qar_26",p5t="_squadTag_l9qar_34",m5t="_squadTagIcon_l9qar_52",g5t="_squadTagName_l9qar_58",qA={avatar:d5t,sm:h5t,md:f5t,squadTag:p5t,squadTagIcon:m5t,squadTagName:g5t};function fN({name:e,color:t,size:n="sm",className:s}){const r=Array.from(e.trim())[0]?.toUpperCase()??"?";return a.jsx("span",{"aria-hidden":"true",className:[qA.avatar,qA[n],s].filter(Boolean).join(" "),"data-tinted":t?"true":void 0,style:t?{"--author-color":t}:void 0,children:r})}const v5t="_flash_96ig5_1",xb={flash:v5t},w5t="_chatMessageRow_i47wk_41",y5t="_chatMessageColumn_i47wk_48",b5t="_author_i47wk_57",x5t="_authorName_i47wk_65",k5t="_chatBubble_i47wk_75",_5t="_scheduledTaskBubble_i47wk_88",S5t="_scheduledTaskRun_i47wk_96",C5t="_scheduledTaskHeader_i47wk_103",T5t="_scheduledTaskIcon_i47wk_110",I5t="_scheduledTaskHeading_i47wk_128",R5t="_scheduledTaskEyebrow_i47wk_135",E5t="_scheduledTaskName_i47wk_142",j5t="_scheduledTaskMeta_i47wk_151",A5t="_scheduledTaskMetaItem_i47wk_158",N5t="_scheduledTaskBadge_i47wk_178",M5t="_scheduledTaskId_i47wk_190",P5t="_scheduledTaskPrompt_i47wk_201",L5t="_sendFailure_i47wk_211",D5t="_retryButton_i47wk_221",O5t="_editArea_i47wk_249",$5t="_editInput_i47wk_257",B5t="_editActions_i47wk_278",F5t="_editCancel_i47wk_284",z5t="_editSubmit_i47wk_285",q5t="_chatContent_i47wk_314",H5t="_messageTag_i47wk_319",U5t="_messageTagTooltip_i47wk_337",W5t="_messageTagClickable_i47wk_371",V5t="_messageTagIcon_i47wk_384",G5t="_messageTagLabel_i47wk_396",K5t="_messageTagValue_i47wk_397",Y5t="_chatContentCollapsed_i47wk_420",X5t="_toggleButton_i47wk_425",Q5t="_toggleIcon_i47wk_446",Z5t="_toggleIconExpanded_i47wk_453",J5t="_chatImages_i47wk_457",eMt="_chatImageThumb_i47wk_465",tMt="_chatImageThumbInteractive_i47wk_473",nMt="_chatFiles_i47wk_482",sMt="_chatFileChip_i47wk_490",rMt="_chatFileChipPreviewable_i47wk_503",oMt="_fileTagIcon_i47wk_512",vo={chatMessageRow:w5t,chatMessageColumn:y5t,author:b5t,authorName:x5t,chatBubble:k5t,scheduledTaskBubble:_5t,scheduledTaskRun:S5t,scheduledTaskHeader:C5t,scheduledTaskIcon:T5t,scheduledTaskHeading:I5t,scheduledTaskEyebrow:R5t,scheduledTaskName:E5t,scheduledTaskMeta:j5t,scheduledTaskMetaItem:A5t,scheduledTaskBadge:N5t,scheduledTaskId:M5t,scheduledTaskPrompt:P5t,sendFailure:L5t,retryButton:D5t,editArea:O5t,editInput:$5t,editActions:B5t,editCancel:F5t,editSubmit:z5t,chatContent:q5t,messageTag:H5t,messageTagTooltip:U5t,messageTagClickable:W5t,messageTagIcon:V5t,messageTagLabel:G5t,messageTagValue:K5t,chatContentCollapsed:Y5t,toggleButton:X5t,toggleIcon:Q5t,toggleIconExpanded:Z5t,chatImages:J5t,chatImageThumb:eMt,chatImageThumbInteractive:tMt,chatFiles:nMt,chatFileChip:sMt,chatFileChipPreviewable:rMt,fileTagIcon:oMt},iMt="This is a scheduled task run. Execute the instructions below now. Do not create or modify a schedule unless the instructions explicitly ask you to.";function aMt(e){const t=`
|
|
1810
1810
|
|
|
1811
1811
|
${iMt}
|
|
@@ -2359,7 +2359,7 @@ ${t}`:"")))}else if(u.type==="completed"||u.type==="failed"||u.type==="cancelled
|
|
|
2359
2359
|
`));if(St.discoveryState==="completed"||St.initialized&&St.discoveryState==="not_started"&&St.servers.length===0){vt=!0;break}}}if(!vt)throw new Error(u("mcp.discovery.timeout"))}catch(Ge){Lt&&Ne(Ge instanceof Error?Ge.message:String(Ge))}finally{Lt&<(!1)}})(),()=>{Lt=!1}},[x,I,S,_,E,u,h]),d.useEffect(()=>{if(h||Ce)return;if(!fn){xe({});return}let Lt=!0;return _e(!0),ct(null),Promise.all(Cn.map(async Ee=>{const Ge=await y(Ee);return{serverName:Ee,tools:Ge.tools.filter(we=>we.isValid),error:Ge.errors?.length?`${Ee}: ${Ge.errors.map(we=>we.error||we.hint||we.kind).join(", ")}`:void 0}})).then(Ee=>{if(!Lt)return;xe(Object.fromEntries(Ee.map(({serverName:we,tools:ze})=>[we,ze])));const Ge=Ee.flatMap(({error:we})=>we?[we]:[]);ct(Ge.length>0?Ge.join(`
|
|
2360
2360
|
`):null)}).catch(Ee=>{Lt&&ct(Ee instanceof Error?Ee.message:String(Ee))}).finally(()=>{Lt&&_e(!1)}),()=>{Lt=!1}},[fn,Cn,Ce,y,h]);function Sn(Lt){if(!Lt){for(const Ee of["description","systemPrompt"])rt.current[Ee]+=1,mt.current[Ee]?.abort(),delete mt.current[Ee];Bt(new Set)}Ve(Lt)}function as(){ye(R),ve(M),wn(null),Ve(!0)}function Vt(Lt){rt.current[Lt]+=1,mt.current[Lt]?.abort(),delete mt.current[Lt],Bt(Ee=>{const Ge=new Set(Ee);return Ge.delete(Lt),Ge})}async function Kn(Lt){const Ee=Q.trim();if(!Ee||mt.current[Lt])return;const Ge=rt.current[Lt]+1;rt.current[Lt]=Ge;const we=new AbortController;mt.current[Lt]=we,Bt(vt=>new Set(vt).add(Lt)),wn(null);const ze=Lt==="description"?ye:ve;ze("");try{const vt=Lt==="description"?`Return only a concise one-sentence ${h?"persistent Agent":"subagent"} description explaining when this agent should be used. Do not return JSON, Markdown, a label, or commentary.`:`Return only the complete ${h?"persistent Agent":"subagent"} system prompt. Do not return JSON, a Markdown code block, a name, a description, or commentary.`;let et="";for await(const St of m(`${Ee}
|
|
2361
2361
|
|
|
2362
|
-
${vt}`,{signal:we.signal})){if(rt.current[Lt]!==Ge)return;if(St.type==="delta")et+=St.text,ze(et);else if(St.type==="error")throw new Error(St.message)}if(rt.current[Lt]!==Ge)return;ze(et.trim())}catch(vt){if(rt.current[Lt]!==Ge||we.signal.aborted)return;wn(u("agent.create.generateFailed",{error:vt instanceof Error?vt.message:String(vt)}))}finally{rt.current[Lt]===Ge&&(Bt(vt=>{const et=new Set(vt);return et.delete(Lt),et}),mt.current[Lt]===we&&delete mt.current[Lt])}}function jn(){P(se.trim()),$(ge.trim()),Sn(!1)}function pn(Lt){const Ee=t?.mcpServers?.[Lt];if(G1(Ee))return Ee;const Ge=_t[Lt];if(G1(Ge))return Ge;const we=T==="workspace"?Pt.find(ze=>ze.name===Lt)?.config:void 0;return G1(we)?we:void 0}async function Ht(){if(!cn){ln(u("agent.create.required"));return}Ye(!0),ln(null);try{if(c){const St=Number(Y);if(!Number.isInteger(St)||St<1||St>8)throw new Error(u("collab.agent.concurrencyInvalid"));const $e=C.trim();await c({name:$e,...R.trim()?{description:R.trim()}:{},...M.trim()?{instructions:M.trim()}:{},...ue?{agentType:ue}:{},...U.trim()?{model:U.trim()}:{},maxConcurrentRuns:St,...he.size>0?{execution:{mode:"managed-host",hostIds:[...he],...ne?{provider:ne}:{}}}:ne&&ne!=="qwen"?{execution:{mode:"local",provider:ne}}:{}}),s($e);return}const Lt=ie.trim()?Number(ie.trim()):void 0;if(Lt!==void 0&&(!Number.isSafeInteger(Lt)||Lt<=0))throw new Error(u("agent.create.maxTurnsInvalid"));const Ee=[...L],Ge=[...H],we=Jkn(st,"hooks"),ze=Object.fromEntries([...Te].flatMap(St=>{const $e=pn(St);return $e?[[St,$e]]:[]})),vt={description:R.trim(),systemPrompt:M.trim(),tools:t||Ee.length>0?Ee:void 0,disallowedTools:t||Ge.length>0?Ge:void 0,mcpServers:t||Object.keys(ze).length>0?ze:void 0,hooks:t?we??{}:we},et=t?await p(t.name,{...vt,model:U.trim()||null,approvalMode:B==="inherit"?null:B,maxTurns:Lt??null,color:de==="inherit"?null:de},T):await f({name:C.trim(),scope:T,...vt,model:U.trim()||void 0,approvalMode:B==="inherit"?void 0:B,maxTurns:Lt,color:de==="inherit"?void 0:de});s(et.agent.name)}catch(Lt){ln(e_n(Lt))}finally{Ye(!1)}}return a.jsxs("div",{className:"flex w-full max-w-5xl flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:u(h?"collab.agent.new":t?"agent.edit":"agent.create")}),a.jsxs(Ze,{type:"button",variant:"outline",onClick:as,children:[a.jsx(Dx,{"data-icon":"inline-start"}),u("agent.create.modelGenerate")]})]}),nn?a.jsx(mp,{tone:"error",noticeKey:nn,closeLabel:u("common.close"),onDismiss:()=>ln(null),children:nn}):null,h&&a.jsx("p",{className:"text-sm text-muted-foreground",children:u("collab.agent.joins",{project:o?.split(/[\\/]/).filter(Boolean).at(-1)??""})}),a.jsxs(G0,{defaultValue:"overview",children:[!h&&a.jsxs(K0,{className:"max-w-full overflow-x-auto",children:[a.jsx(Ai,{value:"overview",children:u("agent.detail.overview")}),a.jsx(Ai,{value:"prompt",children:u("agent.detail.systemPrompt")}),a.jsx(Ai,{value:"tools",children:u("agent.detail.tools")}),a.jsx(Ai,{value:"mcp",children:u("agent.detail.mcp")}),a.jsx(Ai,{value:"hooks",children:u("agent.detail.hooks")})]}),a.jsx(_a,{value:"overview",className:"pt-4",children:a.jsxs($x,{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[h?null:a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-scope",children:u("agent.create.scope")}),a.jsxs(ja,{value:T,disabled:!!t,onValueChange:Lt=>j(Lt),children:[a.jsx(Na,{id:"agent-scope",className:"w-full",children:a.jsx(Aa,{})}),a.jsxs(Ma,{children:[a.jsx(Fo,{value:"workspace",children:u("agent.create.project.cli")}),a.jsx(Fo,{value:"global",children:u("agent.create.user.cli")})]})]})]}),a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-name",children:u("agent.create.name")}),a.jsx(Mr,{id:"agent-name",value:C,onChange:Lt=>A(Lt.target.value),placeholder:u("agent.create.namePlaceholder"),disabled:!!t}),a.jsx(Nd,{children:u(h?"collab.agent.nameHelp":"agent.create.nameHelp")})]}),h&&a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-role",children:u("collab.agent.role")}),a.jsxs(ja,{value:ue||rG,disabled:he.size>0,onValueChange:Lt=>V(Lt===rG?"":Lt),children:[a.jsx(Na,{id:"agent-role",className:"w-full",children:a.jsx(Aa,{})}),a.jsxs(Ma,{children:[a.jsx(Fo,{value:rG,children:u("collab.agent.roleNone")}),g.map(Lt=>a.jsx(Fo,{value:Lt.name,children:Lt.name},Lt.name))]})]}),a.jsx(Nd,{children:u("collab.agent.roleHint")})]}),h&&a.jsxs(zi,{className:"lg:col-span-2",children:[a.jsx(ba,{htmlFor:"agent-workspace-prompt",children:u("collab.agent.instructions")}),a.jsx(ky,{id:"agent-workspace-prompt",value:M,onChange:Lt=>$(Lt.target.value),rows:6,placeholder:u("collab.agent.instructionsHint")})]}),a.jsxs(zi,{className:"lg:col-span-2",children:[a.jsx(ba,{htmlFor:"agent-description",children:u(h?"collab.agent.description":"agent.create.description")}),a.jsx(ky,{id:"agent-description",value:R,onChange:Lt=>P(Lt.target.value),placeholder:u("agent.create.manualDescPlaceholder"),rows:3})]}),a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-model",children:u("agent.create.model")}),a.jsx(Mr,{id:"agent-model",disabled:h&&he.size>0,value:U,onChange:Lt=>J(Lt.target.value),placeholder:"inherit / fast / provider:model"})]}),h?a.jsxs(a.Fragment,{children:[a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-concurrency",children:u("collab.agent.concurrency")}),a.jsx(Mr,{id:"agent-concurrency",type:"number",min:"1",max:"8",step:"1",value:Y,onChange:Lt=>ee(Lt.target.value)})]}),a.jsxs(zi,{className:"lg:col-span-2",children:[a.jsx(ba,{children:u("collab.agent.runsOn")}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm",children:[a.jsx("input",{type:"radio",name:"agent-execution-location",checked:he.size===0,onChange:()=>{pe(new Set),X(q[0])}}),a.jsxs("span",{children:[u("collab.agent.thisComputer"),a.jsx("span",{className:"block break-all text-xs text-muted-foreground",children:o})]})]}),r.map(Lt=>a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm",children:[a.jsx("input",{type:"radio",name:"agent-execution-location",checked:he.has(Lt.id),onChange:()=>{pe(new Set([Lt.id])),X(p9(Lt)[0]),V(""),J("")}}),a.jsxs("span",{children:[Lt.label,Lt.status==="offline"&&a.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u("collab.agentStatus.offline")}),a.jsx("span",{className:"block break-all text-xs text-muted-foreground",children:Lt.workspaceCwd??u("collab.agent.cwdUnknown")})]})]},Lt.id))]}),a.jsx(Nd,{children:u(he.size>0?"collab.agent.hostPersona":"collab.agent.runsOnHint")})]}),(()=>{const Lt=r.find(we=>he.has(we.id)),Ee=Lt?p9(Lt):q,Ge=we=>Ee.includes(we)?void 0:u(Lt||l!==void 0?"collab.agent.programMissing":"collab.agent.programLocal");return a.jsxs(zi,{className:"lg:col-span-2",children:[a.jsx(ba,{children:u("collab.runtime.program")}),a.jsx("div",{role:"radiogroup","aria-label":u("collab.runtime.program"),className:"grid gap-2 sm:grid-cols-2",children:EBe.map(we=>{const ze=Ge(we);return a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm has-[:disabled]:opacity-60",children:[a.jsx("input",{type:"radio",name:"agent-execution-provider",disabled:ze!==void 0,checked:ne===we,onChange:()=>X(we)}),a.jsxs("span",{children:[jBe(we),ze&&a.jsx("span",{className:"block text-xs text-muted-foreground",children:ze})]})]},we)})})]})})(),a.jsx(zi,{className:"lg:col-span-2",children:a.jsx(Nd,{children:u("collab.agent.afterCreate")})})]}):a.jsxs(a.Fragment,{children:[a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-approval",children:u("agent.create.approvalMode")}),a.jsxs(ja,{value:B,onValueChange:oe,children:[a.jsx(Na,{id:"agent-approval",className:"w-full",children:a.jsx(Aa,{children:K1e(B,u)})}),a.jsx(Ma,{children:K.map(Lt=>a.jsx(Fo,{value:Lt,disabled:Lt==="bubble",children:K1e(Lt,u)},Lt))})]}),a.jsx(Nd,{children:r_n(B,u)})]}),a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-max-turns",children:u("agent.create.maxTurns")}),a.jsx(Mr,{id:"agent-max-turns",type:"number",min:"1",step:"1",value:ie,onChange:Lt=>z(Lt.target.value)}),a.jsx(Nd,{children:u("agent.create.maxTurnsHelp")})]}),a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-color",children:u("agent.create.color")}),a.jsxs(ja,{value:de,onValueChange:ke,children:[a.jsx(Na,{id:"agent-color",className:"w-full",children:a.jsx(Aa,{})}),a.jsx(Ma,{children:["inherit","auto","red","blue","green","yellow","purple","orange","pink","cyan"].map(Lt=>a.jsx(Fo,{value:Lt,children:Lt},Lt))})]})]})]})]})}),!h&&a.jsx(_a,{value:"prompt",className:"pt-4",children:a.jsxs(zi,{children:[a.jsx(ky,{id:"agent-prompt","aria-label":u("agent.create.prompt"),value:M,onChange:Lt=>$(Lt.target.value),placeholder:u("agent.create.promptPlaceholder.cli"),rows:16,className:"min-h-80 max-h-[60vh] overflow-y-auto"}),a.jsx(Nd,{children:u("agent.create.promptHelp")})]})}),a.jsx(_a,{value:"tools",className:"pt-4",children:a.jsxs($x,{children:[a.jsxs(zi,{children:[a.jsx(ba,{children:u("agent.create.tools")}),a.jsx(Nd,{children:u("agent.create.toolsSelectHelp")}),a.jsx(G1e,{idPrefix:"agent-allowed-tool",selection:L,onSelectionChange:F,builtInTools:Ue,mcpServers:an,mcpTools:G,t:u}),Ce||Se?a.jsx(Y1e,{label:u("agent.create.tools.initializing")}):null,qe||Be?a.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:qe||Be}):null]}),a.jsxs(zi,{children:[a.jsx(ba,{children:u("agent.create.disallowedTools")}),a.jsx(G1e,{idPrefix:"agent-disallowed-tool",selection:H,onSelectionChange:D,builtInTools:Ue,mcpServers:an,mcpTools:G,t:u})]})]})}),a.jsx(_a,{value:"mcp",className:"pt-4",children:a.jsxs(zi,{children:[a.jsx(ba,{children:u("agent.create.mcpServers")}),a.jsx(s_n,{selection:Te,onSelectionChange:Qe,servers:an,t:u}),w.loading?a.jsx(Y1e,{label:u("common.loading")}):w.error?a.jsx(o_n,{error:w.error}):null]})}),a.jsx(_a,{value:"hooks",className:"pt-4",children:a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-hooks",children:"Hooks"}),a.jsx(ky,{id:"agent-hooks",value:st,onChange:Lt=>Pe(Lt.target.value),placeholder:'{"PreToolUse":[...] }',rows:10,className:"min-h-64 max-h-[60vh] overflow-y-auto font-mono text-xs"}),a.jsx(Nd,{children:u("agent.create.jsonObjectHelp")})]})})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx(Ze,{variant:"outline",onClick:n,disabled:yt,children:u("common.cancel")}),a.jsxs(Ze,{onClick:()=>void Ht(),disabled:!cn||yt,children:[yt?a.jsx(Lr,{"data-icon":"inline-start"}):null,u(t?"agent.edit.save":"agent.create.save")]})]}),a.jsx(Xh,{open:He,onOpenChange:Sn,children:a.jsxs(Qh,{className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl",children:[a.jsxs(Cp,{children:[a.jsx(Zh,{children:u("agent.create.modelGenerate")}),a.jsx(km,{children:u("agent.create.modelGenerate.description")})]}),xn?a.jsx(mp,{tone:"error",noticeKey:xn,closeLabel:u("common.close"),onDismiss:()=>wn(null),children:xn}):null,a.jsxs($x,{children:[a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-generation-requirements",children:u("agent.create.describeAgent")}),a.jsx(ky,{id:"agent-generation-requirements",value:Q,onChange:Lt=>Z(Lt.target.value),placeholder:u("agent.create.qwenPlaceholder"),rows:4}),a.jsx(Nd,{children:u("agent.create.qwenHint")})]}),a.jsxs(zi,{children:[a.jsx(V1e,{htmlFor:"agent-generated-description",label:u("agent.create.generatedDescription"),active:Et.has("description"),disabled:!Q.trim(),onGenerate:()=>void Kn("description"),onCancel:()=>Vt("description"),t:u}),a.jsx(ky,{id:"agent-generated-description",value:se,onChange:Lt=>ye(Lt.target.value),rows:3,readOnly:Et.has("description")})]}),a.jsxs(zi,{children:[a.jsx(V1e,{htmlFor:"agent-generated-prompt",label:u("agent.create.generatedSystemPrompt"),active:Et.has("systemPrompt"),disabled:!Q.trim(),onGenerate:()=>void Kn("systemPrompt"),onCancel:()=>Vt("systemPrompt"),t:u}),a.jsx(ky,{id:"agent-generated-prompt",value:ge,onChange:Lt=>ve(Lt.target.value),rows:10,readOnly:Et.has("systemPrompt"),className:"min-h-64 max-h-64 overflow-y-auto"})]})]}),a.jsxs(H0,{children:[a.jsx(Ze,{type:"button",variant:"outline",onClick:()=>Sn(!1),children:u("common.cancel")}),a.jsx(Ze,{type:"button",onClick:jn,disabled:Et.size>0||!se.trim()||!ge.trim(),children:u("agent.create.useGenerated")})]})]})})]})}function V1e({htmlFor:e,label:t,active:n,disabled:s,onGenerate:r,onCancel:o,t:i}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ba,{htmlFor:e,children:t}),n?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Lr,{className:"size-3"}),i("agent.create.generatingPrompt")]}),a.jsx(Ze,{type:"button",variant:"outline",size:"sm",className:"ml-auto",onClick:o,children:i("common.cancel")})]}):a.jsxs(Ze,{type:"button",variant:"outline",size:"sm",className:"ml-auto",disabled:s,onClick:r,children:[a.jsx(Dx,{"data-icon":"inline-start"}),i("agent.create.generate")]})]})}function G1e({idPrefix:e,selection:t,onSelectionChange:n,builtInTools:s,mcpServers:r,mcpTools:o,t:i}){const[l,c]=d.useState("builtin"),[u,h]=d.useState(""),f=r.filter(g=>!g.disabled),p=l==="builtin"?s:o[u]??[],m=new Map;for(const g of s)m.set(g.name,g.displayName||g.name);for(const[g,v]of Object.entries(o))for(const b of v)m.set(b.name,`${g} / ${b.serverToolName||b.name}`);return a.jsxs("div",{className:"grid gap-3 rounded-lg border p-4",children:[a.jsxs("div",{className:`grid gap-3 ${l==="mcp"?"sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]":"sm:grid-cols-[minmax(0,1fr)]"}`,children:[a.jsxs(ja,{value:l,onValueChange:g=>{c(g),h("")},children:[a.jsx(Na,{id:`${e}-kind`,className:"w-full","aria-label":i("agent.create.tools.type"),children:a.jsx(Aa,{})}),a.jsxs(Ma,{children:[a.jsx(Fo,{value:"builtin",children:i("agent.create.tools.builtin")}),a.jsx(Fo,{value:"mcp",children:i("agent.create.tools.mcp")})]})]}),l==="mcp"?a.jsxs(ja,{value:u||void 0,onValueChange:h,children:[a.jsx(Na,{id:`${e}-server`,className:"w-full","aria-label":i("agent.create.tools.selectServer"),children:a.jsx(Aa,{placeholder:i("agent.create.tools.selectServer")})}),a.jsx(Ma,{children:f.map(g=>a.jsxs(Fo,{value:g.name,disabled:g.mcpStatus!=="connected"&&(o[g.name]?.length??0)===0,children:[g.name,g.mcpStatus?` · ${i(`mcp.status.${g.mcpStatus}`)}`:""]},g.name))})]}):null]}),a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:p.length>0?a.jsx(wd,{delayDuration:300,children:a.jsx("div",{className:"divide-y",children:p.map(g=>{const v=l==="builtin"?g.displayName||g.name:g.serverToolName||g.name;return a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(cm,{id:`${e}-${g.name}`,checked:t.has(g.name),onCheckedChange:b=>n(gJ(t,g.name,b===!0))}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium",children:v}),g.description?a.jsxs(Fu,{children:[a.jsx(zu,{asChild:!0,children:a.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:g.description})}),a.jsx(qu,{className:"max-w-sm whitespace-normal",children:g.description})]}):null]})]},g.name)})})}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:i("agent.create.tools.empty")})}),t.size>0?a.jsx("div",{className:"flex flex-wrap gap-2",children:[...t].map(g=>a.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md bg-muted px-2 py-1 text-sm",title:g,children:[a.jsx("span",{className:"truncate",children:m.get(g)||g}),a.jsx("button",{type:"button",className:"rounded-sm text-muted-foreground hover:text-foreground","aria-label":i("agent.create.removeSelection",{name:g}),onClick:()=>n(gJ(t,g,!1)),children:a.jsx(wh,{className:"size-3.5"})})]},g))}):a.jsx("div",{className:"text-sm text-muted-foreground",children:i("agent.create.tools.noneSelected")})]})}function s_n({selection:e,onSelectionChange:t,servers:n,t:s}){return a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border",children:n.length>0?a.jsx("div",{className:"divide-y",children:n.map(r=>a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(cm,{id:`agent-mcp-server-${r.name}`,checked:e.has(r.name),onCheckedChange:o=>t(gJ(e,r.name,o===!0))}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.name}),r.mcpStatus?a.jsx(To,{variant:"secondary",className:r.mcpStatus==="connected"?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:s(`mcp.status.${r.mcpStatus}`)}):null]},r.name))}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:s("agent.create.mcpServers.empty")})})}function K1e(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.${e}`:`mode.listLabel.${e}`)}function r_n(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.desc.${e}`:`mode.desc.${e}`)}function Y1e({label:e}){return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Lr,{}),e]})}function o_n({error:e}){return a.jsx("div",{className:"text-sm text-destructive",children:e?.message})}const i_n=d.lazy(async()=>({default:(await nt(()=>import("./agents-route-Bg4_tLdL.js"),__vite__mapDeps([93,94]))).AgentsRoute}));function a_n(e){return a.jsx(d.Suspense,{fallback:null,children:a.jsx(i_n,{...e})})}function gk({className:e,...t}){return a.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Zn(e),...t})}function vk({className:e,...t}){return a.jsx("ol",{"data-slot":"breadcrumb-list",className:Zn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function Nc({className:e,...t}){return a.jsx("li",{"data-slot":"breadcrumb-item",className:Zn("inline-flex items-center gap-1",e),...t})}function nw({asChild:e,className:t,...n}){const s=e?Ene:"a";return a.jsx(s,{"data-slot":"breadcrumb-link",className:Zn("transition-colors hover:text-foreground",t),...n})}function Sf({className:e,...t}){return a.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Zn("font-normal text-foreground",e),...t})}function sw({children:e,className:t,...n}){return a.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:Zn("[&>svg]:size-3.5",t),...n,children:e??a.jsx(qa,{})})}const l_n=_C("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),ABe=d.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Yie({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:o,...i}){return a.jsx(ise,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:Zn("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...i,children:a.jsx(ABe.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:o})})}function Xie({className:e,children:t,variant:n="default",size:s="default",...r}){const o=d.useContext(ABe);return a.jsx(h3e,{"data-slot":"toggle-group-item","data-variant":o.variant||n,"data-size":o.size||s,"data-spacing":o.spacing,className:Zn("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",l_n({variant:o.variant||n,size:o.size||s}),e),...r,children:t})}const c_n="_agentGrid_1rdw6_1",u_n={agentGrid:c_n};function oG(e,t){return e==="project"?t("agent.level.project"):e==="user"?t("agent.level.user"):e==="builtin"?t("agent.level.builtin"):e==="extension"?t("agent.level.extension"):e}function d_n(e,t){return e?e==="inherit"||e==="bubble"?t(`agent.approval.${e}`):yk.some(n=>n===e)?t(`mode.listLabel.${e}`):e:"—"}function L_({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function X1e(e){return e?JSON.stringify(e,null,2):"—"}function h_n(e){return e.replace(/\r\n?/g,`
|
|
2362
|
+
${vt}`,{signal:we.signal})){if(rt.current[Lt]!==Ge)return;if(St.type==="delta")et+=St.text,ze(et);else if(St.type==="error")throw new Error(St.message)}if(rt.current[Lt]!==Ge)return;ze(et.trim())}catch(vt){if(rt.current[Lt]!==Ge||we.signal.aborted)return;wn(u("agent.create.generateFailed",{error:vt instanceof Error?vt.message:String(vt)}))}finally{rt.current[Lt]===Ge&&(Bt(vt=>{const et=new Set(vt);return et.delete(Lt),et}),mt.current[Lt]===we&&delete mt.current[Lt])}}function jn(){P(se.trim()),$(ge.trim()),Sn(!1)}function pn(Lt){const Ee=t?.mcpServers?.[Lt];if(G1(Ee))return Ee;const Ge=_t[Lt];if(G1(Ge))return Ge;const we=T==="workspace"?Pt.find(ze=>ze.name===Lt)?.config:void 0;return G1(we)?we:void 0}async function Ht(){if(!cn){ln(u("agent.create.required"));return}Ye(!0),ln(null);try{if(c){const St=Number(Y);if(!Number.isInteger(St)||St<1||St>8)throw new Error(u("collab.agent.concurrencyInvalid"));const $e=C.trim();await c({name:$e,...R.trim()?{description:R.trim()}:{},...M.trim()?{instructions:M.trim()}:{},...ue?{agentType:ue}:{},...U.trim()?{model:U.trim()}:{},maxConcurrentRuns:St,...he.size>0?{execution:{mode:"managed-host",hostIds:[...he],...ne?{provider:ne}:{}}}:ne&&ne!=="qwen"?{execution:{mode:"local",provider:ne}}:{}}),s($e);return}const Lt=ie.trim()?Number(ie.trim()):void 0;if(Lt!==void 0&&(!Number.isSafeInteger(Lt)||Lt<=0))throw new Error(u("agent.create.maxTurnsInvalid"));const Ee=[...L],Ge=[...H],we=Jkn(st,"hooks"),ze=Object.fromEntries([...Te].flatMap(St=>{const $e=pn(St);return $e?[[St,$e]]:[]})),vt={description:R.trim(),systemPrompt:M.trim(),tools:t||Ee.length>0?Ee:void 0,disallowedTools:t||Ge.length>0?Ge:void 0,mcpServers:t||Object.keys(ze).length>0?ze:void 0,hooks:t?we??{}:we},et=t?await p(t.name,{...vt,model:U.trim()||null,approvalMode:B==="inherit"?null:B,maxTurns:Lt??null,color:de==="inherit"?null:de},T):await f({name:C.trim(),scope:T,...vt,model:U.trim()||void 0,approvalMode:B==="inherit"?void 0:B,maxTurns:Lt,color:de==="inherit"?void 0:de});s(et.agent.name)}catch(Lt){ln(e_n(Lt))}finally{Ye(!1)}}return a.jsxs("div",{className:"flex w-full max-w-5xl flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:u(h?"collab.agent.new":t?"agent.edit":"agent.create")}),a.jsxs(Ze,{type:"button",variant:"outline",onClick:as,children:[a.jsx(Dx,{"data-icon":"inline-start"}),u("agent.create.modelGenerate")]})]}),nn?a.jsx(mp,{tone:"error",noticeKey:nn,closeLabel:u("common.close"),onDismiss:()=>ln(null),children:nn}):null,h&&a.jsx("p",{className:"text-sm text-muted-foreground",children:u("collab.agent.joins",{project:o?.split(/[\\/]/).filter(Boolean).at(-1)??""})}),a.jsxs(G0,{defaultValue:"overview",children:[!h&&a.jsxs(K0,{className:"max-w-full overflow-x-auto",children:[a.jsx(Ai,{value:"overview",children:u("agent.detail.overview")}),a.jsx(Ai,{value:"prompt",children:u("agent.detail.systemPrompt")}),a.jsx(Ai,{value:"tools",children:u("agent.detail.tools")}),a.jsx(Ai,{value:"mcp",children:u("agent.detail.mcp")}),a.jsx(Ai,{value:"hooks",children:u("agent.detail.hooks")})]}),a.jsx(_a,{value:"overview",className:"pt-4",children:a.jsxs($x,{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[h?null:a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-scope",children:u("agent.create.scope")}),a.jsxs(ja,{value:T,disabled:!!t,onValueChange:Lt=>j(Lt),children:[a.jsx(Na,{id:"agent-scope",className:"w-full",children:a.jsx(Aa,{})}),a.jsxs(Ma,{children:[a.jsx(Fo,{value:"workspace",children:u("agent.create.project.cli")}),a.jsx(Fo,{value:"global",children:u("agent.create.user.cli")})]})]})]}),a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-name",children:u("agent.create.name")}),a.jsx(Mr,{id:"agent-name",value:C,onChange:Lt=>A(Lt.target.value),placeholder:u("agent.create.namePlaceholder"),disabled:!!t}),a.jsx(Nd,{children:u(h?"collab.agent.nameHelp":"agent.create.nameHelp")})]}),h&&a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-role",children:u("collab.agent.role")}),a.jsxs(ja,{value:ue||rG,disabled:he.size>0,onValueChange:Lt=>V(Lt===rG?"":Lt),children:[a.jsx(Na,{id:"agent-role",className:"w-full",children:a.jsx(Aa,{})}),a.jsxs(Ma,{children:[a.jsx(Fo,{value:rG,children:u("collab.agent.roleNone")}),g.map(Lt=>a.jsx(Fo,{value:Lt.name,children:Lt.name},Lt.name))]})]}),a.jsx(Nd,{children:u("collab.agent.roleHint")})]}),h&&a.jsxs(zi,{className:"lg:col-span-2",children:[a.jsx(ba,{htmlFor:"agent-workspace-prompt",children:u("collab.agent.instructions")}),a.jsx(ky,{id:"agent-workspace-prompt",value:M,onChange:Lt=>$(Lt.target.value),rows:6,placeholder:u("collab.agent.instructionsHint")})]}),a.jsxs(zi,{className:"lg:col-span-2",children:[a.jsx(ba,{htmlFor:"agent-description",children:u(h?"collab.agent.description":"agent.create.description")}),a.jsx(ky,{id:"agent-description",value:R,onChange:Lt=>P(Lt.target.value),placeholder:u("agent.create.manualDescPlaceholder"),rows:3})]}),a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-model",children:u("agent.create.model")}),a.jsx(Mr,{id:"agent-model",disabled:h&&he.size>0,value:U,onChange:Lt=>J(Lt.target.value),placeholder:"inherit / fast / provider:model"})]}),h?a.jsxs(a.Fragment,{children:[a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-concurrency",children:u("collab.agent.concurrency")}),a.jsx(Mr,{id:"agent-concurrency",type:"number",min:"1",max:"8",step:"1",value:Y,onChange:Lt=>ee(Lt.target.value)})]}),a.jsxs(zi,{className:"lg:col-span-2",children:[a.jsx(ba,{children:u("collab.agent.runsOn")}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm",children:[a.jsx("input",{type:"radio",name:"agent-execution-location",checked:he.size===0,onChange:()=>{pe(new Set),X(q[0])}}),a.jsxs("span",{children:[u("collab.agent.thisComputer"),a.jsx("span",{className:"block break-all text-xs text-muted-foreground",children:o})]})]}),r.map(Lt=>a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm",children:[a.jsx("input",{type:"radio",name:"agent-execution-location",checked:he.has(Lt.id),onChange:()=>{pe(new Set([Lt.id])),X(p9(Lt)[0]),V(""),J("")}}),a.jsxs("span",{children:[Lt.label,Lt.status==="offline"&&a.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u("collab.agentStatus.offline")}),a.jsx("span",{className:"block break-all text-xs text-muted-foreground",children:Lt.workspaceCwd??u("collab.agent.cwdUnknown")})]})]},Lt.id))]}),a.jsx(Nd,{children:u(he.size>0?"collab.agent.hostPersona":"collab.agent.runsOnHint")})]}),(()=>{const Lt=r.find(we=>he.has(we.id)),Ee=Lt?p9(Lt):q,Ge=we=>Ee.includes(we)?void 0:u(Lt||l!==void 0?"collab.agent.programMissing":"collab.agent.programLocal");return a.jsxs(zi,{className:"lg:col-span-2",children:[a.jsx(ba,{children:u("collab.runtime.program")}),a.jsx("div",{role:"radiogroup","aria-label":u("collab.runtime.program"),className:"grid gap-2 sm:grid-cols-2",children:EBe.map(we=>{const ze=Ge(we);return a.jsxs("label",{className:"flex items-start gap-2 rounded-md border border-border p-3 text-sm has-[:disabled]:opacity-60",children:[a.jsx("input",{type:"radio",name:"agent-execution-provider",disabled:ze!==void 0,checked:ne===we,onChange:()=>X(we)}),a.jsxs("span",{children:[jBe(we),ze&&a.jsx("span",{className:"block text-xs text-muted-foreground",children:ze})]})]},we)})})]})})(),a.jsx(zi,{className:"lg:col-span-2",children:a.jsx(Nd,{children:u("collab.agent.afterCreate")})})]}):a.jsxs(a.Fragment,{children:[a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-approval",children:u("agent.create.approvalMode")}),a.jsxs(ja,{value:B,onValueChange:oe,children:[a.jsx(Na,{id:"agent-approval",className:"w-full",children:a.jsx(Aa,{children:K1e(B,u)})}),a.jsx(Ma,{children:K.map(Lt=>a.jsx(Fo,{value:Lt,disabled:Lt==="bubble",children:K1e(Lt,u)},Lt))})]}),a.jsx(Nd,{children:r_n(B,u)})]}),a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-max-turns",children:u("agent.create.maxTurns")}),a.jsx(Mr,{id:"agent-max-turns",type:"number",min:"1",step:"1",value:ie,onChange:Lt=>z(Lt.target.value)}),a.jsx(Nd,{children:u("agent.create.maxTurnsHelp")})]}),a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-color",children:u("agent.create.color")}),a.jsxs(ja,{value:de,onValueChange:ke,children:[a.jsx(Na,{id:"agent-color",className:"w-full",children:a.jsx(Aa,{})}),a.jsx(Ma,{children:["inherit","auto","red","blue","green","yellow","purple","orange","pink","cyan"].map(Lt=>a.jsx(Fo,{value:Lt,children:Lt},Lt))})]})]})]})]})}),!h&&a.jsx(_a,{value:"prompt",className:"pt-4",children:a.jsxs(zi,{children:[a.jsx(ky,{id:"agent-prompt","aria-label":u("agent.create.prompt"),value:M,onChange:Lt=>$(Lt.target.value),placeholder:u("agent.create.promptPlaceholder.cli"),rows:16,className:"min-h-80 max-h-[60vh] overflow-y-auto"}),a.jsx(Nd,{children:u("agent.create.promptHelp")})]})}),a.jsx(_a,{value:"tools",className:"pt-4",children:a.jsxs($x,{children:[a.jsxs(zi,{children:[a.jsx(ba,{children:u("agent.create.tools")}),a.jsx(Nd,{children:u("agent.create.toolsSelectHelp")}),a.jsx(G1e,{idPrefix:"agent-allowed-tool",selection:L,onSelectionChange:F,builtInTools:Ue,mcpServers:an,mcpTools:G,t:u}),Ce||Se?a.jsx(Y1e,{label:u("agent.create.tools.initializing")}):null,qe||Be?a.jsx("div",{className:"whitespace-pre-wrap text-sm text-destructive",children:qe||Be}):null]}),a.jsxs(zi,{children:[a.jsx(ba,{children:u("agent.create.disallowedTools")}),a.jsx(G1e,{idPrefix:"agent-disallowed-tool",selection:H,onSelectionChange:D,builtInTools:Ue,mcpServers:an,mcpTools:G,t:u})]})]})}),a.jsx(_a,{value:"mcp",className:"pt-4",children:a.jsxs(zi,{children:[a.jsx(ba,{children:u("agent.create.mcpServers")}),a.jsx(s_n,{selection:Te,onSelectionChange:Qe,servers:an,t:u}),w.loading?a.jsx(Y1e,{label:u("common.loading")}):w.error?a.jsx(o_n,{error:w.error}):null]})}),a.jsx(_a,{value:"hooks",className:"pt-4",children:a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-hooks",children:"Hooks"}),a.jsx(ky,{id:"agent-hooks",value:st,onChange:Lt=>Pe(Lt.target.value),placeholder:'{"PreToolUse":[...] }',rows:10,className:"min-h-64 max-h-[60vh] overflow-y-auto font-mono text-xs"}),a.jsx(Nd,{children:u("agent.create.jsonObjectHelp")})]})})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx(Ze,{variant:"outline",onClick:n,disabled:yt,children:u("common.cancel")}),a.jsxs(Ze,{onClick:()=>void Ht(),disabled:!cn||yt,children:[yt?a.jsx(Lr,{"data-icon":"inline-start"}):null,u(t?"agent.edit.save":"agent.create.save")]})]}),a.jsx(Xh,{open:He,onOpenChange:Sn,children:a.jsxs(Qh,{className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-2xl",children:[a.jsxs(Cp,{children:[a.jsx(Zh,{children:u("agent.create.modelGenerate")}),a.jsx(km,{children:u("agent.create.modelGenerate.description")})]}),xn?a.jsx(mp,{tone:"error",noticeKey:xn,closeLabel:u("common.close"),onDismiss:()=>wn(null),children:xn}):null,a.jsxs($x,{children:[a.jsxs(zi,{children:[a.jsx(ba,{htmlFor:"agent-generation-requirements",children:u("agent.create.describeAgent")}),a.jsx(ky,{id:"agent-generation-requirements",value:Q,onChange:Lt=>Z(Lt.target.value),placeholder:u("agent.create.qwenPlaceholder"),rows:4}),a.jsx(Nd,{children:u("agent.create.qwenHint")})]}),a.jsxs(zi,{children:[a.jsx(V1e,{htmlFor:"agent-generated-description",label:u("agent.create.generatedDescription"),active:Et.has("description"),disabled:!Q.trim(),onGenerate:()=>void Kn("description"),onCancel:()=>Vt("description"),t:u}),a.jsx(ky,{id:"agent-generated-description",value:se,onChange:Lt=>ye(Lt.target.value),rows:3,readOnly:Et.has("description")})]}),a.jsxs(zi,{children:[a.jsx(V1e,{htmlFor:"agent-generated-prompt",label:u("agent.create.generatedSystemPrompt"),active:Et.has("systemPrompt"),disabled:!Q.trim(),onGenerate:()=>void Kn("systemPrompt"),onCancel:()=>Vt("systemPrompt"),t:u}),a.jsx(ky,{id:"agent-generated-prompt",value:ge,onChange:Lt=>ve(Lt.target.value),rows:10,readOnly:Et.has("systemPrompt"),className:"min-h-64 max-h-64 overflow-y-auto"})]})]}),a.jsxs(H0,{children:[a.jsx(Ze,{type:"button",variant:"outline",onClick:()=>Sn(!1),children:u("common.cancel")}),a.jsx(Ze,{type:"button",onClick:jn,disabled:Et.size>0||!se.trim()||!ge.trim(),children:u("agent.create.useGenerated")})]})]})})]})}function V1e({htmlFor:e,label:t,active:n,disabled:s,onGenerate:r,onCancel:o,t:i}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ba,{htmlFor:e,children:t}),n?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Lr,{className:"size-3"}),i("agent.create.generatingPrompt")]}),a.jsx(Ze,{type:"button",variant:"outline",size:"sm",className:"ml-auto",onClick:o,children:i("common.cancel")})]}):a.jsxs(Ze,{type:"button",variant:"outline",size:"sm",className:"ml-auto",disabled:s,onClick:r,children:[a.jsx(Dx,{"data-icon":"inline-start"}),i("agent.create.generate")]})]})}function G1e({idPrefix:e,selection:t,onSelectionChange:n,builtInTools:s,mcpServers:r,mcpTools:o,t:i}){const[l,c]=d.useState("builtin"),[u,h]=d.useState(""),f=r.filter(g=>!g.disabled),p=l==="builtin"?s:o[u]??[],m=new Map;for(const g of s)m.set(g.name,g.displayName||g.name);for(const[g,v]of Object.entries(o))for(const b of v)m.set(b.name,`${g} / ${b.serverToolName||b.name}`);return a.jsxs("div",{className:"grid gap-3 rounded-lg border p-4",children:[a.jsxs("div",{className:`grid gap-3 ${l==="mcp"?"sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]":"sm:grid-cols-[minmax(0,1fr)]"}`,children:[a.jsxs(ja,{value:l,onValueChange:g=>{c(g),h("")},children:[a.jsx(Na,{id:`${e}-kind`,className:"w-full","aria-label":i("agent.create.tools.type"),children:a.jsx(Aa,{})}),a.jsxs(Ma,{children:[a.jsx(Fo,{value:"builtin",children:i("agent.create.tools.builtin")}),a.jsx(Fo,{value:"mcp",children:i("agent.create.tools.mcp")})]})]}),l==="mcp"?a.jsxs(ja,{value:u||void 0,onValueChange:h,children:[a.jsx(Na,{id:`${e}-server`,className:"w-full","aria-label":i("agent.create.tools.selectServer"),children:a.jsx(Aa,{placeholder:i("agent.create.tools.selectServer")})}),a.jsx(Ma,{children:f.map(g=>a.jsxs(Fo,{value:g.name,disabled:g.mcpStatus!=="connected"&&(o[g.name]?.length??0)===0,children:[g.name,g.mcpStatus?` · ${i(`mcp.status.${g.mcpStatus}`)}`:""]},g.name))})]}):null]}),a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:p.length>0?a.jsx(wd,{delayDuration:300,children:a.jsx("div",{className:"divide-y",children:p.map(g=>{const v=l==="builtin"?g.displayName||g.name:g.serverToolName||g.name;return a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(cm,{id:`${e}-${g.name}`,checked:t.has(g.name),onCheckedChange:b=>n(gJ(t,g.name,b===!0))}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium",children:v}),g.description?a.jsxs(Fu,{children:[a.jsx(zu,{asChild:!0,children:a.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:g.description})}),a.jsx(qu,{className:"max-w-sm whitespace-normal",children:g.description})]}):null]})]},g.name)})})}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:i("agent.create.tools.empty")})}),t.size>0?a.jsx("div",{className:"flex flex-wrap gap-2",children:[...t].map(g=>a.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md bg-muted px-2 py-1 text-sm",title:g,children:[a.jsx("span",{className:"truncate",children:m.get(g)||g}),a.jsx("button",{type:"button",className:"rounded-sm text-muted-foreground hover:text-foreground","aria-label":i("agent.create.removeSelection",{name:g}),onClick:()=>n(gJ(t,g,!1)),children:a.jsx(wh,{className:"size-3.5"})})]},g))}):a.jsx("div",{className:"text-sm text-muted-foreground",children:i("agent.create.tools.noneSelected")})]})}function s_n({selection:e,onSelectionChange:t,servers:n,t:s}){return a.jsx("div",{className:"max-h-64 overflow-y-auto rounded-lg border",children:n.length>0?a.jsx("div",{className:"divide-y",children:n.map(r=>a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 hover:bg-accent/30",children:[a.jsx(cm,{id:`agent-mcp-server-${r.name}`,checked:e.has(r.name),onCheckedChange:o=>t(gJ(e,r.name,o===!0))}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.name}),r.mcpStatus?a.jsx(To,{variant:"secondary",className:r.mcpStatus==="connected"?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:s(`mcp.status.${r.mcpStatus}`)}):null]},r.name))}):a.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:s("agent.create.mcpServers.empty")})})}function K1e(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.${e}`:`mode.listLabel.${e}`)}function r_n(e,t){return t(e==="inherit"||e==="bubble"?`agent.approval.desc.${e}`:`mode.desc.${e}`)}function Y1e({label:e}){return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Lr,{}),e]})}function o_n({error:e}){return a.jsx("div",{className:"text-sm text-destructive",children:e?.message})}const i_n=d.lazy(async()=>({default:(await nt(()=>import("./agents-route-6E_3XRjk.js"),__vite__mapDeps([93,94]))).AgentsRoute}));function a_n(e){return a.jsx(d.Suspense,{fallback:null,children:a.jsx(i_n,{...e})})}function gk({className:e,...t}){return a.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:Zn(e),...t})}function vk({className:e,...t}){return a.jsx("ol",{"data-slot":"breadcrumb-list",className:Zn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function Nc({className:e,...t}){return a.jsx("li",{"data-slot":"breadcrumb-item",className:Zn("inline-flex items-center gap-1",e),...t})}function nw({asChild:e,className:t,...n}){const s=e?Ene:"a";return a.jsx(s,{"data-slot":"breadcrumb-link",className:Zn("transition-colors hover:text-foreground",t),...n})}function Sf({className:e,...t}){return a.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:Zn("font-normal text-foreground",e),...t})}function sw({children:e,className:t,...n}){return a.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:Zn("[&>svg]:size-3.5",t),...n,children:e??a.jsx(qa,{})})}const l_n=_C("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),ABe=d.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Yie({className:e,variant:t,size:n,spacing:s=2,orientation:r="horizontal",children:o,...i}){return a.jsx(ise,{orientation:r,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":s,"data-orientation":r,style:{"--gap":s},className:Zn("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...i,children:a.jsx(ABe.Provider,{value:{variant:t,size:n,spacing:s,orientation:r},children:o})})}function Xie({className:e,children:t,variant:n="default",size:s="default",...r}){const o=d.useContext(ABe);return a.jsx(h3e,{"data-slot":"toggle-group-item","data-variant":o.variant||n,"data-size":o.size||s,"data-spacing":o.spacing,className:Zn("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",l_n({variant:o.variant||n,size:o.size||s}),e),...r,children:t})}const c_n="_agentGrid_1rdw6_1",u_n={agentGrid:c_n};function oG(e,t){return e==="project"?t("agent.level.project"):e==="user"?t("agent.level.user"):e==="builtin"?t("agent.level.builtin"):e==="extension"?t("agent.level.extension"):e}function d_n(e,t){return e?e==="inherit"||e==="bubble"?t(`agent.approval.${e}`):yk.some(n=>n===e)?t(`mode.listLabel.${e}`):e:"—"}function L_({label:e,value:t}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("div",{className:"text-sm font-medium",children:e}),a.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function X1e(e){return e?JSON.stringify(e,null,2):"—"}function h_n(e){return e.replace(/\r\n?/g,`
|
|
2363
2363
|
`).replace(/(?<!\n)\n(?!\n|[ \t]*(?:#{1,6}\s|[-*+]\s|\d+\.\s|```|>\s|\*\*[^*\n]+\*\*:))/g," ")}function NBe({initialAgentView:e,onClose:t,embedded:n,initialCreateScope:s,workspaceCwd:r,onMentionAgent:o}){const{t:i}=dt(),{agents:l,loading:c,error:u,reload:h,getAgent:f,deleteAgent:p}=wEe({autoLoad:!0}),[m,g]=d.useState(""),[v,b]=d.useState("all"),[w,y]=d.useState(null),[x,_]=d.useState(null),[S,I]=d.useState(!1),[E,N]=d.useState(!1),[T,j]=d.useState(!1),[C,A]=d.useState(()=>!!s),[R,P]=d.useState(!1),M=Kr(),$=rLe(M.capabilities,r),[L,F]=d.useState(()=>!s&&!n&&$);d.useEffect(()=>{$||F(!1)},[$]);const[H,D]=d.useState(null),[U,J]=d.useState(null),[B,oe]=d.useState(null),[K,ie]=d.useState(!1),z=d.useMemo(()=>Hkn(l,m,v),[l,m,v]),Y=d.useMemo(()=>z1e(w,l),[l,w]),ee=w?.name??null;d.useEffect(()=>{y(V=>z1e(V,l))},[l]),d.useEffect(()=>{n?.onDetailChange(!!(ee||C||R||L))},[C,R,n,L,ee]),d.useEffect(()=>{if(!w){_(null),oe(null);return}let V=!0;return _(null),oe(null),I(!0),f(w.name,H1e(w.level)).then(de=>{V&&_(de)}).catch(de=>{V&&oe(de instanceof Error?de.message:String(de))}).finally(()=>{V&&I(!1)}),()=>{V=!1}},[w,f]),d.useEffect(()=>{ie(!1)},[u]),d.useEffect(()=>{s&&(F(!1),A(!0))},[s]);function q(){F(!1),A(!1),P(!1),y(null),_(null),J(null),h()}async function ne(){if(!x||!Y)return;const V=H1e(Y.level);if(V){N(!0);try{await p(Y.name,V),j(!1),y(null),_(null),D(i("agent.deleted",{name:x.name})),await h()}catch(de){j(!1),J(de instanceof Error?de.message:String(de))}finally{N(!1)}}}const X=[{value:"all",label:i("skills.filter.all")},{value:"project",label:i("agent.level.project")},{value:"user",label:i("agent.level.user")},{value:"builtin",label:i("agent.level.builtin")},{value:"extension",label:i("agent.level.extension")}],he=R?i("agent.edit"):ee??(C?i("agent.create.button"):null),pe=a.jsx(gk,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(vk,{className:"text-base",children:[a.jsx(Nc,{children:a.jsx(Ze,{variant:"ghost",size:"icon",onClick:t,"aria-label":i("common.back"),children:a.jsx(jb,{})})}),a.jsx(Nc,{children:he?a.jsx(nw,{asChild:!0,children:a.jsx("button",{type:"button",onClick:q,children:i("agents.title")})}):a.jsx(Sf,{children:i("agents.title")})}),he?a.jsx(sw,{}):null,he?a.jsx(Nc,{children:a.jsx(Sf,{children:he})}):null]})}),ue=n?he?a.jsx(gk,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:a.jsxs(vk,{className:"h-8 text-sm",children:[a.jsx(Nc,{children:a.jsx(nw,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{q(),n.onDetailChange(!1)},children:i("agents.title")})})}),a.jsx(sw,{}),a.jsx(Nc,{children:a.jsx(Sf,{children:he})})]})}):null:pe;if(L&&$)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ue,a.jsx(a_n,{initialView:e,workspaceCwd:r,...o?{onMentionAgent:o}:{},onOpenDefinitions:()=>F(!1)})]});if(C)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ue,a.jsx(W1e,{initialScope:s??"global",onCancel:q,onCreated:V=>{A(!1),D(i("agent.created",{name:V})),h()}})]});if(R&&x)return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ue,a.jsx(W1e,{agent:x,onCancel:()=>P(!1),onCreated:V=>{P(!1),y(null),_(null),D(i("agent.updated",{name:V})),h()}})]});if(ee&&x){const V=Ukn(x),de=!x.tools||x.tools.length===0||x.tools.includes("*")?i("agent.create.tools.all"):x.tools.join(", "),ke=x.disallowedTools?.join(", ")||"—";return a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ue,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:a.jsx(cw,{})}),a.jsx("div",{className:"min-w-0 flex-1",children:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"break-words text-xl font-semibold text-balance",children:x.name}),a.jsx(To,{variant:"outline",children:oG(x.level,i)}),q1e(x,l)?a.jsx(To,{variant:"secondary",children:i("agent.overriddenBadge")}):null]})}),V?a.jsxs(Fg,{children:[a.jsx(Sm,{asChild:!0,children:a.jsx(Ze,{variant:"ghost",size:"icon",disabled:E,"aria-label":i("agent.chooseAction",{name:x.name}),children:E?a.jsx(Lr,{}):a.jsx(Qx,{})})}),a.jsx(Cm,{align:"end",onCloseAutoFocus:Te=>Te.preventDefault(),children:a.jsxs(Sb,{children:[a.jsxs(Eo,{onSelect:()=>P(!0),children:[a.jsx(P0,{"data-icon":"inline-start"}),i("agent.edit")]}),a.jsxs(Eo,{variant:"destructive",disabled:E,onSelect:()=>j(!0),children:[a.jsx(Uh,{"data-icon":"inline-start"}),i("agent.delete")]})]})})]}):null]}),U?a.jsx(mp,{tone:"error",noticeKey:U,closeLabel:i("common.close"),onDismiss:()=>J(null),children:U}):null,a.jsxs(G0,{defaultValue:"overview",children:[a.jsxs(K0,{className:"max-w-full overflow-x-auto",children:[a.jsx(Ai,{value:"overview",children:i("agent.detail.overview")}),a.jsx(Ai,{value:"prompt",children:i("agent.detail.systemPrompt")}),a.jsx(Ai,{value:"tools",children:i("agent.detail.tools")}),a.jsx(Ai,{value:"mcp",children:i("agent.detail.mcp")}),a.jsx(Ai,{value:"hooks",children:i("agent.detail.hooks")})]}),a.jsx(_a,{value:"overview",className:"pt-4",children:a.jsxs(mu,{children:[a.jsxs(Fh,{children:[a.jsx(zh,{className:"text-sm",children:i("agent.descriptionLabel")}),a.jsx(lm,{children:x.description||"—"})]}),a.jsxs(Cf,{className:"grid gap-6 sm:grid-cols-2",children:[a.jsx(L_,{label:i("agent.filePathLabel"),value:x.filePath||"—"}),a.jsx(L_,{label:i("agent.modelLabel"),value:x.model||"—"}),a.jsx(L_,{label:i("agent.level.label"),value:oG(x.level,i)}),a.jsx(L_,{label:i("agent.create.approvalMode"),value:d_n(x.approvalMode||x.permissionMode,i)}),a.jsx(L_,{label:i("agent.create.maxTurns"),value:x.maxTurns?.toString()||"—"}),a.jsx(L_,{label:i("agent.create.color"),value:x.color||"—"})]})]})}),a.jsx(_a,{value:"prompt",className:"pt-4",children:a.jsx(mu,{children:a.jsx(Cf,{children:a.jsx("div",{className:"max-h-[60vh] w-full overflow-auto break-words whitespace-pre-line text-sm leading-6 text-muted-foreground",children:x.systemPrompt?h_n(x.systemPrompt):"—"})})})}),a.jsx(_a,{value:"tools",className:"pt-4",children:a.jsxs(mu,{children:[a.jsxs(Fh,{children:[a.jsx(zh,{className:"text-sm",children:i("agent.toolsLabel")}),a.jsx(lm,{children:de})]}),a.jsx(Cf,{className:"flex flex-col gap-6",children:a.jsx(L_,{label:i("agent.create.disallowedTools"),value:ke})})]})}),a.jsx(_a,{value:"mcp",className:"pt-4",children:a.jsxs(mu,{children:[a.jsx(Fh,{children:a.jsx(zh,{className:"text-sm",children:i("agent.create.mcpServers")})}),a.jsx(Cf,{children:a.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:X1e(x.mcpServers)})})]})}),a.jsx(_a,{value:"hooks",className:"pt-4",children:a.jsxs(mu,{children:[a.jsx(Fh,{children:a.jsx(zh,{className:"text-sm",children:i("agent.detail.hooks")})}),a.jsx(Cf,{children:a.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:X1e(x.hooks)})})]})})]}),a.jsx(kw,{open:T,onOpenChange:Te=>{!Te&&E||j(Te)},children:a.jsxs(_w,{children:[a.jsxs(Sw,{children:[a.jsx(Tw,{children:i("agent.delete.title",{name:x.name})}),a.jsx(Iw,{children:i("agent.delete.confirm",{name:x.name})})]}),a.jsxs(Cw,{children:[a.jsx(Rw,{disabled:E,children:i("common.cancel")}),a.jsxs(ak,{variant:"destructive",disabled:E,onClick:Te=>{Te.preventDefault(),ne()},children:[E?a.jsx(Lr,{"data-icon":"inline-start"}):null,i("agent.delete.yes")]})]})]})})]})]})}return ee&&S?a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ue,a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(Lr,{className:"size-6"})})]}):ee&&B?a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ue,a.jsx(mp,{tone:"error",noticeKey:B,closeLabel:i("common.close"),onDismiss:q,children:B})]}):a.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[ue,a.jsxs("div",{className:"flex w-full flex-col gap-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-balance",children:i("agents.title")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:i("agents.description")}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground tabular-nums",children:i("agent.count",{count:l.length})})]}),a.jsxs("div",{className:"flex gap-2",children:[$?a.jsx(Ze,{variant:"outline",onClick:()=>F(!0),children:i("collab.sharedThreads")}):null,a.jsxs(Ze,{variant:"outline",disabled:c,onClick:()=>void h(),children:[c?a.jsx(Lr,{"data-icon":"inline-start"}):a.jsx(xh,{"data-icon":"inline-start"}),i("common.refresh")]}),a.jsxs(Ze,{onClick:()=>A(!0),children:[a.jsx(bh,{"data-icon":"inline-start"}),i("agent.create.button")]})]})]}),u&&!K?a.jsx(mp,{tone:"error",noticeKey:u.message,closeLabel:i("common.close"),onDismiss:()=>ie(!0),children:u.message}):null,H?a.jsx(mp,{tone:"success",noticeKey:H,closeLabel:i("common.close"),onDismiss:()=>D(null),children:H}):null,a.jsxs("div",{className:"relative",children:[a.jsx(Yh,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Mr,{name:"agent-search","aria-label":i("common.search"),autoComplete:"off",value:m,onChange:V=>g(V.target.value),placeholder:i("common.search"),className:"pl-9"})]}),a.jsx(Yie,{type:"single",value:v,onValueChange:V=>{V&&b(V)},variant:"outline",size:"sm","aria-label":i("agent.level.filter"),children:X.map(V=>a.jsx(Xie,{value:V.value,children:V.label},V.value))}),z.length?a.jsx("div",{className:u_n.agentGrid,"data-column-count":Math.min(z.length,4),children:z.map(V=>a.jsx(mu,{size:"sm",role:"button",tabIndex:0,"aria-label":V.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>{D(null),J(null),y({name:V.name,level:V.level})},onKeyDown:de=>{(de.key==="Enter"||de.key===" ")&&(de.preventDefault(),D(null),J(null),y({name:V.name,level:V.level}))},children:a.jsx(Fh,{className:"block",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:a.jsx(cw,{className:"size-5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[a.jsx(zh,{className:"min-w-0 flex-1 truncate",children:V.name}),a.jsxs("div",{className:"flex shrink-0 gap-1",children:[a.jsx(To,{variant:"outline",className:"text-[10px]",children:oG(V.level,i)}),q1e(V,l)?a.jsx(To,{variant:"secondary",className:"text-[10px]",children:i("agent.overriddenBadge")}):null]})]}),a.jsx(lm,{className:"mt-1 min-w-0 text-xs",children:a.jsx(wd,{delayDuration:300,children:a.jsxs(Fu,{children:[a.jsx(zu,{asChild:!0,children:a.jsx("span",{className:"block truncate",children:V.description||"—"})}),a.jsx(qu,{children:V.description||"—"})]})})})]})]})})},`${V.level}:${V.name}`))}):a.jsx(Pg,{className:"border",children:a.jsxs(uw,{children:[a.jsx(Lg,{variant:"icon",children:m||v!=="all"?a.jsx(Yh,{}):a.jsx(cw,{})}),a.jsx(dw,{children:i(m||v!=="all"?"agent.noMatches":"agent.empty")})]})})]})]})}/**
|
|
2364
2364
|
* @license
|
|
2365
2365
|
* Copyright 2026 Qwen Team
|
|
@@ -2611,7 +2611,7 @@ ${i("terminal.notice.protocolMismatch")}`),K.close(4002,"Terminal protocol misma
|
|
|
2611
2611
|
* Copyright 2025 Qwen Team
|
|
2612
2612
|
* SPDX-License-Identifier: Apache-2.0
|
|
2613
2613
|
*/const jFn=2048,AFn=8192,NFn=4096,MFn=2097152,VG=8,PFn=512,LFn=256,GG=65536;function DFn(e){if(e.kind==="request")return e.status==="ok"?"success":e.status;if(e.kind==="tool")switch(e.toolStatus??e.block.status){case"success":case"completed":return"success";case"error":case"failed":return"error";case"cancelled":case"canceled":return"cancelled";case"pending":case"in_progress":case"running":return"running";default:return"unknown"}}function OFn(e){switch(e.kind){case"request":return[e.model,e.recordId,e.responseId,e.promptId,e.subagentId,e.parentToolCallId];case"tool":return[e.block.toolName,e.block.toolCallId,e.block.parentToolCallId,e.block.subagentType,e.block.title];case"user":case"message":return[e.block.id];case"other":return[e.block.kind,e.block.id]}}function $Fn(e){if(e.kind==="request")return[];if(e.kind==="tool")return[e.block.rawInput,e.block.rawOutput===void 0?e.block.content:e.block.rawOutput];if(e.kind==="user"||e.kind==="message")return[e.block.text];switch(e.block.kind){case"shell":case"status":case"error":case"debug":return[e.block.text];case"user_shell":return[e.block.command,e.block.text];case"permission":return[e.block.title];case"prompt_cancelled":return[e.block.reason];default:return[]}}function BFn(e){let t=MFn,n=0;return{rows:[...e.rows].reverse().map(r=>{const o=[];let i=!1,l=jFn,c=GG;const u=m=>{const g=m.slice(0,c);c-=g.length,g.length<m.length&&(i=!0);const v=y=>{const x=y.slice(0,l);x.length<y.length&&(i=!0),l-=x.length,x.length>0&&o.push(x.toLowerCase())},b=/data:(?:[a-z0-9!#$&^_.+-]{1,128}\/[a-z0-9!#$&^_.+-]{1,128})?(?:;[^,\s;"'<>]{1,128}){0,4},[^\s"'<>)]*/gi;let w=0;for(const y of g.matchAll(b))v(g.slice(w,y.index)),w=y.index+y[0].length;v(g.slice(w))};for(const m of OFn(r))m!==void 0&&u(m);let h=AFn,f=PFn,p=GG;for(const m of $Fn(r)){const g=r.kind==="tool"||r.kind==="other"&&r.block.kind==="user_shell";l=Math.min(g?NFn:h,t);const v=l;c=g?GG:p;let b=g?LFn:f;const w=b,y=new Set,x=(S,I)=>{if(I>VG||b===0){i=!0;return}if(b--,S!==void 0){if(S===null||typeof S=="string"||typeof S=="boolean"||typeof S=="number"){u(String(S));return}if(typeof S=="object"&&!(!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)){if(y.has(S)){i=!0;return}if(y.add(S),Array.isArray(S))for(let E=0;E<S.length;E++){if(b===0||l===0||I===VG){i=!0;break}x(S[E],I+1)}else{const E=S,N=T=>b===0||l===0||I===VG||(x(T,I+1),b===0||l===0)?(i=!0,!1):(x(E[T],I+1),!0);for(const T in E)if(Object.hasOwn(E,T)&&!(["base64","blob","inlineData","inline_data","mimeType","mime_type"].includes(T)||T==="data"&&typeof E[T]=="string")&&!N(T))break}y.delete(S)}}};x(m,0);const _=v-l;t-=_,h-=_,f-=w-b,p=c}return i&&n++,{key:r.key,kind:r.kind,status:DFn(r),fields:o}}).reverse(),truncatedCount:n}}function Jke(e,t){const n=t.query.trim().toLowerCase();return e.rows.filter(s=>(t.type==="all"||s.kind===t.type)&&(t.status==="all"||s.status===t.status)&&(!n||s.fields.some(r=>r.includes(n)))).map(s=>s.key)}const M9={query:"",type:"all",status:"all"};function e_e(e){return e.query.trim()!==""||e.type!=="all"||e.status!=="all"}function KG(e,t,n){return JSON.stringify([e.query.trim().toLowerCase(),e.type,e.status,t?.start,t?.end,n])}const kj=34;function t_e(e){return e>=999950?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function FFn(e){return`${t_e(e.inputTokens)} → ${t_e(e.outputTokens)}`}const zFn=/-call_[A-Za-z0-9]+$/;function qFn(e){const{subagentId:t,parentToolCallId:n}=e;if(t!==void 0)return n!==void 0&&t.endsWith(`-${n}`)?t.slice(0,-(n.length+1)):t.replace(zFn,"")}function zS(e){const t=e.trim(),n=t.indexOf(`
|
|
2614
|
-
`);return n===-1?t:t.slice(0,n)}function HFn(e,t){if(e.kind==="request"){const n=[Ca(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:Ca(e.timing.ttftMs)})),e.usage&&n.push(FFn(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(Ca(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:Ca(o)}))}return n}return[]}function YG(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Js.toneError;if(t==="cancelled"||t==="canceled")return Js.toneMuted}function oL(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:zS(e.block.text)};case"request":{const n=qFn(e),s=e.status==="error",r=n!==void 0?`${n}${e.model?` · ${e.model}`:""}`:e.model??t("trajectory.request");return{badge:n!==void 0?t("trajectory.badge.subagent"):`#${e.requestIndex??"?"}`,...s?{badgeTone:Js.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:zS(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...YG(e)?{badgeTone:YG(e)}:{},text:`${e.block.title||(e.block.toolName??"")}${YG(e)===Js.toneError?` · ${t("trajectory.toolFailed")}`:""}`};default:return UFn(e.block,t)}}function UFn(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:zS(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:zS(e.command||e.text)};case"permission":return{badge:t("trajectory.badge.permission"),text:e.title||e.toolName||""};case"status":case"error":case"debug":return{badge:t("trajectory.badge.status"),...e.kind==="error"?{badgeTone:Js.toneError}:{},text:zS(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Js.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function WFn(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function VFn({loadPage:e,historyGapRevision:t=0}){const{t:n}=dt(),{trajectory:s,lifecycle:r,status:o,error:i,loadedPages:l,windowPages:c,truncated:u,olderFailure:h,refresh:f,retry:p,older:m,newer:g,mode:v,navigationVersion:b,navigationError:w,canRefresh:y,canOlder:x,canNewer:_,historyReleased:S,bookmarks:I}=g$n(e),[E,N]=d.useState({loader:e,revision:0}),T=d.useRef(void 0),j=d.useCallback(()=>{T.current={revision:t,trajectory:s},f()},[t,s,f]);d.useEffect(()=>{T.current=void 0},[e]),d.useEffect(()=>{const Ke=T.current;Ke&&o!=="loading"&&i?T.current=void 0:Ke&&o==="ready"&&s!==Ke.trajectory&&(N({loader:e,revision:Ke.revision}),T.current=void 0)},[o,s,i,e]);const C=t>(E.loader===e?E.revision:0),A=d.useRef(null),R=d.useRef(!1),P=d.useRef(!1),[M,$]=d.useState({loader:e,version:b,selectionLost:!1}),[L,F]=d.useState({loader:e,value:M9,scope:0});L.loader!==e&&F({loader:e,value:M9,scope:L.scope+1});const H=L.loader===e?L.value:M9,D=d.useCallback(Ke=>{F(Le=>Le.loader===e&&Le.value.query===Ke.query&&Le.value.type===Ke.type&&Le.value.status===Ke.status?Le:{loader:e,value:Ke,scope:Le.scope})},[e]),U=d.useCallback(()=>D(M9),[D]),J=e_e(H),B=d.useMemo(()=>s?BFn(s):void 0,[s]),oe=d.useMemo(()=>B?Jke(B,H):[],[B,H]),K=d.useMemo(()=>new Set(oe),[oe]),[ie,z]=d.useState(void 0),[Y,ee]=d.useState(),[q,ne]=d.useState(!1);d.useEffect(()=>{ne(!1),ee(void 0)},[e]),d.useEffect(()=>{Y?.of&&s&&Y.of!==s&&ee({...Y,of:void 0})},[Y,s]);const X=d.useRef(null),he=d.useRef(!1),pe=d.useRef(0),ue=d.useId(),V=d.useCallback(Ke=>`${ue}-row-${Ke}`,[ue]),de=d.useCallback((Ke,Le)=>{Ke.scrollTop=Le,pe.current=Ke.scrollTop},[]),ke=d.useRef(void 0),[Te,Qe]=d.useState("active"),st=d.useMemo(()=>s?Dze(s,{mode:Te}):void 0,[s,Te]),Pe=mFn(st),He=d.useMemo(()=>new Map(st?.spans.map(Ke=>[Ke.row.key,Ke])),[st]),[Ve,Q]=d.useState(void 0),Z=Ve!==void 0&&Ve.of===s&&Ve.mode===Te?Ve.range:void 0,se=d.useCallback(Ke=>{Q(Ke!==void 0&&s!==void 0?{range:Ke,of:s,mode:Te}:void 0)},[s,Te]);d.useEffect(()=>{Ve&&(Ve.of!==s||Ve.mode!==Te)&&Q(void 0)},[Ve,s,Te]);const ye=d.useMemo(()=>Z&&st?Oze(st,Z):void 0,[Z,st]),ge=d.useMemo(()=>s?hFn(s):void 0,[s]),[ve,G]=d.useState(),xe=d.useMemo(()=>!ge||!ve||ve.loader!==e?new Set:ve.of===ge?ve.keys:new Set([...ve.keys].filter(Ke=>{const Le=ge.groupIdentities.get(Ke);return Le!==void 0&&Le===ve.of.groupIdentities.get(Ke)})),[ve,ge,e]);d.useEffect(()=>{ve&&(ve.of!==ge||ve.loader!==e)&&G(ge?{of:ge,loader:e,keys:xe}:void 0)},[ve,ge,e,xe]);const Se=d.useMemo(()=>oe.filter(Ke=>!ye||ye.has(Ke)),[oe,ye]),_e=d.useMemo(()=>J?new Set(Se):ye,[J,Se,ye]),Be=KG(H,Z,Te),[ct,Ce]=d.useState(),lt=d.useMemo(()=>ct?.of===s&&ct?.loader===e&&ct?.signature===Be?ct.overrides:new Map,[ct,s,e,Be]);d.useEffect(()=>{ct&&(!J||ct.of!==s||ct.loader!==e||ct.signature!==Be)&&Ce(void 0)},[ct,J,s,e,Be]);const qe=d.useMemo(()=>{if(!J)return xe;const Ke=new Set(xe);for(const Le of Se)for(const Ie of ge?.ancestors.get(Le)??[])Ke.delete(Ie);for(const[Le,Ie]of lt)Ie?Ke.add(Le):Ke.delete(Le);return Ke},[J,xe,Se,ge,lt]),Ne=d.useMemo(()=>ge?fFn(ge,_e):[],[ge,_e]),yt=d.useMemo(()=>new Set(Ne.map(Ke=>Ke.key)),[Ne]),Ye=d.useMemo(()=>ge?pFn(ge,Ne,qe):[],[ge,Ne,qe]),Et=d.useMemo(()=>new Set(Ye.map(Ke=>Ke.key)),[Ye]),Bt=ge&&ie?Yke(ge,ie,Et):void 0,nn=d.useMemo(()=>{const Ke=new Map;for(const Le of Ne)if(Le.kind==="row")for(const Ie of ge?.ancestors.get(Le.key)??[])Ke.set(Ie,(Ke.get(Ie)??0)+1);return Ke},[ge,Ne]),ln=n5e({count:Ye.length,getScrollElement:()=>X.current,getItemKey:Ke=>Ye[Ke]?.key??Ke,estimateSize:()=>kj,overscan:12}),xn=d.useCallback(Ke=>{if(!s||!ge?.groups.has(Ke))return;const Le=X.current;if(Le){const xt=Math.min(Ye.length-1,Math.floor(Le.scrollTop/kj)),wt=Ye[xt];wt&&(ke.current={key:wt.key,offset:Le.scrollTop-xt*kj})}const Ie=new Set(qe);if(Ie.has(Ke)?Ie.delete(Ke):Ie.add(Ke),J){const xt=new Map(lt);xt.set(Ke,Ie.has(Ke)),Ce({of:s,loader:e,signature:Be,overrides:xt})}else G({of:ge,loader:e,keys:Ie});X.current?.focus({preventScroll:!0})},[s,ge,Ye,qe,e,J,Be,lt]);d.useLayoutEffect(()=>{const Ke=ke.current;if(!Ke||!ge||!X.current)return;ke.current=void 0;const Le=Yke(ge,Ke.key,Et),Ie=Ye.findIndex(xt=>xt.key===Le);Ie>=0&&de(X.current,Ie*kj+Ke.offset)},[ge,Ye,Et,de]);const wn=Ye.length>0;d.useLayoutEffect(()=>{const Ke=X.current;if(!Ke||typeof ResizeObserver>"u")return;let Le=0;const Ie=()=>{Ke.scrollTop===0&&pe.current>0&&(Ke.scrollTop=pe.current)},xt=new ResizeObserver(()=>{Ie(),Le=requestAnimationFrame(Ie)});return xt.observe(Ke),()=>{xt.disconnect(),Le!==0&&cancelAnimationFrame(Le)}},[wn]),d.useEffect(()=>{if(o!=="ready"||he.current||Ye.length===0)return;he.current=!0;const Ke=X.current;Ke&&de(Ke,Ke.scrollHeight)},[de,o,Ye.length]);const rt=d.useMemo(()=>Bt===void 0?-1:Ye.findIndex(Ke=>Ke.key===Bt),[Bt,Ye]),mt=d.useRef(rt);mt.current=rt,d.useLayoutEffect(()=>{const Ke=mt.current;if(!q||Ke<0)return;const Le=requestAnimationFrame(()=>{ln.scrollToIndex(Ke,{align:"auto"})});return()=>cancelAnimationFrame(Le)},[q,ln]);const Ue=d.useCallback(Ke=>{if(Ye.length===0)return;const Le=Math.min(Math.max(Ke,0),Ye.length-1),Ie=Ye[Le].key;z(Ie),q&&s&&e&&ee({of:s,loader:e,key:Ie}),ln.scrollToIndex(Le,{align:"auto"})},[q,e,s,ln,Ye]),Pt=d.useCallback((Ke,Le=!0)=>{z(Ke),q&&s&&e&&ee({of:s,loader:e,key:Ke}),Le&&X.current?.focus({preventScroll:!0})},[q,s,e]),_t=d.useCallback((Ke=ie)=>{!s||!e||!Ke||s.rowIndexByKey.has(Ke)&&(ee({of:s,loader:e,key:Ke}),z(Ke),ne(!0))},[s,e,ie]),an=d.useCallback(()=>{ne(!1),ee(void 0),X.current?.focus({preventScroll:!0})},[]),Cn=d.useCallback(Ke=>{if(Ke.key==="Escape"){Z!==void 0&&(Ke.preventDefault(),se(void 0));return}if(Ye.length===0)return;if(Ke.key==="Enter"){Ke.preventDefault(),Bt&&(Pt(Bt),_t(Bt));return}if((Ke.key==="ArrowLeft"||Ke.key==="ArrowRight")&&Bt&&ge?.groups.has(Bt)&&(nn.get(Bt)??0)>0){const Ie=Ke.key==="ArrowLeft";qe.has(Bt)!==Ie&&(Ke.preventDefault(),xn(Bt));return}const Le=rt<0?-1:rt;Ke.key==="ArrowDown"?(Ke.preventDefault(),Ue(Le+1)):Ke.key==="ArrowUp"?(Ke.preventDefault(),Ue(Le<=0?0:Le-1)):Ke.key==="Home"?(Ke.preventDefault(),Ue(0)):Ke.key==="End"&&(Ke.preventDefault(),Ue(Ye.length-1))},[Ue,_t,Pt,Z,rt,se,Ye,Bt,ge,nn,qe,xn]),fn=d.useMemo(()=>s?w$n(s):void 0,[s]),cn=ge?.rows.find(Ke=>Ke.key===ie),Sn=Y!==void 0&&Y.of===s&&Y.loader===e,as=Sn?s?.rowIndexByKey.get(Y.key):void 0,Vt=as===void 0?void 0:s?.rows[as],Kn=cn?cn.kind==="turn"?n("trajectory.turn",{index:cn.turn.index}):oL(cn.row,n).text:n("trajectory.selected.none"),jn=cn?.kind==="row"&&(cn.row.kind==="request"||cn.row.kind==="tool")?cn.row.timing:void 0,pn=cn?.kind==="row"&&cn.row.kind==="request"?jn?.ttftMs:void 0,Ht=cn?cn.kind==="turn"?n("trajectory.turnSummary",{requests:cn.turn.requestCount,tools:cn.turn.toolCount,duration:cn.turn.requestCount>0?Ca(cn.turn.requestMs):n("trajectory.unrecorded")}):cn.row.kind==="request"||cn.row.kind==="tool"?`${jn===void 0?n("trajectory.unrecorded"):Ca(jn.durationMs)}${pn===void 0?"":` · ${n("trajectory.ttft",{duration:Ca(pn)})}`}`:n("trajectory.selected.noTiming"):void 0,Lt=o==="ready"&&Ye.length===0,Ee=s!==void 0&&s.rows.length>0&&!WFn(s),Ge=fn!==void 0&&fn.plottedCount===0&&fn.missingStartCount>0,we=d.useMemo(()=>{if(!(!s||!Z&&!J&&qe.size===0))return{shown:Ye.filter(Ke=>Ke.kind==="row").length,total:s.rows.length}},[Z,s,Ye,qe,J]),ze=h===void 0?void 0:h.kind==="partial"?n("trajectory.olderPartial"):h.kind==="unreadable"?n("trajectory.olderFailed",{message:h.message}):n(`trajectory.window.${h.kind}`),vt=d.useRef(void 0);if(M.loader!==e||M.version!==b){const Ke=M.loader!==e;P.current=!Ke;const Le=document.activeElement;R.current=!!(!Ke&&A.current?.contains(Le)&&Le?.getAttribute("data-testid")!=="trajectory-window-older"&&Le?.getAttribute("data-testid")!=="trajectory-window-newer"),$({loader:e,version:b,selectionLost:!Ke&&ie!==void 0}),z(void 0),ee(void 0),ne(!1),G(void 0),Ce(void 0),Q(void 0),ke.current=void 0,vt.current=void 0,pe.current=0,he.current=!Ke}d.useLayoutEffect(()=>{P.current&&X.current&&(P.current=!1,ln.scrollToOffset(0),de(X.current,0)),R.current&&(R.current=!1,A.current?.focus({preventScroll:!0}))},[b,wn,ln,de]);const et=d.useCallback(Ke=>{const Le=Ye.findIndex(Ie=>Ie.key===Ke);if(Le<0&&s&&ge){vt.current=Ke;const Ie=J&&!yt.has(Ke)&&!K.has(Ke),xt=Z!==void 0&&!yt.has(Ke)&&!ye?.has(Ke);Ie&&U(),xt&&se(void 0);const wt=ge.ancestors.get(Ke)??[];if(J&&!Ie){const fe=new Map(xt?[]:lt);for(const Xt of wt)fe.set(Xt,!1);Ce({of:s,loader:e,signature:KG(H,xt?void 0:Z,Te),overrides:fe})}else{const fe=new Set(xe);for(const Xt of wt)fe.delete(Xt);G({of:ge,loader:e,keys:fe})}Pt(Ke);return}Pt(Ke),Le>=0&&ln.scrollToIndex(Le,{align:"auto"})},[s,ge,K,yt,ye,J,U,lt,H,Z,Te,xe,e,Pt,se,ln,Ye]),St=d.useCallback((Ke,Le=H)=>{if(!e_e(Le)||!B||!s||!ge)return;D(Le);const Ie=Jke(B,Le).filter(js=>!ye||ye.has(js));if(!Ie.length)return;const xt=ie?Ie.indexOf(ie):-1,wt=xt<0?Ke===1?0:Ie.length-1:(xt+Ke+Ie.length)%Ie.length,fe=Ie[wt],Xt=ge.ancestors.get(fe)??[],rs=KG(Le,Z,Te),hs=new Map(rs===Be?lt:[]);for(const js of Xt)hs.set(js,!1);Ce({of:s,loader:e,signature:rs,overrides:hs}),vt.current=fe,Pt(fe,!1)},[B,s,ge,D,H,ye,ie,Z,Te,Be,lt,e,Pt]);d.useLayoutEffect(()=>{const Ke=vt.current;if(Ke===void 0)return;vt.current=void 0;const Le=Ye.findIndex(Ie=>Ie.key===Ke);Le>=0&&ln.scrollToIndex(Le,{align:"auto"})},[ln,Ye]);const $e=d.useCallback(Ke=>{const Le=[oL(Ke.row,n).text],Ie=Ke.row.kind==="request"||Ke.row.kind==="tool"?Ke.row.timing?.startedAt:void 0;return Ie!==void 0&&Le.push(`${new Date(Ie).toLocaleString()}–${new Date(Ie+Ke.end-Ke.start).toLocaleString()}`),Le.push(Ca(Ke.end-Ke.start)),Ke.ttftEnd!==void 0&&Le.push(n("trajectory.ttft",{duration:Ca(Ke.ttftEnd-Ke.start)})),Le.filter(Boolean).join(" · ")},[n]);return a.jsxs("div",{className:Js.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Js.header,children:[a.jsx("div",{className:Js.summary,children:fn?a.jsx("span",{"data-testid":"trajectory-totals",children:n("trajectory.totals",{turns:fn.turnCount,requests:fn.requestCount,tools:fn.toolCount})}):a.jsx("span",{children:n("trajectory.title")})}),a.jsxs("div",{className:Js.headerActions,children:[Z!==void 0&&a.jsx("button",{type:"button",className:Js.iconButton,onClick:()=>se(void 0),title:n("trajectory.range.clear"),"aria-label":n("trajectory.range.clear"),"data-testid":"trajectory-range-clear",children:a.jsx(wh,{size:14,strokeWidth:1.6})}),v==="latest"&&a.jsx("button",{type:"button",className:Js.iconButton,onClick:j,disabled:!y,title:n("common.refresh"),"aria-label":n("common.refresh"),children:a.jsx(xh,{size:14,strokeWidth:1.6})})]})]}),a.jsxs("div",{className:Js.overviewMetrics,"data-testid":"trajectory-metrics",children:[[["elapsed",fn?.elapsedMs],["active",fn?.activeMs],["main",fn?.mainRequestMs]].map(([Ke,Le])=>a.jsxs("div",{className:Js.metric,children:[a.jsx("span",{children:n(`trajectory.metric.${Ke}`)}),a.jsx("strong",{"aria-label":Le===void 0?n("trajectory.unrecorded"):void 0,title:Le===void 0?n("trajectory.unrecorded"):void 0,children:Le===void 0?"—":Ca(Le)})]},Ke)),a.jsx("div",{className:Js.failureCounts,"data-has-failures":fn&&fn.requestFailures+fn.toolFailures>0?"true":void 0,children:fn?n("trajectory.failures",{requests:fn.requestFailures,tools:fn.toolFailures}):"—"}),a.jsxs("details",{className:Js.metricHelp,children:[a.jsx("summary",{children:n("trajectory.metric.help")}),a.jsxs("div",{className:Js.metricHelpContent,children:[a.jsx("p",{children:n("trajectory.metric.scope")}),a.jsx("p",{children:n("trajectory.metric.elapsed.help")}),a.jsx("p",{children:n("trajectory.metric.active.help")}),a.jsx("p",{children:n("trajectory.metric.main.help")}),a.jsx("p",{children:n("trajectory.metric.missing.help")})]})]})]}),a.jsx(K$n,{model:st,viewportControl:Pe,...Ee||Ge?{notice:n(Ge?"trajectory.noStart":"trajectory.noTiming")}:{},selectedKey:ie,onSelect:et,describe:$e,...Z!==void 0?{range:Z}:{},onRangeChange:se,onModeChange:Qe}),a.jsxs("div",{className:Js.context,children:[a.jsxs("div",{className:Js.selectedLine,children:[a.jsxs("div",{className:Js.selectedInfo,"data-testid":"trajectory-selected","aria-live":"polite",children:[a.jsx("span",{className:Js.selectedLabel,children:n("trajectory.selected.label")}),a.jsx("span",{className:Js.selectedName,title:Kn,children:Kn}),Ht&&a.jsx("span",{className:Js.selectedMeta,title:Ht,children:Ht})]}),a.jsxs("button",{type:"button",className:Js.detailsButton,onClick:()=>_t(),disabled:!s||!e||!ie||!s.rowIndexByKey.has(ie),children:[n("trajectory.inspector.open"),a.jsx(qa,{size:13,"aria-hidden":"true"})]})]}),a.jsxs("div",{className:Js.contextNotice,"data-testid":"trajectory-context-notice",title:[fn?.missingStartCount?n("trajectory.missingStart",{count:fn.missingStartCount}):"",fn?.missingTimingCount?n("trajectory.missingTiming",{count:fn.missingTimingCount}):"",u?n(v==="history"?"trajectory.window.outside":"trajectory.truncated"):"",C?n("trajectory.historyGap"):"",r.incomplete||r.truncated?n("trajectory.lifecycleIncomplete"):"",i&&s?n("trajectory.refreshStale"):""].filter(Boolean).join(" · "),children:[we&&a.jsx("span",{"data-testid":"trajectory-range-status",role:"status",children:n("trajectory.range.status",we)}),we?" · ":"",[ze,C?n("trajectory.historyGap"):"",r.incomplete||r.truncated?n("trajectory.lifecycleIncomplete"):"",i&&s?n("trajectory.refreshStale"):"",u&&!ze?n(v==="history"?"trajectory.window.outside":"trajectory.truncated"):"",fn&&(fn.missingStartCount>0||fn.missingTimingCount>0)?n("trajectory.unplotted",{starts:fn.missingStartCount,timing:fn.missingTimingCount}):""].filter(Boolean).join(" · ")||(we?"":" ")]})]}),a.jsx("div",{className:Js.errorSlot,children:i!==void 0&&a.jsxs("div",{className:Js.error,role:"alert",children:[a.jsxs("span",{children:[s?`${n("trajectory.refreshStale")} · `:"",i.kind==="partial"?n("trajectory.partial"):i.kind==="unreadable"?n("trajectory.loadFailed",{message:i.message}):n(`trajectory.window.${i.kind}`)]}),a.jsx("button",{type:"button",className:Js.headerButton,onClick:p,disabled:o==="loading"||i.kind!=="partial"&&i.kind!=="unreadable",children:n("common.retry")})]})}),s&&a.jsxs("div",{className:Js.windowNavigation,ref:A,tabIndex:-1,role:"group","aria-label":n("trajectory.window.navigation"),"data-testid":"trajectory-window-navigation","data-bookmarks":I,children:[a.jsxs("div",{className:Js.windowStatus,role:"status","aria-live":"polite","data-testid":"trajectory-window-status",children:[n(`trajectory.window.${v}`)," ·"," ",n("trajectory.window.pages",{pages:c}),a.jsx("span",{children:n("trajectory.window.scope")}),a.jsx("span",{className:Js.windowNotice,children:[o==="loading"?n("trajectory.loadingPages",{pages:l}):u?"":n("trajectory.window.start"),S&&!_&&o!=="loading"&&!w&&!i&&!h?n("trajectory.window.released"):"",M.selectionLost&&!ie?n("trajectory.window.changed"):""].filter(Boolean).join(" · ")||" "})]}),a.jsxs("div",{className:Js.windowButtons,children:[a.jsx("button",{type:"button",className:Js.headerButton,"aria-disabled":!x,onClick:m,"data-testid":"trajectory-window-older",children:n("trajectory.window.older")}),a.jsx("button",{type:"button",className:Js.headerButton,"aria-disabled":!_,onClick:g,"data-testid":"trajectory-window-newer",children:n("trajectory.window.newer")}),h&&!wn&&a.jsx("button",{type:"button",className:Js.headerButton,"data-testid":"trajectory-older-retry",onClick:p,"aria-disabled":o==="loading"||h.kind!=="partial"&&h.kind!=="unreadable",children:n("common.retry")}),v==="history"&&a.jsx("button",{type:"button",className:Js.headerButton,onClick:()=>{y&&j()},"aria-disabled":!y,"data-testid":"trajectory-window-latest",children:n("trajectory.window.return")})]}),w&&a.jsxs("div",{className:Js.windowFailure,role:"alert",children:[a.jsxs("span",{children:[n("trajectory.window.failed")," ",w.kind==="partial"?n("trajectory.partial"):w.kind==="unreadable"?n("trajectory.loadFailed",{message:w.message}):n(`trajectory.window.${w.kind}`)]}),(w.kind==="partial"||w.kind==="unreadable")&&a.jsx("button",{type:"button",className:Js.headerButton,onClick:p,"aria-disabled":o==="loading",children:n("common.retry")})]})]}),s&&s.rows.length>0&&a.jsx(EFn,{value:H,onChange:D,onNavigate:St,onClear:U,count:J?Se.length:0,position:J&&ie?Se.indexOf(ie)+1:0,truncatedCount:B?.truncatedCount??0},L.scope),a.jsx("div",{className:`${Js.tableWrap} ${q?Js.tableWrapWithInspector:""}`,children:Ye.length===0?o==="error"?null:J?a.jsxs("div",{className:Js.placeholder,"data-testid":"trajectory-filter-empty",children:[a.jsx("span",{children:n("trajectory.filter.empty")})," ",a.jsx("button",{type:"button",className:Js.headerButton,onClick:U,children:n("trajectory.filter.clear")})]}):Z!==void 0?a.jsxs("div",{className:Js.placeholder,"data-testid":"trajectory-range-empty",children:[a.jsx("span",{children:n("trajectory.range.empty")})," ",a.jsx("button",{type:"button",className:Js.headerButton,onClick:()=>se(void 0),children:n("trajectory.range.clear")})]}):a.jsx("div",{className:Js.placeholder,role:"status",children:Lt?n("trajectory.empty"):l>0?n("trajectory.loadingPages",{pages:l}):n("common.loading")}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Js.olderBar,role:"status","data-testid":"trajectory-older-bar",children:h!==void 0?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`${Js.olderNotice} ${Js.toneError}`,"data-testid":"trajectory-older-failed",title:ze,children:ze}),a.jsx("button",{type:"button",className:Js.headerButton,onClick:()=>{o!=="loading"&&p()},"aria-disabled":o==="loading"||h.kind!=="partial"&&h.kind!=="unreadable","data-testid":"trajectory-older-retry",children:n("common.retry")})]}):u?a.jsx("span",{className:Js.olderNotice,"data-testid":"trajectory-truncated",children:n(v==="history"?"trajectory.window.outside":"trajectory.truncated")}):null}),a.jsx("div",{ref:X,className:Js.scroll,role:"grid",tabIndex:0,"aria-label":n("trajectory.title"),"aria-rowcount":Ye.length,"aria-activedescendant":ln.getVirtualItems().some(Ke=>Ke.index===rt)?V(rt):void 0,onKeyDown:Cn,onScroll:Ke=>{pe.current=Ke.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Js.virtualBody,style:{height:`${ln.getTotalSize()}px`},children:ln.getVirtualItems().map(Ke=>{const Le=Ye[Ke.index];return a.jsx("div",{id:V(Ke.index),className:Js.virtualRow,style:{height:`${kj}px`,transform:`translateY(${Ke.start}px)`},role:"row","aria-rowindex":Ke.index+1,children:Le.kind==="turn"?a.jsx(GFn,{turn:Le.turn,prompt:Le.turn.userRowKey?s?.rows[s.rowIndexByKey.get(Le.turn.userRowKey)??-1]:void 0,collapsed:qe.has(Le.key),hiddenCount:nn.get(Le.key)??0,onToggle:()=>xn(Le.key),selected:Le.key===Bt,onSelect:()=>Pt(Le.key)}):a.jsx(KFn,{row:Le.row,grouped:(ge?.ancestors.get(Le.key)?.length??0)>1,unresolvedParent:ge?.unresolvedParents.has(Le.key)??!1,fold:ge?.groups.has(Le.key)&&(nn.get(Le.key)??0)>0?{collapsed:qe.has(Le.key),hiddenCount:nn.get(Le.key)??0,onToggle:()=>xn(Le.key)}:void 0,span:He.get(Le.key),total:st?.total??0,viewport:Pe.viewport,range:Z,context:!!_e&&!_e.has(Le.key),selected:Le.key===Bt,onSelect:()=>Pt(Le.key)})},Ke.key)})})})]})}),q&&Y!==void 0&&Y.loader===e&&a.jsx(fBn,{row:Vt,lifecycle:Sn&&Vt?r.byRowKey.get(Vt.key):void 0,stale:!Sn,turnSelected:cn?.kind==="turn",title:Vt?oL(Vt,n).text:void 0,hiddenByRange:!!(Z&&Vt&&!yt.has(Vt.key)&&!ye?.has(Vt.key)),hiddenByFilter:!!(J&&Vt&&!yt.has(Vt.key)&&!K.has(Vt.key)),onClearFilter:U,hiddenByCollapse:!!(Vt&&ge?.ancestors.get(Vt.key)?.some(Ke=>qe.has(Ke))),onReveal:()=>{Vt&&et(Vt.key)},onClearRange:()=>se(void 0),onClose:an})]})}function GFn({turn:e,prompt:t,collapsed:n,hiddenCount:s,onToggle:r,selected:o,onSelect:i}){const{t:l}=dt();return a.jsxs("div",{className:`${Js.turnHeader} ${o?Js.selected:""}`,onClick:i,"aria-selected":o,"data-selected":o?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx(Bze,{collapsed:n,name:l("trajectory.turn",{index:e.index}),onToggle:r}),a.jsx("span",{className:Js.turnTitle,children:e.partial?l("trajectory.turnPartial",{index:e.index}):l("trajectory.turn",{index:e.index})}),t?.kind==="user"&&a.jsx("span",{className:Js.turnPrompt,title:zS(t.block.text),children:zS(t.block.text).slice(0,160)}),n&&s>0&&a.jsx("span",{className:Js.foldCount,children:l("trajectory.collapsed",{count:s})}),a.jsx("span",{className:Js.turnSummary,children:l("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestCount>0?Ca(e.requestMs):"—"})})]})}function KFn({row:e,grouped:t,unresolvedParent:n,fold:s,span:r,total:o,viewport:i,range:l,context:c,selected:u,onSelect:h}){const{t:f}=dt(),p=oL(e,f),m=HFn(e,f);return a.jsxs("div",{className:`${Js.record} ${u?Js.selected:""}`,role:"gridcell","aria-selected":u,"data-selected":u?"true":void 0,onClick:h,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,"data-grouped":t||void 0,"data-context":c||void 0,"data-row-key":e.key,children:[s?a.jsx(Bze,{collapsed:s.collapsed,name:p.text,onToggle:s.onToggle}):a.jsx("span",{className:Js.foldSpacer}),e.depth>0&&a.jsx(mpt,{size:12,strokeWidth:1.6,className:Js.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Js.badge} ${p.badgeTone??""}`,children:p.badge}),a.jsx("span",{className:`${Js.text} ${p.faint?Js.faint:""}`,children:p.text}),n&&a.jsx("span",{className:Js.parentNotice,title:f("trajectory.parentUnresolved"),children:f("trajectory.parentUnresolved")}),c&&a.jsx("span",{className:Js.foldCount,children:f("trajectory.contextRow")}),s?.collapsed&&a.jsx("span",{className:Js.foldCount,children:f("trajectory.collapsed",{count:s.hiddenCount})}),a.jsx("span",{className:Js.waterfallSlot,children:a.jsx(xFn,{span:r,total:o,viewport:i,range:l,title:m.join(" · ")})}),a.jsx("span",{className:Js.rowMetrics,"data-testid":"trajectory-row-metrics",title:m.length>0?m.join(" · "):void 0,children:m.length>0?m.join(" · "):"—"})]})}function Bze({collapsed:e,name:t,onToggle:n}){const{t:s}=dt();return a.jsx("button",{type:"button",tabIndex:-1,className:Js.foldButton,"aria-expanded":!e,"aria-label":s(e?"trajectory.expand":"trajectory.collapse",{name:t}),onClick:r=>{r.stopPropagation(),n()},children:e?a.jsx(qa,{size:13,"aria-hidden":"true"}):a.jsx(ad,{size:13,"aria-hidden":"true"})})}const YFn="_panel_pwtdr_1",XFn="_toolbar_pwtdr_5",QFn="_actions_pwtdr_15",ZFn="_feedback_pwtdr_21",JFn="_state_pwtdr_31",my={panel:YFn,toolbar:XFn,actions:QFn,feedback:ZFn,state:JFn};function ezn({sessionActions:e,sessionId:t,controls:n}){const{t:s}=dt(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),p=d.useRef(null),m=n?.sessionId===t?n:void 0,g=m?.getContextUsage??e?.getContextUsage,v=d.useRef(m);v.current=m;const b=m?.result,[w,y]=d.useState(b),x=!!(b&&b!==w&&(b.kind!=="completed"||!c));d.useEffect(()=>{b?.kind==="completed"&&(h.current++,o(b.usage),u(!1))},[b]),d.useEffect(()=>{let I=!0,E=!1;const N=v.current?.result;o(j=>j?.sessionId===t?j:N?.kind==="completed"?N.usage:null),u(!1),l(!!g);const T=async()=>{if(!I||E||!g)return;E=!0,l(!0),u(!1);const j=h.current,C=p.current,A=C&&C.getContextUsage===g&&C.sessionId===t?C:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=A;try{const R=await A.promise;if(!I||j!==h.current)return;o(R.sessionId===t&&R.usage.contextWindowSize>0?R:null)}catch(R){if(!I||j!==h.current)return;u(one(R)?"transient":"hard")}finally{E=!1,p.current===A&&(p.current=null),I&&l(!1)}};return f.current=()=>void T(),T(),()=>{I=!1}},[g,t]);const _=!g||i||m?.compressing,S=()=>{y(b),f.current()};return a.jsxs("div",{className:my.panel,"aria-busy":i,children:[a.jsxs("div",{className:my.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:my.actions,children:[a.jsx(Ze,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:_,onClick:S,children:a.jsx(xh,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(Ze,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||i,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(oBe,{controls:m,className:my.feedback}),c==="transient"&&r&&a.jsx("div",{className:my.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:my.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(Ze,{type:"button",variant:"outline",size:"sm",disabled:_,onClick:S,children:s("contextUsage.retry")})]}):g?i&&!r?a.jsx("div",{className:my.state,role:"status",children:s("common.loading")}):r?a.jsx(CPe,{status:r,compact:!0}):a.jsx("div",{className:my.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:my.state,children:s("contextUsage.unavailable")})]})}class Fze extends Error{}function zze(e){throw new Fze(e instanceof Error?e.message:String(e))}const tzn=()=>nt(()=>import("./WorkspaceFileBrowser-DjeX-ArR.js"),__vite__mapDeps([95,96])).then(e=>({default:e.WorkspaceFileBrowser})).catch(zze),nzn=()=>nt(()=>import("./PierreFilePreview-Cq9imG0c.js"),[]).catch(zze),szn=d.lazy(()=>nt(()=>import("./SpreadsheetPreview-Blho0kkO.js"),[])),rzn=700,ozn=["daily","weekdays","weekly","hourly","minutes","custom"],izn=[1,2,3,4,5,6,10,12,15,20,30],azn=(e,t)=>{},lzn=(e,t,n)=>{},czn=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function n_e(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function gy(e){return e.kind==="pending"?e.targetKind:e.kind}function uzn(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const dzn=["review","sideTask"];function hzn({tab:e,workspaceCwd:t,onOpenFilePreview:n,onReferenceFile:s,onClose:r}){const{t:o,language:i}=dt(),l=v5(),c=d.useMemo(()=>d.lazy(tzn),[]),u=d.useMemo(()=>d.lazy(nzn),[]),h=PC(e.workspaceCwd),f=h?.workspaceId===e.workspaceId?h?.actions:void 0;if(!f)return a.jsx("div",{className:ft.empty,role:"alert",children:o("workspace.notFoundDescription")});const p=(m,g)=>{const v=m instanceof Fze,b=()=>!!(l&&(!l.activeToken||nte()));return v&&!b()?a.jsxs("div",{role:"alert",className:ft.empty,children:[a.jsx("p",{children:o("files.loadFailed")}),a.jsx("p",{children:o("files.reloadUnavailable")}),a.jsx(Ze,{onClick:r,children:o("files.close")})]}):a.jsx(H3e,{error:m,language:i,retryMode:v?"reload":"reset",onRetry:v?()=>{b()?window.location.reload():r()}:g})};return a.jsx(Sp,{label:"workspace file browser",fallback:p,children:a.jsx(d.Suspense,{fallback:a.jsx("div",{className:ft.empty,children:o("common.loading")}),children:a.jsx(c,{workspaceCwd:e.workspaceCwd,actions:f,onOpenPreview:m=>n(m,e.workspaceCwd,e.workspaceId),onReferenceFile:e.workspaceCwd===t?s:void 0,renderPreview:(m,g,v)=>a.jsx(yM,{workspacePath:m,workspaceActions:f,previewKind:g?"source":void 0,sourceRenderer:b=>a.jsx(Sp,{label:"workspace file source",resetKeys:[m],fallback:p,children:a.jsx(d.Suspense,{fallback:a.jsx("div",{className:ft.empty,children:o("common.loading")}),children:a.jsx(u,{path:m,content:b})})})},`${m}:${g}:${v}`)},`${e.workspaceCwd}:${e.workspaceId??""}`)})})}function s_e({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:o,panelWidth:i,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onSelectTurnCallsPrompt:p,onCloseTab:m,onOpenFilePreview:g,latestReviewAvailable:v=!1,onOpenLatestReview:b,onOpenTerminal:w,onOpenTrajectory:y,trajectoryTabId:x,onOpenFiles:_,onReferenceFile:S,onOpenWebPreview:I,onWebPreviewChange:E,items:N=dzn,sideTaskAvailable:T=!1,sideTasks:j=[],sideTasksLoading:C=!1,onCreateSideTask:A,onOpenSideTask:R,onCreateSideTaskSession:P,onSideTaskCreated:M,onSideTaskTitleChange:$,onSideTaskInitialPromptRefused:L,onNestedRightPanelOpen:F,onNestedArtifactsChange:H,onOpenNestedSubagent:D,agentTasks:U=[],agentTraceLoading:J=!1,agentTraceError:B,onOpenWorkflowAgent:oe,onError:K,sessionWorkflowEnabled:ie,modelManagement:z,workflow:Y,onImageIngestionNotice:ee,deferSubagentMount:q=!1,onClose:ne,variant:X="docked",fullscreen:he=!1,onToggleFullscreen:pe}){const{t:ue}=dt(),V=Kr(),de=WA(V.capabilities,l),[ke,Te]=d.useState(!1),[Qe,st]=d.useState(),Pe=d.useRef(null),He=d.useCallback(()=>{Pe.current&&(clearTimeout(Pe.current),Pe.current=null),Te(!0)},[]),Ve=d.useCallback(()=>{Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(()=>{Te(!1),Pe.current=null},120)},[]);d.useEffect(()=>()=>{Pe.current&&clearTimeout(Pe.current)},[]);const Q=n.find(Ne=>Ne.id===s)??n[0],Z=Q?.kind==="file"&&Q.sourcePreview&&(/\.html?$/i.test(Q.workspacePath)||yw(Q.previewMimeType||Q.previewData?.type)==="text/html"),se=Q?.kind==="file"&&Q.previewOnly===!0&&!Z&&/\.(?:html?|md|markdown)$/i.test(Q.workspacePath)&&(Q.previewContent!==void 0||!Q.previewData||!!bR(Q.previewMimeType||Q.previewData.type,Q.workspacePath)),ye=Qe===Q?.id,ge=N.includes("review")&&!n.some(Ne=>gy(Ne)==="review"),ve=N.includes("sideTask")&&T&&!!A,G=!!w,xe=N.includes("webPreview")&&!!I,Se=N.includes("trajectory")&&!!y&&!n.some(Ne=>Ne.id===x),_e=N.includes("files")&&!!_&&!n.some(Ne=>Ne.kind==="files"&&Ne.workspaceCwd===l&&Ne.workspaceId===de?.id),Be=!!Q&&(_e||ge||ve||G||xe||Se),ct=Q&&n_e(Q)?{workspaceCwd:Q.workspaceCwd,workspaceId:Q.workspaceId}:void 0,Ce=PC(ct?.workspaceCwd),lt=Ce?.workspaceId===ct?.workspaceId?Ce?.actions:void 0,qe=Q?.kind==="artifact"?t.find(Ne=>Ne.id===Q.artifactId):void 0;return a.jsxs("aside",{className:`${ft.panel} ${X==="drawer"?ft.panelDrawer:""} ${he?ft.panelFullscreen:""}`,style:X==="docked"&&i&&!he?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:ft.header,children:[n.length>0&&a.jsx("div",{className:ft.tabs,role:"tablist","aria-label":"Right panel",children:n.map(Ne=>a.jsxs("div",{className:[ft.tabItem,Ne.id===Q?.id?ft.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":Ne.id===Q?.id,className:ft.tab,onClick:()=>f(Ne.id),onMouseEnter:yt=>PS(yt.currentTarget),onFocus:yt=>PS(yt.currentTarget),title:Ne.kind==="turn_calls"?ue("turnCalls.title"):Ne.title,children:[a.jsx("span",{className:`${ft.tabIcon} ${gy(Ne)==="artifact"?ft.tabArtifactIcon:""}`,"aria-hidden":"true",children:gy(Ne)==="review"?a.jsx(XG,{}):Ne.kind==="files"?a.jsx(PA,{className:ft.tabIconSvg}):Ne.kind==="workflow"?a.jsx(fNe,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="file"?a.jsx(L0,{name:Ne.workspacePath,className:ft.tabIconSvg,strokeWidth:1.6}):gy(Ne)==="artifact"?a.jsx(YNe,{artifact:t.find(yt=>"artifactId"in Ne&&yt.id===Ne.artifactId),className:ft.tabIconSvg}):gy(Ne)==="subagent"?a.jsx(fzn,{}):gy(Ne)==="monitor"?a.jsx(xNe,{className:ft.tabIconSvg,strokeWidth:1.6}):gy(Ne)==="shell"?a.jsx(qT,{className:ft.tabIconSvg,strokeWidth:1.6}):gy(Ne)==="side_task"?a.jsx(H8,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="web_preview"?a.jsx(mI,{className:ft.tabIconSvg}):Ne.kind==="terminal"?a.jsx(qT,{className:ft.tabIconSvg,strokeWidth:1.6}):gy(Ne)==="image"?a.jsx(ymt,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="context_usage"?a.jsx(FB,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="token_usage"?a.jsx(gse,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="turn_calls"?a.jsx(X3,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="trajectory"?a.jsx(AU,{className:ft.tabIconSvg,strokeWidth:1.6}):a.jsx(mzn,{})}),a.jsx("span",{className:ft.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:ft.tabTitleInner,children:Ne.kind==="turn_calls"?ue("turnCalls.title"):Ne.title})})]}),a.jsx("button",{type:"button",className:ft.tabCloseButton,onClick:()=>m(Ne.id),"aria-label":`Close ${Ne.kind==="turn_calls"?ue("turnCalls.title"):Ne.title}`,title:"Close",children:a.jsx(pzn,{})})]},Ne.id))}),a.jsxs("div",{className:ft.headerActions,children:[Be&&a.jsxs(Fg,{modal:!1,children:[a.jsx(Sm,{asChild:!0,children:a.jsx("button",{type:"button",className:`${ft.iconButton} ${ft.addButton}`,"aria-label":ue("rightPanel.add"),title:ue("rightPanel.add"),children:a.jsx(bh,{className:ft.toolbarIcon})})}),a.jsxs(Cm,{align:"end",className:"w-64",children:[_e&&a.jsxs(Eo,{onSelect:_,children:[a.jsx(PA,{}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("files.title")})]}),ge&&a.jsxs(Eo,{disabled:!v||!b,onSelect:b,children:[a.jsx(XG,{}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("turnOutputs.review")})]}),ge&&ve&&a.jsx(fw,{}),ve&&a.jsxs(Eo,{disabled:C,onSelect:A,children:[a.jsx(H8,{className:ft.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("sideTask.create")})]}),G&&(ge||ve)&&a.jsx(fw,{}),G&&a.jsxs(Eo,{onSelect:()=>w?.(),children:[a.jsx(qT,{className:ft.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("terminal.title")})]}),xe&&a.jsxs(Eo,{onSelect:I,children:[a.jsx(mI,{className:ft.sideTaskNewIcon}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("webPreview.title")})]}),Se&&a.jsxs(Eo,{onSelect:()=>y?.(),children:[a.jsx(AU,{className:ft.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("trajectory.title")})]})]})]}),pe&&a.jsx("button",{type:"button",className:`${ft.iconButton} ${ft.fullscreenButton} ${he?ft.iconButtonActive:""}`,onClick:pe,"aria-label":ue(he?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":he,title:ue(he?"common.exitFullscreen":"common.fullscreen"),children:he?a.jsx(xse,{className:ft.toolbarIcon,"aria-hidden":!0}):a.jsx(pse,{className:ft.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${ft.iconButton} ${ft.panelToggleButton}`,onClick:ne,"aria-label":ue("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:ue("chatHeader.toggleRightPanel"),children:a.jsx(pNe,{className:ft.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${ft.body} ${Q?.kind==="side_task"||Q?.kind==="files"?ft.bodySideTask:""}`.trim(),children:[n.filter(Ne=>Ne.kind==="web_preview").map(Ne=>a.jsx("div",{className:"h-full",hidden:Ne.id!==Q?.id,children:a.jsx(gOn,{state:Ne,onChange:yt=>E?.(Ne.id,yt)})},Ne.id)),n.filter(Ne=>Ne.kind==="files").map(Ne=>a.jsx("div",{className:"h-full",hidden:Ne.id!==Q?.id,children:a.jsx(hzn,{onClose:()=>m(Ne.id),tab:Ne,workspaceCwd:l,onOpenFilePreview:g,onReferenceFile:S})},Ne.id)),n.filter(Ne=>Ne.kind==="terminal").map(Ne=>a.jsx("div",{className:`${ft.terminalPane} ${Ne.id===Q?.id?"":ft.terminalPaneHidden}`.trim(),"aria-hidden":Ne.id===Q?.id?void 0:!0,children:a.jsx(mOn,{terminalId:Ne.id,cwd:Ne.workspaceCwd??l,active:Ne.id===Q?.id,enabled:Ne.initialized!==!1})},Ne.id)),se&&a.jsxs("button",{type:"button",className:ft.attachmentPreviewButton,onClick:()=>st(ye?void 0:Q?.id),"aria-label":ue(ye?"attachment.showSource":"attachment.showPreview"),"aria-pressed":ye,children:[ye?a.jsx(lpt,{"aria-hidden":!0}):a.jsx(nNe,{"aria-hidden":!0}),ue(ye?"attachment.showSource":"attachment.showPreview")]}),u&&!Q?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":ue("common.loading"),children:[a.jsx(Yv,{className:"h-5 w-2/5"}),a.jsx(Yv,{className:"h-32 w-full"}),a.jsx(Yv,{className:"h-4 w-4/5"}),a.jsx(Yv,{className:"h-4 w-3/5"})]}):Q?.kind==="terminal"||Q?.kind==="web_preview"||Q?.kind==="files"?null:Q?Q.kind==="pending"?a.jsx("div",{className:ft.empty,role:Q.loadError?"alert":"status",children:Q.loadError??ue("common.loading")}):Q.kind==="workflow"?Q.sessionId?a.jsx(p9n,{tasks:U,loading:J,error:B,onOpenAgent:oe}):Y?a.jsx(Q9n,{...Y}):a.jsx("div",{className:ft.empty,children:ue("workflow.empty.title")}):n_e(Q)&&(Q.kind!=="scheduled_task"||Q.task.durable)&&(Q.kind!=="file"||!Q.previewOnly)&&(Q.kind!=="artifact"||qe?.metadata?.artifactType!=="web_preview_snapshot")&&!lt?a.jsx("div",{className:ft.empty,role:"alert",children:ue("workspace.notFoundDescription")}):Q.kind==="review"?a.jsx(wzn,{changes:Q.changes??r,selectedPath:Q.selectedPath??o,workspaceCwd:Q.workspaceCwd??l,onOpenFilePreview:Ne=>g(Ne,Q.workspaceCwd??l,Q.workspaceId),onDownloadFile:(Ne,yt)=>WB(lt,Ne.path,Ivt(Ne.path),yt),onDownloadError:Ne=>{const yt=ue("common.downloadFailed",{message:kl(Ne)});K?K(new Error(yt,{cause:Ne}),yt):console.error(yt,Ne)}}):Q.kind==="file"?Q.attachmentId&&!Q.previewData&&Q.previewContent===void 0?a.jsx("div",{className:ft.empty,role:Q.loadError?"alert":"status",children:Q.loadError??ue("common.loading")}):Q.sourcePreview&&Q.previewData&&!E5(Q.workspacePath,Q.previewMimeType||Q.previewData.type)&&yw(Q.previewMimeType||Q.previewData.type)!=="application/pdf"&&!bR(Q.previewMimeType||Q.previewData.type,Q.workspacePath)?a.jsx(yae,{data:Q.previewData,title:Q.title,image:!!Jx(Q.workspacePath)&&Q.previewData.type.startsWith("image/")}):a.jsx(yM,{workspacePath:Q.workspacePath,artifactVersion:String(Q.previewVersion??0),workspaceActions:lt,previewContent:Q.previewContent,previewData:Q.previewData,previewMimeType:Q.previewMimeType,previewOnly:Q.previewOnly,previewKind:Z||Q.previewOnly&&!ye?"source":void 0},Q.id):Q.kind==="source"?a.jsx(Pzn,{tab:Q},Q.id):Q.kind==="artifact"?a.jsx(gzn,{artifacts:t,artifactId:Q.artifactId,sourceSessionId:Q.sourceSessionId,workspaceActions:lt,previewContent:Q.previewContent,loading:c,error:h},Q.id):Q.kind==="subagent"?q?null:a.jsx(XPn,{sessionId:Q.sessionId,rootToolCallId:Q.rootToolCallId,initialRootTool:Q.rootTool,workspaceCwd:Q.workspaceCwd??l,onRightPanelOpen:F,onArtifactsChange:H,onOpenSubagent:D,onError:K}):Q.kind==="monitor"?a.jsx(ROt,{task:Q.task,actions:Q.sessionActions},Q.id):Q.kind==="shell"?a.jsx(EOt,{task:Q.task,actions:Q.sessionActions},Q.id):Q.kind==="side_task"?a.jsx(g9n,{tabId:Q.id,sessionId:Q.sessionId,parentSessionId:Q.parentSessionId,workspaceCwd:Q.workspaceCwd??l,title:Q.title,shouldNameFromFirstPrompt:Q.nameFromFirstPrompt,initialPrompt:Q.initialPrompt,createSession:P??czn,onCreated:M??azn,onTitleChange:$??lzn,onInitialPromptRefused:L,onRightPanelOpen:F,onArtifactsChange:H,onError:K,sessionWorkflowEnabled:ie,modelManagement:z,onImageIngestionNotice:ee},Q.id):Q.kind==="image"?Q.src?a.jsxs("div",{className:ft.imagePreviewWrap,children:[a.jsx("img",{src:Q.src,alt:Q.alt??Q.title,className:ft.imagePreview}),a.jsx("a",{className:ft.imageDownloadButton,href:Q.src,download:uzn(Q.src),"aria-label":ue("common.download"),title:ue("common.download"),children:a.jsx(tb,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:ft.empty,role:Q.loadError?"alert":"status",children:Q.loadError??ue("common.loading")}):Q.kind==="context_usage"?a.jsx(ezn,{controls:e?.[Q.sessionId],sessionActions:Q.sessionActions,sessionId:Q.sessionId},Q.id):Q.kind==="trajectory"?a.jsx(VFn,{loadPage:Q.loadPage,historyGapRevision:Q.historyGapRevision},Q.id):Q.kind==="token_usage"?a.jsx(s$n,{sessionActions:Q.sessionActions,sessionId:Q.sessionId},Q.id):Q.kind==="turn_calls"?a.jsx(O5n,{turnId:Q.turnId,ownerSessionId:Q.sessionId,recordId:Q.recordId,promptId:Q.promptId,promptLabel:Q.promptLabel,onSelectPrompt:p,workspaceCwd:l,onOpenFile:F,onOpenAgent:D},`${Q.sessionId}:${l}`):a.jsx(vzn,{task:Q.task,actions:lt},Q.id):a.jsxs("div",{className:ft.emptyActions,"data-testid":"right-panel-empty-actions",children:[N.includes("files")&&a.jsxs("button",{type:"button",className:ft.emptyAction,disabled:!_,onClick:_,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(PA,{})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("files.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("files.description")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),N.includes("review")&&a.jsxs("button",{type:"button",className:ft.emptyAction,disabled:!v||!b,onClick:b,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(XG,{})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("turnOutputs.review")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("turnOutputs.reviewLatest")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),N.includes("sideTask")&&T&&A&&(j.length===0?a.jsxs("button",{type:"button",className:ft.emptyAction,disabled:C,"aria-busy":C,onClick:A,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(H8,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("sideTask.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("sideTask.description")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Fg,{open:ke,onOpenChange:Te,modal:!1,children:[a.jsx(Sm,{asChild:!0,children:a.jsxs("button",{type:"button",className:ft.emptyAction,"aria-expanded":ke,onMouseEnter:He,onMouseLeave:Ve,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(H8,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("sideTask.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("sideTask.description")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Cm,{align:"end",className:"w-80",onMouseEnter:He,onMouseLeave:Ve,children:[j.map(Ne=>a.jsxs(Eo,{onSelect:()=>R?.(Ne),children:[a.jsx("span",{className:ft.sideTaskListTitle,children:Ne.title}),Ne.updatedAt&&a.jsx("span",{className:ft.sideTaskListTime,children:xR(Ne.updatedAt,ue)})]},Ne.sessionId)),a.jsx(fw,{}),a.jsxs(Eo,{onSelect:A,children:[a.jsx(Zft,{className:ft.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("sideTask.new")})]})]})]})),xe&&a.jsxs("button",{type:"button",className:ft.emptyAction,"data-testid":"right-panel-open-web-preview",onClick:I,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(mI,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("webPreview.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("webPreview.openHint")}),a.jsx(qa,{className:ft.emptyActionChevron,"aria-hidden":"true"})]}),Se&&a.jsxs("button",{type:"button",className:ft.emptyAction,onClick:()=>y?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(AU,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("trajectory.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("trajectory.description")}),a.jsx(qa,{className:ft.emptyActionChevron,"aria-hidden":"true"})]}),w&&a.jsxs("button",{type:"button",className:ft.emptyAction,onClick:()=>w(),children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(qT,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("terminal.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("terminal.open")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function fzn(){return a.jsxs("svg",{className:ft.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M6.5 19c.7-3.1 2.5-4.7 5.5-4.7s4.8 1.6 5.5 4.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function pzn(){return a.jsx("svg",{className:ft.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function XG(){return a.jsxs("svg",{className:ft.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),a.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function mzn(){return a.jsxs("svg",{className:ft.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gzn({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:o,error:i}){const l=e.find(c=>c.id===t);return l?a.jsx(Ezn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:ft.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:ft.empty,children:i}):a.jsx("div",{className:ft.empty,children:"Artifact not found."})}function vzn({task:e,actions:t}){const{t:n}=dt(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>V1(e.cron)),[v,b]=d.useState(!1),[w,y]=d.useState(!1),[x,_]=d.useState(!1),[S,I]=d.useState(!1),[E,N]=d.useState(null),T=d.useRef(0),j=d.useRef(0),C=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});C.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const A=d.useCallback((q,ne,X,he)=>{const pe=C.current;return q===T.current&&pe.actions===ne&&pe.taskId===X&&pe.workspaceId===he},[]),R=d.useCallback((q,ne,X,he)=>{const pe=C.current;return q===j.current&&pe.actions===ne&&pe.taskId===X&&pe.workspaceId===he},[]);d.useEffect(()=>()=>{T.current+=1,j.current+=1},[]),d.useEffect(()=>{_(!1),I(!1),N(null)},[t,e.id,e.workspaceId]);const P=d.useCallback(async()=>{const q=++T.current,ne=++j.current,X=e.id,he=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(V1(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const pe=await t.listScheduledTasks(he);if(!A(q,t,X,he))return;const ue=pe.find(V=>V.id===e.id)??null;r(ue),ue?(h(ue.name??""),p(ue.prompt),g(V1(ue.cron))):(h(""),p(e.prompt),g(V1(e.cron)))}catch(pe){R(ne,t,X,he)&&c(pe instanceof Error?pe.message:String(pe))}finally{R(ne,t,X,he)&&i(!1)}},[t,R,A,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{P()},[P]);const M=!e.durable,$=e.durable&&!o&&!l&&!s,L=!!s,F=s?.name||s?.prompt||e.title,H=s?.prompt??e.prompt,D=s?.cron??e.cron,U=s?.recurring??e.recurring,J=s?.enabled,B=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(V1(s.cron)),N(null),b(!0))},[s]),oe=d.useCallback(()=>{b(!1),N(null),s&&(h(s.name??""),p(s.prompt),g(V1(s.cron)))},[s]),K=d.useCallback(async()=>{if(!s||!t)return;const q=SD(m);if(!q){N(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){N(n("scheduledTasks.error.emptyPrompt"));return}const ne=++T.current,X=e.id,he=e.workspaceId;I(!0),N(null);try{const pe=await t.updateScheduledTask(s.id,{cron:q,prompt:f.trim(),name:u.trim()||null},he);if(!A(ne,t,X,he))return;r(pe),h(pe.name??""),p(pe.prompt),g(V1(pe.cron)),b(!1)}catch(pe){A(ne,t,X,he)&&N(pe instanceof Error?pe.message:String(pe))}finally{A(ne,t,X,he)&&I(!1)}},[t,m,A,s,u,f,n,e.id,e.workspaceId]),ie=d.useCallback(async()=>{if(!s||!t)return;const q=++T.current,ne=e.id,X=e.workspaceId;_(!0),N(null);try{const he=await t.updateScheduledTask(s.id,{enabled:!s.enabled},X);if(!A(q,t,ne,X))return;r(he)}catch(he){A(q,t,ne,X)&&N(he instanceof Error?he.message:String(he))}finally{A(q,t,ne,X)&&_(!1)}},[t,A,s,e.id,e.workspaceId]),z=d.useCallback(async()=>{if(!s||!t)return;const q=++T.current,ne=e.id,X=e.workspaceId;_(!0),N(null);try{if(await t.deleteScheduledTask(s.id,X),!A(q,t,ne,X))return;r(null),y(!1)}catch(he){A(q,t,ne,X)&&N(he instanceof Error?he.message:String(he))}finally{A(q,t,ne,X)&&_(!1)}},[t,A,s,e.id,e.workspaceId]),Y=SD(m),ee=Y?JI(Y,n):null;return a.jsxs("div",{className:ft.detail,children:[o&&a.jsx("div",{className:ft.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Jt.loadError,children:l}),$&&a.jsx("div",{className:ft.empty,children:n("scheduledTasks.deletedSnapshot")}),M&&a.jsx("div",{className:ft.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!$&&a.jsx("div",{className:ft.section,children:a.jsxs("div",{className:ft.fieldGrid,children:[a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:ft.fieldValue,children:F}),a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:ft.fieldValue,children:e.id}),a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:ft.fieldValue,children:JI(D,n)}),a.jsx("span",{className:ft.fieldLabel,children:"Cron"}),a.jsx("span",{className:ft.fieldValue,children:D}),a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:ft.fieldValue,children:n(U?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),J!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:ft.fieldValue,children:n(J?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!$&&a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:"Prompt"}),a.jsx("div",{className:ft.description,children:H})]}),E&&a.jsx("div",{className:Jt.formError,children:E}),a.jsxs("div",{className:ft.actionsRow,children:[a.jsx("button",{type:"button",className:Jt.primaryButton,disabled:!L||x,onClick:B,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Jt.secondaryButton,disabled:!L||x,onClick:()=>void ie(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Jt.secondaryButton,disabled:!L||x,onClick:()=>y(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(la,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>y(!1),children:a.jsxs("div",{className:Jt.formFields,children:[a.jsx("div",{className:ft.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),E&&a.jsx("div",{className:Jt.formError,children:E}),a.jsxs("div",{className:Jt.formActions,children:[a.jsx("button",{type:"button",className:Jt.secondaryButton,onClick:()=>y(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Jt.primaryButton,onClick:()=>void z(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(la,{title:n("scheduledTasks.editTitle"),size:"md",onClose:oe,children:a.jsxs("div",{className:Jt.formFields,children:[a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Jt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:q=>h(q.target.value)})]}),a.jsxs("label",{className:Jt.field,children:[a.jsxs("span",{className:Jt.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Jt.required,children:"*"})]}),a.jsx("textarea",{className:Jt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:q=>p(q.target.value)})]}),a.jsxs("div",{className:Jt.scheduleRow,children:[a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Jt.select,value:m.frequency,onChange:q=>{const ne=q.target.value;g(X=>({...X,frequency:ne,...ne==="hourly"?{time:"00:00"}:{}}))},children:ozn.map(q=>a.jsx("option",{value:q,children:n(`scheduledTasks.freq.${q}`)},q))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Jt.input,type:"time",value:m.time,onChange:q=>g(ne=>({...ne,time:q.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Jt.select,value:m.weekday,onChange:q=>g(ne=>({...ne,weekday:Number(q.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((q,ne)=>a.jsx("option",{value:ne,children:q},ne))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Jt.select,value:m.minuteInterval,onChange:q=>g(ne=>({...ne,minuteInterval:Number(q.target.value)})),children:izn.map(q=>a.jsx("option",{value:q,children:q},q))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Jt.field} ${Jt.fieldGrow}`,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Jt.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:q=>g(ne=>({...ne,customCron:q.target.value}))})]})]}),a.jsx("div",{className:Jt.preview,children:ee?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Jt.previewLabel,children:ee}),a.jsx("code",{className:Jt.previewCron,children:Y})]}):a.jsx("span",{className:Jt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),E&&a.jsx("div",{className:Jt.formError,children:E}),a.jsxs("div",{className:Jt.formActions,children:[a.jsx("button",{type:"button",className:Jt.secondaryButton,onClick:oe,disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Jt.primaryButton,onClick:()=>void K(),disabled:S,children:n(S?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function wzn({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=dt(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,p]=d.useState(!1),[m,g]=d.useState(520),v=d.useRef(m),b=d.useRef(null),w=d.useRef(null),[y,x]=d.useState(null),[_,S]=d.useState(()=>new Set),I=d.useRef(!0);d.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]);const E=l,N=d.useMemo(()=>Rzn(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const R=b.current;if(!R)return;const P=()=>{p(R.clientWidth<rzn)};P();const M=new ResizeObserver(P);return M.observe(R),()=>M.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const T=d.useCallback(R=>{const P=b.current;if(!P)return;R.preventDefault();const M=R.currentTarget;M.setPointerCapture(R.pointerId);const $=R.clientX,L=v.current,F=P.getBoundingClientRect().width,H=Math.max(180,F-180),D=document.body.style.cursor,U=document.body.style.userSelect;let J=L,B=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const oe=()=>{B=null,g(J)},K=Y=>{J=Math.min(H,Math.max(180,L+(Y.clientX-$))),B===null&&(B=window.requestAnimationFrame(oe))};let ie=()=>{};const z=Y=>{w.current=null,B!==null&&(window.cancelAnimationFrame(B),B=null),Y&&g(J),M.hasPointerCapture(R.pointerId)&&M.releasePointerCapture(R.pointerId),document.body.style.cursor=D,document.body.style.userSelect=U,window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",ie),window.removeEventListener("pointercancel",ie)};ie=()=>z(!0),w.current=()=>z(!1),window.addEventListener("pointermove",K),window.addEventListener("pointerup",ie),window.addEventListener("pointercancel",ie)},[]);if(e.length===0)return a.jsx("div",{className:ft.empty,children:"No file changes to review."});const j=R7e(e),C=R=>{x(P=>P===R?null:R)},A=async R=>{if(!_.has(R.path)){S(P=>new Set(P).add(R.path));try{await r(R,()=>!I.current)}catch(P){I.current&&o(P)}finally{S(P=>{const M=new Set(P);return M.delete(R.path),M})}}};return a.jsxs("div",{className:ft.review,children:[a.jsxs("div",{className:ft.reviewToolbar,children:[a.jsxs("div",{className:ft.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(wO,{additions:j?.additions,deletions:j?.deletions,className:ft.lineStats,additionsClassName:ft.additions,deletionsClassName:ft.deletions})]}),a.jsxs("div",{className:ft.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:ft.reviewTotalsButton,onClick:()=>h(R=>!R),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[ft.chevron,u?ft.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(o_e,{})})]}),a.jsx("button",{type:"button",className:[ft.iconButton,l?ft.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(R=>!R),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(Tzn,{}):a.jsx(Czn,{})})]})]}),u&&a.jsxs("div",{ref:b,className:[ft.reviewContent,E?"":ft.reviewContentListOnly,E&&f?ft.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[ft.reviewList,y?ft.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(R=>{const P=y===R.path,M=A7e(R.path),$=BYt(R.path);return a.jsxs("div",{className:[ft.reviewItem,P?ft.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:ft.reviewRow,"data-selected":R.path===t||void 0,children:[a.jsx("button",{type:"button",className:ft.reviewRowToggle,onClick:()=>C(R.path),"aria-label":R.path,"aria-expanded":P}),a.jsx("span",{className:ft.fileIcon,children:Wze(R.path)}),a.jsxs("span",{className:ft.reviewFileName,children:[a.jsx(kzn,{path:IF(R.path,n),title:R.path}),M&&a.jsx("button",{type:"button",className:ft.reviewOpenButton,onClick:()=>s(R),title:`${i("turnOutputs.preview")} ${R.path}`,children:i("turnOutputs.preview")}),$&&a.jsx("button",{type:"button",className:ft.reviewOpenButton,onClick:()=>void A(R),title:`${i("common.download")} ${R.path}`,disabled:_.has(R.path),children:i(_.has(R.path)?"common.downloading":"common.download")})]}),a.jsx(wO,{additions:R.additions,deletions:R.deletions,className:ft.lineStats,additionsClassName:ft.additions,deletionsClassName:ft.deletions}),a.jsx("span",{className:[ft.chevron,P?ft.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(o_e,{})})]}),P&&a.jsx(yzn,{change:R})]},`${R.toolCallId}:${R.path}`)})}),E&&!f&&a.jsx("div",{className:ft.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:T}),E&&a.jsx("div",{className:ft.tree,children:N.children.map(R=>a.jsx(qze,{node:R,depth:0,selectedPath:t},R.path))})]})]})}function yzn({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:ft.diffEmpty,children:"No diff available."});const t=bzn(e.diffs);return a.jsx("div",{className:ft.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(bF,{diff:n.fileDiff},s):a.jsx(xzn,{oldText:n.oldText,newText:n.newText},s))})}function bzn(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function xzn({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[o,i]=d.useState(null);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),d.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),i(null);let c=!1,u=null;const h=[_$e,ys.editable.of(!1),Ui.readOnly.of(!0),ys.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return nt(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-CKa6aZMZ.js");return{MergeView:m,unifiedMergeView:g}},[]).then(({MergeView:m,unifiedMergeView:g})=>{if(!c)try{if(s){u=new m({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:p,diffConfig:f});return}u=new ys({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||i(v instanceof Error?v.message:String(v))}}).catch(m=>{c||i(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:ft.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:ft.codeMirrorDiff}),o&&a.jsxs("div",{className:ft.diffError,children:["Diff unavailable: ",o]})]})}function qze({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[ft.treeRow,s?ft.treeFile:ft.treeFolder].filter(Boolean).join(" "),l={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ft.treeTwisty,children:!s&&a.jsx("span",{className:[ft.treeChevron,r?"":ft.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(Izn,{})})}),a.jsxs("span",{className:ft.treeContent,children:[s&&a.jsx("span",{className:ft.fileIcon,children:Wze(e.path)}),a.jsx("span",{className:ft.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:ft.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:ft.treeNode,children:[s?a.jsx("div",{className:i,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:i,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>o(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:ft.treeChildren,style:c,children:e.children.map(h=>a.jsx(qze,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function kzn({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>Hze(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(_zn(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:ft.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:ft.pathPrefix,children:s.prefix}),a.jsx("span",{className:ft.pathFileName,children:s.leaf})]})}function Hze(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let r_e=null;function _zn(e,t){const n=Hze(e),s=t.clientWidth;if(s<=0)return n;const r=Szn(t);if(r(e)<=s)return n;const o=e.split("/").filter(Boolean),i=o.at(-1)??e,l=r(i);if(o.length<=1||l+r(".../")>s)return{prefix:"",leaf:i};let c=".../";for(let u=1;u<o.length;u++){const f=`.../${o.slice(o.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:i}}function Szn(e){r_e??=document.createElement("canvas");const t=r_e.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),s=>t?.measureText(s).width??s.length*8}function Czn(){return a.jsxs("svg",{className:ft.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 7.5h6l1.6 2h9.4v8.2a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M3.5 7.5V5.8a1.5 1.5 0 0 1 1.5-1.5h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.6",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function Tzn(){return a.jsxs("svg",{className:ft.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 8.2V5.8A1.5 1.5 0 0 1 5 4.3h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.4",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M4.8 19.7h12.9a2 2 0 0 0 1.9-1.4l2-7H6.4l-2.8 7.1a.9.9 0 0 0 1.2 1.3Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function o_e(){return a.jsx("svg",{className:ft.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Izn(){return a.jsx("svg",{className:ft.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Rzn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=IF(s.path,t).split("/").filter(Boolean);let o=n;for(let i=0;i<r.length;i++){const l=r[i],c=r.slice(0,i+1).join("/");let u=o.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},o.children.push(u)),i===r.length-1&&(u.file=s),o=u}}return Uze(n),n}function Uze(e){e.children.sort((t,n)=>!!t.file!=!!n.file?t.file?1:-1:t.name.localeCompare(n.name));for(const t of e.children)Uze(t)}function iL(e){return eC(e).split("/").filter(Boolean).at(-1)??e}function Wze(e){const t=iL(e),n=t.includes(".")?t.split(".").pop()?.toLowerCase():"";return n?{css:"CSS",html:"HTML",js:"JS",json:"JSON",jsx:"JSX",md:"MD",ts:"TS",tsx:"TSX"}[n]??n.slice(0,3).toUpperCase():"FILE"}function Ezn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=dt(),o=Ap(),i=Rvt(e),l=KR(e.url)?e.url:void 0,c=e.metadata?.artifactType==="automation_snapshot",u=e.metadata?.artifactType==="code_review",h=e.storage==="workspace"&&!!e.workspacePath,f=UNe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(vOn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(jzn,{status:e.status}):!h||!e.workspacePath?a.jsx(Azn,{}):a.jsx(MPn,{workspacePath:e.workspacePath,artifactVersion:lme(e),workspaceActions:n}):h&&e.workspacePath?qNe(e)||E5(e.workspacePath,e.mimeType)&&e.status!=="available"&&e.status!=="changed"?a.jsx(Vze,{artifact:e,workspaceActions:n}):a.jsx(yM,{workspacePath:e.workspacePath,artifactVersion:lme(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,previewMimeType:e.mimeType,imageMimeType:f,previewKind:Nzn(e)?"html":Mzn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:ft.detail,children:[a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:ft.fieldGrid,children:[a.jsx(op,{label:"Type",value:Cse(e.kind,e.workspacePath)}),a.jsx(op,{label:"Storage",value:e.storage}),a.jsx(op,{label:"Status",value:e.status}),a.jsx(op,{label:"Source",value:e.source}),a.jsx(op,{label:"Size",value:UB(e.sizeBytes)}),a.jsx(op,{label:"Created",value:e.createdAt}),a.jsx(op,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(op,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(op,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:"Description"}),a.jsx("div",{className:ft.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:"Details"}),a.jsxs("div",{className:ft.fieldGrid,children:[Y2(e.metadata,"automationId","Automation ID"),Y2(e.metadata,"schedule","Schedule"),Y2(e.metadata,"timezone","Timezone"),Y2(e.metadata,"status","Status"),Y2(e.metadata,"nextRunAt","Next run"),Y2(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:ft.locationRow,children:[a.jsx("a",{className:ft.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:l}),a.jsx("a",{className:ft.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:ft.meta,children:i})]})]})}function jzn({status:e}){const{t}=dt();return a.jsx("div",{className:ft.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function Azn(){const{t:e}=dt();return a.jsx("div",{className:ft.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function Nzn(e){const t=e.workspacePath?.toLowerCase()??"",n=yw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function Mzn(e){const t=e.workspacePath?.toLowerCase()??"",n=yw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function Vze({artifact:e,workspaceActions:t}){const{t:n}=dt(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=e.workspacePath;d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await WB(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&i(!1)}}};return a.jsx("div",{className:ft.detail,children:a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:ft.fieldGrid,children:[a.jsx(op,{label:"Type",value:Cse(e.kind,e.workspacePath)}),a.jsx(op,{label:"Size",value:UB(e.sizeBytes)}),c?a.jsx(op,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(op,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:ft.downloadRow,children:a.jsx("button",{type:"button",className:ft.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:ft.previewError,children:s})]})})}function Pzn({tab:e}){const{t}=dt(),n=ua(),s=PC(e.workspaceCwd),r=s?.actions,o=Ap(),[i,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[p,m]=d.useState(),g=e.source,v=g.locator,b=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&v.type!=="workspace_file")&&(v.type!=="workspace_file"||g.workspaceCwd===n.workspaceCwd),w=v.type==="workspace_file"?v.workspacePath:v.type==="attachment"?v.attachmentId:"",y=/\.pdf$/i.test(w);if(d.useEffect(()=>{let _=!1;return u(void 0),f(void 0),m(void 0),!b||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const I=await e.sessionActions.readAttachment(v.attachmentId);if(_||!e.owner.isCurrent())return;const E=Uint8Array.from(atob(I.data),N=>N.charCodeAt(0));u(new Blob([E],{type:I.mimeType}))}else if(y&&r){const I=await BR(r.readFileBytes,w,"application/pdf",{statFile:r.stat,isCancelled:()=>_||!e.owner.isCurrent()});!_&&e.owner.isCurrent()&&u(I)}})().catch(I=>{!_&&e.owner.isCurrent()&&f(kl(I))}),()=>{_=!0})},[i,b,v,w,y,e.owner,e.sessionActions,r]),b&&v.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:g.title}),g.description&&a.jsx("p",{children:g.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:v.url}),KR(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:_=>o(_,v.url),children:t("sources.openOriginal")})]});if(!b||!s&&v.type!=="attachment")return a.jsx("div",{className:ft.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!y&&qNe({workspacePath:w});return a.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[a.jsx("span",{className:"truncate text-xs text-muted-foreground",title:w,children:w}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&a.jsx(Ze,{variant:"ghost",size:"icon-sm",asChild:!0,children:a.jsx("a",{href:p,download:g.title,"aria-label":`Download ${g.title}`,title:t("common.download"),children:a.jsx(tb,{})})}),h&&a.jsx(Ze,{variant:"ghost",size:"sm",onClick:()=>l(_=>_+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:ft.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Ze,{onClick:()=>void WB(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(_=>{e.owner.isCurrent()&&f(kl(_))}),children:t("common.download")})]}):(v.type==="attachment"||y)&&!c?a.jsx("div",{className:ft.empty,role:"status",children:t("common.loading")}):c&&!E5(w,c.type)&&c.type!=="application/pdf"&&!bR(c.type,w)?a.jsx(yae,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!Jx(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(yM,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||yw(c?.type)==="text/html"?"source":void 0},i)})]})}function yae({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[o,i]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return i(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),o?a.jsxs("div",{className:ft.imagePreviewWrap,children:[n?a.jsx("img",{className:ft.imagePreview,src:o,alt:t}):a.jsx(Gze,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(tb,{})})]}):null}function yM({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:o,previewMimeType:i,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h,sourceRenderer:f}){const{t:p}=dt();if(E5(e,i||o?.type))return a.jsx(Sp,{resetKeys:[e,n,o,t],fallback:a.jsxs("div",{children:[a.jsx("div",{role:"alert",className:ft.previewError,children:p("excel.invalid")}),o?a.jsx(yae,{data:o,title:e.split(/[/\\]/).pop(),image:!1}):n?a.jsx(Vze,{artifact:{workspacePath:e,kind:"document",mimeType:i,status:"available"},workspaceActions:n},e):null]}),children:a.jsx(d.Suspense,{fallback:a.jsx("div",{className:ft.empty,role:"status",children:p("common.loading")}),children:a.jsx(szn,{workspacePath:e,workspaceActions:n,data:o,artifactVersion:t})})});if(o)return a.jsx(Lzn,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const m=e.toLowerCase(),g=l??Jx(e),v=c??(m.endsWith(".html")||m.endsWith(".htm")?"html":m.endsWith(".md")||m.endsWith(".markdown")?"markdown":g?"image":"source");return v==="html"?a.jsx(Bzn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):v==="markdown"?a.jsx(zzn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):v==="image"&&g?a.jsx($zn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:g,onLoadError:h}):a.jsx(Kze,{sourceRenderer:f,workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function Lzn({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:o}){const i=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return i==="application/pdf"?a.jsx(Ozn,{data:n,mimeType:i,title:e}):bR(i,e)?a.jsx(Dzn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(Gze,{name:e,mimeType:i,size:n.size})}function Dzn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=dt(),[i,l]=d.useState(),[c,u]=d.useState();return d.useEffect(()=>{const h=new FileReader;return l(void 0),u(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=o("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,o]),c?a.jsx("div",{className:ft.previewError,children:c}):i===void 0?a.jsx("div",{className:ft.empty,children:o("attachment.loadingFile")}):a.jsx(yM,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function Ozn({data:e,mimeType:t,title:n}){const{t:s}=dt(),[r,o]=d.useState();return d.useEffect(()=>{const i=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return o(i),()=>URL.revokeObjectURL(i)},[e,t]),r?a.jsx("iframe",{className:ft.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:ft.empty,children:s("attachment.loadingPreview")})}function Gze({name:e,mimeType:t,size:n}){const{t:s}=dt();return a.jsxs("div",{className:ft.unsupportedAttachmentPreview,children:[a.jsx(L0,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:ft.unsupportedAttachmentMeta,children:[t," · ",UB(n)]})]})}function $zn({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[o,i]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return i(null),c(null),BR((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:ft.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:ft.imagePreview,src:o,alt:iL(e)}),a.jsx("a",{className:ft.imageDownloadButton,href:o,download:iL(e),"aria-label":`Download ${iL(e)}`,title:"Download",children:a.jsx(tb,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:ft.empty,children:"Loading image..."}),l&&a.jsx("div",{className:ft.previewError,children:l})]})}function bae({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,maxPreviewBytes:i}){const{t:l}=dt(),[c,u]=d.useState(s??null),[h,f]=d.useState(),[p,m]=d.useState(null);return d.useEffect(()=>{let g=!1;if(u(s??null),m(null),f(void 0),!r)return n.stat(e).then(v=>{if(!g){if(v.type==="directory")throw new Error("Directories cannot be opened as artifacts.");if(i!==void 0&&v.sizeBytes>i)throw new Error(l("files.sourceTooLarge"));return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async v=>{if(g||!v||!v.truncated)return v;const b=await BR((w,y)=>n.readFileBytes(w,y),e,"application/octet-stream",{statFile:w=>n.stat(w),isCancelled:()=>g,maxBytes:i});return{sizeBytes:b.size,content:new TextDecoder(v.encoding||"utf-8").decode(await b.arrayBuffer())}}).then(v=>{g||!v||(f(v.sizeBytes),u(v.content))}).catch(v=>{if(g)return;const b=v instanceof Error?v.message:String(v);m(b),o?.(b)}),()=>{g=!0}},[t,s,r,o,n,e,i,l]),{content:c,error:p,sizeBytes:h}}function Bzn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=bae({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:ft.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:ft.empty,children:"Loading preview..."}):a.jsx(Yze,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(Fzn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:ft.previewError,children:c})]})}function Fzn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=dt(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),Evt(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(kl(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:ft.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:ft.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:ft.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function Kze({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,sourceRenderer:i}){const l=d.useRef(null),[c,u]=d.useState(null),{content:h,error:f}=bae({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,maxPreviewBytes:i?4*1024*1024:void 0});return d.useEffect(()=>{const p=l.current;if(!p||h===null)return;p.replaceChildren(),u(null);let m;try{m=new ys({doc:h,extensions:[_$e,ys.editable.of(!1),Ui.readOnly.of(!0),ys.lineWrapping],parent:p})}catch(g){u(g instanceof Error?g.message:String(g));return}return()=>m.destroy()},[h,i]),a.jsxs("div",{className:ft.filePreviewWrap,children:[h===null?!f&&a.jsx("div",{className:ft.empty,children:"Loading file..."}):i?a.jsx("div",{className:ft.codeMirrorFile,children:i(h)}):a.jsx("div",{ref:l,className:ft.codeMirrorFile}),(f||c)&&a.jsx("div",{className:ft.previewError,children:f||c})]})}function Yze({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=dt(),[i,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=i===e;return a.jsxs("div",{className:"absolute inset-3 flex min-h-0 flex-col gap-2",children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[a.jsx("span",{children:o("artifact.longDocument")}),a.jsx(Ze,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:o(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(Kze,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function zzn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=bae({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:ft.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:ft.empty,children:"Loading preview..."}):a.jsx(Yze,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:ft.markdownPreviewWrap,children:a.jsx(Jh,{content:l})})}),c&&a.jsx("div",{className:ft.previewError,children:c})]})}function op({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ft.fieldLabel,children:e}),a.jsx("span",{className:ft.fieldValue,children:t})]}):null}function Y2(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(op,{label:n,value:String(s)},t)}/**
|
|
2614
|
+
`);return n===-1?t:t.slice(0,n)}function HFn(e,t){if(e.kind==="request"){const n=[Ca(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:Ca(e.timing.ttftMs)})),e.usage&&n.push(FFn(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(Ca(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:Ca(o)}))}return n}return[]}function YG(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Js.toneError;if(t==="cancelled"||t==="canceled")return Js.toneMuted}function oL(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:zS(e.block.text)};case"request":{const n=qFn(e),s=e.status==="error",r=n!==void 0?`${n}${e.model?` · ${e.model}`:""}`:e.model??t("trajectory.request");return{badge:n!==void 0?t("trajectory.badge.subagent"):`#${e.requestIndex??"?"}`,...s?{badgeTone:Js.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:zS(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...YG(e)?{badgeTone:YG(e)}:{},text:`${e.block.title||(e.block.toolName??"")}${YG(e)===Js.toneError?` · ${t("trajectory.toolFailed")}`:""}`};default:return UFn(e.block,t)}}function UFn(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:zS(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:zS(e.command||e.text)};case"permission":return{badge:t("trajectory.badge.permission"),text:e.title||e.toolName||""};case"status":case"error":case"debug":return{badge:t("trajectory.badge.status"),...e.kind==="error"?{badgeTone:Js.toneError}:{},text:zS(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Js.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function WFn(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function VFn({loadPage:e,historyGapRevision:t=0}){const{t:n}=dt(),{trajectory:s,lifecycle:r,status:o,error:i,loadedPages:l,windowPages:c,truncated:u,olderFailure:h,refresh:f,retry:p,older:m,newer:g,mode:v,navigationVersion:b,navigationError:w,canRefresh:y,canOlder:x,canNewer:_,historyReleased:S,bookmarks:I}=g$n(e),[E,N]=d.useState({loader:e,revision:0}),T=d.useRef(void 0),j=d.useCallback(()=>{T.current={revision:t,trajectory:s},f()},[t,s,f]);d.useEffect(()=>{T.current=void 0},[e]),d.useEffect(()=>{const Ke=T.current;Ke&&o!=="loading"&&i?T.current=void 0:Ke&&o==="ready"&&s!==Ke.trajectory&&(N({loader:e,revision:Ke.revision}),T.current=void 0)},[o,s,i,e]);const C=t>(E.loader===e?E.revision:0),A=d.useRef(null),R=d.useRef(!1),P=d.useRef(!1),[M,$]=d.useState({loader:e,version:b,selectionLost:!1}),[L,F]=d.useState({loader:e,value:M9,scope:0});L.loader!==e&&F({loader:e,value:M9,scope:L.scope+1});const H=L.loader===e?L.value:M9,D=d.useCallback(Ke=>{F(Le=>Le.loader===e&&Le.value.query===Ke.query&&Le.value.type===Ke.type&&Le.value.status===Ke.status?Le:{loader:e,value:Ke,scope:Le.scope})},[e]),U=d.useCallback(()=>D(M9),[D]),J=e_e(H),B=d.useMemo(()=>s?BFn(s):void 0,[s]),oe=d.useMemo(()=>B?Jke(B,H):[],[B,H]),K=d.useMemo(()=>new Set(oe),[oe]),[ie,z]=d.useState(void 0),[Y,ee]=d.useState(),[q,ne]=d.useState(!1);d.useEffect(()=>{ne(!1),ee(void 0)},[e]),d.useEffect(()=>{Y?.of&&s&&Y.of!==s&&ee({...Y,of:void 0})},[Y,s]);const X=d.useRef(null),he=d.useRef(!1),pe=d.useRef(0),ue=d.useId(),V=d.useCallback(Ke=>`${ue}-row-${Ke}`,[ue]),de=d.useCallback((Ke,Le)=>{Ke.scrollTop=Le,pe.current=Ke.scrollTop},[]),ke=d.useRef(void 0),[Te,Qe]=d.useState("active"),st=d.useMemo(()=>s?Dze(s,{mode:Te}):void 0,[s,Te]),Pe=mFn(st),He=d.useMemo(()=>new Map(st?.spans.map(Ke=>[Ke.row.key,Ke])),[st]),[Ve,Q]=d.useState(void 0),Z=Ve!==void 0&&Ve.of===s&&Ve.mode===Te?Ve.range:void 0,se=d.useCallback(Ke=>{Q(Ke!==void 0&&s!==void 0?{range:Ke,of:s,mode:Te}:void 0)},[s,Te]);d.useEffect(()=>{Ve&&(Ve.of!==s||Ve.mode!==Te)&&Q(void 0)},[Ve,s,Te]);const ye=d.useMemo(()=>Z&&st?Oze(st,Z):void 0,[Z,st]),ge=d.useMemo(()=>s?hFn(s):void 0,[s]),[ve,G]=d.useState(),xe=d.useMemo(()=>!ge||!ve||ve.loader!==e?new Set:ve.of===ge?ve.keys:new Set([...ve.keys].filter(Ke=>{const Le=ge.groupIdentities.get(Ke);return Le!==void 0&&Le===ve.of.groupIdentities.get(Ke)})),[ve,ge,e]);d.useEffect(()=>{ve&&(ve.of!==ge||ve.loader!==e)&&G(ge?{of:ge,loader:e,keys:xe}:void 0)},[ve,ge,e,xe]);const Se=d.useMemo(()=>oe.filter(Ke=>!ye||ye.has(Ke)),[oe,ye]),_e=d.useMemo(()=>J?new Set(Se):ye,[J,Se,ye]),Be=KG(H,Z,Te),[ct,Ce]=d.useState(),lt=d.useMemo(()=>ct?.of===s&&ct?.loader===e&&ct?.signature===Be?ct.overrides:new Map,[ct,s,e,Be]);d.useEffect(()=>{ct&&(!J||ct.of!==s||ct.loader!==e||ct.signature!==Be)&&Ce(void 0)},[ct,J,s,e,Be]);const qe=d.useMemo(()=>{if(!J)return xe;const Ke=new Set(xe);for(const Le of Se)for(const Ie of ge?.ancestors.get(Le)??[])Ke.delete(Ie);for(const[Le,Ie]of lt)Ie?Ke.add(Le):Ke.delete(Le);return Ke},[J,xe,Se,ge,lt]),Ne=d.useMemo(()=>ge?fFn(ge,_e):[],[ge,_e]),yt=d.useMemo(()=>new Set(Ne.map(Ke=>Ke.key)),[Ne]),Ye=d.useMemo(()=>ge?pFn(ge,Ne,qe):[],[ge,Ne,qe]),Et=d.useMemo(()=>new Set(Ye.map(Ke=>Ke.key)),[Ye]),Bt=ge&&ie?Yke(ge,ie,Et):void 0,nn=d.useMemo(()=>{const Ke=new Map;for(const Le of Ne)if(Le.kind==="row")for(const Ie of ge?.ancestors.get(Le.key)??[])Ke.set(Ie,(Ke.get(Ie)??0)+1);return Ke},[ge,Ne]),ln=n5e({count:Ye.length,getScrollElement:()=>X.current,getItemKey:Ke=>Ye[Ke]?.key??Ke,estimateSize:()=>kj,overscan:12}),xn=d.useCallback(Ke=>{if(!s||!ge?.groups.has(Ke))return;const Le=X.current;if(Le){const xt=Math.min(Ye.length-1,Math.floor(Le.scrollTop/kj)),wt=Ye[xt];wt&&(ke.current={key:wt.key,offset:Le.scrollTop-xt*kj})}const Ie=new Set(qe);if(Ie.has(Ke)?Ie.delete(Ke):Ie.add(Ke),J){const xt=new Map(lt);xt.set(Ke,Ie.has(Ke)),Ce({of:s,loader:e,signature:Be,overrides:xt})}else G({of:ge,loader:e,keys:Ie});X.current?.focus({preventScroll:!0})},[s,ge,Ye,qe,e,J,Be,lt]);d.useLayoutEffect(()=>{const Ke=ke.current;if(!Ke||!ge||!X.current)return;ke.current=void 0;const Le=Yke(ge,Ke.key,Et),Ie=Ye.findIndex(xt=>xt.key===Le);Ie>=0&&de(X.current,Ie*kj+Ke.offset)},[ge,Ye,Et,de]);const wn=Ye.length>0;d.useLayoutEffect(()=>{const Ke=X.current;if(!Ke||typeof ResizeObserver>"u")return;let Le=0;const Ie=()=>{Ke.scrollTop===0&&pe.current>0&&(Ke.scrollTop=pe.current)},xt=new ResizeObserver(()=>{Ie(),Le=requestAnimationFrame(Ie)});return xt.observe(Ke),()=>{xt.disconnect(),Le!==0&&cancelAnimationFrame(Le)}},[wn]),d.useEffect(()=>{if(o!=="ready"||he.current||Ye.length===0)return;he.current=!0;const Ke=X.current;Ke&&de(Ke,Ke.scrollHeight)},[de,o,Ye.length]);const rt=d.useMemo(()=>Bt===void 0?-1:Ye.findIndex(Ke=>Ke.key===Bt),[Bt,Ye]),mt=d.useRef(rt);mt.current=rt,d.useLayoutEffect(()=>{const Ke=mt.current;if(!q||Ke<0)return;const Le=requestAnimationFrame(()=>{ln.scrollToIndex(Ke,{align:"auto"})});return()=>cancelAnimationFrame(Le)},[q,ln]);const Ue=d.useCallback(Ke=>{if(Ye.length===0)return;const Le=Math.min(Math.max(Ke,0),Ye.length-1),Ie=Ye[Le].key;z(Ie),q&&s&&e&&ee({of:s,loader:e,key:Ie}),ln.scrollToIndex(Le,{align:"auto"})},[q,e,s,ln,Ye]),Pt=d.useCallback((Ke,Le=!0)=>{z(Ke),q&&s&&e&&ee({of:s,loader:e,key:Ke}),Le&&X.current?.focus({preventScroll:!0})},[q,s,e]),_t=d.useCallback((Ke=ie)=>{!s||!e||!Ke||s.rowIndexByKey.has(Ke)&&(ee({of:s,loader:e,key:Ke}),z(Ke),ne(!0))},[s,e,ie]),an=d.useCallback(()=>{ne(!1),ee(void 0),X.current?.focus({preventScroll:!0})},[]),Cn=d.useCallback(Ke=>{if(Ke.key==="Escape"){Z!==void 0&&(Ke.preventDefault(),se(void 0));return}if(Ye.length===0)return;if(Ke.key==="Enter"){Ke.preventDefault(),Bt&&(Pt(Bt),_t(Bt));return}if((Ke.key==="ArrowLeft"||Ke.key==="ArrowRight")&&Bt&&ge?.groups.has(Bt)&&(nn.get(Bt)??0)>0){const Ie=Ke.key==="ArrowLeft";qe.has(Bt)!==Ie&&(Ke.preventDefault(),xn(Bt));return}const Le=rt<0?-1:rt;Ke.key==="ArrowDown"?(Ke.preventDefault(),Ue(Le+1)):Ke.key==="ArrowUp"?(Ke.preventDefault(),Ue(Le<=0?0:Le-1)):Ke.key==="Home"?(Ke.preventDefault(),Ue(0)):Ke.key==="End"&&(Ke.preventDefault(),Ue(Ye.length-1))},[Ue,_t,Pt,Z,rt,se,Ye,Bt,ge,nn,qe,xn]),fn=d.useMemo(()=>s?w$n(s):void 0,[s]),cn=ge?.rows.find(Ke=>Ke.key===ie),Sn=Y!==void 0&&Y.of===s&&Y.loader===e,as=Sn?s?.rowIndexByKey.get(Y.key):void 0,Vt=as===void 0?void 0:s?.rows[as],Kn=cn?cn.kind==="turn"?n("trajectory.turn",{index:cn.turn.index}):oL(cn.row,n).text:n("trajectory.selected.none"),jn=cn?.kind==="row"&&(cn.row.kind==="request"||cn.row.kind==="tool")?cn.row.timing:void 0,pn=cn?.kind==="row"&&cn.row.kind==="request"?jn?.ttftMs:void 0,Ht=cn?cn.kind==="turn"?n("trajectory.turnSummary",{requests:cn.turn.requestCount,tools:cn.turn.toolCount,duration:cn.turn.requestCount>0?Ca(cn.turn.requestMs):n("trajectory.unrecorded")}):cn.row.kind==="request"||cn.row.kind==="tool"?`${jn===void 0?n("trajectory.unrecorded"):Ca(jn.durationMs)}${pn===void 0?"":` · ${n("trajectory.ttft",{duration:Ca(pn)})}`}`:n("trajectory.selected.noTiming"):void 0,Lt=o==="ready"&&Ye.length===0,Ee=s!==void 0&&s.rows.length>0&&!WFn(s),Ge=fn!==void 0&&fn.plottedCount===0&&fn.missingStartCount>0,we=d.useMemo(()=>{if(!(!s||!Z&&!J&&qe.size===0))return{shown:Ye.filter(Ke=>Ke.kind==="row").length,total:s.rows.length}},[Z,s,Ye,qe,J]),ze=h===void 0?void 0:h.kind==="partial"?n("trajectory.olderPartial"):h.kind==="unreadable"?n("trajectory.olderFailed",{message:h.message}):n(`trajectory.window.${h.kind}`),vt=d.useRef(void 0);if(M.loader!==e||M.version!==b){const Ke=M.loader!==e;P.current=!Ke;const Le=document.activeElement;R.current=!!(!Ke&&A.current?.contains(Le)&&Le?.getAttribute("data-testid")!=="trajectory-window-older"&&Le?.getAttribute("data-testid")!=="trajectory-window-newer"),$({loader:e,version:b,selectionLost:!Ke&&ie!==void 0}),z(void 0),ee(void 0),ne(!1),G(void 0),Ce(void 0),Q(void 0),ke.current=void 0,vt.current=void 0,pe.current=0,he.current=!Ke}d.useLayoutEffect(()=>{P.current&&X.current&&(P.current=!1,ln.scrollToOffset(0),de(X.current,0)),R.current&&(R.current=!1,A.current?.focus({preventScroll:!0}))},[b,wn,ln,de]);const et=d.useCallback(Ke=>{const Le=Ye.findIndex(Ie=>Ie.key===Ke);if(Le<0&&s&&ge){vt.current=Ke;const Ie=J&&!yt.has(Ke)&&!K.has(Ke),xt=Z!==void 0&&!yt.has(Ke)&&!ye?.has(Ke);Ie&&U(),xt&&se(void 0);const wt=ge.ancestors.get(Ke)??[];if(J&&!Ie){const fe=new Map(xt?[]:lt);for(const Xt of wt)fe.set(Xt,!1);Ce({of:s,loader:e,signature:KG(H,xt?void 0:Z,Te),overrides:fe})}else{const fe=new Set(xe);for(const Xt of wt)fe.delete(Xt);G({of:ge,loader:e,keys:fe})}Pt(Ke);return}Pt(Ke),Le>=0&&ln.scrollToIndex(Le,{align:"auto"})},[s,ge,K,yt,ye,J,U,lt,H,Z,Te,xe,e,Pt,se,ln,Ye]),St=d.useCallback((Ke,Le=H)=>{if(!e_e(Le)||!B||!s||!ge)return;D(Le);const Ie=Jke(B,Le).filter(js=>!ye||ye.has(js));if(!Ie.length)return;const xt=ie?Ie.indexOf(ie):-1,wt=xt<0?Ke===1?0:Ie.length-1:(xt+Ke+Ie.length)%Ie.length,fe=Ie[wt],Xt=ge.ancestors.get(fe)??[],rs=KG(Le,Z,Te),hs=new Map(rs===Be?lt:[]);for(const js of Xt)hs.set(js,!1);Ce({of:s,loader:e,signature:rs,overrides:hs}),vt.current=fe,Pt(fe,!1)},[B,s,ge,D,H,ye,ie,Z,Te,Be,lt,e,Pt]);d.useLayoutEffect(()=>{const Ke=vt.current;if(Ke===void 0)return;vt.current=void 0;const Le=Ye.findIndex(Ie=>Ie.key===Ke);Le>=0&&ln.scrollToIndex(Le,{align:"auto"})},[ln,Ye]);const $e=d.useCallback(Ke=>{const Le=[oL(Ke.row,n).text],Ie=Ke.row.kind==="request"||Ke.row.kind==="tool"?Ke.row.timing?.startedAt:void 0;return Ie!==void 0&&Le.push(`${new Date(Ie).toLocaleString()}–${new Date(Ie+Ke.end-Ke.start).toLocaleString()}`),Le.push(Ca(Ke.end-Ke.start)),Ke.ttftEnd!==void 0&&Le.push(n("trajectory.ttft",{duration:Ca(Ke.ttftEnd-Ke.start)})),Le.filter(Boolean).join(" · ")},[n]);return a.jsxs("div",{className:Js.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Js.header,children:[a.jsx("div",{className:Js.summary,children:fn?a.jsx("span",{"data-testid":"trajectory-totals",children:n("trajectory.totals",{turns:fn.turnCount,requests:fn.requestCount,tools:fn.toolCount})}):a.jsx("span",{children:n("trajectory.title")})}),a.jsxs("div",{className:Js.headerActions,children:[Z!==void 0&&a.jsx("button",{type:"button",className:Js.iconButton,onClick:()=>se(void 0),title:n("trajectory.range.clear"),"aria-label":n("trajectory.range.clear"),"data-testid":"trajectory-range-clear",children:a.jsx(wh,{size:14,strokeWidth:1.6})}),v==="latest"&&a.jsx("button",{type:"button",className:Js.iconButton,onClick:j,disabled:!y,title:n("common.refresh"),"aria-label":n("common.refresh"),children:a.jsx(xh,{size:14,strokeWidth:1.6})})]})]}),a.jsxs("div",{className:Js.overviewMetrics,"data-testid":"trajectory-metrics",children:[[["elapsed",fn?.elapsedMs],["active",fn?.activeMs],["main",fn?.mainRequestMs]].map(([Ke,Le])=>a.jsxs("div",{className:Js.metric,children:[a.jsx("span",{children:n(`trajectory.metric.${Ke}`)}),a.jsx("strong",{"aria-label":Le===void 0?n("trajectory.unrecorded"):void 0,title:Le===void 0?n("trajectory.unrecorded"):void 0,children:Le===void 0?"—":Ca(Le)})]},Ke)),a.jsx("div",{className:Js.failureCounts,"data-has-failures":fn&&fn.requestFailures+fn.toolFailures>0?"true":void 0,children:fn?n("trajectory.failures",{requests:fn.requestFailures,tools:fn.toolFailures}):"—"}),a.jsxs("details",{className:Js.metricHelp,children:[a.jsx("summary",{children:n("trajectory.metric.help")}),a.jsxs("div",{className:Js.metricHelpContent,children:[a.jsx("p",{children:n("trajectory.metric.scope")}),a.jsx("p",{children:n("trajectory.metric.elapsed.help")}),a.jsx("p",{children:n("trajectory.metric.active.help")}),a.jsx("p",{children:n("trajectory.metric.main.help")}),a.jsx("p",{children:n("trajectory.metric.missing.help")})]})]})]}),a.jsx(K$n,{model:st,viewportControl:Pe,...Ee||Ge?{notice:n(Ge?"trajectory.noStart":"trajectory.noTiming")}:{},selectedKey:ie,onSelect:et,describe:$e,...Z!==void 0?{range:Z}:{},onRangeChange:se,onModeChange:Qe}),a.jsxs("div",{className:Js.context,children:[a.jsxs("div",{className:Js.selectedLine,children:[a.jsxs("div",{className:Js.selectedInfo,"data-testid":"trajectory-selected","aria-live":"polite",children:[a.jsx("span",{className:Js.selectedLabel,children:n("trajectory.selected.label")}),a.jsx("span",{className:Js.selectedName,title:Kn,children:Kn}),Ht&&a.jsx("span",{className:Js.selectedMeta,title:Ht,children:Ht})]}),a.jsxs("button",{type:"button",className:Js.detailsButton,onClick:()=>_t(),disabled:!s||!e||!ie||!s.rowIndexByKey.has(ie),children:[n("trajectory.inspector.open"),a.jsx(qa,{size:13,"aria-hidden":"true"})]})]}),a.jsxs("div",{className:Js.contextNotice,"data-testid":"trajectory-context-notice",title:[fn?.missingStartCount?n("trajectory.missingStart",{count:fn.missingStartCount}):"",fn?.missingTimingCount?n("trajectory.missingTiming",{count:fn.missingTimingCount}):"",u?n(v==="history"?"trajectory.window.outside":"trajectory.truncated"):"",C?n("trajectory.historyGap"):"",r.incomplete||r.truncated?n("trajectory.lifecycleIncomplete"):"",i&&s?n("trajectory.refreshStale"):""].filter(Boolean).join(" · "),children:[we&&a.jsx("span",{"data-testid":"trajectory-range-status",role:"status",children:n("trajectory.range.status",we)}),we?" · ":"",[ze,C?n("trajectory.historyGap"):"",r.incomplete||r.truncated?n("trajectory.lifecycleIncomplete"):"",i&&s?n("trajectory.refreshStale"):"",u&&!ze?n(v==="history"?"trajectory.window.outside":"trajectory.truncated"):"",fn&&(fn.missingStartCount>0||fn.missingTimingCount>0)?n("trajectory.unplotted",{starts:fn.missingStartCount,timing:fn.missingTimingCount}):""].filter(Boolean).join(" · ")||(we?"":" ")]})]}),a.jsx("div",{className:Js.errorSlot,children:i!==void 0&&a.jsxs("div",{className:Js.error,role:"alert",children:[a.jsxs("span",{children:[s?`${n("trajectory.refreshStale")} · `:"",i.kind==="partial"?n("trajectory.partial"):i.kind==="unreadable"?n("trajectory.loadFailed",{message:i.message}):n(`trajectory.window.${i.kind}`)]}),a.jsx("button",{type:"button",className:Js.headerButton,onClick:p,disabled:o==="loading"||i.kind!=="partial"&&i.kind!=="unreadable",children:n("common.retry")})]})}),s&&a.jsxs("div",{className:Js.windowNavigation,ref:A,tabIndex:-1,role:"group","aria-label":n("trajectory.window.navigation"),"data-testid":"trajectory-window-navigation","data-bookmarks":I,children:[a.jsxs("div",{className:Js.windowStatus,role:"status","aria-live":"polite","data-testid":"trajectory-window-status",children:[n(`trajectory.window.${v}`)," ·"," ",n("trajectory.window.pages",{pages:c}),a.jsx("span",{children:n("trajectory.window.scope")}),a.jsx("span",{className:Js.windowNotice,children:[o==="loading"?n("trajectory.loadingPages",{pages:l}):u?"":n("trajectory.window.start"),S&&!_&&o!=="loading"&&!w&&!i&&!h?n("trajectory.window.released"):"",M.selectionLost&&!ie?n("trajectory.window.changed"):""].filter(Boolean).join(" · ")||" "})]}),a.jsxs("div",{className:Js.windowButtons,children:[a.jsx("button",{type:"button",className:Js.headerButton,"aria-disabled":!x,onClick:m,"data-testid":"trajectory-window-older",children:n("trajectory.window.older")}),a.jsx("button",{type:"button",className:Js.headerButton,"aria-disabled":!_,onClick:g,"data-testid":"trajectory-window-newer",children:n("trajectory.window.newer")}),h&&!wn&&a.jsx("button",{type:"button",className:Js.headerButton,"data-testid":"trajectory-older-retry",onClick:p,"aria-disabled":o==="loading"||h.kind!=="partial"&&h.kind!=="unreadable",children:n("common.retry")}),v==="history"&&a.jsx("button",{type:"button",className:Js.headerButton,onClick:()=>{y&&j()},"aria-disabled":!y,"data-testid":"trajectory-window-latest",children:n("trajectory.window.return")})]}),w&&a.jsxs("div",{className:Js.windowFailure,role:"alert",children:[a.jsxs("span",{children:[n("trajectory.window.failed")," ",w.kind==="partial"?n("trajectory.partial"):w.kind==="unreadable"?n("trajectory.loadFailed",{message:w.message}):n(`trajectory.window.${w.kind}`)]}),(w.kind==="partial"||w.kind==="unreadable")&&a.jsx("button",{type:"button",className:Js.headerButton,onClick:p,"aria-disabled":o==="loading",children:n("common.retry")})]})]}),s&&s.rows.length>0&&a.jsx(EFn,{value:H,onChange:D,onNavigate:St,onClear:U,count:J?Se.length:0,position:J&&ie?Se.indexOf(ie)+1:0,truncatedCount:B?.truncatedCount??0},L.scope),a.jsx("div",{className:`${Js.tableWrap} ${q?Js.tableWrapWithInspector:""}`,children:Ye.length===0?o==="error"?null:J?a.jsxs("div",{className:Js.placeholder,"data-testid":"trajectory-filter-empty",children:[a.jsx("span",{children:n("trajectory.filter.empty")})," ",a.jsx("button",{type:"button",className:Js.headerButton,onClick:U,children:n("trajectory.filter.clear")})]}):Z!==void 0?a.jsxs("div",{className:Js.placeholder,"data-testid":"trajectory-range-empty",children:[a.jsx("span",{children:n("trajectory.range.empty")})," ",a.jsx("button",{type:"button",className:Js.headerButton,onClick:()=>se(void 0),children:n("trajectory.range.clear")})]}):a.jsx("div",{className:Js.placeholder,role:"status",children:Lt?n("trajectory.empty"):l>0?n("trajectory.loadingPages",{pages:l}):n("common.loading")}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Js.olderBar,role:"status","data-testid":"trajectory-older-bar",children:h!==void 0?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`${Js.olderNotice} ${Js.toneError}`,"data-testid":"trajectory-older-failed",title:ze,children:ze}),a.jsx("button",{type:"button",className:Js.headerButton,onClick:()=>{o!=="loading"&&p()},"aria-disabled":o==="loading"||h.kind!=="partial"&&h.kind!=="unreadable","data-testid":"trajectory-older-retry",children:n("common.retry")})]}):u?a.jsx("span",{className:Js.olderNotice,"data-testid":"trajectory-truncated",children:n(v==="history"?"trajectory.window.outside":"trajectory.truncated")}):null}),a.jsx("div",{ref:X,className:Js.scroll,role:"grid",tabIndex:0,"aria-label":n("trajectory.title"),"aria-rowcount":Ye.length,"aria-activedescendant":ln.getVirtualItems().some(Ke=>Ke.index===rt)?V(rt):void 0,onKeyDown:Cn,onScroll:Ke=>{pe.current=Ke.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Js.virtualBody,style:{height:`${ln.getTotalSize()}px`},children:ln.getVirtualItems().map(Ke=>{const Le=Ye[Ke.index];return a.jsx("div",{id:V(Ke.index),className:Js.virtualRow,style:{height:`${kj}px`,transform:`translateY(${Ke.start}px)`},role:"row","aria-rowindex":Ke.index+1,children:Le.kind==="turn"?a.jsx(GFn,{turn:Le.turn,prompt:Le.turn.userRowKey?s?.rows[s.rowIndexByKey.get(Le.turn.userRowKey)??-1]:void 0,collapsed:qe.has(Le.key),hiddenCount:nn.get(Le.key)??0,onToggle:()=>xn(Le.key),selected:Le.key===Bt,onSelect:()=>Pt(Le.key)}):a.jsx(KFn,{row:Le.row,grouped:(ge?.ancestors.get(Le.key)?.length??0)>1,unresolvedParent:ge?.unresolvedParents.has(Le.key)??!1,fold:ge?.groups.has(Le.key)&&(nn.get(Le.key)??0)>0?{collapsed:qe.has(Le.key),hiddenCount:nn.get(Le.key)??0,onToggle:()=>xn(Le.key)}:void 0,span:He.get(Le.key),total:st?.total??0,viewport:Pe.viewport,range:Z,context:!!_e&&!_e.has(Le.key),selected:Le.key===Bt,onSelect:()=>Pt(Le.key)})},Ke.key)})})})]})}),q&&Y!==void 0&&Y.loader===e&&a.jsx(fBn,{row:Vt,lifecycle:Sn&&Vt?r.byRowKey.get(Vt.key):void 0,stale:!Sn,turnSelected:cn?.kind==="turn",title:Vt?oL(Vt,n).text:void 0,hiddenByRange:!!(Z&&Vt&&!yt.has(Vt.key)&&!ye?.has(Vt.key)),hiddenByFilter:!!(J&&Vt&&!yt.has(Vt.key)&&!K.has(Vt.key)),onClearFilter:U,hiddenByCollapse:!!(Vt&&ge?.ancestors.get(Vt.key)?.some(Ke=>qe.has(Ke))),onReveal:()=>{Vt&&et(Vt.key)},onClearRange:()=>se(void 0),onClose:an})]})}function GFn({turn:e,prompt:t,collapsed:n,hiddenCount:s,onToggle:r,selected:o,onSelect:i}){const{t:l}=dt();return a.jsxs("div",{className:`${Js.turnHeader} ${o?Js.selected:""}`,onClick:i,"aria-selected":o,"data-selected":o?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx(Bze,{collapsed:n,name:l("trajectory.turn",{index:e.index}),onToggle:r}),a.jsx("span",{className:Js.turnTitle,children:e.partial?l("trajectory.turnPartial",{index:e.index}):l("trajectory.turn",{index:e.index})}),t?.kind==="user"&&a.jsx("span",{className:Js.turnPrompt,title:zS(t.block.text),children:zS(t.block.text).slice(0,160)}),n&&s>0&&a.jsx("span",{className:Js.foldCount,children:l("trajectory.collapsed",{count:s})}),a.jsx("span",{className:Js.turnSummary,children:l("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestCount>0?Ca(e.requestMs):"—"})})]})}function KFn({row:e,grouped:t,unresolvedParent:n,fold:s,span:r,total:o,viewport:i,range:l,context:c,selected:u,onSelect:h}){const{t:f}=dt(),p=oL(e,f),m=HFn(e,f);return a.jsxs("div",{className:`${Js.record} ${u?Js.selected:""}`,role:"gridcell","aria-selected":u,"data-selected":u?"true":void 0,onClick:h,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,"data-grouped":t||void 0,"data-context":c||void 0,"data-row-key":e.key,children:[s?a.jsx(Bze,{collapsed:s.collapsed,name:p.text,onToggle:s.onToggle}):a.jsx("span",{className:Js.foldSpacer}),e.depth>0&&a.jsx(mpt,{size:12,strokeWidth:1.6,className:Js.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Js.badge} ${p.badgeTone??""}`,children:p.badge}),a.jsx("span",{className:`${Js.text} ${p.faint?Js.faint:""}`,children:p.text}),n&&a.jsx("span",{className:Js.parentNotice,title:f("trajectory.parentUnresolved"),children:f("trajectory.parentUnresolved")}),c&&a.jsx("span",{className:Js.foldCount,children:f("trajectory.contextRow")}),s?.collapsed&&a.jsx("span",{className:Js.foldCount,children:f("trajectory.collapsed",{count:s.hiddenCount})}),a.jsx("span",{className:Js.waterfallSlot,children:a.jsx(xFn,{span:r,total:o,viewport:i,range:l,title:m.join(" · ")})}),a.jsx("span",{className:Js.rowMetrics,"data-testid":"trajectory-row-metrics",title:m.length>0?m.join(" · "):void 0,children:m.length>0?m.join(" · "):"—"})]})}function Bze({collapsed:e,name:t,onToggle:n}){const{t:s}=dt();return a.jsx("button",{type:"button",tabIndex:-1,className:Js.foldButton,"aria-expanded":!e,"aria-label":s(e?"trajectory.expand":"trajectory.collapse",{name:t}),onClick:r=>{r.stopPropagation(),n()},children:e?a.jsx(qa,{size:13,"aria-hidden":"true"}):a.jsx(ad,{size:13,"aria-hidden":"true"})})}const YFn="_panel_pwtdr_1",XFn="_toolbar_pwtdr_5",QFn="_actions_pwtdr_15",ZFn="_feedback_pwtdr_21",JFn="_state_pwtdr_31",my={panel:YFn,toolbar:XFn,actions:QFn,feedback:ZFn,state:JFn};function ezn({sessionActions:e,sessionId:t,controls:n}){const{t:s}=dt(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),p=d.useRef(null),m=n?.sessionId===t?n:void 0,g=m?.getContextUsage??e?.getContextUsage,v=d.useRef(m);v.current=m;const b=m?.result,[w,y]=d.useState(b),x=!!(b&&b!==w&&(b.kind!=="completed"||!c));d.useEffect(()=>{b?.kind==="completed"&&(h.current++,o(b.usage),u(!1))},[b]),d.useEffect(()=>{let I=!0,E=!1;const N=v.current?.result;o(j=>j?.sessionId===t?j:N?.kind==="completed"?N.usage:null),u(!1),l(!!g);const T=async()=>{if(!I||E||!g)return;E=!0,l(!0),u(!1);const j=h.current,C=p.current,A=C&&C.getContextUsage===g&&C.sessionId===t?C:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=A;try{const R=await A.promise;if(!I||j!==h.current)return;o(R.sessionId===t&&R.usage.contextWindowSize>0?R:null)}catch(R){if(!I||j!==h.current)return;u(one(R)?"transient":"hard")}finally{E=!1,p.current===A&&(p.current=null),I&&l(!1)}};return f.current=()=>void T(),T(),()=>{I=!1}},[g,t]);const _=!g||i||m?.compressing,S=()=>{y(b),f.current()};return a.jsxs("div",{className:my.panel,"aria-busy":i,children:[a.jsxs("div",{className:my.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:my.actions,children:[a.jsx(Ze,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:_,onClick:S,children:a.jsx(xh,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(Ze,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||i,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(oBe,{controls:m,className:my.feedback}),c==="transient"&&r&&a.jsx("div",{className:my.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:my.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(Ze,{type:"button",variant:"outline",size:"sm",disabled:_,onClick:S,children:s("contextUsage.retry")})]}):g?i&&!r?a.jsx("div",{className:my.state,role:"status",children:s("common.loading")}):r?a.jsx(CPe,{status:r,compact:!0}):a.jsx("div",{className:my.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:my.state,children:s("contextUsage.unavailable")})]})}class Fze extends Error{}function zze(e){throw new Fze(e instanceof Error?e.message:String(e))}const tzn=()=>nt(()=>import("./WorkspaceFileBrowser-DBXW9l-s.js"),__vite__mapDeps([95,96])).then(e=>({default:e.WorkspaceFileBrowser})).catch(zze),nzn=()=>nt(()=>import("./PierreFilePreview-Cij36lF-.js"),[]).catch(zze),szn=d.lazy(()=>nt(()=>import("./SpreadsheetPreview-kDlHrK21.js"),[])),rzn=700,ozn=["daily","weekdays","weekly","hourly","minutes","custom"],izn=[1,2,3,4,5,6,10,12,15,20,30],azn=(e,t)=>{},lzn=(e,t,n)=>{},czn=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function n_e(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function gy(e){return e.kind==="pending"?e.targetKind:e.kind}function uzn(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const dzn=["review","sideTask"];function hzn({tab:e,workspaceCwd:t,onOpenFilePreview:n,onReferenceFile:s,onClose:r}){const{t:o,language:i}=dt(),l=v5(),c=d.useMemo(()=>d.lazy(tzn),[]),u=d.useMemo(()=>d.lazy(nzn),[]),h=PC(e.workspaceCwd),f=h?.workspaceId===e.workspaceId?h?.actions:void 0;if(!f)return a.jsx("div",{className:ft.empty,role:"alert",children:o("workspace.notFoundDescription")});const p=(m,g)=>{const v=m instanceof Fze,b=()=>!!(l&&(!l.activeToken||nte()));return v&&!b()?a.jsxs("div",{role:"alert",className:ft.empty,children:[a.jsx("p",{children:o("files.loadFailed")}),a.jsx("p",{children:o("files.reloadUnavailable")}),a.jsx(Ze,{onClick:r,children:o("files.close")})]}):a.jsx(H3e,{error:m,language:i,retryMode:v?"reload":"reset",onRetry:v?()=>{b()?window.location.reload():r()}:g})};return a.jsx(Sp,{label:"workspace file browser",fallback:p,children:a.jsx(d.Suspense,{fallback:a.jsx("div",{className:ft.empty,children:o("common.loading")}),children:a.jsx(c,{workspaceCwd:e.workspaceCwd,actions:f,onOpenPreview:m=>n(m,e.workspaceCwd,e.workspaceId),onReferenceFile:e.workspaceCwd===t?s:void 0,renderPreview:(m,g,v)=>a.jsx(yM,{workspacePath:m,workspaceActions:f,previewKind:g?"source":void 0,sourceRenderer:b=>a.jsx(Sp,{label:"workspace file source",resetKeys:[m],fallback:p,children:a.jsx(d.Suspense,{fallback:a.jsx("div",{className:ft.empty,children:o("common.loading")}),children:a.jsx(u,{path:m,content:b})})})},`${m}:${g}:${v}`)},`${e.workspaceCwd}:${e.workspaceId??""}`)})})}function s_e({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:o,panelWidth:i,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onSelectTurnCallsPrompt:p,onCloseTab:m,onOpenFilePreview:g,latestReviewAvailable:v=!1,onOpenLatestReview:b,onOpenTerminal:w,onOpenTrajectory:y,trajectoryTabId:x,onOpenFiles:_,onReferenceFile:S,onOpenWebPreview:I,onWebPreviewChange:E,items:N=dzn,sideTaskAvailable:T=!1,sideTasks:j=[],sideTasksLoading:C=!1,onCreateSideTask:A,onOpenSideTask:R,onCreateSideTaskSession:P,onSideTaskCreated:M,onSideTaskTitleChange:$,onSideTaskInitialPromptRefused:L,onNestedRightPanelOpen:F,onNestedArtifactsChange:H,onOpenNestedSubagent:D,agentTasks:U=[],agentTraceLoading:J=!1,agentTraceError:B,onOpenWorkflowAgent:oe,onError:K,sessionWorkflowEnabled:ie,modelManagement:z,workflow:Y,onImageIngestionNotice:ee,deferSubagentMount:q=!1,onClose:ne,variant:X="docked",fullscreen:he=!1,onToggleFullscreen:pe}){const{t:ue}=dt(),V=Kr(),de=WA(V.capabilities,l),[ke,Te]=d.useState(!1),[Qe,st]=d.useState(),Pe=d.useRef(null),He=d.useCallback(()=>{Pe.current&&(clearTimeout(Pe.current),Pe.current=null),Te(!0)},[]),Ve=d.useCallback(()=>{Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(()=>{Te(!1),Pe.current=null},120)},[]);d.useEffect(()=>()=>{Pe.current&&clearTimeout(Pe.current)},[]);const Q=n.find(Ne=>Ne.id===s)??n[0],Z=Q?.kind==="file"&&Q.sourcePreview&&(/\.html?$/i.test(Q.workspacePath)||yw(Q.previewMimeType||Q.previewData?.type)==="text/html"),se=Q?.kind==="file"&&Q.previewOnly===!0&&!Z&&/\.(?:html?|md|markdown)$/i.test(Q.workspacePath)&&(Q.previewContent!==void 0||!Q.previewData||!!bR(Q.previewMimeType||Q.previewData.type,Q.workspacePath)),ye=Qe===Q?.id,ge=N.includes("review")&&!n.some(Ne=>gy(Ne)==="review"),ve=N.includes("sideTask")&&T&&!!A,G=!!w,xe=N.includes("webPreview")&&!!I,Se=N.includes("trajectory")&&!!y&&!n.some(Ne=>Ne.id===x),_e=N.includes("files")&&!!_&&!n.some(Ne=>Ne.kind==="files"&&Ne.workspaceCwd===l&&Ne.workspaceId===de?.id),Be=!!Q&&(_e||ge||ve||G||xe||Se),ct=Q&&n_e(Q)?{workspaceCwd:Q.workspaceCwd,workspaceId:Q.workspaceId}:void 0,Ce=PC(ct?.workspaceCwd),lt=Ce?.workspaceId===ct?.workspaceId?Ce?.actions:void 0,qe=Q?.kind==="artifact"?t.find(Ne=>Ne.id===Q.artifactId):void 0;return a.jsxs("aside",{className:`${ft.panel} ${X==="drawer"?ft.panelDrawer:""} ${he?ft.panelFullscreen:""}`,style:X==="docked"&&i&&!he?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:ft.header,children:[n.length>0&&a.jsx("div",{className:ft.tabs,role:"tablist","aria-label":"Right panel",children:n.map(Ne=>a.jsxs("div",{className:[ft.tabItem,Ne.id===Q?.id?ft.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":Ne.id===Q?.id,className:ft.tab,onClick:()=>f(Ne.id),onMouseEnter:yt=>PS(yt.currentTarget),onFocus:yt=>PS(yt.currentTarget),title:Ne.kind==="turn_calls"?ue("turnCalls.title"):Ne.title,children:[a.jsx("span",{className:`${ft.tabIcon} ${gy(Ne)==="artifact"?ft.tabArtifactIcon:""}`,"aria-hidden":"true",children:gy(Ne)==="review"?a.jsx(XG,{}):Ne.kind==="files"?a.jsx(PA,{className:ft.tabIconSvg}):Ne.kind==="workflow"?a.jsx(fNe,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="file"?a.jsx(L0,{name:Ne.workspacePath,className:ft.tabIconSvg,strokeWidth:1.6}):gy(Ne)==="artifact"?a.jsx(YNe,{artifact:t.find(yt=>"artifactId"in Ne&&yt.id===Ne.artifactId),className:ft.tabIconSvg}):gy(Ne)==="subagent"?a.jsx(fzn,{}):gy(Ne)==="monitor"?a.jsx(xNe,{className:ft.tabIconSvg,strokeWidth:1.6}):gy(Ne)==="shell"?a.jsx(qT,{className:ft.tabIconSvg,strokeWidth:1.6}):gy(Ne)==="side_task"?a.jsx(H8,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="web_preview"?a.jsx(mI,{className:ft.tabIconSvg}):Ne.kind==="terminal"?a.jsx(qT,{className:ft.tabIconSvg,strokeWidth:1.6}):gy(Ne)==="image"?a.jsx(ymt,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="context_usage"?a.jsx(FB,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="token_usage"?a.jsx(gse,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="turn_calls"?a.jsx(X3,{className:ft.tabIconSvg,strokeWidth:1.6}):Ne.kind==="trajectory"?a.jsx(AU,{className:ft.tabIconSvg,strokeWidth:1.6}):a.jsx(mzn,{})}),a.jsx("span",{className:ft.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:ft.tabTitleInner,children:Ne.kind==="turn_calls"?ue("turnCalls.title"):Ne.title})})]}),a.jsx("button",{type:"button",className:ft.tabCloseButton,onClick:()=>m(Ne.id),"aria-label":`Close ${Ne.kind==="turn_calls"?ue("turnCalls.title"):Ne.title}`,title:"Close",children:a.jsx(pzn,{})})]},Ne.id))}),a.jsxs("div",{className:ft.headerActions,children:[Be&&a.jsxs(Fg,{modal:!1,children:[a.jsx(Sm,{asChild:!0,children:a.jsx("button",{type:"button",className:`${ft.iconButton} ${ft.addButton}`,"aria-label":ue("rightPanel.add"),title:ue("rightPanel.add"),children:a.jsx(bh,{className:ft.toolbarIcon})})}),a.jsxs(Cm,{align:"end",className:"w-64",children:[_e&&a.jsxs(Eo,{onSelect:_,children:[a.jsx(PA,{}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("files.title")})]}),ge&&a.jsxs(Eo,{disabled:!v||!b,onSelect:b,children:[a.jsx(XG,{}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("turnOutputs.review")})]}),ge&&ve&&a.jsx(fw,{}),ve&&a.jsxs(Eo,{disabled:C,onSelect:A,children:[a.jsx(H8,{className:ft.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("sideTask.create")})]}),G&&(ge||ve)&&a.jsx(fw,{}),G&&a.jsxs(Eo,{onSelect:()=>w?.(),children:[a.jsx(qT,{className:ft.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("terminal.title")})]}),xe&&a.jsxs(Eo,{onSelect:I,children:[a.jsx(mI,{className:ft.sideTaskNewIcon}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("webPreview.title")})]}),Se&&a.jsxs(Eo,{onSelect:()=>y?.(),children:[a.jsx(AU,{className:ft.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("trajectory.title")})]})]})]}),pe&&a.jsx("button",{type:"button",className:`${ft.iconButton} ${ft.fullscreenButton} ${he?ft.iconButtonActive:""}`,onClick:pe,"aria-label":ue(he?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":he,title:ue(he?"common.exitFullscreen":"common.fullscreen"),children:he?a.jsx(xse,{className:ft.toolbarIcon,"aria-hidden":!0}):a.jsx(pse,{className:ft.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${ft.iconButton} ${ft.panelToggleButton}`,onClick:ne,"aria-label":ue("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:ue("chatHeader.toggleRightPanel"),children:a.jsx(pNe,{className:ft.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${ft.body} ${Q?.kind==="side_task"||Q?.kind==="files"?ft.bodySideTask:""}`.trim(),children:[n.filter(Ne=>Ne.kind==="web_preview").map(Ne=>a.jsx("div",{className:"h-full",hidden:Ne.id!==Q?.id,children:a.jsx(gOn,{state:Ne,onChange:yt=>E?.(Ne.id,yt)})},Ne.id)),n.filter(Ne=>Ne.kind==="files").map(Ne=>a.jsx("div",{className:"h-full",hidden:Ne.id!==Q?.id,children:a.jsx(hzn,{onClose:()=>m(Ne.id),tab:Ne,workspaceCwd:l,onOpenFilePreview:g,onReferenceFile:S})},Ne.id)),n.filter(Ne=>Ne.kind==="terminal").map(Ne=>a.jsx("div",{className:`${ft.terminalPane} ${Ne.id===Q?.id?"":ft.terminalPaneHidden}`.trim(),"aria-hidden":Ne.id===Q?.id?void 0:!0,children:a.jsx(mOn,{terminalId:Ne.id,cwd:Ne.workspaceCwd??l,active:Ne.id===Q?.id,enabled:Ne.initialized!==!1})},Ne.id)),se&&a.jsxs("button",{type:"button",className:ft.attachmentPreviewButton,onClick:()=>st(ye?void 0:Q?.id),"aria-label":ue(ye?"attachment.showSource":"attachment.showPreview"),"aria-pressed":ye,children:[ye?a.jsx(lpt,{"aria-hidden":!0}):a.jsx(nNe,{"aria-hidden":!0}),ue(ye?"attachment.showSource":"attachment.showPreview")]}),u&&!Q?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":ue("common.loading"),children:[a.jsx(Yv,{className:"h-5 w-2/5"}),a.jsx(Yv,{className:"h-32 w-full"}),a.jsx(Yv,{className:"h-4 w-4/5"}),a.jsx(Yv,{className:"h-4 w-3/5"})]}):Q?.kind==="terminal"||Q?.kind==="web_preview"||Q?.kind==="files"?null:Q?Q.kind==="pending"?a.jsx("div",{className:ft.empty,role:Q.loadError?"alert":"status",children:Q.loadError??ue("common.loading")}):Q.kind==="workflow"?Q.sessionId?a.jsx(p9n,{tasks:U,loading:J,error:B,onOpenAgent:oe}):Y?a.jsx(Q9n,{...Y}):a.jsx("div",{className:ft.empty,children:ue("workflow.empty.title")}):n_e(Q)&&(Q.kind!=="scheduled_task"||Q.task.durable)&&(Q.kind!=="file"||!Q.previewOnly)&&(Q.kind!=="artifact"||qe?.metadata?.artifactType!=="web_preview_snapshot")&&!lt?a.jsx("div",{className:ft.empty,role:"alert",children:ue("workspace.notFoundDescription")}):Q.kind==="review"?a.jsx(wzn,{changes:Q.changes??r,selectedPath:Q.selectedPath??o,workspaceCwd:Q.workspaceCwd??l,onOpenFilePreview:Ne=>g(Ne,Q.workspaceCwd??l,Q.workspaceId),onDownloadFile:(Ne,yt)=>WB(lt,Ne.path,Ivt(Ne.path),yt),onDownloadError:Ne=>{const yt=ue("common.downloadFailed",{message:kl(Ne)});K?K(new Error(yt,{cause:Ne}),yt):console.error(yt,Ne)}}):Q.kind==="file"?Q.attachmentId&&!Q.previewData&&Q.previewContent===void 0?a.jsx("div",{className:ft.empty,role:Q.loadError?"alert":"status",children:Q.loadError??ue("common.loading")}):Q.sourcePreview&&Q.previewData&&!E5(Q.workspacePath,Q.previewMimeType||Q.previewData.type)&&yw(Q.previewMimeType||Q.previewData.type)!=="application/pdf"&&!bR(Q.previewMimeType||Q.previewData.type,Q.workspacePath)?a.jsx(yae,{data:Q.previewData,title:Q.title,image:!!Jx(Q.workspacePath)&&Q.previewData.type.startsWith("image/")}):a.jsx(yM,{workspacePath:Q.workspacePath,artifactVersion:String(Q.previewVersion??0),workspaceActions:lt,previewContent:Q.previewContent,previewData:Q.previewData,previewMimeType:Q.previewMimeType,previewOnly:Q.previewOnly,previewKind:Z||Q.previewOnly&&!ye?"source":void 0},Q.id):Q.kind==="source"?a.jsx(Pzn,{tab:Q},Q.id):Q.kind==="artifact"?a.jsx(gzn,{artifacts:t,artifactId:Q.artifactId,sourceSessionId:Q.sourceSessionId,workspaceActions:lt,previewContent:Q.previewContent,loading:c,error:h},Q.id):Q.kind==="subagent"?q?null:a.jsx(XPn,{sessionId:Q.sessionId,rootToolCallId:Q.rootToolCallId,initialRootTool:Q.rootTool,workspaceCwd:Q.workspaceCwd??l,onRightPanelOpen:F,onArtifactsChange:H,onOpenSubagent:D,onError:K}):Q.kind==="monitor"?a.jsx(ROt,{task:Q.task,actions:Q.sessionActions},Q.id):Q.kind==="shell"?a.jsx(EOt,{task:Q.task,actions:Q.sessionActions},Q.id):Q.kind==="side_task"?a.jsx(g9n,{tabId:Q.id,sessionId:Q.sessionId,parentSessionId:Q.parentSessionId,workspaceCwd:Q.workspaceCwd??l,title:Q.title,shouldNameFromFirstPrompt:Q.nameFromFirstPrompt,initialPrompt:Q.initialPrompt,createSession:P??czn,onCreated:M??azn,onTitleChange:$??lzn,onInitialPromptRefused:L,onRightPanelOpen:F,onArtifactsChange:H,onError:K,sessionWorkflowEnabled:ie,modelManagement:z,onImageIngestionNotice:ee},Q.id):Q.kind==="image"?Q.src?a.jsxs("div",{className:ft.imagePreviewWrap,children:[a.jsx("img",{src:Q.src,alt:Q.alt??Q.title,className:ft.imagePreview}),a.jsx("a",{className:ft.imageDownloadButton,href:Q.src,download:uzn(Q.src),"aria-label":ue("common.download"),title:ue("common.download"),children:a.jsx(tb,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:ft.empty,role:Q.loadError?"alert":"status",children:Q.loadError??ue("common.loading")}):Q.kind==="context_usage"?a.jsx(ezn,{controls:e?.[Q.sessionId],sessionActions:Q.sessionActions,sessionId:Q.sessionId},Q.id):Q.kind==="trajectory"?a.jsx(VFn,{loadPage:Q.loadPage,historyGapRevision:Q.historyGapRevision},Q.id):Q.kind==="token_usage"?a.jsx(s$n,{sessionActions:Q.sessionActions,sessionId:Q.sessionId},Q.id):Q.kind==="turn_calls"?a.jsx(O5n,{turnId:Q.turnId,ownerSessionId:Q.sessionId,recordId:Q.recordId,promptId:Q.promptId,promptLabel:Q.promptLabel,onSelectPrompt:p,workspaceCwd:l,onOpenFile:F,onOpenAgent:D},`${Q.sessionId}:${l}`):a.jsx(vzn,{task:Q.task,actions:lt},Q.id):a.jsxs("div",{className:ft.emptyActions,"data-testid":"right-panel-empty-actions",children:[N.includes("files")&&a.jsxs("button",{type:"button",className:ft.emptyAction,disabled:!_,onClick:_,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(PA,{})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("files.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("files.description")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),N.includes("review")&&a.jsxs("button",{type:"button",className:ft.emptyAction,disabled:!v||!b,onClick:b,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(XG,{})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("turnOutputs.review")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("turnOutputs.reviewLatest")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),N.includes("sideTask")&&T&&A&&(j.length===0?a.jsxs("button",{type:"button",className:ft.emptyAction,disabled:C,"aria-busy":C,onClick:A,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(H8,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("sideTask.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("sideTask.description")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Fg,{open:ke,onOpenChange:Te,modal:!1,children:[a.jsx(Sm,{asChild:!0,children:a.jsxs("button",{type:"button",className:ft.emptyAction,"aria-expanded":ke,onMouseEnter:He,onMouseLeave:Ve,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(H8,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("sideTask.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("sideTask.description")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Cm,{align:"end",className:"w-80",onMouseEnter:He,onMouseLeave:Ve,children:[j.map(Ne=>a.jsxs(Eo,{onSelect:()=>R?.(Ne),children:[a.jsx("span",{className:ft.sideTaskListTitle,children:Ne.title}),Ne.updatedAt&&a.jsx("span",{className:ft.sideTaskListTime,children:xR(Ne.updatedAt,ue)})]},Ne.sessionId)),a.jsx(fw,{}),a.jsxs(Eo,{onSelect:A,children:[a.jsx(Zft,{className:ft.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ft.sideTaskListTitle,children:ue("sideTask.new")})]})]})]})),xe&&a.jsxs("button",{type:"button",className:ft.emptyAction,"data-testid":"right-panel-open-web-preview",onClick:I,children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(mI,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("webPreview.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("webPreview.openHint")}),a.jsx(qa,{className:ft.emptyActionChevron,"aria-hidden":"true"})]}),Se&&a.jsxs("button",{type:"button",className:ft.emptyAction,onClick:()=>y?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(AU,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("trajectory.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("trajectory.description")}),a.jsx(qa,{className:ft.emptyActionChevron,"aria-hidden":"true"})]}),w&&a.jsxs("button",{type:"button",className:ft.emptyAction,onClick:()=>w(),children:[a.jsx("span",{className:ft.emptyActionIcon,"aria-hidden":"true",children:a.jsx(qT,{strokeWidth:1.6})}),a.jsx("span",{className:ft.emptyActionTitle,children:ue("terminal.title")}),a.jsx("span",{className:ft.emptyActionHint,children:ue("terminal.open")}),a.jsx(qa,{className:ft.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function fzn(){return a.jsxs("svg",{className:ft.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("circle",{cx:"12",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M6.5 19c.7-3.1 2.5-4.7 5.5-4.7s4.8 1.6 5.5 4.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function pzn(){return a.jsx("svg",{className:ft.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function XG(){return a.jsxs("svg",{className:ft.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),a.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),a.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function mzn(){return a.jsxs("svg",{className:ft.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),a.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gzn({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:o,error:i}){const l=e.find(c=>c.id===t);return l?a.jsx(Ezn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:ft.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:ft.empty,children:i}):a.jsx("div",{className:ft.empty,children:"Artifact not found."})}function vzn({task:e,actions:t}){const{t:n}=dt(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>V1(e.cron)),[v,b]=d.useState(!1),[w,y]=d.useState(!1),[x,_]=d.useState(!1),[S,I]=d.useState(!1),[E,N]=d.useState(null),T=d.useRef(0),j=d.useRef(0),C=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});C.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const A=d.useCallback((q,ne,X,he)=>{const pe=C.current;return q===T.current&&pe.actions===ne&&pe.taskId===X&&pe.workspaceId===he},[]),R=d.useCallback((q,ne,X,he)=>{const pe=C.current;return q===j.current&&pe.actions===ne&&pe.taskId===X&&pe.workspaceId===he},[]);d.useEffect(()=>()=>{T.current+=1,j.current+=1},[]),d.useEffect(()=>{_(!1),I(!1),N(null)},[t,e.id,e.workspaceId]);const P=d.useCallback(async()=>{const q=++T.current,ne=++j.current,X=e.id,he=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(V1(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const pe=await t.listScheduledTasks(he);if(!A(q,t,X,he))return;const ue=pe.find(V=>V.id===e.id)??null;r(ue),ue?(h(ue.name??""),p(ue.prompt),g(V1(ue.cron))):(h(""),p(e.prompt),g(V1(e.cron)))}catch(pe){R(ne,t,X,he)&&c(pe instanceof Error?pe.message:String(pe))}finally{R(ne,t,X,he)&&i(!1)}},[t,R,A,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{P()},[P]);const M=!e.durable,$=e.durable&&!o&&!l&&!s,L=!!s,F=s?.name||s?.prompt||e.title,H=s?.prompt??e.prompt,D=s?.cron??e.cron,U=s?.recurring??e.recurring,J=s?.enabled,B=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(V1(s.cron)),N(null),b(!0))},[s]),oe=d.useCallback(()=>{b(!1),N(null),s&&(h(s.name??""),p(s.prompt),g(V1(s.cron)))},[s]),K=d.useCallback(async()=>{if(!s||!t)return;const q=SD(m);if(!q){N(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){N(n("scheduledTasks.error.emptyPrompt"));return}const ne=++T.current,X=e.id,he=e.workspaceId;I(!0),N(null);try{const pe=await t.updateScheduledTask(s.id,{cron:q,prompt:f.trim(),name:u.trim()||null},he);if(!A(ne,t,X,he))return;r(pe),h(pe.name??""),p(pe.prompt),g(V1(pe.cron)),b(!1)}catch(pe){A(ne,t,X,he)&&N(pe instanceof Error?pe.message:String(pe))}finally{A(ne,t,X,he)&&I(!1)}},[t,m,A,s,u,f,n,e.id,e.workspaceId]),ie=d.useCallback(async()=>{if(!s||!t)return;const q=++T.current,ne=e.id,X=e.workspaceId;_(!0),N(null);try{const he=await t.updateScheduledTask(s.id,{enabled:!s.enabled},X);if(!A(q,t,ne,X))return;r(he)}catch(he){A(q,t,ne,X)&&N(he instanceof Error?he.message:String(he))}finally{A(q,t,ne,X)&&_(!1)}},[t,A,s,e.id,e.workspaceId]),z=d.useCallback(async()=>{if(!s||!t)return;const q=++T.current,ne=e.id,X=e.workspaceId;_(!0),N(null);try{if(await t.deleteScheduledTask(s.id,X),!A(q,t,ne,X))return;r(null),y(!1)}catch(he){A(q,t,ne,X)&&N(he instanceof Error?he.message:String(he))}finally{A(q,t,ne,X)&&_(!1)}},[t,A,s,e.id,e.workspaceId]),Y=SD(m),ee=Y?JI(Y,n):null;return a.jsxs("div",{className:ft.detail,children:[o&&a.jsx("div",{className:ft.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Jt.loadError,children:l}),$&&a.jsx("div",{className:ft.empty,children:n("scheduledTasks.deletedSnapshot")}),M&&a.jsx("div",{className:ft.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!$&&a.jsx("div",{className:ft.section,children:a.jsxs("div",{className:ft.fieldGrid,children:[a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:ft.fieldValue,children:F}),a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:ft.fieldValue,children:e.id}),a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:ft.fieldValue,children:JI(D,n)}),a.jsx("span",{className:ft.fieldLabel,children:"Cron"}),a.jsx("span",{className:ft.fieldValue,children:D}),a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:ft.fieldValue,children:n(U?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),J!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ft.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:ft.fieldValue,children:n(J?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!$&&a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:"Prompt"}),a.jsx("div",{className:ft.description,children:H})]}),E&&a.jsx("div",{className:Jt.formError,children:E}),a.jsxs("div",{className:ft.actionsRow,children:[a.jsx("button",{type:"button",className:Jt.primaryButton,disabled:!L||x,onClick:B,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Jt.secondaryButton,disabled:!L||x,onClick:()=>void ie(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Jt.secondaryButton,disabled:!L||x,onClick:()=>y(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(la,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>y(!1),children:a.jsxs("div",{className:Jt.formFields,children:[a.jsx("div",{className:ft.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),E&&a.jsx("div",{className:Jt.formError,children:E}),a.jsxs("div",{className:Jt.formActions,children:[a.jsx("button",{type:"button",className:Jt.secondaryButton,onClick:()=>y(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Jt.primaryButton,onClick:()=>void z(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(la,{title:n("scheduledTasks.editTitle"),size:"md",onClose:oe,children:a.jsxs("div",{className:Jt.formFields,children:[a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Jt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:q=>h(q.target.value)})]}),a.jsxs("label",{className:Jt.field,children:[a.jsxs("span",{className:Jt.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Jt.required,children:"*"})]}),a.jsx("textarea",{className:Jt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:q=>p(q.target.value)})]}),a.jsxs("div",{className:Jt.scheduleRow,children:[a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Jt.select,value:m.frequency,onChange:q=>{const ne=q.target.value;g(X=>({...X,frequency:ne,...ne==="hourly"?{time:"00:00"}:{}}))},children:ozn.map(q=>a.jsx("option",{value:q,children:n(`scheduledTasks.freq.${q}`)},q))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Jt.input,type:"time",value:m.time,onChange:q=>g(ne=>({...ne,time:q.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Jt.select,value:m.weekday,onChange:q=>g(ne=>({...ne,weekday:Number(q.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((q,ne)=>a.jsx("option",{value:ne,children:q},ne))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Jt.select,value:m.minuteInterval,onChange:q=>g(ne=>({...ne,minuteInterval:Number(q.target.value)})),children:izn.map(q=>a.jsx("option",{value:q,children:q},q))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Jt.field} ${Jt.fieldGrow}`,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Jt.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:q=>g(ne=>({...ne,customCron:q.target.value}))})]})]}),a.jsx("div",{className:Jt.preview,children:ee?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Jt.previewLabel,children:ee}),a.jsx("code",{className:Jt.previewCron,children:Y})]}):a.jsx("span",{className:Jt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),E&&a.jsx("div",{className:Jt.formError,children:E}),a.jsxs("div",{className:Jt.formActions,children:[a.jsx("button",{type:"button",className:Jt.secondaryButton,onClick:oe,disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Jt.primaryButton,onClick:()=>void K(),disabled:S,children:n(S?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function wzn({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=dt(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,p]=d.useState(!1),[m,g]=d.useState(520),v=d.useRef(m),b=d.useRef(null),w=d.useRef(null),[y,x]=d.useState(null),[_,S]=d.useState(()=>new Set),I=d.useRef(!0);d.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]);const E=l,N=d.useMemo(()=>Rzn(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const R=b.current;if(!R)return;const P=()=>{p(R.clientWidth<rzn)};P();const M=new ResizeObserver(P);return M.observe(R),()=>M.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const T=d.useCallback(R=>{const P=b.current;if(!P)return;R.preventDefault();const M=R.currentTarget;M.setPointerCapture(R.pointerId);const $=R.clientX,L=v.current,F=P.getBoundingClientRect().width,H=Math.max(180,F-180),D=document.body.style.cursor,U=document.body.style.userSelect;let J=L,B=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const oe=()=>{B=null,g(J)},K=Y=>{J=Math.min(H,Math.max(180,L+(Y.clientX-$))),B===null&&(B=window.requestAnimationFrame(oe))};let ie=()=>{};const z=Y=>{w.current=null,B!==null&&(window.cancelAnimationFrame(B),B=null),Y&&g(J),M.hasPointerCapture(R.pointerId)&&M.releasePointerCapture(R.pointerId),document.body.style.cursor=D,document.body.style.userSelect=U,window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",ie),window.removeEventListener("pointercancel",ie)};ie=()=>z(!0),w.current=()=>z(!1),window.addEventListener("pointermove",K),window.addEventListener("pointerup",ie),window.addEventListener("pointercancel",ie)},[]);if(e.length===0)return a.jsx("div",{className:ft.empty,children:"No file changes to review."});const j=R7e(e),C=R=>{x(P=>P===R?null:R)},A=async R=>{if(!_.has(R.path)){S(P=>new Set(P).add(R.path));try{await r(R,()=>!I.current)}catch(P){I.current&&o(P)}finally{S(P=>{const M=new Set(P);return M.delete(R.path),M})}}};return a.jsxs("div",{className:ft.review,children:[a.jsxs("div",{className:ft.reviewToolbar,children:[a.jsxs("div",{className:ft.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(wO,{additions:j?.additions,deletions:j?.deletions,className:ft.lineStats,additionsClassName:ft.additions,deletionsClassName:ft.deletions})]}),a.jsxs("div",{className:ft.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:ft.reviewTotalsButton,onClick:()=>h(R=>!R),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[ft.chevron,u?ft.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(o_e,{})})]}),a.jsx("button",{type:"button",className:[ft.iconButton,l?ft.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(R=>!R),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(Tzn,{}):a.jsx(Czn,{})})]})]}),u&&a.jsxs("div",{ref:b,className:[ft.reviewContent,E?"":ft.reviewContentListOnly,E&&f?ft.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[ft.reviewList,y?ft.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(R=>{const P=y===R.path,M=A7e(R.path),$=BYt(R.path);return a.jsxs("div",{className:[ft.reviewItem,P?ft.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:ft.reviewRow,"data-selected":R.path===t||void 0,children:[a.jsx("button",{type:"button",className:ft.reviewRowToggle,onClick:()=>C(R.path),"aria-label":R.path,"aria-expanded":P}),a.jsx("span",{className:ft.fileIcon,children:Wze(R.path)}),a.jsxs("span",{className:ft.reviewFileName,children:[a.jsx(kzn,{path:IF(R.path,n),title:R.path}),M&&a.jsx("button",{type:"button",className:ft.reviewOpenButton,onClick:()=>s(R),title:`${i("turnOutputs.preview")} ${R.path}`,children:i("turnOutputs.preview")}),$&&a.jsx("button",{type:"button",className:ft.reviewOpenButton,onClick:()=>void A(R),title:`${i("common.download")} ${R.path}`,disabled:_.has(R.path),children:i(_.has(R.path)?"common.downloading":"common.download")})]}),a.jsx(wO,{additions:R.additions,deletions:R.deletions,className:ft.lineStats,additionsClassName:ft.additions,deletionsClassName:ft.deletions}),a.jsx("span",{className:[ft.chevron,P?ft.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(o_e,{})})]}),P&&a.jsx(yzn,{change:R})]},`${R.toolCallId}:${R.path}`)})}),E&&!f&&a.jsx("div",{className:ft.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:T}),E&&a.jsx("div",{className:ft.tree,children:N.children.map(R=>a.jsx(qze,{node:R,depth:0,selectedPath:t},R.path))})]})]})}function yzn({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:ft.diffEmpty,children:"No diff available."});const t=bzn(e.diffs);return a.jsx("div",{className:ft.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(bF,{diff:n.fileDiff},s):a.jsx(xzn,{oldText:n.oldText,newText:n.newText},s))})}function bzn(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function xzn({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[o,i]=d.useState(null);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),d.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),i(null);let c=!1,u=null;const h=[_$e,ys.editable.of(!1),Ui.readOnly.of(!0),ys.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return nt(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-CJmvuO8Q.js");return{MergeView:m,unifiedMergeView:g}},[]).then(({MergeView:m,unifiedMergeView:g})=>{if(!c)try{if(s){u=new m({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:p,diffConfig:f});return}u=new ys({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||i(v instanceof Error?v.message:String(v))}}).catch(m=>{c||i(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:ft.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:ft.codeMirrorDiff}),o&&a.jsxs("div",{className:ft.diffError,children:["Diff unavailable: ",o]})]})}function qze({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[ft.treeRow,s?ft.treeFile:ft.treeFolder].filter(Boolean).join(" "),l={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},c={"--tree-children-line-left":`${19+t*18}px`},u=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ft.treeTwisty,children:!s&&a.jsx("span",{className:[ft.treeChevron,r?"":ft.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(Izn,{})})}),a.jsxs("span",{className:ft.treeContent,children:[s&&a.jsx("span",{className:ft.fileIcon,children:Wze(e.path)}),a.jsx("span",{className:ft.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:ft.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:ft.treeNode,children:[s?a.jsx("div",{className:i,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:i,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>o(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:ft.treeChildren,style:c,children:e.children.map(h=>a.jsx(qze,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function kzn({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>Hze(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(_zn(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:ft.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:ft.pathPrefix,children:s.prefix}),a.jsx("span",{className:ft.pathFileName,children:s.leaf})]})}function Hze(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let r_e=null;function _zn(e,t){const n=Hze(e),s=t.clientWidth;if(s<=0)return n;const r=Szn(t);if(r(e)<=s)return n;const o=e.split("/").filter(Boolean),i=o.at(-1)??e,l=r(i);if(o.length<=1||l+r(".../")>s)return{prefix:"",leaf:i};let c=".../";for(let u=1;u<o.length;u++){const f=`.../${o.slice(o.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:i}}function Szn(e){r_e??=document.createElement("canvas");const t=r_e.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),s=>t?.measureText(s).width??s.length*8}function Czn(){return a.jsxs("svg",{className:ft.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 7.5h6l1.6 2h9.4v8.2a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M3.5 7.5V5.8a1.5 1.5 0 0 1 1.5-1.5h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.6",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function Tzn(){return a.jsxs("svg",{className:ft.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[a.jsx("path",{d:"M3.5 8.2V5.8A1.5 1.5 0 0 1 5 4.3h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.4",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),a.jsx("path",{d:"M4.8 19.7h12.9a2 2 0 0 0 1.9-1.4l2-7H6.4l-2.8 7.1a.9.9 0 0 0 1.2 1.3Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function o_e(){return a.jsx("svg",{className:ft.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Izn(){return a.jsx("svg",{className:ft.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:a.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Rzn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=IF(s.path,t).split("/").filter(Boolean);let o=n;for(let i=0;i<r.length;i++){const l=r[i],c=r.slice(0,i+1).join("/");let u=o.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},o.children.push(u)),i===r.length-1&&(u.file=s),o=u}}return Uze(n),n}function Uze(e){e.children.sort((t,n)=>!!t.file!=!!n.file?t.file?1:-1:t.name.localeCompare(n.name));for(const t of e.children)Uze(t)}function iL(e){return eC(e).split("/").filter(Boolean).at(-1)??e}function Wze(e){const t=iL(e),n=t.includes(".")?t.split(".").pop()?.toLowerCase():"";return n?{css:"CSS",html:"HTML",js:"JS",json:"JSON",jsx:"JSX",md:"MD",ts:"TS",tsx:"TSX"}[n]??n.slice(0,3).toUpperCase():"FILE"}function Ezn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=dt(),o=Ap(),i=Rvt(e),l=KR(e.url)?e.url:void 0,c=e.metadata?.artifactType==="automation_snapshot",u=e.metadata?.artifactType==="code_review",h=e.storage==="workspace"&&!!e.workspacePath,f=UNe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(vOn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(jzn,{status:e.status}):!h||!e.workspacePath?a.jsx(Azn,{}):a.jsx(MPn,{workspacePath:e.workspacePath,artifactVersion:lme(e),workspaceActions:n}):h&&e.workspacePath?qNe(e)||E5(e.workspacePath,e.mimeType)&&e.status!=="available"&&e.status!=="changed"?a.jsx(Vze,{artifact:e,workspaceActions:n}):a.jsx(yM,{workspacePath:e.workspacePath,artifactVersion:lme(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,previewMimeType:e.mimeType,imageMimeType:f,previewKind:Nzn(e)?"html":Mzn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:ft.detail,children:[a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:ft.fieldGrid,children:[a.jsx(op,{label:"Type",value:Cse(e.kind,e.workspacePath)}),a.jsx(op,{label:"Storage",value:e.storage}),a.jsx(op,{label:"Status",value:e.status}),a.jsx(op,{label:"Source",value:e.source}),a.jsx(op,{label:"Size",value:UB(e.sizeBytes)}),a.jsx(op,{label:"Created",value:e.createdAt}),a.jsx(op,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(op,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(op,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:"Description"}),a.jsx("div",{className:ft.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:"Details"}),a.jsxs("div",{className:ft.fieldGrid,children:[Y2(e.metadata,"automationId","Automation ID"),Y2(e.metadata,"schedule","Schedule"),Y2(e.metadata,"timezone","Timezone"),Y2(e.metadata,"status","Status"),Y2(e.metadata,"nextRunAt","Next run"),Y2(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:ft.locationRow,children:[a.jsx("a",{className:ft.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:l}),a.jsx("a",{className:ft.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:ft.meta,children:i})]})]})}function jzn({status:e}){const{t}=dt();return a.jsx("div",{className:ft.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function Azn(){const{t:e}=dt();return a.jsx("div",{className:ft.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function Nzn(e){const t=e.workspacePath?.toLowerCase()??"",n=yw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function Mzn(e){const t=e.workspacePath?.toLowerCase()??"",n=yw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function Vze({artifact:e,workspaceActions:t}){const{t:n}=dt(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=e.workspacePath;d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await WB(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&i(!1)}}};return a.jsx("div",{className:ft.detail,children:a.jsxs("div",{className:ft.section,children:[a.jsx("div",{className:ft.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:ft.fieldGrid,children:[a.jsx(op,{label:"Type",value:Cse(e.kind,e.workspacePath)}),a.jsx(op,{label:"Size",value:UB(e.sizeBytes)}),c?a.jsx(op,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(op,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:ft.downloadRow,children:a.jsx("button",{type:"button",className:ft.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:ft.previewError,children:s})]})})}function Pzn({tab:e}){const{t}=dt(),n=ua(),s=PC(e.workspaceCwd),r=s?.actions,o=Ap(),[i,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[p,m]=d.useState(),g=e.source,v=g.locator,b=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&v.type!=="workspace_file")&&(v.type!=="workspace_file"||g.workspaceCwd===n.workspaceCwd),w=v.type==="workspace_file"?v.workspacePath:v.type==="attachment"?v.attachmentId:"",y=/\.pdf$/i.test(w);if(d.useEffect(()=>{let _=!1;return u(void 0),f(void 0),m(void 0),!b||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const I=await e.sessionActions.readAttachment(v.attachmentId);if(_||!e.owner.isCurrent())return;const E=Uint8Array.from(atob(I.data),N=>N.charCodeAt(0));u(new Blob([E],{type:I.mimeType}))}else if(y&&r){const I=await BR(r.readFileBytes,w,"application/pdf",{statFile:r.stat,isCancelled:()=>_||!e.owner.isCurrent()});!_&&e.owner.isCurrent()&&u(I)}})().catch(I=>{!_&&e.owner.isCurrent()&&f(kl(I))}),()=>{_=!0})},[i,b,v,w,y,e.owner,e.sessionActions,r]),b&&v.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:g.title}),g.description&&a.jsx("p",{children:g.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:v.url}),KR(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:_=>o(_,v.url),children:t("sources.openOriginal")})]});if(!b||!s&&v.type!=="attachment")return a.jsx("div",{className:ft.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!y&&qNe({workspacePath:w});return a.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[a.jsx("span",{className:"truncate text-xs text-muted-foreground",title:w,children:w}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[p&&a.jsx(Ze,{variant:"ghost",size:"icon-sm",asChild:!0,children:a.jsx("a",{href:p,download:g.title,"aria-label":`Download ${g.title}`,title:t("common.download"),children:a.jsx(tb,{})})}),h&&a.jsx(Ze,{variant:"ghost",size:"sm",onClick:()=>l(_=>_+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:ft.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Ze,{onClick:()=>void WB(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(_=>{e.owner.isCurrent()&&f(kl(_))}),children:t("common.download")})]}):(v.type==="attachment"||y)&&!c?a.jsx("div",{className:ft.empty,role:"status",children:t("common.loading")}):c&&!E5(w,c.type)&&c.type!=="application/pdf"&&!bR(c.type,w)?a.jsx(yae,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!Jx(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(yM,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||yw(c?.type)==="text/html"?"source":void 0},i)})]})}function yae({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[o,i]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return i(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),o?a.jsxs("div",{className:ft.imagePreviewWrap,children:[n?a.jsx("img",{className:ft.imagePreview,src:o,alt:t}):a.jsx(Gze,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(tb,{})})]}):null}function yM({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:o,previewMimeType:i,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h,sourceRenderer:f}){const{t:p}=dt();if(E5(e,i||o?.type))return a.jsx(Sp,{resetKeys:[e,n,o,t],fallback:a.jsxs("div",{children:[a.jsx("div",{role:"alert",className:ft.previewError,children:p("excel.invalid")}),o?a.jsx(yae,{data:o,title:e.split(/[/\\]/).pop(),image:!1}):n?a.jsx(Vze,{artifact:{workspacePath:e,kind:"document",mimeType:i,status:"available"},workspaceActions:n},e):null]}),children:a.jsx(d.Suspense,{fallback:a.jsx("div",{className:ft.empty,role:"status",children:p("common.loading")}),children:a.jsx(szn,{workspacePath:e,workspaceActions:n,data:o,artifactVersion:t})})});if(o)return a.jsx(Lzn,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const m=e.toLowerCase(),g=l??Jx(e),v=c??(m.endsWith(".html")||m.endsWith(".htm")?"html":m.endsWith(".md")||m.endsWith(".markdown")?"markdown":g?"image":"source");return v==="html"?a.jsx(Bzn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):v==="markdown"?a.jsx(zzn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):v==="image"&&g?a.jsx($zn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:g,onLoadError:h}):a.jsx(Kze,{sourceRenderer:f,workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function Lzn({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:o}){const i=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return i==="application/pdf"?a.jsx(Ozn,{data:n,mimeType:i,title:e}):bR(i,e)?a.jsx(Dzn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(Gze,{name:e,mimeType:i,size:n.size})}function Dzn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=dt(),[i,l]=d.useState(),[c,u]=d.useState();return d.useEffect(()=>{const h=new FileReader;return l(void 0),u(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=o("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,o]),c?a.jsx("div",{className:ft.previewError,children:c}):i===void 0?a.jsx("div",{className:ft.empty,children:o("attachment.loadingFile")}):a.jsx(yM,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function Ozn({data:e,mimeType:t,title:n}){const{t:s}=dt(),[r,o]=d.useState();return d.useEffect(()=>{const i=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return o(i),()=>URL.revokeObjectURL(i)},[e,t]),r?a.jsx("iframe",{className:ft.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:ft.empty,children:s("attachment.loadingPreview")})}function Gze({name:e,mimeType:t,size:n}){const{t:s}=dt();return a.jsxs("div",{className:ft.unsupportedAttachmentPreview,children:[a.jsx(L0,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:ft.unsupportedAttachmentMeta,children:[t," · ",UB(n)]})]})}function $zn({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[o,i]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return i(null),c(null),BR((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:ft.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:ft.imagePreview,src:o,alt:iL(e)}),a.jsx("a",{className:ft.imageDownloadButton,href:o,download:iL(e),"aria-label":`Download ${iL(e)}`,title:"Download",children:a.jsx(tb,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:ft.empty,children:"Loading image..."}),l&&a.jsx("div",{className:ft.previewError,children:l})]})}function bae({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,maxPreviewBytes:i}){const{t:l}=dt(),[c,u]=d.useState(s??null),[h,f]=d.useState(),[p,m]=d.useState(null);return d.useEffect(()=>{let g=!1;if(u(s??null),m(null),f(void 0),!r)return n.stat(e).then(v=>{if(!g){if(v.type==="directory")throw new Error("Directories cannot be opened as artifacts.");if(i!==void 0&&v.sizeBytes>i)throw new Error(l("files.sourceTooLarge"));return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async v=>{if(g||!v||!v.truncated)return v;const b=await BR((w,y)=>n.readFileBytes(w,y),e,"application/octet-stream",{statFile:w=>n.stat(w),isCancelled:()=>g,maxBytes:i});return{sizeBytes:b.size,content:new TextDecoder(v.encoding||"utf-8").decode(await b.arrayBuffer())}}).then(v=>{g||!v||(f(v.sizeBytes),u(v.content))}).catch(v=>{if(g)return;const b=v instanceof Error?v.message:String(v);m(b),o?.(b)}),()=>{g=!0}},[t,s,r,o,n,e,i,l]),{content:c,error:p,sizeBytes:h}}function Bzn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=bae({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:ft.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:ft.empty,children:"Loading preview..."}):a.jsx(Yze,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(Fzn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:ft.previewError,children:c})]})}function Fzn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=dt(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),Evt(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(kl(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:ft.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:ft.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:ft.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function Kze({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,sourceRenderer:i}){const l=d.useRef(null),[c,u]=d.useState(null),{content:h,error:f}=bae({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o,maxPreviewBytes:i?4*1024*1024:void 0});return d.useEffect(()=>{const p=l.current;if(!p||h===null)return;p.replaceChildren(),u(null);let m;try{m=new ys({doc:h,extensions:[_$e,ys.editable.of(!1),Ui.readOnly.of(!0),ys.lineWrapping],parent:p})}catch(g){u(g instanceof Error?g.message:String(g));return}return()=>m.destroy()},[h,i]),a.jsxs("div",{className:ft.filePreviewWrap,children:[h===null?!f&&a.jsx("div",{className:ft.empty,children:"Loading file..."}):i?a.jsx("div",{className:ft.codeMirrorFile,children:i(h)}):a.jsx("div",{ref:l,className:ft.codeMirrorFile}),(f||c)&&a.jsx("div",{className:ft.previewError,children:f||c})]})}function Yze({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=dt(),[i,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=i===e;return a.jsxs("div",{className:"absolute inset-3 flex min-h-0 flex-col gap-2",children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[a.jsx("span",{children:o("artifact.longDocument")}),a.jsx(Ze,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:o(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(Kze,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function zzn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=bae({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:ft.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:ft.empty,children:"Loading preview..."}):a.jsx(Yze,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:ft.markdownPreviewWrap,children:a.jsx(Jh,{content:l})})}),c&&a.jsx("div",{className:ft.previewError,children:c})]})}function op({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ft.fieldLabel,children:e}),a.jsx("span",{className:ft.fieldValue,children:t})]}):null}function Y2(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(op,{label:n,value:String(s)},t)}/**
|
|
2615
2615
|
* @license
|
|
2616
2616
|
* Copyright 2025 Qwen Team
|
|
2617
2617
|
* SPDX-License-Identifier: Apache-2.0
|