@qwen-code/qwen-code 0.24.5-nightly.20260924.ffea2d024e → 0.24.5
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/bundled/review/references/persistence.md +1 -1
- package/chunks/{MaxSizedBox-P2GHN5YV.js → MaxSizedBox-4MLWQHF3.js} +18 -18
- package/chunks/{StandaloneSessionPicker-PEMEEZ3Z.js → StandaloneSessionPicker-PDNU6KJJ.js} +31 -31
- package/chunks/{acp-subagent-executor-OGMA6OLJ.js → acp-subagent-executor-JB2J6N73.js} +21 -21
- package/chunks/{acpAgent-A53IIIQE.js → acpAgent-CAPZFZCW.js} +57 -57
- package/chunks/{agent-JMMW45UJ.js → agent-MTWGIPWC.js} +8 -8
- package/chunks/{agent-headless-KPCHNPFD.js → agent-headless-Z27XJSXK.js} +8 -8
- package/chunks/{anthropicContentGenerator-RDVBAABV.js → anthropicContentGenerator-VAFZRJWG.js} +3 -3
- package/chunks/{bridge-TQHMDUPJ.js → bridge-BUCSJHCE.js} +21 -21
- package/chunks/{channel-settings-store-FKBBCMS2.js → channel-settings-store-U25CVEL6.js} +23 -23
- package/chunks/{chunk-MHAVM3RF.js → chunk-242INZ6Y.js} +1 -1
- package/chunks/{chunk-DVQCM4OJ.js → chunk-245NB3M4.js} +1 -1
- package/chunks/{chunk-GXLCL2SC.js → chunk-26KGIWIW.js} +1 -1
- package/chunks/{chunk-CD7AASGR.js → chunk-2RQEWY2P.js} +1 -1
- package/chunks/{chunk-NFRX3HKQ.js → chunk-2SCE6YR2.js} +3 -3
- package/chunks/{chunk-F4WSLDSL.js → chunk-2XNGG7R3.js} +1 -1
- package/chunks/{chunk-BCW42UYG.js → chunk-36ZMEEBW.js} +4 -4
- package/chunks/{chunk-YQYJ2SGK.js → chunk-44K6Q5AW.js} +3 -3
- package/chunks/{chunk-EMMJKUYQ.js → chunk-4A4XNQEZ.js} +3 -3
- package/chunks/{chunk-KC7DLSY7.js → chunk-4VULJ3LV.js} +1 -1
- package/chunks/{chunk-J4DEZKGQ.js → chunk-4XXUGJJS.js} +1 -1
- package/chunks/{chunk-QZG34NFD.js → chunk-5OJQLD3P.js} +3 -3
- package/chunks/{chunk-AT4FRIF6.js → chunk-6FURC4LI.js} +1 -1
- package/chunks/{chunk-JYOYZTGR.js → chunk-6KXQIDK2.js} +3 -3
- package/chunks/{chunk-ACUMQNP3.js → chunk-7MNHZUTA.js} +9 -9
- package/chunks/{chunk-BN3JSE4B.js → chunk-7P5WZQXF.js} +5 -5
- package/chunks/{chunk-GOIJGGKX.js → chunk-AAOMFXVZ.js} +7 -7
- package/chunks/{chunk-SJ2JVXQY.js → chunk-ACLD6C3R.js} +53 -78
- package/chunks/{chunk-7ELTXG6G.js → chunk-ALTMZEBU.js} +6 -6
- package/chunks/{chunk-FAXPWBVN.js → chunk-AN62TPO6.js} +1 -1
- package/chunks/{chunk-ZKZTUR7U.js → chunk-AYTI24XN.js} +1 -1
- package/chunks/{chunk-EEXUIATI.js → chunk-AZN2GSLM.js} +2 -2
- package/chunks/{chunk-LJ6YZBD6.js → chunk-B3J4BSPL.js} +1 -1
- package/chunks/{chunk-IJYQAXUO.js → chunk-BMCDSO77.js} +2 -2
- package/chunks/{chunk-UYCJVDPK.js → chunk-BUDUHXX3.js} +1 -1
- package/chunks/{chunk-KXKRYU57.js → chunk-CWLTXYKP.js} +3 -3
- package/chunks/{chunk-3VJVCB2E.js → chunk-DACCX4JI.js} +4 -4
- package/chunks/{chunk-WNBI4ZWD.js → chunk-DU53RB7A.js} +2 -2
- package/chunks/{chunk-YID5BOAE.js → chunk-DZCTQ2MF.js} +1 -1
- package/chunks/{chunk-DY44AVOC.js → chunk-DZUNDX4M.js} +1 -1
- package/chunks/{chunk-HJUAP436.js → chunk-ELY2U74S.js} +1 -1
- package/chunks/{chunk-75AREKQ5.js → chunk-EMOTEATH.js} +1 -1
- package/chunks/{chunk-GI3G24M2.js → chunk-ES6EQNGR.js} +6 -6
- package/chunks/{chunk-TTHRVIPY.js → chunk-EUHSEMO4.js} +3 -3
- package/chunks/{chunk-YHGIEYIF.js → chunk-F4ERRMCO.js} +3 -3
- package/chunks/{chunk-JIT2CBTI.js → chunk-FE7D3WKV.js} +1 -1
- package/chunks/{chunk-K3NURH33.js → chunk-FH45BQGZ.js} +3 -3
- package/chunks/{chunk-GSR2VAE6.js → chunk-FLBUHGL4.js} +10 -10
- package/chunks/{chunk-DV3DHBN6.js → chunk-FVIJFKEQ.js} +3 -3
- package/chunks/{chunk-SMEUKYCR.js → chunk-G6XRNTXF.js} +1 -1
- package/chunks/{chunk-YPY4FZDT.js → chunk-G72UHXC3.js} +5 -5
- package/chunks/{chunk-VFYAQLSV.js → chunk-GAHZJLQG.js} +2 -2
- package/chunks/{chunk-ONIJYCSH.js → chunk-GKJGKTWJ.js} +3 -3
- package/chunks/{chunk-DNUSU3MC.js → chunk-GRUASRWC.js} +1 -1
- package/chunks/{chunk-HQTMH3GI.js → chunk-GYLDOFLU.js} +3 -3
- package/chunks/{chunk-WFHS3WCK.js → chunk-HDSI3RDN.js} +1 -1
- package/chunks/{chunk-GT3ISCLZ.js → chunk-HHMJ5ONX.js} +4 -4
- package/chunks/{chunk-5Q7BILXI.js → chunk-HVVQYSBA.js} +1 -1
- package/chunks/{chunk-2J2ZQVLC.js → chunk-I36GIR6K.js} +1 -1
- package/chunks/{chunk-I2TYEHKM.js → chunk-IBRV4T3I.js} +2 -2
- package/chunks/{chunk-C6TGSAYO.js → chunk-IQH7Q5OP.js} +4 -4
- package/chunks/{chunk-ZG7MLW6R.js → chunk-IYKGSUTA.js} +1 -1
- package/chunks/{chunk-XQ4ALB6S.js → chunk-KACKEW2M.js} +2 -2
- package/chunks/{chunk-K7WPYXOF.js → chunk-KGLPVCX7.js} +2 -2
- package/chunks/{chunk-VFE7QIOE.js → chunk-LLIYDIGU.js} +15 -15
- package/chunks/{chunk-QXCBFLYD.js → chunk-MBC3PULP.js} +1 -1
- package/chunks/{chunk-4UGMA2PY.js → chunk-MMCGLNPP.js} +4 -4
- package/chunks/{chunk-HXNXTDZQ.js → chunk-NZC74TT2.js} +1 -1
- package/chunks/{chunk-QOBSJV7J.js → chunk-O6PPYFQN.js} +3 -3
- package/chunks/{chunk-6MYJD4ZS.js → chunk-OICDXWXP.js} +12 -12
- package/chunks/{chunk-EB3IUZV4.js → chunk-OOU7XOZF.js} +2 -2
- package/chunks/{chunk-3KDV7ZQJ.js → chunk-P4P7CH7H.js} +26 -26
- package/chunks/{chunk-UDXFQTUI.js → chunk-PWGMHXIV.js} +2 -2
- package/chunks/{chunk-DN7TVNHS.js → chunk-PZOWKCPJ.js} +1 -1
- package/chunks/{chunk-FQT6ZHKU.js → chunk-Q36IJ74U.js} +5 -5
- package/chunks/{chunk-TENLV7C6.js → chunk-QGKAYDES.js} +5 -5
- package/chunks/{chunk-GDOTFZKX.js → chunk-QNEBHC2E.js} +1 -1
- package/chunks/{chunk-22JENOQB.js → chunk-QU7VULWX.js} +4 -4
- package/chunks/{chunk-F3ADPR3A.js → chunk-R3IFSY55.js} +12 -12
- package/chunks/{chunk-BUMI6PRL.js → chunk-RBKZ6SK4.js} +1 -1
- package/chunks/{chunk-TKEDWZ44.js → chunk-RCL6OXZC.js} +3 -3
- package/chunks/{chunk-XBIOF5ZN.js → chunk-SCYKHWRM.js} +2 -2
- package/chunks/{chunk-5QEJKW7V.js → chunk-SYZPPX3O.js} +48 -48
- package/chunks/{chunk-UBL3PRRZ.js → chunk-T7TJPVTY.js} +3 -3
- package/chunks/{chunk-UO7RMX3D.js → chunk-TF7UC7F6.js} +3 -3
- package/chunks/{chunk-USEHQ5O2.js → chunk-TPFV5YZK.js} +1 -1
- package/chunks/{chunk-2FS4T477.js → chunk-U6RMVE5X.js} +8 -8
- package/chunks/{chunk-3S7UTGDX.js → chunk-VFNKO4FK.js} +3 -3
- package/chunks/{chunk-2JY2LCUU.js → chunk-VW33WARJ.js} +1 -1
- package/chunks/{chunk-IS43JHQK.js → chunk-WCLHOKAZ.js} +1 -1
- package/chunks/{chunk-W7TLK2JE.js → chunk-WVWCRZ6M.js} +2 -2
- package/chunks/{chunk-2SUKF4JL.js → chunk-X3A72KX5.js} +5 -5
- package/chunks/{chunk-BAV7Z5KE.js → chunk-XHHUGXYW.js} +4 -4
- package/chunks/{chunk-YCWU2MD3.js → chunk-YCCBLTSL.js} +3 -3
- package/chunks/{chunk-KMBELEHL.js → chunk-Z3I5B4DH.js} +1 -1
- package/chunks/{chunk-KZD6ZVFD.js → chunk-ZAJNI63I.js} +1 -1
- package/chunks/{chunk-HIX5TSC5.js → chunk-ZJFCDRVP.js} +4 -4
- package/chunks/{codex-subagent-executor-3DP5XYNE.js → codex-subagent-executor-IKWULWIZ.js} +21 -21
- package/chunks/{config-utils-GLX7SJ6O.js → config-utils-3IOTAFBG.js} +18 -18
- package/chunks/{contextCommand-DGFYOWR5.js → contextCommand-ZKG2JFCR.js} +19 -19
- package/chunks/{core-runtime-2LYDGU5V.js → core-runtime-5CAK5DSM.js} +18 -18
- package/chunks/{create-sub-session-35UOGHD7.js → create-sub-session-DG4CVOQC.js} +19 -19
- package/chunks/{daemon-git-worktree-guard-3ITNVX66.js → daemon-git-worktree-guard-S3SFT3H7.js} +18 -18
- package/chunks/{daemon-status-provider-LBY4YRSJ.js → daemon-status-provider-GG64ZJR3.js} +26 -26
- package/chunks/{daemon-trust-policy-ZNFE2I42.js → daemon-trust-policy-XNWYLQ32.js} +23 -23
- package/chunks/{daemon-trust-policy-monitor-IUMXEDZO.js → daemon-trust-policy-monitor-DR5CRWMM.js} +23 -23
- package/chunks/{deferred-core-runtime-DJBM4M2A.js → deferred-core-runtime-V4Q674KN.js} +18 -18
- package/chunks/{edit-XOPO64IC.js → edit-FPIWTN3L.js} +10 -10
- package/chunks/{enterPlanMode-T3GKYG47.js → enterPlanMode-GDZVXYB2.js} +8 -8
- package/chunks/{environment-DLKZ42JH.js → environment-Q2BVTUQO.js} +20 -20
- package/chunks/{errors-UBNSHKPT.js → errors-MZTLVUEM.js} +20 -20
- package/chunks/{execution-tool-J6W5JVU2.js → execution-tool-DZ4XSEFZ.js} +10 -10
- package/chunks/{execution-worker-NB7VOXHE.js → execution-worker-L3TM3F5D.js} +13 -13
- package/chunks/{exitPlanMode-5SU4CL6O.js → exitPlanMode-VIGOD2KP.js} +8 -8
- package/chunks/{fast-path-PMBHIP4A.js → fast-path-JCKEFUUL.js} +2 -2
- package/chunks/{glob-PFM2ZX2Q.js → glob-UOKQZHKL.js} +8 -8
- package/chunks/{goal-tools-BFXHBNL3.js → goal-tools-G4RIX4ER.js} +8 -8
- package/chunks/{handleAutoUpdate-NS4L5IPQ.js → handleAutoUpdate-UZZEGL3N.js} +20 -20
- package/chunks/{i18n-MG7AUI3C.js → i18n-IL33FVND.js} +18 -18
- package/chunks/{initializer-2EHWDIL7.js → initializer-BCXBRM6Y.js} +23 -23
- package/chunks/{installationInfo-IUK6GWUL.js → installationInfo-V7OKUOJV.js} +18 -18
- package/chunks/{list-FVYHW6UK.js → list-LQHG6SXA.js} +26 -26
- package/chunks/{llm-CIEL5EA7.js → llm-JWCANCDC.js} +51 -51
- package/chunks/{llm-content-generator-QWJIQRUP.js → llm-content-generator-OXMMHUVK.js} +3 -3
- package/chunks/{loadedSettingsAdapter-GDD23BZ4.js → loadedSettingsAdapter-EKXSRWMY.js} +23 -23
- package/chunks/{local-execution-environment-7M6SPJXO.js → local-execution-environment-XIQLRMLF.js} +13 -13
- package/chunks/{loggingContentGenerator-MGVME2MV.js → loggingContentGenerator-6KHNZDTZ.js} +9 -9
- package/chunks/{managed-npm-update-F3EMYFJE.js → managed-npm-update-MBUH5TIX.js} +18 -18
- package/chunks/{mcp-2LXAQFBW.js → mcp-AYVCEEN7.js} +23 -23
- package/chunks/{model-call-collection-JLUMVNCT.js → model-call-collection-OKUGOY4B.js} +1 -1
- package/chunks/{model-configuration-GUR32M76.js → model-configuration-Q3MNGG3B.js} +23 -23
- package/chunks/{modelConfigUtils-Y3UZ7DR5.js → modelConfigUtils-WC5XDR34.js} +19 -19
- package/chunks/{monitor-DOSUZV4I.js → monitor-7JUZXYZN.js} +8 -8
- package/chunks/{nonInteractiveCli-F7YPIV3H.js → nonInteractiveCli-B3GCZ6NJ.js} +48 -48
- package/chunks/{nonInteractiveToolExecutor-WO2RE5HY.js → nonInteractiveToolExecutor-IUHO7PXG.js} +9 -9
- package/chunks/{notebook-edit-CUHNYHP5.js → notebook-edit-IYDACZDW.js} +9 -9
- package/chunks/{omni-PYA4ZCID.js → omni-DLBHISHC.js} +7 -7
- package/chunks/{openaiContentGenerator-GS2ORQMQ.js → openaiContentGenerator-W5GN6H6Z.js} +6 -6
- package/chunks/{openaiResponsesContentGenerator-62YOYDIA.js → openaiResponsesContentGenerator-BXXRYJQQ.js} +2 -2
- package/chunks/{pidfile-DEYAILAH.js → pidfile-QIBF53CW.js} +18 -18
- package/chunks/{processUtils-E3CERUVZ.js → processUtils-2LU22KCR.js} +2 -2
- package/chunks/{prompt-terminal-ledger-YRZHHREO.js → prompt-terminal-ledger-LXFVLR6C.js} +19 -19
- package/chunks/{qwenContentGenerator-2C3J7HYV.js → qwenContentGenerator-LYMLXBWI.js} +10 -10
- package/chunks/{reactive-degrade-GDNBQBBY.js → reactive-degrade-HPYBJHYA.js} +6 -6
- package/chunks/{read-file-ITAQTQHJ.js → read-file-SXS2MKDY.js} +2 -2
- package/chunks/{resumeHistoryUtils-L2UNUBSP.js → resumeHistoryUtils-UPGZGP5V.js} +19 -19
- package/chunks/{ripGrep-EAASDYG3.js → ripGrep-X33VVIN5.js} +3 -3
- package/chunks/{run-qwen-serve-LN76E4VH.js → run-qwen-serve-CUB2NZ6P.js} +38 -38
- package/chunks/{runtime-UL6DZYHW.js → runtime-2DAVBADX.js} +24 -24
- package/chunks/{sandboxConfig-2N3BXDJA.js → sandboxConfig-ESBH3F27.js} +18 -18
- package/chunks/{scheduled-tasks-DGIGRBYW.js → scheduled-tasks-TGWYXZWW.js} +24 -24
- package/chunks/{scheduler-BCHAOQWV.js → scheduler-XGLZCXPN.js} +20 -20
- package/chunks/{serve-CZZHMYCY.js → serve-7RX4AIID.js} +23 -23
- package/chunks/{server-DV6PIMPW.js → server-MJETIFJS.js} +54 -54
- package/chunks/{session-PFPIIM3N.js → session-7AVYU3TC.js} +49 -49
- package/chunks/{session-attachments-root-ALF36B7T.js → session-attachments-root-RONFQ3D3.js} +18 -18
- package/chunks/{session-pr-refresh-E4DAPHGT.js → session-pr-refresh-ZPT6TAD4.js} +23 -23
- package/chunks/{settings-YRMNIP6J.js → settings-FPMUAVWD.js} +22 -22
- package/chunks/{shell-UMZ5J6UJ.js → shell-THD5EYOK.js} +8 -8
- package/chunks/{skill-WQBDICQA.js → skill-2D6KXDC5.js} +3 -3
- package/chunks/{skill-settings-W4OLDKUA.js → skill-settings-XW7X244B.js} +23 -23
- package/chunks/{spawnChannel-EAFCNPOA.js → spawnChannel-DBSAAUUT.js} +20 -20
- package/chunks/{standalone-update-D7JQ27GQ.js → standalone-update-TFAWA676.js} +19 -19
- package/chunks/{start-opentui-ui-43ATEBO2.js → start-opentui-ui-VYMAXPBH.js} +54 -54
- package/chunks/{startInteractiveUI-HJLPYP6N.js → startInteractiveUI-Z54XKH35.js} +57 -57
- package/chunks/{team-create-QKZREJRV.js → team-create-TPCELNBJ.js} +8 -8
- package/chunks/{team-plan-approval-BU4HTFUI.js → team-plan-approval-RUURGHQL.js} +8 -8
- package/chunks/{terminal-image-renderer-7KWVCSJU.js → terminal-image-renderer-SLJVUD4Z.js} +18 -18
- package/chunks/{theme-manager-I4S4TGZV.js → theme-manager-VBOIN2KT.js} +18 -18
- package/chunks/{tool-result-media-R2JNWHDG.js → tool-result-media-WU6QAREN.js} +7 -7
- package/chunks/{tool-search-4LU3SWMU.js → tool-search-ET4NH2LK.js} +2 -2
- package/chunks/{total-session-admission-AIC2VP5H.js → total-session-admission-UWMJWTWP.js} +21 -21
- package/chunks/{trustedFolders-WVBPJOAW.js → trustedFolders-3WNZBUH7.js} +19 -19
- package/chunks/{update-relaunch-SON2QA6T.js → update-relaunch-SHS3BD6V.js} +5 -5
- package/chunks/{updateCheck-THHMK6IX.js → updateCheck-MDF2FCRN.js} +18 -18
- package/chunks/{upload-config-VPUAXWRX.js → upload-config-LVVUIKA2.js} +4 -4
- package/chunks/{useAutoAcceptIndicator-LTUZXFZC.js → useAutoAcceptIndicator-26OOM7OM.js} +24 -24
- package/chunks/{validateNonInterActiveAuth-KUNH2FOL.js → validateNonInterActiveAuth-TBCZCQIN.js} +46 -46
- package/chunks/{version-GMDVWXUG.js → version-MICV7I4Y.js} +1 -1
- package/chunks/{web-fetch-MM4TA6NJ.js → web-fetch-3O2DFRE5.js} +2 -2
- package/chunks/{web-search-IAWACMBT.js → web-search-5FS3NB3D.js} +4 -4
- package/chunks/{workflow-5MTBNIH6.js → workflow-FRJO5ZUI.js} +9 -9
- package/chunks/{workspace-providers-status-5M3UOWCJ.js → workspace-providers-status-I5MO7Z2T.js} +28 -28
- package/chunks/{workspace-registration-store-MXY4VBW4.js → workspace-registration-store-CBHKV34L.js} +1 -1
- package/chunks/{workspace-registry-KTTGYUOC.js → workspace-registry-2UKNZO5M.js} +21 -21
- package/chunks/{workspace-runtime-coordinator-V6MBZQVT.js → workspace-runtime-coordinator-TKCI5WJW.js} +22 -22
- package/chunks/{workspace-service-UMQUHB32.js → workspace-service-M3ZKR6WL.js} +24 -24
- package/chunks/{workspace-skills-status-F7IWMYNU.js → workspace-skills-status-OC3EYL7U.js} +26 -26
- package/chunks/{workspace-trust-reconciler-MDLI73QF.js → workspace-trust-reconciler-YQZSUOH4.js} +26 -26
- package/chunks/{write-file-LHOV3BL3.js → write-file-BATJLBJX.js} +10 -10
- package/chunks/{zoom-image-VTPGT3GB.js → zoom-image-5I7DDLQE.js} +2 -2
- package/cli.js +12 -12
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-BIzY5prP.js → abnfDiagram-VCTEODGH-DQHroFS1.js} +1 -1
- package/web-shell/assets/{arc-DTPoYgqM.js → arc-BrOc_HVh.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-DMRFm81i.js → architectureDiagram-5GKGNRK7-DXce8IH6.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-TcNGiiEi.js → blockDiagram-NRAW4CY4-96A3Q3-l.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-CsSMrmkn.js → c4Diagram-UCG6FXSJ-CQBg2PSg.js} +1 -1
- package/web-shell/assets/channel-CBP6pwSs.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-DLUS2OKz.js → chunk-2Q5K7J3B-i_jhVz-t.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-Dj3neojq.js → chunk-5VM5RSS4-Cx3gMrWT.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-DKTGRC_7.js → chunk-F27PBJKO-B9WwW7C0.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-Bhhhl7xI.js → chunk-G27WJ6UU-B8t0FNPI.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-7AfyvpFL.js → chunk-JWPE2WC7-Dg0__6CF.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-C50Eay3L.js → chunk-LCL6LL3I-DUwE5g3m.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-CRBPbOWe.js → chunk-POPQ4Y6H-BirYW5iS.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-Ctr7vVt3.js → chunk-SVP7TREG-_ONJKtFF.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-B4ExJpUK.js → chunk-XXDRQBXY-DGi0chgj.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-_4_fFrN3.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-_4_fFrN3.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-Cllr81g5.js → cose-bilkent-JH36ORCC-BSSFxREn.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-dbFc7Jqn.js → cynefin-OW5HDTMX-h-oYVCez.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-CHqViWsG.js → cynefinDiagram-5FMLGOSQ-CXj6T7Pm.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-DVHuD-Ma.js → dagre-3AP2YEHR-Ch9GIhJm.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-B6P5dSD8.js → diagram-S7CK7UJ4-Cq3W541T.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-BPdvjv7b.js → diagram-UQ7AKVKN-Bm1R5-sN.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-Cf3wqtZb.js → diagram-VSXAHHWV-BW2qG6Vh.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-iT7vh4BN.js → diagram-VX7I27RA-DN96PhRe.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-CBq-pKMo.js → diagram-Z3DM3KII-A8MnwaJr.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-CWo8D0_l.js → ebnfDiagram-PWID7BFC-CZTpUypI.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-BdcX9VXM.js → erDiagram-SSCWMZ5O-CbxCRFru.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-D2uR47D0.js → flowDiagram-A5DVABFB-Bt1PM2Dy.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-Du1Q-imH.js → ganttDiagram-EL5Y4UJY-CTgim3LX.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-ZytI2J6R.js → gitGraphDiagram-WWUBYQGX-h4jX7S4l.js} +1 -1
- package/web-shell/assets/{index-B5zIMd3G.js → index-BDxWHGNm.js} +1 -1
- package/web-shell/assets/{index-t2okSTsk.js → index-Bd3iA5Er.js} +3 -3
- package/web-shell/assets/{infoDiagram-RXCK75RN-DeZwQFlp.js → infoDiagram-RXCK75RN-DsIsFmZ4.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-pDgu1jeK.js → ishikawaDiagram-5VMMS53U-BgF2V3rC.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-ZCvpl8hA.js → journeyDiagram-EYS64GPL-CJ2ibWhB.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-C9qY0GRv.js → kanban-definition-3QL26DDD-oqNfpjND.js} +1 -1
- package/web-shell/assets/{layout-BixptjLn.js → layout-DKF2f-UC.js} +1 -1
- package/web-shell/assets/{linear-DjkqGiAW.js → linear-CadmYA8J.js} +1 -1
- package/web-shell/assets/{mermaid.core-BSX0Vr31.js → mermaid.core-BSD13L-h.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-CBrjZekm.js → mindmap-definition-FBJOCRG2-Cg3jlHzV.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-DQIDACM3.js → pegDiagram-XKGWAZYB-BGzqlBWk.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-CjeBecJ1.js → pieDiagram-E7YTZNPT-BVDdPYnC.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-s_fyH42A.js → quadrantDiagram-AXDQQJYC-D7maRW6r.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-CruAGcMa.js → railroadDiagram-O6MQD6OU-C7J0Nnqc.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-CTBv3FSX.js → requirementDiagram-EFPCY7ZU-CDEpUB7S.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CjFlz0KT.js → sankeyDiagram-P5KCCOFB-DoA0BWeR.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DRNDmQQw.js → sequenceDiagram-WJ2MYXX4-DlqRjDLl.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BvBdgQsw.js → sizeCapture-X5ZJPWSS-3l2EJ1DB.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-D1dJtfN0.js → stateDiagram-HBIQ2CUA-Bdq0N6Lr.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DtdYpKZp.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-QylCxvYC.js → swimlanes-XN3QIQJK-B4ArxdLV.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-B_iL0Dc4.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-Cw56FtZw.js → timeline-definition-24CTP7MA-B_Ug6D_k.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-DyA0dekR.js → vennDiagram-4TSXK5OY-BR9tvaDT.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CoAgxg4O.js → wardleyDiagram-VM6X3IG4-BdGIt6qE.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-kH3Md0xm.js → xychartDiagram-S5SC5T6Z-NxS8XkXN.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-CX6nRLY5.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DvX73GRE.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DvX73GRE.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DXVOtEux.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BqCkfjdF.js +0 -8
|
@@ -1181,7 +1181,7 @@ ${n}`:n}function Yle(e){const t=e.data.indexOf(","),n=e.data.startsWith("data:")
|
|
|
1181
1181
|
</head><body><iframe title="${c3(t)}" src="${c3(e.href)}" sandbox="allow-scripts allow-same-origin allow-forms" referrerpolicy="no-referrer"></iframe></body></html>`}function hee(e,t){const n=wO(t);if(fee.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 Cdt=new Set([".doc",".docx",".docm",".dotx",".xls",".xlsx",".xlsm",".xlsb",".ppt",".pptx",".pptm",".odt",".ods",".odp"]),fee=new Set([".m4a",".mp3",".ogg",".wav"]),Tdt=new Set([...Cdt,...fee,".pdf",".mp4",".mov",".webm"]);function AEe(e){const t=wO(e.workspacePath),n=uy(e.mimeType);return t===".svg"||n==="image/svg+xml"||Tdt.has(t)?!0:NEe(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 wO(e){const n=(e??"").split(/[?#]/,1)[0].split(/[/\\]/).pop()??"",s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function Idt(e,t){return fee.has(wO(e))||uy(t).startsWith("audio/")}const Edt="qwen.workspace.sha256";function Que(e){const t=e.metadata?.[Edt],n=typeof t=="string"?t:"";return`${e.status}:${e.updatedAt}:${n}`}function Rdt(e){const t=e.metadata?.artifactType;return typeof t=="string"&&t?t:hee(e.kind,e.workspacePath??e.url??e.title)}function yO(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const jEe={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"},Adt=100*1024*1024,jdt=256*1024;function uy(e){return e?.split(";",1)[0]?.trim().toLowerCase()??""}function NEe(e){const t=uy(e.mimeType);return t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(jEe).includes(t)?t:void 0:U1(e.workspacePath??"")}function U1(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?jEe[n]:void 0}function Ndt(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function _I(e,t,n,s){const r=[],o=s.maxBytes??Adt,i=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(i.type==="directory")throw new Error("Directories cannot be opened or downloaded as artifacts.");if(i.sizeBytes>o)throw new Error("File is too large to preview or download.");let l=0;for(;;){if(s.isCancelled?.())throw new Error("File loading was cancelled.");const c=await e(t,{offset:l,maxBytes:jdt});if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(c.sizeBytes!==i.sizeBytes)throw new Error("File changed while loading. Please retry.");if(c.returnedBytes<=0&&l<i.sizeBytes)throw new Error("File loading made no progress.");const u=atob(c.contentBase64),h=new Uint8Array(u.length);for(let f=0;f<u.length;f++)h[f]=u.charCodeAt(f);if(r.push(h),l=c.offset+c.returnedBytes,l>=i.sizeBytes){const f=await s.statFile(t);if(s.isCancelled?.())throw new Error("File loading was cancelled.");if(f.sizeBytes!==i.sizeBytes||f.modifiedMs!==i.modifiedMs)throw new Error("File changed while loading. Please retry.");return new Blob(r,{type:n})}}}async function bO(e,t,n="application/octet-stream",s){const r=await _I((i,l)=>e.readFileBytes(i,l),t,n,{statFile:i=>e.stat(i),isCancelled:s}),o=URL.createObjectURL(r);try{const i=document.createElement("a");i.href=o,i.download=dy(t).split("/").at(-1)??t,i.addEventListener("click",l=>l.stopPropagation()),document.body.appendChild(i),i.click(),i.remove()}finally{setTimeout(()=>URL.revokeObjectURL(o),1e3)}}function MEe(e){return e.workspacePath??e.url??e.managedId??""}function dy(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),s=[];for(const o of t.split("/"))if(!(!o||o===".")){if(o===".."){s.length>0&&s.at(-1)!==".."?s.pop():n||s.push(o);continue}s.push(o)}const r=s.join("/");return n?`/${r}`:r}function y5(e,t){const n=dy(e),s=dy(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 pee(e,t,n){const s=y5(e??"",n),r=y5(t??"",n);return!!s&&s===r}const MG="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 PEe(e,t){return PG(LG(e),t)}function PG(e,t){return`<!doctype html><html><head>
|
|
1182
1182
|
<meta http-equiv="Content-Security-Policy" content="${MG} frame-src 'none';">
|
|
1183
1183
|
<style>html,body,iframe{width:100%;height:100%;margin:0;border:0;display:block;overflow:hidden}</style>
|
|
1184
|
-
</head><body><iframe title="${c3(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${c3(e)}"></iframe></body></html>`}let FN;async function Mdt(e,t,n){if(FN?.content===e&&FN.title===t)return FN.document;const s=await Pdt(e,t,n);return FN={content:e,title:t,document:s},s}async function Pdt(e,t,n){if(typeof DOMParser>"u")return PEe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return PG(LG(s),t);const r=new AbortController,o=()=>r.abort();n.addEventListener("abort",o,{once:!0}),n.aborted&&r.abort();try{await Promise.all([["script#transcript-renderer","src","js","text/javascript"],['link#transcript-stylesheet[rel="stylesheet"]',"href","css","text/css"]].map(async([i,l,c,u])=>{const h=s.querySelector(i),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@qwen-code/qwen-code@0.24.5-nightly.20260924.ffea2d024e/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",o),r.abort()}return PG(LG(s),t)}function LG(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${MG}"></head><body>${Ldt(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=MG,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function Ldt(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 LEe={csv:pdt,file:mdt,html:gdt,image:vdt,link:wdt,md:ydt,pdf:bdt,spreadsheet:xdt,video:kdt,word:_dt},Ddt={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Odt={audio:iee,document:kI,notebook:kct},Jue={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 DEe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=wO(t).slice(1);if(n&&Jue[n])return Jue[n];const s=uy(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":Ddt[e.kind]??"file"}function OEe({artifact:e,className:t}){const{artifact:n}=md(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=DEe(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?Idt(o,e.mimeType)?"audio":e.kind:void 0,l=i?Odt[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:LEe[r],"data-artifact-icon":r,alt:""})}const $dt=[[new Set(["json","jsonl","geojson"]),Vit],[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"]),Z9],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),Hat],[new Set(["csv","tsv","xls","xlsx","ods"]),Xat],[new Set(["ppt","pptx","odp"]),qct],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),sEe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),iee],[new Set(["mp4","mov","webm","avi","mkv"]),rEe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),kI]];function Bdt(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of $dt)if(s.has(n))return r;return t?.startsWith("image/")?sEe:t?.startsWith("audio/")?iee:t?.startsWith("video/")?rEe:t?.startsWith("text/")?kI:oEe}function $g({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=Bdt(e,t),i=DEe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===oEe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:LEe[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const Fdt="_panel_19vsn_1",zdt="_floating_19vsn_16",qdt="_section_19vsn_26",Hdt="_sectionHeader_19vsn_40",Udt="_sectionHeaderRow_19vsn_59",Wdt="_sectionAction_19vsn_70",Vdt="_sectionContent_19vsn_111",Gdt="_row_19vsn_115",Kdt="_workspaceIcon_19vsn_158",Ydt="_rowActionIcon_19vsn_162",Xdt="_label_19vsn_168",Zdt="_branchName_19vsn_173",Qdt="_value_19vsn_181",Jdt="_tasks_19vsn_191",eht="_task_19vsn_191",tht="_taskIcon_19vsn_229",nht="_taskLabel_19vsn_240",sht="_agentName_19vsn_248",rht="_taskName_19vsn_249",oht="_agentColor_19vsn_260",iht="_agentTag_19vsn_269",aht="_taskStatus_19vsn_280",lht="_statusRunning_19vsn_301",cht="_attachmentFiles_19vsn_311",uht="_attachmentFile_19vsn_311",dht="_attachmentFileIcon_19vsn_344",hht="_attachmentFileName_19vsn_348",fht="_emptyDescription_19vsn_356",pht="_sourceTitle_19vsn_363",cr={panel:Fdt,floating:zdt,section:qdt,sectionHeader:Hdt,sectionHeaderRow:Udt,sectionAction:Wdt,sectionContent:Vdt,row:Gdt,workspaceIcon:Kdt,rowActionIcon:Ydt,label:Xdt,branchName:Zdt,value:Qdt,tasks:Jdt,task:eht,taskIcon:tht,taskLabel:nht,agentName:sht,taskName:rht,agentColor:oht,agentTag:iht,taskStatus:aht,statusRunning:lht,attachmentFiles:cht,attachmentFile:uht,attachmentFileIcon:dht,attachmentFileName:hht,emptyDescription:fht,sourceTitle:pht};function $Ee({entries:e,onOpen:t}){const{t:n}=mt();return a.jsx("ul",{className:cr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:cr.attachmentFile,title:Xue(s),"aria-label":s.type==="source"?`${n("sources.open")} ${Yue(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(lEe,{size:16,strokeWidth:1.7,className:cr.attachmentFileIcon}):a.jsx($g,{name:Xue(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:cr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:cr.attachmentFileName,children:Yue(s)})]})},n7(s)))})}function Q0({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Xn("animate-pulse rounded-md bg-muted",e),...t})}function mht(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function ght({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:o,onOpen:i,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p}){const{t:m}=mt(),[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=EEe(b,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const k=s||t?.supported&&t.loading;return a.jsxs("section",{className:cr.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:cr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${cr.sectionHeader} ${cr.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&mht()&&a.jsx("button",{type:"button",className:cr.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(Bd,{})})]}),l&&a.jsxs("div",{className:cr.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(vt,{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(vt,{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(vt,{size:"sm",variant:"link",onClick:o,children:m("common.retry")})]}),a.jsx($Ee,{entries:g?x:x.slice(0,3),onOpen:C=>BEe(C,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),k&&!x.length&&a.jsx("ul",{className:cr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(C=>a.jsxs("li",{className:cr.attachmentFile,children:[a.jsx(Q0,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(Q0,{className:"h-4",style:{width:`${C}%`}})]},C))}),!k&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:cr.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:cr.attachmentFile,"aria-expanded":g,onClick:()=>v(C=>!C),children:m(g?"common.collapse":"sources.viewAll")}),y&&t?.supported&&a.jsx(vht,{state:t,onClose:()=>w(!1)})]})}function vht({state:e,onClose:t}){const{t:n}=mt(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,p]=d.useState(),[m,g]=d.useState(!1),v=async()=>{g(!0),p(void 0);try{const y=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,w=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||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(ca,{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),i(""),p(void 0)},children:[a.jsx("option",{value:"workspace_file",children:n("sources.workspaceFile")}),a.jsx("option",{value:"url",children:n("sources.link")})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.location"),a.jsx(Ar,{value:o,onChange:y=>i(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(Ar,{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(Ar,{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(vt,{type:"submit",disabled:m||!o,children:n("sources.add")})]})})}function BEe(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})}/**
|
|
1184
|
+
</head><body><iframe title="${c3(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${c3(e)}"></iframe></body></html>`}let FN;async function Mdt(e,t,n){if(FN?.content===e&&FN.title===t)return FN.document;const s=await Pdt(e,t,n);return FN={content:e,title:t,document:s},s}async function Pdt(e,t,n){if(typeof DOMParser>"u")return PEe(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return PG(LG(s),t);const r=new AbortController,o=()=>r.abort();n.addEventListener("abort",o,{once:!0}),n.aborted&&r.abort();try{await Promise.all([["script#transcript-renderer","src","js","text/javascript"],['link#transcript-stylesheet[rel="stylesheet"]',"href","css","text/css"]].map(async([i,l,c,u])=>{const h=s.querySelector(i),f=h?.getAttribute(l)??"",p=h?.getAttribute("integrity")??"";if(!h)return;const m=`https://unpkg.com/@qwen-code/qwen-code@0.24.5/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",o),r.abort()}return PG(LG(s),t)}function LG(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${MG}"></head><body>${Ldt(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=MG,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function Ldt(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 LEe={csv:pdt,file:mdt,html:gdt,image:vdt,link:wdt,md:ydt,pdf:bdt,spreadsheet:xdt,video:kdt,word:_dt},Ddt={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},Odt={audio:iee,document:kI,notebook:kct},Jue={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 DEe(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=wO(t).slice(1);if(n&&Jue[n])return Jue[n];const s=uy(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":Ddt[e.kind]??"file"}function OEe({artifact:e,className:t}){const{artifact:n}=md(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=DEe(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?Idt(o,e.mimeType)?"audio":e.kind:void 0,l=i?Odt[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:LEe[r],"data-artifact-icon":r,alt:""})}const $dt=[[new Set(["json","jsonl","geojson"]),Vit],[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"]),Z9],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),Hat],[new Set(["csv","tsv","xls","xlsx","ods"]),Xat],[new Set(["ppt","pptx","odp"]),qct],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),sEe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),iee],[new Set(["mp4","mov","webm","avi","mkv"]),rEe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),kI]];function Bdt(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of $dt)if(s.has(n))return r;return t?.startsWith("image/")?sEe:t?.startsWith("audio/")?iee:t?.startsWith("video/")?rEe:t?.startsWith("text/")?kI:oEe}function $g({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=Bdt(e,t),i=DEe({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===oEe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:LEe[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const Fdt="_panel_19vsn_1",zdt="_floating_19vsn_16",qdt="_section_19vsn_26",Hdt="_sectionHeader_19vsn_40",Udt="_sectionHeaderRow_19vsn_59",Wdt="_sectionAction_19vsn_70",Vdt="_sectionContent_19vsn_111",Gdt="_row_19vsn_115",Kdt="_workspaceIcon_19vsn_158",Ydt="_rowActionIcon_19vsn_162",Xdt="_label_19vsn_168",Zdt="_branchName_19vsn_173",Qdt="_value_19vsn_181",Jdt="_tasks_19vsn_191",eht="_task_19vsn_191",tht="_taskIcon_19vsn_229",nht="_taskLabel_19vsn_240",sht="_agentName_19vsn_248",rht="_taskName_19vsn_249",oht="_agentColor_19vsn_260",iht="_agentTag_19vsn_269",aht="_taskStatus_19vsn_280",lht="_statusRunning_19vsn_301",cht="_attachmentFiles_19vsn_311",uht="_attachmentFile_19vsn_311",dht="_attachmentFileIcon_19vsn_344",hht="_attachmentFileName_19vsn_348",fht="_emptyDescription_19vsn_356",pht="_sourceTitle_19vsn_363",cr={panel:Fdt,floating:zdt,section:qdt,sectionHeader:Hdt,sectionHeaderRow:Udt,sectionAction:Wdt,sectionContent:Vdt,row:Gdt,workspaceIcon:Kdt,rowActionIcon:Ydt,label:Xdt,branchName:Zdt,value:Qdt,tasks:Jdt,task:eht,taskIcon:tht,taskLabel:nht,agentName:sht,taskName:rht,agentColor:oht,agentTag:iht,taskStatus:aht,statusRunning:lht,attachmentFiles:cht,attachmentFile:uht,attachmentFileIcon:dht,attachmentFileName:hht,emptyDescription:fht,sourceTitle:pht};function $Ee({entries:e,onOpen:t}){const{t:n}=mt();return a.jsx("ul",{className:cr.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:cr.attachmentFile,title:Xue(s),"aria-label":s.type==="source"?`${n("sources.open")} ${Yue(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(lEe,{size:16,strokeWidth:1.7,className:cr.attachmentFileIcon}):a.jsx($g,{name:Xue(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:cr.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:cr.attachmentFileName,children:Yue(s)})]})},n7(s)))})}function Q0({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:Xn("animate-pulse rounded-md bg-muted",e),...t})}function mht(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function ght({hidden:e=!1,state:t,attachments:n=[],attachmentsLoading:s=!1,attachmentsError:r,onRetryAttachments:o,onOpen:i,retryRegistration:l,onDialogOpenChange:c,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p}){const{t:m}=mt(),[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=EEe(b,n);if(!t?.supported&&!x.length&&!s&&!r)return null;const k=s||t?.supported&&t.loading;return a.jsxs("section",{className:cr.section,"aria-label":m("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:cr.sectionHeaderRow,children:[a.jsxs("h3",{className:`${cr.sectionHeader} ${cr.sourceTitle}`,children:[m("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:x.length})]}),t?.supported&&mht()&&a.jsx("button",{type:"button",className:cr.sectionAction,"aria-label":m("sources.add"),onClick:()=>w(!0),children:a.jsx(Bd,{})})]}),l&&a.jsxs("div",{className:cr.emptyDescription,role:"alert",children:[m("sources.registrationFailed")," ",a.jsx(vt,{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(vt,{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(vt,{size:"sm",variant:"link",onClick:o,children:m("common.retry")})]}),a.jsx($Ee,{entries:g?x:x.slice(0,3),onOpen:C=>BEe(C,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:p})}),k&&!x.length&&a.jsx("ul",{className:cr.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":m("common.loading"),children:[72,88,64].map(C=>a.jsxs("li",{className:cr.attachmentFile,children:[a.jsx(Q0,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(Q0,{className:"h-4",style:{width:`${C}%`}})]},C))}),!k&&!x.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:cr.emptyDescription,children:m("sources.empty")}),x.length>3&&a.jsx("button",{type:"button",className:cr.attachmentFile,"aria-expanded":g,onClick:()=>v(C=>!C),children:m(g?"common.collapse":"sources.viewAll")}),y&&t?.supported&&a.jsx(vht,{state:t,onClose:()=>w(!1)})]})}function vht({state:e,onClose:t}){const{t:n}=mt(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,p]=d.useState(),[m,g]=d.useState(!1),v=async()=>{g(!0),p(void 0);try{const y=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,w=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||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(ca,{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),i(""),p(void 0)},children:[a.jsx("option",{value:"workspace_file",children:n("sources.workspaceFile")}),a.jsx("option",{value:"url",children:n("sources.link")})]})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.location"),a.jsx(Ar,{value:o,onChange:y=>i(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(Ar,{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(Ar,{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(vt,{type:"submit",disabled:m||!o,children:n("sources.add")})]})})}function BEe(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})}/**
|
|
1185
1185
|
* @license
|
|
1186
1186
|
* Copyright 2026 Qwen Team
|
|
1187
1187
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -1701,7 +1701,7 @@ License: MIT
|
|
|
1701
1701
|
})();`,ITt=`<!doctype html>
|
|
1702
1702
|
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${STt}"></head>
|
|
1703
1703
|
<body><script>${TTt}<\/script></body></html>`;function ETt(){const e=globalThis.crypto;if(!e?.getRandomValues)throw new As("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 Mfe(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function RTt(e){if(e.signal.aborted)return Promise.reject(Mfe());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new As("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new As("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=ETt(),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=ITt,new Promise((s,r)=>{let o=!1,i=!1,l;const c=()=>{window.removeEventListener("message",p),e.signal.removeEventListener("abort",f),n.onload=null,n.onerror=null,l!==void 0&&clearTimeout(l),n.remove()},u=(m,g)=>{o||(o=!0,c(),m(g))},h=m=>{o||(o=!0,c(),r(m))},f=()=>h(Mfe()),p=m=>{if(!(m.source!==n.contentWindow||!Zi(m.data))&&!(m.data.channel!==PK||m.data.requestId!==t)){if(m.data.type==="error"){h(new As("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(m.data.type==="result")try{const g=FRe(m.data.option);if(!Zi(g))throw new As("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 As("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart sandbox failed to load")),n.onload=()=>{if(!i){if(i=!0,n.onload=null,o||e.signal.aborted){f();return}n.contentWindow?.postMessage({channel:PK,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>h(new As("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var CAe=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);nt(this,"code");nt(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s?.cause}},ATt=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function jTt(e,t){const n={...ATt,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new As("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function TAe(e){let t;try{t=await e.resolveContent()}catch(o){throw e.signal.aborted||e.preserveLegacySandboxError&&o instanceof CAe?o:new As("REF_RESOLUTION_FAILED",e.resolutionError,{cause:o})}if(typeof t!="string")throw new As("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=bTt(t,e.limits),s=_Tt(e.source);if(!s)throw new As("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await RTt({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:r}}async function NTt(e){return TAe({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 MTt(e){return TAe({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 PTt=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),LTt=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"]),DTt=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),OTt=/(?:url|uri|href|src|link)$/i,$Tt=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Pfe=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,BTt=/\burl\s*\(/i,FTt=/<\s*\/?\s*[a-z][^>]*>/i,zTt=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,qTt=/^[A-Za-z_][A-Za-z0-9_]*$/;function xa(e){throw new As("SCHEMA_INVALID",e)}function LK(e,t,n){for(const s of Object.keys(e))t.has(s)||xa(`${n}.${s} is not allowed`)}function Lfe(e,t){if(!Array.isArray(e)||e.length===0)return xa(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!qTt.test(s)?xa(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?xa(`${t} must not contain duplicate dimensions`):n}function HTt(e,t){if(!Zi(e)||typeof e.kind!="string")return xa("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){LK(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=Lfe(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return xa("echarts-fulldata.data.source must be an array");e.source.forEach((r,o)=>{Array.isArray(r)||xa(`echarts-fulldata.data.source[${o}] must be an array`),r.length!==n.length&&xa(`echarts-fulldata.data.source[${o}] must contain ${n.length} cells`)});const s=VO(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(LK(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return xa("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return xa("echarts-fulldata.data.format must be csv or json");const n=Lfe(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return xa(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function IAe(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!Zi(r)||typeof r.text!="string")continue;const o=r.text.trim();if(o)return{index:s,isArray:t,title:r,text:o}}}function UTt(e){return IAe(e)?.text}function WTt(e,t){const n=IAe(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 py(e){return Array.isArray(e)?e.map(t=>py(t)):Zi(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,py(n)])):e}function EAe(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&xa(`${t} must be an array of non-empty strings`),[...e]}function VO(e,t,n){if(Array.isArray(e)||xa(`${n} must be an array`),e.length>t.maxRows)throw new As("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxRows} row limit`);let s=0;const r=e.map((o,i)=>{if(Array.isArray(o)){const l=o.map((c,u)=>(c!==null&&!["string","number","boolean"].includes(typeof c)&&xa(`${n}[${i}][${u}] must be a JSON scalar`),c));return s+=l.length,l}if(Zi(o)){const l={};for(const[c,u]of Object.entries(o))u!==null&&!["string","number","boolean"].includes(typeof u)&&xa(`${n}[${i}].${c} must be a JSON scalar`),l[c]=u,s+=1;return l}return xa(`${n}[${i}] must be an array or object`)});if(s>t.maxCells)throw new As("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function VTt(e,t){if(!Zi(e)||typeof e.kind!="string")return xa("echarts.data must be an inline or ref dataset object");const n=EAe(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const s=VO(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?xa("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?xa("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:xa(`Unsupported echarts.data.kind: ${e.kind}`)}function Dfe(e,t){if($Tt.test(e))throw new As("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(Pfe.test(s)||Pfe.test(n.trim())||BTt.test(e)||FTt.test(e)||zTt.test(e))throw new As("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function GTt(e,t){for(const r of Object.keys(e))if(!LTt.has(r))throw new As("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,o,i)=>{if(n+=1,n>t.maxNodes)throw new As("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(i>t.maxDepth)throw new As("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){Dfe(r,o);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${o}[${c}]`,i+1));return}if(Zi(r))for(const[l,c]of Object.entries(r)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new As("UNSAFE_SPEC",`${o}.${l} must be a string`);Dfe(c,`${o}.${l}`);continue}if(DTt.has(u)||OTt.test(l))throw new As("UNSAFE_SPEC",`${o}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new As("UNSAFE_SPEC","Custom ECharts series are not allowed");s(c,`${o}.${l}`,i+1)}};if(s(e,"echarts.option",0),Array.isArray(e.series)&&e.series.length>t.maxSeries)throw new As("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxSeries} series limit`);e.dataset!==void 0&&(Array.isArray(e.dataset)?e.dataset:[e.dataset]).forEach((o,i)=>{Zi(o)||xa(`echarts.option.dataset[${i}] must be an object`),o.source!==void 0&&VO(o.source,t,`echarts.option.dataset[${i}].source`)})}function DK(e,t,n){if(!Zi(e))return xa("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return xa("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=py(e),r=t===void 0?void 0:VTt(t,n);return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?xa("echarts.option.dataset cannot be combined with echarts.data"):(GTt(s,n),{option:s,data:r})}function KTt(e,t){if(!Zi(e))return xa("echarts-fulldata must contain an object");if(LK(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new As("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return xa("echarts-fulldata.data is required");if(!Zi(e.option))return xa("echarts-fulldata.option must be an object");const n=HTt(e.data,t);return DK(e.option,n,t)}function YTt(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new As("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function Ofe(e,t){const n=VO(e.source,t,"resolvedDataset.source"),s=e.dimensions?EAe(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 XTt={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 Pg(e,t){const n={...py(e),...t};for(const[s,r]of Object.entries(e)){const o=t[s];Zi(r)&&Zi(o)&&(n[s]=Pg(r,o))}return n}function _R(e,t){return Array.isArray(e)?e.map(n=>Zi(n)?Pg(t,n):n):Zi(e)?Pg(t,e):e??py(t)}function RAe(e){const t=n=>Zi(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function N5(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ZTt(e,t){const n=s=>{if(!N5(s,"top")&&!N5(s,"bottom"))return Pg(t,s);const r=py(t);return delete r.top,delete r.bottom,Pg(r,s)};return Array.isArray(e)?e.map(s=>Zi(s)?n(s):s):Zi(e)?n(e):e??py(t)}var QTt=740,AAe=10,$fe=QTt*AAe/100,JTt=24,eIt=24,Bfe=16,tIt=24;function jAe(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=$fe?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<=AAe?$fe:null}function nIt(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function sIt(e){return e.show===!1||!nIt(e)?null:N5(e,"top")?jAe(e.top):N5(e,"bottom")?null:0}function rIt(e){return e.show===!1||!N5(e,"top")?null:jAe(e.top)}function Ffe(e){return Array.isArray(e)?e.filter(Zi):Zi(e)?[e]:[]}function oIt(e,t){const n=Ffe(e).flatMap(r=>{const o=sIt(r);return o===null?[]:[o+JTt+Bfe]}),s=Ffe(t).flatMap(r=>{const o=rIt(r);return o===null?[]:[o+eIt+Bfe]});return Math.max(tIt,...n,...s)}function zfe(e,t){return Array.isArray(e)?e.map((n,s)=>Zi(n)?Pg(t(s),n):n):Zi(e)?Pg(t(0),e):e}function qfe(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=Pg(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=Pg(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=Pg(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=Pg(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=RAe(_R(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var NAe=new Set(["pie","funnel","gauge","radar","treemap"]),iIt=new Set([...NAe,"graph","chord","themeRiver"]);function MAe(e){return Array.isArray(e.series)?e.series.filter(Zi):Zi(e.series)?[e.series]:[]}function aIt(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=MAe(e);return t.some(n=>typeof n.type=="string"&&iIt.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function lIt(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=MAe(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&NAe.has(n.type))?"item":"axis"}function cIt(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function uIt(e,t="light"){const n=XTt[t],s=py(e);return s.backgroundColor??=n.background,s.color??=[...n.palette],s.textStyle=_R(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=_R(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=RAe(_R(s.tooltip,{trigger:lIt(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}}})),aIt(e)&&(s.legend=ZTt(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=_R(s.grid,{top:oIt(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=zfe(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=zfe(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=>Zi(r)?qfe(r,n):r):Zi(s.series)&&(s.series=qfe(s.series,n)),s}var tH={dispose(){}};function dIt(e={}){const t={...PTt,...e.limits},n=e.legacySandbox?.resolveLegacyArtifactContent,s=e.legacySandbox?.resolveLegacySandboxFileContent,r=e.legacySandbox?jTt({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,o=e.loadECharts??(async()=>await Ze(()=>import("./index-DohPy72Z.js"),[])),i=async(l,c)=>{if(e.validateDataRef&&!e.validateDataRef(l.ref))throw new As("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new As("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 As("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 Ofe(h,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:gTt,parse(l,c){return c.language==="echarts-fulldata"?KTt(l,t):DK(l,c.data,t)},parseSource(l,c){return SAe(c.language)?{option:{},data:void 0,legacyEChartSandboxFile:wTt(c.rawLanguage??c.language,l)}:{option:{},data:void 0,legacyEChartQuery:vTt(c.language,l)}},getTitle(l){return UTt(l.option)},async materialize(l,c){if(!l.legacyEChartQuery&&!l.legacyEChartSandboxFile){if(l.data?.kind==="ref"){const p=await i(l.data,c.signal);return p?{parsed:{...l,data:p},data:p}:{parsed:l,data:c.data}}return{parsed:l,data:l.data}}if(l.legacyEChartQuery&&!n)throw new As("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(l.legacyEChartSandboxFile&&!s)throw new As("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let u;try{l.legacyEChartSandboxFile?u=await MTt({block:l.legacyEChartSandboxFile,signal:c.signal,resolveSandboxFileContent:s,limits:r,preserveLegacySandboxError:e.legacySandbox!==void 0}):u=await NTt({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 As||p instanceof CAe?p:new As("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=FRe(u,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(p){throw p instanceof As?p:new As("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:p})}if(!Zi(h))return xa("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(h,"data")||!Object.prototype.hasOwnProperty.call(h,"spec"))return xa("Temporary ChatBI resolver must return data and spec");const f=DK(h.spec,h.data,t);return f.data?.kind!=="inline"?xa("Temporary ChatBI resolver must return inline data"):{parsed:f,data:f.data}},async mount(l,c,u){if(c.legacyEChartQuery||c.legacyEChartSandboxFile)return xa("Temporary ChatBI charts must be materialized before mounting");const h=py(c.option);if(u.externalizedTitle&&WTt(h,u.externalizedTitle),c.data){let y;if(c.data.kind==="inline")y=c.data;else{const b=await i(c.data,u.signal);if(!b)return tH;y=b}const w=Ofe(y,t);h.dataset=w.option}if(u.signal.aborted)return tH;let f;try{f=YTt(await o())}catch(y){throw y instanceof As?y:new As("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:y})}if(u.signal.aborted)return tH;let p,m;try{const y=typeof u.theme=="string"||Zi(u.theme)?u.theme:void 0;p=f.init(l,y);const w=cIt(u.theme),b=e.defaultStyle===!1||!w?h:uIt(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 As("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 bte=d.createContext(null);function hIt(e){if(d.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function fIt(e){const t=e.source??hIt(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(bte.Provider,{value:n},e.children)}function pIt(e){const t=d.useContext(bte);if(!t)throw new Error("MarkdownChartBlock must be rendered inside MarkdownChartProvider");const n=d.useRef(null),s=e.streaming??t.streaming,r=e.loadingLabel??t.loadingLabel,o=e.labels??t.labels,i=d.useMemo(()=>qRe(o),[o]);d.useEffect(()=>{const c=n.current;if(!c)return;const u=new Ivt(t.registry);let h=!1;return u.render(c,{language:e.language,source:e.source,theme:t.theme,streaming:s,...r!==void 0?{loadingLabel:r}:{},...o!==void 0?{labels:o}:{}}).catch(f=>{h||(c.classList.add("markdown-chart-error"),c.setAttribute("role","alert"),c.textContent=i.chartUnavailable,t.onError?.(f,{language:e.language,source:e.source}))}),()=>{h=!0,u.dispose()}},[t.registry,t.theme,t.onError,r,o,i,e.language,e.source,s]);const l=["markdown-chart-placeholder",s?"markdown-chart-streaming":void 0,e.className].filter(Boolean).join(" ");return d.createElement("div",{ref:n,className:l,style:e.style,"aria-label":i.chart,"aria-busy":s||void 0,"data-markdown-chart-complete":String(!s)})}function mIt(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(`
|
|
1704
|
-
`,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return URe(e.slice(i,s))||e.slice(s).trim().length>0}function PAe(e,t){return e===o7||t?.has(e)===!0}function gIt(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(bte);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&PAe(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(pIt,{language:u,source:f,streaming:i?.streaming===!0&&!mIt(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const vIt=3e4,wIt=["artifact://","session-file://"],yIt=/^[a-z]:/i;function bIt(e={}){const{resolveDataRef:t,validateDataRef:n=CIt,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?LAe(i):i;if(!c)throw new Error("Chart data reference is not supported.");return TIt(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new dvt().register(dIt({...s,resolveDataRef:o,validateDataRef:n}))}const xIt={registry:bIt()};function kIt(e,t={}){const n=gIt(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...o}){if(d.isValidElement(r)){const i=r,c=/(?:^|\s)language-([^\s]+)/.exec(i.props.className??"")?.[1]?.toLowerCase();if(c&&PAe(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function _It({customization:e,source:t,streaming:n,theme:s,children:r}){const o=SIt(e.labels),{t:i}=mt();return a.jsx(fIt,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function SIt(e){const{t}=mt();return d.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o,omittedRows:s-n,omittedColumns:o-r}),...e}),[e,t])}function Hfe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function LAe(e){if(e.trim()!==e||!e||Hfe(e))return;const t=e.toLowerCase(),n=wIt.find(i=>t.startsWith(i));if(!n)return;const s=e.slice(n.length);if(!s||/[?#\\]/.test(s))return;let r;try{r=decodeURIComponent(s)}catch{return}if(/[%?#\\]/.test(r)||Hfe(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||yIt.test(i)))return`${n}${o.join("/")}`}function CIt(e){return LAe(e)!==void 0}function TIt(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),vIt);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const IIt="_content_1ns4y_1",EIt="_streamingPlainText_1ns4y_11",RIt="_inlineCode_1ns4y_135",AIt="_link_1ns4y_147",jIt="_tableWrapper_1ns4y_157",NIt="_table_1ns4y_157",MIt="_image_1ns4y_187",PIt="_codeBlock_1ns4y_195",LIt="_codeBlockHeader_1ns4y_204",DIt="_codeBlockLang_1ns4y_213",OIt="_codeBlockCopy_1ns4y_221",$It="_codeBlockContent_1ns4y_244",BIt="_codeBlockPlain_1ns4y_264",FIt="_mermaidBlock_1ns4y_282",zIt="_mermaidInline_1ns4y_294",qIt="_mermaidStage_1ns4y_308",HIt="_mermaidLoading_1ns4y_331",UIt="_mermaidActions_1ns4y_338",WIt="_mermaidZoomWrapper_1ns4y_343",VIt="_mermaidPannable_1ns4y_358",GIt="_mermaidDragging_1ns4y_362",Io={content:IIt,streamingPlainText:EIt,inlineCode:RIt,link:AIt,tableWrapper:jIt,table:NIt,image:MIt,codeBlock:PIt,codeBlockHeader:LIt,codeBlockLang:DIt,codeBlockCopy:OIt,codeBlockContent:$It,codeBlockPlain:BIt,mermaidBlock:FIt,mermaidInline:zIt,mermaidStage:qIt,mermaidLoading:HIt,mermaidActions:UIt,mermaidZoomWrapper:WIt,mermaidPannable:VIt,mermaidDragging:GIt},KIt=32e3,YIt=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"]),Ufe={"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 xte(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(Ufe,t)?Ufe[t]:t,s=YIt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const DAe=/^(https?:|mailto:)/i,XIt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,OAe=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function NI(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:DAe.test(t):!1}function Lv(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?OAe.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||XIt.test(n)?!0:DAe.test(n):!1}let Wfe,Vfe=Promise.resolve(),ZIt=0;const QIt=5e4,JIt=500,e4t=1e4,Gfe=16;function t4t({code:e}){const{t}=mt(),n=Ry(),s=fl()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=W1(),[p,m]=d.useState(1),[g,v]=d.useState(!1),y=d.useRef(null),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[C,T]=d.useState(null),I=d.useRef(null),j=d.useRef(null),S=n==="light"?"default":"dark",R=.5,E=3,N=.25,A=()=>{m(H=>Math.min(E,Math.round((H+N)*100)/100))},M=()=>{m(H=>Math.max(R,Math.round((H-N)*100)/100))},L=d.useCallback(()=>{j.current=null,v(!1),m(1);const H=y.current;H&&(H.scrollLeft=0,H.scrollTop=0),b(!1)},[]),B=d.useCallback(H=>{const te=y.current;te&&(H.preventDefault(),v(!0),j.current={startX:H.clientX,startY:H.clientY,startLeft:te.scrollLeft,startTop:te.scrollTop})},[]),D=d.useCallback(H=>{const{scrollLeft:te,scrollTop:z}=H.currentTarget;b(te!==0||z!==0)},[]),W=d.useCallback(()=>{const H=y.current;H&&(k(H.scrollWidth>H.clientWidth||H.scrollHeight>H.clientHeight),b(H.scrollLeft!==0||H.scrollTop!==0))},[]),q=d.useCallback(()=>{const H=y.current,te=I.current?.querySelector("svg");if(!H||!te)return;const[,,z,Q]=(te.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),ee=(te.getAttribute("width")??"").trim(),he=Number.parseFloat(te.getAttribute("height")??""),F=z>0&&Q>0,K=F?z:Number.parseFloat(ee),V=F?Q:he;if(!(K>0)||!(V>0)){T(null);return}const $=H.clientWidth-Gfe*2,Z=ee.endsWith("%")&&$>0?Math.min(K,$):K,ne=Math.max(0,H.offsetHeight-H.clientHeight);T({stageWidth:Z,canvasHeight:Z*V/K+Gfe*2+ne})},[]);d.useEffect(()=>{if(!g)return;const H=z=>{const Q=y.current,ee=j.current;!Q||!ee||(Q.scrollLeft=ee.startLeft-(z.clientX-ee.startX),Q.scrollTop=ee.startTop-(z.clientY-ee.startY),b(Q.scrollLeft!==0||Q.scrollTop!==0))},te=()=>{j.current=null,v(!1)};return window.addEventListener("mousemove",H),window.addEventListener("mouseup",te),window.addEventListener("blur",te),()=>{window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",te),window.removeEventListener("blur",te)}},[g]),d.useEffect(()=>{L()},[e,L]),d.useLayoutEffect(()=>{q(),W()},[r,p,c,q,W]),d.useEffect(()=>{const H=y.current;if(!H)return;const te=new ResizeObserver(()=>{q(),W()});return te.observe(H),()=>te.disconnect()},[r,c,q,W]),d.useEffect(()=>{let H=!1;o(null),l(null);const te=setTimeout(()=>{Ze(()=>import("./mermaid.core-BSX0Vr31.js").then(z=>z.cb),[]).then(async z=>{if(H)return;const Q=z.default,ee=`${S}:${s?"hardened":"runtime"}`,he=Vfe.then(async()=>{if(H)throw new Error("Mermaid render skipped");Wfe!==ee&&(Q.initialize({startOnLoad:!1,theme:S,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:QIt,maxEdges:JIt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),Wfe=ee);const K=`mermaid-${++ZIt}`;if(!s)return Q.render(K,e.trim());let V;try{return await Promise.race([Q.render(K,e.trim()),new Promise(($,Z)=>{V=setTimeout(()=>Z(new Error("Mermaid render timed out")),e4t)})])}finally{V!==void 0&&clearTimeout(V)}});Vfe=he.then(()=>{},()=>{});const{svg:F}=await he;H||o(F)}).catch(z=>{H||l(z instanceof Error?z.message:"Mermaid render failed")})},150);return()=>{H=!0,clearTimeout(te)}},[e,s,S]);const P=()=>{Xh(e).then(()=>{f()}).catch(Bg)};return i?a.jsxs("div",{className:Io.codeBlock,children:[a.jsx("div",{className:Io.codeBlockHeader,children:a.jsx("span",{className:Io.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Io.codeBlockContent} ${Io.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Io.codeBlock,children:[a.jsxs("div",{className:Io.codeBlockHeader,children:[a.jsx("span",{className:Io.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Io.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Io.codeBlockCopy,onClick:M,title:t("mermaid.zoomOut"),disabled:p<=R,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Io.codeBlockCopy,onClick:L,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Io.codeBlockCopy,onClick:A,title:t("mermaid.zoomIn"),disabled:p>=E,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Io.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Io.codeBlockCopy,onClick:P,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Io.codeBlockContent} ${Io.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Io.mermaidZoomWrapper} ${x?Io.mermaidPannable:""} ${x&&g?Io.mermaidDragging:""}`,ref:y,style:C?{height:C.canvasHeight}:void 0,onMouseDown:B,onDoubleClick:L,onScroll:D,children:a.jsx("div",{className:`${Io.mermaidBlock} ${Io.mermaidStage}`,ref:I,style:{...C?{width:C.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Io.mermaidBlock} ${Io.mermaidLoading} ${Io.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function n4t({className:e,children:t,isStreaming:n}){const{t:s}=mt(),r=Ry(),o=fl()==="document",[i,l]=d.useState(null),[c,u]=W1(),{label:h,lang:f,resolvedLang:p}=xte($Ae(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||p==="text"||AK(m)){l(null);return}const y=QSt(m,p,g);if(y!==null){l(y);return}const w=Sfe(m,p,g,!0);if(w!==null){l(w);return}l(null);let b=!1;return iAe(p).then(()=>{if(b)return;const x=Sfe(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,o,f,p,g,n]);const v=()=>{Xh(m).then(()=>{u()}).catch(Bg)};return f==="mermaid"&&!n&&!o?a.jsx(t4t,{code:m}):a.jsxs("div",{className:Io.codeBlock,children:[a.jsxs("div",{className:Io.codeBlockHeader,children:[a.jsx("span",{className:Io.codeBlockLang,children:h}),a.jsx("button",{className:Io.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:Io.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${Io.codeBlockContent} ${Io.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function $Ae(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 s4t({children:e}){return a.jsx("code",{className:Io.inlineCode,children:e})}function Kfe({children:e}){return a.jsx("div",{className:Io.tableWrapper,children:a.jsx("table",{className:Io.table,children:e})})}const BAe=d.createContext(!1),FAe=d.createContext(void 0),zAe=d.createContext(void 0);function r4t(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:!URe(e.slice(s,r))&&e.slice(r).trim().length===0}function o4t({className:e,children:t,node:n}){const s=d.useContext(BAe),r=d.useContext(zAe);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1704
|
+
`,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return URe(e.slice(i,s))||e.slice(s).trim().length>0}function PAe(e,t){return e===o7||t?.has(e)===!0}function gIt(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(bte);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&PAe(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(p=>typeof p=="string"||typeof p=="number"?String(p):"").join("");return d.createElement(pIt,{language:u,source:f,streaming:i?.streaming===!0&&!mIt(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const vIt=3e4,wIt=["artifact://","session-file://"],yIt=/^[a-z]:/i;function bIt(e={}){const{resolveDataRef:t,validateDataRef:n=CIt,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?LAe(i):i;if(!c)throw new Error("Chart data reference is not supported.");return TIt(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new dvt().register(dIt({...s,resolveDataRef:o,validateDataRef:n}))}const xIt={registry:bIt()};function kIt(e,t={}){const n=gIt(t).pre;if(!n)throw new Error("markdown-chart React adapter did not provide a pre renderer");return function({children:r,...o}){if(d.isValidElement(r)){const i=r,c=/(?:^|\s)language-([^\s]+)/.exec(i.props.className??"")?.[1]?.toLowerCase();if(c&&PAe(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function _It({customization:e,source:t,streaming:n,theme:s,children:r}){const o=SIt(e.labels),{t:i}=mt();return a.jsx(fIt,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function SIt(e){const{t}=mt();return d.useMemo(()=>({chartUnavailable:t("echartsChart.renderFailed"),viewMode:t("echartsChart.viewMode"),chart:t("echartsChart.chart"),data:t("echartsChart.data"),showChart:t("echartsChart.showChart"),showData:t("echartsChart.showData"),noData:t("echartsChart.noData"),tableNotice:({visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o})=>t("echartsChart.tableNotice",{visibleRows:n,totalRows:s,visibleColumns:r,totalColumns:o,omittedRows:s-n,omittedColumns:o-r}),...e}),[e,t])}function Hfe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function LAe(e){if(e.trim()!==e||!e||Hfe(e))return;const t=e.toLowerCase(),n=wIt.find(i=>t.startsWith(i));if(!n)return;const s=e.slice(n.length);if(!s||/[?#\\]/.test(s))return;let r;try{r=decodeURIComponent(s)}catch{return}if(/[%?#\\]/.test(r)||Hfe(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||yIt.test(i)))return`${n}${o.join("/")}`}function CIt(e){return LAe(e)!==void 0}function TIt(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),vIt);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const IIt="_content_1ns4y_1",EIt="_streamingPlainText_1ns4y_11",RIt="_inlineCode_1ns4y_135",AIt="_link_1ns4y_147",jIt="_tableWrapper_1ns4y_157",NIt="_table_1ns4y_157",MIt="_image_1ns4y_187",PIt="_codeBlock_1ns4y_195",LIt="_codeBlockHeader_1ns4y_204",DIt="_codeBlockLang_1ns4y_213",OIt="_codeBlockCopy_1ns4y_221",$It="_codeBlockContent_1ns4y_244",BIt="_codeBlockPlain_1ns4y_264",FIt="_mermaidBlock_1ns4y_282",zIt="_mermaidInline_1ns4y_294",qIt="_mermaidStage_1ns4y_308",HIt="_mermaidLoading_1ns4y_331",UIt="_mermaidActions_1ns4y_338",WIt="_mermaidZoomWrapper_1ns4y_343",VIt="_mermaidPannable_1ns4y_358",GIt="_mermaidDragging_1ns4y_362",Io={content:IIt,streamingPlainText:EIt,inlineCode:RIt,link:AIt,tableWrapper:jIt,table:NIt,image:MIt,codeBlock:PIt,codeBlockHeader:LIt,codeBlockLang:DIt,codeBlockCopy:OIt,codeBlockContent:$It,codeBlockPlain:BIt,mermaidBlock:FIt,mermaidInline:zIt,mermaidStage:qIt,mermaidLoading:HIt,mermaidActions:UIt,mermaidZoomWrapper:WIt,mermaidPannable:VIt,mermaidDragging:GIt},KIt=32e3,YIt=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"]),Ufe={"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 xte(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(Ufe,t)?Ufe[t]:t,s=YIt.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const DAe=/^(https?:|mailto:)/i,XIt=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,OAe=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function NI(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:DAe.test(t):!1}function Lv(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?OAe.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||XIt.test(n)?!0:DAe.test(n):!1}let Wfe,Vfe=Promise.resolve(),ZIt=0;const QIt=5e4,JIt=500,e4t=1e4,Gfe=16;function t4t({code:e}){const{t}=mt(),n=Ry(),s=fl()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=W1(),[p,m]=d.useState(1),[g,v]=d.useState(!1),y=d.useRef(null),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[C,T]=d.useState(null),I=d.useRef(null),j=d.useRef(null),S=n==="light"?"default":"dark",R=.5,E=3,N=.25,A=()=>{m(H=>Math.min(E,Math.round((H+N)*100)/100))},M=()=>{m(H=>Math.max(R,Math.round((H-N)*100)/100))},L=d.useCallback(()=>{j.current=null,v(!1),m(1);const H=y.current;H&&(H.scrollLeft=0,H.scrollTop=0),b(!1)},[]),B=d.useCallback(H=>{const te=y.current;te&&(H.preventDefault(),v(!0),j.current={startX:H.clientX,startY:H.clientY,startLeft:te.scrollLeft,startTop:te.scrollTop})},[]),D=d.useCallback(H=>{const{scrollLeft:te,scrollTop:z}=H.currentTarget;b(te!==0||z!==0)},[]),W=d.useCallback(()=>{const H=y.current;H&&(k(H.scrollWidth>H.clientWidth||H.scrollHeight>H.clientHeight),b(H.scrollLeft!==0||H.scrollTop!==0))},[]),q=d.useCallback(()=>{const H=y.current,te=I.current?.querySelector("svg");if(!H||!te)return;const[,,z,Q]=(te.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),ee=(te.getAttribute("width")??"").trim(),he=Number.parseFloat(te.getAttribute("height")??""),F=z>0&&Q>0,K=F?z:Number.parseFloat(ee),V=F?Q:he;if(!(K>0)||!(V>0)){T(null);return}const $=H.clientWidth-Gfe*2,Z=ee.endsWith("%")&&$>0?Math.min(K,$):K,ne=Math.max(0,H.offsetHeight-H.clientHeight);T({stageWidth:Z,canvasHeight:Z*V/K+Gfe*2+ne})},[]);d.useEffect(()=>{if(!g)return;const H=z=>{const Q=y.current,ee=j.current;!Q||!ee||(Q.scrollLeft=ee.startLeft-(z.clientX-ee.startX),Q.scrollTop=ee.startTop-(z.clientY-ee.startY),b(Q.scrollLeft!==0||Q.scrollTop!==0))},te=()=>{j.current=null,v(!1)};return window.addEventListener("mousemove",H),window.addEventListener("mouseup",te),window.addEventListener("blur",te),()=>{window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",te),window.removeEventListener("blur",te)}},[g]),d.useEffect(()=>{L()},[e,L]),d.useLayoutEffect(()=>{q(),W()},[r,p,c,q,W]),d.useEffect(()=>{const H=y.current;if(!H)return;const te=new ResizeObserver(()=>{q(),W()});return te.observe(H),()=>te.disconnect()},[r,c,q,W]),d.useEffect(()=>{let H=!1;o(null),l(null);const te=setTimeout(()=>{Ze(()=>import("./mermaid.core-BSD13L-h.js").then(z=>z.cb),[]).then(async z=>{if(H)return;const Q=z.default,ee=`${S}:${s?"hardened":"runtime"}`,he=Vfe.then(async()=>{if(H)throw new Error("Mermaid render skipped");Wfe!==ee&&(Q.initialize({startOnLoad:!1,theme:S,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:QIt,maxEdges:JIt}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),Wfe=ee);const K=`mermaid-${++ZIt}`;if(!s)return Q.render(K,e.trim());let V;try{return await Promise.race([Q.render(K,e.trim()),new Promise(($,Z)=>{V=setTimeout(()=>Z(new Error("Mermaid render timed out")),e4t)})])}finally{V!==void 0&&clearTimeout(V)}});Vfe=he.then(()=>{},()=>{});const{svg:F}=await he;H||o(F)}).catch(z=>{H||l(z instanceof Error?z.message:"Mermaid render failed")})},150);return()=>{H=!0,clearTimeout(te)}},[e,s,S]);const P=()=>{Xh(e).then(()=>{f()}).catch(Bg)};return i?a.jsxs("div",{className:Io.codeBlock,children:[a.jsx("div",{className:Io.codeBlockHeader,children:a.jsx("span",{className:Io.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${Io.codeBlockContent} ${Io.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:Io.codeBlock,children:[a.jsxs("div",{className:Io.codeBlockHeader,children:[a.jsx("span",{className:Io.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:Io.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Io.codeBlockCopy,onClick:M,title:t("mermaid.zoomOut"),disabled:p<=R,children:t("mermaid.zoomOut")}),a.jsx("button",{className:Io.codeBlockCopy,onClick:L,title:t("mermaid.zoomReset"),disabled:p===1&&!w,children:t("mermaid.zoomReset")}),a.jsx("button",{className:Io.codeBlockCopy,onClick:A,title:t("mermaid.zoomIn"),disabled:p>=E,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:Io.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:Io.codeBlockCopy,onClick:P,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${Io.codeBlockContent} ${Io.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${Io.mermaidZoomWrapper} ${x?Io.mermaidPannable:""} ${x&&g?Io.mermaidDragging:""}`,ref:y,style:C?{height:C.canvasHeight}:void 0,onMouseDown:B,onDoubleClick:L,onScroll:D,children:a.jsx("div",{className:`${Io.mermaidBlock} ${Io.mermaidStage}`,ref:I,style:{...C?{width:C.stageWidth}:{},...p===1?{}:{zoom:p}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${Io.mermaidBlock} ${Io.mermaidLoading} ${Io.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function n4t({className:e,children:t,isStreaming:n}){const{t:s}=mt(),r=Ry(),o=fl()==="document",[i,l]=d.useState(null),[c,u]=W1(),{label:h,lang:f,resolvedLang:p}=xte($Ae(e)),m=String(t).replace(/\n$/,""),g=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||p==="text"||AK(m)){l(null);return}const y=QSt(m,p,g);if(y!==null){l(y);return}const w=Sfe(m,p,g,!0);if(w!==null){l(w);return}l(null);let b=!1;return iAe(p).then(()=>{if(b)return;const x=Sfe(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,o,f,p,g,n]);const v=()=>{Xh(m).then(()=>{u()}).catch(Bg)};return f==="mermaid"&&!n&&!o?a.jsx(t4t,{code:m}):a.jsxs("div",{className:Io.codeBlock,children:[a.jsxs("div",{className:Io.codeBlockHeader,children:[a.jsx("span",{className:Io.codeBlockLang,children:h}),a.jsx("button",{className:Io.codeBlockCopy,onClick:v,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:Io.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${Io.codeBlockContent} ${Io.codeBlockPlain}`,children:a.jsx("code",{children:m})})]})}function $Ae(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 s4t({children:e}){return a.jsx("code",{className:Io.inlineCode,children:e})}function Kfe({children:e}){return a.jsx("div",{className:Io.tableWrapper,children:a.jsx("table",{className:Io.table,children:e})})}const BAe=d.createContext(!1),FAe=d.createContext(void 0),zAe=d.createContext(void 0);function r4t(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:!URe(e.slice(s,r))&&e.slice(r).trim().length===0}function o4t({className:e,children:t,node:n}){const s=d.useContext(BAe),r=d.useContext(zAe);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1705
1705
|
`)?a.jsx(i4t,{className:e,isStreaming:s,isIncomplete:r4t(r,n,s),children:t}):a.jsx(s4t,{children:t})}function i4t({className:e,children:t,isStreaming:n,isIncomplete:s}){const r=d.useContext(FAe),o=Ry(),{markdown:i}=md(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(n4t,{className:e,isStreaming:n,children:l}),h=$Ae(e),{resolvedLang:f}=xte(h);if(!!r&&!!e&&!!h)try{const m=i?.renderCodeBlock?.({language:h,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!s,source:r,theme:o});if(m!=null&&typeof m!="boolean")return a.jsx(Ug,{fallback:u,label:`custom code block component render (lang=${h})`,resetKeys:[h,r,o,n?"streaming":"settled",s?"incomplete":"complete",c],children:m})}catch(m){console.error("[web-shell] custom code block renderer call failed (lang=%s):",h,m)}return u}function a4t({children:e}){return a.jsx(a.Fragment,{children:e})}const OK=/^qwen-session:\/\//i;function Yfe(e,t=!1){return t&&OAe.test(e.trim())||OK.test(e.trim())?e:$Re(e)}function qAe({href:e,children:t,node:n,id:s,"aria-label":r,"aria-describedby":o}){const i=fl(),l=Vf();if((n?.properties.dataFootnoteRef!==void 0||n?.properties.dataFootnoteBackref!==void 0)&&e?.startsWith("#"))return a.jsx("a",{id:s,href:e,className:Io.link,"aria-label":r,"aria-describedby":o,"data-footnote-ref":n?.properties.dataFootnoteRef!==void 0?"":void 0,"data-footnote-backref":n?.properties.dataFootnoteBackref!==void 0?"":void 0,onClick:h=>{const p=h.currentTarget.getRootNode().getElementById(e.slice(1));p&&(h.preventDefault(),p.scrollIntoView({block:"nearest"}),!p.hasAttribute("tabindex")&&p.tagName!=="BUTTON"&&(p.tabIndex=-1),p.focus({preventScroll:!0}))},children:t});if(e&&OK.test(e.trim())){if(i!=="interactive")return a.jsx("span",{className:Io.link,children:t});const h=e.trim().replace(OK,"");return a.jsx("a",{href:"#",role:"button",className:Io.link,onClick:f=>{f.preventDefault(),f.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:h}))},children:t})}const u=NI(e)?e:void 0;return a.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:Io.link,onClick:h=>l(h,u),children:t})}function l4t({src:e,alt:t}){const n=fl(),s=Lv(e,n==="document")?e:void 0;return a.jsx("img",{src:s,alt:t||"",className:Io.image})}function c4t(e,t,n=80){const[s,r]=d.useState(e),o=d.useRef(s);o.current=s;const i=d.useRef(0),l=d.useRef(null),c=d.useRef(e);return c.current=e,d.useEffect(()=>{if(!t){l.current&&(clearTimeout(l.current),l.current=null),o.current!==e&&r(e);return}const u=Date.now(),h=u-i.current;h>=n?(i.current=u,r(c.current)):l.current||(l.current=setTimeout(()=>{i.current=Date.now(),l.current=null,r(c.current)},n-h))},[e,t,n]),d.useEffect(()=>()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),!t||typeof e=="string"&&typeof s=="string"&&!e.startsWith(s)?e:s}function HAe(e="basic",t=""){return{code:o4t,pre:a4t,a:qAe,img:l4t,sup:yAe,section:bAe,table({children:n}){if(e==="advanced"){const s=a.jsx(Kfe,{children:n});return a.jsx(Ug,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(rTt,{fallback:s,children:n})})}return a.jsx(Kfe,{children:n})}}}const u4t=HAe(),d4t=d.memo(function({content:t,components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o}){return a.jsx(tvt,{components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o,children:t})}),Bf=d.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:o,markdownTableMode:i}=md(),l=Ry(),c=fl()==="document",u=`footnote-${d.useId()}-`,h=n?o:void 0,f=c4t(t??"",s),p=s===!0&&f.length>KIt,m=d.useMemo(()=>f&&n&&h?.transformMarkdown?h.transformMarkdown(f,{source:n,isStreaming:s===!0}):f,[n,h,f,s]),g=s?"basic":r??i??"basic",v=d.useMemo(()=>g==="advanced"?HAe("advanced",m):u4t,[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}:{}},A=y?.a;return y&&(N.a=M=>{if(M.node?.properties.dataFootnoteRef!==void 0||M.node?.properties.dataFootnoteBackref!==void 0||!A)return a.jsx(qAe,{...M});if(typeof A!="string")return d.createElement(A,M);const{node:B,...D}=M;return d.createElement(A,D)}),y?.sup||(N.sup=M=>a.jsx(yAe,{...M,linkComponent:A,iconResolver:w,mountPreview:b}),N.section=M=>a.jsx(bAe,{...M,sectionComponent:y?.section})),N},[v,g,y,w,b]),k=!c&&n==="assistant"&&!y?.code&&!y?.pre?h?.chart??(h?.renderCodeBlock?void 0:xIt):void 0,C=d.useMemo(()=>k?kIt(k.registry,{chartClassName:k.chartClassName,chartStyle:{minHeight:360,...k.chartStyle}}):void 0,[k]),T=d.useMemo(()=>C?{...x,pre:C}:x,[C,x]),I=d.useMemo(()=>h?.remarkPlugins?[ihe,Vhe,ofe,...h.remarkPlugins]:[ihe,Vhe,ofe],[h?.remarkPlugins]),j=d.useMemo(()=>[pxt,...h?.rehypePlugins??[],[hTt,{prefix:u,group:!c&&!y?.sup,safeHref:NI,safeImage:Lv,transformUrl:Yfe}]],[h?.rehypePlugins,u,c,y?.sup]),S=d.useMemo(()=>N=>Yfe(N,c),[c]);if(!t)return null;if(p)return a.jsx("div",{className:n!=="thinking"?Io.content:void 0,"data-markdown-source":n,"data-markdown-streaming-plain-text":"true",children:a.jsx("pre",{className:Io.streamingPlainText,children:m})});const R=a.jsx(d4t,{content:m,components:T,remarkPlugins:I,rehypePlugins:j,urlTransform:S}),E=k?a.jsx(_It,{customization:k,source:m,streaming:!!s,theme:l,children:R}):R;return a.jsx("div",{className:n!=="thinking"?Io.content:void 0,"data-markdown-source":n,children:a.jsx(BAe.Provider,{value:!!s,children:a.jsx(FAe.Provider,{value:n,children:a.jsx(zAe.Provider,{value:m,children:E})})})})}),nH=/https?:\/\/[A-Za-z0-9\-._~:/?#[\]{}@!$&'()*+,;=%]+/gi,h4t=new Set([...".,;:!?'*_~"]),f4t={")":"(","]":"[","}":"{"},p4t=/^https?:\/\/./i;function Xfe(e,t){let n=0;for(const s of e)s===t&&(n+=1);return n}function m4t(e){const t={};for(const[s,r]of Object.entries(f4t))t[s]=Xfe(e,s)-Xfe(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(!h4t.has(s))break;n--}return e.slice(0,n)}function g4t(e){const t=[];let n=0;nH.lastIndex=0;for(let s=nH.exec(e);s!==null;s=nH.exec(e)){const r=m4t(s[0]);if(!p4t.test(r))continue;const o=s.index;o>n&&t.push({type:"text",value:e.slice(n,o)}),t.push({type:"url",value:r}),n=o+r.length}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const jP=d.memo(function({text:t}){const n=Vf(),s=d.useMemo(()=>g4t(t),[t]);return s.every(r=>r.type==="text")?t:s.map((r,o)=>{if(r.type==="text")return r.value;const i=r.value.replace(/%(?![0-9A-Za-z]{2})/g,"%25"),l=NI(i)?i:void 0;return a.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:Io.link,onClick:c=>n(c,l),children:r.value},o)})}),v4t="_flash_96ig5_1",my={flash:v4t},w4t="_chatMessageRow_qnd03_41",y4t="_chatMessageColumn_qnd03_48",b4t="_chatBubble_qnd03_55",x4t="_scheduledTaskBubble_qnd03_68",k4t="_scheduledTaskRun_qnd03_76",_4t="_scheduledTaskHeader_qnd03_83",S4t="_scheduledTaskIcon_qnd03_90",C4t="_scheduledTaskHeading_qnd03_108",T4t="_scheduledTaskEyebrow_qnd03_115",I4t="_scheduledTaskName_qnd03_122",E4t="_scheduledTaskMeta_qnd03_131",R4t="_scheduledTaskMetaItem_qnd03_138",A4t="_scheduledTaskBadge_qnd03_158",j4t="_scheduledTaskId_qnd03_170",N4t="_scheduledTaskPrompt_qnd03_181",M4t="_sendFailure_qnd03_191",P4t="_retryButton_qnd03_201",L4t="_editArea_qnd03_229",D4t="_editInput_qnd03_237",O4t="_editActions_qnd03_258",$4t="_editCancel_qnd03_264",B4t="_editSubmit_qnd03_265",F4t="_chatContent_qnd03_294",z4t="_messageTag_qnd03_299",q4t="_messageTagTooltip_qnd03_317",H4t="_messageTagClickable_qnd03_351",U4t="_messageTagIcon_qnd03_364",W4t="_messageTagLabel_qnd03_376",V4t="_messageTagValue_qnd03_377",G4t="_chatContentCollapsed_qnd03_400",K4t="_toggleButton_qnd03_405",Y4t="_toggleIcon_qnd03_426",X4t="_toggleIconExpanded_qnd03_433",Z4t="_chatImages_qnd03_437",Q4t="_chatImageThumb_qnd03_445",J4t="_chatImageThumbInteractive_qnd03_453",eEt="_chatFiles_qnd03_462",tEt="_chatFileChip_qnd03_470",nEt="_chatFileChipPreviewable_qnd03_483",sEt="_fileTagIcon_qnd03_492",ho={chatMessageRow:w4t,chatMessageColumn:y4t,chatBubble:b4t,scheduledTaskBubble:x4t,scheduledTaskRun:k4t,scheduledTaskHeader:_4t,scheduledTaskIcon:S4t,scheduledTaskHeading:C4t,scheduledTaskEyebrow:T4t,scheduledTaskName:I4t,scheduledTaskMeta:E4t,scheduledTaskMetaItem:R4t,scheduledTaskBadge:A4t,scheduledTaskId:j4t,scheduledTaskPrompt:N4t,sendFailure:M4t,retryButton:P4t,editArea:L4t,editInput:D4t,editActions:O4t,editCancel:$4t,editSubmit:B4t,chatContent:F4t,messageTag:z4t,messageTagTooltip:q4t,messageTagClickable:H4t,messageTagIcon:U4t,messageTagLabel:W4t,messageTagValue:V4t,chatContentCollapsed:G4t,toggleButton:K4t,toggleIcon:Y4t,toggleIconExpanded:X4t,chatImages:Z4t,chatImageThumb:Q4t,chatImageThumbInteractive:J4t,chatFiles:eEt,chatFileChip:tEt,chatFileChipPreviewable:nEt,fileTagIcon:sEt},rEt="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 oEt(e){const t=`
|
|
1706
1706
|
|
|
1707
1707
|
${rEt}
|
|
@@ -2336,7 +2336,7 @@ ${i("terminal.notice.protocolMismatch")}`),ee.close(4002,"Terminal protocol mism
|
|
|
2336
2336
|
* Copyright 2026 Qwen Team
|
|
2337
2337
|
* SPDX-License-Identifier: Apache-2.0
|
|
2338
2338
|
*/function oDe(e,t){const n=new Set;for(const s of e.spans)s.start<=t.end&&s.end>=t.start&&n.add(s.rowKey);return n}const c6n="_overview_1px7x_7",u6n="_labels_1px7x_30",d6n="_plot_1px7x_58",h6n="_domain_1px7x_77",f6n="_selection_1px7x_88",p6n="_turnMark_1px7x_103",m6n="_span_1px7x_113",g6n="_axis_1px7x_174",v6n="_axisEnd_1px7x_185",w6n="_zoomButton_1px7x_195",y6n="_srOnly_1px7x_221",b6n="_notice_1px7x_252",jh={overview:c6n,labels:u6n,plot:d6n,domain:h6n,selection:f6n,turnMark:p6n,span:m6n,axis:g6n,axisEnd:v6n,zoomButton:w6n,srOnly:y6n,notice:b6n},fye=4,x6n=20,k6n=5e3,pye=.0015,_6n=120,S6n=.999;function C6n(e){return Math.min(1,Math.max(0,e))}function iDe(e){return Math.min(e,Math.max(x6n,e/k6n))}function T6n(e,t,n,s){if(!(e>0))return;const r=Math.min(e,Math.max(iDe(e),s));if(r>=e*S6n)return;const o=Math.min(e-r,Math.max(0,t-n*r));return{start:o,end:o+r}}function mye(e,t,n){return t===1?e*16:t===2?e*n:e}function gye(e){return`${Number(e.toFixed(3))}%`}function pT(e){const t=e.toFixed(8).replace(/\.?0+$/,"");return`${t==="-0"?"0":t}%`}function I6n(e,t){if(t>=6e4)return Yl(e);if(e<1e3)return`${Math.round(e)}ms`;const n=t>=1e4?0:t>=1e3?1:t>=100?2:3,s=10**(3-n),r=Math.round(e/s)*s;if(r<6e4)return`${(r/1e3).toFixed(n)}s`;const o=Math.floor(r/36e5),i=Math.floor(r%36e5/6e4),l=(r%6e4/1e3).toFixed(n);return`${o>0?`${o}h `:""}${i}m ${l}s`}function E6n(e,t,n){const s=t>=1e4?0:t>=1e3?1:t>=100?2:3;return new Intl.DateTimeFormat(n,{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23",...s>0?{fractionalSecondDigits:s}:{}}).format(e)}function R6n(e,t){const n=e.end-e.start,s=t>0?n/t:0,r={"--left":pT(t>0?e.start/t*100:0),"--width":pT(s*100),"--stack":String(1+Math.round((1-s)*1e3))};return e.ttftEnd!==void 0&&n>0&&(r["--ttft"]=pT((e.ttftEnd-e.start)/n*100)),r}function A6n({model:e,notice:t,selectedKey:n,onSelect:s,describe:r,range:o,onRangeChange:i,onModeChange:l}){const{t:c,language:u}=mt(),h=e?.mode==="clock",[f,p]=d.useState(void 0),m=e?Yl(e.total):void 0,g=d.useRef(null),v=d.useRef(null),y=d.useRef(null),[w,b]=d.useState(void 0),[x,k]=d.useState(!1),C=e?.total??0,[T,I]=d.useState(void 0),j=T!==void 0&&T.of===e?T.viewport:void 0,S=j?.start??0,R=j?j.end-j.start:C,E=d.useRef(e),N=d.useRef(void 0);d.useLayoutEffect(()=>{E.current=e},[e]);const A=d.useCallback(()=>{const ve=E.current,xe=ve?.total??0,Ne=N.current;return Ne===void 0||Ne.of!==ve?{start:0,length:xe}:{start:Ne.viewport.start,length:Ne.viewport.end-Ne.viewport.start}},[]),M=d.useCallback(ve=>{p("zoom");const xe=E.current,Ne=ve!==void 0&&xe!==void 0?{viewport:ve,of:xe}:void 0;N.current=Ne,I(Ne)},[]),L=d.useCallback(ve=>{const xe=g.current?.getBoundingClientRect();return!xe||xe.width<=0?0:C6n((ve-xe.left)/xe.width)},[]),B=d.useCallback(ve=>{const{start:xe,length:Ne}=A();return xe+L(ve)*Ne},[A,L]),D=(ve,xe)=>({start:Math.min(ve,xe),end:Math.max(ve,xe)}),W=d.useCallback((ve,xe,Ne)=>{const Re=E.current?.total??0,{start:je,length:et}=A(),Ye=T6n(Re,xe,Ne,et*ve),le=Ye?.start??0,G=Ye?Ye.end-Ye.start:Re;return le===je&&G===et?!1:(M(Ye),!0)},[M,A]),q=d.useCallback((ve,xe,Ne)=>{const Re=E.current?.total??0,je=Math.min(Re-xe,Math.max(0,ve+Ne));return je===A().start?!1:(M({start:je,end:je+xe}),!0)},[M,A]),P=e!==void 0;d.useEffect(()=>{const ve=g.current;if(!ve)return;const xe=Ne=>{if(Ne.ctrlKey||v.current||y.current)return;const Re=ve.getBoundingClientRect().width,je=mye(Ne.deltaX,Ne.deltaMode,Re),et=mye(Ne.deltaY,Ne.deltaMode,Re);let Ye=!1;if(Math.abs(je)>Math.abs(et)){const{start:le,length:G}=A();Ye=Re>0&&q(le,G,je/Re*G)}else if(et!==0){const le=L(Ne.clientX);Ye=W(Math.exp(et*pye),B(Ne.clientX),le)}Ye&&Ne.preventDefault()};return ve.addEventListener("wheel",xe,{passive:!1}),()=>ve.removeEventListener("wheel",xe)},[P,A,L,B,q,W]),d.useEffect(()=>{if(n===void 0||e===void 0)return;const ve=e.spans.find(Ye=>Ye.rowKey===n);if(!ve)return;const{start:xe,length:Ne}=A();if(Ne>=e.total)return;const Re=xe+Ne;if(ve.end>=xe&&ve.start<=Re)return;const je=Ne*.1,et=ve.end<xe?ve.start-je:ve.end-Ne+je;q(xe,Ne,et-xe)},[n,e,A,q]);const H=ve=>{if(v.current||y.current)return;if(ve.button===2){const{start:je,length:et}=A();y.current={pointerId:ve.pointerId,anchorX:ve.clientX,start:je,length:et,panned:!1};const Ye=ve.currentTarget;typeof Ye.setPointerCapture=="function"&&Ye.setPointerCapture(ve.pointerId);return}if(ve.button!==0)return;const Ne=(ve.target instanceof Element?ve.target:null)?.closest("[data-row-key]")?.dataset.rowKey;v.current={pointerId:ve.pointerId,anchorX:ve.clientX,anchorMs:B(ve.clientX),spanKey:Ne,dragging:!1};const Re=ve.currentTarget;typeof Re.setPointerCapture=="function"&&Re.setPointerCapture(ve.pointerId),ve.preventDefault()},te=ve=>{const xe=y.current;if(xe&&xe.pointerId===ve.pointerId){const Re=ve.clientX-xe.anchorX;if(!xe.panned&&Math.abs(Re)<fye)return;const je=g.current?.getBoundingClientRect().width??0;je>0&&q(xe.start,xe.length,-Re/je*xe.length)&&!xe.panned&&(xe.panned=!0,k(!0));return}const Ne=v.current;!Ne||Ne.pointerId!==ve.pointerId||(!Ne.dragging&&Math.abs(ve.clientX-Ne.anchorX)>=fye&&(Ne.dragging=!0),Ne.dragging&&b(D(Ne.anchorMs,B(ve.clientX))))},z=ve=>{const xe=y.current;if(xe&&xe.pointerId===ve.pointerId){y.current=null,k(!1),xe.panned||i(void 0);return}const Ne=v.current;!Ne||Ne.pointerId!==ve.pointerId||(v.current=null,b(void 0),Ne.dragging?i(D(Ne.anchorMs,B(ve.clientX))):Ne.spanKey!==void 0?s(Ne.spanKey):i(void 0))},Q=()=>{v.current=null,y.current=null,b(void 0),k(!1)},ee=ve=>{ve.preventDefault(),v.current&&(Q(),i(void 0))},he=j!==void 0,F=R<=iDe(C),K=S+R/2,V=Math.exp(_6n*pye),$={left:gye(R>0?-(S/R)*100:0),width:gye(R>0?C/R*100:100)},Z=(ve,xe)=>h?E6n((e?.originMs??0)+ve,xe,u):I6n(ve,xe),ne=Z(S,R),ae=Z(S+R,R),Y=m,de=e?Yl(e.activeMs):void 0,fe=w??o,pe=d.useMemo(()=>e&&fe?oDe(e,fe):void 0,[e,fe]);return a.jsx("div",{className:jh.overview,"data-testid":"trajectory-overview",...e?{role:"group","aria-label":(h?c("trajectory.clock.label",{spans:e.spans.length,elapsed:Y??"",active:de??""}):c("trajectory.overview.label",{spans:e.spans.length,busy:m??""}))+(o?c("trajectory.range.aria",{from:h?Z(o.start,o.end-o.start):Yl(o.start),to:h?Z(o.end,o.end-o.start):Yl(o.end)}):"")+(j?c("trajectory.zoom.aria",{from:ne,to:ae}):"")}:{},children:e?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:jh.labels,"aria-hidden":"true",children:[a.jsx("span",{children:c("trajectory.overview.lane.requests")}),a.jsx("span",{children:c("trajectory.overview.lane.tools")}),a.jsx("span",{children:c("trajectory.overview.lane.subagents")})]}),a.jsx("div",{ref:g,className:jh.plot,"aria-hidden":"true","data-testid":"trajectory-plot","data-panning":x?"true":void 0,onPointerDown:H,onPointerMove:te,onPointerUp:z,onPointerCancel:Q,onContextMenu:ee,children:a.jsxs("div",{className:jh.domain,"data-testid":"trajectory-domain","data-zoomed":he?"true":void 0,style:$,children:[fe&&a.jsx("div",{className:jh.selection,"data-testid":"trajectory-range","data-draft":w?"true":void 0,style:{"--left":pT(C>0?fe.start/C*100:0),"--width":pT(C>0?(fe.end-fe.start)/C*100:0)}}),e.turnMarks.map(ve=>a.jsx("span",{className:jh.turnMark,"data-testid":"trajectory-turn-mark",style:{"--left":pT(e.total>0?ve.at/e.total*100:0)}},ve.turnIndex)),e.spans.map(ve=>a.jsx("span",{className:jh.span,"data-testid":"trajectory-span","data-row-key":ve.rowKey,"data-lane":ve.lane,"data-error":ve.error?"true":void 0,"data-ttft":ve.ttftEnd!==void 0?"true":void 0,"data-current":ve.rowKey===n?"true":void 0,"data-dimmed":pe&&!pe.has(ve.rowKey)&&ve.rowKey!==n?"true":void 0,title:r(ve),style:R6n(ve,e.total)},ve.rowKey))]})}),a.jsxs("div",{className:jh.axis,children:[a.jsx("span",{"aria-hidden":"true","data-testid":"trajectory-overview-from",children:h||S>0?ne:"0"}),a.jsxs("span",{className:jh.axisEnd,children:[a.jsx("button",{type:"button",className:jh.zoomButton,"data-testid":"trajectory-mode-clock","aria-pressed":h,"aria-label":c("trajectory.mode.clock"),title:c("trajectory.mode.clock"),onClick:()=>{p("mode"),l(h?"active":"clock")},children:a.jsx(ree,{size:10,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:jh.zoomButton,"data-testid":"trajectory-zoom-in","aria-label":c("trajectory.zoom.in"),title:c("trajectory.zoom.in"),"aria-disabled":F?!0:void 0,onClick:()=>{W(1/V,K,.5)},children:a.jsx(Vut,{size:10,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:jh.zoomButton,"data-testid":"trajectory-zoom-out","aria-label":c("trajectory.zoom.out"),title:c("trajectory.zoom.out"),"aria-disabled":he?void 0:!0,onClick:()=>{W(V,K,.5)},children:a.jsx(Kut,{size:10,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:jh.zoomButton,"data-testid":"trajectory-zoom-reset","aria-label":c("trajectory.zoom.reset"),title:c("trajectory.zoom.reset"),"aria-disabled":he?void 0:!0,onClick:()=>{he&&M(void 0)},children:a.jsx(cEe,{size:10,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsx("span",{"aria-hidden":"true","data-testid":"trajectory-overview-busy",children:h?he?ae:c("trajectory.clock.window",{elapsed:Y??"",active:de??""}):he?c("trajectory.zoom.window",{to:ae,busy:m??""}):c("trajectory.overview.busy",{duration:m??""})})]})]}),a.jsx("span",{className:jh.srOnly,role:"status","data-testid":"trajectory-zoom-status",children:f==="mode"?c(h?"trajectory.clock.status":"trajectory.active.status"):he?c("trajectory.zoom.status",{from:ne,to:ae,busy:m??""}):""})]}):t?a.jsx("div",{className:jh.notice,role:"status",children:t}):null})}const j6n="_panel_ym3d2_1",N6n="_header_ym3d2_8",M6n="_summary_ym3d2_17",P6n="_headerActions_ym3d2_26",L6n="_headerButton_ym3d2_33",D6n="_iconButton_ym3d2_54",O6n="_error_ym3d2_78",$6n="_tableWrap_ym3d2_91",B6n="_placeholder_ym3d2_98",F6n="_scroll_ym3d2_105",z6n="_olderBar_ym3d2_117",q6n="_olderNotice_ym3d2_129",H6n="_toneError_ym3d2_138",U6n="_virtualBody_ym3d2_142",W6n="_virtualRow_ym3d2_147",V6n="_turnHeader_ym3d2_156",G6n="_turnTitle_ym3d2_172",K6n="_turnSummary_ym3d2_176",Y6n="_record_ym3d2_184",X6n="_nestMarker_ym3d2_203",Z6n="_selected_ym3d2_208",Q6n="_badge_ym3d2_213",J6n="_text_ym3d2_226",eNn="_faint_ym3d2_235",tNn="_metrics_ym3d2_240",nNn="_toneMuted_ym3d2_253",Ri={panel:j6n,header:N6n,summary:M6n,headerActions:P6n,headerButton:L6n,iconButton:D6n,error:O6n,tableWrap:$6n,placeholder:B6n,scroll:F6n,olderBar:z6n,olderNotice:q6n,toneError:H6n,virtualBody:U6n,virtualRow:W6n,turnHeader:V6n,turnTitle:G6n,turnSummary:K6n,record:Y6n,nestMarker:X6n,selected:Z6n,badge:Q6n,text:J6n,faint:eNn,metrics:tNn,toneMuted:nNn},vye=34;function wye(e){return e>=999950?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function sNn(e){return`${wye(e.inputTokens)} → ${wye(e.outputTokens)}`}const rNn=/-call_[A-Za-z0-9]+$/;function oNn(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(rNn,"")}function O3(e){const t=e.trim(),n=t.indexOf(`
|
|
2339
|
-
`);return n===-1?t:t.slice(0,n)}function iNn(e,t){if(e.kind==="request"){const n=[Yl(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:Yl(e.timing.ttftMs)})),e.usage&&n.push(sNn(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(Yl(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:Yl(o)}))}return n}return[]}function yye(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Ri.toneError;if(t==="cancelled")return Ri.toneMuted}function aDe(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:O3(e.block.text)};case"request":{const n=oNn(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:Ri.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:O3(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...yye(e)?{badgeTone:yye(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return aNn(e.block,t)}}function aNn(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:O3(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:O3(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:Ri.toneError}:{},text:O3(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Ri.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function lNn(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function cNn({loadPage:e}){const{t}=mt(),{trajectory:n,status:s,error:r,loadedPages:o,truncated:i,olderFailure:l,refresh:c}=i6n(e),[u,h]=d.useState(void 0),f=d.useRef(null),p=d.useRef(!1),m=d.useRef(0),g=d.useId(),v=d.useCallback(Q=>`${g}-row-${Q}`,[g]),y=d.useCallback((Q,ee)=>{Q.scrollTop=ee,m.current=Q.scrollTop},[]),[w,b]=d.useState("active"),x=d.useMemo(()=>n?l6n(n,{mode:w}):void 0,[n,w]),[k,C]=d.useState(void 0),T=k!==void 0&&k.of===n&&k.mode===w?k.range:void 0,I=d.useCallback(Q=>{C(Q!==void 0&&n!==void 0?{range:Q,of:n,mode:w}:void 0)},[n,w]),j=d.useMemo(()=>T&&x?oDe(x,T):void 0,[T,x]),S=d.useMemo(()=>{if(!n)return[];const Q=new Map(n.rows.map(he=>[he.key,he])),ee=[];for(const he of n.turns){if(j&&!he.rowKeys.some(K=>j.has(K)))continue;const F=he.userRowKey??`ordinal:${he.index}`;ee.push({kind:"turn",key:`turn:${F}`,turn:he});for(const K of he.rowKeys){if(j&&!j.has(K)&&K!==he.userRowKey)continue;const V=Q.get(K);V&&ee.push({kind:"row",key:K,row:V})}}return ee},[n,j]),R=WEe({count:S.length,getScrollElement:()=>f.current,getItemKey:Q=>S[Q]?.key??Q,estimateSize:()=>vye,overscan:12}),E=S.length>0;d.useLayoutEffect(()=>{const Q=f.current;if(!Q||typeof ResizeObserver>"u")return;let ee=0;const he=()=>{Q.scrollTop===0&&m.current>0&&(Q.scrollTop=m.current)},F=new ResizeObserver(()=>{he(),ee=requestAnimationFrame(he)});return F.observe(Q),()=>{F.disconnect(),ee!==0&&cancelAnimationFrame(ee)}},[E]),d.useEffect(()=>{if(s!=="ready"||p.current||S.length===0)return;p.current=!0;const Q=f.current;Q&&y(Q,Q.scrollHeight)},[y,s,S.length]);const N=d.useMemo(()=>u===void 0?-1:S.findIndex(Q=>Q.key===u),[u,S]),A=d.useCallback(Q=>{if(S.length===0)return;const ee=Math.min(Math.max(Q,0),S.length-1);h(S[ee].key),R.scrollToIndex(ee,{align:"auto"})},[R,S]),M=d.useCallback(Q=>{h(Q),f.current?.focus({preventScroll:!0})},[]),L=d.useCallback(Q=>{if(Q.key==="Escape"){T!==void 0&&(Q.preventDefault(),I(void 0));return}if(S.length===0)return;const ee=N<0?-1:N;Q.key==="ArrowDown"?(Q.preventDefault(),A(ee+1)):Q.key==="ArrowUp"?(Q.preventDefault(),A(ee<=0?0:ee-1)):Q.key==="Home"?(Q.preventDefault(),A(0)):Q.key==="End"&&(Q.preventDefault(),A(S.length-1))},[A,T,N,I,S]),B=d.useMemo(()=>{if(!n)return;let Q=0,ee=0,he=0;for(const F of n.turns)Q+=F.requestCount,ee+=F.toolCount,he+=F.requestMs;return{turns:n.turns.length,requests:Q,tools:ee,durationMs:he}},[n]),D=s==="ready"&&S.length===0,W=n!==void 0&&n.rows.length>0&&!lNn(n),q=d.useMemo(()=>{if(!(!T||!n))return{shown:S.filter(Q=>Q.kind==="row").length,total:n.rows.length}},[T,n,S]),P=l===void 0?void 0:l.kind==="partial"?t("trajectory.olderPartial"):t("trajectory.olderFailed",{message:l.message}),H=d.useRef(void 0),te=d.useCallback(Q=>{const ee=S.findIndex(he=>he.key===Q);if(ee<0){if(T===void 0)return;H.current=Q,I(void 0),M(Q);return}M(Q),R.scrollToIndex(ee,{align:"auto"})},[T,M,I,R,S]);d.useLayoutEffect(()=>{const Q=H.current;if(Q===void 0)return;H.current=void 0;const ee=S.findIndex(he=>he.key===Q);ee>=0&&R.scrollToIndex(ee,{align:"auto"})},[R,S]);const z=d.useCallback(Q=>{const ee=[aDe(Q.row,t).text];return ee.push(Yl(Q.end-Q.start)),Q.ttftEnd!==void 0&&ee.push(t("trajectory.ttft",{duration:Yl(Q.ttftEnd-Q.start)})),ee.filter(Boolean).join(" · ")},[t]);return a.jsxs("div",{className:Ri.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Ri.header,children:[a.jsx("div",{className:Ri.summary,children:q?a.jsx("span",{"data-testid":"trajectory-range-status",role:"status",children:t("trajectory.range.status",q)}):B?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:B.turns,requests:B.requests,tools:B.tools,duration:B.durationMs>0?Yl(B.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsxs("div",{className:Ri.headerActions,children:[T!==void 0&&a.jsx("button",{type:"button",className:Ri.iconButton,onClick:()=>I(void 0),title:t("trajectory.range.clear"),"aria-label":t("trajectory.range.clear"),"data-testid":"trajectory-range-clear",children:a.jsx(Ap,{size:14,strokeWidth:1.6})}),a.jsx("button",{type:"button",className:Ri.iconButton,onClick:c,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(fh,{size:14,strokeWidth:1.6})})]})]}),a.jsx(A6n,{model:x,...W?{notice:t("trajectory.noTiming")}:{},selectedKey:u,onSelect:te,describe:z,...T!==void 0?{range:T}:{},onRangeChange:I,onModeChange:b}),r!==void 0&&a.jsxs("div",{className:Ri.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:Ri.headerButton,onClick:c,disabled:s==="loading",children:t("common.retry")})]}),a.jsx("div",{className:Ri.tableWrap,children:S.length===0?s==="error"?null:T!==void 0?a.jsxs("div",{className:Ri.placeholder,"data-testid":"trajectory-range-empty",children:[a.jsx("span",{children:t("trajectory.range.empty")})," ",a.jsx("button",{type:"button",className:Ri.headerButton,onClick:()=>I(void 0),children:t("trajectory.range.clear")})]}):a.jsx("div",{className:Ri.placeholder,role:"status",children:D?t("trajectory.empty"):o>0?t("trajectory.loadingPages",{pages:o}):t("common.loading")}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Ri.olderBar,role:"status","data-testid":"trajectory-older-bar",children:l!==void 0?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`${Ri.olderNotice} ${Ri.toneError}`,"data-testid":"trajectory-older-failed",title:P,children:P}),a.jsx("button",{type:"button",className:Ri.headerButton,onClick:()=>{s!=="loading"&&c()},"aria-disabled":s==="loading"?!0:void 0,"data-testid":"trajectory-older-retry",children:t("common.retry")})]}):i?a.jsx("span",{className:Ri.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")}):null}),a.jsx("div",{ref:f,className:Ri.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":S.length,"aria-activedescendant":N>=0?v(N):void 0,onKeyDown:L,onScroll:Q=>{m.current=Q.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Ri.virtualBody,style:{height:`${R.getTotalSize()}px`},children:R.getVirtualItems().map(Q=>{const ee=S[Q.index];return a.jsx("div",{id:v(Q.index),className:Ri.virtualRow,style:{height:`${vye}px`,transform:`translateY(${Q.start}px)`},role:"row","aria-rowindex":Q.index+1,children:ee.kind==="turn"?a.jsx(uNn,{turn:ee.turn,selected:ee.key===u,onSelect:()=>M(ee.key)}):a.jsx(dNn,{row:ee.row,selected:ee.key===u,onSelect:()=>M(ee.key)})},Q.key)})})})]})})]})}function uNn({turn:e,selected:t,onSelect:n}){const{t:s}=mt();return a.jsxs("div",{className:`${Ri.turnHeader} ${t?Ri.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Ri.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Ri.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?Yl(e.requestMs):"—"})})]})}function dNn({row:e,selected:t,onSelect:n}){const{t:s}=mt(),r=aDe(e,s),o=iNn(e,s);return a.jsxs("div",{className:`${Ri.record} ${t?Ri.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(Aat,{size:12,strokeWidth:1.6,className:Ri.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Ri.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Ri.text} ${r.faint?Ri.faint:""}`,children:r.text}),a.jsx("span",{className:Ri.metrics,"data-testid":"trajectory-row-metrics",children:o.length>0?o.join(" · "):"—"})]})}const hNn="_panel_pwtdr_1",fNn="_toolbar_pwtdr_5",pNn="_actions_pwtdr_15",mNn="_feedback_pwtdr_21",gNn="_state_pwtdr_31",lw={panel:hNn,toolbar:fNn,actions:pNn,feedback:mNn,state:gNn};function vNn({sessionActions:e,sessionId:t,controls:n}){const{t:s}=mt(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),p=d.useRef(null),m=n?.sessionId===t?n:void 0,g=m?.getContextUsage??e?.getContextUsage,v=d.useRef(m);v.current=m;const y=m?.result,[w,b]=d.useState(y),x=!!(y&&y!==w&&(y.kind!=="completed"||!c));d.useEffect(()=>{y?.kind==="completed"&&(h.current++,o(y.usage),u(!1))},[y]),d.useEffect(()=>{let T=!0,I=!1;const j=v.current?.result;o(R=>R?.sessionId===t?R:j?.kind==="completed"?j.usage:null),u(!1),l(!!g);const S=async()=>{if(!T||I||!g)return;I=!0,l(!0),u(!1);const R=h.current,E=p.current,N=E&&E.getContextUsage===g&&E.sessionId===t?E:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=N;try{const A=await N.promise;if(!T||R!==h.current)return;o(A.sessionId===t&&A.usage.contextWindowSize>0?A:null)}catch(A){if(!T||R!==h.current)return;u(QQ(A)?"transient":"hard")}finally{I=!1,p.current===N&&(p.current=null),T&&l(!1)}};return f.current=()=>void S(),S(),()=>{T=!1}},[g,t]);const k=!g||i||m?.compressing,C=()=>{b(y),f.current()};return a.jsxs("div",{className:lw.panel,"aria-busy":i,children:[a.jsxs("div",{className:lw.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:lw.actions,children:[a.jsx(vt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:k,onClick:C,children:a.jsx(fh,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(vt,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||i,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(F9e,{controls:m,className:lw.feedback}),c==="transient"&&r&&a.jsx("div",{className:lw.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:lw.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(vt,{type:"button",variant:"outline",size:"sm",disabled:k,onClick:C,children:s("contextUsage.retry")})]}):g?i&&!r?a.jsx("div",{className:lw.state,role:"status",children:s("common.loading")}):r?a.jsx(QAe,{status:r,compact:!0}):a.jsx("div",{className:lw.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:lw.state,children:s("contextUsage.unavailable")})]})}const wNn=700,yNn=["daily","weekdays","weekly","hourly","minutes","custom"],bNn=[1,2,3,4,5,6,10,12,15,20,30],xNn=(e,t)=>{},kNn=(e,t,n)=>{},_Nn=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function bye(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function cw(e){return e.kind==="pending"?e.targetKind:e.kind}function SNn(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const CNn=["review","sideTask"];function xye({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:o,panelWidth:i,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onSelectTurnCallsPrompt:p,onCloseTab:m,onOpenFilePreview:g,latestReviewAvailable:v=!1,onOpenLatestReview:y,onOpenTerminal:w,onOpenTrajectory:b,trajectoryTabId:x,onOpenWebPreview:k,onWebPreviewChange:C,items:T=CNn,sideTaskAvailable:I=!1,sideTasks:j=[],sideTasksLoading:S=!1,onCreateSideTask:R,onOpenSideTask:E,onCreateSideTaskSession:N,onSideTaskCreated:A,onSideTaskTitleChange:M,onSideTaskInitialPromptRefused:L,onNestedRightPanelOpen:B,onNestedArtifactsChange:D,onOpenNestedSubagent:W,agentTasks:q=[],agentTraceLoading:P=!1,agentTraceError:H,onOpenWorkflowAgent:te,onError:z,sessionWorkflowEnabled:Q,modelManagement:ee,workflow:he,onImageIngestionNotice:F,deferSubagentMount:K=!1,onClose:V,variant:$="docked",fullscreen:Z=!1,onToggleFullscreen:ne}){const{t:ae}=mt(),[Y,de]=d.useState(!1),[fe,pe]=d.useState(),ve=d.useRef(null),xe=d.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),de(!0)},[]),Ne=d.useCallback(()=>{ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{de(!1),ve.current=null},120)},[]);d.useEffect(()=>()=>{ve.current&&clearTimeout(ve.current)},[]);const Re=n.find(_e=>_e.id===s)??n[0],je=Re?.kind==="file"&&Re.sourcePreview&&(/\.html?$/i.test(Re.workspacePath)||uy(Re.previewMimeType||Re.previewData?.type)==="text/html"),et=Re?.kind==="file"&&Re.previewOnly===!0&&!je&&/\.(?:html?|md|markdown)$/i.test(Re.workspacePath)&&(Re.previewContent!==void 0||!Re.previewData||!!rI(Re.previewMimeType||Re.previewData.type,Re.workspacePath)),Ye=fe===Re?.id,le=T.includes("review")&&!n.some(_e=>cw(_e)==="review"),G=T.includes("sideTask")&&I&&!!R,ce=!!w,be=T.includes("webPreview")&&!!k,se=T.includes("trajectory")&&!!b&&!n.some(_e=>_e.id===x),Ie=!!Re&&(le||G||ce||be||se),me=Re&&bye(Re)?{workspaceCwd:Re.workspaceCwd,workspaceId:Re.workspaceId}:void 0,Se=DI(me?.workspaceCwd),we=Se?.workspaceId===me?.workspaceId?Se?.actions:void 0,Ee=Re?.kind==="artifact"?t.find(_e=>_e.id===Re.artifactId):void 0;return a.jsxs("aside",{className:`${ct.panel} ${$==="drawer"?ct.panelDrawer:""} ${Z?ct.panelFullscreen:""}`,style:$==="docked"&&i&&!Z?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:ct.header,children:[n.length>0&&a.jsx("div",{className:ct.tabs,role:"tablist","aria-label":"Right panel",children:n.map(_e=>a.jsxs("div",{className:[ct.tabItem,_e.id===Re?.id?ct.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":_e.id===Re?.id,className:ct.tab,onClick:()=>f(_e.id),onMouseEnter:Qe=>oT(Qe.currentTarget),onFocus:Qe=>oT(Qe.currentTarget),title:_e.kind==="turn_calls"?ae("turnCalls.title"):_e.title,children:[a.jsx("span",{className:`${ct.tabIcon} ${cw(_e)==="artifact"?ct.tabArtifactIcon:""}`,"aria-hidden":"true",children:cw(_e)==="review"?a.jsx(rW,{}):_e.kind==="workflow"?a.jsx(dEe,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="file"?a.jsx($g,{name:_e.workspacePath,className:ct.tabIconSvg,strokeWidth:1.6}):cw(_e)==="artifact"?a.jsx(OEe,{artifact:t.find(Qe=>"artifactId"in _e&&Qe.id===_e.artifactId),className:ct.tabIconSvg}):cw(_e)==="subagent"?a.jsx(TNn,{}):cw(_e)==="monitor"?a.jsx(yEe,{className:ct.tabIconSvg,strokeWidth:1.6}):cw(_e)==="shell"?a.jsx(C2,{className:ct.tabIconSvg,strokeWidth:1.6}):cw(_e)==="side_task"?a.jsx(DN,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="web_preview"?a.jsx(Z2,{className:ct.tabIconSvg}):_e.kind==="terminal"?a.jsx(C2,{className:ct.tabIconSvg,strokeWidth:1.6}):cw(_e)==="image"?a.jsx(Mlt,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="context_usage"?a.jsx(gO,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="token_usage"?a.jsx(aee,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="turn_calls"?a.jsx(w5,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="trajectory"?a.jsx(sq,{className:ct.tabIconSvg,strokeWidth:1.6}):a.jsx(ENn,{})}),a.jsx("span",{className:ct.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:ct.tabTitleInner,children:_e.kind==="turn_calls"?ae("turnCalls.title"):_e.title})})]}),a.jsx("button",{type:"button",className:ct.tabCloseButton,onClick:()=>m(_e.id),"aria-label":`Close ${_e.kind==="turn_calls"?ae("turnCalls.title"):_e.title}`,title:"Close",children:a.jsx(INn,{})})]},_e.id))}),a.jsxs("div",{className:ct.headerActions,children:[Ie&&a.jsxs(Ym,{modal:!1,children:[a.jsx(Bp,{asChild:!0,children:a.jsx("button",{type:"button",className:`${ct.iconButton} ${ct.addButton}`,"aria-label":ae("rightPanel.add"),title:ae("rightPanel.add"),children:a.jsx(Bd,{className:ct.toolbarIcon})})}),a.jsxs(Fp,{align:"end",className:"w-64",children:[le&&a.jsxs(Eo,{disabled:!v||!y,onSelect:y,children:[a.jsx(rW,{}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("turnOutputs.review")})]}),le&&G&&a.jsx(Zw,{}),G&&a.jsxs(Eo,{disabled:S,onSelect:R,children:[a.jsx(DN,{className:ct.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("sideTask.create")})]}),ce&&(le||G)&&a.jsx(Zw,{}),ce&&a.jsxs(Eo,{onSelect:()=>w?.(),children:[a.jsx(C2,{className:ct.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("terminal.title")})]}),be&&a.jsxs(Eo,{onSelect:k,children:[a.jsx(Z2,{className:ct.sideTaskNewIcon}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("webPreview.title")})]}),se&&a.jsxs(Eo,{onSelect:()=>b?.(),children:[a.jsx(sq,{className:ct.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("trajectory.title")})]})]})]}),ne&&a.jsx("button",{type:"button",className:`${ct.iconButton} ${ct.fullscreenButton} ${Z?ct.iconButtonActive:""}`,onClick:ne,"aria-label":ae(Z?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":Z,title:ae(Z?"common.exitFullscreen":"common.fullscreen"),children:Z?a.jsx(cee,{className:ct.toolbarIcon,"aria-hidden":!0}):a.jsx(oee,{className:ct.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${ct.iconButton} ${ct.panelToggleButton}`,onClick:V,"aria-label":ae("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:ae("chatHeader.toggleRightPanel"),children:a.jsx(hEe,{className:ct.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${ct.body} ${Re?.kind==="side_task"?ct.bodySideTask:""}`.trim(),children:[n.filter(_e=>_e.kind==="web_preview").map(_e=>a.jsx("div",{className:"h-full",hidden:_e.id!==Re?.id,children:a.jsx(ujn,{state:_e,onChange:Qe=>C?.(_e.id,Qe)})},_e.id)),n.filter(_e=>_e.kind==="terminal").map(_e=>a.jsx("div",{className:`${ct.terminalPane} ${_e.id===Re?.id?"":ct.terminalPaneHidden}`.trim(),"aria-hidden":_e.id===Re?.id?void 0:!0,children:a.jsx(cjn,{terminalId:_e.id,cwd:_e.workspaceCwd??l,active:_e.id===Re?.id,enabled:_e.initialized!==!1})},_e.id)),et&&a.jsxs("button",{type:"button",className:ct.attachmentPreviewButton,onClick:()=>pe(Ye?void 0:Re?.id),"aria-label":ae(Ye?"attachment.showSource":"attachment.showPreview"),"aria-pressed":Ye,children:[Ye?a.jsx(_at,{"aria-hidden":!0}):a.jsx(tEe,{"aria-hidden":!0}),ae(Ye?"attachment.showSource":"attachment.showPreview")]}),u&&!Re?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":ae("common.loading"),children:[a.jsx(Q0,{className:"h-5 w-2/5"}),a.jsx(Q0,{className:"h-32 w-full"}),a.jsx(Q0,{className:"h-4 w-4/5"}),a.jsx(Q0,{className:"h-4 w-3/5"})]}):Re?.kind==="terminal"||Re?.kind==="web_preview"?null:Re?Re.kind==="pending"?a.jsx("div",{className:ct.empty,role:Re.loadError?"alert":"status",children:Re.loadError??ae("common.loading")}):Re.kind==="workflow"?Re.sessionId?a.jsx(lRn,{tasks:q,loading:P,error:H,onOpenAgent:te}):he?a.jsx(WRn,{...he}):a.jsx("div",{className:ct.empty,children:ae("workflow.empty.title")}):bye(Re)&&(Re.kind!=="scheduled_task"||Re.task.durable)&&(Re.kind!=="file"||!Re.previewOnly)&&(Re.kind!=="artifact"||Ee?.metadata?.artifactType!=="web_preview_snapshot")&&!we?a.jsx("div",{className:ct.empty,role:"alert",children:ae("workspace.notFoundDescription")}):Re.kind==="review"?a.jsx(jNn,{changes:Re.changes??r,selectedPath:Re.selectedPath??o,workspaceCwd:Re.workspaceCwd??l,onOpenFilePreview:_e=>g(_e,Re.workspaceCwd??l,Re.workspaceId),onDownloadFile:(_e,Qe)=>bO(we,_e.path,Ndt(_e.path),Qe),onDownloadError:_e=>{const Qe=ae("common.downloadFailed",{message:il(_e)});z?z(new Error(Qe,{cause:_e}),Qe):console.error(Qe,_e)}}):Re.kind==="file"?Re.attachmentId&&!Re.previewData&&Re.previewContent===void 0?a.jsx("div",{className:ct.empty,role:Re.loadError?"alert":"status",children:Re.loadError??ae("common.loading")}):Re.sourcePreview&&Re.previewData&&uy(Re.previewMimeType||Re.previewData.type)!=="application/pdf"&&!rI(Re.previewMimeType||Re.previewData.type,Re.workspacePath)?a.jsx(hDe,{data:Re.previewData,title:Re.title,image:!!U1(Re.workspacePath)&&Re.previewData.type.startsWith("image/")}):a.jsx(P$,{workspacePath:Re.workspacePath,artifactVersion:String(Re.previewVersion??0),workspaceActions:we,previewContent:Re.previewContent,previewData:Re.previewData,previewMimeType:Re.previewMimeType,previewOnly:Re.previewOnly,previewKind:je||Re.previewOnly&&!Ye?"source":void 0},Re.id):Re.kind==="source"?a.jsx(KNn,{tab:Re},Re.id):Re.kind==="artifact"?a.jsx(RNn,{artifacts:t,artifactId:Re.artifactId,sourceSessionId:Re.sourceSessionId,workspaceActions:we,previewContent:Re.previewContent,loading:c,error:h},Re.id):Re.kind==="subagent"?K?null:a.jsx(UEn,{sessionId:Re.sessionId,rootToolCallId:Re.rootToolCallId,initialRootTool:Re.rootTool,workspaceCwd:Re.workspaceCwd??l,onRightPanelOpen:B,onArtifactsChange:D,onOpenSubagent:W,onError:z}):Re.kind==="monitor"?a.jsx(ENt,{task:Re.task,actions:Re.sessionActions},Re.id):Re.kind==="shell"?a.jsx(RNt,{task:Re.task,actions:Re.sessionActions},Re.id):Re.kind==="side_task"?a.jsx(uRn,{tabId:Re.id,sessionId:Re.sessionId,parentSessionId:Re.parentSessionId,workspaceCwd:Re.workspaceCwd??l,title:Re.title,shouldNameFromFirstPrompt:Re.nameFromFirstPrompt,initialPrompt:Re.initialPrompt,createSession:N??_Nn,onCreated:A??xNn,onTitleChange:M??kNn,onInitialPromptRefused:L,onRightPanelOpen:B,onArtifactsChange:D,onError:z,sessionWorkflowEnabled:Q,modelManagement:ee,onImageIngestionNotice:F},Re.id):Re.kind==="image"?Re.src?a.jsxs("div",{className:ct.imagePreviewWrap,children:[a.jsx("img",{src:Re.src,alt:Re.alt??Re.title,className:ct.imagePreview}),a.jsx("a",{className:ct.imageDownloadButton,href:Re.src,download:SNn(Re.src),"aria-label":ae("common.download"),title:ae("common.download"),children:a.jsx(Uw,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:ct.empty,role:Re.loadError?"alert":"status",children:Re.loadError??ae("common.loading")}):Re.kind==="context_usage"?a.jsx(vNn,{controls:e?.[Re.sessionId],sessionActions:Re.sessionActions,sessionId:Re.sessionId},Re.id):Re.kind==="trajectory"?a.jsx(cNn,{loadPage:Re.loadPage},Re.id):Re.kind==="token_usage"?a.jsx(Zjn,{sessionActions:Re.sessionActions,sessionId:Re.sessionId},Re.id):Re.kind==="turn_calls"?a.jsx(j2n,{turnId:Re.turnId,ownerSessionId:Re.sessionId,recordId:Re.recordId,promptId:Re.promptId,promptLabel:Re.promptLabel,onSelectPrompt:p,workspaceCwd:l,onOpenFile:B,onOpenAgent:W},`${Re.sessionId}:${l}`):a.jsx(ANn,{task:Re.task,actions:we},Re.id):a.jsxs("div",{className:ct.emptyActions,"data-testid":"right-panel-empty-actions",children:[T.includes("review")&&a.jsxs("button",{type:"button",className:ct.emptyAction,disabled:!v||!y,onClick:y,children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(rW,{})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("turnOutputs.review")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("turnOutputs.reviewLatest")}),a.jsx(Ja,{className:ct.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),T.includes("sideTask")&&I&&R&&(j.length===0?a.jsxs("button",{type:"button",className:ct.emptyAction,disabled:S,"aria-busy":S,onClick:R,children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(DN,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("sideTask.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("sideTask.description")}),a.jsx(Ja,{className:ct.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Ym,{open:Y,onOpenChange:de,modal:!1,children:[a.jsx(Bp,{asChild:!0,children:a.jsxs("button",{type:"button",className:ct.emptyAction,"aria-expanded":Y,onMouseEnter:xe,onMouseLeave:Ne,children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(DN,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("sideTask.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("sideTask.description")}),a.jsx(Ja,{className:ct.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Fp,{align:"end",className:"w-80",onMouseEnter:xe,onMouseLeave:Ne,children:[j.map(_e=>a.jsxs(Eo,{onSelect:()=>E?.(_e),children:[a.jsx("span",{className:ct.sideTaskListTitle,children:_e.title}),_e.updatedAt&&a.jsx("span",{className:ct.sideTaskListTime,children:oI(_e.updatedAt,ae)})]},_e.sessionId)),a.jsx(Zw,{}),a.jsxs(Eo,{onSelect:R,children:[a.jsx(fat,{className:ct.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("sideTask.new")})]})]})]})),be&&a.jsxs("button",{type:"button",className:ct.emptyAction,onClick:k,children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Z2,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("webPreview.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("webPreview.openHint")}),a.jsx(Ja,{className:ct.emptyActionChevron,"aria-hidden":"true"})]}),se&&a.jsxs("button",{type:"button",className:ct.emptyAction,onClick:()=>b?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(sq,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("trajectory.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("trajectory.description")}),a.jsx(Ja,{className:ct.emptyActionChevron,"aria-hidden":"true"})]}),w&&a.jsxs("button",{type:"button",className:ct.emptyAction,onClick:()=>w(),children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(C2,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("terminal.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("terminal.open")}),a.jsx(Ja,{className:ct.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function TNn(){return a.jsxs("svg",{className:ct.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 INn(){return a.jsx("svg",{className:ct.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 rW(){return a.jsxs("svg",{className:ct.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 ENn(){return a.jsxs("svg",{className:ct.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 RNn({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:o,error:i}){const l=e.find(c=>c.id===t);return l?a.jsx(qNn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:ct.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:ct.empty,children:i}):a.jsx("div",{className:ct.empty,children:"Artifact not found."})}function ANn({task:e,actions:t}){const{t:n}=mt(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>Db(e.cron)),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[C,T]=d.useState(!1),[I,j]=d.useState(null),S=d.useRef(0),R=d.useRef(0),E=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});E.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=d.useCallback(($,Z,ne,ae)=>{const Y=E.current;return $===S.current&&Y.actions===Z&&Y.taskId===ne&&Y.workspaceId===ae},[]),A=d.useCallback(($,Z,ne,ae)=>{const Y=E.current;return $===R.current&&Y.actions===Z&&Y.taskId===ne&&Y.workspaceId===ae},[]);d.useEffect(()=>()=>{S.current+=1,R.current+=1},[]),d.useEffect(()=>{k(!1),T(!1),j(null)},[t,e.id,e.workspaceId]);const M=d.useCallback(async()=>{const $=++S.current,Z=++R.current,ne=e.id,ae=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(Db(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const Y=await t.listScheduledTasks(ae);if(!N($,t,ne,ae))return;const de=Y.find(fe=>fe.id===e.id)??null;r(de),de?(h(de.name??""),p(de.prompt),g(Db(de.cron))):(h(""),p(e.prompt),g(Db(e.cron)))}catch(Y){A(Z,t,ne,ae)&&c(Y instanceof Error?Y.message:String(Y))}finally{A(Z,t,ne,ae)&&i(!1)}},[t,A,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{M()},[M]);const L=!e.durable,B=e.durable&&!o&&!l&&!s,D=!!s,W=s?.name||s?.prompt||e.title,q=s?.prompt??e.prompt,P=s?.cron??e.cron,H=s?.recurring??e.recurring,te=s?.enabled,z=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(Db(s.cron)),j(null),y(!0))},[s]),Q=d.useCallback(()=>{y(!1),j(null),s&&(h(s.name??""),p(s.prompt),g(Db(s.cron)))},[s]),ee=d.useCallback(async()=>{if(!s||!t)return;const $=rP(m);if(!$){j(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){j(n("scheduledTasks.error.emptyPrompt"));return}const Z=++S.current,ne=e.id,ae=e.workspaceId;T(!0),j(null);try{const Y=await t.updateScheduledTask(s.id,{cron:$,prompt:f.trim(),name:u.trim()||null},ae);if(!N(Z,t,ne,ae))return;r(Y),h(Y.name??""),p(Y.prompt),g(Db(Y.cron)),y(!1)}catch(Y){N(Z,t,ne,ae)&&j(Y instanceof Error?Y.message:String(Y))}finally{N(Z,t,ne,ae)&&T(!1)}},[t,m,N,s,u,f,n,e.id,e.workspaceId]),he=d.useCallback(async()=>{if(!s||!t)return;const $=++S.current,Z=e.id,ne=e.workspaceId;k(!0),j(null);try{const ae=await t.updateScheduledTask(s.id,{enabled:!s.enabled},ne);if(!N($,t,Z,ne))return;r(ae)}catch(ae){N($,t,Z,ne)&&j(ae instanceof Error?ae.message:String(ae))}finally{N($,t,Z,ne)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),F=d.useCallback(async()=>{if(!s||!t)return;const $=++S.current,Z=e.id,ne=e.workspaceId;k(!0),j(null);try{if(await t.deleteScheduledTask(s.id,ne),!N($,t,Z,ne))return;r(null),b(!1)}catch(ae){N($,t,Z,ne)&&j(ae instanceof Error?ae.message:String(ae))}finally{N($,t,Z,ne)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),K=rP(m),V=K?OT(K,n):null;return a.jsxs("div",{className:ct.detail,children:[o&&a.jsx("div",{className:ct.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Jt.loadError,children:l}),B&&a.jsx("div",{className:ct.empty,children:n("scheduledTasks.deletedSnapshot")}),L&&a.jsx("div",{className:ct.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!B&&a.jsx("div",{className:ct.section,children:a.jsxs("div",{className:ct.fieldGrid,children:[a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:ct.fieldValue,children:W}),a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:ct.fieldValue,children:e.id}),a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:ct.fieldValue,children:OT(P,n)}),a.jsx("span",{className:ct.fieldLabel,children:"Cron"}),a.jsx("span",{className:ct.fieldValue,children:P}),a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:ct.fieldValue,children:n(H?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),te!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:ct.fieldValue,children:n(te?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!B&&a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:"Prompt"}),a.jsx("div",{className:ct.description,children:q})]}),I&&a.jsx("div",{className:Jt.formError,children:I}),a.jsxs("div",{className:ct.actionsRow,children:[a.jsx("button",{type:"button",className:Jt.primaryButton,disabled:!D||x,onClick:z,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Jt.secondaryButton,disabled:!D||x,onClick:()=>void he(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Jt.secondaryButton,disabled:!D||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(ca,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:a.jsxs("div",{className:Jt.formFields,children:[a.jsx("div",{className:ct.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),I&&a.jsx("div",{className:Jt.formError,children:I}),a.jsxs("div",{className:Jt.formActions,children:[a.jsx("button",{type:"button",className:Jt.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Jt.primaryButton,onClick:()=>void F(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(ca,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:a.jsxs("div",{className:Jt.formFields,children:[a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Jt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:$=>h($.target.value)})]}),a.jsxs("label",{className:Jt.field,children:[a.jsxs("span",{className:Jt.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Jt.required,children:"*"})]}),a.jsx("textarea",{className:Jt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:$=>p($.target.value)})]}),a.jsxs("div",{className:Jt.scheduleRow,children:[a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Jt.select,value:m.frequency,onChange:$=>{const Z=$.target.value;g(ne=>({...ne,frequency:Z,...Z==="hourly"?{time:"00:00"}:{}}))},children:yNn.map($=>a.jsx("option",{value:$,children:n(`scheduledTasks.freq.${$}`)},$))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Jt.input,type:"time",value:m.time,onChange:$=>g(Z=>({...Z,time:$.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Jt.select,value:m.weekday,onChange:$=>g(Z=>({...Z,weekday:Number($.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map(($,Z)=>a.jsx("option",{value:Z,children:$},Z))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Jt.select,value:m.minuteInterval,onChange:$=>g(Z=>({...Z,minuteInterval:Number($.target.value)})),children:bNn.map($=>a.jsx("option",{value:$,children:$},$))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Jt.field} ${Jt.fieldGrow}`,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Jt.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:$=>g(Z=>({...Z,customCron:$.target.value}))})]})]}),a.jsx("div",{className:Jt.preview,children:V?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Jt.previewLabel,children:V}),a.jsx("code",{className:Jt.previewCron,children:K})]}):a.jsx("span",{className:Jt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),I&&a.jsx("div",{className:Jt.formError,children:I}),a.jsxs("div",{className:Jt.formActions,children:[a.jsx("button",{type:"button",className:Jt.secondaryButton,onClick:Q,disabled:C,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Jt.primaryButton,onClick:()=>void ee(),disabled:C,children:n(C?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function jNn({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=mt(),[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,C]=d.useState(()=>new Set),T=d.useRef(!0);d.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const I=l,j=d.useMemo(()=>zNn(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const A=y.current;if(!A)return;const M=()=>{p(A.clientWidth<wNn)};M();const L=new ResizeObserver(M);return L.observe(A),()=>L.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const S=d.useCallback(A=>{const M=y.current;if(!M)return;A.preventDefault();const L=A.currentTarget;L.setPointerCapture(A.pointerId);const B=A.clientX,D=v.current,W=M.getBoundingClientRect().width,q=Math.max(180,W-180),P=document.body.style.cursor,H=document.body.style.userSelect;let te=D,z=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Q=()=>{z=null,g(te)},ee=K=>{te=Math.min(q,Math.max(180,D+(K.clientX-B))),z===null&&(z=window.requestAnimationFrame(Q))};let he=()=>{};const F=K=>{w.current=null,z!==null&&(window.cancelAnimationFrame(z),z=null),K&&g(te),L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.cursor=P,document.body.style.userSelect=H,window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he)};he=()=>F(!0),w.current=()=>F(!1),window.addEventListener("pointermove",ee),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he)},[]);if(e.length===0)return a.jsx("div",{className:ct.empty,children:"No file changes to review."});const R=nNe(e),E=A=>{x(M=>M===A?null:A)},N=async A=>{if(!k.has(A.path)){C(M=>new Set(M).add(A.path));try{await r(A,()=>!T.current)}catch(M){T.current&&o(M)}finally{C(M=>{const L=new Set(M);return L.delete(A.path),L})}}};return a.jsxs("div",{className:ct.review,children:[a.jsxs("div",{className:ct.reviewToolbar,children:[a.jsxs("div",{className:ct.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(KP,{additions:R?.additions,deletions:R?.deletions,className:ct.lineStats,additionsClassName:ct.additions,deletionsClassName:ct.deletions})]}),a.jsxs("div",{className:ct.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:ct.reviewTotalsButton,onClick:()=>h(A=>!A),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[ct.chevron,u?ct.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(_ye,{})})]}),a.jsx("button",{type:"button",className:[ct.iconButton,l?ct.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(A=>!A),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(BNn,{}):a.jsx($Nn,{})})]})]}),u&&a.jsxs("div",{ref:y,className:[ct.reviewContent,I?"":ct.reviewContentListOnly,I&&f?ct.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[ct.reviewList,b?ct.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(A=>{const M=b===A.path,L=oNe(A.path),B=Dzt(A.path);return a.jsxs("div",{className:[ct.reviewItem,M?ct.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:ct.reviewRow,"data-selected":A.path===t||void 0,children:[a.jsx("button",{type:"button",className:ct.reviewRowToggle,onClick:()=>E(A.path),"aria-label":A.path,"aria-expanded":M}),a.jsx("span",{className:ct.fileIcon,children:dDe(A.path)}),a.jsxs("span",{className:ct.reviewFileName,children:[a.jsx(LNn,{path:r$(A.path,n),title:A.path}),L&&a.jsx("button",{type:"button",className:ct.reviewOpenButton,onClick:()=>s(A),title:`${i("turnOutputs.preview")} ${A.path}`,children:i("turnOutputs.preview")}),B&&a.jsx("button",{type:"button",className:ct.reviewOpenButton,onClick:()=>void N(A),title:`${i("common.download")} ${A.path}`,disabled:k.has(A.path),children:i(k.has(A.path)?"common.downloading":"common.download")})]}),a.jsx(KP,{additions:A.additions,deletions:A.deletions,className:ct.lineStats,additionsClassName:ct.additions,deletionsClassName:ct.deletions}),a.jsx("span",{className:[ct.chevron,M?ct.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(_ye,{})})]}),M&&a.jsx(NNn,{change:A})]},`${A.toolCallId}:${A.path}`)})}),I&&!f&&a.jsx("div",{className:ct.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:S}),I&&a.jsx("div",{className:ct.tree,children:j.children.map(A=>a.jsx(lDe,{node:A,depth:0,selectedPath:t},A.path))})]})]})}function NNn({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:ct.diffEmpty,children:"No diff available."});const t=MNn(e.diffs);return a.jsx("div",{className:ct.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(ZO,{diff:n.fileDiff},s):a.jsx(PNn,{oldText:n.oldText,newText:n.newText},s))})}function MNn(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function PNn({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[o,i]=d.useState(null);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),d.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),i(null);let c=!1,u=null;const h=[Y7e,gs.editable.of(!1),$i.readOnly.of(!0),gs.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return Ze(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-B5zIMd3G.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 gs({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||i(v instanceof Error?v.message:String(v))}}).catch(m=>{c||i(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:ct.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:ct.codeMirrorDiff}),o&&a.jsxs("div",{className:ct.diffError,children:["Diff unavailable: ",o]})]})}function lDe({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[ct.treeRow,s?ct.treeFile:ct.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:ct.treeTwisty,children:!s&&a.jsx("span",{className:[ct.treeChevron,r?"":ct.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(FNn,{})})}),a.jsxs("span",{className:ct.treeContent,children:[s&&a.jsx("span",{className:ct.fileIcon,children:dDe(e.path)}),a.jsx("span",{className:ct.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:ct.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:ct.treeNode,children:[s?a.jsx("div",{className:i,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:i,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>o(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:ct.treeChildren,style:c,children:e.children.map(h=>a.jsx(lDe,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function LNn({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>cDe(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(DNn(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:ct.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:ct.pathPrefix,children:s.prefix}),a.jsx("span",{className:ct.pathFileName,children:s.leaf})]})}function cDe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let kye=null;function DNn(e,t){const n=cDe(e),s=t.clientWidth;if(s<=0)return n;const r=ONn(t);if(r(e)<=s)return n;const o=e.split("/").filter(Boolean),i=o.at(-1)??e,l=r(i);if(o.length<=1||l+r(".../")>s)return{prefix:"",leaf:i};let c=".../";for(let u=1;u<o.length;u++){const f=`.../${o.slice(o.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:i}}function ONn(e){kye??=document.createElement("canvas");const t=kye.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 $Nn(){return a.jsxs("svg",{className:ct.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 BNn(){return a.jsxs("svg",{className:ct.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 _ye(){return a.jsx("svg",{className:ct.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 FNn(){return a.jsx("svg",{className:ct.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 zNn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=r$(s.path,t).split("/").filter(Boolean);let o=n;for(let i=0;i<r.length;i++){const l=r[i],c=r.slice(0,i+1).join("/");let u=o.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},o.children.push(u)),i===r.length-1&&(u.file=s),o=u}}return uDe(n),n}function uDe(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)uDe(t)}function H7(e){return dy(e).split("/").filter(Boolean).at(-1)??e}function dDe(e){const t=H7(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 qNn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=mt(),o=Vf(),i=MEe(e),l=NI(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=NEe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(djn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(HNn,{status:e.status}):!h||!e.workspacePath?a.jsx(UNn,{}):a.jsx(IEn,{workspacePath:e.workspacePath,artifactVersion:Que(e),workspaceActions:n}):h&&e.workspacePath?AEe(e)?a.jsx(GNn,{artifact:e,workspaceActions:n}):a.jsx(P$,{workspacePath:e.workspacePath,artifactVersion:Que(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:WNn(e)?"html":VNn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:ct.detail,children:[a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:ct.fieldGrid,children:[a.jsx(_f,{label:"Type",value:hee(e.kind,e.workspacePath)}),a.jsx(_f,{label:"Storage",value:e.storage}),a.jsx(_f,{label:"Status",value:e.status}),a.jsx(_f,{label:"Source",value:e.source}),a.jsx(_f,{label:"Size",value:yO(e.sizeBytes)}),a.jsx(_f,{label:"Created",value:e.createdAt}),a.jsx(_f,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(_f,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(_f,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:"Description"}),a.jsx("div",{className:ct.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:"Details"}),a.jsxs("div",{className:ct.fieldGrid,children:[$C(e.metadata,"automationId","Automation ID"),$C(e.metadata,"schedule","Schedule"),$C(e.metadata,"timezone","Timezone"),$C(e.metadata,"status","Status"),$C(e.metadata,"nextRunAt","Next run"),$C(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:ct.locationRow,children:[a.jsx("a",{className:ct.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:l}),a.jsx("a",{className:ct.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:ct.meta,children:i})]})]})}function HNn({status:e}){const{t}=mt();return a.jsx("div",{className:ct.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function UNn(){const{t:e}=mt();return a.jsx("div",{className:ct.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function WNn(e){const t=e.workspacePath?.toLowerCase()??"",n=uy(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function VNn(e){const t=e.workspacePath?.toLowerCase()??"",n=uy(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function GNn({artifact:e,workspaceActions:t}){const{t:n}=mt(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=MEe(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await bO(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&i(!1)}}};return a.jsx("div",{className:ct.detail,children:a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:ct.fieldGrid,children:[a.jsx(_f,{label:"Type",value:hee(e.kind,e.workspacePath)}),a.jsx(_f,{label:"Size",value:yO(e.sizeBytes)}),c?a.jsx(_f,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(_f,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:ct.downloadRow,children:a.jsx("button",{type:"button",className:ct.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:ct.previewError,children:s})]})})}function KNn({tab:e}){const{t}=mt(),n=da(),s=DI(e.workspaceCwd),r=s?.actions,o=Vf(),[i,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 I=Uint8Array.from(atob(T.data),j=>j.charCodeAt(0));u(new Blob([I],{type:T.mimeType}))}else if(b&&r){const T=await _I(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(il(T))}),()=>{k=!0})},[i,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}),NI(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>o(k,v.url),children:t("sources.openOriginal")})]});if(!y||!s&&v.type!=="attachment")return a.jsx("div",{className:ct.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!b&&AEe({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(vt,{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(Uw,{})})}),h&&a.jsx(vt,{variant:"ghost",size:"sm",onClick:()=>l(k=>k+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:ct.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(vt,{onClick:()=>void bO(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(k=>{e.owner.isCurrent()&&f(il(k))}),children:t("common.download")})]}):(v.type==="attachment"||b)&&!c?a.jsx("div",{className:ct.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!rI(c.type,w)?a.jsx(hDe,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!U1(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(P$,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||uy(c?.type)==="text/html"?"source":void 0},i)})]})}function hDe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[o,i]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return i(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),o?a.jsxs("div",{className:ct.imagePreviewWrap,children:[n?a.jsx("img",{className:ct.imagePreview,src:o,alt:t}):a.jsx(fDe,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(Uw,{})})]}):null}function P$({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:o,previewMimeType:i,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h}){if(o)return a.jsx(YNn,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const f=e.toLowerCase(),p=l??U1(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(JNn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="markdown"?a.jsx(tMn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="image"&&p?a.jsx(QNn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:p,onLoadError:h}):a.jsx(pDe,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function YNn({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:o}){const i=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return i==="application/pdf"?a.jsx(ZNn,{data:n,mimeType:i,title:e}):rI(i,e)?a.jsx(XNn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(fDe,{name:e,mimeType:i,size:n.size})}function XNn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=mt(),[i,l]=d.useState(),[c,u]=d.useState();return d.useEffect(()=>{const h=new FileReader;return l(void 0),u(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=o("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,o]),c?a.jsx("div",{className:ct.previewError,children:c}):i===void 0?a.jsx("div",{className:ct.empty,children:o("attachment.loadingFile")}):a.jsx(P$,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function ZNn({data:e,mimeType:t,title:n}){const{t:s}=mt(),[r,o]=d.useState();return d.useEffect(()=>{const i=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return o(i),()=>URL.revokeObjectURL(i)},[e,t]),r?a.jsx("iframe",{className:ct.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:ct.empty,children:s("attachment.loadingPreview")})}function fDe({name:e,mimeType:t,size:n}){const{t:s}=mt();return a.jsxs("div",{className:ct.unsupportedAttachmentPreview,children:[a.jsx($g,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:ct.unsupportedAttachmentMeta,children:[t," · ",yO(n)]})]})}function QNn({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[o,i]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return i(null),c(null),_I((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:ct.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:ct.imagePreview,src:o,alt:H7(e)}),a.jsx("a",{className:ct.imageDownloadButton,href:o,download:H7(e),"aria-label":`Download ${H7(e)}`,title:"Download",children:a.jsx(Uw,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:ct.empty,children:"Loading image..."}),l&&a.jsx("div",{className:ct.previewError,children:l})]})}function Hse({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o}){const[i,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 _I((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),o?.(g)}),()=>{p=!0}},[t,s,r,o,n,e]),{content:i,error:h,sizeBytes:c}}function JNn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=Hse({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:ct.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:ct.empty,children:"Loading preview..."}):a.jsx(mDe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(eMn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:ct.previewError,children:c})]})}function eMn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=mt(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),Mdt(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(il(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:ct.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:ct.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:ct.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function pDe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o}){const i=d.useRef(null),[l,c]=d.useState(null),{content:u,error:h}=Hse({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o});return d.useEffect(()=>{const f=i.current;if(!f||u===null)return;f.replaceChildren(),c(null);let p;try{p=new gs({doc:u,extensions:[Y7e,gs.editable.of(!1),$i.readOnly.of(!0),gs.lineWrapping],parent:f})}catch(m){c(m instanceof Error?m.message:String(m));return}return()=>p.destroy()},[u]),a.jsxs("div",{className:ct.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:ct.empty,children:"Loading file..."}):a.jsx("div",{ref:i,className:ct.codeMirrorFile}),(h||l)&&a.jsx("div",{className:ct.previewError,children:h||l})]})}function mDe({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=mt(),[i,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=i===e;return a.jsxs("div",{className:"absolute inset-3 flex min-h-0 flex-col gap-2",children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[a.jsx("span",{children:o("artifact.longDocument")}),a.jsx(vt,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:o(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(pDe,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function tMn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=Hse({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:ct.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:ct.empty,children:"Loading preview..."}):a.jsx(mDe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:ct.markdownPreviewWrap,children:a.jsx(Bf,{content:l})})}),c&&a.jsx("div",{className:ct.previewError,children:c})]})}function _f({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ct.fieldLabel,children:e}),a.jsx("span",{className:ct.fieldValue,children:t})]}):null}function $C(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(_f,{label:n,value:String(s)},t)}/**
|
|
2339
|
+
`);return n===-1?t:t.slice(0,n)}function iNn(e,t){if(e.kind==="request"){const n=[Yl(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:Yl(e.timing.ttftMs)})),e.usage&&n.push(sNn(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(Yl(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:Yl(o)}))}return n}return[]}function yye(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Ri.toneError;if(t==="cancelled")return Ri.toneMuted}function aDe(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:O3(e.block.text)};case"request":{const n=oNn(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:Ri.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:O3(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...yye(e)?{badgeTone:yye(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return aNn(e.block,t)}}function aNn(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:O3(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:O3(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:Ri.toneError}:{},text:O3(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Ri.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function lNn(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function cNn({loadPage:e}){const{t}=mt(),{trajectory:n,status:s,error:r,loadedPages:o,truncated:i,olderFailure:l,refresh:c}=i6n(e),[u,h]=d.useState(void 0),f=d.useRef(null),p=d.useRef(!1),m=d.useRef(0),g=d.useId(),v=d.useCallback(Q=>`${g}-row-${Q}`,[g]),y=d.useCallback((Q,ee)=>{Q.scrollTop=ee,m.current=Q.scrollTop},[]),[w,b]=d.useState("active"),x=d.useMemo(()=>n?l6n(n,{mode:w}):void 0,[n,w]),[k,C]=d.useState(void 0),T=k!==void 0&&k.of===n&&k.mode===w?k.range:void 0,I=d.useCallback(Q=>{C(Q!==void 0&&n!==void 0?{range:Q,of:n,mode:w}:void 0)},[n,w]),j=d.useMemo(()=>T&&x?oDe(x,T):void 0,[T,x]),S=d.useMemo(()=>{if(!n)return[];const Q=new Map(n.rows.map(he=>[he.key,he])),ee=[];for(const he of n.turns){if(j&&!he.rowKeys.some(K=>j.has(K)))continue;const F=he.userRowKey??`ordinal:${he.index}`;ee.push({kind:"turn",key:`turn:${F}`,turn:he});for(const K of he.rowKeys){if(j&&!j.has(K)&&K!==he.userRowKey)continue;const V=Q.get(K);V&&ee.push({kind:"row",key:K,row:V})}}return ee},[n,j]),R=WEe({count:S.length,getScrollElement:()=>f.current,getItemKey:Q=>S[Q]?.key??Q,estimateSize:()=>vye,overscan:12}),E=S.length>0;d.useLayoutEffect(()=>{const Q=f.current;if(!Q||typeof ResizeObserver>"u")return;let ee=0;const he=()=>{Q.scrollTop===0&&m.current>0&&(Q.scrollTop=m.current)},F=new ResizeObserver(()=>{he(),ee=requestAnimationFrame(he)});return F.observe(Q),()=>{F.disconnect(),ee!==0&&cancelAnimationFrame(ee)}},[E]),d.useEffect(()=>{if(s!=="ready"||p.current||S.length===0)return;p.current=!0;const Q=f.current;Q&&y(Q,Q.scrollHeight)},[y,s,S.length]);const N=d.useMemo(()=>u===void 0?-1:S.findIndex(Q=>Q.key===u),[u,S]),A=d.useCallback(Q=>{if(S.length===0)return;const ee=Math.min(Math.max(Q,0),S.length-1);h(S[ee].key),R.scrollToIndex(ee,{align:"auto"})},[R,S]),M=d.useCallback(Q=>{h(Q),f.current?.focus({preventScroll:!0})},[]),L=d.useCallback(Q=>{if(Q.key==="Escape"){T!==void 0&&(Q.preventDefault(),I(void 0));return}if(S.length===0)return;const ee=N<0?-1:N;Q.key==="ArrowDown"?(Q.preventDefault(),A(ee+1)):Q.key==="ArrowUp"?(Q.preventDefault(),A(ee<=0?0:ee-1)):Q.key==="Home"?(Q.preventDefault(),A(0)):Q.key==="End"&&(Q.preventDefault(),A(S.length-1))},[A,T,N,I,S]),B=d.useMemo(()=>{if(!n)return;let Q=0,ee=0,he=0;for(const F of n.turns)Q+=F.requestCount,ee+=F.toolCount,he+=F.requestMs;return{turns:n.turns.length,requests:Q,tools:ee,durationMs:he}},[n]),D=s==="ready"&&S.length===0,W=n!==void 0&&n.rows.length>0&&!lNn(n),q=d.useMemo(()=>{if(!(!T||!n))return{shown:S.filter(Q=>Q.kind==="row").length,total:n.rows.length}},[T,n,S]),P=l===void 0?void 0:l.kind==="partial"?t("trajectory.olderPartial"):t("trajectory.olderFailed",{message:l.message}),H=d.useRef(void 0),te=d.useCallback(Q=>{const ee=S.findIndex(he=>he.key===Q);if(ee<0){if(T===void 0)return;H.current=Q,I(void 0),M(Q);return}M(Q),R.scrollToIndex(ee,{align:"auto"})},[T,M,I,R,S]);d.useLayoutEffect(()=>{const Q=H.current;if(Q===void 0)return;H.current=void 0;const ee=S.findIndex(he=>he.key===Q);ee>=0&&R.scrollToIndex(ee,{align:"auto"})},[R,S]);const z=d.useCallback(Q=>{const ee=[aDe(Q.row,t).text];return ee.push(Yl(Q.end-Q.start)),Q.ttftEnd!==void 0&&ee.push(t("trajectory.ttft",{duration:Yl(Q.ttftEnd-Q.start)})),ee.filter(Boolean).join(" · ")},[t]);return a.jsxs("div",{className:Ri.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Ri.header,children:[a.jsx("div",{className:Ri.summary,children:q?a.jsx("span",{"data-testid":"trajectory-range-status",role:"status",children:t("trajectory.range.status",q)}):B?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:B.turns,requests:B.requests,tools:B.tools,duration:B.durationMs>0?Yl(B.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsxs("div",{className:Ri.headerActions,children:[T!==void 0&&a.jsx("button",{type:"button",className:Ri.iconButton,onClick:()=>I(void 0),title:t("trajectory.range.clear"),"aria-label":t("trajectory.range.clear"),"data-testid":"trajectory-range-clear",children:a.jsx(Ap,{size:14,strokeWidth:1.6})}),a.jsx("button",{type:"button",className:Ri.iconButton,onClick:c,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(fh,{size:14,strokeWidth:1.6})})]})]}),a.jsx(A6n,{model:x,...W?{notice:t("trajectory.noTiming")}:{},selectedKey:u,onSelect:te,describe:z,...T!==void 0?{range:T}:{},onRangeChange:I,onModeChange:b}),r!==void 0&&a.jsxs("div",{className:Ri.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:Ri.headerButton,onClick:c,disabled:s==="loading",children:t("common.retry")})]}),a.jsx("div",{className:Ri.tableWrap,children:S.length===0?s==="error"?null:T!==void 0?a.jsxs("div",{className:Ri.placeholder,"data-testid":"trajectory-range-empty",children:[a.jsx("span",{children:t("trajectory.range.empty")})," ",a.jsx("button",{type:"button",className:Ri.headerButton,onClick:()=>I(void 0),children:t("trajectory.range.clear")})]}):a.jsx("div",{className:Ri.placeholder,role:"status",children:D?t("trajectory.empty"):o>0?t("trajectory.loadingPages",{pages:o}):t("common.loading")}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:Ri.olderBar,role:"status","data-testid":"trajectory-older-bar",children:l!==void 0?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`${Ri.olderNotice} ${Ri.toneError}`,"data-testid":"trajectory-older-failed",title:P,children:P}),a.jsx("button",{type:"button",className:Ri.headerButton,onClick:()=>{s!=="loading"&&c()},"aria-disabled":s==="loading"?!0:void 0,"data-testid":"trajectory-older-retry",children:t("common.retry")})]}):i?a.jsx("span",{className:Ri.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")}):null}),a.jsx("div",{ref:f,className:Ri.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":S.length,"aria-activedescendant":N>=0?v(N):void 0,onKeyDown:L,onScroll:Q=>{m.current=Q.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Ri.virtualBody,style:{height:`${R.getTotalSize()}px`},children:R.getVirtualItems().map(Q=>{const ee=S[Q.index];return a.jsx("div",{id:v(Q.index),className:Ri.virtualRow,style:{height:`${vye}px`,transform:`translateY(${Q.start}px)`},role:"row","aria-rowindex":Q.index+1,children:ee.kind==="turn"?a.jsx(uNn,{turn:ee.turn,selected:ee.key===u,onSelect:()=>M(ee.key)}):a.jsx(dNn,{row:ee.row,selected:ee.key===u,onSelect:()=>M(ee.key)})},Q.key)})})})]})})]})}function uNn({turn:e,selected:t,onSelect:n}){const{t:s}=mt();return a.jsxs("div",{className:`${Ri.turnHeader} ${t?Ri.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Ri.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Ri.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?Yl(e.requestMs):"—"})})]})}function dNn({row:e,selected:t,onSelect:n}){const{t:s}=mt(),r=aDe(e,s),o=iNn(e,s);return a.jsxs("div",{className:`${Ri.record} ${t?Ri.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(Aat,{size:12,strokeWidth:1.6,className:Ri.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Ri.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Ri.text} ${r.faint?Ri.faint:""}`,children:r.text}),a.jsx("span",{className:Ri.metrics,"data-testid":"trajectory-row-metrics",children:o.length>0?o.join(" · "):"—"})]})}const hNn="_panel_pwtdr_1",fNn="_toolbar_pwtdr_5",pNn="_actions_pwtdr_15",mNn="_feedback_pwtdr_21",gNn="_state_pwtdr_31",lw={panel:hNn,toolbar:fNn,actions:pNn,feedback:mNn,state:gNn};function vNn({sessionActions:e,sessionId:t,controls:n}){const{t:s}=mt(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),p=d.useRef(null),m=n?.sessionId===t?n:void 0,g=m?.getContextUsage??e?.getContextUsage,v=d.useRef(m);v.current=m;const y=m?.result,[w,b]=d.useState(y),x=!!(y&&y!==w&&(y.kind!=="completed"||!c));d.useEffect(()=>{y?.kind==="completed"&&(h.current++,o(y.usage),u(!1))},[y]),d.useEffect(()=>{let T=!0,I=!1;const j=v.current?.result;o(R=>R?.sessionId===t?R:j?.kind==="completed"?j.usage:null),u(!1),l(!!g);const S=async()=>{if(!T||I||!g)return;I=!0,l(!0),u(!1);const R=h.current,E=p.current,N=E&&E.getContextUsage===g&&E.sessionId===t?E:{getContextUsage:g,sessionId:t,promise:g({detail:!0,silent:!0,...v.current?.result?{syncCounters:!0}:{}})};p.current=N;try{const A=await N.promise;if(!T||R!==h.current)return;o(A.sessionId===t&&A.usage.contextWindowSize>0?A:null)}catch(A){if(!T||R!==h.current)return;u(QQ(A)?"transient":"hard")}finally{I=!1,p.current===N&&(p.current=null),T&&l(!1)}};return f.current=()=>void S(),S(),()=>{T=!1}},[g,t]);const k=!g||i||m?.compressing,C=()=>{b(y),f.current()};return a.jsxs("div",{className:lw.panel,"aria-busy":i,children:[a.jsxs("div",{className:lw.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:lw.actions,children:[a.jsx(vt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:k,onClick:C,children:a.jsx(fh,{"aria-hidden":"true"})}),a.jsx("span",{title:m?.compressing?void 0:m?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(vt,{type:"button",variant:"outline",size:"sm",disabled:!m?.canCompress||i,onClick:()=>void m?.compress(),children:s(m?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(m?.compressing||x)&&a.jsx(F9e,{controls:m,className:lw.feedback}),c==="transient"&&r&&a.jsx("div",{className:lw.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:lw.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(vt,{type:"button",variant:"outline",size:"sm",disabled:k,onClick:C,children:s("contextUsage.retry")})]}):g?i&&!r?a.jsx("div",{className:lw.state,role:"status",children:s("common.loading")}):r?a.jsx(QAe,{status:r,compact:!0}):a.jsx("div",{className:lw.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:lw.state,children:s("contextUsage.unavailable")})]})}const wNn=700,yNn=["daily","weekdays","weekly","hourly","minutes","custom"],bNn=[1,2,3,4,5,6,10,12,15,20,30],xNn=(e,t)=>{},kNn=(e,t,n)=>{},_Nn=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function bye(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function cw(e){return e.kind==="pending"?e.targetKind:e.kind}function SNn(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const CNn=["review","sideTask"];function xye({contextUsageControls:e,artifacts:t,tabs:n,activeTabId:s,reviewChanges:r,selectedReviewPath:o,panelWidth:i,workspaceCwd:l,loading:c,restoring:u=!1,error:h,onSelectTab:f,onSelectTurnCallsPrompt:p,onCloseTab:m,onOpenFilePreview:g,latestReviewAvailable:v=!1,onOpenLatestReview:y,onOpenTerminal:w,onOpenTrajectory:b,trajectoryTabId:x,onOpenWebPreview:k,onWebPreviewChange:C,items:T=CNn,sideTaskAvailable:I=!1,sideTasks:j=[],sideTasksLoading:S=!1,onCreateSideTask:R,onOpenSideTask:E,onCreateSideTaskSession:N,onSideTaskCreated:A,onSideTaskTitleChange:M,onSideTaskInitialPromptRefused:L,onNestedRightPanelOpen:B,onNestedArtifactsChange:D,onOpenNestedSubagent:W,agentTasks:q=[],agentTraceLoading:P=!1,agentTraceError:H,onOpenWorkflowAgent:te,onError:z,sessionWorkflowEnabled:Q,modelManagement:ee,workflow:he,onImageIngestionNotice:F,deferSubagentMount:K=!1,onClose:V,variant:$="docked",fullscreen:Z=!1,onToggleFullscreen:ne}){const{t:ae}=mt(),[Y,de]=d.useState(!1),[fe,pe]=d.useState(),ve=d.useRef(null),xe=d.useCallback(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null),de(!0)},[]),Ne=d.useCallback(()=>{ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{de(!1),ve.current=null},120)},[]);d.useEffect(()=>()=>{ve.current&&clearTimeout(ve.current)},[]);const Re=n.find(_e=>_e.id===s)??n[0],je=Re?.kind==="file"&&Re.sourcePreview&&(/\.html?$/i.test(Re.workspacePath)||uy(Re.previewMimeType||Re.previewData?.type)==="text/html"),et=Re?.kind==="file"&&Re.previewOnly===!0&&!je&&/\.(?:html?|md|markdown)$/i.test(Re.workspacePath)&&(Re.previewContent!==void 0||!Re.previewData||!!rI(Re.previewMimeType||Re.previewData.type,Re.workspacePath)),Ye=fe===Re?.id,le=T.includes("review")&&!n.some(_e=>cw(_e)==="review"),G=T.includes("sideTask")&&I&&!!R,ce=!!w,be=T.includes("webPreview")&&!!k,se=T.includes("trajectory")&&!!b&&!n.some(_e=>_e.id===x),Ie=!!Re&&(le||G||ce||be||se),me=Re&&bye(Re)?{workspaceCwd:Re.workspaceCwd,workspaceId:Re.workspaceId}:void 0,Se=DI(me?.workspaceCwd),we=Se?.workspaceId===me?.workspaceId?Se?.actions:void 0,Ee=Re?.kind==="artifact"?t.find(_e=>_e.id===Re.artifactId):void 0;return a.jsxs("aside",{className:`${ct.panel} ${$==="drawer"?ct.panelDrawer:""} ${Z?ct.panelFullscreen:""}`,style:$==="docked"&&i&&!Z?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:ct.header,children:[n.length>0&&a.jsx("div",{className:ct.tabs,role:"tablist","aria-label":"Right panel",children:n.map(_e=>a.jsxs("div",{className:[ct.tabItem,_e.id===Re?.id?ct.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":_e.id===Re?.id,className:ct.tab,onClick:()=>f(_e.id),onMouseEnter:Qe=>oT(Qe.currentTarget),onFocus:Qe=>oT(Qe.currentTarget),title:_e.kind==="turn_calls"?ae("turnCalls.title"):_e.title,children:[a.jsx("span",{className:`${ct.tabIcon} ${cw(_e)==="artifact"?ct.tabArtifactIcon:""}`,"aria-hidden":"true",children:cw(_e)==="review"?a.jsx(rW,{}):_e.kind==="workflow"?a.jsx(dEe,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="file"?a.jsx($g,{name:_e.workspacePath,className:ct.tabIconSvg,strokeWidth:1.6}):cw(_e)==="artifact"?a.jsx(OEe,{artifact:t.find(Qe=>"artifactId"in _e&&Qe.id===_e.artifactId),className:ct.tabIconSvg}):cw(_e)==="subagent"?a.jsx(TNn,{}):cw(_e)==="monitor"?a.jsx(yEe,{className:ct.tabIconSvg,strokeWidth:1.6}):cw(_e)==="shell"?a.jsx(C2,{className:ct.tabIconSvg,strokeWidth:1.6}):cw(_e)==="side_task"?a.jsx(DN,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="web_preview"?a.jsx(Z2,{className:ct.tabIconSvg}):_e.kind==="terminal"?a.jsx(C2,{className:ct.tabIconSvg,strokeWidth:1.6}):cw(_e)==="image"?a.jsx(Mlt,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="context_usage"?a.jsx(gO,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="token_usage"?a.jsx(aee,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="turn_calls"?a.jsx(w5,{className:ct.tabIconSvg,strokeWidth:1.6}):_e.kind==="trajectory"?a.jsx(sq,{className:ct.tabIconSvg,strokeWidth:1.6}):a.jsx(ENn,{})}),a.jsx("span",{className:ct.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:ct.tabTitleInner,children:_e.kind==="turn_calls"?ae("turnCalls.title"):_e.title})})]}),a.jsx("button",{type:"button",className:ct.tabCloseButton,onClick:()=>m(_e.id),"aria-label":`Close ${_e.kind==="turn_calls"?ae("turnCalls.title"):_e.title}`,title:"Close",children:a.jsx(INn,{})})]},_e.id))}),a.jsxs("div",{className:ct.headerActions,children:[Ie&&a.jsxs(Ym,{modal:!1,children:[a.jsx(Bp,{asChild:!0,children:a.jsx("button",{type:"button",className:`${ct.iconButton} ${ct.addButton}`,"aria-label":ae("rightPanel.add"),title:ae("rightPanel.add"),children:a.jsx(Bd,{className:ct.toolbarIcon})})}),a.jsxs(Fp,{align:"end",className:"w-64",children:[le&&a.jsxs(Eo,{disabled:!v||!y,onSelect:y,children:[a.jsx(rW,{}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("turnOutputs.review")})]}),le&&G&&a.jsx(Zw,{}),G&&a.jsxs(Eo,{disabled:S,onSelect:R,children:[a.jsx(DN,{className:ct.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("sideTask.create")})]}),ce&&(le||G)&&a.jsx(Zw,{}),ce&&a.jsxs(Eo,{onSelect:()=>w?.(),children:[a.jsx(C2,{className:ct.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("terminal.title")})]}),be&&a.jsxs(Eo,{onSelect:k,children:[a.jsx(Z2,{className:ct.sideTaskNewIcon}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("webPreview.title")})]}),se&&a.jsxs(Eo,{onSelect:()=>b?.(),children:[a.jsx(sq,{className:ct.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("trajectory.title")})]})]})]}),ne&&a.jsx("button",{type:"button",className:`${ct.iconButton} ${ct.fullscreenButton} ${Z?ct.iconButtonActive:""}`,onClick:ne,"aria-label":ae(Z?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":Z,title:ae(Z?"common.exitFullscreen":"common.fullscreen"),children:Z?a.jsx(cee,{className:ct.toolbarIcon,"aria-hidden":!0}):a.jsx(oee,{className:ct.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${ct.iconButton} ${ct.panelToggleButton}`,onClick:V,"aria-label":ae("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:ae("chatHeader.toggleRightPanel"),children:a.jsx(hEe,{className:ct.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${ct.body} ${Re?.kind==="side_task"?ct.bodySideTask:""}`.trim(),children:[n.filter(_e=>_e.kind==="web_preview").map(_e=>a.jsx("div",{className:"h-full",hidden:_e.id!==Re?.id,children:a.jsx(ujn,{state:_e,onChange:Qe=>C?.(_e.id,Qe)})},_e.id)),n.filter(_e=>_e.kind==="terminal").map(_e=>a.jsx("div",{className:`${ct.terminalPane} ${_e.id===Re?.id?"":ct.terminalPaneHidden}`.trim(),"aria-hidden":_e.id===Re?.id?void 0:!0,children:a.jsx(cjn,{terminalId:_e.id,cwd:_e.workspaceCwd??l,active:_e.id===Re?.id,enabled:_e.initialized!==!1})},_e.id)),et&&a.jsxs("button",{type:"button",className:ct.attachmentPreviewButton,onClick:()=>pe(Ye?void 0:Re?.id),"aria-label":ae(Ye?"attachment.showSource":"attachment.showPreview"),"aria-pressed":Ye,children:[Ye?a.jsx(_at,{"aria-hidden":!0}):a.jsx(tEe,{"aria-hidden":!0}),ae(Ye?"attachment.showSource":"attachment.showPreview")]}),u&&!Re?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":ae("common.loading"),children:[a.jsx(Q0,{className:"h-5 w-2/5"}),a.jsx(Q0,{className:"h-32 w-full"}),a.jsx(Q0,{className:"h-4 w-4/5"}),a.jsx(Q0,{className:"h-4 w-3/5"})]}):Re?.kind==="terminal"||Re?.kind==="web_preview"?null:Re?Re.kind==="pending"?a.jsx("div",{className:ct.empty,role:Re.loadError?"alert":"status",children:Re.loadError??ae("common.loading")}):Re.kind==="workflow"?Re.sessionId?a.jsx(lRn,{tasks:q,loading:P,error:H,onOpenAgent:te}):he?a.jsx(WRn,{...he}):a.jsx("div",{className:ct.empty,children:ae("workflow.empty.title")}):bye(Re)&&(Re.kind!=="scheduled_task"||Re.task.durable)&&(Re.kind!=="file"||!Re.previewOnly)&&(Re.kind!=="artifact"||Ee?.metadata?.artifactType!=="web_preview_snapshot")&&!we?a.jsx("div",{className:ct.empty,role:"alert",children:ae("workspace.notFoundDescription")}):Re.kind==="review"?a.jsx(jNn,{changes:Re.changes??r,selectedPath:Re.selectedPath??o,workspaceCwd:Re.workspaceCwd??l,onOpenFilePreview:_e=>g(_e,Re.workspaceCwd??l,Re.workspaceId),onDownloadFile:(_e,Qe)=>bO(we,_e.path,Ndt(_e.path),Qe),onDownloadError:_e=>{const Qe=ae("common.downloadFailed",{message:il(_e)});z?z(new Error(Qe,{cause:_e}),Qe):console.error(Qe,_e)}}):Re.kind==="file"?Re.attachmentId&&!Re.previewData&&Re.previewContent===void 0?a.jsx("div",{className:ct.empty,role:Re.loadError?"alert":"status",children:Re.loadError??ae("common.loading")}):Re.sourcePreview&&Re.previewData&&uy(Re.previewMimeType||Re.previewData.type)!=="application/pdf"&&!rI(Re.previewMimeType||Re.previewData.type,Re.workspacePath)?a.jsx(hDe,{data:Re.previewData,title:Re.title,image:!!U1(Re.workspacePath)&&Re.previewData.type.startsWith("image/")}):a.jsx(P$,{workspacePath:Re.workspacePath,artifactVersion:String(Re.previewVersion??0),workspaceActions:we,previewContent:Re.previewContent,previewData:Re.previewData,previewMimeType:Re.previewMimeType,previewOnly:Re.previewOnly,previewKind:je||Re.previewOnly&&!Ye?"source":void 0},Re.id):Re.kind==="source"?a.jsx(KNn,{tab:Re},Re.id):Re.kind==="artifact"?a.jsx(RNn,{artifacts:t,artifactId:Re.artifactId,sourceSessionId:Re.sourceSessionId,workspaceActions:we,previewContent:Re.previewContent,loading:c,error:h},Re.id):Re.kind==="subagent"?K?null:a.jsx(UEn,{sessionId:Re.sessionId,rootToolCallId:Re.rootToolCallId,initialRootTool:Re.rootTool,workspaceCwd:Re.workspaceCwd??l,onRightPanelOpen:B,onArtifactsChange:D,onOpenSubagent:W,onError:z}):Re.kind==="monitor"?a.jsx(ENt,{task:Re.task,actions:Re.sessionActions},Re.id):Re.kind==="shell"?a.jsx(RNt,{task:Re.task,actions:Re.sessionActions},Re.id):Re.kind==="side_task"?a.jsx(uRn,{tabId:Re.id,sessionId:Re.sessionId,parentSessionId:Re.parentSessionId,workspaceCwd:Re.workspaceCwd??l,title:Re.title,shouldNameFromFirstPrompt:Re.nameFromFirstPrompt,initialPrompt:Re.initialPrompt,createSession:N??_Nn,onCreated:A??xNn,onTitleChange:M??kNn,onInitialPromptRefused:L,onRightPanelOpen:B,onArtifactsChange:D,onError:z,sessionWorkflowEnabled:Q,modelManagement:ee,onImageIngestionNotice:F},Re.id):Re.kind==="image"?Re.src?a.jsxs("div",{className:ct.imagePreviewWrap,children:[a.jsx("img",{src:Re.src,alt:Re.alt??Re.title,className:ct.imagePreview}),a.jsx("a",{className:ct.imageDownloadButton,href:Re.src,download:SNn(Re.src),"aria-label":ae("common.download"),title:ae("common.download"),children:a.jsx(Uw,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:ct.empty,role:Re.loadError?"alert":"status",children:Re.loadError??ae("common.loading")}):Re.kind==="context_usage"?a.jsx(vNn,{controls:e?.[Re.sessionId],sessionActions:Re.sessionActions,sessionId:Re.sessionId},Re.id):Re.kind==="trajectory"?a.jsx(cNn,{loadPage:Re.loadPage},Re.id):Re.kind==="token_usage"?a.jsx(Zjn,{sessionActions:Re.sessionActions,sessionId:Re.sessionId},Re.id):Re.kind==="turn_calls"?a.jsx(j2n,{turnId:Re.turnId,ownerSessionId:Re.sessionId,recordId:Re.recordId,promptId:Re.promptId,promptLabel:Re.promptLabel,onSelectPrompt:p,workspaceCwd:l,onOpenFile:B,onOpenAgent:W},`${Re.sessionId}:${l}`):a.jsx(ANn,{task:Re.task,actions:we},Re.id):a.jsxs("div",{className:ct.emptyActions,"data-testid":"right-panel-empty-actions",children:[T.includes("review")&&a.jsxs("button",{type:"button",className:ct.emptyAction,disabled:!v||!y,onClick:y,children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(rW,{})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("turnOutputs.review")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("turnOutputs.reviewLatest")}),a.jsx(Ja,{className:ct.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),T.includes("sideTask")&&I&&R&&(j.length===0?a.jsxs("button",{type:"button",className:ct.emptyAction,disabled:S,"aria-busy":S,onClick:R,children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(DN,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("sideTask.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("sideTask.description")}),a.jsx(Ja,{className:ct.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(Ym,{open:Y,onOpenChange:de,modal:!1,children:[a.jsx(Bp,{asChild:!0,children:a.jsxs("button",{type:"button",className:ct.emptyAction,"aria-expanded":Y,onMouseEnter:xe,onMouseLeave:Ne,children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(DN,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("sideTask.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("sideTask.description")}),a.jsx(Ja,{className:ct.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Fp,{align:"end",className:"w-80",onMouseEnter:xe,onMouseLeave:Ne,children:[j.map(_e=>a.jsxs(Eo,{onSelect:()=>E?.(_e),children:[a.jsx("span",{className:ct.sideTaskListTitle,children:_e.title}),_e.updatedAt&&a.jsx("span",{className:ct.sideTaskListTime,children:oI(_e.updatedAt,ae)})]},_e.sessionId)),a.jsx(Zw,{}),a.jsxs(Eo,{onSelect:R,children:[a.jsx(fat,{className:ct.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:ct.sideTaskListTitle,children:ae("sideTask.new")})]})]})]})),be&&a.jsxs("button",{type:"button",className:ct.emptyAction,onClick:k,children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Z2,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("webPreview.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("webPreview.openHint")}),a.jsx(Ja,{className:ct.emptyActionChevron,"aria-hidden":"true"})]}),se&&a.jsxs("button",{type:"button",className:ct.emptyAction,onClick:()=>b?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(sq,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("trajectory.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("trajectory.description")}),a.jsx(Ja,{className:ct.emptyActionChevron,"aria-hidden":"true"})]}),w&&a.jsxs("button",{type:"button",className:ct.emptyAction,onClick:()=>w(),children:[a.jsx("span",{className:ct.emptyActionIcon,"aria-hidden":"true",children:a.jsx(C2,{strokeWidth:1.6})}),a.jsx("span",{className:ct.emptyActionTitle,children:ae("terminal.title")}),a.jsx("span",{className:ct.emptyActionHint,children:ae("terminal.open")}),a.jsx(Ja,{className:ct.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function TNn(){return a.jsxs("svg",{className:ct.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 INn(){return a.jsx("svg",{className:ct.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 rW(){return a.jsxs("svg",{className:ct.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 ENn(){return a.jsxs("svg",{className:ct.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 RNn({artifacts:e,artifactId:t,sourceSessionId:n,workspaceActions:s,previewContent:r,loading:o,error:i}){const l=e.find(c=>c.id===t);return l?a.jsx(qNn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:ct.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:ct.empty,children:i}):a.jsx("div",{className:ct.empty,children:"Artifact not found."})}function ANn({task:e,actions:t}){const{t:n}=mt(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,p]=d.useState(e.prompt),[m,g]=d.useState(()=>Db(e.cron)),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[x,k]=d.useState(!1),[C,T]=d.useState(!1),[I,j]=d.useState(null),S=d.useRef(0),R=d.useRef(0),E=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});E.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const N=d.useCallback(($,Z,ne,ae)=>{const Y=E.current;return $===S.current&&Y.actions===Z&&Y.taskId===ne&&Y.workspaceId===ae},[]),A=d.useCallback(($,Z,ne,ae)=>{const Y=E.current;return $===R.current&&Y.actions===Z&&Y.taskId===ne&&Y.workspaceId===ae},[]);d.useEffect(()=>()=>{S.current+=1,R.current+=1},[]),d.useEffect(()=>{k(!1),T(!1),j(null)},[t,e.id,e.workspaceId]);const M=d.useCallback(async()=>{const $=++S.current,Z=++R.current,ne=e.id,ae=e.workspaceId;if(!e.durable||!t){r(null),h(""),p(e.prompt),g(Db(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const Y=await t.listScheduledTasks(ae);if(!N($,t,ne,ae))return;const de=Y.find(fe=>fe.id===e.id)??null;r(de),de?(h(de.name??""),p(de.prompt),g(Db(de.cron))):(h(""),p(e.prompt),g(Db(e.cron)))}catch(Y){A(Z,t,ne,ae)&&c(Y instanceof Error?Y.message:String(Y))}finally{A(Z,t,ne,ae)&&i(!1)}},[t,A,N,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{M()},[M]);const L=!e.durable,B=e.durable&&!o&&!l&&!s,D=!!s,W=s?.name||s?.prompt||e.title,q=s?.prompt??e.prompt,P=s?.cron??e.cron,H=s?.recurring??e.recurring,te=s?.enabled,z=d.useCallback(()=>{s&&(h(s.name??""),p(s.prompt),g(Db(s.cron)),j(null),y(!0))},[s]),Q=d.useCallback(()=>{y(!1),j(null),s&&(h(s.name??""),p(s.prompt),g(Db(s.cron)))},[s]),ee=d.useCallback(async()=>{if(!s||!t)return;const $=rP(m);if(!$){j(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){j(n("scheduledTasks.error.emptyPrompt"));return}const Z=++S.current,ne=e.id,ae=e.workspaceId;T(!0),j(null);try{const Y=await t.updateScheduledTask(s.id,{cron:$,prompt:f.trim(),name:u.trim()||null},ae);if(!N(Z,t,ne,ae))return;r(Y),h(Y.name??""),p(Y.prompt),g(Db(Y.cron)),y(!1)}catch(Y){N(Z,t,ne,ae)&&j(Y instanceof Error?Y.message:String(Y))}finally{N(Z,t,ne,ae)&&T(!1)}},[t,m,N,s,u,f,n,e.id,e.workspaceId]),he=d.useCallback(async()=>{if(!s||!t)return;const $=++S.current,Z=e.id,ne=e.workspaceId;k(!0),j(null);try{const ae=await t.updateScheduledTask(s.id,{enabled:!s.enabled},ne);if(!N($,t,Z,ne))return;r(ae)}catch(ae){N($,t,Z,ne)&&j(ae instanceof Error?ae.message:String(ae))}finally{N($,t,Z,ne)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),F=d.useCallback(async()=>{if(!s||!t)return;const $=++S.current,Z=e.id,ne=e.workspaceId;k(!0),j(null);try{if(await t.deleteScheduledTask(s.id,ne),!N($,t,Z,ne))return;r(null),b(!1)}catch(ae){N($,t,Z,ne)&&j(ae instanceof Error?ae.message:String(ae))}finally{N($,t,Z,ne)&&k(!1)}},[t,N,s,e.id,e.workspaceId]),K=rP(m),V=K?OT(K,n):null;return a.jsxs("div",{className:ct.detail,children:[o&&a.jsx("div",{className:ct.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:Jt.loadError,children:l}),B&&a.jsx("div",{className:ct.empty,children:n("scheduledTasks.deletedSnapshot")}),L&&a.jsx("div",{className:ct.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!B&&a.jsx("div",{className:ct.section,children:a.jsxs("div",{className:ct.fieldGrid,children:[a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:ct.fieldValue,children:W}),a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:ct.fieldValue,children:e.id}),a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:ct.fieldValue,children:OT(P,n)}),a.jsx("span",{className:ct.fieldLabel,children:"Cron"}),a.jsx("span",{className:ct.fieldValue,children:P}),a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:ct.fieldValue,children:n(H?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),te!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ct.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:ct.fieldValue,children:n(te?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!B&&a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:"Prompt"}),a.jsx("div",{className:ct.description,children:q})]}),I&&a.jsx("div",{className:Jt.formError,children:I}),a.jsxs("div",{className:ct.actionsRow,children:[a.jsx("button",{type:"button",className:Jt.primaryButton,disabled:!D||x,onClick:z,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:Jt.secondaryButton,disabled:!D||x,onClick:()=>void he(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:Jt.secondaryButton,disabled:!D||x,onClick:()=>b(!0),children:n("scheduledTasks.delete")})]}),w&&s&&a.jsx(ca,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>b(!1),children:a.jsxs("div",{className:Jt.formFields,children:[a.jsx("div",{className:ct.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),I&&a.jsx("div",{className:Jt.formError,children:I}),a.jsxs("div",{className:Jt.formActions,children:[a.jsx("button",{type:"button",className:Jt.secondaryButton,onClick:()=>b(!1),disabled:x,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Jt.primaryButton,onClick:()=>void F(),disabled:x,children:n("scheduledTasks.delete")})]})]})}),v&&a.jsx(ca,{title:n("scheduledTasks.editTitle"),size:"md",onClose:Q,children:a.jsxs("div",{className:Jt.formFields,children:[a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:Jt.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:$=>h($.target.value)})]}),a.jsxs("label",{className:Jt.field,children:[a.jsxs("span",{className:Jt.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:Jt.required,children:"*"})]}),a.jsx("textarea",{className:Jt.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:$=>p($.target.value)})]}),a.jsxs("div",{className:Jt.scheduleRow,children:[a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:Jt.select,value:m.frequency,onChange:$=>{const Z=$.target.value;g(ne=>({...ne,frequency:Z,...Z==="hourly"?{time:"00:00"}:{}}))},children:yNn.map($=>a.jsx("option",{value:$,children:n(`scheduledTasks.freq.${$}`)},$))})]}),(m.frequency==="daily"||m.frequency==="weekdays"||m.frequency==="weekly")&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:Jt.input,type:"time",value:m.time,onChange:$=>g(Z=>({...Z,time:$.target.value}))})]}),m.frequency==="weekly"&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:Jt.select,value:m.weekday,onChange:$=>g(Z=>({...Z,weekday:Number($.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map(($,Z)=>a.jsx("option",{value:Z,children:$},Z))})]}),m.frequency==="minutes"&&a.jsxs("label",{className:Jt.field,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:Jt.select,value:m.minuteInterval,onChange:$=>g(Z=>({...Z,minuteInterval:Number($.target.value)})),children:bNn.map($=>a.jsx("option",{value:$,children:$},$))})]}),m.frequency==="custom"&&a.jsxs("label",{className:`${Jt.field} ${Jt.fieldGrow}`,children:[a.jsx("span",{className:Jt.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:Jt.input,type:"text",value:m.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:$=>g(Z=>({...Z,customCron:$.target.value}))})]})]}),a.jsx("div",{className:Jt.preview,children:V?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:Jt.previewLabel,children:V}),a.jsx("code",{className:Jt.previewCron,children:K})]}):a.jsx("span",{className:Jt.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),I&&a.jsx("div",{className:Jt.formError,children:I}),a.jsxs("div",{className:Jt.formActions,children:[a.jsx("button",{type:"button",className:Jt.secondaryButton,onClick:Q,disabled:C,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:Jt.primaryButton,onClick:()=>void ee(),disabled:C,children:n(C?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function jNn({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=mt(),[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,C]=d.useState(()=>new Set),T=d.useRef(!0);d.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const I=l,j=d.useMemo(()=>zNn(e,n),[e,n]);d.useEffect(()=>{x(t)},[t]),d.useEffect(()=>{v.current=m},[m]),d.useEffect(()=>{const A=y.current;if(!A)return;const M=()=>{p(A.clientWidth<wNn)};M();const L=new ResizeObserver(M);return L.observe(A),()=>L.disconnect()},[u]),d.useEffect(()=>()=>w.current?.(),[]);const S=d.useCallback(A=>{const M=y.current;if(!M)return;A.preventDefault();const L=A.currentTarget;L.setPointerCapture(A.pointerId);const B=A.clientX,D=v.current,W=M.getBoundingClientRect().width,q=Math.max(180,W-180),P=document.body.style.cursor,H=document.body.style.userSelect;let te=D,z=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const Q=()=>{z=null,g(te)},ee=K=>{te=Math.min(q,Math.max(180,D+(K.clientX-B))),z===null&&(z=window.requestAnimationFrame(Q))};let he=()=>{};const F=K=>{w.current=null,z!==null&&(window.cancelAnimationFrame(z),z=null),K&&g(te),L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.cursor=P,document.body.style.userSelect=H,window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he)};he=()=>F(!0),w.current=()=>F(!1),window.addEventListener("pointermove",ee),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he)},[]);if(e.length===0)return a.jsx("div",{className:ct.empty,children:"No file changes to review."});const R=nNe(e),E=A=>{x(M=>M===A?null:A)},N=async A=>{if(!k.has(A.path)){C(M=>new Set(M).add(A.path));try{await r(A,()=>!T.current)}catch(M){T.current&&o(M)}finally{C(M=>{const L=new Set(M);return L.delete(A.path),L})}}};return a.jsxs("div",{className:ct.review,children:[a.jsxs("div",{className:ct.reviewToolbar,children:[a.jsxs("div",{className:ct.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(KP,{additions:R?.additions,deletions:R?.deletions,className:ct.lineStats,additionsClassName:ct.additions,deletionsClassName:ct.deletions})]}),a.jsxs("div",{className:ct.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:ct.reviewTotalsButton,onClick:()=>h(A=>!A),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[ct.chevron,u?ct.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(_ye,{})})]}),a.jsx("button",{type:"button",className:[ct.iconButton,l?ct.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(A=>!A),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(BNn,{}):a.jsx($Nn,{})})]})]}),u&&a.jsxs("div",{ref:y,className:[ct.reviewContent,I?"":ct.reviewContentListOnly,I&&f?ct.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${m}px`},children:[a.jsx("div",{className:[ct.reviewList,b?ct.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(A=>{const M=b===A.path,L=oNe(A.path),B=Dzt(A.path);return a.jsxs("div",{className:[ct.reviewItem,M?ct.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:ct.reviewRow,"data-selected":A.path===t||void 0,children:[a.jsx("button",{type:"button",className:ct.reviewRowToggle,onClick:()=>E(A.path),"aria-label":A.path,"aria-expanded":M}),a.jsx("span",{className:ct.fileIcon,children:dDe(A.path)}),a.jsxs("span",{className:ct.reviewFileName,children:[a.jsx(LNn,{path:r$(A.path,n),title:A.path}),L&&a.jsx("button",{type:"button",className:ct.reviewOpenButton,onClick:()=>s(A),title:`${i("turnOutputs.preview")} ${A.path}`,children:i("turnOutputs.preview")}),B&&a.jsx("button",{type:"button",className:ct.reviewOpenButton,onClick:()=>void N(A),title:`${i("common.download")} ${A.path}`,disabled:k.has(A.path),children:i(k.has(A.path)?"common.downloading":"common.download")})]}),a.jsx(KP,{additions:A.additions,deletions:A.deletions,className:ct.lineStats,additionsClassName:ct.additions,deletionsClassName:ct.deletions}),a.jsx("span",{className:[ct.chevron,M?ct.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(_ye,{})})]}),M&&a.jsx(NNn,{change:A})]},`${A.toolCallId}:${A.path}`)})}),I&&!f&&a.jsx("div",{className:ct.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:S}),I&&a.jsx("div",{className:ct.tree,children:j.children.map(A=>a.jsx(lDe,{node:A,depth:0,selectedPath:t},A.path))})]})]})}function NNn({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:ct.diffEmpty,children:"No diff available."});const t=MNn(e.diffs);return a.jsx("div",{className:ct.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(ZO,{diff:n.fileDiff},s):a.jsx(PNn,{oldText:n.oldText,newText:n.newText},s))})}function MNn(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function PNn({oldText:e,newText:t}){const n=d.useRef(null),[s,r]=d.useState(null),[o,i]=d.useState(null);return d.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>r(l.clientWidth>=720);c();const u=new ResizeObserver(c);return u.observe(l),()=>u.disconnect()},[]),d.useEffect(()=>{const l=n.current;if(!l||s===null)return;l.replaceChildren(),i(null);let c=!1,u=null;const h=[Y7e,gs.editable.of(!1),$i.readOnly.of(!0),gs.lineWrapping],f={scanLimit:1e3,timeout:500},p={margin:3,minSize:8};return Ze(async()=>{const{MergeView:m,unifiedMergeView:g}=await import("./index-BDxWHGNm.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 gs({doc:t,extensions:[...h,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:p,diffConfig:f})],parent:l})}catch(v){c||i(v instanceof Error?v.message:String(v))}}).catch(m=>{c||i(m instanceof Error?m.message:String(m))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:ct.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:ct.codeMirrorDiff}),o&&a.jsxs("div",{className:ct.diffError,children:["Diff unavailable: ",o]})]})}function lDe({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[ct.treeRow,s?ct.treeFile:ct.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:ct.treeTwisty,children:!s&&a.jsx("span",{className:[ct.treeChevron,r?"":ct.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(FNn,{})})}),a.jsxs("span",{className:ct.treeContent,children:[s&&a.jsx("span",{className:ct.fileIcon,children:dDe(e.path)}),a.jsx("span",{className:ct.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:ct.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:ct.treeNode,children:[s?a.jsx("div",{className:i,"data-selected":e.file?.path===n||void 0,"data-depth":t,style:l,title:e.path,children:u}):a.jsx("button",{type:"button",className:i,"data-depth":t,style:l,title:e.path,"aria-expanded":r,onClick:()=>o(h=>!h),children:u}),!s&&r&&e.children.length>0&&a.jsx("div",{className:ct.treeChildren,style:c,children:e.children.map(h=>a.jsx(lDe,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function LNn({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>cDe(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(DNn(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:ct.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:ct.pathPrefix,children:s.prefix}),a.jsx("span",{className:ct.pathFileName,children:s.leaf})]})}function cDe(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let kye=null;function DNn(e,t){const n=cDe(e),s=t.clientWidth;if(s<=0)return n;const r=ONn(t);if(r(e)<=s)return n;const o=e.split("/").filter(Boolean),i=o.at(-1)??e,l=r(i);if(o.length<=1||l+r(".../")>s)return{prefix:"",leaf:i};let c=".../";for(let u=1;u<o.length;u++){const f=`.../${o.slice(o.length-1-u,-1).join("/")}/`;if(r(f)+l>s)break;c=f}return{prefix:c,leaf:i}}function ONn(e){kye??=document.createElement("canvas");const t=kye.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 $Nn(){return a.jsxs("svg",{className:ct.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 BNn(){return a.jsxs("svg",{className:ct.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 _ye(){return a.jsx("svg",{className:ct.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 FNn(){return a.jsx("svg",{className:ct.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 zNn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=r$(s.path,t).split("/").filter(Boolean);let o=n;for(let i=0;i<r.length;i++){const l=r[i],c=r.slice(0,i+1).join("/");let u=o.children.find(h=>h.name===l);u||(u={name:l,path:c,children:[]},o.children.push(u)),i===r.length-1&&(u.file=s),o=u}}return uDe(n),n}function uDe(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)uDe(t)}function H7(e){return dy(e).split("/").filter(Boolean).at(-1)??e}function dDe(e){const t=H7(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 qNn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=mt(),o=Vf(),i=MEe(e),l=NI(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=NEe(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(djn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(HNn,{status:e.status}):!h||!e.workspacePath?a.jsx(UNn,{}):a.jsx(IEn,{workspacePath:e.workspacePath,artifactVersion:Que(e),workspaceActions:n}):h&&e.workspacePath?AEe(e)?a.jsx(GNn,{artifact:e,workspaceActions:n}):a.jsx(P$,{workspacePath:e.workspacePath,artifactVersion:Que(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:WNn(e)?"html":VNn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:ct.detail,children:[a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:ct.fieldGrid,children:[a.jsx(_f,{label:"Type",value:hee(e.kind,e.workspacePath)}),a.jsx(_f,{label:"Storage",value:e.storage}),a.jsx(_f,{label:"Status",value:e.status}),a.jsx(_f,{label:"Source",value:e.source}),a.jsx(_f,{label:"Size",value:yO(e.sizeBytes)}),a.jsx(_f,{label:"Created",value:e.createdAt}),a.jsx(_f,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(_f,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(_f,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:"Description"}),a.jsx("div",{className:ct.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:"Details"}),a.jsxs("div",{className:ct.fieldGrid,children:[$C(e.metadata,"automationId","Automation ID"),$C(e.metadata,"schedule","Schedule"),$C(e.metadata,"timezone","Timezone"),$C(e.metadata,"status","Status"),$C(e.metadata,"nextRunAt","Next run"),$C(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:ct.locationRow,children:[a.jsx("a",{className:ct.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:l}),a.jsx("a",{className:ct.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:p=>o(p,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:ct.meta,children:i})]})]})}function HNn({status:e}){const{t}=mt();return a.jsx("div",{className:ct.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function UNn(){const{t:e}=mt();return a.jsx("div",{className:ct.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function WNn(e){const t=e.workspacePath?.toLowerCase()??"",n=uy(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function VNn(e){const t=e.workspacePath?.toLowerCase()??"",n=uy(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function GNn({artifact:e,workspaceActions:t}){const{t:n}=mt(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=MEe(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await bO(t,e.workspacePath,e.mimeType,()=>!l.current)}catch(h){if(!l.current)return;r(h instanceof Error?h.message:String(h))}finally{l.current&&i(!1)}}};return a.jsx("div",{className:ct.detail,children:a.jsxs("div",{className:ct.section,children:[a.jsx("div",{className:ct.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:ct.fieldGrid,children:[a.jsx(_f,{label:"Type",value:hee(e.kind,e.workspacePath)}),a.jsx(_f,{label:"Size",value:yO(e.sizeBytes)}),c?a.jsx(_f,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(_f,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:ct.downloadRow,children:a.jsx("button",{type:"button",className:ct.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:ct.previewError,children:s})]})})}function KNn({tab:e}){const{t}=mt(),n=da(),s=DI(e.workspaceCwd),r=s?.actions,o=Vf(),[i,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 I=Uint8Array.from(atob(T.data),j=>j.charCodeAt(0));u(new Blob([I],{type:T.mimeType}))}else if(b&&r){const T=await _I(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(il(T))}),()=>{k=!0})},[i,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}),NI(v.url)&&a.jsx("a",{className:"text-primary underline",href:v.url,target:"_blank",rel:"noopener noreferrer",onClick:k=>o(k,v.url),children:t("sources.openOriginal")})]});if(!y||!s&&v.type!=="attachment")return a.jsx("div",{className:ct.empty,role:"alert",children:t("sources.unavailable")});const x=v.type==="workspace_file"&&!b&&AEe({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(vt,{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(Uw,{})})}),h&&a.jsx(vt,{variant:"ghost",size:"sm",onClick:()=>l(k=>k+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:ct.previewError,role:"alert",children:h}):x?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(vt,{onClick:()=>void bO(r,w,"application/octet-stream",()=>!e.owner.isCurrent()).catch(k=>{e.owner.isCurrent()&&f(il(k))}),children:t("common.download")})]}):(v.type==="attachment"||b)&&!c?a.jsx("div",{className:ct.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!rI(c.type,w)?a.jsx(hDe,{data:c,title:g.title,onDownloadUrl:m,showDownload:!1,image:!!U1(w)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(P$,{workspacePath:w,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:v.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(w)||uy(c?.type)==="text/html"?"source":void 0},i)})]})}function hDe({data:e,title:t,image:n,onDownloadUrl:s,showDownload:r=!0}){const[o,i]=d.useState();return d.useEffect(()=>{const l=URL.createObjectURL(e);return i(l),s?.(l),()=>URL.revokeObjectURL(l)},[e,s]),o?a.jsxs("div",{className:ct.imagePreviewWrap,children:[n?a.jsx("img",{className:ct.imagePreview,src:o,alt:t}):a.jsx(fDe,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(Uw,{})})]}):null}function P$({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewData:o,previewMimeType:i,imageMimeType:l,previewKind:c,previewOnly:u,onLoadError:h}){if(o)return a.jsx(YNn,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const f=e.toLowerCase(),p=l??U1(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(JNn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="markdown"?a.jsx(tMn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):m==="image"&&p?a.jsx(QNn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:p,onLoadError:h}):a.jsx(pDe,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function YNn({workspacePath:e,workspaceActions:t,data:n,mimeType:s,previewKind:r,onLoadError:o}){const i=(s||n.type||"application/octet-stream").split(";",1)[0].trim().toLowerCase();return i==="application/pdf"?a.jsx(ZNn,{data:n,mimeType:i,title:e}):rI(i,e)?a.jsx(XNn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(fDe,{name:e,mimeType:i,size:n.size})}function XNn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=mt(),[i,l]=d.useState(),[c,u]=d.useState();return d.useEffect(()=>{const h=new FileReader;return l(void 0),u(void 0),h.onload=()=>l(String(h.result??"")),h.onerror=()=>{const f=o("attachment.readFailed");u(f),r?.(f)},h.readAsText(n),()=>{h.readyState===FileReader.LOADING&&h.abort()}},[n,r,o]),c?a.jsx("div",{className:ct.previewError,children:c}):i===void 0?a.jsx("div",{className:ct.empty,children:o("attachment.loadingFile")}):a.jsx(P$,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function ZNn({data:e,mimeType:t,title:n}){const{t:s}=mt(),[r,o]=d.useState();return d.useEffect(()=>{const i=URL.createObjectURL(e.type===t?e:new Blob([e],{type:t}));return o(i),()=>URL.revokeObjectURL(i)},[e,t]),r?a.jsx("iframe",{className:ct.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:ct.empty,children:s("attachment.loadingPreview")})}function fDe({name:e,mimeType:t,size:n}){const{t:s}=mt();return a.jsxs("div",{className:ct.unsupportedAttachmentPreview,children:[a.jsx($g,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:ct.unsupportedAttachmentMeta,children:[t," · ",yO(n)]})]})}function QNn({workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:s,onLoadError:r}){const[o,i]=d.useState(null),[l,c]=d.useState(null);return d.useEffect(()=>{let u=!1,h;return i(null),c(null),_I((f,p)=>n.readFileBytes(f,p),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const p=f instanceof Error?f.message:String(f);c(p),r?.(p)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:ct.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:ct.imagePreview,src:o,alt:H7(e)}),a.jsx("a",{className:ct.imageDownloadButton,href:o,download:H7(e),"aria-label":`Download ${H7(e)}`,title:"Download",children:a.jsx(Uw,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:ct.empty,children:"Loading image..."}),l&&a.jsx("div",{className:ct.previewError,children:l})]})}function Hse({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o}){const[i,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 _I((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),o?.(g)}),()=>{p=!0}},[t,s,r,o,n,e]),{content:i,error:h,sizeBytes:c}}function JNn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=Hse({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:ct.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:ct.empty,children:"Loading preview..."}):a.jsx(mDe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(eMn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:ct.previewError,children:c})]})}function eMn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=mt(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),Mdt(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(il(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:ct.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:ct.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:ct.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function pDe({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o}){const i=d.useRef(null),[l,c]=d.useState(null),{content:u,error:h}=Hse({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:r,onLoadError:o});return d.useEffect(()=>{const f=i.current;if(!f||u===null)return;f.replaceChildren(),c(null);let p;try{p=new gs({doc:u,extensions:[Y7e,gs.editable.of(!1),$i.readOnly.of(!0),gs.lineWrapping],parent:f})}catch(m){c(m instanceof Error?m.message:String(m));return}return()=>p.destroy()},[u]),a.jsxs("div",{className:ct.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:ct.empty,children:"Loading file..."}):a.jsx("div",{ref:i,className:ct.codeMirrorFile}),(h||l)&&a.jsx("div",{className:ct.previewError,children:h||l})]})}function mDe({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=mt(),[i,l]=d.useState(null);if(!d.useMemo(()=>(t??new TextEncoder().encode(e).byteLength)>1024*1024,[e,t]))return r();const u=i===e;return a.jsxs("div",{className:"absolute inset-3 flex min-h-0 flex-col gap-2",children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[a.jsx("span",{children:o("artifact.longDocument")}),a.jsx(vt,{className:"ml-auto shrink-0",variant:"outline",size:"sm",onClick:()=>l(u?null:e),children:o(u?"artifact.showSource":"artifact.renderFullPreview")})]}),a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:u?r():a.jsx(pDe,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function tMn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=Hse({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:ct.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:ct.empty,children:"Loading preview..."}):a.jsx(mDe,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:ct.markdownPreviewWrap,children:a.jsx(Bf,{content:l})})}),c&&a.jsx("div",{className:ct.previewError,children:c})]})}function _f({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ct.fieldLabel,children:e}),a.jsx("span",{className:ct.fieldValue,children:t})]}):null}function $C(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(_f,{label:n,value:String(s)},t)}/**
|
|
2340
2340
|
* @license
|
|
2341
2341
|
* Copyright 2025 Qwen Team
|
|
2342
2342
|
* SPDX-License-Identifier: Apache-2.0
|