@ziroo/code 1.0.1 → 1.0.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/README.md +59 -175
- package/chunks/{MaxSizedBox-Q2JOCPAR.js → MaxSizedBox-AE6XDJVP.js} +19 -19
- package/chunks/{StandaloneSessionPicker-U3KQ4SRL.js → StandaloneSessionPicker-P4YAL7JP.js} +32 -32
- package/chunks/{acp-subagent-executor-5AY2F4R4.js → acp-subagent-executor-OXSWEENE.js} +22 -22
- package/chunks/{acpAgent-GB5W6MQG.js → acpAgent-7GLEBL6L.js} +59 -59
- package/chunks/{agent-TPX4E25J.js → agent-LM6L5HKI.js} +8 -8
- package/chunks/{agent-headless-C4ARK2AY.js → agent-headless-SXLG3VFE.js} +8 -8
- package/chunks/{anthropicContentGenerator-7BZ32PUH.js → anthropicContentGenerator-EQYVBR54.js} +3 -3
- package/chunks/{boos-release-JACDEY5J.js → boos-release-QUFXXUYD.js} +20 -20
- package/chunks/{bridge-Y2JOQBRU.js → bridge-AQ7UPXAU.js} +22 -22
- package/chunks/{channel-settings-store-VIG5ZWSL.js → channel-settings-store-N2EC6WO7.js} +24 -24
- package/chunks/{chunk-FEHNDQ3H.js → chunk-2GG7PSPS.js} +11 -11
- package/chunks/{chunk-7GJDRSHC.js → chunk-2PRGIRRX.js} +1 -1
- package/chunks/{chunk-QSLYNAIW.js → chunk-34GGSVLG.js} +2 -2
- package/chunks/{chunk-2DUDBNQ3.js → chunk-36N46BV6.js} +2 -2
- package/chunks/{chunk-6LRD3NFT.js → chunk-3OS2WJAJ.js} +8 -8
- package/chunks/{chunk-HO2RNYFB.js → chunk-4N4YBX4A.js} +1 -1
- package/chunks/{chunk-X4RCK3QL.js → chunk-4ODWIFWU.js} +3 -3
- package/chunks/{chunk-IB26TZTM.js → chunk-4OHHXBBK.js} +4 -4
- package/chunks/{chunk-3D7CPWNN.js → chunk-4TCAGPOZ.js} +3 -3
- package/chunks/{chunk-ES7I5JQP.js → chunk-533IZYSM.js} +4 -4
- package/chunks/{chunk-YRLOQQT5.js → chunk-55MLM4TC.js} +1 -1
- package/chunks/{chunk-QQ3RA43B.js → chunk-5ISUWKAK.js} +4 -4
- package/chunks/{chunk-6O7MSMS5.js → chunk-5YQBH2BN.js} +6 -6
- package/chunks/{chunk-XOAXVIQK.js → chunk-5YSS7T3I.js} +48 -48
- package/chunks/{chunk-5XSSWEEZ.js → chunk-6JI7QTXH.js} +5 -5
- package/chunks/{chunk-5VRPMPHD.js → chunk-766M343P.js} +3 -3
- package/chunks/{chunk-ITS5YND4.js → chunk-773URJVC.js} +1 -1
- package/chunks/{chunk-QI7DF3RJ.js → chunk-77TSYP5H.js} +2 -2
- package/chunks/{chunk-MRWPLS7R.js → chunk-7LAZVXPX.js} +1 -1
- package/chunks/{chunk-RS5KUZH7.js → chunk-AAZUDZ46.js} +1 -1
- package/chunks/{chunk-JWBGDOGT.js → chunk-APLLBEY7.js} +1 -1
- package/chunks/{chunk-YFG6IUPF.js → chunk-AQ6645JB.js} +1 -1
- package/chunks/{chunk-KUI7I6QG.js → chunk-ASJUZ7TM.js} +3 -3
- package/chunks/{chunk-ELJAWV7C.js → chunk-BBNOVVVO.js} +2 -2
- package/chunks/{chunk-FWY6ZYOV.js → chunk-CHXTKBVX.js} +5 -5
- package/chunks/{chunk-J5YIW77R.js → chunk-D7XS6D3O.js} +1 -1
- package/chunks/{chunk-MTSWQFYX.js → chunk-EF3CAROL.js} +5 -5
- package/chunks/{chunk-GAIWRTKM.js → chunk-EFNNICVF.js} +3 -3
- package/chunks/{chunk-B2IE7KRJ.js → chunk-EFY4Q6WS.js} +2 -2
- package/chunks/{chunk-JIN6UMM4.js → chunk-FCQBCZHR.js} +1 -1
- package/chunks/{chunk-IFJGGAHR.js → chunk-FOJZAE5N.js} +1 -1
- package/chunks/{chunk-TWIIOXSD.js → chunk-FVVPUV3Z.js} +28 -28
- package/chunks/{chunk-ULKOQQYG.js → chunk-FZ5CX3PV.js} +2 -2
- package/chunks/{chunk-X6VBKXOO.js → chunk-G6GUBKKA.js} +1 -1
- package/chunks/{chunk-WHE5M3SY.js → chunk-GADUNIHK.js} +1 -1
- package/chunks/{chunk-CRWUPJDQ.js → chunk-GQ4HZYC5.js} +1 -1
- package/chunks/{chunk-GVIIPBTL.js → chunk-H5BBPD5X.js} +1 -1
- package/chunks/{chunk-RUIFG3KP.js → chunk-HAL2JWR6.js} +9 -9
- package/chunks/{chunk-LRIKJZ6F.js → chunk-HDVJK6ZF.js} +3 -3
- package/chunks/{chunk-CEGXFKFY.js → chunk-HVMEOGSS.js} +7 -7
- package/chunks/{chunk-WGNKGUWY.js → chunk-I6PD5PPF.js} +2 -2
- package/chunks/{chunk-UTSD75IR.js → chunk-ICT5QTBR.js} +1 -1
- package/chunks/{chunk-KSRQQPLS.js → chunk-IPCGWUQ2.js} +1 -1
- package/chunks/{chunk-XBW6ZPSB.js → chunk-J7GIEMDA.js} +1 -1
- package/chunks/{chunk-B653MHTM.js → chunk-JAKL2XWS.js} +4 -4
- package/chunks/{chunk-I4SK75LC.js → chunk-JAZ2LJCR.js} +1 -1
- package/chunks/{chunk-JM7Y3EMC.js → chunk-JHTX2FXJ.js} +1 -1
- package/chunks/{chunk-QJECQCEX.js → chunk-JJXMFDR6.js} +1 -1
- package/chunks/{chunk-DVGBNV4M.js → chunk-JSXNJ672.js} +9 -9
- package/chunks/{chunk-VUNSANIA.js → chunk-KA5WOAU3.js} +3 -3
- package/chunks/{chunk-SIGAKHJZ.js → chunk-KJOH7AQ6.js} +1 -1
- package/chunks/{chunk-TMKANEWK.js → chunk-KWG2TCKC.js} +1 -1
- package/chunks/{chunk-YO7PCHUV.js → chunk-KXMTNT7A.js} +2 -2
- package/chunks/{chunk-7P3HCIMO.js → chunk-L5ODR7PK.js} +1 -1
- package/chunks/{chunk-H6NBJZMY.js → chunk-M3KE2YHM.js} +1 -1
- package/chunks/{chunk-7IZSFN5Y.js → chunk-M4X5Q5PN.js} +2 -2
- package/chunks/{chunk-UE6P5SMU.js → chunk-MAFSQJAG.js} +1 -1
- package/chunks/{chunk-4R5W6Y5M.js → chunk-NEY3L2Z3.js} +34 -34
- package/chunks/{chunk-OTNRVLMS.js → chunk-NMYCELQ5.js} +4 -4
- package/chunks/{chunk-UO22JLMI.js → chunk-NQMSV4TR.js} +2 -2
- package/chunks/{chunk-7FUEOND4.js → chunk-O7L66CBJ.js} +3 -3
- package/chunks/{chunk-ZLR25Q7U.js → chunk-OXP3KTYJ.js} +15 -15
- package/chunks/{chunk-Y46AMTI4.js → chunk-PDSYERRI.js} +3 -3
- package/chunks/{chunk-TCDJGWG6.js → chunk-PPSIJ3TJ.js} +1 -1
- package/chunks/{chunk-PSYHTJZ7.js → chunk-QTE6ZVBT.js} +14 -14
- package/chunks/{chunk-FAF5P2F4.js → chunk-RB3ZWUBO.js} +1 -1
- package/chunks/{chunk-XS7T37RM.js → chunk-REZX7PDN.js} +5 -5
- package/chunks/{chunk-D4ARUGJI.js → chunk-RJNTBHPV.js} +1 -1
- package/chunks/{chunk-2HGEPNRT.js → chunk-RP6RKYHM.js} +3 -3
- package/chunks/{chunk-NYUO6LAC.js → chunk-TDSZLLAU.js} +1 -1
- package/chunks/{chunk-CCAZCEGZ.js → chunk-TUBH5GZ5.js} +4 -4
- package/chunks/{chunk-LKTV3LED.js → chunk-U5AO3GES.js} +1 -1
- package/chunks/{chunk-VV5H2CBH.js → chunk-UBNQZI33.js} +3 -3
- package/chunks/{chunk-2KW2NLXZ.js → chunk-UC3D3ERG.js} +2 -2
- package/chunks/{chunk-OZWVZDLL.js → chunk-VNOH23VD.js} +3 -3
- package/chunks/{chunk-ANPUTLIM.js → chunk-W2PNTNUF.js} +3 -3
- package/chunks/{chunk-XQRIVVY4.js → chunk-WFMB7UJE.js} +1 -1
- package/chunks/{chunk-GC6C223E.js → chunk-WJ5FRMHA.js} +1 -1
- package/chunks/{chunk-KMTKYZ4L.js → chunk-WLMZRQLB.js} +2 -2
- package/chunks/{chunk-JY56VMDP.js → chunk-XEVW4MH5.js} +2 -2
- package/chunks/{chunk-HKB3RRTW.js → chunk-XEWQCJYQ.js} +4 -4
- package/chunks/{chunk-ZW2LQ3O5.js → chunk-XXKCXJGV.js} +3 -3
- package/chunks/{chunk-CGS7NNKS.js → chunk-XZUA36L6.js} +4 -4
- package/chunks/{chunk-W56A5INY.js → chunk-Y3PSIJFM.js} +2 -2
- package/chunks/{chunk-577FK7HT.js → chunk-YAE47XAF.js} +13 -13
- package/chunks/{chunk-DRGCSW76.js → chunk-YQJBYTAO.js} +4 -4
- package/chunks/{chunk-J7MWEI4R.js → chunk-YWO6STQY.js} +3 -3
- package/chunks/{chunk-7S2Q55NS.js → chunk-ZB7HWY5O.js} +3 -3
- package/chunks/{chunk-T7BMF2JK.js → chunk-ZHNB7IC7.js} +1 -1
- package/chunks/{codex-subagent-executor-6OBS4V63.js → codex-subagent-executor-F7DCLOHZ.js} +22 -22
- package/chunks/{config-utils-5DSANA3X.js → config-utils-63EK3PLX.js} +19 -19
- package/chunks/{contextCommand-5QZJAGOK.js → contextCommand-LPAJPT6C.js} +20 -20
- package/chunks/{core-runtime-2H3XD5KG.js → core-runtime-NJ2F2WO3.js} +19 -19
- package/chunks/{create-sub-session-SO3ZTQKE.js → create-sub-session-UHB3B3AX.js} +20 -20
- package/chunks/{daemon-git-worktree-guard-GTKEB7OB.js → daemon-git-worktree-guard-BHD3BRGI.js} +19 -19
- package/chunks/{daemon-status-provider-FUEHZ3TJ.js → daemon-status-provider-MTO4LPW7.js} +27 -27
- package/chunks/{daemon-trust-policy-7AQNJEAU.js → daemon-trust-policy-CQZMBB26.js} +24 -24
- package/chunks/{daemon-trust-policy-monitor-BINZYOZM.js → daemon-trust-policy-monitor-GQP5EL5S.js} +24 -24
- package/chunks/{deferred-core-runtime-UWVMWUSZ.js → deferred-core-runtime-VVVTV3BL.js} +19 -19
- package/chunks/{edit-OMJOFFUL.js → edit-NKYGXV44.js} +10 -10
- package/chunks/{enterPlanMode-HF7QYLFD.js → enterPlanMode-VKOJKPBP.js} +8 -8
- package/chunks/{environment-PZZBLDDQ.js → environment-F2SFPUAX.js} +21 -21
- package/chunks/{errors-WRCB4RT3.js → errors-GBN2CLPB.js} +21 -21
- package/chunks/{execution-tool-7UW3FHLT.js → execution-tool-DCH6YQSY.js} +10 -10
- package/chunks/{execution-worker-ZKCKWUAW.js → execution-worker-ETIBXT6U.js} +13 -13
- package/chunks/{exitPlanMode-IS7BPROL.js → exitPlanMode-3SKF5ULE.js} +8 -8
- package/chunks/{fast-path-RX5DKDNR.js → fast-path-XAOYHJRJ.js} +2 -2
- package/chunks/{glob-SV27XA7L.js → glob-CQNTPO4I.js} +8 -8
- package/chunks/{goal-tools-CTHXJCKV.js → goal-tools-YINHW3LU.js} +8 -8
- package/chunks/{handleAutoUpdate-7OHWBVHV.js → handleAutoUpdate-CSVD25VH.js} +22 -22
- package/chunks/{i18n-IASTHFDU.js → i18n-RQMF4KIW.js} +19 -19
- package/chunks/{initializer-QZY2XJFE.js → initializer-K42IRXUJ.js} +24 -24
- package/chunks/{installationInfo-CZREULWG.js → installationInfo-P4S3ABXV.js} +19 -19
- package/chunks/{list-F6BKOYSL.js → list-ICNF4DJL.js} +27 -27
- package/chunks/{llm-55SFBSF6.js → llm-EM6EMXPS.js} +52 -52
- package/chunks/{llm-content-generator-C2IULOA6.js → llm-content-generator-LTPAGW7F.js} +3 -3
- package/chunks/{loadedSettingsAdapter-TRF4NN3K.js → loadedSettingsAdapter-XG7Q54GF.js} +24 -24
- package/chunks/{local-execution-environment-PPNGCRRH.js → local-execution-environment-L2R3GPPM.js} +13 -13
- package/chunks/{loggingContentGenerator-OVVFECFP.js → loggingContentGenerator-NXHN7DFF.js} +9 -9
- package/chunks/{managed-npm-update-ODB7PJTB.js → managed-npm-update-NGWD2TE2.js} +19 -19
- package/chunks/{mcp-6UWLYURH.js → mcp-2RM6NY44.js} +24 -24
- package/chunks/{model-call-collection-7RK4O6ZJ.js → model-call-collection-SULIZ2WM.js} +1 -1
- package/chunks/{model-configuration-4KHUABDY.js → model-configuration-DZVJWYDS.js} +24 -24
- package/chunks/{modelConfigUtils-G6OTPT3A.js → modelConfigUtils-6ZATXNBZ.js} +20 -20
- package/chunks/{monitor-QHNB6VRT.js → monitor-AXOG2VVI.js} +8 -8
- package/chunks/{nonInteractiveCli-PPPWBPCD.js → nonInteractiveCli-HYAKFUQE.js} +50 -50
- package/chunks/{nonInteractiveToolExecutor-NWTL7LE4.js → nonInteractiveToolExecutor-C6AZROCN.js} +9 -9
- package/chunks/{notebook-edit-MK2H45YA.js → notebook-edit-D2OMHDEJ.js} +9 -9
- package/chunks/{omni-3MPDLUYX.js → omni-TMZWPVOE.js} +7 -7
- package/chunks/{openaiContentGenerator-RARLY2JJ.js → openaiContentGenerator-F7RNYUSJ.js} +6 -6
- package/chunks/{openaiResponsesContentGenerator-5SASJ3UU.js → openaiResponsesContentGenerator-2WUWCSGR.js} +2 -2
- package/chunks/{pidfile-DHB3GKKM.js → pidfile-XMFKOAX7.js} +19 -19
- package/chunks/{processUtils-ABI7NHUU.js → processUtils-HX75UIIJ.js} +2 -2
- package/chunks/{prompt-terminal-ledger-CRHRHFOU.js → prompt-terminal-ledger-2ANKCQZU.js} +20 -20
- package/chunks/{reactive-degrade-XTWHEG7J.js → reactive-degrade-FB6UAXDW.js} +6 -6
- package/chunks/{read-file-SIWETONB.js → read-file-FDUBNL7U.js} +2 -2
- package/chunks/{ripGrep-5KMUDM3D.js → ripGrep-BJAYYS5X.js} +3 -3
- package/chunks/{run-qwen-serve-SSULB6H3.js → run-qwen-serve-HOJRSKTE.js} +38 -38
- package/chunks/{runtime-EDW62LCI.js → runtime-YJDIT22D.js} +25 -25
- package/chunks/{sandboxConfig-7TKIIVGQ.js → sandboxConfig-HPGK3TLT.js} +19 -19
- package/chunks/{scheduled-tasks-32GCPTKA.js → scheduled-tasks-K4NE6BFL.js} +25 -25
- package/chunks/{scheduler-GYWHSM6Q.js → scheduler-3STY73NU.js} +21 -21
- package/chunks/{serve-EU4BE3NX.js → serve-XOES6FYW.js} +24 -24
- package/chunks/{server-MI4EAJRH.js → server-4FKIR4FW.js} +55 -55
- package/chunks/{session-QJWXM4W3.js → session-57LDIGYD.js} +51 -51
- package/chunks/{session-attachments-root-GS6O6HO5.js → session-attachments-root-ELYAW7TX.js} +19 -19
- package/chunks/{session-pr-refresh-XQI74HRU.js → session-pr-refresh-6BK7LGEL.js} +24 -24
- package/chunks/{settings-O2PKCL6X.js → settings-Q33XSG2I.js} +23 -23
- package/chunks/{shell-ZF2G3HGA.js → shell-7GC7KV7R.js} +8 -8
- package/chunks/{skill-ZYES4JTZ.js → skill-M7AU7ZJO.js} +3 -3
- package/chunks/{skill-settings-AJFHEAB3.js → skill-settings-4IRADBOU.js} +24 -24
- package/chunks/{spawnChannel-R75E6GJY.js → spawnChannel-KWVQ7PN5.js} +21 -21
- package/chunks/{standalone-update-BD72SHPE.js → standalone-update-25M67YEF.js} +20 -20
- package/chunks/{start-opentui-ui-4RUWSZNV.js → start-opentui-ui-EMNVXPYV.js} +56 -56
- package/chunks/{startInteractiveUI-X6ECEZ3N.js → startInteractiveUI-IPQS65AL.js} +60 -60
- package/chunks/{team-create-TUGY6NAK.js → team-create-43JCHJ7E.js} +8 -8
- package/chunks/{team-plan-approval-VF7237WV.js → team-plan-approval-WEW4YEZ6.js} +8 -8
- package/chunks/{terminal-image-renderer-RRCJEWJQ.js → terminal-image-renderer-JI4XZAT6.js} +19 -19
- package/chunks/{theme-manager-NH7O3MIJ.js → theme-manager-UAUH4JZR.js} +19 -19
- package/chunks/{tool-result-media-2PXOQJFH.js → tool-result-media-TZLWS6IM.js} +7 -7
- package/chunks/{tool-search-YE3JQFMK.js → tool-search-47JJFG2G.js} +2 -2
- package/chunks/{total-session-admission-R5TQO5RV.js → total-session-admission-LEUSCAYM.js} +22 -22
- package/chunks/{trustedFolders-4ZSIZHRS.js → trustedFolders-ZDNOUBMY.js} +20 -20
- package/chunks/{update-relaunch-755J32EG.js → update-relaunch-BFIE2TF5.js} +5 -5
- package/chunks/{updateCheck-M77QAS5K.js → updateCheck-WNATFZX5.js} +21 -21
- package/chunks/{upload-config-O57ONA6V.js → upload-config-BDM6VQ2L.js} +4 -4
- package/chunks/{useAutoAcceptIndicator-4Q3JYJUS.js → useAutoAcceptIndicator-7MF27JNW.js} +26 -26
- package/chunks/{validateNonInterActiveAuth-P4J26SAH.js → validateNonInterActiveAuth-CHHURPRY.js} +48 -48
- package/chunks/{version-YS7Z6QEI.js → version-LCAFUCLI.js} +1 -1
- package/chunks/{web-fetch-S543YCL3.js → web-fetch-6EWK33NV.js} +2 -2
- package/chunks/{web-search-AZLDIKXI.js → web-search-D4I6KKCL.js} +4 -4
- package/chunks/{workflow-DPW44KFG.js → workflow-I6PCR6Z4.js} +9 -9
- package/chunks/{workspace-providers-status-KBG4YFN7.js → workspace-providers-status-5NCDWHVK.js} +29 -29
- package/chunks/{workspace-registration-store-3W7MIIMK.js → workspace-registration-store-7OI3V6HT.js} +1 -1
- package/chunks/{workspace-registry-MLFTAWL7.js → workspace-registry-P4RIMY3S.js} +22 -22
- package/chunks/{workspace-runtime-coordinator-ZCYYRG4X.js → workspace-runtime-coordinator-7S636HPY.js} +23 -23
- package/chunks/{workspace-service-GJWEBIRA.js → workspace-service-UAWMARJQ.js} +25 -25
- package/chunks/{workspace-skills-status-GUYXOFWS.js → workspace-skills-status-QNN7QLLG.js} +27 -27
- package/chunks/{workspace-trust-reconciler-3V55KCZA.js → workspace-trust-reconciler-KTRAI3JS.js} +27 -27
- package/chunks/{write-file-S6CWPGLV.js → write-file-3W663MHZ.js} +10 -10
- package/chunks/{zoom-image-B2FLC6RA.js → zoom-image-3AOSKJWX.js} +2 -2
- package/cli.js +12 -12
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +1 -1
- package/web-shell/assets/{abnfDiagram-VCTEODGH-CQyYkbXZ.js → abnfDiagram-VCTEODGH-B2x60Rk3.js} +1 -1
- package/web-shell/assets/{arc-DyYVKvrR.js → arc-Dg10GEs8.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-BCaijm5x.js → architectureDiagram-5GKGNRK7-BQY8S4LV.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-0qHfzjme.js → blockDiagram-NRAW4CY4-kAWHNGCL.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-C_gS0Qwg.js → c4Diagram-UCG6FXSJ-DgZ3QvQv.js} +1 -1
- package/web-shell/assets/channel-CiI5JOh7.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-LWJWNW3v.js → chunk-2Q5K7J3B-CD1ayqhd.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-4UgI-TmG.js → chunk-5VM5RSS4-BcegqjU1.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-De2tA6j1.js → chunk-F27PBJKO-dU88I5xu.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-3LP_lZ_S.js → chunk-G27WJ6UU-BYrrudaW.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-C54lYdnu.js → chunk-JWPE2WC7-BWFmBFi8.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-D1Q4lEm9.js → chunk-LCL6LL3I-IQawQXu2.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-6BoeBX0v.js → chunk-POPQ4Y6H-CtetmNAQ.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-dT4vC6pN.js → chunk-SVP7TREG-r7fzTemk.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-CFQEes_F.js → chunk-XXDRQBXY-3KxjYrnl.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-B_DSU2pm.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-B_DSU2pm.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-ClvmvQTH.js → cose-bilkent-JH36ORCC-d_-9zC98.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-DwfwwS7z.js → cynefin-OW5HDTMX-haMIoxCZ.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BhsPHxR2.js → cynefinDiagram-5FMLGOSQ-DglDDPuI.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-DVxjxvpx.js → dagre-3AP2YEHR-BSgP96YL.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-BAOLm3Ts.js → diagram-S7CK7UJ4-Czni9K67.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-vrcedCb8.js → diagram-UQ7AKVKN-D7BJA-_K.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-D6uJsbFc.js → diagram-VSXAHHWV-BCOwiK7u.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-Byf7duhF.js → diagram-VX7I27RA-B55ho8Un.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-CcR7xx1S.js → diagram-Z3DM3KII-C4ROAETQ.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-GYYAXVI6.js → ebnfDiagram-PWID7BFC-D6rqTgWX.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-ke4WpvXl.js → erDiagram-SSCWMZ5O-Lie6ayrt.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-D8PujwQP.js → flowDiagram-A5DVABFB-DhCi5fe7.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-CGuauosi.js → ganttDiagram-EL5Y4UJY-Ddt7fwy-.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-Cc80WgEl.js → gitGraphDiagram-WWUBYQGX-D5K8VrUo.js} +1 -1
- package/web-shell/assets/{index-CQxep91K.js → index-BgwXHnoB.js} +1 -1
- package/web-shell/assets/{index-D5GdGSA7.js → index-C-kwHBey.js} +3 -3
- package/web-shell/assets/{infoDiagram-RXCK75RN-BStELVvd.js → infoDiagram-RXCK75RN-BEd5ZNPm.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-C-NTa1ph.js → ishikawaDiagram-5VMMS53U-QgJL18nx.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-9SEdumop.js → journeyDiagram-EYS64GPL-CteQlmE5.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-DENZOTcv.js → kanban-definition-3QL26DDD-CgraRinm.js} +1 -1
- package/web-shell/assets/{layout-DSB-mDG5.js → layout-V3Sqj-6n.js} +1 -1
- package/web-shell/assets/{linear-BZWN94TW.js → linear-OZGS3P9o.js} +1 -1
- package/web-shell/assets/{mermaid.core-BhKZI204.js → mermaid.core-Cj1nqB6l.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-Cp0MzK8b.js → mindmap-definition-FBJOCRG2-O_Gz_Qyj.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-XFvOfPoX.js → pegDiagram-XKGWAZYB-ClAXBrOi.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-b0ozwQFT.js → pieDiagram-E7YTZNPT-6PyEIccZ.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-vbMIToVY.js → quadrantDiagram-AXDQQJYC-DbH8pO9i.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-DOtea3y-.js → railroadDiagram-O6MQD6OU-DIMPehjD.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-CXBJUucx.js → requirementDiagram-EFPCY7ZU-CHyYCEoY.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-BUfVMTe0.js → sankeyDiagram-P5KCCOFB-B8Q8oq5P.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-jxPhAE9t.js → sequenceDiagram-WJ2MYXX4-2w5GcO-g.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-Dj02ZTte.js → sizeCapture-X5ZJPWSS--sHR6Yun.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-BCDWSaZ3.js → stateDiagram-HBIQ2CUA-BRLM4uVn.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-tN4VyP8e.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-D2DG3vEa.js → swimlanes-XN3QIQJK-CQq6kzIf.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-HtRX6oN2.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-Kedc8zSU.js → timeline-definition-24CTP7MA-BTu32ToH.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-CdjfgUvk.js → vennDiagram-4TSXK5OY-CpEKggCs.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-BOGxr8BK.js → wardleyDiagram-VM6X3IG4-BYzmZVjK.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-Bp6FKqff.js → xychartDiagram-S5SC5T6Z-CkC73DvL.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-Bh-Zyno9.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-Kjz1oqzK.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-Kjz1oqzK.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-siJeWAsF.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-lLmV5BSm.js +0 -8
|
@@ -1124,7 +1124,7 @@ ${n}`:n}function Hae(e){const t=e.data.indexOf(","),n=e.data.startsWith("data:")
|
|
|
1124
1124
|
</head><body><iframe title="${OR(t)}" src="${OR(e.href)}" sandbox="allow-scripts allow-same-origin allow-forms" referrerpolicy="no-referrer"></iframe></body></html>`}function fJ(e,t){const n=ND(t);if(pJ.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 Ect=new Set([".doc",".docx",".docm",".dotx",".xls",".xlsx",".xlsm",".xlsb",".ppt",".pptx",".pptm",".odt",".ods",".odp"]),pJ=new Set([".m4a",".mp3",".ogg",".wav"]),Rct=new Set([...Ect,...pJ,".pdf",".mp4",".mov",".webm"]);function oIe(e){const t=ND(e.workspacePath),n=Xw(e.mimeType);return t===".svg"||n==="image/svg+xml"||Rct.has(t)?!0:lIe(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 ND(e){const n=(e??"").split(/[?#]/,1)[0].split(/[/\\]/).pop()??"",s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function Act(e,t){return pJ.has(ND(e))||Xw(t).startsWith("audio/")}const jct="qwen.workspace.sha256";function qce(e){const t=e.metadata?.[jct],n=typeof t=="string"?t:"";return`${e.status}:${e.updatedAt}:${n}`}function Nct(e){const t=e.metadata?.artifactType;return typeof t=="string"&&t?t:fJ(e.kind,e.workspacePath??e.url??e.title)}function MD(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const aIe={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"},Mct=100*1024*1024,Pct=256*1024;function Xw(e){return e?.split(";",1)[0]?.trim().toLowerCase()??""}function lIe(e){const t=Xw(e.mimeType);return t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(aIe).includes(t)?t:void 0:sS(e.workspacePath??"")}function sS(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?aIe[n]:void 0}function Lct(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function i4(e,t,n,s){const r=[],i=s.maxBytes??Mct,o=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(o.type==="directory")throw new Error("Directories cannot be opened or downloaded as artifacts.");if(o.sizeBytes>i)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:Pct});if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(c.sizeBytes!==o.sizeBytes)throw new Error("File changed while loading. Please retry.");if(c.returnedBytes<=0&&l<o.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>=o.sizeBytes){const f=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(f.sizeBytes!==o.sizeBytes||f.modifiedMs!==o.modifiedMs)throw new Error("File changed while loading. Please retry.");return new Blob(r,{type:n})}}}async function PD(e,t,n="application/octet-stream",s){const r=await i4((o,l)=>e.readFileBytes(o,l),t,n,{statFile:o=>e.stat(o),isCancelled:s}),i=URL.createObjectURL(r);try{const o=document.createElement("a");o.href=i,o.download=Zw(t).split("/").at(-1)??t,document.body.appendChild(o),o.click(),o.remove()}finally{URL.revokeObjectURL(i)}}function cIe(e){return e.workspacePath??e.url??e.managedId??""}function Zw(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),s=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){s.length>0&&s.at(-1)!==".."?s.pop():n||s.push(i);continue}s.push(i)}const r=s.join("/");return n?`/${r}`:r}function q3(e,t){const n=Zw(e),s=Zw(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 mJ(e,t,n){const s=q3(e??"",n),r=q3(t??"",n);return!!s&&s===r}const FV="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 uIe(e,t){return zV(HV(e),t)}function zV(e,t){return`<!doctype html><html><head>
|
|
1125
1125
|
<meta http-equiv="Content-Security-Policy" content="${FV} frame-src 'none';">
|
|
1126
1126
|
<style>html,body,iframe{width:100%;height:100%;margin:0;border:0;display:block;overflow:hidden}</style>
|
|
1127
|
-
</head><body><iframe title="${OR(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${OR(e)}"></iframe></body></html>`}let lN;async function Dct(e,t,n){if(lN?.content===e&&lN.title===t)return lN.document;const s=await Oct(e,t,n);return lN={content:e,title:t,document:s},s}async function Oct(e,t,n){if(typeof DOMParser>"u")return uIe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return zV(HV(s),t);const r=new AbortController,i=()=>r.abort();n.addEventListener("abort",i,{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([o,l,c,u])=>{const h=s.querySelector(o),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/boos-code@1.0.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}),y=await new Promise((w,b)=>{const x=new FileReader;x.onload=()=>w(x.result),x.onerror=()=>b(x.error),x.readAsDataURL(v)});h.setAttribute(l,y),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",i),r.abort()}return zV(HV(s),t)}function HV(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${FV}"></head><body>${$ct(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=FV,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function $ct(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 dIe={csv:vct,file:wct,html:yct,image:bct,link:xct,md:kct,pdf:_ct,spreadsheet:Sct,video:Cct,word:Tct},Bct={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Fct={audio:lJ,document:r4,notebook:qat},Wce={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 hIe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=ND(t).slice(1);if(n&&Wce[n])return Wce[n];const s=Xw(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":Bct[e.kind]??"file"}function fIe({artifact:e,className:t}){const{artifact:n}=Nd(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=hIe(e),i=e?e.workspacePath??e.url??e.title:void 0,o=r==="file"&&e?Act(i,e.mimeType)?"audio":e.kind:void 0,l=o?Fct[o]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":o,"aria-hidden":"true"}):a.jsx("img",{className:t,src:dIe[r],"data-artifact-icon":r,alt:""})}const zct=[[new Set(["json","jsonl","geojson"]),wit],[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"]),y7],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),vot],[new Set(["csv","tsv","xls","xlsx","ods"]),Sot],[new Set(["ppt","pptx","odp"]),llt],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),$4e],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),lJ],[new Set(["mp4","mov","webm","avi","mkv"]),B4e],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),r4]];function Hct(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of zct)if(s.has(n))return r;return t?.startsWith("image/")?$4e:t?.startsWith("audio/")?lJ:t?.startsWith("video/")?B4e:t?.startsWith("text/")?r4:F4e}function mg({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const i=Hct(e,t),o=hIe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return o!=="file"||i===F4e?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":o,children:a.jsx("image",{href:dIe[o],width:"100%",height:"100%"})}):a.jsx(i,{size:n,absoluteStrokeWidth:s,...r})}const Uct="_panel_19vsn_1",qct="_floating_19vsn_16",Wct="_section_19vsn_26",Vct="_sectionHeader_19vsn_40",Gct="_sectionHeaderRow_19vsn_59",Kct="_sectionAction_19vsn_70",Yct="_sectionContent_19vsn_111",Xct="_row_19vsn_115",Zct="_workspaceIcon_19vsn_158",Qct="_rowActionIcon_19vsn_162",Jct="_label_19vsn_168",eut="_branchName_19vsn_173",tut="_value_19vsn_181",nut="_tasks_19vsn_191",sut="_task_19vsn_191",rut="_taskIcon_19vsn_229",iut="_taskLabel_19vsn_240",out="_agentName_19vsn_248",aut="_taskName_19vsn_249",lut="_agentColor_19vsn_260",cut="_agentTag_19vsn_269",uut="_taskStatus_19vsn_280",dut="_statusRunning_19vsn_301",hut="_attachmentFiles_19vsn_311",fut="_attachmentFile_19vsn_311",put="_attachmentFileIcon_19vsn_344",mut="_attachmentFileName_19vsn_348",gut="_emptyDescription_19vsn_356",vut="_sourceTitle_19vsn_363",wr={panel:Uct,floating:qct,section:Wct,sectionHeader:Vct,sectionHeaderRow:Gct,sectionAction:Kct,sectionContent:Yct,row:Xct,workspaceIcon:Zct,rowActionIcon:Qct,label:Jct,branchName:eut,value:tut,tasks:nut,task:sut,taskIcon:rut,taskLabel:iut,agentName:out,taskName:aut,agentColor:lut,agentTag:cut,taskStatus:uut,statusRunning:dut,attachmentFiles:hut,attachmentFile:fut,attachmentFileIcon:put,attachmentFileName:mut,emptyDescription:gut,sourceTitle:vut};function pIe({entries:e,onOpen:t}){const{t:n}=pt();return a.jsx("ul",{className:wr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:wr.attachmentFile,title:zce(s),"aria-label":s.type==="source"?`${n("sources.open")} ${Fce(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(U4e,{size:16,strokeWidth:1.7,className:wr.attachmentFileIcon}):a.jsx(mg,{name:zce(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:wr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:wr.attachmentFileName,children:Fce(s)})]})},_8(s)))})}function $0({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Fn("animate-pulse rounded-md bg-muted",e),...t})}function wut(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function yut({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:i,onOpen:o,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p}){const{t:m}=pt(),[g,v]=d.useState(!1),[y,w]=d.useState(!1);d.useEffect(()=>{e&&w(!1)},[e]),d.useEffect(()=>{w(!1),v(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(y&&t?.supported===!0),()=>c?.(!1)),[y,c,t?.supported]);const b=t?.supported?t.sources:[],x=nIe(b,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const k=s||t?.supported&&t.loading;return a.jsxs("section",{className:wr.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:wr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${wr.sectionHeader} ${wr.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&wut()&&a.jsx("button",{type:"button",className:wr.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(rh,{})})]}),l&&a.jsxs("div",{className:wr.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(wt,{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(wt,{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(wt,{size:"sm",variant:"link",onClick:i,children:m("common.retry")})]}),a.jsx(pIe,{entries:g?x:x.slice(0,3),onOpen:S=>mIe(S,{onOpen:o,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),k&&!x.length&&a.jsx("ul",{className:wr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(S=>a.jsxs("li",{className:wr.attachmentFile,children:[a.jsx($0,{className:"size-4 shrink-0 rounded-sm"}),a.jsx($0,{className:"h-4",style:{width:`${S}%`}})]},S))}),!k&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:wr.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:wr.attachmentFile,"aria-expanded":g,onClick:()=>v(S=>!S),children:m(g?"common.collapse":"sources.viewAll")}),y&&t?.supported&&a.jsx(but,{state:t,onClose:()=>w(!1)})]})}function but({state:e,onClose:t}){const{t:n}=pt(),[s,r]=d.useState("workspace_file"),[i,o]=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 y=s==="url"?new URL(i).hostname:i.split(/[\\/]/).at(-1)||i,w=s==="workspace_file"?{type:s,workspacePath:i}:{type:s,url:i};await e.upsert({title:l.trim()||y.trim().slice(0,200),locator:w,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(y){e.owner.isCurrent()&&p(y instanceof Error?y.message:String(y))}finally{e.owner.isCurrent()&&g(!1)}};return a.jsx(Ko,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:y=>{y.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:y=>{r(y.target.value),o(""),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(Yr,{value:i,onChange:y=>o(y.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(Yr,{value:l,maxLength:200,onChange:y=>c(y.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(Yr,{value:u,maxLength:1e3,onChange:y=>h(y.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(wt,{type:"submit",disabled:m||!i,children:n("sources.add")})]})})}function mIe(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})}/**
|
|
1127
|
+
</head><body><iframe title="${OR(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${OR(e)}"></iframe></body></html>`}let lN;async function Dct(e,t,n){if(lN?.content===e&&lN.title===t)return lN.document;const s=await Oct(e,t,n);return lN={content:e,title:t,document:s},s}async function Oct(e,t,n){if(typeof DOMParser>"u")return uIe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return zV(HV(s),t);const r=new AbortController,i=()=>r.abort();n.addEventListener("abort",i,{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([o,l,c,u])=>{const h=s.querySelector(o),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/boos-code@1.0.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}),y=await new Promise((w,b)=>{const x=new FileReader;x.onload=()=>w(x.result),x.onerror=()=>b(x.error),x.readAsDataURL(v)});h.setAttribute(l,y),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",i),r.abort()}return zV(HV(s),t)}function HV(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${FV}"></head><body>${$ct(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=FV,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function $ct(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 dIe={csv:vct,file:wct,html:yct,image:bct,link:xct,md:kct,pdf:_ct,spreadsheet:Sct,video:Cct,word:Tct},Bct={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Fct={audio:lJ,document:r4,notebook:qat},Wce={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 hIe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=ND(t).slice(1);if(n&&Wce[n])return Wce[n];const s=Xw(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":Bct[e.kind]??"file"}function fIe({artifact:e,className:t}){const{artifact:n}=Nd(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=hIe(e),i=e?e.workspacePath??e.url??e.title:void 0,o=r==="file"&&e?Act(i,e.mimeType)?"audio":e.kind:void 0,l=o?Fct[o]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":o,"aria-hidden":"true"}):a.jsx("img",{className:t,src:dIe[r],"data-artifact-icon":r,alt:""})}const zct=[[new Set(["json","jsonl","geojson"]),wit],[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"]),y7],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),vot],[new Set(["csv","tsv","xls","xlsx","ods"]),Sot],[new Set(["ppt","pptx","odp"]),llt],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),$4e],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),lJ],[new Set(["mp4","mov","webm","avi","mkv"]),B4e],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),r4]];function Hct(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of zct)if(s.has(n))return r;return t?.startsWith("image/")?$4e:t?.startsWith("audio/")?lJ:t?.startsWith("video/")?B4e:t?.startsWith("text/")?r4:F4e}function mg({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const i=Hct(e,t),o=hIe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return o!=="file"||i===F4e?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":o,children:a.jsx("image",{href:dIe[o],width:"100%",height:"100%"})}):a.jsx(i,{size:n,absoluteStrokeWidth:s,...r})}const Uct="_panel_19vsn_1",qct="_floating_19vsn_16",Wct="_section_19vsn_26",Vct="_sectionHeader_19vsn_40",Gct="_sectionHeaderRow_19vsn_59",Kct="_sectionAction_19vsn_70",Yct="_sectionContent_19vsn_111",Xct="_row_19vsn_115",Zct="_workspaceIcon_19vsn_158",Qct="_rowActionIcon_19vsn_162",Jct="_label_19vsn_168",eut="_branchName_19vsn_173",tut="_value_19vsn_181",nut="_tasks_19vsn_191",sut="_task_19vsn_191",rut="_taskIcon_19vsn_229",iut="_taskLabel_19vsn_240",out="_agentName_19vsn_248",aut="_taskName_19vsn_249",lut="_agentColor_19vsn_260",cut="_agentTag_19vsn_269",uut="_taskStatus_19vsn_280",dut="_statusRunning_19vsn_301",hut="_attachmentFiles_19vsn_311",fut="_attachmentFile_19vsn_311",put="_attachmentFileIcon_19vsn_344",mut="_attachmentFileName_19vsn_348",gut="_emptyDescription_19vsn_356",vut="_sourceTitle_19vsn_363",wr={panel:Uct,floating:qct,section:Wct,sectionHeader:Vct,sectionHeaderRow:Gct,sectionAction:Kct,sectionContent:Yct,row:Xct,workspaceIcon:Zct,rowActionIcon:Qct,label:Jct,branchName:eut,value:tut,tasks:nut,task:sut,taskIcon:rut,taskLabel:iut,agentName:out,taskName:aut,agentColor:lut,agentTag:cut,taskStatus:uut,statusRunning:dut,attachmentFiles:hut,attachmentFile:fut,attachmentFileIcon:put,attachmentFileName:mut,emptyDescription:gut,sourceTitle:vut};function pIe({entries:e,onOpen:t}){const{t:n}=pt();return a.jsx("ul",{className:wr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:wr.attachmentFile,title:zce(s),"aria-label":s.type==="source"?`${n("sources.open")} ${Fce(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(U4e,{size:16,strokeWidth:1.7,className:wr.attachmentFileIcon}):a.jsx(mg,{name:zce(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:wr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:wr.attachmentFileName,children:Fce(s)})]})},_8(s)))})}function $0({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Fn("animate-pulse rounded-md bg-muted",e),...t})}function wut(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function yut({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:i,onOpen:o,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p}){const{t:m}=pt(),[g,v]=d.useState(!1),[y,w]=d.useState(!1);d.useEffect(()=>{e&&w(!1)},[e]),d.useEffect(()=>{w(!1),v(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(y&&t?.supported===!0),()=>c?.(!1)),[y,c,t?.supported]);const b=t?.supported?t.sources:[],x=nIe(b,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const k=s||t?.supported&&t.loading;return a.jsxs("section",{className:wr.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:wr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${wr.sectionHeader} ${wr.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&wut()&&a.jsx("button",{type:"button",className:wr.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(rh,{})})]}),l&&a.jsxs("div",{className:wr.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(wt,{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(wt,{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(wt,{size:"sm",variant:"link",onClick:i,children:m("common.retry")})]}),a.jsx(pIe,{entries:g?x:x.slice(0,3),onOpen:S=>mIe(S,{onOpen:o,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),k&&!x.length&&a.jsx("ul",{className:wr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(S=>a.jsxs("li",{className:wr.attachmentFile,children:[a.jsx($0,{className:"size-4 shrink-0 rounded-sm"}),a.jsx($0,{className:"h-4",style:{width:`${S}%`}})]},S))}),!k&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:wr.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:wr.attachmentFile,"aria-expanded":g,onClick:()=>v(S=>!S),children:m(g?"common.collapse":"sources.viewAll")}),y&&t?.supported&&a.jsx(but,{state:t,onClose:()=>w(!1)})]})}function but({state:e,onClose:t}){const{t:n}=pt(),[s,r]=d.useState("workspace_file"),[i,o]=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 y=s==="url"?new URL(i).hostname:i.split(/[\\/]/).at(-1)||i,w=s==="workspace_file"?{type:s,workspacePath:i}:{type:s,url:i};await e.upsert({title:l.trim()||y.trim().slice(0,200),locator:w,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(y){e.owner.isCurrent()&&p(y instanceof Error?y.message:String(y))}finally{e.owner.isCurrent()&&g(!1)}};return a.jsx(Ko,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:y=>{y.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:y=>{r(y.target.value),o(""),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(Yr,{value:i,onChange:y=>o(y.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(Yr,{value:l,maxLength:200,onChange:y=>c(y.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(Yr,{value:u,maxLength:1e3,onChange:y=>h(y.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(wt,{type:"submit",disabled:m||!i,children:n("sources.add")})]})})}function mIe(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})}/**
|
|
1128
1128
|
* @license
|
|
1129
1129
|
* Copyright 2026 Qwen Team
|
|
1130
1130
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -1644,7 +1644,7 @@ License: MIT
|
|
|
1644
1644
|
})();`,ACt=`<!doctype html>
|
|
1645
1645
|
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${ICt}"></head>
|
|
1646
1646
|
<body><script>${RCt}<\/script></body></html>`;function jCt(){const e=globalThis.crypto;if(!e?.getRandomValues)throw new Ts("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 Che(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function NCt(e){if(e.signal.aborted)return Promise.reject(Che());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new Ts("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new Ts("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=jCt(),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=ACt,new Promise((s,r)=>{let i=!1,o=!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)=>{i||(i=!0,c(),m(g))},h=m=>{i||(i=!0,c(),r(m))},f=()=>h(Che()),p=m=>{if(!(m.source!==n.contentWindow||!$o(m.data))&&!(m.data.channel!==zG||m.data.requestId!==t)){if(m.data.type==="error"){h(new Ts("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(m.data.type==="result")try{const g=gEe(m.data.option);if(!$o(g))throw new Ts("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 Ts("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to load")),n.onload=()=>{if(!o){if(o=!0,n.onload=null,i||e.signal.aborted){f();return}n.contentWindow?.postMessage({channel:zG,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>h(new Ts("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var t5e=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);Ge(this,"code");Ge(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s?.cause}},MCt=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function PCt(e,t){const n={...MCt,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new Ts("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function n5e(e){let t;try{t=await e.resolveContent()}catch(i){throw e.signal.aborted||e.preserveLegacySandboxError&&i instanceof t5e?i:new Ts("REF_RESOLUTION_FAILED",e.resolutionError,{cause:i})}if(typeof t!="string")throw new Ts("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=_Ct(t,e.limits),s=TCt(e.source);if(!s)throw new Ts("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await NCt({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:r}}async function LCt(e){return n5e({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 DCt(e){return n5e({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 OCt=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),$Ct=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"]),BCt=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),FCt=/(?:url|uri|href|src|link)$/i,zCt=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,The=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,HCt=/\burl\s*\(/i,UCt=/<\s*\/?\s*[a-z][^>]*>/i,qCt=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,WCt=/^[A-Za-z_][A-Za-z0-9_]*$/;function Qo(e){throw new Ts("SCHEMA_INVALID",e)}function HG(e,t,n){for(const s of Object.keys(e))t.has(s)||Qo(`${n}.${s} is not allowed`)}function Ihe(e,t){if(!Array.isArray(e)||e.length===0)return Qo(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!WCt.test(s)?Qo(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?Qo(`${t} must not contain duplicate dimensions`):n}function VCt(e,t){if(!$o(e)||typeof e.kind!="string")return Qo("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){HG(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=Ihe(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return Qo("echarts-fulldata.data.source must be an array");e.source.forEach((r,i)=>{Array.isArray(r)||Qo(`echarts-fulldata.data.source[${i}] must be an array`),r.length!==n.length&&Qo(`echarts-fulldata.data.source[${i}] must contain ${n.length} cells`)});const s=oO(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(HG(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return Qo("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return Qo("echarts-fulldata.data.format must be csv or json");const n=Ihe(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return Qo(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function s5e(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!$o(r)||typeof r.text!="string")continue;const i=r.text.trim();if(i)return{index:s,isArray:t,title:r,text:i}}}function GCt(e){return s5e(e)?.text}function KCt(e,t){const n=s5e(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 Jw(e){return Array.isArray(e)?e.map(t=>Jw(t)):$o(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Jw(n)])):e}function r5e(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&Qo(`${t} must be an array of non-empty strings`),[...e]}function oO(e,t,n){if(Array.isArray(e)||Qo(`${n} must be an array`),e.length>t.maxRows)throw new Ts("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxRows} row limit`);let s=0;const r=e.map((i,o)=>{if(Array.isArray(i)){const l=i.map((c,u)=>(c!==null&&!["string","number","boolean"].includes(typeof c)&&Qo(`${n}[${o}][${u}] must be a JSON scalar`),c));return s+=l.length,l}if($o(i)){const l={};for(const[c,u]of Object.entries(i))u!==null&&!["string","number","boolean"].includes(typeof u)&&Qo(`${n}[${o}].${c} must be a JSON scalar`),l[c]=u,s+=1;return l}return Qo(`${n}[${o}] must be an array or object`)});if(s>t.maxCells)throw new Ts("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function YCt(e,t){if(!$o(e)||typeof e.kind!="string")return Qo("echarts.data must be an inline or ref dataset object");const n=r5e(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const s=oO(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?Qo("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?Qo("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:Qo(`Unsupported echarts.data.kind: ${e.kind}`)}function Ehe(e,t){if(zCt.test(e))throw new Ts("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(The.test(s)||The.test(n.trim())||HCt.test(e)||UCt.test(e)||qCt.test(e))throw new Ts("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function XCt(e,t){for(const r of Object.keys(e))if(!$Ct.has(r))throw new Ts("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,i,o)=>{if(n+=1,n>t.maxNodes)throw new Ts("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(o>t.maxDepth)throw new Ts("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){Ehe(r,i);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${i}[${c}]`,o+1));return}if($o(r))for(const[l,c]of Object.entries(r)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new Ts("UNSAFE_SPEC",`${i}.${l} must be a string`);Ehe(c,`${i}.${l}`);continue}if(BCt.has(u)||FCt.test(l))throw new Ts("UNSAFE_SPEC",`${i}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new Ts("UNSAFE_SPEC","Custom ECharts series are not allowed");s(c,`${i}.${l}`,o+1)}};if(s(e,"echarts.option",0),Array.isArray(e.series)&&e.series.length>t.maxSeries)throw new Ts("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxSeries} series limit`);e.dataset!==void 0&&(Array.isArray(e.dataset)?e.dataset:[e.dataset]).forEach((i,o)=>{$o(i)||Qo(`echarts.option.dataset[${o}] must be an object`),i.source!==void 0&&oO(i.source,t,`echarts.option.dataset[${o}].source`)})}function UG(e,t,n){if(!$o(e))return Qo("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return Qo("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=Jw(e),r=t===void 0?void 0:YCt(t,n);return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?Qo("echarts.option.dataset cannot be combined with echarts.data"):(XCt(s,n),{option:s,data:r})}function ZCt(e,t){if(!$o(e))return Qo("echarts-fulldata must contain an object");if(HG(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new Ts("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return Qo("echarts-fulldata.data is required");if(!$o(e.option))return Qo("echarts-fulldata.option must be an object");const n=VCt(e.data,t);return UG(e.option,n,t)}function QCt(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new Ts("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function Rhe(e,t){const n=oO(e.source,t,"resolvedDataset.source"),s=e.dimensions?r5e(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 JCt={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 ug(e,t){const n={...Jw(e),...t};for(const[s,r]of Object.entries(e)){const i=t[s];$o(r)&&$o(i)&&(n[s]=ug(r,i))}return n}function QE(e,t){return Array.isArray(e)?e.map(n=>$o(n)?ug(t,n):n):$o(e)?ug(t,e):e??Jw(t)}function i5e(e){const t=n=>$o(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function s5(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function e2t(e,t){const n=s=>{if(!s5(s,"top")&&!s5(s,"bottom"))return ug(t,s);const r=Jw(t);return delete r.top,delete r.bottom,ug(r,s)};return Array.isArray(e)?e.map(s=>$o(s)?n(s):s):$o(e)?n(e):e??Jw(t)}var t2t=740,o5e=10,Ahe=t2t*o5e/100,n2t=24,s2t=24,jhe=16,r2t=24;function a5e(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=Ahe?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<=o5e?Ahe:null}function i2t(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function o2t(e){return e.show===!1||!i2t(e)?null:s5(e,"top")?a5e(e.top):s5(e,"bottom")?null:0}function a2t(e){return e.show===!1||!s5(e,"top")?null:a5e(e.top)}function Nhe(e){return Array.isArray(e)?e.filter($o):$o(e)?[e]:[]}function l2t(e,t){const n=Nhe(e).flatMap(r=>{const i=o2t(r);return i===null?[]:[i+n2t+jhe]}),s=Nhe(t).flatMap(r=>{const i=a2t(r);return i===null?[]:[i+s2t+jhe]});return Math.max(r2t,...n,...s)}function Mhe(e,t){return Array.isArray(e)?e.map((n,s)=>$o(n)?ug(t(s),n):n):$o(e)?ug(t(0),e):e}function Phe(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=ug(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=ug(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=ug(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=ug(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=i5e(QE(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var l5e=new Set(["pie","funnel","gauge","radar","treemap"]),c2t=new Set([...l5e,"graph","chord","themeRiver"]);function c5e(e){return Array.isArray(e.series)?e.series.filter($o):$o(e.series)?[e.series]:[]}function u2t(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=c5e(e);return t.some(n=>typeof n.type=="string"&&c2t.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function d2t(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=c5e(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&l5e.has(n.type))?"item":"axis"}function h2t(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function f2t(e,t="light"){const n=JCt[t],s=Jw(e);return s.backgroundColor??=n.background,s.color??=[...n.palette],s.textStyle=QE(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=QE(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=i5e(QE(s.tooltip,{trigger:d2t(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}}})),u2t(e)&&(s.legend=e2t(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=QE(s.grid,{top:l2t(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=Mhe(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=Mhe(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=>$o(r)?Phe(r,n):r):$o(s.series)&&(s.series=Phe(s.series,n)),s}var hH={dispose(){}};function p2t(e={}){const t={...OCt,...e.limits},n=e.legacySandbox?.resolveLegacyArtifactContent,s=e.legacySandbox?.resolveLegacySandboxFileContent,r=e.legacySandbox?PCt({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,i=e.loadECharts??(async()=>await He(()=>import("./index-DohPy72Z.js"),[])),o=async(l,c)=>{if(e.validateDataRef&&!e.validateDataRef(l.ref))throw new Ts("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new Ts("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 Ts("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 Rhe(h,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:yCt,parse(l,c){return c.language==="echarts-fulldata"?ZCt(l,t):UG(l,c.data,t)},parseSource(l,c){return e5e(c.language)?{option:{},data:void 0,legacyEChartSandboxFile:xCt(c.rawLanguage??c.language,l)}:{option:{},data:void 0,legacyEChartQuery:bCt(c.language,l)}},getTitle(l){return GCt(l.option)},async materialize(l,c){if(!l.legacyEChartQuery&&!l.legacyEChartSandboxFile){if(l.data?.kind==="ref"){const p=await o(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 Ts("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(l.legacyEChartSandboxFile&&!s)throw new Ts("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let u;try{l.legacyEChartSandboxFile?u=await DCt({block:l.legacyEChartSandboxFile,signal:c.signal,resolveSandboxFileContent:s,limits:r,preserveLegacySandboxError:e.legacySandbox!==void 0}):u=await LCt({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 Ts||p instanceof t5e?p:new Ts("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=gEe(u,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(p){throw p instanceof Ts?p:new Ts("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:p})}if(!$o(h))return Qo("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(h,"data")||!Object.prototype.hasOwnProperty.call(h,"spec"))return Qo("Temporary ChatBI resolver must return data and spec");const f=UG(h.spec,h.data,t);return f.data?.kind!=="inline"?Qo("Temporary ChatBI resolver must return inline data"):{parsed:f,data:f.data}},async mount(l,c,u){if(c.legacyEChartQuery||c.legacyEChartSandboxFile)return Qo("Temporary ChatBI charts must be materialized before mounting");const h=Jw(c.option);if(u.externalizedTitle&&KCt(h,u.externalizedTitle),c.data){let y;if(c.data.kind==="inline")y=c.data;else{const b=await o(c.data,u.signal);if(!b)return hH;y=b}const w=Rhe(y,t);h.dataset=w.option}if(u.signal.aborted)return hH;let f;try{f=QCt(await i())}catch(y){throw y instanceof Ts?y:new Ts("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:y})}if(u.signal.aborted)return hH;let p,m;try{const y=typeof u.theme=="string"||$o(u.theme)?u.theme:void 0;p=f.init(l,y);const w=h2t(u.theme),b=e.defaultStyle===!1||!w?h:f2t(h,w);p.setOption(b,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(m=new ResizeObserver(()=>p?.resize()),m.observe(l))}catch(y){try{m?.disconnect()}catch{}try{p?.dispose()}catch{}throw new Ts("RENDER_FAILED","ECharts failed to render the chart",{cause:y})}const g=p;let v=!1;return{resize:()=>g.resize(),dispose(){v||(v=!0,m?.disconnect(),g.dispose())}}}}}var xee=d.createContext(null);function m2t(e){if(d.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function g2t(e){const t=e.source??m2t(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(xee.Provider,{value:n},e.children)}function v2t(e){const t=d.useContext(xee);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,i=e.labels??t.labels,o=d.useMemo(()=>wEe(i),[i]);d.useEffect(()=>{const c=n.current;if(!c)return;const u=new Agt(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}:{},...i!==void 0?{labels:i}:{}}).catch(f=>{h||(c.classList.add("markdown-chart-error"),c.setAttribute("role","alert"),c.textContent=o.chartUnavailable,t.onError?.(f,{language:e.language,source:e.source}))}),()=>{h=!0,u.dispose()}},[t.registry,t.theme,t.onError,r,i,o,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":o.chart,"aria-busy":s||void 0,"data-markdown-chart-complete":String(!s)})}function w2t(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(`
|
|
1647
|
-
`,Math.max(0,n-1))+1,i=e.slice(r,n),o=/^(?: {0,3}>[ \t]?)+$/.test(i)?r:n;return bEe(e.slice(o,s))||e.slice(s).trim().length>0}function u5e(e,t){return e===T8||t?.has(e)===!0}function y2t(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...i}){const o=d.useContext(xee);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&u5e(h,o?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(v2t,{language:u,source:f,streaming:o?.streaming===!0&&!w2t(o.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",i,r)}}}const b2t=3e4,x2t=["artifact://","session-file://"],k2t=/^[a-z]:/i;function _2t(e={}){const{resolveDataRef:t,validateDataRef:n=E2t,...s}=e,r=e.validateDataRef===void 0,i=t?async(o,l)=>{const c=r?d5e(o):o;if(!c)throw new Error("Chart data reference is not supported.");return R2t(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new pgt().register(p2t({...s,resolveDataRef:i,validateDataRef:n}))}const S2t={registry:_2t()};function C2t(e,t={}){const n=y2t(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...i}){if(d.isValidElement(r)){const o=r,c=/(?:^|\s)language-([^\s]+)/.exec(o.props.className??"")?.[1]?.toLowerCase();if(c&&u5e(c,e))return d.createElement(n,i,r)}return d.createElement(d.Fragment,null,r)}}function T2t({customization:e,source:t,streaming:n,theme:s,children:r}){const i=I2t(e.labels),{t:o}=pt();return a.jsx(g2t,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??o("echartsChart.rendering"),labels:i,onError:e.onError,children:r})}function I2t(e){const{t}=pt();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:i})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:i,omittedRows:s-n,omittedColumns:i-r}),...e}),[e,t])}function Lhe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function d5e(e){if(e.trim()!==e||!e||Lhe(e))return;const t=e.toLowerCase(),n=x2t.find(o=>t.startsWith(o));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)||Lhe(r))return;const i=r.split("/");if(!i.some(o=>o.length===0||o==="."||o===".."||k2t.test(o)))return`${n}${i.join("/")}`}function E2t(e){return d5e(e)!==void 0}function R2t(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),b2t);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const A2t="_content_1ns4y_1",j2t="_streamingPlainText_1ns4y_11",N2t="_inlineCode_1ns4y_135",M2t="_link_1ns4y_147",P2t="_tableWrapper_1ns4y_157",L2t="_table_1ns4y_157",D2t="_image_1ns4y_187",O2t="_codeBlock_1ns4y_195",$2t="_codeBlockHeader_1ns4y_204",B2t="_codeBlockLang_1ns4y_213",F2t="_codeBlockCopy_1ns4y_221",z2t="_codeBlockContent_1ns4y_244",H2t="_codeBlockPlain_1ns4y_264",U2t="_mermaidBlock_1ns4y_282",q2t="_mermaidInline_1ns4y_294",W2t="_mermaidStage_1ns4y_308",V2t="_mermaidLoading_1ns4y_331",G2t="_mermaidActions_1ns4y_338",K2t="_mermaidZoomWrapper_1ns4y_343",Y2t="_mermaidPannable_1ns4y_358",X2t="_mermaidDragging_1ns4y_362",Ei={content:A2t,streamingPlainText:j2t,inlineCode:N2t,link:M2t,tableWrapper:P2t,table:L2t,image:D2t,codeBlock:O2t,codeBlockHeader:$2t,codeBlockLang:B2t,codeBlockCopy:F2t,codeBlockContent:z2t,codeBlockPlain:H2t,mermaidBlock:U2t,mermaidInline:q2t,mermaidStage:W2t,mermaidLoading:V2t,mermaidActions:G2t,mermaidZoomWrapper:K2t,mermaidPannable:Y2t,mermaidDragging:X2t},Z2t=32e3,Q2t=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"]),Dhe={"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 kee(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(Dhe,t)?Dhe[t]:t,s=Q2t.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const h5e=/^(https?:|mailto:)/i,J2t=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,f5e=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function p4(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:h5e.test(t):!1}function kv(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?f5e.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||J2t.test(n)?!0:h5e.test(n):!1}let Ohe,$he=Promise.resolve(),eTt=0;const tTt=5e4,nTt=500,sTt=1e4,Bhe=16;function rTt({code:e}){const{t}=pt(),n=py(),s=Xa()!=="interactive",[r,i]=d.useState(null),[o,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=E1(),[p,m]=d.useState(1),[g,v]=d.useState(!1),y=d.useRef(null),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[S,T]=d.useState(null),E=d.useRef(null),A=d.useRef(null),C=n==="light"?"default":"dark",I=.5,R=3,N=.25,j=()=>{m(X=>Math.min(R,Math.round((X+N)*100)/100))},P=()=>{m(X=>Math.max(I,Math.round((X-N)*100)/100))},$=d.useCallback(()=>{A.current=null,v(!1),m(1);const X=y.current;X&&(X.scrollLeft=0,X.scrollTop=0),b(!1)},[]),M=d.useCallback(X=>{const ee=y.current;ee&&(X.preventDefault(),v(!0),A.current={startX:X.clientX,startY:X.clientY,startLeft:ee.scrollLeft,startTop:ee.scrollTop})},[]),U=d.useCallback(X=>{const{scrollLeft:ee,scrollTop:H}=X.currentTarget;b(ee!==0||H!==0)},[]),V=d.useCallback(()=>{const X=y.current;X&&(k(X.scrollWidth>X.clientWidth||X.scrollHeight>X.clientHeight),b(X.scrollLeft!==0||X.scrollTop!==0))},[]),z=d.useCallback(()=>{const X=y.current,ee=E.current?.querySelector("svg");if(!X||!ee)return;const[,,H,Q]=(ee.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),de=(ee.getAttribute("width")??"").trim(),ve=Number.parseFloat(ee.getAttribute("height")??""),B=H>0&&Q>0,G=B?H:Number.parseFloat(de),W=B?Q:ve;if(!(G>0)||!(W>0)){T(null);return}const F=X.clientWidth-Bhe*2,pe=de.endsWith("%")&&F>0?Math.min(G,F):G,J=Math.max(0,X.offsetHeight-X.clientHeight);T({stageWidth:pe,canvasHeight:pe*W/G+Bhe*2+J})},[]);d.useEffect(()=>{if(!g)return;const X=H=>{const Q=y.current,de=A.current;!Q||!de||(Q.scrollLeft=de.startLeft-(H.clientX-de.startX),Q.scrollTop=de.startTop-(H.clientY-de.startY),b(Q.scrollLeft!==0||Q.scrollTop!==0))},ee=()=>{A.current=null,v(!1)};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ee),window.addEventListener("blur",ee),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ee),window.removeEventListener("blur",ee)}},[g]),d.useEffect(()=>{$()},[e,$]),d.useLayoutEffect(()=>{z(),V()},[r,p,c,z,V]),d.useEffect(()=>{const X=y.current;if(!X)return;const ee=new ResizeObserver(()=>{z(),V()});return ee.observe(X),()=>ee.disconnect()},[r,c,z,V]),d.useEffect(()=>{let X=!1;i(null),l(null);const ee=setTimeout(()=>{He(()=>import("./mermaid.core-BhKZI204.js").then(H=>H.cb),[]).then(async H=>{if(X)return;const Q=H.default,de=`${C}:${s?"hardened":"runtime"}`,ve=$he.then(async()=>{if(X)throw new Error("Mermaid render skipped");Ohe!==de&&(Q.initialize({startOnLoad:!1,theme:C,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:tTt,maxEdges:nTt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),Ohe=de);const G=`mermaid-${++eTt}`;if(!s)return Q.render(G,e.trim());let W;try{return await Promise.race([Q.render(G,e.trim()),new Promise((F,pe)=>{W=setTimeout(()=>pe(new Error("Mermaid render timed out")),sTt)})])}finally{W!==void 0&&clearTimeout(W)}});$he=ve.then(()=>{},()=>{});const{svg:B}=await ve;X||i(B)}).catch(H=>{X||l(H instanceof Error?H.message:"Mermaid render failed")})},150);return()=>{X=!0,clearTimeout(ee)}},[e,s,C]);const L=()=>{zh(e).then(()=>{f()}).catch(gg)};return o?a.jsxs("div",{className:Ei.codeBlock,children:[a.jsx("div",{className:Ei.codeBlockHeader,children:a.jsx("span",{className:Ei.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Ei.codeBlockContent} ${Ei.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Ei.codeBlock,children:[a.jsxs("div",{className:Ei.codeBlockHeader,children:[a.jsx("span",{className:Ei.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Ei.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Ei.codeBlockCopy,onClick:P,title:t("mermaid.zoomOut"),disabled:p<=I,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:$,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:j,title:t("mermaid.zoomIn"),disabled:p>=R,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:L,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Ei.codeBlockContent} ${Ei.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Ei.mermaidZoomWrapper} ${x?Ei.mermaidPannable:""} ${x&&g?Ei.mermaidDragging:""}`,ref:y,style:S?{height:S.canvasHeight}:void 0,onMouseDown:M,onDoubleClick:$,onScroll:U,children:a.jsx("div",{className:`${Ei.mermaidBlock} ${Ei.mermaidStage}`,ref:E,style:{...S?{width:S.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Ei.mermaidBlock} ${Ei.mermaidLoading} ${Ei.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function iTt({className:e,children:t,isStreaming:n}){const{t:s}=pt(),r=py(),i=Xa()==="document",[o,l]=d.useState(null),[c,u]=E1(),{label:h,lang:f,resolvedLang:p}=kee(p5e(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(i||n||f==="mermaid"||p==="text"||OG(m)){l(null);return}const y=t_t(m,p,g);if(y!==null){l(y);return}const w=ghe(m,p,g,!0);if(w!==null){l(w);return}l(null);let b=!1;return D3e(p).then(()=>{if(b)return;const x=ghe(m,p,g,!0);x!==null&&l(x)}).catch(x=>{b||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{b=!0}},[m,i,f,p,g,n]);const v=()=>{zh(m).then(()=>{u()}).catch(gg)};return f==="mermaid"&&!n&&!i?a.jsx(rTt,{code:m}):a.jsxs("div",{className:Ei.codeBlock,children:[a.jsxs("div",{className:Ei.codeBlockHeader,children:[a.jsx("span",{className:Ei.codeBlockLang,children:h}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!i&&!n&&o!==null?a.jsx("div",{className:Ei.codeBlockContent,dangerouslySetInnerHTML:{__html:o}}):a.jsx("pre",{className:`${Ei.codeBlockContent} ${Ei.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function p5e(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 oTt({children:e}){return a.jsx("code",{className:Ei.inlineCode,children:e})}function Fhe({children:e}){return a.jsx("div",{className:Ei.tableWrapper,children:a.jsx("table",{className:Ei.table,children:e})})}const m5e=d.createContext(!1),g5e=d.createContext(void 0),v5e=d.createContext(void 0);function aTt(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:!bEe(e.slice(s,r))&&e.slice(r).trim().length===0}function lTt({className:e,children:t,node:n}){const s=d.useContext(m5e),r=d.useContext(v5e);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1647
|
+
`,Math.max(0,n-1))+1,i=e.slice(r,n),o=/^(?: {0,3}>[ \t]?)+$/.test(i)?r:n;return bEe(e.slice(o,s))||e.slice(s).trim().length>0}function u5e(e,t){return e===T8||t?.has(e)===!0}function y2t(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...i}){const o=d.useContext(xee);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&u5e(h,o?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(v2t,{language:u,source:f,streaming:o?.streaming===!0&&!w2t(o.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",i,r)}}}const b2t=3e4,x2t=["artifact://","session-file://"],k2t=/^[a-z]:/i;function _2t(e={}){const{resolveDataRef:t,validateDataRef:n=E2t,...s}=e,r=e.validateDataRef===void 0,i=t?async(o,l)=>{const c=r?d5e(o):o;if(!c)throw new Error("Chart data reference is not supported.");return R2t(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new pgt().register(p2t({...s,resolveDataRef:i,validateDataRef:n}))}const S2t={registry:_2t()};function C2t(e,t={}){const n=y2t(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...i}){if(d.isValidElement(r)){const o=r,c=/(?:^|\s)language-([^\s]+)/.exec(o.props.className??"")?.[1]?.toLowerCase();if(c&&u5e(c,e))return d.createElement(n,i,r)}return d.createElement(d.Fragment,null,r)}}function T2t({customization:e,source:t,streaming:n,theme:s,children:r}){const i=I2t(e.labels),{t:o}=pt();return a.jsx(g2t,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??o("echartsChart.rendering"),labels:i,onError:e.onError,children:r})}function I2t(e){const{t}=pt();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:i})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:i,omittedRows:s-n,omittedColumns:i-r}),...e}),[e,t])}function Lhe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function d5e(e){if(e.trim()!==e||!e||Lhe(e))return;const t=e.toLowerCase(),n=x2t.find(o=>t.startsWith(o));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)||Lhe(r))return;const i=r.split("/");if(!i.some(o=>o.length===0||o==="."||o===".."||k2t.test(o)))return`${n}${i.join("/")}`}function E2t(e){return d5e(e)!==void 0}function R2t(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),b2t);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const A2t="_content_1ns4y_1",j2t="_streamingPlainText_1ns4y_11",N2t="_inlineCode_1ns4y_135",M2t="_link_1ns4y_147",P2t="_tableWrapper_1ns4y_157",L2t="_table_1ns4y_157",D2t="_image_1ns4y_187",O2t="_codeBlock_1ns4y_195",$2t="_codeBlockHeader_1ns4y_204",B2t="_codeBlockLang_1ns4y_213",F2t="_codeBlockCopy_1ns4y_221",z2t="_codeBlockContent_1ns4y_244",H2t="_codeBlockPlain_1ns4y_264",U2t="_mermaidBlock_1ns4y_282",q2t="_mermaidInline_1ns4y_294",W2t="_mermaidStage_1ns4y_308",V2t="_mermaidLoading_1ns4y_331",G2t="_mermaidActions_1ns4y_338",K2t="_mermaidZoomWrapper_1ns4y_343",Y2t="_mermaidPannable_1ns4y_358",X2t="_mermaidDragging_1ns4y_362",Ei={content:A2t,streamingPlainText:j2t,inlineCode:N2t,link:M2t,tableWrapper:P2t,table:L2t,image:D2t,codeBlock:O2t,codeBlockHeader:$2t,codeBlockLang:B2t,codeBlockCopy:F2t,codeBlockContent:z2t,codeBlockPlain:H2t,mermaidBlock:U2t,mermaidInline:q2t,mermaidStage:W2t,mermaidLoading:V2t,mermaidActions:G2t,mermaidZoomWrapper:K2t,mermaidPannable:Y2t,mermaidDragging:X2t},Z2t=32e3,Q2t=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"]),Dhe={"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 kee(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(Dhe,t)?Dhe[t]:t,s=Q2t.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const h5e=/^(https?:|mailto:)/i,J2t=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,f5e=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function p4(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:h5e.test(t):!1}function kv(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?f5e.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||J2t.test(n)?!0:h5e.test(n):!1}let Ohe,$he=Promise.resolve(),eTt=0;const tTt=5e4,nTt=500,sTt=1e4,Bhe=16;function rTt({code:e}){const{t}=pt(),n=py(),s=Xa()!=="interactive",[r,i]=d.useState(null),[o,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=E1(),[p,m]=d.useState(1),[g,v]=d.useState(!1),y=d.useRef(null),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[S,T]=d.useState(null),E=d.useRef(null),A=d.useRef(null),C=n==="light"?"default":"dark",I=.5,R=3,N=.25,j=()=>{m(X=>Math.min(R,Math.round((X+N)*100)/100))},P=()=>{m(X=>Math.max(I,Math.round((X-N)*100)/100))},$=d.useCallback(()=>{A.current=null,v(!1),m(1);const X=y.current;X&&(X.scrollLeft=0,X.scrollTop=0),b(!1)},[]),M=d.useCallback(X=>{const ee=y.current;ee&&(X.preventDefault(),v(!0),A.current={startX:X.clientX,startY:X.clientY,startLeft:ee.scrollLeft,startTop:ee.scrollTop})},[]),U=d.useCallback(X=>{const{scrollLeft:ee,scrollTop:H}=X.currentTarget;b(ee!==0||H!==0)},[]),V=d.useCallback(()=>{const X=y.current;X&&(k(X.scrollWidth>X.clientWidth||X.scrollHeight>X.clientHeight),b(X.scrollLeft!==0||X.scrollTop!==0))},[]),z=d.useCallback(()=>{const X=y.current,ee=E.current?.querySelector("svg");if(!X||!ee)return;const[,,H,Q]=(ee.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),de=(ee.getAttribute("width")??"").trim(),ve=Number.parseFloat(ee.getAttribute("height")??""),B=H>0&&Q>0,G=B?H:Number.parseFloat(de),W=B?Q:ve;if(!(G>0)||!(W>0)){T(null);return}const F=X.clientWidth-Bhe*2,pe=de.endsWith("%")&&F>0?Math.min(G,F):G,J=Math.max(0,X.offsetHeight-X.clientHeight);T({stageWidth:pe,canvasHeight:pe*W/G+Bhe*2+J})},[]);d.useEffect(()=>{if(!g)return;const X=H=>{const Q=y.current,de=A.current;!Q||!de||(Q.scrollLeft=de.startLeft-(H.clientX-de.startX),Q.scrollTop=de.startTop-(H.clientY-de.startY),b(Q.scrollLeft!==0||Q.scrollTop!==0))},ee=()=>{A.current=null,v(!1)};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ee),window.addEventListener("blur",ee),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ee),window.removeEventListener("blur",ee)}},[g]),d.useEffect(()=>{$()},[e,$]),d.useLayoutEffect(()=>{z(),V()},[r,p,c,z,V]),d.useEffect(()=>{const X=y.current;if(!X)return;const ee=new ResizeObserver(()=>{z(),V()});return ee.observe(X),()=>ee.disconnect()},[r,c,z,V]),d.useEffect(()=>{let X=!1;i(null),l(null);const ee=setTimeout(()=>{He(()=>import("./mermaid.core-Cj1nqB6l.js").then(H=>H.cb),[]).then(async H=>{if(X)return;const Q=H.default,de=`${C}:${s?"hardened":"runtime"}`,ve=$he.then(async()=>{if(X)throw new Error("Mermaid render skipped");Ohe!==de&&(Q.initialize({startOnLoad:!1,theme:C,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:tTt,maxEdges:nTt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),Ohe=de);const G=`mermaid-${++eTt}`;if(!s)return Q.render(G,e.trim());let W;try{return await Promise.race([Q.render(G,e.trim()),new Promise((F,pe)=>{W=setTimeout(()=>pe(new Error("Mermaid render timed out")),sTt)})])}finally{W!==void 0&&clearTimeout(W)}});$he=ve.then(()=>{},()=>{});const{svg:B}=await ve;X||i(B)}).catch(H=>{X||l(H instanceof Error?H.message:"Mermaid render failed")})},150);return()=>{X=!0,clearTimeout(ee)}},[e,s,C]);const L=()=>{zh(e).then(()=>{f()}).catch(gg)};return o?a.jsxs("div",{className:Ei.codeBlock,children:[a.jsx("div",{className:Ei.codeBlockHeader,children:a.jsx("span",{className:Ei.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Ei.codeBlockContent} ${Ei.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Ei.codeBlock,children:[a.jsxs("div",{className:Ei.codeBlockHeader,children:[a.jsx("span",{className:Ei.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Ei.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Ei.codeBlockCopy,onClick:P,title:t("mermaid.zoomOut"),disabled:p<=I,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:$,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:j,title:t("mermaid.zoomIn"),disabled:p>=R,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:L,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Ei.codeBlockContent} ${Ei.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Ei.mermaidZoomWrapper} ${x?Ei.mermaidPannable:""} ${x&&g?Ei.mermaidDragging:""}`,ref:y,style:S?{height:S.canvasHeight}:void 0,onMouseDown:M,onDoubleClick:$,onScroll:U,children:a.jsx("div",{className:`${Ei.mermaidBlock} ${Ei.mermaidStage}`,ref:E,style:{...S?{width:S.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Ei.mermaidBlock} ${Ei.mermaidLoading} ${Ei.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function iTt({className:e,children:t,isStreaming:n}){const{t:s}=pt(),r=py(),i=Xa()==="document",[o,l]=d.useState(null),[c,u]=E1(),{label:h,lang:f,resolvedLang:p}=kee(p5e(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(i||n||f==="mermaid"||p==="text"||OG(m)){l(null);return}const y=t_t(m,p,g);if(y!==null){l(y);return}const w=ghe(m,p,g,!0);if(w!==null){l(w);return}l(null);let b=!1;return D3e(p).then(()=>{if(b)return;const x=ghe(m,p,g,!0);x!==null&&l(x)}).catch(x=>{b||(console.warn("[web-shell] highlight failed for lang=%s",p,x),l(null))}),()=>{b=!0}},[m,i,f,p,g,n]);const v=()=>{zh(m).then(()=>{u()}).catch(gg)};return f==="mermaid"&&!n&&!i?a.jsx(rTt,{code:m}):a.jsxs("div",{className:Ei.codeBlock,children:[a.jsxs("div",{className:Ei.codeBlockHeader,children:[a.jsx("span",{className:Ei.codeBlockLang,children:h}),a.jsx("button",{className:Ei.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!i&&!n&&o!==null?a.jsx("div",{className:Ei.codeBlockContent,dangerouslySetInnerHTML:{__html:o}}):a.jsx("pre",{className:`${Ei.codeBlockContent} ${Ei.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function p5e(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 oTt({children:e}){return a.jsx("code",{className:Ei.inlineCode,children:e})}function Fhe({children:e}){return a.jsx("div",{className:Ei.tableWrapper,children:a.jsx("table",{className:Ei.table,children:e})})}const m5e=d.createContext(!1),g5e=d.createContext(void 0),v5e=d.createContext(void 0);function aTt(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:!bEe(e.slice(s,r))&&e.slice(r).trim().length===0}function lTt({className:e,children:t,node:n}){const s=d.useContext(m5e),r=d.useContext(v5e);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1648
1648
|
`)?a.jsx(cTt,{className:e,isStreaming:s,isIncomplete:aTt(r,n,s),children:t}):a.jsx(oTt,{children:t})}function cTt({className:e,children:t,isStreaming:n,isIncomplete:s}){const r=d.useContext(g5e),i=py(),{markdown:o}=Nd(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(iTt,{className:e,isStreaming:n,children:l}),h=p5e(e),{resolvedLang:f}=kee(h);if(!!r&&!!e&&!!h)try{const m=o?.renderCodeBlock?.({language:h,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!s,source:r,theme:i});if(m!=null&&typeof m!="boolean")return a.jsx(xg,{fallback:u,label:`custom code block component render (lang=${h})`,resetKeys:[h,r,i,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 uTt({children:e}){return a.jsx(a.Fragment,{children:e})}const qG=/^qwen-session:\/\//i;function zhe(e,t=!1){return t&&f5e.test(e.trim())||qG.test(e.trim())?e:pEe(e)}function w5e({href:e,children:t,node:n,id:s,"aria-label":r,"aria-describedby":i}){const o=Xa(),l=Lf();if((n?.properties.dataFootnoteRef!==void 0||n?.properties.dataFootnoteBackref!==void 0)&&e?.startsWith("#"))return a.jsx("a",{id:s,href:e,className:Ei.link,"aria-label":r,"aria-describedby":i,"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&&qG.test(e.trim())){if(o!=="interactive")return a.jsx("span",{className:Ei.link,children:t});const h=e.trim().replace(qG,"");return a.jsx("a",{href:"#",role:"button",className:Ei.link,onClick:f=>{f.preventDefault(),f.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:h}))},children:t})}const u=p4(e)?e:void 0;return a.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:Ei.link,onClick:h=>l(h,u),children:t})}function dTt({src:e,alt:t}){const n=Xa(),s=kv(e,n==="document")?e:void 0;return a.jsx("img",{src:s,alt:t||"",className:Ei.image})}function hTt(e,t,n=80){const[s,r]=d.useState(e),i=d.useRef(s);i.current=s;const o=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),i.current!==e&&r(e);return}const u=Date.now(),h=u-o.current;h>=n?(o.current=u,r(c.current)):l.current||(l.current=setTimeout(()=>{o.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 y5e(e="basic",t=""){return{code:lTt,pre:uTt,a:w5e,img:dTt,sup:Y3e,section:X3e,table({children:n}){if(e==="advanced"){const s=a.jsx(Fhe,{children:n});return a.jsx(xg,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(aCt,{fallback:s,children:n})})}return a.jsx(Fhe,{children:n})}}}const fTt=y5e(),pTt=d.memo(function({content:t,components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:i}){return a.jsx(rgt,{components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:i,children:t})}),kp=d.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=Nd(),l=py(),c=Xa()==="document",u=`footnote-${d.useId()}-`,h=n?i:void 0,f=hTt(t??"",s),p=s===!0&&f.length>Z2t,m=d.useMemo(()=>f&&n&&h?.transformMarkdown?h.transformMarkdown(f,{source:n,isStreaming:s===!0}):f,[n,h,f,s]),g=s?"basic":r??o??"basic",v=d.useMemo(()=>g==="advanced"?y5e("advanced",m):fTt,[g,m]),y=h?.components,w=h?.getInlineFootnoteIcon,b=h?.mountFootnotePreview,x=d.useMemo(()=>{if(!y&&!w&&!b)return v;const N={...v,...y,...g==="advanced"?{table:v.table}:{}},j=y?.a;return y&&(N.a=P=>{if(P.node?.properties.dataFootnoteRef!==void 0||P.node?.properties.dataFootnoteBackref!==void 0||!j)return a.jsx(w5e,{...P});if(typeof j!="string")return d.createElement(j,P);const{node:M,...U}=P;return d.createElement(j,U)}),y?.sup||(N.sup=P=>a.jsx(Y3e,{...P,linkComponent:j,iconResolver:w,mountPreview:b}),N.section=P=>a.jsx(X3e,{...P,sectionComponent:y?.section})),N},[v,g,y,w,b]),k=!c&&n==="assistant"&&!y?.code&&!y?.pre?h?.chart??(h?.renderCodeBlock?void 0:S2t):void 0,S=d.useMemo(()=>k?C2t(k.registry,{chartClassName:k.chartClassName,chartStyle:{minHeight:360,...k.chartStyle}}):void 0,[k]),T=d.useMemo(()=>S?{...x,pre:S}:x,[S,x]),E=d.useMemo(()=>h?.remarkPlugins?[Que,$de,Zde,...h.remarkPlugins]:[Que,$de,Zde],[h?.remarkPlugins]),A=d.useMemo(()=>[vbt,...h?.rehypePlugins??[],[mCt,{prefix:u,group:!c&&!y?.sup,safeHref:p4,safeImage:kv,transformUrl:zhe}]],[h?.rehypePlugins,u,c,y?.sup]),C=d.useMemo(()=>N=>zhe(N,c),[c]);if(!t)return null;if(p)return a.jsx("div",{className:n!=="thinking"?Ei.content:void 0,"data-markdown-source":n,"data-markdown-streaming-plain-text":"true",children:a.jsx("pre",{className:Ei.streamingPlainText,children:m})});const I=a.jsx(pTt,{content:m,components:T,remarkPlugins:E,rehypePlugins:A,urlTransform:C}),R=k?a.jsx(T2t,{customization:k,source:m,streaming:!!s,theme:l,children:I}):I;return a.jsx("div",{className:n!=="thinking"?Ei.content:void 0,"data-markdown-source":n,children:a.jsx(m5e.Provider,{value:!!s,children:a.jsx(g5e.Provider,{value:n,children:a.jsx(v5e.Provider,{value:m,children:R})})})})}),fH=/https?:\/\/[A-Za-z0-9\-._~:/?#[\]{}@!$&'()*+,;=%]+/gi,mTt=new Set([...".,;:!?'*_~"]),gTt={")":"(","]":"[","}":"{"},vTt=/^https?:\/\/./i;function Hhe(e,t){let n=0;for(const s of e)s===t&&(n+=1);return n}function wTt(e){const t={};for(const[s,r]of Object.entries(gTt))t[s]=Hhe(e,s)-Hhe(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(!mTt.has(s))break;n--}return e.slice(0,n)}function yTt(e){const t=[];let n=0;fH.lastIndex=0;for(let s=fH.exec(e);s!==null;s=fH.exec(e)){const r=wTt(s[0]);if(!vTt.test(r))continue;const i=s.index;i>n&&t.push({type:"text",value:e.slice(n,i)}),t.push({type:"url",value:r}),n=i+r.length}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const Q7=d.memo(function({text:t}){const n=Lf(),s=d.useMemo(()=>yTt(t),[t]);return s.every(r=>r.type==="text")?t:s.map((r,i)=>{if(r.type==="text")return r.value;const o=r.value.replace(/%(?![0-9A-Za-z]{2})/g,"%25"),l=p4(o)?o:void 0;return a.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:Ei.link,onClick:c=>n(c,l),children:r.value},i)})}),bTt="_flash_96ig5_1",ey={flash:bTt},xTt="_chatMessageRow_qnd03_41",kTt="_chatMessageColumn_qnd03_48",_Tt="_chatBubble_qnd03_55",STt="_scheduledTaskBubble_qnd03_68",CTt="_scheduledTaskRun_qnd03_76",TTt="_scheduledTaskHeader_qnd03_83",ITt="_scheduledTaskIcon_qnd03_90",ETt="_scheduledTaskHeading_qnd03_108",RTt="_scheduledTaskEyebrow_qnd03_115",ATt="_scheduledTaskName_qnd03_122",jTt="_scheduledTaskMeta_qnd03_131",NTt="_scheduledTaskMetaItem_qnd03_138",MTt="_scheduledTaskBadge_qnd03_158",PTt="_scheduledTaskId_qnd03_170",LTt="_scheduledTaskPrompt_qnd03_181",DTt="_sendFailure_qnd03_191",OTt="_retryButton_qnd03_201",$Tt="_editArea_qnd03_229",BTt="_editInput_qnd03_237",FTt="_editActions_qnd03_258",zTt="_editCancel_qnd03_264",HTt="_editSubmit_qnd03_265",UTt="_chatContent_qnd03_294",qTt="_messageTag_qnd03_299",WTt="_messageTagTooltip_qnd03_317",VTt="_messageTagClickable_qnd03_351",GTt="_messageTagIcon_qnd03_364",KTt="_messageTagLabel_qnd03_376",YTt="_messageTagValue_qnd03_377",XTt="_chatContentCollapsed_qnd03_400",ZTt="_toggleButton_qnd03_405",QTt="_toggleIcon_qnd03_426",JTt="_toggleIconExpanded_qnd03_433",e4t="_chatImages_qnd03_437",t4t="_chatImageThumb_qnd03_445",n4t="_chatImageThumbInteractive_qnd03_453",s4t="_chatFiles_qnd03_462",r4t="_chatFileChip_qnd03_470",i4t="_chatFileChipPreviewable_qnd03_483",o4t="_fileTagIcon_qnd03_492",pi={chatMessageRow:xTt,chatMessageColumn:kTt,chatBubble:_Tt,scheduledTaskBubble:STt,scheduledTaskRun:CTt,scheduledTaskHeader:TTt,scheduledTaskIcon:ITt,scheduledTaskHeading:ETt,scheduledTaskEyebrow:RTt,scheduledTaskName:ATt,scheduledTaskMeta:jTt,scheduledTaskMetaItem:NTt,scheduledTaskBadge:MTt,scheduledTaskId:PTt,scheduledTaskPrompt:LTt,sendFailure:DTt,retryButton:OTt,editArea:$Tt,editInput:BTt,editActions:FTt,editCancel:zTt,editSubmit:HTt,chatContent:UTt,messageTag:qTt,messageTagTooltip:WTt,messageTagClickable:VTt,messageTagIcon:GTt,messageTagLabel:KTt,messageTagValue:YTt,chatContentCollapsed:XTt,toggleButton:ZTt,toggleIcon:QTt,toggleIconExpanded:JTt,chatImages:e4t,chatImageThumb:t4t,chatImageThumbInteractive:n4t,chatFiles:s4t,chatFileChip:r4t,chatFileChipPreviewable:i4t,fileTagIcon:o4t},a4t="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 l4t(e){const t=`
|
|
1649
1649
|
|
|
1650
1650
|
${a4t}
|
|
@@ -2266,7 +2266,7 @@ ${o("terminal.notice.protocolMismatch")}`),de.close(4002,"Terminal protocol mism
|
|
|
2266
2266
|
* Copyright 2025 Qwen Team
|
|
2267
2267
|
* SPDX-License-Identifier: Apache-2.0
|
|
2268
2268
|
*/const H3n=250,fq={truncated:!1,status:"idle"};function U3n(e){if(e instanceof Error&&e.message)return e.message;const t=String(e??"");return t.length>0?t:"Unknown error"}function q3n(e){return e.replayError?{kind:"unreadable",message:e.replayError}:e.partial?{kind:"partial"}:void 0}function W3n(e,t={}){const n=t.pageSize??H3n,[s,r]=d.useState(fq),i=d.useRef(0),o=d.useCallback(()=>{if(!e)return;const u=++i.current;r(h=>({...h,status:"loading",error:void 0})),e({limit:n}).then(h=>{if(i.current!==u)return;const f=q3n(h);if(f!==void 0){r(p=>({...p,status:"error",error:f}));return}r({events:h.events,truncated:h.hasMore,status:"ready"})},h=>{i.current===u&&r(f=>({...f,status:"error",error:{kind:"unreadable",message:U3n(h)}}))})},[e,n]);d.useEffect(()=>{if(!e){i.current+=1,r(fq);return}return r(fq),o(),()=>{i.current+=1}},[e,o]);const l=s.events;return{trajectory:d.useMemo(()=>l===void 0?void 0:$3n(z3n(l)),[l]),status:s.status,...s.error!==void 0?{error:s.error}:{},truncated:s.truncated,refresh:o}}const V3n="_panel_1ploj_1",G3n="_header_1ploj_8",K3n="_summary_1ploj_17",Y3n="_headerActions_1ploj_26",X3n="_headerButton_1ploj_33",Z3n="_iconButton_1ploj_54",Q3n="_error_1ploj_78",J3n="_notice_1ploj_91",e5n="_tableWrap_1ploj_100",t5n="_placeholder_1ploj_107",n5n="_scroll_1ploj_114",s5n="_olderBar_1ploj_126",r5n="_olderNotice_1ploj_132",i5n="_virtualBody_1ploj_137",o5n="_virtualRow_1ploj_142",a5n="_turnHeader_1ploj_151",l5n="_turnTitle_1ploj_167",c5n="_turnSummary_1ploj_171",u5n="_record_1ploj_179",d5n="_nestMarker_1ploj_198",h5n="_selected_1ploj_203",f5n="_badge_1ploj_208",p5n="_text_1ploj_221",m5n="_faint_1ploj_230",g5n="_metrics_1ploj_235",v5n="_toneError_1ploj_244",w5n="_toneMuted_1ploj_248",Go={panel:V3n,header:G3n,summary:K3n,headerActions:Y3n,headerButton:X3n,iconButton:Z3n,error:Q3n,notice:J3n,tableWrap:e5n,placeholder:t5n,scroll:n5n,olderBar:s5n,olderNotice:r5n,virtualBody:i5n,virtualRow:o5n,turnHeader:a5n,turnTitle:l5n,turnSummary:c5n,record:u5n,nestMarker:d5n,selected:h5n,badge:f5n,text:p5n,faint:m5n,metrics:g5n,toneError:v5n,toneMuted:w5n},rwe=34;function iwe(e){return e>=999950?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function y5n(e){return`${iwe(e.inputTokens)} → ${iwe(e.outputTokens)}`}const b5n=/-call_[A-Za-z0-9]+$/;function x5n(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(b5n,"")}function c3(e){const t=e.trim(),n=t.indexOf(`
|
|
2269
|
-
`);return n===-1?t:t.slice(0,n)}function k5n(e,t){if(e.kind==="request"){const n=[Id(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:Id(e.timing.ttftMs)})),e.usage&&n.push(y5n(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(Id(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:i}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:Id(i)}))}return n}return[]}function owe(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Go.toneError;if(t==="cancelled")return Go.toneMuted}function _5n(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:c3(e.block.text)};case"request":{const n=x5n(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:Go.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:c3(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...owe(e)?{badgeTone:owe(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return S5n(e.block,t)}}function S5n(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:c3(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:c3(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:Go.toneError}:{},text:c3(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Go.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function C5n(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function T5n({loadPage:e}){const{t}=pt(),{trajectory:n,status:s,error:r,truncated:i,refresh:o}=W3n(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),p=d.useId(),m=d.useCallback(C=>`${p}-row-${C}`,[p]),g=d.useCallback((C,I)=>{C.scrollTop=I,f.current=C.scrollTop},[]),v=d.useMemo(()=>{if(!n)return[];const C=new Map(n.rows.map(R=>[R.key,R])),I=[];for(const R of n.turns){const N=R.userRowKey??`ordinal:${R.index}`;I.push({kind:"turn",key:`turn:${N}`,turn:R});for(const j of R.rowKeys){const P=C.get(j);P&&I.push({kind:"row",key:j,row:P})}}return I},[n]),y=xIe({count:v.length,getScrollElement:()=>u.current,getItemKey:C=>v[C]?.key??C,estimateSize:()=>rwe,overscan:12}),w=v.length>0;d.useLayoutEffect(()=>{const C=u.current;if(!C||typeof ResizeObserver>"u")return;let I=0;const R=()=>{C.scrollTop===0&&f.current>0&&(C.scrollTop=f.current)},N=new ResizeObserver(()=>{R(),I=requestAnimationFrame(R)});return N.observe(C),()=>{N.disconnect(),I!==0&&cancelAnimationFrame(I)}},[w]),d.useEffect(()=>{if(s!=="ready"||h.current||v.length===0)return;h.current=!0;const C=u.current;C&&g(C,C.scrollHeight)},[g,s,v.length]);const b=d.useMemo(()=>l===void 0?-1:v.findIndex(C=>C.key===l),[l,v]),x=d.useCallback(C=>{if(v.length===0)return;const I=Math.min(Math.max(C,0),v.length-1);c(v[I].key),y.scrollToIndex(I,{align:"auto"})},[y,v]),k=d.useCallback(C=>{c(C),u.current?.focus({preventScroll:!0})},[]),S=d.useCallback(C=>{if(v.length===0)return;const I=b<0?-1:b;C.key==="ArrowDown"?(C.preventDefault(),x(I+1)):C.key==="ArrowUp"?(C.preventDefault(),x(I<=0?0:I-1)):C.key==="Home"?(C.preventDefault(),x(0)):C.key==="End"&&(C.preventDefault(),x(v.length-1))},[x,b,v]),T=d.useMemo(()=>{if(!n)return;let C=0,I=0,R=0;for(const N of n.turns)C+=N.requestCount,I+=N.toolCount,R+=N.requestMs;return{turns:n.turns.length,requests:C,tools:I,durationMs:R}},[n]),E=s==="ready"&&v.length===0,A=n!==void 0&&v.length>0&&!C5n(n);return a.jsxs("div",{className:Go.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Go.header,children:[a.jsx("div",{className:Go.summary,children:T?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:T.turns,requests:T.requests,tools:T.tools,duration:T.durationMs>0?Id(T.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Go.headerActions,children:a.jsx("button",{type:"button",className:Go.iconButton,onClick:o,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(Wh,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Go.error,role:"alert",children:[a.jsx("span",{children:r.kind==="partial"?t("trajectory.partial"):t("trajectory.loadFailed",{message:r.message})}),a.jsx("button",{type:"button",className:Go.headerButton,onClick:o,disabled:s==="loading",children:t("common.retry")})]}),A&&a.jsx("div",{className:Go.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Go.tableWrap,children:v.length===0?s==="error"?null:a.jsx("div",{className:Go.placeholder,role:"status",children:t(E?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[i&&a.jsx("div",{className:Go.olderBar,children:a.jsx("span",{className:Go.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Go.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":v.length,"aria-activedescendant":b>=0?m(b):void 0,onKeyDown:S,onScroll:C=>{f.current=C.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Go.virtualBody,style:{height:`${y.getTotalSize()}px`},children:y.getVirtualItems().map(C=>{const I=v[C.index];return a.jsx("div",{id:m(C.index),className:Go.virtualRow,style:{height:`${rwe}px`,transform:`translateY(${C.start}px)`},role:"row","aria-rowindex":C.index+1,children:I.kind==="turn"?a.jsx(I5n,{turn:I.turn,selected:I.key===l,onSelect:()=>k(I.key)}):a.jsx(E5n,{row:I.row,selected:I.key===l,onSelect:()=>k(I.key)})},C.key)})})})]})})]})}function I5n({turn:e,selected:t,onSelect:n}){const{t:s}=pt();return a.jsxs("div",{className:`${Go.turnHeader} ${t?Go.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Go.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Go.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?Id(e.requestMs):"—"})})]})}function E5n({row:e,selected:t,onSelect:n}){const{t:s}=pt(),r=_5n(e,s),i=k5n(e,s);return a.jsxs("div",{className:`${Go.record} ${t?Go.selected:""}`,role:"gridcell","aria-selected":t,"data-selected":t?"true":void 0,onClick:n,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,children:[e.depth>0&&a.jsx(rot,{size:12,strokeWidth:1.6,className:Go.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Go.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Go.text} ${r.faint?Go.faint:""}`,children:r.text}),a.jsx("span",{className:Go.metrics,"data-testid":"trajectory-row-metrics",children:i.length>0?i.join(" · "):"—"})]})}const R5n="_panel_pwtdr_1",A5n="_toolbar_pwtdr_5",j5n="_actions_pwtdr_15",N5n="_feedback_pwtdr_21",M5n="_state_pwtdr_31",Xv={panel:R5n,toolbar:A5n,actions:j5n,feedback:N5n,state:M5n};function P5n({sessionActions:e,sessionId:t,controls:n}){const{t:s}=pt(),[r,i]=d.useState(null),[o,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 y=m?.result,[w,b]=d.useState(y),x=!!(y&&y!==w&&(y.kind!=="completed"||!c));d.useEffect(()=>{y?.kind==="completed"&&(h.current++,i(y.usage),u(!1))},[y]),d.useEffect(()=>{let T=!0,E=!1;const A=v.current?.result;i(I=>I?.sessionId===t?I:A?.kind==="completed"?A.usage:null),u(!1),l(!!g);const C=async()=>{if(!T||E||!g)return;E=!0,l(!0),u(!1);const I=h.current,R=p.current,N=R&&R.getContextUsage===g&&R.sessionId===t?R:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=N;try{const j=await N.promise;if(!T||I!==h.current)return;i(j.sessionId===t&&j.usage.contextWindowSize>0?j:null)}catch(j){if(!T||I!==h.current)return;u(sQ(j)?"transient":"hard")}finally{E=!1,p.current===N&&(p.current=null),T&&l(!1)}};return f.current=()=>void C(),C(),()=>{T=!1}},[g,t]);const k=!g||o||m?.compressing,S=()=>{b(y),f.current()};return a.jsxs("div",{className:Xv.panel,"aria-busy":o,children:[a.jsxs("div",{className:Xv.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:Xv.actions,children:[a.jsx(wt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:k,onClick:S,children:a.jsx(Wh,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?o?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(wt,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||o,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(f9e,{controls:m,className:Xv.feedback}),c==="transient"&&r&&a.jsx("div",{className:Xv.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:Xv.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(wt,{type:"button",variant:"outline",size:"sm",disabled:k,onClick:S,children:s("contextUsage.retry")})]}):g?o&&!r?a.jsx("div",{className:Xv.state,role:"status",children:s("common.loading")}):r?a.jsx(R5e,{status:r,compact:!0}):a.jsx("div",{className:Xv.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:Xv.state,children:s("contextUsage.unavailable")})]})}const L5n=700,D5n=["daily","weekdays","weekly","hourly","minutes","custom"],O5n=[1,2,3,4,5,6,10,12,15,20,30],$5n=(e,t)=>{},B5n=(e,t,n)=>{},F5n=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function awe(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function Zv(e){return e.kind==="pending"?e.targetKind:e.kind}function z5n(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const H5n=["review","sideTask"];function lwe({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:i,panelWidth:o,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onCloseTab:p,onOpenFilePreview:m,latestReviewAvailable:g=!1,onOpenLatestReview:v,onOpenTerminal:y,onOpenTrajectory:w,trajectoryTabId:b,onOpenWebPreview:x,onWebPreviewChange:k,items:S=H5n,sideTaskAvailable:T=!1,sideTasks:E=[],sideTasksLoading:A=!1,onCreateSideTask:C,onOpenSideTask:I,onCreateSideTaskSession:R,onSideTaskCreated:N,onSideTaskTitleChange:j,onNestedRightPanelOpen:P,onNestedArtifactsChange:$,onOpenNestedSubagent:M,agentTasks:U=[],agentTraceLoading:V=!1,agentTraceError:z,onOpenWorkflowAgent:L,onError:X,sessionWorkflowEnabled:ee,workflow:H,onImageIngestionNotice:Q,deferSubagentMount:de=!1,onClose:ve,variant:B="docked",fullscreen:G=!1,onToggleFullscreen:W}){const{t:F}=pt(),[pe,J]=d.useState(!1),[ue,re]=d.useState(),we=d.useRef(null),me=d.useCallback(()=>{we.current&&(clearTimeout(we.current),we.current=null),J(!0)},[]),fe=d.useCallback(()=>{we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{J(!1),we.current=null},120)},[]);d.useEffect(()=>()=>{we.current&&clearTimeout(we.current)},[]);const ke=n.find(be=>be.id===s)??n[0],Le=ke?.kind==="file"&&ke.sourcePreview&&(/\.html?$/i.test(ke.workspacePath)||Xw(ke.previewMimeType||ke.previewData?.type)==="text/html"),Ve=ke?.kind==="file"&&ke.previewOnly===!0&&!Le&&/\.(?:html?|md|markdown)$/i.test(ke.workspacePath)&&(ke.previewContent!==void 0||!ke.previewData||!!FT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)),rt=ue===ke?.id,Re=S.includes("review")&&!n.some(be=>Zv(be)==="review"),Ue=S.includes("sideTask")&&T&&!!C,Te=!!y,oe=S.includes("webPreview")&&!!x,D=S.includes("trajectory")&&!!w&&!n.some(be=>be.id===b),Y=!!ke&&(Re||Ue||Te||oe||D),ie=ke&&awe(ke)?{workspaceCwd:ke.workspaceCwd,workspaceId:ke.workspaceId}:void 0,_e=y4(ie?.workspaceCwd),Be=_e?.workspaceId===ie?.workspaceId?_e?.actions:void 0,ge=ke?.kind==="artifact"?t.find(be=>be.id===ke.artifactId):void 0;return a.jsxs("aside",{className:`${tt.panel} ${B==="drawer"?tt.panelDrawer:""} ${G?tt.panelFullscreen:""}`,style:B==="docked"&&o&&!G?{flexBasis:o,width:o}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:tt.header,children:[n.length>0&&a.jsx("div",{className:tt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(be=>a.jsxs("div",{className:[tt.tabItem,be.id===ke?.id?tt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":be.id===ke?.id,className:tt.tab,onClick:()=>f(be.id),onMouseEnter:Ee=>F2(Ee.currentTarget),onFocus:Ee=>F2(Ee.currentTarget),title:be.title,children:[a.jsx("span",{className:`${tt.tabIcon} ${Zv(be)==="artifact"?tt.tabArtifactIcon:""}`,"aria-hidden":"true",children:Zv(be)==="review"?a.jsx(pq,{}):be.kind==="workflow"?a.jsx(q4e,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="file"?a.jsx(mg,{name:be.workspacePath,className:tt.tabIconSvg,strokeWidth:1.6}):Zv(be)==="artifact"?a.jsx(fIe,{artifact:t.find(Ee=>"artifactId"in be&&Ee.id===be.artifactId),className:tt.tabIconSvg}):Zv(be)==="subagent"?a.jsx(U5n,{}):Zv(be)==="monitor"?a.jsx(Q4e,{className:tt.tabIconSvg,strokeWidth:1.6}):Zv(be)==="shell"?a.jsx(l2,{className:tt.tabIconSvg,strokeWidth:1.6}):Zv(be)==="side_task"?a.jsx(iN,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="web_preview"?a.jsx(M2,{className:tt.tabIconSvg}):be.kind==="terminal"?a.jsx(l2,{className:tt.tabIconSvg,strokeWidth:1.6}):Zv(be)==="image"?a.jsx(iat,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="context_usage"?a.jsx(jD,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="token_usage"?a.jsx(cJ,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="trajectory"?a.jsx(pz,{className:tt.tabIconSvg,strokeWidth:1.6}):a.jsx(W5n,{})}),a.jsx("span",{className:tt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:tt.tabTitleInner,children:be.title})})]}),a.jsx("button",{type:"button",className:tt.tabCloseButton,onClick:()=>p(be.id),"aria-label":`Close ${be.title}`,title:"Close",children:a.jsx(q5n,{})})]},be.id))}),a.jsxs("div",{className:tt.headerActions,children:[Y&&a.jsxs(Pm,{modal:!1,children:[a.jsx(Sp,{asChild:!0,children:a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.addButton}`,"aria-label":F("rightPanel.add"),title:F("rightPanel.add"),children:a.jsx(rh,{className:tt.toolbarIcon})})}),a.jsxs(Cp,{align:"end",className:"w-64",children:[Re&&a.jsxs(Ri,{disabled:!g||!v,onSelect:v,children:[a.jsx(pq,{}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("turnOutputs.review")})]}),Re&&Ue&&a.jsx($w,{}),Ue&&a.jsxs(Ri,{disabled:A,onSelect:C,children:[a.jsx(iN,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("sideTask.create")})]}),Te&&(Re||Ue)&&a.jsx($w,{}),Te&&a.jsxs(Ri,{onSelect:()=>y?.(),children:[a.jsx(l2,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("terminal.title")})]}),oe&&a.jsxs(Ri,{onSelect:x,children:[a.jsx(M2,{className:tt.sideTaskNewIcon}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("webPreview.title")})]}),D&&a.jsxs(Ri,{onSelect:()=>w?.(),children:[a.jsx(pz,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("trajectory.title")})]})]})]}),W&&a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.fullscreenButton} ${G?tt.iconButtonActive:""}`,onClick:W,"aria-label":F(G?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":G,title:F(G?"common.exitFullscreen":"common.fullscreen"),children:G?a.jsx(dJ,{className:tt.toolbarIcon,"aria-hidden":!0}):a.jsx(aJ,{className:tt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.panelToggleButton}`,onClick:ve,"aria-label":F("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:F("chatHeader.toggleRightPanel"),children:a.jsx(W4e,{className:tt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${tt.body} ${ke?.kind==="side_task"?tt.bodySideTask:""}`.trim(),children:[n.filter(be=>be.kind==="web_preview").map(be=>a.jsx("div",{className:"h-full",hidden:be.id!==ke?.id,children:a.jsx(URn,{state:be,onChange:Ee=>k?.(be.id,Ee)})},be.id)),n.filter(be=>be.kind==="terminal").map(be=>a.jsx("div",{className:`${tt.terminalPane} ${be.id===ke?.id?"":tt.terminalPaneHidden}`.trim(),"aria-hidden":be.id===ke?.id?void 0:!0,children:a.jsx(HRn,{terminalId:be.id,cwd:be.workspaceCwd??l,active:be.id===ke?.id,enabled:be.initialized!==!1})},be.id)),Ve&&a.jsxs("button",{type:"button",className:tt.attachmentPreviewButton,onClick:()=>re(rt?void 0:ke?.id),"aria-label":F(rt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":rt,children:[rt?a.jsx(Zit,{"aria-hidden":!0}):a.jsx(D4e,{"aria-hidden":!0}),F(rt?"attachment.showSource":"attachment.showPreview")]}),u&&!ke?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":F("common.loading"),children:[a.jsx($0,{className:"h-5 w-2/5"}),a.jsx($0,{className:"h-32 w-full"}),a.jsx($0,{className:"h-4 w-4/5"}),a.jsx($0,{className:"h-4 w-3/5"})]}):ke?.kind==="terminal"||ke?.kind==="web_preview"?null:ke?ke.kind==="pending"?a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.kind==="workflow"?ke.sessionId?a.jsx(DTn,{tasks:U,loading:V,error:z,onOpenAgent:L}):H?a.jsx(S4n,{...H}):a.jsx("div",{className:tt.empty,children:F("workflow.empty.title")}):awe(ke)&&(ke.kind!=="scheduled_task"||ke.task.durable)&&(ke.kind!=="file"||!ke.previewOnly)&&(ke.kind!=="artifact"||ge?.metadata?.artifactType!=="web_preview_snapshot")&&!Be?a.jsx("div",{className:tt.empty,role:"alert",children:F("workspace.notFoundDescription")}):ke.kind==="review"?a.jsx(K5n,{changes:ke.changes??r,selectedPath:ke.selectedPath??i,workspaceCwd:ke.workspaceCwd??l,onOpenFilePreview:be=>m(be,ke.workspaceCwd??l,ke.workspaceId),onDownloadFile:(be,Ee)=>PD(Be,be.path,Lct(be.path),Ee),onDownloadError:be=>{const Ee=F("common.downloadFailed",{message:Ha(be)});X?X(new Error(Ee,{cause:be}),Ee):console.error(Ee,be)}}):ke.kind==="file"?ke.attachmentId&&!ke.previewData&&ke.previewContent===void 0?a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.sourcePreview&&ke.previewData&&Xw(ke.previewMimeType||ke.previewData.type)!=="application/pdf"&&!FT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)?a.jsx(LPe,{data:ke.previewData,title:ke.title,image:!!sS(ke.workspacePath)&&ke.previewData.type.startsWith("image/")}):a.jsx(KO,{workspacePath:ke.workspacePath,artifactVersion:String(ke.previewVersion??0),workspaceActions:Be,previewContent:ke.previewContent,previewData:ke.previewData,previewMimeType:ke.previewMimeType,previewOnly:ke.previewOnly,previewKind:Le||ke.previewOnly&&!rt?"source":void 0},ke.id):ke.kind==="source"?a.jsx(dAn,{tab:ke},ke.id):ke.kind==="artifact"?a.jsx(V5n,{artifacts:t,artifactId:ke.artifactId,sourceSessionId:ke.sourceSessionId,workspaceActions:Be,previewContent:ke.previewContent,loading:c,error:h},ke.id):ke.kind==="subagent"?de?null:a.jsx(wTn,{sessionId:ke.sessionId,rootToolCallId:ke.rootToolCallId,initialRootTool:ke.rootTool,workspaceCwd:ke.workspaceCwd??l,onRightPanelOpen:P,onArtifactsChange:$,onOpenSubagent:M,onError:X}):ke.kind==="monitor"?a.jsx(k6t,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="shell"?a.jsx(_6t,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="side_task"?a.jsx($Tn,{tabId:ke.id,sessionId:ke.sessionId,parentSessionId:ke.parentSessionId,workspaceCwd:ke.workspaceCwd??l,title:ke.title,shouldNameFromFirstPrompt:ke.nameFromFirstPrompt,initialPrompt:ke.initialPrompt,createSession:R??F5n,onCreated:N??$5n,onTitleChange:j??B5n,onRightPanelOpen:P,onArtifactsChange:$,onError:X,sessionWorkflowEnabled:ee,onImageIngestionNotice:Q},ke.id):ke.kind==="image"?ke.src?a.jsxs("div",{className:tt.imagePreviewWrap,children:[a.jsx("img",{src:ke.src,alt:ke.alt??ke.title,className:tt.imagePreview}),a.jsx("a",{className:tt.imageDownloadButton,href:ke.src,download:z5n(ke.src),"aria-label":F("common.download"),title:F("common.download"),children:a.jsx(jw,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.kind==="context_usage"?a.jsx(P5n,{controls:e?.[ke.sessionId],sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):ke.kind==="trajectory"?a.jsx(T5n,{loadPage:ke.loadPage},ke.id):ke.kind==="token_usage"?a.jsx(A3n,{sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):a.jsx(G5n,{task:ke.task,actions:Be},ke.id):a.jsxs("div",{className:tt.emptyActions,"data-testid":"right-panel-empty-actions",children:[S.includes("review")&&a.jsxs("button",{type:"button",className:tt.emptyAction,disabled:!g||!v,onClick:v,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(pq,{})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("turnOutputs.review")}),a.jsx("span",{className:tt.emptyActionHint,children:F("turnOutputs.reviewLatest")}),a.jsx(qa,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),S.includes("sideTask")&&T&&C&&(E.length===0?a.jsxs("button",{type:"button",className:tt.emptyAction,disabled:A,"aria-busy":A,onClick:C,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(iN,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("sideTask.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("sideTask.description")}),a.jsx(qa,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Pm,{open:pe,onOpenChange:J,modal:!1,children:[a.jsx(Sp,{asChild:!0,children:a.jsxs("button",{type:"button",className:tt.emptyAction,"aria-expanded":pe,onMouseEnter:me,onMouseLeave:fe,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(iN,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("sideTask.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("sideTask.description")}),a.jsx(qa,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Cp,{align:"end",className:"w-80",onMouseEnter:me,onMouseLeave:fe,children:[E.map(be=>a.jsxs(Ri,{onSelect:()=>I?.(be),children:[a.jsx("span",{className:tt.sideTaskListTitle,children:be.title}),be.updatedAt&&a.jsx("span",{className:tt.sideTaskListTime,children:zT(be.updatedAt,F)})]},be.sessionId)),a.jsx($w,{}),a.jsxs(Ri,{onSelect:C,children:[a.jsx(Bit,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("sideTask.new")})]})]})]})),oe&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:x,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(M2,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("webPreview.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("webPreview.openHint")}),a.jsx(qa,{className:tt.emptyActionChevron,"aria-hidden":"true"})]}),D&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:()=>w?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(pz,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("trajectory.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("trajectory.description")}),a.jsx(qa,{className:tt.emptyActionChevron,"aria-hidden":"true"})]}),y&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:()=>y(),children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(l2,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("terminal.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("terminal.open")}),a.jsx(qa,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function U5n(){return a.jsxs("svg",{className:tt.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 q5n(){return a.jsx("svg",{className:tt.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 pq(){return a.jsxs("svg",{className:tt.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 W5n(){return a.jsxs("svg",{className:tt.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 V5n({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:i,error:o}){const l=e.find(c=>c.id===t);return l?a.jsx(iAn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):i?a.jsx("div",{className:tt.empty,children:"Loading artifact..."}):o?a.jsx("div",{className:tt.empty,children:o}):a.jsx("div",{className:tt.empty,children:"Artifact not found."})}function G5n({task:e,actions:t}){const{t:n}=pt(),[s,r]=d.useState(null),[i,o]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>yb(e.cron)),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[S,T]=d.useState(!1),[E,A]=d.useState(null),C=d.useRef(0),I=d.useRef(0),R=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});R.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=d.useCallback((F,pe,J,ue)=>{const re=R.current;return F===C.current&&re.actions===pe&&re.taskId===J&&re.workspaceId===ue},[]),j=d.useCallback((F,pe,J,ue)=>{const re=R.current;return F===I.current&&re.actions===pe&&re.taskId===J&&re.workspaceId===ue},[]);d.useEffect(()=>()=>{C.current+=1,I.current+=1},[]),d.useEffect(()=>{k(!1),T(!1),A(null)},[t,e.id,e.workspaceId]);const P=d.useCallback(async()=>{const F=++C.current,pe=++I.current,J=e.id,ue=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(yb(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const re=await t.listScheduledTasks(ue);if(!N(F,t,J,ue))return;const we=re.find(me=>me.id===e.id)??null;r(we),we?(h(we.name??""),p(we.prompt),g(yb(we.cron))):(h(""),p(e.prompt),g(yb(e.cron)))}catch(re){j(pe,t,J,ue)&&c(re instanceof Error?re.message:String(re))}finally{j(pe,t,J,ue)&&o(!1)}},[t,j,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{P()},[P]);const $=!e.durable,M=e.durable&&!i&&!l&&!s,U=!!s,V=s?.name||s?.prompt||e.title,z=s?.prompt??e.prompt,L=s?.cron??e.cron,X=s?.recurring??e.recurring,ee=s?.enabled,H=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(yb(s.cron)),A(null),y(!0))},[s]),Q=d.useCallback(()=>{y(!1),A(null),s&&(h(s.name??""),p(s.prompt),g(yb(s.cron)))},[s]),de=d.useCallback(async()=>{if(!s||!t)return;const F=C7(m);if(!F){A(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){A(n("scheduledTasks.error.emptyPrompt"));return}const pe=++C.current,J=e.id,ue=e.workspaceId;T(!0),A(null);try{const re=await t.updateScheduledTask(s.id,{cron:F,prompt:f.trim(),name:u.trim()||null},ue);if(!N(pe,t,J,ue))return;r(re),h(re.name??""),p(re.prompt),g(yb(re.cron)),y(!1)}catch(re){N(pe,t,J,ue)&&A(re instanceof Error?re.message:String(re))}finally{N(pe,t,J,ue)&&T(!1)}},[t,m,N,s,u,f,n,e.id,e.workspaceId]),ve=d.useCallback(async()=>{if(!s||!t)return;const F=++C.current,pe=e.id,J=e.workspaceId;k(!0),A(null);try{const ue=await t.updateScheduledTask(s.id,{enabled:!s.enabled},J);if(!N(F,t,pe,J))return;r(ue)}catch(ue){N(F,t,pe,J)&&A(ue instanceof Error?ue.message:String(ue))}finally{N(F,t,pe,J)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),B=d.useCallback(async()=>{if(!s||!t)return;const F=++C.current,pe=e.id,J=e.workspaceId;k(!0),A(null);try{if(await t.deleteScheduledTask(s.id,J),!N(F,t,pe,J))return;r(null),b(!1)}catch(ue){N(F,t,pe,J)&&A(ue instanceof Error?ue.message:String(ue))}finally{N(F,t,pe,J)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),G=C7(m),W=G?yT(G,n):null;return a.jsxs("div",{className:tt.detail,children:[i&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Vt.loadError,children:l}),M&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.deletedSnapshot")}),$&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!M&&a.jsx("div",{className:tt.section,children:a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:tt.fieldValue,children:V}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:tt.fieldValue,children:e.id}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:tt.fieldValue,children:yT(L,n)}),a.jsx("span",{className:tt.fieldLabel,children:"Cron"}),a.jsx("span",{className:tt.fieldValue,children:L}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:tt.fieldValue,children:n(X?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ee!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:tt.fieldValue,children:n(ee?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!M&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:tt.description,children:z})]}),E&&a.jsx("div",{className:Vt.formError,children:E}),a.jsxs("div",{className:tt.actionsRow,children:[a.jsx("button",{type:"button",className:Vt.primaryButton,disabled:!U||x,onClick:H,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Vt.secondaryButton,disabled:!U||x,onClick:()=>void ve(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Vt.secondaryButton,disabled:!U||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(Ko,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:a.jsxs("div",{className:Vt.formFields,children:[a.jsx("div",{className:tt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),E&&a.jsx("div",{className:Vt.formError,children:E}),a.jsxs("div",{className:Vt.formActions,children:[a.jsx("button",{type:"button",className:Vt.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Vt.primaryButton,onClick:()=>void B(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(Ko,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:a.jsxs("div",{className:Vt.formFields,children:[a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Vt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:F=>h(F.target.value)})]}),a.jsxs("label",{className:Vt.field,children:[a.jsxs("span",{className:Vt.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Vt.required,children:"*"})]}),a.jsx("textarea",{className:Vt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:F=>p(F.target.value)})]}),a.jsxs("div",{className:Vt.scheduleRow,children:[a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Vt.select,value:m.frequency,onChange:F=>{const pe=F.target.value;g(J=>({...J,frequency:pe,...pe==="hourly"?{time:"00:00"}:{}}))},children:D5n.map(F=>a.jsx("option",{value:F,children:n(`scheduledTasks.freq.${F}`)},F))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Vt.input,type:"time",value:m.time,onChange:F=>g(pe=>({...pe,time:F.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Vt.select,value:m.weekday,onChange:F=>g(pe=>({...pe,weekday:Number(F.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((F,pe)=>a.jsx("option",{value:pe,children:F},pe))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Vt.select,value:m.minuteInterval,onChange:F=>g(pe=>({...pe,minuteInterval:Number(F.target.value)})),children:O5n.map(F=>a.jsx("option",{value:F,children:F},F))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Vt.field} ${Vt.fieldGrow}`,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Vt.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:F=>g(pe=>({...pe,customCron:F.target.value}))})]})]}),a.jsx("div",{className:Vt.preview,children:W?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Vt.previewLabel,children:W}),a.jsx("code",{className:Vt.previewCron,children:G})]}):a.jsx("span",{className:Vt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),E&&a.jsx("div",{className:Vt.formError,children:E}),a.jsxs("div",{className:Vt.formActions,children:[a.jsx("button",{type:"button",className:Vt.secondaryButton,onClick:Q,disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Vt.primaryButton,onClick:()=>void de(),disabled:S,children:n(S?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function K5n({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:i}){const{t:o}=pt(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,p]=d.useState(!1),[m,g]=d.useState(520),v=d.useRef(m),y=d.useRef(null),w=d.useRef(null),[b,x]=d.useState(null),[k,S]=d.useState(()=>new Set),T=d.useRef(!0);d.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const E=l,A=d.useMemo(()=>rAn(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const j=y.current;if(!j)return;const P=()=>{p(j.clientWidth<L5n)};P();const $=new ResizeObserver(P);return $.observe(j),()=>$.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const C=d.useCallback(j=>{const P=y.current;if(!P)return;j.preventDefault();const $=j.currentTarget;$.setPointerCapture(j.pointerId);const M=j.clientX,U=v.current,V=P.getBoundingClientRect().width,z=Math.max(180,V-180),L=document.body.style.cursor,X=document.body.style.userSelect;let ee=U,H=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Q=()=>{H=null,g(ee)},de=G=>{ee=Math.min(z,Math.max(180,U+(G.clientX-M))),H===null&&(H=window.requestAnimationFrame(Q))};let ve=()=>{};const B=G=>{w.current=null,H!==null&&(window.cancelAnimationFrame(H),H=null),G&&g(ee),$.hasPointerCapture(j.pointerId)&&$.releasePointerCapture(j.pointerId),document.body.style.cursor=L,document.body.style.userSelect=X,window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve)};ve=()=>B(!0),w.current=()=>B(!1),window.addEventListener("pointermove",de),window.addEventListener("pointerup",ve),window.addEventListener("pointercancel",ve)},[]);if(e.length===0)return a.jsx("div",{className:tt.empty,children:"No file changes to review."});const I=j6e(e),R=j=>{x(P=>P===j?null:j)},N=async j=>{if(!k.has(j.path)){S(P=>new Set(P).add(j.path));try{await r(j,()=>!T.current)}catch(P){T.current&&i(P)}finally{S(P=>{const $=new Set(P);return $.delete(j.path),$})}}};return a.jsxs("div",{className:tt.review,children:[a.jsxs("div",{className:tt.reviewToolbar,children:[a.jsxs("div",{className:tt.reviewToolbarTitle,children:[a.jsx("span",{children:o("turnOutputs.previousTurn")}),a.jsx(pP,{additions:I?.additions,deletions:I?.deletions,className:tt.lineStats,additionsClassName:tt.additions,deletionsClassName:tt.deletions})]}),a.jsxs("div",{className:tt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:tt.reviewTotalsButton,onClick:()=>h(j=>!j),"aria-expanded":u,children:[a.jsx("span",{children:o("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[tt.chevron,u?tt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(uwe,{})})]}),a.jsx("button",{type:"button",className:[tt.iconButton,l?tt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(j=>!j),"aria-label":o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(nAn,{}):a.jsx(tAn,{})})]})]}),u&&a.jsxs("div",{ref:y,className:[tt.reviewContent,E?"":tt.reviewContentListOnly,E&&f?tt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[tt.reviewList,b?tt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(j=>{const P=b===j.path,$=P6e(j.path),M=PBt(j.path);return a.jsxs("div",{className:[tt.reviewItem,P?tt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:tt.reviewRow,"data-selected":j.path===t||void 0,children:[a.jsx("button",{type:"button",className:tt.reviewRowToggle,onClick:()=>R(j.path),"aria-label":j.path,"aria-expanded":P}),a.jsx("span",{className:tt.fileIcon,children:PPe(j.path)}),a.jsxs("span",{className:tt.reviewFileName,children:[a.jsx(Q5n,{path:wO(j.path,n),title:j.path}),$&&a.jsx("button",{type:"button",className:tt.reviewOpenButton,onClick:()=>s(j),title:`${o("turnOutputs.preview")} ${j.path}`,children:o("turnOutputs.preview")}),M&&a.jsx("button",{type:"button",className:tt.reviewOpenButton,onClick:()=>void N(j),title:`${o("common.download")} ${j.path}`,disabled:k.has(j.path),children:o(k.has(j.path)?"common.downloading":"common.download")})]}),a.jsx(pP,{additions:j.additions,deletions:j.deletions,className:tt.lineStats,additionsClassName:tt.additions,deletionsClassName:tt.deletions}),a.jsx("span",{className:[tt.chevron,P?tt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(uwe,{})})]}),P&&a.jsx(Y5n,{change:j})]},`${j.toolCallId}:${j.path}`)})}),E&&!f&&a.jsx("div",{className:tt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:C}),E&&a.jsx("div",{className:tt.tree,children:A.children.map(j=>a.jsx(jPe,{node:j,depth:0,selectedPath:t},j.path))})]})]})}function Y5n({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:tt.diffEmpty,children:"No diff available."});const t=X5n(e.diffs);return a.jsx("div",{className:tt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(Oee,{diff:n.fileDiff},s):a.jsx(Z5n,{oldText:n.oldText,newText:n.newText},s))})}function X5n(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function Z5n({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[i,o]=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(),o(null);let c=!1,u=null;const h=[S8e,os.editable.of(!1),Co.readOnly.of(!0),os.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return He(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-CQxep91K.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 os({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||o(v instanceof Error?v.message:String(v))}}).catch(m=>{c||o(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:tt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:tt.codeMirrorDiff}),i&&a.jsxs("div",{className:tt.diffError,children:["Diff unavailable: ",i]})]})}function jPe({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,i]=d.useState(!0),o=[tt.treeRow,s?tt.treeFile:tt.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:tt.treeTwisty,children:!s&&a.jsx("span",{className:[tt.treeChevron,r?"":tt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(sAn,{})})}),a.jsxs("span",{className:tt.treeContent,children:[s&&a.jsx("span",{className:tt.fileIcon,children:PPe(e.path)}),a.jsx("span",{className:tt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:tt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:tt.treeNode,children:[s?a.jsx("div",{className:o,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:o,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>i(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:tt.treeChildren,style:c,children:e.children.map(h=>a.jsx(jPe,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function Q5n({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>NPe(e));return d.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(J5n(e,i));o();const l=new ResizeObserver(o);return l.observe(i),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:tt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:tt.pathPrefix,children:s.prefix}),a.jsx("span",{className:tt.pathFileName,children:s.leaf})]})}function NPe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let cwe=null;function J5n(e,t){const n=NPe(e),s=t.clientWidth;if(s<=0)return n;const r=eAn(t);if(r(e)<=s)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,l=r(o);if(i.length<=1||l+r(".../")>s)return{prefix:"",leaf:o};let c=".../";for(let u=1;u<i.length;u++){const f=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:o}}function eAn(e){cwe??=document.createElement("canvas");const t=cwe.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 tAn(){return a.jsxs("svg",{className:tt.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 nAn(){return a.jsxs("svg",{className:tt.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 uwe(){return a.jsx("svg",{className:tt.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 sAn(){return a.jsx("svg",{className:tt.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 rAn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=wO(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const l=r[o],c=r.slice(0,o+1).join("/");let u=i.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},i.children.push(u)),o===r.length-1&&(u.file=s),i=u}}return MPe(n),n}function MPe(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)MPe(t)}function u9(e){return Zw(e).split("/").filter(Boolean).at(-1)??e}function PPe(e){const t=u9(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 iAn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=pt(),i=Lf(),o=cIe(e),l=p4(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=lIe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(qRn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(oAn,{status:e.status}):!h||!e.workspacePath?a.jsx(aAn,{}):a.jsx(tTn,{workspacePath:e.workspacePath,artifactVersion:qce(e),workspaceActions:n}):h&&e.workspacePath?oIe(e)?a.jsx(uAn,{artifact:e,workspaceActions:n}):a.jsx(KO,{workspacePath:e.workspacePath,artifactVersion:qce(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:lAn(e)?"html":cAn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:tt.detail,children:[a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx(hf,{label:"Type",value:fJ(e.kind,e.workspacePath)}),a.jsx(hf,{label:"Storage",value:e.storage}),a.jsx(hf,{label:"Status",value:e.status}),a.jsx(hf,{label:"Source",value:e.source}),a.jsx(hf,{label:"Size",value:MD(e.sizeBytes)}),a.jsx(hf,{label:"Created",value:e.createdAt}),a.jsx(hf,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(hf,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(hf,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Description"}),a.jsx("div",{className:tt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Details"}),a.jsxs("div",{className:tt.fieldGrid,children:[xC(e.metadata,"automationId","Automation ID"),xC(e.metadata,"schedule","Schedule"),xC(e.metadata,"timezone","Timezone"),xC(e.metadata,"status","Status"),xC(e.metadata,"nextRunAt","Next run"),xC(e.metadata,"prompt","Prompt")]})]}),(o||l)&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:tt.locationRow,children:[a.jsx("a",{className:tt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>i(p,l),children:l}),a.jsx("a",{className:tt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>i(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:tt.meta,children:o})]})]})}function oAn({status:e}){const{t}=pt();return a.jsx("div",{className:tt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function aAn(){const{t:e}=pt();return a.jsx("div",{className:tt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function lAn(e){const t=e.workspacePath?.toLowerCase()??"",n=Xw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function cAn(e){const t=e.workspacePath?.toLowerCase()??"",n=Xw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function uAn({artifact:e,workspaceActions:t}){const{t:n}=pt(),[s,r]=d.useState(null),[i,o]=d.useState(!1),l=d.useRef(!0),c=cIe(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){o(!0),r(null);try{await PD(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&o(!1)}}};return a.jsx("div",{className:tt.detail,children:a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx(hf,{label:"Type",value:fJ(e.kind,e.workspacePath)}),a.jsx(hf,{label:"Size",value:MD(e.sizeBytes)}),c?a.jsx(hf,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(hf,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:tt.downloadRow,children:a.jsx("button",{type:"button",className:tt.downloadButton,onClick:()=>{u()},disabled:i||e.status!=="available"&&e.status!=="changed",children:n(i?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:tt.previewError,children:s})]})})}function dAn({tab:e}){const{t}=pt(),n=oa(),s=y4(e.workspaceCwd),r=s?.actions,i=Lf(),[o,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[p,m]=d.useState(),g=e.source,v=g.locator,y=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:"",b=/\.pdf$/i.test(w);if(d.useEffect(()=>{let k=!1;return u(void 0),f(void 0),m(void 0),!y||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const T=await e.sessionActions.readAttachment(v.attachmentId);if(k||!e.owner.isCurrent())return;const E=Uint8Array.from(atob(T.data),A=>A.charCodeAt(0));u(new Blob([E],{type:T.mimeType}))}else if(b&&r){const T=await i4(r.readFileBytes,w,"application/pdf",{statFile:r.stat,isCancelled:()=>k||!e.owner.isCurrent()});!k&&e.owner.isCurrent()&&u(T)}})().catch(T=>{!k&&e.owner.isCurrent()&&f(Ha(T))}),()=>{k=!0})},[o,y,v,w,b,e.owner,e.sessionActions,r]),y&&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}),p4(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>i(k,v.url),children:t("sources.openOriginal")})]});if(!y||!s&&v.type!=="attachment")return a.jsx("div",{className:tt.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!b&&oIe({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(wt,{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(jw,{})})}),h&&a.jsx(wt,{variant:"ghost",size:"sm",onClick:()=>l(k=>k+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:tt.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(wt,{onClick:()=>void PD(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(k=>{e.owner.isCurrent()&&f(Ha(k))}),children:t("common.download")})]}):(v.type==="attachment"||b)&&!c?a.jsx("div",{className:tt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!FT(c.type,w)?a.jsx(LPe,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!sS(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(KO,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||Xw(c?.type)==="text/html"?"source":void 0},o)})]})}function LPe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[i,o]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return o(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),i?a.jsxs("div",{className:tt.imagePreviewWrap,children:[n?a.jsx("img",{className:tt.imagePreview,src:i,alt:t}):a.jsx(DPe,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:i,download:t,"aria-label":`Download ${t}`,children:a.jsx(jw,{})})]}):null}function KO({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:i,previewMimeType:o,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h}){if(i)return a.jsx(hAn,{workspacePath:e,workspaceActions:n,data:i,mimeType:o,previewKind:c,onLoadError:h});const f=e.toLowerCase(),p=l??sS(e),m=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":p?"image":"source");return m==="html"?a.jsx(gAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="markdown"?a.jsx(wAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="image"&&p?a.jsx(mAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:p,onLoadError:h}):a.jsx(OPe,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function hAn({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:i}){const o=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return o==="application/pdf"?a.jsx(pAn,{data:n,mimeType:o,title:e}):FT(o,e)?a.jsx(fAn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:i}):a.jsx(DPe,{name:e,mimeType:o,size:n.size})}function fAn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:i}=pt(),[o,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=i("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,i]),c?a.jsx("div",{className:tt.previewError,children:c}):o===void 0?a.jsx("div",{className:tt.empty,children:i("attachment.loadingFile")}):a.jsx(KO,{workspacePath:e,workspaceActions:t,previewContent:o,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function pAn({data:e,mimeType:t,title:n}){const{t:s}=pt(),[r,i]=d.useState();return d.useEffect(()=>{const o=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return i(o),()=>URL.revokeObjectURL(o)},[e,t]),r?a.jsx("iframe",{className:tt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:tt.empty,children:s("attachment.loadingPreview")})}function DPe({name:e,mimeType:t,size:n}){const{t:s}=pt();return a.jsxs("div",{className:tt.unsupportedAttachmentPreview,children:[a.jsx(mg,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:tt.unsupportedAttachmentMeta,children:[t," · ",MD(n)]})]})}function mAn({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[i,o]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return o(null),c(null),i4((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),o(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:tt.imagePreviewWrap,children:[i?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:tt.imagePreview,src:i,alt:u9(e)}),a.jsx("a",{className:tt.imageDownloadButton,href:i,download:u9(e),"aria-label":`Download ${u9(e)}`,title:"Download",children:a.jsx(jw,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:tt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:tt.previewError,children:l})]})}function Une({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i}){const[o,l]=d.useState(s??null),[c,u]=d.useState(),[h,f]=d.useState(null);return d.useEffect(()=>{let p=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(m=>{if(!p){if(m.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async m=>{if(p||!m||!m.truncated)return m;const g=await i4((v,y)=>n.readFileBytes(v,y),e,"application/octet-stream",{statFile:v=>n.stat(v),isCancelled:()=>p});return{sizeBytes:g.size,content:new TextDecoder(m.encoding||"utf-8").decode(await g.arrayBuffer())}}).then(m=>{p||!m||(u(m.sizeBytes),l(m.content))}).catch(m=>{if(p)return;const g=m instanceof Error?m.message:String(m);f(g),i?.(g)}),()=>{p=!0}},[t,s,r,i,n,e]),{content:o,error:h,sizeBytes:c}}function gAn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:i,onLoadError:o}){const{content:l,error:c,sizeBytes:u}=Une({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:i,onLoadError:o});return a.jsxs("div",{className:tt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:tt.empty,children:"Loading preview..."}):a.jsx($Pe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(vAn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:tt.previewError,children:c})]})}function vAn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=pt(),[r,i]=d.useState(null),[o,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return i(null),l(null),Dct(e,n,c.signal).then(u=>{c.signal.aborted||i(u)},u=>{c.signal.aborted||l(Ha(u))}),()=>c.abort()},[e,n]),o?a.jsx("div",{className:tt.previewError,children:s("artifact.previewFailed",{message:o})}):r===null?a.jsx("div",{className:tt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:tt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function OPe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i}){const o=d.useRef(null),[l,c]=d.useState(null),{content:u,error:h}=Une({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i});return d.useEffect(()=>{const f=o.current;if(!f||u===null)return;f.replaceChildren(),c(null);let p;try{p=new os({doc:u,extensions:[S8e,os.editable.of(!1),Co.readOnly.of(!0),os.lineWrapping],parent:f})}catch(m){c(m instanceof Error?m.message:String(m));return}return()=>p.destroy()},[u]),a.jsxs("div",{className:tt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:tt.empty,children:"Loading file..."}):a.jsx("div",{ref:o,className:tt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:tt.previewError,children:h||l})]})}function $Pe({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:i}=pt(),[o,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=o===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:i("artifact.longDocument")}),a.jsx(wt,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:i(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(OPe,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function wAn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:i,onLoadError:o}){const{content:l,error:c,sizeBytes:u}=Une({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:i,onLoadError:o});return a.jsxs("div",{className:tt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:tt.empty,children:"Loading preview..."}):a.jsx($Pe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:tt.markdownPreviewWrap,children:a.jsx(kp,{content:l})})}),c&&a.jsx("div",{className:tt.previewError,children:c})]})}function hf({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.fieldLabel,children:e}),a.jsx("span",{className:tt.fieldValue,children:t})]}):null}function xC(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(hf,{label:n,value:String(s)},t)}/**
|
|
2269
|
+
`);return n===-1?t:t.slice(0,n)}function k5n(e,t){if(e.kind==="request"){const n=[Id(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:Id(e.timing.ttftMs)})),e.usage&&n.push(y5n(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(Id(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:i}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:Id(i)}))}return n}return[]}function owe(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Go.toneError;if(t==="cancelled")return Go.toneMuted}function _5n(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:c3(e.block.text)};case"request":{const n=x5n(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:Go.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:c3(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...owe(e)?{badgeTone:owe(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return S5n(e.block,t)}}function S5n(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:c3(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:c3(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:Go.toneError}:{},text:c3(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Go.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function C5n(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function T5n({loadPage:e}){const{t}=pt(),{trajectory:n,status:s,error:r,truncated:i,refresh:o}=W3n(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),p=d.useId(),m=d.useCallback(C=>`${p}-row-${C}`,[p]),g=d.useCallback((C,I)=>{C.scrollTop=I,f.current=C.scrollTop},[]),v=d.useMemo(()=>{if(!n)return[];const C=new Map(n.rows.map(R=>[R.key,R])),I=[];for(const R of n.turns){const N=R.userRowKey??`ordinal:${R.index}`;I.push({kind:"turn",key:`turn:${N}`,turn:R});for(const j of R.rowKeys){const P=C.get(j);P&&I.push({kind:"row",key:j,row:P})}}return I},[n]),y=xIe({count:v.length,getScrollElement:()=>u.current,getItemKey:C=>v[C]?.key??C,estimateSize:()=>rwe,overscan:12}),w=v.length>0;d.useLayoutEffect(()=>{const C=u.current;if(!C||typeof ResizeObserver>"u")return;let I=0;const R=()=>{C.scrollTop===0&&f.current>0&&(C.scrollTop=f.current)},N=new ResizeObserver(()=>{R(),I=requestAnimationFrame(R)});return N.observe(C),()=>{N.disconnect(),I!==0&&cancelAnimationFrame(I)}},[w]),d.useEffect(()=>{if(s!=="ready"||h.current||v.length===0)return;h.current=!0;const C=u.current;C&&g(C,C.scrollHeight)},[g,s,v.length]);const b=d.useMemo(()=>l===void 0?-1:v.findIndex(C=>C.key===l),[l,v]),x=d.useCallback(C=>{if(v.length===0)return;const I=Math.min(Math.max(C,0),v.length-1);c(v[I].key),y.scrollToIndex(I,{align:"auto"})},[y,v]),k=d.useCallback(C=>{c(C),u.current?.focus({preventScroll:!0})},[]),S=d.useCallback(C=>{if(v.length===0)return;const I=b<0?-1:b;C.key==="ArrowDown"?(C.preventDefault(),x(I+1)):C.key==="ArrowUp"?(C.preventDefault(),x(I<=0?0:I-1)):C.key==="Home"?(C.preventDefault(),x(0)):C.key==="End"&&(C.preventDefault(),x(v.length-1))},[x,b,v]),T=d.useMemo(()=>{if(!n)return;let C=0,I=0,R=0;for(const N of n.turns)C+=N.requestCount,I+=N.toolCount,R+=N.requestMs;return{turns:n.turns.length,requests:C,tools:I,durationMs:R}},[n]),E=s==="ready"&&v.length===0,A=n!==void 0&&v.length>0&&!C5n(n);return a.jsxs("div",{className:Go.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Go.header,children:[a.jsx("div",{className:Go.summary,children:T?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:T.turns,requests:T.requests,tools:T.tools,duration:T.durationMs>0?Id(T.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Go.headerActions,children:a.jsx("button",{type:"button",className:Go.iconButton,onClick:o,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(Wh,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Go.error,role:"alert",children:[a.jsx("span",{children:r.kind==="partial"?t("trajectory.partial"):t("trajectory.loadFailed",{message:r.message})}),a.jsx("button",{type:"button",className:Go.headerButton,onClick:o,disabled:s==="loading",children:t("common.retry")})]}),A&&a.jsx("div",{className:Go.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Go.tableWrap,children:v.length===0?s==="error"?null:a.jsx("div",{className:Go.placeholder,role:"status",children:t(E?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[i&&a.jsx("div",{className:Go.olderBar,children:a.jsx("span",{className:Go.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Go.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":v.length,"aria-activedescendant":b>=0?m(b):void 0,onKeyDown:S,onScroll:C=>{f.current=C.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Go.virtualBody,style:{height:`${y.getTotalSize()}px`},children:y.getVirtualItems().map(C=>{const I=v[C.index];return a.jsx("div",{id:m(C.index),className:Go.virtualRow,style:{height:`${rwe}px`,transform:`translateY(${C.start}px)`},role:"row","aria-rowindex":C.index+1,children:I.kind==="turn"?a.jsx(I5n,{turn:I.turn,selected:I.key===l,onSelect:()=>k(I.key)}):a.jsx(E5n,{row:I.row,selected:I.key===l,onSelect:()=>k(I.key)})},C.key)})})})]})})]})}function I5n({turn:e,selected:t,onSelect:n}){const{t:s}=pt();return a.jsxs("div",{className:`${Go.turnHeader} ${t?Go.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Go.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Go.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?Id(e.requestMs):"—"})})]})}function E5n({row:e,selected:t,onSelect:n}){const{t:s}=pt(),r=_5n(e,s),i=k5n(e,s);return a.jsxs("div",{className:`${Go.record} ${t?Go.selected:""}`,role:"gridcell","aria-selected":t,"data-selected":t?"true":void 0,onClick:n,"data-testid":`trajectory-row-${e.kind}`,"data-depth":e.depth,children:[e.depth>0&&a.jsx(rot,{size:12,strokeWidth:1.6,className:Go.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Go.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Go.text} ${r.faint?Go.faint:""}`,children:r.text}),a.jsx("span",{className:Go.metrics,"data-testid":"trajectory-row-metrics",children:i.length>0?i.join(" · "):"—"})]})}const R5n="_panel_pwtdr_1",A5n="_toolbar_pwtdr_5",j5n="_actions_pwtdr_15",N5n="_feedback_pwtdr_21",M5n="_state_pwtdr_31",Xv={panel:R5n,toolbar:A5n,actions:j5n,feedback:N5n,state:M5n};function P5n({sessionActions:e,sessionId:t,controls:n}){const{t:s}=pt(),[r,i]=d.useState(null),[o,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 y=m?.result,[w,b]=d.useState(y),x=!!(y&&y!==w&&(y.kind!=="completed"||!c));d.useEffect(()=>{y?.kind==="completed"&&(h.current++,i(y.usage),u(!1))},[y]),d.useEffect(()=>{let T=!0,E=!1;const A=v.current?.result;i(I=>I?.sessionId===t?I:A?.kind==="completed"?A.usage:null),u(!1),l(!!g);const C=async()=>{if(!T||E||!g)return;E=!0,l(!0),u(!1);const I=h.current,R=p.current,N=R&&R.getContextUsage===g&&R.sessionId===t?R:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=N;try{const j=await N.promise;if(!T||I!==h.current)return;i(j.sessionId===t&&j.usage.contextWindowSize>0?j:null)}catch(j){if(!T||I!==h.current)return;u(sQ(j)?"transient":"hard")}finally{E=!1,p.current===N&&(p.current=null),T&&l(!1)}};return f.current=()=>void C(),C(),()=>{T=!1}},[g,t]);const k=!g||o||m?.compressing,S=()=>{b(y),f.current()};return a.jsxs("div",{className:Xv.panel,"aria-busy":o,children:[a.jsxs("div",{className:Xv.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:Xv.actions,children:[a.jsx(wt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:k,onClick:S,children:a.jsx(Wh,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?o?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(wt,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||o,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(f9e,{controls:m,className:Xv.feedback}),c==="transient"&&r&&a.jsx("div",{className:Xv.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:Xv.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(wt,{type:"button",variant:"outline",size:"sm",disabled:k,onClick:S,children:s("contextUsage.retry")})]}):g?o&&!r?a.jsx("div",{className:Xv.state,role:"status",children:s("common.loading")}):r?a.jsx(R5e,{status:r,compact:!0}):a.jsx("div",{className:Xv.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:Xv.state,children:s("contextUsage.unavailable")})]})}const L5n=700,D5n=["daily","weekdays","weekly","hourly","minutes","custom"],O5n=[1,2,3,4,5,6,10,12,15,20,30],$5n=(e,t)=>{},B5n=(e,t,n)=>{},F5n=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function awe(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function Zv(e){return e.kind==="pending"?e.targetKind:e.kind}function z5n(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const H5n=["review","sideTask"];function lwe({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:i,panelWidth:o,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onCloseTab:p,onOpenFilePreview:m,latestReviewAvailable:g=!1,onOpenLatestReview:v,onOpenTerminal:y,onOpenTrajectory:w,trajectoryTabId:b,onOpenWebPreview:x,onWebPreviewChange:k,items:S=H5n,sideTaskAvailable:T=!1,sideTasks:E=[],sideTasksLoading:A=!1,onCreateSideTask:C,onOpenSideTask:I,onCreateSideTaskSession:R,onSideTaskCreated:N,onSideTaskTitleChange:j,onNestedRightPanelOpen:P,onNestedArtifactsChange:$,onOpenNestedSubagent:M,agentTasks:U=[],agentTraceLoading:V=!1,agentTraceError:z,onOpenWorkflowAgent:L,onError:X,sessionWorkflowEnabled:ee,workflow:H,onImageIngestionNotice:Q,deferSubagentMount:de=!1,onClose:ve,variant:B="docked",fullscreen:G=!1,onToggleFullscreen:W}){const{t:F}=pt(),[pe,J]=d.useState(!1),[ue,re]=d.useState(),we=d.useRef(null),me=d.useCallback(()=>{we.current&&(clearTimeout(we.current),we.current=null),J(!0)},[]),fe=d.useCallback(()=>{we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{J(!1),we.current=null},120)},[]);d.useEffect(()=>()=>{we.current&&clearTimeout(we.current)},[]);const ke=n.find(be=>be.id===s)??n[0],Le=ke?.kind==="file"&&ke.sourcePreview&&(/\.html?$/i.test(ke.workspacePath)||Xw(ke.previewMimeType||ke.previewData?.type)==="text/html"),Ve=ke?.kind==="file"&&ke.previewOnly===!0&&!Le&&/\.(?:html?|md|markdown)$/i.test(ke.workspacePath)&&(ke.previewContent!==void 0||!ke.previewData||!!FT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)),rt=ue===ke?.id,Re=S.includes("review")&&!n.some(be=>Zv(be)==="review"),Ue=S.includes("sideTask")&&T&&!!C,Te=!!y,oe=S.includes("webPreview")&&!!x,D=S.includes("trajectory")&&!!w&&!n.some(be=>be.id===b),Y=!!ke&&(Re||Ue||Te||oe||D),ie=ke&&awe(ke)?{workspaceCwd:ke.workspaceCwd,workspaceId:ke.workspaceId}:void 0,_e=y4(ie?.workspaceCwd),Be=_e?.workspaceId===ie?.workspaceId?_e?.actions:void 0,ge=ke?.kind==="artifact"?t.find(be=>be.id===ke.artifactId):void 0;return a.jsxs("aside",{className:`${tt.panel} ${B==="drawer"?tt.panelDrawer:""} ${G?tt.panelFullscreen:""}`,style:B==="docked"&&o&&!G?{flexBasis:o,width:o}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:tt.header,children:[n.length>0&&a.jsx("div",{className:tt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(be=>a.jsxs("div",{className:[tt.tabItem,be.id===ke?.id?tt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":be.id===ke?.id,className:tt.tab,onClick:()=>f(be.id),onMouseEnter:Ee=>F2(Ee.currentTarget),onFocus:Ee=>F2(Ee.currentTarget),title:be.title,children:[a.jsx("span",{className:`${tt.tabIcon} ${Zv(be)==="artifact"?tt.tabArtifactIcon:""}`,"aria-hidden":"true",children:Zv(be)==="review"?a.jsx(pq,{}):be.kind==="workflow"?a.jsx(q4e,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="file"?a.jsx(mg,{name:be.workspacePath,className:tt.tabIconSvg,strokeWidth:1.6}):Zv(be)==="artifact"?a.jsx(fIe,{artifact:t.find(Ee=>"artifactId"in be&&Ee.id===be.artifactId),className:tt.tabIconSvg}):Zv(be)==="subagent"?a.jsx(U5n,{}):Zv(be)==="monitor"?a.jsx(Q4e,{className:tt.tabIconSvg,strokeWidth:1.6}):Zv(be)==="shell"?a.jsx(l2,{className:tt.tabIconSvg,strokeWidth:1.6}):Zv(be)==="side_task"?a.jsx(iN,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="web_preview"?a.jsx(M2,{className:tt.tabIconSvg}):be.kind==="terminal"?a.jsx(l2,{className:tt.tabIconSvg,strokeWidth:1.6}):Zv(be)==="image"?a.jsx(iat,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="context_usage"?a.jsx(jD,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="token_usage"?a.jsx(cJ,{className:tt.tabIconSvg,strokeWidth:1.6}):be.kind==="trajectory"?a.jsx(pz,{className:tt.tabIconSvg,strokeWidth:1.6}):a.jsx(W5n,{})}),a.jsx("span",{className:tt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:tt.tabTitleInner,children:be.title})})]}),a.jsx("button",{type:"button",className:tt.tabCloseButton,onClick:()=>p(be.id),"aria-label":`Close ${be.title}`,title:"Close",children:a.jsx(q5n,{})})]},be.id))}),a.jsxs("div",{className:tt.headerActions,children:[Y&&a.jsxs(Pm,{modal:!1,children:[a.jsx(Sp,{asChild:!0,children:a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.addButton}`,"aria-label":F("rightPanel.add"),title:F("rightPanel.add"),children:a.jsx(rh,{className:tt.toolbarIcon})})}),a.jsxs(Cp,{align:"end",className:"w-64",children:[Re&&a.jsxs(Ri,{disabled:!g||!v,onSelect:v,children:[a.jsx(pq,{}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("turnOutputs.review")})]}),Re&&Ue&&a.jsx($w,{}),Ue&&a.jsxs(Ri,{disabled:A,onSelect:C,children:[a.jsx(iN,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("sideTask.create")})]}),Te&&(Re||Ue)&&a.jsx($w,{}),Te&&a.jsxs(Ri,{onSelect:()=>y?.(),children:[a.jsx(l2,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("terminal.title")})]}),oe&&a.jsxs(Ri,{onSelect:x,children:[a.jsx(M2,{className:tt.sideTaskNewIcon}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("webPreview.title")})]}),D&&a.jsxs(Ri,{onSelect:()=>w?.(),children:[a.jsx(pz,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("trajectory.title")})]})]})]}),W&&a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.fullscreenButton} ${G?tt.iconButtonActive:""}`,onClick:W,"aria-label":F(G?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":G,title:F(G?"common.exitFullscreen":"common.fullscreen"),children:G?a.jsx(dJ,{className:tt.toolbarIcon,"aria-hidden":!0}):a.jsx(aJ,{className:tt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${tt.iconButton} ${tt.panelToggleButton}`,onClick:ve,"aria-label":F("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:F("chatHeader.toggleRightPanel"),children:a.jsx(W4e,{className:tt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${tt.body} ${ke?.kind==="side_task"?tt.bodySideTask:""}`.trim(),children:[n.filter(be=>be.kind==="web_preview").map(be=>a.jsx("div",{className:"h-full",hidden:be.id!==ke?.id,children:a.jsx(URn,{state:be,onChange:Ee=>k?.(be.id,Ee)})},be.id)),n.filter(be=>be.kind==="terminal").map(be=>a.jsx("div",{className:`${tt.terminalPane} ${be.id===ke?.id?"":tt.terminalPaneHidden}`.trim(),"aria-hidden":be.id===ke?.id?void 0:!0,children:a.jsx(HRn,{terminalId:be.id,cwd:be.workspaceCwd??l,active:be.id===ke?.id,enabled:be.initialized!==!1})},be.id)),Ve&&a.jsxs("button",{type:"button",className:tt.attachmentPreviewButton,onClick:()=>re(rt?void 0:ke?.id),"aria-label":F(rt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":rt,children:[rt?a.jsx(Zit,{"aria-hidden":!0}):a.jsx(D4e,{"aria-hidden":!0}),F(rt?"attachment.showSource":"attachment.showPreview")]}),u&&!ke?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":F("common.loading"),children:[a.jsx($0,{className:"h-5 w-2/5"}),a.jsx($0,{className:"h-32 w-full"}),a.jsx($0,{className:"h-4 w-4/5"}),a.jsx($0,{className:"h-4 w-3/5"})]}):ke?.kind==="terminal"||ke?.kind==="web_preview"?null:ke?ke.kind==="pending"?a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.kind==="workflow"?ke.sessionId?a.jsx(DTn,{tasks:U,loading:V,error:z,onOpenAgent:L}):H?a.jsx(S4n,{...H}):a.jsx("div",{className:tt.empty,children:F("workflow.empty.title")}):awe(ke)&&(ke.kind!=="scheduled_task"||ke.task.durable)&&(ke.kind!=="file"||!ke.previewOnly)&&(ke.kind!=="artifact"||ge?.metadata?.artifactType!=="web_preview_snapshot")&&!Be?a.jsx("div",{className:tt.empty,role:"alert",children:F("workspace.notFoundDescription")}):ke.kind==="review"?a.jsx(K5n,{changes:ke.changes??r,selectedPath:ke.selectedPath??i,workspaceCwd:ke.workspaceCwd??l,onOpenFilePreview:be=>m(be,ke.workspaceCwd??l,ke.workspaceId),onDownloadFile:(be,Ee)=>PD(Be,be.path,Lct(be.path),Ee),onDownloadError:be=>{const Ee=F("common.downloadFailed",{message:Ha(be)});X?X(new Error(Ee,{cause:be}),Ee):console.error(Ee,be)}}):ke.kind==="file"?ke.attachmentId&&!ke.previewData&&ke.previewContent===void 0?a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.sourcePreview&&ke.previewData&&Xw(ke.previewMimeType||ke.previewData.type)!=="application/pdf"&&!FT(ke.previewMimeType||ke.previewData.type,ke.workspacePath)?a.jsx(LPe,{data:ke.previewData,title:ke.title,image:!!sS(ke.workspacePath)&&ke.previewData.type.startsWith("image/")}):a.jsx(KO,{workspacePath:ke.workspacePath,artifactVersion:String(ke.previewVersion??0),workspaceActions:Be,previewContent:ke.previewContent,previewData:ke.previewData,previewMimeType:ke.previewMimeType,previewOnly:ke.previewOnly,previewKind:Le||ke.previewOnly&&!rt?"source":void 0},ke.id):ke.kind==="source"?a.jsx(dAn,{tab:ke},ke.id):ke.kind==="artifact"?a.jsx(V5n,{artifacts:t,artifactId:ke.artifactId,sourceSessionId:ke.sourceSessionId,workspaceActions:Be,previewContent:ke.previewContent,loading:c,error:h},ke.id):ke.kind==="subagent"?de?null:a.jsx(wTn,{sessionId:ke.sessionId,rootToolCallId:ke.rootToolCallId,initialRootTool:ke.rootTool,workspaceCwd:ke.workspaceCwd??l,onRightPanelOpen:P,onArtifactsChange:$,onOpenSubagent:M,onError:X}):ke.kind==="monitor"?a.jsx(k6t,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="shell"?a.jsx(_6t,{task:ke.task,actions:ke.sessionActions},ke.id):ke.kind==="side_task"?a.jsx($Tn,{tabId:ke.id,sessionId:ke.sessionId,parentSessionId:ke.parentSessionId,workspaceCwd:ke.workspaceCwd??l,title:ke.title,shouldNameFromFirstPrompt:ke.nameFromFirstPrompt,initialPrompt:ke.initialPrompt,createSession:R??F5n,onCreated:N??$5n,onTitleChange:j??B5n,onRightPanelOpen:P,onArtifactsChange:$,onError:X,sessionWorkflowEnabled:ee,onImageIngestionNotice:Q},ke.id):ke.kind==="image"?ke.src?a.jsxs("div",{className:tt.imagePreviewWrap,children:[a.jsx("img",{src:ke.src,alt:ke.alt??ke.title,className:tt.imagePreview}),a.jsx("a",{className:tt.imageDownloadButton,href:ke.src,download:z5n(ke.src),"aria-label":F("common.download"),title:F("common.download"),children:a.jsx(jw,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:tt.empty,role:ke.loadError?"alert":"status",children:ke.loadError??F("common.loading")}):ke.kind==="context_usage"?a.jsx(P5n,{controls:e?.[ke.sessionId],sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):ke.kind==="trajectory"?a.jsx(T5n,{loadPage:ke.loadPage},ke.id):ke.kind==="token_usage"?a.jsx(A3n,{sessionActions:ke.sessionActions,sessionId:ke.sessionId},ke.id):a.jsx(G5n,{task:ke.task,actions:Be},ke.id):a.jsxs("div",{className:tt.emptyActions,"data-testid":"right-panel-empty-actions",children:[S.includes("review")&&a.jsxs("button",{type:"button",className:tt.emptyAction,disabled:!g||!v,onClick:v,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(pq,{})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("turnOutputs.review")}),a.jsx("span",{className:tt.emptyActionHint,children:F("turnOutputs.reviewLatest")}),a.jsx(qa,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),S.includes("sideTask")&&T&&C&&(E.length===0?a.jsxs("button",{type:"button",className:tt.emptyAction,disabled:A,"aria-busy":A,onClick:C,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(iN,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("sideTask.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("sideTask.description")}),a.jsx(qa,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Pm,{open:pe,onOpenChange:J,modal:!1,children:[a.jsx(Sp,{asChild:!0,children:a.jsxs("button",{type:"button",className:tt.emptyAction,"aria-expanded":pe,onMouseEnter:me,onMouseLeave:fe,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(iN,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("sideTask.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("sideTask.description")}),a.jsx(qa,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Cp,{align:"end",className:"w-80",onMouseEnter:me,onMouseLeave:fe,children:[E.map(be=>a.jsxs(Ri,{onSelect:()=>I?.(be),children:[a.jsx("span",{className:tt.sideTaskListTitle,children:be.title}),be.updatedAt&&a.jsx("span",{className:tt.sideTaskListTime,children:zT(be.updatedAt,F)})]},be.sessionId)),a.jsx($w,{}),a.jsxs(Ri,{onSelect:C,children:[a.jsx(Bit,{className:tt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:tt.sideTaskListTitle,children:F("sideTask.new")})]})]})]})),oe&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:x,children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(M2,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("webPreview.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("webPreview.openHint")}),a.jsx(qa,{className:tt.emptyActionChevron,"aria-hidden":"true"})]}),D&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:()=>w?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(pz,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("trajectory.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("trajectory.description")}),a.jsx(qa,{className:tt.emptyActionChevron,"aria-hidden":"true"})]}),y&&a.jsxs("button",{type:"button",className:tt.emptyAction,onClick:()=>y(),children:[a.jsx("span",{className:tt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(l2,{strokeWidth:1.6})}),a.jsx("span",{className:tt.emptyActionTitle,children:F("terminal.title")}),a.jsx("span",{className:tt.emptyActionHint,children:F("terminal.open")}),a.jsx(qa,{className:tt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function U5n(){return a.jsxs("svg",{className:tt.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 q5n(){return a.jsx("svg",{className:tt.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 pq(){return a.jsxs("svg",{className:tt.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 W5n(){return a.jsxs("svg",{className:tt.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 V5n({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:i,error:o}){const l=e.find(c=>c.id===t);return l?a.jsx(iAn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):i?a.jsx("div",{className:tt.empty,children:"Loading artifact..."}):o?a.jsx("div",{className:tt.empty,children:o}):a.jsx("div",{className:tt.empty,children:"Artifact not found."})}function G5n({task:e,actions:t}){const{t:n}=pt(),[s,r]=d.useState(null),[i,o]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>yb(e.cron)),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[S,T]=d.useState(!1),[E,A]=d.useState(null),C=d.useRef(0),I=d.useRef(0),R=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});R.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=d.useCallback((F,pe,J,ue)=>{const re=R.current;return F===C.current&&re.actions===pe&&re.taskId===J&&re.workspaceId===ue},[]),j=d.useCallback((F,pe,J,ue)=>{const re=R.current;return F===I.current&&re.actions===pe&&re.taskId===J&&re.workspaceId===ue},[]);d.useEffect(()=>()=>{C.current+=1,I.current+=1},[]),d.useEffect(()=>{k(!1),T(!1),A(null)},[t,e.id,e.workspaceId]);const P=d.useCallback(async()=>{const F=++C.current,pe=++I.current,J=e.id,ue=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(yb(e.cron)),c(null),o(!1);return}o(!0),c(null);try{const re=await t.listScheduledTasks(ue);if(!N(F,t,J,ue))return;const we=re.find(me=>me.id===e.id)??null;r(we),we?(h(we.name??""),p(we.prompt),g(yb(we.cron))):(h(""),p(e.prompt),g(yb(e.cron)))}catch(re){j(pe,t,J,ue)&&c(re instanceof Error?re.message:String(re))}finally{j(pe,t,J,ue)&&o(!1)}},[t,j,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{P()},[P]);const $=!e.durable,M=e.durable&&!i&&!l&&!s,U=!!s,V=s?.name||s?.prompt||e.title,z=s?.prompt??e.prompt,L=s?.cron??e.cron,X=s?.recurring??e.recurring,ee=s?.enabled,H=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(yb(s.cron)),A(null),y(!0))},[s]),Q=d.useCallback(()=>{y(!1),A(null),s&&(h(s.name??""),p(s.prompt),g(yb(s.cron)))},[s]),de=d.useCallback(async()=>{if(!s||!t)return;const F=C7(m);if(!F){A(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){A(n("scheduledTasks.error.emptyPrompt"));return}const pe=++C.current,J=e.id,ue=e.workspaceId;T(!0),A(null);try{const re=await t.updateScheduledTask(s.id,{cron:F,prompt:f.trim(),name:u.trim()||null},ue);if(!N(pe,t,J,ue))return;r(re),h(re.name??""),p(re.prompt),g(yb(re.cron)),y(!1)}catch(re){N(pe,t,J,ue)&&A(re instanceof Error?re.message:String(re))}finally{N(pe,t,J,ue)&&T(!1)}},[t,m,N,s,u,f,n,e.id,e.workspaceId]),ve=d.useCallback(async()=>{if(!s||!t)return;const F=++C.current,pe=e.id,J=e.workspaceId;k(!0),A(null);try{const ue=await t.updateScheduledTask(s.id,{enabled:!s.enabled},J);if(!N(F,t,pe,J))return;r(ue)}catch(ue){N(F,t,pe,J)&&A(ue instanceof Error?ue.message:String(ue))}finally{N(F,t,pe,J)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),B=d.useCallback(async()=>{if(!s||!t)return;const F=++C.current,pe=e.id,J=e.workspaceId;k(!0),A(null);try{if(await t.deleteScheduledTask(s.id,J),!N(F,t,pe,J))return;r(null),b(!1)}catch(ue){N(F,t,pe,J)&&A(ue instanceof Error?ue.message:String(ue))}finally{N(F,t,pe,J)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),G=C7(m),W=G?yT(G,n):null;return a.jsxs("div",{className:tt.detail,children:[i&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Vt.loadError,children:l}),M&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.deletedSnapshot")}),$&&a.jsx("div",{className:tt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!M&&a.jsx("div",{className:tt.section,children:a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:tt.fieldValue,children:V}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:tt.fieldValue,children:e.id}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:tt.fieldValue,children:yT(L,n)}),a.jsx("span",{className:tt.fieldLabel,children:"Cron"}),a.jsx("span",{className:tt.fieldValue,children:L}),a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:tt.fieldValue,children:n(X?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ee!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:tt.fieldValue,children:n(ee?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!M&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:tt.description,children:z})]}),E&&a.jsx("div",{className:Vt.formError,children:E}),a.jsxs("div",{className:tt.actionsRow,children:[a.jsx("button",{type:"button",className:Vt.primaryButton,disabled:!U||x,onClick:H,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Vt.secondaryButton,disabled:!U||x,onClick:()=>void ve(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Vt.secondaryButton,disabled:!U||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(Ko,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:a.jsxs("div",{className:Vt.formFields,children:[a.jsx("div",{className:tt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),E&&a.jsx("div",{className:Vt.formError,children:E}),a.jsxs("div",{className:Vt.formActions,children:[a.jsx("button",{type:"button",className:Vt.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Vt.primaryButton,onClick:()=>void B(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(Ko,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:a.jsxs("div",{className:Vt.formFields,children:[a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Vt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:F=>h(F.target.value)})]}),a.jsxs("label",{className:Vt.field,children:[a.jsxs("span",{className:Vt.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Vt.required,children:"*"})]}),a.jsx("textarea",{className:Vt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:F=>p(F.target.value)})]}),a.jsxs("div",{className:Vt.scheduleRow,children:[a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Vt.select,value:m.frequency,onChange:F=>{const pe=F.target.value;g(J=>({...J,frequency:pe,...pe==="hourly"?{time:"00:00"}:{}}))},children:D5n.map(F=>a.jsx("option",{value:F,children:n(`scheduledTasks.freq.${F}`)},F))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Vt.input,type:"time",value:m.time,onChange:F=>g(pe=>({...pe,time:F.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Vt.select,value:m.weekday,onChange:F=>g(pe=>({...pe,weekday:Number(F.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((F,pe)=>a.jsx("option",{value:pe,children:F},pe))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Vt.field,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Vt.select,value:m.minuteInterval,onChange:F=>g(pe=>({...pe,minuteInterval:Number(F.target.value)})),children:O5n.map(F=>a.jsx("option",{value:F,children:F},F))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Vt.field} ${Vt.fieldGrow}`,children:[a.jsx("span",{className:Vt.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Vt.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:F=>g(pe=>({...pe,customCron:F.target.value}))})]})]}),a.jsx("div",{className:Vt.preview,children:W?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Vt.previewLabel,children:W}),a.jsx("code",{className:Vt.previewCron,children:G})]}):a.jsx("span",{className:Vt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),E&&a.jsx("div",{className:Vt.formError,children:E}),a.jsxs("div",{className:Vt.formActions,children:[a.jsx("button",{type:"button",className:Vt.secondaryButton,onClick:Q,disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Vt.primaryButton,onClick:()=>void de(),disabled:S,children:n(S?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function K5n({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:i}){const{t:o}=pt(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,p]=d.useState(!1),[m,g]=d.useState(520),v=d.useRef(m),y=d.useRef(null),w=d.useRef(null),[b,x]=d.useState(null),[k,S]=d.useState(()=>new Set),T=d.useRef(!0);d.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const E=l,A=d.useMemo(()=>rAn(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const j=y.current;if(!j)return;const P=()=>{p(j.clientWidth<L5n)};P();const $=new ResizeObserver(P);return $.observe(j),()=>$.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const C=d.useCallback(j=>{const P=y.current;if(!P)return;j.preventDefault();const $=j.currentTarget;$.setPointerCapture(j.pointerId);const M=j.clientX,U=v.current,V=P.getBoundingClientRect().width,z=Math.max(180,V-180),L=document.body.style.cursor,X=document.body.style.userSelect;let ee=U,H=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Q=()=>{H=null,g(ee)},de=G=>{ee=Math.min(z,Math.max(180,U+(G.clientX-M))),H===null&&(H=window.requestAnimationFrame(Q))};let ve=()=>{};const B=G=>{w.current=null,H!==null&&(window.cancelAnimationFrame(H),H=null),G&&g(ee),$.hasPointerCapture(j.pointerId)&&$.releasePointerCapture(j.pointerId),document.body.style.cursor=L,document.body.style.userSelect=X,window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve)};ve=()=>B(!0),w.current=()=>B(!1),window.addEventListener("pointermove",de),window.addEventListener("pointerup",ve),window.addEventListener("pointercancel",ve)},[]);if(e.length===0)return a.jsx("div",{className:tt.empty,children:"No file changes to review."});const I=j6e(e),R=j=>{x(P=>P===j?null:j)},N=async j=>{if(!k.has(j.path)){S(P=>new Set(P).add(j.path));try{await r(j,()=>!T.current)}catch(P){T.current&&i(P)}finally{S(P=>{const $=new Set(P);return $.delete(j.path),$})}}};return a.jsxs("div",{className:tt.review,children:[a.jsxs("div",{className:tt.reviewToolbar,children:[a.jsxs("div",{className:tt.reviewToolbarTitle,children:[a.jsx("span",{children:o("turnOutputs.previousTurn")}),a.jsx(pP,{additions:I?.additions,deletions:I?.deletions,className:tt.lineStats,additionsClassName:tt.additions,deletionsClassName:tt.deletions})]}),a.jsxs("div",{className:tt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:tt.reviewTotalsButton,onClick:()=>h(j=>!j),"aria-expanded":u,children:[a.jsx("span",{children:o("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[tt.chevron,u?tt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(uwe,{})})]}),a.jsx("button",{type:"button",className:[tt.iconButton,l?tt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(j=>!j),"aria-label":o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:o(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(nAn,{}):a.jsx(tAn,{})})]})]}),u&&a.jsxs("div",{ref:y,className:[tt.reviewContent,E?"":tt.reviewContentListOnly,E&&f?tt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[tt.reviewList,b?tt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(j=>{const P=b===j.path,$=P6e(j.path),M=PBt(j.path);return a.jsxs("div",{className:[tt.reviewItem,P?tt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:tt.reviewRow,"data-selected":j.path===t||void 0,children:[a.jsx("button",{type:"button",className:tt.reviewRowToggle,onClick:()=>R(j.path),"aria-label":j.path,"aria-expanded":P}),a.jsx("span",{className:tt.fileIcon,children:PPe(j.path)}),a.jsxs("span",{className:tt.reviewFileName,children:[a.jsx(Q5n,{path:wO(j.path,n),title:j.path}),$&&a.jsx("button",{type:"button",className:tt.reviewOpenButton,onClick:()=>s(j),title:`${o("turnOutputs.preview")} ${j.path}`,children:o("turnOutputs.preview")}),M&&a.jsx("button",{type:"button",className:tt.reviewOpenButton,onClick:()=>void N(j),title:`${o("common.download")} ${j.path}`,disabled:k.has(j.path),children:o(k.has(j.path)?"common.downloading":"common.download")})]}),a.jsx(pP,{additions:j.additions,deletions:j.deletions,className:tt.lineStats,additionsClassName:tt.additions,deletionsClassName:tt.deletions}),a.jsx("span",{className:[tt.chevron,P?tt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(uwe,{})})]}),P&&a.jsx(Y5n,{change:j})]},`${j.toolCallId}:${j.path}`)})}),E&&!f&&a.jsx("div",{className:tt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:C}),E&&a.jsx("div",{className:tt.tree,children:A.children.map(j=>a.jsx(jPe,{node:j,depth:0,selectedPath:t},j.path))})]})]})}function Y5n({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:tt.diffEmpty,children:"No diff available."});const t=X5n(e.diffs);return a.jsx("div",{className:tt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(Oee,{diff:n.fileDiff},s):a.jsx(Z5n,{oldText:n.oldText,newText:n.newText},s))})}function X5n(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function Z5n({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[i,o]=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(),o(null);let c=!1,u=null;const h=[S8e,os.editable.of(!1),Co.readOnly.of(!0),os.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return He(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-BgwXHnoB.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 os({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||o(v instanceof Error?v.message:String(v))}}).catch(m=>{c||o(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:tt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:tt.codeMirrorDiff}),i&&a.jsxs("div",{className:tt.diffError,children:["Diff unavailable: ",i]})]})}function jPe({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,i]=d.useState(!0),o=[tt.treeRow,s?tt.treeFile:tt.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:tt.treeTwisty,children:!s&&a.jsx("span",{className:[tt.treeChevron,r?"":tt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(sAn,{})})}),a.jsxs("span",{className:tt.treeContent,children:[s&&a.jsx("span",{className:tt.fileIcon,children:PPe(e.path)}),a.jsx("span",{className:tt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:tt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:tt.treeNode,children:[s?a.jsx("div",{className:o,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:o,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>i(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:tt.treeChildren,style:c,children:e.children.map(h=>a.jsx(jPe,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function Q5n({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>NPe(e));return d.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>r(J5n(e,i));o();const l=new ResizeObserver(o);return l.observe(i),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:tt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:tt.pathPrefix,children:s.prefix}),a.jsx("span",{className:tt.pathFileName,children:s.leaf})]})}function NPe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let cwe=null;function J5n(e,t){const n=NPe(e),s=t.clientWidth;if(s<=0)return n;const r=eAn(t);if(r(e)<=s)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,l=r(o);if(i.length<=1||l+r(".../")>s)return{prefix:"",leaf:o};let c=".../";for(let u=1;u<i.length;u++){const f=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:o}}function eAn(e){cwe??=document.createElement("canvas");const t=cwe.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 tAn(){return a.jsxs("svg",{className:tt.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 nAn(){return a.jsxs("svg",{className:tt.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 uwe(){return a.jsx("svg",{className:tt.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 sAn(){return a.jsx("svg",{className:tt.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 rAn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=wO(s.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<r.length;o++){const l=r[o],c=r.slice(0,o+1).join("/");let u=i.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},i.children.push(u)),o===r.length-1&&(u.file=s),i=u}}return MPe(n),n}function MPe(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)MPe(t)}function u9(e){return Zw(e).split("/").filter(Boolean).at(-1)??e}function PPe(e){const t=u9(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 iAn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=pt(),i=Lf(),o=cIe(e),l=p4(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=lIe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(qRn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(oAn,{status:e.status}):!h||!e.workspacePath?a.jsx(aAn,{}):a.jsx(tTn,{workspacePath:e.workspacePath,artifactVersion:qce(e),workspaceActions:n}):h&&e.workspacePath?oIe(e)?a.jsx(uAn,{artifact:e,workspaceActions:n}):a.jsx(KO,{workspacePath:e.workspacePath,artifactVersion:qce(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:lAn(e)?"html":cAn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:tt.detail,children:[a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx(hf,{label:"Type",value:fJ(e.kind,e.workspacePath)}),a.jsx(hf,{label:"Storage",value:e.storage}),a.jsx(hf,{label:"Status",value:e.status}),a.jsx(hf,{label:"Source",value:e.source}),a.jsx(hf,{label:"Size",value:MD(e.sizeBytes)}),a.jsx(hf,{label:"Created",value:e.createdAt}),a.jsx(hf,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(hf,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(hf,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Description"}),a.jsx("div",{className:tt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Details"}),a.jsxs("div",{className:tt.fieldGrid,children:[xC(e.metadata,"automationId","Automation ID"),xC(e.metadata,"schedule","Schedule"),xC(e.metadata,"timezone","Timezone"),xC(e.metadata,"status","Status"),xC(e.metadata,"nextRunAt","Next run"),xC(e.metadata,"prompt","Prompt")]})]}),(o||l)&&a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:tt.locationRow,children:[a.jsx("a",{className:tt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>i(p,l),children:l}),a.jsx("a",{className:tt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>i(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:tt.meta,children:o})]})]})}function oAn({status:e}){const{t}=pt();return a.jsx("div",{className:tt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function aAn(){const{t:e}=pt();return a.jsx("div",{className:tt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function lAn(e){const t=e.workspacePath?.toLowerCase()??"",n=Xw(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function cAn(e){const t=e.workspacePath?.toLowerCase()??"",n=Xw(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function uAn({artifact:e,workspaceActions:t}){const{t:n}=pt(),[s,r]=d.useState(null),[i,o]=d.useState(!1),l=d.useRef(!0),c=cIe(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){o(!0),r(null);try{await PD(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&o(!1)}}};return a.jsx("div",{className:tt.detail,children:a.jsxs("div",{className:tt.section,children:[a.jsx("div",{className:tt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:tt.fieldGrid,children:[a.jsx(hf,{label:"Type",value:fJ(e.kind,e.workspacePath)}),a.jsx(hf,{label:"Size",value:MD(e.sizeBytes)}),c?a.jsx(hf,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(hf,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:tt.downloadRow,children:a.jsx("button",{type:"button",className:tt.downloadButton,onClick:()=>{u()},disabled:i||e.status!=="available"&&e.status!=="changed",children:n(i?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:tt.previewError,children:s})]})})}function dAn({tab:e}){const{t}=pt(),n=oa(),s=y4(e.workspaceCwd),r=s?.actions,i=Lf(),[o,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[p,m]=d.useState(),g=e.source,v=g.locator,y=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:"",b=/\.pdf$/i.test(w);if(d.useEffect(()=>{let k=!1;return u(void 0),f(void 0),m(void 0),!y||v.type==="url"?void 0:((async()=>{if(v.type==="attachment"){const T=await e.sessionActions.readAttachment(v.attachmentId);if(k||!e.owner.isCurrent())return;const E=Uint8Array.from(atob(T.data),A=>A.charCodeAt(0));u(new Blob([E],{type:T.mimeType}))}else if(b&&r){const T=await i4(r.readFileBytes,w,"application/pdf",{statFile:r.stat,isCancelled:()=>k||!e.owner.isCurrent()});!k&&e.owner.isCurrent()&&u(T)}})().catch(T=>{!k&&e.owner.isCurrent()&&f(Ha(T))}),()=>{k=!0})},[o,y,v,w,b,e.owner,e.sessionActions,r]),y&&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}),p4(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>i(k,v.url),children:t("sources.openOriginal")})]});if(!y||!s&&v.type!=="attachment")return a.jsx("div",{className:tt.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!b&&oIe({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(wt,{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(jw,{})})}),h&&a.jsx(wt,{variant:"ghost",size:"sm",onClick:()=>l(k=>k+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:tt.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(wt,{onClick:()=>void PD(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(k=>{e.owner.isCurrent()&&f(Ha(k))}),children:t("common.download")})]}):(v.type==="attachment"||b)&&!c?a.jsx("div",{className:tt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!FT(c.type,w)?a.jsx(LPe,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!sS(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(KO,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||Xw(c?.type)==="text/html"?"source":void 0},o)})]})}function LPe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[i,o]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return o(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),i?a.jsxs("div",{className:tt.imagePreviewWrap,children:[n?a.jsx("img",{className:tt.imagePreview,src:i,alt:t}):a.jsx(DPe,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:i,download:t,"aria-label":`Download ${t}`,children:a.jsx(jw,{})})]}):null}function KO({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:i,previewMimeType:o,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h}){if(i)return a.jsx(hAn,{workspacePath:e,workspaceActions:n,data:i,mimeType:o,previewKind:c,onLoadError:h});const f=e.toLowerCase(),p=l??sS(e),m=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":p?"image":"source");return m==="html"?a.jsx(gAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="markdown"?a.jsx(wAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="image"&&p?a.jsx(mAn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:p,onLoadError:h}):a.jsx(OPe,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function hAn({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:i}){const o=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return o==="application/pdf"?a.jsx(pAn,{data:n,mimeType:o,title:e}):FT(o,e)?a.jsx(fAn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:i}):a.jsx(DPe,{name:e,mimeType:o,size:n.size})}function fAn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:i}=pt(),[o,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=i("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,i]),c?a.jsx("div",{className:tt.previewError,children:c}):o===void 0?a.jsx("div",{className:tt.empty,children:i("attachment.loadingFile")}):a.jsx(KO,{workspacePath:e,workspaceActions:t,previewContent:o,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function pAn({data:e,mimeType:t,title:n}){const{t:s}=pt(),[r,i]=d.useState();return d.useEffect(()=>{const o=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return i(o),()=>URL.revokeObjectURL(o)},[e,t]),r?a.jsx("iframe",{className:tt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:tt.empty,children:s("attachment.loadingPreview")})}function DPe({name:e,mimeType:t,size:n}){const{t:s}=pt();return a.jsxs("div",{className:tt.unsupportedAttachmentPreview,children:[a.jsx(mg,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:tt.unsupportedAttachmentMeta,children:[t," · ",MD(n)]})]})}function mAn({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[i,o]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return o(null),c(null),i4((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),o(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:tt.imagePreviewWrap,children:[i?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:tt.imagePreview,src:i,alt:u9(e)}),a.jsx("a",{className:tt.imageDownloadButton,href:i,download:u9(e),"aria-label":`Download ${u9(e)}`,title:"Download",children:a.jsx(jw,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:tt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:tt.previewError,children:l})]})}function Une({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i}){const[o,l]=d.useState(s??null),[c,u]=d.useState(),[h,f]=d.useState(null);return d.useEffect(()=>{let p=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(m=>{if(!p){if(m.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async m=>{if(p||!m||!m.truncated)return m;const g=await i4((v,y)=>n.readFileBytes(v,y),e,"application/octet-stream",{statFile:v=>n.stat(v),isCancelled:()=>p});return{sizeBytes:g.size,content:new TextDecoder(m.encoding||"utf-8").decode(await g.arrayBuffer())}}).then(m=>{p||!m||(u(m.sizeBytes),l(m.content))}).catch(m=>{if(p)return;const g=m instanceof Error?m.message:String(m);f(g),i?.(g)}),()=>{p=!0}},[t,s,r,i,n,e]),{content:o,error:h,sizeBytes:c}}function gAn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:i,onLoadError:o}){const{content:l,error:c,sizeBytes:u}=Une({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:i,onLoadError:o});return a.jsxs("div",{className:tt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:tt.empty,children:"Loading preview..."}):a.jsx($Pe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(vAn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:tt.previewError,children:c})]})}function vAn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=pt(),[r,i]=d.useState(null),[o,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return i(null),l(null),Dct(e,n,c.signal).then(u=>{c.signal.aborted||i(u)},u=>{c.signal.aborted||l(Ha(u))}),()=>c.abort()},[e,n]),o?a.jsx("div",{className:tt.previewError,children:s("artifact.previewFailed",{message:o})}):r===null?a.jsx("div",{className:tt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:tt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function OPe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i}){const o=d.useRef(null),[l,c]=d.useState(null),{content:u,error:h}=Une({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:i});return d.useEffect(()=>{const f=o.current;if(!f||u===null)return;f.replaceChildren(),c(null);let p;try{p=new os({doc:u,extensions:[S8e,os.editable.of(!1),Co.readOnly.of(!0),os.lineWrapping],parent:f})}catch(m){c(m instanceof Error?m.message:String(m));return}return()=>p.destroy()},[u]),a.jsxs("div",{className:tt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:tt.empty,children:"Loading file..."}):a.jsx("div",{ref:o,className:tt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:tt.previewError,children:h||l})]})}function $Pe({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:i}=pt(),[o,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=o===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:i("artifact.longDocument")}),a.jsx(wt,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:i(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(OPe,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function wAn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:i,onLoadError:o}){const{content:l,error:c,sizeBytes:u}=Une({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:i,onLoadError:o});return a.jsxs("div",{className:tt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:tt.empty,children:"Loading preview..."}):a.jsx($Pe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:tt.markdownPreviewWrap,children:a.jsx(kp,{content:l})})}),c&&a.jsx("div",{className:tt.previewError,children:c})]})}function hf({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:tt.fieldLabel,children:e}),a.jsx("span",{className:tt.fieldValue,children:t})]}):null}function xC(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(hf,{label:n,value:String(s)},t)}/**
|
|
2270
2270
|
* @license
|
|
2271
2271
|
* Copyright 2025 Qwen Team
|
|
2272
2272
|
* SPDX-License-Identifier: Apache-2.0
|