@qwen-code/qwen-code 0.26.2-preview.0 → 0.26.2-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/{MaxSizedBox-K6YUM3DX.js → MaxSizedBox-EGHZ2BPF.js} +1 -1
- package/chunks/{StandaloneSessionPicker-75IC33SN.js → StandaloneSessionPicker-UVCW6YW3.js} +1 -1
- package/chunks/{acp-subagent-executor-3NHBJRPL.js → acp-subagent-executor-AQ7AWSD4.js} +1 -1
- package/chunks/{acpAgent-JT6KQPTH.js → acpAgent-IV7JAGD7.js} +3 -3
- package/chunks/{advisor-TI2UVEZK.js → advisor-UZ4TF65D.js} +1 -1
- package/chunks/{agent-SWIZZZMY.js → agent-CNLVAWDD.js} +1 -1
- package/chunks/{agent-headless-USWEJ4GW.js → agent-headless-ZJUJLUJS.js} +1 -1
- package/chunks/{agent-host-client-ZFIMQX33.js → agent-host-client-SN5V2KBH.js} +1 -1
- package/chunks/{agent-host-connections-LOFD7O7Q.js → agent-host-connections-VKMAJIIU.js} +1 -1
- package/chunks/{anthropicContentGenerator-HMLEI4FI.js → anthropicContentGenerator-QTJVPAMI.js} +1 -1
- package/chunks/{autofix-pr-NKR2VSLB.js → autofix-pr-U7GNSH27.js} +1 -1
- package/chunks/{batch-JQZ3TOHA.js → batch-MBEWETXN.js} +1 -1
- package/chunks/{bridge-EIWWT4P6.js → bridge-TEJLNYV3.js} +1 -1
- package/chunks/{channel-settings-store-FLRLUA67.js → channel-settings-store-QNCKWWBL.js} +1 -1
- package/chunks/{chunk-244YTFYD.js → chunk-23KDY7UW.js} +1 -1
- package/chunks/{chunk-7TDMQJTD.js → chunk-2DWWSMTV.js} +1 -1
- package/chunks/{chunk-UU2LTNSF.js → chunk-3IZMVLVZ.js} +1 -1
- package/chunks/{chunk-B6T4ESBM.js → chunk-3JI7IKJL.js} +1 -1
- package/chunks/{chunk-Y5TT2G3N.js → chunk-427MARCP.js} +1 -1
- package/chunks/{chunk-KX7JS2P7.js → chunk-4NNNGSQY.js} +3 -3
- package/chunks/{chunk-6TQS2WQO.js → chunk-4RM7KY3Z.js} +2 -2
- package/chunks/{chunk-YL3N2UGG.js → chunk-5X7S4AE6.js} +5 -5
- package/chunks/{chunk-K2HAY5PY.js → chunk-5XAECBED.js} +1 -1
- package/chunks/{chunk-VCHFBETO.js → chunk-66KKSLUO.js} +1 -1
- package/chunks/{chunk-BSJR2KEF.js → chunk-6CIIDUZW.js} +1 -1
- package/chunks/{chunk-22CLK7PK.js → chunk-7EBRMQYW.js} +1 -1
- package/chunks/{chunk-J4TFGZ4A.js → chunk-7FSC2NKA.js} +1 -1
- package/chunks/{chunk-6JFC5M6B.js → chunk-A5TAAMML.js} +1 -1
- package/chunks/{chunk-DHHACQVN.js → chunk-AOYSX44A.js} +1 -1
- package/chunks/{chunk-VFVZ2DY7.js → chunk-AZCMQ3DD.js} +2 -2
- package/chunks/{chunk-BQJXWIMR.js → chunk-B6F7CVBP.js} +1 -1
- package/chunks/{chunk-OVPEAKOQ.js → chunk-BDQOLT37.js} +1 -1
- package/chunks/{chunk-5SYUBQNO.js → chunk-BIWEUAKG.js} +1 -1
- package/chunks/{chunk-BZM66PQO.js → chunk-BJ5R7LOM.js} +1 -1
- package/chunks/{chunk-4R2OHBH3.js → chunk-BKUFRNME.js} +1 -1
- package/chunks/{chunk-NIYWNFVF.js → chunk-BNZSPX2I.js} +1 -1
- package/chunks/{chunk-FJV2ECNY.js → chunk-D2URRVOK.js} +1 -1
- package/chunks/{chunk-GT6CHVAI.js → chunk-DANP7CMW.js} +1 -1
- package/chunks/{chunk-FHFLD4DR.js → chunk-DBHLRZGI.js} +1 -1
- package/chunks/{chunk-Y2UXZJLM.js → chunk-DL7TKH2E.js} +2 -2
- package/chunks/{chunk-MCQE2U7N.js → chunk-DOWKH5OZ.js} +6 -6
- package/chunks/{chunk-UHRLBY3C.js → chunk-DPHQJPCU.js} +1 -1
- package/chunks/{chunk-PV2VT25U.js → chunk-DPNGBOI7.js} +1 -1
- package/chunks/{chunk-NCDNF7UJ.js → chunk-DXRXF4QD.js} +1 -1
- package/chunks/{chunk-OCVRMNEQ.js → chunk-DZ3GV34J.js} +1 -1
- package/chunks/{chunk-3QIAXWWW.js → chunk-EU2MKUK4.js} +1 -1
- package/chunks/{chunk-KMAVI6FB.js → chunk-EVBUXPGM.js} +1 -1
- package/chunks/{chunk-BVSTV4JM.js → chunk-F3ZRU2SA.js} +1 -1
- package/chunks/{chunk-TBZY477Y.js → chunk-FCZYH27X.js} +1 -1
- package/chunks/{chunk-JCOK67LT.js → chunk-FNDMWG43.js} +1 -1
- package/chunks/{chunk-5SF32OGU.js → chunk-GDXLJJSW.js} +1 -1
- package/chunks/{chunk-SO6FCPRI.js → chunk-GZYIXB7Y.js} +1 -1
- package/chunks/{chunk-WZPTWC7X.js → chunk-HHNAH4IH.js} +1 -1
- package/chunks/{chunk-7KCAOXNL.js → chunk-HOKROBQZ.js} +1 -1
- package/chunks/{chunk-34ZBUQJV.js → chunk-IGPAATQW.js} +1 -1
- package/chunks/{chunk-2ZTRKK2O.js → chunk-INFBJDWM.js} +1 -1
- package/chunks/{chunk-IEJ2CGRN.js → chunk-J3R7ZNSA.js} +1 -1
- package/chunks/{chunk-KT5MPRYB.js → chunk-JCRS367I.js} +1 -1
- package/chunks/{chunk-7JWJTRP6.js → chunk-JFVXZFMV.js} +1 -1
- package/chunks/{chunk-47LP4MBD.js → chunk-JKMGS2VD.js} +1 -1
- package/chunks/{chunk-WRJ3PMDZ.js → chunk-JUQ7T2MV.js} +1 -1
- package/chunks/{chunk-NZX3UWNF.js → chunk-KQ4TDFNE.js} +1 -1
- package/chunks/{chunk-X7D4VKMX.js → chunk-L6BKKN42.js} +1 -1
- package/chunks/{chunk-YG5HVFMY.js → chunk-L7Y6MOHS.js} +1 -1
- package/chunks/{chunk-UFTIUKD4.js → chunk-LGYXZJI3.js} +1 -1
- package/chunks/{chunk-JQGGILML.js → chunk-LPOEVTKD.js} +1 -1
- package/chunks/{chunk-5KI55A6S.js → chunk-LRXS7ZI2.js} +1 -1
- package/chunks/{chunk-CKVHEYXW.js → chunk-LYYVSCNL.js} +1 -1
- package/chunks/{chunk-LIIMQ4DI.js → chunk-LZNBHBAJ.js} +6 -6
- package/chunks/{chunk-H4GDEXMF.js → chunk-M3C6RDGC.js} +1 -1
- package/chunks/{chunk-KKKUB3RQ.js → chunk-MNVMHVQJ.js} +1 -1
- package/chunks/{chunk-2B3W7IQY.js → chunk-MVGQFFIK.js} +1 -1
- package/chunks/{chunk-Q35A2RGO.js → chunk-NC7BCZPQ.js} +1 -1
- package/chunks/{chunk-2ZOTG3NW.js → chunk-NE627MUW.js} +1 -1
- package/chunks/{chunk-W4P2EN3V.js → chunk-NZNRCPGE.js} +1 -1
- package/chunks/{chunk-YPDQJQ3S.js → chunk-P3M4WWRA.js} +1 -1
- package/chunks/{chunk-DVB36ASH.js → chunk-P534ONQN.js} +1 -1
- package/chunks/{chunk-EL5J4ESB.js → chunk-QF44NNSC.js} +1 -1
- package/chunks/{chunk-IQPJOBPI.js → chunk-QHGCDHNW.js} +1 -1
- package/chunks/{chunk-EVZC4KEQ.js → chunk-QWJX7NIP.js} +1 -1
- package/chunks/{chunk-J2TJL2F4.js → chunk-S53G54DW.js} +2 -2
- package/chunks/{chunk-3A6LFJJV.js → chunk-SMNFL3AD.js} +1 -1
- package/chunks/{chunk-WDO3K3P2.js → chunk-TOBNWST4.js} +1 -1
- package/chunks/{chunk-AVGJ4HE3.js → chunk-TQSBUHAM.js} +1 -1
- package/chunks/{chunk-ABUS7DNN.js → chunk-TW5QEP2J.js} +1 -1
- package/chunks/{chunk-WYM4Z4D5.js → chunk-UEB2F43V.js} +1 -1
- package/chunks/{chunk-FUUPMVD2.js → chunk-UPPE4I6H.js} +1 -1
- package/chunks/{chunk-UHBJVFZA.js → chunk-US42COBM.js} +1 -1
- package/chunks/{chunk-RMQNBSMK.js → chunk-UUY6XSQI.js} +1 -1
- package/chunks/{chunk-UVQUQNCA.js → chunk-UZI3IA27.js} +1 -1
- package/chunks/{chunk-SXJ2E33J.js → chunk-V6VMUJ47.js} +1 -1
- package/chunks/{chunk-5UFCNJGN.js → chunk-VG2ZINTO.js} +1 -1
- package/chunks/{chunk-JPPPJ2GN.js → chunk-VJI6MHWX.js} +1 -1
- package/chunks/{chunk-AUI7WVSU.js → chunk-VOBNHBCJ.js} +1 -1
- package/chunks/{chunk-3BNJDZHU.js → chunk-VUEZWMI4.js} +1 -1
- package/chunks/{chunk-LMNKCL55.js → chunk-W7ZX6WB3.js} +2 -2
- package/chunks/{chunk-HVS6V2UZ.js → chunk-WA2LKUVP.js} +1 -1
- package/chunks/{chunk-7APLU2XE.js → chunk-WFFCJ5PF.js} +1 -1
- package/chunks/{chunk-3TD4WAG5.js → chunk-WQY5GE65.js} +1 -1
- package/chunks/{chunk-3YWRMF6C.js → chunk-WSESLSKK.js} +1 -1
- package/chunks/{chunk-NILCQMZ7.js → chunk-XFJV5NYT.js} +1 -1
- package/chunks/{chunk-LGBGUITT.js → chunk-XIYLRIW4.js} +1 -1
- package/chunks/{chunk-KS74L67R.js → chunk-XQ2NYKJH.js} +1 -1
- package/chunks/{chunk-JB2NOB6W.js → chunk-Y3VRWG52.js} +1 -1
- package/chunks/{chunk-GVZ6D2NL.js → chunk-YBISME5B.js} +1 -1
- package/chunks/{chunk-2C2253QI.js → chunk-YJNWPSB3.js} +1 -1
- package/chunks/{chunk-O2T3GQ6F.js → chunk-YWVV5STA.js} +1 -1
- package/chunks/{chunk-MAQZSOHI.js → chunk-ZH4J3FL6.js} +1 -1
- package/chunks/{chunk-THNEKTPK.js → chunk-ZSKCF6DI.js} +1 -1
- package/chunks/{chunk-Z7BAHKO5.js → chunk-ZW6456SD.js} +1 -1
- package/chunks/{chunk-DMSZ2TB3.js → chunk-ZWM3LLT7.js} +1 -1
- package/chunks/{codex-subagent-executor-DQ5LQQWO.js → codex-subagent-executor-DWWT7246.js} +1 -1
- package/chunks/{config-utils-CY6HLKZ5.js → config-utils-NGZB522W.js} +1 -1
- package/chunks/{contextCommand-SGBWI7O6.js → contextCommand-7QCW2YNX.js} +1 -1
- package/chunks/{core-runtime-4DP27LCC.js → core-runtime-PSVNDJPD.js} +1 -1
- package/chunks/{create-sub-session-ECPDZMBX.js → create-sub-session-JTSEMEJE.js} +1 -1
- package/chunks/{cron-create-OO4OG3EI.js → cron-create-VGIDTUMX.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-OYDNHT7P.js → daemon-git-worktree-guard-IQRGS7IH.js} +1 -1
- package/chunks/{daemon-status-provider-JGDLXPC6.js → daemon-status-provider-R4MYCYPG.js} +1 -1
- package/chunks/{daemon-trust-policy-5HRARS54.js → daemon-trust-policy-VAUKFZ2N.js} +1 -1
- package/chunks/{daemon-trust-policy-monitor-RM7FVIIC.js → daemon-trust-policy-monitor-E5HIO6RP.js} +1 -1
- package/chunks/{deferred-core-runtime-3CXBZIOG.js → deferred-core-runtime-FLOFQJPU.js} +1 -1
- package/chunks/{edit-DJPESAAY.js → edit-OOVQUGKV.js} +1 -1
- package/chunks/{enterPlanMode-IHBLRIF3.js → enterPlanMode-AUWVTQLT.js} +1 -1
- package/chunks/{environment-JN5SD347.js → environment-RM5OXYP4.js} +1 -1
- package/chunks/{errors-NUJCME3Y.js → errors-CLDJGHVD.js} +1 -1
- package/chunks/{execution-tool-I3SWG6I3.js → execution-tool-JFBVOKPW.js} +1 -1
- package/chunks/{execution-worker-62UZMAMJ.js → execution-worker-MNJZD72W.js} +1 -1
- package/chunks/{exitPlanMode-JIC4V3FE.js → exitPlanMode-PC6XG4TW.js} +1 -1
- package/chunks/{fast-path-NIOIL5YI.js → fast-path-V4DN3CRZ.js} +1 -1
- package/chunks/{glob-EQ4QNAHF.js → glob-DTZROBDS.js} +1 -1
- package/chunks/{goal-tools-DYTTSBQG.js → goal-tools-FUVGTY33.js} +1 -1
- package/chunks/{handleAutoUpdate-44BTG5L5.js → handleAutoUpdate-U4LVTHGU.js} +1 -1
- package/chunks/{i18n-FTHZAHCT.js → i18n-XOKNDFYP.js} +1 -1
- package/chunks/{initializer-MSGKXC75.js → initializer-XBR5J4CY.js} +1 -1
- package/chunks/{installationInfo-4XJMJJYU.js → installationInfo-4AOEOUI6.js} +1 -1
- package/chunks/{interactive-mod-session-DFLRYO2Q.js → interactive-mod-session-YGZK2JK2.js} +1 -1
- package/chunks/{list-ODZ7Z6VI.js → list-TCGKVPH4.js} +1 -1
- package/chunks/{llm-O64DHKP7.js → llm-SKFTN5UN.js} +4 -4
- package/chunks/{llm-content-generator-SK24I6QS.js → llm-content-generator-GWHXT3WS.js} +1 -1
- package/chunks/{loadedSettingsAdapter-6PEBUZT5.js → loadedSettingsAdapter-ZALZGZE7.js} +1 -1
- package/chunks/{local-ED3UEKWP.js → local-RWTWYS5Z.js} +1 -1
- package/chunks/{local-execution-environment-PUKES5LO.js → local-execution-environment-R6JWLD65.js} +1 -1
- package/chunks/{loggingContentGenerator-UHOJVSRR.js → loggingContentGenerator-UJV6QFOY.js} +1 -1
- package/chunks/{loop-wakeup-NSJQETPZ.js → loop-wakeup-BU2RRYHA.js} +1 -1
- package/chunks/{manage-memory-5RRB6FLH.js → manage-memory-XI57JN4T.js} +1 -1
- package/chunks/{managed-execution-engine-MZAP7SK6.js → managed-execution-engine-BA5PABMP.js} +1 -1
- package/chunks/{managed-local-serve-XMES3HXL.js → managed-local-serve-MFKN22K6.js} +1 -1
- package/chunks/{managed-npm-update-R5KGY7G2.js → managed-npm-update-ZGN43NUA.js} +1 -1
- package/chunks/{managed-runtime-attestation-worker-O2KNHHV6.js → managed-runtime-attestation-worker-YN2VBGYN.js} +1 -1
- package/chunks/{managed-runtime-bootstrap-HOTLM6DE.js → managed-runtime-bootstrap-SGQVMUJE.js} +1 -1
- package/chunks/{managed-runtime-session-worker-QZX44ZTD.js → managed-runtime-session-worker-4UMF3VBY.js} +1 -1
- package/chunks/{managed-runtime-ssh-worker-U425WQ65.js → managed-runtime-ssh-worker-7XA6KRBN.js} +1 -1
- package/chunks/{managed-session-authority-THHDHCBP.js → managed-session-authority-IJGYAOEL.js} +1 -1
- package/chunks/{mcp-AR7EK4WY.js → mcp-V3L7B5YK.js} +1 -1
- package/chunks/{memory-C2TSF6BK.js → memory-3T6FPNAK.js} +1 -1
- package/chunks/{model-call-collection-25WR55OH.js → model-call-collection-WTTITWWM.js} +1 -1
- package/chunks/{model-configuration-KC7DQGKV.js → model-configuration-T6SSGI4J.js} +1 -1
- package/chunks/{modelConfigUtils-QEHMVLSQ.js → modelConfigUtils-TQA25QJC.js} +1 -1
- package/chunks/{monitor-PDQUZD23.js → monitor-5ZAOJSEE.js} +1 -1
- package/chunks/{nonInteractiveCli-WY2YFONU.js → nonInteractiveCli-YFINLVA7.js} +1 -1
- package/chunks/{nonInteractiveToolExecutor-7RJZYPHJ.js → nonInteractiveToolExecutor-DE3WACL5.js} +1 -1
- package/chunks/{notebook-edit-P4ITXF5H.js → notebook-edit-UK6HBRO3.js} +1 -1
- package/chunks/{omni-AYUPB2QM.js → omni-65LF5QK4.js} +1 -1
- package/chunks/{openaiContentGenerator-V5IK4ITO.js → openaiContentGenerator-HX7NCSV5.js} +1 -1
- package/chunks/{openaiResponsesContentGenerator-DYDH6KWT.js → openaiResponsesContentGenerator-CFA6U6Y5.js} +1 -1
- package/chunks/{pidfile-INPBL2DK.js → pidfile-ZVKJUNTZ.js} +1 -1
- package/chunks/{processUtils-J4UDEDS4.js → processUtils-VS6CJT7E.js} +1 -1
- package/chunks/{prompt-terminal-ledger-QLOQWHYE.js → prompt-terminal-ledger-UF5RDB57.js} +1 -1
- package/chunks/{qwenContentGenerator-RU43XKKB.js → qwenContentGenerator-GM3ZSI7E.js} +1 -1
- package/chunks/{reactive-degrade-2Q3Z3KAR.js → reactive-degrade-TSAQWZ5F.js} +1 -1
- package/chunks/{read-file-472BQ25I.js → read-file-J267NT45.js} +1 -1
- package/chunks/{resumeHistoryUtils-7SUFKZDC.js → resumeHistoryUtils-IM46VFDV.js} +1 -1
- package/chunks/{review-WX52IWJR.js → review-4B64XTCL.js} +1 -1
- package/chunks/{ripGrep-4GPGLKAM.js → ripGrep-YLOSXO7P.js} +1 -1
- package/chunks/{run-qwen-serve-MXK4RBKL.js → run-qwen-serve-SAHEC44O.js} +1 -1
- package/chunks/{runtime-WHU3AGFT.js → runtime-SJDZHV6J.js} +1 -1
- package/chunks/{sandboxConfig-7DBXEQJH.js → sandboxConfig-47EXXMUA.js} +1 -1
- package/chunks/{scheduled-tasks-O5RV6G6U.js → scheduled-tasks-E6RCTUUS.js} +1 -1
- package/chunks/{scheduler-HLMS5LR5.js → scheduler-SE3IWIWA.js} +1 -1
- package/chunks/{search-memory-PYND7ZX3.js → search-memory-2W7VJC4Q.js} +1 -1
- package/chunks/{send-message-TMLYTQOI.js → send-message-63YGQP6G.js} +1 -1
- package/chunks/{serve-EBNBRAME.js → serve-F4ML2WNL.js} +1 -1
- package/chunks/{server-63BRDBL5.js → server-S56IB4TT.js} +3 -3
- package/chunks/{session-XB6J4CZD.js → session-2CUVLZ4H.js} +1 -1
- package/chunks/{session-attachments-root-PFK475N2.js → session-attachments-root-FINBX7K5.js} +1 -1
- package/chunks/{session-execution-engine-selector-P6TJTCKR.js → session-execution-engine-selector-UGC7DGUN.js} +1 -1
- package/chunks/{session-pr-refresh-PM7VAQTV.js → session-pr-refresh-KQLQ4MZY.js} +1 -1
- package/chunks/{sessionService-PO3LLZIZ.js → sessionService-Q6N7LF7Z.js} +1 -1
- package/chunks/{settings-JDQSRXP3.js → settings-23I6H76E.js} +1 -1
- package/chunks/{shell-JCEX3HKM.js → shell-IUECEVVY.js} +1 -1
- package/chunks/{skill-JSZBONIZ.js → skill-YKUETMPC.js} +1 -1
- package/chunks/{skill-settings-YGFG6GPN.js → skill-settings-ODYXOPCA.js} +1 -1
- package/chunks/{spawnChannel-VIIWSWTL.js → spawnChannel-7XU2SRWZ.js} +1 -1
- package/chunks/{standalone-update-2UU6FQZL.js → standalone-update-SWI2RL3L.js} +1 -1
- package/chunks/{start-opentui-ui-OSZZNSLY.js → start-opentui-ui-T53QJGCH.js} +1 -1
- package/chunks/{startInteractiveUI-FFH66MYH.js → startInteractiveUI-USTZGQOE.js} +1 -1
- package/chunks/{team-create-TKGDJ3NU.js → team-create-4A2XUE3D.js} +1 -1
- package/chunks/{team-plan-approval-3VJF4G6Z.js → team-plan-approval-4TS5CYN6.js} +1 -1
- package/chunks/{terminal-image-renderer-T3VJRZGP.js → terminal-image-renderer-C7553YV6.js} +1 -1
- package/chunks/{theme-manager-ZGUFLFUI.js → theme-manager-GTW75GOO.js} +1 -1
- package/chunks/{tool-call-3EQS5KSE.js → tool-call-YTUMWL3A.js} +1 -1
- package/chunks/{tool-result-media-7LFNVQ6E.js → tool-result-media-JYOYBX4J.js} +1 -1
- package/chunks/{tool-search-UDZ4S7T5.js → tool-search-Y4XTT2WF.js} +1 -1
- package/chunks/{total-session-admission-U4MII4RA.js → total-session-admission-EMJ5NRGL.js} +1 -1
- package/chunks/{trustedFolders-2NQJCIN3.js → trustedFolders-YG6WAVRE.js} +1 -1
- package/chunks/{update-relaunch-YKLWSCLC.js → update-relaunch-4QYQRCP4.js} +1 -1
- package/chunks/{updateCheck-YDLTQQRU.js → updateCheck-VRFPSX4G.js} +1 -1
- package/chunks/{upload-config-5QQKWF4O.js → upload-config-UCKGUYYQ.js} +1 -1
- package/chunks/{useAutoAcceptIndicator-AJS4WTU2.js → useAutoAcceptIndicator-2VGLKD7B.js} +1 -1
- package/chunks/{validateNonInterActiveAuth-AETOT7ZW.js → validateNonInterActiveAuth-GGMQXKKU.js} +1 -1
- package/chunks/{version-IB6DLRAG.js → version-Y46PG7II.js} +1 -1
- package/chunks/{web-fetch-LS3QARNR.js → web-fetch-7MPU555L.js} +1 -1
- package/chunks/{web-search-FGHRIVEB.js → web-search-HU2CL2X2.js} +1 -1
- package/chunks/{workflow-FX6XNETQ.js → workflow-U3D34QQX.js} +1 -1
- package/chunks/{workflow-ancestor-trust-5XXBGN6F.js → workflow-ancestor-trust-OWC4YTMR.js} +1 -1
- package/chunks/{workspace-agents-UJKLYPUK.js → workspace-agents-KHLAWSAR.js} +1 -1
- package/chunks/{workspace-providers-status-4JOHMTAW.js → workspace-providers-status-T57SE3YX.js} +1 -1
- package/chunks/{workspace-recovery-worker-XFEYQ4TP.js → workspace-recovery-worker-VYQ723ZE.js} +1 -1
- package/chunks/{workspace-registration-store-LWAPVNYC.js → workspace-registration-store-I7PR3A2Y.js} +1 -1
- package/chunks/{workspace-registry-M7OC376O.js → workspace-registry-YYUBXCLH.js} +1 -1
- package/chunks/{workspace-runtime-coordinator-CYHIL47L.js → workspace-runtime-coordinator-5ICAQO7W.js} +1 -1
- package/chunks/{workspace-service-43VZZ56B.js → workspace-service-YROWXOLQ.js} +1 -1
- package/chunks/{workspace-skills-status-V2TT6UJQ.js → workspace-skills-status-DKKQDTZJ.js} +1 -1
- package/chunks/{workspace-trust-reconciler-YZ4AG5ZW.js → workspace-trust-reconciler-3FPMUZDO.js} +1 -1
- package/chunks/{write-file-TGEH5MEZ.js → write-file-7QQVYFDT.js} +1 -1
- package/chunks/{zoom-image-TT6R7H2H.js → zoom-image-WL5EB6Q7.js} +1 -1
- package/cli.js +2 -2
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +3 -3
- package/web-shell/assets/{PierreFilePreview-OsApm5-S.js → PierreFilePreview-BZ17f56_.js} +1 -1
- package/web-shell/assets/{SpreadsheetPreview-I1v1EzV7.js → SpreadsheetPreview-Bvkvr_5u.js} +1 -1
- package/web-shell/assets/{WorkspaceFileBrowser-BO6aug7i.js → WorkspaceFileBrowser-BJ_I4Uoz.js} +1 -1
- package/web-shell/assets/{abnfDiagram-VCTEODGH-DxuLMyN0.js → abnfDiagram-VCTEODGH-iuaBM15V.js} +1 -1
- package/web-shell/assets/{agents-route-CSJf6QPO.js → agents-route-CycwfNSC.js} +1 -1
- package/web-shell/assets/{arc-3--LekYQ.js → arc-C0lt8n55.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-Dihq4uto.js → architectureDiagram-5GKGNRK7-Bw326d-A.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-BnaRPM2o.js → blockDiagram-NRAW4CY4-CHtFgBjV.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BtC94eMa.js → c4Diagram-UCG6FXSJ-Bx66oJT9.js} +1 -1
- package/web-shell/assets/channel-CRJuO00u.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-2ZTXWP6M.js → chunk-2Q5K7J3B-BIshvfa_.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-DBh7DP1F.js → chunk-5VM5RSS4-BZeRS6uD.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-xzqbWXBw.js → chunk-F27PBJKO-El-CGY2R.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-DxnCrpxK.js → chunk-G27WJ6UU-DO8ZfQL_.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-BPjRsozm.js → chunk-JWPE2WC7-yYFrrKAj.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-Q2HgB3lf.js → chunk-LCL6LL3I-BFGuOKN0.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-9tlPaKu-.js → chunk-POPQ4Y6H-GRHK6sdV.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-DkNdOHCU.js → chunk-SVP7TREG-DwDu6GqZ.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-D0G-Dhfi.js → chunk-XXDRQBXY-RoNDjkIy.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-pPPByLA7.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-pPPByLA7.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-Ck0tHxul.js → cose-bilkent-JH36ORCC-CYNiiONE.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-a4-NTMHi.js → cynefin-OW5HDTMX-DC1_lDIG.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-Pg41Zbf2.js → cynefinDiagram-5FMLGOSQ-D2VxKm2n.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-DT_ZmqkF.js → dagre-3AP2YEHR-C4_BHzpM.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-hapdMOl1.js → diagram-S7CK7UJ4-BpAO4-Gv.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-YZ0nbk56.js → diagram-UQ7AKVKN-DqUsFdsX.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-DA_yNbWy.js → diagram-VSXAHHWV-DcMXIYMy.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-DoULuCLT.js → diagram-VX7I27RA-I3nr09ex.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-B5c9o9zL.js → diagram-Z3DM3KII-CN-gvsTo.js} +1 -1
- package/web-shell/assets/{docx-preview-BulxdBjs.js → docx-preview-31J6RsS0.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-B5hgIg3m.js → ebnfDiagram-PWID7BFC-DOQvLWlM.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-BEfEPozi.js → erDiagram-SSCWMZ5O-Cb5ijFZh.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-CQHNk92v.js → flowDiagram-A5DVABFB-BecqqjnZ.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-BabdVgIM.js → ganttDiagram-EL5Y4UJY-DWY5vzQl.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-ujRZBFUo.js → gitGraphDiagram-WWUBYQGX-DqBnsZmZ.js} +1 -1
- package/web-shell/assets/{index-B9uXebIR.js → index-DDmiUW3b.js} +6 -6
- package/web-shell/assets/{index-DSZXdZnu.js → index-DabH7kHA.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-CUHj9jJC.js → infoDiagram-RXCK75RN-MlotyOdT.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-CulW_q81.js → ishikawaDiagram-5VMMS53U-Daq_85C7.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-BR46CvRQ.js → journeyDiagram-EYS64GPL-OipivCxL.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-HAoUqzFy.js → kanban-definition-3QL26DDD-zqaz7dLu.js} +1 -1
- package/web-shell/assets/{layout-DYLl7fyA.js → layout-Bi3msQMQ.js} +1 -1
- package/web-shell/assets/{linear-DPXABjDZ.js → linear-D4gPORvD.js} +1 -1
- package/web-shell/assets/{mermaid.core-Bi30Gi0n.js → mermaid.core-BUnytF7a.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-B1_lUq4o.js → mindmap-definition-FBJOCRG2-B_X4iChu.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-Cy8tjJJC.js → pegDiagram-XKGWAZYB-z4wYBoBW.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-D6waLVVi.js → pieDiagram-E7YTZNPT-Dvyg6FYo.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC--6ehi_FI.js → quadrantDiagram-AXDQQJYC-CJBWU2Dk.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-BhLy40X4.js → railroadDiagram-O6MQD6OU-Dl_An1O0.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BVNXTgNP.js → requirementDiagram-EFPCY7ZU-Tw8FwaYU.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-BHgTytxV.js → sankeyDiagram-P5KCCOFB-BCPCkbR0.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-CgOsTvhu.js → sequenceDiagram-WJ2MYXX4-DDj7uFTG.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-vCQBQ5FI.js → sizeCapture-X5ZJPWSS-B9eVSpKb.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-DytMYRWJ.js → stateDiagram-HBIQ2CUA-Bf4BZP_V.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BPJi6Gre.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-CTGnifOP.js → swimlanes-XN3QIQJK-dyTWsZFj.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Bw4NRtJQ.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-DEJ1cbn2.js → timeline-definition-24CTP7MA-DVl1A4uL.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-K1e4SjS0.js → vennDiagram-4TSXK5OY-Boosxy9D.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-DEX-GkRp.js → wardleyDiagram-VM6X3IG4-C6wlY8jy.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-B6wYXreH.js → xychartDiagram-S5SC5T6Z-CkzZe3ro.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-CLVrtVFX.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-Df2T70oB.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-Df2T70oB.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-CcjUJGng.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Dt8NvQfX.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{ICON,SHELL_COMMAND_NAME,SHELL_NAME,TOOL_STATUS,isCollapsibleTool}from"./chunk-IEJ2CGRN.js";import{disableMouseEvents,enableMouseEvents,useContextMenu,useKeypress,useKeypressContext}from"./chunk-ZKNRRYWK.js";import{INLINE_CODE_SPAN_PATTERN_SOURCE,formatDuration,formatTokenCount,mergeInlineMathMatches,readInlineMathSpanAt,unescapeMarkdownBeforeMath,unescapeMarkdownDollars}from"./chunk-SO6FCPRI.js";import{MINIMUM_MAX_HEIGHT,MaxSizedBox,theme}from"./chunk-E2NIVXLK.js";import{require_jsx_runtime}from"./chunk-REPFZQ7R.js";import{Box_default,Text,Transform,use_is_screen_reader_enabled_default,use_stdin_default,use_stdout_default,wrapAnsi}from"./chunk-YIJNS5IJ.js";import{require_react}from"./chunk-5QKDV4CD.js";import{resolveColor,themeManager}from"./chunk-W3YCOEIP.js";import{markKittyImageWritten,prepareInlineTerminalImage,renderMermaidImageAsync,renderTerminalImage,wasKittyImageWritten}from"./chunk-TZV5T7CF.js";import{formatInlineImageOverflow}from"./chunk-VRNYIKVL.js";import{cpLen,cpSlice,escapeAnsiCtrlCodes,getCachedStringWidth,sanitizeMultilineForDisplay,sanitizeTerminalText,stringWidth,stripUnsafeCharacters,toCodePoints,truncateToWidth}from"./chunk-64CA3W6G.js";import{require_source}from"./chunk-D2NY7HVY.js";import{localizeToolDisplayName,t}from"./chunk-EZMTX4EU.js";import{IdeClient,allowEditorTypeInSandbox,getEditorExecutable,getExternalEditorCommand,isEditorAvailable,isValidEditorType}from"./chunk-LIIMQ4DI.js";import{buildHumanReadableRuleLabel}from"./chunk-TDHEAGDX.js";import{ShellExecutionService}from"./chunk-CQCSNHPU.js";import{stripAnsi}from"./chunk-YGLM5XPP.js";import{formatMemoryUsage}from"./chunk-NTRFETZB.js";import{sanitizeForOsc,supportsHyperlinks,wrapForMultiplexer}from"./chunk-IKDZVJH2.js";import{MAIN_SOURCE,formatVisionBridgeNoticeDisplay,isVisionBridgeNoticeDisplay,uiTelemetryService}from"./chunk-TNCN2JX2.js";import{formatAdvisorDisplay,isAdvisorDisplay,isTerminalImageDisplay}from"./chunk-O5EKX7LG.js";import{ToolDisplayNames,ToolNames,ToolNamesMigration}from"./chunk-SBZFGYYS.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import{escapePath,unescapePath}from"./chunk-OKN3Z5C5.js";import{require_has_flag,require_supports_color}from"./chunk-MK3OONRA.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__commonJS,__name,__toESM}from"./chunk-KBWJGX7I.js";var require_spinners=__commonJS({"node_modules/cli-spinners/spinners.json"(exports,module){module.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}}});var require_cli_spinners=__commonJS({"node_modules/cli-spinners/index.js"(exports,module){"use strict";init_esbuild_shims();var spinners2=Object.assign({},require_spinners());var spinnersList=Object.keys(spinners2);Object.defineProperty(spinners2,"random",{get(){const randomIndex=Math.floor(Math.random()*spinnersList.length);const spinnerName=spinnersList[randomIndex];return spinners2[spinnerName]}});module.exports=spinners2}});var require_ReactPropTypesSecret=__commonJS({"node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports,module){"use strict";init_esbuild_shims();var ReactPropTypesSecret="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";module.exports=ReactPropTypesSecret}});var require_factoryWithThrowingShims=__commonJS({"node_modules/prop-types/factoryWithThrowingShims.js"(exports,module){"use strict";init_esbuild_shims();var ReactPropTypesSecret=require_ReactPropTypesSecret();function emptyFunction(){}__name(emptyFunction,"emptyFunction");function emptyFunctionWithReset(){}__name(emptyFunctionWithReset,"emptyFunctionWithReset");emptyFunctionWithReset.resetWarningCache=emptyFunction;module.exports=function(){function shim(props,propName,componentName,location,propFullName,secret){if(secret===ReactPropTypesSecret){return}var err=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");err.name="Invariant Violation";throw err}__name(shim,"shim");;shim.isRequired=shim;function getShim(){return shim}__name(getShim,"getShim");;var ReactPropTypes={array:shim,bigint:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,elementType:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};ReactPropTypes.PropTypes=ReactPropTypes;return ReactPropTypes}}});var require_prop_types=__commonJS({"node_modules/prop-types/index.js"(exports,module){init_esbuild_shims();if(false){ReactIs=null;throwOnDirectAccess=true;module.exports=null(ReactIs.isElement,throwOnDirectAccess)}else{module.exports=require_factoryWithThrowingShims()()}var ReactIs;var throwOnDirectAccess}});var require_supports_hyperlinks=__commonJS({"node_modules/supports-hyperlinks/index.js"(exports,module){"use strict";init_esbuild_shims();var supportsColor=require_supports_color();var hasFlag=require_has_flag();function parseVersion(versionString){if(/^\d{3,4}$/.test(versionString)){const m=/(\d{1,2})(\d{2})/.exec(versionString);return{major:0,minor:parseInt(m[1],10),patch:parseInt(m[2],10)}}const versions=(versionString||"").split(".").map(n=>parseInt(n,10));return{major:versions[0],minor:versions[1],patch:versions[2]}}__name(parseVersion,"parseVersion");function supportsHyperlink(stream){const{env}=process;if("FORCE_HYPERLINK"in env){return!(env.FORCE_HYPERLINK.length>0&&parseInt(env.FORCE_HYPERLINK,10)===0)}if(hasFlag("no-hyperlink")||hasFlag("no-hyperlinks")||hasFlag("hyperlink=false")||hasFlag("hyperlink=never")){return false}if(hasFlag("hyperlink=true")||hasFlag("hyperlink=always")){return true}if("NETLIFY"in env){return true}if(!supportsColor.supportsColor(stream)){return false}if(stream&&!stream.isTTY){return false}if(process.platform==="win32"){return false}if("CI"in env){return false}if("TEAMCITY_VERSION"in env){return false}if("TERM_PROGRAM"in env){const version=parseVersion(env.TERM_PROGRAM_VERSION);switch(env.TERM_PROGRAM){case"iTerm.app":if(version.major===3){return version.minor>=1}return version.major>3;case"WezTerm":return version.major>=20200620;case"vscode":return version.major>1||version.major===1&&version.minor>=72}}if("VTE_VERSION"in env){if(env.VTE_VERSION==="0.50.0"){return false}const version=parseVersion(env.VTE_VERSION);return version.major>0||version.minor>=50}return false}__name(supportsHyperlink,"supportsHyperlink");module.exports={supportsHyperlink,stdout:supportsHyperlink(process.stdout),stderr:supportsHyperlink(process.stderr)}}});init_esbuild_shims();var import_react=__toESM(require_react(),1);var ConfigContext=import_react.default.createContext(void 0);var useConfig=__name(()=>{const context=(0,import_react.useContext)(ConfigContext);if(context===void 0){throw new Error("useConfig must be used within a ConfigProvider")}return context},"useConfig");init_esbuild_shims();var import_react2=__toESM(require_react(),1);var SettingsContext=import_react2.default.createContext(void 0);var useSettings=__name(()=>{const context=(0,import_react2.useContext)(SettingsContext);if(context===void 0){throw new Error("useSettings must be used within a SettingsProvider")}return context},"useSettings");init_esbuild_shims();var import_react3=__toESM(require_react(),1);var import_jsx_runtime=__toESM(require_jsx_runtime(),1);function normalizeError(error){if(error instanceof Error){return error}return new Error(String(error))}__name(normalizeError,"normalizeError");var lastRenderError;function consumeLastRenderError(){const err=lastRenderError;lastRenderError=void 0;return err}__name(consumeLastRenderError,"consumeLastRenderError");var ErrorBoundary=class extends import_react3.Component{static{__name(this,"ErrorBoundary")}state={error:null};static getDerivedStateFromError(error){return{error:normalizeError(error)}}componentDidCatch(error,info){const normalized=normalizeError(error);if(this.props.recordForExitEcho){lastRenderError=normalized}this.props.onError?.(normalized,info)}reset=__name(()=>{this.setState({error:null})},"reset");render(){const{error}=this.state;if(error){if(this.props.fallback){return this.props.fallback(error,this.reset)}return(0,import_jsx_runtime.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime.jsx)(Text,{color:theme.status.error,bold:true,children:"Something went wrong while rendering."}),(0,import_jsx_runtime.jsx)(Text,{color:theme.text.secondary,children:sanitizeTerminalText(error.message)})]})}return this.props.children}};init_esbuild_shims();var import_react4=__toESM(require_react(),1);var import_jsx_runtime2=__toESM(require_jsx_runtime(),1);var EMPTY_SKILL_METRICS={totalCalls:0,totalSuccess:0,totalFail:0,byName:{}};function areModelMetricsCoreEqual(a,b){if(a.api.totalRequests!==b.api.totalRequests||a.api.totalErrors!==b.api.totalErrors||a.api.totalLatencyMs!==b.api.totalLatencyMs){return false}if(a.tokens.prompt!==b.tokens.prompt||a.tokens.candidates!==b.tokens.candidates||a.tokens.total!==b.tokens.total||a.tokens.cached!==b.tokens.cached||a.tokens.thoughts!==b.tokens.thoughts){return false}return true}__name(areModelMetricsCoreEqual,"areModelMetricsCoreEqual");function areModelMetricsEqual(a,b){if(!areModelMetricsCoreEqual(a,b))return false;const aKeys=Object.keys(a.bySource);const bKeys=Object.keys(b.bySource);if(aKeys.length!==bKeys.length)return false;for(const key of aKeys){const aSource=a.bySource[key];const bSource=b.bySource[key];if(!bSource||!areModelMetricsCoreEqual(aSource,bSource)){return false}}return true}__name(areModelMetricsEqual,"areModelMetricsEqual");function areToolCallStatsEqual(a,b){if(a.count!==b.count||a.success!==b.success||a.fail!==b.fail||a.durationMs!==b.durationMs){return false}if(a.decisions["accept"]!==b.decisions["accept"]||a.decisions["reject"]!==b.decisions["reject"]||a.decisions["modify"]!==b.decisions["modify"]||a.decisions["auto_accept"]!==b.decisions["auto_accept"]){return false}return true}__name(areToolCallStatsEqual,"areToolCallStatsEqual");function areSkillCallStatsEqual(a,b){return a.count===b.count&&a.success===b.success&&a.fail===b.fail}__name(areSkillCallStatsEqual,"areSkillCallStatsEqual");function areSkillMetricsEqual(a,b){if(a.totalCalls!==b.totalCalls||a.totalSuccess!==b.totalSuccess||a.totalFail!==b.totalFail){return false}const aKeys=Object.keys(a.byName);const bKeys=Object.keys(b.byName);if(aKeys.length!==bKeys.length)return false;for(const key of aKeys){const skillA=a.byName[key];const skillB=b.byName[key];if(!skillB||!areSkillCallStatsEqual(skillA,skillB)){return false}}return true}__name(areSkillMetricsEqual,"areSkillMetricsEqual");function areGenerationMetricsEqual(a,b){if(a===b)return true;if(!a||!b)return false;if(a.timedRequests!==b.timedRequests||a.totalTtftMs!==b.totalTtftMs||a.totalGenerationDurationMs!==b.totalGenerationDurationMs||a.totalThroughputOutputTokens!==b.totalThroughputOutputTokens){return false}if(a.last===b.last)return true;if(!a.last||!b.last)return false;return a.last.model===b.last.model&&a.last.ttftMs===b.last.ttftMs&&a.last.generationDurationMs===b.last.generationDurationMs&&a.last.outputTokens===b.last.outputTokens}__name(areGenerationMetricsEqual,"areGenerationMetricsEqual");function areMetricsEqual(a,b){if(a===b)return true;if(!a||!b)return false;if(!areGenerationMetricsEqual(a.generation,b.generation)){return false}if(a.files.totalLinesAdded!==b.files.totalLinesAdded||a.files.totalLinesRemoved!==b.files.totalLinesRemoved){return false}const toolsA=a.tools;const toolsB=b.tools;if(toolsA.totalCalls!==toolsB.totalCalls||toolsA.totalSuccess!==toolsB.totalSuccess||toolsA.totalFail!==toolsB.totalFail||toolsA.totalDurationMs!==toolsB.totalDurationMs){return false}if(toolsA.totalDecisions["accept"]!==toolsB.totalDecisions["accept"]||toolsA.totalDecisions["reject"]!==toolsB.totalDecisions["reject"]||toolsA.totalDecisions["modify"]!==toolsB.totalDecisions["modify"]||toolsA.totalDecisions["auto_accept"]!==toolsB.totalDecisions["auto_accept"]){return false}const toolsByNameAKeys=Object.keys(toolsA.byName);const toolsByNameBKeys=Object.keys(toolsB.byName);if(toolsByNameAKeys.length!==toolsByNameBKeys.length)return false;for(const key of toolsByNameAKeys){const toolA=toolsA.byName[key];const toolB=toolsB.byName[key];if(!toolB||!areToolCallStatsEqual(toolA,toolB)){return false}}if(!areSkillMetricsEqual(a.skills??EMPTY_SKILL_METRICS,b.skills??EMPTY_SKILL_METRICS)){return false}const billableA=a.billableOutputTokens??{};const billableB=b.billableOutputTokens??{};if(Object.keys(billableA).length!==Object.keys(billableB).length){return false}for(const[model,costA]of Object.entries(billableA)){const costB=billableB[model];if(!costB||costA.total!==costB.total||Object.keys(costA.bySource).length!==Object.keys(costB.bySource).length||Object.entries(costA.bySource).some(([source,count])=>costB.bySource[source]!==count)){return false}}const modelsAKeys=Object.keys(a.models);const modelsBKeys=Object.keys(b.models);if(modelsAKeys.length!==modelsBKeys.length)return false;for(const key of modelsAKeys){if(!b.models[key]||!areModelMetricsEqual(a.models[key],b.models[key])){return false}}return true}__name(areMetricsEqual,"areMetricsEqual");function cloneSessionMetrics(metrics){return{models:Object.fromEntries(Object.entries(metrics.models).map(([name,model])=>[name,{api:{...model.api},tokens:{...model.tokens},bySource:Object.fromEntries(Object.entries(model.bySource).map(([source,sourceMetrics])=>[source,{api:{...sourceMetrics.api},tokens:{...sourceMetrics.tokens}}]))}])),...metrics.billableOutputTokens?{billableOutputTokens:Object.fromEntries(Object.entries(metrics.billableOutputTokens).map(([model,cost])=>[model,{total:cost.total,bySource:{...cost.bySource}}]))}:{},...metrics.generation?{generation:{timedRequests:metrics.generation.timedRequests,totalTtftMs:metrics.generation.totalTtftMs,totalGenerationDurationMs:metrics.generation.totalGenerationDurationMs,totalThroughputOutputTokens:metrics.generation.totalThroughputOutputTokens,...metrics.generation.last?{last:{...metrics.generation.last}}:{}}}:{},tools:{totalCalls:metrics.tools.totalCalls,totalSuccess:metrics.tools.totalSuccess,totalFail:metrics.tools.totalFail,totalDurationMs:metrics.tools.totalDurationMs,totalDecisions:{...metrics.tools.totalDecisions},byName:Object.fromEntries(Object.entries(metrics.tools.byName).map(([name,stats])=>[name,{count:stats.count,success:stats.success,fail:stats.fail,durationMs:stats.durationMs,decisions:{...stats.decisions}}]))},files:{totalLinesAdded:metrics.files.totalLinesAdded,totalLinesRemoved:metrics.files.totalLinesRemoved},...metrics.skills?{skills:{totalCalls:metrics.skills.totalCalls,totalSuccess:metrics.skills.totalSuccess,totalFail:metrics.skills.totalFail,byName:Object.fromEntries(Object.entries(metrics.skills.byName).map(([name,stats])=>[name,{count:stats.count,success:stats.success,fail:stats.fail}]))}}:{}}}__name(cloneSessionMetrics,"cloneSessionMetrics");function getMetricsForDisplay(sessionId){return cloneSessionMetrics(sessionId?uiTelemetryService.getMetricsForSession(sessionId):uiTelemetryService.getMetrics())}__name(getMetricsForDisplay,"getMetricsForDisplay");var SessionStatsContext=(0,import_react4.createContext)(void 0);var createDefaultStats=__name((sessionId="")=>({sessionId,sessionStartTime:new Date,metrics:getMetricsForDisplay(sessionId),lastPromptTokenCount:0,promptCount:0}),"createDefaultStats");var SessionStatsProvider=__name(({sessionId,children})=>{const[stats,setStats]=(0,import_react4.useState)(()=>createDefaultStats(sessionId??""));(0,import_react4.useEffect)(()=>{const handleUpdate=__name(({metrics,lastPromptTokenCount})=>{setStats(prevState=>{const nextMetrics=prevState.sessionId?getMetricsForDisplay(prevState.sessionId):cloneSessionMetrics(metrics);if(prevState.lastPromptTokenCount===lastPromptTokenCount&&areMetricsEqual(prevState.metrics,nextMetrics)){return prevState}return{...prevState,metrics:nextMetrics,lastPromptTokenCount}})},"handleUpdate");uiTelemetryService.on("update",handleUpdate);handleUpdate({metrics:uiTelemetryService.getMetrics(),lastPromptTokenCount:uiTelemetryService.getLastPromptTokenCount()});return()=>{uiTelemetryService.off("update",handleUpdate)}},[]);const startNewSession=(0,import_react4.useCallback)(sessionId2=>{setStats(()=>({...createDefaultStats(sessionId2),lastPromptTokenCount:uiTelemetryService.getLastPromptTokenCount()}))},[]);const startNewPrompt=(0,import_react4.useCallback)(()=>{setStats(prevState=>({...prevState,promptCount:prevState.promptCount+1}))},[]);const getPromptCount=(0,import_react4.useCallback)(()=>stats.promptCount,[stats.promptCount]);const seedPromptCount=(0,import_react4.useCallback)(count=>{setStats(prevState=>({...prevState,promptCount:Math.max(prevState.promptCount,count)}))},[]);const value=(0,import_react4.useMemo)(()=>({stats,startNewSession,startNewPrompt,getPromptCount,seedPromptCount}),[stats,startNewSession,startNewPrompt,getPromptCount,seedPromptCount]);return(0,import_jsx_runtime2.jsx)(SessionStatsContext.Provider,{value,children})},"SessionStatsProvider");var useSessionStats=__name(()=>{const context=(0,import_react4.useContext)(SessionStatsContext);if(context===void 0){throw new Error("useSessionStats must be used within a SessionStatsProvider")}return context},"useSessionStats");init_esbuild_shims();var graphemeSegmenter=new Intl.Segmenter(void 0,{granularity:"grapheme"});var SESSION_PAGE_SIZE=20;function truncateText(text,maxWidth){const widthLimit=Math.max(0,Math.floor(maxWidth));if(widthLimit===0){return""}const firstLine=text.split(/\r?\n/,1)[0];if(getCachedStringWidth(firstLine)<=widthLimit){return firstLine}if(widthLimit<=3){return truncateToDisplayWidth(firstLine,widthLimit)}return`${truncateToDisplayWidth(firstLine,widthLimit-3)}...`}__name(truncateText,"truncateText");function truncateToDisplayWidth(text,maxWidth){let width=0;let result="";for(const{segment}of graphemeSegmenter.segment(text)){const segmentWidth=getCachedStringWidth(segment);if(width+segmentWidth>maxWidth){break}result+=segment;width+=segmentWidth}return result}__name(truncateToDisplayWidth,"truncateToDisplayWidth");function matchesQuery(session,normalizedQuery){if(!normalizedQuery)return true;const haystacks=[session.customTitle,session.prompt,session.goalObjective,session.gitBranch];for(const h of haystacks){if(h&&h.toLowerCase().includes(normalizedQuery))return true}return false}__name(matchesQuery,"matchesQuery");function filterSessions(sessions,filterByBranch,currentBranch,query){const normalizedQuery=query?.toLowerCase().trim()??"";return sessions.filter(session=>{if(filterByBranch&¤tBranch){if(session.gitBranch!==currentBranch)return false}return matchesQuery(session,normalizedQuery)})}__name(filterSessions,"filterSessions");function formatMessageCount(count){return count===1?"1 message":`${count} messages`}__name(formatMessageCount,"formatMessageCount");init_esbuild_shims();var import_react5=__toESM(require_react(),1);function getTerminalSize(){return{columns:process.stdout.columns||80,rows:process.stdout.rows||24}}__name(getTerminalSize,"getTerminalSize");var currentSize=getTerminalSize();var subscribers=new Set;function handleResize(){currentSize=getTerminalSize();for(const notify of subscribers){notify(currentSize)}}__name(handleResize,"handleResize");function subscribe(callback){if(subscribers.size===0){currentSize=getTerminalSize();process.stdout.on("resize",handleResize)}subscribers.add(callback);return()=>{subscribers.delete(callback);if(subscribers.size===0){process.stdout.off("resize",handleResize)}}}__name(subscribe,"subscribe");function useTerminalSize(){const[size,setSize]=(0,import_react5.useState)(getTerminalSize);(0,import_react5.useEffect)(()=>{const unsubscribe=subscribe(setSize);setSize(currentSize);return unsubscribe},[]);return size}__name(useTerminalSize,"useTerminalSize");init_esbuild_shims();var lowlightInstance=null;var lowlightLoad=null;var LOWLIGHT_RETRY_COOLDOWN_MS=3e4;var lowlightLastFailureAt=0;var lowlightError=null;function getLowlightInstance(){return lowlightInstance}__name(getLowlightInstance,"getLowlightInstance");function isLowlightCoolingDown(){return lowlightLastFailureAt>0&&Date.now()-lowlightLastFailureAt<LOWLIGHT_RETRY_COOLDOWN_MS}__name(isLowlightCoolingDown,"isLowlightCoolingDown");function loadLowlight(){if(lowlightInstance)return Promise.resolve(lowlightInstance);if(isLowlightCoolingDown()){return Promise.reject(lowlightError??new Error("lowlight import previously failed"))}if(lowlightLoad)return lowlightLoad;lowlightLoad=import("./lowlight-common-Q5Z5HIJ3.js").then(mod=>{const instance=mod.createLowlight(mod.common);if(typeof instance?.registered!=="function"||typeof instance?.highlight!=="function"||typeof instance?.highlightAuto!=="function"){throw new Error("lowlight instance does not match expected API (registered/highlight/highlightAuto)")}lowlightInstance=instance;lowlightLastFailureAt=0;lowlightError=null;return lowlightInstance}).catch(err=>{lowlightLastFailureAt=Date.now();lowlightError=err instanceof Error?err:new Error(String(err));lowlightLoad=null;throw err});return lowlightLoad}__name(loadLowlight,"loadLowlight");init_esbuild_shims();function osc8Open(url){return wrapForMultiplexer(`\x1B]8;;${sanitizeForOsc(url)}\x07`)}__name(osc8Open,"osc8Open");function osc8Close(){return wrapForMultiplexer(`\x1B]8;;\x07`)}__name(osc8Close,"osc8Close");var SAFE_OSC8_SCHEMES=new Set(["http:","https:","mailto:","ftp:","ftps:","sftp:","ssh:"]);function isSafeOscScheme(url){const match=url.match(/^([a-z][a-z0-9+.-]*:)/i);if(!match)return false;return SAFE_OSC8_SCHEMES.has(match[1].toLowerCase())}__name(isSafeOscScheme,"isSafeOscScheme");var BARE_URL_BREAK_CHARACTERS=String.raw`\u3001-\u3004\u3008-\u3020\u302e-\u3030\u3036-\u3037\u303d-\u303f\uff01-\uff0f\uff1a-\uff20\uff3b-\uff40\uff5b-\uff65\ufe10-\ufe1f\ufe30-\ufe32\ufe35-\ufe6f`;var BARE_URL_BREAK_PATTERN=new RegExp(`[${BARE_URL_BREAK_CHARACTERS}]`);function trimTrailingUrlPunctuation(url,nextCharacter=""){let openParen=0;let openBracket=0;let openBrace=0;let closeParen=0;let closeBracket=0;let closeBrace=0;for(let i=0;i<url.length;i++){const cc=url.charCodeAt(i);if(cc===40)openParen++;else if(cc===91)openBracket++;else if(cc===123)openBrace++;else if(cc===41)closeParen++;else if(cc===93)closeBracket++;else if(cc===125)closeBrace++}let end=url.length;if(url.charCodeAt(end-1)===95&&BARE_URL_BREAK_PATTERN.test(nextCharacter)){end--}while(end>0){const c=url.charCodeAt(end-1);if(c===46||c===44||c===59||c===58||c===33||c===63||c===39||c===34||c===96||c===62){end--;continue}if(c===41&&closeParen>openParen){closeParen--;end--;continue}if(c===93&&closeBracket>openBracket){closeBracket--;end--;continue}if(c===125&&closeBrace>openBrace){closeBrace--;end--;continue}break}return url.slice(0,end)}__name(trimTrailingUrlPunctuation,"trimTrailingUrlPunctuation");var MD_LINK_PATTERN=String.raw`\[.*?\]\((?:[^()]|\([^()]*\))*\)`;var MD_LINK_CAPTURE=/^\[(.*?)\]\(((?:[^()]|\([^()]*\))*)\)$/;var BARE_URL_PATTERN=String.raw`https?:\/\/[^\s${BARE_URL_BREAK_CHARACTERS}]+`;function shouldWrapMarkdownLink(url,canHyperlink){return canHyperlink&&isSafeOscScheme(url)&&!/\s/.test(url)}__name(shouldWrapMarkdownLink,"shouldWrapMarkdownLink");var HOST_LIKE_RE=/\b[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)*\.[a-z]{2,}\b/gi;var IPV4_LIKE_RE=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g;function targetHostname(url){try{const u=new URL(url);if(u.protocol==="mailto:"){const at=u.pathname.lastIndexOf("@");return at>=0?u.pathname.slice(at+1).toLowerCase()||void 0:void 0}return u.hostname.toLowerCase()||void 0}catch{return void 0}}__name(targetHostname,"targetHostname");function labelMayDeceive(label,url){if(label===url)return false;if(/:\/\//.test(label)||/^[a-z][a-z0-9+.-]*:/i.test(label.trim())){return true}const lower=label.toLowerCase();const labelHosts=[...lower.match(HOST_LIKE_RE)??[],...lower.match(IPV4_LIKE_RE)??[]];if(labelHosts.length===0)return false;const target=targetHostname(url);if(!target)return true;return labelHosts.some(h=>h!==target)}__name(labelMayDeceive,"labelMayDeceive");init_esbuild_shims();var import_react6=__toESM(require_react(),1);var import_jsx_runtime3=__toESM(require_jsx_runtime(),1);var defaultWriteRaw=__name(data=>{process.stdout.write(data)},"defaultWriteRaw");var TerminalOutputContext=(0,import_react6.createContext)(defaultWriteRaw);var TerminalOutputProvider=__name(({value,children})=>(0,import_jsx_runtime3.jsx)(TerminalOutputContext.Provider,{value,children}),"TerminalOutputProvider");function useTerminalOutput(){return(0,import_react6.useContext)(TerminalOutputContext)}__name(useTerminalOutput,"useTerminalOutput");init_esbuild_shims();var import_react7=__toESM(require_react(),1);var RenderModeContext=import_react7.default.createContext({renderMode:"render",setRenderMode:__name(()=>void 0,"setRenderMode")});var RenderModeProvider=RenderModeContext.Provider;function useRenderMode(){return import_react7.default.useContext(RenderModeContext)}__name(useRenderMode,"useRenderMode");init_esbuild_shims();function getArenaStatusLabel(status){switch(status){case"idle":return{icon:"\u2713",text:"Idle",color:theme.status.success};case"completed":return{icon:"\u2713",text:"Done",color:theme.status.success};case"cancelled":return{icon:"\u2298",text:"Cancelled",color:theme.status.warning};case"failed":return{icon:"\u2717",text:"Failed",color:theme.status.error};case"running":return{icon:ICON.CIRCLE_EMPTY,text:"Running",color:theme.text.secondary};case"initializing":return{icon:ICON.CIRCLE_EMPTY,text:"Initializing",color:theme.text.secondary};default:return{icon:ICON.CIRCLE_EMPTY,text:status,color:theme.text.secondary}}}__name(getArenaStatusLabel,"getArenaStatusLabel");var TOOL_SUCCESS_RATE_HIGH=95;var TOOL_SUCCESS_RATE_MEDIUM=85;var USER_AGREEMENT_RATE_HIGH=75;var USER_AGREEMENT_RATE_MEDIUM=45;var getStatusColor=__name((value,thresholds,options={})=>{if(value>=thresholds.green){return theme.status.success}if(value>=thresholds.yellow){return theme.status.warning}if(thresholds.red!=null&&value>=thresholds.red){return theme.status.error}return options.defaultColor??theme.status.error},"getStatusColor");function formatDuration2(ms){const totalSeconds=Math.round(ms/1e3);if(totalSeconds<60){return`${totalSeconds}s`}const minutes=Math.floor(totalSeconds/60);const seconds=totalSeconds%60;return seconds>0?`${minutes}m ${seconds}s`:`${minutes}m`}__name(formatDuration2,"formatDuration");init_esbuild_shims();var Command=(Command2=>{Command2["RETURN"]="return";Command2["ESCAPE"]="escape";Command2["HOME"]="home";Command2["END"]="end";Command2["KILL_LINE_RIGHT"]="killLineRight";Command2["KILL_LINE_LEFT"]="killLineLeft";Command2["CLEAR_INPUT"]="clearInput";Command2["DELETE_WORD_BACKWARD"]="deleteWordBackward";Command2["CLEAR_SCREEN"]="clearScreen";Command2["HISTORY_UP"]="historyUp";Command2["HISTORY_DOWN"]="historyDown";Command2["NAVIGATION_UP"]="navigationUp";Command2["NAVIGATION_DOWN"]="navigationDown";Command2["SELECTION_UP"]="selectionUp";Command2["SELECTION_DOWN"]="selectionDown";Command2["ACCEPT_SUGGESTION"]="acceptSuggestion";Command2["COMPLETION_UP"]="completionUp";Command2["COMPLETION_DOWN"]="completionDown";Command2["COMPLETION_TAB_LEFT"]="completionTabLeft";Command2["COMPLETION_TAB_RIGHT"]="completionTabRight";Command2["SUBMIT"]="submit";Command2["QUEUE_MESSAGE"]="queueMessage";Command2["NEWLINE"]="newline";Command2["VOICE_PUSH_TO_TALK"]="voicePushToTalk";Command2["OPEN_EXTERNAL_EDITOR"]="openExternalEditor";Command2["PASTE_CLIPBOARD_IMAGE"]="pasteClipboardImage";Command2["TOGGLE_TOOL_DESCRIPTIONS"]="toggleToolDescriptions";Command2["TOGGLE_IDE_CONTEXT_DETAIL"]="toggleIDEContextDetail";Command2["QUIT"]="quit";Command2["EXIT"]="exit";Command2["SHOW_MORE_LINES"]="showMoreLines";Command2["RETRY_LAST"]="retryLast";Command2["TOGGLE_RENDER_MODE"]="toggleRenderMode";Command2["PROMOTE_SHELL_TO_BACKGROUND"]="promoteShellToBackground";Command2["REVERSE_SEARCH"]="reverseSearch";Command2["SUBMIT_REVERSE_SEARCH"]="submitReverseSearch";Command2["ACCEPT_SUGGESTION_REVERSE_SEARCH"]="acceptSuggestionReverseSearch";Command2["TOGGLE_SHELL_INPUT_FOCUS"]="toggleShellInputFocus";Command2["EXPAND_SUGGESTION"]="expandSuggestion";Command2["COLLAPSE_SUGGESTION"]="collapseSuggestion";Command2["TOGGLE_THINKING_EXPANDED"]="toggleThinkingExpanded";Command2["SCROLL_UP"]="scrollUp";Command2["SCROLL_DOWN"]="scrollDown";Command2["PAGE_UP"]="pageUp";Command2["PAGE_DOWN"]="pageDown";Command2["SCROLL_HOME"]="scrollHome";Command2["SCROLL_END"]="scrollEnd";return Command2})(Command||{});var defaultKeyBindings={["return"]:[{key:"return"}],["escape"]:[{key:"escape"}],["home"]:[{key:"a",ctrl:true}],["end"]:[{key:"e",ctrl:true}],["killLineRight"]:[{key:"k",ctrl:true}],["killLineLeft"]:[{key:"u",ctrl:true}],["clearInput"]:[{key:"c",ctrl:true,shift:false}],["deleteWordBackward"]:[{key:"backspace",ctrl:true},{key:"backspace",command:true},{sequence:""}],["clearScreen"]:[{key:"l",ctrl:true}],["historyUp"]:[{key:"p",ctrl:true}],["historyDown"]:[{key:"n",ctrl:true}],["navigationUp"]:[{key:"up",shift:false}],["navigationDown"]:[{key:"down",shift:false}],["selectionUp"]:[{key:"up",shift:false},{key:"k",ctrl:false},{key:"p",ctrl:true}],["selectionDown"]:[{key:"down",shift:false},{key:"j",ctrl:false},{key:"n",ctrl:true}],["acceptSuggestion"]:[{key:"tab"},{key:"return",ctrl:false,shift:false}],["completionUp"]:[{key:"up",shift:false},{key:"p",ctrl:true}],["completionDown"]:[{key:"down",shift:false},{key:"n",ctrl:true}],["completionTabLeft"]:[{key:"left",shift:false,ctrl:false,meta:false}],["completionTabRight"]:[{key:"right",shift:false,ctrl:false,meta:false}],["submit"]:[{key:"return",ctrl:false,command:false,paste:false,shift:false}],["queueMessage"]:[{key:"q",ctrl:true,command:false,shift:false,paste:false}],["newline"]:[{key:"return",ctrl:true},{key:"return",command:true},{key:"return",paste:true},{key:"return",shift:true},{key:"j",ctrl:true}],["voicePushToTalk"]:[{key:"space",ctrl:false,meta:false}],["openExternalEditor"]:[{key:"x",ctrl:true},{sequence:"",ctrl:true}],["pasteClipboardImage"]:process.platform==="win32"?[{key:"v",command:true},{key:"v",meta:true}]:[{key:"v",ctrl:true},{key:"v",command:true}],["toggleToolDescriptions"]:[{key:"t",ctrl:true}],["toggleIDEContextDetail"]:[{key:"g",ctrl:true}],["quit"]:[{key:"c",ctrl:true,shift:false}],["exit"]:[{key:"d",ctrl:true}],["showMoreLines"]:[{key:"s",ctrl:true}],["retryLast"]:[{key:"y",ctrl:true}],["toggleRenderMode"]:[{key:"m",meta:true}],["promoteShellToBackground"]:[{key:"b",ctrl:true}],["reverseSearch"]:[{key:"r",ctrl:true}],["submitReverseSearch"]:[{key:"return",ctrl:false}],["acceptSuggestionReverseSearch"]:[{key:"tab"}],["toggleShellInputFocus"]:[{key:"f",ctrl:true}],["expandSuggestion"]:[{key:"right"}],["collapseSuggestion"]:[{key:"left"}],["toggleThinkingExpanded"]:[{key:"o",ctrl:true},{key:"t",meta:true}],["scrollUp"]:[{key:"up",shift:true}],["scrollDown"]:[{key:"down",shift:true}],["pageUp"]:[{key:"pageup"}],["pageDown"]:[{key:"pagedown"}],["scrollHome"]:[{key:"home",ctrl:true}],["scrollEnd"]:[{key:"end",ctrl:true}]};init_esbuild_shims();function matchKeyBinding(keyBinding,key){let keyMatches=false;if(keyBinding.key!==void 0){keyMatches=keyBinding.key===key.name}else if(keyBinding.sequence!==void 0){keyMatches=keyBinding.sequence===key.sequence}else{return false}if(!keyMatches){return false}if(keyBinding.ctrl!==void 0&&!!key.ctrl!==keyBinding.ctrl){return false}if(keyBinding.shift!==void 0&&!!key.shift!==keyBinding.shift){return false}if(keyBinding.command!==void 0&&!!key.meta!==keyBinding.command){return false}if(keyBinding.paste!==void 0&&!!key.paste!==keyBinding.paste){return false}if(keyBinding.meta!==void 0&&!!key.meta!==keyBinding.meta){return false}return true}__name(matchKeyBinding,"matchKeyBinding");function matchCommand(command,key,config=defaultKeyBindings){const bindings=config[command];return bindings.some(binding=>matchKeyBinding(binding,key))}__name(matchCommand,"matchCommand");function createKeyMatchers(config=defaultKeyBindings){const matchers={};for(const command of Object.values(Command)){matchers[command]=key=>matchCommand(command,key,config)}return matchers}__name(createKeyMatchers,"createKeyMatchers");var keyMatchers=createKeyMatchers(defaultKeyBindings);init_esbuild_shims();var import_react8=__toESM(require_react(),1);var VirtualViewportContext=(0,import_react8.createContext)(void 0);function useVirtualViewport(fallback){return(0,import_react8.useContext)(VirtualViewportContext)??fallback??false}__name(useVirtualViewport,"useVirtualViewport");init_esbuild_shims();var import_react9=__toESM(require_react(),1);init_esbuild_shims();import{spawnSync}from"node:child_process";import fs from"node:fs";import os from"node:os";import path from"node:path";var debugLogger=createDebugLogger("EXTERNAL_EDITOR");function editTextInExternalEditor(text,options){const directory=fs.mkdtempSync(path.join(os.tmpdir(),"qwen-edit-"));const file=path.join(directory,"buffer.txt");try{const resolved=!options.editor&&options.preferredEditor?getExternalEditorCommand(options.preferredEditor,file):null;if(!options.editor&&options.preferredEditor&&!resolved){debugLogger.warn(`Preferred editor "${options.preferredEditor}" not found, falling back to env/default`)}let command=(options.editor||resolved?.command)??process.env["VISUAL"]??process.env["EDITOR"]??(process.platform==="win32"?"notepad":"vi");let args=resolved?.args??[file];const shell=resolved?resolved.needsShell:process.platform==="win32"&&/\.(cmd|bat)$/i.test(command);if(shell){if(!resolved&&/["|%!]/.test(command)){throw new Error(`Editor command contains unsafe characters: ${command}`)}command=`"${command}"`;args=args.map(arg=>`"${arg}"`)}fs.writeFileSync(file,text,{encoding:"utf8",mode:384});options.beforeLaunch();debugLogger.warn(`Launching external editor (cmd=${command}, shell=${shell})`);const{status,error,signal}=spawnSync(command,args,{stdio:"inherit",shell,timeout:30*60*1e3});if(error)throw error;if(signal)throw new Error(`External editor was killed by signal ${signal}`);if(typeof status==="number"&&status!==0){throw new Error(`External editor exited with status ${status}`)}return fs.readFileSync(file,"utf8").replace(/\r\n?/g,"\n")}finally{try{fs.rmSync(directory,{recursive:true,force:true})}catch{}}}__name(editTextInExternalEditor,"editTextInExternalEditor");init_esbuild_shims();init_esbuild_shims();function assumeExhaustive(_value){}__name(assumeExhaustive,"assumeExhaustive");function checkExhaustive(value,msg=`unexpected value ${value}!`){assumeExhaustive(value);throw new Error(msg)}__name(checkExhaustive,"checkExhaustive");function isAtEndOfBaseWord(lineCodePoints,col){if(!isWordCharStrict(lineCodePoints[col]))return false;let i=col+1;while(i<lineCodePoints.length&&isCombiningMark(lineCodePoints[i])){i++}return i>=lineCodePoints.length||!isWordCharStrict(lineCodePoints[i])}__name(isAtEndOfBaseWord,"isAtEndOfBaseWord");function handleVimAction(state,action){return applyVimAction(state,action,pushUndo)}__name(handleVimAction,"handleVimAction");function applyVimAction(state,action,prepareEdit){const{lines,cursorRow,cursorCol}=state;switch(action.type){case"vim_delete_word_forward":case"vim_change_word_forward":{const{count}=action.payload;let endRow=cursorRow;let endCol=cursorCol;for(let i=0;i<count;i++){const nextWord=findNextWordAcrossLines(lines,endRow,endCol,true);if(nextWord){endRow=nextWord.row;endCol=nextWord.col}else{const currentLine=lines[endRow]||"";const wordEnd=findWordEndInLine(currentLine,endCol);if(wordEnd!==null){endCol=wordEnd+1}else{endCol=cpLen(currentLine)}break}}if(endRow!==cursorRow||endCol!==cursorCol){const nextState=prepareEdit(state);return replaceRangeInternal(nextState,cursorRow,cursorCol,endRow,endCol,"")}return state}case"vim_delete_word_backward":case"vim_change_word_backward":{const{count}=action.payload;let startRow=cursorRow;let startCol=cursorCol;for(let i=0;i<count;i++){const prevWord=findPrevWordAcrossLines(lines,startRow,startCol);if(prevWord){startRow=prevWord.row;startCol=prevWord.col}else{break}}if(startRow!==cursorRow||startCol!==cursorCol){const nextState=prepareEdit(state);return replaceRangeInternal(nextState,startRow,startCol,cursorRow,cursorCol,"")}return state}case"vim_delete_word_end":case"vim_change_word_end":{const{count}=action.payload;let row=cursorRow;let col=cursorCol;let endRow=cursorRow;let endCol=cursorCol;for(let i=0;i<count;i++){const wordEnd=findNextWordAcrossLines(lines,row,col,false);if(wordEnd){endRow=wordEnd.row;endCol=wordEnd.col+1;if(i<count-1){const nextWord=findNextWordAcrossLines(lines,wordEnd.row,wordEnd.col+1,true);if(nextWord){row=nextWord.row;col=nextWord.col}else{break}}}else{break}}if(endRow<lines.length){const lineLen=cpLen(lines[endRow]||"");endCol=Math.min(endCol,lineLen)}if(endRow!==cursorRow||endCol!==cursorCol){const nextState=prepareEdit(state);return replaceRangeInternal(nextState,cursorRow,cursorCol,endRow,endCol,"")}return state}case"vim_delete_line":{const{count}=action.payload;if(lines.length===0)return state;const linesToDelete=Math.min(count,lines.length-cursorRow);const totalLines=lines.length;if(totalLines===1||linesToDelete>=totalLines){const nextState2=prepareEdit(state);return{...nextState2,lines:[""],cursorRow:0,cursorCol:0,preferredCol:null}}const nextState=prepareEdit(state);const newLines=[...nextState.lines];newLines.splice(cursorRow,linesToDelete);const newCursorRow=Math.min(cursorRow,newLines.length-1);const newCursorCol=0;return{...nextState,lines:newLines,cursorRow:newCursorRow,cursorCol:newCursorCol,preferredCol:null}}case"vim_change_line":{const{count}=action.payload;if(lines.length===0)return state;const linesToChange=Math.min(count,lines.length-cursorRow);const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(cursorRow,linesToChange,nextState.lines);const{startRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);return replaceRangeInternal(nextState,startRow,startCol,endRow,endCol,"")}case"vim_delete_to_end_of_line":case"vim_change_to_end_of_line":{const currentLine=lines[cursorRow]||"";if(cursorCol<cpLen(currentLine)){const nextState=prepareEdit(state);return replaceRangeInternal(nextState,cursorRow,cursorCol,cursorRow,cpLen(currentLine),"")}return state}case"vim_change_movement":{const{movement,count}=action.payload;const totalLines=lines.length;switch(movement){case"h":{const startCol=Math.max(0,cursorCol-count);return replaceRangeInternal(prepareEdit(state),cursorRow,startCol,cursorRow,cursorCol,"")}case"j":{const linesToChange=Math.min(count+1,totalLines-cursorRow);if(linesToChange>0){if(totalLines===1){const currentLine=state.lines[0]||"";return replaceRangeInternal(prepareEdit(state),0,0,0,cpLen(currentLine),"")}else{const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(cursorRow,linesToChange,nextState.lines);const{startRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);return replaceRangeInternal(nextState,startRow,startCol,endRow,endCol,"")}}return state}case"k":{const upLines=Math.min(count+1,cursorRow+1);if(upLines>0){if(state.lines.length===1){const currentLine=state.lines[0]||"";return replaceRangeInternal(prepareEdit(state),0,0,0,cpLen(currentLine),"")}else{const startRow=Math.max(0,cursorRow-count);const linesToChange=cursorRow-startRow+1;const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(startRow,linesToChange,nextState.lines);const{startRow:newStartRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);const resultState=replaceRangeInternal(nextState,newStartRow,startCol,endRow,endCol,"");return{...resultState,cursorRow:startRow,cursorCol:0}}}return state}case"l":{return replaceRangeInternal(prepareEdit(state),cursorRow,cursorCol,cursorRow,Math.min(cpLen(lines[cursorRow]||""),cursorCol+count),"")}default:return state}}case"vim_delete_movement":{const{movement,count}=action.payload;const totalLines=lines.length;switch(movement){case"h":{const startCol=Math.max(0,cursorCol-count);return replaceRangeInternal(prepareEdit(state),cursorRow,startCol,cursorRow,cursorCol,"")}case"j":{const linesToDelete=Math.min(count+1,totalLines-cursorRow);if(linesToDelete>0){if(totalLines===1){const currentLine=state.lines[0]||"";return replaceRangeInternal(prepareEdit(state),0,0,0,cpLen(currentLine),"")}else{const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(cursorRow,linesToDelete,nextState.lines);const{startRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);return replaceRangeInternal(nextState,startRow,startCol,endRow,endCol,"")}}return state}case"k":{const upLines=Math.min(count+1,cursorRow+1);if(upLines>0){if(state.lines.length===1){const currentLine=state.lines[0]||"";return replaceRangeInternal(prepareEdit(state),0,0,0,cpLen(currentLine),"")}else{const startRow=Math.max(0,cursorRow-count);const linesToDelete=cursorRow-startRow+1;const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(startRow,linesToDelete,nextState.lines);const{startRow:newStartRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);const resultState=replaceRangeInternal(nextState,newStartRow,startCol,endRow,endCol,"");return{...resultState,cursorRow:startRow,cursorCol:0}}}return state}case"l":{return replaceRangeInternal(prepareEdit(state),cursorRow,cursorCol,cursorRow,Math.min(cpLen(lines[cursorRow]||""),cursorCol+count),"")}default:return state}}case"vim_move_left":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;let newRow=cursorRow2;let newCol=cursorCol2;for(let i=0;i<count;i++){if(newCol>0){newCol--}else if(newRow>0){newRow--;const prevLine=lines2[newRow]||"";const prevLineLength=cpLen(prevLine);newCol=prevLineLength===0?0:prevLineLength-1}}return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"vim_move_right":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;let newRow=cursorRow2;let newCol=cursorCol2;for(let i=0;i<count;i++){const currentLine=lines2[newRow]||"";const lineLength=cpLen(currentLine);if(lineLength===0){if(newRow<lines2.length-1){newRow++;newCol=0}}else if(newCol<lineLength-1){newCol++;const currentLinePoints=toCodePoints(currentLine);while(newCol<currentLinePoints.length&&isCombiningMark(currentLinePoints[newCol])&&newCol<lineLength-1){newCol++}}else if(newRow<lines2.length-1){newRow++;newCol=0}}return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"vim_move_up":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;const newRow=Math.max(0,cursorRow2-count);const targetLine=lines2[newRow]||"";const targetLineLength=cpLen(targetLine);const newCol=Math.min(cursorCol2,targetLineLength>0?targetLineLength-1:0);return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"vim_move_down":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;const newRow=Math.min(lines2.length-1,cursorRow2+count);const targetLine=lines2[newRow]||"";const targetLineLength=cpLen(targetLine);const newCol=Math.min(cursorCol2,targetLineLength>0?targetLineLength-1:0);return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"vim_move_word_forward":{const{count}=action.payload;let row=cursorRow;let col=cursorCol;for(let i=0;i<count;i++){const nextWord=findNextWordAcrossLines(lines,row,col,true);if(nextWord){row=nextWord.row;col=nextWord.col}else{break}}return{...state,cursorRow:row,cursorCol:col,preferredCol:null}}case"vim_move_word_backward":{const{count}=action.payload;let row=cursorRow;let col=cursorCol;for(let i=0;i<count;i++){const prevWord=findPrevWordAcrossLines(lines,row,col);if(prevWord){row=prevWord.row;col=prevWord.col}else{break}}return{...state,cursorRow:row,cursorCol:col,preferredCol:null}}case"vim_move_word_end":{const{count}=action.payload;let row=cursorRow;let col=cursorCol;for(let i=0;i<count;i++){if(i===0){const currentLine=lines[row]||"";const lineCodePoints=toCodePoints(currentLine);const atEndOfWord=col<lineCodePoints.length&&isWordCharStrict(lineCodePoints[col])&&(col+1>=lineCodePoints.length||!isWordCharWithCombining(lineCodePoints[col+1])||isWordCharStrict(lineCodePoints[col])&&isAtEndOfBaseWord(lineCodePoints,col));if(atEndOfWord){const nextWord=findNextWordAcrossLines(lines,row,col+1,false);if(nextWord){row=nextWord.row;col=nextWord.col;continue}}}const wordEnd=findNextWordAcrossLines(lines,row,col,false);if(wordEnd){row=wordEnd.row;col=wordEnd.col}else{break}}return{...state,cursorRow:row,cursorCol:col,preferredCol:null}}case"vim_delete_char":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;const currentLine=lines2[cursorRow2]||"";const lineLength=cpLen(currentLine);if(cursorCol2<lineLength){const deleteCount=Math.min(count,lineLength-cursorCol2);const nextState=prepareEdit(state);return replaceRangeInternal(nextState,cursorRow2,cursorCol2,cursorRow2,cursorCol2+deleteCount,"")}return state}case"vim_insert_at_cursor":{return state}case"vim_append_at_cursor":{const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;const currentLine=lines2[cursorRow2]||"";const newCol=cursorCol2<cpLen(currentLine)?cursorCol2+1:cursorCol2;return{...state,cursorCol:newCol,preferredCol:null}}case"vim_open_line_below":{const{cursorRow:cursorRow2,lines:lines2}=state;const nextState=prepareEdit(state);const endOfLine=cpLen(lines2[cursorRow2]||"");return replaceRangeInternal(nextState,cursorRow2,endOfLine,cursorRow2,endOfLine,"\n")}case"vim_open_line_above":{const{cursorRow:cursorRow2}=state;const nextState=prepareEdit(state);const resultState=replaceRangeInternal(nextState,cursorRow2,0,cursorRow2,0,"\n");return{...resultState,cursorRow:cursorRow2,cursorCol:0}}case"vim_append_at_line_end":{const{cursorRow:cursorRow2,lines:lines2}=state;const lineLength=cpLen(lines2[cursorRow2]||"");return{...state,cursorCol:lineLength,preferredCol:null}}case"vim_insert_at_line_start":{const{cursorRow:cursorRow2,lines:lines2}=state;const currentLine=lines2[cursorRow2]||"";let col=0;const lineCodePoints=toCodePoints(currentLine);while(col<lineCodePoints.length&&/\s/.test(lineCodePoints[col])){col++}return{...state,cursorCol:col,preferredCol:null}}case"vim_move_to_line_start":{return{...state,cursorCol:0,preferredCol:null}}case"vim_move_to_line_end":{const{cursorRow:cursorRow2,lines:lines2}=state;const lineLength=cpLen(lines2[cursorRow2]||"");return{...state,cursorCol:lineLength>0?lineLength-1:0,preferredCol:null}}case"vim_move_to_first_nonwhitespace":{const{cursorRow:cursorRow2,lines:lines2}=state;const currentLine=lines2[cursorRow2]||"";let col=0;const lineCodePoints=toCodePoints(currentLine);while(col<lineCodePoints.length&&/\s/.test(lineCodePoints[col])){col++}return{...state,cursorCol:col,preferredCol:null}}case"vim_move_to_first_line":{return{...state,cursorRow:0,cursorCol:0,preferredCol:null}}case"vim_move_to_last_line":{const{lines:lines2}=state;const lastRow=lines2.length-1;return{...state,cursorRow:lastRow,cursorCol:0,preferredCol:null}}case"vim_move_to_line":{const{lineNumber}=action.payload;const{lines:lines2}=state;const targetRow=Math.min(Math.max(0,lineNumber-1),lines2.length-1);return{...state,cursorRow:targetRow,cursorCol:0,preferredCol:null}}case"vim_escape_insert_mode":{const{cursorCol:cursorCol2}=state;const newCol=cursorCol2>0?cursorCol2-1:0;return{...state,cursorCol:newCol,preferredCol:null}}default:{assumeExhaustive(action);return state}}}__name(applyVimAction,"applyVimAction");var debugLogger2=createDebugLogger("TEXT_BUFFER");var isWordCharStrict=__name(char=>/[\w\p{L}\p{N}]/u.test(char),"isWordCharStrict");var isWhitespace=__name(char=>/\s/.test(char),"isWhitespace");var isCombiningMark=__name(char=>new RegExp("\\p{M}","u").test(char),"isCombiningMark");var isWordCharWithCombining=__name(char=>isWordCharStrict(char)||isCombiningMark(char),"isWordCharWithCombining");var getCharScript=__name(char=>{if(/[\p{Script=Latin}]/u.test(char))return"latin";if(/[\p{Script=Han}]/u.test(char))return"han";if(/[\p{Script=Arabic}]/u.test(char))return"arabic";if(/[\p{Script=Hiragana}]/u.test(char))return"hiragana";if(/[\p{Script=Katakana}]/u.test(char))return"katakana";if(/[\p{Script=Cyrillic}]/u.test(char))return"cyrillic";return"other"},"getCharScript");var isDifferentScript=__name((char1,char2)=>{if(!isWordCharStrict(char1)||!isWordCharStrict(char2))return false;return getCharScript(char1)!==getCharScript(char2)},"isDifferentScript");var CJK_CHAR_REGEX=/[\u4e00-\u9fff\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/;var isCjkChar=__name(char=>CJK_CHAR_REGEX.test(char),"isCjkChar");var WORD_BOUNDARIES_CACHE_MAX=500;var SEGMENTER_LENGTH_LIMIT=1500;var wordBoundariesCache=null;var segmenter=null;function ensureSegmenterLoaded(){if(segmenter!==null)return;try{segmenter=new Intl.Segmenter("zh",{granularity:"word"});debugLogger2.info("Intl.Segmenter: initialized successfully")}catch(err){debugLogger2.warn("Intl.Segmenter: failed to initialize",err);segmenter=false}}__name(ensureSegmenterLoaded,"ensureSegmenterLoaded");function charByCharFallback(line){const codePoints=toCodePoints(line);const fallback=[];for(let i=0;i<codePoints.length;i++){if(isCjkChar(codePoints[i])){fallback.push({start:i,end:i+1})}}return fallback}__name(charByCharFallback,"charByCharFallback");function evictCacheIfNeeded(){if(wordBoundariesCache&&wordBoundariesCache.size>=WORD_BOUNDARIES_CACHE_MAX){const firstKey=wordBoundariesCache.keys().next().value;if(firstKey!==void 0){wordBoundariesCache.delete(firstKey)}}}__name(evictCacheIfNeeded,"evictCacheIfNeeded");function getWordBoundaries(line,codePoints){const cps=codePoints??toCodePoints(line);if(cps.length>SEGMENTER_LENGTH_LIMIT){if(!wordBoundariesCache)wordBoundariesCache=new Map;if(wordBoundariesCache.has(line))return wordBoundariesCache.get(line);const fallback=charByCharFallback(line);evictCacheIfNeeded();wordBoundariesCache.set(line,fallback);return fallback}if(!wordBoundariesCache)wordBoundariesCache=new Map;const cached=wordBoundariesCache.get(line);if(cached){return cached}ensureSegmenterLoaded();if(!segmenter){const fallback=charByCharFallback(line);evictCacheIfNeeded();wordBoundariesCache.set(line,fallback);return fallback}try{const segments=segmenter.segment(line);const cpToStrIdx=[];let strIdx=0;for(let i=0;i<cps.length;i++){cpToStrIdx[i]=strIdx;strIdx+=cps[i].length}const boundaries=[];for(const{index,segment,isWordLike}of segments){const trimmedSegment=segment.trim();if(!isWordLike&&trimmedSegment.length===0){continue}if(isWordLike&&segment.includes(".")){let currentOffset=index;const parts=segment.split(/(\.)/);for(const part of parts){if(part.length===0)continue;const partStartCpIdx=binarySearchCpIndex(cpToStrIdx,currentOffset);const partEndStrPos=currentOffset+part.length;const partEndCpIdxRaw=binarySearchCpIndex(cpToStrIdx,partEndStrPos);const partEndCpIdx=partEndCpIdxRaw===-1?cps.length:partEndCpIdxRaw;if(partStartCpIdx>=0&&partStartCpIdx<partEndCpIdx){boundaries.push({start:partStartCpIdx,end:partEndCpIdx})}currentOffset+=part.length}continue}if(!isWordLike&&/^[.,;!?,。;!?、]+$/.test(trimmedSegment)){const startCpIdx2=binarySearchCpIndex(cpToStrIdx,index);const endStrPos2=index+segment.length;const endCpIdxRaw2=binarySearchCpIndex(cpToStrIdx,endStrPos2);const endCpIdx2=endCpIdxRaw2===-1?cps.length:endCpIdxRaw2;if(startCpIdx2>=0&&startCpIdx2<endCpIdx2){boundaries.push({start:startCpIdx2,end:endCpIdx2})}continue}const startCpIdx=binarySearchCpIndex(cpToStrIdx,index);const endStrPos=index+segment.length;const endCpIdxRaw=binarySearchCpIndex(cpToStrIdx,endStrPos);const endCpIdx=endCpIdxRaw===-1?cps.length:endCpIdxRaw;if(startCpIdx>=0&&startCpIdx<endCpIdx){boundaries.push({start:startCpIdx,end:endCpIdx})}}evictCacheIfNeeded();wordBoundariesCache.set(line,boundaries);return boundaries}catch(err){debugLogger2.warn("getWordBoundaries: error, using char fallback",err);const fallback=charByCharFallback(line);evictCacheIfNeeded();wordBoundariesCache.set(line,fallback);return fallback}}__name(getWordBoundaries,"getWordBoundaries");function binarySearchCpIndex(cpToStrIdx,target){let lo=0;let hi=cpToStrIdx.length-1;while(lo<=hi){const mid=lo+hi>>>1;if(cpToStrIdx[mid]>=target)hi=mid-1;else lo=mid+1}return lo<cpToStrIdx.length?lo:-1}__name(binarySearchCpIndex,"binarySearchCpIndex");function findPrevWordStart(boundaries,col){for(let i=boundaries.length-1;i>=0;i--){const b=boundaries[i];if(col>b.start&&col<=b.end){return b.start}if(col===b.start&&i>0){return boundaries[i-1].start}}return null}__name(findPrevWordStart,"findPrevWordStart");function findNextWordEnd(boundaries,col){for(const b of boundaries){if(col>=b.start&&col<b.end){return b.end}if(col<b.start){return null}}return null}__name(findNextWordEnd,"findNextWordEnd");function findWordEndFallback(arr,startPos){let end=startPos;while(end<arr.length){const currChar=arr[end];const nextChar=end+1<arr.length?arr[end+1]:void 0;if(!isWordCharStrict(currChar??"")||nextChar!==void 0&&isWordCharStrict(currChar??"")&&isWordCharStrict(nextChar)&&isDifferentScript(currChar??"",nextChar)){break}if(nextChar!==void 0&&isCjkChar(currChar??"")&&isCjkChar(nextChar)){end++;break}end++}return end}__name(findWordEndFallback,"findWordEndFallback");var findNextWordStartInLine=__name((line,col)=>{const chars=toCodePoints(line);let i=col;if(i>=chars.length)return null;const currentChar=chars[i];if(isWordCharStrict(currentChar)){while(i<chars.length&&isWordCharWithCombining(chars[i])){if(i+1<chars.length&&isWordCharStrict(chars[i+1])&&isDifferentScript(chars[i],chars[i+1])){i++;break}i++}}else if(!isWhitespace(currentChar)){while(i<chars.length&&!isWordCharStrict(chars[i])&&!isWhitespace(chars[i])){i++}}while(i<chars.length&&isWhitespace(chars[i])){i++}return i<chars.length?i:null},"findNextWordStartInLine");var findPrevWordStartInLine=__name((line,col)=>{const chars=toCodePoints(line);let i=col;if(i<=0)return null;i--;while(i>=0&&isWhitespace(chars[i])){i--}if(i<0)return null;if(isWordCharStrict(chars[i])){while(i>=0&&isWordCharStrict(chars[i])){if(i-1>=0&&isWordCharStrict(chars[i-1])&&isDifferentScript(chars[i],chars[i-1])){return i}i--}return i+1}else{while(i>=0&&!isWordCharStrict(chars[i])&&!isWhitespace(chars[i])){i--}return i+1}},"findPrevWordStartInLine");var findWordEndInLine=__name((line,col)=>{const chars=toCodePoints(line);let i=col;const atEndOfWordChar=i<chars.length&&isWordCharWithCombining(chars[i])&&(i+1>=chars.length||!isWordCharWithCombining(chars[i+1])||isWordCharStrict(chars[i])&&i+1<chars.length&&isWordCharStrict(chars[i+1])&&isDifferentScript(chars[i],chars[i+1]));const atEndOfPunctuation=i<chars.length&&!isWordCharWithCombining(chars[i])&&!isWhitespace(chars[i])&&(i+1>=chars.length||isWhitespace(chars[i+1])||isWordCharWithCombining(chars[i+1]));if(atEndOfWordChar||atEndOfPunctuation){i++;while(i<chars.length&&isWhitespace(chars[i])){i++}}if(i<chars.length&&!isWordCharWithCombining(chars[i])){while(i<chars.length&&isWhitespace(chars[i])){i++}}let foundWord=false;let lastBaseCharPos=-1;if(i<chars.length&&isWordCharWithCombining(chars[i])){while(i<chars.length&&isWordCharWithCombining(chars[i])){foundWord=true;if(isWordCharStrict(chars[i])){lastBaseCharPos=i}if(i+1<chars.length&&isWordCharStrict(chars[i+1])&&isDifferentScript(chars[i],chars[i+1])){i++;if(isWordCharStrict(chars[i-1])){lastBaseCharPos=i-1}break}i++}}else if(i<chars.length&&!isWhitespace(chars[i])){while(i<chars.length&&!isWordCharStrict(chars[i])&&!isWhitespace(chars[i])){foundWord=true;lastBaseCharPos=i;i++}}if(foundWord&&lastBaseCharPos>=col){return lastBaseCharPos}return null},"findWordEndInLine");var findNextWordAcrossLines=__name((lines,cursorRow,cursorCol,searchForWordStart)=>{const currentLine=lines[cursorRow]||"";const colInCurrentLine=searchForWordStart?findNextWordStartInLine(currentLine,cursorCol):findWordEndInLine(currentLine,cursorCol);if(colInCurrentLine!==null){return{row:cursorRow,col:colInCurrentLine}}for(let row=cursorRow+1;row<lines.length;row++){const line=lines[row]||"";const chars=toCodePoints(line);if(chars.length===0){let hasWordsInLaterLines=false;for(let laterRow=row+1;laterRow<lines.length;laterRow++){const laterLine=lines[laterRow]||"";const laterChars=toCodePoints(laterLine);let firstNonWhitespace2=0;while(firstNonWhitespace2<laterChars.length&&isWhitespace(laterChars[firstNonWhitespace2])){firstNonWhitespace2++}if(firstNonWhitespace2<laterChars.length){hasWordsInLaterLines=true;break}}if(!hasWordsInLaterLines){return{row,col:0}}continue}let firstNonWhitespace=0;while(firstNonWhitespace<chars.length&&isWhitespace(chars[firstNonWhitespace])){firstNonWhitespace++}if(firstNonWhitespace<chars.length){if(searchForWordStart){return{row,col:firstNonWhitespace}}else{const endCol=findWordEndInLine(line,firstNonWhitespace);if(endCol!==null){return{row,col:endCol}}}}}return null},"findNextWordAcrossLines");var findPrevWordAcrossLines=__name((lines,cursorRow,cursorCol)=>{const currentLine=lines[cursorRow]||"";const colInCurrentLine=findPrevWordStartInLine(currentLine,cursorCol);if(colInCurrentLine!==null){return{row:cursorRow,col:colInCurrentLine}}for(let row=cursorRow-1;row>=0;row--){const line=lines[row]||"";const chars=toCodePoints(line);if(chars.length===0)continue;let lastWordStart=chars.length;while(lastWordStart>0&&isWhitespace(chars[lastWordStart-1])){lastWordStart--}if(lastWordStart>0){const wordStart=findPrevWordStartInLine(line,lastWordStart);if(wordStart!==null){return{row,col:wordStart}}}}return null},"findPrevWordAcrossLines");var offsetToRowCol=__name((offset,lines)=>{let running=0;for(let i=0;i<lines.length;i++){const lineLength=lines[i].length+1;if(running+lineLength>offset){return{row:i,col:offset-running}}running+=lineLength}const last=Math.max(0,lines.length-1);return{row:last,col:lines[last]?.length??0}},"offsetToRowCol");var getPositionFromOffsets=__name((startOffset,endOffset,lines)=>{const{row:startRow,col:startCol}=offsetToRowCol(startOffset,lines);const{row:endRow,col:endCol}=offsetToRowCol(endOffset,lines);return{startRow,startCol,endRow,endCol}},"getPositionFromOffsets");var getLineRangeOffsets=__name((startRow,lineCount,lines)=>{let startOffset=0;for(let i=0;i<startRow;i++){startOffset+=lines[i].length+1}let endOffset=startOffset;for(let i=0;i<lineCount;i++){const lineIndex=startRow+i;if(lineIndex<lines.length){endOffset+=lines[lineIndex].length;if(lineIndex<lines.length-1){endOffset+=1}}}return{startOffset,endOffset}},"getLineRangeOffsets");var replaceRangeInternal=__name((state,startRow,startCol,endRow,endCol,text)=>{const currentLine=__name(row=>state.lines[row]||"","currentLine");const currentLineLen=__name(row=>cpLen(currentLine(row)),"currentLineLen");const clamp2=__name((value,min,max)=>Math.min(Math.max(value,min),max),"clamp");if(startRow>endRow||startRow===endRow&&startCol>endCol||startRow<0||startCol<0||endRow>=state.lines.length||endRow<state.lines.length&&endCol>currentLineLen(endRow)){return state}const newLines=[...state.lines];const sCol=clamp2(startCol,0,currentLineLen(startRow));const eCol=clamp2(endCol,0,currentLineLen(endRow));const prefix=cpSlice(currentLine(startRow),0,sCol);const suffix=cpSlice(currentLine(endRow),eCol);const normalisedReplacement=text.replace(/\r\n/g,"\n").replace(/\r/g,"\n");const replacementParts=normalisedReplacement.split("\n");const firstLine=prefix+replacementParts[0];if(replacementParts.length===1){newLines.splice(startRow,endRow-startRow+1,firstLine+suffix)}else{const lastLine=replacementParts[replacementParts.length-1]+suffix;const middleLines=replacementParts.slice(1,-1);newLines.splice(startRow,endRow-startRow+1,firstLine,...middleLines,lastLine)}const finalCursorRow=startRow+replacementParts.length-1;const finalCursorCol=(replacementParts.length>1?0:sCol)+cpLen(replacementParts[replacementParts.length-1]);return{...state,lines:newLines,cursorRow:Math.min(Math.max(finalCursorRow,0),newLines.length-1),cursorCol:Math.max(0,Math.min(finalCursorCol,cpLen(newLines[finalCursorRow]||""))),preferredCol:null}},"replaceRangeInternal");function clamp(v,min,max){return v<min?min:v>max?max:v}__name(clamp,"clamp");function calculateInitialCursorPosition(initialLines,offset){let remainingChars=offset;let row=0;while(row<initialLines.length){const lineLength=cpLen(initialLines[row]);const totalCharsInLineAndNewline=lineLength+(row<initialLines.length-1?1:0);if(remainingChars<=lineLength){return[row,remainingChars]}remainingChars-=totalCharsInLineAndNewline;row++}if(initialLines.length>0){const lastRow=initialLines.length-1;return[lastRow,cpLen(initialLines[lastRow])]}return[0,0]}__name(calculateInitialCursorPosition,"calculateInitialCursorPosition");function offsetToLogicalPos(text,offset){let row=0;let col=0;let currentOffset=0;if(offset===0)return[0,0];const lines=text.split("\n");for(let i=0;i<lines.length;i++){const line=lines[i];const lineLength=cpLen(line);const lineLengthWithNewline=lineLength+(i<lines.length-1?1:0);if(offset<=currentOffset+lineLength){row=i;col=offset-currentOffset;return[row,col]}else if(offset<=currentOffset+lineLengthWithNewline){row=i;col=lineLength;if(offset===currentOffset+lineLengthWithNewline&&i<lines.length-1){return[i+1,0]}return[row,col]}currentOffset+=lineLengthWithNewline}if(lines.length>0){row=lines.length-1;col=cpLen(lines[row])}else{row=0;col=0}return[row,col]}__name(offsetToLogicalPos,"offsetToLogicalPos");function logicalPosToOffset(lines,row,col){let offset=0;const actualRow=Math.min(row,lines.length-1);for(let i=0;i<actualRow;i++){offset+=cpLen(lines[i])+1}if(actualRow>=0&&actualRow<lines.length){offset+=Math.min(col,cpLen(lines[actualRow]))}return offset}__name(logicalPosToOffset,"logicalPosToOffset");function calculateLayout(logicalLines,viewportWidth){const visualLines=[];const logicalToVisualMap=[];const visualToLogicalMap=[];logicalLines.forEach((logLine,logIndex)=>{logicalToVisualMap[logIndex]=[];if(logLine.length===0){logicalToVisualMap[logIndex].push([visualLines.length,0]);visualToLogicalMap.push([logIndex,0]);visualLines.push("")}else{let currentPosInLogLine=0;const codePointsInLogLine=toCodePoints(logLine);while(currentPosInLogLine<codePointsInLogLine.length){let currentChunk="";let currentChunkVisualWidth=0;let numCodePointsInChunk=0;let lastWordBreakPoint=-1;let numCodePointsAtLastWordBreak=0;for(let i=currentPosInLogLine;i<codePointsInLogLine.length;i++){const char=codePointsInLogLine[i];const charVisualWidth=getCachedStringWidth(char);if(currentChunkVisualWidth+charVisualWidth>viewportWidth){if(lastWordBreakPoint!==-1&&numCodePointsAtLastWordBreak>0&¤tPosInLogLine+numCodePointsAtLastWordBreak<i){currentChunk=codePointsInLogLine.slice(currentPosInLogLine,currentPosInLogLine+numCodePointsAtLastWordBreak).join("");numCodePointsInChunk=numCodePointsAtLastWordBreak}else{if(numCodePointsInChunk===0&&charVisualWidth>viewportWidth){currentChunk=char;numCodePointsInChunk=1}else if(numCodePointsInChunk===0&&charVisualWidth<=viewportWidth){}}break}currentChunk+=char;currentChunkVisualWidth+=charVisualWidth;numCodePointsInChunk++;if(char===" "){lastWordBreakPoint=i;numCodePointsAtLastWordBreak=numCodePointsInChunk-1}}if(numCodePointsInChunk===0&¤tPosInLogLine<codePointsInLogLine.length){const firstChar=codePointsInLogLine[currentPosInLogLine];currentChunk=firstChar;numCodePointsInChunk=1}if(numCodePointsInChunk===0&¤tPosInLogLine<codePointsInLogLine.length){currentChunk=codePointsInLogLine[currentPosInLogLine];numCodePointsInChunk=1}logicalToVisualMap[logIndex].push([visualLines.length,currentPosInLogLine]);visualToLogicalMap.push([logIndex,currentPosInLogLine]);visualLines.push(currentChunk);const logicalStartOfThisChunk=currentPosInLogLine;currentPosInLogLine+=numCodePointsInChunk;if(logicalStartOfThisChunk+numCodePointsInChunk<codePointsInLogLine.length&¤tPosInLogLine<codePointsInLogLine.length&&codePointsInLogLine[currentPosInLogLine]===" "){currentPosInLogLine++}}}});if(logicalLines.length===0||logicalLines.length===1&&logicalLines[0]===""){if(visualLines.length===0){visualLines.push("");if(!logicalToVisualMap[0])logicalToVisualMap[0]=[];logicalToVisualMap[0].push([0,0]);visualToLogicalMap.push([0,0])}}return{visualLines,logicalToVisualMap,visualToLogicalMap}}__name(calculateLayout,"calculateLayout");function calculateVisualCursorFromLayout(layout,logicalCursor){const{logicalToVisualMap,visualLines}=layout;const[logicalRow,logicalCol]=logicalCursor;const segmentsForLogicalLine=logicalToVisualMap[logicalRow];if(!segmentsForLogicalLine||segmentsForLogicalLine.length===0){return[0,0]}let targetSegmentIndex=segmentsForLogicalLine.findIndex(([,startColInLogical2],index)=>{const nextStartColInLogical=index+1<segmentsForLogicalLine.length?segmentsForLogicalLine[index+1][1]:Infinity;return logicalCol>=startColInLogical2&&logicalCol<nextStartColInLogical});if(targetSegmentIndex===-1){if(logicalCol===0){targetSegmentIndex=0}else{targetSegmentIndex=segmentsForLogicalLine.length-1}}const[visualRow,startColInLogical]=segmentsForLogicalLine[targetSegmentIndex];const visualCol=logicalCol-startColInLogical;const clampedVisualCol=Math.min(visualCol,cpLen(visualLines[visualRow]??""));return[visualRow,clampedVisualCol]}__name(calculateVisualCursorFromLayout,"calculateVisualCursorFromLayout");var historyLimit=100;var pushUndo=__name(currentState=>{const snapshot={lines:[...currentState.lines],cursorRow:currentState.cursorRow,cursorCol:currentState.cursorCol,...currentState.pasteHistory?{pasteHistory:currentState.pasteHistory}:{}};const newStack=[...currentState.undoStack,snapshot];if(newStack.length>historyLimit){newStack.shift()}return{...currentState,undoStack:newStack,redoStack:[]}},"pushUndo");function getWordMovePosition(lines,cursorRow,cursorCol,direction){if(direction==="wordLeft"){if(cursorCol===0&&cursorRow===0)return{row:cursorRow,col:cursorCol};let newCursorRow=cursorRow;let newCursorCol=cursorCol;if(cursorCol===0){newCursorRow--;newCursorCol=cpLen(lines[newCursorRow]??"")}else{const lineContent=lines[cursorRow];const arr=toCodePoints(lineContent);let start=cursorCol;const boundaries=getWordBoundaries(lineContent,arr);const startBoundary=findPrevWordStart(boundaries,start);if(startBoundary!==null){start=startBoundary}else{let onlySpaces=true;for(let i=0;i<start;i++){if(isWordCharStrict(arr[i]??"")){onlySpaces=false;break}}if(onlySpaces){start=0}else{while(start>0&&!isWordCharStrict(arr[start-1]??""))start--;while(start>0){const prevChar=arr[start-1];const currChar=arr[start];if(!isWordCharStrict(prevChar??"")||isWordCharStrict(currChar??"")&&isDifferentScript(currChar??"",prevChar??"")){break}if(isCjkChar(currChar??"")&&isCjkChar(prevChar??"")){break}start--}}}newCursorCol=start}return{row:newCursorRow,col:newCursorCol}}else{if(cursorRow===lines.length-1&&cursorCol===cpLen(lines[cursorRow]??"")){return{row:cursorRow,col:cursorCol}}let newCursorRow=cursorRow;let newCursorCol=cursorCol;const lineContent=lines[cursorRow]??"";const arr=toCodePoints(lineContent);if(cursorCol>=arr.length){newCursorRow++;newCursorCol=0}else{const boundaries=getWordBoundaries(lineContent,arr);const endBoundary=findNextWordEnd(boundaries,cursorCol);let end;if(endBoundary!==null){end=endBoundary;while(end<arr.length&&isWhitespace(arr[end]??"")){end++}}else if(cursorCol<arr.length&&!isWordCharStrict(arr[cursorCol]??"")){end=cursorCol;while(end<arr.length&&!isWordCharStrict(arr[end]??""))end++;if(end<arr.length){const nextEnd=findNextWordEnd(boundaries,end);if(nextEnd!==null){end=nextEnd}else{end=findWordEndFallback(arr,end)}}}else{end=cursorCol;while(end<arr.length&&!isWordCharStrict(arr[end]??""))end++;end=findWordEndFallback(arr,end)}newCursorCol=end}return{row:newCursorRow,col:newCursorCol}}}__name(getWordMovePosition,"getWordMovePosition");function applyWordDeletion(state,direction,prepareEdit){const currentLine=__name(row=>state.lines[row]??"","currentLine");switch(direction){case"delete_word_left":{const{cursorRow,cursorCol}=state;if(cursorCol===0&&cursorRow===0)return state;const nextState=prepareEdit(state);const newLines=[...nextState.lines];let newCursorRow=cursorRow;let newCursorCol=cursorCol;if(newCursorCol>0){const lineContent=currentLine(newCursorRow);const arr=toCodePoints(lineContent);const boundaries=getWordBoundaries(lineContent,arr);const startBoundary=findPrevWordStart(boundaries,newCursorCol);let start;if(startBoundary!==null){start=startBoundary}else{const prevWordStart=findPrevWordStartInLine(lineContent,newCursorCol);start=prevWordStart===null?0:prevWordStart}newLines[newCursorRow]=cpSlice(lineContent,0,start)+cpSlice(lineContent,newCursorCol);newCursorCol=start}else{const prevLineContent=currentLine(cursorRow-1);const currentLineContentVal=currentLine(cursorRow);const newCol=cpLen(prevLineContent);newLines[cursorRow-1]=prevLineContent+currentLineContentVal;newLines.splice(cursorRow,1);newCursorRow--;newCursorCol=newCol}return{...nextState,lines:newLines,cursorRow:newCursorRow,cursorCol:newCursorCol,preferredCol:null}}case"delete_word_right":{const{cursorRow,cursorCol,lines}=state;const lineContent=currentLine(cursorRow);const lineLen=cpLen(lineContent);if(cursorCol>=lineLen&&cursorRow===lines.length-1){return state}const nextState=prepareEdit(state);const newLines=[...nextState.lines];if(cursorCol>=lineLen){const nextLineContent=currentLine(cursorRow+1);newLines[cursorRow]=lineContent+nextLineContent;newLines.splice(cursorRow+1,1)}else{const arr=toCodePoints(lineContent);const boundaries=getWordBoundaries(lineContent,arr);const endBoundary=findNextWordEnd(boundaries,cursorCol);let end;if(endBoundary!==null){end=endBoundary;while(end<arr.length&&isWhitespace(arr[end]??"")){end++}}else{const nextWordStart=findNextWordStartInLine(lineContent,cursorCol);end=nextWordStart===null?lineLen:nextWordStart}newLines[cursorRow]=cpSlice(lineContent,0,cursorCol)+cpSlice(lineContent,end)}return{...nextState,lines:newLines,preferredCol:null}}default:return state}}__name(applyWordDeletion,"applyWordDeletion");function textBufferReducerLogic(state,action){const pushUndoLocal=pushUndo;const currentLine=__name(r=>state.lines[r]??"","currentLine");const currentLineLen=__name(r=>cpLen(currentLine(r)),"currentLineLen");switch(action.type){case"set_text":{let nextState=action.clearUndoHistory?{...state,undoStack:[],redoStack:[]}:state;if(!action.clearUndoHistory&&action.pushToUndo!==false){nextState=pushUndoLocal(state)}const newContentLines=action.payload.replace(/\r\n?/g,"\n").split("\n");const lines=newContentLines.length===0?[""]:newContentLines;const lastNewLineIndex=lines.length-1;return{...nextState,lines,cursorRow:lastNewLineIndex,cursorCol:cpLen(lines[lastNewLineIndex]??""),preferredCol:null}}case"insert":{const nextState=pushUndoLocal(state);const newLines=[...nextState.lines];let newCursorRow=nextState.cursorRow;let newCursorCol=nextState.cursorCol;const currentLine2=__name(r=>newLines[r]??"","currentLine");const str=stripUnsafeCharacters(action.payload.replace(/\r\n/g,"\n").replace(/\r/g,"\n"));const parts=str.split("\n");const lineContent=currentLine2(newCursorRow);const before=cpSlice(lineContent,0,newCursorCol);const after=cpSlice(lineContent,newCursorCol);if(parts.length>1){newLines[newCursorRow]=before+parts[0];const remainingParts=parts.slice(1);const lastPartOriginal=remainingParts.pop()??"";newLines.splice(newCursorRow+1,0,...remainingParts);newLines.splice(newCursorRow+parts.length-1,0,lastPartOriginal+after);newCursorRow=newCursorRow+parts.length-1;newCursorCol=cpLen(lastPartOriginal)}else{newLines[newCursorRow]=before+parts[0]+after;newCursorCol=cpLen(before)+cpLen(parts[0])}return{...nextState,lines:newLines,cursorRow:newCursorRow,cursorCol:newCursorCol,preferredCol:null}}case"backspace":{const nextState=pushUndoLocal(state);const newLines=[...nextState.lines];let newCursorRow=nextState.cursorRow;let newCursorCol=nextState.cursorCol;const currentLine2=__name(r=>newLines[r]??"","currentLine");if(newCursorCol===0&&newCursorRow===0)return state;if(newCursorCol>0){const lineContent=currentLine2(newCursorRow);newLines[newCursorRow]=cpSlice(lineContent,0,newCursorCol-1)+cpSlice(lineContent,newCursorCol);newCursorCol--}else if(newCursorRow>0){const prevLineContent=currentLine2(newCursorRow-1);const currentLineContentVal=currentLine2(newCursorRow);const newCol=cpLen(prevLineContent);newLines[newCursorRow-1]=prevLineContent+currentLineContentVal;newLines.splice(newCursorRow,1);newCursorRow--;newCursorCol=newCol}return{...nextState,lines:newLines,cursorRow:newCursorRow,cursorCol:newCursorCol,preferredCol:null}}case"set_viewport":{const{width,height}=action.payload;if(width===state.viewportWidth&&height===state.viewportHeight){return state}return{...state,viewportWidth:width,viewportHeight:height}}case"move":{const{dir}=action.payload;const{cursorRow,cursorCol,lines,visualLayout,preferredCol}=state;if(dir==="left"||dir==="right"||dir==="up"||dir==="down"||dir==="home"||dir==="end"){const visualCursor=calculateVisualCursorFromLayout(visualLayout,[cursorRow,cursorCol]);const{visualLines,visualToLogicalMap}=visualLayout;let newVisualRow=visualCursor[0];let newVisualCol=visualCursor[1];let newPreferredCol=preferredCol;const currentVisLineLen=cpLen(visualLines[newVisualRow]??"");switch(dir){case"left":newPreferredCol=null;if(newVisualCol>0){newVisualCol--}else if(newVisualRow>0){newVisualRow--;newVisualCol=cpLen(visualLines[newVisualRow]??"");const previousMapping=visualToLogicalMap[newVisualRow];if(previousMapping){const[previousLogRow,previousLogStartCol]=previousMapping;const previousCursorCol=previousLogStartCol+newVisualCol;if(previousLogRow===cursorRow&&previousCursorCol===cursorCol&&newVisualCol>0){newVisualCol--}}}break;case"right":newPreferredCol=null;if(newVisualCol<currentVisLineLen){newVisualCol++}else if(newVisualRow<visualLines.length-1){newVisualRow++;newVisualCol=0}break;case"up":if(newVisualRow>0){if(newPreferredCol===null)newPreferredCol=newVisualCol;newVisualRow--;newVisualCol=clamp(newPreferredCol,0,cpLen(visualLines[newVisualRow]??""))}break;case"down":if(newVisualRow<visualLines.length-1){if(newPreferredCol===null)newPreferredCol=newVisualCol;newVisualRow++;newVisualCol=clamp(newPreferredCol,0,cpLen(visualLines[newVisualRow]??""))}break;case"home":newPreferredCol=null;newVisualCol=0;break;case"end":newPreferredCol=null;newVisualCol=currentVisLineLen;break;default:{const exhaustiveCheck=dir;debugLogger2.error(`Unknown visual movement direction: ${exhaustiveCheck}`);return state}}if(visualToLogicalMap[newVisualRow]){const[logRow,logStartCol]=visualToLogicalMap[newVisualRow];return{...state,cursorRow:logRow,cursorCol:clamp(logStartCol+newVisualCol,0,cpLen(lines[logRow]??"")),preferredCol:newPreferredCol}}return state}switch(dir){case"wordLeft":case"wordRight":{const target=getWordMovePosition(lines,cursorRow,cursorCol,dir);if(target.row===cursorRow&&target.col===cursorCol)return state;return{...state,cursorRow:target.row,cursorCol:target.col,preferredCol:null}}default:return state}}case"set_cursor":{return{...state,...action.payload}}case"delete":{const{cursorRow,cursorCol,lines}=state;const lineContent=currentLine(cursorRow);if(cursorCol<currentLineLen(cursorRow)){const nextState=pushUndoLocal(state);const newLines=[...nextState.lines];newLines[cursorRow]=cpSlice(lineContent,0,cursorCol)+cpSlice(lineContent,cursorCol+1);return{...nextState,lines:newLines,preferredCol:null}}else if(cursorRow<lines.length-1){const nextState=pushUndoLocal(state);const nextLineContent=currentLine(cursorRow+1);const newLines=[...nextState.lines];newLines[cursorRow]=lineContent+nextLineContent;newLines.splice(cursorRow+1,1);return{...nextState,lines:newLines,preferredCol:null}}return state}case"delete_word_left":case"delete_word_right":return applyWordDeletion(state,action.type,pushUndoLocal);case"kill_line_right":{const{cursorRow,cursorCol,lines}=state;const lineContent=currentLine(cursorRow);if(cursorCol<currentLineLen(cursorRow)){const nextState=pushUndoLocal(state);const newLines=[...nextState.lines];newLines[cursorRow]=cpSlice(lineContent,0,cursorCol);return{...nextState,lines:newLines}}else if(cursorRow<lines.length-1){const nextState=pushUndoLocal(state);const nextLineContent=currentLine(cursorRow+1);const newLines=[...nextState.lines];newLines[cursorRow]=lineContent+nextLineContent;newLines.splice(cursorRow+1,1);return{...nextState,lines:newLines,preferredCol:null}}return state}case"kill_line_left":{const{cursorRow,cursorCol}=state;if(cursorCol>0){const nextState=pushUndoLocal(state);const lineContent=currentLine(cursorRow);const newLines=[...nextState.lines];newLines[cursorRow]=cpSlice(lineContent,cursorCol);return{...nextState,lines:newLines,cursorCol:0,preferredCol:null}}else if(cursorRow>0){const nextState=pushUndoLocal(state);const prevLineContent=currentLine(cursorRow-1);const currentLineContent=currentLine(cursorRow);const newCol=cpLen(prevLineContent);const newLines=[...nextState.lines];newLines[cursorRow-1]=prevLineContent+currentLineContent;newLines.splice(cursorRow,1);return{...nextState,lines:newLines,cursorRow:cursorRow-1,cursorCol:newCol,preferredCol:null}}return state}case"undo":{const stateToRestore=state.undoStack[state.undoStack.length-1];if(!stateToRestore)return state;const currentSnapshot={lines:[...state.lines],cursorRow:state.cursorRow,cursorCol:state.cursorCol,...state.pasteHistory?{pasteHistory:state.pasteHistory}:{}};return{...state,...stateToRestore,undoStack:state.undoStack.slice(0,-1),redoStack:[...state.redoStack,currentSnapshot]}}case"redo":{const stateToRestore=state.redoStack[state.redoStack.length-1];if(!stateToRestore)return state;const currentSnapshot={lines:[...state.lines],cursorRow:state.cursorRow,cursorCol:state.cursorCol,...state.pasteHistory?{pasteHistory:state.pasteHistory}:{}};return{...state,...stateToRestore,redoStack:state.redoStack.slice(0,-1),undoStack:[...state.undoStack,currentSnapshot]}}case"replace_range":{const{startRow,startCol,endRow,endCol,text}=action.payload;const nextState=pushUndoLocal(state);return replaceRangeInternal(nextState,startRow,startCol,endRow,endCol,text)}case"move_to_offset":{const{offset}=action.payload;const[newRow,newCol]=offsetToLogicalPos(state.lines.join("\n"),offset);return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"create_undo_snapshot":{return pushUndoLocal(state)}case"vim_delete_word_forward":case"vim_delete_word_backward":case"vim_delete_word_end":case"vim_change_word_forward":case"vim_change_word_backward":case"vim_change_word_end":case"vim_delete_line":case"vim_change_line":case"vim_delete_to_end_of_line":case"vim_change_to_end_of_line":case"vim_change_movement":case"vim_delete_movement":case"vim_move_left":case"vim_move_right":case"vim_move_up":case"vim_move_down":case"vim_move_word_forward":case"vim_move_word_backward":case"vim_move_word_end":case"vim_delete_char":case"vim_insert_at_cursor":case"vim_append_at_cursor":case"vim_open_line_below":case"vim_open_line_above":case"vim_append_at_line_end":case"vim_insert_at_line_start":case"vim_move_to_line_start":case"vim_move_to_line_end":case"vim_move_to_first_nonwhitespace":case"vim_move_to_first_line":case"vim_move_to_last_line":case"vim_move_to_line":case"vim_escape_insert_mode":return handleVimAction(state,action);default:{const exhaustiveCheck=action;debugLogger2.error(`Unknown action encountered: ${exhaustiveCheck}`);return state}}}__name(textBufferReducerLogic,"textBufferReducerLogic");function textBufferReducer(state,action){const newState=textBufferReducerLogic(state,action);if(newState.lines!==state.lines||newState.viewportWidth!==state.viewportWidth){return{...newState,visualLayout:calculateLayout(newState.lines,newState.viewportWidth)}}return newState}__name(textBufferReducer,"textBufferReducer");function looksLikePath(str){const unquoted=str.replace(/^'(.*)'$/,"$1");const inner=unquoted.startsWith("'")?unquoted.slice(1):unquoted;return inner.startsWith("/")||inner.startsWith("./")||inner.startsWith("../")||inner.startsWith("~/")||inner.startsWith(".")||/^[A-Za-z]:/.test(inner)}__name(looksLikePath,"looksLikePath");function tryExtractFilePaths(content,isValidPath){const normalized=content.replace(/\r\n/g,"\n").replace(/\r/g,"\n");const lines=normalized.split(/\n/).filter(s=>s.trim().length>0);const validPaths=[];const hadNonPathToken={value:false};for(const line of lines){if(hadNonPathToken.value)break;const quotedPathRegex=/'((?:[~/.]|[A-Za-z]:)[^']*)'/g;let lastIndex=0;let match;let hasQuotedPaths=false;while((match=quotedPathRegex.exec(line))!==null){const gap=line.slice(lastIndex,match.index).trim();if(gap){const gapPaths=extractPathsFromSegment(gap,isValidPath,hadNonPathToken);validPaths.push(...gapPaths)}const unescaped=unescapePath(match[1]);if(isValidPath(unescaped)){validPaths.push(`@${escapePath(unescaped)}`)}else{hadNonPathToken.value=true}lastIndex=quotedPathRegex.lastIndex;hasQuotedPaths=true}if(hasQuotedPaths){const trailing=line.slice(lastIndex).trim();if(trailing){const trailingPaths=extractPathsFromSegment(trailing,isValidPath,hadNonPathToken);validPaths.push(...trailingPaths)}}else{const linePaths=extractPathsFromSegment(line.trim(),isValidPath,hadNonPathToken);validPaths.push(...linePaths)}}if(validPaths.length>0&&!hadNonPathToken.value){return validPaths}return null}__name(tryExtractFilePaths,"tryExtractFilePaths");function extractPathsFromSegment(segment,isValidPath,hadNonPathToken){const tokens=segment.split(/\s+/).filter(Boolean);const paths=[];let i=0;while(i<tokens.length){if(hadNonPathToken.value)break;if(tokens.length>1&&!looksLikePath(tokens[i])){hadNonPathToken.value=true;i++;continue}let found=false;for(let j=tokens.length;j>=i+1;j--){const candidate=tokens.slice(i,j).join(" ");let unquoted=candidate;const quoteMatch=unquoted.match(/^'(.*)'$/);if(quoteMatch){unquoted=quoteMatch[1]}const unescaped=unescapePath(unquoted);if(isValidPath(unescaped)){paths.push(`@${escapePath(unescaped)}`);i=j;found=true;break}}if(!found){hadNonPathToken.value=true;i++}}return paths}__name(extractPathsFromSegment,"extractPathsFromSegment");function handleTextBufferInput(key,{insert,newline,move,deleteWordLeft,deleteWordRight,backspace,del,undo,redo}){const{sequence:input}=key;if(key.paste){insert(input,{paste:key.paste});return}if(key.name==="return"||input==="\r"||input==="\n"||input==="\\\r")newline();else if(key.name==="left"&&!key.meta&&!key.ctrl)move("left");else if(key.ctrl&&key.name==="b")move("left");else if(key.name==="right"&&!key.meta&&!key.ctrl)move("right");else if(key.ctrl&&key.name==="f")move("right");else if(key.name==="up"&&!key.shift)move("up");else if(key.name==="down"&&!key.shift)move("down");else if((key.ctrl||key.meta)&&key.name==="left")move("wordLeft");else if(key.meta&&key.name==="b")move("wordLeft");else if((key.ctrl||key.meta)&&key.name==="right")move("wordRight");else if(key.meta&&key.name==="d")deleteWordRight();else if(key.meta&&key.name==="f")move("wordRight");else if(key.name==="home")move("home");else if(key.ctrl&&key.name==="a")move("home");else if(key.name==="end")move("end");else if(key.ctrl&&key.name==="e")move("end");else if(key.ctrl&&key.name==="w")deleteWordLeft();else if((key.meta||key.ctrl)&&(key.name==="backspace"||input==="\x7F"))deleteWordLeft();else if((key.meta||key.ctrl)&&key.name==="delete")deleteWordRight();else if(key.name==="backspace"||input==="\x7F"||key.ctrl&&key.name==="h")backspace();else if(key.name==="delete"||key.ctrl&&key.name==="d")del();else if(key.ctrl&&!key.shift&&key.name==="z")undo();else if(key.ctrl&&key.shift&&key.name==="z")redo();else if(input&&!key.ctrl&&!key.meta&&key.name!=="tab"&&input!==" "){insert(input,{paste:key.paste})}}__name(handleTextBufferInput,"handleTextBufferInput");function useTextBuffer({initialText="",initialCursorOffset=0,viewport,stdin,setRawMode,onChange,isValidPath,shellModeActive=false,preferredEditor,pasteHistory}){const initialState=(0,import_react9.useMemo)(()=>{const lines2=initialText.split("\n");const[initialCursorRow,initialCursorCol]=calculateInitialCursorPosition(lines2.length===0?[""]:lines2,initialCursorOffset);const visualLayout2=calculateLayout(lines2.length===0?[""]:lines2,viewport.width);return{lines:lines2.length===0?[""]:lines2,cursorRow:initialCursorRow,cursorCol:initialCursorCol,preferredCol:null,undoStack:[],redoStack:[],clipboard:null,selectionAnchor:null,viewportWidth:viewport.width,viewportHeight:viewport.height,visualLayout:visualLayout2}},[initialText,initialCursorOffset,viewport.width,viewport.height]);const stateRef=(0,import_react9.useRef)(initialState);const[state,setState]=(0,import_react9.useState)(initialState);const pasteHistoryRef=(0,import_react9.useRef)(pasteHistory);pasteHistoryRef.current=pasteHistory;const dispatch=(0,import_react9.useCallback)(action=>{const history=pasteHistoryRef.current;let before=stateRef.current;if(history){before={...before,pasteHistory:new Map(history.capture())}}const restoring=action.type==="undo"&&before.undoStack.length>0||action.type==="redo"&&before.redoStack.length>0;stateRef.current=textBufferReducer(before,action);if(restoring&&history&&stateRef.current.pasteHistory){history.restore(new Map(stateRef.current.pasteHistory))}setState(stateRef.current)},[]);const{lines,cursorRow,cursorCol,preferredCol,selectionAnchor,visualLayout}=state;const text=(0,import_react9.useMemo)(()=>lines.join("\n"),[lines]);const visualCursor=(0,import_react9.useMemo)(()=>calculateVisualCursorFromLayout(visualLayout,[cursorRow,cursorCol]),[visualLayout,cursorRow,cursorCol]);const{visualLines,visualToLogicalMap}=visualLayout;const[visualScrollRow,setVisualScrollRow]=(0,import_react9.useState)(0);(0,import_react9.useEffect)(()=>{if(onChange){onChange(text)}},[text,onChange]);(0,import_react9.useEffect)(()=>{dispatch({type:"set_viewport",payload:{width:viewport.width,height:viewport.height}})},[dispatch,viewport.width,viewport.height]);(0,import_react9.useEffect)(()=>{const{height}=viewport;const totalVisualLines=visualLines.length;const maxScrollStart=Math.max(0,totalVisualLines-height);let newVisualScrollRow=visualScrollRow;if(visualCursor[0]<visualScrollRow){newVisualScrollRow=visualCursor[0]}else if(visualCursor[0]>=visualScrollRow+height){newVisualScrollRow=visualCursor[0]-height+1}newVisualScrollRow=clamp(newVisualScrollRow,0,maxScrollStart);if(newVisualScrollRow!==visualScrollRow){setVisualScrollRow(newVisualScrollRow)}},[visualCursor,visualScrollRow,viewport,visualLines.length]);const insert=(0,import_react9.useCallback)((ch,{paste=false}={})=>{if(paste&&/[\n\r]/.test(ch)&&!shellModeActive){const validPaths=tryExtractFilePaths(ch,isValidPath);if(validPaths){ch=`${validPaths.join(" ")} `}dispatch({type:"insert",payload:ch});return}if(/[\n\r]/.test(ch)){dispatch({type:"insert",payload:ch});return}const minLengthToInferAsDragDrop=3;if(paste&&ch.length>=minLengthToInferAsDragDrop&&!shellModeActive){const validPaths=tryExtractFilePaths(ch.trim(),isValidPath);if(validPaths){ch=`${validPaths.join(" ")} `}}let currentText="";for(const char of toCodePoints(ch)){if(char.codePointAt(0)===127){if(currentText.length>0){dispatch({type:"insert",payload:currentText});currentText=""}dispatch({type:"backspace"})}else{currentText+=char}}if(currentText.length>0){dispatch({type:"insert",payload:currentText})}},[dispatch,isValidPath,shellModeActive]);const newline=(0,import_react9.useCallback)(()=>{dispatch({type:"insert",payload:"\n"})},[dispatch]);const backspace=(0,import_react9.useCallback)(()=>{dispatch({type:"backspace"})},[dispatch]);const del=(0,import_react9.useCallback)(()=>{dispatch({type:"delete"})},[dispatch]);const move=(0,import_react9.useCallback)(dir=>{dispatch({type:"move",payload:{dir}})},[dispatch]);const undo=(0,import_react9.useCallback)(()=>{dispatch({type:"undo"})},[dispatch]);const redo=(0,import_react9.useCallback)(()=>{dispatch({type:"redo"})},[dispatch]);const setText=(0,import_react9.useCallback)((newText,options)=>{dispatch({type:"set_text",payload:newText,clearUndoHistory:options?.clearUndoHistory})},[dispatch]);const deleteWordLeft=(0,import_react9.useCallback)(()=>{dispatch({type:"delete_word_left"})},[dispatch]);const deleteWordRight=(0,import_react9.useCallback)(()=>{dispatch({type:"delete_word_right"})},[dispatch]);const killLineRight=(0,import_react9.useCallback)(()=>{dispatch({type:"kill_line_right"})},[dispatch]);const killLineLeft=(0,import_react9.useCallback)(()=>{dispatch({type:"kill_line_left"})},[dispatch]);const vimDeleteWordForward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_word_forward",payload:{count}})},[dispatch]);const vimDeleteWordBackward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_word_backward",payload:{count}})},[dispatch]);const vimDeleteWordEnd=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_word_end",payload:{count}})},[dispatch]);const vimChangeWordForward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_change_word_forward",payload:{count}})},[dispatch]);const vimChangeWordBackward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_change_word_backward",payload:{count}})},[dispatch]);const vimChangeWordEnd=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_change_word_end",payload:{count}})},[dispatch]);const vimDeleteLine=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_line",payload:{count}})},[dispatch]);const vimChangeLine=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_change_line",payload:{count}})},[dispatch]);const vimDeleteToEndOfLine=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_delete_to_end_of_line"})},[dispatch]);const vimChangeToEndOfLine=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_change_to_end_of_line"})},[dispatch]);const vimChangeMovement=(0,import_react9.useCallback)((movement,count)=>{dispatch({type:"vim_change_movement",payload:{movement,count}})},[dispatch]);const vimDeleteMovement=(0,import_react9.useCallback)((movement,count)=>{dispatch({type:"vim_delete_movement",payload:{movement,count}})},[dispatch]);const vimMoveLeft=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_left",payload:{count}})},[dispatch]);const vimMoveRight=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_right",payload:{count}})},[dispatch]);const vimMoveUp=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_up",payload:{count}})},[dispatch]);const vimMoveDown=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_down",payload:{count}})},[dispatch]);const vimMoveWordForward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_word_forward",payload:{count}})},[dispatch]);const vimMoveWordBackward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_word_backward",payload:{count}})},[dispatch]);const vimMoveWordEnd=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_word_end",payload:{count}})},[dispatch]);const vimDeleteChar=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_char",payload:{count}})},[dispatch]);const vimInsertAtCursor=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_insert_at_cursor"})},[dispatch]);const vimAppendAtCursor=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_append_at_cursor"})},[dispatch]);const vimOpenLineBelow=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_open_line_below"})},[dispatch]);const vimOpenLineAbove=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_open_line_above"})},[dispatch]);const vimAppendAtLineEnd=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_append_at_line_end"})},[dispatch]);const vimInsertAtLineStart=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_insert_at_line_start"})},[dispatch]);const vimMoveToLineStart=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_line_start"})},[dispatch]);const vimMoveToLineEnd=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_line_end"})},[dispatch]);const vimMoveToFirstNonWhitespace=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_first_nonwhitespace"})},[dispatch]);const vimMoveToFirstLine=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_first_line"})},[dispatch]);const vimMoveToLastLine=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_last_line"})},[dispatch]);const vimMoveToLine=(0,import_react9.useCallback)(lineNumber=>{dispatch({type:"vim_move_to_line",payload:{lineNumber}})},[dispatch]);const vimEscapeInsertMode=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_escape_insert_mode"})},[dispatch]);const openInExternalEditor=(0,import_react9.useCallback)(async(opts={})=>{const wasRaw=stdin?.isRaw??false;try{const currentText=stateRef.current.lines.join("\n");const newText=editTextInExternalEditor(currentText,{editor:opts.editor,preferredEditor,beforeLaunch:__name(()=>setRawMode?.(false),"beforeLaunch")});if(newText!==currentText){dispatch({type:"create_undo_snapshot"});dispatch({type:"set_text",payload:newText,pushToUndo:false})}}catch(err){debugLogger2.error("[useTextBuffer] external editor error",err)}finally{try{if(wasRaw)setRawMode?.(true)}catch(rawErr){debugLogger2.error("[useTextBuffer] failed to restore raw mode after external editor",rawErr)}}},[dispatch,stdin,setRawMode,preferredEditor]);const handleInput=(0,import_react9.useCallback)(key=>{handleTextBufferInput(key,{insert,newline,move,deleteWordLeft,deleteWordRight,backspace,del,undo,redo})},[insert,newline,move,deleteWordLeft,deleteWordRight,backspace,del,undo,redo]);const renderedVisualLines=(0,import_react9.useMemo)(()=>visualLines.slice(visualScrollRow,visualScrollRow+viewport.height),[visualLines,visualScrollRow,viewport.height]);const replaceRange=(0,import_react9.useCallback)((startRow,startCol,endRow,endCol,text2)=>{dispatch({type:"replace_range",payload:{startRow,startCol,endRow,endCol,text:text2}})},[dispatch]);const replaceRangeByOffset=(0,import_react9.useCallback)((startOffset,endOffset,replacementText)=>{const currentText=stateRef.current.lines.join("\n");const[startRow,startCol]=offsetToLogicalPos(currentText,startOffset);const[endRow,endCol]=offsetToLogicalPos(currentText,endOffset);replaceRange(startRow,startCol,endRow,endCol,replacementText)},[replaceRange]);const moveToOffset=(0,import_react9.useCallback)(offset=>{dispatch({type:"move_to_offset",payload:{offset}})},[dispatch]);const returnValue=(0,import_react9.useMemo)(()=>({get lines(){return stateRef.current.lines},get text(){return stateRef.current.lines.join("\n")},get cursor(){return[stateRef.current.cursorRow,stateRef.current.cursorCol]},preferredCol,selectionAnchor,allVisualLines:visualLines,viewportVisualLines:renderedVisualLines,visualCursor,visualScrollRow,visualToLogicalMap,setText,insert,newline,backspace,del,move,undo,redo,replaceRange,replaceRangeByOffset,moveToOffset,deleteWordLeft,deleteWordRight,killLineRight,killLineLeft,handleInput,openInExternalEditor,vimDeleteWordForward,vimDeleteWordBackward,vimDeleteWordEnd,vimChangeWordForward,vimChangeWordBackward,vimChangeWordEnd,vimDeleteLine,vimChangeLine,vimDeleteToEndOfLine,vimChangeToEndOfLine,vimChangeMovement,vimDeleteMovement,vimMoveLeft,vimMoveRight,vimMoveUp,vimMoveDown,vimMoveWordForward,vimMoveWordBackward,vimMoveWordEnd,vimDeleteChar,vimInsertAtCursor,vimAppendAtCursor,vimOpenLineBelow,vimOpenLineAbove,vimAppendAtLineEnd,vimInsertAtLineStart,vimMoveToLineStart,vimMoveToLineEnd,vimMoveToFirstNonWhitespace,vimMoveToFirstLine,vimMoveToLastLine,vimMoveToLine,vimEscapeInsertMode}),[preferredCol,selectionAnchor,visualLines,renderedVisualLines,visualCursor,visualScrollRow,setText,insert,newline,backspace,del,move,undo,redo,replaceRange,replaceRangeByOffset,moveToOffset,deleteWordLeft,deleteWordRight,killLineRight,killLineLeft,handleInput,openInExternalEditor,vimDeleteWordForward,vimDeleteWordBackward,vimDeleteWordEnd,vimChangeWordForward,vimChangeWordBackward,vimChangeWordEnd,vimDeleteLine,vimChangeLine,vimDeleteToEndOfLine,vimChangeToEndOfLine,vimChangeMovement,vimDeleteMovement,vimMoveLeft,vimMoveRight,vimMoveUp,vimMoveDown,vimMoveWordForward,vimMoveWordBackward,vimMoveWordEnd,vimDeleteChar,vimInsertAtCursor,vimAppendAtCursor,vimOpenLineBelow,vimOpenLineAbove,vimAppendAtLineEnd,vimInsertAtLineStart,vimMoveToLineStart,vimMoveToLineEnd,vimMoveToFirstNonWhitespace,vimMoveToFirstLine,vimMoveToLastLine,vimMoveToLine,vimEscapeInsertMode,visualToLogicalMap]);return returnValue}__name(useTextBuffer,"useTextBuffer");init_esbuild_shims();var import_react10=__toESM(require_react(),1);var debugLogger3=createDebugLogger("PREFERRED_EDITOR");function usePreferredEditor(){const settings=useSettings();return(0,import_react10.useMemo)(()=>{const raw=settings.merged.general?.preferredEditor??"";if(raw&&!isValidEditorType(raw)){debugLogger3.warn(`[usePreferredEditor] invalid preferredEditor value "${raw}", ignoring`);return void 0}if(isValidEditorType(raw)&&!allowEditorTypeInSandbox(raw)){debugLogger3.warn(`[usePreferredEditor] editor "${raw}" is not allowed in sandbox mode, ignoring`);return void 0}return isValidEditorType(raw)?raw:void 0},[settings.merged.general?.preferredEditor])}__name(usePreferredEditor,"usePreferredEditor");init_esbuild_shims();function keyToAnsi(key){if(key.ctrl){if(key.name>="a"&&key.name<="z"){return String.fromCharCode(key.name.charCodeAt(0)-"a".charCodeAt(0)+1)}switch(key.name){case"c":return"";default:break}}switch(key.name){case"up":return"\x1B[A";case"down":return"\x1B[B";case"right":return"\x1B[C";case"left":return"\x1B[D";case"escape":return"\x1B";case"tab":return" ";case"backspace":return"\x7F";case"delete":return"\x1B[3~";case"home":return"\x1B[H";case"end":return"\x1B[F";case"pageup":return"\x1B[5~";case"pagedown":return"\x1B[6~";default:break}if(key.name==="return"){return"\r"}if(!key.ctrl&&!key.meta&&key.sequence){return key.sequence}return null}__name(keyToAnsi,"keyToAnsi");init_esbuild_shims();var import_react31=__toESM(require_react(),1);init_esbuild_shims();import crypto from"node:crypto";init_esbuild_shims();var import_react11=__toESM(require_react(),1);var import_jsx_runtime4=__toESM(require_jsx_runtime(),1);var debugLogger4=createDebugLogger("CODE_COLORIZER");var STRUCTURAL_BOX_RE=/[│├└┌┐┘┬┴┼]/;var CJK_RE=/[\u4E00-\u9FFF\u3400-\u4DBF]/g;function looksLikeDiagramOrArt(line){const trimmed=line.trim();if(trimmed.length===0)return false;if(STRUCTURAL_BOX_RE.test(trimmed)){return true}const cjkMatches=trimmed.match(CJK_RE)||[];const totalChars=trimmed.replace(/\s/g,"").length;if(totalChars>0&&cjkMatches.length/totalChars>.3){return true}return false}__name(looksLikeDiagramOrArt,"looksLikeDiagramOrArt");function renderHastNode(node,theme2,inheritedColor){if(node.type==="text"){const color=inheritedColor||theme2.defaultColor;return(0,import_jsx_runtime4.jsx)(Text,{color,children:node.value})}if(node.type==="element"){const nodeClasses=node.properties?.["className"]||[];let elementColor=void 0;for(let i=nodeClasses.length-1;i>=0;i--){const color=theme2.getInkColor(nodeClasses[i]);if(color){elementColor=color;break}}const colorToPassDown=elementColor||inheritedColor;const children=node.children?.map((child,index)=>(0,import_jsx_runtime4.jsx)(import_react11.default.Fragment,{children:renderHastNode(child,theme2,colorToPassDown)},index));return(0,import_jsx_runtime4.jsx)(import_react11.default.Fragment,{children})}if(node.type==="root"){if(!node.children||node.children.length===0){return null}return node.children?.map((child,index)=>(0,import_jsx_runtime4.jsx)(import_react11.default.Fragment,{children:renderHastNode(child,theme2,inheritedColor)},index))}return null}__name(renderHastNode,"renderHastNode");function ensureLowlightLoading(){const ll=getLowlightInstance();if(ll)return ll;if(!isLowlightCoolingDown()){void loadLowlight().catch(err=>{debugLogger4.error("[CodeColorizer] failed to load lowlight:",err)})}return null}__name(ensureLowlightLoading,"ensureLowlightLoading");function highlightAndRenderLine(line,language,theme2,lowlight){if(!lowlight){return line}if(!language&&looksLikeDiagramOrArt(line)){return line}try{const getHighlightedLine=__name(()=>!language||!lowlight.registered(language)?lowlight.highlightAuto(line):lowlight.highlight(language,line),"getHighlightedLine");const renderedNode=renderHastNode(getHighlightedLine(),theme2,void 0);return renderedNode!==null?renderedNode:line}catch(_error){return line}}__name(highlightAndRenderLine,"highlightAndRenderLine");function colorizeLine(line,language,theme2){const activeTheme=theme2||themeManager.getActiveTheme();return highlightAndRenderLine(line,language,activeTheme,ensureLowlightLoading())}__name(colorizeLine,"colorizeLine");function colorizeCode(code,language,availableHeight,maxWidth,options={}){const{theme:theme2,settings,tabWidth=4,startLineNumber=1}=options;const firstLineNumber=Math.max(1,Math.trunc(startLineNumber));const codeToHighlight=code.replace(/\n$/,"").replace(/\t/g," ".repeat(tabWidth));const activeTheme=theme2||themeManager.getActiveTheme();const showLineNumbers=settings?.merged.ui?.showLineNumbers??true;const lowlight=ensureLowlightLoading();try{let lines=codeToHighlight.split("\n");const padWidth=String(lines.length+firstLineNumber-1).length;let hiddenLinesCount=0;if(availableHeight!==void 0){availableHeight=Math.max(availableHeight,MINIMUM_MAX_HEIGHT);if(lines.length>availableHeight){const sliceIndex=lines.length-availableHeight;hiddenLinesCount=sliceIndex;lines=lines.slice(sliceIndex)}}return(0,import_jsx_runtime4.jsx)(MaxSizedBox,{maxHeight:availableHeight,maxWidth,additionalHiddenLinesCount:hiddenLinesCount,overflowDirection:"top",children:lines.map((line,index)=>{const contentToRender=highlightAndRenderLine(line,language,activeTheme,lowlight);return(0,import_jsx_runtime4.jsxs)(Box_default,{children:[showLineNumbers&&(0,import_jsx_runtime4.jsx)(Text,{color:activeTheme.colors.Gray,selectable:false,children:`${String(index+firstLineNumber+hiddenLinesCount).padStart(padWidth," ")} `}),(0,import_jsx_runtime4.jsx)(Text,{color:activeTheme.defaultColor,wrap:"wrap",children:contentToRender})]},index)})})}catch(error){debugLogger4.error(`[colorizeCode] Error highlighting code for language "${language}":`,error);const lines=codeToHighlight.split("\n");const padWidth=String(lines.length+firstLineNumber-1).length;return(0,import_jsx_runtime4.jsx)(MaxSizedBox,{maxHeight:availableHeight,maxWidth,overflowDirection:"top",children:lines.map((line,index)=>(0,import_jsx_runtime4.jsxs)(Box_default,{children:[showLineNumbers&&(0,import_jsx_runtime4.jsx)(Text,{color:activeTheme.defaultColor,selectable:false,children:`${String(index+firstLineNumber).padStart(padWidth," ")} `}),(0,import_jsx_runtime4.jsx)(Text,{color:activeTheme.colors.Gray,children:line})]},index))})}}__name(colorizeCode,"colorizeCode");var import_jsx_runtime5=__toESM(require_jsx_runtime(),1);function parseDiffWithLineNumbers(diffContent){const lines=diffContent.split("\n");const result=[];let currentOldLine=0;let currentNewLine=0;let inHunk=false;const hunkHeaderRegex=/^@@ -(\d+),?\d* \+(\d+),?\d* @@/;for(const line of lines){const hunkMatch=line.match(hunkHeaderRegex);if(hunkMatch){currentOldLine=parseInt(hunkMatch[1],10);currentNewLine=parseInt(hunkMatch[2],10);inHunk=true;result.push({type:"hunk",content:line});currentOldLine--;currentNewLine--;continue}if(!inHunk){if(line.startsWith("--- ")){continue}continue}if(line.startsWith("+")){currentNewLine++;result.push({type:"add",newLine:currentNewLine,content:line.substring(1)})}else if(line.startsWith("-")){currentOldLine++;result.push({type:"del",oldLine:currentOldLine,content:line.substring(1)})}else if(line.startsWith(" ")){currentOldLine++;currentNewLine++;result.push({type:"context",oldLine:currentOldLine,newLine:currentNewLine,content:line.substring(1)})}else if(line.startsWith("\\")){result.push({type:"other",content:line})}}return result}__name(parseDiffWithLineNumbers,"parseDiffWithLineNumbers");var DEFAULT_TAB_WIDTH=4;var DiffRenderer=__name(({diffContent,filename,tabWidth=DEFAULT_TAB_WIDTH,availableTerminalHeight,contentWidth,theme:theme2,settings})=>{const screenReaderEnabled=use_is_screen_reader_enabled_default();if(!diffContent||typeof diffContent!=="string"){return(0,import_jsx_runtime5.jsx)(Text,{color:theme.status.warning,children:"No diff content."})}const parsedLines=parseDiffWithLineNumbers(diffContent);if(parsedLines.length===0){return(0,import_jsx_runtime5.jsx)(Box_default,{borderStyle:"round",borderColor:theme.border.default,padding:1,children:(0,import_jsx_runtime5.jsx)(Text,{dimColor:true,children:"No changes detected."})})}if(screenReaderEnabled){return(0,import_jsx_runtime5.jsx)(Box_default,{flexDirection:"column",children:parsedLines.map((line,index)=>(0,import_jsx_runtime5.jsxs)(Text,{children:[line.type,": ",line.content]},index))})}const isNewFile=parsedLines.every(line=>line.type==="add"||line.type==="hunk"||line.type==="other"||line.content.startsWith("diff --git")||line.content.startsWith("new file mode"));let renderedOutput;if(isNewFile){const addedContent=parsedLines.filter(line=>line.type==="add").map(line=>line.content).join("\n");const fileExtension=filename?.split(".").pop()||null;const language=fileExtension?getLanguageFromExtension(fileExtension):null;renderedOutput=colorizeCode(addedContent,language,availableTerminalHeight,contentWidth,{theme:theme2,settings,tabWidth})}else{renderedOutput=renderDiffContent(parsedLines,filename,tabWidth,availableTerminalHeight,contentWidth,settings)}return renderedOutput},"DiffRenderer");var renderDiffContent=__name((parsedLines,filename,tabWidth=DEFAULT_TAB_WIDTH,availableTerminalHeight,contentWidth,settings)=>{const normalizedLines=parsedLines.map(line=>({...line,content:line.content.replace(/\t/g," ".repeat(tabWidth))}));const displayableLines=normalizedLines.filter(l=>l.type!=="hunk"&&l.type!=="other");if(displayableLines.length===0){return(0,import_jsx_runtime5.jsx)(Box_default,{borderStyle:"round",borderColor:theme.border.default,padding:1,children:(0,import_jsx_runtime5.jsx)(Text,{dimColor:true,children:"No changes detected."})})}const showLineNumbers=settings?.merged.ui?.showLineNumbers??true;const maxLineNumber=Math.max(0,...displayableLines.map(l=>l.oldLine??0),...displayableLines.map(l=>l.newLine??0));const gutterWidth=Math.max(1,maxLineNumber.toString().length);const fileExtension=filename?.split(".").pop()||null;const language=fileExtension?getLanguageFromExtension(fileExtension):null;let baseIndentation=Infinity;for(const line of displayableLines){if(line.content.trim()==="")continue;const firstCharIndex=line.content.search(/\S/);const currentIndent=firstCharIndex===-1?0:firstCharIndex;baseIndentation=Math.min(baseIndentation,currentIndent)}if(!isFinite(baseIndentation)){baseIndentation=0}const key=filename?`diff-box-${filename}`:`diff-box-${crypto.createHash("sha1").update(JSON.stringify(parsedLines)).digest("hex")}`;let lastLineNumber=null;const MAX_CONTEXT_LINES_WITHOUT_GAP=5;return(0,import_jsx_runtime5.jsx)(MaxSizedBox,{maxHeight:availableTerminalHeight,maxWidth:contentWidth,children:displayableLines.reduce((acc,line,index)=>{let relevantLineNumberForGapCalc=null;if(line.type==="add"||line.type==="context"){relevantLineNumberForGapCalc=line.newLine??null}else if(line.type==="del"){relevantLineNumberForGapCalc=line.oldLine??null}if(lastLineNumber!==null&&relevantLineNumberForGapCalc!==null&&relevantLineNumberForGapCalc>lastLineNumber+MAX_CONTEXT_LINES_WITHOUT_GAP+1){acc.push((0,import_jsx_runtime5.jsx)(Box_default,{children:(0,import_jsx_runtime5.jsx)(Text,{wrap:"truncate",color:theme.text.secondary,children:"\u2550".repeat(contentWidth)})},`gap-${index}`))}const lineKey=`diff-line-${index}`;let gutterNumStr="";let prefixSymbol=" ";switch(line.type){case"add":gutterNumStr=(line.newLine??"").toString();prefixSymbol="+";lastLineNumber=line.newLine??null;break;case"del":gutterNumStr=(line.oldLine??"").toString();prefixSymbol="-";if(line.oldLine!==void 0){lastLineNumber=line.oldLine}break;case"context":gutterNumStr=(line.newLine??"").toString();prefixSymbol=" ";lastLineNumber=line.newLine??null;break;default:return acc}const displayContent=line.content.substring(baseIndentation);acc.push((0,import_jsx_runtime5.jsxs)(Box_default,{flexDirection:"row",children:[showLineNumbers&&(0,import_jsx_runtime5.jsxs)(Text,{selectable:false,color:theme.text.secondary,backgroundColor:line.type==="add"?theme.background.diff.added:line.type==="del"?theme.background.diff.removed:void 0,children:[gutterNumStr.padStart(gutterWidth)," "]}),line.type==="context"?(0,import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment,{children:[(0,import_jsx_runtime5.jsxs)(Text,{children:[prefixSymbol," "]}),(0,import_jsx_runtime5.jsx)(Text,{wrap:"wrap",children:colorizeLine(displayContent,language)})]}):(0,import_jsx_runtime5.jsxs)(Text,{backgroundColor:line.type==="add"?theme.background.diff.added:theme.background.diff.removed,wrap:"wrap",children:[(0,import_jsx_runtime5.jsx)(Text,{color:line.type==="add"?theme.status.success:theme.status.error,children:prefixSymbol})," ",colorizeLine(displayContent,language)]})]},lineKey));return acc},[])},key)},"renderDiffContent");var getLanguageFromExtension=__name(extension=>{const languageMap={js:"javascript",ts:"typescript",py:"python",json:"json",css:"css",html:"html",sh:"bash",md:"markdown",yaml:"yaml",yml:"yaml",txt:"plaintext",java:"java",c:"c",cpp:"cpp",rb:"ruby"};return languageMap[extension]||null},"getLanguageFromExtension");init_esbuild_shims();var import_react14=__toESM(require_react(),1);init_esbuild_shims();init_esbuild_shims();var TABLE_CHROME_ROWS=5;var TABLE_MAX_ROW_LINES=4;var TABLE_ROW_RE=/^\s*\|(.+)\|\s*$/;var TABLE_SEPARATOR_RE=/^(?=.*\|)\s*\|?\s*(:?-+:?)\s*(\|\s*(:?-+:?)\s*)*\|?\s*$/;var CODE_FENCE_RE=/^ *(`{3,}|~{3,}) *([^`]*)$/;function readTableInlineMathSpan(row,index){return readInlineMathSpanAt(row,index)}__name(readTableInlineMathSpan,"readTableInlineMathSpan");function splitMarkdownTableRow(row){const cells=[];let current="";let activeCodeFenceLength=0;for(let index=0;index<row.length;index++){const char=row[index];if(char==="\\"){const next=row[index+1];if(next==="|"){current+="|";index+=1;continue}current+=char;continue}if(char==="`"){let runLength=1;while(row[index+runLength]==="`"){runLength+=1}if(activeCodeFenceLength===0){activeCodeFenceLength=runLength}else if(runLength===activeCodeFenceLength){activeCodeFenceLength=0}current+="`".repeat(runLength);index+=runLength-1;continue}if(char==="$"&&activeCodeFenceLength===0){const mathSpan=readTableInlineMathSpan(row,index);if(mathSpan){current+=mathSpan;index+=mathSpan.length-1;continue}}if(char==="|"&&activeCodeFenceLength===0){cells.push(current.trim());current="";continue}current+=char}cells.push(current.trim());return cells}__name(splitMarkdownTableRow,"splitMarkdownTableRow");function estimateWrappedRows(line,width){if(width<=0)return 1;return Math.max(1,Math.ceil(getCachedStringWidth(line)/width))}__name(estimateWrappedRows,"estimateWrappedRows");function isTableStart(lines,i){const header=lines[i];if(header===void 0||i+1>=lines.length)return false;const headerMatch=TABLE_ROW_RE.exec(header);if(!headerMatch)return false;const separator=lines[i+1];if(!TABLE_SEPARATOR_RE.test(separator))return false;const headerCols=splitMarkdownTableRow(headerMatch[1]).length;const sepCols=splitMarkdownTableRow(separator).filter(cell=>cell.length>0).length;return headerCols===sepCols}__name(isTableStart,"isTableStart");function fitPendingSlice(allLines,contentWidth,budget,tableClampRows){let rendered=0;let kept=allLines.length;let codeFence="";for(let i=0;i<allLines.length;){const line=allLines[i];const fenceMatch=CODE_FENCE_RE.exec(line);if(codeFence){if(fenceMatch&&fenceMatch[1].startsWith(codeFence[0])&&fenceMatch[1].length>=codeFence.length){codeFence=""}rendered+=estimateWrappedRows(line,contentWidth);if(rendered>budget){kept=i;break}i++;continue}if(fenceMatch){codeFence=fenceMatch[1];rendered+=estimateWrappedRows(line,contentWidth);if(rendered>budget){kept=i;break}i++;continue}if(isTableStart(allLines,i)){let j=i+2;while(j<allLines.length&&TABLE_ROW_RE.test(allLines[j]))j++;const dataRows=j-(i+2);const headerCells=splitMarkdownTableRow(TABLE_ROW_RE.exec(allLines[i])[1]);const colCount=headerCells.length;const minHorizontalWidth=Math.max(24,6*colCount+5);const perColWidth=Math.max(3,Math.floor((contentWidth-(1+3*colCount)-4)/colCount));let contentRows=0;let verticalRows=0;let maxRowLines=1;for(const label of headerCells){maxRowLines=Math.max(maxRowLines,estimateWrappedRows(label,perColWidth))}contentRows+=maxRowLines;for(let r=i+2;r<j;r++){const cells=splitMarkdownTableRow(TABLE_ROW_RE.exec(allLines[r])[1]);let rowMax=1;for(let colIdx=0;colIdx<cells.length;colIdx++){const value=cells[colIdx];rowMax=Math.max(rowMax,estimateWrappedRows(value,perColWidth));const label=headerCells[colIdx]??"";verticalRows+=estimateWrappedRows(label?`${label}: ${value}`:value,contentWidth)}contentRows+=rowMax;if(r===i+2){maxRowLines=Math.max(maxRowLines,rowMax)}}const usesVertical=dataRows>0&&(contentWidth<minHorizontalWidth||maxRowLines>TABLE_MAX_ROW_LINES);const rows=usesVertical?verticalRows+Math.max(0,dataRows-1)+2:contentRows+Math.max(0,dataRows-1)+TABLE_CHROME_ROWS;const cost=Math.min(rows,tableClampRows+2);if(rendered+cost>budget&&i>0){kept=i;break}rendered+=cost;i=j;if(rendered>=budget){kept=j;break}}else{rendered+=estimateWrappedRows(line,contentWidth);if(rendered>budget){kept=i;break}i++}}return{keptLines:kept,clipped:kept<allLines.length}}__name(fitPendingSlice,"fitPendingSlice");init_esbuild_shims();var COMMAND_REPLACEMENTS={"\\alpha":"\u03B1","\\beta":"\u03B2","\\gamma":"\u03B3","\\delta":"\u03B4","\\epsilon":"\u03B5","\\varepsilon":"\u03B5","\\theta":"\u03B8","\\lambda":"\u03BB","\\mu":"\u03BC","\\pi":"\u03C0","\\rho":"\u03C1","\\sigma":"\u03C3","\\tau":"\u03C4","\\phi":"\u03C6","\\varphi":"\u03C6","\\omega":"\u03C9","\\Gamma":"\u0393","\\Delta":"\u0394","\\Theta":"\u0398","\\Lambda":"\u039B","\\Pi":"\u03A0","\\Sigma":"\u03A3","\\Phi":"\u03A6","\\Omega":"\u03A9","\\sum":"\u03A3","\\prod":"\u220F","\\int":"\u222B","\\infty":"\u221E","\\partial":"\u2202","\\sqrt":"\u221A","\\times":"\xD7","\\cdot":"\xB7","\\pm":"\xB1","\\leq":"\u2264","\\geq":"\u2265","\\neq":"\u2260","\\approx":"\u2248","\\rightarrow":"\u2192","\\to":"\u2192","\\leftarrow":"\u2190","\\Rightarrow":"\u21D2","\\Leftarrow":"\u21D0"};var COMMAND_REPLACEMENT_REGEX=new RegExp(Object.keys(COMMAND_REPLACEMENTS).sort((a,b)=>b.length-a.length).map(command=>command.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"g");var MAX_RENDER_DEPTH=10;var SUPERSCRIPT={"0":"\u2070","1":"\xB9","2":"\xB2","3":"\xB3","4":"\u2074","5":"\u2075","6":"\u2076","7":"\u2077","8":"\u2078","9":"\u2079","+":"\u207A","-":"\u207B","=":"\u207C","(":"\u207D",")":"\u207E",n:"\u207F",i:"\u2071"};var SUBSCRIPT={"0":"\u2080","1":"\u2081","2":"\u2082","3":"\u2083","4":"\u2084","5":"\u2085","6":"\u2086","7":"\u2087","8":"\u2088","9":"\u2089","+":"\u208A","-":"\u208B","=":"\u208C","(":"\u208D",")":"\u208E",a:"\u2090",e:"\u2091",h:"\u2095",i:"\u1D62",j:"\u2C7C",k:"\u2096",l:"\u2097",m:"\u2098",n:"\u2099",o:"\u2092",p:"\u209A",r:"\u1D63",s:"\u209B",t:"\u209C",u:"\u1D64",v:"\u1D65",x:"\u2093"};function convertScript(value,map){return[...value].map(char=>map[char]??char).join("")}__name(convertScript,"convertScript");function findBalancedGroup(input,openBraceIndex){if(input[openBraceIndex]!=="{"){return null}let depth=0;for(let index=openBraceIndex;index<input.length;index++){const char=input[index];if(char==="\\"){index+=1;continue}if(char==="{"){depth+=1;continue}if(char!=="}"){continue}depth-=1;if(depth===0){return{value:input.slice(openBraceIndex+1,index),end:index+1}}}return null}__name(findBalancedGroup,"findBalancedGroup");function replaceBraceCommand(input,command,groupCount,render){const marker=`\\${command}`;let output="";let index=0;while(index<input.length){if(!input.startsWith(marker,index)){output+=input[index];index+=1;continue}const groups=[];let cursor=index+marker.length;for(let groupIndex=0;groupIndex<groupCount;groupIndex++){const group=findBalancedGroup(input,cursor);if(!group){groups.length=0;break}groups.push(group.value);cursor=group.end}if(groups.length!==groupCount){output+=input[index];index+=1;continue}output+=render(groups);index=cursor}return output}__name(replaceBraceCommand,"replaceBraceCommand");function renderInlineLatex(input,depth=0){let output=input.trim();if(depth>MAX_RENDER_DEPTH){return output}output=replaceBraceCommand(output,"frac",2,([numerator,denominator])=>`${renderInlineLatex(numerator??"",depth+1)}/${renderInlineLatex(denominator??"",depth+1)}`);output=replaceBraceCommand(output,"sqrt",1,([radicand])=>`\u221A(${renderInlineLatex(radicand??"",depth+1)})`);output=output.replace(/\^\{([^{}]+)\}|\^([A-Za-z0-9+\-=()])/g,(_match,braced,single)=>convertScript(braced??single??"",SUPERSCRIPT));output=output.replace(/_\{([^{}]+)\}|_([A-Za-z0-9+\-=()])/g,(_match,braced,single)=>convertScript(braced??single??"",SUBSCRIPT));output=output.replace(COMMAND_REPLACEMENT_REGEX,command=>COMMAND_REPLACEMENTS[command]??command);return output.replace(/\\(?:left|right)\./g,"").replace(/\\left|\\right/g,"").replace(/\\,/g," ").replace(/\s+/g," ").trim()}__name(renderInlineLatex,"renderInlineLatex");var import_jsx_runtime6=__toESM(require_jsx_runtime(),1);var MIN_COLUMN_WIDTH=3;var ABSOLUTE_MIN_HORIZONTAL_TABLE_WIDTH=24;var SAFETY_MARGIN=4;var INLINE_MARKDOWN_REGEX=new RegExp(String.raw`(\*\*.*?\*\*|\*.*?\*|(?<![\w\u3400-\u9fff])_(?!_)[^_]*_(?![\w\u3400-\u9fff])|~~.*?~~|${MD_LINK_PATTERN}|`+String.raw`${INLINE_CODE_SPAN_PATTERN_SOURCE}|<u>.*?<\/u>|${BARE_URL_PATTERN})`,"g");var INK_COLOR_TO_ANSI={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,gray:90,grey:90,blackbright:90,redbright:91,greenbright:92,yellowbright:93,bluebright:94,magentabright:95,cyanbright:96,whitebright:97};var HEX_COLOR_RE=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;var ESC="\x1B";function getColorCode(color){if(!color)return"";if(color.startsWith("#")){if(!HEX_COLOR_RE.test(color))return"";const hex=color.length===4?color[1]+color[1]+color[2]+color[2]+color[3]+color[3]:color.slice(1);const r=parseInt(hex.slice(0,2),16);const g=parseInt(hex.slice(2,4),16);const b=parseInt(hex.slice(4,6),16);return`\x1B[38;2;${r};${g};${b}m`}const code=INK_COLOR_TO_ANSI[color.toLowerCase()];if(code!==void 0)return`\x1B[${code}m`;return""}__name(getColorCode,"getColorCode");function applyColor(text,color){const code=getColorCode(color);if(!code)return text;return`${code}${text}\x1B[39m`}__name(applyColor,"applyColor");function recolorAfterResets(text,colorCode){const fgReset="\x1B[39m";const fullReset="\x1B[0m";return text.split(fgReset).join(fgReset+colorCode).split(fullReset).join(fullReset+colorCode)}__name(recolorAfterResets,"recolorAfterResets");function updateActiveForeground(activeForeground,paramsText){const params=paramsText.length>0?paramsText.split(";").map(param=>Number(param)):[0];let foreground=activeForeground;for(let index=0;index<params.length;index++){const code=params[index];if(!Number.isFinite(code)){continue}if(code===0||code===39){foreground=""}else if(code>=30&&code<=37||code>=90&&code<=97){foreground=`\x1B[${code}m`}else if(code===38){const mode=params[index+1];if(mode===5&&Number.isFinite(params[index+2])){foreground=`\x1B[38;5;${params[index+2]}m`;index+=2}else if(mode===2&&Number.isFinite(params[index+2])&&Number.isFinite(params[index+3])&&Number.isFinite(params[index+4])){foreground=`\x1B[38;2;${params[index+2]};${params[index+3]};${params[index+4]}m`;index+=4}}}return foreground}__name(updateActiveForeground,"updateActiveForeground");function readSgrSequence(text,index){if(text[index]!==ESC||text[index+1]!=="["){return null}const endIndex=text.indexOf("m",index+2);if(endIndex===-1){return null}const paramsText=text.slice(index+2,endIndex);if(!/^[0-9;]*$/.test(paramsText)){return null}return{sequence:text.slice(index,endIndex+1),paramsText,endIndex}}__name(readSgrSequence,"readSgrSequence");function preserveForegroundAcrossLineBreaks(text){let activeForeground="";let result="";let lastIndex=0;let index=0;while(index<text.length){const sgr=readSgrSequence(text,index);if(!sgr){index+=1;continue}const segment2=text.slice(lastIndex,index);result+=activeForeground?segment2.replace(/\n/g,`\x1B[39m
|
|
3
|
+
import{ICON,SHELL_COMMAND_NAME,SHELL_NAME,TOOL_STATUS,isCollapsibleTool}from"./chunk-J3R7ZNSA.js";import{disableMouseEvents,enableMouseEvents,useContextMenu,useKeypress,useKeypressContext}from"./chunk-ZKNRRYWK.js";import{INLINE_CODE_SPAN_PATTERN_SOURCE,formatDuration,formatTokenCount,mergeInlineMathMatches,readInlineMathSpanAt,unescapeMarkdownBeforeMath,unescapeMarkdownDollars}from"./chunk-GZYIXB7Y.js";import{MINIMUM_MAX_HEIGHT,MaxSizedBox,theme}from"./chunk-E2NIVXLK.js";import{require_jsx_runtime}from"./chunk-REPFZQ7R.js";import{Box_default,Text,Transform,use_is_screen_reader_enabled_default,use_stdin_default,use_stdout_default,wrapAnsi}from"./chunk-YIJNS5IJ.js";import{require_react}from"./chunk-5QKDV4CD.js";import{resolveColor,themeManager}from"./chunk-W3YCOEIP.js";import{markKittyImageWritten,prepareInlineTerminalImage,renderMermaidImageAsync,renderTerminalImage,wasKittyImageWritten}from"./chunk-TZV5T7CF.js";import{formatInlineImageOverflow}from"./chunk-VRNYIKVL.js";import{cpLen,cpSlice,escapeAnsiCtrlCodes,getCachedStringWidth,sanitizeMultilineForDisplay,sanitizeTerminalText,stringWidth,stripUnsafeCharacters,toCodePoints,truncateToWidth}from"./chunk-64CA3W6G.js";import{require_source}from"./chunk-D2NY7HVY.js";import{localizeToolDisplayName,t}from"./chunk-EZMTX4EU.js";import{IdeClient,allowEditorTypeInSandbox,getEditorExecutable,getExternalEditorCommand,isEditorAvailable,isValidEditorType}from"./chunk-LZNBHBAJ.js";import{buildHumanReadableRuleLabel}from"./chunk-TDHEAGDX.js";import{ShellExecutionService}from"./chunk-CQCSNHPU.js";import{stripAnsi}from"./chunk-YGLM5XPP.js";import{formatMemoryUsage}from"./chunk-NTRFETZB.js";import{sanitizeForOsc,supportsHyperlinks,wrapForMultiplexer}from"./chunk-IKDZVJH2.js";import{MAIN_SOURCE,formatVisionBridgeNoticeDisplay,isVisionBridgeNoticeDisplay,uiTelemetryService}from"./chunk-TNCN2JX2.js";import{formatAdvisorDisplay,isAdvisorDisplay,isTerminalImageDisplay}from"./chunk-O5EKX7LG.js";import{ToolDisplayNames,ToolNames,ToolNamesMigration}from"./chunk-SBZFGYYS.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import{escapePath,unescapePath}from"./chunk-OKN3Z5C5.js";import{require_has_flag,require_supports_color}from"./chunk-MK3OONRA.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__commonJS,__name,__toESM}from"./chunk-KBWJGX7I.js";var require_spinners=__commonJS({"node_modules/cli-spinners/spinners.json"(exports,module){module.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}}});var require_cli_spinners=__commonJS({"node_modules/cli-spinners/index.js"(exports,module){"use strict";init_esbuild_shims();var spinners2=Object.assign({},require_spinners());var spinnersList=Object.keys(spinners2);Object.defineProperty(spinners2,"random",{get(){const randomIndex=Math.floor(Math.random()*spinnersList.length);const spinnerName=spinnersList[randomIndex];return spinners2[spinnerName]}});module.exports=spinners2}});var require_ReactPropTypesSecret=__commonJS({"node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports,module){"use strict";init_esbuild_shims();var ReactPropTypesSecret="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";module.exports=ReactPropTypesSecret}});var require_factoryWithThrowingShims=__commonJS({"node_modules/prop-types/factoryWithThrowingShims.js"(exports,module){"use strict";init_esbuild_shims();var ReactPropTypesSecret=require_ReactPropTypesSecret();function emptyFunction(){}__name(emptyFunction,"emptyFunction");function emptyFunctionWithReset(){}__name(emptyFunctionWithReset,"emptyFunctionWithReset");emptyFunctionWithReset.resetWarningCache=emptyFunction;module.exports=function(){function shim(props,propName,componentName,location,propFullName,secret){if(secret===ReactPropTypesSecret){return}var err=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");err.name="Invariant Violation";throw err}__name(shim,"shim");;shim.isRequired=shim;function getShim(){return shim}__name(getShim,"getShim");;var ReactPropTypes={array:shim,bigint:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,elementType:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};ReactPropTypes.PropTypes=ReactPropTypes;return ReactPropTypes}}});var require_prop_types=__commonJS({"node_modules/prop-types/index.js"(exports,module){init_esbuild_shims();if(false){ReactIs=null;throwOnDirectAccess=true;module.exports=null(ReactIs.isElement,throwOnDirectAccess)}else{module.exports=require_factoryWithThrowingShims()()}var ReactIs;var throwOnDirectAccess}});var require_supports_hyperlinks=__commonJS({"node_modules/supports-hyperlinks/index.js"(exports,module){"use strict";init_esbuild_shims();var supportsColor=require_supports_color();var hasFlag=require_has_flag();function parseVersion(versionString){if(/^\d{3,4}$/.test(versionString)){const m=/(\d{1,2})(\d{2})/.exec(versionString);return{major:0,minor:parseInt(m[1],10),patch:parseInt(m[2],10)}}const versions=(versionString||"").split(".").map(n=>parseInt(n,10));return{major:versions[0],minor:versions[1],patch:versions[2]}}__name(parseVersion,"parseVersion");function supportsHyperlink(stream){const{env}=process;if("FORCE_HYPERLINK"in env){return!(env.FORCE_HYPERLINK.length>0&&parseInt(env.FORCE_HYPERLINK,10)===0)}if(hasFlag("no-hyperlink")||hasFlag("no-hyperlinks")||hasFlag("hyperlink=false")||hasFlag("hyperlink=never")){return false}if(hasFlag("hyperlink=true")||hasFlag("hyperlink=always")){return true}if("NETLIFY"in env){return true}if(!supportsColor.supportsColor(stream)){return false}if(stream&&!stream.isTTY){return false}if(process.platform==="win32"){return false}if("CI"in env){return false}if("TEAMCITY_VERSION"in env){return false}if("TERM_PROGRAM"in env){const version=parseVersion(env.TERM_PROGRAM_VERSION);switch(env.TERM_PROGRAM){case"iTerm.app":if(version.major===3){return version.minor>=1}return version.major>3;case"WezTerm":return version.major>=20200620;case"vscode":return version.major>1||version.major===1&&version.minor>=72}}if("VTE_VERSION"in env){if(env.VTE_VERSION==="0.50.0"){return false}const version=parseVersion(env.VTE_VERSION);return version.major>0||version.minor>=50}return false}__name(supportsHyperlink,"supportsHyperlink");module.exports={supportsHyperlink,stdout:supportsHyperlink(process.stdout),stderr:supportsHyperlink(process.stderr)}}});init_esbuild_shims();var import_react=__toESM(require_react(),1);var ConfigContext=import_react.default.createContext(void 0);var useConfig=__name(()=>{const context=(0,import_react.useContext)(ConfigContext);if(context===void 0){throw new Error("useConfig must be used within a ConfigProvider")}return context},"useConfig");init_esbuild_shims();var import_react2=__toESM(require_react(),1);var SettingsContext=import_react2.default.createContext(void 0);var useSettings=__name(()=>{const context=(0,import_react2.useContext)(SettingsContext);if(context===void 0){throw new Error("useSettings must be used within a SettingsProvider")}return context},"useSettings");init_esbuild_shims();var import_react3=__toESM(require_react(),1);var import_jsx_runtime=__toESM(require_jsx_runtime(),1);function normalizeError(error){if(error instanceof Error){return error}return new Error(String(error))}__name(normalizeError,"normalizeError");var lastRenderError;function consumeLastRenderError(){const err=lastRenderError;lastRenderError=void 0;return err}__name(consumeLastRenderError,"consumeLastRenderError");var ErrorBoundary=class extends import_react3.Component{static{__name(this,"ErrorBoundary")}state={error:null};static getDerivedStateFromError(error){return{error:normalizeError(error)}}componentDidCatch(error,info){const normalized=normalizeError(error);if(this.props.recordForExitEcho){lastRenderError=normalized}this.props.onError?.(normalized,info)}reset=__name(()=>{this.setState({error:null})},"reset");render(){const{error}=this.state;if(error){if(this.props.fallback){return this.props.fallback(error,this.reset)}return(0,import_jsx_runtime.jsxs)(Box_default,{flexDirection:"column",children:[(0,import_jsx_runtime.jsx)(Text,{color:theme.status.error,bold:true,children:"Something went wrong while rendering."}),(0,import_jsx_runtime.jsx)(Text,{color:theme.text.secondary,children:sanitizeTerminalText(error.message)})]})}return this.props.children}};init_esbuild_shims();var import_react4=__toESM(require_react(),1);var import_jsx_runtime2=__toESM(require_jsx_runtime(),1);var EMPTY_SKILL_METRICS={totalCalls:0,totalSuccess:0,totalFail:0,byName:{}};function areModelMetricsCoreEqual(a,b){if(a.api.totalRequests!==b.api.totalRequests||a.api.totalErrors!==b.api.totalErrors||a.api.totalLatencyMs!==b.api.totalLatencyMs){return false}if(a.tokens.prompt!==b.tokens.prompt||a.tokens.candidates!==b.tokens.candidates||a.tokens.total!==b.tokens.total||a.tokens.cached!==b.tokens.cached||a.tokens.thoughts!==b.tokens.thoughts){return false}return true}__name(areModelMetricsCoreEqual,"areModelMetricsCoreEqual");function areModelMetricsEqual(a,b){if(!areModelMetricsCoreEqual(a,b))return false;const aKeys=Object.keys(a.bySource);const bKeys=Object.keys(b.bySource);if(aKeys.length!==bKeys.length)return false;for(const key of aKeys){const aSource=a.bySource[key];const bSource=b.bySource[key];if(!bSource||!areModelMetricsCoreEqual(aSource,bSource)){return false}}return true}__name(areModelMetricsEqual,"areModelMetricsEqual");function areToolCallStatsEqual(a,b){if(a.count!==b.count||a.success!==b.success||a.fail!==b.fail||a.durationMs!==b.durationMs){return false}if(a.decisions["accept"]!==b.decisions["accept"]||a.decisions["reject"]!==b.decisions["reject"]||a.decisions["modify"]!==b.decisions["modify"]||a.decisions["auto_accept"]!==b.decisions["auto_accept"]){return false}return true}__name(areToolCallStatsEqual,"areToolCallStatsEqual");function areSkillCallStatsEqual(a,b){return a.count===b.count&&a.success===b.success&&a.fail===b.fail}__name(areSkillCallStatsEqual,"areSkillCallStatsEqual");function areSkillMetricsEqual(a,b){if(a.totalCalls!==b.totalCalls||a.totalSuccess!==b.totalSuccess||a.totalFail!==b.totalFail){return false}const aKeys=Object.keys(a.byName);const bKeys=Object.keys(b.byName);if(aKeys.length!==bKeys.length)return false;for(const key of aKeys){const skillA=a.byName[key];const skillB=b.byName[key];if(!skillB||!areSkillCallStatsEqual(skillA,skillB)){return false}}return true}__name(areSkillMetricsEqual,"areSkillMetricsEqual");function areGenerationMetricsEqual(a,b){if(a===b)return true;if(!a||!b)return false;if(a.timedRequests!==b.timedRequests||a.totalTtftMs!==b.totalTtftMs||a.totalGenerationDurationMs!==b.totalGenerationDurationMs||a.totalThroughputOutputTokens!==b.totalThroughputOutputTokens){return false}if(a.last===b.last)return true;if(!a.last||!b.last)return false;return a.last.model===b.last.model&&a.last.ttftMs===b.last.ttftMs&&a.last.generationDurationMs===b.last.generationDurationMs&&a.last.outputTokens===b.last.outputTokens}__name(areGenerationMetricsEqual,"areGenerationMetricsEqual");function areMetricsEqual(a,b){if(a===b)return true;if(!a||!b)return false;if(!areGenerationMetricsEqual(a.generation,b.generation)){return false}if(a.files.totalLinesAdded!==b.files.totalLinesAdded||a.files.totalLinesRemoved!==b.files.totalLinesRemoved){return false}const toolsA=a.tools;const toolsB=b.tools;if(toolsA.totalCalls!==toolsB.totalCalls||toolsA.totalSuccess!==toolsB.totalSuccess||toolsA.totalFail!==toolsB.totalFail||toolsA.totalDurationMs!==toolsB.totalDurationMs){return false}if(toolsA.totalDecisions["accept"]!==toolsB.totalDecisions["accept"]||toolsA.totalDecisions["reject"]!==toolsB.totalDecisions["reject"]||toolsA.totalDecisions["modify"]!==toolsB.totalDecisions["modify"]||toolsA.totalDecisions["auto_accept"]!==toolsB.totalDecisions["auto_accept"]){return false}const toolsByNameAKeys=Object.keys(toolsA.byName);const toolsByNameBKeys=Object.keys(toolsB.byName);if(toolsByNameAKeys.length!==toolsByNameBKeys.length)return false;for(const key of toolsByNameAKeys){const toolA=toolsA.byName[key];const toolB=toolsB.byName[key];if(!toolB||!areToolCallStatsEqual(toolA,toolB)){return false}}if(!areSkillMetricsEqual(a.skills??EMPTY_SKILL_METRICS,b.skills??EMPTY_SKILL_METRICS)){return false}const billableA=a.billableOutputTokens??{};const billableB=b.billableOutputTokens??{};if(Object.keys(billableA).length!==Object.keys(billableB).length){return false}for(const[model,costA]of Object.entries(billableA)){const costB=billableB[model];if(!costB||costA.total!==costB.total||Object.keys(costA.bySource).length!==Object.keys(costB.bySource).length||Object.entries(costA.bySource).some(([source,count])=>costB.bySource[source]!==count)){return false}}const modelsAKeys=Object.keys(a.models);const modelsBKeys=Object.keys(b.models);if(modelsAKeys.length!==modelsBKeys.length)return false;for(const key of modelsAKeys){if(!b.models[key]||!areModelMetricsEqual(a.models[key],b.models[key])){return false}}return true}__name(areMetricsEqual,"areMetricsEqual");function cloneSessionMetrics(metrics){return{models:Object.fromEntries(Object.entries(metrics.models).map(([name,model])=>[name,{api:{...model.api},tokens:{...model.tokens},bySource:Object.fromEntries(Object.entries(model.bySource).map(([source,sourceMetrics])=>[source,{api:{...sourceMetrics.api},tokens:{...sourceMetrics.tokens}}]))}])),...metrics.billableOutputTokens?{billableOutputTokens:Object.fromEntries(Object.entries(metrics.billableOutputTokens).map(([model,cost])=>[model,{total:cost.total,bySource:{...cost.bySource}}]))}:{},...metrics.generation?{generation:{timedRequests:metrics.generation.timedRequests,totalTtftMs:metrics.generation.totalTtftMs,totalGenerationDurationMs:metrics.generation.totalGenerationDurationMs,totalThroughputOutputTokens:metrics.generation.totalThroughputOutputTokens,...metrics.generation.last?{last:{...metrics.generation.last}}:{}}}:{},tools:{totalCalls:metrics.tools.totalCalls,totalSuccess:metrics.tools.totalSuccess,totalFail:metrics.tools.totalFail,totalDurationMs:metrics.tools.totalDurationMs,totalDecisions:{...metrics.tools.totalDecisions},byName:Object.fromEntries(Object.entries(metrics.tools.byName).map(([name,stats])=>[name,{count:stats.count,success:stats.success,fail:stats.fail,durationMs:stats.durationMs,decisions:{...stats.decisions}}]))},files:{totalLinesAdded:metrics.files.totalLinesAdded,totalLinesRemoved:metrics.files.totalLinesRemoved},...metrics.skills?{skills:{totalCalls:metrics.skills.totalCalls,totalSuccess:metrics.skills.totalSuccess,totalFail:metrics.skills.totalFail,byName:Object.fromEntries(Object.entries(metrics.skills.byName).map(([name,stats])=>[name,{count:stats.count,success:stats.success,fail:stats.fail}]))}}:{}}}__name(cloneSessionMetrics,"cloneSessionMetrics");function getMetricsForDisplay(sessionId){return cloneSessionMetrics(sessionId?uiTelemetryService.getMetricsForSession(sessionId):uiTelemetryService.getMetrics())}__name(getMetricsForDisplay,"getMetricsForDisplay");var SessionStatsContext=(0,import_react4.createContext)(void 0);var createDefaultStats=__name((sessionId="")=>({sessionId,sessionStartTime:new Date,metrics:getMetricsForDisplay(sessionId),lastPromptTokenCount:0,promptCount:0}),"createDefaultStats");var SessionStatsProvider=__name(({sessionId,children})=>{const[stats,setStats]=(0,import_react4.useState)(()=>createDefaultStats(sessionId??""));(0,import_react4.useEffect)(()=>{const handleUpdate=__name(({metrics,lastPromptTokenCount})=>{setStats(prevState=>{const nextMetrics=prevState.sessionId?getMetricsForDisplay(prevState.sessionId):cloneSessionMetrics(metrics);if(prevState.lastPromptTokenCount===lastPromptTokenCount&&areMetricsEqual(prevState.metrics,nextMetrics)){return prevState}return{...prevState,metrics:nextMetrics,lastPromptTokenCount}})},"handleUpdate");uiTelemetryService.on("update",handleUpdate);handleUpdate({metrics:uiTelemetryService.getMetrics(),lastPromptTokenCount:uiTelemetryService.getLastPromptTokenCount()});return()=>{uiTelemetryService.off("update",handleUpdate)}},[]);const startNewSession=(0,import_react4.useCallback)(sessionId2=>{setStats(()=>({...createDefaultStats(sessionId2),lastPromptTokenCount:uiTelemetryService.getLastPromptTokenCount()}))},[]);const startNewPrompt=(0,import_react4.useCallback)(()=>{setStats(prevState=>({...prevState,promptCount:prevState.promptCount+1}))},[]);const getPromptCount=(0,import_react4.useCallback)(()=>stats.promptCount,[stats.promptCount]);const seedPromptCount=(0,import_react4.useCallback)(count=>{setStats(prevState=>({...prevState,promptCount:Math.max(prevState.promptCount,count)}))},[]);const value=(0,import_react4.useMemo)(()=>({stats,startNewSession,startNewPrompt,getPromptCount,seedPromptCount}),[stats,startNewSession,startNewPrompt,getPromptCount,seedPromptCount]);return(0,import_jsx_runtime2.jsx)(SessionStatsContext.Provider,{value,children})},"SessionStatsProvider");var useSessionStats=__name(()=>{const context=(0,import_react4.useContext)(SessionStatsContext);if(context===void 0){throw new Error("useSessionStats must be used within a SessionStatsProvider")}return context},"useSessionStats");init_esbuild_shims();var graphemeSegmenter=new Intl.Segmenter(void 0,{granularity:"grapheme"});var SESSION_PAGE_SIZE=20;function truncateText(text,maxWidth){const widthLimit=Math.max(0,Math.floor(maxWidth));if(widthLimit===0){return""}const firstLine=text.split(/\r?\n/,1)[0];if(getCachedStringWidth(firstLine)<=widthLimit){return firstLine}if(widthLimit<=3){return truncateToDisplayWidth(firstLine,widthLimit)}return`${truncateToDisplayWidth(firstLine,widthLimit-3)}...`}__name(truncateText,"truncateText");function truncateToDisplayWidth(text,maxWidth){let width=0;let result="";for(const{segment}of graphemeSegmenter.segment(text)){const segmentWidth=getCachedStringWidth(segment);if(width+segmentWidth>maxWidth){break}result+=segment;width+=segmentWidth}return result}__name(truncateToDisplayWidth,"truncateToDisplayWidth");function matchesQuery(session,normalizedQuery){if(!normalizedQuery)return true;const haystacks=[session.customTitle,session.prompt,session.goalObjective,session.gitBranch];for(const h of haystacks){if(h&&h.toLowerCase().includes(normalizedQuery))return true}return false}__name(matchesQuery,"matchesQuery");function filterSessions(sessions,filterByBranch,currentBranch,query){const normalizedQuery=query?.toLowerCase().trim()??"";return sessions.filter(session=>{if(filterByBranch&¤tBranch){if(session.gitBranch!==currentBranch)return false}return matchesQuery(session,normalizedQuery)})}__name(filterSessions,"filterSessions");function formatMessageCount(count){return count===1?"1 message":`${count} messages`}__name(formatMessageCount,"formatMessageCount");init_esbuild_shims();var import_react5=__toESM(require_react(),1);function getTerminalSize(){return{columns:process.stdout.columns||80,rows:process.stdout.rows||24}}__name(getTerminalSize,"getTerminalSize");var currentSize=getTerminalSize();var subscribers=new Set;function handleResize(){currentSize=getTerminalSize();for(const notify of subscribers){notify(currentSize)}}__name(handleResize,"handleResize");function subscribe(callback){if(subscribers.size===0){currentSize=getTerminalSize();process.stdout.on("resize",handleResize)}subscribers.add(callback);return()=>{subscribers.delete(callback);if(subscribers.size===0){process.stdout.off("resize",handleResize)}}}__name(subscribe,"subscribe");function useTerminalSize(){const[size,setSize]=(0,import_react5.useState)(getTerminalSize);(0,import_react5.useEffect)(()=>{const unsubscribe=subscribe(setSize);setSize(currentSize);return unsubscribe},[]);return size}__name(useTerminalSize,"useTerminalSize");init_esbuild_shims();var lowlightInstance=null;var lowlightLoad=null;var LOWLIGHT_RETRY_COOLDOWN_MS=3e4;var lowlightLastFailureAt=0;var lowlightError=null;function getLowlightInstance(){return lowlightInstance}__name(getLowlightInstance,"getLowlightInstance");function isLowlightCoolingDown(){return lowlightLastFailureAt>0&&Date.now()-lowlightLastFailureAt<LOWLIGHT_RETRY_COOLDOWN_MS}__name(isLowlightCoolingDown,"isLowlightCoolingDown");function loadLowlight(){if(lowlightInstance)return Promise.resolve(lowlightInstance);if(isLowlightCoolingDown()){return Promise.reject(lowlightError??new Error("lowlight import previously failed"))}if(lowlightLoad)return lowlightLoad;lowlightLoad=import("./lowlight-common-Q5Z5HIJ3.js").then(mod=>{const instance=mod.createLowlight(mod.common);if(typeof instance?.registered!=="function"||typeof instance?.highlight!=="function"||typeof instance?.highlightAuto!=="function"){throw new Error("lowlight instance does not match expected API (registered/highlight/highlightAuto)")}lowlightInstance=instance;lowlightLastFailureAt=0;lowlightError=null;return lowlightInstance}).catch(err=>{lowlightLastFailureAt=Date.now();lowlightError=err instanceof Error?err:new Error(String(err));lowlightLoad=null;throw err});return lowlightLoad}__name(loadLowlight,"loadLowlight");init_esbuild_shims();function osc8Open(url){return wrapForMultiplexer(`\x1B]8;;${sanitizeForOsc(url)}\x07`)}__name(osc8Open,"osc8Open");function osc8Close(){return wrapForMultiplexer(`\x1B]8;;\x07`)}__name(osc8Close,"osc8Close");var SAFE_OSC8_SCHEMES=new Set(["http:","https:","mailto:","ftp:","ftps:","sftp:","ssh:"]);function isSafeOscScheme(url){const match=url.match(/^([a-z][a-z0-9+.-]*:)/i);if(!match)return false;return SAFE_OSC8_SCHEMES.has(match[1].toLowerCase())}__name(isSafeOscScheme,"isSafeOscScheme");var BARE_URL_BREAK_CHARACTERS=String.raw`\u3001-\u3004\u3008-\u3020\u302e-\u3030\u3036-\u3037\u303d-\u303f\uff01-\uff0f\uff1a-\uff20\uff3b-\uff40\uff5b-\uff65\ufe10-\ufe1f\ufe30-\ufe32\ufe35-\ufe6f`;var BARE_URL_BREAK_PATTERN=new RegExp(`[${BARE_URL_BREAK_CHARACTERS}]`);function trimTrailingUrlPunctuation(url,nextCharacter=""){let openParen=0;let openBracket=0;let openBrace=0;let closeParen=0;let closeBracket=0;let closeBrace=0;for(let i=0;i<url.length;i++){const cc=url.charCodeAt(i);if(cc===40)openParen++;else if(cc===91)openBracket++;else if(cc===123)openBrace++;else if(cc===41)closeParen++;else if(cc===93)closeBracket++;else if(cc===125)closeBrace++}let end=url.length;if(url.charCodeAt(end-1)===95&&BARE_URL_BREAK_PATTERN.test(nextCharacter)){end--}while(end>0){const c=url.charCodeAt(end-1);if(c===46||c===44||c===59||c===58||c===33||c===63||c===39||c===34||c===96||c===62){end--;continue}if(c===41&&closeParen>openParen){closeParen--;end--;continue}if(c===93&&closeBracket>openBracket){closeBracket--;end--;continue}if(c===125&&closeBrace>openBrace){closeBrace--;end--;continue}break}return url.slice(0,end)}__name(trimTrailingUrlPunctuation,"trimTrailingUrlPunctuation");var MD_LINK_PATTERN=String.raw`\[.*?\]\((?:[^()]|\([^()]*\))*\)`;var MD_LINK_CAPTURE=/^\[(.*?)\]\(((?:[^()]|\([^()]*\))*)\)$/;var BARE_URL_PATTERN=String.raw`https?:\/\/[^\s${BARE_URL_BREAK_CHARACTERS}]+`;function shouldWrapMarkdownLink(url,canHyperlink){return canHyperlink&&isSafeOscScheme(url)&&!/\s/.test(url)}__name(shouldWrapMarkdownLink,"shouldWrapMarkdownLink");var HOST_LIKE_RE=/\b[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)*\.[a-z]{2,}\b/gi;var IPV4_LIKE_RE=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g;function targetHostname(url){try{const u=new URL(url);if(u.protocol==="mailto:"){const at=u.pathname.lastIndexOf("@");return at>=0?u.pathname.slice(at+1).toLowerCase()||void 0:void 0}return u.hostname.toLowerCase()||void 0}catch{return void 0}}__name(targetHostname,"targetHostname");function labelMayDeceive(label,url){if(label===url)return false;if(/:\/\//.test(label)||/^[a-z][a-z0-9+.-]*:/i.test(label.trim())){return true}const lower=label.toLowerCase();const labelHosts=[...lower.match(HOST_LIKE_RE)??[],...lower.match(IPV4_LIKE_RE)??[]];if(labelHosts.length===0)return false;const target=targetHostname(url);if(!target)return true;return labelHosts.some(h=>h!==target)}__name(labelMayDeceive,"labelMayDeceive");init_esbuild_shims();var import_react6=__toESM(require_react(),1);var import_jsx_runtime3=__toESM(require_jsx_runtime(),1);var defaultWriteRaw=__name(data=>{process.stdout.write(data)},"defaultWriteRaw");var TerminalOutputContext=(0,import_react6.createContext)(defaultWriteRaw);var TerminalOutputProvider=__name(({value,children})=>(0,import_jsx_runtime3.jsx)(TerminalOutputContext.Provider,{value,children}),"TerminalOutputProvider");function useTerminalOutput(){return(0,import_react6.useContext)(TerminalOutputContext)}__name(useTerminalOutput,"useTerminalOutput");init_esbuild_shims();var import_react7=__toESM(require_react(),1);var RenderModeContext=import_react7.default.createContext({renderMode:"render",setRenderMode:__name(()=>void 0,"setRenderMode")});var RenderModeProvider=RenderModeContext.Provider;function useRenderMode(){return import_react7.default.useContext(RenderModeContext)}__name(useRenderMode,"useRenderMode");init_esbuild_shims();function getArenaStatusLabel(status){switch(status){case"idle":return{icon:"\u2713",text:"Idle",color:theme.status.success};case"completed":return{icon:"\u2713",text:"Done",color:theme.status.success};case"cancelled":return{icon:"\u2298",text:"Cancelled",color:theme.status.warning};case"failed":return{icon:"\u2717",text:"Failed",color:theme.status.error};case"running":return{icon:ICON.CIRCLE_EMPTY,text:"Running",color:theme.text.secondary};case"initializing":return{icon:ICON.CIRCLE_EMPTY,text:"Initializing",color:theme.text.secondary};default:return{icon:ICON.CIRCLE_EMPTY,text:status,color:theme.text.secondary}}}__name(getArenaStatusLabel,"getArenaStatusLabel");var TOOL_SUCCESS_RATE_HIGH=95;var TOOL_SUCCESS_RATE_MEDIUM=85;var USER_AGREEMENT_RATE_HIGH=75;var USER_AGREEMENT_RATE_MEDIUM=45;var getStatusColor=__name((value,thresholds,options={})=>{if(value>=thresholds.green){return theme.status.success}if(value>=thresholds.yellow){return theme.status.warning}if(thresholds.red!=null&&value>=thresholds.red){return theme.status.error}return options.defaultColor??theme.status.error},"getStatusColor");function formatDuration2(ms){const totalSeconds=Math.round(ms/1e3);if(totalSeconds<60){return`${totalSeconds}s`}const minutes=Math.floor(totalSeconds/60);const seconds=totalSeconds%60;return seconds>0?`${minutes}m ${seconds}s`:`${minutes}m`}__name(formatDuration2,"formatDuration");init_esbuild_shims();var Command=(Command2=>{Command2["RETURN"]="return";Command2["ESCAPE"]="escape";Command2["HOME"]="home";Command2["END"]="end";Command2["KILL_LINE_RIGHT"]="killLineRight";Command2["KILL_LINE_LEFT"]="killLineLeft";Command2["CLEAR_INPUT"]="clearInput";Command2["DELETE_WORD_BACKWARD"]="deleteWordBackward";Command2["CLEAR_SCREEN"]="clearScreen";Command2["HISTORY_UP"]="historyUp";Command2["HISTORY_DOWN"]="historyDown";Command2["NAVIGATION_UP"]="navigationUp";Command2["NAVIGATION_DOWN"]="navigationDown";Command2["SELECTION_UP"]="selectionUp";Command2["SELECTION_DOWN"]="selectionDown";Command2["ACCEPT_SUGGESTION"]="acceptSuggestion";Command2["COMPLETION_UP"]="completionUp";Command2["COMPLETION_DOWN"]="completionDown";Command2["COMPLETION_TAB_LEFT"]="completionTabLeft";Command2["COMPLETION_TAB_RIGHT"]="completionTabRight";Command2["SUBMIT"]="submit";Command2["QUEUE_MESSAGE"]="queueMessage";Command2["NEWLINE"]="newline";Command2["VOICE_PUSH_TO_TALK"]="voicePushToTalk";Command2["OPEN_EXTERNAL_EDITOR"]="openExternalEditor";Command2["PASTE_CLIPBOARD_IMAGE"]="pasteClipboardImage";Command2["TOGGLE_TOOL_DESCRIPTIONS"]="toggleToolDescriptions";Command2["TOGGLE_IDE_CONTEXT_DETAIL"]="toggleIDEContextDetail";Command2["QUIT"]="quit";Command2["EXIT"]="exit";Command2["SHOW_MORE_LINES"]="showMoreLines";Command2["RETRY_LAST"]="retryLast";Command2["TOGGLE_RENDER_MODE"]="toggleRenderMode";Command2["PROMOTE_SHELL_TO_BACKGROUND"]="promoteShellToBackground";Command2["REVERSE_SEARCH"]="reverseSearch";Command2["SUBMIT_REVERSE_SEARCH"]="submitReverseSearch";Command2["ACCEPT_SUGGESTION_REVERSE_SEARCH"]="acceptSuggestionReverseSearch";Command2["TOGGLE_SHELL_INPUT_FOCUS"]="toggleShellInputFocus";Command2["EXPAND_SUGGESTION"]="expandSuggestion";Command2["COLLAPSE_SUGGESTION"]="collapseSuggestion";Command2["TOGGLE_THINKING_EXPANDED"]="toggleThinkingExpanded";Command2["SCROLL_UP"]="scrollUp";Command2["SCROLL_DOWN"]="scrollDown";Command2["PAGE_UP"]="pageUp";Command2["PAGE_DOWN"]="pageDown";Command2["SCROLL_HOME"]="scrollHome";Command2["SCROLL_END"]="scrollEnd";return Command2})(Command||{});var defaultKeyBindings={["return"]:[{key:"return"}],["escape"]:[{key:"escape"}],["home"]:[{key:"a",ctrl:true}],["end"]:[{key:"e",ctrl:true}],["killLineRight"]:[{key:"k",ctrl:true}],["killLineLeft"]:[{key:"u",ctrl:true}],["clearInput"]:[{key:"c",ctrl:true,shift:false}],["deleteWordBackward"]:[{key:"backspace",ctrl:true},{key:"backspace",command:true},{sequence:""}],["clearScreen"]:[{key:"l",ctrl:true}],["historyUp"]:[{key:"p",ctrl:true}],["historyDown"]:[{key:"n",ctrl:true}],["navigationUp"]:[{key:"up",shift:false}],["navigationDown"]:[{key:"down",shift:false}],["selectionUp"]:[{key:"up",shift:false},{key:"k",ctrl:false},{key:"p",ctrl:true}],["selectionDown"]:[{key:"down",shift:false},{key:"j",ctrl:false},{key:"n",ctrl:true}],["acceptSuggestion"]:[{key:"tab"},{key:"return",ctrl:false,shift:false}],["completionUp"]:[{key:"up",shift:false},{key:"p",ctrl:true}],["completionDown"]:[{key:"down",shift:false},{key:"n",ctrl:true}],["completionTabLeft"]:[{key:"left",shift:false,ctrl:false,meta:false}],["completionTabRight"]:[{key:"right",shift:false,ctrl:false,meta:false}],["submit"]:[{key:"return",ctrl:false,command:false,paste:false,shift:false}],["queueMessage"]:[{key:"q",ctrl:true,command:false,shift:false,paste:false}],["newline"]:[{key:"return",ctrl:true},{key:"return",command:true},{key:"return",paste:true},{key:"return",shift:true},{key:"j",ctrl:true}],["voicePushToTalk"]:[{key:"space",ctrl:false,meta:false}],["openExternalEditor"]:[{key:"x",ctrl:true},{sequence:"",ctrl:true}],["pasteClipboardImage"]:process.platform==="win32"?[{key:"v",command:true},{key:"v",meta:true}]:[{key:"v",ctrl:true},{key:"v",command:true}],["toggleToolDescriptions"]:[{key:"t",ctrl:true}],["toggleIDEContextDetail"]:[{key:"g",ctrl:true}],["quit"]:[{key:"c",ctrl:true,shift:false}],["exit"]:[{key:"d",ctrl:true}],["showMoreLines"]:[{key:"s",ctrl:true}],["retryLast"]:[{key:"y",ctrl:true}],["toggleRenderMode"]:[{key:"m",meta:true}],["promoteShellToBackground"]:[{key:"b",ctrl:true}],["reverseSearch"]:[{key:"r",ctrl:true}],["submitReverseSearch"]:[{key:"return",ctrl:false}],["acceptSuggestionReverseSearch"]:[{key:"tab"}],["toggleShellInputFocus"]:[{key:"f",ctrl:true}],["expandSuggestion"]:[{key:"right"}],["collapseSuggestion"]:[{key:"left"}],["toggleThinkingExpanded"]:[{key:"o",ctrl:true},{key:"t",meta:true}],["scrollUp"]:[{key:"up",shift:true}],["scrollDown"]:[{key:"down",shift:true}],["pageUp"]:[{key:"pageup"}],["pageDown"]:[{key:"pagedown"}],["scrollHome"]:[{key:"home",ctrl:true}],["scrollEnd"]:[{key:"end",ctrl:true}]};init_esbuild_shims();function matchKeyBinding(keyBinding,key){let keyMatches=false;if(keyBinding.key!==void 0){keyMatches=keyBinding.key===key.name}else if(keyBinding.sequence!==void 0){keyMatches=keyBinding.sequence===key.sequence}else{return false}if(!keyMatches){return false}if(keyBinding.ctrl!==void 0&&!!key.ctrl!==keyBinding.ctrl){return false}if(keyBinding.shift!==void 0&&!!key.shift!==keyBinding.shift){return false}if(keyBinding.command!==void 0&&!!key.meta!==keyBinding.command){return false}if(keyBinding.paste!==void 0&&!!key.paste!==keyBinding.paste){return false}if(keyBinding.meta!==void 0&&!!key.meta!==keyBinding.meta){return false}return true}__name(matchKeyBinding,"matchKeyBinding");function matchCommand(command,key,config=defaultKeyBindings){const bindings=config[command];return bindings.some(binding=>matchKeyBinding(binding,key))}__name(matchCommand,"matchCommand");function createKeyMatchers(config=defaultKeyBindings){const matchers={};for(const command of Object.values(Command)){matchers[command]=key=>matchCommand(command,key,config)}return matchers}__name(createKeyMatchers,"createKeyMatchers");var keyMatchers=createKeyMatchers(defaultKeyBindings);init_esbuild_shims();var import_react8=__toESM(require_react(),1);var VirtualViewportContext=(0,import_react8.createContext)(void 0);function useVirtualViewport(fallback){return(0,import_react8.useContext)(VirtualViewportContext)??fallback??false}__name(useVirtualViewport,"useVirtualViewport");init_esbuild_shims();var import_react9=__toESM(require_react(),1);init_esbuild_shims();import{spawnSync}from"node:child_process";import fs from"node:fs";import os from"node:os";import path from"node:path";var debugLogger=createDebugLogger("EXTERNAL_EDITOR");function editTextInExternalEditor(text,options){const directory=fs.mkdtempSync(path.join(os.tmpdir(),"qwen-edit-"));const file=path.join(directory,"buffer.txt");try{const resolved=!options.editor&&options.preferredEditor?getExternalEditorCommand(options.preferredEditor,file):null;if(!options.editor&&options.preferredEditor&&!resolved){debugLogger.warn(`Preferred editor "${options.preferredEditor}" not found, falling back to env/default`)}let command=(options.editor||resolved?.command)??process.env["VISUAL"]??process.env["EDITOR"]??(process.platform==="win32"?"notepad":"vi");let args=resolved?.args??[file];const shell=resolved?resolved.needsShell:process.platform==="win32"&&/\.(cmd|bat)$/i.test(command);if(shell){if(!resolved&&/["|%!]/.test(command)){throw new Error(`Editor command contains unsafe characters: ${command}`)}command=`"${command}"`;args=args.map(arg=>`"${arg}"`)}fs.writeFileSync(file,text,{encoding:"utf8",mode:384});options.beforeLaunch();debugLogger.warn(`Launching external editor (cmd=${command}, shell=${shell})`);const{status,error,signal}=spawnSync(command,args,{stdio:"inherit",shell,timeout:30*60*1e3});if(error)throw error;if(signal)throw new Error(`External editor was killed by signal ${signal}`);if(typeof status==="number"&&status!==0){throw new Error(`External editor exited with status ${status}`)}return fs.readFileSync(file,"utf8").replace(/\r\n?/g,"\n")}finally{try{fs.rmSync(directory,{recursive:true,force:true})}catch{}}}__name(editTextInExternalEditor,"editTextInExternalEditor");init_esbuild_shims();init_esbuild_shims();function assumeExhaustive(_value){}__name(assumeExhaustive,"assumeExhaustive");function checkExhaustive(value,msg=`unexpected value ${value}!`){assumeExhaustive(value);throw new Error(msg)}__name(checkExhaustive,"checkExhaustive");function isAtEndOfBaseWord(lineCodePoints,col){if(!isWordCharStrict(lineCodePoints[col]))return false;let i=col+1;while(i<lineCodePoints.length&&isCombiningMark(lineCodePoints[i])){i++}return i>=lineCodePoints.length||!isWordCharStrict(lineCodePoints[i])}__name(isAtEndOfBaseWord,"isAtEndOfBaseWord");function handleVimAction(state,action){return applyVimAction(state,action,pushUndo)}__name(handleVimAction,"handleVimAction");function applyVimAction(state,action,prepareEdit){const{lines,cursorRow,cursorCol}=state;switch(action.type){case"vim_delete_word_forward":case"vim_change_word_forward":{const{count}=action.payload;let endRow=cursorRow;let endCol=cursorCol;for(let i=0;i<count;i++){const nextWord=findNextWordAcrossLines(lines,endRow,endCol,true);if(nextWord){endRow=nextWord.row;endCol=nextWord.col}else{const currentLine=lines[endRow]||"";const wordEnd=findWordEndInLine(currentLine,endCol);if(wordEnd!==null){endCol=wordEnd+1}else{endCol=cpLen(currentLine)}break}}if(endRow!==cursorRow||endCol!==cursorCol){const nextState=prepareEdit(state);return replaceRangeInternal(nextState,cursorRow,cursorCol,endRow,endCol,"")}return state}case"vim_delete_word_backward":case"vim_change_word_backward":{const{count}=action.payload;let startRow=cursorRow;let startCol=cursorCol;for(let i=0;i<count;i++){const prevWord=findPrevWordAcrossLines(lines,startRow,startCol);if(prevWord){startRow=prevWord.row;startCol=prevWord.col}else{break}}if(startRow!==cursorRow||startCol!==cursorCol){const nextState=prepareEdit(state);return replaceRangeInternal(nextState,startRow,startCol,cursorRow,cursorCol,"")}return state}case"vim_delete_word_end":case"vim_change_word_end":{const{count}=action.payload;let row=cursorRow;let col=cursorCol;let endRow=cursorRow;let endCol=cursorCol;for(let i=0;i<count;i++){const wordEnd=findNextWordAcrossLines(lines,row,col,false);if(wordEnd){endRow=wordEnd.row;endCol=wordEnd.col+1;if(i<count-1){const nextWord=findNextWordAcrossLines(lines,wordEnd.row,wordEnd.col+1,true);if(nextWord){row=nextWord.row;col=nextWord.col}else{break}}}else{break}}if(endRow<lines.length){const lineLen=cpLen(lines[endRow]||"");endCol=Math.min(endCol,lineLen)}if(endRow!==cursorRow||endCol!==cursorCol){const nextState=prepareEdit(state);return replaceRangeInternal(nextState,cursorRow,cursorCol,endRow,endCol,"")}return state}case"vim_delete_line":{const{count}=action.payload;if(lines.length===0)return state;const linesToDelete=Math.min(count,lines.length-cursorRow);const totalLines=lines.length;if(totalLines===1||linesToDelete>=totalLines){const nextState2=prepareEdit(state);return{...nextState2,lines:[""],cursorRow:0,cursorCol:0,preferredCol:null}}const nextState=prepareEdit(state);const newLines=[...nextState.lines];newLines.splice(cursorRow,linesToDelete);const newCursorRow=Math.min(cursorRow,newLines.length-1);const newCursorCol=0;return{...nextState,lines:newLines,cursorRow:newCursorRow,cursorCol:newCursorCol,preferredCol:null}}case"vim_change_line":{const{count}=action.payload;if(lines.length===0)return state;const linesToChange=Math.min(count,lines.length-cursorRow);const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(cursorRow,linesToChange,nextState.lines);const{startRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);return replaceRangeInternal(nextState,startRow,startCol,endRow,endCol,"")}case"vim_delete_to_end_of_line":case"vim_change_to_end_of_line":{const currentLine=lines[cursorRow]||"";if(cursorCol<cpLen(currentLine)){const nextState=prepareEdit(state);return replaceRangeInternal(nextState,cursorRow,cursorCol,cursorRow,cpLen(currentLine),"")}return state}case"vim_change_movement":{const{movement,count}=action.payload;const totalLines=lines.length;switch(movement){case"h":{const startCol=Math.max(0,cursorCol-count);return replaceRangeInternal(prepareEdit(state),cursorRow,startCol,cursorRow,cursorCol,"")}case"j":{const linesToChange=Math.min(count+1,totalLines-cursorRow);if(linesToChange>0){if(totalLines===1){const currentLine=state.lines[0]||"";return replaceRangeInternal(prepareEdit(state),0,0,0,cpLen(currentLine),"")}else{const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(cursorRow,linesToChange,nextState.lines);const{startRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);return replaceRangeInternal(nextState,startRow,startCol,endRow,endCol,"")}}return state}case"k":{const upLines=Math.min(count+1,cursorRow+1);if(upLines>0){if(state.lines.length===1){const currentLine=state.lines[0]||"";return replaceRangeInternal(prepareEdit(state),0,0,0,cpLen(currentLine),"")}else{const startRow=Math.max(0,cursorRow-count);const linesToChange=cursorRow-startRow+1;const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(startRow,linesToChange,nextState.lines);const{startRow:newStartRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);const resultState=replaceRangeInternal(nextState,newStartRow,startCol,endRow,endCol,"");return{...resultState,cursorRow:startRow,cursorCol:0}}}return state}case"l":{return replaceRangeInternal(prepareEdit(state),cursorRow,cursorCol,cursorRow,Math.min(cpLen(lines[cursorRow]||""),cursorCol+count),"")}default:return state}}case"vim_delete_movement":{const{movement,count}=action.payload;const totalLines=lines.length;switch(movement){case"h":{const startCol=Math.max(0,cursorCol-count);return replaceRangeInternal(prepareEdit(state),cursorRow,startCol,cursorRow,cursorCol,"")}case"j":{const linesToDelete=Math.min(count+1,totalLines-cursorRow);if(linesToDelete>0){if(totalLines===1){const currentLine=state.lines[0]||"";return replaceRangeInternal(prepareEdit(state),0,0,0,cpLen(currentLine),"")}else{const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(cursorRow,linesToDelete,nextState.lines);const{startRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);return replaceRangeInternal(nextState,startRow,startCol,endRow,endCol,"")}}return state}case"k":{const upLines=Math.min(count+1,cursorRow+1);if(upLines>0){if(state.lines.length===1){const currentLine=state.lines[0]||"";return replaceRangeInternal(prepareEdit(state),0,0,0,cpLen(currentLine),"")}else{const startRow=Math.max(0,cursorRow-count);const linesToDelete=cursorRow-startRow+1;const nextState=prepareEdit(state);const{startOffset,endOffset}=getLineRangeOffsets(startRow,linesToDelete,nextState.lines);const{startRow:newStartRow,startCol,endRow,endCol}=getPositionFromOffsets(startOffset,endOffset,nextState.lines);const resultState=replaceRangeInternal(nextState,newStartRow,startCol,endRow,endCol,"");return{...resultState,cursorRow:startRow,cursorCol:0}}}return state}case"l":{return replaceRangeInternal(prepareEdit(state),cursorRow,cursorCol,cursorRow,Math.min(cpLen(lines[cursorRow]||""),cursorCol+count),"")}default:return state}}case"vim_move_left":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;let newRow=cursorRow2;let newCol=cursorCol2;for(let i=0;i<count;i++){if(newCol>0){newCol--}else if(newRow>0){newRow--;const prevLine=lines2[newRow]||"";const prevLineLength=cpLen(prevLine);newCol=prevLineLength===0?0:prevLineLength-1}}return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"vim_move_right":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;let newRow=cursorRow2;let newCol=cursorCol2;for(let i=0;i<count;i++){const currentLine=lines2[newRow]||"";const lineLength=cpLen(currentLine);if(lineLength===0){if(newRow<lines2.length-1){newRow++;newCol=0}}else if(newCol<lineLength-1){newCol++;const currentLinePoints=toCodePoints(currentLine);while(newCol<currentLinePoints.length&&isCombiningMark(currentLinePoints[newCol])&&newCol<lineLength-1){newCol++}}else if(newRow<lines2.length-1){newRow++;newCol=0}}return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"vim_move_up":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;const newRow=Math.max(0,cursorRow2-count);const targetLine=lines2[newRow]||"";const targetLineLength=cpLen(targetLine);const newCol=Math.min(cursorCol2,targetLineLength>0?targetLineLength-1:0);return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"vim_move_down":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;const newRow=Math.min(lines2.length-1,cursorRow2+count);const targetLine=lines2[newRow]||"";const targetLineLength=cpLen(targetLine);const newCol=Math.min(cursorCol2,targetLineLength>0?targetLineLength-1:0);return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"vim_move_word_forward":{const{count}=action.payload;let row=cursorRow;let col=cursorCol;for(let i=0;i<count;i++){const nextWord=findNextWordAcrossLines(lines,row,col,true);if(nextWord){row=nextWord.row;col=nextWord.col}else{break}}return{...state,cursorRow:row,cursorCol:col,preferredCol:null}}case"vim_move_word_backward":{const{count}=action.payload;let row=cursorRow;let col=cursorCol;for(let i=0;i<count;i++){const prevWord=findPrevWordAcrossLines(lines,row,col);if(prevWord){row=prevWord.row;col=prevWord.col}else{break}}return{...state,cursorRow:row,cursorCol:col,preferredCol:null}}case"vim_move_word_end":{const{count}=action.payload;let row=cursorRow;let col=cursorCol;for(let i=0;i<count;i++){if(i===0){const currentLine=lines[row]||"";const lineCodePoints=toCodePoints(currentLine);const atEndOfWord=col<lineCodePoints.length&&isWordCharStrict(lineCodePoints[col])&&(col+1>=lineCodePoints.length||!isWordCharWithCombining(lineCodePoints[col+1])||isWordCharStrict(lineCodePoints[col])&&isAtEndOfBaseWord(lineCodePoints,col));if(atEndOfWord){const nextWord=findNextWordAcrossLines(lines,row,col+1,false);if(nextWord){row=nextWord.row;col=nextWord.col;continue}}}const wordEnd=findNextWordAcrossLines(lines,row,col,false);if(wordEnd){row=wordEnd.row;col=wordEnd.col}else{break}}return{...state,cursorRow:row,cursorCol:col,preferredCol:null}}case"vim_delete_char":{const{count}=action.payload;const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;const currentLine=lines2[cursorRow2]||"";const lineLength=cpLen(currentLine);if(cursorCol2<lineLength){const deleteCount=Math.min(count,lineLength-cursorCol2);const nextState=prepareEdit(state);return replaceRangeInternal(nextState,cursorRow2,cursorCol2,cursorRow2,cursorCol2+deleteCount,"")}return state}case"vim_insert_at_cursor":{return state}case"vim_append_at_cursor":{const{cursorRow:cursorRow2,cursorCol:cursorCol2,lines:lines2}=state;const currentLine=lines2[cursorRow2]||"";const newCol=cursorCol2<cpLen(currentLine)?cursorCol2+1:cursorCol2;return{...state,cursorCol:newCol,preferredCol:null}}case"vim_open_line_below":{const{cursorRow:cursorRow2,lines:lines2}=state;const nextState=prepareEdit(state);const endOfLine=cpLen(lines2[cursorRow2]||"");return replaceRangeInternal(nextState,cursorRow2,endOfLine,cursorRow2,endOfLine,"\n")}case"vim_open_line_above":{const{cursorRow:cursorRow2}=state;const nextState=prepareEdit(state);const resultState=replaceRangeInternal(nextState,cursorRow2,0,cursorRow2,0,"\n");return{...resultState,cursorRow:cursorRow2,cursorCol:0}}case"vim_append_at_line_end":{const{cursorRow:cursorRow2,lines:lines2}=state;const lineLength=cpLen(lines2[cursorRow2]||"");return{...state,cursorCol:lineLength,preferredCol:null}}case"vim_insert_at_line_start":{const{cursorRow:cursorRow2,lines:lines2}=state;const currentLine=lines2[cursorRow2]||"";let col=0;const lineCodePoints=toCodePoints(currentLine);while(col<lineCodePoints.length&&/\s/.test(lineCodePoints[col])){col++}return{...state,cursorCol:col,preferredCol:null}}case"vim_move_to_line_start":{return{...state,cursorCol:0,preferredCol:null}}case"vim_move_to_line_end":{const{cursorRow:cursorRow2,lines:lines2}=state;const lineLength=cpLen(lines2[cursorRow2]||"");return{...state,cursorCol:lineLength>0?lineLength-1:0,preferredCol:null}}case"vim_move_to_first_nonwhitespace":{const{cursorRow:cursorRow2,lines:lines2}=state;const currentLine=lines2[cursorRow2]||"";let col=0;const lineCodePoints=toCodePoints(currentLine);while(col<lineCodePoints.length&&/\s/.test(lineCodePoints[col])){col++}return{...state,cursorCol:col,preferredCol:null}}case"vim_move_to_first_line":{return{...state,cursorRow:0,cursorCol:0,preferredCol:null}}case"vim_move_to_last_line":{const{lines:lines2}=state;const lastRow=lines2.length-1;return{...state,cursorRow:lastRow,cursorCol:0,preferredCol:null}}case"vim_move_to_line":{const{lineNumber}=action.payload;const{lines:lines2}=state;const targetRow=Math.min(Math.max(0,lineNumber-1),lines2.length-1);return{...state,cursorRow:targetRow,cursorCol:0,preferredCol:null}}case"vim_escape_insert_mode":{const{cursorCol:cursorCol2}=state;const newCol=cursorCol2>0?cursorCol2-1:0;return{...state,cursorCol:newCol,preferredCol:null}}default:{assumeExhaustive(action);return state}}}__name(applyVimAction,"applyVimAction");var debugLogger2=createDebugLogger("TEXT_BUFFER");var isWordCharStrict=__name(char=>/[\w\p{L}\p{N}]/u.test(char),"isWordCharStrict");var isWhitespace=__name(char=>/\s/.test(char),"isWhitespace");var isCombiningMark=__name(char=>new RegExp("\\p{M}","u").test(char),"isCombiningMark");var isWordCharWithCombining=__name(char=>isWordCharStrict(char)||isCombiningMark(char),"isWordCharWithCombining");var getCharScript=__name(char=>{if(/[\p{Script=Latin}]/u.test(char))return"latin";if(/[\p{Script=Han}]/u.test(char))return"han";if(/[\p{Script=Arabic}]/u.test(char))return"arabic";if(/[\p{Script=Hiragana}]/u.test(char))return"hiragana";if(/[\p{Script=Katakana}]/u.test(char))return"katakana";if(/[\p{Script=Cyrillic}]/u.test(char))return"cyrillic";return"other"},"getCharScript");var isDifferentScript=__name((char1,char2)=>{if(!isWordCharStrict(char1)||!isWordCharStrict(char2))return false;return getCharScript(char1)!==getCharScript(char2)},"isDifferentScript");var CJK_CHAR_REGEX=/[\u4e00-\u9fff\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/;var isCjkChar=__name(char=>CJK_CHAR_REGEX.test(char),"isCjkChar");var WORD_BOUNDARIES_CACHE_MAX=500;var SEGMENTER_LENGTH_LIMIT=1500;var wordBoundariesCache=null;var segmenter=null;function ensureSegmenterLoaded(){if(segmenter!==null)return;try{segmenter=new Intl.Segmenter("zh",{granularity:"word"});debugLogger2.info("Intl.Segmenter: initialized successfully")}catch(err){debugLogger2.warn("Intl.Segmenter: failed to initialize",err);segmenter=false}}__name(ensureSegmenterLoaded,"ensureSegmenterLoaded");function charByCharFallback(line){const codePoints=toCodePoints(line);const fallback=[];for(let i=0;i<codePoints.length;i++){if(isCjkChar(codePoints[i])){fallback.push({start:i,end:i+1})}}return fallback}__name(charByCharFallback,"charByCharFallback");function evictCacheIfNeeded(){if(wordBoundariesCache&&wordBoundariesCache.size>=WORD_BOUNDARIES_CACHE_MAX){const firstKey=wordBoundariesCache.keys().next().value;if(firstKey!==void 0){wordBoundariesCache.delete(firstKey)}}}__name(evictCacheIfNeeded,"evictCacheIfNeeded");function getWordBoundaries(line,codePoints){const cps=codePoints??toCodePoints(line);if(cps.length>SEGMENTER_LENGTH_LIMIT){if(!wordBoundariesCache)wordBoundariesCache=new Map;if(wordBoundariesCache.has(line))return wordBoundariesCache.get(line);const fallback=charByCharFallback(line);evictCacheIfNeeded();wordBoundariesCache.set(line,fallback);return fallback}if(!wordBoundariesCache)wordBoundariesCache=new Map;const cached=wordBoundariesCache.get(line);if(cached){return cached}ensureSegmenterLoaded();if(!segmenter){const fallback=charByCharFallback(line);evictCacheIfNeeded();wordBoundariesCache.set(line,fallback);return fallback}try{const segments=segmenter.segment(line);const cpToStrIdx=[];let strIdx=0;for(let i=0;i<cps.length;i++){cpToStrIdx[i]=strIdx;strIdx+=cps[i].length}const boundaries=[];for(const{index,segment,isWordLike}of segments){const trimmedSegment=segment.trim();if(!isWordLike&&trimmedSegment.length===0){continue}if(isWordLike&&segment.includes(".")){let currentOffset=index;const parts=segment.split(/(\.)/);for(const part of parts){if(part.length===0)continue;const partStartCpIdx=binarySearchCpIndex(cpToStrIdx,currentOffset);const partEndStrPos=currentOffset+part.length;const partEndCpIdxRaw=binarySearchCpIndex(cpToStrIdx,partEndStrPos);const partEndCpIdx=partEndCpIdxRaw===-1?cps.length:partEndCpIdxRaw;if(partStartCpIdx>=0&&partStartCpIdx<partEndCpIdx){boundaries.push({start:partStartCpIdx,end:partEndCpIdx})}currentOffset+=part.length}continue}if(!isWordLike&&/^[.,;!?,。;!?、]+$/.test(trimmedSegment)){const startCpIdx2=binarySearchCpIndex(cpToStrIdx,index);const endStrPos2=index+segment.length;const endCpIdxRaw2=binarySearchCpIndex(cpToStrIdx,endStrPos2);const endCpIdx2=endCpIdxRaw2===-1?cps.length:endCpIdxRaw2;if(startCpIdx2>=0&&startCpIdx2<endCpIdx2){boundaries.push({start:startCpIdx2,end:endCpIdx2})}continue}const startCpIdx=binarySearchCpIndex(cpToStrIdx,index);const endStrPos=index+segment.length;const endCpIdxRaw=binarySearchCpIndex(cpToStrIdx,endStrPos);const endCpIdx=endCpIdxRaw===-1?cps.length:endCpIdxRaw;if(startCpIdx>=0&&startCpIdx<endCpIdx){boundaries.push({start:startCpIdx,end:endCpIdx})}}evictCacheIfNeeded();wordBoundariesCache.set(line,boundaries);return boundaries}catch(err){debugLogger2.warn("getWordBoundaries: error, using char fallback",err);const fallback=charByCharFallback(line);evictCacheIfNeeded();wordBoundariesCache.set(line,fallback);return fallback}}__name(getWordBoundaries,"getWordBoundaries");function binarySearchCpIndex(cpToStrIdx,target){let lo=0;let hi=cpToStrIdx.length-1;while(lo<=hi){const mid=lo+hi>>>1;if(cpToStrIdx[mid]>=target)hi=mid-1;else lo=mid+1}return lo<cpToStrIdx.length?lo:-1}__name(binarySearchCpIndex,"binarySearchCpIndex");function findPrevWordStart(boundaries,col){for(let i=boundaries.length-1;i>=0;i--){const b=boundaries[i];if(col>b.start&&col<=b.end){return b.start}if(col===b.start&&i>0){return boundaries[i-1].start}}return null}__name(findPrevWordStart,"findPrevWordStart");function findNextWordEnd(boundaries,col){for(const b of boundaries){if(col>=b.start&&col<b.end){return b.end}if(col<b.start){return null}}return null}__name(findNextWordEnd,"findNextWordEnd");function findWordEndFallback(arr,startPos){let end=startPos;while(end<arr.length){const currChar=arr[end];const nextChar=end+1<arr.length?arr[end+1]:void 0;if(!isWordCharStrict(currChar??"")||nextChar!==void 0&&isWordCharStrict(currChar??"")&&isWordCharStrict(nextChar)&&isDifferentScript(currChar??"",nextChar)){break}if(nextChar!==void 0&&isCjkChar(currChar??"")&&isCjkChar(nextChar)){end++;break}end++}return end}__name(findWordEndFallback,"findWordEndFallback");var findNextWordStartInLine=__name((line,col)=>{const chars=toCodePoints(line);let i=col;if(i>=chars.length)return null;const currentChar=chars[i];if(isWordCharStrict(currentChar)){while(i<chars.length&&isWordCharWithCombining(chars[i])){if(i+1<chars.length&&isWordCharStrict(chars[i+1])&&isDifferentScript(chars[i],chars[i+1])){i++;break}i++}}else if(!isWhitespace(currentChar)){while(i<chars.length&&!isWordCharStrict(chars[i])&&!isWhitespace(chars[i])){i++}}while(i<chars.length&&isWhitespace(chars[i])){i++}return i<chars.length?i:null},"findNextWordStartInLine");var findPrevWordStartInLine=__name((line,col)=>{const chars=toCodePoints(line);let i=col;if(i<=0)return null;i--;while(i>=0&&isWhitespace(chars[i])){i--}if(i<0)return null;if(isWordCharStrict(chars[i])){while(i>=0&&isWordCharStrict(chars[i])){if(i-1>=0&&isWordCharStrict(chars[i-1])&&isDifferentScript(chars[i],chars[i-1])){return i}i--}return i+1}else{while(i>=0&&!isWordCharStrict(chars[i])&&!isWhitespace(chars[i])){i--}return i+1}},"findPrevWordStartInLine");var findWordEndInLine=__name((line,col)=>{const chars=toCodePoints(line);let i=col;const atEndOfWordChar=i<chars.length&&isWordCharWithCombining(chars[i])&&(i+1>=chars.length||!isWordCharWithCombining(chars[i+1])||isWordCharStrict(chars[i])&&i+1<chars.length&&isWordCharStrict(chars[i+1])&&isDifferentScript(chars[i],chars[i+1]));const atEndOfPunctuation=i<chars.length&&!isWordCharWithCombining(chars[i])&&!isWhitespace(chars[i])&&(i+1>=chars.length||isWhitespace(chars[i+1])||isWordCharWithCombining(chars[i+1]));if(atEndOfWordChar||atEndOfPunctuation){i++;while(i<chars.length&&isWhitespace(chars[i])){i++}}if(i<chars.length&&!isWordCharWithCombining(chars[i])){while(i<chars.length&&isWhitespace(chars[i])){i++}}let foundWord=false;let lastBaseCharPos=-1;if(i<chars.length&&isWordCharWithCombining(chars[i])){while(i<chars.length&&isWordCharWithCombining(chars[i])){foundWord=true;if(isWordCharStrict(chars[i])){lastBaseCharPos=i}if(i+1<chars.length&&isWordCharStrict(chars[i+1])&&isDifferentScript(chars[i],chars[i+1])){i++;if(isWordCharStrict(chars[i-1])){lastBaseCharPos=i-1}break}i++}}else if(i<chars.length&&!isWhitespace(chars[i])){while(i<chars.length&&!isWordCharStrict(chars[i])&&!isWhitespace(chars[i])){foundWord=true;lastBaseCharPos=i;i++}}if(foundWord&&lastBaseCharPos>=col){return lastBaseCharPos}return null},"findWordEndInLine");var findNextWordAcrossLines=__name((lines,cursorRow,cursorCol,searchForWordStart)=>{const currentLine=lines[cursorRow]||"";const colInCurrentLine=searchForWordStart?findNextWordStartInLine(currentLine,cursorCol):findWordEndInLine(currentLine,cursorCol);if(colInCurrentLine!==null){return{row:cursorRow,col:colInCurrentLine}}for(let row=cursorRow+1;row<lines.length;row++){const line=lines[row]||"";const chars=toCodePoints(line);if(chars.length===0){let hasWordsInLaterLines=false;for(let laterRow=row+1;laterRow<lines.length;laterRow++){const laterLine=lines[laterRow]||"";const laterChars=toCodePoints(laterLine);let firstNonWhitespace2=0;while(firstNonWhitespace2<laterChars.length&&isWhitespace(laterChars[firstNonWhitespace2])){firstNonWhitespace2++}if(firstNonWhitespace2<laterChars.length){hasWordsInLaterLines=true;break}}if(!hasWordsInLaterLines){return{row,col:0}}continue}let firstNonWhitespace=0;while(firstNonWhitespace<chars.length&&isWhitespace(chars[firstNonWhitespace])){firstNonWhitespace++}if(firstNonWhitespace<chars.length){if(searchForWordStart){return{row,col:firstNonWhitespace}}else{const endCol=findWordEndInLine(line,firstNonWhitespace);if(endCol!==null){return{row,col:endCol}}}}}return null},"findNextWordAcrossLines");var findPrevWordAcrossLines=__name((lines,cursorRow,cursorCol)=>{const currentLine=lines[cursorRow]||"";const colInCurrentLine=findPrevWordStartInLine(currentLine,cursorCol);if(colInCurrentLine!==null){return{row:cursorRow,col:colInCurrentLine}}for(let row=cursorRow-1;row>=0;row--){const line=lines[row]||"";const chars=toCodePoints(line);if(chars.length===0)continue;let lastWordStart=chars.length;while(lastWordStart>0&&isWhitespace(chars[lastWordStart-1])){lastWordStart--}if(lastWordStart>0){const wordStart=findPrevWordStartInLine(line,lastWordStart);if(wordStart!==null){return{row,col:wordStart}}}}return null},"findPrevWordAcrossLines");var offsetToRowCol=__name((offset,lines)=>{let running=0;for(let i=0;i<lines.length;i++){const lineLength=lines[i].length+1;if(running+lineLength>offset){return{row:i,col:offset-running}}running+=lineLength}const last=Math.max(0,lines.length-1);return{row:last,col:lines[last]?.length??0}},"offsetToRowCol");var getPositionFromOffsets=__name((startOffset,endOffset,lines)=>{const{row:startRow,col:startCol}=offsetToRowCol(startOffset,lines);const{row:endRow,col:endCol}=offsetToRowCol(endOffset,lines);return{startRow,startCol,endRow,endCol}},"getPositionFromOffsets");var getLineRangeOffsets=__name((startRow,lineCount,lines)=>{let startOffset=0;for(let i=0;i<startRow;i++){startOffset+=lines[i].length+1}let endOffset=startOffset;for(let i=0;i<lineCount;i++){const lineIndex=startRow+i;if(lineIndex<lines.length){endOffset+=lines[lineIndex].length;if(lineIndex<lines.length-1){endOffset+=1}}}return{startOffset,endOffset}},"getLineRangeOffsets");var replaceRangeInternal=__name((state,startRow,startCol,endRow,endCol,text)=>{const currentLine=__name(row=>state.lines[row]||"","currentLine");const currentLineLen=__name(row=>cpLen(currentLine(row)),"currentLineLen");const clamp2=__name((value,min,max)=>Math.min(Math.max(value,min),max),"clamp");if(startRow>endRow||startRow===endRow&&startCol>endCol||startRow<0||startCol<0||endRow>=state.lines.length||endRow<state.lines.length&&endCol>currentLineLen(endRow)){return state}const newLines=[...state.lines];const sCol=clamp2(startCol,0,currentLineLen(startRow));const eCol=clamp2(endCol,0,currentLineLen(endRow));const prefix=cpSlice(currentLine(startRow),0,sCol);const suffix=cpSlice(currentLine(endRow),eCol);const normalisedReplacement=text.replace(/\r\n/g,"\n").replace(/\r/g,"\n");const replacementParts=normalisedReplacement.split("\n");const firstLine=prefix+replacementParts[0];if(replacementParts.length===1){newLines.splice(startRow,endRow-startRow+1,firstLine+suffix)}else{const lastLine=replacementParts[replacementParts.length-1]+suffix;const middleLines=replacementParts.slice(1,-1);newLines.splice(startRow,endRow-startRow+1,firstLine,...middleLines,lastLine)}const finalCursorRow=startRow+replacementParts.length-1;const finalCursorCol=(replacementParts.length>1?0:sCol)+cpLen(replacementParts[replacementParts.length-1]);return{...state,lines:newLines,cursorRow:Math.min(Math.max(finalCursorRow,0),newLines.length-1),cursorCol:Math.max(0,Math.min(finalCursorCol,cpLen(newLines[finalCursorRow]||""))),preferredCol:null}},"replaceRangeInternal");function clamp(v,min,max){return v<min?min:v>max?max:v}__name(clamp,"clamp");function calculateInitialCursorPosition(initialLines,offset){let remainingChars=offset;let row=0;while(row<initialLines.length){const lineLength=cpLen(initialLines[row]);const totalCharsInLineAndNewline=lineLength+(row<initialLines.length-1?1:0);if(remainingChars<=lineLength){return[row,remainingChars]}remainingChars-=totalCharsInLineAndNewline;row++}if(initialLines.length>0){const lastRow=initialLines.length-1;return[lastRow,cpLen(initialLines[lastRow])]}return[0,0]}__name(calculateInitialCursorPosition,"calculateInitialCursorPosition");function offsetToLogicalPos(text,offset){let row=0;let col=0;let currentOffset=0;if(offset===0)return[0,0];const lines=text.split("\n");for(let i=0;i<lines.length;i++){const line=lines[i];const lineLength=cpLen(line);const lineLengthWithNewline=lineLength+(i<lines.length-1?1:0);if(offset<=currentOffset+lineLength){row=i;col=offset-currentOffset;return[row,col]}else if(offset<=currentOffset+lineLengthWithNewline){row=i;col=lineLength;if(offset===currentOffset+lineLengthWithNewline&&i<lines.length-1){return[i+1,0]}return[row,col]}currentOffset+=lineLengthWithNewline}if(lines.length>0){row=lines.length-1;col=cpLen(lines[row])}else{row=0;col=0}return[row,col]}__name(offsetToLogicalPos,"offsetToLogicalPos");function logicalPosToOffset(lines,row,col){let offset=0;const actualRow=Math.min(row,lines.length-1);for(let i=0;i<actualRow;i++){offset+=cpLen(lines[i])+1}if(actualRow>=0&&actualRow<lines.length){offset+=Math.min(col,cpLen(lines[actualRow]))}return offset}__name(logicalPosToOffset,"logicalPosToOffset");function calculateLayout(logicalLines,viewportWidth){const visualLines=[];const logicalToVisualMap=[];const visualToLogicalMap=[];logicalLines.forEach((logLine,logIndex)=>{logicalToVisualMap[logIndex]=[];if(logLine.length===0){logicalToVisualMap[logIndex].push([visualLines.length,0]);visualToLogicalMap.push([logIndex,0]);visualLines.push("")}else{let currentPosInLogLine=0;const codePointsInLogLine=toCodePoints(logLine);while(currentPosInLogLine<codePointsInLogLine.length){let currentChunk="";let currentChunkVisualWidth=0;let numCodePointsInChunk=0;let lastWordBreakPoint=-1;let numCodePointsAtLastWordBreak=0;for(let i=currentPosInLogLine;i<codePointsInLogLine.length;i++){const char=codePointsInLogLine[i];const charVisualWidth=getCachedStringWidth(char);if(currentChunkVisualWidth+charVisualWidth>viewportWidth){if(lastWordBreakPoint!==-1&&numCodePointsAtLastWordBreak>0&¤tPosInLogLine+numCodePointsAtLastWordBreak<i){currentChunk=codePointsInLogLine.slice(currentPosInLogLine,currentPosInLogLine+numCodePointsAtLastWordBreak).join("");numCodePointsInChunk=numCodePointsAtLastWordBreak}else{if(numCodePointsInChunk===0&&charVisualWidth>viewportWidth){currentChunk=char;numCodePointsInChunk=1}else if(numCodePointsInChunk===0&&charVisualWidth<=viewportWidth){}}break}currentChunk+=char;currentChunkVisualWidth+=charVisualWidth;numCodePointsInChunk++;if(char===" "){lastWordBreakPoint=i;numCodePointsAtLastWordBreak=numCodePointsInChunk-1}}if(numCodePointsInChunk===0&¤tPosInLogLine<codePointsInLogLine.length){const firstChar=codePointsInLogLine[currentPosInLogLine];currentChunk=firstChar;numCodePointsInChunk=1}if(numCodePointsInChunk===0&¤tPosInLogLine<codePointsInLogLine.length){currentChunk=codePointsInLogLine[currentPosInLogLine];numCodePointsInChunk=1}logicalToVisualMap[logIndex].push([visualLines.length,currentPosInLogLine]);visualToLogicalMap.push([logIndex,currentPosInLogLine]);visualLines.push(currentChunk);const logicalStartOfThisChunk=currentPosInLogLine;currentPosInLogLine+=numCodePointsInChunk;if(logicalStartOfThisChunk+numCodePointsInChunk<codePointsInLogLine.length&¤tPosInLogLine<codePointsInLogLine.length&&codePointsInLogLine[currentPosInLogLine]===" "){currentPosInLogLine++}}}});if(logicalLines.length===0||logicalLines.length===1&&logicalLines[0]===""){if(visualLines.length===0){visualLines.push("");if(!logicalToVisualMap[0])logicalToVisualMap[0]=[];logicalToVisualMap[0].push([0,0]);visualToLogicalMap.push([0,0])}}return{visualLines,logicalToVisualMap,visualToLogicalMap}}__name(calculateLayout,"calculateLayout");function calculateVisualCursorFromLayout(layout,logicalCursor){const{logicalToVisualMap,visualLines}=layout;const[logicalRow,logicalCol]=logicalCursor;const segmentsForLogicalLine=logicalToVisualMap[logicalRow];if(!segmentsForLogicalLine||segmentsForLogicalLine.length===0){return[0,0]}let targetSegmentIndex=segmentsForLogicalLine.findIndex(([,startColInLogical2],index)=>{const nextStartColInLogical=index+1<segmentsForLogicalLine.length?segmentsForLogicalLine[index+1][1]:Infinity;return logicalCol>=startColInLogical2&&logicalCol<nextStartColInLogical});if(targetSegmentIndex===-1){if(logicalCol===0){targetSegmentIndex=0}else{targetSegmentIndex=segmentsForLogicalLine.length-1}}const[visualRow,startColInLogical]=segmentsForLogicalLine[targetSegmentIndex];const visualCol=logicalCol-startColInLogical;const clampedVisualCol=Math.min(visualCol,cpLen(visualLines[visualRow]??""));return[visualRow,clampedVisualCol]}__name(calculateVisualCursorFromLayout,"calculateVisualCursorFromLayout");var historyLimit=100;var pushUndo=__name(currentState=>{const snapshot={lines:[...currentState.lines],cursorRow:currentState.cursorRow,cursorCol:currentState.cursorCol,...currentState.pasteHistory?{pasteHistory:currentState.pasteHistory}:{}};const newStack=[...currentState.undoStack,snapshot];if(newStack.length>historyLimit){newStack.shift()}return{...currentState,undoStack:newStack,redoStack:[]}},"pushUndo");function getWordMovePosition(lines,cursorRow,cursorCol,direction){if(direction==="wordLeft"){if(cursorCol===0&&cursorRow===0)return{row:cursorRow,col:cursorCol};let newCursorRow=cursorRow;let newCursorCol=cursorCol;if(cursorCol===0){newCursorRow--;newCursorCol=cpLen(lines[newCursorRow]??"")}else{const lineContent=lines[cursorRow];const arr=toCodePoints(lineContent);let start=cursorCol;const boundaries=getWordBoundaries(lineContent,arr);const startBoundary=findPrevWordStart(boundaries,start);if(startBoundary!==null){start=startBoundary}else{let onlySpaces=true;for(let i=0;i<start;i++){if(isWordCharStrict(arr[i]??"")){onlySpaces=false;break}}if(onlySpaces){start=0}else{while(start>0&&!isWordCharStrict(arr[start-1]??""))start--;while(start>0){const prevChar=arr[start-1];const currChar=arr[start];if(!isWordCharStrict(prevChar??"")||isWordCharStrict(currChar??"")&&isDifferentScript(currChar??"",prevChar??"")){break}if(isCjkChar(currChar??"")&&isCjkChar(prevChar??"")){break}start--}}}newCursorCol=start}return{row:newCursorRow,col:newCursorCol}}else{if(cursorRow===lines.length-1&&cursorCol===cpLen(lines[cursorRow]??"")){return{row:cursorRow,col:cursorCol}}let newCursorRow=cursorRow;let newCursorCol=cursorCol;const lineContent=lines[cursorRow]??"";const arr=toCodePoints(lineContent);if(cursorCol>=arr.length){newCursorRow++;newCursorCol=0}else{const boundaries=getWordBoundaries(lineContent,arr);const endBoundary=findNextWordEnd(boundaries,cursorCol);let end;if(endBoundary!==null){end=endBoundary;while(end<arr.length&&isWhitespace(arr[end]??"")){end++}}else if(cursorCol<arr.length&&!isWordCharStrict(arr[cursorCol]??"")){end=cursorCol;while(end<arr.length&&!isWordCharStrict(arr[end]??""))end++;if(end<arr.length){const nextEnd=findNextWordEnd(boundaries,end);if(nextEnd!==null){end=nextEnd}else{end=findWordEndFallback(arr,end)}}}else{end=cursorCol;while(end<arr.length&&!isWordCharStrict(arr[end]??""))end++;end=findWordEndFallback(arr,end)}newCursorCol=end}return{row:newCursorRow,col:newCursorCol}}}__name(getWordMovePosition,"getWordMovePosition");function applyWordDeletion(state,direction,prepareEdit){const currentLine=__name(row=>state.lines[row]??"","currentLine");switch(direction){case"delete_word_left":{const{cursorRow,cursorCol}=state;if(cursorCol===0&&cursorRow===0)return state;const nextState=prepareEdit(state);const newLines=[...nextState.lines];let newCursorRow=cursorRow;let newCursorCol=cursorCol;if(newCursorCol>0){const lineContent=currentLine(newCursorRow);const arr=toCodePoints(lineContent);const boundaries=getWordBoundaries(lineContent,arr);const startBoundary=findPrevWordStart(boundaries,newCursorCol);let start;if(startBoundary!==null){start=startBoundary}else{const prevWordStart=findPrevWordStartInLine(lineContent,newCursorCol);start=prevWordStart===null?0:prevWordStart}newLines[newCursorRow]=cpSlice(lineContent,0,start)+cpSlice(lineContent,newCursorCol);newCursorCol=start}else{const prevLineContent=currentLine(cursorRow-1);const currentLineContentVal=currentLine(cursorRow);const newCol=cpLen(prevLineContent);newLines[cursorRow-1]=prevLineContent+currentLineContentVal;newLines.splice(cursorRow,1);newCursorRow--;newCursorCol=newCol}return{...nextState,lines:newLines,cursorRow:newCursorRow,cursorCol:newCursorCol,preferredCol:null}}case"delete_word_right":{const{cursorRow,cursorCol,lines}=state;const lineContent=currentLine(cursorRow);const lineLen=cpLen(lineContent);if(cursorCol>=lineLen&&cursorRow===lines.length-1){return state}const nextState=prepareEdit(state);const newLines=[...nextState.lines];if(cursorCol>=lineLen){const nextLineContent=currentLine(cursorRow+1);newLines[cursorRow]=lineContent+nextLineContent;newLines.splice(cursorRow+1,1)}else{const arr=toCodePoints(lineContent);const boundaries=getWordBoundaries(lineContent,arr);const endBoundary=findNextWordEnd(boundaries,cursorCol);let end;if(endBoundary!==null){end=endBoundary;while(end<arr.length&&isWhitespace(arr[end]??"")){end++}}else{const nextWordStart=findNextWordStartInLine(lineContent,cursorCol);end=nextWordStart===null?lineLen:nextWordStart}newLines[cursorRow]=cpSlice(lineContent,0,cursorCol)+cpSlice(lineContent,end)}return{...nextState,lines:newLines,preferredCol:null}}default:return state}}__name(applyWordDeletion,"applyWordDeletion");function textBufferReducerLogic(state,action){const pushUndoLocal=pushUndo;const currentLine=__name(r=>state.lines[r]??"","currentLine");const currentLineLen=__name(r=>cpLen(currentLine(r)),"currentLineLen");switch(action.type){case"set_text":{let nextState=action.clearUndoHistory?{...state,undoStack:[],redoStack:[]}:state;if(!action.clearUndoHistory&&action.pushToUndo!==false){nextState=pushUndoLocal(state)}const newContentLines=action.payload.replace(/\r\n?/g,"\n").split("\n");const lines=newContentLines.length===0?[""]:newContentLines;const lastNewLineIndex=lines.length-1;return{...nextState,lines,cursorRow:lastNewLineIndex,cursorCol:cpLen(lines[lastNewLineIndex]??""),preferredCol:null}}case"insert":{const nextState=pushUndoLocal(state);const newLines=[...nextState.lines];let newCursorRow=nextState.cursorRow;let newCursorCol=nextState.cursorCol;const currentLine2=__name(r=>newLines[r]??"","currentLine");const str=stripUnsafeCharacters(action.payload.replace(/\r\n/g,"\n").replace(/\r/g,"\n"));const parts=str.split("\n");const lineContent=currentLine2(newCursorRow);const before=cpSlice(lineContent,0,newCursorCol);const after=cpSlice(lineContent,newCursorCol);if(parts.length>1){newLines[newCursorRow]=before+parts[0];const remainingParts=parts.slice(1);const lastPartOriginal=remainingParts.pop()??"";newLines.splice(newCursorRow+1,0,...remainingParts);newLines.splice(newCursorRow+parts.length-1,0,lastPartOriginal+after);newCursorRow=newCursorRow+parts.length-1;newCursorCol=cpLen(lastPartOriginal)}else{newLines[newCursorRow]=before+parts[0]+after;newCursorCol=cpLen(before)+cpLen(parts[0])}return{...nextState,lines:newLines,cursorRow:newCursorRow,cursorCol:newCursorCol,preferredCol:null}}case"backspace":{const nextState=pushUndoLocal(state);const newLines=[...nextState.lines];let newCursorRow=nextState.cursorRow;let newCursorCol=nextState.cursorCol;const currentLine2=__name(r=>newLines[r]??"","currentLine");if(newCursorCol===0&&newCursorRow===0)return state;if(newCursorCol>0){const lineContent=currentLine2(newCursorRow);newLines[newCursorRow]=cpSlice(lineContent,0,newCursorCol-1)+cpSlice(lineContent,newCursorCol);newCursorCol--}else if(newCursorRow>0){const prevLineContent=currentLine2(newCursorRow-1);const currentLineContentVal=currentLine2(newCursorRow);const newCol=cpLen(prevLineContent);newLines[newCursorRow-1]=prevLineContent+currentLineContentVal;newLines.splice(newCursorRow,1);newCursorRow--;newCursorCol=newCol}return{...nextState,lines:newLines,cursorRow:newCursorRow,cursorCol:newCursorCol,preferredCol:null}}case"set_viewport":{const{width,height}=action.payload;if(width===state.viewportWidth&&height===state.viewportHeight){return state}return{...state,viewportWidth:width,viewportHeight:height}}case"move":{const{dir}=action.payload;const{cursorRow,cursorCol,lines,visualLayout,preferredCol}=state;if(dir==="left"||dir==="right"||dir==="up"||dir==="down"||dir==="home"||dir==="end"){const visualCursor=calculateVisualCursorFromLayout(visualLayout,[cursorRow,cursorCol]);const{visualLines,visualToLogicalMap}=visualLayout;let newVisualRow=visualCursor[0];let newVisualCol=visualCursor[1];let newPreferredCol=preferredCol;const currentVisLineLen=cpLen(visualLines[newVisualRow]??"");switch(dir){case"left":newPreferredCol=null;if(newVisualCol>0){newVisualCol--}else if(newVisualRow>0){newVisualRow--;newVisualCol=cpLen(visualLines[newVisualRow]??"");const previousMapping=visualToLogicalMap[newVisualRow];if(previousMapping){const[previousLogRow,previousLogStartCol]=previousMapping;const previousCursorCol=previousLogStartCol+newVisualCol;if(previousLogRow===cursorRow&&previousCursorCol===cursorCol&&newVisualCol>0){newVisualCol--}}}break;case"right":newPreferredCol=null;if(newVisualCol<currentVisLineLen){newVisualCol++}else if(newVisualRow<visualLines.length-1){newVisualRow++;newVisualCol=0}break;case"up":if(newVisualRow>0){if(newPreferredCol===null)newPreferredCol=newVisualCol;newVisualRow--;newVisualCol=clamp(newPreferredCol,0,cpLen(visualLines[newVisualRow]??""))}break;case"down":if(newVisualRow<visualLines.length-1){if(newPreferredCol===null)newPreferredCol=newVisualCol;newVisualRow++;newVisualCol=clamp(newPreferredCol,0,cpLen(visualLines[newVisualRow]??""))}break;case"home":newPreferredCol=null;newVisualCol=0;break;case"end":newPreferredCol=null;newVisualCol=currentVisLineLen;break;default:{const exhaustiveCheck=dir;debugLogger2.error(`Unknown visual movement direction: ${exhaustiveCheck}`);return state}}if(visualToLogicalMap[newVisualRow]){const[logRow,logStartCol]=visualToLogicalMap[newVisualRow];return{...state,cursorRow:logRow,cursorCol:clamp(logStartCol+newVisualCol,0,cpLen(lines[logRow]??"")),preferredCol:newPreferredCol}}return state}switch(dir){case"wordLeft":case"wordRight":{const target=getWordMovePosition(lines,cursorRow,cursorCol,dir);if(target.row===cursorRow&&target.col===cursorCol)return state;return{...state,cursorRow:target.row,cursorCol:target.col,preferredCol:null}}default:return state}}case"set_cursor":{return{...state,...action.payload}}case"delete":{const{cursorRow,cursorCol,lines}=state;const lineContent=currentLine(cursorRow);if(cursorCol<currentLineLen(cursorRow)){const nextState=pushUndoLocal(state);const newLines=[...nextState.lines];newLines[cursorRow]=cpSlice(lineContent,0,cursorCol)+cpSlice(lineContent,cursorCol+1);return{...nextState,lines:newLines,preferredCol:null}}else if(cursorRow<lines.length-1){const nextState=pushUndoLocal(state);const nextLineContent=currentLine(cursorRow+1);const newLines=[...nextState.lines];newLines[cursorRow]=lineContent+nextLineContent;newLines.splice(cursorRow+1,1);return{...nextState,lines:newLines,preferredCol:null}}return state}case"delete_word_left":case"delete_word_right":return applyWordDeletion(state,action.type,pushUndoLocal);case"kill_line_right":{const{cursorRow,cursorCol,lines}=state;const lineContent=currentLine(cursorRow);if(cursorCol<currentLineLen(cursorRow)){const nextState=pushUndoLocal(state);const newLines=[...nextState.lines];newLines[cursorRow]=cpSlice(lineContent,0,cursorCol);return{...nextState,lines:newLines}}else if(cursorRow<lines.length-1){const nextState=pushUndoLocal(state);const nextLineContent=currentLine(cursorRow+1);const newLines=[...nextState.lines];newLines[cursorRow]=lineContent+nextLineContent;newLines.splice(cursorRow+1,1);return{...nextState,lines:newLines,preferredCol:null}}return state}case"kill_line_left":{const{cursorRow,cursorCol}=state;if(cursorCol>0){const nextState=pushUndoLocal(state);const lineContent=currentLine(cursorRow);const newLines=[...nextState.lines];newLines[cursorRow]=cpSlice(lineContent,cursorCol);return{...nextState,lines:newLines,cursorCol:0,preferredCol:null}}else if(cursorRow>0){const nextState=pushUndoLocal(state);const prevLineContent=currentLine(cursorRow-1);const currentLineContent=currentLine(cursorRow);const newCol=cpLen(prevLineContent);const newLines=[...nextState.lines];newLines[cursorRow-1]=prevLineContent+currentLineContent;newLines.splice(cursorRow,1);return{...nextState,lines:newLines,cursorRow:cursorRow-1,cursorCol:newCol,preferredCol:null}}return state}case"undo":{const stateToRestore=state.undoStack[state.undoStack.length-1];if(!stateToRestore)return state;const currentSnapshot={lines:[...state.lines],cursorRow:state.cursorRow,cursorCol:state.cursorCol,...state.pasteHistory?{pasteHistory:state.pasteHistory}:{}};return{...state,...stateToRestore,undoStack:state.undoStack.slice(0,-1),redoStack:[...state.redoStack,currentSnapshot]}}case"redo":{const stateToRestore=state.redoStack[state.redoStack.length-1];if(!stateToRestore)return state;const currentSnapshot={lines:[...state.lines],cursorRow:state.cursorRow,cursorCol:state.cursorCol,...state.pasteHistory?{pasteHistory:state.pasteHistory}:{}};return{...state,...stateToRestore,redoStack:state.redoStack.slice(0,-1),undoStack:[...state.undoStack,currentSnapshot]}}case"replace_range":{const{startRow,startCol,endRow,endCol,text}=action.payload;const nextState=pushUndoLocal(state);return replaceRangeInternal(nextState,startRow,startCol,endRow,endCol,text)}case"move_to_offset":{const{offset}=action.payload;const[newRow,newCol]=offsetToLogicalPos(state.lines.join("\n"),offset);return{...state,cursorRow:newRow,cursorCol:newCol,preferredCol:null}}case"create_undo_snapshot":{return pushUndoLocal(state)}case"vim_delete_word_forward":case"vim_delete_word_backward":case"vim_delete_word_end":case"vim_change_word_forward":case"vim_change_word_backward":case"vim_change_word_end":case"vim_delete_line":case"vim_change_line":case"vim_delete_to_end_of_line":case"vim_change_to_end_of_line":case"vim_change_movement":case"vim_delete_movement":case"vim_move_left":case"vim_move_right":case"vim_move_up":case"vim_move_down":case"vim_move_word_forward":case"vim_move_word_backward":case"vim_move_word_end":case"vim_delete_char":case"vim_insert_at_cursor":case"vim_append_at_cursor":case"vim_open_line_below":case"vim_open_line_above":case"vim_append_at_line_end":case"vim_insert_at_line_start":case"vim_move_to_line_start":case"vim_move_to_line_end":case"vim_move_to_first_nonwhitespace":case"vim_move_to_first_line":case"vim_move_to_last_line":case"vim_move_to_line":case"vim_escape_insert_mode":return handleVimAction(state,action);default:{const exhaustiveCheck=action;debugLogger2.error(`Unknown action encountered: ${exhaustiveCheck}`);return state}}}__name(textBufferReducerLogic,"textBufferReducerLogic");function textBufferReducer(state,action){const newState=textBufferReducerLogic(state,action);if(newState.lines!==state.lines||newState.viewportWidth!==state.viewportWidth){return{...newState,visualLayout:calculateLayout(newState.lines,newState.viewportWidth)}}return newState}__name(textBufferReducer,"textBufferReducer");function looksLikePath(str){const unquoted=str.replace(/^'(.*)'$/,"$1");const inner=unquoted.startsWith("'")?unquoted.slice(1):unquoted;return inner.startsWith("/")||inner.startsWith("./")||inner.startsWith("../")||inner.startsWith("~/")||inner.startsWith(".")||/^[A-Za-z]:/.test(inner)}__name(looksLikePath,"looksLikePath");function tryExtractFilePaths(content,isValidPath){const normalized=content.replace(/\r\n/g,"\n").replace(/\r/g,"\n");const lines=normalized.split(/\n/).filter(s=>s.trim().length>0);const validPaths=[];const hadNonPathToken={value:false};for(const line of lines){if(hadNonPathToken.value)break;const quotedPathRegex=/'((?:[~/.]|[A-Za-z]:)[^']*)'/g;let lastIndex=0;let match;let hasQuotedPaths=false;while((match=quotedPathRegex.exec(line))!==null){const gap=line.slice(lastIndex,match.index).trim();if(gap){const gapPaths=extractPathsFromSegment(gap,isValidPath,hadNonPathToken);validPaths.push(...gapPaths)}const unescaped=unescapePath(match[1]);if(isValidPath(unescaped)){validPaths.push(`@${escapePath(unescaped)}`)}else{hadNonPathToken.value=true}lastIndex=quotedPathRegex.lastIndex;hasQuotedPaths=true}if(hasQuotedPaths){const trailing=line.slice(lastIndex).trim();if(trailing){const trailingPaths=extractPathsFromSegment(trailing,isValidPath,hadNonPathToken);validPaths.push(...trailingPaths)}}else{const linePaths=extractPathsFromSegment(line.trim(),isValidPath,hadNonPathToken);validPaths.push(...linePaths)}}if(validPaths.length>0&&!hadNonPathToken.value){return validPaths}return null}__name(tryExtractFilePaths,"tryExtractFilePaths");function extractPathsFromSegment(segment,isValidPath,hadNonPathToken){const tokens=segment.split(/\s+/).filter(Boolean);const paths=[];let i=0;while(i<tokens.length){if(hadNonPathToken.value)break;if(tokens.length>1&&!looksLikePath(tokens[i])){hadNonPathToken.value=true;i++;continue}let found=false;for(let j=tokens.length;j>=i+1;j--){const candidate=tokens.slice(i,j).join(" ");let unquoted=candidate;const quoteMatch=unquoted.match(/^'(.*)'$/);if(quoteMatch){unquoted=quoteMatch[1]}const unescaped=unescapePath(unquoted);if(isValidPath(unescaped)){paths.push(`@${escapePath(unescaped)}`);i=j;found=true;break}}if(!found){hadNonPathToken.value=true;i++}}return paths}__name(extractPathsFromSegment,"extractPathsFromSegment");function handleTextBufferInput(key,{insert,newline,move,deleteWordLeft,deleteWordRight,backspace,del,undo,redo}){const{sequence:input}=key;if(key.paste){insert(input,{paste:key.paste});return}if(key.name==="return"||input==="\r"||input==="\n"||input==="\\\r")newline();else if(key.name==="left"&&!key.meta&&!key.ctrl)move("left");else if(key.ctrl&&key.name==="b")move("left");else if(key.name==="right"&&!key.meta&&!key.ctrl)move("right");else if(key.ctrl&&key.name==="f")move("right");else if(key.name==="up"&&!key.shift)move("up");else if(key.name==="down"&&!key.shift)move("down");else if((key.ctrl||key.meta)&&key.name==="left")move("wordLeft");else if(key.meta&&key.name==="b")move("wordLeft");else if((key.ctrl||key.meta)&&key.name==="right")move("wordRight");else if(key.meta&&key.name==="d")deleteWordRight();else if(key.meta&&key.name==="f")move("wordRight");else if(key.name==="home")move("home");else if(key.ctrl&&key.name==="a")move("home");else if(key.name==="end")move("end");else if(key.ctrl&&key.name==="e")move("end");else if(key.ctrl&&key.name==="w")deleteWordLeft();else if((key.meta||key.ctrl)&&(key.name==="backspace"||input==="\x7F"))deleteWordLeft();else if((key.meta||key.ctrl)&&key.name==="delete")deleteWordRight();else if(key.name==="backspace"||input==="\x7F"||key.ctrl&&key.name==="h")backspace();else if(key.name==="delete"||key.ctrl&&key.name==="d")del();else if(key.ctrl&&!key.shift&&key.name==="z")undo();else if(key.ctrl&&key.shift&&key.name==="z")redo();else if(input&&!key.ctrl&&!key.meta&&key.name!=="tab"&&input!==" "){insert(input,{paste:key.paste})}}__name(handleTextBufferInput,"handleTextBufferInput");function useTextBuffer({initialText="",initialCursorOffset=0,viewport,stdin,setRawMode,onChange,isValidPath,shellModeActive=false,preferredEditor,pasteHistory}){const initialState=(0,import_react9.useMemo)(()=>{const lines2=initialText.split("\n");const[initialCursorRow,initialCursorCol]=calculateInitialCursorPosition(lines2.length===0?[""]:lines2,initialCursorOffset);const visualLayout2=calculateLayout(lines2.length===0?[""]:lines2,viewport.width);return{lines:lines2.length===0?[""]:lines2,cursorRow:initialCursorRow,cursorCol:initialCursorCol,preferredCol:null,undoStack:[],redoStack:[],clipboard:null,selectionAnchor:null,viewportWidth:viewport.width,viewportHeight:viewport.height,visualLayout:visualLayout2}},[initialText,initialCursorOffset,viewport.width,viewport.height]);const stateRef=(0,import_react9.useRef)(initialState);const[state,setState]=(0,import_react9.useState)(initialState);const pasteHistoryRef=(0,import_react9.useRef)(pasteHistory);pasteHistoryRef.current=pasteHistory;const dispatch=(0,import_react9.useCallback)(action=>{const history=pasteHistoryRef.current;let before=stateRef.current;if(history){before={...before,pasteHistory:new Map(history.capture())}}const restoring=action.type==="undo"&&before.undoStack.length>0||action.type==="redo"&&before.redoStack.length>0;stateRef.current=textBufferReducer(before,action);if(restoring&&history&&stateRef.current.pasteHistory){history.restore(new Map(stateRef.current.pasteHistory))}setState(stateRef.current)},[]);const{lines,cursorRow,cursorCol,preferredCol,selectionAnchor,visualLayout}=state;const text=(0,import_react9.useMemo)(()=>lines.join("\n"),[lines]);const visualCursor=(0,import_react9.useMemo)(()=>calculateVisualCursorFromLayout(visualLayout,[cursorRow,cursorCol]),[visualLayout,cursorRow,cursorCol]);const{visualLines,visualToLogicalMap}=visualLayout;const[visualScrollRow,setVisualScrollRow]=(0,import_react9.useState)(0);(0,import_react9.useEffect)(()=>{if(onChange){onChange(text)}},[text,onChange]);(0,import_react9.useEffect)(()=>{dispatch({type:"set_viewport",payload:{width:viewport.width,height:viewport.height}})},[dispatch,viewport.width,viewport.height]);(0,import_react9.useEffect)(()=>{const{height}=viewport;const totalVisualLines=visualLines.length;const maxScrollStart=Math.max(0,totalVisualLines-height);let newVisualScrollRow=visualScrollRow;if(visualCursor[0]<visualScrollRow){newVisualScrollRow=visualCursor[0]}else if(visualCursor[0]>=visualScrollRow+height){newVisualScrollRow=visualCursor[0]-height+1}newVisualScrollRow=clamp(newVisualScrollRow,0,maxScrollStart);if(newVisualScrollRow!==visualScrollRow){setVisualScrollRow(newVisualScrollRow)}},[visualCursor,visualScrollRow,viewport,visualLines.length]);const insert=(0,import_react9.useCallback)((ch,{paste=false}={})=>{if(paste&&/[\n\r]/.test(ch)&&!shellModeActive){const validPaths=tryExtractFilePaths(ch,isValidPath);if(validPaths){ch=`${validPaths.join(" ")} `}dispatch({type:"insert",payload:ch});return}if(/[\n\r]/.test(ch)){dispatch({type:"insert",payload:ch});return}const minLengthToInferAsDragDrop=3;if(paste&&ch.length>=minLengthToInferAsDragDrop&&!shellModeActive){const validPaths=tryExtractFilePaths(ch.trim(),isValidPath);if(validPaths){ch=`${validPaths.join(" ")} `}}let currentText="";for(const char of toCodePoints(ch)){if(char.codePointAt(0)===127){if(currentText.length>0){dispatch({type:"insert",payload:currentText});currentText=""}dispatch({type:"backspace"})}else{currentText+=char}}if(currentText.length>0){dispatch({type:"insert",payload:currentText})}},[dispatch,isValidPath,shellModeActive]);const newline=(0,import_react9.useCallback)(()=>{dispatch({type:"insert",payload:"\n"})},[dispatch]);const backspace=(0,import_react9.useCallback)(()=>{dispatch({type:"backspace"})},[dispatch]);const del=(0,import_react9.useCallback)(()=>{dispatch({type:"delete"})},[dispatch]);const move=(0,import_react9.useCallback)(dir=>{dispatch({type:"move",payload:{dir}})},[dispatch]);const undo=(0,import_react9.useCallback)(()=>{dispatch({type:"undo"})},[dispatch]);const redo=(0,import_react9.useCallback)(()=>{dispatch({type:"redo"})},[dispatch]);const setText=(0,import_react9.useCallback)((newText,options)=>{dispatch({type:"set_text",payload:newText,clearUndoHistory:options?.clearUndoHistory})},[dispatch]);const deleteWordLeft=(0,import_react9.useCallback)(()=>{dispatch({type:"delete_word_left"})},[dispatch]);const deleteWordRight=(0,import_react9.useCallback)(()=>{dispatch({type:"delete_word_right"})},[dispatch]);const killLineRight=(0,import_react9.useCallback)(()=>{dispatch({type:"kill_line_right"})},[dispatch]);const killLineLeft=(0,import_react9.useCallback)(()=>{dispatch({type:"kill_line_left"})},[dispatch]);const vimDeleteWordForward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_word_forward",payload:{count}})},[dispatch]);const vimDeleteWordBackward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_word_backward",payload:{count}})},[dispatch]);const vimDeleteWordEnd=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_word_end",payload:{count}})},[dispatch]);const vimChangeWordForward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_change_word_forward",payload:{count}})},[dispatch]);const vimChangeWordBackward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_change_word_backward",payload:{count}})},[dispatch]);const vimChangeWordEnd=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_change_word_end",payload:{count}})},[dispatch]);const vimDeleteLine=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_line",payload:{count}})},[dispatch]);const vimChangeLine=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_change_line",payload:{count}})},[dispatch]);const vimDeleteToEndOfLine=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_delete_to_end_of_line"})},[dispatch]);const vimChangeToEndOfLine=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_change_to_end_of_line"})},[dispatch]);const vimChangeMovement=(0,import_react9.useCallback)((movement,count)=>{dispatch({type:"vim_change_movement",payload:{movement,count}})},[dispatch]);const vimDeleteMovement=(0,import_react9.useCallback)((movement,count)=>{dispatch({type:"vim_delete_movement",payload:{movement,count}})},[dispatch]);const vimMoveLeft=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_left",payload:{count}})},[dispatch]);const vimMoveRight=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_right",payload:{count}})},[dispatch]);const vimMoveUp=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_up",payload:{count}})},[dispatch]);const vimMoveDown=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_down",payload:{count}})},[dispatch]);const vimMoveWordForward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_word_forward",payload:{count}})},[dispatch]);const vimMoveWordBackward=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_word_backward",payload:{count}})},[dispatch]);const vimMoveWordEnd=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_move_word_end",payload:{count}})},[dispatch]);const vimDeleteChar=(0,import_react9.useCallback)(count=>{dispatch({type:"vim_delete_char",payload:{count}})},[dispatch]);const vimInsertAtCursor=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_insert_at_cursor"})},[dispatch]);const vimAppendAtCursor=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_append_at_cursor"})},[dispatch]);const vimOpenLineBelow=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_open_line_below"})},[dispatch]);const vimOpenLineAbove=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_open_line_above"})},[dispatch]);const vimAppendAtLineEnd=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_append_at_line_end"})},[dispatch]);const vimInsertAtLineStart=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_insert_at_line_start"})},[dispatch]);const vimMoveToLineStart=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_line_start"})},[dispatch]);const vimMoveToLineEnd=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_line_end"})},[dispatch]);const vimMoveToFirstNonWhitespace=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_first_nonwhitespace"})},[dispatch]);const vimMoveToFirstLine=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_first_line"})},[dispatch]);const vimMoveToLastLine=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_move_to_last_line"})},[dispatch]);const vimMoveToLine=(0,import_react9.useCallback)(lineNumber=>{dispatch({type:"vim_move_to_line",payload:{lineNumber}})},[dispatch]);const vimEscapeInsertMode=(0,import_react9.useCallback)(()=>{dispatch({type:"vim_escape_insert_mode"})},[dispatch]);const openInExternalEditor=(0,import_react9.useCallback)(async(opts={})=>{const wasRaw=stdin?.isRaw??false;try{const currentText=stateRef.current.lines.join("\n");const newText=editTextInExternalEditor(currentText,{editor:opts.editor,preferredEditor,beforeLaunch:__name(()=>setRawMode?.(false),"beforeLaunch")});if(newText!==currentText){dispatch({type:"create_undo_snapshot"});dispatch({type:"set_text",payload:newText,pushToUndo:false})}}catch(err){debugLogger2.error("[useTextBuffer] external editor error",err)}finally{try{if(wasRaw)setRawMode?.(true)}catch(rawErr){debugLogger2.error("[useTextBuffer] failed to restore raw mode after external editor",rawErr)}}},[dispatch,stdin,setRawMode,preferredEditor]);const handleInput=(0,import_react9.useCallback)(key=>{handleTextBufferInput(key,{insert,newline,move,deleteWordLeft,deleteWordRight,backspace,del,undo,redo})},[insert,newline,move,deleteWordLeft,deleteWordRight,backspace,del,undo,redo]);const renderedVisualLines=(0,import_react9.useMemo)(()=>visualLines.slice(visualScrollRow,visualScrollRow+viewport.height),[visualLines,visualScrollRow,viewport.height]);const replaceRange=(0,import_react9.useCallback)((startRow,startCol,endRow,endCol,text2)=>{dispatch({type:"replace_range",payload:{startRow,startCol,endRow,endCol,text:text2}})},[dispatch]);const replaceRangeByOffset=(0,import_react9.useCallback)((startOffset,endOffset,replacementText)=>{const currentText=stateRef.current.lines.join("\n");const[startRow,startCol]=offsetToLogicalPos(currentText,startOffset);const[endRow,endCol]=offsetToLogicalPos(currentText,endOffset);replaceRange(startRow,startCol,endRow,endCol,replacementText)},[replaceRange]);const moveToOffset=(0,import_react9.useCallback)(offset=>{dispatch({type:"move_to_offset",payload:{offset}})},[dispatch]);const returnValue=(0,import_react9.useMemo)(()=>({get lines(){return stateRef.current.lines},get text(){return stateRef.current.lines.join("\n")},get cursor(){return[stateRef.current.cursorRow,stateRef.current.cursorCol]},preferredCol,selectionAnchor,allVisualLines:visualLines,viewportVisualLines:renderedVisualLines,visualCursor,visualScrollRow,visualToLogicalMap,setText,insert,newline,backspace,del,move,undo,redo,replaceRange,replaceRangeByOffset,moveToOffset,deleteWordLeft,deleteWordRight,killLineRight,killLineLeft,handleInput,openInExternalEditor,vimDeleteWordForward,vimDeleteWordBackward,vimDeleteWordEnd,vimChangeWordForward,vimChangeWordBackward,vimChangeWordEnd,vimDeleteLine,vimChangeLine,vimDeleteToEndOfLine,vimChangeToEndOfLine,vimChangeMovement,vimDeleteMovement,vimMoveLeft,vimMoveRight,vimMoveUp,vimMoveDown,vimMoveWordForward,vimMoveWordBackward,vimMoveWordEnd,vimDeleteChar,vimInsertAtCursor,vimAppendAtCursor,vimOpenLineBelow,vimOpenLineAbove,vimAppendAtLineEnd,vimInsertAtLineStart,vimMoveToLineStart,vimMoveToLineEnd,vimMoveToFirstNonWhitespace,vimMoveToFirstLine,vimMoveToLastLine,vimMoveToLine,vimEscapeInsertMode}),[preferredCol,selectionAnchor,visualLines,renderedVisualLines,visualCursor,visualScrollRow,setText,insert,newline,backspace,del,move,undo,redo,replaceRange,replaceRangeByOffset,moveToOffset,deleteWordLeft,deleteWordRight,killLineRight,killLineLeft,handleInput,openInExternalEditor,vimDeleteWordForward,vimDeleteWordBackward,vimDeleteWordEnd,vimChangeWordForward,vimChangeWordBackward,vimChangeWordEnd,vimDeleteLine,vimChangeLine,vimDeleteToEndOfLine,vimChangeToEndOfLine,vimChangeMovement,vimDeleteMovement,vimMoveLeft,vimMoveRight,vimMoveUp,vimMoveDown,vimMoveWordForward,vimMoveWordBackward,vimMoveWordEnd,vimDeleteChar,vimInsertAtCursor,vimAppendAtCursor,vimOpenLineBelow,vimOpenLineAbove,vimAppendAtLineEnd,vimInsertAtLineStart,vimMoveToLineStart,vimMoveToLineEnd,vimMoveToFirstNonWhitespace,vimMoveToFirstLine,vimMoveToLastLine,vimMoveToLine,vimEscapeInsertMode,visualToLogicalMap]);return returnValue}__name(useTextBuffer,"useTextBuffer");init_esbuild_shims();var import_react10=__toESM(require_react(),1);var debugLogger3=createDebugLogger("PREFERRED_EDITOR");function usePreferredEditor(){const settings=useSettings();return(0,import_react10.useMemo)(()=>{const raw=settings.merged.general?.preferredEditor??"";if(raw&&!isValidEditorType(raw)){debugLogger3.warn(`[usePreferredEditor] invalid preferredEditor value "${raw}", ignoring`);return void 0}if(isValidEditorType(raw)&&!allowEditorTypeInSandbox(raw)){debugLogger3.warn(`[usePreferredEditor] editor "${raw}" is not allowed in sandbox mode, ignoring`);return void 0}return isValidEditorType(raw)?raw:void 0},[settings.merged.general?.preferredEditor])}__name(usePreferredEditor,"usePreferredEditor");init_esbuild_shims();function keyToAnsi(key){if(key.ctrl){if(key.name>="a"&&key.name<="z"){return String.fromCharCode(key.name.charCodeAt(0)-"a".charCodeAt(0)+1)}switch(key.name){case"c":return"";default:break}}switch(key.name){case"up":return"\x1B[A";case"down":return"\x1B[B";case"right":return"\x1B[C";case"left":return"\x1B[D";case"escape":return"\x1B";case"tab":return" ";case"backspace":return"\x7F";case"delete":return"\x1B[3~";case"home":return"\x1B[H";case"end":return"\x1B[F";case"pageup":return"\x1B[5~";case"pagedown":return"\x1B[6~";default:break}if(key.name==="return"){return"\r"}if(!key.ctrl&&!key.meta&&key.sequence){return key.sequence}return null}__name(keyToAnsi,"keyToAnsi");init_esbuild_shims();var import_react31=__toESM(require_react(),1);init_esbuild_shims();import crypto from"node:crypto";init_esbuild_shims();var import_react11=__toESM(require_react(),1);var import_jsx_runtime4=__toESM(require_jsx_runtime(),1);var debugLogger4=createDebugLogger("CODE_COLORIZER");var STRUCTURAL_BOX_RE=/[│├└┌┐┘┬┴┼]/;var CJK_RE=/[\u4E00-\u9FFF\u3400-\u4DBF]/g;function looksLikeDiagramOrArt(line){const trimmed=line.trim();if(trimmed.length===0)return false;if(STRUCTURAL_BOX_RE.test(trimmed)){return true}const cjkMatches=trimmed.match(CJK_RE)||[];const totalChars=trimmed.replace(/\s/g,"").length;if(totalChars>0&&cjkMatches.length/totalChars>.3){return true}return false}__name(looksLikeDiagramOrArt,"looksLikeDiagramOrArt");function renderHastNode(node,theme2,inheritedColor){if(node.type==="text"){const color=inheritedColor||theme2.defaultColor;return(0,import_jsx_runtime4.jsx)(Text,{color,children:node.value})}if(node.type==="element"){const nodeClasses=node.properties?.["className"]||[];let elementColor=void 0;for(let i=nodeClasses.length-1;i>=0;i--){const color=theme2.getInkColor(nodeClasses[i]);if(color){elementColor=color;break}}const colorToPassDown=elementColor||inheritedColor;const children=node.children?.map((child,index)=>(0,import_jsx_runtime4.jsx)(import_react11.default.Fragment,{children:renderHastNode(child,theme2,colorToPassDown)},index));return(0,import_jsx_runtime4.jsx)(import_react11.default.Fragment,{children})}if(node.type==="root"){if(!node.children||node.children.length===0){return null}return node.children?.map((child,index)=>(0,import_jsx_runtime4.jsx)(import_react11.default.Fragment,{children:renderHastNode(child,theme2,inheritedColor)},index))}return null}__name(renderHastNode,"renderHastNode");function ensureLowlightLoading(){const ll=getLowlightInstance();if(ll)return ll;if(!isLowlightCoolingDown()){void loadLowlight().catch(err=>{debugLogger4.error("[CodeColorizer] failed to load lowlight:",err)})}return null}__name(ensureLowlightLoading,"ensureLowlightLoading");function highlightAndRenderLine(line,language,theme2,lowlight){if(!lowlight){return line}if(!language&&looksLikeDiagramOrArt(line)){return line}try{const getHighlightedLine=__name(()=>!language||!lowlight.registered(language)?lowlight.highlightAuto(line):lowlight.highlight(language,line),"getHighlightedLine");const renderedNode=renderHastNode(getHighlightedLine(),theme2,void 0);return renderedNode!==null?renderedNode:line}catch(_error){return line}}__name(highlightAndRenderLine,"highlightAndRenderLine");function colorizeLine(line,language,theme2){const activeTheme=theme2||themeManager.getActiveTheme();return highlightAndRenderLine(line,language,activeTheme,ensureLowlightLoading())}__name(colorizeLine,"colorizeLine");function colorizeCode(code,language,availableHeight,maxWidth,options={}){const{theme:theme2,settings,tabWidth=4,startLineNumber=1}=options;const firstLineNumber=Math.max(1,Math.trunc(startLineNumber));const codeToHighlight=code.replace(/\n$/,"").replace(/\t/g," ".repeat(tabWidth));const activeTheme=theme2||themeManager.getActiveTheme();const showLineNumbers=settings?.merged.ui?.showLineNumbers??true;const lowlight=ensureLowlightLoading();try{let lines=codeToHighlight.split("\n");const padWidth=String(lines.length+firstLineNumber-1).length;let hiddenLinesCount=0;if(availableHeight!==void 0){availableHeight=Math.max(availableHeight,MINIMUM_MAX_HEIGHT);if(lines.length>availableHeight){const sliceIndex=lines.length-availableHeight;hiddenLinesCount=sliceIndex;lines=lines.slice(sliceIndex)}}return(0,import_jsx_runtime4.jsx)(MaxSizedBox,{maxHeight:availableHeight,maxWidth,additionalHiddenLinesCount:hiddenLinesCount,overflowDirection:"top",children:lines.map((line,index)=>{const contentToRender=highlightAndRenderLine(line,language,activeTheme,lowlight);return(0,import_jsx_runtime4.jsxs)(Box_default,{children:[showLineNumbers&&(0,import_jsx_runtime4.jsx)(Text,{color:activeTheme.colors.Gray,selectable:false,children:`${String(index+firstLineNumber+hiddenLinesCount).padStart(padWidth," ")} `}),(0,import_jsx_runtime4.jsx)(Text,{color:activeTheme.defaultColor,wrap:"wrap",children:contentToRender})]},index)})})}catch(error){debugLogger4.error(`[colorizeCode] Error highlighting code for language "${language}":`,error);const lines=codeToHighlight.split("\n");const padWidth=String(lines.length+firstLineNumber-1).length;return(0,import_jsx_runtime4.jsx)(MaxSizedBox,{maxHeight:availableHeight,maxWidth,overflowDirection:"top",children:lines.map((line,index)=>(0,import_jsx_runtime4.jsxs)(Box_default,{children:[showLineNumbers&&(0,import_jsx_runtime4.jsx)(Text,{color:activeTheme.defaultColor,selectable:false,children:`${String(index+firstLineNumber).padStart(padWidth," ")} `}),(0,import_jsx_runtime4.jsx)(Text,{color:activeTheme.colors.Gray,children:line})]},index))})}}__name(colorizeCode,"colorizeCode");var import_jsx_runtime5=__toESM(require_jsx_runtime(),1);function parseDiffWithLineNumbers(diffContent){const lines=diffContent.split("\n");const result=[];let currentOldLine=0;let currentNewLine=0;let inHunk=false;const hunkHeaderRegex=/^@@ -(\d+),?\d* \+(\d+),?\d* @@/;for(const line of lines){const hunkMatch=line.match(hunkHeaderRegex);if(hunkMatch){currentOldLine=parseInt(hunkMatch[1],10);currentNewLine=parseInt(hunkMatch[2],10);inHunk=true;result.push({type:"hunk",content:line});currentOldLine--;currentNewLine--;continue}if(!inHunk){if(line.startsWith("--- ")){continue}continue}if(line.startsWith("+")){currentNewLine++;result.push({type:"add",newLine:currentNewLine,content:line.substring(1)})}else if(line.startsWith("-")){currentOldLine++;result.push({type:"del",oldLine:currentOldLine,content:line.substring(1)})}else if(line.startsWith(" ")){currentOldLine++;currentNewLine++;result.push({type:"context",oldLine:currentOldLine,newLine:currentNewLine,content:line.substring(1)})}else if(line.startsWith("\\")){result.push({type:"other",content:line})}}return result}__name(parseDiffWithLineNumbers,"parseDiffWithLineNumbers");var DEFAULT_TAB_WIDTH=4;var DiffRenderer=__name(({diffContent,filename,tabWidth=DEFAULT_TAB_WIDTH,availableTerminalHeight,contentWidth,theme:theme2,settings})=>{const screenReaderEnabled=use_is_screen_reader_enabled_default();if(!diffContent||typeof diffContent!=="string"){return(0,import_jsx_runtime5.jsx)(Text,{color:theme.status.warning,children:"No diff content."})}const parsedLines=parseDiffWithLineNumbers(diffContent);if(parsedLines.length===0){return(0,import_jsx_runtime5.jsx)(Box_default,{borderStyle:"round",borderColor:theme.border.default,padding:1,children:(0,import_jsx_runtime5.jsx)(Text,{dimColor:true,children:"No changes detected."})})}if(screenReaderEnabled){return(0,import_jsx_runtime5.jsx)(Box_default,{flexDirection:"column",children:parsedLines.map((line,index)=>(0,import_jsx_runtime5.jsxs)(Text,{children:[line.type,": ",line.content]},index))})}const isNewFile=parsedLines.every(line=>line.type==="add"||line.type==="hunk"||line.type==="other"||line.content.startsWith("diff --git")||line.content.startsWith("new file mode"));let renderedOutput;if(isNewFile){const addedContent=parsedLines.filter(line=>line.type==="add").map(line=>line.content).join("\n");const fileExtension=filename?.split(".").pop()||null;const language=fileExtension?getLanguageFromExtension(fileExtension):null;renderedOutput=colorizeCode(addedContent,language,availableTerminalHeight,contentWidth,{theme:theme2,settings,tabWidth})}else{renderedOutput=renderDiffContent(parsedLines,filename,tabWidth,availableTerminalHeight,contentWidth,settings)}return renderedOutput},"DiffRenderer");var renderDiffContent=__name((parsedLines,filename,tabWidth=DEFAULT_TAB_WIDTH,availableTerminalHeight,contentWidth,settings)=>{const normalizedLines=parsedLines.map(line=>({...line,content:line.content.replace(/\t/g," ".repeat(tabWidth))}));const displayableLines=normalizedLines.filter(l=>l.type!=="hunk"&&l.type!=="other");if(displayableLines.length===0){return(0,import_jsx_runtime5.jsx)(Box_default,{borderStyle:"round",borderColor:theme.border.default,padding:1,children:(0,import_jsx_runtime5.jsx)(Text,{dimColor:true,children:"No changes detected."})})}const showLineNumbers=settings?.merged.ui?.showLineNumbers??true;const maxLineNumber=Math.max(0,...displayableLines.map(l=>l.oldLine??0),...displayableLines.map(l=>l.newLine??0));const gutterWidth=Math.max(1,maxLineNumber.toString().length);const fileExtension=filename?.split(".").pop()||null;const language=fileExtension?getLanguageFromExtension(fileExtension):null;let baseIndentation=Infinity;for(const line of displayableLines){if(line.content.trim()==="")continue;const firstCharIndex=line.content.search(/\S/);const currentIndent=firstCharIndex===-1?0:firstCharIndex;baseIndentation=Math.min(baseIndentation,currentIndent)}if(!isFinite(baseIndentation)){baseIndentation=0}const key=filename?`diff-box-${filename}`:`diff-box-${crypto.createHash("sha1").update(JSON.stringify(parsedLines)).digest("hex")}`;let lastLineNumber=null;const MAX_CONTEXT_LINES_WITHOUT_GAP=5;return(0,import_jsx_runtime5.jsx)(MaxSizedBox,{maxHeight:availableTerminalHeight,maxWidth:contentWidth,children:displayableLines.reduce((acc,line,index)=>{let relevantLineNumberForGapCalc=null;if(line.type==="add"||line.type==="context"){relevantLineNumberForGapCalc=line.newLine??null}else if(line.type==="del"){relevantLineNumberForGapCalc=line.oldLine??null}if(lastLineNumber!==null&&relevantLineNumberForGapCalc!==null&&relevantLineNumberForGapCalc>lastLineNumber+MAX_CONTEXT_LINES_WITHOUT_GAP+1){acc.push((0,import_jsx_runtime5.jsx)(Box_default,{children:(0,import_jsx_runtime5.jsx)(Text,{wrap:"truncate",color:theme.text.secondary,children:"\u2550".repeat(contentWidth)})},`gap-${index}`))}const lineKey=`diff-line-${index}`;let gutterNumStr="";let prefixSymbol=" ";switch(line.type){case"add":gutterNumStr=(line.newLine??"").toString();prefixSymbol="+";lastLineNumber=line.newLine??null;break;case"del":gutterNumStr=(line.oldLine??"").toString();prefixSymbol="-";if(line.oldLine!==void 0){lastLineNumber=line.oldLine}break;case"context":gutterNumStr=(line.newLine??"").toString();prefixSymbol=" ";lastLineNumber=line.newLine??null;break;default:return acc}const displayContent=line.content.substring(baseIndentation);acc.push((0,import_jsx_runtime5.jsxs)(Box_default,{flexDirection:"row",children:[showLineNumbers&&(0,import_jsx_runtime5.jsxs)(Text,{selectable:false,color:theme.text.secondary,backgroundColor:line.type==="add"?theme.background.diff.added:line.type==="del"?theme.background.diff.removed:void 0,children:[gutterNumStr.padStart(gutterWidth)," "]}),line.type==="context"?(0,import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment,{children:[(0,import_jsx_runtime5.jsxs)(Text,{children:[prefixSymbol," "]}),(0,import_jsx_runtime5.jsx)(Text,{wrap:"wrap",children:colorizeLine(displayContent,language)})]}):(0,import_jsx_runtime5.jsxs)(Text,{backgroundColor:line.type==="add"?theme.background.diff.added:theme.background.diff.removed,wrap:"wrap",children:[(0,import_jsx_runtime5.jsx)(Text,{color:line.type==="add"?theme.status.success:theme.status.error,children:prefixSymbol})," ",colorizeLine(displayContent,language)]})]},lineKey));return acc},[])},key)},"renderDiffContent");var getLanguageFromExtension=__name(extension=>{const languageMap={js:"javascript",ts:"typescript",py:"python",json:"json",css:"css",html:"html",sh:"bash",md:"markdown",yaml:"yaml",yml:"yaml",txt:"plaintext",java:"java",c:"c",cpp:"cpp",rb:"ruby"};return languageMap[extension]||null},"getLanguageFromExtension");init_esbuild_shims();var import_react14=__toESM(require_react(),1);init_esbuild_shims();init_esbuild_shims();var TABLE_CHROME_ROWS=5;var TABLE_MAX_ROW_LINES=4;var TABLE_ROW_RE=/^\s*\|(.+)\|\s*$/;var TABLE_SEPARATOR_RE=/^(?=.*\|)\s*\|?\s*(:?-+:?)\s*(\|\s*(:?-+:?)\s*)*\|?\s*$/;var CODE_FENCE_RE=/^ *(`{3,}|~{3,}) *([^`]*)$/;function readTableInlineMathSpan(row,index){return readInlineMathSpanAt(row,index)}__name(readTableInlineMathSpan,"readTableInlineMathSpan");function splitMarkdownTableRow(row){const cells=[];let current="";let activeCodeFenceLength=0;for(let index=0;index<row.length;index++){const char=row[index];if(char==="\\"){const next=row[index+1];if(next==="|"){current+="|";index+=1;continue}current+=char;continue}if(char==="`"){let runLength=1;while(row[index+runLength]==="`"){runLength+=1}if(activeCodeFenceLength===0){activeCodeFenceLength=runLength}else if(runLength===activeCodeFenceLength){activeCodeFenceLength=0}current+="`".repeat(runLength);index+=runLength-1;continue}if(char==="$"&&activeCodeFenceLength===0){const mathSpan=readTableInlineMathSpan(row,index);if(mathSpan){current+=mathSpan;index+=mathSpan.length-1;continue}}if(char==="|"&&activeCodeFenceLength===0){cells.push(current.trim());current="";continue}current+=char}cells.push(current.trim());return cells}__name(splitMarkdownTableRow,"splitMarkdownTableRow");function estimateWrappedRows(line,width){if(width<=0)return 1;return Math.max(1,Math.ceil(getCachedStringWidth(line)/width))}__name(estimateWrappedRows,"estimateWrappedRows");function isTableStart(lines,i){const header=lines[i];if(header===void 0||i+1>=lines.length)return false;const headerMatch=TABLE_ROW_RE.exec(header);if(!headerMatch)return false;const separator=lines[i+1];if(!TABLE_SEPARATOR_RE.test(separator))return false;const headerCols=splitMarkdownTableRow(headerMatch[1]).length;const sepCols=splitMarkdownTableRow(separator).filter(cell=>cell.length>0).length;return headerCols===sepCols}__name(isTableStart,"isTableStart");function fitPendingSlice(allLines,contentWidth,budget,tableClampRows){let rendered=0;let kept=allLines.length;let codeFence="";for(let i=0;i<allLines.length;){const line=allLines[i];const fenceMatch=CODE_FENCE_RE.exec(line);if(codeFence){if(fenceMatch&&fenceMatch[1].startsWith(codeFence[0])&&fenceMatch[1].length>=codeFence.length){codeFence=""}rendered+=estimateWrappedRows(line,contentWidth);if(rendered>budget){kept=i;break}i++;continue}if(fenceMatch){codeFence=fenceMatch[1];rendered+=estimateWrappedRows(line,contentWidth);if(rendered>budget){kept=i;break}i++;continue}if(isTableStart(allLines,i)){let j=i+2;while(j<allLines.length&&TABLE_ROW_RE.test(allLines[j]))j++;const dataRows=j-(i+2);const headerCells=splitMarkdownTableRow(TABLE_ROW_RE.exec(allLines[i])[1]);const colCount=headerCells.length;const minHorizontalWidth=Math.max(24,6*colCount+5);const perColWidth=Math.max(3,Math.floor((contentWidth-(1+3*colCount)-4)/colCount));let contentRows=0;let verticalRows=0;let maxRowLines=1;for(const label of headerCells){maxRowLines=Math.max(maxRowLines,estimateWrappedRows(label,perColWidth))}contentRows+=maxRowLines;for(let r=i+2;r<j;r++){const cells=splitMarkdownTableRow(TABLE_ROW_RE.exec(allLines[r])[1]);let rowMax=1;for(let colIdx=0;colIdx<cells.length;colIdx++){const value=cells[colIdx];rowMax=Math.max(rowMax,estimateWrappedRows(value,perColWidth));const label=headerCells[colIdx]??"";verticalRows+=estimateWrappedRows(label?`${label}: ${value}`:value,contentWidth)}contentRows+=rowMax;if(r===i+2){maxRowLines=Math.max(maxRowLines,rowMax)}}const usesVertical=dataRows>0&&(contentWidth<minHorizontalWidth||maxRowLines>TABLE_MAX_ROW_LINES);const rows=usesVertical?verticalRows+Math.max(0,dataRows-1)+2:contentRows+Math.max(0,dataRows-1)+TABLE_CHROME_ROWS;const cost=Math.min(rows,tableClampRows+2);if(rendered+cost>budget&&i>0){kept=i;break}rendered+=cost;i=j;if(rendered>=budget){kept=j;break}}else{rendered+=estimateWrappedRows(line,contentWidth);if(rendered>budget){kept=i;break}i++}}return{keptLines:kept,clipped:kept<allLines.length}}__name(fitPendingSlice,"fitPendingSlice");init_esbuild_shims();var COMMAND_REPLACEMENTS={"\\alpha":"\u03B1","\\beta":"\u03B2","\\gamma":"\u03B3","\\delta":"\u03B4","\\epsilon":"\u03B5","\\varepsilon":"\u03B5","\\theta":"\u03B8","\\lambda":"\u03BB","\\mu":"\u03BC","\\pi":"\u03C0","\\rho":"\u03C1","\\sigma":"\u03C3","\\tau":"\u03C4","\\phi":"\u03C6","\\varphi":"\u03C6","\\omega":"\u03C9","\\Gamma":"\u0393","\\Delta":"\u0394","\\Theta":"\u0398","\\Lambda":"\u039B","\\Pi":"\u03A0","\\Sigma":"\u03A3","\\Phi":"\u03A6","\\Omega":"\u03A9","\\sum":"\u03A3","\\prod":"\u220F","\\int":"\u222B","\\infty":"\u221E","\\partial":"\u2202","\\sqrt":"\u221A","\\times":"\xD7","\\cdot":"\xB7","\\pm":"\xB1","\\leq":"\u2264","\\geq":"\u2265","\\neq":"\u2260","\\approx":"\u2248","\\rightarrow":"\u2192","\\to":"\u2192","\\leftarrow":"\u2190","\\Rightarrow":"\u21D2","\\Leftarrow":"\u21D0"};var COMMAND_REPLACEMENT_REGEX=new RegExp(Object.keys(COMMAND_REPLACEMENTS).sort((a,b)=>b.length-a.length).map(command=>command.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"g");var MAX_RENDER_DEPTH=10;var SUPERSCRIPT={"0":"\u2070","1":"\xB9","2":"\xB2","3":"\xB3","4":"\u2074","5":"\u2075","6":"\u2076","7":"\u2077","8":"\u2078","9":"\u2079","+":"\u207A","-":"\u207B","=":"\u207C","(":"\u207D",")":"\u207E",n:"\u207F",i:"\u2071"};var SUBSCRIPT={"0":"\u2080","1":"\u2081","2":"\u2082","3":"\u2083","4":"\u2084","5":"\u2085","6":"\u2086","7":"\u2087","8":"\u2088","9":"\u2089","+":"\u208A","-":"\u208B","=":"\u208C","(":"\u208D",")":"\u208E",a:"\u2090",e:"\u2091",h:"\u2095",i:"\u1D62",j:"\u2C7C",k:"\u2096",l:"\u2097",m:"\u2098",n:"\u2099",o:"\u2092",p:"\u209A",r:"\u1D63",s:"\u209B",t:"\u209C",u:"\u1D64",v:"\u1D65",x:"\u2093"};function convertScript(value,map){return[...value].map(char=>map[char]??char).join("")}__name(convertScript,"convertScript");function findBalancedGroup(input,openBraceIndex){if(input[openBraceIndex]!=="{"){return null}let depth=0;for(let index=openBraceIndex;index<input.length;index++){const char=input[index];if(char==="\\"){index+=1;continue}if(char==="{"){depth+=1;continue}if(char!=="}"){continue}depth-=1;if(depth===0){return{value:input.slice(openBraceIndex+1,index),end:index+1}}}return null}__name(findBalancedGroup,"findBalancedGroup");function replaceBraceCommand(input,command,groupCount,render){const marker=`\\${command}`;let output="";let index=0;while(index<input.length){if(!input.startsWith(marker,index)){output+=input[index];index+=1;continue}const groups=[];let cursor=index+marker.length;for(let groupIndex=0;groupIndex<groupCount;groupIndex++){const group=findBalancedGroup(input,cursor);if(!group){groups.length=0;break}groups.push(group.value);cursor=group.end}if(groups.length!==groupCount){output+=input[index];index+=1;continue}output+=render(groups);index=cursor}return output}__name(replaceBraceCommand,"replaceBraceCommand");function renderInlineLatex(input,depth=0){let output=input.trim();if(depth>MAX_RENDER_DEPTH){return output}output=replaceBraceCommand(output,"frac",2,([numerator,denominator])=>`${renderInlineLatex(numerator??"",depth+1)}/${renderInlineLatex(denominator??"",depth+1)}`);output=replaceBraceCommand(output,"sqrt",1,([radicand])=>`\u221A(${renderInlineLatex(radicand??"",depth+1)})`);output=output.replace(/\^\{([^{}]+)\}|\^([A-Za-z0-9+\-=()])/g,(_match,braced,single)=>convertScript(braced??single??"",SUPERSCRIPT));output=output.replace(/_\{([^{}]+)\}|_([A-Za-z0-9+\-=()])/g,(_match,braced,single)=>convertScript(braced??single??"",SUBSCRIPT));output=output.replace(COMMAND_REPLACEMENT_REGEX,command=>COMMAND_REPLACEMENTS[command]??command);return output.replace(/\\(?:left|right)\./g,"").replace(/\\left|\\right/g,"").replace(/\\,/g," ").replace(/\s+/g," ").trim()}__name(renderInlineLatex,"renderInlineLatex");var import_jsx_runtime6=__toESM(require_jsx_runtime(),1);var MIN_COLUMN_WIDTH=3;var ABSOLUTE_MIN_HORIZONTAL_TABLE_WIDTH=24;var SAFETY_MARGIN=4;var INLINE_MARKDOWN_REGEX=new RegExp(String.raw`(\*\*.*?\*\*|\*.*?\*|(?<![\w\u3400-\u9fff])_(?!_)[^_]*_(?![\w\u3400-\u9fff])|~~.*?~~|${MD_LINK_PATTERN}|`+String.raw`${INLINE_CODE_SPAN_PATTERN_SOURCE}|<u>.*?<\/u>|${BARE_URL_PATTERN})`,"g");var INK_COLOR_TO_ANSI={black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,gray:90,grey:90,blackbright:90,redbright:91,greenbright:92,yellowbright:93,bluebright:94,magentabright:95,cyanbright:96,whitebright:97};var HEX_COLOR_RE=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;var ESC="\x1B";function getColorCode(color){if(!color)return"";if(color.startsWith("#")){if(!HEX_COLOR_RE.test(color))return"";const hex=color.length===4?color[1]+color[1]+color[2]+color[2]+color[3]+color[3]:color.slice(1);const r=parseInt(hex.slice(0,2),16);const g=parseInt(hex.slice(2,4),16);const b=parseInt(hex.slice(4,6),16);return`\x1B[38;2;${r};${g};${b}m`}const code=INK_COLOR_TO_ANSI[color.toLowerCase()];if(code!==void 0)return`\x1B[${code}m`;return""}__name(getColorCode,"getColorCode");function applyColor(text,color){const code=getColorCode(color);if(!code)return text;return`${code}${text}\x1B[39m`}__name(applyColor,"applyColor");function recolorAfterResets(text,colorCode){const fgReset="\x1B[39m";const fullReset="\x1B[0m";return text.split(fgReset).join(fgReset+colorCode).split(fullReset).join(fullReset+colorCode)}__name(recolorAfterResets,"recolorAfterResets");function updateActiveForeground(activeForeground,paramsText){const params=paramsText.length>0?paramsText.split(";").map(param=>Number(param)):[0];let foreground=activeForeground;for(let index=0;index<params.length;index++){const code=params[index];if(!Number.isFinite(code)){continue}if(code===0||code===39){foreground=""}else if(code>=30&&code<=37||code>=90&&code<=97){foreground=`\x1B[${code}m`}else if(code===38){const mode=params[index+1];if(mode===5&&Number.isFinite(params[index+2])){foreground=`\x1B[38;5;${params[index+2]}m`;index+=2}else if(mode===2&&Number.isFinite(params[index+2])&&Number.isFinite(params[index+3])&&Number.isFinite(params[index+4])){foreground=`\x1B[38;2;${params[index+2]};${params[index+3]};${params[index+4]}m`;index+=4}}}return foreground}__name(updateActiveForeground,"updateActiveForeground");function readSgrSequence(text,index){if(text[index]!==ESC||text[index+1]!=="["){return null}const endIndex=text.indexOf("m",index+2);if(endIndex===-1){return null}const paramsText=text.slice(index+2,endIndex);if(!/^[0-9;]*$/.test(paramsText)){return null}return{sequence:text.slice(index,endIndex+1),paramsText,endIndex}}__name(readSgrSequence,"readSgrSequence");function preserveForegroundAcrossLineBreaks(text){let activeForeground="";let result="";let lastIndex=0;let index=0;while(index<text.length){const sgr=readSgrSequence(text,index);if(!sgr){index+=1;continue}const segment2=text.slice(lastIndex,index);result+=activeForeground?segment2.replace(/\n/g,`\x1B[39m
|
|
4
4
|
${activeForeground}`):segment2;result+=sgr.sequence;activeForeground=updateActiveForeground(activeForeground,sgr.paramsText);index=sgr.endIndex+1;lastIndex=index}const segment=text.slice(lastIndex);result+=activeForeground?segment.replace(/\n/g,`\x1B[39m
|
|
5
5
|
${activeForeground}`):segment;return result}__name(preserveForegroundAcrossLineBreaks,"preserveForegroundAcrossLineBreaks");var ansiFmt={bold:__name(t2=>`\x1B[1m${t2}\x1B[22m`,"bold"),italic:__name(t2=>`\x1B[3m${t2}\x1B[23m`,"italic"),underline:__name(t2=>`\x1B[4m${t2}\x1B[24m`,"underline"),strikethrough:__name(t2=>`\x1B[9m${t2}\x1B[29m`,"strikethrough")};function renderMarkdownToAnsi(text,enableInlineMath=false){const canHyperlink=supportsHyperlinks();let result="";let lastIndex=0;for(const token of mergeInlineMathMatches(text,INLINE_MARKDOWN_REGEX,enableInlineMath)){const index=token.kind==="math"?token.span.index:token.match.index??0;const prose=text.slice(lastIndex,index);result+=token.kind==="math"?unescapeMarkdownBeforeMath(prose):unescapeMarkdownDollars(prose);if(token.kind==="math"){result+=applyColor(renderInlineLatex(unescapeMarkdownDollars(token.span.content)),theme.text.accent);lastIndex=index+token.span.raw.length;continue}const match=token.match;const fullMatch=match[0];let rendered=null;if(fullMatch.startsWith("**")&&fullMatch.endsWith("**")&&fullMatch.length>4){rendered=ansiFmt.bold(unescapeMarkdownDollars(fullMatch.slice(2,-2)))}else if(fullMatch.length>2&&(fullMatch.startsWith("*")&&fullMatch.endsWith("*")||fullMatch.startsWith("_")&&fullMatch.endsWith("_"))&&!/\w/.test(text.substring(index-1,index))&&!/\w/.test(text.substring(index+fullMatch.length,index+fullMatch.length+1))&&!/\S[./\\]/.test(text.substring(index-2,index))&&!/[./\\]\S/.test(text.substring(index+fullMatch.length,index+fullMatch.length+2))){rendered=ansiFmt.italic(unescapeMarkdownDollars(fullMatch.slice(1,-1)))}else if(fullMatch.startsWith("~~")&&fullMatch.endsWith("~~")&&fullMatch.length>4){rendered=ansiFmt.strikethrough(unescapeMarkdownDollars(fullMatch.slice(2,-2)))}else if(fullMatch.startsWith("`")&&fullMatch.endsWith("`")&&fullMatch.length>1){const codeMatch=fullMatch.match(/^(`+)(.+?)\1$/s);if(codeMatch?.[2]){rendered=applyColor(codeMatch[2],theme.text.code)}}else if(fullMatch.startsWith("[")&&fullMatch.includes("](")&&fullMatch.endsWith(")")){const linkMatch=fullMatch.match(MD_LINK_CAPTURE);if(linkMatch){const labelText=unescapeMarkdownDollars(linkMatch[1]??"");const url=linkMatch[2]??"";if(shouldWrapMarkdownLink(url,canHyperlink)){const safeLabel=sanitizeForOsc(labelText);const safeUrl=sanitizeForOsc(url);const visibleLabel=applyColor(safeLabel||safeUrl,theme.text.link);const envelope=`${osc8Open(url)}${visibleLabel}${osc8Close()}`;rendered=labelMayDeceive(safeLabel,safeUrl)?`${envelope} ${applyColor(`(${safeUrl})`,theme.text.link)}`:envelope}else{rendered=`${labelText} ${applyColor(`(${url})`,theme.text.link)}`}}}else if(fullMatch.startsWith("<u>")&&fullMatch.endsWith("</u>")&&fullMatch.length>7){rendered=ansiFmt.underline(unescapeMarkdownDollars(fullMatch.slice(3,-4)))}else if(/^https?:\/\//.test(fullMatch)){const visible=applyColor(fullMatch,theme.text.link);if(canHyperlink){const trimmedUrl=trimTrailingUrlPunctuation(fullMatch,text[index+fullMatch.length]);rendered=isSafeOscScheme(trimmedUrl)?`${osc8Open(trimmedUrl)}${visible}${osc8Close()}`:visible}else{rendered=visible}}result+=rendered??unescapeMarkdownDollars(fullMatch);lastIndex=index+fullMatch.length}result+=unescapeMarkdownDollars(text.slice(lastIndex));return result}__name(renderMarkdownToAnsi,"renderMarkdownToAnsi");function padAligned(content,displayWidth,targetWidth,align){const padding=Math.max(0,targetWidth-displayWidth);if(align==="center"){const leftPad=Math.floor(padding/2);return" ".repeat(leftPad)+content+" ".repeat(padding-leftPad)}if(align==="right"){return" ".repeat(padding)+content}return content+" ".repeat(padding)}__name(padAligned,"padAligned");function wrapText(text,width,options){if(width<=0)return[text];const trimmedText=text.trimEnd();const wrapped=wrapAnsi(trimmedText,width,{hard:options?.hard??false,trim:false,wordWrap:true});const lines=preserveForegroundAcrossLineBreaks(wrapped).split("\n");while(lines.length>1&&lines[lines.length-1].length===0){lines.pop()}return lines.length>0?lines:[""]}__name(wrapText,"wrapText");var TableRenderer=__name(({headers,rows,contentWidth,aligns,enableInlineMath=false,isStreaming=false,maxHeight})=>{const colCount=headers.length;if(colCount===0){return(0,import_jsx_runtime6.jsx)(Box_default,{})}const clampToMaxHeight=__name(text=>{if(maxHeight===void 0)return text;const all=text.split("\n");if(all.length<=maxHeight)return text;const kept=all.slice(0,Math.max(1,maxHeight-1));kept.push(applyColor("\u2026 more rows streaming \u2026",theme.text.secondary));return kept.join("\n")},"clampToMaxHeight");const computeMetrics=__name(text=>{const rendered=renderMarkdownToAnsi(text,enableInlineMath);const visible=stripAnsi(rendered);const words=visible.split(/\s+/).filter(w=>w.length>0);return{rendered,renderedWidth:getCachedStringWidth(visible),minWordWidth:words.length>0?Math.max(...words.map(w=>getCachedStringWidth(w)),MIN_COLUMN_WIDTH):MIN_COLUMN_WIDTH}},"computeMetrics");const headerMetrics=headers.map(h=>computeMetrics(h));const rowMetrics=rows.map(row=>Array.from({length:colCount},(_,i)=>computeMetrics(row[i]||"")));const minColumnWidths=headers.map((_,colIndex)=>{let maxMin=headerMetrics[colIndex].minWordWidth;for(const row of rowMetrics){maxMin=Math.max(maxMin,row[colIndex].minWordWidth)}return maxMin});const idealWidths=headers.map((_,colIndex)=>{let maxIdeal=Math.max(headerMetrics[colIndex].renderedWidth,MIN_COLUMN_WIDTH);for(const row of rowMetrics){maxIdeal=Math.max(maxIdeal,row[colIndex].renderedWidth)}return maxIdeal});const borderOverhead=1+colCount*3;const availableWidth=Math.max(contentWidth-borderOverhead-SAFETY_MARGIN,colCount*MIN_COLUMN_WIDTH);const totalMin=minColumnWidths.reduce((sum,w)=>sum+w,0);const totalIdeal=idealWidths.reduce((sum,w)=>sum+w,0);let needsHardWrap=false;let columnWidths;if(totalIdeal<=availableWidth){columnWidths=idealWidths}else if(totalMin<=availableWidth){const extraSpace=availableWidth-totalMin;const overflows=idealWidths.map((ideal,i)=>ideal-minColumnWidths[i]);const totalOverflow=overflows.reduce((sum,o)=>sum+o,0);columnWidths=minColumnWidths.map((min,i)=>{if(totalOverflow===0)return min;const extra=Math.floor(overflows[i]/totalOverflow*extraSpace);return min+extra})}else{needsHardWrap=true;const scaleFactor=availableWidth/totalMin;columnWidths=minColumnWidths.map(w=>Math.max(Math.floor(w*scaleFactor),MIN_COLUMN_WIDTH));let excess=columnWidths.reduce((s,w)=>s+w,0)-availableWidth;while(excess>0){const maxW=Math.max(...columnWidths);if(maxW<=MIN_COLUMN_WIDTH)break;const idx=columnWidths.indexOf(maxW);const reduction=Math.min(excess,maxW-MIN_COLUMN_WIDTH);columnWidths[idx]=maxW-reduction;excess-=reduction}}function calculateMaxRowLines(){let maxLines=1;const rowsToMeasure=isStreaming?rowMetrics.slice(0,1):rowMetrics;for(let i=0;i<colCount;i++){const headerWrapped=wrapText(headerMetrics[i].rendered,columnWidths[i],{hard:needsHardWrap});maxLines=Math.max(maxLines,headerWrapped.length)}for(const row of rowsToMeasure){for(let i=0;i<colCount;i++){const cellWrapped=wrapText(row[i].rendered,columnWidths[i],{hard:needsHardWrap});maxLines=Math.max(maxLines,cellWrapped.length)}}return maxLines}__name(calculateMaxRowLines,"calculateMaxRowLines");const maxRowLines=calculateMaxRowLines();const minHorizontalTableWidth=Math.max(ABSOLUTE_MIN_HORIZONTAL_TABLE_WIDTH,colCount*MIN_COLUMN_WIDTH+borderOverhead+SAFETY_MARGIN);const useVerticalFormat=rowMetrics.length>0&&(contentWidth<minHorizontalTableWidth||maxRowLines>TABLE_MAX_ROW_LINES);const getAlign=__name(colIndex=>aligns?.[colIndex]??"left","getAlign");function renderBorderLine(type){const[left,mid,cross,right]={top:["\u250C","\u2500","\u252C","\u2510"],middle:["\u251C","\u2500","\u253C","\u2524"],bottom:["\u2514","\u2500","\u2534","\u2518"]}[type];let line=left;columnWidths.forEach((width,colIndex)=>{line+=mid.repeat(width+2);line+=colIndex<columnWidths.length-1?cross:right});return applyColor(line,theme.border.default)}__name(renderBorderLine,"renderBorderLine");function renderRowLines(renderedCells,isHeader){const cellLines=renderedCells.map((cell,colIndex)=>wrapText(cell,columnWidths[colIndex],{hard:needsHardWrap}));const maxLines=Math.max(...cellLines.map(l=>l.length),1);const offsets=cellLines.map(l=>Math.floor((maxLines-l.length)/2));const borderPipe=applyColor("\u2502",theme.border.default);const result=[];for(let lineIdx=0;lineIdx<maxLines;lineIdx++){let line=borderPipe;for(let colIndex=0;colIndex<colCount;colIndex++){const lines=cellLines[colIndex];const offset=offsets[colIndex];const contentLineIdx=lineIdx-offset;const lineText=contentLineIdx>=0&&contentLineIdx<lines.length?lines[contentLineIdx]:"";const width=columnWidths[colIndex];const displayWidth=getCachedStringWidth(stripAnsi(lineText));const align=aligns?.[colIndex]!=null?getAlign(colIndex):isHeader?"center":"left";const padded=padAligned(lineText,displayWidth,width,align);if(isHeader){const linkCode=getColorCode(theme.text.link);const recolored=linkCode?recolorAfterResets(padded,linkCode):padded;const styledPadded=applyColor(ansiFmt.bold(recolored),theme.text.link);line+=" "+styledPadded+" "+borderPipe}else{const primaryCode=getColorCode(theme.text.primary);const recolored=primaryCode?recolorAfterResets(padded,primaryCode):padded;const styledCell=primaryCode?applyColor(recolored,theme.text.primary):recolored;line+=" "+styledCell+" "+borderPipe}}result.push(line)}return result}__name(renderRowLines,"renderRowLines");function renderVerticalFormat(){const lines=[];const separatorWidth=Math.max(Math.min(contentWidth-1,40),0);const separator=separatorWidth>0?"\u2500".repeat(separatorWidth):"";rowMetrics.forEach((row,rowIndex)=>{if(rowIndex>0){lines.push(separator)}for(let colIndex=0;colIndex<colCount;colIndex++){const rawLabel=headers[colIndex]??`Column ${colIndex+1}`;const label=renderMarkdownToAnsi(rawLabel,enableInlineMath);const value=row[colIndex].rendered.trim().replace(/\n+/g," ").replace(/\s+/g," ").trim();const linkCode=getColorCode(theme.text.link);const recoloredLabel=linkCode?recolorAfterResets(`${label}:`,linkCode):`${label}:`;const primaryCode=getColorCode(theme.text.primary);const styledValue=primaryCode?applyColor(recolorAfterResets(value,primaryCode),theme.text.primary):value;lines.push(`${applyColor(ansiFmt.bold(recoloredLabel),theme.text.link)} ${styledValue}`)}});return lines.join("\n")}__name(renderVerticalFormat,"renderVerticalFormat");if(useVerticalFormat){return(0,import_jsx_runtime6.jsx)(Box_default,{marginY:1,children:(0,import_jsx_runtime6.jsx)(Text,{children:clampToMaxHeight(renderVerticalFormat())})})}const headerRendered=headerMetrics.map(m=>m.rendered);const tableLines=[];tableLines.push(renderBorderLine("top"));tableLines.push(...renderRowLines(headerRendered,true));if(rowMetrics.length>0){tableLines.push(renderBorderLine("middle"));rowMetrics.forEach((row,rowIndex)=>{tableLines.push(...renderRowLines(row.map(m=>m.rendered),false));if(rowIndex<rows.length-1){tableLines.push(renderBorderLine("middle"))}})}tableLines.push(renderBorderLine("bottom"));const maxLineWidth=Math.max(...tableLines.map(line=>getCachedStringWidth(stripAnsi(line))));if(rowMetrics.length>0&&maxLineWidth>contentWidth-SAFETY_MARGIN){return(0,import_jsx_runtime6.jsx)(Box_default,{marginY:1,children:(0,import_jsx_runtime6.jsx)(Text,{children:clampToMaxHeight(renderVerticalFormat())})})}return(0,import_jsx_runtime6.jsx)(Box_default,{flexDirection:"column",marginY:1,children:(0,import_jsx_runtime6.jsx)(Text,{children:clampToMaxHeight(tableLines.join("\n"))})})},"TableRenderer");init_esbuild_shims();var import_react12=__toESM(require_react(),1);var import_jsx_runtime7=__toESM(require_jsx_runtime(),1);var BOLD_MARKER_LENGTH=2;var ITALIC_MARKER_LENGTH=1;var STRIKETHROUGH_MARKER_LENGTH=2;var INLINE_CODE_MARKER_LENGTH=1;var UNDERLINE_TAG_START_LENGTH=3;var UNDERLINE_TAG_END_LENGTH=4;var INLINE_MARKDOWN_REGEX2=new RegExp(String.raw`(\*\*.*?\*\*|\*.*?\*|(?<![\w\u3400-\u9fff])_(?!_)[^_]*_(?![\w\u3400-\u9fff])|~~.*?~~|${MD_LINK_PATTERN}|`+String.raw`${INLINE_CODE_SPAN_PATTERN_SOURCE}|<u>.*?<\/u>|${BARE_URL_PATTERN})`,"g");var debugLogger5=createDebugLogger("INLINE_MARKDOWN");var RenderInlineInternal=__name(({text,textColor=theme.text.primary,enableInlineMath=false})=>{if(!/[*_~`<[]|https?:/.test(text)&&!(enableInlineMath&&text.includes("$"))&&!text.includes("\\$")){return(0,import_jsx_runtime7.jsx)(Text,{color:textColor,children:text})}const nodes=[];let lastIndex=0;const canHyperlink=supportsHyperlinks();for(const token of mergeInlineMathMatches(text,INLINE_MARKDOWN_REGEX2,enableInlineMath)){const index=token.kind==="math"?token.span.index:token.match.index??0;if(index>lastIndex){const prose=text.slice(lastIndex,index);nodes.push((0,import_jsx_runtime7.jsx)(Text,{children:token.kind==="math"?unescapeMarkdownBeforeMath(prose):unescapeMarkdownDollars(prose)},`t-${lastIndex}`))}if(token.kind==="math"){nodes.push((0,import_jsx_runtime7.jsx)(Text,{color:theme.text.accent,children:renderInlineLatex(unescapeMarkdownDollars(token.span.content))},`m-${index}`));lastIndex=index+token.span.raw.length;continue}const match=token.match;const fullMatch=match[0];let renderedNode=null;const key=`m-${index}`;try{if(fullMatch.startsWith("**")&&fullMatch.endsWith("**")&&fullMatch.length>BOLD_MARKER_LENGTH*2){renderedNode=(0,import_jsx_runtime7.jsx)(Text,{bold:true,children:unescapeMarkdownDollars(fullMatch.slice(BOLD_MARKER_LENGTH,-BOLD_MARKER_LENGTH))},key)}else if(fullMatch.length>ITALIC_MARKER_LENGTH*2&&(fullMatch.startsWith("*")&&fullMatch.endsWith("*")||fullMatch.startsWith("_")&&fullMatch.endsWith("_"))&&!/\w/.test(text.substring(index-1,index))&&!/\w/.test(text.substring(index+fullMatch.length,index+fullMatch.length+1))&&!/\S[./\\]/.test(text.substring(index-2,index))&&!/[./\\]\S/.test(text.substring(index+fullMatch.length,index+fullMatch.length+2))){renderedNode=(0,import_jsx_runtime7.jsx)(Text,{italic:true,children:unescapeMarkdownDollars(fullMatch.slice(ITALIC_MARKER_LENGTH,-ITALIC_MARKER_LENGTH))},key)}else if(fullMatch.startsWith("~~")&&fullMatch.endsWith("~~")&&fullMatch.length>STRIKETHROUGH_MARKER_LENGTH*2){renderedNode=(0,import_jsx_runtime7.jsx)(Text,{strikethrough:true,children:unescapeMarkdownDollars(fullMatch.slice(STRIKETHROUGH_MARKER_LENGTH,-STRIKETHROUGH_MARKER_LENGTH))},key)}else if(fullMatch.startsWith("`")&&fullMatch.endsWith("`")&&fullMatch.length>INLINE_CODE_MARKER_LENGTH){const codeMatch=fullMatch.match(/^(`+)(.+?)\1$/s);if(codeMatch&&codeMatch[2]){renderedNode=(0,import_jsx_runtime7.jsx)(Text,{color:theme.text.code,children:codeMatch[2]},key)}}else if(fullMatch.startsWith("[")&&fullMatch.includes("](")&&fullMatch.endsWith(")")){const linkMatch=fullMatch.match(MD_LINK_CAPTURE);if(linkMatch){const linkText=linkMatch[1]??"";const url=linkMatch[2]??"";const wrapOsc8=shouldWrapMarkdownLink(url,canHyperlink);const renderedLinkText=unescapeMarkdownDollars(linkText);const safeLabel=wrapOsc8?sanitizeForOsc(renderedLinkText):renderedLinkText;const safeUrl=wrapOsc8?sanitizeForOsc(url):url;const showUrlSuffix=wrapOsc8&&labelMayDeceive(safeLabel,safeUrl);renderedNode=wrapOsc8?(0,import_jsx_runtime7.jsxs)(Text,{children:[(0,import_jsx_runtime7.jsxs)(Text,{color:theme.text.link,children:[osc8Open(url),safeLabel||safeUrl,osc8Close()]}),showUrlSuffix?(0,import_jsx_runtime7.jsxs)(Text,{color:theme.text.link,children:[" (",safeUrl,")"]}):null]},key):(0,import_jsx_runtime7.jsxs)(Text,{children:[renderedLinkText,(0,import_jsx_runtime7.jsxs)(Text,{color:theme.text.link,children:[" (",url,")"]})]},key)}}else if(fullMatch.startsWith("<u>")&&fullMatch.endsWith("</u>")&&fullMatch.length>UNDERLINE_TAG_START_LENGTH+UNDERLINE_TAG_END_LENGTH-1){renderedNode=(0,import_jsx_runtime7.jsx)(Text,{underline:true,children:unescapeMarkdownDollars(fullMatch.slice(UNDERLINE_TAG_START_LENGTH,-UNDERLINE_TAG_END_LENGTH))},key)}else if(fullMatch.match(/^https?:\/\//)){const trimmedUrl=canHyperlink?trimTrailingUrlPunctuation(fullMatch,text[index+fullMatch.length]):fullMatch;const wrapOsc8=canHyperlink&&isSafeOscScheme(trimmedUrl);renderedNode=(0,import_jsx_runtime7.jsxs)(Text,{color:theme.text.link,children:[wrapOsc8?osc8Open(trimmedUrl):null,fullMatch,wrapOsc8?osc8Close():null]},key)}}catch(e){debugLogger5.error("Error parsing inline markdown part:",fullMatch,e);renderedNode=null}nodes.push(renderedNode??(0,import_jsx_runtime7.jsx)(Text,{children:unescapeMarkdownDollars(fullMatch)},key));lastIndex=index+fullMatch.length}if(lastIndex<text.length){nodes.push((0,import_jsx_runtime7.jsx)(Text,{children:unescapeMarkdownDollars(text.slice(lastIndex))},`t-${lastIndex}`))}return(0,import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment,{children:nodes.filter(node=>node!==null)})},"RenderInlineInternal");var RenderInline=import_react12.default.memo(RenderInlineInternal);init_esbuild_shims();var import_react13=__toESM(require_react(),1);init_esbuild_shims();var FLOW_START_RE=/^(?:flowchart|graph)\s+([A-Za-z]{2})/i;var SEQUENCE_START_RE=/^sequenceDiagram\b/i;var CLASS_START_RE=/^classDiagram(?:-v2)?\b/i;var STATE_START_RE=/^stateDiagram(?:-v2)?\b/i;var ER_START_RE=/^erDiagram\b/i;var GANTT_START_RE=/^gantt\b/i;var PIE_START_RE=/^pie\b/i;var JOURNEY_START_RE=/^journey\b/i;var GIT_GRAPH_START_RE=/^gitGraph\b/i;var MINDMAP_START_RE=/^mindmap\b/i;var REQUIREMENT_START_RE=/^requirementDiagram\b/i;var LINE_COMMENT_RE=/^%%/;var FLOW_ARROW_OPERATOR=String.fromCharCode(45,45,62);var MAX_RENDERED_LINES=80;var MAX_FLOWCHART_PREVIEW_LINES=120;var MAX_FLOWCHART_PREVIEW_EDGES=80;var MAX_SEQUENCE_PREVIEW_LINES=160;var MAX_SEQUENCE_PREVIEW_MESSAGES=80;var MAX_GENERIC_PREVIEW_LINES=80;var MAX_SOURCE_FALLBACK_LINES=80;var MAX_PREVIEW_SOURCE_LINE_LENGTH=1e3;var MIN_CANVAS_WIDTH=24;var NODE_GAP_X=4;var NODE_GAP_Y=4;var FLOW_EDGE_OPERATOR_RE=new RegExp(String.raw`\s*(?:`+`${escapeRegExp(FLOW_ARROW_OPERATOR)}\\|([^|]+)\\|`+String.raw`|--\s+(.+?)\s+`+escapeRegExp(FLOW_ARROW_OPERATOR)+`|(?:${[FLOW_ARROW_OPERATOR,"---","==>","-.->","--x","--o"].map(escapeRegExp).join("|")}))`+String.raw`\s*`,"g");function escapeRegExp(text){return text.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}__name(escapeRegExp,"escapeRegExp");function truncateToWidth2(text,width){if(width<=0||stringWidth(text)<=width)return text;let result="";for(const char of text){if(stringWidth(result+char+"\u2026")>width)break;result+=char}return result+"\u2026"}__name(truncateToWidth2,"truncateToWidth");function center(text,width){const padding=Math.max(0,width-stringWidth(text));const left=Math.floor(padding/2);return" ".repeat(left)+text+" ".repeat(padding-left)}__name(center,"center");function sanitizeTerminalText2(text){let result="";for(const char of stripAnsi(text)){const code=char.charCodeAt(0);if(code<=31&&code!==10||code===127||code>=128&&code<=159){continue}result+=char}return result}__name(sanitizeTerminalText2,"sanitizeTerminalText");function stripMermaidPunctuation(text){return sanitizeTerminalText2(text).trim().replace(/[;,]+$/g,"").trim()}__name(stripMermaidPunctuation,"stripMermaidPunctuation");function normalizePreviewLine(line){const trimmed=sanitizeTerminalText2(line).trim();return trimmed.length>MAX_PREVIEW_SOURCE_LINE_LENGTH?trimmed.slice(0,MAX_PREVIEW_SOURCE_LINE_LENGTH):trimmed}__name(normalizePreviewLine,"normalizePreviewLine");function sanitizePreviewSourceLine(line){const sanitized=sanitizeTerminalText2(line);return sanitized.length>MAX_PREVIEW_SOURCE_LINE_LENGTH?sanitized.slice(0,MAX_PREVIEW_SOURCE_LINE_LENGTH):sanitized}__name(sanitizePreviewSourceLine,"sanitizePreviewSourceLine");function normalizeNodeLabel(label){return sanitizeTerminalText2(label).replace(/^["']|["']$/g,"").replace(/<br\s*\/?>/gi,"\n").replace(/\\n/g,"\n")}__name(normalizeNodeLabel,"normalizeNodeLabel");function nodeLabelLines(label){return label.split(/\n/).map(line=>line.trim()).filter(line=>line.length>0)}__name(nodeLabelLines,"nodeLabelLines");function singleLineLabel(label){return nodeLabelLines(label).join(" ")}__name(singleLineLabel,"singleLineLabel");function previewSourceFallback(source,contentWidth,type,warning){const allSourceLines=sanitizeTerminalText2(source).trim().split(/\r?\n/).map(sanitizePreviewSourceLine);const sourceLines=allSourceLines.slice(0,MAX_SOURCE_FALLBACK_LINES);const truncated=allSourceLines.length>sourceLines.length;const lines=["```mermaid",...sourceLines,"```"].map(line=>truncateToWidth2(line,contentWidth));return{title:`Mermaid source (${type})`,lines,warning:[warning??"Visual preview is not available; showing source so it remains readable and copyable.",truncated?`Source truncated to ${MAX_SOURCE_FALLBACK_LINES} lines.`:void 0].filter(Boolean).join(" ")||void 0}}__name(previewSourceFallback,"previewSourceFallback");function diagramLines(source,startRe,maxLines=MAX_GENERIC_PREVIEW_LINES){const allLines=source.split(/\r?\n/).map(normalizePreviewLine).filter(line=>line.length>0&&!LINE_COMMENT_RE.test(line)&&!startRe.test(line));return{lines:allLines.slice(0,maxLines),truncated:allLines.length>maxLines}}__name(diagramLines,"diagramLines");function budgetWarning(truncated,maxLines=MAX_GENERIC_PREVIEW_LINES){return truncated?`Preview limited to ${maxLines} source lines.`:void 0}__name(budgetWarning,"budgetWarning");function parseNodeToken(rawToken){const token=stripMermaidPunctuation(rawToken).replace(/^\|.*?\|/,"").trim();if(!token||/^subgraph\b|^end$/i.test(token))return null;const idMatch=/^([A-Za-z0-9_.$:-]+)\s*(.*)$/.exec(token);if(!idMatch){return{id:token,label:normalizeNodeLabel(token),shape:"rect"}}const id=idMatch[1];const rest=idMatch[2].trim();const labelMatch=/^\[\[(.+)\]\]$/.exec(rest)??/^\[(.+)\]$/.exec(rest)??/^\(\((.+)\)\)$/.exec(rest)??/^\((.+)\)$/.exec(rest)??/^\{(.+)\}$/.exec(rest)??/^>\s*(.+)\]$/.exec(rest);const shape=/^\{(.+)\}$/.test(rest)?"diamond":/^\(\((.+)\)\)$/.test(rest)||/^\((.+)\)$/.test(rest)?"round":"rect";return{id,label:normalizeNodeLabel(labelMatch?.[1]??id),shape}}__name(parseNodeToken,"parseNodeToken");function parseFlowEdge(line){const patterns=[{re:/^(.+?)\s*--\s*(.+?)\s*-->\s*(.+)$/i,fromIndex:1,labelIndex:2,toIndex:3},{re:/^(.+?)\s*-->\|(.+?)\|\s*(.+)$/i,fromIndex:1,labelIndex:2,toIndex:3},{re:/^(.+?)\s*(?:-->|---|==>|-\.->|--x|--o)\s*(.+)$/i,fromIndex:1,toIndex:2}];for(const pattern of patterns){const match=pattern.re.exec(line);if(!match)continue;const from=parseNodeToken(match[pattern.fromIndex]);const to=parseNodeToken(match[pattern.toIndex]);if(!from||!to)return null;const label=pattern.labelIndex!==void 0?stripMermaidPunctuation(match[pattern.labelIndex]):void 0;return{from,to,label:label||void 0}}return null}__name(parseFlowEdge,"parseFlowEdge");function parseFlowEdges(line){const singleEdge=parseFlowEdge(line);const operators=[...line.matchAll(FLOW_EDGE_OPERATOR_RE)];if(operators.length<=1)return singleEdge?[singleEdge]:[];const tokens=[];const labels=[];let cursor=0;for(const operator of operators){tokens.push(line.slice(cursor,operator.index).trim());labels.push(stripMermaidPunctuation(operator[1]??operator[2]??"")||void 0);cursor=operator.index+operator[0].length}tokens.push(line.slice(cursor).trim());if(tokens.length!==operators.length+1){return[]}const nodes=tokens.map(parseNodeToken);if(nodes.some(node=>node===null)){return[]}const edges=[];for(let index=0;index<nodes.length-1;index++){edges.push({from:nodes[index],to:nodes[index+1],label:labels[index]})}return edges}__name(parseFlowEdges,"parseFlowEdges");function normalizeFlowNodeLabels(edges){const labelById=new Map;const shapeById=new Map;for(const edge of edges){for(const node of[edge.from,edge.to]){if(node.label!==node.id&&!labelById.has(node.id)){labelById.set(node.id,node.label)}if(node.shape!=="rect"&&!shapeById.has(node.id)){shapeById.set(node.id,node.shape)}}}return edges.map(edge=>({...edge,from:{...edge.from,label:labelById.get(edge.from.id)??edge.from.label,shape:shapeById.get(edge.from.id)??edge.from.shape},to:{...edge.to,label:labelById.get(edge.to.id)??edge.to.label,shape:shapeById.get(edge.to.id)??edge.to.shape}}))}__name(normalizeFlowNodeLabels,"normalizeFlowNodeLabels");function boxNode(node,width){const labels=nodeLabelLines(node.label).map(line=>truncateToWidth2(line,Math.max(3,width-4)));const innerWidth=Math.max(4,...labels.map(label=>stringWidth(label)));if(node.shape==="diamond"){return[` \u2571${"\u2500".repeat(innerWidth+2)}\u2572 `,...labels.map(label=>` \u25C7 ${center(label,innerWidth)} \u25C7 `),` \u2572${"\u2500".repeat(innerWidth+2)}\u2571 `]}if(node.shape==="round"){return[`\u256D${"\u2500".repeat(innerWidth+2)}\u256E`,...labels.map(label=>`\u2502 ${center(label,innerWidth)} \u2502`),`\u2570${"\u2500".repeat(innerWidth+2)}\u256F`]}return[`\u250C${"\u2500".repeat(innerWidth+2)}\u2510`,...labels.map(label=>`\u2502 ${center(label,innerWidth)} \u2502`),`\u2514${"\u2500".repeat(innerWidth+2)}\u2518`]}__name(boxNode,"boxNode");function buildFlowGraph(edges){const nodes=new Map;const outgoing=new Map;const incomingCount=new Map;for(const edge of edges){nodes.set(edge.from.id,edge.from);nodes.set(edge.to.id,edge.to);const outgoingEdges=outgoing.get(edge.from.id)??[];outgoingEdges.push(edge);outgoing.set(edge.from.id,outgoingEdges);incomingCount.set(edge.to.id,(incomingCount.get(edge.to.id)??0)+1);if(!incomingCount.has(edge.from.id))incomingCount.set(edge.from.id,0)}const roots=Array.from(nodes.values()).filter(node=>(incomingCount.get(node.id)??0)===0);return{nodes,outgoing,incomingCount,roots:roots.length>0?roots:[edges[0].from]}}__name(buildFlowGraph,"buildFlowGraph");function renderNodeLines(node,maxWidth){return boxNode(node,Math.max(8,maxWidth))}__name(renderNodeLines,"renderNodeLines");function lineWidth(line){return stringWidth(line)}__name(lineWidth,"lineWidth");function computeRanks(graph){const ranks=new Map;const queue=[...graph.roots];for(const root of graph.roots){ranks.set(root.id,0)}while(queue.length>0){const node=queue.shift();const rank=ranks.get(node.id)??0;for(const edge of graph.outgoing.get(node.id)??[]){if(ranks.has(edge.to.id))continue;ranks.set(edge.to.id,rank+1);queue.push(edge.to)}}for(const node of graph.nodes.values()){if(!ranks.has(node.id))ranks.set(node.id,0)}return ranks}__name(computeRanks,"computeRanks");function branchPreference(label){if(!label)return 0;const normalized=label.trim().toLowerCase();if(/^(no|false|fail|failed|否|不|失败)$/.test(normalized))return-1;if(/^(yes|true|pass|passed|是|成功)$/.test(normalized))return 1;return 0}__name(branchPreference,"branchPreference");function groupNodesByRank(graph,ranks){const layers=[];const preferenceById=new Map;const parentEdgesById=new Map;const originalIndexById=new Map;Array.from(graph.nodes.values()).forEach((node,index)=>{originalIndexById.set(node.id,index)});for(const edgeList of graph.outgoing.values()){for(const edge of edgeList){const parentEdges=parentEdgesById.get(edge.to.id)??[];parentEdges.push(edge);parentEdgesById.set(edge.to.id,parentEdges);const preference=branchPreference(edge.label);if(preference!==0&&!preferenceById.has(edge.to.id)){preferenceById.set(edge.to.id,preference)}}}for(const node of graph.nodes.values()){const rank=ranks.get(node.id)??0;layers[rank]??=[];layers[rank].push(node)}const orderById=new Map;for(const[rank,layer]of layers.entries()){layer?.sort((a,b)=>{const parentOrderDelta=parentOrder(a,rank,ranks,parentEdgesById,orderById)-parentOrder(b,rank,ranks,parentEdgesById,orderById);if(parentOrderDelta!==0)return parentOrderDelta;const preferenceDelta=(preferenceById.get(a.id)??0)-(preferenceById.get(b.id)??0);if(preferenceDelta!==0)return preferenceDelta;return(originalIndexById.get(a.id)??0)-(originalIndexById.get(b.id)??0)});layer?.forEach((node,index)=>{orderById.set(node.id,index)})}return layers.filter(layer=>layer.length>0)}__name(groupNodesByRank,"groupNodesByRank");function parentOrder(node,rank,ranks,parentEdgesById,orderById){const parentEdges=parentEdgesById.get(node.id)??[];const orders=parentEdges.filter(edge=>(ranks.get(edge.from.id)??0)<rank).map(edge=>orderById.get(edge.from.id)).filter(order=>order!==void 0);if(orders.length===0)return Number.POSITIVE_INFINITY;return orders.reduce((sum,order)=>sum+order,0)/orders.length}__name(parentOrder,"parentOrder");function createCanvas(width,height){return Array.from({length:height},()=>Array(width).fill(" "))}__name(createCanvas,"createCanvas");function mergeCanvasChar(existing,next){if(existing==="")return existing;if(next==="")return existing;if(existing===" "||existing===next)return next;if("\u25BC\u25B2\u25C0\u25B6\u2192\u2190\u21A9".includes(existing))return existing;if("\u25BC\u25B2\u25C0\u25B6\u2192\u2190\u21A9".includes(next))return next;if(existing==="\u2502"&&next==="\u2500"||existing==="\u2500"&&next==="\u2502"||existing==="\u253C"||next==="\u253C"){return"\u253C"}if("\u250C\u2510\u2514\u2518\u256D\u256E\u2570\u256F\u2571\u2572\u25C7".includes(existing))return existing;return next}__name(mergeCanvasChar,"mergeCanvasChar");function putChar(canvas,x,y,char,overwrite=false){if(y<0||y>=canvas.length||x<0||x>=canvas[y].length)return;canvas[y][x]=overwrite?char:mergeCanvasChar(canvas[y][x],char)}__name(putChar,"putChar");function putText(canvas,x,y,text,overwrite=false){let cursor=x;for(const char of text){const width=Math.max(1,stringWidth(char));putChar(canvas,cursor,y,char,overwrite);for(let offset=1;offset<width;offset++){if(y>=0&&y<canvas.length&&cursor+offset>=0&&cursor+offset<canvas[y].length){canvas[y][cursor+offset]=""}}cursor+=width}}__name(putText,"putText");function drawHorizontal(canvas,y,x1,x2){const start=Math.min(x1,x2);const end=Math.max(x1,x2);for(let x=start;x<=end;x++)putChar(canvas,x,y,"\u2500")}__name(drawHorizontal,"drawHorizontal");function drawVertical(canvas,x,y1,y2){const start=Math.min(y1,y2);const end=Math.max(y1,y2);for(let y=start;y<=end;y++)putChar(canvas,x,y,"\u2502")}__name(drawVertical,"drawVertical");function drawNode(canvas,positioned){positioned.lines.forEach((line,offset)=>{putText(canvas,positioned.x,positioned.y+offset,line,true)})}__name(drawNode,"drawNode");function layoutVertical(graph,contentWidth){const ranks=computeRanks(graph);const layers=groupNodesByRank(graph,ranks);const positioned=[];let y=0;for(const layer of layers){const gapCount=Math.max(0,layer.length-1);const maxNodeWidth=Math.max(8,Math.floor((contentWidth-gapCount*NODE_GAP_X)/layer.length));const rendered=layer.map(node=>({node,lines:renderNodeLines(node,Math.min(28,maxNodeWidth))}));const totalWidth=rendered.reduce((sum,item)=>sum+lineWidth(item.lines[0]),0)+gapCount*NODE_GAP_X;let x=Math.max(0,Math.floor((contentWidth-totalWidth)/2));const layerHeight=Math.max(...rendered.map(item=>item.lines.length));for(const item of rendered){const width=lineWidth(item.lines[0]);const height=item.lines.length;positioned.push({node:item.node,lines:item.lines,x,y,width,height,centerX:x+Math.floor(width/2),centerY:y+Math.floor(height/2),rank:ranks.get(item.node.id)??0});x+=width+NODE_GAP_X}y+=layerHeight+NODE_GAP_Y}return positioned}__name(layoutVertical,"layoutVertical");function layoutHorizontal(graph,contentWidth){const ranks=computeRanks(graph);const layers=groupNodesByRank(graph,ranks);const columnWidth=Math.max(10,Math.min(24,Math.floor((contentWidth-(layers.length-1)*NODE_GAP_X)/layers.length)));const totalWidth=layers.length*columnWidth+(layers.length-1)*NODE_GAP_X;if(totalWidth>contentWidth||layers.length===0)return null;const positioned=[];let x=Math.max(0,Math.floor((contentWidth-totalWidth)/2));for(const layer of layers){let y=0;for(const node of layer){const lines=renderNodeLines(node,columnWidth);const width=lineWidth(lines[0]);positioned.push({node,lines,x:x+Math.floor((columnWidth-width)/2),y,width,height:lines.length,centerX:x+Math.floor(columnWidth/2),centerY:y+Math.floor(lines.length/2),rank:ranks.get(node.id)??0});y+=lines.length+NODE_GAP_Y}x+=columnWidth+NODE_GAP_X}return positioned}__name(layoutHorizontal,"layoutHorizontal");function drawForwardVerticalEdge(canvas,from,to,label){const startY=from.y+from.height;const endY=to.y-1;const midY=Math.max(startY,Math.floor((startY+endY)/2));if(Math.abs(from.centerX-to.centerX)<=1){drawVertical(canvas,from.centerX,startY,endY);putChar(canvas,from.centerX,endY,"\u25BC");if(label){putText(canvas,Math.min(canvas[midY].length-1,from.centerX+2),midY,truncateToWidth2(label,14))}return}const bendY=Math.max(startY,Math.min(midY,endY-1));const targetIsRight=to.centerX>from.centerX;drawVertical(canvas,from.centerX,startY,bendY);drawHorizontal(canvas,bendY,from.centerX,to.centerX);if(bendY+1<=endY){drawVertical(canvas,to.centerX,bendY+1,endY)}putChar(canvas,from.centerX,bendY,targetIsRight?"\u2514":"\u2518",true);putChar(canvas,to.centerX,bendY,targetIsRight?"\u2510":"\u250C",true);putChar(canvas,to.centerX,endY,"\u25BC");if(label){const text=truncateToWidth2(label,14);const labelX=Math.abs(to.centerX-from.centerX)>stringWidth(text)+2?Math.min(from.centerX,to.centerX)+Math.floor((Math.abs(to.centerX-from.centerX)-stringWidth(text))/2):Math.min(canvas[bendY].length-stringWidth(text),from.centerX+2);putText(canvas,Math.max(0,labelX),bendY,text,true)}}__name(drawForwardVerticalEdge,"drawForwardVerticalEdge");function drawVerticalFork(canvas,from,targets){if(targets.length===0)return;if(targets.length===1){drawForwardVerticalEdge(canvas,from,targets[0].to,targets[0].edge.label);return}const sortedTargets=[...targets].sort((a,b)=>a.to.centerX-b.to.centerX);const startY=from.y+from.height;const firstTargetTop=Math.min(...sortedTargets.map(target=>target.to.y));const forkY=Math.max(startY,firstTargetTop-3);const labelY=Math.min(forkY+1,firstTargetTop-2);const minX=Math.min(...sortedTargets.map(target=>target.to.centerX));const maxX=Math.max(...sortedTargets.map(target=>target.to.centerX));drawVertical(canvas,from.centerX,startY,forkY);drawHorizontal(canvas,forkY,minX,maxX);putChar(canvas,from.centerX,forkY,"\u2534",true);for(const[index,target]of sortedTargets.entries()){const endY=target.to.y-1;const targetJunction=sortedTargets.length===1?"\u2534":index===0?"\u250C":index===sortedTargets.length-1?"\u2510":"\u252C";putChar(canvas,target.to.centerX,forkY,targetJunction,true);putChar(canvas,target.to.centerX,endY,"\u25BC");if(target.edge.label){const label=`[${truncateToWidth2(target.edge.label,10)}]`;const x=Math.max(0,Math.min(canvas[labelY].length-stringWidth(label),target.to.centerX-Math.floor(stringWidth(label)/2)));putText(canvas,x,labelY,label,true)}if(forkY+1<=labelY-1){drawVertical(canvas,target.to.centerX,forkY+1,labelY-1)}if(labelY+1<=endY){drawVertical(canvas,target.to.centerX,labelY+1,endY)}}}__name(drawVerticalFork,"drawVerticalFork");function formatLoopNote(from,to,label){const edgeLabel=label?` [${label}]`:"";return`${singleLineLabel(from.node.label)}${edgeLabel} \u21A9 to ${singleLineLabel(to.node.label)}`}__name(formatLoopNote,"formatLoopNote");function drawHorizontalEdge(canvas,from,to,label){const forward=to.rank>from.rank;const fromX=forward?from.x+from.width:from.x-1;const toX=forward?to.x-1:to.x+to.width;const midX=Math.floor((fromX+toX)/2);if(from.centerY===to.centerY){drawHorizontal(canvas,from.centerY,fromX,toX);putChar(canvas,toX,to.centerY,forward?"\u25B6":"\u25C0");if(label){const text=truncateToWidth2(label,12);putText(canvas,Math.max(0,midX-Math.floor(stringWidth(text)/2)),from.centerY,text)}return}drawHorizontal(canvas,from.centerY,fromX,midX);drawVertical(canvas,midX,from.centerY,to.centerY);drawHorizontal(canvas,to.centerY,midX,toX);putChar(canvas,toX,to.centerY,forward?"\u25B6":"\u25C0");if(label){const text=truncateToWidth2(label,12);putText(canvas,Math.max(0,midX-Math.floor(stringWidth(text)/2)),Math.min(from.centerY,to.centerY),text)}}__name(drawHorizontalEdge,"drawHorizontalEdge");function canvasToLines(canvas,contentWidth){return canvas.map(row=>truncateToWidth2(row.join("").trimEnd(),contentWidth)).filter((line,index,lines)=>line.length>0||index<lines.length-1)}__name(canvasToLines,"canvasToLines");function renderLayeredFlowchart(edges,contentWidth,horizontal){const width=Math.max(MIN_CANVAS_WIDTH,contentWidth);const graph=buildFlowGraph(edges);const positioned=horizontal&&graph.nodes.size<=8?layoutHorizontal(graph,width)??layoutVertical(graph,width):layoutVertical(graph,width);const byId=new Map(positioned.map(node=>[node.node.id,node]));const canvasHeight=Math.max(...positioned.map(node=>node.y+node.height),1)+2;const canvas=createCanvas(width,canvasHeight);const loopNotes=[];for(const edge of edges){if(!horizontal&&(graph.outgoing.get(edge.from.id)?.length??0)>1){continue}const from=byId.get(edge.from.id);const to=byId.get(edge.to.id);if(!from||!to)continue;if(horizontal&&to.rank!==from.rank){drawHorizontalEdge(canvas,from,to,edge.label)}else if(to.rank>from.rank){drawForwardVerticalEdge(canvas,from,to,edge.label)}else{loopNotes.push(formatLoopNote(from,to,edge.label))}}if(!horizontal){for(const edgeList of graph.outgoing.values()){if(edgeList.length<=1)continue;const source=byId.get(edgeList[0].from.id);if(!source)continue;const forwardTargets=[];for(const edge of edgeList){const target=byId.get(edge.to.id);if(!target)continue;if(target.rank>source.rank){forwardTargets.push({edge,to:target})}else{loopNotes.push(formatLoopNote(source,target,edge.label))}}drawVerticalFork(canvas,source,forwardTargets)}}for(const node of positioned){drawNode(canvas,node)}const lines=canvasToLines(canvas,contentWidth);if(loopNotes.length>0){lines.push("");lines.push("Cycles:");for(const note of loopNotes){lines.push(truncateToWidth2(` ${note}`,contentWidth))}}return lines}__name(renderLayeredFlowchart,"renderLayeredFlowchart");function renderFlowchart(source,contentWidth){const allRawLines=source.split(/\r?\n/).map(normalizePreviewLine).filter(line=>line.length>0&&!LINE_COMMENT_RE.test(line));const rawLines=allRawLines.slice(0,MAX_FLOWCHART_PREVIEW_LINES);const lineBudgetExceeded=allRawLines.length>rawLines.length;const first=rawLines[0]??"";const direction=FLOW_START_RE.exec(first)?.[1]?.toUpperCase()??"TD";const lines=rawLines.slice(FLOW_START_RE.test(first)?1:0);const edgeLines=[];let edgeBudgetExceeded=false;for(const line of lines){for(const part of line.split(";")){const statement=part.trim();if(!statement)continue;if(edgeLines.length>=MAX_FLOWCHART_PREVIEW_EDGES){edgeBudgetExceeded=true;break}edgeLines.push(statement)}if(edgeBudgetExceeded)break}const edges=edgeLines.flatMap(parseFlowEdges);const normalizedEdges=normalizeFlowNodeLabels(edges);if(normalizedEdges.length===0){return previewSourceFallback(source,contentWidth,"flowchart","Flowchart preview supports simple A --> B style edges; showing source instead.")}const horizontal=direction.includes("LR")||direction.includes("RL");const rendered=renderLayeredFlowchart(normalizedEdges,contentWidth,horizontal);return{title:`Mermaid flowchart (${direction})`,lines:rendered.slice(0,MAX_RENDERED_LINES),warning:[lineBudgetExceeded?`Preview limited to ${MAX_FLOWCHART_PREVIEW_LINES} source lines.`:void 0,edgeBudgetExceeded?`Preview limited to ${MAX_FLOWCHART_PREVIEW_EDGES} edges.`:void 0,rendered.length>MAX_RENDERED_LINES?`Preview truncated to ${MAX_RENDERED_LINES} rendered lines.`:void 0].filter(Boolean).join(" ")||void 0}}__name(renderFlowchart,"renderFlowchart");function parseParticipant(line){const match=/^(?:participant|actor)\s+(.+?)(?:\s+as\s+(.+))?$/i.exec(line);if(!match)return null;const id=stripMermaidPunctuation(match[1]);return{id,label:stripMermaidPunctuation(match[2]??id)}}__name(parseParticipant,"parseParticipant");function renderSequence(source,contentWidth){const allRawLines=source.split(/\r?\n/).map(normalizePreviewLine).filter(line=>line.length>0&&!LINE_COMMENT_RE.test(line)&&!SEQUENCE_START_RE.test(line));const rawLines=allRawLines.slice(0,MAX_SEQUENCE_PREVIEW_LINES);const lineBudgetExceeded=allRawLines.length>rawLines.length;const participants=new Map;const messages=[];let messageBudgetExceeded=false;for(const line of rawLines){const participant=parseParticipant(line);if(participant){participants.set(participant.id,participant.label);continue}const messageMatch=/^(.+?)(-->>|->>|-->|->|--x|-x)\s*(.+?)\s*:\s*(.+)$/.exec(line);if(!messageMatch)continue;const from=stripMermaidPunctuation(messageMatch[1]);const arrow=messageMatch[2].includes("--")?"\u21E2":"\u2192";const to=stripMermaidPunctuation(messageMatch[3]);const message=stripMermaidPunctuation(messageMatch[4]);if(!participants.has(from))participants.set(from,from);if(!participants.has(to))participants.set(to,to);if(messages.length>=MAX_SEQUENCE_PREVIEW_MESSAGES){messageBudgetExceeded=true;continue}messages.push(truncateToWidth2(`${participants.get(from)??from} ${arrow} ${participants.get(to)??to}: ${message}`,contentWidth))}const header=participants.size>0?`Participants: ${Array.from(participants.values()).join(" | ")}`:"Participants: not declared";if(messages.length===0){return previewSourceFallback(source,contentWidth,"sequenceDiagram","Sequence preview supports A->>B: message style arrows; showing source instead.")}const lines=[truncateToWidth2(header,contentWidth),""];lines.push(...messages);return{title:"Mermaid sequence diagram",lines:lines.slice(0,MAX_RENDERED_LINES),warning:[lineBudgetExceeded?`Preview limited to ${MAX_SEQUENCE_PREVIEW_LINES} source lines.`:void 0,messageBudgetExceeded?`Preview limited to ${MAX_SEQUENCE_PREVIEW_MESSAGES} messages.`:void 0].filter(Boolean).join(" ")||void 0}}__name(renderSequence,"renderSequence");function renderClassDiagram(source,contentWidth){const{lines:rawLines,truncated}=diagramLines(source,CLASS_START_RE);const classes=new Set;const relationships=[];const members=[];let currentClass=null;for(const line of rawLines){const classBlockMatch=/^class\s+([A-Za-z0-9_.$:-]+)\s*\{?$/i.exec(line);if(classBlockMatch){currentClass=classBlockMatch[1];classes.add(currentClass);continue}if(line==="}"){currentClass=null;continue}const relationMatch=/^([A-Za-z0-9_.$:-]+)\s+([<|*o.]*--[|>*o.]*|<\|--|--\|>|\*--|o--|-->|<--|\.\.>)\s+([A-Za-z0-9_.$:-]+)(?:\s*:\s*(.+))?$/i.exec(line);if(relationMatch){const from=relationMatch[1];const relation=relationMatch[2];const to=relationMatch[3];const label=stripMermaidPunctuation(relationMatch[4]??"");classes.add(from);classes.add(to);relationships.push(truncateToWidth2(`${from} ${relation} ${to}${label?`: ${label}`:""}`,contentWidth));continue}const inlineMemberMatch=/^([A-Za-z0-9_.$:-]+)\s*:\s*(.+)$/i.exec(line);if(inlineMemberMatch){classes.add(inlineMemberMatch[1]);members.push(truncateToWidth2(`${inlineMemberMatch[1]}: ${stripMermaidPunctuation(inlineMemberMatch[2])}`,contentWidth));continue}if(currentClass){members.push(truncateToWidth2(`${currentClass}: ${stripMermaidPunctuation(line)}`,contentWidth))}}if(classes.size===0&&relationships.length===0&&members.length===0){return previewSourceFallback(source,contentWidth,"classDiagram","Class preview found no previewable classes or relationships; showing source instead.")}const output=[truncateToWidth2(`Classes: ${Array.from(classes).join(" | ")||"not declared"}`,contentWidth),"",...relationships.length>0?["Relationships:",...relationships]:["Relationships: none previewed"],...members.length>0?["","Members:",...members.slice(0,24)]:[]];return{title:"Mermaid class diagram",lines:output.slice(0,MAX_RENDERED_LINES),warning:budgetWarning(truncated)}}__name(renderClassDiagram,"renderClassDiagram");function renderStateDiagram(source,contentWidth){const{lines:rawLines,truncated}=diagramLines(source,STATE_START_RE);const transitions=[];const declarations=[];for(const line of rawLines){const transitionMatch=/^(.+?)\s*-->\s*(.+?)(?:\s*:\s*(.+))?$/.exec(line);if(transitionMatch){const from=stripMermaidPunctuation(transitionMatch[1]);const to=stripMermaidPunctuation(transitionMatch[2]);const label=stripMermaidPunctuation(transitionMatch[3]??"");transitions.push(truncateToWidth2(`${from} \u2192 ${to}${label?`: ${label}`:""}`,contentWidth));continue}const stateMatch=/^state\s+(.+?)(?:\s+as\s+(.+))?$/i.exec(line);if(stateMatch){declarations.push(truncateToWidth2(stripMermaidPunctuation(stateMatch[2]??stateMatch[1]),contentWidth))}}if(declarations.length===0&&transitions.length===0){return previewSourceFallback(source,contentWidth,"stateDiagram","State preview found no previewable states or transitions; showing source instead.")}const output=[...declarations.length>0?["States:",...declarations.slice(0,20),""]:[],...transitions.length>0?["Transitions:",...transitions]:["Transitions: none previewed"]];return{title:"Mermaid state diagram",lines:output.slice(0,MAX_RENDERED_LINES),warning:budgetWarning(truncated)}}__name(renderStateDiagram,"renderStateDiagram");function renderErDiagram(source,contentWidth){const{lines:rawLines,truncated}=diagramLines(source,ER_START_RE);const entities=new Set;const relationships=[];const attributes=[];let currentEntity=null;for(const line of rawLines){const entityBlock=/^([A-Za-z0-9_.$:-]+)\s*\{$/.exec(line);if(entityBlock){currentEntity=entityBlock[1];entities.add(currentEntity);continue}if(line==="}"){currentEntity=null;continue}const relationMatch=/^([A-Za-z0-9_.$:-]+)\s+([|o}{]{1,2}--[|o}{]{1,2})\s+([A-Za-z0-9_.$:-]+)(?:\s*:\s*(.+))?$/i.exec(line);if(relationMatch){entities.add(relationMatch[1]);entities.add(relationMatch[3]);relationships.push(truncateToWidth2(`${relationMatch[1]} ${relationMatch[2]} ${relationMatch[3]}${relationMatch[4]?`: ${stripMermaidPunctuation(relationMatch[4])}`:""}`,contentWidth));continue}if(currentEntity){attributes.push(truncateToWidth2(`${currentEntity}: ${stripMermaidPunctuation(line)}`,contentWidth))}}if(entities.size===0&&relationships.length===0&&attributes.length===0){return previewSourceFallback(source,contentWidth,"erDiagram","ER preview found no previewable entities or relationships; showing source instead.")}return{title:"Mermaid ER diagram",lines:[truncateToWidth2(`Entities: ${Array.from(entities).join(" | ")||"not declared"}`,contentWidth),"",...relationships.length>0?["Relationships:",...relationships]:["Relationships: none previewed"],...attributes.length>0?["","Attributes:",...attributes.slice(0,24)]:[]].slice(0,MAX_RENDERED_LINES),warning:budgetWarning(truncated)}}__name(renderErDiagram,"renderErDiagram");function renderPieDiagram(source,contentWidth){const{lines:rawLines,truncated}=diagramLines(source,PIE_START_RE);const titleLine=rawLines.find(line=>/^title\b/i.test(line));const slices=rawLines.map(line=>/^["']?(.+?)["']?\s*:\s*([0-9.]+)\s*$/.exec(line)).filter(match=>match!==null).map(match=>truncateToWidth2(`${stripMermaidPunctuation(match[1])}: ${match[2]}`,contentWidth));if(slices.length===0){return previewSourceFallback(source,contentWidth,"pie","Pie preview found no previewable slices; showing source instead.")}return{title:"Mermaid pie chart",lines:[...titleLine?[truncateToWidth2(stripMermaidPunctuation(titleLine),contentWidth),""]:[],...slices],warning:budgetWarning(truncated)}}__name(renderPieDiagram,"renderPieDiagram");function renderGanttDiagram(source,contentWidth){const{lines:rawLines,truncated}=diagramLines(source,GANTT_START_RE);const output=[];for(const line of rawLines){if(/^(dateFormat|axisFormat|tickInterval|weekday|excludes|todayMarker)\b/i.test(line)){continue}const section=/^section\s+(.+)$/i.exec(line);if(section){output.push("");output.push(truncateToWidth2(`Section: ${stripMermaidPunctuation(section[1])}`,contentWidth));continue}const title=/^title\s+(.+)$/i.exec(line);if(title){output.push(truncateToWidth2(`Title: ${stripMermaidPunctuation(title[1])}`,contentWidth));continue}output.push(truncateToWidth2(`\u2022 ${stripMermaidPunctuation(line)}`,contentWidth))}if(output.length===0){return previewSourceFallback(source,contentWidth,"gantt","Gantt preview found no previewable tasks; showing source instead.")}return{title:"Mermaid gantt chart",lines:output.slice(0,MAX_RENDERED_LINES),warning:budgetWarning(truncated)}}__name(renderGanttDiagram,"renderGanttDiagram");function renderJourneyDiagram(source,contentWidth){const{lines:rawLines,truncated}=diagramLines(source,JOURNEY_START_RE);const output=[];for(const line of rawLines){const title=/^title\s+(.+)$/i.exec(line);if(title){output.push(truncateToWidth2(`Title: ${stripMermaidPunctuation(title[1])}`,contentWidth));continue}const section=/^section\s+(.+)$/i.exec(line);if(section){output.push("");output.push(truncateToWidth2(`Section: ${stripMermaidPunctuation(section[1])}`,contentWidth));continue}output.push(truncateToWidth2(`\u2022 ${stripMermaidPunctuation(line)}`,contentWidth))}if(output.length===0){return previewSourceFallback(source,contentWidth,"journey","Journey preview found no previewable steps; showing source instead.")}return{title:"Mermaid journey diagram",lines:output.slice(0,MAX_RENDERED_LINES),warning:budgetWarning(truncated)}}__name(renderJourneyDiagram,"renderJourneyDiagram");function renderIndentedTreeDiagram(source,contentWidth,startRe,title,sourceType){const allLines=source.split(/\r?\n/).filter(line=>normalizePreviewLine(line).length>0&&!LINE_COMMENT_RE.test(normalizePreviewLine(line))&&!startRe.test(normalizePreviewLine(line)));const rawLines=allLines.slice(0,MAX_GENERIC_PREVIEW_LINES);const truncated=allLines.length>rawLines.length;const lines=rawLines.map(line=>{const safeLine=sanitizeTerminalText2(line);const indentation=/^\s*/.exec(safeLine)?.[0].length??0;const depth=Math.floor(indentation/2);return truncateToWidth2(`${" ".repeat(depth)}\u2022 ${safeLine.trim()}`,contentWidth)});if(lines.length===0){return previewSourceFallback(source,contentWidth,sourceType,`${title} preview found no previewable nodes; showing source instead.`)}return{title,lines:lines.slice(0,MAX_RENDERED_LINES),warning:budgetWarning(truncated)}}__name(renderIndentedTreeDiagram,"renderIndentedTreeDiagram");function renderMermaidVisual(source,contentWidth){const trimmed=sanitizeTerminalText2(source).trim();const firstLine=trimmed.split(/\r?\n/).find(line=>line.trim())??"";if(FLOW_START_RE.test(firstLine)){return renderFlowchart(trimmed,contentWidth)}if(SEQUENCE_START_RE.test(firstLine)){return renderSequence(trimmed,contentWidth)}if(CLASS_START_RE.test(firstLine)){return renderClassDiagram(trimmed,contentWidth)}if(STATE_START_RE.test(firstLine)){return renderStateDiagram(trimmed,contentWidth)}if(ER_START_RE.test(firstLine)){return renderErDiagram(trimmed,contentWidth)}if(GANTT_START_RE.test(firstLine)){return renderGanttDiagram(trimmed,contentWidth)}if(PIE_START_RE.test(firstLine)){return renderPieDiagram(trimmed,contentWidth)}if(JOURNEY_START_RE.test(firstLine)){return renderJourneyDiagram(trimmed,contentWidth)}if(MINDMAP_START_RE.test(firstLine)){return renderIndentedTreeDiagram(trimmed,contentWidth,MINDMAP_START_RE,"Mermaid mindmap","mindmap")}if(GIT_GRAPH_START_RE.test(firstLine)){return renderIndentedTreeDiagram(trimmed,contentWidth,GIT_GRAPH_START_RE,"Mermaid git graph","gitGraph")}if(REQUIREMENT_START_RE.test(firstLine)){return renderIndentedTreeDiagram(trimmed,contentWidth,REQUIREMENT_START_RE,"Mermaid requirement diagram","requirementDiagram")}const type=firstLine.split(/\s+/)[0]||"unknown";return previewSourceFallback(trimmed,contentWidth,type)}__name(renderMermaidVisual,"renderMermaidVisual");var import_jsx_runtime8=__toESM(require_jsx_runtime(),1);var MERMAID_PADDING=1;function getRenderErrorReason(error){return error instanceof Error?error.message:String(error)}__name(getRenderErrorReason,"getRenderErrorReason");var MermaidDiagramInternal=__name(({source,sourceCopyCommand,contentWidth,isPending,availableTerminalHeight})=>{const writeRaw=useTerminalOutput();const config=import_react13.default.useContext(ConfigContext);const sandboxed=Boolean(config?.getShellExecutionSandbox?.());const preparedTerminalImageSequence=import_react13.default.useRef(null);const[imageState,setImageState]=import_react13.default.useState(null);const innerWidth=Math.max(8,contentWidth-MERMAID_PADDING);const imageKey=`${source}\0${innerWidth}\0${availableTerminalHeight??"auto"}`;const image=imageState?.key===imageKey&&!isPending&&!sandboxed?imageState.result:null;const visual=import_react13.default.useMemo(()=>renderMermaidVisual(source,innerWidth),[source,innerWidth]);import_react13.default.useEffect(()=>{if(isPending||sandboxed){setImageState(null);return}let cancelled=false;const abortController=new AbortController;void renderMermaidImageAsync({source,contentWidth:innerWidth,availableTerminalHeight,signal:abortController.signal}).then(result=>{if(!cancelled){setImageState({key:imageKey,result})}},error=>{if(!cancelled){setImageState({key:imageKey,result:{kind:"unavailable",reason:getRenderErrorReason(error)}})}});return()=>{cancelled=true;abortController.abort()}},[availableTerminalHeight,imageKey,innerWidth,isPending,source,sandboxed]);const kittySequence=image?.kind==="terminal-image"&&image.protocol==="kitty"&&image.placeholder?image.sequence:null;import_react13.default.useEffect(()=>{preparedTerminalImageSequence.current=null},[imageKey]);import_react13.default.useEffect(()=>{if(!kittySequence||preparedTerminalImageSequence.current===kittySequence){return}preparedTerminalImageSequence.current=kittySequence;process.nextTick(()=>writeRaw(kittySequence))},[kittySequence,writeRaw]);const titleWithSourceHint=__name(title=>`${title} \xB7 source: ${sourceCopyCommand}`,"titleWithSourceHint");if(image?.kind==="terminal-image"&&image.protocol==="kitty"&&image.placeholder){return(0,import_jsx_runtime8.jsxs)(Box_default,{paddingLeft:MERMAID_PADDING,flexDirection:"column",width:contentWidth,flexShrink:0,children:[(0,import_jsx_runtime8.jsx)(Text,{bold:true,color:theme.text.accent,children:titleWithSourceHint(visual.title)}),(0,import_jsx_runtime8.jsx)(MaxSizedBox,{maxHeight:availableTerminalHeight,maxWidth:innerWidth,overflowDirection:"bottom",children:image.placeholder.lines.map((line,index)=>(0,import_jsx_runtime8.jsx)(Box_default,{children:(0,import_jsx_runtime8.jsx)(Text,{color:image.placeholder.color,wrap:"truncate-end",children:line})},index))})]})}if(image?.kind==="ansi"){return(0,import_jsx_runtime8.jsxs)(Box_default,{paddingLeft:MERMAID_PADDING,flexDirection:"column",width:contentWidth,flexShrink:0,children:[(0,import_jsx_runtime8.jsx)(Text,{bold:true,color:theme.text.accent,children:titleWithSourceHint(visual.title)}),(0,import_jsx_runtime8.jsx)(MaxSizedBox,{maxHeight:availableTerminalHeight,maxWidth:innerWidth,overflowDirection:"bottom",children:image.lines.map((line,index)=>(0,import_jsx_runtime8.jsx)(Box_default,{children:(0,import_jsx_runtime8.jsx)(Text,{children:line||" "})},index))})]})}return(0,import_jsx_runtime8.jsxs)(Box_default,{paddingLeft:MERMAID_PADDING,flexDirection:"column",width:contentWidth,flexShrink:0,children:[(0,import_jsx_runtime8.jsx)(Text,{bold:true,color:theme.text.accent,children:titleWithSourceHint(visual.title)}),(0,import_jsx_runtime8.jsx)(MaxSizedBox,{maxHeight:availableTerminalHeight,maxWidth:innerWidth,overflowDirection:"bottom",children:visual.lines.map((line,index)=>(0,import_jsx_runtime8.jsx)(Box_default,{children:(0,import_jsx_runtime8.jsx)(Text,{color:theme.text.primary,children:line||" "})},index))}),visual.warning&&(0,import_jsx_runtime8.jsx)(Text,{color:theme.text.secondary,wrap:"wrap",children:visual.warning}),!isPending&&image?.kind==="unavailable"&&image.showReason!==false&&(0,import_jsx_runtime8.jsxs)(Text,{color:theme.text.secondary,wrap:"wrap",children:["Image rendering unavailable: ",image.reason]})]})},"MermaidDiagramInternal");var MermaidDiagram=import_react13.default.memo(MermaidDiagramInternal);init_esbuild_shims();var findNextFence=__name((content,from)=>{let lineStart=from===0?0:content.lastIndexOf("\n",from-1)+1;while(lineStart<content.length){const newlineIndex=content.indexOf("\n",lineStart);const lineEnd=newlineIndex===-1?content.length:newlineIndex;let delimiterStart=lineStart;while(content[delimiterStart]===" ")delimiterStart++;if(delimiterStart>=from&&(content.startsWith("```",delimiterStart)||content.startsWith("~~~",delimiterStart))){let delimiterEnd=delimiterStart+3;while(content[delimiterEnd]===content[delimiterStart])delimiterEnd++;if(content.slice(delimiterEnd,lineEnd).includes("`")){lineStart=lineEnd+1;continue}const match=CODE_FENCE_RE.exec(content.slice(lineStart,lineEnd));if(!match){lineStart=lineEnd+1;continue}const delimiter=match[1];return{index:delimiterStart,char:delimiter[0]==="`"?"`":"~",length:delimiter.length}}lineStart=lineEnd+1}return null},"findNextFence");var getEnclosingFence=__name((content,indexToTest,onClosed)=>{let open=null;let searchPos=0;while(searchPos<content.length){const fence=findNextFence(content,searchPos);if(!fence||fence.index>=indexToTest)break;if(!open){open={char:fence.char,len:fence.length,index:fence.index}}else if(fence.char===open.char&&fence.length>=open.len){onClosed?.(open.index,fence.index);open=null}searchPos=fence.index+fence.length}if(!open)return null;const newlineIndex=content.indexOf("\n",open.index);const fenceLineEnd=newlineIndex===-1?content.length:newlineIndex;return{startIndex:open.index,delimiter:content.slice(open.index,open.index+open.len),infoString:content.slice(open.index+open.len,fenceLineEnd)}},"getEnclosingFence");var getEnclosingFenceInfo=__name((content,index)=>{const fence=getEnclosingFence(content,index);return fence?parseCodeFenceInfo(fence.infoString):null},"getEnclosingFenceInfo");var findLastSafeSplitPoint=__name((content,idealMaxLength)=>{const hasLengthCap=idealMaxLength!==void 0;const searchEnd=hasLengthCap?Math.min(Math.max(idealMaxLength,0),content.length):content.length;if(hasLengthCap&&content.length<=searchEnd){return content.length}const closedBlocks=[];const enclosingFence=getEnclosingFence(content,searchEnd,(start,end)=>{closedBlocks.push({start,end})});if(enclosingFence){return hasLengthCap&&enclosingFence.startIndex===0?searchEnd:enclosingFence.startIndex}let blockIndex=closedBlocks.length-1;const isInsideClosedBlock=__name(index=>{while(blockIndex>=0&&index<=closedBlocks[blockIndex].start){blockIndex--}return blockIndex>=0&&index<=closedBlocks[blockIndex].end},"isInsideClosedBlock");let searchStartIndex=searchEnd;while(searchStartIndex>=0){const dnlIndex=content.lastIndexOf("\n\n",searchStartIndex);if(dnlIndex===-1){break}const potentialSplitPoint=dnlIndex+2;if(potentialSplitPoint<=searchEnd&&!isInsideClosedBlock(potentialSplitPoint)){return potentialSplitPoint}searchStartIndex=dnlIndex-1}if(hasLengthCap){blockIndex=closedBlocks.length-1;searchStartIndex=searchEnd;while(searchStartIndex>=0){const nlIndex=content.lastIndexOf("\n",searchStartIndex);if(nlIndex===-1){break}const potentialSplitPoint=nlIndex+1;if(potentialSplitPoint<=searchEnd&&!isInsideClosedBlock(potentialSplitPoint)){return potentialSplitPoint}searchStartIndex=nlIndex-1}}return hasLengthCap?searchEnd:content.length},"findLastSafeSplitPoint");var START_LINE_DIRECTIVE_RE=/\s*\bqwen-code:start-line=(\d+)\b/;var parseCodeFenceInfo=__name(info=>{const raw=info??"";const directive=raw.match(START_LINE_DIRECTIVE_RE);const startLine=directive?Math.max(1,Number(directive[1])):1;const lang=raw.replace(START_LINE_DIRECTIVE_RE,"").trim().split(/\s+/)[0];return{lang:lang||null,startLine}},"parseCodeFenceInfo");var countHeadContentLines=__name((content,fenceStartIndex,splitPoint)=>{const headFromFence=content.slice(fenceStartIndex,splitPoint);const newlineCount=(headFromFence.match(/\n/g)||[]).length;return Math.max(newlineCount-1,0)},"countHeadContentLines");var splitFencedMarkdown=__name((content,splitPoint)=>{const before=content.slice(0,splitPoint);const after=content.slice(splitPoint);if(splitPoint<=0||splitPoint>=content.length){return{before,after}}const fence=getEnclosingFence(content,splitPoint);if(!fence){return{before,after}}const closingFence=fence.delimiter;const{startLine:headStart}=parseCodeFenceInfo(fence.infoString);const tailStart=headStart+countHeadContentLines(content,fence.startIndex,splitPoint);const baseInfo=fence.infoString.replace(START_LINE_DIRECTIVE_RE,"").replace(/\s+$/,"");const directive=`qwen-code:start-line=${tailStart}`;const reopeningFence=`${fence.delimiter}${baseInfo?`${baseInfo} ${directive}`:directive}`;const beforeWithClose=before.endsWith("\n")?`${before}${closingFence}
|
|
6
6
|
`:`${before}
|