@organizaone/o1-code 0.23.2 → 0.23.4
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/qc-helper/docs/configuration/model-providers.md +39 -17
- package/bundled/qc-helper/docs/features/mcp.md +1 -1
- package/chunks/{MaxSizedBox-Z7DJBX2Q.js → MaxSizedBox-FHQ2P2SP.js} +30 -29
- package/chunks/{StandaloneSessionPicker-EYM35PIJ.js → StandaloneSessionPicker-JWI3NLN2.js} +46 -45
- package/chunks/{acp-subagent-executor-SMYOAOWC.js → acp-subagent-executor-MJJ6EAZC.js} +33 -32
- package/chunks/{acpAgent-HSOIXV24.js → acpAgent-6Z3FGPTA.js} +75 -73
- package/chunks/{agent-JC6EFT2I.js → agent-42DFRA2J.js} +19 -18
- package/chunks/{agent-headless-CHIUZU65.js → agent-headless-ET4HNKGM.js} +19 -18
- package/chunks/{all-providers-ZA3SYI4L.js → all-providers-P7KEC3WQ.js} +2 -2
- package/chunks/{anthropicContentGenerator-ZVN4PNRN.js → anthropicContentGenerator-CUW5FCXR.js} +9 -8
- package/chunks/{bridge-COLH5KR3.js → bridge-52NJEAM6.js} +33 -32
- package/chunks/{chunk-HLTVFS3P.js → chunk-22TAD3S6.js} +1 -1
- package/chunks/{chunk-J6IO5FRE.js → chunk-2DEMKCA3.js} +2 -2
- package/chunks/{chunk-WXRDFUBX.js → chunk-2HLPOUCW.js} +3 -3
- package/chunks/chunk-2SJEYSJ5.js +478 -0
- package/chunks/{chunk-IKCTAL27.js → chunk-32GJTTKG.js} +5 -5
- package/chunks/{chunk-G376S7VI.js → chunk-3FDAQK6P.js} +1 -1
- package/chunks/chunk-3JWJHYFV.js +328 -0
- package/chunks/{chunk-F5GPRGLO.js → chunk-3OPD6SKW.js} +1 -1
- package/chunks/{chunk-YXUFWO4Q.js → chunk-3RTPI5JO.js} +1 -1
- package/chunks/{chunk-YHONRCP6.js → chunk-3YQSW6GV.js} +3 -3
- package/chunks/{chunk-IPZ6Q5DH.js → chunk-43W64XRD.js} +1 -1
- package/chunks/{chunk-CJ4DSU6T.js → chunk-4HQKNVMC.js} +1 -1
- package/chunks/{chunk-5WCEM6DZ.js → chunk-4MFP7T32.js} +1 -1
- package/chunks/{chunk-SRDS6JPI.js → chunk-4VKMHWS6.js} +3 -3
- package/chunks/{chunk-INBZJC5Z.js → chunk-54UVZNY4.js} +1 -1
- package/chunks/{chunk-FVYOBBIY.js → chunk-5FA7YQJ5.js} +9 -9
- package/chunks/{chunk-AURWTXBY.js → chunk-5QNPNK3Y.js} +3 -3
- package/chunks/{chunk-GCOX5DHU.js → chunk-5XYYE7SJ.js} +37 -37
- package/chunks/{chunk-Q4LEAAGJ.js → chunk-6243HSOC.js} +1 -1
- package/chunks/{chunk-XLSS6CXY.js → chunk-6UVO2CGF.js} +3 -3
- package/chunks/{chunk-QD5MC6EV.js → chunk-6W65R7F3.js} +6 -6
- package/chunks/{chunk-LKM24VDU.js → chunk-6Z7HP4ID.js} +6 -6
- package/chunks/{chunk-EK2MS2YU.js → chunk-75W5XG5B.js} +101 -42
- package/chunks/{chunk-RI5VIBOZ.js → chunk-A64MZXCQ.js} +2 -2
- package/chunks/{chunk-RWUZRVUT.js → chunk-AE4IQ5HU.js} +2 -2
- package/chunks/{chunk-YPTR7ZFB.js → chunk-AFLYEJ7J.js} +20 -314
- package/chunks/{chunk-6SNXZ4AT.js → chunk-AMZCWMHX.js} +2 -2
- package/chunks/{chunk-Y6HZBYDT.js → chunk-AQCZYMTK.js} +7 -7
- package/chunks/{chunk-DYQ33P42.js → chunk-AT3KYR34.js} +1 -1
- package/chunks/{chunk-2OEBEF5L.js → chunk-BZYI5TLI.js} +1 -1
- package/chunks/{chunk-52OZIQ5T.js → chunk-CAD5UWKT.js} +3 -3
- package/chunks/{chunk-7RKJLHZZ.js → chunk-CCOOEN4T.js} +6 -6
- package/chunks/{chunk-NYFKH3IB.js → chunk-CD3FMTIW.js} +9 -9
- package/chunks/{chunk-BOD2QXN3.js → chunk-CRERIA6M.js} +3 -3
- package/chunks/{chunk-I25PS4O7.js → chunk-CTGTHRVE.js} +3 -3
- package/chunks/{chunk-KPPSQ5EU.js → chunk-D54VYWTE.js} +1 -1
- package/chunks/{chunk-TOHVMXEP.js → chunk-DDP4CQDP.js} +5 -5
- package/chunks/{chunk-AHIIFAZD.js → chunk-DLEJTCS5.js} +3 -3
- package/chunks/{chunk-W5XYWVXE.js → chunk-EB4VOVOS.js} +4 -4
- package/chunks/{chunk-AXM2QH6N.js → chunk-ETYF6LYZ.js} +1 -1
- package/chunks/{chunk-ULF6LMSZ.js → chunk-FGJZG3PB.js} +1 -1
- package/chunks/{chunk-LRSEIM7L.js → chunk-FH46YEKJ.js} +2 -2
- package/chunks/{chunk-CNXTYK25.js → chunk-G7TCNWW4.js} +2 -2
- package/chunks/{chunk-5C2PDGQ5.js → chunk-GAFJTGDP.js} +1 -1
- package/chunks/{chunk-EHNBRYKR.js → chunk-GLLNZ7E3.js} +1 -1
- package/chunks/{chunk-ZMXWTUY3.js → chunk-HFYL2VZG.js} +1 -1
- package/chunks/{chunk-K3ONONVP.js → chunk-I7XOJ2QI.js} +4 -4
- package/chunks/{chunk-6WR3DWHA.js → chunk-J5HQL7OD.js} +1 -1
- package/chunks/{chunk-WXIQKOFD.js → chunk-JCWIHPJ2.js} +32 -2
- package/chunks/{chunk-M2PU5FFH.js → chunk-JZSQAL7B.js} +2 -2
- package/chunks/{chunk-HRVFW2AK.js → chunk-KKWFVFWM.js} +4 -4
- package/chunks/{chunk-73D2FESX.js → chunk-KQHDGWXY.js} +1 -1
- package/chunks/{chunk-GE3WWLUS.js → chunk-L2HUG77D.js} +11 -11
- package/chunks/{chunk-CHKNZNCJ.js → chunk-LS3I3JJO.js} +8 -8
- package/chunks/{chunk-NRVJJRQU.js → chunk-LS6DOUZJ.js} +1 -1
- package/chunks/{chunk-Q3L72VR6.js → chunk-MEBFT635.js} +4 -4
- package/chunks/{chunk-EKCBRE2L.js → chunk-MLFML2VT.js} +4 -4
- package/chunks/{chunk-ITLANVG6.js → chunk-NRY3W5MD.js} +3 -3
- package/chunks/{chunk-AHHIUSSB.js → chunk-NTPJNUUS.js} +14 -14
- package/chunks/{chunk-YQIVW7PV.js → chunk-OKHE75DU.js} +1 -1
- package/chunks/{chunk-HPRAZUO3.js → chunk-OLZHEMQP.js} +8 -8
- package/chunks/{chunk-XV74KNLU.js → chunk-OMKHM4UW.js} +2 -2
- package/chunks/{chunk-WCV4SHJT.js → chunk-OV4IKI6E.js} +2 -2
- package/chunks/{chunk-KGYU4YCT.js → chunk-OWVDDIPY.js} +2 -2
- package/chunks/{chunk-MRDYGSEU.js → chunk-OX6A5GJG.js} +298 -83
- package/chunks/{chunk-5TGVTMA4.js → chunk-PZ5JMLBW.js} +2 -2
- package/chunks/{chunk-Y4BAYYQH.js → chunk-Q7LRFO2Z.js} +2 -2
- package/chunks/{chunk-2NTOADNA.js → chunk-QPGYYXO7.js} +1 -1
- package/chunks/{chunk-NRPYVAT2.js → chunk-QQDN6TTH.js} +4 -4
- package/chunks/{chunk-EE35GR3R.js → chunk-QQXXDTSU.js} +1 -1
- package/chunks/{chunk-VDFCAVG2.js → chunk-R45UQD5V.js} +6 -6
- package/chunks/{chunk-B4CCJMG6.js → chunk-R66LP4MO.js} +2 -2
- package/chunks/{chunk-O6EHTIDU.js → chunk-REKFASVP.js} +8 -8
- package/chunks/{chunk-6L4U7EHQ.js → chunk-RENNBDET.js} +3 -3
- package/chunks/{chunk-B4K3VBFF.js → chunk-RI6JVRWR.js} +1 -1
- package/chunks/{chunk-QNI2MYF2.js → chunk-RUMWX2SS.js} +4 -4
- package/chunks/{chunk-N3U72PWG.js → chunk-RY6DFOXD.js} +1 -1
- package/chunks/{chunk-YLNBTV7R.js → chunk-SIANDFHS.js} +4 -4
- package/chunks/{chunk-W7YSJWYY.js → chunk-SPGNKIRH.js} +1 -1
- package/chunks/{chunk-ULI3W2FQ.js → chunk-T7FEPG6S.js} +2 -2
- package/chunks/{chunk-4KLFLD6W.js → chunk-TASQRFKT.js} +1 -1
- package/chunks/{chunk-LIWLMHB2.js → chunk-TBNNLW6W.js} +5 -5
- package/chunks/{chunk-Z2FEOKPL.js → chunk-TTQS6ARK.js} +8 -8
- package/chunks/{chunk-GYEUB6AF.js → chunk-TWZ6ULYH.js} +2 -2
- package/chunks/{chunk-XCFYHA4L.js → chunk-UBMNZJ2I.js} +3 -3
- package/chunks/{chunk-VTK33X3H.js → chunk-ULZSYUR5.js} +1 -1
- package/chunks/{chunk-3SIUBEAC.js → chunk-UMXXMSBY.js} +1 -1
- package/chunks/{chunk-FOST7L5P.js → chunk-UP6XFNZK.js} +5 -5
- package/chunks/{chunk-G524L6DX.js → chunk-VHSVQ4YD.js} +59 -16
- package/chunks/{chunk-HIJ2PJCR.js → chunk-VL7IPPLV.js} +3 -3
- package/chunks/{chunk-EPNQMLQI.js → chunk-WB7BTNTR.js} +1 -1
- package/chunks/{chunk-7DRS2N6U.js → chunk-WCNZRV77.js} +2 -2
- package/chunks/{chunk-7PYCEQRH.js → chunk-WNJA3CH5.js} +1 -1
- package/chunks/{chunk-LMFAYXBU.js → chunk-XBZ4D64Q.js} +1 -1
- package/chunks/{chunk-3365B2SG.js → chunk-XHAO7L6K.js} +2 -2
- package/chunks/{chunk-AKXCASOU.js → chunk-XO73AHWJ.js} +1 -1
- package/chunks/{chunk-X6K47FOG.js → chunk-XWGAOAIY.js} +1 -1
- package/chunks/{chunk-S2Q3IIJI.js → chunk-XWKCE5VX.js} +2 -2
- package/chunks/{chunk-VDZHZKLL.js → chunk-YBJ5CGLV.js} +84 -93
- package/chunks/{chunk-55J4YCGE.js → chunk-YLGMWYXR.js} +4 -4
- package/chunks/{chunk-TJQMUJ4P.js → chunk-YPVXKPDR.js} +3 -3
- package/chunks/{chunk-OCGMQ7V4.js → chunk-ZIWHK3AH.js} +1 -1
- package/chunks/{chunk-PJT67V3P.js → chunk-ZPF5QU35.js} +3 -3
- package/chunks/{codex-subagent-executor-T7M5FTHN.js → codex-subagent-executor-HDDF3623.js} +33 -32
- package/chunks/{contextCommand-227JLKFM.js → contextCommand-PCDR5XST.js} +32 -31
- package/chunks/{core-runtime-VLL5ONTJ.js → core-runtime-YO2BU645.js} +30 -29
- package/chunks/{create-sub-session-BXIEQSUR.js → create-sub-session-IRYT42QC.js} +31 -30
- package/chunks/{daemon-git-worktree-guard-SCYT7G5Z.js → daemon-git-worktree-guard-CQIXKMCN.js} +30 -29
- package/chunks/{daemon-status-provider-BXRYGSEC.js → daemon-status-provider-UUCNZSAQ.js} +38 -37
- package/chunks/{daemon-trust-policy-KUU3SJJR.js → daemon-trust-policy-TMPZYJO5.js} +36 -35
- package/chunks/{daemon-trust-policy-monitor-3HW5C536.js → daemon-trust-policy-monitor-X22KZQNG.js} +36 -35
- package/chunks/{deferred-core-runtime-ZVY4R7JN.js → deferred-core-runtime-CW3RYKVF.js} +30 -29
- package/chunks/{edit-7VTZEUFB.js → edit-GY6M2OZO.js} +21 -20
- package/chunks/{en-MQICGJBA.js → en-QZTJJ53G.js} +5 -1
- package/chunks/{enterPlanMode-4ACRIABY.js → enterPlanMode-OL5SMGZ2.js} +19 -18
- package/chunks/{environment-P7O3DRVU.js → environment-2LII6MAZ.js} +32 -31
- package/chunks/{errors-FPOD56OM.js → errors-YLTJNGIJ.js} +32 -31
- package/chunks/{execution-tool-CUZLLHDM.js → execution-tool-LSWT3ED3.js} +21 -20
- package/chunks/{execution-worker-K7OIFEQC.js → execution-worker-SN7DU5M6.js} +24 -23
- package/chunks/{exitPlanMode-SVK6JBWM.js → exitPlanMode-6RIRCY65.js} +19 -18
- package/chunks/{fast-path-63ZAOC2O.js → fast-path-QK4MJZ2O.js} +2 -2
- package/chunks/{foreground-runner-5BDXDCJ3.js → foreground-runner-3344CG4R.js} +32 -31
- package/chunks/{gateway-content-generator-YATQA6IH.js → gateway-content-generator-URNHKQ6P.js} +32 -101
- package/chunks/{gateway-models-CI5ONUHN.js → gateway-models-IBOWVC4O.js} +7 -6
- package/chunks/gateway-transfer-OASSZYSK.js +46 -0
- package/chunks/{glob-AHU4JEAH.js → glob-PY6YF7U4.js} +19 -18
- package/chunks/{goal-tools-HZ3SEEDJ.js → goal-tools-HMAA3TMO.js} +19 -18
- package/chunks/{handleAutoUpdate-NWIBYK3W.js → handleAutoUpdate-ANFC3Z6G.js} +33 -32
- package/chunks/{i18n-HXRZVPI5.js → i18n-6U5NHFUK.js} +31 -30
- package/chunks/{image-gen-WGMRL47H.js → image-gen-D4WPSZB4.js} +3 -2
- package/chunks/{initializer-DZE6W5ZZ.js → initializer-4MDFZJVC.js} +36 -35
- package/chunks/{installationInfo-DJS6YOYL.js → installationInfo-CD2A6E6I.js} +30 -29
- package/chunks/{list-QOTYRCXE.js → list-DTPZJHOJ.js} +38 -37
- package/chunks/{llm-VTSGUOEX.js → llm-3V2DU6KO.js} +64 -63
- package/chunks/{llm-content-generator-GNBKROI6.js → llm-content-generator-K6Q3E6AH.js} +4 -4
- package/chunks/{loadedSettingsAdapter-5XTSYAN2.js → loadedSettingsAdapter-XCFCTBCK.js} +36 -35
- package/chunks/{local-execution-environment-FAMBOK2R.js → local-execution-environment-JFU74GRI.js} +24 -23
- package/chunks/{loggingContentGenerator-QHARM6I7.js → loggingContentGenerator-ITWAHQQA.js} +20 -19
- package/chunks/{managed-npm-update-NHG4CNTY.js → managed-npm-update-QVW4WS42.js} +30 -29
- package/chunks/{mcp-GFWKHITS.js → mcp-YOZXHPME.js} +36 -35
- package/chunks/{model-call-collection-PSCHHAL2.js → model-call-collection-IXU3COZH.js} +1 -1
- package/chunks/{model-configuration-4OLQAYPC.js → model-configuration-TQPP6C56.js} +37 -36
- package/chunks/{modelConfigUtils-6BOQF3QL.js → modelConfigUtils-OL2I6LTF.js} +32 -31
- package/chunks/{monitor-AMCODWD4.js → monitor-IYFEU4WZ.js} +19 -18
- package/chunks/{nonInteractiveCli-WNWO63XM.js → nonInteractiveCli-MAXL5D4Y.js} +66 -64
- package/chunks/{nonInteractiveToolExecutor-WM3YSMJV.js → nonInteractiveToolExecutor-WGY3CAAJ.js} +20 -19
- package/chunks/{notebook-edit-2ZEGVMQ5.js → notebook-edit-2N4BWOIJ.js} +20 -19
- package/chunks/{omni-F3MGKMI5.js → omni-MOV3MXTX.js} +13 -12
- package/chunks/{openaiContentGenerator-JSWESHEH.js → openaiContentGenerator-MGCUMNTJ.js} +15 -13
- package/chunks/{openaiResponsesContentGenerator-GOFHZBHE.js → openaiResponsesContentGenerator-VIMLFFS6.js} +8 -7
- package/chunks/{processUtils-BLTEAR2P.js → processUtils-XM5BY2Q7.js} +2 -2
- package/chunks/{prompt-terminal-ledger-SZV4IH7W.js → prompt-terminal-ledger-WLJXQ2QJ.js} +31 -30
- package/chunks/{pt-EZL4H2AB.js → pt-KE77XTFU.js} +5 -1
- package/chunks/{reactive-degrade-RMOJR3UO.js → reactive-degrade-6P4KI4Z3.js} +12 -11
- package/chunks/{read-file-QH2DDCDD.js → read-file-M66I6SWK.js} +4 -4
- package/chunks/{resumeHistoryUtils-SK7UGMOC.js → resumeHistoryUtils-6KNHMAID.js} +34 -33
- package/chunks/{ripGrep-K4J4MLBL.js → ripGrep-EHJ3FDNE.js} +5 -5
- package/chunks/{run-o1-code-serve-PGCIJYC2.js → run-o1-code-serve-WJ4BRL2T.js} +32 -32
- package/chunks/{sandboxConfig-MUJTXJWI.js → sandboxConfig-4CEQGERI.js} +30 -29
- package/chunks/{scheduled-tasks-DFC6Q3IG.js → scheduled-tasks-7RVOCXQJ.js} +36 -35
- package/chunks/{scheduler-63WJQPZ2.js → scheduler-ESB6OTOV.js} +32 -31
- package/chunks/{sdk-exporters-http-66WPQ7UY.js → sdk-exporters-http-YROX3PLL.js} +2 -2
- package/chunks/{sdk-impl-B4WTXTDQ.js → sdk-impl-LMCYCCTE.js} +4 -4
- package/chunks/{serve-DKXTI5V2.js → serve-LKRV22OH.js} +36 -35
- package/chunks/{server-3INVZRET.js → server-QXLYJOGN.js} +68 -67
- package/chunks/{session-LN37VDDP.js → session-CR4OVISR.js} +177 -68
- package/chunks/{session-HENSFFJO.js → session-TZYPGQBA.js} +2 -2
- package/chunks/{session-attachments-root-MQU3746J.js → session-attachments-root-DTMA76CV.js} +30 -29
- package/chunks/{session-pr-refresh-OGTS6EVI.js → session-pr-refresh-DK4MCWHR.js} +35 -34
- package/chunks/{settings-BXDNY2AP.js → settings-MPQBHLKQ.js} +35 -34
- package/chunks/{shell-H7R2TF7F.js → shell-PMXP5W4B.js} +19 -18
- package/chunks/{skill-3DPAHPZB.js → skill-ZDOOYYEJ.js} +6 -6
- package/chunks/{skill-settings-RWVB7OQH.js → skill-settings-WZ5D2YDV.js} +36 -35
- package/chunks/{spawnChannel-FTLDFA2H.js → spawnChannel-U3JRKEEQ.js} +32 -31
- package/chunks/{standalone-update-2NTMLG6U.js → standalone-update-ELOY4TKH.js} +32 -31
- package/chunks/{startInteractiveUI-ZQYISDFK.js → startInteractiveUI-MIPP76GG.js} +119 -147
- package/chunks/{supervisor-runner-4UQ3S7ZK.js → supervisor-runner-CGUFZJOX.js} +2 -2
- package/chunks/{team-create-AKAP7B2I.js → team-create-TKE64LZO.js} +19 -18
- package/chunks/{team-plan-approval-CD5PJ2HF.js → team-plan-approval-RI2Q4OAZ.js} +19 -18
- package/chunks/{terminal-image-renderer-2H7GWOGJ.js → terminal-image-renderer-Q2E35SMZ.js} +30 -29
- package/chunks/{theme-manager-PO2AOYF4.js → theme-manager-OEOS4P4R.js} +30 -29
- package/chunks/{tool-result-media-TRUCQ7RW.js → tool-result-media-RR2EOQKL.js} +13 -12
- package/chunks/{tool-search-EDTROJCV.js → tool-search-YFEMM2RO.js} +4 -4
- package/chunks/{total-session-admission-P6DIV3Q5.js → total-session-admission-KGIKHYHU.js} +33 -32
- package/chunks/{trustedFolders-SEN5Y6NQ.js → trustedFolders-VCHPBP7F.js} +31 -30
- package/chunks/{update-relaunch-SYHPPEM3.js → update-relaunch-BFRAJ666.js} +5 -5
- package/chunks/{updateCheck-7OOIBXXV.js → updateCheck-KCVBGBBR.js} +32 -31
- package/chunks/{upload-config-UMYJSCZQ.js → upload-config-Z6BMQ33S.js} +10 -9
- package/chunks/{useAutoAcceptIndicator-I5R77IN7.js → useAutoAcceptIndicator-CNOBUVGA.js} +38 -37
- package/chunks/{validateNonInterActiveAuth-AEZTP3MC.js → validateNonInterActiveAuth-J23HKWQZ.js} +63 -61
- package/chunks/{version-S7QK2XJ3.js → version-NKG54EQU.js} +1 -1
- package/chunks/{web-fetch-4CLYKVOX.js → web-fetch-OA6FFOEX.js} +6 -5
- package/chunks/{web-search-LXGIHMSR.js → web-search-OOKSTACM.js} +10 -9
- package/chunks/{workflow-BJXDZAIK.js → workflow-KB5RHTHA.js} +22 -21
- package/chunks/{workspace-providers-status-WOJTQARI.js → workspace-providers-status-BA5MMCHL.js} +42 -41
- package/chunks/{workspace-registration-store-HA5CPWRM.js → workspace-registration-store-JLXOXBBM.js} +1 -1
- package/chunks/{workspace-registry-JTKEDLKB.js → workspace-registry-RQNMS4NT.js} +33 -32
- package/chunks/{workspace-runtime-coordinator-HCSJM4WW.js → workspace-runtime-coordinator-2NRPYIR7.js} +34 -33
- package/chunks/{workspace-service-Z6AXYMZK.js → workspace-service-AITMTQ5F.js} +40 -39
- package/chunks/{workspace-skills-status-5CRGREPM.js → workspace-skills-status-FAWXZW2K.js} +39 -38
- package/chunks/{workspace-trust-reconciler-2HYPUBV5.js → workspace-trust-reconciler-XIYIWMD5.js} +39 -38
- package/chunks/{write-file-DB5MAWEC.js → write-file-ZXWVEQBO.js} +21 -20
- package/chunks/{zoom-image-INVYZYGT.js → zoom-image-NXYFTJCE.js} +4 -4
- package/cli.js +15 -15
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/locales/en.js +9 -2
- package/locales/pt.js +9 -2
- package/package.json +2 -2
- package/release-notes.json +15 -0
- package/vendor/o1-connect/.lintstagedrc.mjs +7 -0
- package/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
- package/vendor/tree-sitter/tree-sitter.wasm +0 -0
- package/web-shell/assets/{abnfDiagram-VCTEODGH-BaNqfZpC.js → abnfDiagram-VCTEODGH-CqjOJwIl.js} +1 -1
- package/web-shell/assets/{arc-gDDqDKPT.js → arc-C5SJ23WU.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-Bksq6k3e.js → architectureDiagram-5GKGNRK7-An4fJIBe.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-7hsG6uyG.js → blockDiagram-NRAW4CY4-G2eztYPX.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-D1YM1daI.js → c4Diagram-UCG6FXSJ-C6ezHlpJ.js} +1 -1
- package/web-shell/assets/channel-D5esVGM7.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-BB8Fw1Hw.js → chunk-2Q5K7J3B-BvJY7MyE.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-DQVttniG.js → chunk-5VM5RSS4-BtyPdSpj.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-CmdpVDej.js → chunk-F27PBJKO-BTyZPl5y.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-C2pQ1X6e.js → chunk-G27WJ6UU-JFsGVpGk.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-DLd59_s7.js → chunk-JWPE2WC7-A4mmQSWN.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-CF_rpE3C.js → chunk-LCL6LL3I-BxALl8Fh.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-Bix-ymX6.js → chunk-POPQ4Y6H-Cw8I0h3T.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-TgCBK2Wr.js → chunk-SVP7TREG-DSL1NUen.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-bAG8mDsG.js → chunk-XXDRQBXY-DaOf-wsF.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-GkP_GnoS.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-GkP_GnoS.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-Ki_lMvfR.js → cose-bilkent-JH36ORCC-BoJUwl6N.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-ClCmMaaz.js → cynefin-OW5HDTMX-OjMGs01U.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-Bd_01Yme.js → cynefinDiagram-5FMLGOSQ-CIlbclJF.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-CFzBzlQw.js → dagre-3AP2YEHR-mF2nY8kI.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-D1sCOBvM.js → diagram-S7CK7UJ4-B2gmDJpJ.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-9BhhA92f.js → diagram-UQ7AKVKN-CbeiFG4H.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-CcRwCzkz.js → diagram-VSXAHHWV-1b6dLlvx.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-CxuPvHoZ.js → diagram-VX7I27RA-Bhotp5VI.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-CoIJxvYZ.js → diagram-Z3DM3KII-BaR9ET3O.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-Dg5aM3n8.js → ebnfDiagram-PWID7BFC-DU7SRTDr.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-DMa-93Pc.js → erDiagram-SSCWMZ5O-Doc9fBrw.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-YyRjDg58.js → flowDiagram-A5DVABFB-Dg4piWMk.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DL6u7rJj.js → ganttDiagram-EL5Y4UJY-g0Szi6ST.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-VzBe_y82.js → gitGraphDiagram-WWUBYQGX-Cf7xdXvO.js} +1 -1
- package/web-shell/assets/{index-sM76wg9o.js → index-BJgwudRv.js} +1 -1
- package/web-shell/assets/{index-GigiICvn.js → index-zu97iwyx.js} +3 -3
- package/web-shell/assets/{infoDiagram-RXCK75RN-ZdRuVjv4.js → infoDiagram-RXCK75RN-B2wvgM-Z.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-DCGfNGm8.js → ishikawaDiagram-5VMMS53U-DuXJBRoZ.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-vAmOL7Eg.js → journeyDiagram-EYS64GPL-D1buQOuH.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-DE-XVGLj.js → kanban-definition-3QL26DDD-C4ocotU4.js} +1 -1
- package/web-shell/assets/{layout-8oKHDfxQ.js → layout-C4TsdXH6.js} +1 -1
- package/web-shell/assets/{linear-BTNkFLpm.js → linear-B579tz05.js} +1 -1
- package/web-shell/assets/{mermaid.core-1L-v7Osp.js → mermaid.core-C4GAuwX5.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-B_TZjQ0C.js → mindmap-definition-FBJOCRG2-BjVDZjap.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-YXEadiQt.js → pegDiagram-XKGWAZYB-CXumURc6.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-BhkRy1C-.js → pieDiagram-E7YTZNPT-B4pmVjw8.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CSuVeiFP.js → quadrantDiagram-AXDQQJYC-8STI_3oc.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-C-keEU-2.js → railroadDiagram-O6MQD6OU-BOkM9ljd.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BRsygqPt.js → requirementDiagram-EFPCY7ZU-C_o-DuKn.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-D-_EHQLT.js → sankeyDiagram-P5KCCOFB-DyFETog_.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-CNIb-Onj.js → sequenceDiagram-WJ2MYXX4-DEDdqLcH.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BbofuaSb.js → sizeCapture-X5ZJPWSS-Cv9dGT1I.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-DWmCEpdE.js → stateDiagram-HBIQ2CUA-D9Gad5Fv.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-CdGtFEba.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-DZduoU7z.js → swimlanes-XN3QIQJK-Dya2rRKz.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-DFVEwDmq.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-DfIVB7QH.js → timeline-definition-24CTP7MA-B0UZHOzv.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-OvwgQkxx.js → vennDiagram-4TSXK5OY-C_u8Z-Bk.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CH_cuYLP.js → wardleyDiagram-VM6X3IG4-Bq4DlxeN.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-Dc3Tv7qx.js → xychartDiagram-S5SC5T6Z-CMeeBCXA.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/chunks/chunk-V24FMEXL.js +0 -203
- package/chunks/gateway-transfer-47WP3EUB.js +0 -27
- package/web-shell/assets/channel-CGxTee96.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-CVk9ORuZ.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-CVk9ORuZ.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-CsO4gStv.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BEwObTq5.js +0 -8
|
@@ -1091,7 +1091,7 @@ ${n}`:n}function pee(e){const t=e.data.indexOf(","),n=e.data.startsWith("data:")
|
|
|
1091
1091
|
</head><body><iframe title="${p3(t)}" src="${p3(e.href)}" sandbox="allow-scripts allow-same-origin allow-forms" referrerpolicy="no-referrer"></iframe></body></html>`}function MK(e,t){const n=vL(t);if(PK.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 UGe=new Set([".doc",".docx",".docm",".dotx",".xls",".xlsx",".xlsm",".xlsb",".ppt",".pptx",".pptm",".odt",".ods",".odp"]),PK=new Set([".m4a",".mp3",".ogg",".wav"]),WGe=new Set([...UGe,...PK,".pdf",".mp4",".mov",".webm"]);function fye(e){const t=vL(e.workspacePath),n=wb(e.mimeType);return t===".svg"||n==="image/svg+xml"||WGe.has(t)?!0:mye(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 vL(e){const n=(e??"").split(/[?#]/,1)[0].split(/[/\\]/).pop()??"",s=n.lastIndexOf(".");return s>=0?n.slice(s).toLowerCase():""}function qGe(e,t){return PK.has(vL(e))||wb(t).startsWith("audio/")}const VGe="o1code.workspace.sha256";function pne(e){const t=e.metadata?.[VGe],n=typeof t=="string"?t:"";return`${e.status}:${e.updatedAt}:${n}`}function GGe(e){const t=e.metadata?.artifactType;return typeof t=="string"&&t?t:MK(e.kind,e.workspacePath??e.url??e.title)}function wL(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const pye={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"},KGe=100*1024*1024,YGe=256*1024;function wb(e){return e?.split(";",1)[0]?.trim().toLowerCase()??""}function mye(e){const t=wb(e.mimeType);return t.startsWith("image/")?t==="image/jpg"?"image/jpeg":Object.values(pye).includes(t)?t:void 0:eC(e.workspacePath??"")}function eC(e){const t=e.toLowerCase(),n=t.includes(".")?t.split(".").pop():void 0;return n?pye[n]:void 0}function XGe(e){return/\.html?$/i.test(e)?"text/html":"text/markdown"}async function F4(e,t,n,s){const r=[],o=s.maxBytes??KGe,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:YGe});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 yL(e,t,n="application/octet-stream",s){const r=await F4((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=yb(t).split("/").at(-1)??t,document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(o)}}function gye(e){return e.workspacePath??e.url??e.managedId??""}function yb(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 iA(e,t){const n=yb(e),s=yb(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 LK(e,t,n){const s=iA(e??"",n),r=iA(t??"",n);return!!s&&s===r}const eU="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 vye(e,t){return tU(nU(e),t)}function tU(e,t){return`<!doctype html><html><head>
|
|
1092
1092
|
<meta http-equiv="Content-Security-Policy" content="${eU} frame-src 'none';">
|
|
1093
1093
|
<style>html,body,iframe{width:100%;height:100%;margin:0;border:0;display:block;overflow:hidden}</style>
|
|
1094
|
-
</head><body><iframe title="${p3(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${p3(e)}"></iframe></body></html>`}let Qj;async function ZGe(e,t,n){if(Qj?.content===e&&Qj.title===t)return Qj.document;const s=await JGe(e,t,n);return Qj={content:e,title:t,document:s},s}async function JGe(e,t,n){if(typeof DOMParser>"u")return vye(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return tU(nU(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)??"",m=h?.getAttribute("integrity")??"";if(!h)return;const g=`https://unpkg.com/@organizaone/o1-code@0.23.2/export-transcript-document.${c}`;if(f!==g||!/^sha384-[A-Za-z0-9+/]{64}$/.test(m))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const w=await fetch(f,{integrity:m,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!w.ok)throw new Error(`Could not load export renderer (${w.status}).`);const y=new Blob([await w.arrayBuffer()],{type:u}),x=await new Promise((k,_)=>{const S=new FileReader;S.onload=()=>k(S.result),S.onerror=()=>_(S.error),S.readAsDataURL(y)});h.setAttribute(l,x),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return tU(nU(s),t)}function nU(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${eU}"></head><body>${QGe(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=eU,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function QGe(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 wye={csv:NGe,file:MGe,html:PGe,image:LGe,link:DGe,md:OGe,pdf:$Ge,spreadsheet:BGe,video:zGe,word:FGe},eKe={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},tKe={audio:EK,document:z4,notebook:lVe},mne={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 yye(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=vL(t).slice(1);if(n&&mne[n])return mne[n];const s=wb(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":eKe[e.kind]??"file"}function bye({artifact:e,className:t}){const{artifact:n}=Ih(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=yye(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?qGe(o,e.mimeType)?"audio":e.kind:void 0,l=i?tKe[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:wye[r],"data-artifact-icon":r,alt:""})}const nKe=[[new Set(["json","jsonl","geojson"]),zUe],[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"]),k9],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),BWe],[new Set(["csv","tsv","xls","xlsx","ods"]),VWe],[new Set(["ppt","pptx","odp"]),TVe],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),Vwe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),EK],[new Set(["mp4","mov","webm","avi","mkv"]),Gwe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),z4]];function sKe(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of nKe)if(s.has(n))return r;return t?.startsWith("image/")?Vwe:t?.startsWith("audio/")?EK:t?.startsWith("video/")?Gwe:t?.startsWith("text/")?z4:Kwe}function K0({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=sKe(e,t),i=yye({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===Kwe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:wye[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const rKe="_panel_19vsn_1",oKe="_floating_19vsn_16",iKe="_section_19vsn_26",aKe="_sectionHeader_19vsn_40",lKe="_sectionHeaderRow_19vsn_59",cKe="_sectionAction_19vsn_70",uKe="_sectionContent_19vsn_111",dKe="_row_19vsn_115",hKe="_workspaceIcon_19vsn_158",fKe="_rowActionIcon_19vsn_162",pKe="_label_19vsn_168",mKe="_branchName_19vsn_173",gKe="_value_19vsn_181",vKe="_tasks_19vsn_191",wKe="_task_19vsn_191",yKe="_taskIcon_19vsn_229",bKe="_taskLabel_19vsn_240",xKe="_agentName_19vsn_248",kKe="_taskName_19vsn_249",_Ke="_agentColor_19vsn_260",SKe="_agentTag_19vsn_269",CKe="_taskStatus_19vsn_280",TKe="_statusRunning_19vsn_301",IKe="_attachmentFiles_19vsn_311",EKe="_attachmentFile_19vsn_311",RKe="_attachmentFileIcon_19vsn_344",AKe="_attachmentFileName_19vsn_348",jKe="_emptyDescription_19vsn_356",NKe="_sourceTitle_19vsn_363",Ur={panel:rKe,floating:oKe,section:iKe,sectionHeader:aKe,sectionHeaderRow:lKe,sectionAction:cKe,sectionContent:uKe,row:dKe,workspaceIcon:hKe,rowActionIcon:fKe,label:pKe,branchName:mKe,value:gKe,tasks:vKe,task:wKe,taskIcon:yKe,taskLabel:bKe,agentName:xKe,taskName:kKe,agentColor:_Ke,agentTag:SKe,taskStatus:CKe,statusRunning:TKe,attachmentFiles:IKe,attachmentFile:EKe,attachmentFileIcon:RKe,attachmentFileName:AKe,emptyDescription:jKe,sourceTitle:NKe};function xye({entries:e,onOpen:t}){const{t:n}=Ct();return a.jsx("ul",{className:Ur.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:Ur.attachmentFile,title:dne(s),"aria-label":s.type==="source"?`${n("sources.open")} ${une(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(Xwe,{size:16,strokeWidth:1.7,className:Ur.attachmentFileIcon}):a.jsx(K0,{name:dne(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:Ur.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:Ur.attachmentFileName,children:une(s)})]})},ZM(s)))})}function dw({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:cs("animate-pulse rounded-md bg-muted",e),...t})}function MKe(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function PKe({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:m}){const{t:g}=Ct(),[w,y]=d.useState(!1),[x,k]=d.useState(!1);d.useEffect(()=>{e&&k(!1)},[e]),d.useEffect(()=>{k(!1),y(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(x&&t?.supported===!0),()=>c?.(!1)),[x,c,t?.supported]);const _=t?.supported?t.sources:[],S=cye(_,n);if(!t?.supported&&!S.length&&!s&&!r)return null;const I=s||t?.supported&&t.loading;return a.jsxs("section",{className:Ur.section,"aria-label":g("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:Ur.sectionHeaderRow,children:[a.jsxs("h3",{className:`${Ur.sectionHeader} ${Ur.sourceTitle}`,children:[g("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:S.length})]}),t?.supported&&MKe()&&a.jsx("button",{type:"button",className:Ur.sectionAction,"aria-label":g("sources.add"),onClick:()=>k(!0),children:a.jsx(ep,{})})]}),l&&a.jsxs("div",{className:Ur.emptyDescription,role:"alert",children:[g("sources.registrationFailed")," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:()=>void l(),children:g("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:g("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[g("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:o,children:g("common.retry")})]}),a.jsx(xye,{entries:w?S:S.slice(0,3),onOpen:R=>kye(R,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:m})}),I&&!S.length&&a.jsx("ul",{className:Ur.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":g("common.loading"),children:[72,88,64].map(R=>a.jsxs("li",{className:Ur.attachmentFile,children:[a.jsx(dw,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(dw,{className:"h-4",style:{width:`${R}%`}})]},R))}),!I&&!S.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:Ur.emptyDescription,children:g("sources.empty")}),S.length>3&&a.jsx("button",{type:"button",className:Ur.attachmentFile,"aria-expanded":w,onClick:()=>y(R=>!R),children:g(w?"common.collapse":"sources.viewAll")}),x&&t?.supported&&a.jsx(LKe,{state:t,onClose:()=>k(!1)})]})}function LKe({state:e,onClose:t}){const{t:n}=Ct(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,m]=d.useState(),[g,w]=d.useState(!1),y=async()=>{w(!0),m(void 0);try{const x=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,k=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||x.trim().slice(0,200),locator:k,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(x){e.owner.isCurrent()&&m(x instanceof Error?x.message:String(x))}finally{e.owner.isCurrent()&&w(!1)}};return a.jsx(qa,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:x=>{x.preventDefault(),y()},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:x=>{r(x.target.value),i(""),m(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(hi,{value:o,onChange:x=>i(x.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(hi,{value:l,maxLength:200,onChange:x=>c(x.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(hi,{value:u,maxLength:1e3,onChange:x=>h(x.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(Wt,{type:"submit",disabled:g||!o,children:n("sources.add")})]})})}function kye(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})}/**
|
|
1094
|
+
</head><body><iframe title="${p3(t)}" sandbox="allow-scripts" referrerpolicy="no-referrer" srcdoc="${p3(e)}"></iframe></body></html>`}let Qj;async function ZGe(e,t,n){if(Qj?.content===e&&Qj.title===t)return Qj.document;const s=await JGe(e,t,n);return Qj={content:e,title:t,document:s},s}async function JGe(e,t,n){if(typeof DOMParser>"u")return vye(e,t);const s=new DOMParser().parseFromString(e,"text/html");if(!s.querySelector('script#transcript-document[type="application/json"]'))return tU(nU(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)??"",m=h?.getAttribute("integrity")??"";if(!h)return;const g=`https://unpkg.com/@organizaone/o1-code@0.23.4/export-transcript-document.${c}`;if(f!==g||!/^sha384-[A-Za-z0-9+/]{64}$/.test(m))throw new Error("Unsupported export preview resource; use an export matching the current Web Shell version.");const w=await fetch(f,{integrity:m,signal:r.signal,credentials:"omit",referrerPolicy:"no-referrer",redirect:"error"});if(!w.ok)throw new Error(`Could not load export renderer (${w.status}).`);const y=new Blob([await w.arrayBuffer()],{type:u}),x=await new Promise((k,_)=>{const S=new FileReader;S.onload=()=>k(S.result),S.onerror=()=>_(S.error),S.readAsDataURL(y)});h.setAttribute(l,x),h.removeAttribute("integrity"),h.removeAttribute("crossorigin")}))}finally{n.removeEventListener("abort",o),r.abort()}return tU(nU(s),t)}function nU(e){if(typeof e=="string"&&typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${eU}"></head><body>${QGe(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=eU,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function QGe(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 wye={csv:NGe,file:MGe,html:PGe,image:LGe,link:DGe,md:OGe,pdf:$Ge,spreadsheet:BGe,video:zGe,word:FGe},eKe={csv:"csv",html:"html",image:"image",link:"link",markdown:"md",md:"md",pdf:"pdf",spreadsheet:"spreadsheet",video:"video",word:"word"},tKe={audio:EK,document:z4,notebook:lVe},mne={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 yye(e){if(!e)return"file";const t=e.workspacePath??e.url??e.title,n=vL(t).slice(1);if(n&&mne[n])return mne[n];const s=wb(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":eKe[e.kind]??"file"}function bye({artifact:e,className:t}){const{artifact:n}=Ih(),s=e?n?.renderImage?.(e):void 0;if(s!=null&&s!==!1)return s;const r=yye(e),o=e?e.workspacePath??e.url??e.title:void 0,i=r==="file"&&e?qGe(o,e.mimeType)?"audio":e.kind:void 0,l=i?tKe[i]:void 0;return l?a.jsx(l,{className:t,"data-artifact-icon":i,"aria-hidden":"true"}):a.jsx("img",{className:t,src:wye[r],"data-artifact-icon":r,alt:""})}const nKe=[[new Set(["json","jsonl","geojson"]),zUe],[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"]),k9],[new Set(["zip","tar","gz","tgz","bz2","xz","7z","rar"]),BWe],[new Set(["csv","tsv","xls","xlsx","ods"]),VWe],[new Set(["ppt","pptx","odp"]),TVe],[new Set(["png","jpg","jpeg","gif","webp","bmp","ico","tif","tiff"]),Vwe],[new Set(["mp3","wav","ogg","m4a","aac","flac"]),EK],[new Set(["mp4","mov","webm","avi","mkv"]),Gwe],[new Set(["txt","md","mdx","log","pdf","doc","docx","rtf"]),z4]];function sKe(e,t){const n=e.split(".").pop()?.toLowerCase()??"";for(const[s,r]of nKe)if(s.has(n))return r;return t?.startsWith("image/")?Vwe:t?.startsWith("audio/")?EK:t?.startsWith("video/")?Gwe:t?.startsWith("text/")?z4:Kwe}function K0({name:e,mimeType:t,size:n=24,absoluteStrokeWidth:s,...r}){const o=sKe(e,t),i=yye({kind:"file",title:e.replace(/[?#]/g,"_"),mimeType:t});return i!=="file"||o===Kwe?a.jsx("svg",{width:n,height:n,...r,"data-file-type-icon":i,children:a.jsx("image",{href:wye[i],width:"100%",height:"100%"})}):a.jsx(o,{size:n,absoluteStrokeWidth:s,...r})}const rKe="_panel_19vsn_1",oKe="_floating_19vsn_16",iKe="_section_19vsn_26",aKe="_sectionHeader_19vsn_40",lKe="_sectionHeaderRow_19vsn_59",cKe="_sectionAction_19vsn_70",uKe="_sectionContent_19vsn_111",dKe="_row_19vsn_115",hKe="_workspaceIcon_19vsn_158",fKe="_rowActionIcon_19vsn_162",pKe="_label_19vsn_168",mKe="_branchName_19vsn_173",gKe="_value_19vsn_181",vKe="_tasks_19vsn_191",wKe="_task_19vsn_191",yKe="_taskIcon_19vsn_229",bKe="_taskLabel_19vsn_240",xKe="_agentName_19vsn_248",kKe="_taskName_19vsn_249",_Ke="_agentColor_19vsn_260",SKe="_agentTag_19vsn_269",CKe="_taskStatus_19vsn_280",TKe="_statusRunning_19vsn_301",IKe="_attachmentFiles_19vsn_311",EKe="_attachmentFile_19vsn_311",RKe="_attachmentFileIcon_19vsn_344",AKe="_attachmentFileName_19vsn_348",jKe="_emptyDescription_19vsn_356",NKe="_sourceTitle_19vsn_363",Ur={panel:rKe,floating:oKe,section:iKe,sectionHeader:aKe,sectionHeaderRow:lKe,sectionAction:cKe,sectionContent:uKe,row:dKe,workspaceIcon:hKe,rowActionIcon:fKe,label:pKe,branchName:mKe,value:gKe,tasks:vKe,task:wKe,taskIcon:yKe,taskLabel:bKe,agentName:xKe,taskName:kKe,agentColor:_Ke,agentTag:SKe,taskStatus:CKe,statusRunning:TKe,attachmentFiles:IKe,attachmentFile:EKe,attachmentFileIcon:RKe,attachmentFileName:AKe,emptyDescription:jKe,sourceTitle:NKe};function xye({entries:e,onOpen:t}){const{t:n}=Ct();return a.jsx("ul",{className:Ur.attachmentFiles,children:e.map(s=>a.jsx("li",{children:a.jsxs("button",{type:"button",className:Ur.attachmentFile,title:dne(s),"aria-label":s.type==="source"?`${n("sources.open")} ${une(s)}`:void 0,disabled:!t,onClick:()=>t?.(s),children:[s.type==="source"&&s.source.kind==="link"?a.jsx(Xwe,{size:16,strokeWidth:1.7,className:Ur.attachmentFileIcon}):a.jsx(K0,{name:dne(s),mimeType:s.type==="attachment"?s.attachment.mimeType:void 0,size:16,strokeWidth:1.7,className:Ur.attachmentFileIcon,"aria-hidden":"true"}),a.jsx("span",{className:Ur.attachmentFileName,children:une(s)})]})},ZM(s)))})}function dw({className:e,...t}){return a.jsx("div",{"data-slot":"skeleton",className:cs("animate-pulse rounded-md bg-muted",e),...t})}function MKe(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("addSource")==="1"}function PKe({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:m}){const{t:g}=Ct(),[w,y]=d.useState(!1),[x,k]=d.useState(!1);d.useEffect(()=>{e&&k(!1)},[e]),d.useEffect(()=>{k(!1),y(!1)},[t?.owner,t?.supported]),d.useEffect(()=>(c?.(x&&t?.supported===!0),()=>c?.(!1)),[x,c,t?.supported]);const _=t?.supported?t.sources:[],S=cye(_,n);if(!t?.supported&&!S.length&&!s&&!r)return null;const I=s||t?.supported&&t.loading;return a.jsxs("section",{className:Ur.section,"aria-label":g("sources.title"),"data-testid":"sources-section",children:[a.jsxs("div",{className:Ur.sectionHeaderRow,children:[a.jsxs("h3",{className:`${Ur.sectionHeader} ${Ur.sourceTitle}`,children:[g("sources.title")," ",a.jsx("span",{className:"text-muted-foreground",children:S.length})]}),t?.supported&&MKe()&&a.jsx("button",{type:"button",className:Ur.sectionAction,"aria-label":g("sources.add"),onClick:()=>k(!0),children:a.jsx(ep,{})})]}),l&&a.jsxs("div",{className:Ur.emptyDescription,role:"alert",children:[g("sources.registrationFailed")," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:()=>void l(),children:g("common.retry")})]}),t?.supported&&t.error&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[t.error," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:()=>void t.refresh(),children:g("common.retry")})]}),r&&a.jsxs("div",{className:"mt-2 text-xs text-destructive",role:"alert",children:[g("sources.attachmentsLoadFailed",{error:r})," ",a.jsx(Wt,{size:"sm",variant:"link",onClick:o,children:g("common.retry")})]}),a.jsx(xye,{entries:w?S:S.slice(0,3),onOpen:R=>kye(R,{onOpen:i,onReadImage:u,onImagePreview:h,onAttachmentPreview:f,onAttachmentPreviewError:m})}),I&&!S.length&&a.jsx("ul",{className:Ur.attachmentFiles,"data-testid":"environment-file-list-skeleton",role:"status","aria-label":g("common.loading"),children:[72,88,64].map(R=>a.jsxs("li",{className:Ur.attachmentFile,children:[a.jsx(dw,{className:"size-4 shrink-0 rounded-sm"}),a.jsx(dw,{className:"h-4",style:{width:`${R}%`}})]},R))}),!I&&!S.length&&t?.hydrated&&!t.error&&!r&&a.jsx("p",{className:Ur.emptyDescription,children:g("sources.empty")}),S.length>3&&a.jsx("button",{type:"button",className:Ur.attachmentFile,"aria-expanded":w,onClick:()=>y(R=>!R),children:g(w?"common.collapse":"sources.viewAll")}),x&&t?.supported&&a.jsx(LKe,{state:t,onClose:()=>k(!1)})]})}function LKe({state:e,onClose:t}){const{t:n}=Ct(),[s,r]=d.useState("workspace_file"),[o,i]=d.useState(""),[l,c]=d.useState(""),[u,h]=d.useState(""),[f,m]=d.useState(),[g,w]=d.useState(!1),y=async()=>{w(!0),m(void 0);try{const x=s==="url"?new URL(o).hostname:o.split(/[\\/]/).at(-1)||o,k=s==="workspace_file"?{type:s,workspacePath:o}:{type:s,url:o};await e.upsert({title:l.trim()||x.trim().slice(0,200),locator:k,...u?{description:u}:{}}),e.owner.isCurrent()&&t()}catch(x){e.owner.isCurrent()&&m(x instanceof Error?x.message:String(x))}finally{e.owner.isCurrent()&&w(!1)}};return a.jsx(qa,{title:n("sources.add"),subtitle:n("sources.explanation"),onClose:t,size:"sm",children:a.jsxs("form",{className:"flex flex-col gap-3",onSubmit:x=>{x.preventDefault(),y()},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:x=>{r(x.target.value),i(""),m(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(hi,{value:o,onChange:x=>i(x.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(hi,{value:l,maxLength:200,onChange:x=>c(x.target.value)})]}),a.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[n("sources.description"),a.jsx(hi,{value:u,maxLength:1e3,onChange:x=>h(x.target.value)})]}),f&&a.jsx("div",{role:"alert",className:"text-xs text-destructive",children:f}),a.jsx(Wt,{type:"submit",disabled:g||!o,children:n("sources.add")})]})})}function kye(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})}/**
|
|
1095
1095
|
* @license
|
|
1096
1096
|
* Copyright 2026 Qwen Team
|
|
1097
1097
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -1615,7 +1615,7 @@ License: MIT
|
|
|
1615
1615
|
})();`,Adt=`<!doctype html>
|
|
1616
1616
|
<html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Idt}"></head>
|
|
1617
1617
|
<body><script>${Rdt}<\/script></body></html>`;function jdt(){const e=globalThis.crypto;if(!e?.getRandomValues)throw new sr("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 Wre(){return new DOMException("The temporary legacy chart operation was aborted","AbortError")}function Ndt(e){if(e.signal.aborted)return Promise.reject(Wre());if(!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<=0)return Promise.reject(new sr("SCHEMA_INVALID","Legacy sandbox timeout must be a positive safe integer"));if(typeof document>"u"||!document.body)return Promise.reject(new sr("LEGACY_SANDBOX_UNAVAILABLE","The temporary legacy sandbox requires a browser document body"));const t=jdt(),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=Adt,new Promise((s,r)=>{let o=!1,i=!1,l;const c=()=>{window.removeEventListener("message",m),e.signal.removeEventListener("abort",f),n.onload=null,n.onerror=null,l!==void 0&&clearTimeout(l),n.remove()},u=(g,w)=>{o||(o=!0,c(),g(w))},h=g=>{o||(o=!0,c(),r(g))},f=()=>h(Wre()),m=g=>{if(!(g.source!==n.contentWindow||!ja(g.data))&&!(g.data.channel!==eW||g.data.requestId!==t)){if(g.data.type==="error"){h(new sr("LEGACY_SANDBOX_EXECUTION_FAILED","Temporary legacy chart source failed in the isolated worker"));return}if(g.data.type==="result")try{const w=kbe(g.data.option);if(!ja(w))throw new sr("SCHEMA_INVALID","Temporary legacy chart source must produce a JSON object option");u(s,w)}catch(w){h(w)}}};window.addEventListener("message",m),e.signal.addEventListener("abort",f,{once:!0}),n.onerror=()=>h(new sr("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:eW,type:"execute",requestId:t,source:e.source,inputData:e.inputData},"*")}},l=setTimeout(()=>h(new sr("LEGACY_SANDBOX_TIMEOUT",`Temporary legacy chart sandbox exceeded ${e.timeoutMs}ms`)),e.timeoutMs),document.body.append(n)})}var ike=class extends Error{constructor(t,n,s){super(n,s&&"cause"in s?{cause:s.cause}:void 0);rt(this,"code");rt(this,"cause");this.name="LegacySandboxError",this.code=t,this.cause=s?.cause}},Mdt=Object.freeze({maxArtifactContentBytes:5*1024*1024,maxRows:2e3,maxColumns:200,maxCells:4e4,executionTimeoutMs:5e3});function Pdt(e,t){const n={...Mdt,...e,...t};for(const[s,r]of Object.entries(n))if(!Number.isSafeInteger(r)||r<=0)throw new sr("SCHEMA_INVALID",`legacyArtifactLimits.${s} must be a positive safe integer`);return n}async function ake(e){let t;try{t=await e.resolveContent()}catch(o){throw e.signal.aborted||e.preserveLegacySandboxError&&o instanceof ike?o:new sr("REF_RESOLUTION_FAILED",e.resolutionError,{cause:o})}if(typeof t!="string")throw new sr("SCHEMA_INVALID",e.returnTypeError);if(e.signal.aborted)throw new DOMException("The temporary legacy chart operation was aborted","AbortError");const n=_dt(t,e.limits),s=Tdt(e.source);if(!s)throw new sr("SCHEMA_INVALID","Temporary legacy chart source is empty after sanitization");const r=await Ndt({source:s,inputData:n.source,signal:e.signal,timeoutMs:e.limits.executionTimeoutMs});return{data:n,spec:r}}async function Ldt(e){return ake({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 Ddt(e){return ake({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 Odt=Object.freeze({maxRows:2e3,maxCells:4e4,maxSeries:100,maxDepth:40,maxNodes:1e5}),$dt=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"]),Bdt=new Set(["__proto__","prototype","constructor","extracsstext","renderitem","graphic","image","toolbox","dataview","transform","link","sublink","href","src","url"]),zdt=/(?:url|uri|href|src|link)$/i,Fdt=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,qre=/(?:^|[\s("'=])(?:https?:|file:|ftp:|blob:|data:|javascript:|vbscript:|\/\/|image:\/\/)/i,Hdt=/\burl\s*\(/i,Udt=/<\s*\/?\s*[a-z][^>]*>/i,Wdt=/&(?:#\d+|#x[\da-f]+|[a-z][\da-z]+);/i,qdt=/^[A-Za-z_][A-Za-z0-9_]*$/;function Ya(e){throw new sr("SCHEMA_INVALID",e)}function tW(e,t,n){for(const s of Object.keys(e))t.has(s)||Ya(`${n}.${s} is not allowed`)}function Vre(e,t){if(!Array.isArray(e)||e.length===0)return Ya(`${t} must be a non-empty array`);const n=e.map((s,r)=>typeof s!="string"||!qdt.test(s)?Ya(`${t}[${r}] must be a stable ASCII identifier`):s);return new Set(n).size!==n.length?Ya(`${t} must not contain duplicate dimensions`):n}function Vdt(e,t){if(!ja(e)||typeof e.kind!="string")return Ya("echarts-fulldata.data must be an inline or ref dataset object");if(e.kind==="inline"){tW(e,new Set(["kind","dimensions","source"]),"echarts-fulldata.data");const n=Vre(e.dimensions,"echarts-fulldata.data.dimensions");if(!Array.isArray(e.source))return Ya("echarts-fulldata.data.source must be an array");e.source.forEach((r,o)=>{Array.isArray(r)||Ya(`echarts-fulldata.data.source[${o}] must be an array`),r.length!==n.length&&Ya(`echarts-fulldata.data.source[${o}] must contain ${n.length} cells`)});const s=WL(e.source,t,"echarts-fulldata.data.source");return{kind:"inline",dimensions:n,source:s}}if(e.kind==="ref"){if(tW(e,new Set(["kind","ref","format","dimensions"]),"echarts-fulldata.data"),typeof e.ref!="string"||e.ref.trim().length===0)return Ya("echarts-fulldata.data.ref must be a non-empty string");if(e.format!=="csv"&&e.format!=="json")return Ya("echarts-fulldata.data.format must be csv or json");const n=Vre(e.dimensions,"echarts-fulldata.data.dimensions");return{kind:"ref",ref:e.ref,format:e.format,dimensions:n}}return Ya(`Unsupported echarts-fulldata.data.kind: ${e.kind}`)}function lke(e){const t=Array.isArray(e.title),n=t?e.title:[e.title];for(const[s,r]of n.entries()){if(!ja(r)||typeof r.text!="string")continue;const o=r.text.trim();if(o)return{index:s,isArray:t,title:r,text:o}}}function Gdt(e){return lke(e)?.text}function Kdt(e,t){const n=lke(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 xb(e){return Array.isArray(e)?e.map(t=>xb(t)):ja(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,xb(n)])):e}function cke(e,t){if(e!==void 0)return(!Array.isArray(e)||e.some(n=>typeof n!="string"||n.length===0))&&Ya(`${t} must be an array of non-empty strings`),[...e]}function WL(e,t,n){if(Array.isArray(e)||Ya(`${n} must be an array`),e.length>t.maxRows)throw new sr("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)&&Ya(`${n}[${i}][${u}] must be a JSON scalar`),c));return s+=l.length,l}if(ja(o)){const l={};for(const[c,u]of Object.entries(o))u!==null&&!["string","number","boolean"].includes(typeof u)&&Ya(`${n}[${i}].${c} must be a JSON scalar`),l[c]=u,s+=1;return l}return Ya(`${n}[${i}] must be an array or object`)});if(s>t.maxCells)throw new sr("LIMIT_EXCEEDED",`${n} exceeds the ${t.maxCells} cell limit`);return r}function Ydt(e,t){if(!ja(e)||typeof e.kind!="string")return Ya("echarts.data must be an inline or ref dataset object");const n=cke(e.dimensions,"echarts.data.dimensions");if(e.kind==="inline"){const s=WL(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?Ya("echarts.data.ref must be a non-empty string"):e.format!==void 0&&e.format!=="csv"&&e.format!=="json"?Ya("echarts.data.format must be csv or json"):{kind:"ref",ref:e.ref,...e.format?{format:e.format}:{},...n?{dimensions:n}:{}}:Ya(`Unsupported echarts.data.kind: ${e.kind}`)}function Gre(e,t){if(Fdt.test(e))throw new sr("UNSAFE_SPEC",`${t} contains an ASCII control character`);const n=e.replace(/[\n\r\t]/g,""),s=e.trim();if(qre.test(s)||qre.test(n.trim())||Hdt.test(e)||Udt.test(e)||Wdt.test(e))throw new sr("UNSAFE_SPEC",`${t} contains a URL, CSS URL, or unsafe markup`)}function Xdt(e,t){for(const r of Object.keys(e))if(!$dt.has(r))throw new sr("UNSAFE_SPEC",`echarts.option.${r} is not allowed`);let n=0;const s=(r,o,i)=>{if(n+=1,n>t.maxNodes)throw new sr("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxNodes} node limit`);if(i>t.maxDepth)throw new sr("LIMIT_EXCEEDED",`ECharts option exceeds the ${t.maxDepth} depth limit`);if(typeof r=="string"){Gre(r,o);return}if(Array.isArray(r)){r.forEach((l,c)=>s(l,`${o}[${c}]`,i+1));return}if(ja(r))for(const[l,c]of Object.entries(r)){const u=l.toLowerCase();if(u==="formatter"){if(typeof c!="string")throw new sr("UNSAFE_SPEC",`${o}.${l} must be a string`);Gre(c,`${o}.${l}`);continue}if(Bdt.has(u)||zdt.test(l))throw new sr("UNSAFE_SPEC",`${o}.${l} is not allowed`);if(l==="type"&&c==="custom")throw new sr("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 sr("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)=>{ja(o)||Ya(`echarts.option.dataset[${i}] must be an object`),o.source!==void 0&&WL(o.source,t,`echarts.option.dataset[${i}].source`)})}function nW(e,t,n){if(!ja(e))return Ya("ECharts specification must be an object");if(Object.prototype.hasOwnProperty.call(e,"option")||Object.prototype.hasOwnProperty.call(e,"data"))return Ya("Canonical markdown-chart data must be a sibling of spec; spec must contain the ECharts option directly");const s=xb(e),r=t===void 0?void 0:Ydt(t,n);return r&&Object.prototype.hasOwnProperty.call(s,"dataset")?Ya("echarts.option.dataset cannot be combined with echarts.data"):(Xdt(s,n),{option:s,data:r})}function Zdt(e,t){if(!ja(e))return Ya("echarts-fulldata must contain an object");if(tW(e,new Set(["version","data","option"]),"echarts-fulldata"),e.version!==1)throw new sr("UNSUPPORTED_VERSION","Only echarts-fulldata version 1 is supported");if(!Object.prototype.hasOwnProperty.call(e,"data"))return Ya("echarts-fulldata.data is required");if(!ja(e.option))return Ya("echarts-fulldata.option must be an object");const n=Vdt(e.data,t);return nW(e.option,n,t)}function Jdt(e){const t="default"in e?e.default:e;if(!t||typeof t.init!="function")throw new sr("RUNTIME_LOAD_FAILED","The supplied ECharts runtime has no init function");return t}function Kre(e,t){const n=WL(e.source,t,"resolvedDataset.source"),s=e.dimensions?cke(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 Qdt={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 U0(e,t){const n={...xb(e),...t};for(const[s,r]of Object.entries(e)){const o=t[s];ja(r)&&ja(o)&&(n[s]=U0(r,o))}return n}function FR(e,t){return Array.isArray(e)?e.map(n=>ja(n)?U0(t,n):n):ja(e)?U0(t,e):e??xb(t)}function uke(e){const t=n=>ja(n)?{...n,appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}:n;return Array.isArray(e)?e.map(t):t(e)}function yA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function eht(e,t){const n=s=>{if(!yA(s,"top")&&!yA(s,"bottom"))return U0(t,s);const r=xb(t);return delete r.top,delete r.bottom,U0(r,s)};return Array.isArray(e)?e.map(s=>ja(s)?n(s):s):ja(e)?n(e):e??xb(t)}var tht=740,dke=10,Yre=tht*dke/100,nht=24,sht=24,Xre=16,rht=24;function hke(e){if(typeof e=="number")return Number.isFinite(e)&&e>=0&&e<=Yre?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<=dke?Yre:null}function oht(e){return["text","subtext"].some(t=>typeof e[t]=="string"&&e[t].trim().length>0)}function iht(e){return e.show===!1||!oht(e)?null:yA(e,"top")?hke(e.top):yA(e,"bottom")?null:0}function aht(e){return e.show===!1||!yA(e,"top")?null:hke(e.top)}function Zre(e){return Array.isArray(e)?e.filter(ja):ja(e)?[e]:[]}function lht(e,t){const n=Zre(e).flatMap(r=>{const o=iht(r);return o===null?[]:[o+nht+Xre]}),s=Zre(t).flatMap(r=>{const o=aht(r);return o===null?[]:[o+sht+Xre]});return Math.max(rht,...n,...s)}function Jre(e,t){return Array.isArray(e)?e.map((n,s)=>ja(n)?U0(t(s),n):n):ja(e)?U0(t(0),e):e}function Qre(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=U0(s,{lineStyle:{width:2},itemStyle:{borderWidth:1},symbol:"circle",symbolSize:4}):n==="bar"?s=U0(s,{barCategoryGap:"48%",barMaxWidth:42,itemStyle:{borderRadius:[3,3,0,0]}}):n==="pie"&&(s=U0(s,{itemStyle:{borderColor:t.seriesBorder,borderWidth:2}}));const r=U0(s,e);return Object.prototype.hasOwnProperty.call(e,"tooltip")&&(r.tooltip=uke(FR(e.tooltip,{appendToBody:!1,confine:!0,enterable:!1,renderMode:"richText"}))),r}var fke=new Set(["pie","funnel","gauge","radar","treemap"]),cht=new Set([...fke,"graph","chord","themeRiver"]);function pke(e){return Array.isArray(e.series)?e.series.filter(ja):ja(e.series)?[e.series]:[]}function uht(e){if(Object.prototype.hasOwnProperty.call(e,"legend"))return!0;const t=pke(e);return t.some(n=>typeof n.type=="string"&&cht.has(n.type))?!0:t.filter(n=>typeof n.name=="string"&&n.name.trim().length>0).length>1}function dht(e){if(!Object.prototype.hasOwnProperty.call(e,"xAxis")&&!Object.prototype.hasOwnProperty.call(e,"yAxis"))return"item";const t=pke(e);return t.length>0&&t.every(n=>typeof n.type=="string"&&fke.has(n.type))?"item":"axis"}function hht(e){return e==null||e==="light"?"light":e==="dark"?"dark":void 0}function fht(e,t="light"){const n=Qdt[t],s=xb(e);return s.backgroundColor??=n.background,s.color??=[...n.palette],s.textStyle=FR(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=FR(s.title,{textStyle:{color:n.titleText},subtextStyle:{color:n.subtext}})),s.tooltip=uke(FR(s.tooltip,{trigger:dht(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}}})),uht(e)&&(s.legend=eht(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=FR(s.grid,{top:lht(s.title,s.legend),right:36,bottom:48,left:24,containLabel:!0}),s.xAxis!==void 0&&(s.xAxis=Jre(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=Jre(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=>ja(r)?Qre(r,n):r):ja(s.series)&&(s.series=Qre(s.series,n)),s}var kB={dispose(){}};function pht(e={}){const t={...Odt,...e.limits},n=e.legacySandbox?.resolveLegacyArtifactContent,s=e.legacySandbox?.resolveLegacySandboxFileContent,r=e.legacySandbox?Pdt({maxRows:t.maxRows,maxCells:t.maxCells},void 0):void 0,o=e.loadECharts??(async()=>await Je(()=>import("./index-CL4z8Fsq.js"),[])),i=async(l,c)=>{if(e.validateDataRef&&!e.validateDataRef(l.ref))throw new sr("REF_REJECTED","The host rejected the chart data reference");if(!e.resolveDataRef)throw new sr("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 sr("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 Kre(h,t).data};return{id:"echarts",aliases:["echarts-fulldata"],matchLanguage:ydt,parse(l,c){return c.language==="echarts-fulldata"?Zdt(l,t):nW(l,c.data,t)},parseSource(l,c){return oke(c.language)?{option:{},data:void 0,legacyEChartSandboxFile:xdt(c.rawLanguage??c.language,l)}:{option:{},data:void 0,legacyEChartQuery:bdt(c.language,l)}},getTitle(l){return Gdt(l.option)},async materialize(l,c){if(!l.legacyEChartQuery&&!l.legacyEChartSandboxFile){if(l.data?.kind==="ref"){const m=await i(l.data,c.signal);return m?{parsed:{...l,data:m},data:m}:{parsed:l,data:c.data}}return{parsed:l,data:l.data}}if(l.legacyEChartQuery&&!n)throw new sr("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI query fence");if(l.legacyEChartSandboxFile&&!s)throw new sr("REF_RESOLVER_MISSING","legacySandbox is required for this temporary ChatBI sandbox-file fence");let u;try{l.legacyEChartSandboxFile?u=await Ddt({block:l.legacyEChartSandboxFile,signal:c.signal,resolveSandboxFileContent:s,limits:r,preserveLegacySandboxError:e.legacySandbox!==void 0}):u=await Ldt({block:l.legacyEChartQuery,signal:c.signal,resolveArtifactContent:n,limits:r,preserveLegacySandboxError:!0})}catch(m){if(c.signal.aborted)return{parsed:l,data:c.data};throw m instanceof sr||m instanceof ike?m:new sr("REF_RESOLUTION_FAILED","The temporary ChatBI chart could not be resolved",{cause:m})}if(c.signal.aborted)return{parsed:l,data:c.data};let h;try{h=kbe(u,{maxDepth:t.maxDepth,maxNodes:t.maxNodes})}catch(m){throw m instanceof sr?m:new sr("SCHEMA_INVALID","Temporary ChatBI resolver returned a non-JSON result",{cause:m})}if(!ja(h))return Ya("Temporary ChatBI resolver must return an object");if(!Object.prototype.hasOwnProperty.call(h,"data")||!Object.prototype.hasOwnProperty.call(h,"spec"))return Ya("Temporary ChatBI resolver must return data and spec");const f=nW(h.spec,h.data,t);return f.data?.kind!=="inline"?Ya("Temporary ChatBI resolver must return inline data"):{parsed:f,data:f.data}},async mount(l,c,u){if(c.legacyEChartQuery||c.legacyEChartSandboxFile)return Ya("Temporary ChatBI charts must be materialized before mounting");const h=xb(c.option);if(u.externalizedTitle&&Kdt(h,u.externalizedTitle),c.data){let x;if(c.data.kind==="inline")x=c.data;else{const _=await i(c.data,u.signal);if(!_)return kB;x=_}const k=Kre(x,t);h.dataset=k.option}if(u.signal.aborted)return kB;let f;try{f=Jdt(await o())}catch(x){throw x instanceof sr?x:new sr("RUNTIME_LOAD_FAILED","The ECharts runtime could not be loaded",{cause:x})}if(u.signal.aborted)return kB;let m,g;try{const x=typeof u.theme=="string"||ja(u.theme)?u.theme:void 0;m=f.init(l,x);const k=hht(u.theme),_=e.defaultStyle===!1||!k?h:fht(h,k);m.setOption(_,{notMerge:!0,lazyUpdate:!1}),e.resizeObserver!==!1&&typeof ResizeObserver<"u"&&(g=new ResizeObserver(()=>m?.resize()),g.observe(l))}catch(x){try{g?.disconnect()}catch{}try{m?.dispose()}catch{}throw new sr("RENDER_FAILED","ECharts failed to render the chart",{cause:x})}const w=m;let y=!1;return{resize:()=>w.resize(),dispose(){y||(y=!0,g?.disconnect(),w.dispose())}}}}}var zY=d.createContext(null);function mht(e){if(d.isValidElement(e))return typeof e.props.children=="string"?e.props.children:void 0}function ght(e){const t=e.source??mht(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(zY.Provider,{value:n},e.children)}function vht(e){const t=d.useContext(zY);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(()=>Sbe(o),[o]);d.useEffect(()=>{const c=n.current;if(!c)return;const u=new Eet(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 wht(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(`
|
|
1618
|
-
`,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return Tbe(e.slice(i,s))||e.slice(s).trim().length>0}function mke(e,t){return e===QM||t?.has(e)===!0}function yht(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(zY);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&mke(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(m=>typeof m=="string"||typeof m=="number"?String(m):"").join("");return d.createElement(vht,{language:u,source:f,streaming:i?.streaming===!0&&!wht(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const bht=3e4,xht=["artifact://","session-file://"],kht=/^[a-z]:/i;function _ht(e={}){const{resolveDataRef:t,validateDataRef:n=Eht,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?gke(i):i;if(!c)throw new Error("Chart data reference is not supported.");return Rht(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new det().register(pht({...s,resolveDataRef:o,validateDataRef:n}))}const Sht={registry:_ht()};function Cht(e,t={}){const n=yht(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&&mke(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function Tht({customization:e,source:t,streaming:n,theme:s,children:r}){const o=Iht(e.labels),{t:i}=Ct();return a.jsx(ght,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function Iht(e){const{t}=Ct();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 eoe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function gke(e){if(e.trim()!==e||!e||eoe(e))return;const t=e.toLowerCase(),n=xht.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)||eoe(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||kht.test(i)))return`${n}${o.join("/")}`}function Eht(e){return gke(e)!==void 0}function Rht(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),bht);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const Aht="_content_1ns4y_1",jht="_streamingPlainText_1ns4y_11",Nht="_inlineCode_1ns4y_135",Mht="_link_1ns4y_147",Pht="_tableWrapper_1ns4y_157",Lht="_table_1ns4y_157",Dht="_image_1ns4y_187",Oht="_codeBlock_1ns4y_195",$ht="_codeBlockHeader_1ns4y_204",Bht="_codeBlockLang_1ns4y_213",zht="_codeBlockCopy_1ns4y_221",Fht="_codeBlockContent_1ns4y_244",Hht="_codeBlockPlain_1ns4y_264",Uht="_mermaidBlock_1ns4y_282",Wht="_mermaidInline_1ns4y_294",qht="_mermaidStage_1ns4y_308",Vht="_mermaidLoading_1ns4y_331",Ght="_mermaidActions_1ns4y_338",Kht="_mermaidZoomWrapper_1ns4y_343",Yht="_mermaidPannable_1ns4y_358",Xht="_mermaidDragging_1ns4y_362",ri={content:Aht,streamingPlainText:jht,inlineCode:Nht,link:Mht,tableWrapper:Pht,table:Lht,image:Dht,codeBlock:Oht,codeBlockHeader:$ht,codeBlockLang:Bht,codeBlockCopy:zht,codeBlockContent:Fht,codeBlockPlain:Hht,mermaidBlock:Uht,mermaidInline:Wht,mermaidStage:qht,mermaidLoading:Vht,mermaidActions:Ght,mermaidZoomWrapper:Kht,mermaidPannable:Yht,mermaidDragging:Xht},Zht=32e3,Jht=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"]),toe={"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 FY(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(toe,t)?toe[t]:t,s=Jht.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const vke=/^(https?:|mailto:)/i,Qht=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,wke=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function X4(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:vke.test(t):!1}function Ww(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?wke.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||Qht.test(n)?!0:vke.test(n):!1}let noe,soe=Promise.resolve(),eft=0;const tft=5e4,nft=500,sft=1e4,roe=16;function rft({code:e}){const{t}=Ct(),n=Rb(),s=Vl()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=Nx(),[m,g]=d.useState(1),[w,y]=d.useState(!1),x=d.useRef(null),[k,_]=d.useState(!1),[S,I]=d.useState(!1),[R,A]=d.useState(null),j=d.useRef(null),L=d.useRef(null),E=n==="light"?"default":"dark",N=.5,M=3,$=.25,P=()=>{g(V=>Math.min(M,Math.round((V+$)*100)/100))},z=()=>{g(V=>Math.max(N,Math.round((V-$)*100)/100))},H=d.useCallback(()=>{L.current=null,y(!1),g(1);const V=x.current;V&&(V.scrollLeft=0,V.scrollTop=0),_(!1)},[]),O=d.useCallback(V=>{const J=x.current;J&&(V.preventDefault(),y(!0),L.current={startX:V.clientX,startY:V.clientY,startLeft:J.scrollLeft,startTop:J.scrollTop})},[]),Y=d.useCallback(V=>{const{scrollLeft:J,scrollTop:q}=V.currentTarget;_(J!==0||q!==0)},[]),Z=d.useCallback(()=>{const V=x.current;V&&(I(V.scrollWidth>V.clientWidth||V.scrollHeight>V.clientHeight),_(V.scrollLeft!==0||V.scrollTop!==0))},[]),K=d.useCallback(()=>{const V=x.current,J=j.current?.querySelector("svg");if(!V||!J)return;const[,,q,te]=(J.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),ie=(J.getAttribute("width")??"").trim(),ge=Number.parseFloat(J.getAttribute("height")??""),re=q>0&&te>0,G=re?q:Number.parseFloat(ie),Q=re?te:ge;if(!(G>0)||!(Q>0)){A(null);return}const he=V.clientWidth-roe*2,ve=ie.endsWith("%")&&he>0?Math.min(G,he):G,ye=Math.max(0,V.offsetHeight-V.clientHeight);A({stageWidth:ve,canvasHeight:ve*Q/G+roe*2+ye})},[]);d.useEffect(()=>{if(!w)return;const V=q=>{const te=x.current,ie=L.current;!te||!ie||(te.scrollLeft=ie.startLeft-(q.clientX-ie.startX),te.scrollTop=ie.startTop-(q.clientY-ie.startY),_(te.scrollLeft!==0||te.scrollTop!==0))},J=()=>{L.current=null,y(!1)};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",J),window.addEventListener("blur",J),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",J),window.removeEventListener("blur",J)}},[w]),d.useEffect(()=>{H()},[e,H]),d.useLayoutEffect(()=>{K(),Z()},[r,m,c,K,Z]),d.useEffect(()=>{const V=x.current;if(!V)return;const J=new ResizeObserver(()=>{K(),Z()});return J.observe(V),()=>J.disconnect()},[r,c,K,Z]),d.useEffect(()=>{let V=!1;o(null),l(null);const J=setTimeout(()=>{Je(()=>import("./mermaid.core-1L-v7Osp.js").then(q=>q.cb),[]).then(async q=>{if(V)return;const te=q.default,ie=`${E}:${s?"hardened":"runtime"}`,ge=soe.then(async()=>{if(V)throw new Error("Mermaid render skipped");noe!==ie&&(te.initialize({startOnLoad:!1,theme:E,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:tft,maxEdges:nft}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),noe=ie);const G=`mermaid-${++eft}`;if(!s)return te.render(G,e.trim());let Q;try{return await Promise.race([te.render(G,e.trim()),new Promise((he,ve)=>{Q=setTimeout(()=>ve(new Error("Mermaid render timed out")),sft)})])}finally{Q!==void 0&&clearTimeout(Q)}});soe=ge.then(()=>{},()=>{});const{svg:re}=await ge;V||o(re)}).catch(q=>{V||l(q instanceof Error?q.message:"Mermaid render failed")})},150);return()=>{V=!0,clearTimeout(J)}},[e,s,E]);const B=()=>{Xf(e).then(()=>{f()}).catch(Y0)};return i?a.jsxs("div",{className:ri.codeBlock,children:[a.jsx("div",{className:ri.codeBlockHeader,children:a.jsx("span",{className:ri.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:ri.codeBlock,children:[a.jsxs("div",{className:ri.codeBlockHeader,children:[a.jsx("span",{className:ri.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:ri.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:ri.codeBlockCopy,onClick:z,title:t("mermaid.zoomOut"),disabled:m<=N,children:t("mermaid.zoomOut")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:H,title:t("mermaid.zoomReset"),disabled:m===1&&!k,children:t("mermaid.zoomReset")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:P,title:t("mermaid.zoomIn"),disabled:m>=M,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:ri.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:B,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${ri.mermaidZoomWrapper} ${S?ri.mermaidPannable:""} ${S&&w?ri.mermaidDragging:""}`,ref:x,style:R?{height:R.canvasHeight}:void 0,onMouseDown:O,onDoubleClick:H,onScroll:Y,children:a.jsx("div",{className:`${ri.mermaidBlock} ${ri.mermaidStage}`,ref:j,style:{...R?{width:R.stageWidth}:{},...m===1?{}:{zoom:m}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${ri.mermaidBlock} ${ri.mermaidLoading} ${ri.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function oft({className:e,children:t,isStreaming:n}){const{t:s}=Ct(),r=Rb(),o=Vl()==="document",[i,l]=d.useState(null),[c,u]=Nx(),{label:h,lang:f,resolvedLang:m}=FY(yke(e)),g=String(t).replace(/\n$/,""),w=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||m==="text"||XU(g)){l(null);return}const x=Qlt(g,m,w);if(x!==null){l(x);return}const k=Pre(g,m,w,!0);if(k!==null){l(k);return}l(null);let _=!1;return Hxe(m).then(()=>{if(_)return;const S=Pre(g,m,w,!0);S!==null&&l(S)}).catch(S=>{_||(console.warn("[web-shell] highlight failed for lang=%s",m,S),l(null))}),()=>{_=!0}},[g,o,f,m,w,n]);const y=()=>{Xf(g).then(()=>{u()}).catch(Y0)};return f==="mermaid"&&!n&&!o?a.jsx(rft,{code:g}):a.jsxs("div",{className:ri.codeBlock,children:[a.jsxs("div",{className:ri.codeBlockHeader,children:[a.jsx("span",{className:ri.codeBlockLang,children:h}),a.jsx("button",{className:ri.codeBlockCopy,onClick:y,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:ri.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:g})})]})}function yke(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 ift({children:e}){return a.jsx("code",{className:ri.inlineCode,children:e})}function ooe({children:e}){return a.jsx("div",{className:ri.tableWrapper,children:a.jsx("table",{className:ri.table,children:e})})}const bke=d.createContext(!1),xke=d.createContext(void 0),kke=d.createContext(void 0);function aft(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:!Tbe(e.slice(s,r))&&e.slice(r).trim().length===0}function lft({className:e,children:t,node:n}){const s=d.useContext(bke),r=d.useContext(kke);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1618
|
+
`,Math.max(0,n-1))+1,o=e.slice(r,n),i=/^(?: {0,3}>[ \t]?)+$/.test(o)?r:n;return Tbe(e.slice(i,s))||e.slice(s).trim().length>0}function mke(e,t){return e===QM||t?.has(e)===!0}function yht(e={}){return{code({node:n,...s}){return d.createElement("code",s)},pre:function({node:s,children:r,...o}){const i=d.useContext(zY);if(d.isValidElement(r)){const l=r,u=/(?:^|\s)language-([^\s]+)/.exec(l.props.className??"")?.[1],h=u?.toLowerCase();if(u&&h&&mke(h,i?.registry)){const f=d.Children.toArray(l.props.children).map(m=>typeof m=="string"||typeof m=="number"?String(m):"").join("");return d.createElement(vht,{language:u,source:f,streaming:i?.streaming===!0&&!wht(i.source,s),...e.chartClassName?{className:e.chartClassName}:{},...e.chartStyle?{style:e.chartStyle}:{}})}}return d.createElement("pre",o,r)}}}const bht=3e4,xht=["artifact://","session-file://"],kht=/^[a-z]:/i;function _ht(e={}){const{resolveDataRef:t,validateDataRef:n=Eht,...s}=e,r=e.validateDataRef===void 0,o=t?async(i,l)=>{const c=r?gke(i):i;if(!c)throw new Error("Chart data reference is not supported.");return Rht(Promise.resolve(t(c,l)),"Chart data reference resolution")}:void 0;return new det().register(pht({...s,resolveDataRef:o,validateDataRef:n}))}const Sht={registry:_ht()};function Cht(e,t={}){const n=yht(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&&mke(c,e))return d.createElement(n,o,r)}return d.createElement(d.Fragment,null,r)}}function Tht({customization:e,source:t,streaming:n,theme:s,children:r}){const o=Iht(e.labels),{t:i}=Ct();return a.jsx(ght,{registry:e.registry,source:t,streaming:n,theme:s,loadingLabel:e.loadingLabel??i("echartsChart.rendering"),labels:o,onError:e.onError,children:r})}function Iht(e){const{t}=Ct();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 eoe(e){return/\s/.test(e)||Array.from(e).some(t=>{const n=t.codePointAt(0);return n!==void 0&&(n<=31||n===127)})}function gke(e){if(e.trim()!==e||!e||eoe(e))return;const t=e.toLowerCase(),n=xht.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)||eoe(r))return;const o=r.split("/");if(!o.some(i=>i.length===0||i==="."||i===".."||kht.test(i)))return`${n}${o.join("/")}`}function Eht(e){return gke(e)!==void 0}function Rht(e,t){return new Promise((n,s)=>{const r=globalThis.setTimeout(()=>s(new Error(`${t} timed out.`)),bht);e.then(n,s).finally(()=>globalThis.clearTimeout(r))})}const Aht="_content_1ns4y_1",jht="_streamingPlainText_1ns4y_11",Nht="_inlineCode_1ns4y_135",Mht="_link_1ns4y_147",Pht="_tableWrapper_1ns4y_157",Lht="_table_1ns4y_157",Dht="_image_1ns4y_187",Oht="_codeBlock_1ns4y_195",$ht="_codeBlockHeader_1ns4y_204",Bht="_codeBlockLang_1ns4y_213",zht="_codeBlockCopy_1ns4y_221",Fht="_codeBlockContent_1ns4y_244",Hht="_codeBlockPlain_1ns4y_264",Uht="_mermaidBlock_1ns4y_282",Wht="_mermaidInline_1ns4y_294",qht="_mermaidStage_1ns4y_308",Vht="_mermaidLoading_1ns4y_331",Ght="_mermaidActions_1ns4y_338",Kht="_mermaidZoomWrapper_1ns4y_343",Yht="_mermaidPannable_1ns4y_358",Xht="_mermaidDragging_1ns4y_362",ri={content:Aht,streamingPlainText:jht,inlineCode:Nht,link:Mht,tableWrapper:Pht,table:Lht,image:Dht,codeBlock:Oht,codeBlockHeader:$ht,codeBlockLang:Bht,codeBlockCopy:zht,codeBlockContent:Fht,codeBlockPlain:Hht,mermaidBlock:Uht,mermaidInline:Wht,mermaidStage:qht,mermaidLoading:Vht,mermaidActions:Ght,mermaidZoomWrapper:Kht,mermaidPannable:Yht,mermaidDragging:Xht},Zht=32e3,Jht=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"]),toe={"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 FY(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(toe,t)?toe[t]:t,s=Jht.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const vke=/^(https?:|mailto:)/i,Qht=/^data:image\/(png|jpeg|gif|webp|bmp);base64,/i,wke=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]*={0,2}$/i;function X4(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:vke.test(t):!1}function Ww(e,t=!1){if(!e)return!1;const n=e.trim();return n?t?wke.test(n):n.startsWith("#")||n.startsWith("/")&&!n.startsWith("//")||Qht.test(n)?!0:vke.test(n):!1}let noe,soe=Promise.resolve(),eft=0;const tft=5e4,nft=500,sft=1e4,roe=16;function rft({code:e}){const{t}=Ct(),n=Rb(),s=Vl()!=="interactive",[r,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState("diagram"),[h,f]=Nx(),[m,g]=d.useState(1),[w,y]=d.useState(!1),x=d.useRef(null),[k,_]=d.useState(!1),[S,I]=d.useState(!1),[R,A]=d.useState(null),j=d.useRef(null),L=d.useRef(null),E=n==="light"?"default":"dark",N=.5,M=3,$=.25,P=()=>{g(V=>Math.min(M,Math.round((V+$)*100)/100))},z=()=>{g(V=>Math.max(N,Math.round((V-$)*100)/100))},H=d.useCallback(()=>{L.current=null,y(!1),g(1);const V=x.current;V&&(V.scrollLeft=0,V.scrollTop=0),_(!1)},[]),O=d.useCallback(V=>{const J=x.current;J&&(V.preventDefault(),y(!0),L.current={startX:V.clientX,startY:V.clientY,startLeft:J.scrollLeft,startTop:J.scrollTop})},[]),Y=d.useCallback(V=>{const{scrollLeft:J,scrollTop:q}=V.currentTarget;_(J!==0||q!==0)},[]),Z=d.useCallback(()=>{const V=x.current;V&&(I(V.scrollWidth>V.clientWidth||V.scrollHeight>V.clientHeight),_(V.scrollLeft!==0||V.scrollTop!==0))},[]),K=d.useCallback(()=>{const V=x.current,J=j.current?.querySelector("svg");if(!V||!J)return;const[,,q,te]=(J.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number),ie=(J.getAttribute("width")??"").trim(),ge=Number.parseFloat(J.getAttribute("height")??""),re=q>0&&te>0,G=re?q:Number.parseFloat(ie),Q=re?te:ge;if(!(G>0)||!(Q>0)){A(null);return}const he=V.clientWidth-roe*2,ve=ie.endsWith("%")&&he>0?Math.min(G,he):G,ye=Math.max(0,V.offsetHeight-V.clientHeight);A({stageWidth:ve,canvasHeight:ve*Q/G+roe*2+ye})},[]);d.useEffect(()=>{if(!w)return;const V=q=>{const te=x.current,ie=L.current;!te||!ie||(te.scrollLeft=ie.startLeft-(q.clientX-ie.startX),te.scrollTop=ie.startTop-(q.clientY-ie.startY),_(te.scrollLeft!==0||te.scrollTop!==0))},J=()=>{L.current=null,y(!1)};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",J),window.addEventListener("blur",J),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",J),window.removeEventListener("blur",J)}},[w]),d.useEffect(()=>{H()},[e,H]),d.useLayoutEffect(()=>{K(),Z()},[r,m,c,K,Z]),d.useEffect(()=>{const V=x.current;if(!V)return;const J=new ResizeObserver(()=>{K(),Z()});return J.observe(V),()=>J.disconnect()},[r,c,K,Z]),d.useEffect(()=>{let V=!1;o(null),l(null);const J=setTimeout(()=>{Je(()=>import("./mermaid.core-C4GAuwX5.js").then(q=>q.cb),[]).then(async q=>{if(V)return;const te=q.default,ie=`${E}:${s?"hardened":"runtime"}`,ge=soe.then(async()=>{if(V)throw new Error("Mermaid render skipped");noe!==ie&&(te.initialize({startOnLoad:!1,theme:E,securityLevel:"strict",suppressErrorRendering:!0,...s?{maxTextSize:tft,maxEdges:nft}:{},flowchart:{wrappingWidth:300,useMaxWidth:!1}}),noe=ie);const G=`mermaid-${++eft}`;if(!s)return te.render(G,e.trim());let Q;try{return await Promise.race([te.render(G,e.trim()),new Promise((he,ve)=>{Q=setTimeout(()=>ve(new Error("Mermaid render timed out")),sft)})])}finally{Q!==void 0&&clearTimeout(Q)}});soe=ge.then(()=>{},()=>{});const{svg:re}=await ge;V||o(re)}).catch(q=>{V||l(q instanceof Error?q.message:"Mermaid render failed")})},150);return()=>{V=!0,clearTimeout(J)}},[e,s,E]);const B=()=>{Xf(e).then(()=>{f()}).catch(Y0)};return i?a.jsxs("div",{className:ri.codeBlock,children:[a.jsx("div",{className:ri.codeBlockHeader,children:a.jsx("span",{className:ri.codeBlockLang,children:t("mermaid.errorLabel")})}),a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:e})})]}):a.jsxs("div",{className:ri.codeBlock,children:[a.jsxs("div",{className:ri.codeBlockHeader,children:[a.jsx("span",{className:ri.codeBlockLang,children:t("mermaid.label")}),a.jsxs("span",{className:ri.mermaidActions,children:[c==="diagram"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:ri.codeBlockCopy,onClick:z,title:t("mermaid.zoomOut"),disabled:m<=N,children:t("mermaid.zoomOut")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:H,title:t("mermaid.zoomReset"),disabled:m===1&&!k,children:t("mermaid.zoomReset")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:P,title:t("mermaid.zoomIn"),disabled:m>=M,children:t("mermaid.zoomIn")})]}),a.jsx("button",{className:ri.codeBlockCopy,onClick:()=>u(c==="diagram"?"code":"diagram"),children:t(c==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),a.jsx("button",{className:ri.codeBlockCopy,onClick:B,children:t(h?"code.copied":"code.copy")})]})]}),c==="code"?a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:e})}):r?a.jsx("div",{className:`${ri.mermaidZoomWrapper} ${S?ri.mermaidPannable:""} ${S&&w?ri.mermaidDragging:""}`,ref:x,style:R?{height:R.canvasHeight}:void 0,onMouseDown:O,onDoubleClick:H,onScroll:Y,children:a.jsx("div",{className:`${ri.mermaidBlock} ${ri.mermaidStage}`,ref:j,style:{...R?{width:R.stageWidth}:{},...m===1?{}:{zoom:m}},dangerouslySetInnerHTML:{__html:r}})}):a.jsx("div",{className:`${ri.mermaidBlock} ${ri.mermaidLoading} ${ri.mermaidInline}`,children:a.jsx("span",{children:t("mermaid.rendering")})})]})}function oft({className:e,children:t,isStreaming:n}){const{t:s}=Ct(),r=Rb(),o=Vl()==="document",[i,l]=d.useState(null),[c,u]=Nx(),{label:h,lang:f,resolvedLang:m}=FY(yke(e)),g=String(t).replace(/\n$/,""),w=r==="light"?"github-light-default":"github-dark-default";d.useEffect(()=>{if(o||n||f==="mermaid"||m==="text"||XU(g)){l(null);return}const x=Qlt(g,m,w);if(x!==null){l(x);return}const k=Pre(g,m,w,!0);if(k!==null){l(k);return}l(null);let _=!1;return Hxe(m).then(()=>{if(_)return;const S=Pre(g,m,w,!0);S!==null&&l(S)}).catch(S=>{_||(console.warn("[web-shell] highlight failed for lang=%s",m,S),l(null))}),()=>{_=!0}},[g,o,f,m,w,n]);const y=()=>{Xf(g).then(()=>{u()}).catch(Y0)};return f==="mermaid"&&!n&&!o?a.jsx(rft,{code:g}):a.jsxs("div",{className:ri.codeBlock,children:[a.jsxs("div",{className:ri.codeBlockHeader,children:[a.jsx("span",{className:ri.codeBlockLang,children:h}),a.jsx("button",{className:ri.codeBlockCopy,onClick:y,children:s(c?"code.copied":"code.copy")})]}),!o&&!n&&i!==null?a.jsx("div",{className:ri.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):a.jsx("pre",{className:`${ri.codeBlockContent} ${ri.codeBlockPlain}`,children:a.jsx("code",{children:g})})]})}function yke(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 ift({children:e}){return a.jsx("code",{className:ri.inlineCode,children:e})}function ooe({children:e}){return a.jsx("div",{className:ri.tableWrapper,children:a.jsx("table",{className:ri.table,children:e})})}const bke=d.createContext(!1),xke=d.createContext(void 0),kke=d.createContext(void 0);function aft(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:!Tbe(e.slice(s,r))&&e.slice(r).trim().length===0}function lft({className:e,children:t,node:n}){const s=d.useContext(bke),r=d.useContext(kke);return e?.startsWith("language-")||typeof t=="string"&&t.includes(`
|
|
1619
1619
|
`)?a.jsx(cft,{className:e,isStreaming:s,isIncomplete:aft(r,n,s),children:t}):a.jsx(ift,{children:t})}function cft({className:e,children:t,isStreaming:n,isIncomplete:s}){const r=d.useContext(xke),o=Rb(),{markdown:i}=Ih(),l=String(t),c=l.replace(/\n$/,""),u=a.jsx(oft,{className:e,isStreaming:n,children:l}),h=yke(e),{resolvedLang:f}=FY(h);if(!!r&&!!e&&!!h)try{const g=i?.renderCodeBlock?.({language:h,resolvedLanguage:f,className:e,code:c,isStreaming:!!n,isIncomplete:!!s,source:r,theme:o});if(g!=null&&typeof g!="boolean")return a.jsx(Q0,{fallback:u,label:`custom code block component render (lang=${h})`,resetKeys:[h,r,o,n?"streaming":"settled",s?"incomplete":"complete",c],children:g})}catch(g){console.error("[web-shell] custom code block renderer call failed (lang=%s):",h,g)}return u}function uft({children:e}){return a.jsx(a.Fragment,{children:e})}const sW=/^o1-code-session:\/\//i;function ioe(e,t=!1){return t&&wke.test(e.trim())||sW.test(e.trim())?e:bbe(e)}function _ke({href:e,children:t,node:n,id:s,"aria-label":r,"aria-describedby":o}){const i=Vl(),l=Wp();if((n?.properties.dataFootnoteRef!==void 0||n?.properties.dataFootnoteBackref!==void 0)&&e?.startsWith("#"))return a.jsx("a",{id:s,href:e,className:ri.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 m=h.currentTarget.getRootNode().getElementById(e.slice(1));m&&(h.preventDefault(),m.scrollIntoView({block:"nearest"}),!m.hasAttribute("tabindex")&&m.tagName!=="BUTTON"&&(m.tabIndex=-1),m.focus({preventScroll:!0}))},children:t});if(e&&sW.test(e.trim())){if(i!=="interactive")return a.jsx("span",{className:ri.link,children:t});const h=e.trim().replace(sW,"");return a.jsx("a",{href:"#",role:"button",className:ri.link,onClick:f=>{f.preventDefault(),f.stopPropagation(),window.dispatchEvent(new CustomEvent("o1-code:open-session",{detail:h}))},children:t})}const u=X4(e)?e:void 0;return a.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:ri.link,onClick:h=>l(h,u),children:t})}function dft({src:e,alt:t}){const n=Vl(),s=Ww(e,n==="document")?e:void 0;return a.jsx("img",{src:s,alt:t||"",className:ri.image})}function hft(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 Ske(e="basic",t=""){return{code:lft,pre:uft,a:_ke,img:dft,sup:tke,section:nke,table({children:n}){if(e==="advanced"){const s=a.jsx(ooe,{children:n});return a.jsx(Q0,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:a.jsx(odt,{fallback:s,children:n})})}return a.jsx(ooe,{children:n})}}}const fft=Ske(),pft=d.memo(function({content:t,components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o}){return a.jsx(eet,{components:n,remarkPlugins:s,rehypePlugins:r,urlTransform:o,children:t})}),Am=d.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:o,markdownTableMode:i}=Ih(),l=Rb(),c=Vl()==="document",u=`footnote-${d.useId()}-`,h=n?o:void 0,f=hft(t??"",s),m=s===!0&&f.length>Zht,g=d.useMemo(()=>f&&n&&h?.transformMarkdown?h.transformMarkdown(f,{source:n,isStreaming:s===!0}):f,[n,h,f,s]),w=s?"basic":r??i??"basic",y=d.useMemo(()=>w==="advanced"?Ske("advanced",g):fft,[w,g]),x=h?.components,k=h?.getInlineFootnoteIcon,_=h?.mountFootnotePreview,S=d.useMemo(()=>{if(!x&&!k&&!_)return y;const $={...y,...x,...w==="advanced"?{table:y.table}:{}},P=x?.a;return x&&($.a=z=>{if(z.node?.properties.dataFootnoteRef!==void 0||z.node?.properties.dataFootnoteBackref!==void 0||!P)return a.jsx(_ke,{...z});if(typeof P!="string")return d.createElement(P,z);const{node:O,...Y}=z;return d.createElement(P,Y)}),x?.sup||($.sup=z=>a.jsx(tke,{...z,linkComponent:P,iconResolver:k,mountPreview:_}),$.section=z=>a.jsx(nke,{...z,sectionComponent:x?.section})),$},[y,w,x,k,_]),I=!c&&n==="assistant"&&!x?.code&&!x?.pre?h?.chart??(h?.renderCodeBlock?void 0:Sht):void 0,R=d.useMemo(()=>I?Cht(I.registry,{chartClassName:I.chartClassName,chartStyle:{minHeight:360,...I.chartStyle}}):void 0,[I]),A=d.useMemo(()=>R?{...S,pre:R}:S,[R,S]),j=d.useMemo(()=>h?.remarkPlugins?[gse,nre,mre,...h.remarkPlugins]:[gse,nre,mre],[h?.remarkPlugins]),L=d.useMemo(()=>[mot,...h?.rehypePlugins??[],[fdt,{prefix:u,group:!c&&!x?.sup,safeHref:X4,safeImage:Ww,transformUrl:ioe}]],[h?.rehypePlugins,u,c,x?.sup]),E=d.useMemo(()=>$=>ioe($,c),[c]);if(!t)return null;if(m)return a.jsx("div",{className:n!=="thinking"?ri.content:void 0,"data-markdown-source":n,"data-markdown-streaming-plain-text":"true",children:a.jsx("pre",{className:ri.streamingPlainText,children:g})});const N=a.jsx(pft,{content:g,components:A,remarkPlugins:j,rehypePlugins:L,urlTransform:E}),M=I?a.jsx(Tht,{customization:I,source:g,streaming:!!s,theme:l,children:N}):N;return a.jsx("div",{className:n!=="thinking"?ri.content:void 0,"data-markdown-source":n,children:a.jsx(bke.Provider,{value:!!s,children:a.jsx(xke.Provider,{value:n,children:a.jsx(kke.Provider,{value:g,children:M})})})})}),_B=/https?:\/\/[A-Za-z0-9\-._~:/?#[\]{}@!$&'()*+,;=%]+/gi,mft=new Set([...".,;:!?'*_~"]),gft={")":"(","]":"[","}":"{"},vft=/^https?:\/\/./i;function aoe(e,t){let n=0;for(const s of e)s===t&&(n+=1);return n}function wft(e){const t={};for(const[s,r]of Object.entries(gft))t[s]=aoe(e,s)-aoe(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(!mft.has(s))break;n--}return e.slice(0,n)}function yft(e){const t=[];let n=0;_B.lastIndex=0;for(let s=_B.exec(e);s!==null;s=_B.exec(e)){const r=wft(s[0]);if(!vft.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 n7=d.memo(function({text:t}){const n=Wp(),s=d.useMemo(()=>yft(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=X4(i)?i:void 0;return a.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:ri.link,onClick:c=>n(c,l),children:r.value},o)})}),bft="_flash_96ig5_1",kb={flash:bft},xft="_chatMessageRow_qnd03_41",kft="_chatMessageColumn_qnd03_48",_ft="_chatBubble_qnd03_55",Sft="_scheduledTaskBubble_qnd03_68",Cft="_scheduledTaskRun_qnd03_76",Tft="_scheduledTaskHeader_qnd03_83",Ift="_scheduledTaskIcon_qnd03_90",Eft="_scheduledTaskHeading_qnd03_108",Rft="_scheduledTaskEyebrow_qnd03_115",Aft="_scheduledTaskName_qnd03_122",jft="_scheduledTaskMeta_qnd03_131",Nft="_scheduledTaskMetaItem_qnd03_138",Mft="_scheduledTaskBadge_qnd03_158",Pft="_scheduledTaskId_qnd03_170",Lft="_scheduledTaskPrompt_qnd03_181",Dft="_sendFailure_qnd03_191",Oft="_retryButton_qnd03_201",$ft="_editArea_qnd03_229",Bft="_editInput_qnd03_237",zft="_editActions_qnd03_258",Fft="_editCancel_qnd03_264",Hft="_editSubmit_qnd03_265",Uft="_chatContent_qnd03_294",Wft="_messageTag_qnd03_299",qft="_messageTagTooltip_qnd03_317",Vft="_messageTagClickable_qnd03_351",Gft="_messageTagIcon_qnd03_364",Kft="_messageTagLabel_qnd03_376",Yft="_messageTagValue_qnd03_377",Xft="_chatContentCollapsed_qnd03_400",Zft="_toggleButton_qnd03_405",Jft="_toggleIcon_qnd03_426",Qft="_toggleIconExpanded_qnd03_433",ept="_chatImages_qnd03_437",tpt="_chatImageThumb_qnd03_445",npt="_chatImageThumbInteractive_qnd03_453",spt="_chatFiles_qnd03_462",rpt="_chatFileChip_qnd03_470",opt="_chatFileChipPreviewable_qnd03_483",ipt="_fileTagIcon_qnd03_492",Uo={chatMessageRow:xft,chatMessageColumn:kft,chatBubble:_ft,scheduledTaskBubble:Sft,scheduledTaskRun:Cft,scheduledTaskHeader:Tft,scheduledTaskIcon:Ift,scheduledTaskHeading:Eft,scheduledTaskEyebrow:Rft,scheduledTaskName:Aft,scheduledTaskMeta:jft,scheduledTaskMetaItem:Nft,scheduledTaskBadge:Mft,scheduledTaskId:Pft,scheduledTaskPrompt:Lft,sendFailure:Dft,retryButton:Oft,editArea:$ft,editInput:Bft,editActions:zft,editCancel:Fft,editSubmit:Hft,chatContent:Uft,messageTag:Wft,messageTagTooltip:qft,messageTagClickable:Vft,messageTagIcon:Gft,messageTagLabel:Kft,messageTagValue:Yft,chatContentCollapsed:Xft,toggleButton:Zft,toggleIcon:Jft,toggleIconExpanded:Qft,chatImages:ept,chatImageThumb:tpt,chatImageThumbInteractive:npt,chatFiles:spt,chatFileChip:rpt,chatFileChipPreviewable:opt,fileTagIcon:ipt},apt="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 lpt(e){const t=`
|
|
1620
1620
|
|
|
1621
1621
|
${apt}
|
|
@@ -2244,7 +2244,7 @@ ${i("terminal.notice.protocolMismatch")}`),ie.close(4002,"Terminal protocol mism
|
|
|
2244
2244
|
* Copyright 2025 Qwen Team
|
|
2245
2245
|
* SPDX-License-Identifier: Apache-2.0
|
|
2246
2246
|
*/const Rwn=250,CF={truncated:!1,status:"idle"};function Awn(e){if(e instanceof Error&&e.message)return e.message;const t=String(e??"");return t.length>0?t:"Unknown error"}function jwn(e){return e.replayError?{kind:"unreadable",message:e.replayError}:e.partial?{kind:"partial"}:void 0}function Nwn(e,t={}){const n=t.pageSize??Rwn,[s,r]=d.useState(CF),o=d.useRef(0),i=d.useCallback(()=>{if(!e)return;const u=++o.current;r(h=>({...h,status:"loading",error:void 0})),e({limit:n}).then(h=>{if(o.current!==u)return;const f=jwn(h);if(f!==void 0){r(m=>({...m,status:"error",error:f}));return}r({events:h.events,truncated:h.hasMore,status:"ready"})},h=>{o.current===u&&r(f=>({...f,status:"error",error:{kind:"unreadable",message:Awn(h)}}))})},[e,n]);d.useEffect(()=>{if(!e){o.current+=1,r(CF);return}return r(CF),i(),()=>{o.current+=1}},[e,i]);const l=s.events;return{trajectory:d.useMemo(()=>l===void 0?void 0:Cwn(Ewn(l)),[l]),status:s.status,...s.error!==void 0?{error:s.error}:{},truncated:s.truncated,refresh:i}}const Mwn="_panel_1ploj_1",Pwn="_header_1ploj_8",Lwn="_summary_1ploj_17",Dwn="_headerActions_1ploj_26",Own="_headerButton_1ploj_33",$wn="_iconButton_1ploj_54",Bwn="_error_1ploj_78",zwn="_notice_1ploj_91",Fwn="_tableWrap_1ploj_100",Hwn="_placeholder_1ploj_107",Uwn="_scroll_1ploj_114",Wwn="_olderBar_1ploj_126",qwn="_olderNotice_1ploj_132",Vwn="_virtualBody_1ploj_137",Gwn="_virtualRow_1ploj_142",Kwn="_turnHeader_1ploj_151",Ywn="_turnTitle_1ploj_167",Xwn="_turnSummary_1ploj_171",Zwn="_record_1ploj_179",Jwn="_nestMarker_1ploj_198",Qwn="_selected_1ploj_203",eyn="_badge_1ploj_208",tyn="_text_1ploj_221",nyn="_faint_1ploj_230",syn="_metrics_1ploj_235",ryn="_toneError_1ploj_244",oyn="_toneMuted_1ploj_248",Wa={panel:Mwn,header:Pwn,summary:Lwn,headerActions:Dwn,headerButton:Own,iconButton:$wn,error:Bwn,notice:zwn,tableWrap:Fwn,placeholder:Hwn,scroll:Uwn,olderBar:Wwn,olderNotice:qwn,virtualBody:Vwn,virtualRow:Gwn,turnHeader:Kwn,turnTitle:Ywn,turnSummary:Xwn,record:Zwn,nestMarker:Jwn,selected:Qwn,badge:eyn,text:tyn,faint:nyn,metrics:syn,toneError:ryn,toneMuted:oyn},Ide=34;function Ede(e){return e>=999950?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function iyn(e){return`${Ede(e.inputTokens)} → ${Ede(e.outputTokens)}`}const ayn=/-call_[A-Za-z0-9]+$/;function lyn(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(ayn,"")}function F3(e){const t=e.trim(),n=t.indexOf(`
|
|
2247
|
-
`);return n===-1?t:t.slice(0,n)}function cyn(e,t){if(e.kind==="request"){const n=[_h(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:_h(e.timing.ttftMs)})),e.usage&&n.push(iyn(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(_h(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:_h(o)}))}return n}return[]}function Rde(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Wa.toneError;if(t==="cancelled")return Wa.toneMuted}function uyn(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:F3(e.block.text)};case"request":{const n=lyn(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:Wa.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:F3(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...Rde(e)?{badgeTone:Rde(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return dyn(e.block,t)}}function dyn(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:F3(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:F3(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:Wa.toneError}:{},text:F3(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Wa.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function hyn(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function fyn({loadPage:e}){const{t}=Ct(),{trajectory:n,status:s,error:r,truncated:o,refresh:i}=Nwn(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),m=d.useId(),g=d.useCallback(E=>`${m}-row-${E}`,[m]),w=d.useCallback((E,N)=>{E.scrollTop=N,f.current=E.scrollTop},[]),y=d.useMemo(()=>{if(!n)return[];const E=new Map(n.rows.map(M=>[M.key,M])),N=[];for(const M of n.turns){const $=M.userRowKey??`ordinal:${M.index}`;N.push({kind:"turn",key:`turn:${$}`,turn:M});for(const P of M.rowKeys){const z=E.get(P);z&&N.push({kind:"row",key:P,row:z})}}return N},[n]),x=Eye({count:y.length,getScrollElement:()=>u.current,getItemKey:E=>y[E]?.key??E,estimateSize:()=>Ide,overscan:12}),k=y.length>0;d.useLayoutEffect(()=>{const E=u.current;if(!E||typeof ResizeObserver>"u")return;let N=0;const M=()=>{E.scrollTop===0&&f.current>0&&(E.scrollTop=f.current)},$=new ResizeObserver(()=>{M(),N=requestAnimationFrame(M)});return $.observe(E),()=>{$.disconnect(),N!==0&&cancelAnimationFrame(N)}},[k]),d.useEffect(()=>{if(s!=="ready"||h.current||y.length===0)return;h.current=!0;const E=u.current;E&&w(E,E.scrollHeight)},[w,s,y.length]);const _=d.useMemo(()=>l===void 0?-1:y.findIndex(E=>E.key===l),[l,y]),S=d.useCallback(E=>{if(y.length===0)return;const N=Math.min(Math.max(E,0),y.length-1);c(y[N].key),x.scrollToIndex(N,{align:"auto"})},[x,y]),I=d.useCallback(E=>{c(E),u.current?.focus({preventScroll:!0})},[]),R=d.useCallback(E=>{if(y.length===0)return;const N=_<0?-1:_;E.key==="ArrowDown"?(E.preventDefault(),S(N+1)):E.key==="ArrowUp"?(E.preventDefault(),S(N<=0?0:N-1)):E.key==="Home"?(E.preventDefault(),S(0)):E.key==="End"&&(E.preventDefault(),S(y.length-1))},[S,_,y]),A=d.useMemo(()=>{if(!n)return;let E=0,N=0,M=0;for(const $ of n.turns)E+=$.requestCount,N+=$.toolCount,M+=$.requestMs;return{turns:n.turns.length,requests:E,tools:N,durationMs:M}},[n]),j=s==="ready"&&y.length===0,L=n!==void 0&&y.length>0&&!hyn(n);return a.jsxs("div",{className:Wa.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Wa.header,children:[a.jsx("div",{className:Wa.summary,children:A?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:A.turns,requests:A.requests,tools:A.tools,duration:A.durationMs>0?_h(A.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Wa.headerActions,children:a.jsx("button",{type:"button",className:Wa.iconButton,onClick:i,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(qg,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Wa.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:Wa.headerButton,onClick:i,disabled:s==="loading",children:t("common.retry")})]}),L&&a.jsx("div",{className:Wa.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Wa.tableWrap,children:y.length===0?s==="error"?null:a.jsx("div",{className:Wa.placeholder,role:"status",children:t(j?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:Wa.olderBar,children:a.jsx("span",{className:Wa.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Wa.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":y.length,"aria-activedescendant":_>=0?g(_):void 0,onKeyDown:R,onScroll:E=>{f.current=E.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Wa.virtualBody,style:{height:`${x.getTotalSize()}px`},children:x.getVirtualItems().map(E=>{const N=y[E.index];return a.jsx("div",{id:g(E.index),className:Wa.virtualRow,style:{height:`${Ide}px`,transform:`translateY(${E.start}px)`},role:"row","aria-rowindex":E.index+1,children:N.kind==="turn"?a.jsx(pyn,{turn:N.turn,selected:N.key===l,onSelect:()=>I(N.key)}):a.jsx(myn,{row:N.row,selected:N.key===l,onSelect:()=>I(N.key)})},E.key)})})})]})})]})}function pyn({turn:e,selected:t,onSelect:n}){const{t:s}=Ct();return a.jsxs("div",{className:`${Wa.turnHeader} ${t?Wa.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Wa.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Wa.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?_h(e.requestMs):"—"})})]})}function myn({row:e,selected:t,onSelect:n}){const{t:s}=Ct(),r=uyn(e,s),o=cyn(e,s);return a.jsxs("div",{className:`${Wa.record} ${t?Wa.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(TWe,{size:12,strokeWidth:1.6,className:Wa.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Wa.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Wa.text} ${r.faint?Wa.faint:""}`,children:r.text}),a.jsx("span",{className:Wa.metrics,"data-testid":"trajectory-row-metrics",children:o.length>0?o.join(" · "):"—"})]})}const gyn="_panel_pwtdr_1",vyn="_toolbar_pwtdr_5",wyn="_actions_pwtdr_15",yyn="_feedback_pwtdr_21",byn="_state_pwtdr_31",Ry={panel:gyn,toolbar:vyn,actions:wyn,feedback:yyn,state:byn};function xyn({sessionActions:e,sessionId:t,controls:n}){const{t:s}=Ct(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),m=d.useRef(null),g=n?.sessionId===t?n:void 0,w=g?.getContextUsage??e?.getContextUsage,y=d.useRef(g);y.current=g;const x=g?.result,[k,_]=d.useState(x),S=!!(x&&x!==k&&(x.kind!=="completed"||!c));d.useEffect(()=>{x?.kind==="completed"&&(h.current++,o(x.usage),u(!1))},[x]),d.useEffect(()=>{let A=!0,j=!1;const L=y.current?.result;o(N=>N?.sessionId===t?N:L?.kind==="completed"?L.usage:null),u(!1),l(!!w);const E=async()=>{if(!A||j||!w)return;j=!0,l(!0),u(!1);const N=h.current,M=m.current,$=M&&M.getContextUsage===w&&M.sessionId===t?M:{getContextUsage:w,sessionId:t,promise:w({detail:!0,silent:!0,...y.current?.result?{syncCounters:!0}:{}})};m.current=$;try{const P=await $.promise;if(!A||N!==h.current)return;o(P.sessionId===t&&P.usage.contextWindowSize>0?P:null)}catch(P){if(!A||N!==h.current)return;u(kG(P)?"transient":"hard")}finally{j=!1,m.current===$&&(m.current=null),A&&l(!1)}};return f.current=()=>void E(),E(),()=>{A=!1}},[w,t]);const I=!w||i||g?.compressing,R=()=>{_(x),f.current()};return a.jsxs("div",{className:Ry.panel,"aria-busy":i,children:[a.jsxs("div",{className:Ry.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:Ry.actions,children:[a.jsx(Wt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:I,onClick:R,children:a.jsx(qg,{"aria-hidden":"true"})}),a.jsx("span",{title:g?.compressing?void 0:g?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(Wt,{type:"button",variant:"outline",size:"sm",disabled:!g?.canCompress||i,onClick:()=>void g?.compress(),children:s(g?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(g?.compressing||S)&&a.jsx(qIe,{controls:g,className:Ry.feedback}),c==="transient"&&r&&a.jsx("div",{className:Ry.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:Ry.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(Wt,{type:"button",variant:"outline",size:"sm",disabled:I,onClick:R,children:s("contextUsage.retry")})]}):w?i&&!r?a.jsx("div",{className:Ry.state,role:"status",children:s("common.loading")}):r?a.jsx(Pke,{status:r,compact:!0}):a.jsx("div",{className:Ry.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:Ry.state,children:s("contextUsage.unavailable")})]})}const kyn=700,_yn=["daily","weekdays","weekly","hourly","minutes","custom"],Syn=[1,2,3,4,5,6,10,12,15,20,30],Cyn=(e,t)=>{},Tyn=(e,t,n)=>{},Iyn=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function Ade(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function Ay(e){return e.kind==="pending"?e.targetKind:e.kind}function Eyn(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const Ryn=["review","sideTask"];function jde({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,onCloseTab:m,onOpenFilePreview:g,latestReviewAvailable:w=!1,onOpenLatestReview:y,onOpenTerminal:x,onOpenTrajectory:k,trajectoryTabId:_,onOpenWebPreview:S,onWebPreviewChange:I,items:R=Ryn,sideTaskAvailable:A=!1,sideTasks:j=[],sideTasksLoading:L=!1,onCreateSideTask:E,onOpenSideTask:N,onCreateSideTaskSession:M,onSideTaskCreated:$,onSideTaskTitleChange:P,onNestedRightPanelOpen:z,onNestedArtifactsChange:H,onOpenNestedSubagent:O,agentTasks:Y=[],agentTraceLoading:Z=!1,agentTraceError:K,onOpenWorkflowAgent:B,onError:V,sessionWorkflowEnabled:J,workflow:q,onImageIngestionNotice:te,deferSubagentMount:ie=!1,onClose:ge,variant:re="docked",fullscreen:G=!1,onToggleFullscreen:Q}){const{t:he}=Ct(),[ve,ye]=d.useState(!1),[_e,ae]=d.useState(),Se=d.useRef(null),Te=d.useCallback(()=>{Se.current&&(clearTimeout(Se.current),Se.current=null),ye(!0)},[]),Ne=d.useCallback(()=>{Se.current&&clearTimeout(Se.current),Se.current=setTimeout(()=>{ye(!1),Se.current=null},120)},[]);d.useEffect(()=>()=>{Se.current&&clearTimeout(Se.current)},[]);const Ae=n.find(ke=>ke.id===s)??n[0],Ve=Ae?.kind==="file"&&Ae.sourcePreview&&(/\.html?$/i.test(Ae.workspacePath)||wb(Ae.previewMimeType||Ae.previewData?.type)==="text/html"),Ze=Ae?.kind==="file"&&Ae.previewOnly===!0&&!Ve&&/\.(?:html?|md|markdown)$/i.test(Ae.workspacePath)&&(Ae.previewContent!==void 0||!Ae.previewData||!!S4(Ae.previewMimeType||Ae.previewData.type,Ae.workspacePath)),Tt=_e===Ae?.id,je=R.includes("review")&&!n.some(ke=>Ay(ke)==="review"),ot=R.includes("sideTask")&&A&&!!E,Ie=!!x,ue=R.includes("webPreview")&&!!S,W=R.includes("trajectory")&&!!k&&!n.some(ke=>ke.id===_),ne=!!Ae&&(je||ot||Ie||ue||W),me=Ae&&Ade(Ae)?{workspaceCwd:Ae.workspaceCwd,workspaceId:Ae.workspaceId}:void 0,Me=nI(me?.workspaceCwd),Ke=Me?.workspaceId===me?.workspaceId?Me?.actions:void 0,be=Ae?.kind==="artifact"?t.find(ke=>ke.id===Ae.artifactId):void 0;return a.jsxs("aside",{className:`${pt.panel} ${re==="drawer"?pt.panelDrawer:""} ${G?pt.panelFullscreen:""}`,style:re==="docked"&&i&&!G?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:pt.header,children:[n.length>0&&a.jsx("div",{className:pt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(ke=>a.jsxs("div",{className:[pt.tabItem,ke.id===Ae?.id?pt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":ke.id===Ae?.id,className:pt.tab,onClick:()=>f(ke.id),onMouseEnter:Pe=>MT(Pe.currentTarget),onFocus:Pe=>MT(Pe.currentTarget),title:ke.title,children:[a.jsx("span",{className:`${pt.tabIcon} ${Ay(ke)==="artifact"?pt.tabArtifactIcon:""}`,"aria-hidden":"true",children:Ay(ke)==="review"?a.jsx(TF,{}):ke.kind==="workflow"?a.jsx(Zwe,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="file"?a.jsx(K0,{name:ke.workspacePath,className:pt.tabIconSvg,strokeWidth:1.6}):Ay(ke)==="artifact"?a.jsx(bye,{artifact:t.find(Pe=>"artifactId"in ke&&Pe.id===ke.artifactId),className:pt.tabIconSvg}):Ay(ke)==="subagent"?a.jsx(Ayn,{}):Ay(ke)==="monitor"?a.jsx(oye,{className:pt.tabIconSvg,strokeWidth:1.6}):Ay(ke)==="shell"?a.jsx(lT,{className:pt.tabIconSvg,strokeWidth:1.6}):Ay(ke)==="side_task"?a.jsx(Xj,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="web_preview"?a.jsx(TT,{className:pt.tabIconSvg}):ke.kind==="terminal"?a.jsx(lT,{className:pt.tabIconSvg,strokeWidth:1.6}):Ay(ke)==="image"?a.jsx(Eqe,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="context_usage"?a.jsx(gL,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="token_usage"?a.jsx(RK,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="trajectory"?a.jsx(k$,{className:pt.tabIconSvg,strokeWidth:1.6}):a.jsx(Nyn,{})}),a.jsx("span",{className:pt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:pt.tabTitleInner,children:ke.title})})]}),a.jsx("button",{type:"button",className:pt.tabCloseButton,onClick:()=>m(ke.id),"aria-label":`Close ${ke.title}`,title:"Close",children:a.jsx(jyn,{})})]},ke.id))}),a.jsxs("div",{className:pt.headerActions,children:[ne&&a.jsxs(sv,{modal:!1,children:[a.jsx(Yg,{asChild:!0,children:a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.addButton}`,"aria-label":he("rightPanel.add"),title:he("rightPanel.add"),children:a.jsx(ep,{className:pt.toolbarIcon})})}),a.jsxs(Xg,{align:"end",className:"w-64",children:[je&&a.jsxs(yi,{disabled:!w||!y,onSelect:y,children:[a.jsx(TF,{}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("turnOutputs.review")})]}),je&&ot&&a.jsx(yx,{}),ot&&a.jsxs(yi,{disabled:L,onSelect:E,children:[a.jsx(Xj,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("sideTask.create")})]}),Ie&&(je||ot)&&a.jsx(yx,{}),Ie&&a.jsxs(yi,{onSelect:()=>x?.(),children:[a.jsx(lT,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("terminal.title")})]}),ue&&a.jsxs(yi,{onSelect:S,children:[a.jsx(TT,{className:pt.sideTaskNewIcon}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("webPreview.title")})]}),W&&a.jsxs(yi,{onSelect:()=>k?.(),children:[a.jsx(k$,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("trajectory.title")})]})]})]}),Q&&a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.fullscreenButton} ${G?pt.iconButtonActive:""}`,onClick:Q,"aria-label":he(G?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":G,title:he(G?"common.exitFullscreen":"common.fullscreen"),children:G?a.jsx(jK,{className:pt.toolbarIcon,"aria-hidden":!0}):a.jsx(IK,{className:pt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.panelToggleButton}`,onClick:ge,"aria-label":he("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:he("chatHeader.toggleRightPanel"),children:a.jsx(Jwe,{className:pt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${pt.body} ${Ae?.kind==="side_task"?pt.bodySideTask:""}`.trim(),children:[n.filter(ke=>ke.kind==="web_preview").map(ke=>a.jsx("div",{className:"h-full",hidden:ke.id!==Ae?.id,children:a.jsx(Avn,{state:ke,onChange:Pe=>I?.(ke.id,Pe)})},ke.id)),n.filter(ke=>ke.kind==="terminal").map(ke=>a.jsx("div",{className:`${pt.terminalPane} ${ke.id===Ae?.id?"":pt.terminalPaneHidden}`.trim(),"aria-hidden":ke.id===Ae?.id?void 0:!0,children:a.jsx(Rvn,{terminalId:ke.id,cwd:ke.workspaceCwd??l,active:ke.id===Ae?.id,enabled:ke.initialized!==!1})},ke.id)),Ze&&a.jsxs("button",{type:"button",className:pt.attachmentPreviewButton,onClick:()=>ae(Tt?void 0:Ae?.id),"aria-label":he(Tt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":Tt,children:[Tt?a.jsx(yWe,{"aria-hidden":!0}):a.jsx(Wwe,{"aria-hidden":!0}),he(Tt?"attachment.showSource":"attachment.showPreview")]}),u&&!Ae?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":he("common.loading"),children:[a.jsx(dw,{className:"h-5 w-2/5"}),a.jsx(dw,{className:"h-32 w-full"}),a.jsx(dw,{className:"h-4 w-4/5"}),a.jsx(dw,{className:"h-4 w-3/5"})]}):Ae?.kind==="terminal"||Ae?.kind==="web_preview"?null:Ae?Ae.kind==="pending"?a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.kind==="workflow"?Ae.sessionId?a.jsx(_pn,{tasks:Y,loading:Z,error:K,onOpenAgent:B}):q?a.jsx(dmn,{...q}):a.jsx("div",{className:pt.empty,children:he("workflow.empty.title")}):Ade(Ae)&&(Ae.kind!=="scheduled_task"||Ae.task.durable)&&(Ae.kind!=="file"||!Ae.previewOnly)&&(Ae.kind!=="artifact"||be?.metadata?.artifactType!=="web_preview_snapshot")&&!Ke?a.jsx("div",{className:pt.empty,role:"alert",children:he("workspace.notFoundDescription")}):Ae.kind==="review"?a.jsx(Lyn,{changes:Ae.changes??r,selectedPath:Ae.selectedPath??o,workspaceCwd:Ae.workspaceCwd??l,onOpenFilePreview:ke=>g(ke,Ae.workspaceCwd??l,Ae.workspaceId),onDownloadFile:(ke,Pe)=>yL(Ke,ke.path,XGe(ke.path),Pe),onDownloadError:ke=>{const Pe=he("common.downloadFailed",{message:Iu(ke)});V?V(new Error(Pe,{cause:ke}),Pe):console.error(Pe,ke)}}):Ae.kind==="file"?Ae.attachmentId&&!Ae.previewData&&Ae.previewContent===void 0?a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.sourcePreview&&Ae.previewData&&wb(Ae.previewMimeType||Ae.previewData.type)!=="application/pdf"&&!S4(Ae.previewMimeType||Ae.previewData.type,Ae.workspacePath)?a.jsx(c3e,{data:Ae.previewData,title:Ae.title,image:!!eC(Ae.workspacePath)&&Ae.previewData.type.startsWith("image/")}):a.jsx(PD,{workspacePath:Ae.workspacePath,artifactVersion:String(Ae.previewVersion??0),workspaceActions:Ke,previewContent:Ae.previewContent,previewData:Ae.previewData,previewMimeType:Ae.previewMimeType,previewOnly:Ae.previewOnly,previewKind:Ve||Ae.previewOnly&&!Tt?"source":void 0},Ae.id):Ae.kind==="source"?a.jsx(Jyn,{tab:Ae},Ae.id):Ae.kind==="artifact"?a.jsx(Myn,{artifacts:t,artifactId:Ae.artifactId,sourceSessionId:Ae.sourceSessionId,workspaceActions:Ke,previewContent:Ae.previewContent,loading:c,error:h},Ae.id):Ae.kind==="subagent"?ie?null:a.jsx(opn,{sessionId:Ae.sessionId,rootToolCallId:Ae.rootToolCallId,initialRootTool:Ae.rootTool,workspaceCwd:Ae.workspaceCwd??l,onRightPanelOpen:z,onArtifactsChange:H,onOpenSubagent:O,onError:V}):Ae.kind==="monitor"?a.jsx(kbt,{task:Ae.task,actions:Ae.sessionActions},Ae.id):Ae.kind==="shell"?a.jsx(_bt,{task:Ae.task,actions:Ae.sessionActions},Ae.id):Ae.kind==="side_task"?a.jsx(Cpn,{tabId:Ae.id,sessionId:Ae.sessionId,parentSessionId:Ae.parentSessionId,workspaceCwd:Ae.workspaceCwd??l,title:Ae.title,shouldNameFromFirstPrompt:Ae.nameFromFirstPrompt,initialPrompt:Ae.initialPrompt,createSession:M??Iyn,onCreated:$??Cyn,onTitleChange:P??Tyn,onRightPanelOpen:z,onArtifactsChange:H,onError:V,sessionWorkflowEnabled:J,onImageIngestionNotice:te},Ae.id):Ae.kind==="image"?Ae.src?a.jsxs("div",{className:pt.imagePreviewWrap,children:[a.jsx("img",{src:Ae.src,alt:Ae.alt??Ae.title,className:pt.imagePreview}),a.jsx("a",{className:pt.imageDownloadButton,href:Ae.src,download:Eyn(Ae.src),"aria-label":he("common.download"),title:he("common.download"),children:a.jsx(eb,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.kind==="context_usage"?a.jsx(xyn,{controls:e?.[Ae.sessionId],sessionActions:Ae.sessionActions,sessionId:Ae.sessionId},Ae.id):Ae.kind==="trajectory"?a.jsx(fyn,{loadPage:Ae.loadPage},Ae.id):Ae.kind==="token_usage"?a.jsx(vwn,{sessionActions:Ae.sessionActions,sessionId:Ae.sessionId},Ae.id):a.jsx(Pyn,{task:Ae.task,actions:Ke},Ae.id):a.jsxs("div",{className:pt.emptyActions,"data-testid":"right-panel-empty-actions",children:[R.includes("review")&&a.jsxs("button",{type:"button",className:pt.emptyAction,disabled:!w||!y,onClick:y,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(TF,{})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("turnOutputs.review")}),a.jsx("span",{className:pt.emptyActionHint,children:he("turnOutputs.reviewLatest")}),a.jsx(zl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),R.includes("sideTask")&&A&&E&&(j.length===0?a.jsxs("button",{type:"button",className:pt.emptyAction,disabled:L,"aria-busy":L,onClick:E,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Xj,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("sideTask.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("sideTask.description")}),a.jsx(zl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(sv,{open:ve,onOpenChange:ye,modal:!1,children:[a.jsx(Yg,{asChild:!0,children:a.jsxs("button",{type:"button",className:pt.emptyAction,"aria-expanded":ve,onMouseEnter:Te,onMouseLeave:Ne,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Xj,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("sideTask.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("sideTask.description")}),a.jsx(zl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Xg,{align:"end",className:"w-80",onMouseEnter:Te,onMouseLeave:Ne,children:[j.map(ke=>a.jsxs(yi,{onSelect:()=>N?.(ke),children:[a.jsx("span",{className:pt.sideTaskListTitle,children:ke.title}),ke.updatedAt&&a.jsx("span",{className:pt.sideTaskListTime,children:ZA(ke.updatedAt,he)})]},ke.sessionId)),a.jsx(yx,{}),a.jsxs(yi,{onSelect:E,children:[a.jsx(aWe,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("sideTask.new")})]})]})]})),ue&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:S,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(TT,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("webPreview.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("webPreview.openHint")}),a.jsx(zl,{className:pt.emptyActionChevron,"aria-hidden":"true"})]}),W&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:()=>k?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(k$,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("trajectory.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("trajectory.description")}),a.jsx(zl,{className:pt.emptyActionChevron,"aria-hidden":"true"})]}),x&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:()=>x(),children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(lT,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("terminal.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("terminal.open")}),a.jsx(zl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function Ayn(){return a.jsxs("svg",{className:pt.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 jyn(){return a.jsx("svg",{className:pt.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 TF(){return a.jsxs("svg",{className:pt.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 Nyn(){return a.jsxs("svg",{className:pt.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 Myn({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(Vyn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:pt.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:pt.empty,children:i}):a.jsx("div",{className:pt.empty,children:"Artifact not found."})}function Pyn({task:e,actions:t}){const{t:n}=Ct(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,m]=d.useState(e.prompt),[g,w]=d.useState(()=>W1(e.cron)),[y,x]=d.useState(!1),[k,_]=d.useState(!1),[S,I]=d.useState(!1),[R,A]=d.useState(!1),[j,L]=d.useState(null),E=d.useRef(0),N=d.useRef(0),M=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});M.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const $=d.useCallback((he,ve,ye,_e)=>{const ae=M.current;return he===E.current&&ae.actions===ve&&ae.taskId===ye&&ae.workspaceId===_e},[]),P=d.useCallback((he,ve,ye,_e)=>{const ae=M.current;return he===N.current&&ae.actions===ve&&ae.taskId===ye&&ae.workspaceId===_e},[]);d.useEffect(()=>()=>{E.current+=1,N.current+=1},[]),d.useEffect(()=>{I(!1),A(!1),L(null)},[t,e.id,e.workspaceId]);const z=d.useCallback(async()=>{const he=++E.current,ve=++N.current,ye=e.id,_e=e.workspaceId;if(!e.durable||!t){r(null),h(""),m(e.prompt),w(W1(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const ae=await t.listScheduledTasks(_e);if(!$(he,t,ye,_e))return;const Se=ae.find(Te=>Te.id===e.id)??null;r(Se),Se?(h(Se.name??""),m(Se.prompt),w(W1(Se.cron))):(h(""),m(e.prompt),w(W1(e.cron)))}catch(ae){P(ve,t,ye,_e)&&c(ae instanceof Error?ae.message:String(ae))}finally{P(ve,t,ye,_e)&&i(!1)}},[t,P,$,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{z()},[z]);const H=!e.durable,O=e.durable&&!o&&!l&&!s,Y=!!s,Z=s?.name||s?.prompt||e.title,K=s?.prompt??e.prompt,B=s?.cron??e.cron,V=s?.recurring??e.recurring,J=s?.enabled,q=d.useCallback(()=>{s&&(h(s.name??""),m(s.prompt),w(W1(s.cron)),L(null),x(!0))},[s]),te=d.useCallback(()=>{x(!1),L(null),s&&(h(s.name??""),m(s.prompt),w(W1(s.cron)))},[s]),ie=d.useCallback(async()=>{if(!s||!t)return;const he=R9(g);if(!he){L(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){L(n("scheduledTasks.error.emptyPrompt"));return}const ve=++E.current,ye=e.id,_e=e.workspaceId;A(!0),L(null);try{const ae=await t.updateScheduledTask(s.id,{cron:he,prompt:f.trim(),name:u.trim()||null},_e);if(!$(ve,t,ye,_e))return;r(ae),h(ae.name??""),m(ae.prompt),w(W1(ae.cron)),x(!1)}catch(ae){$(ve,t,ye,_e)&&L(ae instanceof Error?ae.message:String(ae))}finally{$(ve,t,ye,_e)&&A(!1)}},[t,g,$,s,u,f,n,e.id,e.workspaceId]),ge=d.useCallback(async()=>{if(!s||!t)return;const he=++E.current,ve=e.id,ye=e.workspaceId;I(!0),L(null);try{const _e=await t.updateScheduledTask(s.id,{enabled:!s.enabled},ye);if(!$(he,t,ve,ye))return;r(_e)}catch(_e){$(he,t,ve,ye)&&L(_e instanceof Error?_e.message:String(_e))}finally{$(he,t,ve,ye)&&I(!1)}},[t,$,s,e.id,e.workspaceId]),re=d.useCallback(async()=>{if(!s||!t)return;const he=++E.current,ve=e.id,ye=e.workspaceId;I(!0),L(null);try{if(await t.deleteScheduledTask(s.id,ye),!$(he,t,ve,ye))return;r(null),_(!1)}catch(_e){$(he,t,ve,ye)&&L(_e instanceof Error?_e.message:String(_e))}finally{$(he,t,ve,ye)&&I(!1)}},[t,$,s,e.id,e.workspaceId]),G=R9(g),Q=G?QT(G,n):null;return a.jsxs("div",{className:pt.detail,children:[o&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:rn.loadError,children:l}),O&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.deletedSnapshot")}),H&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!O&&a.jsx("div",{className:pt.section,children:a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:pt.fieldValue,children:Z}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:pt.fieldValue,children:e.id}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:pt.fieldValue,children:QT(B,n)}),a.jsx("span",{className:pt.fieldLabel,children:"Cron"}),a.jsx("span",{className:pt.fieldValue,children:B}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:pt.fieldValue,children:n(V?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),J!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:pt.fieldValue,children:n(J?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!O&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:pt.description,children:K})]}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:pt.actionsRow,children:[a.jsx("button",{type:"button",className:rn.primaryButton,disabled:!Y||S,onClick:q,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:rn.secondaryButton,disabled:!Y||S,onClick:()=>void ge(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:rn.secondaryButton,disabled:!Y||S,onClick:()=>_(!0),children:n("scheduledTasks.delete")})]}),k&&s&&a.jsx(qa,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>_(!1),children:a.jsxs("div",{className:rn.formFields,children:[a.jsx("div",{className:pt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:rn.formActions,children:[a.jsx("button",{type:"button",className:rn.secondaryButton,onClick:()=>_(!1),disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:rn.primaryButton,onClick:()=>void re(),disabled:S,children:n("scheduledTasks.delete")})]})]})}),y&&a.jsx(qa,{title:n("scheduledTasks.editTitle"),size:"md",onClose:te,children:a.jsxs("div",{className:rn.formFields,children:[a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:rn.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:he=>h(he.target.value)})]}),a.jsxs("label",{className:rn.field,children:[a.jsxs("span",{className:rn.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:rn.required,children:"*"})]}),a.jsx("textarea",{className:rn.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:he=>m(he.target.value)})]}),a.jsxs("div",{className:rn.scheduleRow,children:[a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:rn.select,value:g.frequency,onChange:he=>{const ve=he.target.value;w(ye=>({...ye,frequency:ve,...ve==="hourly"?{time:"00:00"}:{}}))},children:_yn.map(he=>a.jsx("option",{value:he,children:n(`scheduledTasks.freq.${he}`)},he))})]}),(g.frequency==="daily"||g.frequency==="weekdays"||g.frequency==="weekly")&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:rn.input,type:"time",value:g.time,onChange:he=>w(ve=>({...ve,time:he.target.value}))})]}),g.frequency==="weekly"&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:rn.select,value:g.weekday,onChange:he=>w(ve=>({...ve,weekday:Number(he.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((he,ve)=>a.jsx("option",{value:ve,children:he},ve))})]}),g.frequency==="minutes"&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:rn.select,value:g.minuteInterval,onChange:he=>w(ve=>({...ve,minuteInterval:Number(he.target.value)})),children:Syn.map(he=>a.jsx("option",{value:he,children:he},he))})]}),g.frequency==="custom"&&a.jsxs("label",{className:`${rn.field} ${rn.fieldGrow}`,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:rn.input,type:"text",value:g.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:he=>w(ve=>({...ve,customCron:he.target.value}))})]})]}),a.jsx("div",{className:rn.preview,children:Q?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:rn.previewLabel,children:Q}),a.jsx("code",{className:rn.previewCron,children:G})]}):a.jsx("span",{className:rn.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:rn.formActions,children:[a.jsx("button",{type:"button",className:rn.secondaryButton,onClick:te,disabled:R,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:rn.primaryButton,onClick:()=>void ie(),disabled:R,children:n(R?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function Lyn({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=Ct(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,m]=d.useState(!1),[g,w]=d.useState(520),y=d.useRef(g),x=d.useRef(null),k=d.useRef(null),[_,S]=d.useState(null),[I,R]=d.useState(()=>new Set),A=d.useRef(!0);d.useEffect(()=>(A.current=!0,()=>{A.current=!1}),[]);const j=l,L=d.useMemo(()=>qyn(e,n),[e,n]);d.useEffect(()=>{S(t)},[t]),d.useEffect(()=>{y.current=g},[g]),d.useEffect(()=>{const P=x.current;if(!P)return;const z=()=>{m(P.clientWidth<kyn)};z();const H=new ResizeObserver(z);return H.observe(P),()=>H.disconnect()},[u]),d.useEffect(()=>()=>k.current?.(),[]);const E=d.useCallback(P=>{const z=x.current;if(!z)return;P.preventDefault();const H=P.currentTarget;H.setPointerCapture(P.pointerId);const O=P.clientX,Y=y.current,Z=z.getBoundingClientRect().width,K=Math.max(180,Z-180),B=document.body.style.cursor,V=document.body.style.userSelect;let J=Y,q=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const te=()=>{q=null,w(J)},ie=G=>{J=Math.min(K,Math.max(180,Y+(G.clientX-O))),q===null&&(q=window.requestAnimationFrame(te))};let ge=()=>{};const re=G=>{k.current=null,q!==null&&(window.cancelAnimationFrame(q),q=null),G&&w(J),H.hasPointerCapture(P.pointerId)&&H.releasePointerCapture(P.pointerId),document.body.style.cursor=B,document.body.style.userSelect=V,window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge)};ge=()=>re(!0),k.current=()=>re(!1),window.addEventListener("pointermove",ie),window.addEventListener("pointerup",ge),window.addEventListener("pointercancel",ge)},[]);if(e.length===0)return a.jsx("div",{className:pt.empty,children:"No file changes to review."});const N=dCe(e),M=P=>{S(z=>z===P?null:P)},$=async P=>{if(!I.has(P.path)){R(z=>new Set(z).add(P.path));try{await r(P,()=>!A.current)}catch(z){A.current&&o(z)}finally{R(z=>{const H=new Set(z);return H.delete(P.path),H})}}};return a.jsxs("div",{className:pt.review,children:[a.jsxs("div",{className:pt.reviewToolbar,children:[a.jsxs("div",{className:pt.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(x7,{additions:N?.additions,deletions:N?.deletions,className:pt.lineStats,additionsClassName:pt.additions,deletionsClassName:pt.deletions})]}),a.jsxs("div",{className:pt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:pt.reviewTotalsButton,onClick:()=>h(P=>!P),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[pt.chevron,u?pt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(Mde,{})})]}),a.jsx("button",{type:"button",className:[pt.iconButton,l?pt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(P=>!P),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(Uyn,{}):a.jsx(Hyn,{})})]})]}),u&&a.jsxs("div",{ref:x,className:[pt.reviewContent,j?"":pt.reviewContentListOnly,j&&f?pt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${g}px`},children:[a.jsx("div",{className:[pt.reviewList,_?pt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(P=>{const z=_===P.path,H=pCe(P.path),O=yAt(P.path);return a.jsxs("div",{className:[pt.reviewItem,z?pt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:pt.reviewRow,"data-selected":P.path===t||void 0,children:[a.jsx("button",{type:"button",className:pt.reviewRowToggle,onClick:()=>M(P.path),"aria-label":P.path,"aria-expanded":z}),a.jsx("span",{className:pt.fileIcon,children:l3e(P.path)}),a.jsxs("span",{className:pt.reviewFileName,children:[a.jsx(Byn,{path:oD(P.path,n),title:P.path}),H&&a.jsx("button",{type:"button",className:pt.reviewOpenButton,onClick:()=>s(P),title:`${i("turnOutputs.preview")} ${P.path}`,children:i("turnOutputs.preview")}),O&&a.jsx("button",{type:"button",className:pt.reviewOpenButton,onClick:()=>void $(P),title:`${i("common.download")} ${P.path}`,disabled:I.has(P.path),children:i(I.has(P.path)?"common.downloading":"common.download")})]}),a.jsx(x7,{additions:P.additions,deletions:P.deletions,className:pt.lineStats,additionsClassName:pt.additions,deletionsClassName:pt.deletions}),a.jsx("span",{className:[pt.chevron,z?pt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(Mde,{})})]}),z&&a.jsx(Dyn,{change:P})]},`${P.toolCallId}:${P.path}`)})}),j&&!f&&a.jsx("div",{className:pt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:E}),j&&a.jsx("div",{className:pt.tree,children:L.children.map(P=>a.jsx(o3e,{node:P,depth:0,selectedPath:t},P.path))})]})]})}function Dyn({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:pt.diffEmpty,children:"No diff available."});const t=Oyn(e.diffs);return a.jsx("div",{className:pt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(nX,{diff:n.fileDiff},s):a.jsx($yn,{oldText:n.oldText,newText:n.newText},s))})}function Oyn(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function $yn({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=[nIe,js.editable.of(!1),da.readOnly.of(!0),js.lineWrapping],f={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return Je(async()=>{const{MergeView:g,unifiedMergeView:w}=await import("./index-sM76wg9o.js");return{MergeView:g,unifiedMergeView:w}},[]).then(({MergeView:g,unifiedMergeView:w})=>{if(!c)try{if(s){u=new g({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:f});return}u=new js({doc:t,extensions:[...h,w({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:f})],parent:l})}catch(y){c||i(y instanceof Error?y.message:String(y))}}).catch(g=>{c||i(g instanceof Error?g.message:String(g))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:pt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:pt.codeMirrorDiff}),o&&a.jsxs("div",{className:pt.diffError,children:["Diff unavailable: ",o]})]})}function o3e({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[pt.treeRow,s?pt.treeFile:pt.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:pt.treeTwisty,children:!s&&a.jsx("span",{className:[pt.treeChevron,r?"":pt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(Wyn,{})})}),a.jsxs("span",{className:pt.treeContent,children:[s&&a.jsx("span",{className:pt.fileIcon,children:l3e(e.path)}),a.jsx("span",{className:pt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:pt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:pt.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:pt.treeChildren,style:c,children:e.children.map(h=>a.jsx(o3e,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function Byn({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>i3e(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(zyn(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:pt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:pt.pathPrefix,children:s.prefix}),a.jsx("span",{className:pt.pathFileName,children:s.leaf})]})}function i3e(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let Nde=null;function zyn(e,t){const n=i3e(e),s=t.clientWidth;if(s<=0)return n;const r=Fyn(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 Fyn(e){Nde??=document.createElement("canvas");const t=Nde.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 Hyn(){return a.jsxs("svg",{className:pt.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 Uyn(){return a.jsxs("svg",{className:pt.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 Mde(){return a.jsx("svg",{className:pt.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 Wyn(){return a.jsx("svg",{className:pt.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 qyn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=oD(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 a3e(n),n}function a3e(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)a3e(t)}function H8(e){return yb(e).split("/").filter(Boolean).at(-1)??e}function l3e(e){const t=H8(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 Vyn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=Ct(),o=Wp(),i=gye(e),l=X4(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=mye(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(jvn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(Gyn,{status:e.status}):!h||!e.workspacePath?a.jsx(Kyn,{}):a.jsx(Hfn,{workspacePath:e.workspacePath,artifactVersion:pne(e),workspaceActions:n}):h&&e.workspacePath?fye(e)?a.jsx(Zyn,{artifact:e,workspaceActions:n}):a.jsx(PD,{workspacePath:e.workspacePath,artifactVersion:pne(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:Yyn(e)?"html":Xyn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:pt.detail,children:[a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx(Sp,{label:"Type",value:MK(e.kind,e.workspacePath)}),a.jsx(Sp,{label:"Storage",value:e.storage}),a.jsx(Sp,{label:"Status",value:e.status}),a.jsx(Sp,{label:"Source",value:e.source}),a.jsx(Sp,{label:"Size",value:wL(e.sizeBytes)}),a.jsx(Sp,{label:"Created",value:e.createdAt}),a.jsx(Sp,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(Sp,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(Sp,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Description"}),a.jsx("div",{className:pt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Details"}),a.jsxs("div",{className:pt.fieldGrid,children:[$2(e.metadata,"automationId","Automation ID"),$2(e.metadata,"schedule","Schedule"),$2(e.metadata,"timezone","Timezone"),$2(e.metadata,"status","Status"),$2(e.metadata,"nextRunAt","Next run"),$2(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:pt.locationRow,children:[a.jsx("a",{className:pt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:m=>o(m,l),children:l}),a.jsx("a",{className:pt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:m=>o(m,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:pt.meta,children:i})]})]})}function Gyn({status:e}){const{t}=Ct();return a.jsx("div",{className:pt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function Kyn(){const{t:e}=Ct();return a.jsx("div",{className:pt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function Yyn(e){const t=e.workspacePath?.toLowerCase()??"",n=wb(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function Xyn(e){const t=e.workspacePath?.toLowerCase()??"",n=wb(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function Zyn({artifact:e,workspaceActions:t}){const{t:n}=Ct(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=gye(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await yL(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:pt.detail,children:a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx(Sp,{label:"Type",value:MK(e.kind,e.workspacePath)}),a.jsx(Sp,{label:"Size",value:wL(e.sizeBytes)}),c?a.jsx(Sp,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(Sp,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:pt.downloadRow,children:a.jsx("button",{type:"button",className:pt.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:pt.previewError,children:s})]})})}function Jyn({tab:e}){const{t}=Ct(),n=nl(),s=nI(e.workspaceCwd),r=s?.actions,o=Wp(),[i,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[m,g]=d.useState(),w=e.source,y=w.locator,x=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&y.type!=="workspace_file")&&(y.type!=="workspace_file"||w.workspaceCwd===n.workspaceCwd),k=y.type==="workspace_file"?y.workspacePath:y.type==="attachment"?y.attachmentId:"",_=/\.pdf$/i.test(k);if(d.useEffect(()=>{let I=!1;return u(void 0),f(void 0),g(void 0),!x||y.type==="url"?void 0:((async()=>{if(y.type==="attachment"){const A=await e.sessionActions.readAttachment(y.attachmentId);if(I||!e.owner.isCurrent())return;const j=Uint8Array.from(atob(A.data),L=>L.charCodeAt(0));u(new Blob([j],{type:A.mimeType}))}else if(_&&r){const A=await F4(r.readFileBytes,k,"application/pdf",{statFile:r.stat,isCancelled:()=>I||!e.owner.isCurrent()});!I&&e.owner.isCurrent()&&u(A)}})().catch(A=>{!I&&e.owner.isCurrent()&&f(Iu(A))}),()=>{I=!0})},[i,x,y,k,_,e.owner,e.sessionActions,r]),x&&y.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:w.title}),w.description&&a.jsx("p",{children:w.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:y.url}),X4(y.url)&&a.jsx("a",{className:"text-primary underline",href:y.url,target:"_blank",rel:"noopener noreferrer",onClick:I=>o(I,y.url),children:t("sources.openOriginal")})]});if(!x||!s&&y.type!=="attachment")return a.jsx("div",{className:pt.empty,role:"alert",children:t("sources.unavailable")});const S=y.type==="workspace_file"&&!_&&fye({workspacePath:k});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:k,children:k}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[m&&a.jsx(Wt,{variant:"ghost",size:"icon-sm",asChild:!0,children:a.jsx("a",{href:m,download:w.title,"aria-label":`Download ${w.title}`,title:t("common.download"),children:a.jsx(eb,{})})}),h&&a.jsx(Wt,{variant:"ghost",size:"sm",onClick:()=>l(I=>I+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:pt.previewError,role:"alert",children:h}):S?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Wt,{onClick:()=>void yL(r,k,"application/octet-stream",()=>!e.owner.isCurrent()).catch(I=>{e.owner.isCurrent()&&f(Iu(I))}),children:t("common.download")})]}):(y.type==="attachment"||_)&&!c?a.jsx("div",{className:pt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!S4(c.type,k)?a.jsx(c3e,{data:c,title:w.title,onDownloadUrl:g,showDownload:!1,image:!!eC(k)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(PD,{workspacePath:k,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:y.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(k)||wb(c?.type)==="text/html"?"source":void 0},i)})]})}function c3e({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:pt.imagePreviewWrap,children:[n?a.jsx("img",{className:pt.imagePreview,src:o,alt:t}):a.jsx(u3e,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(eb,{})})]}):null}function PD({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(Qyn,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const f=e.toLowerCase(),m=l??eC(e),g=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":m?"image":"source");return g==="html"?a.jsx(sbn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):g==="markdown"?a.jsx(obn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):g==="image"&&m?a.jsx(nbn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:m,onLoadError:h}):a.jsx(d3e,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function Qyn({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(tbn,{data:n,mimeType:i,title:e}):S4(i,e)?a.jsx(ebn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(u3e,{name:e,mimeType:i,size:n.size})}function ebn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=Ct(),[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:pt.previewError,children:c}):i===void 0?a.jsx("div",{className:pt.empty,children:o("attachment.loadingFile")}):a.jsx(PD,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function tbn({data:e,mimeType:t,title:n}){const{t:s}=Ct(),[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:pt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:pt.empty,children:s("attachment.loadingPreview")})}function u3e({name:e,mimeType:t,size:n}){const{t:s}=Ct();return a.jsxs("div",{className:pt.unsupportedAttachmentPreview,children:[a.jsx(K0,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:pt.unsupportedAttachmentMeta,children:[t," · ",wL(n)]})]})}function nbn({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),F4((f,m)=>n.readFileBytes(f,m),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const m=f instanceof Error?f.message:String(f);c(m),r?.(m)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:pt.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:pt.imagePreview,src:o,alt:H8(e)}),a.jsx("a",{className:pt.imageDownloadButton,href:o,download:H8(e),"aria-label":`Download ${H8(e)}`,title:"Download",children:a.jsx(eb,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:pt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:pt.previewError,children:l})]})}function vJ({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 m=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(g=>{if(!m){if(g.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async g=>{if(m||!g||!g.truncated)return g;const w=await F4((y,x)=>n.readFileBytes(y,x),e,"application/octet-stream",{statFile:y=>n.stat(y),isCancelled:()=>m});return{sizeBytes:w.size,content:new TextDecoder(g.encoding||"utf-8").decode(await w.arrayBuffer())}}).then(g=>{m||!g||(u(g.sizeBytes),l(g.content))}).catch(g=>{if(m)return;const w=g instanceof Error?g.message:String(g);f(w),o?.(w)}),()=>{m=!0}},[t,s,r,o,n,e]),{content:i,error:h,sizeBytes:c}}function sbn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=vJ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:pt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:pt.empty,children:"Loading preview..."}):a.jsx(h3e,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(rbn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:pt.previewError,children:c})]})}function rbn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=Ct(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),ZGe(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(Iu(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:pt.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:pt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:pt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function d3e({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}=vJ({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 m;try{m=new js({doc:u,extensions:[nIe,js.editable.of(!1),da.readOnly.of(!0),js.lineWrapping],parent:f})}catch(g){c(g instanceof Error?g.message:String(g));return}return()=>m.destroy()},[u]),a.jsxs("div",{className:pt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:pt.empty,children:"Loading file..."}):a.jsx("div",{ref:i,className:pt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:pt.previewError,children:h||l})]})}function h3e({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=Ct(),[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(Wt,{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(d3e,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function obn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=vJ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:pt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:pt.empty,children:"Loading preview..."}):a.jsx(h3e,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:pt.markdownPreviewWrap,children:a.jsx(Am,{content:l})})}),c&&a.jsx("div",{className:pt.previewError,children:c})]})}function Sp({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.fieldLabel,children:e}),a.jsx("span",{className:pt.fieldValue,children:t})]}):null}function $2(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(Sp,{label:n,value:String(s)},t)}/**
|
|
2247
|
+
`);return n===-1?t:t.slice(0,n)}function cyn(e,t){if(e.kind==="request"){const n=[_h(e.timing.durationMs)];return e.timing.ttftMs!==void 0&&n.push(t("trajectory.ttft",{duration:_h(e.timing.ttftMs)})),e.usage&&n.push(iyn(e.usage)),n}if(e.kind==="tool"){const n=[];if(e.timing&&n.push(_h(e.timing.durationMs)),e.subagentSummary){const{requests:s,tools:r,requestMs:o}=e.subagentSummary;n.push(t("trajectory.subagentRollup",{requests:s,tools:r,duration:_h(o)}))}return n}return[]}function Rde(e){const t=e.toolStatus??e.block.status;if(t==="error"||t==="failed")return Wa.toneError;if(t==="cancelled")return Wa.toneMuted}function uyn(e,t){switch(e.kind){case"user":return{badge:t("trajectory.badge.user"),text:F3(e.block.text)};case"request":{const n=lyn(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:Wa.toneError}:{},text:s?`${r} · ${t("trajectory.requestFailed")}`:r}}case"message":return{badge:e.thought?t("trajectory.badge.thought"):t("trajectory.badge.message"),text:F3(e.block.text),faint:e.thought};case"tool":return{badge:e.block.toolName??t("trajectory.badge.tool"),...Rde(e)?{badgeTone:Rde(e)}:{},text:e.block.title||(e.block.toolName??"")};default:return dyn(e.block,t)}}function dyn(e,t){switch(e.kind){case"shell":return{badge:t("trajectory.badge.shell"),text:F3(e.text)};case"user_shell":return{badge:t("trajectory.badge.shell"),text:F3(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:Wa.toneError}:{},text:F3(e.text),faint:e.kind!=="error"};case"prompt_cancelled":return{badge:t("trajectory.badge.cancelled"),badgeTone:Wa.toneMuted,text:e.reason??t("trajectory.cancelled"),faint:!0};default:return{badge:t("trajectory.badge.other"),text:""}}}function hyn(e){return e.rows.some(t=>t.kind==="request"||t.kind==="tool"&&t.timing!==void 0)}function fyn({loadPage:e}){const{t}=Ct(),{trajectory:n,status:s,error:r,truncated:o,refresh:i}=Nwn(e),[l,c]=d.useState(void 0),u=d.useRef(null),h=d.useRef(!1),f=d.useRef(0),m=d.useId(),g=d.useCallback(E=>`${m}-row-${E}`,[m]),w=d.useCallback((E,N)=>{E.scrollTop=N,f.current=E.scrollTop},[]),y=d.useMemo(()=>{if(!n)return[];const E=new Map(n.rows.map(M=>[M.key,M])),N=[];for(const M of n.turns){const $=M.userRowKey??`ordinal:${M.index}`;N.push({kind:"turn",key:`turn:${$}`,turn:M});for(const P of M.rowKeys){const z=E.get(P);z&&N.push({kind:"row",key:P,row:z})}}return N},[n]),x=Eye({count:y.length,getScrollElement:()=>u.current,getItemKey:E=>y[E]?.key??E,estimateSize:()=>Ide,overscan:12}),k=y.length>0;d.useLayoutEffect(()=>{const E=u.current;if(!E||typeof ResizeObserver>"u")return;let N=0;const M=()=>{E.scrollTop===0&&f.current>0&&(E.scrollTop=f.current)},$=new ResizeObserver(()=>{M(),N=requestAnimationFrame(M)});return $.observe(E),()=>{$.disconnect(),N!==0&&cancelAnimationFrame(N)}},[k]),d.useEffect(()=>{if(s!=="ready"||h.current||y.length===0)return;h.current=!0;const E=u.current;E&&w(E,E.scrollHeight)},[w,s,y.length]);const _=d.useMemo(()=>l===void 0?-1:y.findIndex(E=>E.key===l),[l,y]),S=d.useCallback(E=>{if(y.length===0)return;const N=Math.min(Math.max(E,0),y.length-1);c(y[N].key),x.scrollToIndex(N,{align:"auto"})},[x,y]),I=d.useCallback(E=>{c(E),u.current?.focus({preventScroll:!0})},[]),R=d.useCallback(E=>{if(y.length===0)return;const N=_<0?-1:_;E.key==="ArrowDown"?(E.preventDefault(),S(N+1)):E.key==="ArrowUp"?(E.preventDefault(),S(N<=0?0:N-1)):E.key==="Home"?(E.preventDefault(),S(0)):E.key==="End"&&(E.preventDefault(),S(y.length-1))},[S,_,y]),A=d.useMemo(()=>{if(!n)return;let E=0,N=0,M=0;for(const $ of n.turns)E+=$.requestCount,N+=$.toolCount,M+=$.requestMs;return{turns:n.turns.length,requests:E,tools:N,durationMs:M}},[n]),j=s==="ready"&&y.length===0,L=n!==void 0&&y.length>0&&!hyn(n);return a.jsxs("div",{className:Wa.panel,"data-testid":"trajectory-panel",children:[a.jsxs("div",{className:Wa.header,children:[a.jsx("div",{className:Wa.summary,children:A?a.jsx("span",{"data-testid":"trajectory-totals",children:t("trajectory.totals",{turns:A.turns,requests:A.requests,tools:A.tools,duration:A.durationMs>0?_h(A.durationMs):"—"})}):a.jsx("span",{children:t("trajectory.title")})}),a.jsx("div",{className:Wa.headerActions,children:a.jsx("button",{type:"button",className:Wa.iconButton,onClick:i,disabled:!e||s==="loading",title:t("common.refresh"),"aria-label":t("common.refresh"),children:a.jsx(qg,{size:14,strokeWidth:1.6})})})]}),r!==void 0&&a.jsxs("div",{className:Wa.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:Wa.headerButton,onClick:i,disabled:s==="loading",children:t("common.retry")})]}),L&&a.jsx("div",{className:Wa.notice,role:"status",children:t("trajectory.noTiming")}),a.jsx("div",{className:Wa.tableWrap,children:y.length===0?s==="error"?null:a.jsx("div",{className:Wa.placeholder,role:"status",children:t(j?"trajectory.empty":"common.loading")}):a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:Wa.olderBar,children:a.jsx("span",{className:Wa.olderNotice,"data-testid":"trajectory-truncated",children:t("trajectory.truncated")})}),a.jsx("div",{ref:u,className:Wa.scroll,role:"grid",tabIndex:0,"aria-label":t("trajectory.title"),"aria-rowcount":y.length,"aria-activedescendant":_>=0?g(_):void 0,onKeyDown:R,onScroll:E=>{f.current=E.currentTarget.scrollTop},"data-testid":"trajectory-rows",children:a.jsx("div",{className:Wa.virtualBody,style:{height:`${x.getTotalSize()}px`},children:x.getVirtualItems().map(E=>{const N=y[E.index];return a.jsx("div",{id:g(E.index),className:Wa.virtualRow,style:{height:`${Ide}px`,transform:`translateY(${E.start}px)`},role:"row","aria-rowindex":E.index+1,children:N.kind==="turn"?a.jsx(pyn,{turn:N.turn,selected:N.key===l,onSelect:()=>I(N.key)}):a.jsx(myn,{row:N.row,selected:N.key===l,onSelect:()=>I(N.key)})},E.key)})})})]})})]})}function pyn({turn:e,selected:t,onSelect:n}){const{t:s}=Ct();return a.jsxs("div",{className:`${Wa.turnHeader} ${t?Wa.selected:""}`,onClick:n,"aria-selected":t,"data-selected":t?"true":void 0,role:"gridcell","data-testid":"trajectory-turn",children:[a.jsx("span",{className:Wa.turnTitle,children:e.partial?s("trajectory.turnPartial",{index:e.index}):s("trajectory.turn",{index:e.index})}),a.jsx("span",{className:Wa.turnSummary,children:s("trajectory.turnSummary",{requests:e.requestCount,tools:e.toolCount,duration:e.requestMs>0?_h(e.requestMs):"—"})})]})}function myn({row:e,selected:t,onSelect:n}){const{t:s}=Ct(),r=uyn(e,s),o=cyn(e,s);return a.jsxs("div",{className:`${Wa.record} ${t?Wa.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(TWe,{size:12,strokeWidth:1.6,className:Wa.nestMarker,"aria-hidden":"true"}),a.jsx("span",{className:`${Wa.badge} ${r.badgeTone??""}`,children:r.badge}),a.jsx("span",{className:`${Wa.text} ${r.faint?Wa.faint:""}`,children:r.text}),a.jsx("span",{className:Wa.metrics,"data-testid":"trajectory-row-metrics",children:o.length>0?o.join(" · "):"—"})]})}const gyn="_panel_pwtdr_1",vyn="_toolbar_pwtdr_5",wyn="_actions_pwtdr_15",yyn="_feedback_pwtdr_21",byn="_state_pwtdr_31",Ry={panel:gyn,toolbar:vyn,actions:wyn,feedback:yyn,state:byn};function xyn({sessionActions:e,sessionId:t,controls:n}){const{t:s}=Ct(),[r,o]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(!1),h=d.useRef(0),f=d.useRef(()=>{}),m=d.useRef(null),g=n?.sessionId===t?n:void 0,w=g?.getContextUsage??e?.getContextUsage,y=d.useRef(g);y.current=g;const x=g?.result,[k,_]=d.useState(x),S=!!(x&&x!==k&&(x.kind!=="completed"||!c));d.useEffect(()=>{x?.kind==="completed"&&(h.current++,o(x.usage),u(!1))},[x]),d.useEffect(()=>{let A=!0,j=!1;const L=y.current?.result;o(N=>N?.sessionId===t?N:L?.kind==="completed"?L.usage:null),u(!1),l(!!w);const E=async()=>{if(!A||j||!w)return;j=!0,l(!0),u(!1);const N=h.current,M=m.current,$=M&&M.getContextUsage===w&&M.sessionId===t?M:{getContextUsage:w,sessionId:t,promise:w({detail:!0,silent:!0,...y.current?.result?{syncCounters:!0}:{}})};m.current=$;try{const P=await $.promise;if(!A||N!==h.current)return;o(P.sessionId===t&&P.usage.contextWindowSize>0?P:null)}catch(P){if(!A||N!==h.current)return;u(kG(P)?"transient":"hard")}finally{j=!1,m.current===$&&(m.current=null),A&&l(!1)}};return f.current=()=>void E(),E(),()=>{A=!1}},[w,t]);const I=!w||i||g?.compressing,R=()=>{_(x),f.current()};return a.jsxs("div",{className:Ry.panel,"aria-busy":i,children:[a.jsxs("div",{className:Ry.toolbar,children:[a.jsx("span",{children:s("contextUsage.title")}),a.jsxs("div",{className:Ry.actions,children:[a.jsx(Wt,{type:"button",variant:"ghost",size:"icon-sm","aria-label":s("contextUsage.refresh"),title:s("contextUsage.refresh"),disabled:I,onClick:R,children:a.jsx(qg,{"aria-hidden":"true"})}),a.jsx("span",{title:g?.compressing?void 0:g?.canCompress?i?s("common.loading"):void 0:s("contextUsage.compressUnavailable"),children:a.jsx(Wt,{type:"button",variant:"outline",size:"sm",disabled:!g?.canCompress||i,onClick:()=>void g?.compress(),children:s(g?.compressing?"contextUsage.compressing":"contextUsage.compress")})})]})]}),(g?.compressing||S)&&a.jsx(qIe,{controls:g,className:Ry.feedback}),c==="transient"&&r&&a.jsx("div",{className:Ry.feedback,role:"status",children:s("contextUsage.previousReading")}),c==="hard"?a.jsxs("div",{className:Ry.state,role:"alert",children:[a.jsx("span",{children:s("contextUsage.loadError")}),a.jsx(Wt,{type:"button",variant:"outline",size:"sm",disabled:I,onClick:R,children:s("contextUsage.retry")})]}):w?i&&!r?a.jsx("div",{className:Ry.state,role:"status",children:s("common.loading")}):r?a.jsx(Pke,{status:r,compact:!0}):a.jsx("div",{className:Ry.state,children:s("contextUsage.unavailable")}):a.jsx("div",{className:Ry.state,children:s("contextUsage.unavailable")})]})}const kyn=700,_yn=["daily","weekdays","weekly","hourly","minutes","custom"],Syn=[1,2,3,4,5,6,10,12,15,20,30],Cyn=(e,t)=>{},Tyn=(e,t,n)=>{},Iyn=()=>Promise.reject(new Error("Side-task session creation is unavailable"));function Ade(e){return e.kind==="review"||e.kind==="file"||e.kind==="artifact"||e.kind==="scheduled_task"}function Ay(e){return e.kind==="pending"?e.targetKind:e.kind}function Eyn(e){return`image.${(e.match(/^data:image\/([a-z0-9+.+-]+)/i)?.[1]??"png").split("+")[0].toLowerCase()}`}const Ryn=["review","sideTask"];function jde({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,onCloseTab:m,onOpenFilePreview:g,latestReviewAvailable:w=!1,onOpenLatestReview:y,onOpenTerminal:x,onOpenTrajectory:k,trajectoryTabId:_,onOpenWebPreview:S,onWebPreviewChange:I,items:R=Ryn,sideTaskAvailable:A=!1,sideTasks:j=[],sideTasksLoading:L=!1,onCreateSideTask:E,onOpenSideTask:N,onCreateSideTaskSession:M,onSideTaskCreated:$,onSideTaskTitleChange:P,onNestedRightPanelOpen:z,onNestedArtifactsChange:H,onOpenNestedSubagent:O,agentTasks:Y=[],agentTraceLoading:Z=!1,agentTraceError:K,onOpenWorkflowAgent:B,onError:V,sessionWorkflowEnabled:J,workflow:q,onImageIngestionNotice:te,deferSubagentMount:ie=!1,onClose:ge,variant:re="docked",fullscreen:G=!1,onToggleFullscreen:Q}){const{t:he}=Ct(),[ve,ye]=d.useState(!1),[_e,ae]=d.useState(),Se=d.useRef(null),Te=d.useCallback(()=>{Se.current&&(clearTimeout(Se.current),Se.current=null),ye(!0)},[]),Ne=d.useCallback(()=>{Se.current&&clearTimeout(Se.current),Se.current=setTimeout(()=>{ye(!1),Se.current=null},120)},[]);d.useEffect(()=>()=>{Se.current&&clearTimeout(Se.current)},[]);const Ae=n.find(ke=>ke.id===s)??n[0],Ve=Ae?.kind==="file"&&Ae.sourcePreview&&(/\.html?$/i.test(Ae.workspacePath)||wb(Ae.previewMimeType||Ae.previewData?.type)==="text/html"),Ze=Ae?.kind==="file"&&Ae.previewOnly===!0&&!Ve&&/\.(?:html?|md|markdown)$/i.test(Ae.workspacePath)&&(Ae.previewContent!==void 0||!Ae.previewData||!!S4(Ae.previewMimeType||Ae.previewData.type,Ae.workspacePath)),Tt=_e===Ae?.id,je=R.includes("review")&&!n.some(ke=>Ay(ke)==="review"),ot=R.includes("sideTask")&&A&&!!E,Ie=!!x,ue=R.includes("webPreview")&&!!S,W=R.includes("trajectory")&&!!k&&!n.some(ke=>ke.id===_),ne=!!Ae&&(je||ot||Ie||ue||W),me=Ae&&Ade(Ae)?{workspaceCwd:Ae.workspaceCwd,workspaceId:Ae.workspaceId}:void 0,Me=nI(me?.workspaceCwd),Ke=Me?.workspaceId===me?.workspaceId?Me?.actions:void 0,be=Ae?.kind==="artifact"?t.find(ke=>ke.id===Ae.artifactId):void 0;return a.jsxs("aside",{className:`${pt.panel} ${re==="drawer"?pt.panelDrawer:""} ${G?pt.panelFullscreen:""}`,style:re==="docked"&&i&&!G?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[a.jsxs("div",{className:pt.header,children:[n.length>0&&a.jsx("div",{className:pt.tabs,role:"tablist","aria-label":"Right panel",children:n.map(ke=>a.jsxs("div",{className:[pt.tabItem,ke.id===Ae?.id?pt.tabActive:""].filter(Boolean).join(" "),children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":ke.id===Ae?.id,className:pt.tab,onClick:()=>f(ke.id),onMouseEnter:Pe=>MT(Pe.currentTarget),onFocus:Pe=>MT(Pe.currentTarget),title:ke.title,children:[a.jsx("span",{className:`${pt.tabIcon} ${Ay(ke)==="artifact"?pt.tabArtifactIcon:""}`,"aria-hidden":"true",children:Ay(ke)==="review"?a.jsx(TF,{}):ke.kind==="workflow"?a.jsx(Zwe,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="file"?a.jsx(K0,{name:ke.workspacePath,className:pt.tabIconSvg,strokeWidth:1.6}):Ay(ke)==="artifact"?a.jsx(bye,{artifact:t.find(Pe=>"artifactId"in ke&&Pe.id===ke.artifactId),className:pt.tabIconSvg}):Ay(ke)==="subagent"?a.jsx(Ayn,{}):Ay(ke)==="monitor"?a.jsx(oye,{className:pt.tabIconSvg,strokeWidth:1.6}):Ay(ke)==="shell"?a.jsx(lT,{className:pt.tabIconSvg,strokeWidth:1.6}):Ay(ke)==="side_task"?a.jsx(Xj,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="web_preview"?a.jsx(TT,{className:pt.tabIconSvg}):ke.kind==="terminal"?a.jsx(lT,{className:pt.tabIconSvg,strokeWidth:1.6}):Ay(ke)==="image"?a.jsx(Eqe,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="context_usage"?a.jsx(gL,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="token_usage"?a.jsx(RK,{className:pt.tabIconSvg,strokeWidth:1.6}):ke.kind==="trajectory"?a.jsx(k$,{className:pt.tabIconSvg,strokeWidth:1.6}):a.jsx(Nyn,{})}),a.jsx("span",{className:pt.tabTitle,"data-web-shell-session-title":!0,children:a.jsx("span",{className:pt.tabTitleInner,children:ke.title})})]}),a.jsx("button",{type:"button",className:pt.tabCloseButton,onClick:()=>m(ke.id),"aria-label":`Close ${ke.title}`,title:"Close",children:a.jsx(jyn,{})})]},ke.id))}),a.jsxs("div",{className:pt.headerActions,children:[ne&&a.jsxs(sv,{modal:!1,children:[a.jsx(Yg,{asChild:!0,children:a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.addButton}`,"aria-label":he("rightPanel.add"),title:he("rightPanel.add"),children:a.jsx(ep,{className:pt.toolbarIcon})})}),a.jsxs(Xg,{align:"end",className:"w-64",children:[je&&a.jsxs(yi,{disabled:!w||!y,onSelect:y,children:[a.jsx(TF,{}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("turnOutputs.review")})]}),je&&ot&&a.jsx(yx,{}),ot&&a.jsxs(yi,{disabled:L,onSelect:E,children:[a.jsx(Xj,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("sideTask.create")})]}),Ie&&(je||ot)&&a.jsx(yx,{}),Ie&&a.jsxs(yi,{onSelect:()=>x?.(),children:[a.jsx(lT,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("terminal.title")})]}),ue&&a.jsxs(yi,{onSelect:S,children:[a.jsx(TT,{className:pt.sideTaskNewIcon}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("webPreview.title")})]}),W&&a.jsxs(yi,{onSelect:()=>k?.(),children:[a.jsx(k$,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("trajectory.title")})]})]})]}),Q&&a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.fullscreenButton} ${G?pt.iconButtonActive:""}`,onClick:Q,"aria-label":he(G?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":G,title:he(G?"common.exitFullscreen":"common.fullscreen"),children:G?a.jsx(jK,{className:pt.toolbarIcon,"aria-hidden":!0}):a.jsx(IK,{className:pt.toolbarIcon,"aria-hidden":!0})}),a.jsx("button",{type:"button",className:`${pt.iconButton} ${pt.panelToggleButton}`,onClick:ge,"aria-label":he("chatHeader.toggleRightPanel"),"aria-pressed":"true",title:he("chatHeader.toggleRightPanel"),children:a.jsx(Jwe,{className:pt.panelToggleIcon})})]})]}),a.jsxs("div",{className:`${pt.body} ${Ae?.kind==="side_task"?pt.bodySideTask:""}`.trim(),children:[n.filter(ke=>ke.kind==="web_preview").map(ke=>a.jsx("div",{className:"h-full",hidden:ke.id!==Ae?.id,children:a.jsx(Avn,{state:ke,onChange:Pe=>I?.(ke.id,Pe)})},ke.id)),n.filter(ke=>ke.kind==="terminal").map(ke=>a.jsx("div",{className:`${pt.terminalPane} ${ke.id===Ae?.id?"":pt.terminalPaneHidden}`.trim(),"aria-hidden":ke.id===Ae?.id?void 0:!0,children:a.jsx(Rvn,{terminalId:ke.id,cwd:ke.workspaceCwd??l,active:ke.id===Ae?.id,enabled:ke.initialized!==!1})},ke.id)),Ze&&a.jsxs("button",{type:"button",className:pt.attachmentPreviewButton,onClick:()=>ae(Tt?void 0:Ae?.id),"aria-label":he(Tt?"attachment.showSource":"attachment.showPreview"),"aria-pressed":Tt,children:[Tt?a.jsx(yWe,{"aria-hidden":!0}):a.jsx(Wwe,{"aria-hidden":!0}),he(Tt?"attachment.showSource":"attachment.showPreview")]}),u&&!Ae?a.jsxs("div",{className:"flex flex-col gap-4 p-5","data-testid":"right-panel-loading-skeleton",role:"status","aria-label":he("common.loading"),children:[a.jsx(dw,{className:"h-5 w-2/5"}),a.jsx(dw,{className:"h-32 w-full"}),a.jsx(dw,{className:"h-4 w-4/5"}),a.jsx(dw,{className:"h-4 w-3/5"})]}):Ae?.kind==="terminal"||Ae?.kind==="web_preview"?null:Ae?Ae.kind==="pending"?a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.kind==="workflow"?Ae.sessionId?a.jsx(_pn,{tasks:Y,loading:Z,error:K,onOpenAgent:B}):q?a.jsx(dmn,{...q}):a.jsx("div",{className:pt.empty,children:he("workflow.empty.title")}):Ade(Ae)&&(Ae.kind!=="scheduled_task"||Ae.task.durable)&&(Ae.kind!=="file"||!Ae.previewOnly)&&(Ae.kind!=="artifact"||be?.metadata?.artifactType!=="web_preview_snapshot")&&!Ke?a.jsx("div",{className:pt.empty,role:"alert",children:he("workspace.notFoundDescription")}):Ae.kind==="review"?a.jsx(Lyn,{changes:Ae.changes??r,selectedPath:Ae.selectedPath??o,workspaceCwd:Ae.workspaceCwd??l,onOpenFilePreview:ke=>g(ke,Ae.workspaceCwd??l,Ae.workspaceId),onDownloadFile:(ke,Pe)=>yL(Ke,ke.path,XGe(ke.path),Pe),onDownloadError:ke=>{const Pe=he("common.downloadFailed",{message:Iu(ke)});V?V(new Error(Pe,{cause:ke}),Pe):console.error(Pe,ke)}}):Ae.kind==="file"?Ae.attachmentId&&!Ae.previewData&&Ae.previewContent===void 0?a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.sourcePreview&&Ae.previewData&&wb(Ae.previewMimeType||Ae.previewData.type)!=="application/pdf"&&!S4(Ae.previewMimeType||Ae.previewData.type,Ae.workspacePath)?a.jsx(c3e,{data:Ae.previewData,title:Ae.title,image:!!eC(Ae.workspacePath)&&Ae.previewData.type.startsWith("image/")}):a.jsx(PD,{workspacePath:Ae.workspacePath,artifactVersion:String(Ae.previewVersion??0),workspaceActions:Ke,previewContent:Ae.previewContent,previewData:Ae.previewData,previewMimeType:Ae.previewMimeType,previewOnly:Ae.previewOnly,previewKind:Ve||Ae.previewOnly&&!Tt?"source":void 0},Ae.id):Ae.kind==="source"?a.jsx(Jyn,{tab:Ae},Ae.id):Ae.kind==="artifact"?a.jsx(Myn,{artifacts:t,artifactId:Ae.artifactId,sourceSessionId:Ae.sourceSessionId,workspaceActions:Ke,previewContent:Ae.previewContent,loading:c,error:h},Ae.id):Ae.kind==="subagent"?ie?null:a.jsx(opn,{sessionId:Ae.sessionId,rootToolCallId:Ae.rootToolCallId,initialRootTool:Ae.rootTool,workspaceCwd:Ae.workspaceCwd??l,onRightPanelOpen:z,onArtifactsChange:H,onOpenSubagent:O,onError:V}):Ae.kind==="monitor"?a.jsx(kbt,{task:Ae.task,actions:Ae.sessionActions},Ae.id):Ae.kind==="shell"?a.jsx(_bt,{task:Ae.task,actions:Ae.sessionActions},Ae.id):Ae.kind==="side_task"?a.jsx(Cpn,{tabId:Ae.id,sessionId:Ae.sessionId,parentSessionId:Ae.parentSessionId,workspaceCwd:Ae.workspaceCwd??l,title:Ae.title,shouldNameFromFirstPrompt:Ae.nameFromFirstPrompt,initialPrompt:Ae.initialPrompt,createSession:M??Iyn,onCreated:$??Cyn,onTitleChange:P??Tyn,onRightPanelOpen:z,onArtifactsChange:H,onError:V,sessionWorkflowEnabled:J,onImageIngestionNotice:te},Ae.id):Ae.kind==="image"?Ae.src?a.jsxs("div",{className:pt.imagePreviewWrap,children:[a.jsx("img",{src:Ae.src,alt:Ae.alt??Ae.title,className:pt.imagePreview}),a.jsx("a",{className:pt.imageDownloadButton,href:Ae.src,download:Eyn(Ae.src),"aria-label":he("common.download"),title:he("common.download"),children:a.jsx(eb,{size:16,strokeWidth:1.8})})]}):a.jsx("div",{className:pt.empty,role:Ae.loadError?"alert":"status",children:Ae.loadError??he("common.loading")}):Ae.kind==="context_usage"?a.jsx(xyn,{controls:e?.[Ae.sessionId],sessionActions:Ae.sessionActions,sessionId:Ae.sessionId},Ae.id):Ae.kind==="trajectory"?a.jsx(fyn,{loadPage:Ae.loadPage},Ae.id):Ae.kind==="token_usage"?a.jsx(vwn,{sessionActions:Ae.sessionActions,sessionId:Ae.sessionId},Ae.id):a.jsx(Pyn,{task:Ae.task,actions:Ke},Ae.id):a.jsxs("div",{className:pt.emptyActions,"data-testid":"right-panel-empty-actions",children:[R.includes("review")&&a.jsxs("button",{type:"button",className:pt.emptyAction,disabled:!w||!y,onClick:y,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(TF,{})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("turnOutputs.review")}),a.jsx("span",{className:pt.emptyActionHint,children:he("turnOutputs.reviewLatest")}),a.jsx(zl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}),R.includes("sideTask")&&A&&E&&(j.length===0?a.jsxs("button",{type:"button",className:pt.emptyAction,disabled:L,"aria-busy":L,onClick:E,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Xj,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("sideTask.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("sideTask.description")}),a.jsx(zl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]}):a.jsxs(sv,{open:ve,onOpenChange:ye,modal:!1,children:[a.jsx(Yg,{asChild:!0,children:a.jsxs("button",{type:"button",className:pt.emptyAction,"aria-expanded":ve,onMouseEnter:Te,onMouseLeave:Ne,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(Xj,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("sideTask.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("sideTask.description")}),a.jsx(zl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})}),a.jsxs(Xg,{align:"end",className:"w-80",onMouseEnter:Te,onMouseLeave:Ne,children:[j.map(ke=>a.jsxs(yi,{onSelect:()=>N?.(ke),children:[a.jsx("span",{className:pt.sideTaskListTitle,children:ke.title}),ke.updatedAt&&a.jsx("span",{className:pt.sideTaskListTime,children:ZA(ke.updatedAt,he)})]},ke.sessionId)),a.jsx(yx,{}),a.jsxs(yi,{onSelect:E,children:[a.jsx(aWe,{className:pt.sideTaskNewIcon,strokeWidth:1.6,"aria-hidden":"true"}),a.jsx("span",{className:pt.sideTaskListTitle,children:he("sideTask.new")})]})]})]})),ue&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:S,children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(TT,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("webPreview.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("webPreview.openHint")}),a.jsx(zl,{className:pt.emptyActionChevron,"aria-hidden":"true"})]}),W&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:()=>k?.(),"data-testid":"right-panel-open-trajectory",children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(k$,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("trajectory.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("trajectory.description")}),a.jsx(zl,{className:pt.emptyActionChevron,"aria-hidden":"true"})]}),x&&a.jsxs("button",{type:"button",className:pt.emptyAction,onClick:()=>x(),children:[a.jsx("span",{className:pt.emptyActionIcon,"aria-hidden":"true",children:a.jsx(lT,{strokeWidth:1.6})}),a.jsx("span",{className:pt.emptyActionTitle,children:he("terminal.title")}),a.jsx("span",{className:pt.emptyActionHint,children:he("terminal.open")}),a.jsx(zl,{className:pt.emptyActionChevron,strokeWidth:1.6,"aria-hidden":"true"})]})]})]})]})}function Ayn(){return a.jsxs("svg",{className:pt.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 jyn(){return a.jsx("svg",{className:pt.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 TF(){return a.jsxs("svg",{className:pt.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 Nyn(){return a.jsxs("svg",{className:pt.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 Myn({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(Vyn,{artifact:l,sourceSessionId:n,workspaceActions:s,previewContent:r}):o?a.jsx("div",{className:pt.empty,children:"Loading artifact..."}):i?a.jsx("div",{className:pt.empty,children:i}):a.jsx("div",{className:pt.empty,children:"Artifact not found."})}function Pyn({task:e,actions:t}){const{t:n}=Ct(),[s,r]=d.useState(null),[o,i]=d.useState(!0),[l,c]=d.useState(null),[u,h]=d.useState(""),[f,m]=d.useState(e.prompt),[g,w]=d.useState(()=>W1(e.cron)),[y,x]=d.useState(!1),[k,_]=d.useState(!1),[S,I]=d.useState(!1),[R,A]=d.useState(!1),[j,L]=d.useState(null),E=d.useRef(0),N=d.useRef(0),M=d.useRef({actions:t,taskId:e.id,workspaceId:e.workspaceId});M.current={actions:t,taskId:e.id,workspaceId:e.workspaceId};const $=d.useCallback((he,ve,ye,_e)=>{const ae=M.current;return he===E.current&&ae.actions===ve&&ae.taskId===ye&&ae.workspaceId===_e},[]),P=d.useCallback((he,ve,ye,_e)=>{const ae=M.current;return he===N.current&&ae.actions===ve&&ae.taskId===ye&&ae.workspaceId===_e},[]);d.useEffect(()=>()=>{E.current+=1,N.current+=1},[]),d.useEffect(()=>{I(!1),A(!1),L(null)},[t,e.id,e.workspaceId]);const z=d.useCallback(async()=>{const he=++E.current,ve=++N.current,ye=e.id,_e=e.workspaceId;if(!e.durable||!t){r(null),h(""),m(e.prompt),w(W1(e.cron)),c(null),i(!1);return}i(!0),c(null);try{const ae=await t.listScheduledTasks(_e);if(!$(he,t,ye,_e))return;const Se=ae.find(Te=>Te.id===e.id)??null;r(Se),Se?(h(Se.name??""),m(Se.prompt),w(W1(Se.cron))):(h(""),m(e.prompt),w(W1(e.cron)))}catch(ae){P(ve,t,ye,_e)&&c(ae instanceof Error?ae.message:String(ae))}finally{P(ve,t,ye,_e)&&i(!1)}},[t,P,$,e.cron,e.durable,e.id,e.prompt,e.workspaceId]);d.useEffect(()=>{z()},[z]);const H=!e.durable,O=e.durable&&!o&&!l&&!s,Y=!!s,Z=s?.name||s?.prompt||e.title,K=s?.prompt??e.prompt,B=s?.cron??e.cron,V=s?.recurring??e.recurring,J=s?.enabled,q=d.useCallback(()=>{s&&(h(s.name??""),m(s.prompt),w(W1(s.cron)),L(null),x(!0))},[s]),te=d.useCallback(()=>{x(!1),L(null),s&&(h(s.name??""),m(s.prompt),w(W1(s.cron)))},[s]),ie=d.useCallback(async()=>{if(!s||!t)return;const he=R9(g);if(!he){L(n("scheduledTasks.error.invalidSchedule"));return}if(f.trim().length===0){L(n("scheduledTasks.error.emptyPrompt"));return}const ve=++E.current,ye=e.id,_e=e.workspaceId;A(!0),L(null);try{const ae=await t.updateScheduledTask(s.id,{cron:he,prompt:f.trim(),name:u.trim()||null},_e);if(!$(ve,t,ye,_e))return;r(ae),h(ae.name??""),m(ae.prompt),w(W1(ae.cron)),x(!1)}catch(ae){$(ve,t,ye,_e)&&L(ae instanceof Error?ae.message:String(ae))}finally{$(ve,t,ye,_e)&&A(!1)}},[t,g,$,s,u,f,n,e.id,e.workspaceId]),ge=d.useCallback(async()=>{if(!s||!t)return;const he=++E.current,ve=e.id,ye=e.workspaceId;I(!0),L(null);try{const _e=await t.updateScheduledTask(s.id,{enabled:!s.enabled},ye);if(!$(he,t,ve,ye))return;r(_e)}catch(_e){$(he,t,ve,ye)&&L(_e instanceof Error?_e.message:String(_e))}finally{$(he,t,ve,ye)&&I(!1)}},[t,$,s,e.id,e.workspaceId]),re=d.useCallback(async()=>{if(!s||!t)return;const he=++E.current,ve=e.id,ye=e.workspaceId;I(!0),L(null);try{if(await t.deleteScheduledTask(s.id,ye),!$(he,t,ve,ye))return;r(null),_(!1)}catch(_e){$(he,t,ve,ye)&&L(_e instanceof Error?_e.message:String(_e))}finally{$(he,t,ve,ye)&&I(!1)}},[t,$,s,e.id,e.workspaceId]),G=R9(g),Q=G?QT(G,n):null;return a.jsxs("div",{className:pt.detail,children:[o&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.loading")}),l&&a.jsx("div",{className:rn.loadError,children:l}),O&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.deletedSnapshot")}),H&&a.jsx("div",{className:pt.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!O&&a.jsx("div",{className:pt.section,children:a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("span",{className:pt.fieldValue,children:Z}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.taskId")}),a.jsx("span",{className:pt.fieldValue,children:e.id}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.schedule")}),a.jsx("span",{className:pt.fieldValue,children:QT(B,n)}),a.jsx("span",{className:pt.fieldLabel,children:"Cron"}),a.jsx("span",{className:pt.fieldValue,children:B}),a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.type")}),a.jsx("span",{className:pt.fieldValue,children:n(V?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),J!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.fieldLabel,children:n("scheduledTasks.status")}),a.jsx("span",{className:pt.fieldValue,children:n(J?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!O&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Prompt"}),a.jsx("div",{className:pt.description,children:K})]}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:pt.actionsRow,children:[a.jsx("button",{type:"button",className:rn.primaryButton,disabled:!Y||S,onClick:q,children:n("scheduledTasks.edit")}),a.jsx("button",{type:"button",className:rn.secondaryButton,disabled:!Y||S,onClick:()=>void ge(),children:s?.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),a.jsx("button",{type:"button",className:rn.secondaryButton,disabled:!Y||S,onClick:()=>_(!0),children:n("scheduledTasks.delete")})]}),k&&s&&a.jsx(qa,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>_(!1),children:a.jsxs("div",{className:rn.formFields,children:[a.jsx("div",{className:pt.description,children:n("scheduledTasks.deleteConfirm",{name:s.name||s.prompt})}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:rn.formActions,children:[a.jsx("button",{type:"button",className:rn.secondaryButton,onClick:()=>_(!1),disabled:S,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:rn.primaryButton,onClick:()=>void re(),disabled:S,children:n("scheduledTasks.delete")})]})]})}),y&&a.jsx(qa,{title:n("scheduledTasks.editTitle"),size:"md",onClose:te,children:a.jsxs("div",{className:rn.formFields,children:[a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.name")}),a.jsx("input",{className:rn.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:he=>h(he.target.value)})]}),a.jsxs("label",{className:rn.field,children:[a.jsxs("span",{className:rn.fieldLabel,children:[n("scheduledTasks.prompt"),a.jsx("span",{className:rn.required,children:"*"})]}),a.jsx("textarea",{className:rn.textarea,value:f,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:he=>m(he.target.value)})]}),a.jsxs("div",{className:rn.scheduleRow,children:[a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.frequency")}),a.jsx("select",{className:rn.select,value:g.frequency,onChange:he=>{const ve=he.target.value;w(ye=>({...ye,frequency:ve,...ve==="hourly"?{time:"00:00"}:{}}))},children:_yn.map(he=>a.jsx("option",{value:he,children:n(`scheduledTasks.freq.${he}`)},he))})]}),(g.frequency==="daily"||g.frequency==="weekdays"||g.frequency==="weekly")&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.time")}),a.jsx("input",{className:rn.input,type:"time",value:g.time,onChange:he=>w(ve=>({...ve,time:he.target.value}))})]}),g.frequency==="weekly"&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.weekday")}),a.jsx("select",{className:rn.select,value:g.weekday,onChange:he=>w(ve=>({...ve,weekday:Number(he.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((he,ve)=>a.jsx("option",{value:ve,children:he},ve))})]}),g.frequency==="minutes"&&a.jsxs("label",{className:rn.field,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.interval")}),a.jsx("select",{className:rn.select,value:g.minuteInterval,onChange:he=>w(ve=>({...ve,minuteInterval:Number(he.target.value)})),children:Syn.map(he=>a.jsx("option",{value:he,children:he},he))})]}),g.frequency==="custom"&&a.jsxs("label",{className:`${rn.field} ${rn.fieldGrow}`,children:[a.jsx("span",{className:rn.fieldLabel,children:n("scheduledTasks.cron")}),a.jsx("input",{className:rn.input,type:"text",value:g.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:he=>w(ve=>({...ve,customCron:he.target.value}))})]})]}),a.jsx("div",{className:rn.preview,children:Q?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:rn.previewLabel,children:Q}),a.jsx("code",{className:rn.previewCron,children:G})]}):a.jsx("span",{className:rn.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),j&&a.jsx("div",{className:rn.formError,children:j}),a.jsxs("div",{className:rn.formActions,children:[a.jsx("button",{type:"button",className:rn.secondaryButton,onClick:te,disabled:R,children:n("scheduledTasks.cancel")}),a.jsx("button",{type:"button",className:rn.primaryButton,onClick:()=>void ie(),disabled:R,children:n(R?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function Lyn({changes:e,selectedPath:t,workspaceCwd:n,onOpenFilePreview:s,onDownloadFile:r,onDownloadError:o}){const{t:i}=Ct(),[l,c]=d.useState(!1),[u,h]=d.useState(!0),[f,m]=d.useState(!1),[g,w]=d.useState(520),y=d.useRef(g),x=d.useRef(null),k=d.useRef(null),[_,S]=d.useState(null),[I,R]=d.useState(()=>new Set),A=d.useRef(!0);d.useEffect(()=>(A.current=!0,()=>{A.current=!1}),[]);const j=l,L=d.useMemo(()=>qyn(e,n),[e,n]);d.useEffect(()=>{S(t)},[t]),d.useEffect(()=>{y.current=g},[g]),d.useEffect(()=>{const P=x.current;if(!P)return;const z=()=>{m(P.clientWidth<kyn)};z();const H=new ResizeObserver(z);return H.observe(P),()=>H.disconnect()},[u]),d.useEffect(()=>()=>k.current?.(),[]);const E=d.useCallback(P=>{const z=x.current;if(!z)return;P.preventDefault();const H=P.currentTarget;H.setPointerCapture(P.pointerId);const O=P.clientX,Y=y.current,Z=z.getBoundingClientRect().width,K=Math.max(180,Z-180),B=document.body.style.cursor,V=document.body.style.userSelect;let J=Y,q=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const te=()=>{q=null,w(J)},ie=G=>{J=Math.min(K,Math.max(180,Y+(G.clientX-O))),q===null&&(q=window.requestAnimationFrame(te))};let ge=()=>{};const re=G=>{k.current=null,q!==null&&(window.cancelAnimationFrame(q),q=null),G&&w(J),H.hasPointerCapture(P.pointerId)&&H.releasePointerCapture(P.pointerId),document.body.style.cursor=B,document.body.style.userSelect=V,window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge)};ge=()=>re(!0),k.current=()=>re(!1),window.addEventListener("pointermove",ie),window.addEventListener("pointerup",ge),window.addEventListener("pointercancel",ge)},[]);if(e.length===0)return a.jsx("div",{className:pt.empty,children:"No file changes to review."});const N=dCe(e),M=P=>{S(z=>z===P?null:P)},$=async P=>{if(!I.has(P.path)){R(z=>new Set(z).add(P.path));try{await r(P,()=>!A.current)}catch(z){A.current&&o(z)}finally{R(z=>{const H=new Set(z);return H.delete(P.path),H})}}};return a.jsxs("div",{className:pt.review,children:[a.jsxs("div",{className:pt.reviewToolbar,children:[a.jsxs("div",{className:pt.reviewToolbarTitle,children:[a.jsx("span",{children:i("turnOutputs.previousTurn")}),a.jsx(x7,{additions:N?.additions,deletions:N?.deletions,className:pt.lineStats,additionsClassName:pt.additions,deletionsClassName:pt.deletions})]}),a.jsxs("div",{className:pt.reviewToolbarActions,children:[a.jsxs("button",{type:"button",className:pt.reviewTotalsButton,onClick:()=>h(P=>!P),"aria-expanded":u,children:[a.jsx("span",{children:i("turnOutputs.fileCount",{count:e.length})}),a.jsx("span",{className:[pt.chevron,u?pt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(Mde,{})})]}),a.jsx("button",{type:"button",className:[pt.iconButton,l?pt.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>c(P=>!P),"aria-label":i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:i(l?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:l?a.jsx(Uyn,{}):a.jsx(Hyn,{})})]})]}),u&&a.jsxs("div",{ref:x,className:[pt.reviewContent,j?"":pt.reviewContentListOnly,j&&f?pt.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${g}px`},children:[a.jsx("div",{className:[pt.reviewList,_?pt.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(P=>{const z=_===P.path,H=pCe(P.path),O=yAt(P.path);return a.jsxs("div",{className:[pt.reviewItem,z?pt.reviewItemExpanded:""].filter(Boolean).join(" "),children:[a.jsxs("div",{className:pt.reviewRow,"data-selected":P.path===t||void 0,children:[a.jsx("button",{type:"button",className:pt.reviewRowToggle,onClick:()=>M(P.path),"aria-label":P.path,"aria-expanded":z}),a.jsx("span",{className:pt.fileIcon,children:l3e(P.path)}),a.jsxs("span",{className:pt.reviewFileName,children:[a.jsx(Byn,{path:oD(P.path,n),title:P.path}),H&&a.jsx("button",{type:"button",className:pt.reviewOpenButton,onClick:()=>s(P),title:`${i("turnOutputs.preview")} ${P.path}`,children:i("turnOutputs.preview")}),O&&a.jsx("button",{type:"button",className:pt.reviewOpenButton,onClick:()=>void $(P),title:`${i("common.download")} ${P.path}`,disabled:I.has(P.path),children:i(I.has(P.path)?"common.downloading":"common.download")})]}),a.jsx(x7,{additions:P.additions,deletions:P.deletions,className:pt.lineStats,additionsClassName:pt.additions,deletionsClassName:pt.deletions}),a.jsx("span",{className:[pt.chevron,z?pt.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:a.jsx(Mde,{})})]}),z&&a.jsx(Dyn,{change:P})]},`${P.toolCallId}:${P.path}`)})}),j&&!f&&a.jsx("div",{className:pt.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:E}),j&&a.jsx("div",{className:pt.tree,children:L.children.map(P=>a.jsx(o3e,{node:P,depth:0,selectedPath:t},P.path))})]})]})}function Dyn({change:e}){if(e.diffs.length===0)return a.jsx("div",{className:pt.diffEmpty,children:"No diff available."});const t=Oyn(e.diffs);return a.jsx("div",{className:pt.diffPreview,children:t.map((n,s)=>n.fileDiff&&!n.fullContent?a.jsx(nX,{diff:n.fileDiff},s):a.jsx($yn,{oldText:n.oldText,newText:n.newText},s))})}function Oyn(e){for(let t=e.length-1;t>=0;t--)if(e[t]?.fullContent)return e.slice(t);return e}function $yn({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=[nIe,js.editable.of(!1),da.readOnly.of(!0),js.lineWrapping],f={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return Je(async()=>{const{MergeView:g,unifiedMergeView:w}=await import("./index-BJgwudRv.js");return{MergeView:g,unifiedMergeView:w}},[]).then(({MergeView:g,unifiedMergeView:w})=>{if(!c)try{if(s){u=new g({a:{doc:e,extensions:h},b:{doc:t,extensions:h},parent:l,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:f});return}u=new js({doc:t,extensions:[...h,w({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:f})],parent:l})}catch(y){c||i(y instanceof Error?y.message:String(y))}}).catch(g=>{c||i(g instanceof Error?g.message:String(g))}),()=>{c=!0,u?.destroy()}},[s,t,e]),a.jsxs("div",{className:pt.codeMirrorDiffWrap,children:[a.jsx("div",{ref:n,className:pt.codeMirrorDiff}),o&&a.jsxs("div",{className:pt.diffError,children:["Diff unavailable: ",o]})]})}function o3e({node:e,depth:t,selectedPath:n}){const s=!!e.file,[r,o]=d.useState(!0),i=[pt.treeRow,s?pt.treeFile:pt.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:pt.treeTwisty,children:!s&&a.jsx("span",{className:[pt.treeChevron,r?"":pt.treeChevronClosed].filter(Boolean).join(" "),children:a.jsx(Wyn,{})})}),a.jsxs("span",{className:pt.treeContent,children:[s&&a.jsx("span",{className:pt.fileIcon,children:l3e(e.path)}),a.jsx("span",{className:pt.treeName,children:e.name})]}),e.file?.isArtifact&&a.jsx("span",{className:pt.reviewBadge,children:"artifact"})]});return a.jsxs("div",{className:pt.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:pt.treeChildren,style:c,children:e.children.map(h=>a.jsx(o3e,{node:h,depth:t+1,selectedPath:n},h.path))})]})}function Byn({path:e,title:t}){const n=d.useRef(null),[s,r]=d.useState(()=>i3e(e));return d.useLayoutEffect(()=>{const o=n.current;if(!o)return;const i=()=>r(zyn(e,o));i();const l=new ResizeObserver(i);return l.observe(o),()=>l.disconnect()},[e]),a.jsxs("span",{ref:n,className:pt.reviewPath,title:t??e,children:[s.prefix&&a.jsx("span",{className:pt.pathPrefix,children:s.prefix}),a.jsx("span",{className:pt.pathFileName,children:s.leaf})]})}function i3e(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let Nde=null;function zyn(e,t){const n=i3e(e),s=t.clientWidth;if(s<=0)return n;const r=Fyn(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 Fyn(e){Nde??=document.createElement("canvas");const t=Nde.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 Hyn(){return a.jsxs("svg",{className:pt.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 Uyn(){return a.jsxs("svg",{className:pt.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 Mde(){return a.jsx("svg",{className:pt.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 Wyn(){return a.jsx("svg",{className:pt.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 qyn(e,t){const n={name:"",path:"",children:[]};for(const s of e){const r=oD(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 a3e(n),n}function a3e(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)a3e(t)}function H8(e){return yb(e).split("/").filter(Boolean).at(-1)??e}function l3e(e){const t=H8(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 Vyn({artifact:e,sourceSessionId:t,workspaceActions:n,previewContent:s}){const{t:r}=Ct(),o=Wp(),i=gye(e),l=X4(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=mye(e);return e.metadata?.artifactType==="web_preview_snapshot"?a.jsx(jvn,{artifact:e,sourceSessionId:t}):u?e.status!=="available"?a.jsx(Gyn,{status:e.status}):!h||!e.workspacePath?a.jsx(Kyn,{}):a.jsx(Hfn,{workspacePath:e.workspacePath,artifactVersion:pne(e),workspaceActions:n}):h&&e.workspacePath?fye(e)?a.jsx(Zyn,{artifact:e,workspaceActions:n}):a.jsx(PD,{workspacePath:e.workspacePath,artifactVersion:pne(e),workspaceActions:n,previewContent:s,previewSizeBytes:e.sizeBytes,imageMimeType:f,previewKind:Yyn(e)?"html":Xyn(e)?"markdown":f?"image":"source"}):a.jsxs("div",{className:pt.detail,children:[a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:c?"Automation Snapshot":"Artifact"}),a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx(Sp,{label:"Type",value:MK(e.kind,e.workspacePath)}),a.jsx(Sp,{label:"Storage",value:e.storage}),a.jsx(Sp,{label:"Status",value:e.status}),a.jsx(Sp,{label:"Source",value:e.source}),a.jsx(Sp,{label:"Size",value:wL(e.sizeBytes)}),a.jsx(Sp,{label:"Created",value:e.createdAt}),a.jsx(Sp,{label:"Updated",value:e.updatedAt}),e.toolName&&a.jsx(Sp,{label:"Tool",value:e.toolName}),e.toolCallId&&a.jsx(Sp,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Description"}),a.jsx("div",{className:pt.description,children:e.description})]}),c&&e.metadata&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Details"}),a.jsxs("div",{className:pt.fieldGrid,children:[$2(e.metadata,"automationId","Automation ID"),$2(e.metadata,"schedule","Schedule"),$2(e.metadata,"timezone","Timezone"),$2(e.metadata,"status","Status"),$2(e.metadata,"nextRunAt","Next run"),$2(e.metadata,"prompt","Prompt")]})]}),(i||l)&&a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:"Location"}),l?a.jsxs("div",{className:pt.locationRow,children:[a.jsx("a",{className:pt.link,href:l,target:"_blank",rel:"noopener noreferrer",onClick:m=>o(m,l),children:l}),a.jsx("a",{className:pt.openButton,href:l,target:"_blank",rel:"noopener noreferrer",onClick:m=>o(m,l),children:r("artifact.openLink")})]}):a.jsx("div",{className:pt.meta,children:i})]})]})}function Gyn({status:e}){const{t}=Ct();return a.jsx("div",{className:pt.previewError,role:"alert",children:t("codeReview.unavailable",{status:e})})}function Kyn(){const{t:e}=Ct();return a.jsx("div",{className:pt.previewError,role:"alert",children:e("codeReview.workspaceRequired")})}function Yyn(e){const t=e.workspacePath?.toLowerCase()??"",n=wb(e.mimeType);return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")||n==="text/html"}function Xyn(e){const t=e.workspacePath?.toLowerCase()??"",n=wb(e.mimeType);return t.endsWith(".md")||t.endsWith(".markdown")||n==="text/markdown"}function Zyn({artifact:e,workspaceActions:t}){const{t:n}=Ct(),[s,r]=d.useState(null),[o,i]=d.useState(!1),l=d.useRef(!0),c=gye(e);d.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const u=async()=>{if(e.workspacePath){i(!0),r(null);try{await yL(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:pt.detail,children:a.jsxs("div",{className:pt.section,children:[a.jsx("div",{className:pt.sectionTitle,children:n("common.download")}),a.jsxs("div",{className:pt.fieldGrid,children:[a.jsx(Sp,{label:"Type",value:MK(e.kind,e.workspacePath)}),a.jsx(Sp,{label:"Size",value:wL(e.sizeBytes)}),c?a.jsx(Sp,{label:"Location",value:c}):null,e.status!=="available"&&e.status!=="changed"?a.jsx(Sp,{label:"Status",value:e.status??"missing"}):null]}),a.jsx("div",{className:pt.downloadRow,children:a.jsx("button",{type:"button",className:pt.downloadButton,onClick:()=>{u()},disabled:o||e.status!=="available"&&e.status!=="changed",children:n(o?"common.downloading":"common.download")})}),s&&a.jsx("div",{className:pt.previewError,children:s})]})})}function Jyn({tab:e}){const{t}=Ct(),n=nl(),s=nI(e.workspaceCwd),r=s?.actions,o=Wp(),[i,l]=d.useState(0),[c,u]=d.useState(),[h,f]=d.useState(),[m,g]=d.useState(),w=e.source,y=w.locator,x=e.owner.isCurrent()&&n.sessionId===e.sourceSessionId&&n.capabilities?.features.includes("session_sources")&&s?.workspaceId===e.workspaceId&&(!!s||e.workspaceCwd===void 0&&y.type!=="workspace_file")&&(y.type!=="workspace_file"||w.workspaceCwd===n.workspaceCwd),k=y.type==="workspace_file"?y.workspacePath:y.type==="attachment"?y.attachmentId:"",_=/\.pdf$/i.test(k);if(d.useEffect(()=>{let I=!1;return u(void 0),f(void 0),g(void 0),!x||y.type==="url"?void 0:((async()=>{if(y.type==="attachment"){const A=await e.sessionActions.readAttachment(y.attachmentId);if(I||!e.owner.isCurrent())return;const j=Uint8Array.from(atob(A.data),L=>L.charCodeAt(0));u(new Blob([j],{type:A.mimeType}))}else if(_&&r){const A=await F4(r.readFileBytes,k,"application/pdf",{statFile:r.stat,isCancelled:()=>I||!e.owner.isCurrent()});!I&&e.owner.isCurrent()&&u(A)}})().catch(A=>{!I&&e.owner.isCurrent()&&f(Iu(A))}),()=>{I=!0})},[i,x,y,k,_,e.owner,e.sessionActions,r]),x&&y.type==="url")return a.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[a.jsx("h3",{children:w.title}),w.description&&a.jsx("p",{children:w.description}),a.jsx("p",{className:"break-all text-sm text-muted-foreground",children:y.url}),X4(y.url)&&a.jsx("a",{className:"text-primary underline",href:y.url,target:"_blank",rel:"noopener noreferrer",onClick:I=>o(I,y.url),children:t("sources.openOriginal")})]});if(!x||!s&&y.type!=="attachment")return a.jsx("div",{className:pt.empty,role:"alert",children:t("sources.unavailable")});const S=y.type==="workspace_file"&&!_&&fye({workspacePath:k});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:k,children:k}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[m&&a.jsx(Wt,{variant:"ghost",size:"icon-sm",asChild:!0,children:a.jsx("a",{href:m,download:w.title,"aria-label":`Download ${w.title}`,title:t("common.download"),children:a.jsx(eb,{})})}),h&&a.jsx(Wt,{variant:"ghost",size:"sm",onClick:()=>l(I=>I+1),children:t("common.retry")})]})]}),h?a.jsx("div",{className:pt.previewError,role:"alert",children:h}):S?a.jsxs("div",{className:"p-4",children:[a.jsx("p",{children:t("attachment.previewUnsupported")}),a.jsx(Wt,{onClick:()=>void yL(r,k,"application/octet-stream",()=>!e.owner.isCurrent()).catch(I=>{e.owner.isCurrent()&&f(Iu(I))}),children:t("common.download")})]}):(y.type==="attachment"||_)&&!c?a.jsx("div",{className:pt.empty,role:"status",children:t("common.loading")}):c&&c.type!=="application/pdf"&&!S4(c.type,k)?a.jsx(c3e,{data:c,title:w.title,onDownloadUrl:g,showDownload:!1,image:!!eC(k)&&c.type.startsWith("image/")}):a.jsx("div",{className:"relative min-h-0 flex-1 overflow-auto",children:a.jsx(PD,{workspacePath:k,workspaceActions:r,onLoadError:f,previewData:c,previewOnly:y.type==="attachment",previewMimeType:c?.type,previewKind:/\.html?$/i.test(k)||wb(c?.type)==="text/html"?"source":void 0},i)})]})}function c3e({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:pt.imagePreviewWrap,children:[n?a.jsx("img",{className:pt.imagePreview,src:o,alt:t}):a.jsx(u3e,{name:t,mimeType:e.type,size:e.size}),r&&a.jsx("a",{href:o,download:t,"aria-label":`Download ${t}`,children:a.jsx(eb,{})})]}):null}function PD({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(Qyn,{workspacePath:e,workspaceActions:n,data:o,mimeType:i,previewKind:c,onLoadError:h});const f=e.toLowerCase(),m=l??eC(e),g=c??(f.endsWith(".html")||f.endsWith(".htm")?"html":f.endsWith(".md")||f.endsWith(".markdown")?"markdown":m?"image":"source");return g==="html"?a.jsx(sbn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):g==="markdown"?a.jsx(obn,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:u,onLoadError:h}):g==="image"&&m?a.jsx(nbn,{workspacePath:e,artifactVersion:t,workspaceActions:n,mimeType:m,onLoadError:h}):a.jsx(d3e,{workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:u,onLoadError:h})}function Qyn({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(tbn,{data:n,mimeType:i,title:e}):S4(i,e)?a.jsx(ebn,{workspacePath:e,workspaceActions:t,data:n,previewKind:r,onLoadError:o}):a.jsx(u3e,{name:e,mimeType:i,size:n.size})}function ebn({workspacePath:e,workspaceActions:t,data:n,previewKind:s,onLoadError:r}){const{t:o}=Ct(),[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:pt.previewError,children:c}):i===void 0?a.jsx("div",{className:pt.empty,children:o("attachment.loadingFile")}):a.jsx(PD,{workspacePath:e,workspaceActions:t,previewContent:i,previewSizeBytes:n.size,previewOnly:!0,previewKind:s})}function tbn({data:e,mimeType:t,title:n}){const{t:s}=Ct(),[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:pt.pdfAttachmentPreview,src:r,title:`Preview ${n}`}):a.jsx("div",{className:pt.empty,children:s("attachment.loadingPreview")})}function u3e({name:e,mimeType:t,size:n}){const{t:s}=Ct();return a.jsxs("div",{className:pt.unsupportedAttachmentPreview,children:[a.jsx(K0,{name:e,mimeType:t,"aria-hidden":"true"}),a.jsx("div",{children:s("attachment.previewUnsupported")}),a.jsxs("div",{className:pt.unsupportedAttachmentMeta,children:[t," · ",wL(n)]})]})}function nbn({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),F4((f,m)=>n.readFileBytes(f,m),e,s,{statFile:f=>n.stat(f),isCancelled:()=>u}).then(f=>{u||(h=URL.createObjectURL(f),i(h))}).catch(f=>{if(u)return;const m=f instanceof Error?f.message:String(f);c(m),r?.(m)}),()=>{u=!0,h&&URL.revokeObjectURL(h)}},[t,s,r,n,e]),a.jsxs("div",{className:pt.imagePreviewWrap,children:[o?a.jsxs(a.Fragment,{children:[a.jsx("img",{className:pt.imagePreview,src:o,alt:H8(e)}),a.jsx("a",{className:pt.imageDownloadButton,href:o,download:H8(e),"aria-label":`Download ${H8(e)}`,title:"Download",children:a.jsx(eb,{size:16,strokeWidth:1.8})})]}):l?null:a.jsx("div",{className:pt.empty,children:"Loading image..."}),l&&a.jsx("div",{className:pt.previewError,children:l})]})}function vJ({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 m=!1;if(l(s??null),f(null),u(void 0),!r)return n.stat(e).then(g=>{if(!m){if(g.type==="directory")throw new Error("Directories cannot be opened as artifacts.");return n.readWorkspaceFile(e,{maxBytes:256*1024})}}).then(async g=>{if(m||!g||!g.truncated)return g;const w=await F4((y,x)=>n.readFileBytes(y,x),e,"application/octet-stream",{statFile:y=>n.stat(y),isCancelled:()=>m});return{sizeBytes:w.size,content:new TextDecoder(g.encoding||"utf-8").decode(await w.arrayBuffer())}}).then(g=>{m||!g||(u(g.sizeBytes),l(g.content))}).catch(g=>{if(m)return;const w=g instanceof Error?g.message:String(g);f(w),o?.(w)}),()=>{m=!0}},[t,s,r,o,n,e]),{content:i,error:h,sizeBytes:c}}function sbn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=vJ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:pt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:pt.empty,children:"Loading preview..."}):a.jsx(h3e,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx(rbn,{content:l,workspacePath:e})}),c&&a.jsx("div",{className:pt.previewError,children:c})]})}function rbn({content:e,workspacePath:t}){const n=`Preview ${t}`,{t:s}=Ct(),[r,o]=d.useState(null),[i,l]=d.useState(null);return d.useEffect(()=>{const c=new AbortController;return o(null),l(null),ZGe(e,n,c.signal).then(u=>{c.signal.aborted||o(u)},u=>{c.signal.aborted||l(Iu(u))}),()=>c.abort()},[e,n]),i?a.jsx("div",{className:pt.previewError,children:s("artifact.previewFailed",{message:i})}):r===null?a.jsx("div",{className:pt.empty,children:s("attachment.loadingPreview")}):a.jsx("iframe",{className:pt.htmlPreview,referrerPolicy:"no-referrer",sandbox:"allow-scripts",srcDoc:r,title:n})}function d3e({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}=vJ({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 m;try{m=new js({doc:u,extensions:[nIe,js.editable.of(!1),da.readOnly.of(!0),js.lineWrapping],parent:f})}catch(g){c(g instanceof Error?g.message:String(g));return}return()=>m.destroy()},[u]),a.jsxs("div",{className:pt.filePreviewWrap,children:[u===null?!h&&a.jsx("div",{className:pt.empty,children:"Loading file..."}):a.jsx("div",{ref:i,className:pt.codeMirrorFile}),(h||l)&&a.jsx("div",{className:pt.previewError,children:h||l})]})}function h3e({content:e,sizeBytes:t,workspacePath:n,workspaceActions:s,children:r}){const{t:o}=Ct(),[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(Wt,{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(d3e,{workspacePath:n,workspaceActions:s,previewContent:e,previewOnly:!0})})]})}function obn({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewSizeBytes:r,previewOnly:o,onLoadError:i}){const{content:l,error:c,sizeBytes:u}=vJ({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:s,previewOnly:o,onLoadError:i});return a.jsxs("div",{className:pt.htmlPreviewWrap,children:[l===null?!c&&a.jsx("div",{className:pt.empty,children:"Loading preview..."}):a.jsx(h3e,{content:l,sizeBytes:u??r,workspacePath:e,workspaceActions:n,children:()=>a.jsx("div",{className:pt.markdownPreviewWrap,children:a.jsx(Am,{content:l})})}),c&&a.jsx("div",{className:pt.previewError,children:c})]})}function Sp({label:e,value:t}){return t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:pt.fieldLabel,children:e}),a.jsx("span",{className:pt.fieldValue,children:t})]}):null}function $2(e,t,n){const s=e[t];return s==null||s===""?null:a.jsx(Sp,{label:n,value:String(s)},t)}/**
|
|
2248
2248
|
* @license
|
|
2249
2249
|
* Copyright 2025 Qwen Team
|
|
2250
2250
|
* SPDX-License-Identifier: Apache-2.0
|