cc-viewer 1.6.183 → 1.6.190
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/dist/assets/{App-BHfyP8-J.js → App-zWgquirU.js} +11 -11
- package/dist/assets/{AppHeader-Dc7WvorH.css → AppHeader-D8MCV07q.css} +3 -3
- package/dist/assets/AppHeader.module-BO_W974X.js +573 -0
- package/dist/assets/{Mobile-ca5EOMpN.js → Mobile-mC2D8w-e.js} +1 -1
- package/dist/assets/{_baseUniq-DYSZB4Xx.js → _baseUniq-CEgwAVBk.js} +1 -1
- package/dist/assets/{arc-BChSP8hM.js → arc-MEHrGoSV.js} +1 -1
- package/dist/assets/{architectureDiagram-Q4EWVU46-vlr5Q6DQ.js → architectureDiagram-Q4EWVU46-BPjoqhJM.js} +1 -1
- package/dist/assets/{blockDiagram-DXYQGD6D-4C3Amh2i.js → blockDiagram-DXYQGD6D-C6E6qAiA.js} +1 -1
- package/dist/assets/{c4Diagram-AHTNJAMY-wI0efLSs.js → c4Diagram-AHTNJAMY-DCaaelvP.js} +1 -1
- package/dist/assets/channel-2Rqd2l4n.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB-BX9brpDB.js → chunk-4BX2VUAB-DOFHXLhh.js} +1 -1
- package/dist/assets/{chunk-4TB4RGXK-DvFQ-X9V.js → chunk-4TB4RGXK-B-NPhf57.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-BNmYjPNf.js → chunk-55IACEB6-DliOMqkO.js} +1 -1
- package/dist/assets/{chunk-EDXVE4YY-BNvDPqBE.js → chunk-EDXVE4YY-DGe6csqF.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-Bb0LARSp.js → chunk-FMBD7UC4-DYA85HUy.js} +1 -1
- package/dist/assets/{chunk-OYMX7WX6-BwlvIpeD.js → chunk-OYMX7WX6-BnQZKCXr.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-BS6RK8_X.js → chunk-QZHKN3VN-BFjJqewT.js} +1 -1
- package/dist/assets/{chunk-YZCP3GAM-oOqmydQz.js → chunk-YZCP3GAM-BNw1WaZX.js} +1 -1
- package/dist/assets/classDiagram-6PBFFD2Q-kdtHORjS.js +1 -0
- package/dist/assets/classDiagram-v2-HSJHXN6E-kdtHORjS.js +1 -0
- package/dist/assets/clone-D28eZRit.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-CamsIqkY.js → cose-bilkent-S5V4N54A-Caf2YU2_.js} +1 -1
- package/dist/assets/{dagre-KV5264BT-CPAWWiBh.js → dagre-KV5264BT-Ci7hNUg6.js} +1 -1
- package/dist/assets/{diagram-5BDNPKRD-D6TmzGhl.js → diagram-5BDNPKRD-CVbF4uma.js} +1 -1
- package/dist/assets/{diagram-G4DWMVQ6-DDuJnMCL.js → diagram-G4DWMVQ6-Bp90W3vP.js} +1 -1
- package/dist/assets/{diagram-MMDJMWI5-CQWhvrpz.js → diagram-MMDJMWI5-B3sqDX6G.js} +1 -1
- package/dist/assets/{diagram-TYMM5635-CEDj3w_h.js → diagram-TYMM5635-DASTGzUc.js} +1 -1
- package/dist/assets/{erDiagram-SMLLAGMA-B_eQqha6.js → erDiagram-SMLLAGMA-BHeKI98s.js} +1 -1
- package/dist/assets/{flowDiagram-DWJPFMVM-B985i3uQ.js → flowDiagram-DWJPFMVM-CVXMRNNP.js} +1 -1
- package/dist/assets/{ganttDiagram-T4ZO3ILL-DKp62vr3.js → ganttDiagram-T4ZO3ILL-DEVtZmK6.js} +1 -1
- package/dist/assets/{gitGraphDiagram-UUTBAWPF-Cc1gyz1Q.js → gitGraphDiagram-UUTBAWPF-O48YFRyc.js} +1 -1
- package/dist/assets/{graph-C-1-3bsA.js → graph-C4C79Ynh.js} +1 -1
- package/dist/assets/{index-LH2WLu05.js → index-Bf88itOf.js} +2 -2
- package/dist/assets/{infoDiagram-42DDH7IO-DqXaAHZz.js → infoDiagram-42DDH7IO-B53T3cTl.js} +1 -1
- package/dist/assets/{ishikawaDiagram-UXIWVN3A-zdUdDJX2.js → ishikawaDiagram-UXIWVN3A-DsBR1H4d.js} +1 -1
- package/dist/assets/{journeyDiagram-VCZTEJTY-ip5SzODy.js → journeyDiagram-VCZTEJTY-C5Qx-MWC.js} +1 -1
- package/dist/assets/{kanban-definition-6JOO6SKY-D5EYh6AP.js → kanban-definition-6JOO6SKY-DdUA1Jqj.js} +1 -1
- package/dist/assets/{layout-Cjq8AL8G.js → layout-8zCmZc2v.js} +1 -1
- package/dist/assets/{linear-U0KsEJ2u.js → linear-iU1fIm4D.js} +1 -1
- package/dist/assets/{mermaid.core-CT-5crLN.js → mermaid.core-DEH9vF8h.js} +4 -4
- package/dist/assets/{min-C7G6pq26.js → min-CYrNSou-.js} +1 -1
- package/dist/assets/{mindmap-definition-QFDTVHPH-CIzhFOw1.js → mindmap-definition-QFDTVHPH-t4p9Tkms.js} +1 -1
- package/dist/assets/{pieDiagram-DEJITSTG-Cp1Zd1MQ.js → pieDiagram-DEJITSTG-CLcGF3ux.js} +1 -1
- package/dist/assets/{quadrantDiagram-34T5L4WZ-Cp31xM90.js → quadrantDiagram-34T5L4WZ-neqUyyc6.js} +1 -1
- package/dist/assets/{requirementDiagram-MS252O5E-Dbg_eQqB.js → requirementDiagram-MS252O5E-C2D_UGIy.js} +1 -1
- package/dist/assets/{sankeyDiagram-XADWPNL6-CMrzwpwC.js → sankeyDiagram-XADWPNL6-DZz_PSNE.js} +1 -1
- package/dist/assets/{sequenceDiagram-FGHM5R23-KJegoBnN.js → sequenceDiagram-FGHM5R23-q7qU3aaX.js} +1 -1
- package/dist/assets/{stateDiagram-FHFEXIEX-BDWprYzE.js → stateDiagram-FHFEXIEX-DYaI8H2Q.js} +1 -1
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-BwkgJKS3.js +1 -0
- package/dist/assets/{timeline-definition-GMOUNBTQ-BOWeG5LY.js → timeline-definition-GMOUNBTQ-CIlZ_lpo.js} +1 -1
- package/dist/assets/{vennDiagram-DHZGUBPP-B6mLodPk.js → vennDiagram-DHZGUBPP-BGi2p57m.js} +1 -1
- package/dist/assets/{wardley-RL74JXVD-CovHs24Z.js → wardley-RL74JXVD-BGn0fLga.js} +1 -1
- package/dist/assets/{wardleyDiagram-NUSXRM2D-CBg_VXF7.js → wardleyDiagram-NUSXRM2D-Clpxmp21.js} +1 -1
- package/dist/assets/{xychartDiagram-5P7HB3ND-BRxgk_oX.js → xychartDiagram-5P7HB3ND-Fnlog8mH.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/AppHeader.module-W_78JZt9.js +0 -573
- package/dist/assets/channel-d8DITadq.js +0 -1
- package/dist/assets/classDiagram-6PBFFD2Q-B1oRrMCc.js +0 -1
- package/dist/assets/classDiagram-v2-HSJHXN6E-B1oRrMCc.js +0 -1
- package/dist/assets/clone-BrNOd7Lq.js +0 -1
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-CCUmB0qI.js +0 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var wt=Object.defineProperty;var Mt=(c,a,t)=>a in c?wt(c,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[a]=t;var R=(c,a,t)=>Mt(c,typeof a!="symbol"?a+"":a,t);import{j as e}from"./vendor-codemirror-CdXaVX4e.js";import{a as N,I as ee,b as te,R as me,i as le,o as Lt,s as H,M as X,S as pt,p as Ze,q as he,D as Rt,P as ge,T as Y,d as E,h as ae,t as ie,u as xe,v as be,j as It,w as gt,x as Ie,y as _e,e as Fe,z as et,f as He,F as Et,A as Bt,E as At,G as Dt,H as oe,L as tt,J as xt,K as ft,N as re,O as ce,C as Ft,Q as Ee,U as Ht,V as Pt}from"./vendor-antd-CtdKd5xs.js";import{a as W,t as l,l as Pe,m as qt,n as Z,d as zt,e as Vt,g as $t,s,k as P,C as $,w as jt,x as Ot,h as Ut,y as Kt,j as fe,p as st,z as Wt,B as Jt,O as yt,D as Gt,E as at,G as _t,H as nt,J as Be,K as it,L as lt,M as Qt,N as Xt,A as Yt,P as ve,Q as ot,u as Zt,o as k,R as rt,r as es}from"./AppHeader.module-W_78JZt9.js";import{s as ts,b as ss}from"./index-LH2WLu05.js";import{Q as as}from"./vendor-qrcode-D05RfzwB.js";import"./vendor-markdown-CO-jRjTB.js";import"./vendor-xterm-DWMOrwSy.js";import"./vendor-highlight-D4ATuRwX.js";import"./vendor-virtuoso-BhnFrbmh.js";var ns={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"},is=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ns}))},ct=N.forwardRef(is),ls={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z"}}]},name:"bar-chart",theme:"outlined"},os=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ls}))},dt=N.forwardRef(os),rs={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M624 706.3h-74.1V464c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v242.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.7a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-download",theme:"outlined"},cs=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:rs}))},ht=N.forwardRef(cs),ds={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"},hs=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ds}))},Ce=N.forwardRef(hs),us={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 385.6a446.7 446.7 0 00-96-142.4 446.7 446.7 0 00-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 00-142.4 96 446.7 446.7 0 00-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM761.4 836H262.6A371.12 371.12 0 01140 560c0-99.4 38.7-192.8 109-263 70.3-70.3 163.7-109 263-109 99.4 0 192.8 38.7 263 109 70.3 70.3 109 163.7 109 263 0 105.6-44.5 205.5-122.6 276zM623.5 421.5a8.03 8.03 0 00-11.3 0L527.7 506c-18.7-5-39.4-.2-54.1 14.5a55.95 55.95 0 000 79.2 55.95 55.95 0 0079.2 0 55.87 55.87 0 0014.5-54.1l84.5-84.5c3.1-3.1 3.1-8.2 0-11.3l-28.3-28.3zM490 320h44c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8h-44c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8zm260 218v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8zm12.7-197.2l-31.1-31.1a8.03 8.03 0 00-11.3 0l-56.6 56.6a8.03 8.03 0 000 11.3l31.1 31.1c3.1 3.1 8.2 3.1 11.3 0l56.6-56.6c3.1-3.1 3.1-8.2 0-11.3zm-458.6-31.1a8.03 8.03 0 00-11.3 0l-31.1 31.1a8.03 8.03 0 000 11.3l56.6 56.6c3.1 3.1 8.2 3.1 11.3 0l31.1-31.1c3.1-3.1 3.1-8.2 0-11.3l-56.6-56.6zM262 530h-80c-4.4 0-8 3.6-8 8v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8z"}}]},name:"dashboard",theme:"outlined"},ms=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:us}))},Ae=N.forwardRef(ms),ps={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"},gs=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ps}))},xs=N.forwardRef(gs),fs={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"},js=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:fs}))},ut=N.forwardRef(js),ys={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z"}}]},name:"message",theme:"outlined"},_s=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ys}))},vs=N.forwardRef(_s),bs={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},Cs=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:bs}))},mt=N.forwardRef(Cs);const Ns=[{label:"Auto",value:"auto"},{label:"Opus 4.7 (1M)",value:"opus-4.7-1m",tokens:1e6},{label:"Sonnet 4.6",value:"sonnet-4.6",tokens:2e5},{label:"GLM5",value:"glm5",tokens:2e5},{label:"Kimi K2.5",value:"kimi-k2.5",tokens:2e5},{label:"MiniMax 2.1",value:"minimax-2.1",tokens:2e5},{label:"Qwen 3.5",value:"Qwen 3.5",tokens:2e5}],Ss={calibrationModels:Ns},De=Ss.calibrationModels,ks=[{value:"zh",short:"zh",label:"简体中文"},{value:"en",short:"en",label:"English"},{value:"zh-TW",short:"zh-TW",label:"繁體中文"},{value:"ko",short:"ko",label:"한국어"},{value:"ja",short:"ja",label:"日本語"},{value:"de",short:"de",label:"Deutsch"},{value:"es",short:"es",label:"Español"},{value:"fr",short:"fr",label:"Français"},{value:"it",short:"it",label:"Italiano"},{value:"da",short:"da",label:"Dansk"},{value:"pl",short:"pl",label:"Polski"},{value:"ru",short:"ru",label:"Русский"},{value:"ar",short:"ar",label:"العربية"},{value:"no",short:"no",label:"Norsk"},{value:"pt-BR",short:"pt-BR",label:"Português (Brasil)"},{value:"th",short:"th",label:"ไทย"},{value:"tr",short:"tr",label:"Türkçe"},{value:"uk",short:"uk",label:"Українська"}],Ts=c=>{const a=t=>t.toUpperCase().split("").map(n=>String.fromCodePoint(127462+n.charCodeAt(0)-65)).join("");return!c||c.length!==2?a("CN"):a(c)},ue=class ue extends me.Component{constructor(t){super(t);R(this,"handleShowPrompts",()=>{this.setState({promptModalVisible:!0,promptData:this.extractUserPrompts()})});R(this,"handleExportPromptsTxt",()=>{const t=this.state.promptData;if(!t||t.length===0)return;const n=[];for(const h of t){const d=[],g=h.timestamp?new Date(h.timestamp).toLocaleString():"";g&&d.push(`${g}:
|
|
1
|
+
var wt=Object.defineProperty;var Mt=(c,a,t)=>a in c?wt(c,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[a]=t;var R=(c,a,t)=>Mt(c,typeof a!="symbol"?a+"":a,t);import{j as e}from"./vendor-codemirror-CdXaVX4e.js";import{a as N,I as ee,b as te,R as me,i as le,o as Lt,s as P,M as X,S as pt,p as Ze,q as he,D as Rt,P as ge,T as Y,d as E,h as ae,t as ie,u as xe,v as be,j as It,w as gt,x as Ie,y as _e,e as Fe,z as et,f as He,F as Et,A as Bt,E as At,G as Dt,H as oe,L as tt,J as xt,K as ft,N as re,O as ce,C as Ft,Q as Ee,U as Ht,V as Pt}from"./vendor-antd-CtdKd5xs.js";import{a as W,t as l,l as Pe,m as qt,n as Z,d as zt,e as Vt,g as $t,s,k as q,C as O,w as jt,x as Ot,h as Ut,y as Kt,j as fe,p as st,z as Wt,B as Jt,O as yt,D as Gt,E as at,G as _t,H as nt,J as Be,K as it,L as lt,M as Qt,N as Xt,A as Yt,P as ve,Q as ot,u as Zt,o as k,R as rt,r as es}from"./AppHeader.module-BO_W974X.js";import{s as ts,b as ss}from"./index-Bf88itOf.js";import{Q as as}from"./vendor-qrcode-D05RfzwB.js";import"./vendor-markdown-CO-jRjTB.js";import"./vendor-xterm-DWMOrwSy.js";import"./vendor-highlight-D4ATuRwX.js";import"./vendor-virtuoso-BhnFrbmh.js";var ns={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"},is=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ns}))},ct=N.forwardRef(is),ls={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z"}}]},name:"bar-chart",theme:"outlined"},os=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ls}))},dt=N.forwardRef(os),rs={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M624 706.3h-74.1V464c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v242.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.7a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-download",theme:"outlined"},cs=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:rs}))},ht=N.forwardRef(cs),ds={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"},hs=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ds}))},Ce=N.forwardRef(hs),us={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 385.6a446.7 446.7 0 00-96-142.4 446.7 446.7 0 00-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 00-142.4 96 446.7 446.7 0 00-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM761.4 836H262.6A371.12 371.12 0 01140 560c0-99.4 38.7-192.8 109-263 70.3-70.3 163.7-109 263-109 99.4 0 192.8 38.7 263 109 70.3 70.3 109 163.7 109 263 0 105.6-44.5 205.5-122.6 276zM623.5 421.5a8.03 8.03 0 00-11.3 0L527.7 506c-18.7-5-39.4-.2-54.1 14.5a55.95 55.95 0 000 79.2 55.95 55.95 0 0079.2 0 55.87 55.87 0 0014.5-54.1l84.5-84.5c3.1-3.1 3.1-8.2 0-11.3l-28.3-28.3zM490 320h44c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8h-44c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8zm260 218v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8zm12.7-197.2l-31.1-31.1a8.03 8.03 0 00-11.3 0l-56.6 56.6a8.03 8.03 0 000 11.3l31.1 31.1c3.1 3.1 8.2 3.1 11.3 0l56.6-56.6c3.1-3.1 3.1-8.2 0-11.3zm-458.6-31.1a8.03 8.03 0 00-11.3 0l-31.1 31.1a8.03 8.03 0 000 11.3l56.6 56.6c3.1 3.1 8.2 3.1 11.3 0l31.1-31.1c3.1-3.1 3.1-8.2 0-11.3l-56.6-56.6zM262 530h-80c-4.4 0-8 3.6-8 8v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8z"}}]},name:"dashboard",theme:"outlined"},ms=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:us}))},Ae=N.forwardRef(ms),ps={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"},gs=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ps}))},xs=N.forwardRef(gs),fs={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"},js=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:fs}))},ut=N.forwardRef(js),ys={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z"}}]},name:"message",theme:"outlined"},_s=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:ys}))},vs=N.forwardRef(_s),bs={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},Cs=function(a,t){return N.createElement(ee,te({},a,{ref:t,icon:bs}))},mt=N.forwardRef(Cs);const Ns=[{label:"Auto",value:"auto"},{label:"Opus 4.7 (1M)",value:"opus-4.7-1m",tokens:1e6},{label:"Sonnet 4.6",value:"sonnet-4.6",tokens:2e5},{label:"GLM5",value:"glm5",tokens:2e5},{label:"Kimi K2.5",value:"kimi-k2.5",tokens:2e5},{label:"MiniMax 2.1",value:"minimax-2.1",tokens:2e5},{label:"Qwen 3.5",value:"Qwen 3.5",tokens:2e5}],Ss={calibrationModels:Ns},De=Ss.calibrationModels,ks=[{value:"zh",short:"zh",label:"简体中文"},{value:"en",short:"en",label:"English"},{value:"zh-TW",short:"zh-TW",label:"繁體中文"},{value:"ko",short:"ko",label:"한국어"},{value:"ja",short:"ja",label:"日本語"},{value:"de",short:"de",label:"Deutsch"},{value:"es",short:"es",label:"Español"},{value:"fr",short:"fr",label:"Français"},{value:"it",short:"it",label:"Italiano"},{value:"da",short:"da",label:"Dansk"},{value:"pl",short:"pl",label:"Polski"},{value:"ru",short:"ru",label:"Русский"},{value:"ar",short:"ar",label:"العربية"},{value:"no",short:"no",label:"Norsk"},{value:"pt-BR",short:"pt-BR",label:"Português (Brasil)"},{value:"th",short:"th",label:"ไทย"},{value:"tr",short:"tr",label:"Türkçe"},{value:"uk",short:"uk",label:"Українська"}],Ts=c=>{const a=t=>t.toUpperCase().split("").map(n=>String.fromCodePoint(127462+n.charCodeAt(0)-65)).join("");return!c||c.length!==2?a("CN"):a(c)},ue=class ue extends me.Component{constructor(t){super(t);R(this,"handleShowPrompts",()=>{this.setState({promptModalVisible:!0,promptData:this.extractUserPrompts()})});R(this,"handleExportPromptsTxt",()=>{const t=this.state.promptData;if(!t||t.length===0)return;const n=[];for(const h of t){const d=[],g=h.timestamp?new Date(h.timestamp).toLocaleString():"";g&&d.push(`${g}:
|
|
2
2
|
`);const m=(h.segments||[]).filter(u=>u.type==="text").map(u=>u.content);m.length>0&&d.push(m.join(`
|
|
3
3
|
`)),n.push(d.join(`
|
|
4
4
|
`))}if(n.length===0)return;const o=new Blob([n.join(`
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
`)],{type:"text/plain;charset=utf-8"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`user-prompts-${new Date().toISOString().slice(0,10)}.txt`,r.click(),URL.revokeObjectURL(i)});R(this,"handleCalibrationModelChange",t=>{this.setState({calibrationModel:t}),localStorage.setItem("ccv_calibrationModel",t)});R(this,"handleShowProjectStats",()=>{this.setState({projectStatsVisible:!0,projectStatsLoading:!0}),fetch(W("/api/project-stats")).then(t=>{if(!t.ok)throw new Error("not found");return t.json()}).then(t=>this.setState({projectStats:t,projectStatsLoading:!1})).catch(()=>this.setState({projectStats:null,projectStatsLoading:!1}))});R(this,"fetchPlugins",()=>fetch(W("/api/plugins")).then(t=>{if(!t.ok)throw new Error(t.status);return t.json()}).then(t=>{this.setState({pluginsList:t.plugins||[],pluginsDir:t.pluginsDir||""})}).catch(()=>{}));R(this,"handleShowPlugins",()=>{this.setState({pluginModalVisible:!0}),this.fetchPlugins()});R(this,"handleTogglePlugin",(t,n)=>{fetch(W("/api/preferences")).then(o=>o.json()).then(o=>{let i=Array.isArray(o.disabledPlugins)?[...o.disabledPlugins]:[];return n?i=i.filter(r=>r!==t):i.includes(t)||i.push(t),fetch(W("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({disabledPlugins:i})})}).then(()=>fetch(W("/api/plugins/reload"),{method:"POST"})).then(o=>{if(!o.ok)throw new Error(o.status);return o.json()}).then(o=>{this.setState({pluginsList:o.plugins||[],pluginsDir:o.pluginsDir||""})}).catch(()=>{})});R(this,"handleDeletePlugin",(t,n)=>{this.setState({deleteConfirmVisible:!0,deleteTarget:{file:t,name:n}})});R(this,"handleDeletePluginConfirm",()=>{const{file:t}=this.state.deleteTarget||{};t&&(this.setState({deleteConfirmVisible:!1,deleteTarget:null}),fetch(W(`/api/plugins?file=${encodeURIComponent(t)}`),{method:"DELETE"}).then(n=>{if(!n.ok)throw new Error(n.status);return n.json()}).then(n=>{n.plugins&&this.setState({pluginsList:n.plugins,pluginsDir:n.pluginsDir||""})}).catch(()=>{}))});R(this,"handleReloadPlugins",()=>{fetch(W("/api/plugins/reload"),{method:"POST"}).then(t=>{if(!t.ok)throw new Error(t.status);return t.json()}).then(t=>{this.setState({pluginsList:t.plugins||[],pluginsDir:t.pluginsDir||""})}).catch(()=>{})});R(this,"handleAddPlugin",()=>{const t=document.createElement("input");t.type="file",t.accept=".js,.mjs",t.multiple=!0,t.onchange=()=>{const n=t.files;if(!n||n.length===0)return;for(const i of n)if(!i.name.endsWith(".js")&&!i.name.endsWith(".mjs")){H.error(l("ui.plugins.invalidFile"));return}const o=Array.from(n).map(i=>new Promise((r,h)=>{const d=new FileReader;d.onload=()=>r({name:i.name,content:d.result}),d.onerror=()=>h(new Error(`Failed to read ${i.name}`)),d.readAsText(i)}));Promise.all(o).then(i=>fetch(W("/api/plugins/upload"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:i})})).then(i=>i.ok?i.json():i.text().then(r=>{try{return JSON.parse(r)}catch{throw new Error(l("ui.plugins.serverError",{status:i.status}))}})).then(i=>{i.error?H.error(l("ui.plugins.addFailed",{reason:i.error})):i.plugins&&(this.setState({pluginsList:i.plugins,pluginsDir:i.pluginsDir||""}),H.success(l("ui.plugins.addSuccess")))}).catch(i=>{H.error(i.message)})},t.click()});R(this,"handleShowCdnModal",()=>{this.setState({cdnModalVisible:!0,cdnUrl:"",cdnLoading:!1})});R(this,"handleCdnUrlChange",t=>{this.setState({cdnUrl:t.target.value})});R(this,"handleCdnInstall",()=>{const{cdnUrl:t}=this.state;if(!t.trim()){H.error(l("ui.plugins.cdnUrlRequired"));return}try{new URL(t)}catch{H.error(l("ui.plugins.cdnInvalidUrl"));return}this.setState({cdnLoading:!0}),fetch(W("/api/plugins/install-from-url"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t.trim()})}).then(n=>n.json()).then(n=>{n.error?H.error(l("ui.plugins.cdnInstallFailed",{reason:n.error})):(H.success(l("ui.plugins.cdnInstallSuccess")),n.plugins&&this.setState({pluginsList:n.plugins,pluginsDir:n.pluginsDir||""}),this.setState({cdnModalVisible:!1,cdnUrl:""}))}).catch(n=>{H.error(l("ui.plugins.cdnInstallFailed",{reason:n.message||"Network error"}))}).finally(()=>{this.setState({cdnLoading:!1})})});R(this,"handleCdnCancel",()=>{this.setState({cdnModalVisible:!1,cdnUrl:"",cdnLoading:!1})});R(this,"fetchProcesses",()=>{this.setState({processLoading:!0}),fetch(W("/api/ccv-processes")).then(t=>t.json()).then(t=>{this.setState({processList:t.processes||[],processLoading:!1})}).catch(()=>{this.setState({processList:[],processLoading:!1})})});R(this,"handleShowProcesses",()=>{this.setState({processModalVisible:!0}),this.fetchProcesses()});R(this,"handleKillProcess",t=>{X.confirm({title:l("ui.processManagement.killConfirm"),onOk:()=>{fetch(W("/api/ccv-processes/kill"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:t})}).then(n=>n.json()).then(n=>{n.ok?(H.success(l("ui.processManagement.killed")),this.fetchProcesses()):H.error(n.error||l("ui.processManagement.killFailed"))}).catch(()=>{H.error(l("ui.processManagement.killFailed"))})}})});this.state={countdownText:"",countryFlag:null,countryInfo:null,promptModalVisible:!1,promptData:[],promptViewMode:"original",settingsDrawerVisible:!1,globalSettingsVisible:!1,projectStatsVisible:!1,projectStats:null,projectStatsLoading:!1,localUrl:"",pluginModalVisible:!1,pluginsList:[],pluginsDir:"",deleteConfirmVisible:!1,deleteTarget:null,processModalVisible:!1,processList:[],processLoading:!1,logoDropdownOpen:!1,cacheHighlightIdx:null,cacheHighlightFading:!1,cdnModalVisible:!1,cdnUrl:"",cdnLoading:!1,calibrationModel:(n=>De.some(o=>o.value===n)?n:"auto")(localStorage.getItem("ccv_calibrationModel")||"auto"),proxyModalVisible:!1,editingProxy:null,editForm:{name:"",baseURL:"",apiKey:"",models:"",activeModel:""},logDirDraft:null},this._countdownTimer=null,this._expiredTimer=null,this.updateCountdown=this.updateCountdown.bind(this)}componentDidMount(){this.startCountdown(),fetch(W("/api/local-url")).then(t=>t.json()).then(t=>{t.url&&this.setState({localUrl:t.url})}).catch(()=>{}),fetch(W("/api/claude-settings")).then(t=>t.json()).then(t=>{t.model&&this.setState({settingsModel:t.model})}).catch(()=>{}),fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(5e3)}).then(t=>t.json()).then(t=>{t.country&&this.setState({countryFlag:Ts(t.country),countryInfo:t})}).catch(()=>{})}componentDidUpdate(t){t.cacheExpireAt!==this.props.cacheExpireAt&&this.startCountdown()}shouldComponentUpdate(t,n){return t.requests!==this.props.requests||t.requestCount!==this.props.requestCount||t.viewMode!==this.props.viewMode||t.cacheExpireAt!==this.props.cacheExpireAt||t.cacheType!==this.props.cacheType||t.isLocalLog!==this.props.isLocalLog||t.localLogFile!==this.props.localLogFile||t.projectName!==this.props.projectName||t.collapseToolResults!==this.props.collapseToolResults||t.expandThinking!==this.props.expandThinking||t.showFullToolContent!==this.props.showFullToolContent||t.expandDiff!==this.props.expandDiff||t.filterIrrelevant!==this.props.filterIrrelevant||t.logDir!==this.props.logDir||t.updateInfo!==this.props.updateInfo||t.cliMode!==this.props.cliMode||t.sdkMode!==this.props.sdkMode||t.terminalVisible!==this.props.terminalVisible||t.contextWindow!==this.props.contextWindow||t.serverCachedContent!==this.props.serverCachedContent||t.resumeAutoChoice!==this.props.resumeAutoChoice||t.themeColor!==this.props.themeColor||t.autoApproveSeconds!==this.props.autoApproveSeconds||t.proxyProfiles!==this.props.proxyProfiles||t.activeProxyId!==this.props.activeProxyId||t.defaultConfig!==this.props.defaultConfig||n!==this.state}componentWillUnmount(){this._countdownTimer&&clearTimeout(this._countdownTimer),this._expiredTimer&&clearTimeout(this._expiredTimer),this._cacheFadeClearTimer&&clearTimeout(this._cacheFadeClearTimer),this._cacheScrollSettleTimer&&clearTimeout(this._cacheScrollSettleTimer),this._cacheAutoFadeTimer&&clearTimeout(this._cacheAutoFadeTimer),this._cacheHighlightDelayTimer&&clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade()}startCountdown(){if(this._countdownTimer&&clearTimeout(this._countdownTimer),this._expiredTimer&&clearTimeout(this._expiredTimer),!this.props.cacheExpireAt){this.state.countdownText!==""&&this.setState({countdownText:""});return}this.updateCountdown()}updateCountdown(){const{cacheExpireAt:t}=this.props;if(!t){this.state.countdownText!==""&&this.setState({countdownText:""});return}const n=Date.now(),o=Math.max(0,t-n);if(o<=0){const d=l("ui.cacheExpired");this.state.countdownText!==d&&this.setState({countdownText:d}),this._expiredTimer=setTimeout(()=>{this.state.countdownText!==""&&this.setState({countdownText:""})},5e3);return}const i=Math.ceil(o/1e3);let r;if(i>=60){const d=Math.floor(i/60),g=i%60;r=l("ui.minuteSecond",{m:d,s:String(g).padStart(2,"0")})}else r=l("ui.second",{s:i});r!==this.state.countdownText&&this.setState({countdownText:r});const h=1e3-n%1e3;this._countdownTimer=setTimeout(this.updateCountdown,h)}static parseSegments(t){const n=[],o=/<([a-zA-Z_][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>/g;let i=0,r;for(;(r=o.exec(t))!==null;){const d=t.slice(i,r.index).trim();d&&n.push({type:"text",content:d});const g=r[1];if(i=r.index+r[0].length,ue.COMMAND_TAGS.has(g))continue;const m=new RegExp(`^<${g}(?:\\s[^>]*)?>([\\s\\S]*)<\\/${g}>$`),u=r[0].match(m),y=u?u[1].trim():r[0].trim();n.push({type:"system",content:y,label:g})}const h=t.slice(i).trim();return h&&n.push({type:"text",content:h}),n}static extractUserTexts(t){const n=[],o=[];let i=null;for(const r of t)if(r.role==="user"){if(typeof r.content=="string"){const h=r.content.trim();if(!h)continue;if(!Pe(h)){if(/Implement the following plan:/i.test(h))continue;n.push(h),o.push(h)}}else if(Array.isArray(r.content)){const{commands:h,textBlocks:d}=qt(r.content);h.length>0&&(i=h[h.length-1]);const g=[];for(const u of d)/Implement the following plan:/i.test((u.text||"").trim())||g.push(u.text.trim());const m=r.content.filter(u=>{var y;return u.type==="text"&&((y=u.text)==null?void 0:y.trim())}).map(u=>u.text.trim());g.length>0&&(n.push(g.join(`
|
|
8
|
+
`)],{type:"text/plain;charset=utf-8"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`user-prompts-${new Date().toISOString().slice(0,10)}.txt`,r.click(),URL.revokeObjectURL(i)});R(this,"handleCalibrationModelChange",t=>{this.setState({calibrationModel:t}),localStorage.setItem("ccv_calibrationModel",t)});R(this,"handleShowProjectStats",()=>{this.setState({projectStatsVisible:!0,projectStatsLoading:!0}),fetch(W("/api/project-stats")).then(t=>{if(!t.ok)throw new Error("not found");return t.json()}).then(t=>this.setState({projectStats:t,projectStatsLoading:!1})).catch(()=>this.setState({projectStats:null,projectStatsLoading:!1}))});R(this,"fetchPlugins",()=>fetch(W("/api/plugins")).then(t=>{if(!t.ok)throw new Error(t.status);return t.json()}).then(t=>{this.setState({pluginsList:t.plugins||[],pluginsDir:t.pluginsDir||""})}).catch(()=>{}));R(this,"handleShowPlugins",()=>{this.setState({pluginModalVisible:!0}),this.fetchPlugins()});R(this,"handleTogglePlugin",(t,n)=>{fetch(W("/api/preferences")).then(o=>o.json()).then(o=>{let i=Array.isArray(o.disabledPlugins)?[...o.disabledPlugins]:[];return n?i=i.filter(r=>r!==t):i.includes(t)||i.push(t),fetch(W("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({disabledPlugins:i})})}).then(()=>fetch(W("/api/plugins/reload"),{method:"POST"})).then(o=>{if(!o.ok)throw new Error(o.status);return o.json()}).then(o=>{this.setState({pluginsList:o.plugins||[],pluginsDir:o.pluginsDir||""})}).catch(()=>{})});R(this,"handleDeletePlugin",(t,n)=>{this.setState({deleteConfirmVisible:!0,deleteTarget:{file:t,name:n}})});R(this,"handleDeletePluginConfirm",()=>{const{file:t}=this.state.deleteTarget||{};t&&(this.setState({deleteConfirmVisible:!1,deleteTarget:null}),fetch(W(`/api/plugins?file=${encodeURIComponent(t)}`),{method:"DELETE"}).then(n=>{if(!n.ok)throw new Error(n.status);return n.json()}).then(n=>{n.plugins&&this.setState({pluginsList:n.plugins,pluginsDir:n.pluginsDir||""})}).catch(()=>{}))});R(this,"handleReloadPlugins",()=>{fetch(W("/api/plugins/reload"),{method:"POST"}).then(t=>{if(!t.ok)throw new Error(t.status);return t.json()}).then(t=>{this.setState({pluginsList:t.plugins||[],pluginsDir:t.pluginsDir||""})}).catch(()=>{})});R(this,"handleAddPlugin",()=>{const t=document.createElement("input");t.type="file",t.accept=".js,.mjs",t.multiple=!0,t.onchange=()=>{const n=t.files;if(!n||n.length===0)return;for(const i of n)if(!i.name.endsWith(".js")&&!i.name.endsWith(".mjs")){P.error(l("ui.plugins.invalidFile"));return}const o=Array.from(n).map(i=>new Promise((r,h)=>{const d=new FileReader;d.onload=()=>r({name:i.name,content:d.result}),d.onerror=()=>h(new Error(`Failed to read ${i.name}`)),d.readAsText(i)}));Promise.all(o).then(i=>fetch(W("/api/plugins/upload"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:i})})).then(i=>i.ok?i.json():i.text().then(r=>{try{return JSON.parse(r)}catch{throw new Error(l("ui.plugins.serverError",{status:i.status}))}})).then(i=>{i.error?P.error(l("ui.plugins.addFailed",{reason:i.error})):i.plugins&&(this.setState({pluginsList:i.plugins,pluginsDir:i.pluginsDir||""}),P.success(l("ui.plugins.addSuccess")))}).catch(i=>{P.error(i.message)})},t.click()});R(this,"handleShowCdnModal",()=>{this.setState({cdnModalVisible:!0,cdnUrl:"",cdnLoading:!1})});R(this,"handleCdnUrlChange",t=>{this.setState({cdnUrl:t.target.value})});R(this,"handleCdnInstall",()=>{const{cdnUrl:t}=this.state;if(!t.trim()){P.error(l("ui.plugins.cdnUrlRequired"));return}try{new URL(t)}catch{P.error(l("ui.plugins.cdnInvalidUrl"));return}this.setState({cdnLoading:!0}),fetch(W("/api/plugins/install-from-url"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t.trim()})}).then(n=>n.json()).then(n=>{n.error?P.error(l("ui.plugins.cdnInstallFailed",{reason:n.error})):(P.success(l("ui.plugins.cdnInstallSuccess")),n.plugins&&this.setState({pluginsList:n.plugins,pluginsDir:n.pluginsDir||""}),this.setState({cdnModalVisible:!1,cdnUrl:""}))}).catch(n=>{P.error(l("ui.plugins.cdnInstallFailed",{reason:n.message||"Network error"}))}).finally(()=>{this.setState({cdnLoading:!1})})});R(this,"handleCdnCancel",()=>{this.setState({cdnModalVisible:!1,cdnUrl:"",cdnLoading:!1})});R(this,"fetchProcesses",()=>{this.setState({processLoading:!0}),fetch(W("/api/ccv-processes")).then(t=>t.json()).then(t=>{this.setState({processList:t.processes||[],processLoading:!1})}).catch(()=>{this.setState({processList:[],processLoading:!1})})});R(this,"handleShowProcesses",()=>{this.setState({processModalVisible:!0}),this.fetchProcesses()});R(this,"handleKillProcess",t=>{X.confirm({title:l("ui.processManagement.killConfirm"),onOk:()=>{fetch(W("/api/ccv-processes/kill"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:t})}).then(n=>n.json()).then(n=>{n.ok?(P.success(l("ui.processManagement.killed")),this.fetchProcesses()):P.error(n.error||l("ui.processManagement.killFailed"))}).catch(()=>{P.error(l("ui.processManagement.killFailed"))})}})});this.state={countdownText:"",countryFlag:null,countryInfo:null,promptModalVisible:!1,promptData:[],promptViewMode:"original",settingsDrawerVisible:!1,globalSettingsVisible:!1,projectStatsVisible:!1,projectStats:null,projectStatsLoading:!1,localUrl:"",pluginModalVisible:!1,pluginsList:[],pluginsDir:"",deleteConfirmVisible:!1,deleteTarget:null,processModalVisible:!1,processList:[],processLoading:!1,logoDropdownOpen:!1,cacheHighlightIdx:null,cacheHighlightFading:!1,cdnModalVisible:!1,cdnUrl:"",cdnLoading:!1,calibrationModel:(n=>De.some(o=>o.value===n)?n:"auto")(localStorage.getItem("ccv_calibrationModel")||"auto"),proxyModalVisible:!1,editingProxy:null,editForm:{name:"",baseURL:"",apiKey:"",models:"",activeModel:""},logDirDraft:null},this._countdownTimer=null,this._expiredTimer=null,this.updateCountdown=this.updateCountdown.bind(this)}componentDidMount(){this.startCountdown(),fetch(W("/api/local-url")).then(t=>t.json()).then(t=>{t.url&&this.setState({localUrl:t.url})}).catch(()=>{}),fetch(W("/api/claude-settings")).then(t=>t.json()).then(t=>{t.model&&this.setState({settingsModel:t.model})}).catch(()=>{}),fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(5e3)}).then(t=>t.json()).then(t=>{t.country&&this.setState({countryFlag:Ts(t.country),countryInfo:t})}).catch(()=>{})}componentDidUpdate(t){t.cacheExpireAt!==this.props.cacheExpireAt&&this.startCountdown()}shouldComponentUpdate(t,n){return t.requests!==this.props.requests||t.requestCount!==this.props.requestCount||t.viewMode!==this.props.viewMode||t.cacheExpireAt!==this.props.cacheExpireAt||t.cacheType!==this.props.cacheType||t.isLocalLog!==this.props.isLocalLog||t.localLogFile!==this.props.localLogFile||t.projectName!==this.props.projectName||t.collapseToolResults!==this.props.collapseToolResults||t.expandThinking!==this.props.expandThinking||t.showFullToolContent!==this.props.showFullToolContent||t.expandDiff!==this.props.expandDiff||t.filterIrrelevant!==this.props.filterIrrelevant||t.logDir!==this.props.logDir||t.updateInfo!==this.props.updateInfo||t.cliMode!==this.props.cliMode||t.sdkMode!==this.props.sdkMode||t.terminalVisible!==this.props.terminalVisible||t.contextWindow!==this.props.contextWindow||t.serverCachedContent!==this.props.serverCachedContent||t.resumeAutoChoice!==this.props.resumeAutoChoice||t.themeColor!==this.props.themeColor||t.autoApproveSeconds!==this.props.autoApproveSeconds||t.proxyProfiles!==this.props.proxyProfiles||t.activeProxyId!==this.props.activeProxyId||t.defaultConfig!==this.props.defaultConfig||n!==this.state}componentWillUnmount(){this._countdownTimer&&clearTimeout(this._countdownTimer),this._expiredTimer&&clearTimeout(this._expiredTimer),this._cacheFadeClearTimer&&clearTimeout(this._cacheFadeClearTimer),this._cacheScrollSettleTimer&&clearTimeout(this._cacheScrollSettleTimer),this._cacheAutoFadeTimer&&clearTimeout(this._cacheAutoFadeTimer),this._cacheHighlightDelayTimer&&clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade()}startCountdown(){if(this._countdownTimer&&clearTimeout(this._countdownTimer),this._expiredTimer&&clearTimeout(this._expiredTimer),!this.props.cacheExpireAt){this.state.countdownText!==""&&this.setState({countdownText:""});return}this.updateCountdown()}updateCountdown(){const{cacheExpireAt:t}=this.props;if(!t){this.state.countdownText!==""&&this.setState({countdownText:""});return}const n=Date.now(),o=Math.max(0,t-n);if(o<=0){const d=l("ui.cacheExpired");this.state.countdownText!==d&&this.setState({countdownText:d}),this._expiredTimer=setTimeout(()=>{this.state.countdownText!==""&&this.setState({countdownText:""})},5e3);return}const i=Math.ceil(o/1e3);let r;if(i>=60){const d=Math.floor(i/60),g=i%60;r=l("ui.minuteSecond",{m:d,s:String(g).padStart(2,"0")})}else r=l("ui.second",{s:i});r!==this.state.countdownText&&this.setState({countdownText:r});const h=1e3-n%1e3;this._countdownTimer=setTimeout(this.updateCountdown,h)}static parseSegments(t){const n=[],o=/<([a-zA-Z_][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>/g;let i=0,r;for(;(r=o.exec(t))!==null;){const d=t.slice(i,r.index).trim();d&&n.push({type:"text",content:d});const g=r[1];if(i=r.index+r[0].length,ue.COMMAND_TAGS.has(g))continue;const m=new RegExp(`^<${g}(?:\\s[^>]*)?>([\\s\\S]*)<\\/${g}>$`),u=r[0].match(m),j=u?u[1].trim():r[0].trim();n.push({type:"system",content:j,label:g})}const h=t.slice(i).trim();return h&&n.push({type:"text",content:h}),n}static extractUserTexts(t){const n=[],o=[];let i=null;for(const r of t)if(r.role==="user"){if(typeof r.content=="string"){const h=r.content.trim();if(!h)continue;if(!Pe(h)){if(/Implement the following plan:/i.test(h))continue;n.push(h),o.push(h)}}else if(Array.isArray(r.content)){const{commands:h,textBlocks:d}=qt(r.content);h.length>0&&(i=h[h.length-1]);const g=[];for(const u of d)/Implement the following plan:/i.test((u.text||"").trim())||g.push(u.text.trim());const m=r.content.filter(u=>{var j;return u.type==="text"&&((j=u.text)==null?void 0:j.trim())}).map(u=>u.text.trim());g.length>0&&(n.push(g.join(`
|
|
9
9
|
`)),o.push(m.join(`
|
|
10
|
-
`)))}}return{userMsgs:n,fullTexts:o,slashCmd:i}}extractUserPrompts(){var h;const{requests:t=[]}=this.props,n=[],o=new Set;let i=null;const r=t.filter(d=>Z(d));for(let d=0;d<r.length;d++){const g=r[d],m=((h=g.body)==null?void 0:h.messages)||[],u=g.timestamp||"",{userMsgs:
|
|
10
|
+
`)))}}return{userMsgs:n,fullTexts:o,slashCmd:i}}extractUserPrompts(){var h;const{requests:t=[]}=this.props,n=[],o=new Set;let i=null;const r=t.filter(d=>Z(d));for(let d=0;d<r.length;d++){const g=r[d],m=((h=g.body)==null?void 0:h.messages)||[],u=g.timestamp||"",{userMsgs:j,fullTexts:S,slashCmd:f}=ue.extractUserTexts(m);f&&f!=="/compact"&&f!==i&&n.push({type:"prompt",segments:[{type:"text",content:f}],timestamp:u}),i=f;for(let p=0;p<j.length;p++){const v=j[p];if(o.has(v))continue;o.add(v);const b=S[p]||v;n.push({type:"prompt",segments:ue.parseSegments(b),timestamp:u})}}return n}renderTokenStats(){const{requests:t=[]}=this.props,{cacheHighlightIdx:n,cacheHighlightFading:o}=this.state;if(this._tokenStatsCache&&this._tokenStatsCacheReq===t&&this._tokenStatsCacheHl===n&&this._tokenStatsCacheFade===o)return this._tokenStatsCache;const i=zt(t),r=Object.keys(i),h=Vt(t),d=$t(t);if(r.length===0&&h.length===0)return e.jsx("div",{className:s.tokenStatsEmpty,children:"暂无 token 数据"});const g=e.jsx("div",{className:s.tokenStatsColumn,children:r.map(f=>{const p=i[f],v=p.input+p.cacheCreation+p.cacheRead,b=v>0?(p.cacheRead/v*100).toFixed(1):"0.0";return e.jsxs("div",{className:r.length>1?s.modelCardSpaced:s.modelCard,children:[e.jsx("div",{className:s.modelName,children:f}),e.jsx("table",{className:s.statsTable,children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:"Token"}),e.jsx("td",{className:s.th,children:"input"}),e.jsx("td",{className:s.th,children:"output"})]}),e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label}),e.jsx("td",{className:s.td,children:q(v)}),e.jsx("td",{className:s.td,children:q(p.output)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:"Cache"}),e.jsx("td",{className:s.th,children:"create"}),e.jsx("td",{className:s.th,children:"read"})]}),e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label}),e.jsx("td",{className:s.td,children:q(p.cacheCreation)}),e.jsx("td",{className:s.td,children:q(p.cacheRead)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:l("ui.hitRate")}),e.jsxs("td",{colSpan:2,className:s.td,children:[b,"%"]})]})]})})]},f)})}),m=this.renderCacheRebuildStats(),u=h.length>0?e.jsx("div",{className:s.toolStatsColumn,children:e.jsxs("div",{className:s.modelCard,children:[e.jsx("div",{className:s.modelName,children:l("ui.toolUsageStats")}),e.jsxs("table",{className:s.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${s.th} ${s.thLeft}`,children:"Tool"}),e.jsx("td",{className:s.th,children:l("ui.cacheRebuild.count")})]})}),e.jsxs("tbody",{children:[h.map(([f,p])=>e.jsxs("tr",{className:s.rowBorder,children:[e.jsxs("td",{className:s.label,children:[f," ",e.jsx(O,{doc:`Tool-${f}`})]}),e.jsx("td",{className:s.td,children:p})]},f)),h.length>1&&e.jsxs("tr",{className:s.rebuildTotalRow,children:[e.jsx("td",{className:s.label,children:"Total"}),e.jsx("td",{className:s.td,children:h.reduce((f,p)=>f+p[1],0)})]})]})]})]})}):null,j=d.length>0?e.jsx("div",{className:s.toolStatsColumn,children:e.jsxs("div",{className:s.modelCard,children:[e.jsx("div",{className:s.modelName,children:l("ui.skillUsageStats")}),e.jsxs("table",{className:s.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${s.th} ${s.thLeft}`,children:"Skill"}),e.jsx("td",{className:s.th,children:l("ui.cacheRebuild.count")})]})}),e.jsxs("tbody",{children:[d.map(([f,p])=>e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label,children:f}),e.jsx("td",{className:s.td,children:p})]},f)),d.length>1&&e.jsxs("tr",{className:s.rebuildTotalRow,children:[e.jsx("td",{className:s.label,children:"Total"}),e.jsx("td",{className:s.td,children:d.reduce((f,p)=>f+p[1],0)})]})]})]})]})}):null,S=e.jsxs("div",{className:s.tokenStatsContainer,children:[g,m,u,j]});return this._tokenStatsCache=S,this._tokenStatsCacheReq=t,this._tokenStatsCacheHl=n,this._tokenStatsCacheFade=o,S}_cacheUnbindScrollFade(){this._cacheOnScrollFade&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scroll",this._cacheOnScrollFade),this._cacheOnScrollFade=null)}_cacheBindScrollFade(){this._cacheUnbindScrollFade();const t=this._cacheScrollEl;t&&(this._cacheOnScrollFade=()=>{clearTimeout(this._cacheAutoFadeTimer),this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade()},t.addEventListener("scroll",this._cacheOnScrollFade,{passive:!0}))}scrollToCacheMsg(t){if(this.props.viewMode==="raw"&&this.props.onNavigateCacheMsg&&this.props.onNavigateCacheMsg(t),(this.state._cacheSectionCollapsed||{}).messages){this.setState(d=>({_cacheSectionCollapsed:{...d._cacheSectionCollapsed||{},messages:!1}}),()=>this.scrollToCacheMsg(t));return}const n=this._cacheScrollEl;if(!n)return;const o=n.querySelector(`[data-msg-idx="${t}"]`);if(!o)return;clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&n.removeEventListener("scrollend",this._cacheScrollEndHandler),this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1});let i=!1,r=!1;const h=()=>{!i||!r||(this.setState({cacheHighlightIdx:t,cacheHighlightFading:!1}),this._cacheScrollSettleTimer=setTimeout(()=>this._cacheBindScrollFade(),200),this._cacheAutoFadeTimer=setTimeout(()=>{this.state.cacheHighlightIdx===t&&!this.state.cacheHighlightFading&&(this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade())},3e3))};this._cacheScrollEndHandler=()=>{n.removeEventListener("scrollend",this._cacheScrollEndHandler),i=!0,h()},n.addEventListener("scrollend",this._cacheScrollEndHandler,{once:!0}),this._cacheScrollSettleTimer=setTimeout(()=>{n.removeEventListener("scrollend",this._cacheScrollEndHandler),i=!0,h()},800),this._cacheHighlightDelayTimer=setTimeout(()=>{r=!0,h()},500),o.scrollIntoView({behavior:"smooth",block:"center"})}renderCacheContentPopover(t){const{requests:n=[],serverCachedContent:o}=this.props,i=o||jt(n);i&&(i.cacheCreateTokens>0||i.cacheReadTokens>0)&&(this._lastCachedTokens={cacheCreateTokens:i.cacheCreateTokens,cacheReadTokens:i.cacheReadTokens}),t>0&&(this._lastContextPercent=t);const r=Array.isArray(i==null?void 0:i.tools)?i.tools:null;let h;r===this._lastToolsRef&&this._lastParsedTools?h=this._lastParsedTools:(h=Ot(r),this._lastToolsRef=r,this._lastParsedTools=h);const{builtin:d,mcpByServer:g}=h,m=d.length>0,u=g.size>0,j=({name:T,description:M})=>{const C=[T,M].filter(Boolean).join(`
|
|
11
11
|
|
|
12
|
-
`),
|
|
12
|
+
`),w=e.jsx("span",{className:s.cacheToolChip,title:C,children:T});return e.jsx(O,{doc:`Tool-${T}`,children:w},T)},S=({name:T,fullName:M,description:C})=>{const w=[M,C].filter(Boolean).join(`
|
|
13
13
|
|
|
14
|
-
`);return e.jsx("span",{className:s.cacheToolChip,title:
|
|
14
|
+
`);return e.jsx("span",{className:s.cacheToolChip,title:w,children:T},M)},f=(T,M,C,w,I)=>{const F=(this.state._cacheSectionCollapsed||{})[T],H=F!==void 0?!!F:w,L=()=>this.setState(V=>({_cacheSectionCollapsed:{...V._cacheSectionCollapsed||{},[T]:!H}}));return e.jsxs("div",{className:s.cacheSection,children:[e.jsxs("button",{type:"button",className:s.cacheSectionTitle,onClick:L,"aria-expanded":!H,children:[e.jsx("span",{className:s.cacheSectionArrow,children:H?"▶":"▼"}),l(M)," (",C,")"]}),!H&&I]})},p=e.jsx("div",{className:s.toolChipGrid,children:d.map(j)}),v=e.jsx("div",{className:s.toolChipGridVertical,children:Array.from(g.entries()).map(([T,M])=>e.jsxs("div",{className:s.mcpServerGroup,children:[e.jsxs("div",{className:s.mcpServerName,children:[T," (",M.length,")"]}),e.jsx("div",{className:s.toolChipGrid,children:M.map(S)})]},T))}),b=t>=80?"var(--color-error-light)":t>=60?"var(--color-warning-light)":"var(--color-success)";return e.jsxs("div",{className:s.cachePopover,children:[e.jsx("div",{className:s.cachePopoverHeader,children:e.jsxs("div",{className:s.cachePopoverTitle,children:[e.jsxs("span",{className:s.cachePercent,style:{color:b},children:[t,"%"]}),e.jsx("span",{className:s.cacheCalibrationLabel,children:l("ui.calibrationModelLabel")}),e.jsx(le,{size:"small",value:this.state.calibrationModel,onChange:this.handleCalibrationModelChange,options:De,className:s.calibrationSelect,popupMatchSelectWidth:!1})]})}),(m||u)&&e.jsxs("div",{className:s.cacheScrollArea,children:[m&&f("tools_builtin","ui.builtinTools",d.length,!0,p),u&&f("tools_mcp","ui.mcpTools",Array.from(g.values()).reduce((T,M)=>T+M.length,0),!1,v)]})]})}renderCacheRebuildStats(){const{requests:t=[]}=this.props,n=Ut(t),o=["ttl","system_change","tools_change","model_change","msg_truncated","msg_modified","key_change"],i={ttl:"cacheLoss.ttl",system_change:"cacheLoss.systemChange",tools_change:"cacheLoss.toolsChange",model_change:"cacheLoss.modelChange",msg_truncated:"cacheLoss.msgTruncated",msg_modified:"cacheLoss.msgModified",key_change:"cacheLoss.keyChange"},r=o.filter(v=>n[v].count>0),h=r.reduce((v,b)=>v+n[b].count,0),d=r.reduce((v,b)=>v+n[b].cacheCreate,0);Kt(t);const g={},m={};for(let v=0;v<t.length;v++){const b=fe(t[v],t[v+1]);if(b.type==="SubAgent"){const T=b.subType||"Other";g[T]=(g[T]||0)+1}else if(b.type==="Teammate"){const T=b.subType||"Teammate";m[T]=(m[T]||0)+1}}const u=Object.entries(g).sort((v,b)=>b[1]-v[1]),j=Object.entries(m).sort((v,b)=>b[1]-v[1]),S=r.length>0,f=u.length>0,p=j.length>0;return!S&&!f&&!p?null:e.jsxs("div",{className:s.toolStatsColumn,children:[S&&e.jsxs("div",{className:f||p?s.modelCardSpaced:s.modelCard,children:[e.jsxs("div",{className:s.modelName,children:["MainAgent",e.jsx(O,{doc:"MainAgent"})," ",l("ui.cacheRebuildStats"),e.jsx(O,{doc:"CacheRebuild"})]}),e.jsxs("table",{className:s.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${s.th} ${s.thLeft}`,children:l("ui.cacheRebuild.reason")}),e.jsx("td",{className:s.th,children:l("ui.cacheRebuild.count")}),e.jsx("td",{className:s.th,children:l("ui.cacheRebuild.cacheCreate")})]})}),e.jsxs("tbody",{children:[r.map(v=>e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label,children:l(`ui.${i[v]}`)}),e.jsx("td",{className:s.td,children:n[v].count}),e.jsx("td",{className:s.td,children:q(n[v].cacheCreate)})]},v)),r.length>1&&e.jsxs("tr",{className:s.rebuildTotalRow,children:[e.jsx("td",{className:s.label,children:"Total"}),e.jsx("td",{className:s.td,children:h}),e.jsx("td",{className:s.td,children:q(d)})]})]})]})]}),f&&e.jsxs("div",{className:p?s.modelCardSpaced:s.modelCard,children:[e.jsx("div",{className:s.modelName,children:l("ui.subAgentStats")}),e.jsxs("table",{className:s.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${s.th} ${s.thLeft}`,children:"SubAgent"}),e.jsx("td",{className:s.th,children:l("ui.cacheRebuild.count")})]})}),e.jsxs("tbody",{children:[u.map(([v,b])=>e.jsxs("tr",{className:s.rowBorder,children:[e.jsxs("td",{className:s.label,children:[v," ",e.jsx(O,{doc:`SubAgent-${v}`})]}),e.jsx("td",{className:s.td,children:b})]},v)),u.length>1&&e.jsxs("tr",{className:s.rebuildTotalRow,children:[e.jsx("td",{className:s.label,children:"Total"}),e.jsx("td",{className:s.td,children:u.reduce((v,b)=>v+b[1],0)})]})]})]})]}),p&&e.jsxs("div",{className:s.modelCard,children:[e.jsxs("div",{className:s.modelName,children:["Teammate",e.jsx(O,{doc:"Teammate"})]}),e.jsxs("table",{className:s.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${s.th} ${s.thLeft}`,children:"Name"}),e.jsx("td",{className:s.th,children:l("ui.cacheRebuild.count")})]})}),e.jsxs("tbody",{children:[j.map(([v,b])=>e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label,children:v}),e.jsx("td",{className:s.td,children:b})]},v)),j.length>1&&e.jsxs("tr",{className:s.rebuildTotalRow,children:[e.jsx("td",{className:s.label,children:"Total"}),e.jsx("td",{className:s.td,children:j.reduce((v,b)=>v+b[1],0)})]})]})]})]})]})}renderTextPrompt(t){return e.jsx("div",{className:s.textPromptCard,children:t.segments.map((n,o)=>n.type==="text"?e.jsx("pre",{className:s.preText,children:n.content},o):e.jsx(Lt,{size:"small",className:s.systemCollapse,items:[{key:`sys-${o}`,label:e.jsx("span",{className:s.systemLabel,children:n.label}),children:e.jsx("pre",{className:s.preSys,children:n.content})}]},o))})}renderOriginalPrompt(t){const n=t.segments.filter(o=>o.type==="text");return n.length===0?null:e.jsx("div",{className:s.textPromptCard,children:n.map((o,i)=>e.jsx("pre",{className:s.preText,children:o.content},i))})}buildTextModeContent(){const{promptData:t}=this.state,n=[];for(const o of t){const i=(o.segments||[]).filter(r=>r.type==="text").map(r=>r.content);i.length>0&&n.push(i.join(`
|
|
15
15
|
`))}return n.join(`
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
`)}renderProjectStatsContent(){const{projectStats:t,projectStatsLoading:n}=this.state;if(n)return e.jsx("div",{className:s.projectStatsCenter,children:e.jsx(pt,{})});if(!t)return e.jsx("div",{className:s.projectStatsEmpty,children:l("ui.projectStats.noData")});const{summary:o,models:i,updatedAt:r}=t;i&&Object.entries(i).sort((g,m)=>m[1]-g[1]);const h={};if(t.files){for(const g of Object.values(t.files))if(g.models)for(const[m,u]of Object.entries(g.models))h[m]||(h[m]={input:0,output:0,cacheRead:0,cacheCreation:0,count:0}),h[m].input+=u.input_tokens||0,h[m].output+=u.output_tokens||0,h[m].cacheRead+=u.cache_read_input_tokens||0,h[m].cacheCreation+=u.cache_creation_input_tokens||0,h[m].count+=u.count||0}const d=Object.entries(h).sort((g,m)=>m[1].count-g[1].count);return e.jsxs("div",{className:s.projectStatsContent,children:[r&&e.jsx("div",{className:s.projectStatsUpdated,children:l("ui.projectStats.updatedAt",{time:new Date(r).toLocaleString()})}),e.jsxs("div",{className:s.projectStatsSummary,children:[e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:(o==null?void 0:o.requestCount)??0}),e.jsx("div",{className:s.projectStatLabel,children:l("ui.projectStats.totalRequests")})]}),e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:(o==null?void 0:o.turnCount)??(o==null?void 0:o.sessionCount)??0}),e.jsx("div",{className:s.projectStatLabel,children:l("ui.projectStats.turnCount")})]}),e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:(o==null?void 0:o.fileCount)??0}),e.jsx("div",{className:s.projectStatLabel,children:l("ui.projectStats.totalFiles")})]}),e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:P(o==null?void 0:o.input_tokens)}),e.jsx("div",{className:s.projectStatLabel,children:"Input Tokens"})]}),e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:P(o==null?void 0:o.output_tokens)}),e.jsx("div",{className:s.projectStatLabel,children:"Output Tokens"})]})]}),d.length>0&&e.jsxs("div",{className:s.projectStatsSection,children:[e.jsx("div",{className:s.projectStatsSectionTitle,children:l("ui.projectStats.modelUsage")}),d.map(([g,m])=>{const u=m.input+m.cacheRead+m.cacheCreation,y=u>0?(m.cacheRead/u*100).toFixed(1):"0.0";return e.jsxs("div",{className:s.projectStatsModelCard,children:[e.jsxs("div",{className:s.projectStatsModelHeader,children:[e.jsx("span",{className:s.projectStatsModelName,children:g}),e.jsxs("span",{className:s.projectStatsModelCount,children:[m.count," reqs"]})]}),e.jsx("table",{className:s.statsTable,children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:"Token"}),e.jsx("td",{className:s.th,children:"input"}),e.jsx("td",{className:s.th,children:"output"})]}),e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label}),e.jsx("td",{className:s.td,children:P(u)}),e.jsx("td",{className:s.td,children:P(m.output)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:"Cache"}),e.jsx("td",{className:s.th,children:"create"}),e.jsx("td",{className:s.th,children:"read"})]}),e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label}),e.jsx("td",{className:s.td,children:P(m.cacheCreation)}),e.jsx("td",{className:s.td,children:P(m.cacheRead)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:l("ui.hitRate")}),e.jsxs("td",{colSpan:2,className:s.td,children:[y,"%"]})]})]})})]},g)})]})]})}render(){var Ke;const{requestCount:t,requests:n=[],viewMode:o,cacheType:i,onToggleViewMode:r,onImportLocalLogs:h,onLangChange:d,isLocalLog:g,localLogFile:m,projectName:u,collapseToolResults:y,onCollapseToolResultsChange:S,expandThinking:j,onExpandThinkingChange:p,showFullToolContent:b,onShowFullToolContentChange:f,expandDiff:T,onExpandDiffChange:M,filterIrrelevant:C,onFilterIrrelevantChange:w,logDir:I,onLogDirChange:D,updateInfo:z,onDismissUpdate:L,cliMode:O,terminalVisible:V,onToggleTerminal:ne,onReturnToWorkspaces:pe,contextWindow:q,serverCachedContent:ki,resumeAutoChoice:Me,onResumeAutoChoiceToggle:$e,onResumeAutoChoiceChange:Oe,themeColor:je,onThemeColorChange:ye,autoApproveSeconds:kt,onAutoApproveChange:Ue}=this.props,{countdownText:Le}=this.state,Tt=[{key:"import-local",icon:e.jsx(ut,{}),label:l("ui.importLocalLogs"),onClick:h},{key:"export-prompts",icon:e.jsx(xs,{}),label:l("ui.exportPrompts"),onClick:this.handleShowPrompts},{key:"plugin-management",icon:e.jsx(ct,{}),label:l("ui.pluginManagement"),onClick:this.handleShowPlugins},{key:"switch-workspace",icon:e.jsx(ut,{className:s.iconMirror}),label:e.jsx("span",{className:s.disabledMenuItem,children:l("ui.switchWorkspace")}),disabled:!0},{key:"process-management",icon:e.jsx(Ae,{}),label:l("ui.processManagement"),onClick:this.handleShowProcesses},{key:"proxy-switch",icon:e.jsx(Ze,{}),label:l("ui.proxySwitch"),onClick:()=>this.setState({proxyModalVisible:!0})},{type:"divider"},{key:"project-stats",icon:e.jsx(dt,{}),label:l("ui.projectStats"),onClick:this.handleShowProjectStats},...o==="raw"?[{key:"global-settings",icon:e.jsx(mt,{}),label:l("ui.globalSettings"),onClick:()=>this.setState({globalSettingsVisible:!0})}]:[],...o==="chat"?[{key:"display-settings",icon:e.jsx(mt,{}),label:l("ui.settings"),onClick:()=>this.setState({settingsDrawerVisible:!0})}]:[]];return e.jsxs("div",{className:s.headerBar,children:[e.jsxs(he,{size:"middle",children:[e.jsx(Rt,{menu:{items:Tt,className:"logo-dropdown-menu"},trigger:["hover"],onOpenChange:_=>this.setState({logoDropdownOpen:_}),align:{offset:[-4,0]},children:e.jsx("span",{className:`${s.logoWrap}${this.state.logoDropdownOpen?` ${s.logoWrapActive}`:""}`,children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`${s.logoImage}${this.state.logoDropdownOpen?` ${s.logoImageActive}`:""}`,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}),e.jsx(ge,{content:()=>this.renderTokenStats(),trigger:"hover",placement:"bottomLeft",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px",maxHeight:"80vh",overflowY:"auto"},children:e.jsxs(Y,{className:s.tokenStatsTag,children:[e.jsx(Ae,{className:s.tokenStatsIcon}),l("ui.tokenStats")]})}),this.props.activeProxyId&&this.props.activeProxyId!=="max"&&(()=>{const _=(this.props.proxyProfiles||[]).find(U=>U.id===this.props.activeProxyId);return _?e.jsxs(Y,{className:s.proxyProfileTag,onClick:()=>this.setState({proxyModalVisible:!0}),children:[e.jsx(Ze,{className:s.proxySwapIcon}),_.name,_.activeModel?` · ${_.activeModel}`:""]}):null})(),(()=>{var We,Je,Ge,Qe,Xe;let _=0;const U=De.find(Q=>Q.value===this.state.calibrationModel),de=U==null?void 0:U.tokens;if(!g){if(de&&(q==null?void 0:q.used_percentage)!=null){const Q=F=>{var se,Ye;const G=(Ye=(se=F.response)==null?void 0:se.body)==null?void 0:Ye.usage;return((G==null?void 0:G.input_tokens)||0)+((G==null?void 0:G.cache_creation_input_tokens)||0)+((G==null?void 0:G.cache_read_input_tokens)||0)};let K=0;for(let F=n.length-1;F>=0;F--)if(Z(n[F])&&((Je=(We=n[F].response)==null?void 0:We.body)!=null&&Je.usage)){K=Q(n[F]);break}if(K>0){const F=de*.835;_=Math.min(100,Math.max(0,Math.round(K/F*100)))}else{const F=q.context_window_size||2e5;_=Math.min(100,Math.max(0,Math.round(q.used_percentage*F/de/83.5*100)))}}else if((q==null?void 0:q.used_percentage)!=null){const Q=this.state.settingsModel?st(this.state.settingsModel):0,K=q.context_window_size||2e5;Q&&Q!==K?_=Math.min(100,Math.max(0,Math.round(q.used_percentage*K/Q/83.5*100))):_=Math.min(100,Math.max(0,Math.round(q.used_percentage/83.5*100)))}else if(n.length>0){const Q=K=>{var G,se;const F=(se=(G=K.response)==null?void 0:G.body)==null?void 0:se.usage;return((F==null?void 0:F.input_tokens)||0)+((F==null?void 0:F.cache_creation_input_tokens)||0)+((F==null?void 0:F.cache_read_input_tokens)||0)};for(let K=n.length-1;K>=0;K--)if(Z(n[K])&&((Qe=(Ge=n[K].response)==null?void 0:Ge.body)!=null&&Qe.usage)){const F=Q(n[K]),se=(de||(q==null?void 0:q.context_window_size)||st(((Xe=n[K].body)==null?void 0:Xe.model)||this.state.settingsModel))*.835;se>0&&F>0&&(_=Math.min(100,Math.max(0,Math.round(F/se*100))));break}}}_===0&&this._lastContextPercent>0&&(_=this._lastContextPercent);const Re=_>=80?"var(--color-error-light)":_>=60?"var(--color-warning-light)":"var(--color-success)";return g?e.jsx(Y,{className:`${s.liveTag} ${s.liveTagHistory}`,children:e.jsx("span",{className:s.liveTagText,children:l("ui.historyLog",{file:m})})}):e.jsx(ge,{content:this.state._cachePopoverOpen?this.renderCacheContentPopover(_):e.jsx("div",{className:s.cachePopoverPlaceholder}),trigger:"hover",placement:"bottomLeft",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px"},onOpenChange:Q=>{this.setState({_cachePopoverOpen:Q}),Q||(this._cacheScrollInited=!1)},children:e.jsxs("span",{className:s.liveTag,style:{borderColor:Re,color:Re},children:[e.jsx("span",{className:s.liveTagFill,style:{width:`${_}%`,backgroundColor:Re}}),e.jsx("span",{className:s.liveTagContent,children:e.jsxs("span",{className:s.liveTagText,children:[l("ui.liveMonitoring"),u?`:${u}`:""]})})]})})})(),z&&e.jsx(Y,{color:z.type==="completed"?"green":"orange",closable:!0,onClose:()=>L&&L(),children:z.type==="completed"?l("ui.update.completed",{version:z.version}):l("ui.update.majorAvailable",{version:z.version})})]}),e.jsxs(he,{size:"middle",children:[Le&&o==="raw"&&e.jsxs(Y,{style:{background:"var(--bg-surface)",border:"1px solid var(--border-hover)",color:Le===l("ui.cacheExpired")?"var(--color-error-light)":"var(--text-secondary)"},children:[l("ui.cacheCountdown",{type:i?`(${i})`:""}),e.jsx("strong",{className:s.countdownStrong,children:Le})]}),o==="chat"&&O&&!g&&this.state.localUrl&&e.jsxs(e.Fragment,{children:[this.state.countryFlag&&((Ke=this.state.countryInfo)==null?void 0:Ke.country)!=="CN"&&e.jsx(ge,{content:this.state.countryInfo?e.jsxs("div",{className:s.countryInfoPopover,children:[e.jsxs("div",{children:[this.state.countryFlag," ",this.state.countryInfo.country]}),this.state.countryInfo.region&&e.jsx("div",{children:this.state.countryInfo.region}),this.state.countryInfo.city&&e.jsx("div",{children:this.state.countryInfo.city}),this.state.countryInfo.org&&e.jsx("div",{className:s.countryInfoMeta,children:this.state.countryInfo.org}),this.state.countryInfo.ip&&e.jsx("div",{className:s.countryInfoMeta,children:this.state.countryInfo.ip})]}):null,trigger:"hover",placement:"bottomRight",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 12px"},children:e.jsx(E,{className:s.compactBtnNoBorder,icon:e.jsx("span",{className:s.countryFlagIcon,children:this.state.countryFlag})})}),e.jsx(ae,{checked:je==="light",onChange:_=>ye&&ye(_?"light":"dark"),checkedChildren:"雪山白",unCheckedChildren:"曜石黑"}),e.jsx(ge,{content:e.jsxs("div",{className:s.qrcodePopover,children:[e.jsxs("div",{className:s.qrcodeTitle,children:[l("ui.scanToCoding")," ",e.jsx($,{doc:"QRCode"})]}),e.jsx(as,{value:this.state.localUrl,size:200,bgColor:je==="light"?"#ffffff":"#141414",fgColor:je==="light"?"#1a1a1a":"#d9d9d9",level:"M"}),e.jsx(ie,{readOnly:!0,value:this.state.localUrl,className:s.qrcodeUrlInput,suffix:e.jsx(xe,{className:s.qrcodeUrlCopy,onClick:()=>{navigator.clipboard.writeText(this.state.localUrl).then(()=>{H.success(l("ui.copied"))}).catch(()=>{})}})})]}),trigger:"hover",placement:"bottomRight",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px"},children:e.jsx(E,{className:s.compactBtnNoBorder,icon:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle"},children:e.jsx("path",{fillRule:"evenodd",d:"M0 0h10v10H0zM2 2v6h6V2zM3 3h4v4H3zM14 0h10v10H14zM16 2v6h6V2zM17 3h4v4H17zM0 14h10v10H0zM2 16v6h6v-6zM3 17h4v4H3zM14 14h3v3h-3zM20 14h3v3h-3zM17 17h3v3h-3zM14 20h3v3h-3zM20 20h3v3h-3z"})})})})]}),O&&o==="chat"&&!g&&e.jsx(E,{className:s.compactBtn,type:V?"primary":"default",ghost:V,icon:e.jsx(Ce,{}),onClick:ne,children:l("ui.terminal")}),e.jsx(E,{className:s.compactBtn,type:o==="raw"?"primary":"default",icon:o==="raw"?e.jsx(vs,{}):e.jsx(be,{}),onClick:r,children:o==="raw"?l("ui.chatMode"):l("ui.rawMode")})]}),e.jsxs(X,{title:`${l("ui.userPrompt")} (${this.state.promptData.length}${l("ui.promptCountUnit")})`,open:this.state.promptModalVisible,onCancel:()=>this.setState({promptModalVisible:!1}),footer:null,width:700,children:[e.jsx("div",{className:s.promptExportBar,children:e.jsx(E,{icon:e.jsx(It,{}),onClick:this.handleExportPromptsTxt,children:l("ui.exportPromptsTxt")})}),e.jsx(gt,{activeKey:this.state.promptViewMode,onChange:_=>this.setState({promptViewMode:_}),size:"small",items:[{key:"original",label:l("ui.promptModeOriginal")},{key:"context",label:l("ui.promptModeContext")},{key:"text",label:l("ui.promptModeText")}]}),this.state.promptViewMode==="text"?e.jsx("textarea",{readOnly:!0,className:s.promptTextarea,value:this.buildTextModeContent()}):e.jsxs("div",{className:s.promptScrollArea,children:[this.state.promptData.length===0&&e.jsx("div",{className:s.promptEmpty,children:l("ui.noPrompt")}),this.state.promptData.map((_,U)=>{const de=_.timestamp?new Date(_.timestamp).toLocaleString():l("ui.unknownTime");return e.jsxs("div",{children:[e.jsxs("div",{className:s.promptTimestamp,children:[de,":"]}),this.state.promptViewMode==="original"?this.renderOriginalPrompt(_):this.renderTextPrompt(_)]},U)})]})]}),e.jsxs(Ie,{title:l("ui.settings"),placement:"left",width:360,open:this.state.settingsDrawerVisible,onClose:()=>this.setState({settingsDrawerVisible:!1}),children:[e.jsxs("div",{className:s.settingsGroupBox,children:[e.jsx("div",{className:s.settingsGroupTitle,children:l("ui.chatDisplaySwitches")}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.collapseToolResults")}),e.jsx(ae,{checked:!!y,onChange:_=>S&&S(_)})]}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.expandThinking")}),e.jsx(ae,{checked:!!j,onChange:_=>p&&p(_)})]}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.showFullToolContent")}),e.jsx(ae,{checked:!!b,onChange:_=>f&&f(_)})]})]}),e.jsxs("div",{className:s.settingsGroupBox,children:[e.jsx("div",{className:s.settingsGroupTitle,children:l("ui.userPreferences")}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.resumeAutoChoice")}),e.jsx(ae,{checked:!!Me,onChange:_=>$e&&$e(_)})]}),Me&&e.jsx("div",{className:s.settingsItem,children:e.jsxs(_e.Group,{value:Me,onChange:_=>Oe&&Oe(_.target.value),size:"small",children:[e.jsx(_e,{value:"continue",children:l("ui.resumeAutoChoice.continue")}),e.jsx(_e,{value:"new",children:l("ui.resumeAutoChoice.new")})]})}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.permission.autoApprove.setting")}),e.jsx(le,{size:"small",value:kt||0,onChange:_=>Ue&&Ue(_),options:[{label:l("ui.permission.autoApprove.off"),value:0},{label:"3s",value:3},{label:"5s",value:5},{label:"10s",value:10},{label:"15s",value:15},{label:"20s",value:20},{label:"30s",value:30},{label:"60s",value:60}],style:{width:100}})]})]}),e.jsx("div",{className:s.settingsGroupBox,children:e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.themeColor")}),e.jsx(le,{size:"small",value:je||"dark",onChange:_=>ye&&ye(_),options:[{label:l("ui.themeColor.dark"),value:"dark"},{label:l("ui.themeColor.light"),value:"light"}],style:{width:140}})]})}),e.jsx("div",{className:s.settingsGroupBox,children:e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.languageSettings")}),e.jsx(le,{size:"small",value:Jt(),onChange:_=>{Wt(_),d&&d()},options:ks.map(_=>({label:_.label,value:_.value})),style:{width:140}})]})})]}),e.jsxs(Ie,{title:e.jsxs("span",{children:[l("ui.globalSettings")," ",e.jsx($,{doc:"GlobalSettings"})]}),placement:"left",width:400,open:this.state.globalSettingsVisible,onClose:()=>this.setState({globalSettingsVisible:!1}),children:[e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.filterIrrelevant")}),e.jsx(ae,{checked:!!C,onChange:_=>w&&w(_)})]}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.expandDiff")}),e.jsx(ae,{checked:!!T,onChange:_=>M&&M(_)})]}),e.jsx("div",{className:s.settingsDivider}),e.jsx("div",{className:s.settingsLabel,children:l("ui.logDirTitle")}),e.jsx(ie,{className:s.logDirInput,value:this.state.logDirDraft??I,onChange:_=>this.setState({logDirDraft:_.target.value}),onBlur:()=>{const _=this.state.logDirDraft;_!=null&&_!==I&&(D==null||D(_)),this.setState({logDirDraft:null})},onPressEnter:()=>{const _=this.state.logDirDraft;_!=null&&_!==I&&(D==null||D(_)),this.setState({logDirDraft:null})},placeholder:"~/.claude/cc-viewer"})]}),e.jsx(Ie,{title:e.jsxs("span",{children:[e.jsx(dt,{className:s.titleIcon}),l("ui.projectStats")]}),placement:"left",width:400,open:this.state.projectStatsVisible,onClose:()=>this.setState({projectStatsVisible:!1}),children:this.renderProjectStatsContent()}),e.jsxs(X,{title:e.jsxs("span",{children:[e.jsx(ct,{className:s.titleIcon}),l("ui.pluginManagement")]}),open:this.state.pluginModalVisible,onCancel:()=>this.setState({pluginModalVisible:!1}),footer:e.jsxs("div",{className:s.pluginModalFooter,children:[e.jsxs("div",{className:s.pluginModalFooterLeft,children:[e.jsx(E,{icon:e.jsx(et,{}),onClick:this.handleAddPlugin,children:l("ui.plugins.add")}),e.jsx(E,{icon:e.jsx(ht,{}),onClick:this.handleShowCdnModal,children:l("ui.plugins.cdnInstall")})]}),e.jsx(E,{icon:e.jsx(He,{}),onClick:this.handleReloadPlugins,children:l("ui.plugins.reload")})]}),width:560,children:[this.state.pluginsDir&&e.jsxs("div",{className:s.pluginDirHint,children:[e.jsxs("span",{className:s.pluginDirLabel,children:[l("ui.plugins.pluginsDir"),":"]})," ",e.jsx("code",{className:s.pluginDirPath,onClick:()=>{navigator.clipboard.writeText(this.state.pluginsDir).then(()=>{H.success(l("ui.copied"))}).catch(()=>{})},children:this.state.pluginsDir})]}),this.state.pluginsList.length===0?e.jsxs("div",{className:s.pluginEmpty,children:[e.jsx("div",{className:s.pluginEmptyTitle,children:l("ui.plugins.empty")}),e.jsx("div",{className:s.pluginEmptyHint,children:l("ui.plugins.emptyHint")})]}):e.jsx("div",{className:s.pluginList,children:this.state.pluginsList.map(_=>e.jsxs("div",{className:s.pluginItem,children:[e.jsxs("div",{className:s.pluginInfo,children:[e.jsx("span",{className:s.pluginName,children:_.name}),e.jsx("span",{className:s.pluginFile,children:_.file}),_.hooks.length>0&&e.jsx("span",{className:s.pluginHooks,children:_.hooks.map(U=>e.jsx("span",{className:s.pluginHookTag,children:U},U))})]}),e.jsxs("div",{className:s.pluginActions,children:[e.jsx(ae,{size:"small",checked:_.enabled,onChange:U=>this.handleTogglePlugin(_.name,U)}),e.jsx(E,{type:"text",size:"small",danger:!0,icon:e.jsx(Fe,{}),onClick:()=>this.handleDeletePlugin(_.file,_.name)})]})]},_.file))})]}),e.jsx(X,{title:l("ui.plugins.delete"),open:this.state.deleteConfirmVisible,onCancel:()=>this.setState({deleteConfirmVisible:!1,deleteTarget:null}),onOk:this.handleDeletePluginConfirm,okType:"danger",okText:"OK",cancelText:"Cancel",children:e.jsx("p",{children:this.state.deleteTarget?l("ui.plugins.deleteConfirm",{name:this.state.deleteTarget.name}):""})}),e.jsx(X,{title:e.jsxs("span",{children:[e.jsx(ht,{className:s.titleIcon}),l("ui.plugins.cdnInstall")]}),open:this.state.cdnModalVisible,onCancel:this.handleCdnCancel,onOk:this.handleCdnInstall,confirmLoading:this.state.cdnLoading,okText:l("ui.plugins.cdnInstallBtn"),cancelText:l("ui.cancel"),width:480,children:e.jsxs("div",{children:[e.jsx("div",{className:s.cdnUrlLabel,children:l("ui.plugins.cdnUrl")}),e.jsx(ie,{placeholder:l("ui.plugins.cdnUrlPlaceholder"),value:this.state.cdnUrl,onChange:this.handleCdnUrlChange,onPressEnter:this.handleCdnInstall,className:s.cdnInput})]})}),e.jsx(X,{title:e.jsxs("span",{children:[e.jsx(Ae,{className:s.titleIcon}),l("ui.processManagement")]}),open:this.state.processModalVisible,onCancel:()=>this.setState({processModalVisible:!1}),footer:e.jsx(E,{icon:e.jsx(He,{}),onClick:this.fetchProcesses,loading:this.state.processLoading,children:l("ui.processManagement.refresh")}),width:780,children:e.jsx(Et,{dataSource:this.state.processList,rowKey:"pid",loading:this.state.processLoading,size:"middle",pagination:!1,columns:[{title:l("ui.processManagement.port"),dataIndex:"port",width:80,render:_=>_?e.jsx("a",{href:`${window.location.protocol}//127.0.0.1:${_}`,target:"_blank",rel:"noopener noreferrer",children:_}):""},{title:"PID",dataIndex:"pid",width:80},{title:l("ui.processManagement.command"),dataIndex:"command",ellipsis:!0},{title:l("ui.processManagement.startTime"),dataIndex:"startTime",width:200},{title:l("ui.processManagement.action"),width:100,render:(_,U)=>U.isCurrent?e.jsx(E,{size:"small",className:s.currentProcessBtn,children:l("ui.processManagement.current")}):e.jsx(E,{size:"small",danger:!0,onClick:()=>this.handleKillProcess(U.pid),children:l("ui.processManagement.kill")})}]})}),e.jsx(X,{title:e.jsxs("span",{children:[e.jsx(yt,{apiEndpoint:W("/api/open-profile-dir"),title:l("ui.proxy.openConfigDir"),size:16})," ",l("ui.proxySwitch")," ",e.jsx($,{doc:"ProxySwitch",zIndex:1100})]}),open:this.state.proxyModalVisible,onCancel:()=>this.setState({proxyModalVisible:!1,editingProxy:null}),footer:null,width:520,children:this.renderProxyProfileList()})]})}renderProxyProfileList(){const t=this.props.proxyProfiles||[],n=this.props.activeProxyId||"max",{editingProxy:o,editForm:i}=this.state;return e.jsxs("div",{children:[e.jsxs("div",{className:s.proxyWarning,children:["⚠️ ",l("ui.proxy.maxWarning")]}),e.jsx("div",{className:s.proxyList,children:t.map(r=>{var h;return e.jsxs("div",{className:`${s.proxyItem} ${r.id===n?s.proxyItemActive:""}`,children:[e.jsxs("div",{className:s.proxyItemMain,onClick:()=>{if(r.id!==n){const d={active:r.id,profiles:t};this.props.onProxyProfileChange(d)}},children:[e.jsx(_e,{checked:r.id===n,style:{marginRight:8}}),e.jsxs("div",{className:s.proxyItemInfo,children:[e.jsxs("div",{className:s.proxyItemNameRow,children:[e.jsx("span",{className:s.proxyItemName,children:r.name}),r.id==="max"&&e.jsx(Y,{className:s.proxyBuiltinTag,children:l("ui.proxy.builtin")})]}),r.id==="max"&&this.props.defaultConfig&&e.jsxs("div",{className:s.proxyItemDetail,children:[(()=>{try{return new URL(this.props.defaultConfig.origin).host}catch{return this.props.defaultConfig.origin}})(),this.props.defaultConfig.authType?` · ${this.props.defaultConfig.authType}`:"",this.props.defaultConfig.apiKey?` · ${this.props.defaultConfig.apiKey}`:"",this.props.defaultConfig.model?` · ${this.props.defaultConfig.model}`:""]}),r.id!=="max"&&r.baseURL&&e.jsxs("div",{className:s.proxyItemDetail,children:[(()=>{try{return new URL(r.baseURL).host}catch{return r.baseURL}})(),r.activeModel?` · ${r.activeModel}`:(h=r.models)!=null&&h.length?` · ${r.models[0]}`:""]})]})]}),r.id!=="max"&&e.jsxs("div",{className:s.proxyItemActions,children:[e.jsx(E,{type:"text",size:"small",icon:e.jsx(Bt,{}),onClick:()=>this.setState({editingProxy:r.id,editForm:{name:r.name||"",baseURL:r.baseURL||"",apiKey:r.apiKey||"",models:(r.models||[]).join(", "),activeModel:r.activeModel||""}})}),e.jsx(E,{type:"text",size:"small",danger:!0,icon:e.jsx(Fe,{}),onClick:()=>{X.confirm({title:l("ui.proxy.deleteProxy"),content:l("ui.proxy.deleteConfirm",{name:r.name}),okType:"danger",onOk:()=>{const d=t.filter(m=>m.id!==r.id),g=n===r.id?"max":n;this.props.onProxyProfileChange({active:g,profiles:d})}})}})]})]},r.id)})}),o&&e.jsxs("div",{className:s.proxyEditForm,children:[e.jsxs("div",{className:s.proxyEditRow,children:[e.jsxs("label",{children:[l("ui.proxy.name")," ",e.jsx("span",{className:s.proxyRequired,children:"*"})]}),e.jsx(ie,{size:"small",value:i.name,onChange:r=>{const h=r.target.value;this.setState(d=>({editForm:{...d.editForm,name:h}}))}})]}),e.jsxs("div",{className:s.proxyEditRow,children:[e.jsxs("label",{children:[l("ui.proxy.baseURL")," ",e.jsx("span",{className:s.proxyRequired,children:"*"})]}),e.jsx(ie,{size:"small",value:i.baseURL,onChange:r=>{const h=r.target.value;this.setState(d=>({editForm:{...d.editForm,baseURL:h}}))},placeholder:"https://api.example.com"})]}),e.jsxs("div",{className:s.proxyEditRow,children:[e.jsxs("label",{children:[l("ui.proxy.apiKey")," ",e.jsx("span",{className:s.proxyRequired,children:"*"})]}),e.jsx(ie.Password,{size:"small",value:i.apiKey,onChange:r=>{const h=r.target.value;this.setState(d=>({editForm:{...d.editForm,apiKey:h}}))},placeholder:"sk-..."})]}),e.jsx("div",{className:s.proxyEditDivider}),e.jsxs("div",{className:s.proxyEditRow,children:[e.jsx("label",{children:l("ui.proxy.models")}),e.jsx(ie,{size:"small",value:i.models,onChange:r=>{const h=r.target.value;this.setState(d=>({editForm:{...d.editForm,models:h}}))},placeholder:"model-1, model-2"})]}),e.jsxs("div",{className:s.proxyEditRow,children:[e.jsx("label",{children:l("ui.proxy.activeModel")}),e.jsx(le,{size:"small",className:s.fullWidthSelect,value:i.activeModel||void 0,onChange:r=>this.setState(h=>({editForm:{...h.editForm,activeModel:r}})),placeholder:l("ui.proxy.activeModel"),children:(i.models||"").split(",").map(r=>r.trim()).filter(Boolean).map(r=>e.jsx(le.Option,{value:r,children:r},r))})]}),e.jsxs("div",{className:s.proxyEditBtns,children:[e.jsx(E,{size:"small",icon:e.jsx(At,{}),type:"primary",onClick:()=>{var g,m,u;if(!((g=i.name)!=null&&g.trim())||!((m=i.baseURL)!=null&&m.trim())||!((u=i.apiKey)!=null&&u.trim())){H.warning(l("ui.proxy.requiredFields"));return}const r=(i.models||"").split(",").map(y=>y.trim()).filter(Boolean),h={id:o==="__new__"?`proxy_${Date.now()}`:o,name:i.name.trim(),baseURL:i.baseURL.trim(),apiKey:i.apiKey.trim(),models:r,activeModel:i.activeModel||r[0]||""};let d;o==="__new__"?d=[...t,h]:d=t.map(y=>y.id===o?{...y,...h,id:y.id}:y),this.props.onProxyProfileChange({active:n,profiles:d}),this.setState({editingProxy:null})},children:l("ui.proxy.save")}),e.jsx(E,{size:"small",icon:e.jsx(Dt,{}),onClick:()=>this.setState({editingProxy:null}),children:l("ui.proxy.cancel")})]})]}),!o&&e.jsx(E,{block:!0,type:"dashed",icon:e.jsx(et,{}),style:{marginTop:12},onClick:()=>this.setState({editingProxy:"__new__",editForm:{name:"",baseURL:"",apiKey:"",models:"",activeModel:""}}),children:l("ui.proxy.addProxy")})]})}};R(ue,"COMMAND_TAGS",new Set(["command-name","command-message","command-args","local-command-caveat","local-command-stdout"]));let Se=ue;const ws="_centerEmpty_midza_1",Ms="_scrollContainer_midza_8",Ls="_listItem_midza_15",Rs="_listItemActive_midza_29",Is="_itemContent_midza_46",Es="_itemHeader_midza_51",Bs="_tagNoMargin_midza_59",As="_modelName_midza_64",Ds="_modelNameMain_midza_69",Fs="_time_midza_73",Hs="_detailRow_midza_79",Ps="_urlText_midza_86",qs="_duration_midza_95",zs="_statusOk_midza_100",Vs="_statusErr_midza_106",$s="_statusDefault_midza_111",Os="_usageBox_midza_116",Us="_cacheDot_midza_126",Ks="_cacheDotLoss_midza_135",Ws="_cacheDotNormal_midza_140",Js="_tagMainAgent_midza_144",Gs="_tagPlan_midza_150",Qs="_tagMuted_midza_156",Xs="_tooltipPreLine_midza_162",A={centerEmpty:ws,scrollContainer:Ms,listItem:Ls,listItemActive:Rs,itemContent:Is,itemHeader:Es,tagNoMargin:Bs,modelName:As,modelNameMain:Ds,time:Fs,detailRow:Hs,urlText:Ps,duration:qs,statusOk:zs,statusErr:Vs,statusDefault:$s,usageBox:Os,cacheDot:Us,cacheDotLoss:Ks,cacheDotNormal:Ws,tagMainAgent:Js,tagPlan:Gs,tagMuted:Qs,tooltipPreLine:Xs};class Ys extends me.Component{constructor(t){super(t);R(this,"handleKeyDown",t=>{if(t.key!=="ArrowUp"&&t.key!=="ArrowDown")return;const{requests:n,selectedIndex:o,onSelect:i}=this.props;if(!n.length)return;t.preventDefault();const r=o??0,h=t.key==="ArrowUp"?Math.max(0,r-1):Math.min(n.length-1,r+1);h!==r&&i(h)});this.activeItemRef=me.createRef()}componentDidMount(){this.scrollToSelected(!0)}shouldComponentUpdate(t){return t.requests!==this.props.requests||t.selectedIndex!==this.props.selectedIndex||t.scrollCenter!==this.props.scrollCenter||t.cacheLossMap!==this.props.cacheLossMap}componentDidUpdate(t){this.props.scrollCenter&&t.selectedIndex!==this.props.selectedIndex?this.scrollToSelected(!0):t.selectedIndex!==this.props.selectedIndex&&(this.scrollToSelected(!1),this.activeItemRef.current&&this.activeItemRef.current.focus({preventScroll:!0}))}scrollToSelected(t){this.activeItemRef.current&&(this.activeItemRef.current.scrollIntoView({block:t?"center":"nearest",behavior:"instant"}),t&&this.props.onScrollDone&&this.props.onScrollDone())}render(){const{requests:t,selectedIndex:n,onSelect:o}=this.props;return t.length===0?e.jsx("div",{className:A.centerEmpty,children:e.jsx(oe,{description:l("ui.waitingRequests")})}):e.jsx("div",{className:A.scrollContainer,onKeyDown:this.handleKeyDown,children:e.jsx(tt,{dataSource:t,size:"small",split:!1,renderItem:(i,r)=>{var w,I,D;const h=new Date(i.timestamp).toLocaleTimeString("zh-CN"),d=r===n,g=i.response&&i.response.status<400,m=i.response&&i.response.status>=400,u=Gt((w=i.body)==null?void 0:w.model),y=r+1<t.length?t[r+1]:null,{type:S,subType:j}=fe(i,y),p=(D=(I=i.response)==null?void 0:I.body)==null?void 0:D.usage,b=p?(p.input_tokens||0)+(p.cache_read_input_tokens||0)+(p.cache_creation_input_tokens||0):null,f=(p==null?void 0:p.output_tokens)||null,T=(p==null?void 0:p.cache_read_input_tokens)||0,M=(p==null?void 0:p.cache_creation_input_tokens)||0;let C=i.url;try{const z=new URL(i.url);C=z.host+z.pathname}catch{}return e.jsx(tt.Item,{ref:d?this.activeItemRef:void 0,tabIndex:0,onClick:()=>o(r),className:`${A.listItem} ${d?A.listItemActive:""}`,children:e.jsxs("div",{className:A.itemContent,children:[e.jsxs("div",{className:A.itemHeader,children:[S==="MainAgent"?e.jsx(Y,{className:`${A.tagNoMargin} ${A.tagMainAgent}`,children:"MainAgent"}):S==="Plan"?e.jsx(Y,{className:`${A.tagNoMargin} ${A.tagPlan}`,children:at(S,j)}):S==="Count"||S==="Preflight"?e.jsx(Y,{className:`${A.tagNoMargin} ${A.tagMuted}`,children:S}):e.jsx(Y,{className:A.tagNoMargin,children:at(S,j)}),u&&e.jsx("span",{className:`${A.modelName} ${S==="MainAgent"?A.modelNameMain:""}`,children:u}),e.jsx("span",{className:A.time,children:h})]}),e.jsxs("div",{className:A.detailRow,children:[e.jsx("span",{className:A.urlText,title:i.url,children:C}),i.duration&&e.jsxs("span",{className:A.duration,children:[i.duration,"ms"]}),i.response&&e.jsx("span",{className:g?A.statusOk:m?A.statusErr:A.statusDefault,children:i.response.status})]}),p&&e.jsxs("div",{className:A.usageBox,children:[e.jsxs("div",{children:["token: output:",P(f)||0,", input: ",P(b)||0]}),(T>0||M>0)&&e.jsx("div",{children:(()=>{var V;const z=(V=this.props.cacheLossMap)==null?void 0:V.get(r),L={ttl:"ui.cacheLoss.ttl",system_change:"ui.cacheLoss.systemChange",tools_change:"ui.cacheLoss.toolsChange",model_change:"ui.cacheLoss.modelChange",msg_truncated:"ui.cacheLoss.msgTruncated",msg_modified:"ui.cacheLoss.msgModified",key_change:"ui.cacheLoss.keyChange"};let O;if(z){const pe=(z.reasons||[z.reason]).map(q=>l(L[q]||L.key_change)).join(`
|
|
19
|
-
`);O=e.jsx(xt,{title:e.jsx("span",{className:A.tooltipPreLine,children:pe}),children:e.jsx("span",{className:`${A.cacheDot} ${A.cacheDotLoss}`})})}else O=e.jsx("span",{className:`${A.cacheDot} ${A.cacheDotNormal}`});return e.jsxs(e.Fragment,{children:["cache",O,": ",T>0?`read:${P(T)}`:"",T>0&&M>0?", ":"",M>0?`create:${P(M)}`:""]})})()})]})]})})}})})}}const Zs=c=>typeof c=="boolean"||c instanceof Boolean,ea=c=>typeof c=="number"||c instanceof Number,ta=c=>typeof c=="bigint"||c instanceof BigInt,vt=c=>!!c&&c instanceof Date,sa=c=>typeof c=="string"||c instanceof String,aa=c=>Array.isArray(c),bt=c=>typeof c=="object"&&c!==null,Ct=c=>!!c&&c instanceof Object&&typeof c=="function";function ke(c,a){return a===void 0&&(a=!1),!c||a?`"${c}"`:c}function na(c,a,t){return t?JSON.stringify(c):a?`"${c}"`:c}function Nt(c){let{field:a,value:t,data:n,lastElement:o,openBracket:i,closeBracket:r,level:h,style:d,shouldExpandNode:g,clickToExpandNode:m,outerRef:u,beforeExpandChange:y}=c;const S=N.useRef(!1),[j,p]=N.useState(()=>g(h,t,a)),b=N.useRef(null);N.useEffect(()=>{S.current?p(g(h,t,a)):S.current=!0},[g]);const f=N.useId();if(n.length===0)return ia({field:a,openBracket:i,closeBracket:r,lastElement:o,style:d});const T=j?d.collapseIcon:d.expandIcon,M=j?d.ariaLables.collapseJson:d.ariaLables.expandJson,C=h+1,w=n.length-1,I=L=>{j!==L&&(!y||y({level:h,value:t,field:a,newExpandValue:L}))&&p(L)},D=L=>{if(L.key==="ArrowRight"||L.key==="ArrowLeft")L.preventDefault(),I(L.key==="ArrowRight");else if(L.key==="ArrowUp"||L.key==="ArrowDown"){L.preventDefault();const O=L.key==="ArrowUp"?-1:1;if(!u.current)return;const V=u.current.querySelectorAll("[role=button]");let ne=-1;for(let q=0;q<V.length;q++)if(V[q].tabIndex===0){ne=q;break}if(ne<0)return;const pe=(ne+O+V.length)%V.length;V[ne].tabIndex=-1,V[pe].tabIndex=0,V[pe].focus()}},z=()=>{var L;I(!j);const O=b.current;if(!O)return;const V=(L=u.current)===null||L===void 0?void 0:L.querySelector('[role=button][tabindex="0"]');V&&(V.tabIndex=-1),O.tabIndex=0,O.focus()};return N.createElement("div",{className:d.basicChildStyle,role:"treeitem","aria-expanded":j,"aria-selected":void 0},N.createElement("span",{className:T,onClick:z,onKeyDown:D,role:"button","aria-label":M,"aria-expanded":j,"aria-controls":j?f:void 0,ref:b,tabIndex:h===0?0:-1}),(a||a==="")&&(m?N.createElement("span",{className:d.clickableLabel,onClick:z,onKeyDown:D},ke(a,d.quotesForFieldNames),":"):N.createElement("span",{className:d.label},ke(a,d.quotesForFieldNames),":")),N.createElement("span",{className:d.punctuation},i),j?N.createElement("ul",{id:f,role:"group",className:d.childFieldsContainer},n.map((L,O)=>N.createElement(qe,{key:L[0]||O,field:L[0],value:L[1],style:d,lastElement:O===w,level:C,shouldExpandNode:g,clickToExpandNode:m,beforeExpandChange:y,outerRef:u}))):N.createElement("span",{className:d.collapsedContent,onClick:z,onKeyDown:D}),N.createElement("span",{className:d.punctuation},r),!o&&N.createElement("span",{className:d.punctuation},","))}function ia(c){let{field:a,openBracket:t,closeBracket:n,lastElement:o,style:i}=c;return N.createElement("div",{className:i.basicChildStyle,role:"treeitem","aria-selected":void 0},(a||a==="")&&N.createElement("span",{className:i.label},ke(a,i.quotesForFieldNames),":"),N.createElement("span",{className:i.punctuation},t),N.createElement("span",{className:i.punctuation},n),!o&&N.createElement("span",{className:i.punctuation},","))}function la(c){let{field:a,value:t,style:n,lastElement:o,shouldExpandNode:i,clickToExpandNode:r,level:h,outerRef:d,beforeExpandChange:g}=c;return Nt({field:a,value:t,lastElement:o||!1,level:h,openBracket:"{",closeBracket:"}",style:n,shouldExpandNode:i,clickToExpandNode:r,data:Object.keys(t).map(m=>[m,t[m]]),outerRef:d,beforeExpandChange:g})}function oa(c){let{field:a,value:t,style:n,lastElement:o,level:i,shouldExpandNode:r,clickToExpandNode:h,outerRef:d,beforeExpandChange:g}=c;return Nt({field:a,value:t,lastElement:o||!1,level:i,openBracket:"[",closeBracket:"]",style:n,shouldExpandNode:r,clickToExpandNode:h,data:t.map(m=>[void 0,m]),outerRef:d,beforeExpandChange:g})}function ra(c){let{field:a,value:t,style:n,lastElement:o}=c,i,r=n.otherValue;return t===null?(i="null",r=n.nullValue):t===void 0?(i="undefined",r=n.undefinedValue):sa(t)?(i=na(t,!n.noQuotesForStringValues,n.stringifyStringValues),r=n.stringValue):Zs(t)?(i=t?"true":"false",r=n.booleanValue):ea(t)?(i=t.toString(),r=n.numberValue):ta(t)?(i=`${t.toString()}n`,r=n.numberValue):vt(t)?i=t.toISOString():Ct(t)?i="function() { }":i=t.toString(),N.createElement("div",{className:n.basicChildStyle,role:"treeitem","aria-selected":void 0},(a||a==="")&&N.createElement("span",{className:n.label},ke(a,n.quotesForFieldNames),":"),N.createElement("span",{className:r},i),!o&&N.createElement("span",{className:n.punctuation},","))}function qe(c){const a=c.value;return aa(a)?N.createElement(oa,Object.assign({},c)):bt(a)&&!vt(a)&&!Ct(a)?N.createElement(la,Object.assign({},c)):N.createElement(ra,Object.assign({},c))}var B={"container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};const St={collapseJson:"collapse JSON",expandJson:"expand JSON"},Ne={container:B["container-light"],basicChildStyle:B["basic-element-style"],childFieldsContainer:B["child-fields-container"],label:B["label-light"],clickableLabel:B["clickable-label-light"],nullValue:B["value-null-light"],undefinedValue:B["value-undefined-light"],stringValue:B["value-string-light"],booleanValue:B["value-boolean-light"],numberValue:B["value-number-light"],otherValue:B["value-other-light"],punctuation:B["punctuation-light"],collapseIcon:B["collapse-icon-light"],expandIcon:B["expand-icon-light"],collapsedContent:B["collapsed-content-light"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:St,stringifyStringValues:!1},ca={container:B["container-dark"],basicChildStyle:B["basic-element-style"],childFieldsContainer:B["child-fields-container"],label:B["label-dark"],clickableLabel:B["clickable-label-dark"],nullValue:B["value-null-dark"],undefinedValue:B["value-undefined-dark"],stringValue:B["value-string-dark"],booleanValue:B["value-boolean-dark"],numberValue:B["value-number-dark"],otherValue:B["value-other-dark"],punctuation:B["punctuation-dark"],collapseIcon:B["collapse-icon-dark"],expandIcon:B["expand-icon-dark"],collapsedContent:B["collapsed-content-dark"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:St,stringifyStringValues:!1},da=()=>!0,ha=c=>{let{data:a,style:t=Ne,shouldExpandNode:n=da,clickToExpandNode:o=!1,beforeExpandChange:i,compactTopLevel:r,...h}=c;const d=N.useRef(null);return N.createElement("div",Object.assign({"aria-label":"JSON view"},h,{className:t.container,ref:d,role:"tree"}),r&&bt(a)?Object.entries(a).map(g=>{let[m,u]=g;return N.createElement(qe,{key:m,field:m,value:u,style:{...Ne,...t},lastElement:!0,level:1,shouldExpandNode:n,clickToExpandNode:o,beforeExpandChange:i,outerRef:d})}):N.createElement(qe,{value:a,style:{...Ne,...t},lastElement:!0,level:0,shouldExpandNode:n,clickToExpandNode:o,outerRef:d,beforeExpandChange:i}))},ua="_container_qeuid_1",ma={container:ua};class Te extends me.Component{shouldComponentUpdate(a){return a.data!==this.props.data||a.defaultExpand!==this.props.defaultExpand||a.expandNode!==this.props.expandNode}render(){const{data:a,defaultExpand:t,expandNode:n}=this.props,i={...typeof document<"u"&&document.documentElement.getAttribute("data-theme")!=="light"?ca:Ne,container:"rjv-container"};if(a==null)return null;const r=typeof n=="function"?n:t==="all"?()=>!0:t==="root"?h=>h<2:h=>h<1;return e.jsx("div",{className:ma.container,children:e.jsx(ha,{data:a,shouldExpandNode:r,style:i})})}}function pa({currentId:c,visibleIds:a=[],key:t}){if(t!=="ArrowUp"&&t!=="ArrowDown")return null;const n=a.findIndex(i=>i===c),o=t==="ArrowUp"?-1:1;return n>=0?a[n+o]??null:null}const ga="_root_17dqd_1",xa="_sidebar_17dqd_9",fa="_section_17dqd_18",ja="_sectionHeader_17dqd_22",ya="_arrow_17dqd_48",_a="_sectionTitle_17dqd_54",va="_sectionCount_17dqd_62",ba="_sectionBody_17dqd_71",Ca="_historyToggle_17dqd_76",Na="_historyToggleLabel_17dqd_102",Sa="_item_17dqd_107",ka="_itemActive_17dqd_135",Ta="_itemContent_17dqd_142",wa="_itemLabel_17dqd_148",Ma="_itemSublabel_17dqd_156",La="_itemTime_17dqd_165",Ra="_content_17dqd_174",Ia="_contentEmpty_17dqd_182",Ea="_contentInner_17dqd_189",Ba="_emptyWrap_17dqd_193",Aa="_roleHeader_17dqd_201",Da="_roleBadge_17dqd_209",Fa="_role_user_17dqd_218",Ha="_role_assistant_17dqd_224",Pa="_roleLabel_17dqd_230",qa="_contentTime_17dqd_237",za="_turnDivider_17dqd_245",Va="_textBlock_17dqd_252",$a="_textBlockBar_17dqd_259",Oa="_textBlockBody_17dqd_268",Ua="_textBlockCompact_17dqd_276",Ka="_textBlockCompactFloat_17dqd_283",Wa="_thinkingBlock_17dqd_290",Ja="_thinkingHeader_17dqd_298",Ga="_thinkingPreview_17dqd_313",Qa="_thinkingBody_17dqd_323",Xa="_toolBlock_17dqd_329",Ya="_toolBlockResult_17dqd_336",Za="_toolBlockError_17dqd_340",en="_toolBlockHeader_17dqd_344",tn="_toolBlockBody_17dqd_355",sn="_toolName_17dqd_360",an="_toolId_17dqd_366",nn="_errorLabel_17dqd_373",ln="_blockTag_17dqd_383",on="_blockTagText_17dqd_396",rn="_blockTagThinking_17dqd_402",cn="_blockTagResult_17dqd_408",dn="_blockTagError_17dqd_414",hn="_jsonBlock_17dqd_421",un="_jsonBlockLabel_17dqd_428",mn="_blockSeparator_17dqd_438",pn="_markdownBody_17dqd_445",v={root:ga,sidebar:xa,section:fa,sectionHeader:ja,arrow:ya,sectionTitle:_a,sectionCount:va,sectionBody:ba,historyToggle:Ca,historyToggleLabel:Na,item:Sa,itemActive:ka,itemContent:Ta,itemLabel:wa,itemSublabel:Ma,itemTime:La,content:Ra,contentEmpty:Ia,contentInner:Ea,emptyWrap:Ba,roleHeader:Aa,roleBadge:Da,role_user:Fa,role_assistant:Ha,roleLabel:Pa,contentTime:qa,turnDivider:za,textBlock:Va,textBlockBar:$a,textBlockBody:Oa,textBlockCompact:Ua,textBlockCompactFloat:Ka,thinkingBlock:Wa,thinkingHeader:Ja,thinkingPreview:Ga,thinkingBody:Qa,toolBlock:Xa,toolBlockResult:Ya,toolBlockError:Za,toolBlockHeader:en,toolBlockBody:tn,toolName:sn,toolId:an,errorLabel:nn,blockTag:ln,blockTagText:on,blockTagThinking:rn,blockTagResult:cn,blockTagError:dn,jsonBlock:hn,jsonBlockLabel:un,blockSeparator:mn,markdownBody:pn},{Text:gn}=ft;function ze(c){if(c==null)return[];if(typeof c=="string"){const a=c.trim();return a?[{type:"markdown",text:a}]:[]}if(Array.isArray(c)){const a=[];for(const t of c)if(t)if(t.type==="text"){const n=(t.text||"").trim();n&&a.push({type:"markdown",text:n})}else if(t.type==="tool_use")a.push({type:"tool_use",name:t.name||"unknown",id:t.id||"",input:t.input??{}});else if(t.type==="tool_result"){const n=xn(t.content);a.push({type:"tool_result",tool_use_id:t.tool_use_id||"",is_error:t.is_error,content:n})}else if(t.type==="thinking"){const n=t.thinking||"";n.trim()&&a.push({type:"thinking",text:n})}else t.type==="image"?a.push({type:"json",label:"image",data:t}):a.push({type:"json",label:t.type||"block",data:t});return a}return[{type:"json",label:"content",data:c}]}function xn(c){if(c==null)return[];if(typeof c=="string"){const a=c.trim();return a?[{type:"markdown",text:a}]:[]}return Array.isArray(c)?c.flatMap(a=>{if(!a)return[];if(a.type==="text"){const t=(a.text||"").trim();return t?[{type:"markdown",text:t}]:[]}return[{type:"json",label:a.type||"block",data:a}]}):[{type:"json",label:"content",data:c}]}function fn(c){if(!c)return null;if(typeof c=="string")return[{type:"markdown",text:c}];if(Array.isArray(c)){const a=[];return c.forEach((t,n)=>{n>0&&a.push({type:"separator"}),t&&(typeof t=="string"?a.push({type:"markdown",text:t}):t.type==="text"?a.push({type:"markdown",text:t.text||""}):a.push({type:"json",label:t.type||"item",data:t}))}),a}return[{type:"json",label:"system",data:c}]}function jn(c){const a=[],t=(c==null?void 0:c.name)||"unknown",n=(c==null?void 0:c.description)||"";let o=`### ${t}
|
|
18
|
+
`)}renderProjectStatsContent(){const{projectStats:t,projectStatsLoading:n}=this.state;if(n)return e.jsx("div",{className:s.projectStatsCenter,children:e.jsx(pt,{})});if(!t)return e.jsx("div",{className:s.projectStatsEmpty,children:l("ui.projectStats.noData")});const{summary:o,models:i,updatedAt:r}=t;i&&Object.entries(i).sort((g,m)=>m[1]-g[1]);const h={};if(t.files){for(const g of Object.values(t.files))if(g.models)for(const[m,u]of Object.entries(g.models))h[m]||(h[m]={input:0,output:0,cacheRead:0,cacheCreation:0,count:0}),h[m].input+=u.input_tokens||0,h[m].output+=u.output_tokens||0,h[m].cacheRead+=u.cache_read_input_tokens||0,h[m].cacheCreation+=u.cache_creation_input_tokens||0,h[m].count+=u.count||0}const d=Object.entries(h).sort((g,m)=>m[1].count-g[1].count);return e.jsxs("div",{className:s.projectStatsContent,children:[r&&e.jsx("div",{className:s.projectStatsUpdated,children:l("ui.projectStats.updatedAt",{time:new Date(r).toLocaleString()})}),e.jsxs("div",{className:s.projectStatsSummary,children:[e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:(o==null?void 0:o.requestCount)??0}),e.jsx("div",{className:s.projectStatLabel,children:l("ui.projectStats.totalRequests")})]}),e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:(o==null?void 0:o.turnCount)??(o==null?void 0:o.sessionCount)??0}),e.jsx("div",{className:s.projectStatLabel,children:l("ui.projectStats.turnCount")})]}),e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:(o==null?void 0:o.fileCount)??0}),e.jsx("div",{className:s.projectStatLabel,children:l("ui.projectStats.totalFiles")})]}),e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:q(o==null?void 0:o.input_tokens)}),e.jsx("div",{className:s.projectStatLabel,children:"Input Tokens"})]}),e.jsxs("div",{className:s.projectStatCard,children:[e.jsx("div",{className:s.projectStatValue,children:q(o==null?void 0:o.output_tokens)}),e.jsx("div",{className:s.projectStatLabel,children:"Output Tokens"})]})]}),d.length>0&&e.jsxs("div",{className:s.projectStatsSection,children:[e.jsx("div",{className:s.projectStatsSectionTitle,children:l("ui.projectStats.modelUsage")}),d.map(([g,m])=>{const u=m.input+m.cacheRead+m.cacheCreation,j=u>0?(m.cacheRead/u*100).toFixed(1):"0.0";return e.jsxs("div",{className:s.projectStatsModelCard,children:[e.jsxs("div",{className:s.projectStatsModelHeader,children:[e.jsx("span",{className:s.projectStatsModelName,children:g}),e.jsxs("span",{className:s.projectStatsModelCount,children:[m.count," reqs"]})]}),e.jsx("table",{className:s.statsTable,children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:"Token"}),e.jsx("td",{className:s.th,children:"input"}),e.jsx("td",{className:s.th,children:"output"})]}),e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label}),e.jsx("td",{className:s.td,children:q(u)}),e.jsx("td",{className:s.td,children:q(m.output)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:"Cache"}),e.jsx("td",{className:s.th,children:"create"}),e.jsx("td",{className:s.th,children:"read"})]}),e.jsxs("tr",{className:s.rowBorder,children:[e.jsx("td",{className:s.label}),e.jsx("td",{className:s.td,children:q(m.cacheCreation)}),e.jsx("td",{className:s.td,children:q(m.cacheRead)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:s.label,children:l("ui.hitRate")}),e.jsxs("td",{colSpan:2,className:s.td,children:[j,"%"]})]})]})})]},g)})]})]})}render(){var Ke;const{requestCount:t,requests:n=[],viewMode:o,cacheType:i,onToggleViewMode:r,onImportLocalLogs:h,onLangChange:d,isLocalLog:g,localLogFile:m,projectName:u,collapseToolResults:j,onCollapseToolResultsChange:S,expandThinking:f,onExpandThinkingChange:p,showFullToolContent:v,onShowFullToolContentChange:b,expandDiff:T,onExpandDiffChange:M,filterIrrelevant:C,onFilterIrrelevantChange:w,logDir:I,onLogDirChange:F,updateInfo:H,onDismissUpdate:L,cliMode:V,terminalVisible:$,onToggleTerminal:ne,onReturnToWorkspaces:pe,contextWindow:z,serverCachedContent:ki,resumeAutoChoice:Me,onResumeAutoChoiceToggle:$e,onResumeAutoChoiceChange:Oe,themeColor:je,onThemeColorChange:ye,autoApproveSeconds:kt,onAutoApproveChange:Ue}=this.props,{countdownText:Le}=this.state,Tt=[{key:"import-local",icon:e.jsx(ut,{}),label:l("ui.importLocalLogs"),onClick:h},{key:"export-prompts",icon:e.jsx(xs,{}),label:l("ui.exportPrompts"),onClick:this.handleShowPrompts},{key:"plugin-management",icon:e.jsx(ct,{}),label:l("ui.pluginManagement"),onClick:this.handleShowPlugins},{key:"switch-workspace",icon:e.jsx(ut,{className:s.iconMirror}),label:e.jsx("span",{className:s.disabledMenuItem,children:l("ui.switchWorkspace")}),disabled:!0},{key:"process-management",icon:e.jsx(Ae,{}),label:l("ui.processManagement"),onClick:this.handleShowProcesses},{key:"proxy-switch",icon:e.jsx(Ze,{}),label:l("ui.proxySwitch"),onClick:()=>this.setState({proxyModalVisible:!0})},{type:"divider"},{key:"project-stats",icon:e.jsx(dt,{}),label:l("ui.projectStats"),onClick:this.handleShowProjectStats},...o==="raw"?[{key:"global-settings",icon:e.jsx(mt,{}),label:l("ui.globalSettings"),onClick:()=>this.setState({globalSettingsVisible:!0})}]:[],...o==="chat"?[{key:"display-settings",icon:e.jsx(mt,{}),label:l("ui.settings"),onClick:()=>this.setState({settingsDrawerVisible:!0})}]:[]];return e.jsxs("div",{className:s.headerBar,children:[e.jsxs(he,{size:"middle",children:[e.jsx(Rt,{menu:{items:Tt,className:"logo-dropdown-menu"},trigger:["hover"],onOpenChange:y=>this.setState({logoDropdownOpen:y}),align:{offset:[-4,0]},children:e.jsx("span",{className:`${s.logoWrap}${this.state.logoDropdownOpen?` ${s.logoWrapActive}`:""}`,children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`${s.logoImage}${this.state.logoDropdownOpen?` ${s.logoImageActive}`:""}`,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}),e.jsx(ge,{content:()=>this.renderTokenStats(),trigger:"hover",placement:"bottomLeft",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px",maxHeight:"80vh",overflowY:"auto"},children:e.jsxs(Y,{className:s.tokenStatsTag,children:[e.jsx(Ae,{className:s.tokenStatsIcon}),l("ui.tokenStats")]})}),this.props.activeProxyId&&this.props.activeProxyId!=="max"&&(()=>{const y=(this.props.proxyProfiles||[]).find(U=>U.id===this.props.activeProxyId);return y?e.jsxs(Y,{className:s.proxyProfileTag,onClick:()=>this.setState({proxyModalVisible:!0}),children:[e.jsx(Ze,{className:s.proxySwapIcon}),y.name,y.activeModel?` · ${y.activeModel}`:""]}):null})(),(()=>{var We,Je,Ge,Qe,Xe;let y=0;const U=De.find(Q=>Q.value===this.state.calibrationModel),de=U==null?void 0:U.tokens;if(!g){if(de&&(z==null?void 0:z.used_percentage)!=null){const Q=D=>{var se,Ye;const G=(Ye=(se=D.response)==null?void 0:se.body)==null?void 0:Ye.usage;return((G==null?void 0:G.input_tokens)||0)+((G==null?void 0:G.cache_creation_input_tokens)||0)+((G==null?void 0:G.cache_read_input_tokens)||0)};let K=0;for(let D=n.length-1;D>=0;D--)if(Z(n[D])&&((Je=(We=n[D].response)==null?void 0:We.body)!=null&&Je.usage)){K=Q(n[D]);break}if(K>0){const D=de*.835;y=Math.min(100,Math.max(0,Math.round(K/D*100)))}else{const D=z.context_window_size||2e5;y=Math.min(100,Math.max(0,Math.round(z.used_percentage*D/de/83.5*100)))}}else if((z==null?void 0:z.used_percentage)!=null){const Q=this.state.settingsModel?st(this.state.settingsModel):0,K=z.context_window_size||2e5;Q&&Q!==K?y=Math.min(100,Math.max(0,Math.round(z.used_percentage*K/Q/83.5*100))):y=Math.min(100,Math.max(0,Math.round(z.used_percentage/83.5*100)))}else if(n.length>0){const Q=K=>{var G,se;const D=(se=(G=K.response)==null?void 0:G.body)==null?void 0:se.usage;return((D==null?void 0:D.input_tokens)||0)+((D==null?void 0:D.cache_creation_input_tokens)||0)+((D==null?void 0:D.cache_read_input_tokens)||0)};for(let K=n.length-1;K>=0;K--)if(Z(n[K])&&((Qe=(Ge=n[K].response)==null?void 0:Ge.body)!=null&&Qe.usage)){const D=Q(n[K]),se=(de||(z==null?void 0:z.context_window_size)||st(((Xe=n[K].body)==null?void 0:Xe.model)||this.state.settingsModel))*.835;se>0&&D>0&&(y=Math.min(100,Math.max(0,Math.round(D/se*100))));break}}}y===0&&this._lastContextPercent>0&&(y=this._lastContextPercent);const Re=y>=80?"var(--color-error-light)":y>=60?"var(--color-warning-light)":"var(--color-success)";return g?e.jsx(Y,{className:`${s.liveTag} ${s.liveTagHistory}`,children:e.jsx("span",{className:s.liveTagText,children:l("ui.historyLog",{file:m})})}):e.jsx(ge,{content:this.state._cachePopoverOpen?this.renderCacheContentPopover(y):e.jsx("div",{className:s.cachePopoverPlaceholder}),trigger:"hover",placement:"bottomLeft",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px"},onOpenChange:Q=>{this.setState({_cachePopoverOpen:Q}),Q||(this._cacheScrollInited=!1)},children:e.jsxs("span",{className:s.liveTag,style:{borderColor:Re,color:Re},children:[e.jsx("span",{className:s.liveTagFill,style:{width:`${y}%`,backgroundColor:Re}}),e.jsx("span",{className:s.liveTagContent,children:e.jsxs("span",{className:s.liveTagText,children:[l("ui.liveMonitoring"),u?`:${u}`:""]})})]})})})(),H&&e.jsx(Y,{color:H.type==="completed"?"green":"orange",closable:!0,onClose:()=>L&&L(),children:H.type==="completed"?l("ui.update.completed",{version:H.version}):l("ui.update.majorAvailable",{version:H.version})})]}),e.jsxs(he,{size:"middle",children:[Le&&o==="raw"&&e.jsxs(Y,{style:{background:"var(--bg-surface)",border:"1px solid var(--border-hover)",color:Le===l("ui.cacheExpired")?"var(--color-error-light)":"var(--text-secondary)"},children:[l("ui.cacheCountdown",{type:i?`(${i})`:""}),e.jsx("strong",{className:s.countdownStrong,children:Le})]}),o==="chat"&&V&&!g&&this.state.localUrl&&e.jsxs(e.Fragment,{children:[this.state.countryFlag&&((Ke=this.state.countryInfo)==null?void 0:Ke.country)!=="CN"&&e.jsx(ge,{content:this.state.countryInfo?e.jsxs("div",{className:s.countryInfoPopover,children:[e.jsxs("div",{children:[this.state.countryFlag," ",this.state.countryInfo.country]}),this.state.countryInfo.region&&e.jsx("div",{children:this.state.countryInfo.region}),this.state.countryInfo.city&&e.jsx("div",{children:this.state.countryInfo.city}),this.state.countryInfo.org&&e.jsx("div",{className:s.countryInfoMeta,children:this.state.countryInfo.org}),this.state.countryInfo.ip&&e.jsx("div",{className:s.countryInfoMeta,children:this.state.countryInfo.ip})]}):null,trigger:"hover",placement:"bottomRight",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 12px"},children:e.jsx(E,{className:s.compactBtnNoBorder,icon:e.jsx("span",{className:s.countryFlagIcon,children:this.state.countryFlag})})}),e.jsx(ae,{checked:je==="light",onChange:y=>ye&&ye(y?"light":"dark"),checkedChildren:"雪山白",unCheckedChildren:"曜石黑"}),e.jsx(ge,{content:e.jsxs("div",{className:s.qrcodePopover,children:[e.jsxs("div",{className:s.qrcodeTitle,children:[l("ui.scanToCoding")," ",e.jsx(O,{doc:"QRCode"})]}),e.jsx(as,{value:this.state.localUrl,size:200,bgColor:je==="light"?"#ffffff":"#141414",fgColor:je==="light"?"#1a1a1a":"#d9d9d9",level:"M"}),e.jsx(ie,{readOnly:!0,value:this.state.localUrl,className:s.qrcodeUrlInput,suffix:e.jsx(xe,{className:s.qrcodeUrlCopy,onClick:()=>{navigator.clipboard.writeText(this.state.localUrl).then(()=>{P.success(l("ui.copied"))}).catch(()=>{})}})})]}),trigger:"hover",placement:"bottomRight",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px"},children:e.jsx(E,{className:s.compactBtnNoBorder,icon:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle"},children:e.jsx("path",{fillRule:"evenodd",d:"M0 0h10v10H0zM2 2v6h6V2zM3 3h4v4H3zM14 0h10v10H14zM16 2v6h6V2zM17 3h4v4H17zM0 14h10v10H0zM2 16v6h6v-6zM3 17h4v4H3zM14 14h3v3h-3zM20 14h3v3h-3zM17 17h3v3h-3zM14 20h3v3h-3zM20 20h3v3h-3z"})})})})]}),V&&o==="chat"&&!g&&e.jsx(E,{className:s.compactBtn,type:$?"primary":"default",ghost:$,icon:e.jsx(Ce,{}),onClick:ne,children:l("ui.terminal")}),e.jsx(E,{className:s.compactBtn,type:o==="raw"?"primary":"default",icon:o==="raw"?e.jsx(vs,{}):e.jsx(be,{}),onClick:r,children:o==="raw"?l("ui.chatMode"):l("ui.rawMode")})]}),e.jsxs(X,{title:`${l("ui.userPrompt")} (${this.state.promptData.length}${l("ui.promptCountUnit")})`,open:this.state.promptModalVisible,onCancel:()=>this.setState({promptModalVisible:!1}),footer:null,width:700,children:[e.jsx("div",{className:s.promptExportBar,children:e.jsx(E,{icon:e.jsx(It,{}),onClick:this.handleExportPromptsTxt,children:l("ui.exportPromptsTxt")})}),e.jsx(gt,{activeKey:this.state.promptViewMode,onChange:y=>this.setState({promptViewMode:y}),size:"small",items:[{key:"original",label:l("ui.promptModeOriginal")},{key:"context",label:l("ui.promptModeContext")},{key:"text",label:l("ui.promptModeText")}]}),this.state.promptViewMode==="text"?e.jsx("textarea",{readOnly:!0,className:s.promptTextarea,value:this.buildTextModeContent()}):e.jsxs("div",{className:s.promptScrollArea,children:[this.state.promptData.length===0&&e.jsx("div",{className:s.promptEmpty,children:l("ui.noPrompt")}),this.state.promptData.map((y,U)=>{const de=y.timestamp?new Date(y.timestamp).toLocaleString():l("ui.unknownTime");return e.jsxs("div",{children:[e.jsxs("div",{className:s.promptTimestamp,children:[de,":"]}),this.state.promptViewMode==="original"?this.renderOriginalPrompt(y):this.renderTextPrompt(y)]},U)})]})]}),e.jsxs(Ie,{title:l("ui.settings"),placement:"left",width:360,open:this.state.settingsDrawerVisible,onClose:()=>this.setState({settingsDrawerVisible:!1}),children:[e.jsxs("div",{className:s.settingsGroupBox,children:[e.jsx("div",{className:s.settingsGroupTitle,children:l("ui.chatDisplaySwitches")}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.collapseToolResults")}),e.jsx(ae,{checked:!!j,onChange:y=>S&&S(y)})]}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.expandThinking")}),e.jsx(ae,{checked:!!f,onChange:y=>p&&p(y)})]}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.showFullToolContent")}),e.jsx(ae,{checked:!!v,onChange:y=>b&&b(y)})]})]}),e.jsxs("div",{className:s.settingsGroupBox,children:[e.jsx("div",{className:s.settingsGroupTitle,children:l("ui.userPreferences")}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.resumeAutoChoice")}),e.jsx(ae,{checked:!!Me,onChange:y=>$e&&$e(y)})]}),Me&&e.jsx("div",{className:s.settingsItem,children:e.jsxs(_e.Group,{value:Me,onChange:y=>Oe&&Oe(y.target.value),size:"small",children:[e.jsx(_e,{value:"continue",children:l("ui.resumeAutoChoice.continue")}),e.jsx(_e,{value:"new",children:l("ui.resumeAutoChoice.new")})]})}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.permission.autoApprove.setting")}),e.jsx(le,{size:"small",value:kt||0,onChange:y=>Ue&&Ue(y),options:[{label:l("ui.permission.autoApprove.off"),value:0},{label:"3s",value:3},{label:"5s",value:5},{label:"10s",value:10},{label:"15s",value:15},{label:"20s",value:20},{label:"30s",value:30},{label:"60s",value:60}],style:{width:100}})]})]}),e.jsx("div",{className:s.settingsGroupBox,children:e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.themeColor")}),e.jsx(le,{size:"small",value:je||"dark",onChange:y=>ye&&ye(y),options:[{label:l("ui.themeColor.dark"),value:"dark"},{label:l("ui.themeColor.light"),value:"light"}],style:{width:140}})]})}),e.jsx("div",{className:s.settingsGroupBox,children:e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.languageSettings")}),e.jsx(le,{size:"small",value:Jt(),onChange:y=>{Wt(y),d&&d()},options:ks.map(y=>({label:y.label,value:y.value})),style:{width:140}})]})})]}),e.jsxs(Ie,{title:e.jsxs("span",{children:[l("ui.globalSettings")," ",e.jsx(O,{doc:"GlobalSettings"})]}),placement:"left",width:400,open:this.state.globalSettingsVisible,onClose:()=>this.setState({globalSettingsVisible:!1}),children:[e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.filterIrrelevant")}),e.jsx(ae,{checked:!!C,onChange:y=>w&&w(y)})]}),e.jsxs("div",{className:s.settingsItem,children:[e.jsx("span",{className:s.settingsLabel,children:l("ui.expandDiff")}),e.jsx(ae,{checked:!!T,onChange:y=>M&&M(y)})]}),e.jsx("div",{className:s.settingsDivider}),e.jsx("div",{className:s.settingsLabel,children:l("ui.logDirTitle")}),e.jsx(ie,{className:s.logDirInput,value:this.state.logDirDraft??I,onChange:y=>this.setState({logDirDraft:y.target.value}),onBlur:()=>{const y=this.state.logDirDraft;y!=null&&y!==I&&(F==null||F(y)),this.setState({logDirDraft:null})},onPressEnter:()=>{const y=this.state.logDirDraft;y!=null&&y!==I&&(F==null||F(y)),this.setState({logDirDraft:null})},placeholder:"~/.claude/cc-viewer"})]}),e.jsx(Ie,{title:e.jsxs("span",{children:[e.jsx(dt,{className:s.titleIcon}),l("ui.projectStats")]}),placement:"left",width:400,open:this.state.projectStatsVisible,onClose:()=>this.setState({projectStatsVisible:!1}),children:this.renderProjectStatsContent()}),e.jsxs(X,{title:e.jsxs("span",{children:[e.jsx(ct,{className:s.titleIcon}),l("ui.pluginManagement")]}),open:this.state.pluginModalVisible,onCancel:()=>this.setState({pluginModalVisible:!1}),footer:e.jsxs("div",{className:s.pluginModalFooter,children:[e.jsxs("div",{className:s.pluginModalFooterLeft,children:[e.jsx(E,{icon:e.jsx(et,{}),onClick:this.handleAddPlugin,children:l("ui.plugins.add")}),e.jsx(E,{icon:e.jsx(ht,{}),onClick:this.handleShowCdnModal,children:l("ui.plugins.cdnInstall")})]}),e.jsx(E,{icon:e.jsx(He,{}),onClick:this.handleReloadPlugins,children:l("ui.plugins.reload")})]}),width:560,children:[this.state.pluginsDir&&e.jsxs("div",{className:s.pluginDirHint,children:[e.jsxs("span",{className:s.pluginDirLabel,children:[l("ui.plugins.pluginsDir"),":"]})," ",e.jsx("code",{className:s.pluginDirPath,onClick:()=>{navigator.clipboard.writeText(this.state.pluginsDir).then(()=>{P.success(l("ui.copied"))}).catch(()=>{})},children:this.state.pluginsDir})]}),this.state.pluginsList.length===0?e.jsxs("div",{className:s.pluginEmpty,children:[e.jsx("div",{className:s.pluginEmptyTitle,children:l("ui.plugins.empty")}),e.jsx("div",{className:s.pluginEmptyHint,children:l("ui.plugins.emptyHint")})]}):e.jsx("div",{className:s.pluginList,children:this.state.pluginsList.map(y=>e.jsxs("div",{className:s.pluginItem,children:[e.jsxs("div",{className:s.pluginInfo,children:[e.jsx("span",{className:s.pluginName,children:y.name}),e.jsx("span",{className:s.pluginFile,children:y.file}),y.hooks.length>0&&e.jsx("span",{className:s.pluginHooks,children:y.hooks.map(U=>e.jsx("span",{className:s.pluginHookTag,children:U},U))})]}),e.jsxs("div",{className:s.pluginActions,children:[e.jsx(ae,{size:"small",checked:y.enabled,onChange:U=>this.handleTogglePlugin(y.name,U)}),e.jsx(E,{type:"text",size:"small",danger:!0,icon:e.jsx(Fe,{}),onClick:()=>this.handleDeletePlugin(y.file,y.name)})]})]},y.file))})]}),e.jsx(X,{title:l("ui.plugins.delete"),open:this.state.deleteConfirmVisible,onCancel:()=>this.setState({deleteConfirmVisible:!1,deleteTarget:null}),onOk:this.handleDeletePluginConfirm,okType:"danger",okText:"OK",cancelText:"Cancel",children:e.jsx("p",{children:this.state.deleteTarget?l("ui.plugins.deleteConfirm",{name:this.state.deleteTarget.name}):""})}),e.jsx(X,{title:e.jsxs("span",{children:[e.jsx(ht,{className:s.titleIcon}),l("ui.plugins.cdnInstall")]}),open:this.state.cdnModalVisible,onCancel:this.handleCdnCancel,onOk:this.handleCdnInstall,confirmLoading:this.state.cdnLoading,okText:l("ui.plugins.cdnInstallBtn"),cancelText:l("ui.cancel"),width:480,children:e.jsxs("div",{children:[e.jsx("div",{className:s.cdnUrlLabel,children:l("ui.plugins.cdnUrl")}),e.jsx(ie,{placeholder:l("ui.plugins.cdnUrlPlaceholder"),value:this.state.cdnUrl,onChange:this.handleCdnUrlChange,onPressEnter:this.handleCdnInstall,className:s.cdnInput})]})}),e.jsx(X,{title:e.jsxs("span",{children:[e.jsx(Ae,{className:s.titleIcon}),l("ui.processManagement")]}),open:this.state.processModalVisible,onCancel:()=>this.setState({processModalVisible:!1}),footer:e.jsx(E,{icon:e.jsx(He,{}),onClick:this.fetchProcesses,loading:this.state.processLoading,children:l("ui.processManagement.refresh")}),width:780,children:e.jsx(Et,{dataSource:this.state.processList,rowKey:"pid",loading:this.state.processLoading,size:"middle",pagination:!1,columns:[{title:l("ui.processManagement.port"),dataIndex:"port",width:80,render:y=>y?e.jsx("a",{href:`${window.location.protocol}//127.0.0.1:${y}`,target:"_blank",rel:"noopener noreferrer",children:y}):""},{title:"PID",dataIndex:"pid",width:80},{title:l("ui.processManagement.command"),dataIndex:"command",ellipsis:!0},{title:l("ui.processManagement.startTime"),dataIndex:"startTime",width:200},{title:l("ui.processManagement.action"),width:100,render:(y,U)=>U.isCurrent?e.jsx(E,{size:"small",className:s.currentProcessBtn,children:l("ui.processManagement.current")}):e.jsx(E,{size:"small",danger:!0,onClick:()=>this.handleKillProcess(U.pid),children:l("ui.processManagement.kill")})}]})}),e.jsx(X,{title:e.jsxs("span",{children:[e.jsx(yt,{apiEndpoint:W("/api/open-profile-dir"),title:l("ui.proxy.openConfigDir"),size:16})," ",l("ui.proxySwitch")," ",e.jsx(O,{doc:"ProxySwitch",zIndex:1100})]}),open:this.state.proxyModalVisible,onCancel:()=>this.setState({proxyModalVisible:!1,editingProxy:null}),footer:null,width:520,children:this.renderProxyProfileList()})]})}renderProxyProfileList(){const t=this.props.proxyProfiles||[],n=this.props.activeProxyId||"max",{editingProxy:o,editForm:i}=this.state;return e.jsxs("div",{children:[e.jsxs("div",{className:s.proxyWarning,children:["⚠️ ",l("ui.proxy.maxWarning")]}),e.jsx("div",{className:s.proxyList,children:t.map(r=>{var h;return e.jsxs("div",{className:`${s.proxyItem} ${r.id===n?s.proxyItemActive:""}`,children:[e.jsxs("div",{className:s.proxyItemMain,onClick:()=>{if(r.id!==n){const d={active:r.id,profiles:t};this.props.onProxyProfileChange(d)}},children:[e.jsx(_e,{checked:r.id===n,style:{marginRight:8}}),e.jsxs("div",{className:s.proxyItemInfo,children:[e.jsxs("div",{className:s.proxyItemNameRow,children:[e.jsx("span",{className:s.proxyItemName,children:r.name}),r.id==="max"&&e.jsx(Y,{className:s.proxyBuiltinTag,children:l("ui.proxy.builtin")})]}),r.id==="max"&&this.props.defaultConfig&&e.jsxs("div",{className:s.proxyItemDetail,children:[(()=>{try{return new URL(this.props.defaultConfig.origin).host}catch{return this.props.defaultConfig.origin}})(),this.props.defaultConfig.authType?` · ${this.props.defaultConfig.authType}`:"",this.props.defaultConfig.apiKey?` · ${this.props.defaultConfig.apiKey}`:"",this.props.defaultConfig.model?` · ${this.props.defaultConfig.model}`:""]}),r.id!=="max"&&r.baseURL&&e.jsxs("div",{className:s.proxyItemDetail,children:[(()=>{try{return new URL(r.baseURL).host}catch{return r.baseURL}})(),r.activeModel?` · ${r.activeModel}`:(h=r.models)!=null&&h.length?` · ${r.models[0]}`:""]})]})]}),r.id!=="max"&&e.jsxs("div",{className:s.proxyItemActions,children:[e.jsx(E,{type:"text",size:"small",icon:e.jsx(Bt,{}),onClick:()=>this.setState({editingProxy:r.id,editForm:{name:r.name||"",baseURL:r.baseURL||"",apiKey:r.apiKey||"",models:(r.models||[]).join(", "),activeModel:r.activeModel||""}})}),e.jsx(E,{type:"text",size:"small",danger:!0,icon:e.jsx(Fe,{}),onClick:()=>{X.confirm({title:l("ui.proxy.deleteProxy"),content:l("ui.proxy.deleteConfirm",{name:r.name}),okType:"danger",onOk:()=>{const d=t.filter(m=>m.id!==r.id),g=n===r.id?"max":n;this.props.onProxyProfileChange({active:g,profiles:d})}})}})]})]},r.id)})}),o&&e.jsxs("div",{className:s.proxyEditForm,children:[e.jsxs("div",{className:s.proxyEditRow,children:[e.jsxs("label",{children:[l("ui.proxy.name")," ",e.jsx("span",{className:s.proxyRequired,children:"*"})]}),e.jsx(ie,{size:"small",value:i.name,onChange:r=>{const h=r.target.value;this.setState(d=>({editForm:{...d.editForm,name:h}}))}})]}),e.jsxs("div",{className:s.proxyEditRow,children:[e.jsxs("label",{children:[l("ui.proxy.baseURL")," ",e.jsx("span",{className:s.proxyRequired,children:"*"})]}),e.jsx(ie,{size:"small",value:i.baseURL,onChange:r=>{const h=r.target.value;this.setState(d=>({editForm:{...d.editForm,baseURL:h}}))},placeholder:"https://api.example.com"})]}),e.jsxs("div",{className:s.proxyEditRow,children:[e.jsxs("label",{children:[l("ui.proxy.apiKey")," ",e.jsx("span",{className:s.proxyRequired,children:"*"})]}),e.jsx(ie.Password,{size:"small",value:i.apiKey,onChange:r=>{const h=r.target.value;this.setState(d=>({editForm:{...d.editForm,apiKey:h}}))},placeholder:"sk-..."})]}),e.jsx("div",{className:s.proxyEditDivider}),e.jsxs("div",{className:s.proxyEditRow,children:[e.jsx("label",{children:l("ui.proxy.models")}),e.jsx(ie,{size:"small",value:i.models,onChange:r=>{const h=r.target.value;this.setState(d=>({editForm:{...d.editForm,models:h}}))},placeholder:"model-1, model-2"})]}),e.jsxs("div",{className:s.proxyEditRow,children:[e.jsx("label",{children:l("ui.proxy.activeModel")}),e.jsx(le,{size:"small",className:s.fullWidthSelect,value:i.activeModel||void 0,onChange:r=>this.setState(h=>({editForm:{...h.editForm,activeModel:r}})),placeholder:l("ui.proxy.activeModel"),children:(i.models||"").split(",").map(r=>r.trim()).filter(Boolean).map(r=>e.jsx(le.Option,{value:r,children:r},r))})]}),e.jsxs("div",{className:s.proxyEditBtns,children:[e.jsx(E,{size:"small",icon:e.jsx(At,{}),type:"primary",onClick:()=>{var g,m,u;if(!((g=i.name)!=null&&g.trim())||!((m=i.baseURL)!=null&&m.trim())||!((u=i.apiKey)!=null&&u.trim())){P.warning(l("ui.proxy.requiredFields"));return}const r=(i.models||"").split(",").map(j=>j.trim()).filter(Boolean),h={id:o==="__new__"?`proxy_${Date.now()}`:o,name:i.name.trim(),baseURL:i.baseURL.trim(),apiKey:i.apiKey.trim(),models:r,activeModel:i.activeModel||r[0]||""};let d;o==="__new__"?d=[...t,h]:d=t.map(j=>j.id===o?{...j,...h,id:j.id}:j),this.props.onProxyProfileChange({active:n,profiles:d}),this.setState({editingProxy:null})},children:l("ui.proxy.save")}),e.jsx(E,{size:"small",icon:e.jsx(Dt,{}),onClick:()=>this.setState({editingProxy:null}),children:l("ui.proxy.cancel")})]})]}),!o&&e.jsx(E,{block:!0,type:"dashed",icon:e.jsx(et,{}),style:{marginTop:12},onClick:()=>this.setState({editingProxy:"__new__",editForm:{name:"",baseURL:"",apiKey:"",models:"",activeModel:""}}),children:l("ui.proxy.addProxy")})]})}};R(ue,"COMMAND_TAGS",new Set(["command-name","command-message","command-args","local-command-caveat","local-command-stdout"]));let Se=ue;const ws="_centerEmpty_midza_1",Ms="_scrollContainer_midza_8",Ls="_listItem_midza_15",Rs="_listItemActive_midza_29",Is="_itemContent_midza_46",Es="_itemHeader_midza_51",Bs="_tagNoMargin_midza_59",As="_modelName_midza_64",Ds="_modelNameMain_midza_69",Fs="_time_midza_73",Hs="_detailRow_midza_79",Ps="_urlText_midza_86",qs="_duration_midza_95",zs="_statusOk_midza_100",Vs="_statusErr_midza_106",$s="_statusDefault_midza_111",Os="_usageBox_midza_116",Us="_cacheDot_midza_126",Ks="_cacheDotLoss_midza_135",Ws="_cacheDotNormal_midza_140",Js="_tagMainAgent_midza_144",Gs="_tagPlan_midza_150",Qs="_tagMuted_midza_156",Xs="_tooltipPreLine_midza_162",A={centerEmpty:ws,scrollContainer:Ms,listItem:Ls,listItemActive:Rs,itemContent:Is,itemHeader:Es,tagNoMargin:Bs,modelName:As,modelNameMain:Ds,time:Fs,detailRow:Hs,urlText:Ps,duration:qs,statusOk:zs,statusErr:Vs,statusDefault:$s,usageBox:Os,cacheDot:Us,cacheDotLoss:Ks,cacheDotNormal:Ws,tagMainAgent:Js,tagPlan:Gs,tagMuted:Qs,tooltipPreLine:Xs};class Ys extends me.Component{constructor(t){super(t);R(this,"handleKeyDown",t=>{if(t.key!=="ArrowUp"&&t.key!=="ArrowDown")return;const{requests:n,selectedIndex:o,onSelect:i}=this.props;if(!n.length)return;t.preventDefault();const r=o??0,h=t.key==="ArrowUp"?Math.max(0,r-1):Math.min(n.length-1,r+1);h!==r&&i(h)});this.activeItemRef=me.createRef()}componentDidMount(){this.scrollToSelected(!0)}shouldComponentUpdate(t){return t.requests!==this.props.requests||t.selectedIndex!==this.props.selectedIndex||t.scrollCenter!==this.props.scrollCenter||t.cacheLossMap!==this.props.cacheLossMap}componentDidUpdate(t){this.props.scrollCenter&&t.selectedIndex!==this.props.selectedIndex?this.scrollToSelected(!0):t.selectedIndex!==this.props.selectedIndex&&(this.scrollToSelected(!1),this.activeItemRef.current&&this.activeItemRef.current.focus({preventScroll:!0}))}scrollToSelected(t){this.activeItemRef.current&&(this.activeItemRef.current.scrollIntoView({block:t?"center":"nearest",behavior:"instant"}),t&&this.props.onScrollDone&&this.props.onScrollDone())}render(){const{requests:t,selectedIndex:n,onSelect:o}=this.props;return t.length===0?e.jsx("div",{className:A.centerEmpty,children:e.jsx(oe,{description:l("ui.waitingRequests")})}):e.jsx("div",{className:A.scrollContainer,onKeyDown:this.handleKeyDown,children:e.jsx(tt,{dataSource:t,size:"small",split:!1,renderItem:(i,r)=>{var w,I,F;const h=new Date(i.timestamp).toLocaleTimeString("zh-CN"),d=r===n,g=i.response&&i.response.status<400,m=i.response&&i.response.status>=400,u=Gt((w=i.body)==null?void 0:w.model),j=r+1<t.length?t[r+1]:null,{type:S,subType:f}=fe(i,j),p=(F=(I=i.response)==null?void 0:I.body)==null?void 0:F.usage,v=p?(p.input_tokens||0)+(p.cache_read_input_tokens||0)+(p.cache_creation_input_tokens||0):null,b=(p==null?void 0:p.output_tokens)||null,T=(p==null?void 0:p.cache_read_input_tokens)||0,M=(p==null?void 0:p.cache_creation_input_tokens)||0;let C=i.url;try{const H=new URL(i.url);C=H.host+H.pathname}catch{}return e.jsx(tt.Item,{ref:d?this.activeItemRef:void 0,tabIndex:0,onClick:()=>o(r),className:`${A.listItem} ${d?A.listItemActive:""}`,children:e.jsxs("div",{className:A.itemContent,children:[e.jsxs("div",{className:A.itemHeader,children:[S==="MainAgent"?e.jsx(Y,{className:`${A.tagNoMargin} ${A.tagMainAgent}`,children:"MainAgent"}):S==="Plan"?e.jsx(Y,{className:`${A.tagNoMargin} ${A.tagPlan}`,children:at(S,f)}):S==="Count"||S==="Preflight"?e.jsx(Y,{className:`${A.tagNoMargin} ${A.tagMuted}`,children:S}):e.jsx(Y,{className:A.tagNoMargin,children:at(S,f)}),u&&e.jsx("span",{className:`${A.modelName} ${S==="MainAgent"?A.modelNameMain:""}`,children:u}),e.jsx("span",{className:A.time,children:h})]}),e.jsxs("div",{className:A.detailRow,children:[e.jsx("span",{className:A.urlText,title:i.url,children:C}),i.duration&&e.jsxs("span",{className:A.duration,children:[i.duration,"ms"]}),i.response&&e.jsx("span",{className:g?A.statusOk:m?A.statusErr:A.statusDefault,children:i.response.status})]}),p&&e.jsxs("div",{className:A.usageBox,children:[e.jsxs("div",{children:["token: output:",q(b)||0,", input: ",q(v)||0]}),(T>0||M>0)&&e.jsx("div",{children:(()=>{var $;const H=($=this.props.cacheLossMap)==null?void 0:$.get(r),L={ttl:"ui.cacheLoss.ttl",system_change:"ui.cacheLoss.systemChange",tools_change:"ui.cacheLoss.toolsChange",model_change:"ui.cacheLoss.modelChange",msg_truncated:"ui.cacheLoss.msgTruncated",msg_modified:"ui.cacheLoss.msgModified",key_change:"ui.cacheLoss.keyChange"};let V;if(H){const pe=(H.reasons||[H.reason]).map(z=>l(L[z]||L.key_change)).join(`
|
|
19
|
+
`);V=e.jsx(xt,{title:e.jsx("span",{className:A.tooltipPreLine,children:pe}),children:e.jsx("span",{className:`${A.cacheDot} ${A.cacheDotLoss}`})})}else V=e.jsx("span",{className:`${A.cacheDot} ${A.cacheDotNormal}`});return e.jsxs(e.Fragment,{children:["cache",V,": ",T>0?`read:${q(T)}`:"",T>0&&M>0?", ":"",M>0?`create:${q(M)}`:""]})})()})]})]})})}})})}}const Zs=c=>typeof c=="boolean"||c instanceof Boolean,ea=c=>typeof c=="number"||c instanceof Number,ta=c=>typeof c=="bigint"||c instanceof BigInt,vt=c=>!!c&&c instanceof Date,sa=c=>typeof c=="string"||c instanceof String,aa=c=>Array.isArray(c),bt=c=>typeof c=="object"&&c!==null,Ct=c=>!!c&&c instanceof Object&&typeof c=="function";function ke(c,a){return a===void 0&&(a=!1),!c||a?`"${c}"`:c}function na(c,a,t){return t?JSON.stringify(c):a?`"${c}"`:c}function Nt(c){let{field:a,value:t,data:n,lastElement:o,openBracket:i,closeBracket:r,level:h,style:d,shouldExpandNode:g,clickToExpandNode:m,outerRef:u,beforeExpandChange:j}=c;const S=N.useRef(!1),[f,p]=N.useState(()=>g(h,t,a)),v=N.useRef(null);N.useEffect(()=>{S.current?p(g(h,t,a)):S.current=!0},[g]);const b=N.useId();if(n.length===0)return ia({field:a,openBracket:i,closeBracket:r,lastElement:o,style:d});const T=f?d.collapseIcon:d.expandIcon,M=f?d.ariaLables.collapseJson:d.ariaLables.expandJson,C=h+1,w=n.length-1,I=L=>{f!==L&&(!j||j({level:h,value:t,field:a,newExpandValue:L}))&&p(L)},F=L=>{if(L.key==="ArrowRight"||L.key==="ArrowLeft")L.preventDefault(),I(L.key==="ArrowRight");else if(L.key==="ArrowUp"||L.key==="ArrowDown"){L.preventDefault();const V=L.key==="ArrowUp"?-1:1;if(!u.current)return;const $=u.current.querySelectorAll("[role=button]");let ne=-1;for(let z=0;z<$.length;z++)if($[z].tabIndex===0){ne=z;break}if(ne<0)return;const pe=(ne+V+$.length)%$.length;$[ne].tabIndex=-1,$[pe].tabIndex=0,$[pe].focus()}},H=()=>{var L;I(!f);const V=v.current;if(!V)return;const $=(L=u.current)===null||L===void 0?void 0:L.querySelector('[role=button][tabindex="0"]');$&&($.tabIndex=-1),V.tabIndex=0,V.focus()};return N.createElement("div",{className:d.basicChildStyle,role:"treeitem","aria-expanded":f,"aria-selected":void 0},N.createElement("span",{className:T,onClick:H,onKeyDown:F,role:"button","aria-label":M,"aria-expanded":f,"aria-controls":f?b:void 0,ref:v,tabIndex:h===0?0:-1}),(a||a==="")&&(m?N.createElement("span",{className:d.clickableLabel,onClick:H,onKeyDown:F},ke(a,d.quotesForFieldNames),":"):N.createElement("span",{className:d.label},ke(a,d.quotesForFieldNames),":")),N.createElement("span",{className:d.punctuation},i),f?N.createElement("ul",{id:b,role:"group",className:d.childFieldsContainer},n.map((L,V)=>N.createElement(qe,{key:L[0]||V,field:L[0],value:L[1],style:d,lastElement:V===w,level:C,shouldExpandNode:g,clickToExpandNode:m,beforeExpandChange:j,outerRef:u}))):N.createElement("span",{className:d.collapsedContent,onClick:H,onKeyDown:F}),N.createElement("span",{className:d.punctuation},r),!o&&N.createElement("span",{className:d.punctuation},","))}function ia(c){let{field:a,openBracket:t,closeBracket:n,lastElement:o,style:i}=c;return N.createElement("div",{className:i.basicChildStyle,role:"treeitem","aria-selected":void 0},(a||a==="")&&N.createElement("span",{className:i.label},ke(a,i.quotesForFieldNames),":"),N.createElement("span",{className:i.punctuation},t),N.createElement("span",{className:i.punctuation},n),!o&&N.createElement("span",{className:i.punctuation},","))}function la(c){let{field:a,value:t,style:n,lastElement:o,shouldExpandNode:i,clickToExpandNode:r,level:h,outerRef:d,beforeExpandChange:g}=c;return Nt({field:a,value:t,lastElement:o||!1,level:h,openBracket:"{",closeBracket:"}",style:n,shouldExpandNode:i,clickToExpandNode:r,data:Object.keys(t).map(m=>[m,t[m]]),outerRef:d,beforeExpandChange:g})}function oa(c){let{field:a,value:t,style:n,lastElement:o,level:i,shouldExpandNode:r,clickToExpandNode:h,outerRef:d,beforeExpandChange:g}=c;return Nt({field:a,value:t,lastElement:o||!1,level:i,openBracket:"[",closeBracket:"]",style:n,shouldExpandNode:r,clickToExpandNode:h,data:t.map(m=>[void 0,m]),outerRef:d,beforeExpandChange:g})}function ra(c){let{field:a,value:t,style:n,lastElement:o}=c,i,r=n.otherValue;return t===null?(i="null",r=n.nullValue):t===void 0?(i="undefined",r=n.undefinedValue):sa(t)?(i=na(t,!n.noQuotesForStringValues,n.stringifyStringValues),r=n.stringValue):Zs(t)?(i=t?"true":"false",r=n.booleanValue):ea(t)?(i=t.toString(),r=n.numberValue):ta(t)?(i=`${t.toString()}n`,r=n.numberValue):vt(t)?i=t.toISOString():Ct(t)?i="function() { }":i=t.toString(),N.createElement("div",{className:n.basicChildStyle,role:"treeitem","aria-selected":void 0},(a||a==="")&&N.createElement("span",{className:n.label},ke(a,n.quotesForFieldNames),":"),N.createElement("span",{className:r},i),!o&&N.createElement("span",{className:n.punctuation},","))}function qe(c){const a=c.value;return aa(a)?N.createElement(oa,Object.assign({},c)):bt(a)&&!vt(a)&&!Ct(a)?N.createElement(la,Object.assign({},c)):N.createElement(ra,Object.assign({},c))}var B={"container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};const St={collapseJson:"collapse JSON",expandJson:"expand JSON"},Ne={container:B["container-light"],basicChildStyle:B["basic-element-style"],childFieldsContainer:B["child-fields-container"],label:B["label-light"],clickableLabel:B["clickable-label-light"],nullValue:B["value-null-light"],undefinedValue:B["value-undefined-light"],stringValue:B["value-string-light"],booleanValue:B["value-boolean-light"],numberValue:B["value-number-light"],otherValue:B["value-other-light"],punctuation:B["punctuation-light"],collapseIcon:B["collapse-icon-light"],expandIcon:B["expand-icon-light"],collapsedContent:B["collapsed-content-light"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:St,stringifyStringValues:!1},ca={container:B["container-dark"],basicChildStyle:B["basic-element-style"],childFieldsContainer:B["child-fields-container"],label:B["label-dark"],clickableLabel:B["clickable-label-dark"],nullValue:B["value-null-dark"],undefinedValue:B["value-undefined-dark"],stringValue:B["value-string-dark"],booleanValue:B["value-boolean-dark"],numberValue:B["value-number-dark"],otherValue:B["value-other-dark"],punctuation:B["punctuation-dark"],collapseIcon:B["collapse-icon-dark"],expandIcon:B["expand-icon-dark"],collapsedContent:B["collapsed-content-dark"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:St,stringifyStringValues:!1},da=()=>!0,ha=c=>{let{data:a,style:t=Ne,shouldExpandNode:n=da,clickToExpandNode:o=!1,beforeExpandChange:i,compactTopLevel:r,...h}=c;const d=N.useRef(null);return N.createElement("div",Object.assign({"aria-label":"JSON view"},h,{className:t.container,ref:d,role:"tree"}),r&&bt(a)?Object.entries(a).map(g=>{let[m,u]=g;return N.createElement(qe,{key:m,field:m,value:u,style:{...Ne,...t},lastElement:!0,level:1,shouldExpandNode:n,clickToExpandNode:o,beforeExpandChange:i,outerRef:d})}):N.createElement(qe,{value:a,style:{...Ne,...t},lastElement:!0,level:0,shouldExpandNode:n,clickToExpandNode:o,outerRef:d,beforeExpandChange:i}))},ua="_container_qeuid_1",ma={container:ua};class Te extends me.Component{shouldComponentUpdate(a){return a.data!==this.props.data||a.defaultExpand!==this.props.defaultExpand||a.expandNode!==this.props.expandNode}render(){const{data:a,defaultExpand:t,expandNode:n}=this.props,i={...typeof document<"u"&&document.documentElement.getAttribute("data-theme")!=="light"?ca:Ne,container:"rjv-container"};if(a==null)return null;const r=typeof n=="function"?n:t==="all"?()=>!0:t==="root"?h=>h<2:h=>h<1;return e.jsx("div",{className:ma.container,children:e.jsx(ha,{data:a,shouldExpandNode:r,style:i})})}}function pa({currentId:c,visibleIds:a=[],key:t}){if(t!=="ArrowUp"&&t!=="ArrowDown")return null;const n=a.findIndex(i=>i===c),o=t==="ArrowUp"?-1:1;return n>=0?a[n+o]??null:null}const ga="_root_17dqd_1",xa="_sidebar_17dqd_9",fa="_section_17dqd_18",ja="_sectionHeader_17dqd_22",ya="_arrow_17dqd_48",_a="_sectionTitle_17dqd_54",va="_sectionCount_17dqd_62",ba="_sectionBody_17dqd_71",Ca="_historyToggle_17dqd_76",Na="_historyToggleLabel_17dqd_102",Sa="_item_17dqd_107",ka="_itemActive_17dqd_135",Ta="_itemContent_17dqd_142",wa="_itemLabel_17dqd_148",Ma="_itemSublabel_17dqd_156",La="_itemTime_17dqd_165",Ra="_content_17dqd_174",Ia="_contentEmpty_17dqd_182",Ea="_contentInner_17dqd_189",Ba="_emptyWrap_17dqd_193",Aa="_roleHeader_17dqd_201",Da="_roleBadge_17dqd_209",Fa="_role_user_17dqd_218",Ha="_role_assistant_17dqd_224",Pa="_roleLabel_17dqd_230",qa="_contentTime_17dqd_237",za="_turnDivider_17dqd_245",Va="_textBlock_17dqd_252",$a="_textBlockBar_17dqd_259",Oa="_textBlockBody_17dqd_268",Ua="_textBlockCompact_17dqd_276",Ka="_textBlockCompactFloat_17dqd_283",Wa="_thinkingBlock_17dqd_290",Ja="_thinkingHeader_17dqd_298",Ga="_thinkingPreview_17dqd_313",Qa="_thinkingBody_17dqd_323",Xa="_toolBlock_17dqd_329",Ya="_toolBlockResult_17dqd_336",Za="_toolBlockError_17dqd_340",en="_toolBlockHeader_17dqd_344",tn="_toolBlockBody_17dqd_355",sn="_toolName_17dqd_360",an="_toolId_17dqd_366",nn="_errorLabel_17dqd_373",ln="_blockTag_17dqd_383",on="_blockTagText_17dqd_396",rn="_blockTagThinking_17dqd_402",cn="_blockTagResult_17dqd_408",dn="_blockTagError_17dqd_414",hn="_jsonBlock_17dqd_421",un="_jsonBlockLabel_17dqd_428",mn="_blockSeparator_17dqd_438",pn="_markdownBody_17dqd_445",_={root:ga,sidebar:xa,section:fa,sectionHeader:ja,arrow:ya,sectionTitle:_a,sectionCount:va,sectionBody:ba,historyToggle:Ca,historyToggleLabel:Na,item:Sa,itemActive:ka,itemContent:Ta,itemLabel:wa,itemSublabel:Ma,itemTime:La,content:Ra,contentEmpty:Ia,contentInner:Ea,emptyWrap:Ba,roleHeader:Aa,roleBadge:Da,role_user:Fa,role_assistant:Ha,roleLabel:Pa,contentTime:qa,turnDivider:za,textBlock:Va,textBlockBar:$a,textBlockBody:Oa,textBlockCompact:Ua,textBlockCompactFloat:Ka,thinkingBlock:Wa,thinkingHeader:Ja,thinkingPreview:Ga,thinkingBody:Qa,toolBlock:Xa,toolBlockResult:Ya,toolBlockError:Za,toolBlockHeader:en,toolBlockBody:tn,toolName:sn,toolId:an,errorLabel:nn,blockTag:ln,blockTagText:on,blockTagThinking:rn,blockTagResult:cn,blockTagError:dn,jsonBlock:hn,jsonBlockLabel:un,blockSeparator:mn,markdownBody:pn},{Text:gn}=ft;function ze(c){if(c==null)return[];if(typeof c=="string"){const a=c.trim();return a?[{type:"markdown",text:a}]:[]}if(Array.isArray(c)){const a=[];for(const t of c)if(t)if(t.type==="text"){const n=(t.text||"").trim();n&&a.push({type:"markdown",text:n})}else if(t.type==="tool_use")a.push({type:"tool_use",name:t.name||"unknown",id:t.id||"",input:t.input??{}});else if(t.type==="tool_result"){const n=xn(t.content);a.push({type:"tool_result",tool_use_id:t.tool_use_id||"",is_error:t.is_error,content:n})}else if(t.type==="thinking"){const n=t.thinking||"";n.trim()&&a.push({type:"thinking",text:n})}else t.type==="image"?a.push({type:"json",label:"image",data:t}):a.push({type:"json",label:t.type||"block",data:t});return a}return[{type:"json",label:"content",data:c}]}function xn(c){if(c==null)return[];if(typeof c=="string"){const a=c.trim();return a?[{type:"markdown",text:a}]:[]}return Array.isArray(c)?c.flatMap(a=>{if(!a)return[];if(a.type==="text"){const t=(a.text||"").trim();return t?[{type:"markdown",text:t}]:[]}return[{type:"json",label:a.type||"block",data:a}]}):[{type:"json",label:"content",data:c}]}function fn(c){if(!c)return null;if(typeof c=="string")return[{type:"markdown",text:c}];if(Array.isArray(c)){const a=[];return c.forEach((t,n)=>{n>0&&a.push({type:"separator"}),t&&(typeof t=="string"?a.push({type:"markdown",text:t}):t.type==="text"?a.push({type:"markdown",text:t.text||""}):a.push({type:"json",label:t.type||"item",data:t}))}),a}return[{type:"json",label:"system",data:c}]}function jn(c){const a=[],t=(c==null?void 0:c.name)||"unknown",n=(c==null?void 0:c.description)||"";let o=`### ${t}
|
|
20
20
|
|
|
21
21
|
`;n&&(o+=`${n}
|
|
22
22
|
|
|
23
|
-
`),a.push({type:"markdown",text:o});const i=(c==null?void 0:c.input_schema)||(c==null?void 0:c.parameters)||null;return i&&a.push({type:"json",label:"Parameters",data:i}),a}function yn(c){var a;if(typeof c=="string")return c.slice(0,60).replace(/\n/g," ");if(Array.isArray(c)){for(const t of c)if((t==null?void 0:t.type)==="text"&&((a=t.text)!=null&&a.trim()))return t.text.trim().slice(0,60).replace(/\n/g," ")}return""}function _n(c){var n;const a=[];let t=0;for(;t<c.length;){const o=c[t];if((o==null?void 0:o.role)!=="user"){t++;continue}const i=((n=c[t+1])==null?void 0:n.role)==="assistant"?c[t+1]:null;a.push({id:`turn__${t}`,isTurn:!0,turnIndex:a.length,timestamp:o._timestamp||null,assistantTimestamp:(i==null?void 0:i._timestamp)||null,userBlocks:ze(o==null?void 0:o.content),assistantBlocks:i?ze(i.content):null,preview:yn(o==null?void 0:o.content)}),t+=i?2:1}return a}function Ve(c){try{return new Date(c).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return null}}function vn({text:c,compact:a}){const t=_t(c);return a?e.jsx("div",{className:v.textBlockCompact,children:e.jsx("div",{className:`chat-md ${v.markdownBody}`,dangerouslySetInnerHTML:{__html:t}})}):e.jsxs("div",{className:v.textBlock,children:[e.jsx("div",{className:v.textBlockBar,children:e.jsx("span",{className:`${v.blockTag} ${v.blockTagText}`,children:"text"})}),e.jsx("div",{className:`chat-md ${v.textBlockBody}`,dangerouslySetInnerHTML:{__html:t}})]})}function bn({block:c}){const[a,t]=N.useState(!0),n=c.text.length>60?c.text.slice(0,60).replace(/\n/g," ")+"…":c.text.replace(/\n/g," ");return e.jsxs("div",{className:v.thinkingBlock,children:[e.jsxs("div",{className:v.thinkingHeader,onClick:()=>t(o=>!o),children:[a?e.jsx(re,{className:v.arrow}):e.jsx(ce,{className:v.arrow}),e.jsx("span",{className:`${v.blockTag} ${v.blockTagThinking}`,children:"thinking"}),!a&&e.jsx("span",{className:v.thinkingPreview,children:n})]}),a&&e.jsx("div",{className:v.thinkingBody,children:e.jsx("div",{className:`chat-md ${v.markdownBody}`,dangerouslySetInnerHTML:{__html:_t(c.text)}})})]})}function we({blocks:c,compact:a}){return!c||c.length===0?null:e.jsx(e.Fragment,{children:c.map((t,n)=>e.jsx(Cn,{block:t,compact:a},n))})}function Cn({block:c,compact:a}){var t;return c.type==="separator"?e.jsx("hr",{className:v.blockSeparator}):c.type==="markdown"?(t=c.text)!=null&&t.trim()?e.jsx(vn,{text:c.text,compact:a}):null:c.type==="thinking"?e.jsx(bn,{block:c}):c.type==="tool_use"?e.jsxs("div",{className:v.toolBlock,children:[e.jsxs("div",{className:v.toolBlockHeader,children:[e.jsx("span",{className:v.blockTag,children:"tool_use"}),e.jsx("span",{className:v.toolName,children:c.name}),c.id&&e.jsx("span",{className:v.toolId,children:c.id})]}),e.jsx("div",{className:v.toolBlockBody,children:e.jsx(Te,{data:c.input,defaultExpand:"root"})})]}):c.type==="tool_result"?e.jsxs("div",{className:`${v.toolBlock} ${c.is_error?v.toolBlockError:v.toolBlockResult}`,children:[e.jsxs("div",{className:v.toolBlockHeader,children:[e.jsx("span",{className:`${v.blockTag} ${c.is_error?v.blockTagError:v.blockTagResult}`,children:"tool_result"}),c.tool_use_id&&e.jsx("span",{className:v.toolId,children:c.tool_use_id}),c.is_error&&e.jsx("span",{className:v.errorLabel,children:"error"})]}),e.jsx("div",{className:v.toolBlockBody,children:e.jsx(we,{blocks:c.content,compact:!0})})]}):c.type==="json"?e.jsxs("div",{className:v.jsonBlock,children:[c.label&&e.jsx("div",{className:v.jsonBlockLabel,children:c.label}),e.jsx(Te,{data:c.data,defaultExpand:"root"})]}):null}function Nn({turn:c}){const a=c.timestamp?Ve(c.timestamp):null,t=c.assistantTimestamp?Ve(c.assistantTimestamp):null;return e.jsxs("div",{children:[e.jsxs("div",{className:v.roleHeader,children:[e.jsx("span",{className:`${v.roleBadge} ${v.role_user}`,children:"user"}),e.jsx("span",{className:v.roleLabel,children:`Turn ${c.turnIndex+1}`}),a&&e.jsx("span",{className:v.contentTime,children:a})]}),e.jsx(we,{blocks:c.userBlocks}),c.assistantBlocks&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:v.turnDivider}),e.jsxs("div",{className:v.roleHeader,children:[e.jsx("span",{className:`${v.roleBadge} ${v.role_assistant}`,children:"assistant"}),t&&e.jsx("span",{className:v.contentTime,children:t})]}),e.jsx(we,{blocks:c.assistantBlocks})]})]})}function Sn({sectionKey:c,title:a,items:t,historyItems:n=[],onSelect:o,onSelectById:i,selectedId:r,sidebarRef:h}){const[d,g]=N.useState(c!=="tools"),[m,u]=N.useState(!1),y=t.length+n.length,S=`${c}__history_toggle`;function j(f){var M;const T=(M=h.current)==null?void 0:M.querySelector(`[data-context-sidebar-control="${f}"]`);T&&(T.focus(),T.scrollIntoView({block:"nearest"}))}function p(f,T){var w;const M=Array.from(((w=h.current)==null?void 0:w.querySelectorAll("[data-context-sidebar-control]"))||[]).map(I=>I.dataset.contextSidebarControl).filter(Boolean),C=pa({currentId:T,visibleIds:M,key:f.key});C&&(f.preventDefault(),typeof window<"u"&&window.requestAnimationFrame(()=>{var D;j(C);const I=(D=h.current)==null?void 0:D.querySelector(`[data-context-sidebar-control="${C}"]`);(I==null?void 0:I.dataset.controlType)==="item"&&i(C)}))}function b(f){const T=r===f.id;return e.jsxs("button",{type:"button",className:`${v.item} ${T?v.itemActive:""}`,onClick:()=>o(f),onKeyDown:M=>p(M,f.id),"aria-current":T?"true":void 0,"data-context-sidebar-control":f.id,"data-control-type":"item",children:[e.jsxs("div",{className:v.itemContent,children:[e.jsx("span",{className:v.itemLabel,children:f.label}),f.sublabel&&!T&&e.jsx("div",{className:v.itemSublabel,children:f.sublabel})]}),f.time&&e.jsx("span",{className:v.itemTime,children:f.time})]},f.id)}return e.jsxs("div",{className:v.section,children:[e.jsxs("button",{type:"button",className:v.sectionHeader,onClick:()=>g(f=>!f),"aria-expanded":d,children:[d?e.jsx(re,{className:v.arrow}):e.jsx(ce,{className:v.arrow}),e.jsx("span",{className:v.sectionTitle,children:a}),e.jsx("span",{className:v.sectionCount,children:y})]}),d&&e.jsxs("div",{className:v.sectionBody,children:[n.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:v.historyToggle,onClick:()=>u(f=>!f),onKeyDown:f=>p(f,S),"aria-expanded":m,"data-context-sidebar-control":S,"data-control-type":"toggle",children:[m?e.jsx(re,{className:v.arrow}):e.jsx(ce,{className:v.arrow}),e.jsxs("span",{className:v.historyToggleLabel,children:[l("ui.context.history")," (",n.length,")"]})]}),m&&n.map(b)]}),t.map(b)]})]})}function kn({body:c,response:a}){const[t,n]=N.useState(null),o=N.useRef(null),i=N.useMemo(()=>{if(!Array.isArray(c==null?void 0:c.messages))return[];const m=_n(c.messages);if(m.length===0)return m;const u=m[m.length-1],y=a!=null&&a.content?ze(a.content):null;return[...m.slice(0,-1),{...u,assistantBlocks:y??u.assistantBlocks}]},[c,a]);if(N.useEffect(()=>{i.length>0?n(i[i.length-1]):n(null)},[c,a]),!c||typeof c!="object")return e.jsx("div",{className:v.emptyWrap,children:e.jsx(oe,{description:l("ui.context.noData")})});const r=[];Array.isArray(c.tools)&&c.tools.length>0&&r.push({key:"tools",title:e.jsxs(e.Fragment,{children:[l("ui.context.tools")," ",e.jsx($,{doc:"ToolsFirst"})]}),items:c.tools.map((m,u)=>({id:`tool__${u}`,label:(m==null?void 0:m.name)||`Tool ${u}`,blocks:jn(m)}))});const h=fn(c.system);if(h!=null&&r.push({key:"system",title:l("ui.context.systemPrompt"),items:[{id:"system__0",label:l("ui.context.systemPrompt"),blocks:h}]}),i.length>0){const m=j=>({...j,label:l("ui.context.historyTurnNoTime",{n:j.turnIndex+1}),time:j.timestamp?Ve(j.timestamp):null,sublabel:j.preview||void 0}),u=j=>({...j,label:l("ui.context.currentTurn"),sublabel:j.preview||void 0}),y=i.slice(0,-1).map(m),S=u(i[i.length-1]);r.push({key:"messages",title:l("ui.context.messages"),historyItems:y.length>0?y:void 0,items:[S]})}if(r.length===0)return e.jsx("div",{className:v.emptyWrap,children:e.jsx(oe,{description:l("ui.context.noFields")})});const d=t!=null&&t.isTurn?i.find(m=>m.id===t.id)??null:t,g=new Map;return r.forEach(m=>{(m.historyItems||[]).forEach(u=>g.set(u.id,u)),m.items.forEach(u=>g.set(u.id,u))}),e.jsxs("div",{className:v.root,children:[e.jsx("div",{ref:o,className:v.sidebar,children:r.map(m=>e.jsx(Sn,{sectionKey:m.key,title:m.title,items:m.items,historyItems:m.historyItems,selectedId:d==null?void 0:d.id,onSelect:u=>n(u),onSelectById:u=>{const y=g.get(u);y&&n(y)},sidebarRef:o},m.key))}),e.jsx("div",{className:v.content,children:d==null?e.jsx("div",{className:v.contentEmpty,children:e.jsx(gn,{type:"secondary",children:l("ui.context.selectPrompt")})}):e.jsx("div",{className:v.contentInner,children:d.isTurn?e.jsx(Nn,{turn:d}):e.jsxs(e.Fragment,{children:[d.role&&e.jsxs("div",{className:v.roleHeader,children:[e.jsx("span",{className:`${v.roleBadge} ${v[`role_${d.role}`]||""}`,children:d.role}),e.jsx("span",{className:v.roleLabel,children:d.label})]}),e.jsx(we,{blocks:d.blocks})]})},d.id)})]})}const Tn="_container_rg6mx_1",wn="_emptyState_rg6mx_10",Mn="_urlSection_rg6mx_17",Ln="_urlLeft_rg6mx_25",Rn="_tokenStatsBox_rg6mx_30",In="_tokenGrid_rg6mx_37",En="_tokenRows_rg6mx_47",Bn="_tokenRow_rg6mx_47",An="_tokenRowBorder_rg6mx_55",Dn="_tokenLabel_rg6mx_59",Fn="_tokenTd_rg6mx_66",Hn="_tokenHitRate_rg6mx_75",Pn="_tokenHitRateLabel_rg6mx_88",qn="_urlText_rg6mx_98",zn="_metaText_rg6mx_105",Vn="_headersContainer_rg6mx_109",$n="_headerRow_rg6mx_113",On="_headerKey_rg6mx_119",Un="_headerValue_rg6mx_124",Kn="_streamingBox_rg6mx_129",Wn="_rawTextPre_rg6mx_142",Jn="_tabContent_rg6mx_155",Gn="_bodyLabel_rg6mx_167",Qn="_bodyHeader_rg6mx_171",Xn="_diffSection_rg6mx_178",Yn="_diffToggle_rg6mx_182",Zn="_diffIcon_rg6mx_188",ei="_reminderSelect_rg6mx_214",ti="_diffHeaderRow_rg6mx_233",si="_diffSpaceRight_rg6mx_239",ai="_reminderFilterWrapper_rg6mx_243",ni="_reminderLabel_rg6mx_249",ii="_cacheTabContent_rg6mx_255",li="_userPromptList_rg6mx_260",oi="_userPromptItem_rg6mx_266",ri="_userPromptNavBtn_rg6mx_277",ci="_cacheContent_rg6mx_288",di="_cacheTokenBar_rg6mx_295",hi="_cacheTokenWrite_rg6mx_305",ui="_cacheTokenRead_rg6mx_309",mi="_cacheCopyIcon_rg6mx_313",pi="_cacheScrollArea_rg6mx_320",gi="_cacheSectionBlock_rg6mx_326",xi="_cacheSectionHeader_rg6mx_330",fi="_cacheCollapseArrow_rg6mx_342",ji="_cachePre_rg6mx_348",yi="_cacheHighlightSvg_rg6mx_362",_i="_cachePreSystem_rg6mx_371",x={container:Tn,emptyState:wn,urlSection:Mn,urlLeft:Ln,tokenStatsBox:Rn,tokenGrid:In,tokenRows:En,tokenRow:Bn,tokenRowBorder:An,tokenLabel:Dn,tokenTd:Fn,tokenHitRate:Hn,tokenHitRateLabel:Pn,urlText:qn,metaText:zn,headersContainer:Vn,headerRow:$n,headerKey:On,headerValue:Un,streamingBox:Kn,rawTextPre:Wn,tabContent:Jn,bodyLabel:Gn,bodyHeader:Qn,diffSection:Xn,diffToggle:Yn,diffIcon:Zn,reminderSelect:ei,diffHeaderRow:ti,diffSpaceRight:si,reminderFilterWrapper:ai,reminderLabel:ni,cacheTabContent:ii,userPromptList:li,userPromptItem:oi,userPromptNavBtn:ri,cacheContent:ci,cacheTokenBar:di,cacheTokenWrite:hi,cacheTokenRead:ui,cacheCopyIcon:mi,cacheScrollArea:pi,cacheSectionBlock:gi,cacheSectionHeader:xi,cacheCollapseArrow:fi,cachePre:ji,cacheHighlightSvg:yi,cachePreSystem:_i},{Text:J,Paragraph:vi}=ft;class bi extends me.Component{constructor(a){super(a),this.state={bodyViewMode:{request:"json",response:"json",diff:"json"},diffExpanded:!1,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null,cacheHighlightIdx:null,cacheHighlightFading:!1,cacheCollapsed:{tools:!1,system:!1,messages:!1}}}_cacheUnbindScrollFade(){this._cacheOnScrollFade&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scroll",this._cacheOnScrollFade),this._cacheOnScrollFade=null)}_cacheClearAllTimers(){clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scrollend",this._cacheScrollEndHandler),this._cacheScrollEndHandler=null)}componentWillUnmount(){this._cacheClearAllTimers()}_cacheBindScrollFade(){this._cacheUnbindScrollFade();const a=this._cacheScrollEl;a&&(this._cacheOnScrollFade=()=>{clearTimeout(this._cacheAutoFadeTimer),this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade()},a.addEventListener("scroll",this._cacheOnScrollFade,{passive:!0}))}scrollToCacheMsg(a){if(this.state.cacheCollapsed.messages){this.setState(h=>({cacheCollapsed:{...h.cacheCollapsed,messages:!1}}),()=>this.scrollToCacheMsg(a));return}const t=this._cacheScrollEl;if(!t)return;const n=t.querySelector(`[data-msg-idx="${a}"]`);if(!n)return;clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&t.removeEventListener("scrollend",this._cacheScrollEndHandler),this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1});let o=!1,i=!1;const r=()=>{!o||!i||(this.setState({cacheHighlightIdx:a,cacheHighlightFading:!1}),this._cacheScrollSettleTimer=setTimeout(()=>this._cacheBindScrollFade(),200),this._cacheAutoFadeTimer=setTimeout(()=>{this.state.cacheHighlightIdx===a&&!this.state.cacheHighlightFading&&(this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade())},3e3))};this._cacheScrollEndHandler=()=>{t.removeEventListener("scrollend",this._cacheScrollEndHandler),o=!0,r()},t.addEventListener("scrollend",this._cacheScrollEndHandler,{once:!0}),this._cacheScrollSettleTimer=setTimeout(()=>{t.removeEventListener("scrollend",this._cacheScrollEndHandler),o=!0,r()},800),this._cacheHighlightDelayTimer=setTimeout(()=>{i=!0,r()},500),n.scrollIntoView({behavior:"smooth",block:"center"})}shouldComponentUpdate(a,t){if(a.request!==this.props.request){const o=Z(a.request);this.setState({diffExpanded:o&&!!a.expandDiff,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null}),this._cacheClearAllTimers()}const n=a.currentTab==="kv-cache-text";return a.request!==this.props.request||a.currentTab!==this.props.currentTab||a.onTabChange!==this.props.onTabChange||a.selectedIndex!==this.props.selectedIndex||a.expandDiff!==this.props.expandDiff||a.pendingCacheHighlight!==this.props.pendingCacheHighlight||t.bodyViewMode!==this.state.bodyViewMode||n&&t.cacheHighlightIdx!==this.state.cacheHighlightIdx||n&&t.cacheHighlightFading!==this.state.cacheHighlightFading||t.diffExpanded!==this.state.diffExpanded||t.requestHeadersExpanded!==this.state.requestHeadersExpanded||t.responseHeadersExpanded!==this.state.responseHeadersExpanded||t.reminderFilters!==this.state.reminderFilters||n&&t.cacheCollapsed!==this.state.cacheCollapsed}componentDidUpdate(a){const t=this.props.pendingCacheHighlight;t&&t!==a.pendingCacheHighlight&&setTimeout(()=>{var n,o;this.scrollToCacheMsg(t.msgIdx),(o=(n=this.props).onCacheHighlightDone)==null||o.call(n)},150)}getCurrentRequest(){const{request:a,allRequests:t,requests:n}=this.props;return a?a._slimmed?nt(a,t||n||[]):a:null}toggleBodyViewMode(a){this.setState(t=>({bodyViewMode:{...t.bodyViewMode,[a]:t.bodyViewMode[a]==="json"?"text":"json"}}))}copyBody(a){var r;const t=this.getCurrentRequest();if(!t)return;let n;if(a==="diff"?n=this._lastDiffResult:n=a==="request"?t.body:(r=t.response)==null?void 0:r.body,n==null)return;const o=typeof n=="object"?Be(n):n,i=typeof o=="string"?o:JSON.stringify(o,null,2);navigator.clipboard.writeText(i).then(()=>H.success(l("ui.copySuccess")))}renderHeaders(a){return!a||Object.keys(a).length===0?e.jsx(J,{type:"secondary",children:l("ui.noHeaders")}):e.jsx("div",{className:x.headersContainer,children:Object.entries(a).map(([t,n])=>e.jsxs("div",{className:x.headerRow,children:[e.jsx(J,{code:!0,className:x.headerKey,children:t}),t==="authorization"&&e.jsx($,{doc:"TranslateContextPollution"}),e.jsx(J,{type:"secondary",className:x.headerValue,children:String(n)})]},t))})}getRequestExpandNode(a,t){if(t!=="request"||!a||typeof a!="object")return;const{request:n,requests:o,selectedIndex:i}=this.props;if(!n)return;const r=o&&i!=null?o[i+1]:null,{type:h}=fe(n,r);let d=null;if(this.state.reminderFilters==="claudeMd"&&Array.isArray(a.messages)){d=new Set,d.add(a.messages);for(const u of a.messages){if(!u||typeof u!="object")continue;const y=u.content;if(typeof y=="string")it(y)&&d.add(u);else if(Array.isArray(y)){let S=!1;for(const j of y)j&&j.type==="text"&&it(j.text)&&(d.add(j),S=!0);S&&(d.add(u),d.add(y))}}}let g=null;if(this.state.reminderFilters==="skills"&&Array.isArray(a.messages)){g=new Set,g.add(a.messages);for(const u of a.messages){if(!u||typeof u!="object")continue;const y=u.content;if(typeof y=="string")lt(y)&&g.add(u);else if(Array.isArray(y)){let S=!1;for(const j of y)j&&j.type==="text"&<(j.text)&&(g.add(j),S=!0);S&&(g.add(u),g.add(y))}}}const m=d||g;if(h==="Preflight"){const u=new Set,y=S=>{S&&typeof S=="object"&&(u.add(S),Array.isArray(S)?S.forEach(y):Object.values(S).forEach(y))};return Array.isArray(a.messages)&&y(a.messages),Array.isArray(a.system)&&a.system.length>=3&&y(a.system[2]),(S,j,p)=>!!(S<2||u.has(j)||m&&m.has(j)||S===1&&p==="system")}if(h==="MainAgent"&&Array.isArray(a.messages)&&a.messages.length===1){const u=a.messages[0],y=u&&Array.isArray(u.content)?u.content:null,S=y&&y.length>0?y[y.length-1]:null,j=new Set,p=b=>{b&&typeof b=="object"&&(j.add(b),Array.isArray(b)?b.forEach(p):Object.values(b).forEach(p))};return S&&p(S),j.add(a.messages),u&&typeof u=="object"&&j.add(u),y&&j.add(y),(b,f,T)=>!!(b<2||j.has(f)||m&&m.has(f))}if(m)return(u,y,S)=>!!(u<2||m.has(y))}renderBody(a,t){const{bodyViewMode:n}=this.state;if(a==null)return e.jsx(J,{type:"secondary",children:l("ui.noBody")});if(typeof a=="string"&&a.includes("Streaming Response"))return e.jsx("div",{className:x.streamingBox,children:e.jsx(J,{type:"secondary",children:l("ui.streamingResponse")})});const o=typeof a=="object"?Be(a):a,i=n[t]==="json",r=this.getRequestExpandNode(o,t);return e.jsx("div",{children:i?e.jsx(Te,{data:o,defaultExpand:t==="response"?"all":"root",expandNode:r}):e.jsx("pre",{className:x.rawTextPre,children:typeof o=="string"?o:JSON.stringify(o,null,2)})})}getPrevMainAgentRequest(){const{requests:a,selectedIndex:t}=this.props;if(!a||t==null)return null;for(let n=t-1;n>=0;n--)if(Z(a[n])){const o=a[n];return o._slimmed?nt(o,this.props.allRequests||a):o}return null}computeDiff(a,t){if(a==null||t==null||typeof a!="object"||typeof t!="object")return null;const n={},o=new Set([...Object.keys(a),...Object.keys(t)]);for(const i of o)if(!i.startsWith("_"))if(!(i in a))n[i]=t[i];else if(i in t){const r=JSON.stringify(a[i]),h=JSON.stringify(t[i]);r!==h&&(i==="messages"&&Array.isArray(a[i])&&Array.isArray(t[i])&&t[i].length>a[i].length?n[i]=t[i].slice(a[i].length):n[i]=t[i])}else continue;return Object.keys(n).length?n:null}render(){var y,S,j;let a=this.getCurrentRequest();const{currentTab:t,onTabChange:n}=this.props;if(!a)return e.jsx("div",{className:x.emptyState,children:e.jsx(oe,{description:"选择一个请求查看详情"})});const o=new Date(a.timestamp).toLocaleString("zh-CN"),i=a.response&&a.response.status<400;let r=null;if(Z(a)){const p=this.getPrevMainAgentRequest();if(p){const b=JSON.stringify(a.body).length,f=JSON.stringify(p.body).length;if(b<f)r=e.jsxs("div",{className:x.diffSection,children:[e.jsxs(J,{strong:!0,className:x.diffToggle,onClick:()=>this.setState(M=>({diffExpanded:!M.diffExpanded})),children:["Body Diff JSON ",e.jsx($,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?e.jsx(re,{className:x.diffIcon}):e.jsx(ce,{className:x.diffIcon})]}),this.state.diffExpanded&&e.jsx(J,{type:"secondary",children:l("ui.diffSessionChanged")})]});else{const M=Be(this.computeDiff(p.body,a.body));M&&(this._lastDiffResult=M,r=e.jsxs("div",{className:x.diffSection,children:[e.jsxs("div",{className:x.diffHeaderRow,children:[e.jsxs(J,{strong:!0,className:x.diffToggle,onClick:()=>this.setState(C=>({diffExpanded:!C.diffExpanded})),children:["Body Diff JSON ",e.jsx($,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?e.jsx(re,{className:x.diffIcon}):e.jsx(ce,{className:x.diffIcon})]}),this.state.diffExpanded&&e.jsxs(he,{size:"small",className:x.diffSpaceRight,children:[e.jsx(E,{size:"small",icon:this.state.bodyViewMode.diff==="json"?e.jsx(be,{}):e.jsx(Ce,{}),onClick:()=>this.toggleBodyViewMode("diff"),children:this.state.bodyViewMode.diff==="json"?"Text":"JSON"}),e.jsx(E,{size:"small",icon:e.jsx(xe,{}),onClick:()=>this.copyBody("diff"),children:l("ui.copy")})]})]}),this.state.diffExpanded&&e.jsx(e.Fragment,{children:this.state.bodyViewMode.diff==="json"?e.jsx(Te,{data:M,defaultExpand:"all"}):e.jsx("pre",{className:x.rawTextPre,children:JSON.stringify(M,null,2)})})]}))}}}const h=Qt(a.body),d=Xt(a.body),g=[{key:"request",label:"Request",children:e.jsxs("div",{className:x.tabContent,children:[e.jsxs("div",{className:x.diffSection,children:[e.jsxs(J,{strong:!0,className:x.diffToggle,onClick:()=>this.setState(p=>({requestHeadersExpanded:!p.requestHeadersExpanded})),children:["Headers ",this.state.requestHeadersExpanded?e.jsx(re,{className:x.diffIcon}):e.jsx(ce,{className:x.diffIcon})]}),this.state.requestHeadersExpanded&&this.renderHeaders(a.headers)]}),r,e.jsxs("div",{children:[e.jsxs("div",{className:x.bodyHeader,children:[e.jsxs(J,{strong:!0,className:x.bodyLabel,children:["Body",e.jsx($,{doc:"BodyFields"})]}),e.jsxs(he,{size:"small",children:[(h||d)&&e.jsxs("span",{className:x.reminderFilterWrapper,children:[e.jsx("span",{className:x.reminderLabel,children:"system-reminder:"}),e.jsx(le,{size:"small",className:x.reminderSelect,placeholder:"filter",value:this.state.reminderFilters||void 0,onChange:p=>this.setState({reminderFilters:p||null}),options:[{label:"CLAUDE.md",value:"claudeMd",disabled:!h},{label:"Skills",value:"skills",disabled:!d}],popupMatchSelectWidth:!1,allowClear:!0})]}),e.jsx(E,{size:"small",icon:this.state.bodyViewMode.request==="json"?e.jsx(be,{}):e.jsx(Ce,{}),onClick:()=>this.toggleBodyViewMode("request"),children:this.state.bodyViewMode.request==="json"?"Text":"JSON"}),e.jsx(E,{size:"small",icon:e.jsx(xe,{}),onClick:()=>this.copyBody("request"),children:l("ui.copy")})]})]}),this.renderBody(a.body,"request")]})]})},{key:"response",label:"Response",children:e.jsx("div",{className:x.tabContent,children:a.response?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:x.diffSection,children:[e.jsxs(J,{strong:!0,className:x.diffToggle,onClick:()=>this.setState(p=>({responseHeadersExpanded:!p.responseHeadersExpanded})),children:["Headers ",this.state.responseHeadersExpanded?e.jsx(re,{className:x.diffIcon}):e.jsx(ce,{className:x.diffIcon})]}),this.state.responseHeadersExpanded&&this.renderHeaders(a.response.headers)]}),e.jsxs("div",{children:[e.jsxs("div",{className:x.bodyHeader,children:[e.jsxs(J,{strong:!0,className:x.bodyLabel,children:["Body",e.jsx($,{doc:"ResponseFields"})]}),e.jsxs(he,{size:"small",children:[e.jsx(E,{size:"small",icon:this.state.bodyViewMode.response==="json"?e.jsx(be,{}):e.jsx(Ce,{}),onClick:()=>this.toggleBodyViewMode("response"),children:this.state.bodyViewMode.response==="json"?"Text":"JSON"}),e.jsx(E,{size:"small",icon:e.jsx(xe,{}),onClick:()=>this.copyBody("response"),children:l("ui.copy")})]})]}),this.renderBody(a.response.body,"response")]})]}):e.jsx(oe,{description:l("ui.responseNotCaptured")})})},{key:"kv-cache-text",label:e.jsxs("span",{children:["KV-Cache-Text ",e.jsx($,{doc:"KVCacheContent"})]}),children:e.jsx("div",{className:`${x.tabContent} ${x.cacheTabContent}`,children:(()=>{const p=jt([a]),b=a.timestamp+"|"+a.url;if(p&&(p.cacheCreateTokens>0||p.cacheReadTokens>0)&&(this._lastCachedTokensKey=b,this._lastCachedTokens={cacheCreateTokens:p.cacheCreateTokens,cacheReadTokens:p.cacheReadTokens}),!p||p.system.length===0&&p.messages.length===0&&p.tools.length===0)return e.jsx(oe,{description:l("ui.noCachedContent"),image:oe.PRESENTED_IMAGE_SIMPLE});const f=()=>{const C=[];return p.tools.length>0&&(C.push(`=== ${l("ui.tools")} ===`),p.tools.forEach(w=>C.push(w))),p.system.length>0&&(C.push(`
|
|
23
|
+
`),a.push({type:"markdown",text:o});const i=(c==null?void 0:c.input_schema)||(c==null?void 0:c.parameters)||null;return i&&a.push({type:"json",label:"Parameters",data:i}),a}function yn(c){var a;if(typeof c=="string")return c.slice(0,60).replace(/\n/g," ");if(Array.isArray(c)){for(const t of c)if((t==null?void 0:t.type)==="text"&&((a=t.text)!=null&&a.trim()))return t.text.trim().slice(0,60).replace(/\n/g," ")}return""}function _n(c){var n;const a=[];let t=0;for(;t<c.length;){const o=c[t];if((o==null?void 0:o.role)!=="user"){t++;continue}const i=((n=c[t+1])==null?void 0:n.role)==="assistant"?c[t+1]:null;a.push({id:`turn__${t}`,isTurn:!0,turnIndex:a.length,timestamp:o._timestamp||null,assistantTimestamp:(i==null?void 0:i._timestamp)||null,userBlocks:ze(o==null?void 0:o.content),assistantBlocks:i?ze(i.content):null,preview:yn(o==null?void 0:o.content)}),t+=i?2:1}return a}function Ve(c){try{return new Date(c).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return null}}function vn({text:c,compact:a}){const t=_t(c);return a?e.jsx("div",{className:_.textBlockCompact,children:e.jsx("div",{className:`chat-md ${_.markdownBody}`,dangerouslySetInnerHTML:{__html:t}})}):e.jsxs("div",{className:_.textBlock,children:[e.jsx("div",{className:_.textBlockBar,children:e.jsx("span",{className:`${_.blockTag} ${_.blockTagText}`,children:"text"})}),e.jsx("div",{className:`chat-md ${_.textBlockBody}`,dangerouslySetInnerHTML:{__html:t}})]})}function bn({block:c}){const[a,t]=N.useState(!0),n=c.text.length>60?c.text.slice(0,60).replace(/\n/g," ")+"…":c.text.replace(/\n/g," ");return e.jsxs("div",{className:_.thinkingBlock,children:[e.jsxs("div",{className:_.thinkingHeader,onClick:()=>t(o=>!o),children:[a?e.jsx(re,{className:_.arrow}):e.jsx(ce,{className:_.arrow}),e.jsx("span",{className:`${_.blockTag} ${_.blockTagThinking}`,children:"thinking"}),!a&&e.jsx("span",{className:_.thinkingPreview,children:n})]}),a&&e.jsx("div",{className:_.thinkingBody,children:e.jsx("div",{className:`chat-md ${_.markdownBody}`,dangerouslySetInnerHTML:{__html:_t(c.text)}})})]})}function we({blocks:c,compact:a}){return!c||c.length===0?null:e.jsx(e.Fragment,{children:c.map((t,n)=>e.jsx(Cn,{block:t,compact:a},n))})}function Cn({block:c,compact:a}){var t;return c.type==="separator"?e.jsx("hr",{className:_.blockSeparator}):c.type==="markdown"?(t=c.text)!=null&&t.trim()?e.jsx(vn,{text:c.text,compact:a}):null:c.type==="thinking"?e.jsx(bn,{block:c}):c.type==="tool_use"?e.jsxs("div",{className:_.toolBlock,children:[e.jsxs("div",{className:_.toolBlockHeader,children:[e.jsx("span",{className:_.blockTag,children:"tool_use"}),e.jsx("span",{className:_.toolName,children:c.name}),c.id&&e.jsx("span",{className:_.toolId,children:c.id})]}),e.jsx("div",{className:_.toolBlockBody,children:e.jsx(Te,{data:c.input,defaultExpand:"root"})})]}):c.type==="tool_result"?e.jsxs("div",{className:`${_.toolBlock} ${c.is_error?_.toolBlockError:_.toolBlockResult}`,children:[e.jsxs("div",{className:_.toolBlockHeader,children:[e.jsx("span",{className:`${_.blockTag} ${c.is_error?_.blockTagError:_.blockTagResult}`,children:"tool_result"}),c.tool_use_id&&e.jsx("span",{className:_.toolId,children:c.tool_use_id}),c.is_error&&e.jsx("span",{className:_.errorLabel,children:"error"})]}),e.jsx("div",{className:_.toolBlockBody,children:e.jsx(we,{blocks:c.content,compact:!0})})]}):c.type==="json"?e.jsxs("div",{className:_.jsonBlock,children:[c.label&&e.jsx("div",{className:_.jsonBlockLabel,children:c.label}),e.jsx(Te,{data:c.data,defaultExpand:"root"})]}):null}function Nn({turn:c}){const a=c.timestamp?Ve(c.timestamp):null,t=c.assistantTimestamp?Ve(c.assistantTimestamp):null;return e.jsxs("div",{children:[e.jsxs("div",{className:_.roleHeader,children:[e.jsx("span",{className:`${_.roleBadge} ${_.role_user}`,children:"user"}),e.jsx("span",{className:_.roleLabel,children:`Turn ${c.turnIndex+1}`}),a&&e.jsx("span",{className:_.contentTime,children:a})]}),e.jsx(we,{blocks:c.userBlocks}),c.assistantBlocks&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:_.turnDivider}),e.jsxs("div",{className:_.roleHeader,children:[e.jsx("span",{className:`${_.roleBadge} ${_.role_assistant}`,children:"assistant"}),t&&e.jsx("span",{className:_.contentTime,children:t})]}),e.jsx(we,{blocks:c.assistantBlocks})]})]})}function Sn({sectionKey:c,title:a,items:t,historyItems:n=[],onSelect:o,onSelectById:i,selectedId:r,sidebarRef:h}){const[d,g]=N.useState(c!=="tools"),[m,u]=N.useState(!1),j=t.length+n.length,S=`${c}__history_toggle`;function f(b){var M;const T=(M=h.current)==null?void 0:M.querySelector(`[data-context-sidebar-control="${b}"]`);T&&(T.focus(),T.scrollIntoView({block:"nearest"}))}function p(b,T){var w;const M=Array.from(((w=h.current)==null?void 0:w.querySelectorAll("[data-context-sidebar-control]"))||[]).map(I=>I.dataset.contextSidebarControl).filter(Boolean),C=pa({currentId:T,visibleIds:M,key:b.key});C&&(b.preventDefault(),typeof window<"u"&&window.requestAnimationFrame(()=>{var F;f(C);const I=(F=h.current)==null?void 0:F.querySelector(`[data-context-sidebar-control="${C}"]`);(I==null?void 0:I.dataset.controlType)==="item"&&i(C)}))}function v(b){const T=r===b.id;return e.jsxs("button",{type:"button",className:`${_.item} ${T?_.itemActive:""}`,onClick:()=>o(b),onKeyDown:M=>p(M,b.id),"aria-current":T?"true":void 0,"data-context-sidebar-control":b.id,"data-control-type":"item",children:[e.jsxs("div",{className:_.itemContent,children:[e.jsx("span",{className:_.itemLabel,children:b.label}),b.sublabel&&!T&&e.jsx("div",{className:_.itemSublabel,children:b.sublabel})]}),b.time&&e.jsx("span",{className:_.itemTime,children:b.time})]},b.id)}return e.jsxs("div",{className:_.section,children:[e.jsxs("button",{type:"button",className:_.sectionHeader,onClick:()=>g(b=>!b),"aria-expanded":d,children:[d?e.jsx(re,{className:_.arrow}):e.jsx(ce,{className:_.arrow}),e.jsx("span",{className:_.sectionTitle,children:a}),e.jsx("span",{className:_.sectionCount,children:j})]}),d&&e.jsxs("div",{className:_.sectionBody,children:[n.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:_.historyToggle,onClick:()=>u(b=>!b),onKeyDown:b=>p(b,S),"aria-expanded":m,"data-context-sidebar-control":S,"data-control-type":"toggle",children:[m?e.jsx(re,{className:_.arrow}):e.jsx(ce,{className:_.arrow}),e.jsxs("span",{className:_.historyToggleLabel,children:[l("ui.context.history")," (",n.length,")"]})]}),m&&n.map(v)]}),t.map(v)]})]})}function kn({body:c,response:a}){const[t,n]=N.useState(null),o=N.useRef(null),i=N.useMemo(()=>{if(!Array.isArray(c==null?void 0:c.messages))return[];const m=_n(c.messages);if(m.length===0)return m;const u=m[m.length-1],j=a!=null&&a.content?ze(a.content):null;return[...m.slice(0,-1),{...u,assistantBlocks:j??u.assistantBlocks}]},[c,a]);if(N.useEffect(()=>{i.length>0?n(i[i.length-1]):n(null)},[c,a]),!c||typeof c!="object")return e.jsx("div",{className:_.emptyWrap,children:e.jsx(oe,{description:l("ui.context.noData")})});const r=[];Array.isArray(c.tools)&&c.tools.length>0&&r.push({key:"tools",title:e.jsxs(e.Fragment,{children:[l("ui.context.tools")," ",e.jsx(O,{doc:"ToolsFirst"})]}),items:c.tools.map((m,u)=>({id:`tool__${u}`,label:(m==null?void 0:m.name)||`Tool ${u}`,blocks:jn(m)}))});const h=fn(c.system);if(h!=null&&r.push({key:"system",title:l("ui.context.systemPrompt"),items:[{id:"system__0",label:l("ui.context.systemPrompt"),blocks:h}]}),i.length>0){const m=f=>({...f,label:l("ui.context.historyTurnNoTime",{n:f.turnIndex+1}),time:f.timestamp?Ve(f.timestamp):null,sublabel:f.preview||void 0}),u=f=>({...f,label:l("ui.context.currentTurn"),sublabel:f.preview||void 0}),j=i.slice(0,-1).map(m),S=u(i[i.length-1]);r.push({key:"messages",title:l("ui.context.messages"),historyItems:j.length>0?j:void 0,items:[S]})}if(r.length===0)return e.jsx("div",{className:_.emptyWrap,children:e.jsx(oe,{description:l("ui.context.noFields")})});const d=t!=null&&t.isTurn?i.find(m=>m.id===t.id)??null:t,g=new Map;return r.forEach(m=>{(m.historyItems||[]).forEach(u=>g.set(u.id,u)),m.items.forEach(u=>g.set(u.id,u))}),e.jsxs("div",{className:_.root,children:[e.jsx("div",{ref:o,className:_.sidebar,children:r.map(m=>e.jsx(Sn,{sectionKey:m.key,title:m.title,items:m.items,historyItems:m.historyItems,selectedId:d==null?void 0:d.id,onSelect:u=>n(u),onSelectById:u=>{const j=g.get(u);j&&n(j)},sidebarRef:o},m.key))}),e.jsx("div",{className:_.content,children:d==null?e.jsx("div",{className:_.contentEmpty,children:e.jsx(gn,{type:"secondary",children:l("ui.context.selectPrompt")})}):e.jsx("div",{className:_.contentInner,children:d.isTurn?e.jsx(Nn,{turn:d}):e.jsxs(e.Fragment,{children:[d.role&&e.jsxs("div",{className:_.roleHeader,children:[e.jsx("span",{className:`${_.roleBadge} ${_[`role_${d.role}`]||""}`,children:d.role}),e.jsx("span",{className:_.roleLabel,children:d.label})]}),e.jsx(we,{blocks:d.blocks})]})},d.id)})]})}const Tn="_container_rg6mx_1",wn="_emptyState_rg6mx_10",Mn="_urlSection_rg6mx_17",Ln="_urlLeft_rg6mx_25",Rn="_tokenStatsBox_rg6mx_30",In="_tokenGrid_rg6mx_37",En="_tokenRows_rg6mx_47",Bn="_tokenRow_rg6mx_47",An="_tokenRowBorder_rg6mx_55",Dn="_tokenLabel_rg6mx_59",Fn="_tokenTd_rg6mx_66",Hn="_tokenHitRate_rg6mx_75",Pn="_tokenHitRateLabel_rg6mx_88",qn="_urlText_rg6mx_98",zn="_metaText_rg6mx_105",Vn="_headersContainer_rg6mx_109",$n="_headerRow_rg6mx_113",On="_headerKey_rg6mx_119",Un="_headerValue_rg6mx_124",Kn="_streamingBox_rg6mx_129",Wn="_rawTextPre_rg6mx_142",Jn="_tabContent_rg6mx_155",Gn="_bodyLabel_rg6mx_167",Qn="_bodyHeader_rg6mx_171",Xn="_diffSection_rg6mx_178",Yn="_diffToggle_rg6mx_182",Zn="_diffIcon_rg6mx_188",ei="_reminderSelect_rg6mx_214",ti="_diffHeaderRow_rg6mx_233",si="_diffSpaceRight_rg6mx_239",ai="_reminderFilterWrapper_rg6mx_243",ni="_reminderLabel_rg6mx_249",ii="_cacheTabContent_rg6mx_255",li="_userPromptList_rg6mx_260",oi="_userPromptItem_rg6mx_266",ri="_userPromptNavBtn_rg6mx_277",ci="_cacheContent_rg6mx_288",di="_cacheTokenBar_rg6mx_295",hi="_cacheTokenWrite_rg6mx_305",ui="_cacheTokenRead_rg6mx_309",mi="_cacheCopyIcon_rg6mx_313",pi="_cacheScrollArea_rg6mx_320",gi="_cacheSectionBlock_rg6mx_326",xi="_cacheSectionHeader_rg6mx_330",fi="_cacheCollapseArrow_rg6mx_342",ji="_cachePre_rg6mx_348",yi="_cacheHighlightSvg_rg6mx_362",_i="_cachePreSystem_rg6mx_371",x={container:Tn,emptyState:wn,urlSection:Mn,urlLeft:Ln,tokenStatsBox:Rn,tokenGrid:In,tokenRows:En,tokenRow:Bn,tokenRowBorder:An,tokenLabel:Dn,tokenTd:Fn,tokenHitRate:Hn,tokenHitRateLabel:Pn,urlText:qn,metaText:zn,headersContainer:Vn,headerRow:$n,headerKey:On,headerValue:Un,streamingBox:Kn,rawTextPre:Wn,tabContent:Jn,bodyLabel:Gn,bodyHeader:Qn,diffSection:Xn,diffToggle:Yn,diffIcon:Zn,reminderSelect:ei,diffHeaderRow:ti,diffSpaceRight:si,reminderFilterWrapper:ai,reminderLabel:ni,cacheTabContent:ii,userPromptList:li,userPromptItem:oi,userPromptNavBtn:ri,cacheContent:ci,cacheTokenBar:di,cacheTokenWrite:hi,cacheTokenRead:ui,cacheCopyIcon:mi,cacheScrollArea:pi,cacheSectionBlock:gi,cacheSectionHeader:xi,cacheCollapseArrow:fi,cachePre:ji,cacheHighlightSvg:yi,cachePreSystem:_i},{Text:J,Paragraph:vi}=ft;class bi extends me.Component{constructor(a){super(a),this.state={bodyViewMode:{request:"json",response:"json",diff:"json"},diffExpanded:!1,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null,cacheHighlightIdx:null,cacheHighlightFading:!1,cacheCollapsed:{tools:!1,system:!1,messages:!1}}}_cacheUnbindScrollFade(){this._cacheOnScrollFade&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scroll",this._cacheOnScrollFade),this._cacheOnScrollFade=null)}_cacheClearAllTimers(){clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scrollend",this._cacheScrollEndHandler),this._cacheScrollEndHandler=null)}componentWillUnmount(){this._cacheClearAllTimers()}_cacheBindScrollFade(){this._cacheUnbindScrollFade();const a=this._cacheScrollEl;a&&(this._cacheOnScrollFade=()=>{clearTimeout(this._cacheAutoFadeTimer),this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade()},a.addEventListener("scroll",this._cacheOnScrollFade,{passive:!0}))}scrollToCacheMsg(a){if(this.state.cacheCollapsed.messages){this.setState(h=>({cacheCollapsed:{...h.cacheCollapsed,messages:!1}}),()=>this.scrollToCacheMsg(a));return}const t=this._cacheScrollEl;if(!t)return;const n=t.querySelector(`[data-msg-idx="${a}"]`);if(!n)return;clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&t.removeEventListener("scrollend",this._cacheScrollEndHandler),this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1});let o=!1,i=!1;const r=()=>{!o||!i||(this.setState({cacheHighlightIdx:a,cacheHighlightFading:!1}),this._cacheScrollSettleTimer=setTimeout(()=>this._cacheBindScrollFade(),200),this._cacheAutoFadeTimer=setTimeout(()=>{this.state.cacheHighlightIdx===a&&!this.state.cacheHighlightFading&&(this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade())},3e3))};this._cacheScrollEndHandler=()=>{t.removeEventListener("scrollend",this._cacheScrollEndHandler),o=!0,r()},t.addEventListener("scrollend",this._cacheScrollEndHandler,{once:!0}),this._cacheScrollSettleTimer=setTimeout(()=>{t.removeEventListener("scrollend",this._cacheScrollEndHandler),o=!0,r()},800),this._cacheHighlightDelayTimer=setTimeout(()=>{i=!0,r()},500),n.scrollIntoView({behavior:"smooth",block:"center"})}shouldComponentUpdate(a,t){if(a.request!==this.props.request){const o=Z(a.request);this.setState({diffExpanded:o&&!!a.expandDiff,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null}),this._cacheClearAllTimers()}const n=a.currentTab==="kv-cache-text";return a.request!==this.props.request||a.currentTab!==this.props.currentTab||a.onTabChange!==this.props.onTabChange||a.selectedIndex!==this.props.selectedIndex||a.expandDiff!==this.props.expandDiff||a.pendingCacheHighlight!==this.props.pendingCacheHighlight||t.bodyViewMode!==this.state.bodyViewMode||n&&t.cacheHighlightIdx!==this.state.cacheHighlightIdx||n&&t.cacheHighlightFading!==this.state.cacheHighlightFading||t.diffExpanded!==this.state.diffExpanded||t.requestHeadersExpanded!==this.state.requestHeadersExpanded||t.responseHeadersExpanded!==this.state.responseHeadersExpanded||t.reminderFilters!==this.state.reminderFilters||n&&t.cacheCollapsed!==this.state.cacheCollapsed}componentDidUpdate(a){const t=this.props.pendingCacheHighlight;t&&t!==a.pendingCacheHighlight&&setTimeout(()=>{var n,o;this.scrollToCacheMsg(t.msgIdx),(o=(n=this.props).onCacheHighlightDone)==null||o.call(n)},150)}getCurrentRequest(){const{request:a,allRequests:t,requests:n}=this.props;return a?a._slimmed?nt(a,t||n||[]):a:null}toggleBodyViewMode(a){this.setState(t=>({bodyViewMode:{...t.bodyViewMode,[a]:t.bodyViewMode[a]==="json"?"text":"json"}}))}copyBody(a){var r;const t=this.getCurrentRequest();if(!t)return;let n;if(a==="diff"?n=this._lastDiffResult:n=a==="request"?t.body:(r=t.response)==null?void 0:r.body,n==null)return;const o=typeof n=="object"?Be(n):n,i=typeof o=="string"?o:JSON.stringify(o,null,2);navigator.clipboard.writeText(i).then(()=>P.success(l("ui.copySuccess")))}renderHeaders(a){return!a||Object.keys(a).length===0?e.jsx(J,{type:"secondary",children:l("ui.noHeaders")}):e.jsx("div",{className:x.headersContainer,children:Object.entries(a).map(([t,n])=>e.jsxs("div",{className:x.headerRow,children:[e.jsx(J,{code:!0,className:x.headerKey,children:t}),t==="authorization"&&e.jsx(O,{doc:"TranslateContextPollution"}),e.jsx(J,{type:"secondary",className:x.headerValue,children:String(n)})]},t))})}getRequestExpandNode(a,t){if(t!=="request"||!a||typeof a!="object")return;const{request:n,requests:o,selectedIndex:i}=this.props;if(!n)return;const r=o&&i!=null?o[i+1]:null,{type:h}=fe(n,r);let d=null;if(this.state.reminderFilters==="claudeMd"&&Array.isArray(a.messages)){d=new Set,d.add(a.messages);for(const u of a.messages){if(!u||typeof u!="object")continue;const j=u.content;if(typeof j=="string")it(j)&&d.add(u);else if(Array.isArray(j)){let S=!1;for(const f of j)f&&f.type==="text"&&it(f.text)&&(d.add(f),S=!0);S&&(d.add(u),d.add(j))}}}let g=null;if(this.state.reminderFilters==="skills"&&Array.isArray(a.messages)){g=new Set,g.add(a.messages);for(const u of a.messages){if(!u||typeof u!="object")continue;const j=u.content;if(typeof j=="string")lt(j)&&g.add(u);else if(Array.isArray(j)){let S=!1;for(const f of j)f&&f.type==="text"&<(f.text)&&(g.add(f),S=!0);S&&(g.add(u),g.add(j))}}}const m=d||g;if(h==="Preflight"){const u=new Set,j=S=>{S&&typeof S=="object"&&(u.add(S),Array.isArray(S)?S.forEach(j):Object.values(S).forEach(j))};return Array.isArray(a.messages)&&j(a.messages),Array.isArray(a.system)&&a.system.length>=3&&j(a.system[2]),(S,f,p)=>!!(S<2||u.has(f)||m&&m.has(f)||S===1&&p==="system")}if(h==="MainAgent"&&Array.isArray(a.messages)&&a.messages.length===1){const u=a.messages[0],j=u&&Array.isArray(u.content)?u.content:null,S=j&&j.length>0?j[j.length-1]:null,f=new Set,p=v=>{v&&typeof v=="object"&&(f.add(v),Array.isArray(v)?v.forEach(p):Object.values(v).forEach(p))};return S&&p(S),f.add(a.messages),u&&typeof u=="object"&&f.add(u),j&&f.add(j),(v,b,T)=>!!(v<2||f.has(b)||m&&m.has(b))}if(m)return(u,j,S)=>!!(u<2||m.has(j))}renderBody(a,t){const{bodyViewMode:n}=this.state;if(a==null)return e.jsx(J,{type:"secondary",children:l("ui.noBody")});if(typeof a=="string"&&a.includes("Streaming Response"))return e.jsx("div",{className:x.streamingBox,children:e.jsx(J,{type:"secondary",children:l("ui.streamingResponse")})});const o=typeof a=="object"?Be(a):a,i=n[t]==="json",r=this.getRequestExpandNode(o,t);return e.jsx("div",{children:i?e.jsx(Te,{data:o,defaultExpand:t==="response"?"all":"root",expandNode:r}):e.jsx("pre",{className:x.rawTextPre,children:typeof o=="string"?o:JSON.stringify(o,null,2)})})}getPrevMainAgentRequest(){const{requests:a,selectedIndex:t}=this.props;if(!a||t==null)return null;for(let n=t-1;n>=0;n--)if(Z(a[n])){const o=a[n];return o._slimmed?nt(o,this.props.allRequests||a):o}return null}computeDiff(a,t){if(a==null||t==null||typeof a!="object"||typeof t!="object")return null;const n={},o=new Set([...Object.keys(a),...Object.keys(t)]);for(const i of o)if(!i.startsWith("_"))if(!(i in a))n[i]=t[i];else if(i in t){const r=JSON.stringify(a[i]),h=JSON.stringify(t[i]);r!==h&&(i==="messages"&&Array.isArray(a[i])&&Array.isArray(t[i])&&t[i].length>a[i].length?n[i]=t[i].slice(a[i].length):n[i]=t[i])}else continue;return Object.keys(n).length?n:null}render(){var j,S,f;let a=this.getCurrentRequest();const{currentTab:t,onTabChange:n}=this.props;if(!a)return e.jsx("div",{className:x.emptyState,children:e.jsx(oe,{description:"选择一个请求查看详情"})});const o=new Date(a.timestamp).toLocaleString("zh-CN"),i=a.response&&a.response.status<400;let r=null;if(Z(a)){const p=this.getPrevMainAgentRequest();if(p){const v=JSON.stringify(a.body).length,b=JSON.stringify(p.body).length;if(v<b)r=e.jsxs("div",{className:x.diffSection,children:[e.jsxs(J,{strong:!0,className:x.diffToggle,onClick:()=>this.setState(M=>({diffExpanded:!M.diffExpanded})),children:["Body Diff JSON ",e.jsx(O,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?e.jsx(re,{className:x.diffIcon}):e.jsx(ce,{className:x.diffIcon})]}),this.state.diffExpanded&&e.jsx(J,{type:"secondary",children:l("ui.diffSessionChanged")})]});else{const M=Be(this.computeDiff(p.body,a.body));M&&(this._lastDiffResult=M,r=e.jsxs("div",{className:x.diffSection,children:[e.jsxs("div",{className:x.diffHeaderRow,children:[e.jsxs(J,{strong:!0,className:x.diffToggle,onClick:()=>this.setState(C=>({diffExpanded:!C.diffExpanded})),children:["Body Diff JSON ",e.jsx(O,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?e.jsx(re,{className:x.diffIcon}):e.jsx(ce,{className:x.diffIcon})]}),this.state.diffExpanded&&e.jsxs(he,{size:"small",className:x.diffSpaceRight,children:[e.jsx(E,{size:"small",icon:this.state.bodyViewMode.diff==="json"?e.jsx(be,{}):e.jsx(Ce,{}),onClick:()=>this.toggleBodyViewMode("diff"),children:this.state.bodyViewMode.diff==="json"?"Text":"JSON"}),e.jsx(E,{size:"small",icon:e.jsx(xe,{}),onClick:()=>this.copyBody("diff"),children:l("ui.copy")})]})]}),this.state.diffExpanded&&e.jsx(e.Fragment,{children:this.state.bodyViewMode.diff==="json"?e.jsx(Te,{data:M,defaultExpand:"all"}):e.jsx("pre",{className:x.rawTextPre,children:JSON.stringify(M,null,2)})})]}))}}}const h=Qt(a.body),d=Xt(a.body),g=[{key:"request",label:"Request",children:e.jsxs("div",{className:x.tabContent,children:[e.jsxs("div",{className:x.diffSection,children:[e.jsxs(J,{strong:!0,className:x.diffToggle,onClick:()=>this.setState(p=>({requestHeadersExpanded:!p.requestHeadersExpanded})),children:["Headers ",this.state.requestHeadersExpanded?e.jsx(re,{className:x.diffIcon}):e.jsx(ce,{className:x.diffIcon})]}),this.state.requestHeadersExpanded&&this.renderHeaders(a.headers)]}),r,e.jsxs("div",{children:[e.jsxs("div",{className:x.bodyHeader,children:[e.jsxs(J,{strong:!0,className:x.bodyLabel,children:["Body",e.jsx(O,{doc:"BodyFields"})]}),e.jsxs(he,{size:"small",children:[(h||d)&&e.jsxs("span",{className:x.reminderFilterWrapper,children:[e.jsx("span",{className:x.reminderLabel,children:"system-reminder:"}),e.jsx(le,{size:"small",className:x.reminderSelect,placeholder:"filter",value:this.state.reminderFilters||void 0,onChange:p=>this.setState({reminderFilters:p||null}),options:[{label:"CLAUDE.md",value:"claudeMd",disabled:!h},{label:"Skills",value:"skills",disabled:!d}],popupMatchSelectWidth:!1,allowClear:!0})]}),e.jsx(E,{size:"small",icon:this.state.bodyViewMode.request==="json"?e.jsx(be,{}):e.jsx(Ce,{}),onClick:()=>this.toggleBodyViewMode("request"),children:this.state.bodyViewMode.request==="json"?"Text":"JSON"}),e.jsx(E,{size:"small",icon:e.jsx(xe,{}),onClick:()=>this.copyBody("request"),children:l("ui.copy")})]})]}),this.renderBody(a.body,"request")]})]})},{key:"response",label:"Response",children:e.jsx("div",{className:x.tabContent,children:a.response?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:x.diffSection,children:[e.jsxs(J,{strong:!0,className:x.diffToggle,onClick:()=>this.setState(p=>({responseHeadersExpanded:!p.responseHeadersExpanded})),children:["Headers ",this.state.responseHeadersExpanded?e.jsx(re,{className:x.diffIcon}):e.jsx(ce,{className:x.diffIcon})]}),this.state.responseHeadersExpanded&&this.renderHeaders(a.response.headers)]}),e.jsxs("div",{children:[e.jsxs("div",{className:x.bodyHeader,children:[e.jsxs(J,{strong:!0,className:x.bodyLabel,children:["Body",e.jsx(O,{doc:"ResponseFields"})]}),e.jsxs(he,{size:"small",children:[e.jsx(E,{size:"small",icon:this.state.bodyViewMode.response==="json"?e.jsx(be,{}):e.jsx(Ce,{}),onClick:()=>this.toggleBodyViewMode("response"),children:this.state.bodyViewMode.response==="json"?"Text":"JSON"}),e.jsx(E,{size:"small",icon:e.jsx(xe,{}),onClick:()=>this.copyBody("response"),children:l("ui.copy")})]})]}),this.renderBody(a.response.body,"response")]})]}):e.jsx(oe,{description:l("ui.responseNotCaptured")})})},{key:"kv-cache-text",label:e.jsxs("span",{children:["KV-Cache-Text ",e.jsx(O,{doc:"KVCacheContent"})]}),children:e.jsx("div",{className:`${x.tabContent} ${x.cacheTabContent}`,children:(()=>{const p=jt([a]),v=a.timestamp+"|"+a.url;if(p&&(p.cacheCreateTokens>0||p.cacheReadTokens>0)&&(this._lastCachedTokensKey=v,this._lastCachedTokens={cacheCreateTokens:p.cacheCreateTokens,cacheReadTokens:p.cacheReadTokens}),!p||p.system.length===0&&p.messages.length===0&&p.tools.length===0)return e.jsx(oe,{description:l("ui.noCachedContent"),image:oe.PRESENTED_IMAGE_SIMPLE});const b=()=>{const C=[];return p.tools.length>0&&(C.push(`=== ${l("ui.tools")} ===`),p.tools.forEach(w=>C.push(w))),p.system.length>0&&(C.push(`
|
|
24
24
|
=== ${l("ui.systemPrompt")} ===`),p.system.forEach(w=>C.push(w))),p.messages.length>0&&(C.push(`
|
|
25
25
|
=== ${l("ui.messages")} ===`),p.messages.forEach(w=>C.push(w))),C.join(`
|
|
26
26
|
|
|
27
|
-
`)},T=p.messages.map((C,w)=>({text:C,msgIdx:w})).filter(({text:C})=>C.startsWith("[user]")).map(({text:C,msgIdx:w})=>{const I=C.replace(/^\[user\]\s*/,"").trim();return!I||Pe(I)?{cleaned:"",msgIdx:w}:{cleaned:Se.parseSegments(I).filter(L=>L.type==="text").map(L=>L.content.trim()).filter(L=>L&&!Pe(L)).join(" ").trim(),msgIdx:w}}).filter(({cleaned:C})=>!(!C||/Implement the following plan:/i.test(C))),M=T.length>0?e.jsx("div",{className:x.userPromptList,children:T.map(({cleaned:C,msgIdx:w})=>e.jsx("div",{className:x.userPromptItem,onMouseEnter:I=>{I.currentTarget.style.background="var(--color-primary-bg-lighter)",I.currentTarget.style.color="var(--text-white)"},onMouseLeave:I=>{I.currentTarget.style.background="",I.currentTarget.style.color="var(--text-secondary)"},onClick:()=>this.scrollToCacheMsg(w),children:C},w))}):null;return e.jsxs("div",{className:x.cacheContent,children:[(()=>{const w=p.cacheCreateTokens>0||p.cacheReadTokens>0?p:this._lastCachedTokensKey===
|
|
27
|
+
`)},T=p.messages.map((C,w)=>({text:C,msgIdx:w})).filter(({text:C})=>C.startsWith("[user]")).map(({text:C,msgIdx:w})=>{const I=C.replace(/^\[user\]\s*/,"").trim();return!I||Pe(I)?{cleaned:"",msgIdx:w}:{cleaned:Se.parseSegments(I).filter(L=>L.type==="text").map(L=>L.content.trim()).filter(L=>L&&!Pe(L)).join(" ").trim(),msgIdx:w}}).filter(({cleaned:C})=>!(!C||/Implement the following plan:/i.test(C))),M=T.length>0?e.jsx("div",{className:x.userPromptList,children:T.map(({cleaned:C,msgIdx:w})=>e.jsx("div",{className:x.userPromptItem,onMouseEnter:I=>{I.currentTarget.style.background="var(--color-primary-bg-lighter)",I.currentTarget.style.color="var(--text-white)"},onMouseLeave:I=>{I.currentTarget.style.background="",I.currentTarget.style.color="var(--text-secondary)"},onClick:()=>this.scrollToCacheMsg(w),children:C},w))}):null;return e.jsxs("div",{className:x.cacheContent,children:[(()=>{const w=p.cacheCreateTokens>0||p.cacheReadTokens>0?p:this._lastCachedTokensKey===v?this._lastCachedTokens:null;return w||M?e.jsxs("div",{className:x.cacheTokenBar,children:[w&&e.jsxs(e.Fragment,{children:[l("ui.tokens"),": ",e.jsxs("span",{className:x.cacheTokenWrite,children:["write ",q(w.cacheCreateTokens)]})," / ",e.jsxs("span",{className:x.cacheTokenRead,children:["read ",q(w.cacheReadTokens)]}),e.jsx(xt,{title:l("ui.copyAllCacheText"),children:e.jsx(xe,{className:x.cacheCopyIcon,onClick:()=>{navigator.clipboard.writeText(b()).then(()=>{P.success(l("ui.copied"))}).catch(()=>{})}})})]}),M&&e.jsx(ge,{content:M,trigger:"hover",placement:"left",children:e.jsx("span",{className:x.userPromptNavBtn,children:l("ui.userPromptNav")})})]}):null})(),e.jsxs("div",{className:x.cacheScrollArea,ref:C=>{this._cacheScrollEl=C},children:[p.tools.length>0&&e.jsxs("div",{className:x.cacheSectionBlock,children:[e.jsxs("div",{className:x.cacheSectionHeader,onClick:()=>this.setState(C=>({cacheCollapsed:{...C.cacheCollapsed,tools:!C.cacheCollapsed.tools}})),children:[e.jsx("span",{className:x.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.tools?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),l("ui.tools")," (",p.tools.length,")"]}),!this.state.cacheCollapsed.tools&&p.tools.map((C,w)=>e.jsx("pre",{className:x.cachePre,children:C},w))]}),p.system.length>0&&e.jsxs("div",{className:x.cacheSectionBlock,children:[e.jsxs("div",{className:x.cacheSectionHeader,onClick:()=>this.setState(C=>({cacheCollapsed:{...C.cacheCollapsed,system:!C.cacheCollapsed.system}})),children:[e.jsx("span",{className:x.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.system?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),l("ui.systemPrompt")," (",p.system.length,")"]}),!this.state.cacheCollapsed.system&&p.system.map((C,w)=>e.jsx("pre",{className:x.cachePreSystem,children:C},w))]}),p.messages.length>0&&e.jsxs("div",{className:x.cacheSectionBlock,children:[e.jsxs("div",{className:x.cacheSectionHeader,onClick:()=>this.setState(C=>({cacheCollapsed:{...C.cacheCollapsed,messages:!C.cacheCollapsed.messages}})),children:[e.jsx("span",{className:x.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.messages?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),l("ui.messages")," (",p.messages.length,")"]}),!this.state.cacheCollapsed.messages&&p.messages.map((C,w)=>{const I=w===this.state.cacheHighlightIdx,F=I?this.state.cacheHighlightFading?{boxShadow:"0 0 10px rgba(22,104,220,0)",transition:"box-shadow 3s ease-out",position:"relative"}:{boxShadow:"0 0 10px rgba(22,104,220,0.6)",transition:"box-shadow 0.2s ease-in",position:"relative"}:{};return e.jsxs("pre",{"data-msg-idx":w,className:x.cachePre,style:F,children:[I&&e.jsx("svg",{className:x.cacheHighlightSvg,style:{opacity:this.state.cacheHighlightFading?0:1,transition:this.state.cacheHighlightFading?"opacity 3s ease-out":void 0},preserveAspectRatio:"none",children:e.jsx("rect",{x:"0.5",y:"0.5",width:"calc(100% - 1px)",height:"calc(100% - 1px)",rx:"4",ry:"4",fill:"none",stroke:"#1668dc",strokeWidth:"1",strokeDasharray:"6 4",children:e.jsx("animate",{attributeName:"stroke-dashoffset",from:"0",to:"-100",dur:"4s",repeatCount:"indefinite"})})}),C]},w)})]})]})]})})()})},{key:"context",label:"Context",children:e.jsx("div",{className:`${x.tabContent} ${x.cacheTabContent}`,children:e.jsx(kn,{body:a.body,response:(j=a.response)==null?void 0:j.body})})}],m=(f=(S=a.response)==null?void 0:S.body)==null?void 0:f.usage,u=m?(()=>{const p=m.input_tokens||0,v=m.output_tokens||0,b=m.cache_creation_input_tokens||0,T=m.cache_read_input_tokens||0,M=p+b+T,C=M>0?(T/M*100).toFixed(1):"0.0";return{input:p,output:v,cacheCreate:b,cacheRead:T,hitRate:C}})():null;return e.jsxs("div",{className:x.container,children:[e.jsxs("div",{className:x.urlSection,children:[e.jsxs("div",{className:x.urlLeft,children:[e.jsx(vi,{className:x.urlText,ellipsis:{rows:2,expandable:!0},children:a.url}),e.jsxs(he,{size:"small",wrap:!0,children:[e.jsx(Y,{color:a.method==="POST"?"blue":"green",children:a.method}),e.jsxs(J,{type:"secondary",className:x.metaText,children:["🕐 ",o]}),a.duration&&e.jsxs(J,{type:"secondary",className:x.metaText,children:["⏱️ ",a.duration,"ms"]}),a.response&&e.jsxs(Y,{color:i?"success":"error",children:["HTTP ",a.response.status]})]})]}),u&&e.jsx("div",{className:x.tokenStatsBox,children:e.jsxs("div",{className:x.tokenGrid,children:[e.jsxs("div",{className:x.tokenRows,children:[e.jsxs("div",{className:x.tokenRow,children:[e.jsx("span",{className:x.tokenLabel,children:"Token"}),e.jsxs("span",{className:x.tokenTd,children:["input: ",q(u.input)]}),e.jsxs("span",{className:x.tokenTd,children:["output: ",q(u.output)]})]}),e.jsxs("div",{className:`${x.tokenRow} ${x.tokenRowBorder}`,children:[e.jsx("span",{className:x.tokenLabel,children:"Cache"}),e.jsxs("span",{className:x.tokenTd,children:["create: ",q(u.cacheCreate)]}),e.jsxs("span",{className:x.tokenTd,children:["read: ",q(u.cacheRead)]})]})]}),e.jsxs("div",{className:x.tokenHitRate,children:[e.jsxs("div",{children:[u.hitRate,"%"]}),e.jsx("div",{className:x.tokenHitRateLabel,children:l("ui.hitRate")})]})]})})]}),e.jsx(gt,{activeKey:t,onChange:n,items:g,size:"small"})]})}}const Ci="_resizer_pzn4b_1",Ni={resizer:Ci};class Si extends me.Component{constructor(a){super(a),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this)}handleMouseDown(a){a.preventDefault(),document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}handleMouseMove(a){this.props.onResize&&this.props.onResize(a.clientX)}handleMouseUp(){document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}componentWillUnmount(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}render(){return e.jsx("div",{onMouseDown:this.handleMouseDown,className:Ni.resizer})}}class Fi extends Yt{constructor(t){super(t);R(this,"handleViewRequest",t=>{this.setState({viewMode:"raw",selectedIndex:t,scrollCenter:!0})});R(this,"handleViewInChat",()=>{this.setState(t=>{const o=(t.showAll?t.requests:ve(t.requests))[t.selectedIndex];if(!o)return null;let i=null;if(Z(o)&&o.timestamp)i=o.timestamp;else{const r=fe(o);if((r.type==="SubAgent"||r.type==="Teammate")&&o.timestamp)i=o.timestamp;else{const h=t.requests.indexOf(o);h>=0&&(i=ot(t.requests,h))}i||P.info(l("ui.cannotMap"))}return{viewMode:"chat",chatScrollToTs:i}})});R(this,"handleToggleViewMode",()=>{this.setState(t=>{const n=t.viewMode==="raw"?"chat":"raw";if(n==="raw"){if(t.selectedIndex===null){const r=t.showAll?t.requests:ve(t.requests);return{viewMode:n,selectedIndex:r.length>0?r.length-1:null,scrollCenter:!0}}return{viewMode:n,scrollCenter:!0}}const o=t.showAll?t.requests:ve(t.requests),i=t.selectedIndex!=null?o[t.selectedIndex]:null;if(i){let r=null;if(Z(i)&&i.timestamp)r=i.timestamp;else{const h=fe(i);if((h.type==="SubAgent"||h.type==="Teammate")&&i.timestamp)r=i.timestamp;else{const d=t.requests.indexOf(i);d>=0&&(r=ot(t.requests,d)),r||P.info(l("ui.cannotMap"))}}return{viewMode:n,chatScrollToTs:r}}return{viewMode:n,chatScrollToTs:null}},()=>{this.state.viewMode==="chat"&&this.state.terminalVisible&&this.state.cliMode&&!ss&&requestAnimationFrame(()=>{const t=document.querySelector(".xterm-helper-textarea");t&&t.focus()})})});R(this,"handleTabChange",t=>{this.setState({currentTab:t})});R(this,"handleCacheHighlightDone",()=>{this.setState({pendingCacheHighlight:null})});R(this,"handleNavigateCacheMsg",t=>{const n=this.state.showAll?this.state.requests:ve(this.state.requests);let o=-1;for(let i=n.length-1;i>=0;i--)if(Z(n[i])){o=i;break}o<0||this.setState({selectedIndex:o,scrollCenter:!0,currentTab:"kv-cache-text",pendingCacheHighlight:{msgIdx:t,key:Date.now()}})});R(this,"handleResize",t=>{const n=this.mainContainerRef.current;if(!n)return;const o=n.getBoundingClientRect(),i=t-o.left;i>=250&&i<=800&&this.setState({leftPanelWidth:i})});R(this,"handleLoadLocalJsonlFile",()=>{const t=document.createElement("input");t.type="file",t.accept=".jsonl",t.multiple=!0,t.onchange=n=>{const o=Array.from(n.target.files);if(o.length===0)return;if(o.reduce((g,m)=>g+m.size,0)>500*1024*1024){P.error(l("ui.fileTooLarge"));return}this.setState({fileLoading:!0,fileLoadingCount:0});let r=0;const h=[],d=[];o.forEach(g=>{const m=new FileReader;m.onload=u=>{try{const S=u.target.result.split(`
|
|
28
28
|
---
|
|
29
|
-
`).filter(
|
|
29
|
+
`).filter(f=>f.trim()).map(f=>{try{return JSON.parse(f)}catch{return null}}).filter(Boolean);h.push(...S),d.push(g.name)}catch{}r++,r===o.length&&this._finishLocalLoad(h,d)},m.readAsText(g)})},t.click()});R(this,"_processJsonlFiles",t=>{if(!t||t.length===0)return;if(t.reduce((h,d)=>h+d.size,0)>500*1024*1024){P.error(l("ui.fileTooLarge"));return}this.setState({fileLoading:!0,fileLoadingCount:0});let o=0;const i=[],r=[];t.forEach(h=>{const d=new FileReader;d.onload=g=>{try{const u=g.target.result.split(`
|
|
30
30
|
---
|
|
31
|
-
`).filter(y=>y.trim()).map(y=>{try{return JSON.parse(y)}catch{return null}}).filter(Boolean);i.push(...u),r.push(h.name)}catch{}o++,o===t.length&&this._finishLocalLoad(i,r)},d.readAsText(h)})});R(this,"_isInternalDrag",t=>t.dataTransfer.types.includes("text/x-preset-reorder"));R(this,"_onDragOver",t=>{if(t.preventDefault(),this._isInternalDrag(t))return;if(t.target.closest&&t.target.closest("[data-file-explorer]")){this.state.isDragging&&this.setState({isDragging:!1});return}this.state.isDragging||this.setState({isDragging:!0})});R(this,"_onDragLeave",t=>{const n=this._layoutRef.current;n&&!n.contains(t.relatedTarget)&&this.setState({isDragging:!1})});R(this,"_onDrop",t=>{if(t.preventDefault(),this._isInternalDrag(t))return;this.setState({isDragging:!1});const n=Array.from(t.dataTransfer.files);n.length&&Promise.all(n.map(o=>Zt(o).then(i=>({name:o.name,path:i})).catch(i=>(H.error(`${o.name}: ${i.message}`),null)))).then(o=>{const i=o.filter(Boolean).map(r=>`"${r.path}"`);i.length>0&&this.setState(r=>({pendingUploadPaths:[...r.pendingUploadPaths||[],...i]}))})});R(this,"handleUploadPathsConsumed",()=>{this.setState({pendingUploadPaths:[]})});Object.assign(this.state,{leftPanelWidth:380,terminalVisible:!0,currentTab:"context",pendingCacheHighlight:null})}componentDidMount(){super.componentDidMount(),this._mqlNarrow=window.matchMedia("(max-width: 600px)"),this._modeSwitchDialog=null,this._onNarrowChange=t=>{t.matches?this._modeSwitchDialog=X.confirm({title:l("ui.modeSwitchTitle"),content:l("ui.modeSwitchToSidebar"),okText:l("ui.ok"),onOk:()=>{this._modeSwitchDialog=null,ts("pad")},onCancel:()=>{this._modeSwitchDialog=null}}):this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null)},this._mqlNarrow.addEventListener("change",this._onNarrowChange)}componentWillUnmount(){this._mqlNarrow&&this._mqlNarrow.removeEventListener("change",this._onNarrowChange),this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null),super.componentWillUnmount()}render(){const{filteredRequests:t,selectedRequest:n,fileLoading:o,fileLoadingCount:i,mainAgentSessions:r,viewMode:h}=this.renderPrepare(),{selectedIndex:d,leftPanelWidth:g,currentTab:m}=this.state;return this.state.workspaceMode?this.renderWorkspaceMode():e.jsxs(Ft,{theme:this.themeConfig,children:[o&&e.jsx("div",{className:k.loadingOverlay,children:e.jsxs("div",{className:k.loadingText,children:["Loading...(",i,")"]})}),this.state.isDragging&&e.jsx("div",{className:k.dragOverlay,children:e.jsxs("div",{className:k.dragOverlayContent,children:[e.jsx(rt,{className:k.dragIcon}),e.jsx("p",{children:l("ui.dragDropHint")})]})}),e.jsxs(Ee,{className:k.layout,ref:this._layoutRef,onDragOver:this._onDragOver,onDragLeave:this._onDragLeave,onDrop:this._onDrop,children:[e.jsx(Ee.Header,{className:k.header,children:e.jsx(Se,{requestCount:t.length,requests:t,viewMode:h,cacheExpireAt:this.state.cacheExpireAt,cacheType:this.state.cacheType,onToggleViewMode:this.handleToggleViewMode,onLangChange:this.handleLangChange,onImportLocalLogs:this.handleImportLocalLogs,isLocalLog:!!this._isLocalLog,localLogFile:this._localLogFile,projectName:this.state.projectName,collapseToolResults:this.state.collapseToolResults,onCollapseToolResultsChange:this.handleCollapseToolResultsChange,expandThinking:this.state.expandThinking,onExpandThinkingChange:this.handleExpandThinkingChange,showFullToolContent:this.state.showFullToolContent,onShowFullToolContentChange:this.handleShowFullToolContentChange,expandDiff:this.state.expandDiff,onExpandDiffChange:this.handleExpandDiffChange,filterIrrelevant:!this.state.showAll,onFilterIrrelevantChange:this.handleFilterIrrelevantChange,logDir:this.state.logDir,onLogDirChange:this.handleLogDirChange,updateInfo:this.state.updateInfo,onDismissUpdate:()=>this.setState({updateInfo:null}),cliMode:this.state.cliMode,sdkMode:this.state.sdkMode,terminalVisible:this.state.sdkMode?!1:this.state.terminalVisible,onToggleTerminal:()=>this.setState(u=>({terminalVisible:!u.terminalVisible})),onReturnToWorkspaces:this.state.cliMode?this.handleReturnToWorkspaces:null,contextWindow:this.state.contextWindow,onNavigateCacheMsg:this.handleNavigateCacheMsg,serverCachedContent:this.state.serverCachedContent||this._lastKvCacheContent,resumeAutoChoice:this.state.resumeAutoChoice,onResumeAutoChoiceToggle:this.handleResumeAutoChoiceToggle,onResumeAutoChoiceChange:this.handleResumeAutoChoiceChange,themeColor:this.state.themeColor,onThemeColorChange:this.handleThemeColorChange,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange,proxyProfiles:this.state.proxyProfiles,activeProxyId:this.state.activeProxyId,defaultConfig:this.state.defaultConfig,onProxyProfileChange:this.handleProxyProfileChange})}),this.state.claudeMissing&&e.jsx(Ht,{type:"warning",showIcon:!0,banner:!0,message:l("ui.claudeMissing.title"),description:e.jsxs("span",{children:[l("ui.claudeMissing.desc"),e.jsx("br",{}),e.jsx("code",{style:{background:"var(--bg-code)",padding:"2px 6px",borderRadius:3},children:"npm install -g @anthropic-ai/claude-code"})," ",e.jsx("span",{style:{color:"var(--text-muted)",margin:"0 4px"},children:l("ui.claudeMissing.or")})," ",e.jsx("a",{href:"https://claude.ai/download",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--color-primary-light)"},children:l("ui.claudeMissing.native")})]})}),e.jsxs(Ee.Content,{className:k.content,children:[h==="raw"&&(t.length===0?e.jsx("div",{className:k.guideContainer,children:e.jsxs("div",{className:k.guideContent,children:[e.jsx("h2",{className:k.guideTitle,children:l("ui.guide.title")}),e.jsxs("div",{className:k.guideStep,children:[e.jsx("div",{className:k.guideStepNum,children:"1"}),e.jsxs("div",{className:k.guideStepBody,children:[e.jsx("p",{className:k.guideText,children:l("ui.guide.step1")}),e.jsx("code",{className:k.guideCode,children:l("ui.guide.exampleQuestion")})]})]}),e.jsxs("div",{className:k.guideStep,children:[e.jsx("div",{className:k.guideStepNum,children:"2"}),e.jsxs("div",{className:k.guideStepBody,children:[e.jsx("p",{className:k.guideText,children:l("ui.guide.step2")}),e.jsx("code",{className:k.guideCode,children:l("ui.guide.troubleshootCmd")})]})]}),e.jsxs("div",{className:k.guideStep,children:[e.jsx("div",{className:k.guideStepNum,children:"3"}),e.jsxs("div",{className:k.guideStepBody,children:[e.jsx("p",{className:k.guideText,children:l("ui.guide.step3")}),e.jsx("code",{className:k.guideCode,children:"npm install -g @anthropic-ai/claude-code"})]})]})]})}):e.jsxs("div",{ref:this.mainContainerRef,className:k.mainContainer,children:[e.jsxs("div",{className:k.leftPanel,style:{width:g},children:[e.jsxs("div",{className:k.leftPanelHeader,children:[e.jsx("span",{children:l("ui.requestList")}),e.jsx("span",{className:k.leftPanelCount,children:l("ui.totalRequests",{count:t.length})})]}),e.jsx("div",{className:k.leftPanelBody,children:e.jsx(Ys,{requests:t,selectedIndex:d,scrollCenter:this.state.scrollCenter,onSelect:this.handleSelectRequest,onScrollDone:this.handleScrollDone,cacheLossMap:this._cacheLossMap})})]}),e.jsx(Si,{onResize:this.handleResize}),e.jsx("div",{className:k.rightPanel,children:e.jsx(bi,{request:n,requests:t,allRequests:this.state.requests,selectedIndex:d,currentTab:m,onTabChange:this.handleTabChange,onViewInChat:this.handleViewInChat,expandDiff:this.state.expandDiff,pendingCacheHighlight:this.state.pendingCacheHighlight,onCacheHighlightDone:this.handleCacheHighlightDone})})]})),e.jsx("div",{className:k.chatViewWrapper,style:{display:h==="chat"?"flex":"none"},children:e.jsx(es,{requests:t,mainAgentSessions:r,streamingLatest:this.state.streamingLatest,userProfile:this.state.userProfile,collapseToolResults:this.state.collapseToolResults,expandThinking:this.state.expandThinking,showFullToolContent:this.state.showFullToolContent,showThinkingSummaries:this.state.showThinkingSummaries,onViewRequest:this.handleViewRequest,scrollToTimestamp:this.state.chatScrollToTs,onScrollTsDone:this.handleScrollTsDone,cliMode:this._isLocalLog?!1:this.state.cliMode,sdkMode:this._isLocalLog?!1:this.state.sdkMode,terminalVisible:this._isLocalLog||this.state.sdkMode?!1:this.state.terminalVisible,onToggleTerminal:()=>this.setState(u=>({terminalVisible:!u.terminalVisible})),pendingUploadPaths:this.state.pendingUploadPaths,onUploadPathsConsumed:this.handleUploadPathsConsumed,fileLoading:this.state.fileLoading,isStreaming:this.state.isStreaming,hasMoreHistory:this.state.hasMoreHistory,loadingMore:this.state.loadingMore,onLoadMoreHistory:()=>this.loadMoreHistory(),loadingSessionId:this.state.loadingSessionId,onLoadSession:u=>this.loadSession(u),lang:this.state.lang,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange})})]}),e.jsx("div",{className:k.footer,children:e.jsxs("div",{className:k.footerRight,children:[e.jsxs("a",{href:"https://github.com/weiesky/cc-viewer",target:"_blank",rel:"noopener noreferrer",className:k.footerLink,children:[e.jsx("svg",{className:k.footerIcon,viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})}),"GitHub",this.state.githubStars!=null?` ★ ${this.state.githubStars}`:""]}),e.jsx("span",{className:k.footerSep,children:"|"}),e.jsxs("span",{className:`${k.footerVersion}${this.state.updateInfo?` ${k.footerVersionNew}`:""}`,onClick:()=>this.setState({updateModalVisible:!0}),style:{cursor:"pointer"},children:["v","1.6.183",this.state.updateInfo&&e.jsxs("svg",{className:k.newBadge,width:"28",height:"12",viewBox:"0 0 28 12",children:[e.jsx("rect",{width:"28",height:"12",rx:"3",fill:"currentColor",opacity:"0.25"}),e.jsx("text",{x:"14",y:"9",textAnchor:"middle",fill:"currentColor",fontSize:"8",fontWeight:"600",fontFamily:"system-ui",children:"NEW"})]})]})]})})]}),e.jsx(X,{title:l("ui.update.title"),open:this.state.updateModalVisible,onCancel:()=>this.setState({updateModalVisible:!1}),footer:null,width:480,children:e.jsxs("div",{style:{lineHeight:1.8},children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[l("ui.update.current"),":"]})," v","1.6.183"]}),this.state.updateInfo&&e.jsxs("p",{children:[e.jsxs("strong",{children:[l("ui.update.latest"),":"]})," v",this.state.updateInfo.version]}),e.jsx("p",{style:{marginTop:12},children:e.jsx("strong",{children:l("ui.update.npm")})}),e.jsx("code",{style:{display:"block",background:"var(--bg-code)",padding:"8px 12px",borderRadius:6,fontSize:13},children:"npm update -g cc-viewer"}),typeof window<"u"&&window.electronAPI&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{marginTop:16},children:e.jsx("strong",{children:l("ui.update.electron")})}),e.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:13},children:l("ui.update.electronDesc")}),e.jsxs("ol",{style:{color:"var(--text-tertiary)",fontSize:13,paddingLeft:20,margin:"6px 0"},children:[e.jsx("li",{children:l("ui.update.step1")}),e.jsx("li",{children:l("ui.update.step2")}),e.jsx("li",{children:l("ui.update.step3")})]})]}),e.jsx("div",{style:{marginTop:16,textAlign:"right"},children:e.jsx(E,{type:"primary",href:"https://github.com/weiesky/cc-viewer/releases",target:"_blank",rel:"noopener noreferrer",children:l("ui.update.goReleases")})})]})}),e.jsx(X,{title:l("ui.resume.title"),open:this.state.resumeModalVisible,closable:!1,maskClosable:!1,keyboard:!1,footer:e.jsxs("div",{children:[e.jsxs("div",{className:k.resumeFooterRight,children:[e.jsx(E,{type:"primary",onClick:()=>this.handleResumeChoice("continue"),className:k.btnMarginRight,children:l("ui.resume.continue")},"continue"),e.jsx(E,{onClick:()=>this.handleResumeChoice("new"),children:l("ui.resume.new")},"new")]}),e.jsx("div",{className:k.resumeFooterLeft,children:e.jsx(Pt,{checked:this.state.resumeRememberChoice,onChange:u=>this.setState({resumeRememberChoice:u.target.checked}),className:k.resumeCheckboxOpacity,children:e.jsx("span",{className:k.resumeCheckboxOpacity,children:l("ui.resume.remember")})})})]}),children:e.jsx("p",{children:l("ui.resume.message",{file:this.state.resumeFileName})})}),e.jsxs(X,{title:e.jsxs("span",{className:k.modalTitleInline,children:[e.jsx(yt,{apiEndpoint:W("/api/open-log-dir"),title:l("ui.openLogDir"),size:16}),l("ui.importLocalLogs")]}),open:this.state.importModalVisible,onCancel:this.handleCloseImportModal,footer:null,width:1e3,styles:{body:{overflow:"hidden"}},children:[e.jsxs("div",{className:k.modalActions,children:[e.jsx(E,{icon:e.jsx(rt,{}),onClick:this.handleLoadLocalJsonlFile,children:l("ui.loadLocalJsonl")}),e.jsx(E,{size:"small",type:this.state.selectedLogs.size>1?"primary":"default",disabled:this.state.selectedLogs.size<2,onClick:this.handleMergeLogs,className:k.btnMarginLeft,children:l("ui.mergeLogs")}),e.jsx(E,{size:"small",danger:!0,icon:e.jsx(Fe,{}),disabled:this.state.selectedLogs.size===0,onClick:this.handleDeleteLogs,className:k.btnMarginLeft,children:l("ui.deleteLogs")}),e.jsx(E,{size:"small",icon:e.jsx(He,{spin:this.state.refreshingStats}),loading:this.state.refreshingStats,onClick:this.handleRefreshStats,className:k.btnMarginLeft,children:l("ui.refreshStats")})]}),this.state.localLogsLoading?e.jsx("div",{className:k.spinCenter,children:e.jsx(pt,{})}):(()=>{const u=this.state.localLogs[this.state.currentProject];return!u||u.length===0?e.jsx("div",{className:k.emptyCenter,children:l("ui.noLogs")}):e.jsx("div",{className:k.logListContainer,children:this.renderLogTable(u,!1)})})()]})]})}}export{Fi as default};
|
|
31
|
+
`).filter(j=>j.trim()).map(j=>{try{return JSON.parse(j)}catch{return null}}).filter(Boolean);i.push(...u),r.push(h.name)}catch{}o++,o===t.length&&this._finishLocalLoad(i,r)},d.readAsText(h)})});R(this,"_isInternalDrag",t=>t.dataTransfer.types.includes("text/x-preset-reorder"));R(this,"_onDragOver",t=>{if(t.preventDefault(),this._isInternalDrag(t))return;if(t.target.closest&&t.target.closest("[data-file-explorer]")){this.state.isDragging&&this.setState({isDragging:!1});return}this.state.isDragging||this.setState({isDragging:!0})});R(this,"_onDragLeave",t=>{const n=this._layoutRef.current;n&&!n.contains(t.relatedTarget)&&this.setState({isDragging:!1})});R(this,"_onDrop",t=>{if(t.preventDefault(),this._isInternalDrag(t))return;this.setState({isDragging:!1});const n=Array.from(t.dataTransfer.files);n.length&&Promise.all(n.map(o=>Zt(o).then(i=>({name:o.name,path:i})).catch(i=>(P.error(`${o.name}: ${i.message}`),null)))).then(o=>{const i=o.filter(Boolean).map(r=>`"${r.path}"`);i.length>0&&this.setState(r=>({pendingUploadPaths:[...r.pendingUploadPaths||[],...i]}))})});R(this,"handleUploadPathsConsumed",()=>{this.setState({pendingUploadPaths:[]})});Object.assign(this.state,{leftPanelWidth:380,terminalVisible:!0,currentTab:"context",pendingCacheHighlight:null})}componentDidMount(){super.componentDidMount(),this._mqlNarrow=window.matchMedia("(max-width: 600px)"),this._modeSwitchDialog=null,this._onNarrowChange=t=>{t.matches?this._modeSwitchDialog=X.confirm({title:l("ui.modeSwitchTitle"),content:l("ui.modeSwitchToSidebar"),okText:l("ui.ok"),onOk:()=>{this._modeSwitchDialog=null,ts("pad")},onCancel:()=>{this._modeSwitchDialog=null}}):this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null)},this._mqlNarrow.addEventListener("change",this._onNarrowChange)}componentWillUnmount(){this._mqlNarrow&&this._mqlNarrow.removeEventListener("change",this._onNarrowChange),this._modeSwitchDialog&&(this._modeSwitchDialog.destroy(),this._modeSwitchDialog=null),super.componentWillUnmount()}render(){const{filteredRequests:t,selectedRequest:n,fileLoading:o,fileLoadingCount:i,mainAgentSessions:r,viewMode:h}=this.renderPrepare(),{selectedIndex:d,leftPanelWidth:g,currentTab:m}=this.state;return this.state.workspaceMode?this.renderWorkspaceMode():e.jsxs(Ft,{theme:this.themeConfig,children:[o&&e.jsx("div",{className:k.loadingOverlay,children:e.jsxs("div",{className:k.loadingText,children:["Loading...(",i,")"]})}),this.state.isDragging&&e.jsx("div",{className:k.dragOverlay,children:e.jsxs("div",{className:k.dragOverlayContent,children:[e.jsx(rt,{className:k.dragIcon}),e.jsx("p",{children:l("ui.dragDropHint")})]})}),e.jsxs(Ee,{className:k.layout,ref:this._layoutRef,onDragOver:this._onDragOver,onDragLeave:this._onDragLeave,onDrop:this._onDrop,children:[e.jsx(Ee.Header,{className:k.header,children:e.jsx(Se,{requestCount:t.length,requests:t,viewMode:h,cacheExpireAt:this.state.cacheExpireAt,cacheType:this.state.cacheType,onToggleViewMode:this.handleToggleViewMode,onLangChange:this.handleLangChange,onImportLocalLogs:this.handleImportLocalLogs,isLocalLog:!!this._isLocalLog,localLogFile:this._localLogFile,projectName:this.state.projectName,collapseToolResults:this.state.collapseToolResults,onCollapseToolResultsChange:this.handleCollapseToolResultsChange,expandThinking:this.state.expandThinking,onExpandThinkingChange:this.handleExpandThinkingChange,showFullToolContent:this.state.showFullToolContent,onShowFullToolContentChange:this.handleShowFullToolContentChange,expandDiff:this.state.expandDiff,onExpandDiffChange:this.handleExpandDiffChange,filterIrrelevant:!this.state.showAll,onFilterIrrelevantChange:this.handleFilterIrrelevantChange,logDir:this.state.logDir,onLogDirChange:this.handleLogDirChange,updateInfo:this.state.updateInfo,onDismissUpdate:()=>this.setState({updateInfo:null}),cliMode:this.state.cliMode,sdkMode:this.state.sdkMode,terminalVisible:this.state.sdkMode?!1:this.state.terminalVisible,onToggleTerminal:()=>this.setState(u=>({terminalVisible:!u.terminalVisible})),onReturnToWorkspaces:this.state.cliMode?this.handleReturnToWorkspaces:null,contextWindow:this.state.contextWindow,onNavigateCacheMsg:this.handleNavigateCacheMsg,serverCachedContent:this.state.serverCachedContent||this._lastKvCacheContent,resumeAutoChoice:this.state.resumeAutoChoice,onResumeAutoChoiceToggle:this.handleResumeAutoChoiceToggle,onResumeAutoChoiceChange:this.handleResumeAutoChoiceChange,themeColor:this.state.themeColor,onThemeColorChange:this.handleThemeColorChange,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange,proxyProfiles:this.state.proxyProfiles,activeProxyId:this.state.activeProxyId,defaultConfig:this.state.defaultConfig,onProxyProfileChange:this.handleProxyProfileChange})}),this.state.claudeMissing&&e.jsx(Ht,{type:"warning",showIcon:!0,banner:!0,message:l("ui.claudeMissing.title"),description:e.jsxs("span",{children:[l("ui.claudeMissing.desc"),e.jsx("br",{}),e.jsx("code",{style:{background:"var(--bg-code)",padding:"2px 6px",borderRadius:3},children:"npm install -g @anthropic-ai/claude-code"})," ",e.jsx("span",{style:{color:"var(--text-muted)",margin:"0 4px"},children:l("ui.claudeMissing.or")})," ",e.jsx("a",{href:"https://claude.ai/download",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--color-primary-light)"},children:l("ui.claudeMissing.native")})]})}),e.jsxs(Ee.Content,{className:k.content,children:[h==="raw"&&(t.length===0?e.jsx("div",{className:k.guideContainer,children:e.jsxs("div",{className:k.guideContent,children:[e.jsx("h2",{className:k.guideTitle,children:l("ui.guide.title")}),e.jsxs("div",{className:k.guideStep,children:[e.jsx("div",{className:k.guideStepNum,children:"1"}),e.jsxs("div",{className:k.guideStepBody,children:[e.jsx("p",{className:k.guideText,children:l("ui.guide.step1")}),e.jsx("code",{className:k.guideCode,children:l("ui.guide.exampleQuestion")})]})]}),e.jsxs("div",{className:k.guideStep,children:[e.jsx("div",{className:k.guideStepNum,children:"2"}),e.jsxs("div",{className:k.guideStepBody,children:[e.jsx("p",{className:k.guideText,children:l("ui.guide.step2")}),e.jsx("code",{className:k.guideCode,children:l("ui.guide.troubleshootCmd")})]})]}),e.jsxs("div",{className:k.guideStep,children:[e.jsx("div",{className:k.guideStepNum,children:"3"}),e.jsxs("div",{className:k.guideStepBody,children:[e.jsx("p",{className:k.guideText,children:l("ui.guide.step3")}),e.jsx("code",{className:k.guideCode,children:"npm install -g @anthropic-ai/claude-code"})]})]})]})}):e.jsxs("div",{ref:this.mainContainerRef,className:k.mainContainer,children:[e.jsxs("div",{className:k.leftPanel,style:{width:g},children:[e.jsxs("div",{className:k.leftPanelHeader,children:[e.jsx("span",{children:l("ui.requestList")}),e.jsx("span",{className:k.leftPanelCount,children:l("ui.totalRequests",{count:t.length})})]}),e.jsx("div",{className:k.leftPanelBody,children:e.jsx(Ys,{requests:t,selectedIndex:d,scrollCenter:this.state.scrollCenter,onSelect:this.handleSelectRequest,onScrollDone:this.handleScrollDone,cacheLossMap:this._cacheLossMap})})]}),e.jsx(Si,{onResize:this.handleResize}),e.jsx("div",{className:k.rightPanel,children:e.jsx(bi,{request:n,requests:t,allRequests:this.state.requests,selectedIndex:d,currentTab:m,onTabChange:this.handleTabChange,onViewInChat:this.handleViewInChat,expandDiff:this.state.expandDiff,pendingCacheHighlight:this.state.pendingCacheHighlight,onCacheHighlightDone:this.handleCacheHighlightDone})})]})),e.jsx("div",{className:k.chatViewWrapper,style:{display:h==="chat"?"flex":"none"},children:e.jsx(es,{requests:t,mainAgentSessions:r,streamingLatest:this.state.streamingLatest,userProfile:this.state.userProfile,collapseToolResults:this.state.collapseToolResults,expandThinking:this.state.expandThinking,showFullToolContent:this.state.showFullToolContent,showThinkingSummaries:this.state.showThinkingSummaries,onViewRequest:this.handleViewRequest,scrollToTimestamp:this.state.chatScrollToTs,onScrollTsDone:this.handleScrollTsDone,cliMode:this._isLocalLog?!1:this.state.cliMode,sdkMode:this._isLocalLog?!1:this.state.sdkMode,terminalVisible:this._isLocalLog||this.state.sdkMode?!1:this.state.terminalVisible,onToggleTerminal:()=>this.setState(u=>({terminalVisible:!u.terminalVisible})),pendingUploadPaths:this.state.pendingUploadPaths,onUploadPathsConsumed:this.handleUploadPathsConsumed,fileLoading:this.state.fileLoading,isStreaming:this.state.isStreaming,hasMoreHistory:this.state.hasMoreHistory,loadingMore:this.state.loadingMore,onLoadMoreHistory:()=>this.loadMoreHistory(),loadingSessionId:this.state.loadingSessionId,onLoadSession:u=>this.loadSession(u),lang:this.state.lang,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange})})]}),e.jsx("div",{className:k.footer,children:e.jsxs("div",{className:k.footerRight,children:[e.jsxs("a",{href:"https://github.com/weiesky/cc-viewer",target:"_blank",rel:"noopener noreferrer",className:k.footerLink,children:[e.jsx("svg",{className:k.footerIcon,viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})}),"GitHub",this.state.githubStars!=null?` ★ ${this.state.githubStars}`:""]}),e.jsx("span",{className:k.footerSep,children:"|"}),e.jsxs("span",{className:`${k.footerVersion}${this.state.updateInfo?` ${k.footerVersionNew}`:""}`,onClick:()=>this.setState({updateModalVisible:!0}),style:{cursor:"pointer"},children:["v","1.6.190",this.state.updateInfo&&e.jsxs("svg",{className:k.newBadge,width:"28",height:"12",viewBox:"0 0 28 12",children:[e.jsx("rect",{width:"28",height:"12",rx:"3",fill:"currentColor",opacity:"0.25"}),e.jsx("text",{x:"14",y:"9",textAnchor:"middle",fill:"currentColor",fontSize:"8",fontWeight:"600",fontFamily:"system-ui",children:"NEW"})]})]})]})})]}),e.jsx(X,{title:l("ui.update.title"),open:this.state.updateModalVisible,onCancel:()=>this.setState({updateModalVisible:!1}),footer:null,width:480,children:e.jsxs("div",{style:{lineHeight:1.8},children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[l("ui.update.current"),":"]})," v","1.6.190"]}),this.state.updateInfo&&e.jsxs("p",{children:[e.jsxs("strong",{children:[l("ui.update.latest"),":"]})," v",this.state.updateInfo.version]}),e.jsx("p",{style:{marginTop:12},children:e.jsx("strong",{children:l("ui.update.npm")})}),e.jsx("code",{style:{display:"block",background:"var(--bg-code)",padding:"8px 12px",borderRadius:6,fontSize:13},children:"npm update -g cc-viewer"}),typeof window<"u"&&window.electronAPI&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{marginTop:16},children:e.jsx("strong",{children:l("ui.update.electron")})}),e.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:13},children:l("ui.update.electronDesc")}),e.jsxs("ol",{style:{color:"var(--text-tertiary)",fontSize:13,paddingLeft:20,margin:"6px 0"},children:[e.jsx("li",{children:l("ui.update.step1")}),e.jsx("li",{children:l("ui.update.step2")}),e.jsx("li",{children:l("ui.update.step3")})]})]}),e.jsx("div",{style:{marginTop:16,textAlign:"right"},children:e.jsx(E,{type:"primary",href:"https://github.com/weiesky/cc-viewer/releases",target:"_blank",rel:"noopener noreferrer",children:l("ui.update.goReleases")})})]})}),e.jsx(X,{title:l("ui.resume.title"),open:this.state.resumeModalVisible,closable:!1,maskClosable:!1,keyboard:!1,footer:e.jsxs("div",{children:[e.jsxs("div",{className:k.resumeFooterRight,children:[e.jsx(E,{type:"primary",onClick:()=>this.handleResumeChoice("continue"),className:k.btnMarginRight,children:l("ui.resume.continue")},"continue"),e.jsx(E,{onClick:()=>this.handleResumeChoice("new"),children:l("ui.resume.new")},"new")]}),e.jsx("div",{className:k.resumeFooterLeft,children:e.jsx(Pt,{checked:this.state.resumeRememberChoice,onChange:u=>this.setState({resumeRememberChoice:u.target.checked}),className:k.resumeCheckboxOpacity,children:e.jsx("span",{className:k.resumeCheckboxOpacity,children:l("ui.resume.remember")})})})]}),children:e.jsx("p",{children:l("ui.resume.message",{file:this.state.resumeFileName})})}),e.jsxs(X,{title:e.jsxs("span",{className:k.modalTitleInline,children:[e.jsx(yt,{apiEndpoint:W("/api/open-log-dir"),title:l("ui.openLogDir"),size:16}),l("ui.importLocalLogs")]}),open:this.state.importModalVisible,onCancel:this.handleCloseImportModal,footer:null,width:1e3,styles:{body:{overflow:"hidden"}},children:[e.jsxs("div",{className:k.modalActions,children:[e.jsx(E,{icon:e.jsx(rt,{}),onClick:this.handleLoadLocalJsonlFile,children:l("ui.loadLocalJsonl")}),e.jsx(E,{size:"small",type:this.state.selectedLogs.size>1?"primary":"default",disabled:this.state.selectedLogs.size<2,onClick:this.handleMergeLogs,className:k.btnMarginLeft,children:l("ui.mergeLogs")}),e.jsx(E,{size:"small",danger:!0,icon:e.jsx(Fe,{}),disabled:this.state.selectedLogs.size===0,onClick:this.handleDeleteLogs,className:k.btnMarginLeft,children:l("ui.deleteLogs")}),e.jsx(E,{size:"small",icon:e.jsx(He,{spin:this.state.refreshingStats}),loading:this.state.refreshingStats,onClick:this.handleRefreshStats,className:k.btnMarginLeft,children:l("ui.refreshStats")})]}),this.state.localLogsLoading?e.jsx("div",{className:k.spinCenter,children:e.jsx(pt,{})}):(()=>{const u=this.state.localLogs[this.state.currentProject];return!u||u.length===0?e.jsx("div",{className:k.emptyCenter,children:l("ui.noLogs")}):e.jsx("div",{className:k.logListContainer,children:this.renderLogTable(u,!1)})})()]})]})}}export{Fi as default};
|