@deepseekcode/cli 1.0.30 → 1.0.31

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DA-rfuFy.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/angular-ts-BrjP3tb8.js","assets/scss-D5BDwBP9.js","assets/apl-CORt7UWP.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-HNnZUWAn.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-2xfisSek.js","assets/html-derivative-DlHx6ybY.js","assets/sql-CRqJ_cUM.js","assets/bsl-DlhNcFeZ.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/chapel-DTp_pixX.js","assets/c-BIGW1oBm.js","assets/cobol-nBiQ_Alo.js","assets/coffee-Ch7k5sss.js","assets/cpp-BMRokrvK.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/crystal-DGywbUpC.js","assets/shellscript-Yzrsuije.js","assets/edge-FbVlp4U3.js","assets/elixir-CkH2-t6x.js","assets/elm-DbKCFpqz.js","assets/erb-DXfck5VN.js","assets/ruby-C0TQ7zu5.js","assets/haml-D5jkg6IW.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-TyuKm33G.js","assets/gdshader-DkwncUOv.js","assets/gdscript-DqcFQ5yU.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-ByusRIyA.js","assets/glimmer-ts-BfAWNZQY.js","assets/hack-BWmVpMyf.js","assets/handlebars-BpdQsYii.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-2-FPmUDs.js","assets/haxe-CfZj7gIn.js","assets/jinja-f2NsQr07.js","assets/jison-wvAkD_A8.js","assets/julia-5Bft2YPA.js","assets/r-Cf5RLm7j.js","assets/just-Cwhn7H3k.js","assets/perl-B9cMNwum.js","assets/latex-D5pSuvFb.js","assets/tex-D96PA37w.js","assets/liquid-C0sCDyMI.js","assets/marko-DjSrsDqO.js","assets/less-B1dDrJ26.js","assets/mdc-D1_yUvq7.js","assets/nextflow-C-mBbutL.js","assets/nextflow-groovy-vE_lwT2v.js","assets/nginx-BpAMiNFr.js","assets/nim-BIad80T-.js","assets/org-DM6o9KBp.js","assets/ini-BEwlwnbL.js","assets/make-CHLpvVh8.js","assets/php-Csjmro_R.js","assets/vb-Cu-pLBUe.js","assets/clojure-P80f7IUj.js","assets/objective-c-DXmwc3jG.js","assets/docker-BcOcwvcX.js","assets/go-C27-OAKa.js","assets/groovy-gcz8RCvz.js","assets/raku-DXvB9xmW.js","assets/rust-B1yitclQ.js","assets/scala-CqE71os6.js","assets/csharp-DSvCPggb.js","assets/dart-bE4Kk8sk.js","assets/ocaml-C0hk2d4L.js","assets/zig-VOosw3JB.js","assets/xsl-CtQFsRM5.js","assets/pug-DKIMFp6K.js","assets/qml-3beO22l8.js","assets/razor-BjBPvh-w.js","assets/rst-bs7f0vWN.js","assets/cmake-D1j8_8rp.js","assets/sas-DEy46yEz.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-8wufbnw4.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-DI20mbqo.js","assets/surrealql-Cjom0U5J.js","assets/svelte-Cy7k_4gC.js","assets/templ-DhtptRzy.js","assets/ts-tags-D351s5mN.js","assets/twig-27uCiNez.js","assets/typst-BUadGCkm.js","assets/bat-CickPsom.js","assets/bibtex-CHM0blh-.js","assets/jsonc-Des-eS-w.js","assets/log-2UxHyX5q.js","assets/powershell-BmBUJMz7.js","assets/swift-C2oV4EkX.js","assets/verilog-nZwndyjY.js","assets/system-verilog-0hqHdDBg.js","assets/vue-BqiEGhQt.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-BoDAl6tE.js","assets/stylus-BEDo0Tqx.js","assets/ModelsView-Dbo4GErV.js","assets/markdown-D-c9V8Xq.js","assets/icons-Di-qMB6n.js","assets/react-vendor-DU8XgZt2.js","assets/state-D2vcUGVk.js","assets/panels-CpHTincc.js","assets/ToolsView-DO0_61eJ.js","assets/SkillsView-CecX9sxV.js","assets/TemplatesTab-BtbjQDQk.js","assets/HookConfigView-japq3zFX.js","assets/FileTreeView-BWPOqGPh.js","assets/TerminalView-6U_87hSL.js","assets/terminal-DgJRGhIz.js","assets/TerminalView-C1Mzzh8g.css","assets/SessionGrid-F23LrdJ2.js","assets/sttLanguages-BNRptAQA.js","assets/SessionGrid-BGpz0-op.css","assets/SettingsPanel-CGJbV37j.js","assets/ChannelConfigView-BqEclPUB.js","assets/ConnectorsView-Cz4uqSmh.js","assets/AutomationView-Y4qkPsrX.js","assets/PluginsView-C1BPNAQx.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DA-rfuFy.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/angular-ts-BrjP3tb8.js","assets/scss-D5BDwBP9.js","assets/apl-CORt7UWP.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-HNnZUWAn.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-2xfisSek.js","assets/html-derivative-DlHx6ybY.js","assets/sql-CRqJ_cUM.js","assets/bsl-DlhNcFeZ.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/chapel-DTp_pixX.js","assets/c-BIGW1oBm.js","assets/cobol-nBiQ_Alo.js","assets/coffee-Ch7k5sss.js","assets/cpp-BMRokrvK.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/crystal-DGywbUpC.js","assets/shellscript-Yzrsuije.js","assets/edge-FbVlp4U3.js","assets/elixir-CkH2-t6x.js","assets/elm-DbKCFpqz.js","assets/erb-DXfck5VN.js","assets/ruby-C0TQ7zu5.js","assets/haml-D5jkg6IW.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-TyuKm33G.js","assets/gdshader-DkwncUOv.js","assets/gdscript-DqcFQ5yU.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-ByusRIyA.js","assets/glimmer-ts-BfAWNZQY.js","assets/hack-BWmVpMyf.js","assets/handlebars-BpdQsYii.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-2-FPmUDs.js","assets/haxe-CfZj7gIn.js","assets/jinja-f2NsQr07.js","assets/jison-wvAkD_A8.js","assets/julia-5Bft2YPA.js","assets/r-Cf5RLm7j.js","assets/just-Cwhn7H3k.js","assets/perl-B9cMNwum.js","assets/latex-D5pSuvFb.js","assets/tex-D96PA37w.js","assets/liquid-C0sCDyMI.js","assets/marko-DjSrsDqO.js","assets/less-B1dDrJ26.js","assets/mdc-D1_yUvq7.js","assets/nextflow-C-mBbutL.js","assets/nextflow-groovy-vE_lwT2v.js","assets/nginx-BpAMiNFr.js","assets/nim-BIad80T-.js","assets/org-DM6o9KBp.js","assets/ini-BEwlwnbL.js","assets/make-CHLpvVh8.js","assets/php-Csjmro_R.js","assets/vb-Cu-pLBUe.js","assets/clojure-P80f7IUj.js","assets/objective-c-DXmwc3jG.js","assets/docker-BcOcwvcX.js","assets/go-C27-OAKa.js","assets/groovy-gcz8RCvz.js","assets/raku-DXvB9xmW.js","assets/rust-B1yitclQ.js","assets/scala-CqE71os6.js","assets/csharp-DSvCPggb.js","assets/dart-bE4Kk8sk.js","assets/ocaml-C0hk2d4L.js","assets/zig-VOosw3JB.js","assets/xsl-CtQFsRM5.js","assets/pug-DKIMFp6K.js","assets/qml-3beO22l8.js","assets/razor-BjBPvh-w.js","assets/rst-bs7f0vWN.js","assets/cmake-D1j8_8rp.js","assets/sas-DEy46yEz.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-8wufbnw4.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-DI20mbqo.js","assets/surrealql-Cjom0U5J.js","assets/svelte-Cy7k_4gC.js","assets/templ-DhtptRzy.js","assets/ts-tags-D351s5mN.js","assets/twig-27uCiNez.js","assets/typst-BUadGCkm.js","assets/bat-CickPsom.js","assets/bibtex-CHM0blh-.js","assets/jsonc-Des-eS-w.js","assets/log-2UxHyX5q.js","assets/powershell-BmBUJMz7.js","assets/swift-C2oV4EkX.js","assets/verilog-nZwndyjY.js","assets/system-verilog-0hqHdDBg.js","assets/vue-BqiEGhQt.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-BoDAl6tE.js","assets/stylus-BEDo0Tqx.js","assets/ModelsView-C_hShQeY.js","assets/markdown-D-c9V8Xq.js","assets/icons-Di-qMB6n.js","assets/react-vendor-DU8XgZt2.js","assets/state-D2vcUGVk.js","assets/panels-CpHTincc.js","assets/ToolsView-D3HqxE7K.js","assets/SkillsView-DqLfpF41.js","assets/TemplatesTab-CQy-UXLH.js","assets/HookConfigView-DYF8WoqD.js","assets/FileTreeView-BT45_XVy.js","assets/TerminalView-DFjhMeyT.js","assets/terminal-DgJRGhIz.js","assets/TerminalView-C1Mzzh8g.css","assets/SessionGrid-aZvfkGsH.js","assets/sttLanguages-BNRptAQA.js","assets/SessionGrid-BGpz0-op.css","assets/SettingsPanel-DpXhjWLN.js","assets/ChannelConfigView-egYtlZj-.js","assets/ConnectorsView-5Ii67NnU.js","assets/AutomationView-InguWZFs.js","assets/PluginsView-CFAStd5I.js"])))=>i.map(i=>d[i]);
2
2
  var iS=Object.defineProperty;var oS=Object.getPrototypeOf;var lS=Reflect.get;var xb=n=>{throw TypeError(n)};var cS=(n,e,t)=>e in n?iS(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var V=(n,e,t)=>cS(n,typeof e!="symbol"?e+"":e,t),Cm=(n,e,t)=>e.has(n)||xb("Cannot "+t);var Kn=(n,e,t)=>(Cm(n,e,"read from private field"),t?t.call(n):e.get(n)),Ni=(n,e,t)=>e.has(n)?xb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Qa=(n,e,t,a)=>(Cm(n,e,"write to private field"),a?a.call(n,t):e.set(n,t),t),Tm=(n,e,t)=>(Cm(n,e,"access private method"),t);var wb=(n,e,t)=>lS(oS(n),t,e);import{o as uc,f as kd,m as Li,a as I3,p as Sb,b as kb,n as _b,h as z3,s as Wg,c as uS,v as dS,S as fS,w as Kg,d as hS,e as mS,j as y,M as pS,g as gS}from"./markdown-D-c9V8Xq.js";import{r as yS,g as $3,a as O,F as Jo,C as H3,b as U3,d as ti,P as Dp,e as vS,X as xr,L as Ga,f as F3,h as j0,G as G3,i as q3,S as bS,j as Yg,M as xS,k as P0,l as I0,m as V3,n as wS,o as W3,A as SS,p as Zg,q as kS,s as _S,t as CS,u as K3,v as TS,w as AS,x as ES,y as Xg,E as Cb,D as zc,z as s0,B as NS,H as z0,I as i0,J as Y3,K as Z3,N as MS,O as X3,Q as Tb,T as RS,U as OS,V as DS,Y as Lp,Z as Ac,_ as LS,$ as Qg,a0 as BS,a1 as jS,a2 as PS,a3 as Ab,a4 as IS,a5 as Eb,a6 as zS,a7 as $S,a8 as HS,a9 as Q3,aa as US,ab as FS,ac as J3,ad as GS,ae as qS,af as VS,ag as WS,ah as KS,ai as YS,aj as ZS,ak as XS,al as QS,am as ex,an as JS,ao as ek,W as tk}from"./icons-Di-qMB6n.js";import{r as nk}from"./react-vendor-DU8XgZt2.js";import{r as ak,c as mn}from"./state-D2vcUGVk.js";import{P as tx,a as Bp,b as nx}from"./panels-CpHTincc.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function t(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(s){if(s.ep)return;s.ep=!0;const o=t(s);fetch(s.href,o)}})();var Am={exports:{}},dc={},Em={exports:{}},Nm={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
@@ -24,7 +24,7 @@ var iS=Object.defineProperty;var oS=Object.getPrototypeOf;var lS=Reflect.get;var
24
24
  Error generating stack: `+f.message+`
25
25
  `+f.stack}}var Ce=Object.prototype.hasOwnProperty,Ge=n.unstable_scheduleCallback,At=n.unstable_cancelCallback,Jt=n.unstable_shouldYield,Ht=n.unstable_requestPaint,yt=n.unstable_now,Nn=n.unstable_getCurrentPriorityLevel,rr=n.unstable_ImmediatePriority,ps=n.unstable_UserBlockingPriority,ca=n.unstable_NormalPriority,Ar=n.unstable_LowPriority,zn=n.unstable_IdlePriority,gf=n.log,ua=n.unstable_setDisableYieldValue,gs=null,$n=null;function da(r){if(typeof gf=="function"&&ua(r),$n&&typeof $n.setStrictMode=="function")try{$n.setStrictMode(gs,r)}catch{}}var Mn=Math.clz32?Math.clz32:yf,ou=Math.log,lu=Math.LN2;function yf(r){return r>>>=0,r===0?32:31-(ou(r)/lu|0)|0}var Zi=256,Xi=262144,Er=4194304;function Wa(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Qi(r,i,c){var f=r.pendingLanes;if(f===0)return 0;var g=0,v=r.suspendedLanes,C=r.pingedLanes;r=r.warmLanes;var M=f&134217727;return M!==0?(f=M&~v,f!==0?g=Wa(f):(C&=M,C!==0?g=Wa(C):c||(c=M&~r,c!==0&&(g=Wa(c))))):(M=f&~v,M!==0?g=Wa(M):C!==0?g=Wa(C):c||(c=f&~r,c!==0&&(g=Wa(c)))),g===0?0:i!==0&&i!==g&&(i&v)===0&&(v=g&-g,c=i&-i,v>=c||v===32&&(c&4194048)!==0)?i:g}function ys(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Ji(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function cu(){var r=Er;return Er<<=1,(Er&62914560)===0&&(Er=4194304),r}function eo(r){for(var i=[],c=0;31>c;c++)i.push(r);return i}function Nr(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function uu(r,i,c,f,g,v){var C=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var M=r.entanglements,z=r.expirationTimes,K=r.hiddenUpdates;for(c=C&~c;0<c;){var ae=31-Mn(c),se=1<<ae;M[ae]=0,z[ae]=-1;var X=K[ae];if(X!==null)for(K[ae]=null,ae=0;ae<X.length;ae++){var Q=X[ae];Q!==null&&(Q.lane&=-536870913)}c&=~se}f!==0&&Mr(r,f,0),v!==0&&g===0&&r.tag!==0&&(r.suspendedLanes|=v&~(C&~i))}function Mr(r,i,c){r.pendingLanes|=i,r.suspendedLanes&=~i;var f=31-Mn(i);r.entangledLanes|=i,r.entanglements[f]=r.entanglements[f]|1073741824|c&261930}function du(r,i){var c=r.entangledLanes|=i;for(r=r.entanglements;c;){var f=31-Mn(c),g=1<<f;g&i|r[f]&i&&(r[f]|=i),c&=~g}}function to(r,i){var c=i&-i;return c=(c&42)!==0?1:ci(c),(c&(r.suspendedLanes|i))!==0?0:c}function ci(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function gl(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function yl(){var r=oe.p;return r!==0?r:(r=window.event,r===void 0?32:hb(r.type))}function vl(r,i){var c=oe.p;try{return oe.p=r,i()}finally{oe.p=c}}var Ka=Math.random().toString(36).slice(2),rn="__reactFiber$"+Ka,Rn="__reactProps$"+Ka,sr="__reactContainer$"+Ka,ui="__reactEvents$"+Ka,vf="__reactListeners$"+Ka,bf="__reactHandles$"+Ka,fu="__reactResources$"+Ka,di="__reactMarker$"+Ka;function bl(r){delete r[rn],delete r[Rn],delete r[ui],delete r[vf],delete r[bf]}function vs(r){var i=r[rn];if(i)return i;for(var c=r.parentNode;c;){if(i=c[sr]||c[rn]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(r=X4(r);r!==null;){if(c=r[rn])return c;r=X4(r)}return i}r=c,c=r.parentNode}return null}function Rr(r){if(r=r[rn]||r[sr]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function fi(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function ir(r){var i=r[fu];return i||(i=r[fu]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function sn(r){r[di]=!0}var U=new Set,ne={};function ue(r,i){Le(r,i),Le(r+"Capture",i)}function Le(r,i){for(ne[r]=i,r=0;r<i.length;r++)U.add(i[r])}var $e=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),gt={},Nt={};function yn(r){return Ce.call(Nt,r)?!0:Ce.call(gt,r)?!1:$e.test(r)?Nt[r]=!0:(gt[r]=!0,!1)}function Ot(r,i,c){if(yn(i))if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var f=i.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+c)}}function et(r,i,c){if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+c)}}function Hn(r,i,c,f){if(f===null)r.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(i,c,""+f)}}function qn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function xl(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function wl(r,i,c){var f=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var g=f.get,v=f.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return g.call(this)},set:function(C){c=""+C,v.call(this,C)}}),Object.defineProperty(r,i,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Aa(r){if(!r._valueTracker){var i=xl(r)?"checked":"value";r._valueTracker=wl(r,i,""+r[i])}}function hu(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var c=i.getValue(),f="";return r&&(f=xl(r)?r.checked?"true":"false":r.value),r=f,r!==c?(i.setValue(r),!0):!1}function Ea(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var Or=/[\n"\\]/g;function Vn(r){return r.replace(Or,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Sl(r,i,c,f,g,v,C,M){r.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?r.type=C:r.removeAttribute("type"),i!=null?C==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+qn(i)):r.value!==""+qn(i)&&(r.value=""+qn(i)):C!=="submit"&&C!=="reset"||r.removeAttribute("value"),i!=null?xf(r,C,qn(i)):c!=null?xf(r,C,qn(c)):f!=null&&r.removeAttribute("value"),g==null&&v!=null&&(r.defaultChecked=!!v),g!=null&&(r.checked=g&&typeof g!="function"&&typeof g!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?r.name=""+qn(M):r.removeAttribute("name")}function P1(r,i,c,f,g,v,C,M){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Aa(r);return}c=c!=null?""+qn(c):"",i=i!=null?""+qn(i):c,M||i===r.value||(r.value=i),r.defaultValue=i}f=f??g,f=typeof f!="function"&&typeof f!="symbol"&&!!f,r.checked=M?r.checked:!!f,r.defaultChecked=!!f,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(r.name=C),Aa(r)}function xf(r,i,c){i==="number"&&Ea(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function no(r,i,c,f){if(r=r.options,i){i={};for(var g=0;g<c.length;g++)i["$"+c[g]]=!0;for(c=0;c<r.length;c++)g=i.hasOwnProperty("$"+r[c].value),r[c].selected!==g&&(r[c].selected=g),g&&f&&(r[c].defaultSelected=!0)}else{for(c=""+qn(c),i=null,g=0;g<r.length;g++){if(r[g].value===c){r[g].selected=!0,f&&(r[g].defaultSelected=!0);return}i!==null||r[g].disabled||(i=r[g])}i!==null&&(i.selected=!0)}}function I1(r,i,c){if(i!=null&&(i=""+qn(i),i!==r.value&&(r.value=i),c==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=c!=null?""+qn(c):""}function z1(r,i,c,f){if(i==null){if(f!=null){if(c!=null)throw Error(a(92));if(we(f)){if(1<f.length)throw Error(a(93));f=f[0]}c=f}c==null&&(c=""),i=c}c=qn(i),r.defaultValue=c,f=r.textContent,f===c&&f!==""&&f!==null&&(r.value=f),Aa(r)}function ao(r,i){if(i){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=i;return}}r.textContent=i}var t8=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $1(r,i,c){var f=i.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":f?r.setProperty(i,c):typeof c!="number"||c===0||t8.has(i)?i==="float"?r.cssFloat=c:r[i]=(""+c).trim():r[i]=c+"px"}function H1(r,i,c){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||i!=null&&i.hasOwnProperty(f)||(f.indexOf("--")===0?r.setProperty(f,""):f==="float"?r.cssFloat="":r[f]="");for(var g in i)f=i[g],i.hasOwnProperty(g)&&c[g]!==f&&$1(r,g,f)}else for(var v in i)i.hasOwnProperty(v)&&$1(r,v,i[v])}function wf(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var n8=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),a8=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function mu(r){return a8.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Dr(){}var Sf=null;function kf(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ro=null,so=null;function U1(r){var i=Rr(r);if(i&&(r=i.stateNode)){var c=r[Rn]||null;e:switch(r=i.stateNode,i.type){case"input":if(Sl(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),i=c.name,c.type==="radio"&&i!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Vn(""+i)+'"][type="radio"]'),i=0;i<c.length;i++){var f=c[i];if(f!==r&&f.form===r.form){var g=f[Rn]||null;if(!g)throw Error(a(90));Sl(f,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(i=0;i<c.length;i++)f=c[i],f.form===r.form&&hu(f)}break e;case"textarea":I1(r,c.value,c.defaultValue);break e;case"select":i=c.value,i!=null&&no(r,!!c.multiple,i,!1)}}}var _f=!1;function F1(r,i,c){if(_f)return r(i,c);_f=!0;try{var f=r(i);return f}finally{if(_f=!1,(ro!==null||so!==null)&&(td(),ro&&(i=ro,r=so,so=ro=null,U1(i),r)))for(i=0;i<r.length;i++)U1(r[i])}}function kl(r,i){var c=r.stateNode;if(c===null)return null;var f=c[Rn]||null;if(f===null)return null;c=f[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(r=r.type,f=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!f;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(a(231,i,typeof c));return c}var Lr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cf=!1;if(Lr)try{var _l={};Object.defineProperty(_l,"passive",{get:function(){Cf=!0}}),window.addEventListener("test",_l,_l),window.removeEventListener("test",_l,_l)}catch{Cf=!1}var bs=null,Tf=null,pu=null;function G1(){if(pu)return pu;var r,i=Tf,c=i.length,f,g="value"in bs?bs.value:bs.textContent,v=g.length;for(r=0;r<c&&i[r]===g[r];r++);var C=c-r;for(f=1;f<=C&&i[c-f]===g[v-f];f++);return pu=g.slice(r,1<f?1-f:void 0)}function gu(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function yu(){return!0}function q1(){return!1}function ta(r){function i(c,f,g,v,C){this._reactName=c,this._targetInst=g,this.type=f,this.nativeEvent=v,this.target=C,this.currentTarget=null;for(var M in r)r.hasOwnProperty(M)&&(c=r[M],this[M]=c?c(v):v[M]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?yu:q1,this.isPropagationStopped=q1,this}return p(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=yu)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=yu)},persist:function(){},isPersistent:yu}),i}var hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vu=ta(hi),Cl=p({},hi,{view:0,detail:0}),r8=ta(Cl),Af,Ef,Tl,bu=p({},Cl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mf,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Tl&&(Tl&&r.type==="mousemove"?(Af=r.screenX-Tl.screenX,Ef=r.screenY-Tl.screenY):Ef=Af=0,Tl=r),Af)},movementY:function(r){return"movementY"in r?r.movementY:Ef}}),V1=ta(bu),s8=p({},bu,{dataTransfer:0}),i8=ta(s8),o8=p({},Cl,{relatedTarget:0}),Nf=ta(o8),l8=p({},hi,{animationName:0,elapsedTime:0,pseudoElement:0}),c8=ta(l8),u8=p({},hi,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),d8=ta(u8),f8=p({},hi,{data:0}),W1=ta(f8),h8={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},m8={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},p8={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g8(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=p8[r])?!!i[r]:!1}function Mf(){return g8}var y8=p({},Cl,{key:function(r){if(r.key){var i=h8[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=gu(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?m8[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mf,charCode:function(r){return r.type==="keypress"?gu(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?gu(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),v8=ta(y8),b8=p({},bu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),K1=ta(b8),x8=p({},Cl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mf}),w8=ta(x8),S8=p({},hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),k8=ta(S8),_8=p({},bu,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),C8=ta(_8),T8=p({},hi,{newState:0,oldState:0}),A8=ta(T8),E8=[9,13,27,32],Rf=Lr&&"CompositionEvent"in window,Al=null;Lr&&"documentMode"in document&&(Al=document.documentMode);var N8=Lr&&"TextEvent"in window&&!Al,Y1=Lr&&(!Rf||Al&&8<Al&&11>=Al),Z1=" ",X1=!1;function Q1(r,i){switch(r){case"keyup":return E8.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function J1(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var io=!1;function M8(r,i){switch(r){case"compositionend":return J1(i);case"keypress":return i.which!==32?null:(X1=!0,Z1);case"textInput":return r=i.data,r===Z1&&X1?null:r;default:return null}}function R8(r,i){if(io)return r==="compositionend"||!Rf&&Q1(r,i)?(r=G1(),pu=Tf=bs=null,io=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Y1&&i.locale!=="ko"?null:i.data;default:return null}}var O8={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ey(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!O8[r.type]:i==="textarea"}function ty(r,i,c,f){ro?so?so.push(f):so=[f]:ro=f,i=ld(i,"onChange"),0<i.length&&(c=new vu("onChange","change",null,c,f),r.push({event:c,listeners:i}))}var El=null,Nl=null;function D8(r){P4(r,0)}function xu(r){var i=fi(r);if(hu(i))return r}function ny(r,i){if(r==="change")return i}var ay=!1;if(Lr){var Of;if(Lr){var Df="oninput"in document;if(!Df){var ry=document.createElement("div");ry.setAttribute("oninput","return;"),Df=typeof ry.oninput=="function"}Of=Df}else Of=!1;ay=Of&&(!document.documentMode||9<document.documentMode)}function sy(){El&&(El.detachEvent("onpropertychange",iy),Nl=El=null)}function iy(r){if(r.propertyName==="value"&&xu(Nl)){var i=[];ty(i,Nl,r,kf(r)),F1(D8,i)}}function L8(r,i,c){r==="focusin"?(sy(),El=i,Nl=c,El.attachEvent("onpropertychange",iy)):r==="focusout"&&sy()}function B8(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return xu(Nl)}function j8(r,i){if(r==="click")return xu(i)}function P8(r,i){if(r==="input"||r==="change")return xu(i)}function I8(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var fa=typeof Object.is=="function"?Object.is:I8;function Ml(r,i){if(fa(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var c=Object.keys(r),f=Object.keys(i);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var g=c[f];if(!Ce.call(i,g)||!fa(r[g],i[g]))return!1}return!0}function oy(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ly(r,i){var c=oy(r);r=0;for(var f;c;){if(c.nodeType===3){if(f=r+c.textContent.length,r<=i&&f>=i)return{node:c,offset:i-r};r=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=oy(c)}}function cy(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?cy(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function uy(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Ea(r.document);i instanceof r.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)r=i.contentWindow;else break;i=Ea(r.document)}return i}function Lf(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var z8=Lr&&"documentMode"in document&&11>=document.documentMode,oo=null,Bf=null,Rl=null,jf=!1;function dy(r,i,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;jf||oo==null||oo!==Ea(f)||(f=oo,"selectionStart"in f&&Lf(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Rl&&Ml(Rl,f)||(Rl=f,f=ld(Bf,"onSelect"),0<f.length&&(i=new vu("onSelect","select",null,i,c),r.push({event:i,listeners:f}),i.target=oo)))}function mi(r,i){var c={};return c[r.toLowerCase()]=i.toLowerCase(),c["Webkit"+r]="webkit"+i,c["Moz"+r]="moz"+i,c}var lo={animationend:mi("Animation","AnimationEnd"),animationiteration:mi("Animation","AnimationIteration"),animationstart:mi("Animation","AnimationStart"),transitionrun:mi("Transition","TransitionRun"),transitionstart:mi("Transition","TransitionStart"),transitioncancel:mi("Transition","TransitionCancel"),transitionend:mi("Transition","TransitionEnd")},Pf={},fy={};Lr&&(fy=document.createElement("div").style,"AnimationEvent"in window||(delete lo.animationend.animation,delete lo.animationiteration.animation,delete lo.animationstart.animation),"TransitionEvent"in window||delete lo.transitionend.transition);function pi(r){if(Pf[r])return Pf[r];if(!lo[r])return r;var i=lo[r],c;for(c in i)if(i.hasOwnProperty(c)&&c in fy)return Pf[r]=i[c];return r}var hy=pi("animationend"),my=pi("animationiteration"),py=pi("animationstart"),$8=pi("transitionrun"),H8=pi("transitionstart"),U8=pi("transitioncancel"),gy=pi("transitionend"),yy=new Map,If="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");If.push("scrollEnd");function Ya(r,i){yy.set(r,i),ue(i,[r])}var wu=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Na=[],co=0,zf=0;function Su(){for(var r=co,i=zf=co=0;i<r;){var c=Na[i];Na[i++]=null;var f=Na[i];Na[i++]=null;var g=Na[i];Na[i++]=null;var v=Na[i];if(Na[i++]=null,f!==null&&g!==null){var C=f.pending;C===null?g.next=g:(g.next=C.next,C.next=g),f.pending=g}v!==0&&vy(c,g,v)}}function ku(r,i,c,f){Na[co++]=r,Na[co++]=i,Na[co++]=c,Na[co++]=f,zf|=f,r.lanes|=f,r=r.alternate,r!==null&&(r.lanes|=f)}function $f(r,i,c,f){return ku(r,i,c,f),_u(r)}function gi(r,i){return ku(r,null,null,i),_u(r)}function vy(r,i,c){r.lanes|=c;var f=r.alternate;f!==null&&(f.lanes|=c);for(var g=!1,v=r.return;v!==null;)v.childLanes|=c,f=v.alternate,f!==null&&(f.childLanes|=c),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(g=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,g&&i!==null&&(g=31-Mn(c),r=v.hiddenUpdates,f=r[g],f===null?r[g]=[i]:f.push(i),i.lane=c|536870912),v):null}function _u(r){if(50<Jl)throw Jl=0,Yh=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var uo={};function F8(r,i,c,f){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ha(r,i,c,f){return new F8(r,i,c,f)}function Hf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Br(r,i){var c=r.alternate;return c===null?(c=ha(r.tag,i,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=i,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,i=r.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function by(r,i){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,i=c.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function Cu(r,i,c,f,g,v){var C=0;if(f=r,typeof r=="function")Hf(r)&&(C=1);else if(typeof r=="string")C=Kw(r,c,lt.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case te:return r=ha(31,c,i,g),r.elementType=te,r.lanes=v,r;case _:return yi(c.children,g,v,i);case T:C=8,g|=24;break;case N:return r=ha(12,c,i,g|2),r.elementType=N,r.lanes=v,r;case j:return r=ha(13,c,i,g),r.elementType=j,r.lanes=v,r;case F:return r=ha(19,c,i,g),r.elementType=F,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case B:C=10;break e;case E:C=9;break e;case L:C=11;break e;case Y:C=14;break e;case ee:C=16,f=null;break e}C=29,c=Error(a(130,r===null?"null":typeof r,"")),f=null}return i=ha(C,c,i,g),i.elementType=r,i.type=f,i.lanes=v,i}function yi(r,i,c,f){return r=ha(7,r,f,i),r.lanes=c,r}function Uf(r,i,c){return r=ha(6,r,null,i),r.lanes=c,r}function xy(r){var i=ha(18,null,null,0);return i.stateNode=r,i}function Ff(r,i,c){return i=ha(4,r.children!==null?r.children:[],r.key,i),i.lanes=c,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var wy=new WeakMap;function Ma(r,i){if(typeof r=="object"&&r!==null){var c=wy.get(r);return c!==void 0?c:(i={value:r,source:i,stack:Pe(i)},wy.set(r,i),i)}return{value:r,source:i,stack:Pe(i)}}var fo=[],ho=0,Tu=null,Ol=0,Ra=[],Oa=0,xs=null,or=1,lr="";function jr(r,i){fo[ho++]=Ol,fo[ho++]=Tu,Tu=r,Ol=i}function Sy(r,i,c){Ra[Oa++]=or,Ra[Oa++]=lr,Ra[Oa++]=xs,xs=r;var f=or;r=lr;var g=32-Mn(f)-1;f&=~(1<<g),c+=1;var v=32-Mn(i)+g;if(30<v){var C=g-g%5;v=(f&(1<<C)-1).toString(32),f>>=C,g-=C,or=1<<32-Mn(i)+g|c<<g|f,lr=v+r}else or=1<<v|c<<g|f,lr=r}function Gf(r){r.return!==null&&(jr(r,1),Sy(r,1,0))}function qf(r){for(;r===Tu;)Tu=fo[--ho],fo[ho]=null,Ol=fo[--ho],fo[ho]=null;for(;r===xs;)xs=Ra[--Oa],Ra[Oa]=null,lr=Ra[--Oa],Ra[Oa]=null,or=Ra[--Oa],Ra[Oa]=null}function ky(r,i){Ra[Oa++]=or,Ra[Oa++]=lr,Ra[Oa++]=xs,or=i.id,lr=i.overflow,xs=r}var On=null,zt=null,ft=!1,ws=null,Da=!1,Vf=Error(a(519));function Ss(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Dl(Ma(i,r)),Vf}function _y(r){var i=r.stateNode,c=r.type,f=r.memoizedProps;switch(i[rn]=r,i[Rn]=f,c){case"dialog":ot("cancel",i),ot("close",i);break;case"iframe":case"object":case"embed":ot("load",i);break;case"video":case"audio":for(c=0;c<tc.length;c++)ot(tc[c],i);break;case"source":ot("error",i);break;case"img":case"image":case"link":ot("error",i),ot("load",i);break;case"details":ot("toggle",i);break;case"input":ot("invalid",i),P1(i,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":ot("invalid",i);break;case"textarea":ot("invalid",i),z1(i,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||i.textContent===""+c||f.suppressHydrationWarning===!0||H4(i.textContent,c)?(f.popover!=null&&(ot("beforetoggle",i),ot("toggle",i)),f.onScroll!=null&&ot("scroll",i),f.onScrollEnd!=null&&ot("scrollend",i),f.onClick!=null&&(i.onclick=Dr),i=!0):i=!1,i||Ss(r,!0)}function Cy(r){for(On=r.return;On;)switch(On.tag){case 5:case 31:case 13:Da=!1;return;case 27:case 3:Da=!0;return;default:On=On.return}}function mo(r){if(r!==On)return!1;if(!ft)return Cy(r),ft=!0,!1;var i=r.tag,c;if((c=i!==3&&i!==27)&&((c=i===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||um(r.type,r.memoizedProps)),c=!c),c&&zt&&Ss(r),Cy(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));zt=Z4(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));zt=Z4(r)}else i===27?(i=zt,js(r.type)?(r=pm,pm=null,zt=r):zt=i):zt=On?Ba(r.stateNode.nextSibling):null;return!0}function vi(){zt=On=null,ft=!1}function Wf(){var r=ws;return r!==null&&(sa===null?sa=r:sa.push.apply(sa,r),ws=null),r}function Dl(r){ws===null?ws=[r]:ws.push(r)}var Kf=We(null),bi=null,Pr=null;function ks(r,i,c){Re(Kf,i._currentValue),i._currentValue=c}function Ir(r){r._currentValue=Kf.current,ze(Kf)}function Yf(r,i,c){for(;r!==null;){var f=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,f!==null&&(f.childLanes|=i)):f!==null&&(f.childLanes&i)!==i&&(f.childLanes|=i),r===c)break;r=r.return}}function Zf(r,i,c,f){var g=r.child;for(g!==null&&(g.return=r);g!==null;){var v=g.dependencies;if(v!==null){var C=g.child;v=v.firstContext;e:for(;v!==null;){var M=v;v=g;for(var z=0;z<i.length;z++)if(M.context===i[z]){v.lanes|=c,M=v.alternate,M!==null&&(M.lanes|=c),Yf(v.return,c,r),f||(C=null);break e}v=M.next}}else if(g.tag===18){if(C=g.return,C===null)throw Error(a(341));C.lanes|=c,v=C.alternate,v!==null&&(v.lanes|=c),Yf(C,c,r),C=null}else C=g.child;if(C!==null)C.return=g;else for(C=g;C!==null;){if(C===r){C=null;break}if(g=C.sibling,g!==null){g.return=C.return,C=g;break}C=C.return}g=C}}function po(r,i,c,f){r=null;for(var g=i,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var C=g.alternate;if(C===null)throw Error(a(387));if(C=C.memoizedProps,C!==null){var M=g.type;fa(g.pendingProps.value,C.value)||(r!==null?r.push(M):r=[M])}}else if(g===an.current){if(C=g.alternate,C===null)throw Error(a(387));C.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(r!==null?r.push(ic):r=[ic])}g=g.return}r!==null&&Zf(i,r,c,f),i.flags|=262144}function Au(r){for(r=r.firstContext;r!==null;){if(!fa(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function xi(r){bi=r,Pr=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Dn(r){return Ty(bi,r)}function Eu(r,i){return bi===null&&xi(r),Ty(r,i)}function Ty(r,i){var c=i._currentValue;if(i={context:i,memoizedValue:c,next:null},Pr===null){if(r===null)throw Error(a(308));Pr=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Pr=Pr.next=i;return c}var G8=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(c,f){r.push(f)}};this.abort=function(){i.aborted=!0,r.forEach(function(c){return c()})}},q8=n.unstable_scheduleCallback,V8=n.unstable_NormalPriority,on={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Xf(){return{controller:new G8,data:new Map,refCount:0}}function Ll(r){r.refCount--,r.refCount===0&&q8(V8,function(){r.controller.abort()})}var Bl=null,Qf=0,go=0,yo=null;function W8(r,i){if(Bl===null){var c=Bl=[];Qf=0,go=tm(),yo={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Qf++,i.then(Ay,Ay),i}function Ay(){if(--Qf===0&&Bl!==null){yo!==null&&(yo.status="fulfilled");var r=Bl;Bl=null,go=0,yo=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function K8(r,i){var c=[],f={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return r.then(function(){f.status="fulfilled",f.value=i;for(var g=0;g<c.length;g++)(0,c[g])(i)},function(g){for(f.status="rejected",f.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),f}var Ey=q.S;q.S=function(r,i){d4=yt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&W8(r,i),Ey!==null&&Ey(r,i)};var wi=We(null);function Jf(){var r=wi.current;return r!==null?r:jt.pooledCache}function Nu(r,i){i===null?Re(wi,wi.current):Re(wi,i.pool)}function Ny(){var r=Jf();return r===null?null:{parent:on._currentValue,pool:r}}var vo=Error(a(460)),eh=Error(a(474)),Mu=Error(a(542)),Ru={then:function(){}};function My(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Ry(r,i,c){switch(c=r[c],c===void 0?r.push(i):c!==i&&(i.then(Dr,Dr),i=c),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Dy(r),r;default:if(typeof i.status=="string")i.then(Dr,Dr);else{if(r=jt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(f){if(i.status==="pending"){var g=i;g.status="fulfilled",g.value=f}},function(f){if(i.status==="pending"){var g=i;g.status="rejected",g.reason=f}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Dy(r),r}throw ki=i,vo}}function Si(r){try{var i=r._init;return i(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(ki=c,vo):c}}var ki=null;function Oy(){if(ki===null)throw Error(a(459));var r=ki;return ki=null,r}function Dy(r){if(r===vo||r===Mu)throw Error(a(483))}var bo=null,jl=0;function Ou(r){var i=jl;return jl+=1,bo===null&&(bo=[]),Ry(bo,r,i)}function Pl(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function Du(r,i){throw i.$$typeof===b?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function Ly(r){function i(G,$){if(r){var W=G.deletions;W===null?(G.deletions=[$],G.flags|=16):W.push($)}}function c(G,$){if(!r)return null;for(;$!==null;)i(G,$),$=$.sibling;return null}function f(G){for(var $=new Map;G!==null;)G.key!==null?$.set(G.key,G):$.set(G.index,G),G=G.sibling;return $}function g(G,$){return G=Br(G,$),G.index=0,G.sibling=null,G}function v(G,$,W){return G.index=W,r?(W=G.alternate,W!==null?(W=W.index,W<$?(G.flags|=67108866,$):W):(G.flags|=67108866,$)):(G.flags|=1048576,$)}function C(G){return r&&G.alternate===null&&(G.flags|=67108866),G}function M(G,$,W,re){return $===null||$.tag!==6?($=Uf(W,G.mode,re),$.return=G,$):($=g($,W),$.return=G,$)}function z(G,$,W,re){var Be=W.type;return Be===_?ae(G,$,W.props.children,re,W.key):$!==null&&($.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===ee&&Si(Be)===$.type)?($=g($,W.props),Pl($,W),$.return=G,$):($=Cu(W.type,W.key,W.props,null,G.mode,re),Pl($,W),$.return=G,$)}function K(G,$,W,re){return $===null||$.tag!==4||$.stateNode.containerInfo!==W.containerInfo||$.stateNode.implementation!==W.implementation?($=Ff(W,G.mode,re),$.return=G,$):($=g($,W.children||[]),$.return=G,$)}function ae(G,$,W,re,Be){return $===null||$.tag!==7?($=yi(W,G.mode,re,Be),$.return=G,$):($=g($,W),$.return=G,$)}function se(G,$,W){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Uf(""+$,G.mode,W),$.return=G,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return W=Cu($.type,$.key,$.props,null,G.mode,W),Pl(W,$),W.return=G,W;case w:return $=Ff($,G.mode,W),$.return=G,$;case ee:return $=Si($),se(G,$,W)}if(we($)||ce($))return $=yi($,G.mode,W,null),$.return=G,$;if(typeof $.then=="function")return se(G,Ou($),W);if($.$$typeof===B)return se(G,Eu(G,$),W);Du(G,$)}return null}function X(G,$,W,re){var Be=$!==null?$.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Be!==null?null:M(G,$,""+W,re);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case x:return W.key===Be?z(G,$,W,re):null;case w:return W.key===Be?K(G,$,W,re):null;case ee:return W=Si(W),X(G,$,W,re)}if(we(W)||ce(W))return Be!==null?null:ae(G,$,W,re,null);if(typeof W.then=="function")return X(G,$,Ou(W),re);if(W.$$typeof===B)return X(G,$,Eu(G,W),re);Du(G,W)}return null}function Q(G,$,W,re,Be){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return G=G.get(W)||null,M($,G,""+re,Be);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case x:return G=G.get(re.key===null?W:re.key)||null,z($,G,re,Be);case w:return G=G.get(re.key===null?W:re.key)||null,K($,G,re,Be);case ee:return re=Si(re),Q(G,$,W,re,Be)}if(we(re)||ce(re))return G=G.get(W)||null,ae($,G,re,Be,null);if(typeof re.then=="function")return Q(G,$,W,Ou(re),Be);if(re.$$typeof===B)return Q(G,$,W,Eu($,re),Be);Du($,re)}return null}function Te(G,$,W,re){for(var Be=null,bt=null,Ee=$,nt=$=0,dt=null;Ee!==null&&nt<W.length;nt++){Ee.index>nt?(dt=Ee,Ee=null):dt=Ee.sibling;var xt=X(G,Ee,W[nt],re);if(xt===null){Ee===null&&(Ee=dt);break}r&&Ee&&xt.alternate===null&&i(G,Ee),$=v(xt,$,nt),bt===null?Be=xt:bt.sibling=xt,bt=xt,Ee=dt}if(nt===W.length)return c(G,Ee),ft&&jr(G,nt),Be;if(Ee===null){for(;nt<W.length;nt++)Ee=se(G,W[nt],re),Ee!==null&&($=v(Ee,$,nt),bt===null?Be=Ee:bt.sibling=Ee,bt=Ee);return ft&&jr(G,nt),Be}for(Ee=f(Ee);nt<W.length;nt++)dt=Q(Ee,G,nt,W[nt],re),dt!==null&&(r&&dt.alternate!==null&&Ee.delete(dt.key===null?nt:dt.key),$=v(dt,$,nt),bt===null?Be=dt:bt.sibling=dt,bt=dt);return r&&Ee.forEach(function(Hs){return i(G,Hs)}),ft&&jr(G,nt),Be}function Ie(G,$,W,re){if(W==null)throw Error(a(151));for(var Be=null,bt=null,Ee=$,nt=$=0,dt=null,xt=W.next();Ee!==null&&!xt.done;nt++,xt=W.next()){Ee.index>nt?(dt=Ee,Ee=null):dt=Ee.sibling;var Hs=X(G,Ee,xt.value,re);if(Hs===null){Ee===null&&(Ee=dt);break}r&&Ee&&Hs.alternate===null&&i(G,Ee),$=v(Hs,$,nt),bt===null?Be=Hs:bt.sibling=Hs,bt=Hs,Ee=dt}if(xt.done)return c(G,Ee),ft&&jr(G,nt),Be;if(Ee===null){for(;!xt.done;nt++,xt=W.next())xt=se(G,xt.value,re),xt!==null&&($=v(xt,$,nt),bt===null?Be=xt:bt.sibling=xt,bt=xt);return ft&&jr(G,nt),Be}for(Ee=f(Ee);!xt.done;nt++,xt=W.next())xt=Q(Ee,G,nt,xt.value,re),xt!==null&&(r&&xt.alternate!==null&&Ee.delete(xt.key===null?nt:xt.key),$=v(xt,$,nt),bt===null?Be=xt:bt.sibling=xt,bt=xt);return r&&Ee.forEach(function(sS){return i(G,sS)}),ft&&jr(G,nt),Be}function Bt(G,$,W,re){if(typeof W=="object"&&W!==null&&W.type===_&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case x:e:{for(var Be=W.key;$!==null;){if($.key===Be){if(Be=W.type,Be===_){if($.tag===7){c(G,$.sibling),re=g($,W.props.children),re.return=G,G=re;break e}}else if($.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===ee&&Si(Be)===$.type){c(G,$.sibling),re=g($,W.props),Pl(re,W),re.return=G,G=re;break e}c(G,$);break}else i(G,$);$=$.sibling}W.type===_?(re=yi(W.props.children,G.mode,re,W.key),re.return=G,G=re):(re=Cu(W.type,W.key,W.props,null,G.mode,re),Pl(re,W),re.return=G,G=re)}return C(G);case w:e:{for(Be=W.key;$!==null;){if($.key===Be)if($.tag===4&&$.stateNode.containerInfo===W.containerInfo&&$.stateNode.implementation===W.implementation){c(G,$.sibling),re=g($,W.children||[]),re.return=G,G=re;break e}else{c(G,$);break}else i(G,$);$=$.sibling}re=Ff(W,G.mode,re),re.return=G,G=re}return C(G);case ee:return W=Si(W),Bt(G,$,W,re)}if(we(W))return Te(G,$,W,re);if(ce(W)){if(Be=ce(W),typeof Be!="function")throw Error(a(150));return W=Be.call(W),Ie(G,$,W,re)}if(typeof W.then=="function")return Bt(G,$,Ou(W),re);if(W.$$typeof===B)return Bt(G,$,Eu(G,W),re);Du(G,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,$!==null&&$.tag===6?(c(G,$.sibling),re=g($,W),re.return=G,G=re):(c(G,$),re=Uf(W,G.mode,re),re.return=G,G=re),C(G)):c(G,$)}return function(G,$,W,re){try{jl=0;var Be=Bt(G,$,W,re);return bo=null,Be}catch(Ee){if(Ee===vo||Ee===Mu)throw Ee;var bt=ha(29,Ee,null,G.mode);return bt.lanes=re,bt.return=G,bt}finally{}}}var _i=Ly(!0),By=Ly(!1),_s=!1;function th(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nh(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Cs(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ts(r,i,c){var f=r.updateQueue;if(f===null)return null;if(f=f.shared,(_t&2)!==0){var g=f.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),f.pending=i,i=_u(r),vy(r,null,c),i}return ku(r,f,i,c),_u(r)}function Il(r,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194048)!==0)){var f=i.lanes;f&=r.pendingLanes,c|=f,i.lanes=c,du(r,c)}}function ah(r,i){var c=r.updateQueue,f=r.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var g=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var C={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?g=v=C:v=v.next=C,c=c.next}while(c!==null);v===null?g=v=i:v=v.next=i}else g=v=i;c={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=i:r.next=i,c.lastBaseUpdate=i}var rh=!1;function zl(){if(rh){var r=yo;if(r!==null)throw r}}function $l(r,i,c,f){rh=!1;var g=r.updateQueue;_s=!1;var v=g.firstBaseUpdate,C=g.lastBaseUpdate,M=g.shared.pending;if(M!==null){g.shared.pending=null;var z=M,K=z.next;z.next=null,C===null?v=K:C.next=K,C=z;var ae=r.alternate;ae!==null&&(ae=ae.updateQueue,M=ae.lastBaseUpdate,M!==C&&(M===null?ae.firstBaseUpdate=K:M.next=K,ae.lastBaseUpdate=z))}if(v!==null){var se=g.baseState;C=0,ae=K=z=null,M=v;do{var X=M.lane&-536870913,Q=X!==M.lane;if(Q?(ut&X)===X:(f&X)===X){X!==0&&X===go&&(rh=!0),ae!==null&&(ae=ae.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Te=r,Ie=M;X=i;var Bt=c;switch(Ie.tag){case 1:if(Te=Ie.payload,typeof Te=="function"){se=Te.call(Bt,se,X);break e}se=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ie.payload,X=typeof Te=="function"?Te.call(Bt,se,X):Te,X==null)break e;se=p({},se,X);break e;case 2:_s=!0}}X=M.callback,X!==null&&(r.flags|=64,Q&&(r.flags|=8192),Q=g.callbacks,Q===null?g.callbacks=[X]:Q.push(X))}else Q={lane:X,tag:M.tag,payload:M.payload,callback:M.callback,next:null},ae===null?(K=ae=Q,z=se):ae=ae.next=Q,C|=X;if(M=M.next,M===null){if(M=g.shared.pending,M===null)break;Q=M,M=Q.next,Q.next=null,g.lastBaseUpdate=Q,g.shared.pending=null}}while(!0);ae===null&&(z=se),g.baseState=z,g.firstBaseUpdate=K,g.lastBaseUpdate=ae,v===null&&(g.shared.lanes=0),Rs|=C,r.lanes=C,r.memoizedState=se}}function jy(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Py(r,i){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)jy(c[r],i)}var xo=We(null),Lu=We(0);function Iy(r,i){r=Wr,Re(Lu,r),Re(xo,i),Wr=r|i.baseLanes}function sh(){Re(Lu,Wr),Re(xo,xo.current)}function ih(){Wr=Lu.current,ze(xo),ze(Lu)}var ma=We(null),La=null;function As(r){var i=r.alternate;Re(en,en.current&1),Re(ma,r),La===null&&(i===null||xo.current!==null||i.memoizedState!==null)&&(La=r)}function oh(r){Re(en,en.current),Re(ma,r),La===null&&(La=r)}function zy(r){r.tag===22?(Re(en,en.current),Re(ma,r),La===null&&(La=r)):Es()}function Es(){Re(en,en.current),Re(ma,ma.current)}function pa(r){ze(ma),La===r&&(La=null),ze(en)}var en=We(0);function Bu(r){for(var i=r;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||hm(c)||mm(c)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var zr=0,tt=null,Dt=null,ln=null,ju=!1,wo=!1,Ci=!1,Pu=0,Hl=0,So=null,Y8=0;function Zt(){throw Error(a(321))}function lh(r,i){if(i===null)return!1;for(var c=0;c<i.length&&c<r.length;c++)if(!fa(r[c],i[c]))return!1;return!0}function ch(r,i,c,f,g,v){return zr=v,tt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=r===null||r.memoizedState===null?Sv:_h,Ci=!1,v=c(f,g),Ci=!1,wo&&(v=Hy(i,c,f,g)),$y(r),v}function $y(r){q.H=Gl;var i=Dt!==null&&Dt.next!==null;if(zr=0,ln=Dt=tt=null,ju=!1,Hl=0,So=null,i)throw Error(a(300));r===null||cn||(r=r.dependencies,r!==null&&Au(r)&&(cn=!0))}function Hy(r,i,c,f){tt=r;var g=0;do{if(wo&&(So=null),Hl=0,wo=!1,25<=g)throw Error(a(301));if(g+=1,ln=Dt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}q.H=kv,v=i(c,f)}while(wo);return v}function Z8(){var r=q.H,i=r.useState()[0];return i=typeof i.then=="function"?Ul(i):i,r=r.useState()[0],(Dt!==null?Dt.memoizedState:null)!==r&&(tt.flags|=1024),i}function uh(){var r=Pu!==0;return Pu=0,r}function dh(r,i,c){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~c}function fh(r){if(ju){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ju=!1}zr=0,ln=Dt=tt=null,wo=!1,Hl=Pu=0,So=null}function Wn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ln===null?tt.memoizedState=ln=r:ln=ln.next=r,ln}function tn(){if(Dt===null){var r=tt.alternate;r=r!==null?r.memoizedState:null}else r=Dt.next;var i=ln===null?tt.memoizedState:ln.next;if(i!==null)ln=i,Dt=r;else{if(r===null)throw tt.alternate===null?Error(a(467)):Error(a(310));Dt=r,r={memoizedState:Dt.memoizedState,baseState:Dt.baseState,baseQueue:Dt.baseQueue,queue:Dt.queue,next:null},ln===null?tt.memoizedState=ln=r:ln=ln.next=r}return ln}function Iu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ul(r){var i=Hl;return Hl+=1,So===null&&(So=[]),r=Ry(So,r,i),i=tt,(ln===null?i.memoizedState:ln.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?Sv:_h),r}function zu(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Ul(r);if(r.$$typeof===B)return Dn(r)}throw Error(a(438,String(r)))}function hh(r){var i=null,c=tt.updateQueue;if(c!==null&&(i=c.memoCache),i==null){var f=tt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(i={data:f.data.map(function(g){return g.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),c===null&&(c=Iu(),tt.updateQueue=c),c.memoCache=i,c=i.data[i.index],c===void 0)for(c=i.data[i.index]=Array(r),f=0;f<r;f++)c[f]=xe;return i.index++,c}function $r(r,i){return typeof i=="function"?i(r):i}function $u(r){var i=tn();return mh(i,Dt,r)}function mh(r,i,c){var f=r.queue;if(f===null)throw Error(a(311));f.lastRenderedReducer=c;var g=r.baseQueue,v=f.pending;if(v!==null){if(g!==null){var C=g.next;g.next=v.next,v.next=C}i.baseQueue=g=v,f.pending=null}if(v=r.baseState,g===null)r.memoizedState=v;else{i=g.next;var M=C=null,z=null,K=i,ae=!1;do{var se=K.lane&-536870913;if(se!==K.lane?(ut&se)===se:(zr&se)===se){var X=K.revertLane;if(X===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),se===go&&(ae=!0);else if((zr&X)===X){K=K.next,X===go&&(ae=!0);continue}else se={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},z===null?(M=z=se,C=v):z=z.next=se,tt.lanes|=X,Rs|=X;se=K.action,Ci&&c(v,se),v=K.hasEagerState?K.eagerState:c(v,se)}else X={lane:se,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},z===null?(M=z=X,C=v):z=z.next=X,tt.lanes|=se,Rs|=se;K=K.next}while(K!==null&&K!==i);if(z===null?C=v:z.next=M,!fa(v,r.memoizedState)&&(cn=!0,ae&&(c=yo,c!==null)))throw c;r.memoizedState=v,r.baseState=C,r.baseQueue=z,f.lastRenderedState=v}return g===null&&(f.lanes=0),[r.memoizedState,f.dispatch]}function ph(r){var i=tn(),c=i.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=r;var f=c.dispatch,g=c.pending,v=i.memoizedState;if(g!==null){c.pending=null;var C=g=g.next;do v=r(v,C.action),C=C.next;while(C!==g);fa(v,i.memoizedState)||(cn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),c.lastRenderedState=v}return[v,f]}function Uy(r,i,c){var f=tt,g=tn(),v=ft;if(v){if(c===void 0)throw Error(a(407));c=c()}else c=i();var C=!fa((Dt||g).memoizedState,c);if(C&&(g.memoizedState=c,cn=!0),g=g.queue,vh(qy.bind(null,f,g,r),[r]),g.getSnapshot!==i||C||ln!==null&&ln.memoizedState.tag&1){if(f.flags|=2048,ko(9,{destroy:void 0},Gy.bind(null,f,g,c,i),null),jt===null)throw Error(a(349));v||(zr&127)!==0||Fy(f,i,c)}return c}function Fy(r,i,c){r.flags|=16384,r={getSnapshot:i,value:c},i=tt.updateQueue,i===null?(i=Iu(),tt.updateQueue=i,i.stores=[r]):(c=i.stores,c===null?i.stores=[r]:c.push(r))}function Gy(r,i,c,f){i.value=c,i.getSnapshot=f,Vy(i)&&Wy(r)}function qy(r,i,c){return c(function(){Vy(i)&&Wy(r)})}function Vy(r){var i=r.getSnapshot;r=r.value;try{var c=i();return!fa(r,c)}catch{return!0}}function Wy(r){var i=gi(r,2);i!==null&&ia(i,r,2)}function gh(r){var i=Wn();if(typeof r=="function"){var c=r;if(r=c(),Ci){da(!0);try{c()}finally{da(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$r,lastRenderedState:r},i}function Ky(r,i,c,f){return r.baseState=c,mh(r,Dt,typeof f=="function"?f:$r)}function X8(r,i,c,f,g){if(Fu(r))throw Error(a(485));if(r=i.action,r!==null){var v={payload:g,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){v.listeners.push(C)}};q.T!==null?c(!0):v.isTransition=!1,f(v),c=i.pending,c===null?(v.next=i.pending=v,Yy(i,v)):(v.next=c.next,i.pending=c.next=v)}}function Yy(r,i){var c=i.action,f=i.payload,g=r.state;if(i.isTransition){var v=q.T,C={};q.T=C;try{var M=c(g,f),z=q.S;z!==null&&z(C,M),Zy(r,i,M)}catch(K){yh(r,i,K)}finally{v!==null&&C.types!==null&&(v.types=C.types),q.T=v}}else try{v=c(g,f),Zy(r,i,v)}catch(K){yh(r,i,K)}}function Zy(r,i,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){Xy(r,i,f)},function(f){return yh(r,i,f)}):Xy(r,i,c)}function Xy(r,i,c){i.status="fulfilled",i.value=c,Qy(i),r.state=c,i=r.pending,i!==null&&(c=i.next,c===i?r.pending=null:(c=c.next,i.next=c,Yy(r,c)))}function yh(r,i,c){var f=r.pending;if(r.pending=null,f!==null){f=f.next;do i.status="rejected",i.reason=c,Qy(i),i=i.next;while(i!==f)}r.action=null}function Qy(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Jy(r,i){return i}function ev(r,i){if(ft){var c=jt.formState;if(c!==null){e:{var f=tt;if(ft){if(zt){t:{for(var g=zt,v=Da;g.nodeType!==8;){if(!v){g=null;break t}if(g=Ba(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){zt=Ba(g.nextSibling),f=g.data==="F!";break e}}Ss(f)}f=!1}f&&(i=c[0])}}return c=Wn(),c.memoizedState=c.baseState=i,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jy,lastRenderedState:i},c.queue=f,c=bv.bind(null,tt,f),f.dispatch=c,f=gh(!1),v=kh.bind(null,tt,!1,f.queue),f=Wn(),g={state:i,dispatch:null,action:r,pending:null},f.queue=g,c=X8.bind(null,tt,g,v,c),g.dispatch=c,f.memoizedState=r,[i,c,!1]}function tv(r){var i=tn();return nv(i,Dt,r)}function nv(r,i,c){if(i=mh(r,i,Jy)[0],r=$u($r)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var f=Ul(i)}catch(C){throw C===vo?Mu:C}else f=i;i=tn();var g=i.queue,v=g.dispatch;return c!==i.memoizedState&&(tt.flags|=2048,ko(9,{destroy:void 0},Q8.bind(null,g,c),null)),[f,v,r]}function Q8(r,i){r.action=i}function av(r){var i=tn(),c=Dt;if(c!==null)return nv(i,c,r);tn(),i=i.memoizedState,c=tn();var f=c.queue.dispatch;return c.memoizedState=r,[i,f,!1]}function ko(r,i,c,f){return r={tag:r,create:c,deps:f,inst:i,next:null},i=tt.updateQueue,i===null&&(i=Iu(),tt.updateQueue=i),c=i.lastEffect,c===null?i.lastEffect=r.next=r:(f=c.next,c.next=r,r.next=f,i.lastEffect=r),r}function rv(){return tn().memoizedState}function Hu(r,i,c,f){var g=Wn();tt.flags|=r,g.memoizedState=ko(1|i,{destroy:void 0},c,f===void 0?null:f)}function Uu(r,i,c,f){var g=tn();f=f===void 0?null:f;var v=g.memoizedState.inst;Dt!==null&&f!==null&&lh(f,Dt.memoizedState.deps)?g.memoizedState=ko(i,v,c,f):(tt.flags|=r,g.memoizedState=ko(1|i,v,c,f))}function sv(r,i){Hu(8390656,8,r,i)}function vh(r,i){Uu(2048,8,r,i)}function J8(r){tt.flags|=4;var i=tt.updateQueue;if(i===null)i=Iu(),tt.updateQueue=i,i.events=[r];else{var c=i.events;c===null?i.events=[r]:c.push(r)}}function iv(r){var i=tn().memoizedState;return J8({ref:i,nextImpl:r}),function(){if((_t&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function ov(r,i){return Uu(4,2,r,i)}function lv(r,i){return Uu(4,4,r,i)}function cv(r,i){if(typeof i=="function"){r=r();var c=i(r);return function(){typeof c=="function"?c():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function uv(r,i,c){c=c!=null?c.concat([r]):null,Uu(4,4,cv.bind(null,i,r),c)}function bh(){}function dv(r,i){var c=tn();i=i===void 0?null:i;var f=c.memoizedState;return i!==null&&lh(i,f[1])?f[0]:(c.memoizedState=[r,i],r)}function fv(r,i){var c=tn();i=i===void 0?null:i;var f=c.memoizedState;if(i!==null&&lh(i,f[1]))return f[0];if(f=r(),Ci){da(!0);try{r()}finally{da(!1)}}return c.memoizedState=[f,i],f}function xh(r,i,c){return c===void 0||(zr&1073741824)!==0&&(ut&261930)===0?r.memoizedState=i:(r.memoizedState=c,r=h4(),tt.lanes|=r,Rs|=r,c)}function hv(r,i,c,f){return fa(c,i)?c:xo.current!==null?(r=xh(r,c,f),fa(r,i)||(cn=!0),r):(zr&42)===0||(zr&1073741824)!==0&&(ut&261930)===0?(cn=!0,r.memoizedState=c):(r=h4(),tt.lanes|=r,Rs|=r,i)}function mv(r,i,c,f,g){var v=oe.p;oe.p=v!==0&&8>v?v:8;var C=q.T,M={};q.T=M,kh(r,!1,i,c);try{var z=g(),K=q.S;if(K!==null&&K(M,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var ae=K8(z,f);Fl(r,i,ae,va(r))}else Fl(r,i,f,va(r))}catch(se){Fl(r,i,{then:function(){},status:"rejected",reason:se},va())}finally{oe.p=v,C!==null&&M.types!==null&&(C.types=M.types),q.T=C}}function ew(){}function wh(r,i,c,f){if(r.tag!==5)throw Error(a(476));var g=pv(r).queue;mv(r,g,i,ge,c===null?ew:function(){return gv(r),c(f)})}function pv(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:ge,baseState:ge,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$r,lastRenderedState:ge},next:null};var c={};return i.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$r,lastRenderedState:c},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function gv(r){var i=pv(r);i.next===null&&(i=r.alternate.memoizedState),Fl(r,i.next.queue,{},va())}function Sh(){return Dn(ic)}function yv(){return tn().memoizedState}function vv(){return tn().memoizedState}function tw(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var c=va();r=Cs(c);var f=Ts(i,r,c);f!==null&&(ia(f,i,c),Il(f,i,c)),i={cache:Xf()},r.payload=i;return}i=i.return}}function nw(r,i,c){var f=va();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Fu(r)?xv(i,c):(c=$f(r,i,c,f),c!==null&&(ia(c,r,f),wv(c,i,f)))}function bv(r,i,c){var f=va();Fl(r,i,c,f)}function Fl(r,i,c,f){var g={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Fu(r))xv(i,g);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var C=i.lastRenderedState,M=v(C,c);if(g.hasEagerState=!0,g.eagerState=M,fa(M,C))return ku(r,i,g,0),jt===null&&Su(),!1}catch{}finally{}if(c=$f(r,i,g,f),c!==null)return ia(c,r,f),wv(c,i,f),!0}return!1}function kh(r,i,c,f){if(f={lane:2,revertLane:tm(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Fu(r)){if(i)throw Error(a(479))}else i=$f(r,c,f,2),i!==null&&ia(i,r,2)}function Fu(r){var i=r.alternate;return r===tt||i!==null&&i===tt}function xv(r,i){wo=ju=!0;var c=r.pending;c===null?i.next=i:(i.next=c.next,c.next=i),r.pending=i}function wv(r,i,c){if((c&4194048)!==0){var f=i.lanes;f&=r.pendingLanes,c|=f,i.lanes=c,du(r,c)}}var Gl={readContext:Dn,use:zu,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};Gl.useEffectEvent=Zt;var Sv={readContext:Dn,use:zu,useCallback:function(r,i){return Wn().memoizedState=[r,i===void 0?null:i],r},useContext:Dn,useEffect:sv,useImperativeHandle:function(r,i,c){c=c!=null?c.concat([r]):null,Hu(4194308,4,cv.bind(null,i,r),c)},useLayoutEffect:function(r,i){return Hu(4194308,4,r,i)},useInsertionEffect:function(r,i){Hu(4,2,r,i)},useMemo:function(r,i){var c=Wn();i=i===void 0?null:i;var f=r();if(Ci){da(!0);try{r()}finally{da(!1)}}return c.memoizedState=[f,i],f},useReducer:function(r,i,c){var f=Wn();if(c!==void 0){var g=c(i);if(Ci){da(!0);try{c(i)}finally{da(!1)}}}else g=i;return f.memoizedState=f.baseState=g,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:g},f.queue=r,r=r.dispatch=nw.bind(null,tt,r),[f.memoizedState,r]},useRef:function(r){var i=Wn();return r={current:r},i.memoizedState=r},useState:function(r){r=gh(r);var i=r.queue,c=bv.bind(null,tt,i);return i.dispatch=c,[r.memoizedState,c]},useDebugValue:bh,useDeferredValue:function(r,i){var c=Wn();return xh(c,r,i)},useTransition:function(){var r=gh(!1);return r=mv.bind(null,tt,r.queue,!0,!1),Wn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,c){var f=tt,g=Wn();if(ft){if(c===void 0)throw Error(a(407));c=c()}else{if(c=i(),jt===null)throw Error(a(349));(ut&127)!==0||Fy(f,i,c)}g.memoizedState=c;var v={value:c,getSnapshot:i};return g.queue=v,sv(qy.bind(null,f,v,r),[r]),f.flags|=2048,ko(9,{destroy:void 0},Gy.bind(null,f,v,c,i),null),c},useId:function(){var r=Wn(),i=jt.identifierPrefix;if(ft){var c=lr,f=or;c=(f&~(1<<32-Mn(f)-1)).toString(32)+c,i="_"+i+"R_"+c,c=Pu++,0<c&&(i+="H"+c.toString(32)),i+="_"}else c=Y8++,i="_"+i+"r_"+c.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Sh,useFormState:ev,useActionState:ev,useOptimistic:function(r){var i=Wn();i.memoizedState=i.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=c,i=kh.bind(null,tt,!0,c),c.dispatch=i,[r,i]},useMemoCache:hh,useCacheRefresh:function(){return Wn().memoizedState=tw.bind(null,tt)},useEffectEvent:function(r){var i=Wn(),c={impl:r};return i.memoizedState=c,function(){if((_t&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},_h={readContext:Dn,use:zu,useCallback:dv,useContext:Dn,useEffect:vh,useImperativeHandle:uv,useInsertionEffect:ov,useLayoutEffect:lv,useMemo:fv,useReducer:$u,useRef:rv,useState:function(){return $u($r)},useDebugValue:bh,useDeferredValue:function(r,i){var c=tn();return hv(c,Dt.memoizedState,r,i)},useTransition:function(){var r=$u($r)[0],i=tn().memoizedState;return[typeof r=="boolean"?r:Ul(r),i]},useSyncExternalStore:Uy,useId:yv,useHostTransitionStatus:Sh,useFormState:tv,useActionState:tv,useOptimistic:function(r,i){var c=tn();return Ky(c,Dt,r,i)},useMemoCache:hh,useCacheRefresh:vv};_h.useEffectEvent=iv;var kv={readContext:Dn,use:zu,useCallback:dv,useContext:Dn,useEffect:vh,useImperativeHandle:uv,useInsertionEffect:ov,useLayoutEffect:lv,useMemo:fv,useReducer:ph,useRef:rv,useState:function(){return ph($r)},useDebugValue:bh,useDeferredValue:function(r,i){var c=tn();return Dt===null?xh(c,r,i):hv(c,Dt.memoizedState,r,i)},useTransition:function(){var r=ph($r)[0],i=tn().memoizedState;return[typeof r=="boolean"?r:Ul(r),i]},useSyncExternalStore:Uy,useId:yv,useHostTransitionStatus:Sh,useFormState:av,useActionState:av,useOptimistic:function(r,i){var c=tn();return Dt!==null?Ky(c,Dt,r,i):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:hh,useCacheRefresh:vv};kv.useEffectEvent=iv;function Ch(r,i,c,f){i=r.memoizedState,c=c(f,i),c=c==null?i:p({},i,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Th={enqueueSetState:function(r,i,c){r=r._reactInternals;var f=va(),g=Cs(f);g.payload=i,c!=null&&(g.callback=c),i=Ts(r,g,f),i!==null&&(ia(i,r,f),Il(i,r,f))},enqueueReplaceState:function(r,i,c){r=r._reactInternals;var f=va(),g=Cs(f);g.tag=1,g.payload=i,c!=null&&(g.callback=c),i=Ts(r,g,f),i!==null&&(ia(i,r,f),Il(i,r,f))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var c=va(),f=Cs(c);f.tag=2,i!=null&&(f.callback=i),i=Ts(r,f,c),i!==null&&(ia(i,r,c),Il(i,r,c))}};function _v(r,i,c,f,g,v,C){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(f,v,C):i.prototype&&i.prototype.isPureReactComponent?!Ml(c,f)||!Ml(g,v):!0}function Cv(r,i,c,f){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,f),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,f),i.state!==r&&Th.enqueueReplaceState(i,i.state,null)}function Ti(r,i){var c=i;if("ref"in i){c={};for(var f in i)f!=="ref"&&(c[f]=i[f])}if(r=r.defaultProps){c===i&&(c=p({},c));for(var g in r)c[g]===void 0&&(c[g]=r[g])}return c}function Tv(r){wu(r)}function Av(r){console.error(r)}function Ev(r){wu(r)}function Gu(r,i){try{var c=r.onUncaughtError;c(i.value,{componentStack:i.stack})}catch(f){setTimeout(function(){throw f})}}function Nv(r,i,c){try{var f=r.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Ah(r,i,c){return c=Cs(c),c.tag=3,c.payload={element:null},c.callback=function(){Gu(r,i)},c}function Mv(r){return r=Cs(r),r.tag=3,r}function Rv(r,i,c,f){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var v=f.value;r.payload=function(){return g(v)},r.callback=function(){Nv(i,c,f)}}var C=c.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(r.callback=function(){Nv(i,c,f),typeof g!="function"&&(Os===null?Os=new Set([this]):Os.add(this));var M=f.stack;this.componentDidCatch(f.value,{componentStack:M!==null?M:""})})}function aw(r,i,c,f,g){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(i=c.alternate,i!==null&&po(i,c,g,!0),c=ma.current,c!==null){switch(c.tag){case 31:case 13:return La===null?nd():c.alternate===null&&Xt===0&&(Xt=3),c.flags&=-257,c.flags|=65536,c.lanes=g,f===Ru?c.flags|=16384:(i=c.updateQueue,i===null?c.updateQueue=new Set([f]):i.add(f),Qh(r,f,g)),!1;case 22:return c.flags|=65536,f===Ru?c.flags|=16384:(i=c.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=i):(c=i.retryQueue,c===null?i.retryQueue=new Set([f]):c.add(f)),Qh(r,f,g)),!1}throw Error(a(435,c.tag))}return Qh(r,f,g),nd(),!1}if(ft)return i=ma.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=g,f!==Vf&&(r=Error(a(422),{cause:f}),Dl(Ma(r,c)))):(f!==Vf&&(i=Error(a(423),{cause:f}),Dl(Ma(i,c))),r=r.current.alternate,r.flags|=65536,g&=-g,r.lanes|=g,f=Ma(f,c),g=Ah(r.stateNode,f,g),ah(r,g),Xt!==4&&(Xt=2)),!1;var v=Error(a(520),{cause:f});if(v=Ma(v,c),Ql===null?Ql=[v]:Ql.push(v),Xt!==4&&(Xt=2),i===null)return!0;f=Ma(f,c),c=i;do{switch(c.tag){case 3:return c.flags|=65536,r=g&-g,c.lanes|=r,r=Ah(c.stateNode,f,r),ah(c,r),!1;case 1:if(i=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Os===null||!Os.has(v))))return c.flags|=65536,g&=-g,c.lanes|=g,g=Mv(g),Rv(g,r,c,f),ah(c,g),!1}c=c.return}while(c!==null);return!1}var Eh=Error(a(461)),cn=!1;function Ln(r,i,c,f){i.child=r===null?By(i,null,c,f):_i(i,r.child,c,f)}function Ov(r,i,c,f,g){c=c.render;var v=i.ref;if("ref"in f){var C={};for(var M in f)M!=="ref"&&(C[M]=f[M])}else C=f;return xi(i),f=ch(r,i,c,C,v,g),M=uh(),r!==null&&!cn?(dh(r,i,g),Hr(r,i,g)):(ft&&M&&Gf(i),i.flags|=1,Ln(r,i,f,g),i.child)}function Dv(r,i,c,f,g){if(r===null){var v=c.type;return typeof v=="function"&&!Hf(v)&&v.defaultProps===void 0&&c.compare===null?(i.tag=15,i.type=v,Lv(r,i,v,f,g)):(r=Cu(c.type,null,f,i,i.mode,g),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!jh(r,g)){var C=v.memoizedProps;if(c=c.compare,c=c!==null?c:Ml,c(C,f)&&r.ref===i.ref)return Hr(r,i,g)}return i.flags|=1,r=Br(v,f),r.ref=i.ref,r.return=i,i.child=r}function Lv(r,i,c,f,g){if(r!==null){var v=r.memoizedProps;if(Ml(v,f)&&r.ref===i.ref)if(cn=!1,i.pendingProps=f=v,jh(r,g))(r.flags&131072)!==0&&(cn=!0);else return i.lanes=r.lanes,Hr(r,i,g)}return Nh(r,i,c,f,g)}function Bv(r,i,c,f){var g=f.children,v=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,r!==null){for(f=i.child=r.child,g=0;f!==null;)g=g|f.lanes|f.childLanes,f=f.sibling;f=g&~v}else f=0,i.child=null;return jv(r,i,v,c,f)}if((c&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&Nu(i,v!==null?v.cachePool:null),v!==null?Iy(i,v):sh(),zy(i);else return f=i.lanes=536870912,jv(r,i,v!==null?v.baseLanes|c:c,c,f)}else v!==null?(Nu(i,v.cachePool),Iy(i,v),Es(),i.memoizedState=null):(r!==null&&Nu(i,null),sh(),Es());return Ln(r,i,g,c),i.child}function ql(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function jv(r,i,c,f,g){var v=Jf();return v=v===null?null:{parent:on._currentValue,pool:v},i.memoizedState={baseLanes:c,cachePool:v},r!==null&&Nu(i,null),sh(),zy(i),r!==null&&po(r,i,f,!0),i.childLanes=g,null}function qu(r,i){return i=Wu({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function Pv(r,i,c){return _i(i,r.child,null,c),r=qu(i,i.pendingProps),r.flags|=2,pa(i),i.memoizedState=null,r}function rw(r,i,c){var f=i.pendingProps,g=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(ft){if(f.mode==="hidden")return r=qu(i,f),i.lanes=536870912,ql(null,r);if(oh(i),(r=zt)?(r=Y4(r,Da),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:xs!==null?{id:or,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},c=xy(r),c.return=i,i.child=c,On=i,zt=null)):r=null,r===null)throw Ss(i);return i.lanes=536870912,null}return qu(i,f)}var v=r.memoizedState;if(v!==null){var C=v.dehydrated;if(oh(i),g)if(i.flags&256)i.flags&=-257,i=Pv(r,i,c);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(cn||po(r,i,c,!1),g=(c&r.childLanes)!==0,cn||g){if(f=jt,f!==null&&(C=to(f,c),C!==0&&C!==v.retryLane))throw v.retryLane=C,gi(r,C),ia(f,r,C),Eh;nd(),i=Pv(r,i,c)}else r=v.treeContext,zt=Ba(C.nextSibling),On=i,ft=!0,ws=null,Da=!1,r!==null&&ky(i,r),i=qu(i,f),i.flags|=4096;return i}return r=Br(r.child,{mode:f.mode,children:f.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Vu(r,i){var c=i.ref;if(c===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(r===null||r.ref!==c)&&(i.flags|=4194816)}}function Nh(r,i,c,f,g){return xi(i),c=ch(r,i,c,f,void 0,g),f=uh(),r!==null&&!cn?(dh(r,i,g),Hr(r,i,g)):(ft&&f&&Gf(i),i.flags|=1,Ln(r,i,c,g),i.child)}function Iv(r,i,c,f,g,v){return xi(i),i.updateQueue=null,c=Hy(i,f,c,g),$y(r),f=uh(),r!==null&&!cn?(dh(r,i,v),Hr(r,i,v)):(ft&&f&&Gf(i),i.flags|=1,Ln(r,i,c,v),i.child)}function zv(r,i,c,f,g){if(xi(i),i.stateNode===null){var v=uo,C=c.contextType;typeof C=="object"&&C!==null&&(v=Dn(C)),v=new c(f,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Th,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=f,v.state=i.memoizedState,v.refs={},th(i),C=c.contextType,v.context=typeof C=="object"&&C!==null?Dn(C):uo,v.state=i.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(Ch(i,c,C,f),v.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(C=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),C!==v.state&&Th.enqueueReplaceState(v,v.state,null),$l(i,f,v,g),zl(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),f=!0}else if(r===null){v=i.stateNode;var M=i.memoizedProps,z=Ti(c,M);v.props=z;var K=v.context,ae=c.contextType;C=uo,typeof ae=="object"&&ae!==null&&(C=Dn(ae));var se=c.getDerivedStateFromProps;ae=typeof se=="function"||typeof v.getSnapshotBeforeUpdate=="function",M=i.pendingProps!==M,ae||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(M||K!==C)&&Cv(i,v,f,C),_s=!1;var X=i.memoizedState;v.state=X,$l(i,f,v,g),zl(),K=i.memoizedState,M||X!==K||_s?(typeof se=="function"&&(Ch(i,c,se,f),K=i.memoizedState),(z=_s||_v(i,c,z,f,X,K,C))?(ae||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=f,i.memoizedState=K),v.props=f,v.state=K,v.context=C,f=z):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),f=!1)}else{v=i.stateNode,nh(r,i),C=i.memoizedProps,ae=Ti(c,C),v.props=ae,se=i.pendingProps,X=v.context,K=c.contextType,z=uo,typeof K=="object"&&K!==null&&(z=Dn(K)),M=c.getDerivedStateFromProps,(K=typeof M=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(C!==se||X!==z)&&Cv(i,v,f,z),_s=!1,X=i.memoizedState,v.state=X,$l(i,f,v,g),zl();var Q=i.memoizedState;C!==se||X!==Q||_s||r!==null&&r.dependencies!==null&&Au(r.dependencies)?(typeof M=="function"&&(Ch(i,c,M,f),Q=i.memoizedState),(ae=_s||_v(i,c,ae,f,X,Q,z)||r!==null&&r.dependencies!==null&&Au(r.dependencies))?(K||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,Q,z),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,Q,z)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||C===r.memoizedProps&&X===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||C===r.memoizedProps&&X===r.memoizedState||(i.flags|=1024),i.memoizedProps=f,i.memoizedState=Q),v.props=f,v.state=Q,v.context=z,f=ae):(typeof v.componentDidUpdate!="function"||C===r.memoizedProps&&X===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||C===r.memoizedProps&&X===r.memoizedState||(i.flags|=1024),f=!1)}return v=f,Vu(r,i),f=(i.flags&128)!==0,v||f?(v=i.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&f?(i.child=_i(i,r.child,null,g),i.child=_i(i,null,c,g)):Ln(r,i,c,g),i.memoizedState=v.state,r=i.child):r=Hr(r,i,g),r}function $v(r,i,c,f){return vi(),i.flags|=256,Ln(r,i,c,f),i.child}var Mh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rh(r){return{baseLanes:r,cachePool:Ny()}}function Oh(r,i,c){return r=r!==null?r.childLanes&~c:0,i&&(r|=ya),r}function Hv(r,i,c){var f=i.pendingProps,g=!1,v=(i.flags&128)!==0,C;if((C=v)||(C=r!==null&&r.memoizedState===null?!1:(en.current&2)!==0),C&&(g=!0,i.flags&=-129),C=(i.flags&32)!==0,i.flags&=-33,r===null){if(ft){if(g?As(i):Es(),(r=zt)?(r=Y4(r,Da),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:xs!==null?{id:or,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},c=xy(r),c.return=i,i.child=c,On=i,zt=null)):r=null,r===null)throw Ss(i);return mm(r)?i.lanes=32:i.lanes=536870912,null}var M=f.children;return f=f.fallback,g?(Es(),g=i.mode,M=Wu({mode:"hidden",children:M},g),f=yi(f,g,c,null),M.return=i,f.return=i,M.sibling=f,i.child=M,f=i.child,f.memoizedState=Rh(c),f.childLanes=Oh(r,C,c),i.memoizedState=Mh,ql(null,f)):(As(i),Dh(i,M))}var z=r.memoizedState;if(z!==null&&(M=z.dehydrated,M!==null)){if(v)i.flags&256?(As(i),i.flags&=-257,i=Lh(r,i,c)):i.memoizedState!==null?(Es(),i.child=r.child,i.flags|=128,i=null):(Es(),M=f.fallback,g=i.mode,f=Wu({mode:"visible",children:f.children},g),M=yi(M,g,c,null),M.flags|=2,f.return=i,M.return=i,f.sibling=M,i.child=f,_i(i,r.child,null,c),f=i.child,f.memoizedState=Rh(c),f.childLanes=Oh(r,C,c),i.memoizedState=Mh,i=ql(null,f));else if(As(i),mm(M)){if(C=M.nextSibling&&M.nextSibling.dataset,C)var K=C.dgst;C=K,f=Error(a(419)),f.stack="",f.digest=C,Dl({value:f,source:null,stack:null}),i=Lh(r,i,c)}else if(cn||po(r,i,c,!1),C=(c&r.childLanes)!==0,cn||C){if(C=jt,C!==null&&(f=to(C,c),f!==0&&f!==z.retryLane))throw z.retryLane=f,gi(r,f),ia(C,r,f),Eh;hm(M)||nd(),i=Lh(r,i,c)}else hm(M)?(i.flags|=192,i.child=r.child,i=null):(r=z.treeContext,zt=Ba(M.nextSibling),On=i,ft=!0,ws=null,Da=!1,r!==null&&ky(i,r),i=Dh(i,f.children),i.flags|=4096);return i}return g?(Es(),M=f.fallback,g=i.mode,z=r.child,K=z.sibling,f=Br(z,{mode:"hidden",children:f.children}),f.subtreeFlags=z.subtreeFlags&65011712,K!==null?M=Br(K,M):(M=yi(M,g,c,null),M.flags|=2),M.return=i,f.return=i,f.sibling=M,i.child=f,ql(null,f),f=i.child,M=r.child.memoizedState,M===null?M=Rh(c):(g=M.cachePool,g!==null?(z=on._currentValue,g=g.parent!==z?{parent:z,pool:z}:g):g=Ny(),M={baseLanes:M.baseLanes|c,cachePool:g}),f.memoizedState=M,f.childLanes=Oh(r,C,c),i.memoizedState=Mh,ql(r.child,f)):(As(i),c=r.child,r=c.sibling,c=Br(c,{mode:"visible",children:f.children}),c.return=i,c.sibling=null,r!==null&&(C=i.deletions,C===null?(i.deletions=[r],i.flags|=16):C.push(r)),i.child=c,i.memoizedState=null,c)}function Dh(r,i){return i=Wu({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Wu(r,i){return r=ha(22,r,null,i),r.lanes=0,r}function Lh(r,i,c){return _i(i,r.child,null,c),r=Dh(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function Uv(r,i,c){r.lanes|=i;var f=r.alternate;f!==null&&(f.lanes|=i),Yf(r.return,i,c)}function Bh(r,i,c,f,g,v){var C=r.memoizedState;C===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:g,treeForkCount:v}:(C.isBackwards=i,C.rendering=null,C.renderingStartTime=0,C.last=f,C.tail=c,C.tailMode=g,C.treeForkCount=v)}function Fv(r,i,c){var f=i.pendingProps,g=f.revealOrder,v=f.tail;f=f.children;var C=en.current,M=(C&2)!==0;if(M?(C=C&1|2,i.flags|=128):C&=1,Re(en,C),Ln(r,i,f,c),f=ft?Ol:0,!M&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Uv(r,c,i);else if(r.tag===19)Uv(r,c,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(g){case"forwards":for(c=i.child,g=null;c!==null;)r=c.alternate,r!==null&&Bu(r)===null&&(g=c),c=c.sibling;c=g,c===null?(g=i.child,i.child=null):(g=c.sibling,c.sibling=null),Bh(i,!1,g,c,v,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=i.child,i.child=null;g!==null;){if(r=g.alternate,r!==null&&Bu(r)===null){i.child=g;break}r=g.sibling,g.sibling=c,c=g,g=r}Bh(i,!0,c,null,v,f);break;case"together":Bh(i,!1,null,null,void 0,f);break;default:i.memoizedState=null}return i.child}function Hr(r,i,c){if(r!==null&&(i.dependencies=r.dependencies),Rs|=i.lanes,(c&i.childLanes)===0)if(r!==null){if(po(r,i,c,!1),(c&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(a(153));if(i.child!==null){for(r=i.child,c=Br(r,r.pendingProps),i.child=c,c.return=i;r.sibling!==null;)r=r.sibling,c=c.sibling=Br(r,r.pendingProps),c.return=i;c.sibling=null}return i.child}function jh(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&Au(r)))}function sw(r,i,c){switch(i.tag){case 3:In(i,i.stateNode.containerInfo),ks(i,on,r.memoizedState.cache),vi();break;case 27:case 5:_a(i);break;case 4:In(i,i.stateNode.containerInfo);break;case 10:ks(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,oh(i),null;break;case 13:var f=i.memoizedState;if(f!==null)return f.dehydrated!==null?(As(i),i.flags|=128,null):(c&i.child.childLanes)!==0?Hv(r,i,c):(As(i),r=Hr(r,i,c),r!==null?r.sibling:null);As(i);break;case 19:var g=(r.flags&128)!==0;if(f=(c&i.childLanes)!==0,f||(po(r,i,c,!1),f=(c&i.childLanes)!==0),g){if(f)return Fv(r,i,c);i.flags|=128}if(g=i.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),Re(en,en.current),f)break;return null;case 22:return i.lanes=0,Bv(r,i,c,i.pendingProps);case 24:ks(i,on,r.memoizedState.cache)}return Hr(r,i,c)}function Gv(r,i,c){if(r!==null)if(r.memoizedProps!==i.pendingProps)cn=!0;else{if(!jh(r,c)&&(i.flags&128)===0)return cn=!1,sw(r,i,c);cn=(r.flags&131072)!==0}else cn=!1,ft&&(i.flags&1048576)!==0&&Sy(i,Ol,i.index);switch(i.lanes=0,i.tag){case 16:e:{var f=i.pendingProps;if(r=Si(i.elementType),i.type=r,typeof r=="function")Hf(r)?(f=Ti(r,f),i.tag=1,i=zv(null,i,r,f,c)):(i.tag=0,i=Nh(null,i,r,f,c));else{if(r!=null){var g=r.$$typeof;if(g===L){i.tag=11,i=Ov(null,i,r,f,c);break e}else if(g===Y){i.tag=14,i=Dv(null,i,r,f,c);break e}}throw i=pe(r)||r,Error(a(306,i,""))}}return i;case 0:return Nh(r,i,i.type,i.pendingProps,c);case 1:return f=i.type,g=Ti(f,i.pendingProps),zv(r,i,f,g,c);case 3:e:{if(In(i,i.stateNode.containerInfo),r===null)throw Error(a(387));f=i.pendingProps;var v=i.memoizedState;g=v.element,nh(r,i),$l(i,f,null,c);var C=i.memoizedState;if(f=C.cache,ks(i,on,f),f!==v.cache&&Zf(i,[on],c,!0),zl(),f=C.element,v.isDehydrated)if(v={element:f,isDehydrated:!1,cache:C.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=$v(r,i,f,c);break e}else if(f!==g){g=Ma(Error(a(424)),i),Dl(g),i=$v(r,i,f,c);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(zt=Ba(r.firstChild),On=i,ft=!0,ws=null,Da=!0,c=By(i,null,f,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(vi(),f===g){i=Hr(r,i,c);break e}Ln(r,i,f,c)}i=i.child}return i;case 26:return Vu(r,i),r===null?(c=tb(i.type,null,i.pendingProps,null))?i.memoizedState=c:ft||(c=i.type,r=i.pendingProps,f=cd(En.current).createElement(c),f[rn]=i,f[Rn]=r,Bn(f,c,r),sn(f),i.stateNode=f):i.memoizedState=tb(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return _a(i),r===null&&ft&&(f=i.stateNode=Q4(i.type,i.pendingProps,En.current),On=i,Da=!0,g=zt,js(i.type)?(pm=g,zt=Ba(f.firstChild)):zt=g),Ln(r,i,i.pendingProps.children,c),Vu(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&ft&&((g=f=zt)&&(f=Bw(f,i.type,i.pendingProps,Da),f!==null?(i.stateNode=f,On=i,zt=Ba(f.firstChild),Da=!1,g=!0):g=!1),g||Ss(i)),_a(i),g=i.type,v=i.pendingProps,C=r!==null?r.memoizedProps:null,f=v.children,um(g,v)?f=null:C!==null&&um(g,C)&&(i.flags|=32),i.memoizedState!==null&&(g=ch(r,i,Z8,null,null,c),ic._currentValue=g),Vu(r,i),Ln(r,i,f,c),i.child;case 6:return r===null&&ft&&((r=c=zt)&&(c=jw(c,i.pendingProps,Da),c!==null?(i.stateNode=c,On=i,zt=null,r=!0):r=!1),r||Ss(i)),null;case 13:return Hv(r,i,c);case 4:return In(i,i.stateNode.containerInfo),f=i.pendingProps,r===null?i.child=_i(i,null,f,c):Ln(r,i,f,c),i.child;case 11:return Ov(r,i,i.type,i.pendingProps,c);case 7:return Ln(r,i,i.pendingProps,c),i.child;case 8:return Ln(r,i,i.pendingProps.children,c),i.child;case 12:return Ln(r,i,i.pendingProps.children,c),i.child;case 10:return f=i.pendingProps,ks(i,i.type,f.value),Ln(r,i,f.children,c),i.child;case 9:return g=i.type._context,f=i.pendingProps.children,xi(i),g=Dn(g),f=f(g),i.flags|=1,Ln(r,i,f,c),i.child;case 14:return Dv(r,i,i.type,i.pendingProps,c);case 15:return Lv(r,i,i.type,i.pendingProps,c);case 19:return Fv(r,i,c);case 31:return rw(r,i,c);case 22:return Bv(r,i,c,i.pendingProps);case 24:return xi(i),f=Dn(on),r===null?(g=Jf(),g===null&&(g=jt,v=Xf(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=c),g=v),i.memoizedState={parent:f,cache:g},th(i),ks(i,on,g)):((r.lanes&c)!==0&&(nh(r,i),$l(i,null,null,c),zl()),g=r.memoizedState,v=i.memoizedState,g.parent!==f?(g={parent:f,cache:f},i.memoizedState=g,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=g),ks(i,on,f)):(f=v.cache,ks(i,on,f),f!==g.cache&&Zf(i,[on],c,!0))),Ln(r,i,i.pendingProps.children,c),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ur(r){r.flags|=4}function Ph(r,i,c,f,g){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(g&335544128)===g)if(r.stateNode.complete)r.flags|=8192;else if(y4())r.flags|=8192;else throw ki=Ru,eh}else r.flags&=-16777217}function qv(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!ib(i))if(y4())r.flags|=8192;else throw ki=Ru,eh}function Ku(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?cu():536870912,r.lanes|=i,Ao|=i)}function Vl(r,i){if(!ft)switch(r.tailMode){case"hidden":i=r.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:f.sibling=null}}function $t(r){var i=r.alternate!==null&&r.alternate.child===r.child,c=0,f=0;if(i)for(var g=r.child;g!==null;)c|=g.lanes|g.childLanes,f|=g.subtreeFlags&65011712,f|=g.flags&65011712,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)c|=g.lanes|g.childLanes,f|=g.subtreeFlags,f|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=f,r.childLanes=c,i}function iw(r,i,c){var f=i.pendingProps;switch(qf(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $t(i),null;case 1:return $t(i),null;case 3:return c=i.stateNode,f=null,r!==null&&(f=r.memoizedState.cache),i.memoizedState.cache!==f&&(i.flags|=2048),Ir(on),gn(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(mo(i)?Ur(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Wf())),$t(i),null;case 26:var g=i.type,v=i.memoizedState;return r===null?(Ur(i),v!==null?($t(i),qv(i,v)):($t(i),Ph(i,g,null,f,c))):v?v!==r.memoizedState?(Ur(i),$t(i),qv(i,v)):($t(i),i.flags&=-16777217):(r=r.memoizedProps,r!==f&&Ur(i),$t(i),Ph(i,g,r,f,c)),null;case 27:if(Ca(i),c=En.current,g=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==f&&Ur(i);else{if(!f){if(i.stateNode===null)throw Error(a(166));return $t(i),null}r=lt.current,mo(i)?_y(i):(r=Q4(g,f,c),i.stateNode=r,Ur(i))}return $t(i),null;case 5:if(Ca(i),g=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==f&&Ur(i);else{if(!f){if(i.stateNode===null)throw Error(a(166));return $t(i),null}if(v=lt.current,mo(i))_y(i);else{var C=cd(En.current);switch(v){case 1:v=C.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=C.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=C.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=C.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=C.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof f.is=="string"?C.createElement("select",{is:f.is}):C.createElement("select"),f.multiple?v.multiple=!0:f.size&&(v.size=f.size);break;default:v=typeof f.is=="string"?C.createElement(g,{is:f.is}):C.createElement(g)}}v[rn]=i,v[Rn]=f;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)v.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===i)break e;for(;C.sibling===null;){if(C.return===null||C.return===i)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}i.stateNode=v;e:switch(Bn(v,g,f),g){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Ur(i)}}return $t(i),Ph(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,c),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==f&&Ur(i);else{if(typeof f!="string"&&i.stateNode===null)throw Error(a(166));if(r=En.current,mo(i)){if(r=i.stateNode,c=i.memoizedProps,f=null,g=On,g!==null)switch(g.tag){case 27:case 5:f=g.memoizedProps}r[rn]=i,r=!!(r.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||H4(r.nodeValue,c)),r||Ss(i,!0)}else r=cd(r).createTextNode(f),r[rn]=i,i.stateNode=r}return $t(i),null;case 31:if(c=i.memoizedState,r===null||r.memoizedState!==null){if(f=mo(i),c!==null){if(r===null){if(!f)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[rn]=i}else vi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;$t(i),r=!1}else c=Wf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return i.flags&256?(pa(i),i):(pa(i),null);if((i.flags&128)!==0)throw Error(a(558))}return $t(i),null;case 13:if(f=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(g=mo(i),f!==null&&f.dehydrated!==null){if(r===null){if(!g)throw Error(a(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[rn]=i}else vi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;$t(i),g=!1}else g=Wf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(pa(i),i):(pa(i),null)}return pa(i),(i.flags&128)!==0?(i.lanes=c,i):(c=f!==null,r=r!==null&&r.memoizedState!==null,c&&(f=i.child,g=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(g=f.alternate.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==g&&(f.flags|=2048)),c!==r&&c&&(i.child.flags|=8192),Ku(i,i.updateQueue),$t(i),null);case 4:return gn(),r===null&&sm(i.stateNode.containerInfo),$t(i),null;case 10:return Ir(i.type),$t(i),null;case 19:if(ze(en),f=i.memoizedState,f===null)return $t(i),null;if(g=(i.flags&128)!==0,v=f.rendering,v===null)if(g)Vl(f,!1);else{if(Xt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=Bu(r),v!==null){for(i.flags|=128,Vl(f,!1),r=v.updateQueue,i.updateQueue=r,Ku(i,r),i.subtreeFlags=0,r=c,c=i.child;c!==null;)by(c,r),c=c.sibling;return Re(en,en.current&1|2),ft&&jr(i,f.treeForkCount),i.child}r=r.sibling}f.tail!==null&&yt()>Ju&&(i.flags|=128,g=!0,Vl(f,!1),i.lanes=4194304)}else{if(!g)if(r=Bu(v),r!==null){if(i.flags|=128,g=!0,r=r.updateQueue,i.updateQueue=r,Ku(i,r),Vl(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!ft)return $t(i),null}else 2*yt()-f.renderingStartTime>Ju&&c!==536870912&&(i.flags|=128,g=!0,Vl(f,!1),i.lanes=4194304);f.isBackwards?(v.sibling=i.child,i.child=v):(r=f.last,r!==null?r.sibling=v:i.child=v,f.last=v)}return f.tail!==null?(r=f.tail,f.rendering=r,f.tail=r.sibling,f.renderingStartTime=yt(),r.sibling=null,c=en.current,Re(en,g?c&1|2:c&1),ft&&jr(i,f.treeForkCount),r):($t(i),null);case 22:case 23:return pa(i),ih(),f=i.memoizedState!==null,r!==null?r.memoizedState!==null!==f&&(i.flags|=8192):f&&(i.flags|=8192),f?(c&536870912)!==0&&(i.flags&128)===0&&($t(i),i.subtreeFlags&6&&(i.flags|=8192)):$t(i),c=i.updateQueue,c!==null&&Ku(i,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==c&&(i.flags|=2048),r!==null&&ze(wi),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),i.memoizedState.cache!==c&&(i.flags|=2048),Ir(on),$t(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function ow(r,i){switch(qf(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Ir(on),gn(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Ca(i),null;case 31:if(i.memoizedState!==null){if(pa(i),i.alternate===null)throw Error(a(340));vi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(pa(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));vi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return ze(en),null;case 4:return gn(),null;case 10:return Ir(i.type),null;case 22:case 23:return pa(i),ih(),r!==null&&ze(wi),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Ir(on),null;case 25:return null;default:return null}}function Vv(r,i){switch(qf(i),i.tag){case 3:Ir(on),gn();break;case 26:case 27:case 5:Ca(i);break;case 4:gn();break;case 31:i.memoizedState!==null&&pa(i);break;case 13:pa(i);break;case 19:ze(en);break;case 10:Ir(i.type);break;case 22:case 23:pa(i),ih(),r!==null&&ze(wi);break;case 24:Ir(on)}}function Wl(r,i){try{var c=i.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var g=f.next;c=g;do{if((c.tag&r)===r){f=void 0;var v=c.create,C=c.inst;f=v(),C.destroy=f}c=c.next}while(c!==g)}}catch(M){Rt(i,i.return,M)}}function Ns(r,i,c){try{var f=i.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var v=g.next;f=v;do{if((f.tag&r)===r){var C=f.inst,M=C.destroy;if(M!==void 0){C.destroy=void 0,g=i;var z=c,K=M;try{K()}catch(ae){Rt(g,z,ae)}}}f=f.next}while(f!==v)}}catch(ae){Rt(i,i.return,ae)}}function Wv(r){var i=r.updateQueue;if(i!==null){var c=r.stateNode;try{Py(i,c)}catch(f){Rt(r,r.return,f)}}}function Kv(r,i,c){c.props=Ti(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(f){Rt(r,i,f)}}function Kl(r,i){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var f=r.stateNode;break;case 30:f=r.stateNode;break;default:f=r.stateNode}typeof c=="function"?r.refCleanup=c(f):c.current=f}}catch(g){Rt(r,i,g)}}function cr(r,i){var c=r.ref,f=r.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(g){Rt(r,i,g)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){Rt(r,i,g)}else c.current=null}function Yv(r){var i=r.type,c=r.memoizedProps,f=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(g){Rt(r,r.return,g)}}function Ih(r,i,c){try{var f=r.stateNode;Nw(f,r.type,c,i),f[Rn]=i}catch(g){Rt(r,r.return,g)}}function Zv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&js(r.type)||r.tag===4}function zh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Zv(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&js(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function $h(r,i,c){var f=r.tag;if(f===5||f===6)r=r.stateNode,i?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,i):(i=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,i.appendChild(r),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=Dr));else if(f!==4&&(f===27&&js(r.type)&&(c=r.stateNode,i=null),r=r.child,r!==null))for($h(r,i,c),r=r.sibling;r!==null;)$h(r,i,c),r=r.sibling}function Yu(r,i,c){var f=r.tag;if(f===5||f===6)r=r.stateNode,i?c.insertBefore(r,i):c.appendChild(r);else if(f!==4&&(f===27&&js(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Yu(r,i,c),r=r.sibling;r!==null;)Yu(r,i,c),r=r.sibling}function Xv(r){var i=r.stateNode,c=r.memoizedProps;try{for(var f=r.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Bn(i,f,c),i[rn]=r,i[Rn]=c}catch(v){Rt(r,r.return,v)}}var Fr=!1,un=!1,Hh=!1,Qv=typeof WeakSet=="function"?WeakSet:Set,Cn=null;function lw(r,i){if(r=r.containerInfo,lm=gd,r=uy(r),Lf(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var g=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var C=0,M=-1,z=-1,K=0,ae=0,se=r,X=null;t:for(;;){for(var Q;se!==c||g!==0&&se.nodeType!==3||(M=C+g),se!==v||f!==0&&se.nodeType!==3||(z=C+f),se.nodeType===3&&(C+=se.nodeValue.length),(Q=se.firstChild)!==null;)X=se,se=Q;for(;;){if(se===r)break t;if(X===c&&++K===g&&(M=C),X===v&&++ae===f&&(z=C),(Q=se.nextSibling)!==null)break;se=X,X=se.parentNode}se=Q}c=M===-1||z===-1?null:{start:M,end:z}}else c=null}c=c||{start:0,end:0}}else c=null;for(cm={focusedElem:r,selectionRange:c},gd=!1,Cn=i;Cn!==null;)if(i=Cn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,Cn=r;else for(;Cn!==null;){switch(i=Cn,v=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)g=r[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,c=i,g=v.memoizedProps,v=v.memoizedState,f=c.stateNode;try{var Te=Ti(c.type,g);r=f.getSnapshotBeforeUpdate(Te,v),f.__reactInternalSnapshotBeforeUpdate=r}catch(Ie){Rt(c,c.return,Ie)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,c=r.nodeType,c===9)fm(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":fm(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,Cn=r;break}Cn=i.return}}function Jv(r,i,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:qr(r,c),f&4&&Wl(5,c);break;case 1:if(qr(r,c),f&4)if(r=c.stateNode,i===null)try{r.componentDidMount()}catch(C){Rt(c,c.return,C)}else{var g=Ti(c.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(g,i,r.__reactInternalSnapshotBeforeUpdate)}catch(C){Rt(c,c.return,C)}}f&64&&Wv(c),f&512&&Kl(c,c.return);break;case 3:if(qr(r,c),f&64&&(r=c.updateQueue,r!==null)){if(i=null,c.child!==null)switch(c.child.tag){case 27:case 5:i=c.child.stateNode;break;case 1:i=c.child.stateNode}try{Py(r,i)}catch(C){Rt(c,c.return,C)}}break;case 27:i===null&&f&4&&Xv(c);case 26:case 5:qr(r,c),i===null&&f&4&&Yv(c),f&512&&Kl(c,c.return);break;case 12:qr(r,c);break;case 31:qr(r,c),f&4&&n4(r,c);break;case 13:qr(r,c),f&4&&a4(r,c),f&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=yw.bind(null,c),Pw(r,c))));break;case 22:if(f=c.memoizedState!==null||Fr,!f){i=i!==null&&i.memoizedState!==null||un,g=Fr;var v=un;Fr=f,(un=i)&&!v?Vr(r,c,(c.subtreeFlags&8772)!==0):qr(r,c),Fr=g,un=v}break;case 30:break;default:qr(r,c)}}function e4(r){var i=r.alternate;i!==null&&(r.alternate=null,e4(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&bl(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Ut=null,na=!1;function Gr(r,i,c){for(c=c.child;c!==null;)t4(r,i,c),c=c.sibling}function t4(r,i,c){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(gs,c)}catch{}switch(c.tag){case 26:un||cr(c,i),Gr(r,i,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:un||cr(c,i);var f=Ut,g=na;js(c.type)&&(Ut=c.stateNode,na=!1),Gr(r,i,c),ac(c.stateNode),Ut=f,na=g;break;case 5:un||cr(c,i);case 6:if(f=Ut,g=na,Ut=null,Gr(r,i,c),Ut=f,na=g,Ut!==null)if(na)try{(Ut.nodeType===9?Ut.body:Ut.nodeName==="HTML"?Ut.ownerDocument.body:Ut).removeChild(c.stateNode)}catch(v){Rt(c,i,v)}else try{Ut.removeChild(c.stateNode)}catch(v){Rt(c,i,v)}break;case 18:Ut!==null&&(na?(r=Ut,W4(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),Bo(r)):W4(Ut,c.stateNode));break;case 4:f=Ut,g=na,Ut=c.stateNode.containerInfo,na=!0,Gr(r,i,c),Ut=f,na=g;break;case 0:case 11:case 14:case 15:Ns(2,c,i),un||Ns(4,c,i),Gr(r,i,c);break;case 1:un||(cr(c,i),f=c.stateNode,typeof f.componentWillUnmount=="function"&&Kv(c,i,f)),Gr(r,i,c);break;case 21:Gr(r,i,c);break;case 22:un=(f=un)||c.memoizedState!==null,Gr(r,i,c),un=f;break;default:Gr(r,i,c)}}function n4(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Bo(r)}catch(c){Rt(i,i.return,c)}}}function a4(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Bo(r)}catch(c){Rt(i,i.return,c)}}function cw(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new Qv),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new Qv),i;default:throw Error(a(435,r.tag))}}function Zu(r,i){var c=cw(r);i.forEach(function(f){if(!c.has(f)){c.add(f);var g=vw.bind(null,r,f);f.then(g,g)}})}function aa(r,i){var c=i.deletions;if(c!==null)for(var f=0;f<c.length;f++){var g=c[f],v=r,C=i,M=C;e:for(;M!==null;){switch(M.tag){case 27:if(js(M.type)){Ut=M.stateNode,na=!1;break e}break;case 5:Ut=M.stateNode,na=!1;break e;case 3:case 4:Ut=M.stateNode.containerInfo,na=!0;break e}M=M.return}if(Ut===null)throw Error(a(160));t4(v,C,g),Ut=null,na=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)r4(i,r),i=i.sibling}var Za=null;function r4(r,i){var c=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:aa(i,r),ra(r),f&4&&(Ns(3,r,r.return),Wl(3,r),Ns(5,r,r.return));break;case 1:aa(i,r),ra(r),f&512&&(un||c===null||cr(c,c.return)),f&64&&Fr&&(r=r.updateQueue,r!==null&&(f=r.callbacks,f!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var g=Za;if(aa(i,r),ra(r),f&512&&(un||c===null||cr(c,c.return)),f&4){var v=c!==null?c.memoizedState:null;if(f=r.memoizedState,c===null)if(f===null)if(r.stateNode===null){e:{f=r.type,c=r.memoizedProps,g=g.ownerDocument||g;t:switch(f){case"title":v=g.getElementsByTagName("title")[0],(!v||v[di]||v[rn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(f),g.head.insertBefore(v,g.querySelector("head > title"))),Bn(v,f,c),v[rn]=r,sn(v),f=v;break e;case"link":var C=rb("link","href",g).get(f+(c.href||""));if(C){for(var M=0;M<C.length;M++)if(v=C[M],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){C.splice(M,1);break t}}v=g.createElement(f),Bn(v,f,c),g.head.appendChild(v);break;case"meta":if(C=rb("meta","content",g).get(f+(c.content||""))){for(M=0;M<C.length;M++)if(v=C[M],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){C.splice(M,1);break t}}v=g.createElement(f),Bn(v,f,c),g.head.appendChild(v);break;default:throw Error(a(468,f))}v[rn]=r,sn(v),f=v}r.stateNode=f}else sb(g,r.type,r.stateNode);else r.stateNode=ab(g,f,r.memoizedProps);else v!==f?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,f===null?sb(g,r.type,r.stateNode):ab(g,f,r.memoizedProps)):f===null&&r.stateNode!==null&&Ih(r,r.memoizedProps,c.memoizedProps)}break;case 27:aa(i,r),ra(r),f&512&&(un||c===null||cr(c,c.return)),c!==null&&f&4&&Ih(r,r.memoizedProps,c.memoizedProps);break;case 5:if(aa(i,r),ra(r),f&512&&(un||c===null||cr(c,c.return)),r.flags&32){g=r.stateNode;try{ao(g,"")}catch(Te){Rt(r,r.return,Te)}}f&4&&r.stateNode!=null&&(g=r.memoizedProps,Ih(r,g,c!==null?c.memoizedProps:g)),f&1024&&(Hh=!0);break;case 6:if(aa(i,r),ra(r),f&4){if(r.stateNode===null)throw Error(a(162));f=r.memoizedProps,c=r.stateNode;try{c.nodeValue=f}catch(Te){Rt(r,r.return,Te)}}break;case 3:if(fd=null,g=Za,Za=ud(i.containerInfo),aa(i,r),Za=g,ra(r),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Bo(i.containerInfo)}catch(Te){Rt(r,r.return,Te)}Hh&&(Hh=!1,s4(r));break;case 4:f=Za,Za=ud(r.stateNode.containerInfo),aa(i,r),ra(r),Za=f;break;case 12:aa(i,r),ra(r);break;case 31:aa(i,r),ra(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Zu(r,f)));break;case 13:aa(i,r),ra(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Qu=yt()),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Zu(r,f)));break;case 22:g=r.memoizedState!==null;var z=c!==null&&c.memoizedState!==null,K=Fr,ae=un;if(Fr=K||g,un=ae||z,aa(i,r),un=ae,Fr=K,ra(r),f&8192)e:for(i=r.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(c===null||z||Fr||un||Ai(r)),c=null,i=r;;){if(i.tag===5||i.tag===26){if(c===null){z=c=i;try{if(v=z.stateNode,g)C=v.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{M=z.stateNode;var se=z.memoizedProps.style,X=se!=null&&se.hasOwnProperty("display")?se.display:null;M.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(Te){Rt(z,z.return,Te)}}}else if(i.tag===6){if(c===null){z=i;try{z.stateNode.nodeValue=g?"":z.memoizedProps}catch(Te){Rt(z,z.return,Te)}}}else if(i.tag===18){if(c===null){z=i;try{var Q=z.stateNode;g?K4(Q,!0):K4(z.stateNode,!1)}catch(Te){Rt(z,z.return,Te)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;c===i&&(c=null),i=i.return}c===i&&(c=null),i.sibling.return=i.return,i=i.sibling}f&4&&(f=r.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,Zu(r,c))));break;case 19:aa(i,r),ra(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Zu(r,f)));break;case 30:break;case 21:break;default:aa(i,r),ra(r)}}function ra(r){var i=r.flags;if(i&2){try{for(var c,f=r.return;f!==null;){if(Zv(f)){c=f;break}f=f.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var g=c.stateNode,v=zh(r);Yu(r,v,g);break;case 5:var C=c.stateNode;c.flags&32&&(ao(C,""),c.flags&=-33);var M=zh(r);Yu(r,M,C);break;case 3:case 4:var z=c.stateNode.containerInfo,K=zh(r);$h(r,K,z);break;default:throw Error(a(161))}}catch(ae){Rt(r,r.return,ae)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function s4(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;s4(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function qr(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Jv(r,i.alternate,i),i=i.sibling}function Ai(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ns(4,i,i.return),Ai(i);break;case 1:cr(i,i.return);var c=i.stateNode;typeof c.componentWillUnmount=="function"&&Kv(i,i.return,c),Ai(i);break;case 27:ac(i.stateNode);case 26:case 5:cr(i,i.return),Ai(i);break;case 22:i.memoizedState===null&&Ai(i);break;case 30:Ai(i);break;default:Ai(i)}r=r.sibling}}function Vr(r,i,c){for(c=c&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var f=i.alternate,g=r,v=i,C=v.flags;switch(v.tag){case 0:case 11:case 15:Vr(g,v,c),Wl(4,v);break;case 1:if(Vr(g,v,c),f=v,g=f.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(K){Rt(f,f.return,K)}if(f=v,g=f.updateQueue,g!==null){var M=f.stateNode;try{var z=g.shared.hiddenCallbacks;if(z!==null)for(g.shared.hiddenCallbacks=null,g=0;g<z.length;g++)jy(z[g],M)}catch(K){Rt(f,f.return,K)}}c&&C&64&&Wv(v),Kl(v,v.return);break;case 27:Xv(v);case 26:case 5:Vr(g,v,c),c&&f===null&&C&4&&Yv(v),Kl(v,v.return);break;case 12:Vr(g,v,c);break;case 31:Vr(g,v,c),c&&C&4&&n4(g,v);break;case 13:Vr(g,v,c),c&&C&4&&a4(g,v);break;case 22:v.memoizedState===null&&Vr(g,v,c),Kl(v,v.return);break;case 30:break;default:Vr(g,v,c)}i=i.sibling}}function Uh(r,i){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&Ll(c))}function Fh(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Ll(r))}function Xa(r,i,c,f){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)i4(r,i,c,f),i=i.sibling}function i4(r,i,c,f){var g=i.flags;switch(i.tag){case 0:case 11:case 15:Xa(r,i,c,f),g&2048&&Wl(9,i);break;case 1:Xa(r,i,c,f);break;case 3:Xa(r,i,c,f),g&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Ll(r)));break;case 12:if(g&2048){Xa(r,i,c,f),r=i.stateNode;try{var v=i.memoizedProps,C=v.id,M=v.onPostCommit;typeof M=="function"&&M(C,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(z){Rt(i,i.return,z)}}else Xa(r,i,c,f);break;case 31:Xa(r,i,c,f);break;case 13:Xa(r,i,c,f);break;case 23:break;case 22:v=i.stateNode,C=i.alternate,i.memoizedState!==null?v._visibility&2?Xa(r,i,c,f):Yl(r,i):v._visibility&2?Xa(r,i,c,f):(v._visibility|=2,_o(r,i,c,f,(i.subtreeFlags&10256)!==0||!1)),g&2048&&Uh(C,i);break;case 24:Xa(r,i,c,f),g&2048&&Fh(i.alternate,i);break;default:Xa(r,i,c,f)}}function _o(r,i,c,f,g){for(g=g&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,C=i,M=c,z=f,K=C.flags;switch(C.tag){case 0:case 11:case 15:_o(v,C,M,z,g),Wl(8,C);break;case 23:break;case 22:var ae=C.stateNode;C.memoizedState!==null?ae._visibility&2?_o(v,C,M,z,g):Yl(v,C):(ae._visibility|=2,_o(v,C,M,z,g)),g&&K&2048&&Uh(C.alternate,C);break;case 24:_o(v,C,M,z,g),g&&K&2048&&Fh(C.alternate,C);break;default:_o(v,C,M,z,g)}i=i.sibling}}function Yl(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var c=r,f=i,g=f.flags;switch(f.tag){case 22:Yl(c,f),g&2048&&Uh(f.alternate,f);break;case 24:Yl(c,f),g&2048&&Fh(f.alternate,f);break;default:Yl(c,f)}i=i.sibling}}var Zl=8192;function Co(r,i,c){if(r.subtreeFlags&Zl)for(r=r.child;r!==null;)o4(r,i,c),r=r.sibling}function o4(r,i,c){switch(r.tag){case 26:Co(r,i,c),r.flags&Zl&&r.memoizedState!==null&&Yw(c,Za,r.memoizedState,r.memoizedProps);break;case 5:Co(r,i,c);break;case 3:case 4:var f=Za;Za=ud(r.stateNode.containerInfo),Co(r,i,c),Za=f;break;case 22:r.memoizedState===null&&(f=r.alternate,f!==null&&f.memoizedState!==null?(f=Zl,Zl=16777216,Co(r,i,c),Zl=f):Co(r,i,c));break;default:Co(r,i,c)}}function l4(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function Xl(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var f=i[c];Cn=f,u4(f,r)}l4(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)c4(r),r=r.sibling}function c4(r){switch(r.tag){case 0:case 11:case 15:Xl(r),r.flags&2048&&Ns(9,r,r.return);break;case 3:Xl(r);break;case 12:Xl(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Xu(r)):Xl(r);break;default:Xl(r)}}function Xu(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var f=i[c];Cn=f,u4(f,r)}l4(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ns(8,i,i.return),Xu(i);break;case 22:c=i.stateNode,c._visibility&2&&(c._visibility&=-3,Xu(i));break;default:Xu(i)}r=r.sibling}}function u4(r,i){for(;Cn!==null;){var c=Cn;switch(c.tag){case 0:case 11:case 15:Ns(8,c,i);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Ll(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,Cn=f;else e:for(c=r;Cn!==null;){f=Cn;var g=f.sibling,v=f.return;if(e4(f),f===c){Cn=null;break e}if(g!==null){g.return=v,Cn=g;break e}Cn=v}}}var uw={getCacheForType:function(r){var i=Dn(on),c=i.data.get(r);return c===void 0&&(c=r(),i.data.set(r,c)),c},cacheSignal:function(){return Dn(on).controller.signal}},dw=typeof WeakMap=="function"?WeakMap:Map,_t=0,jt=null,it=null,ut=0,Mt=0,ga=null,Ms=!1,To=!1,Gh=!1,Wr=0,Xt=0,Rs=0,Ei=0,qh=0,ya=0,Ao=0,Ql=null,sa=null,Vh=!1,Qu=0,d4=0,Ju=1/0,ed=null,Os=null,vn=0,Ds=null,Eo=null,Kr=0,Wh=0,Kh=null,f4=null,Jl=0,Yh=null;function va(){return(_t&2)!==0&&ut!==0?ut&-ut:q.T!==null?tm():yl()}function h4(){if(ya===0)if((ut&536870912)===0||ft){var r=Xi;Xi<<=1,(Xi&3932160)===0&&(Xi=262144),ya=r}else ya=536870912;return r=ma.current,r!==null&&(r.flags|=32),ya}function ia(r,i,c){(r===jt&&(Mt===2||Mt===9)||r.cancelPendingCommit!==null)&&(No(r,0),Ls(r,ut,ya,!1)),Nr(r,c),((_t&2)===0||r!==jt)&&(r===jt&&((_t&2)===0&&(Ei|=c),Xt===4&&Ls(r,ut,ya,!1)),ur(r))}function m4(r,i,c){if((_t&6)!==0)throw Error(a(327));var f=!c&&(i&127)===0&&(i&r.expiredLanes)===0||ys(r,i),g=f?mw(r,i):Xh(r,i,!0),v=f;do{if(g===0){To&&!f&&Ls(r,i,0,!1);break}else{if(c=r.current.alternate,v&&!fw(c)){g=Xh(r,i,!1),v=!1;continue}if(g===2){if(v=i,r.errorRecoveryDisabledLanes&v)var C=0;else C=r.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){i=C;e:{var M=r;g=Ql;var z=M.current.memoizedState.isDehydrated;if(z&&(No(M,C).flags|=256),C=Xh(M,C,!1),C!==2){if(Gh&&!z){M.errorRecoveryDisabledLanes|=v,Ei|=v,g=4;break e}v=sa,sa=g,v!==null&&(sa===null?sa=v:sa.push.apply(sa,v))}g=C}if(v=!1,g!==2)continue}}if(g===1){No(r,0),Ls(r,i,0,!0);break}e:{switch(f=r,v=g,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Ls(f,i,ya,!Ms);break e;case 2:sa=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(g=Qu+300-yt(),10<g)){if(Ls(f,i,ya,!Ms),Qi(f,0,!0)!==0)break e;Kr=i,f.timeoutHandle=q4(p4.bind(null,f,c,sa,ed,Vh,i,ya,Ei,Ao,Ms,v,"Throttled",-0,0),g);break e}p4(f,c,sa,ed,Vh,i,ya,Ei,Ao,Ms,v,null,-0,0)}}break}while(!0);ur(r)}function p4(r,i,c,f,g,v,C,M,z,K,ae,se,X,Q){if(r.timeoutHandle=-1,se=i.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Dr},o4(i,v,se);var Te=(v&62914560)===v?Qu-yt():(v&4194048)===v?d4-yt():0;if(Te=Zw(se,Te),Te!==null){Kr=v,r.cancelPendingCommit=Te(k4.bind(null,r,i,v,c,f,g,C,M,z,ae,se,null,X,Q)),Ls(r,v,C,!K);return}}k4(r,i,v,c,f,g,C,M,z)}function fw(r){for(var i=r;;){var c=i.tag;if((c===0||c===11||c===15)&&i.flags&16384&&(c=i.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var g=c[f],v=g.getSnapshot;g=g.value;try{if(!fa(v(),g))return!1}catch{return!1}}if(c=i.child,i.subtreeFlags&16384&&c!==null)c.return=i,i=c;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ls(r,i,c,f){i&=~qh,i&=~Ei,r.suspendedLanes|=i,r.pingedLanes&=~i,f&&(r.warmLanes|=i),f=r.expirationTimes;for(var g=i;0<g;){var v=31-Mn(g),C=1<<v;f[v]=-1,g&=~C}c!==0&&Mr(r,c,i)}function td(){return(_t&6)===0?(ec(0),!1):!0}function Zh(){if(it!==null){if(Mt===0)var r=it.return;else r=it,Pr=bi=null,fh(r),bo=null,jl=0,r=it;for(;r!==null;)Vv(r.alternate,r),r=r.return;it=null}}function No(r,i){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,Ow(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Kr=0,Zh(),jt=r,it=c=Br(r.current,null),ut=i,Mt=0,ga=null,Ms=!1,To=ys(r,i),Gh=!1,Ao=ya=qh=Ei=Rs=Xt=0,sa=Ql=null,Vh=!1,(i&8)!==0&&(i|=i&32);var f=r.entangledLanes;if(f!==0)for(r=r.entanglements,f&=i;0<f;){var g=31-Mn(f),v=1<<g;i|=r[g],f&=~v}return Wr=i,Su(),c}function g4(r,i){tt=null,q.H=Gl,i===vo||i===Mu?(i=Oy(),Mt=3):i===eh?(i=Oy(),Mt=4):Mt=i===Eh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,ga=i,it===null&&(Xt=1,Gu(r,Ma(i,r.current)))}function y4(){var r=ma.current;return r===null?!0:(ut&4194048)===ut?La===null:(ut&62914560)===ut||(ut&536870912)!==0?r===La:!1}function v4(){var r=q.H;return q.H=Gl,r===null?Gl:r}function b4(){var r=q.A;return q.A=uw,r}function nd(){Xt=4,Ms||(ut&4194048)!==ut&&ma.current!==null||(To=!0),(Rs&134217727)===0&&(Ei&134217727)===0||jt===null||Ls(jt,ut,ya,!1)}function Xh(r,i,c){var f=_t;_t|=2;var g=v4(),v=b4();(jt!==r||ut!==i)&&(ed=null,No(r,i)),i=!1;var C=Xt;e:do try{if(Mt!==0&&it!==null){var M=it,z=ga;switch(Mt){case 8:Zh(),C=6;break e;case 3:case 2:case 9:case 6:ma.current===null&&(i=!0);var K=Mt;if(Mt=0,ga=null,Mo(r,M,z,K),c&&To){C=0;break e}break;default:K=Mt,Mt=0,ga=null,Mo(r,M,z,K)}}hw(),C=Xt;break}catch(ae){g4(r,ae)}while(!0);return i&&r.shellSuspendCounter++,Pr=bi=null,_t=f,q.H=g,q.A=v,it===null&&(jt=null,ut=0,Su()),C}function hw(){for(;it!==null;)x4(it)}function mw(r,i){var c=_t;_t|=2;var f=v4(),g=b4();jt!==r||ut!==i?(ed=null,Ju=yt()+500,No(r,i)):To=ys(r,i);e:do try{if(Mt!==0&&it!==null){i=it;var v=ga;t:switch(Mt){case 1:Mt=0,ga=null,Mo(r,i,v,1);break;case 2:case 9:if(My(v)){Mt=0,ga=null,w4(i);break}i=function(){Mt!==2&&Mt!==9||jt!==r||(Mt=7),ur(r)},v.then(i,i);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:My(v)?(Mt=0,ga=null,w4(i)):(Mt=0,ga=null,Mo(r,i,v,7));break;case 5:var C=null;switch(it.tag){case 26:C=it.memoizedState;case 5:case 27:var M=it;if(C?ib(C):M.stateNode.complete){Mt=0,ga=null;var z=M.sibling;if(z!==null)it=z;else{var K=M.return;K!==null?(it=K,ad(K)):it=null}break t}}Mt=0,ga=null,Mo(r,i,v,5);break;case 6:Mt=0,ga=null,Mo(r,i,v,6);break;case 8:Zh(),Xt=6;break e;default:throw Error(a(462))}}pw();break}catch(ae){g4(r,ae)}while(!0);return Pr=bi=null,q.H=f,q.A=g,_t=c,it!==null?0:(jt=null,ut=0,Su(),Xt)}function pw(){for(;it!==null&&!Jt();)x4(it)}function x4(r){var i=Gv(r.alternate,r,Wr);r.memoizedProps=r.pendingProps,i===null?ad(r):it=i}function w4(r){var i=r,c=i.alternate;switch(i.tag){case 15:case 0:i=Iv(c,i,i.pendingProps,i.type,void 0,ut);break;case 11:i=Iv(c,i,i.pendingProps,i.type.render,i.ref,ut);break;case 5:fh(i);default:Vv(c,i),i=it=by(i,Wr),i=Gv(c,i,Wr)}r.memoizedProps=r.pendingProps,i===null?ad(r):it=i}function Mo(r,i,c,f){Pr=bi=null,fh(i),bo=null,jl=0;var g=i.return;try{if(aw(r,g,i,c,ut)){Xt=1,Gu(r,Ma(c,r.current)),it=null;return}}catch(v){if(g!==null)throw it=g,v;Xt=1,Gu(r,Ma(c,r.current)),it=null;return}i.flags&32768?(ft||f===1?r=!0:To||(ut&536870912)!==0?r=!1:(Ms=r=!0,(f===2||f===9||f===3||f===6)&&(f=ma.current,f!==null&&f.tag===13&&(f.flags|=16384))),S4(i,r)):ad(i)}function ad(r){var i=r;do{if((i.flags&32768)!==0){S4(i,Ms);return}r=i.return;var c=iw(i.alternate,i,Wr);if(c!==null){it=c;return}if(i=i.sibling,i!==null){it=i;return}it=i=r}while(i!==null);Xt===0&&(Xt=5)}function S4(r,i){do{var c=ow(r.alternate,r);if(c!==null){c.flags&=32767,it=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!i&&(r=r.sibling,r!==null)){it=r;return}it=r=c}while(r!==null);Xt=6,it=null}function k4(r,i,c,f,g,v,C,M,z){r.cancelPendingCommit=null;do rd();while(vn!==0);if((_t&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=zf,uu(r,c,v,C,M,z),r===jt&&(it=jt=null,ut=0),Eo=i,Ds=r,Kr=c,Wh=v,Kh=g,f4=f,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,bw(ca,function(){return E4(),null})):(r.callbackNode=null,r.callbackPriority=0),f=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||f){f=q.T,q.T=null,g=oe.p,oe.p=2,C=_t,_t|=4;try{lw(r,i,c)}finally{_t=C,oe.p=g,q.T=f}}vn=1,_4(),C4(),T4()}}function _4(){if(vn===1){vn=0;var r=Ds,i=Eo,c=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||c){c=q.T,q.T=null;var f=oe.p;oe.p=2;var g=_t;_t|=4;try{r4(i,r);var v=cm,C=uy(r.containerInfo),M=v.focusedElem,z=v.selectionRange;if(C!==M&&M&&M.ownerDocument&&cy(M.ownerDocument.documentElement,M)){if(z!==null&&Lf(M)){var K=z.start,ae=z.end;if(ae===void 0&&(ae=K),"selectionStart"in M)M.selectionStart=K,M.selectionEnd=Math.min(ae,M.value.length);else{var se=M.ownerDocument||document,X=se&&se.defaultView||window;if(X.getSelection){var Q=X.getSelection(),Te=M.textContent.length,Ie=Math.min(z.start,Te),Bt=z.end===void 0?Ie:Math.min(z.end,Te);!Q.extend&&Ie>Bt&&(C=Bt,Bt=Ie,Ie=C);var G=ly(M,Ie),$=ly(M,Bt);if(G&&$&&(Q.rangeCount!==1||Q.anchorNode!==G.node||Q.anchorOffset!==G.offset||Q.focusNode!==$.node||Q.focusOffset!==$.offset)){var W=se.createRange();W.setStart(G.node,G.offset),Q.removeAllRanges(),Ie>Bt?(Q.addRange(W),Q.extend($.node,$.offset)):(W.setEnd($.node,$.offset),Q.addRange(W))}}}}for(se=[],Q=M;Q=Q.parentNode;)Q.nodeType===1&&se.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<se.length;M++){var re=se[M];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}gd=!!lm,cm=lm=null}finally{_t=g,oe.p=f,q.T=c}}r.current=i,vn=2}}function C4(){if(vn===2){vn=0;var r=Ds,i=Eo,c=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||c){c=q.T,q.T=null;var f=oe.p;oe.p=2;var g=_t;_t|=4;try{Jv(r,i.alternate,i)}finally{_t=g,oe.p=f,q.T=c}}vn=3}}function T4(){if(vn===4||vn===3){vn=0,Ht();var r=Ds,i=Eo,c=Kr,f=f4;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?vn=5:(vn=0,Eo=Ds=null,A4(r,r.pendingLanes));var g=r.pendingLanes;if(g===0&&(Os=null),gl(c),i=i.stateNode,$n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(gs,i,void 0,(i.current.flags&128)===128)}catch{}if(f!==null){i=q.T,g=oe.p,oe.p=2,q.T=null;try{for(var v=r.onRecoverableError,C=0;C<f.length;C++){var M=f[C];v(M.value,{componentStack:M.stack})}}finally{q.T=i,oe.p=g}}(Kr&3)!==0&&rd(),ur(r),g=r.pendingLanes,(c&261930)!==0&&(g&42)!==0?r===Yh?Jl++:(Jl=0,Yh=r):Jl=0,ec(0)}}function A4(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Ll(i)))}function rd(){return _4(),C4(),T4(),E4()}function E4(){if(vn!==5)return!1;var r=Ds,i=Wh;Wh=0;var c=gl(Kr),f=q.T,g=oe.p;try{oe.p=32>c?32:c,q.T=null,c=Kh,Kh=null;var v=Ds,C=Kr;if(vn=0,Eo=Ds=null,Kr=0,(_t&6)!==0)throw Error(a(331));var M=_t;if(_t|=4,c4(v.current),i4(v,v.current,C,c),_t=M,ec(0,!1),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(gs,v)}catch{}return!0}finally{oe.p=g,q.T=f,A4(r,i)}}function N4(r,i,c){i=Ma(c,i),i=Ah(r.stateNode,i,2),r=Ts(r,i,2),r!==null&&(Nr(r,2),ur(r))}function Rt(r,i,c){if(r.tag===3)N4(r,r,c);else for(;i!==null;){if(i.tag===3){N4(i,r,c);break}else if(i.tag===1){var f=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Os===null||!Os.has(f))){r=Ma(c,r),c=Mv(2),f=Ts(i,c,2),f!==null&&(Rv(c,f,i,r),Nr(f,2),ur(f));break}}i=i.return}}function Qh(r,i,c){var f=r.pingCache;if(f===null){f=r.pingCache=new dw;var g=new Set;f.set(i,g)}else g=f.get(i),g===void 0&&(g=new Set,f.set(i,g));g.has(c)||(Gh=!0,g.add(c),r=gw.bind(null,r,i,c),i.then(r,r))}function gw(r,i,c){var f=r.pingCache;f!==null&&f.delete(i),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,jt===r&&(ut&c)===c&&(Xt===4||Xt===3&&(ut&62914560)===ut&&300>yt()-Qu?(_t&2)===0&&No(r,0):qh|=c,Ao===ut&&(Ao=0)),ur(r)}function M4(r,i){i===0&&(i=cu()),r=gi(r,i),r!==null&&(Nr(r,i),ur(r))}function yw(r){var i=r.memoizedState,c=0;i!==null&&(c=i.retryLane),M4(r,c)}function vw(r,i){var c=0;switch(r.tag){case 31:case 13:var f=r.stateNode,g=r.memoizedState;g!==null&&(c=g.retryLane);break;case 19:f=r.stateNode;break;case 22:f=r.stateNode._retryCache;break;default:throw Error(a(314))}f!==null&&f.delete(i),M4(r,c)}function bw(r,i){return Ge(r,i)}var sd=null,Ro=null,Jh=!1,id=!1,em=!1,Bs=0;function ur(r){r!==Ro&&r.next===null&&(Ro===null?sd=Ro=r:Ro=Ro.next=r),id=!0,Jh||(Jh=!0,ww())}function ec(r,i){if(!em&&id){em=!0;do for(var c=!1,f=sd;f!==null;){if(r!==0){var g=f.pendingLanes;if(g===0)var v=0;else{var C=f.suspendedLanes,M=f.pingedLanes;v=(1<<31-Mn(42|r)+1)-1,v&=g&~(C&~M),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,L4(f,v))}else v=ut,v=Qi(f,f===jt?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||ys(f,v)||(c=!0,L4(f,v));f=f.next}while(c);em=!1}}function xw(){R4()}function R4(){id=Jh=!1;var r=0;Bs!==0&&Rw()&&(r=Bs);for(var i=yt(),c=null,f=sd;f!==null;){var g=f.next,v=O4(f,i);v===0?(f.next=null,c===null?sd=g:c.next=g,g===null&&(Ro=c)):(c=f,(r!==0||(v&3)!==0)&&(id=!0)),f=g}vn!==0&&vn!==5||ec(r),Bs!==0&&(Bs=0)}function O4(r,i){for(var c=r.suspendedLanes,f=r.pingedLanes,g=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var C=31-Mn(v),M=1<<C,z=g[C];z===-1?((M&c)===0||(M&f)!==0)&&(g[C]=Ji(M,i)):z<=i&&(r.expiredLanes|=M),v&=~M}if(i=jt,c=ut,c=Qi(r,r===i?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f=r.callbackNode,c===0||r===i&&(Mt===2||Mt===9)||r.cancelPendingCommit!==null)return f!==null&&f!==null&&At(f),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||ys(r,c)){if(i=c&-c,i===r.callbackPriority)return i;switch(f!==null&&At(f),gl(c)){case 2:case 8:c=ps;break;case 32:c=ca;break;case 268435456:c=zn;break;default:c=ca}return f=D4.bind(null,r),c=Ge(c,f),r.callbackPriority=i,r.callbackNode=c,i}return f!==null&&f!==null&&At(f),r.callbackPriority=2,r.callbackNode=null,2}function D4(r,i){if(vn!==0&&vn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(rd()&&r.callbackNode!==c)return null;var f=ut;return f=Qi(r,r===jt?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f===0?null:(m4(r,f,i),O4(r,yt()),r.callbackNode!=null&&r.callbackNode===c?D4.bind(null,r):null)}function L4(r,i){if(rd())return null;m4(r,i,!0)}function ww(){Dw(function(){(_t&6)!==0?Ge(rr,xw):R4()})}function tm(){if(Bs===0){var r=go;r===0&&(r=Zi,Zi<<=1,(Zi&261888)===0&&(Zi=256)),Bs=r}return Bs}function B4(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:mu(""+r)}function j4(r,i){var c=i.ownerDocument.createElement("input");return c.name=i.name,c.value=i.value,r.id&&c.setAttribute("form",r.id),i.parentNode.insertBefore(c,i),r=new FormData(r),c.parentNode.removeChild(c),r}function Sw(r,i,c,f,g){if(i==="submit"&&c&&c.stateNode===g){var v=B4((g[Rn]||null).action),C=f.submitter;C&&(i=(i=C[Rn]||null)?B4(i.formAction):C.getAttribute("formAction"),i!==null&&(v=i,C=null));var M=new vu("action","action",null,f,g);r.push({event:M,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Bs!==0){var z=C?j4(g,C):new FormData(g);wh(c,{pending:!0,data:z,method:g.method,action:v},null,z)}}else typeof v=="function"&&(M.preventDefault(),z=C?j4(g,C):new FormData(g),wh(c,{pending:!0,data:z,method:g.method,action:v},v,z))},currentTarget:g}]})}}for(var nm=0;nm<If.length;nm++){var am=If[nm],kw=am.toLowerCase(),_w=am[0].toUpperCase()+am.slice(1);Ya(kw,"on"+_w)}Ya(hy,"onAnimationEnd"),Ya(my,"onAnimationIteration"),Ya(py,"onAnimationStart"),Ya("dblclick","onDoubleClick"),Ya("focusin","onFocus"),Ya("focusout","onBlur"),Ya($8,"onTransitionRun"),Ya(H8,"onTransitionStart"),Ya(U8,"onTransitionCancel"),Ya(gy,"onTransitionEnd"),Le("onMouseEnter",["mouseout","mouseover"]),Le("onMouseLeave",["mouseout","mouseover"]),Le("onPointerEnter",["pointerout","pointerover"]),Le("onPointerLeave",["pointerout","pointerover"]),ue("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ue("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ue("onBeforeInput",["compositionend","keypress","textInput","paste"]),ue("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ue("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ue("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Cw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tc));function P4(r,i){i=(i&4)!==0;for(var c=0;c<r.length;c++){var f=r[c],g=f.event;f=f.listeners;e:{var v=void 0;if(i)for(var C=f.length-1;0<=C;C--){var M=f[C],z=M.instance,K=M.currentTarget;if(M=M.listener,z!==v&&g.isPropagationStopped())break e;v=M,g.currentTarget=K;try{v(g)}catch(ae){wu(ae)}g.currentTarget=null,v=z}else for(C=0;C<f.length;C++){if(M=f[C],z=M.instance,K=M.currentTarget,M=M.listener,z!==v&&g.isPropagationStopped())break e;v=M,g.currentTarget=K;try{v(g)}catch(ae){wu(ae)}g.currentTarget=null,v=z}}}}function ot(r,i){var c=i[ui];c===void 0&&(c=i[ui]=new Set);var f=r+"__bubble";c.has(f)||(I4(i,r,2,!1),c.add(f))}function rm(r,i,c){var f=0;i&&(f|=4),I4(c,r,f,i)}var od="_reactListening"+Math.random().toString(36).slice(2);function sm(r){if(!r[od]){r[od]=!0,U.forEach(function(c){c!=="selectionchange"&&(Cw.has(c)||rm(c,!1,r),rm(c,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[od]||(i[od]=!0,rm("selectionchange",!1,i))}}function I4(r,i,c,f){switch(hb(i)){case 2:var g=Jw;break;case 8:g=eS;break;default:g=xm}c=g.bind(null,i,c,r),g=void 0,!Cf||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(g=!0),f?g!==void 0?r.addEventListener(i,c,{capture:!0,passive:g}):r.addEventListener(i,c,!0):g!==void 0?r.addEventListener(i,c,{passive:g}):r.addEventListener(i,c,!1)}function im(r,i,c,f,g){var v=f;if((i&1)===0&&(i&2)===0&&f!==null)e:for(;;){if(f===null)return;var C=f.tag;if(C===3||C===4){var M=f.stateNode.containerInfo;if(M===g)break;if(C===4)for(C=f.return;C!==null;){var z=C.tag;if((z===3||z===4)&&C.stateNode.containerInfo===g)return;C=C.return}for(;M!==null;){if(C=vs(M),C===null)return;if(z=C.tag,z===5||z===6||z===26||z===27){f=v=C;continue e}M=M.parentNode}}f=f.return}F1(function(){var K=v,ae=kf(c),se=[];e:{var X=yy.get(r);if(X!==void 0){var Q=vu,Te=r;switch(r){case"keypress":if(gu(c)===0)break e;case"keydown":case"keyup":Q=v8;break;case"focusin":Te="focus",Q=Nf;break;case"focusout":Te="blur",Q=Nf;break;case"beforeblur":case"afterblur":Q=Nf;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=V1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=i8;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=w8;break;case hy:case my:case py:Q=c8;break;case gy:Q=k8;break;case"scroll":case"scrollend":Q=r8;break;case"wheel":Q=C8;break;case"copy":case"cut":case"paste":Q=d8;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=K1;break;case"toggle":case"beforetoggle":Q=A8}var Ie=(i&4)!==0,Bt=!Ie&&(r==="scroll"||r==="scrollend"),G=Ie?X!==null?X+"Capture":null:X;Ie=[];for(var $=K,W;$!==null;){var re=$;if(W=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||W===null||G===null||(re=kl($,G),re!=null&&Ie.push(nc($,re,W))),Bt)break;$=$.return}0<Ie.length&&(X=new Q(X,Te,null,c,ae),se.push({event:X,listeners:Ie}))}}if((i&7)===0){e:{if(X=r==="mouseover"||r==="pointerover",Q=r==="mouseout"||r==="pointerout",X&&c!==Sf&&(Te=c.relatedTarget||c.fromElement)&&(vs(Te)||Te[sr]))break e;if((Q||X)&&(X=ae.window===ae?ae:(X=ae.ownerDocument)?X.defaultView||X.parentWindow:window,Q?(Te=c.relatedTarget||c.toElement,Q=K,Te=Te?vs(Te):null,Te!==null&&(Bt=o(Te),Ie=Te.tag,Te!==Bt||Ie!==5&&Ie!==27&&Ie!==6)&&(Te=null)):(Q=null,Te=K),Q!==Te)){if(Ie=V1,re="onMouseLeave",G="onMouseEnter",$="mouse",(r==="pointerout"||r==="pointerover")&&(Ie=K1,re="onPointerLeave",G="onPointerEnter",$="pointer"),Bt=Q==null?X:fi(Q),W=Te==null?X:fi(Te),X=new Ie(re,$+"leave",Q,c,ae),X.target=Bt,X.relatedTarget=W,re=null,vs(ae)===K&&(Ie=new Ie(G,$+"enter",Te,c,ae),Ie.target=W,Ie.relatedTarget=Bt,re=Ie),Bt=re,Q&&Te)t:{for(Ie=Tw,G=Q,$=Te,W=0,re=G;re;re=Ie(re))W++;re=0;for(var Be=$;Be;Be=Ie(Be))re++;for(;0<W-re;)G=Ie(G),W--;for(;0<re-W;)$=Ie($),re--;for(;W--;){if(G===$||$!==null&&G===$.alternate){Ie=G;break t}G=Ie(G),$=Ie($)}Ie=null}else Ie=null;Q!==null&&z4(se,X,Q,Ie,!1),Te!==null&&Bt!==null&&z4(se,Bt,Te,Ie,!0)}}e:{if(X=K?fi(K):window,Q=X.nodeName&&X.nodeName.toLowerCase(),Q==="select"||Q==="input"&&X.type==="file")var bt=ny;else if(ey(X))if(ay)bt=P8;else{bt=B8;var Ee=L8}else Q=X.nodeName,!Q||Q.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?K&&wf(K.elementType)&&(bt=ny):bt=j8;if(bt&&(bt=bt(r,K))){ty(se,bt,c,ae);break e}Ee&&Ee(r,X,K),r==="focusout"&&K&&X.type==="number"&&K.memoizedProps.value!=null&&xf(X,"number",X.value)}switch(Ee=K?fi(K):window,r){case"focusin":(ey(Ee)||Ee.contentEditable==="true")&&(oo=Ee,Bf=K,Rl=null);break;case"focusout":Rl=Bf=oo=null;break;case"mousedown":jf=!0;break;case"contextmenu":case"mouseup":case"dragend":jf=!1,dy(se,c,ae);break;case"selectionchange":if(z8)break;case"keydown":case"keyup":dy(se,c,ae)}var nt;if(Rf)e:{switch(r){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else io?Q1(r,c)&&(dt="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(dt="onCompositionStart");dt&&(Y1&&c.locale!=="ko"&&(io||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&io&&(nt=G1()):(bs=ae,Tf="value"in bs?bs.value:bs.textContent,io=!0)),Ee=ld(K,dt),0<Ee.length&&(dt=new W1(dt,r,null,c,ae),se.push({event:dt,listeners:Ee}),nt?dt.data=nt:(nt=J1(c),nt!==null&&(dt.data=nt)))),(nt=N8?M8(r,c):R8(r,c))&&(dt=ld(K,"onBeforeInput"),0<dt.length&&(Ee=new W1("onBeforeInput","beforeinput",null,c,ae),se.push({event:Ee,listeners:dt}),Ee.data=nt)),Sw(se,r,K,c,ae)}P4(se,i)})}function nc(r,i,c){return{instance:r,listener:i,currentTarget:c}}function ld(r,i){for(var c=i+"Capture",f=[];r!==null;){var g=r,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=kl(r,c),g!=null&&f.unshift(nc(r,g,v)),g=kl(r,i),g!=null&&f.push(nc(r,g,v))),r.tag===3)return f;r=r.return}return[]}function Tw(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function z4(r,i,c,f,g){for(var v=i._reactName,C=[];c!==null&&c!==f;){var M=c,z=M.alternate,K=M.stateNode;if(M=M.tag,z!==null&&z===f)break;M!==5&&M!==26&&M!==27||K===null||(z=K,g?(K=kl(c,v),K!=null&&C.unshift(nc(c,K,z))):g||(K=kl(c,v),K!=null&&C.push(nc(c,K,z)))),c=c.return}C.length!==0&&r.push({event:i,listeners:C})}var Aw=/\r\n?/g,Ew=/\u0000|\uFFFD/g;function $4(r){return(typeof r=="string"?r:""+r).replace(Aw,`
26
26
  `).replace(Ew,"")}function H4(r,i){return i=$4(i),$4(r)===i}function Lt(r,i,c,f,g,v){switch(c){case"children":typeof f=="string"?i==="body"||i==="textarea"&&f===""||ao(r,f):(typeof f=="number"||typeof f=="bigint")&&i!=="body"&&ao(r,""+f);break;case"className":et(r,"class",f);break;case"tabIndex":et(r,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":et(r,c,f);break;case"style":H1(r,f,v);break;case"data":if(i!=="object"){et(r,"data",f);break}case"src":case"href":if(f===""&&(i!=="a"||c!=="href")){r.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=mu(""+f),r.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){r.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(c==="formAction"?(i!=="input"&&Lt(r,i,"name",g.name,g,null),Lt(r,i,"formEncType",g.formEncType,g,null),Lt(r,i,"formMethod",g.formMethod,g,null),Lt(r,i,"formTarget",g.formTarget,g,null)):(Lt(r,i,"encType",g.encType,g,null),Lt(r,i,"method",g.method,g,null),Lt(r,i,"target",g.target,g,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=mu(""+f),r.setAttribute(c,f);break;case"onClick":f!=null&&(r.onclick=Dr);break;case"onScroll":f!=null&&ot("scroll",r);break;case"onScrollEnd":f!=null&&ot("scrollend",r);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(c=f.__html,c!=null){if(g.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"multiple":r.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":r.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){r.removeAttribute("xlink:href");break}c=mu(""+f),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,""+f):r.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":f===!0?r.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,f):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?r.setAttribute(c,f):r.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?r.removeAttribute(c):r.setAttribute(c,f);break;case"popover":ot("beforetoggle",r),ot("toggle",r),Ot(r,"popover",f);break;case"xlinkActuate":Hn(r,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Hn(r,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Hn(r,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Hn(r,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Hn(r,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Hn(r,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Hn(r,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Hn(r,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Hn(r,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Ot(r,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=n8.get(c)||c,Ot(r,c,f))}}function om(r,i,c,f,g,v){switch(c){case"style":H1(r,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(c=f.__html,c!=null){if(g.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"children":typeof f=="string"?ao(r,f):(typeof f=="number"||typeof f=="bigint")&&ao(r,""+f);break;case"onScroll":f!=null&&ot("scroll",r);break;case"onScrollEnd":f!=null&&ot("scrollend",r);break;case"onClick":f!=null&&(r.onclick=Dr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ne.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),i=c.slice(2,g?c.length-7:void 0),v=r[Rn]||null,v=v!=null?v[c]:null,typeof v=="function"&&r.removeEventListener(i,v,g),typeof f=="function")){typeof v!="function"&&v!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(i,f,g);break e}c in r?r[c]=f:f===!0?r.setAttribute(c,""):Ot(r,c,f)}}}function Bn(r,i,c){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",r),ot("load",r);var f=!1,g=!1,v;for(v in c)if(c.hasOwnProperty(v)){var C=c[v];if(C!=null)switch(v){case"src":f=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Lt(r,i,v,C,c,null)}}g&&Lt(r,i,"srcSet",c.srcSet,c,null),f&&Lt(r,i,"src",c.src,c,null);return;case"input":ot("invalid",r);var M=v=C=g=null,z=null,K=null;for(f in c)if(c.hasOwnProperty(f)){var ae=c[f];if(ae!=null)switch(f){case"name":g=ae;break;case"type":C=ae;break;case"checked":z=ae;break;case"defaultChecked":K=ae;break;case"value":v=ae;break;case"defaultValue":M=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,i));break;default:Lt(r,i,f,ae,c,null)}}P1(r,v,M,z,K,C,g,!1);return;case"select":ot("invalid",r),f=C=v=null;for(g in c)if(c.hasOwnProperty(g)&&(M=c[g],M!=null))switch(g){case"value":v=M;break;case"defaultValue":C=M;break;case"multiple":f=M;default:Lt(r,i,g,M,c,null)}i=v,c=C,r.multiple=!!f,i!=null?no(r,!!f,i,!1):c!=null&&no(r,!!f,c,!0);return;case"textarea":ot("invalid",r),v=g=f=null;for(C in c)if(c.hasOwnProperty(C)&&(M=c[C],M!=null))switch(C){case"value":f=M;break;case"defaultValue":g=M;break;case"children":v=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(a(91));break;default:Lt(r,i,C,M,c,null)}z1(r,f,g,v);return;case"option":for(z in c)if(c.hasOwnProperty(z)&&(f=c[z],f!=null))switch(z){case"selected":r.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Lt(r,i,z,f,c,null)}return;case"dialog":ot("beforetoggle",r),ot("toggle",r),ot("cancel",r),ot("close",r);break;case"iframe":case"object":ot("load",r);break;case"video":case"audio":for(f=0;f<tc.length;f++)ot(tc[f],r);break;case"image":ot("error",r),ot("load",r);break;case"details":ot("toggle",r);break;case"embed":case"source":case"link":ot("error",r),ot("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in c)if(c.hasOwnProperty(K)&&(f=c[K],f!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Lt(r,i,K,f,c,null)}return;default:if(wf(i)){for(ae in c)c.hasOwnProperty(ae)&&(f=c[ae],f!==void 0&&om(r,i,ae,f,c,void 0));return}}for(M in c)c.hasOwnProperty(M)&&(f=c[M],f!=null&&Lt(r,i,M,f,c,null))}function Nw(r,i,c,f){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,C=null,M=null,z=null,K=null,ae=null;for(Q in c){var se=c[Q];if(c.hasOwnProperty(Q)&&se!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":z=se;default:f.hasOwnProperty(Q)||Lt(r,i,Q,null,f,se)}}for(var X in f){var Q=f[X];if(se=c[X],f.hasOwnProperty(X)&&(Q!=null||se!=null))switch(X){case"type":v=Q;break;case"name":g=Q;break;case"checked":K=Q;break;case"defaultChecked":ae=Q;break;case"value":C=Q;break;case"defaultValue":M=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(a(137,i));break;default:Q!==se&&Lt(r,i,X,Q,f,se)}}Sl(r,C,M,z,K,ae,v,g);return;case"select":Q=C=M=X=null;for(v in c)if(z=c[v],c.hasOwnProperty(v)&&z!=null)switch(v){case"value":break;case"multiple":Q=z;default:f.hasOwnProperty(v)||Lt(r,i,v,null,f,z)}for(g in f)if(v=f[g],z=c[g],f.hasOwnProperty(g)&&(v!=null||z!=null))switch(g){case"value":X=v;break;case"defaultValue":M=v;break;case"multiple":C=v;default:v!==z&&Lt(r,i,g,v,f,z)}i=M,c=C,f=Q,X!=null?no(r,!!c,X,!1):!!f!=!!c&&(i!=null?no(r,!!c,i,!0):no(r,!!c,c?[]:"",!1));return;case"textarea":Q=X=null;for(M in c)if(g=c[M],c.hasOwnProperty(M)&&g!=null&&!f.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:Lt(r,i,M,null,f,g)}for(C in f)if(g=f[C],v=c[C],f.hasOwnProperty(C)&&(g!=null||v!=null))switch(C){case"value":X=g;break;case"defaultValue":Q=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(a(91));break;default:g!==v&&Lt(r,i,C,g,f,v)}I1(r,X,Q);return;case"option":for(var Te in c)if(X=c[Te],c.hasOwnProperty(Te)&&X!=null&&!f.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:Lt(r,i,Te,null,f,X)}for(z in f)if(X=f[z],Q=c[z],f.hasOwnProperty(z)&&X!==Q&&(X!=null||Q!=null))switch(z){case"selected":r.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:Lt(r,i,z,X,f,Q)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ie in c)X=c[Ie],c.hasOwnProperty(Ie)&&X!=null&&!f.hasOwnProperty(Ie)&&Lt(r,i,Ie,null,f,X);for(K in f)if(X=f[K],Q=c[K],f.hasOwnProperty(K)&&X!==Q&&(X!=null||Q!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(a(137,i));break;default:Lt(r,i,K,X,f,Q)}return;default:if(wf(i)){for(var Bt in c)X=c[Bt],c.hasOwnProperty(Bt)&&X!==void 0&&!f.hasOwnProperty(Bt)&&om(r,i,Bt,void 0,f,X);for(ae in f)X=f[ae],Q=c[ae],!f.hasOwnProperty(ae)||X===Q||X===void 0&&Q===void 0||om(r,i,ae,X,f,Q);return}}for(var G in c)X=c[G],c.hasOwnProperty(G)&&X!=null&&!f.hasOwnProperty(G)&&Lt(r,i,G,null,f,X);for(se in f)X=f[se],Q=c[se],!f.hasOwnProperty(se)||X===Q||X==null&&Q==null||Lt(r,i,se,X,f,Q)}function U4(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Mw(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var g=c[f],v=g.transferSize,C=g.initiatorType,M=g.duration;if(v&&M&&U4(C)){for(C=0,M=g.responseEnd,f+=1;f<c.length;f++){var z=c[f],K=z.startTime;if(K>M)break;var ae=z.transferSize,se=z.initiatorType;ae&&U4(se)&&(z=z.responseEnd,C+=ae*(z<M?1:(M-K)/(z-K)))}if(--f,i+=8*(v+C)/(g.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var lm=null,cm=null;function cd(r){return r.nodeType===9?r:r.ownerDocument}function F4(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function G4(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function um(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var dm=null;function Rw(){var r=window.event;return r&&r.type==="popstate"?r===dm?!1:(dm=r,!0):(dm=null,!1)}var q4=typeof setTimeout=="function"?setTimeout:void 0,Ow=typeof clearTimeout=="function"?clearTimeout:void 0,V4=typeof Promise=="function"?Promise:void 0,Dw=typeof queueMicrotask=="function"?queueMicrotask:typeof V4<"u"?function(r){return V4.resolve(null).then(r).catch(Lw)}:q4;function Lw(r){setTimeout(function(){throw r})}function js(r){return r==="head"}function W4(r,i){var c=i,f=0;do{var g=c.nextSibling;if(r.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(f===0){r.removeChild(g),Bo(i);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")ac(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,ac(c);for(var v=c.firstChild;v;){var C=v.nextSibling,M=v.nodeName;v[di]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=C}}else c==="body"&&ac(r.ownerDocument.body);c=g}while(c);Bo(i)}function K4(r,i){var c=r;r=0;do{var f=c.nextSibling;if(c.nodeType===1?i?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(i?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=f}while(c)}function fm(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var c=i;switch(i=i.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":fm(c),bl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function Bw(r,i,c,f){for(;r.nodeType===1;){var g=c;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!f&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(f){if(!r[di])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==g.rel||r.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||r.getAttribute("title")!==(g.title==null?null:g.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(g.src==null?null:g.src)||r.getAttribute("type")!==(g.type==null?null:g.type)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Ba(r.nextSibling),r===null)break}return null}function jw(r,i,c){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Ba(r.nextSibling),r===null))return null;return r}function Y4(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Ba(r.nextSibling),r===null))return null;return r}function hm(r){return r.data==="$?"||r.data==="$~"}function mm(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function Pw(r,i){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||c.readyState!=="loading")i();else{var f=function(){i(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),r._reactRetry=f}}function Ba(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var pm=null;function Z4(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(i===0)return Ba(r.nextSibling);i--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||i++}r=r.nextSibling}return null}function X4(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(i===0)return r;i--}else c!=="/$"&&c!=="/&"||i++}r=r.previousSibling}return null}function Q4(r,i,c){switch(i=cd(c),r){case"html":if(r=i.documentElement,!r)throw Error(a(452));return r;case"head":if(r=i.head,!r)throw Error(a(453));return r;case"body":if(r=i.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function ac(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);bl(r)}var ja=new Map,J4=new Set;function ud(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Yr=oe.d;oe.d={f:Iw,r:zw,D:$w,C:Hw,L:Uw,m:Fw,X:qw,S:Gw,M:Vw};function Iw(){var r=Yr.f(),i=td();return r||i}function zw(r){var i=Rr(r);i!==null&&i.tag===5&&i.type==="form"?gv(i):Yr.r(r)}var Oo=typeof document>"u"?null:document;function eb(r,i,c){var f=Oo;if(f&&typeof i=="string"&&i){var g=Vn(i);g='link[rel="'+r+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),J4.has(g)||(J4.add(g),r={rel:r,crossOrigin:c,href:i},f.querySelector(g)===null&&(i=f.createElement("link"),Bn(i,"link",r),sn(i),f.head.appendChild(i)))}}function $w(r){Yr.D(r),eb("dns-prefetch",r,null)}function Hw(r,i){Yr.C(r,i),eb("preconnect",r,i)}function Uw(r,i,c){Yr.L(r,i,c);var f=Oo;if(f&&r&&i){var g='link[rel="preload"][as="'+Vn(i)+'"]';i==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+Vn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+Vn(c.imageSizes)+'"]')):g+='[href="'+Vn(r)+'"]';var v=g;switch(i){case"style":v=Do(r);break;case"script":v=Lo(r)}ja.has(v)||(r=p({rel:"preload",href:i==="image"&&c&&c.imageSrcSet?void 0:r,as:i},c),ja.set(v,r),f.querySelector(g)!==null||i==="style"&&f.querySelector(rc(v))||i==="script"&&f.querySelector(sc(v))||(i=f.createElement("link"),Bn(i,"link",r),sn(i),f.head.appendChild(i)))}}function Fw(r,i){Yr.m(r,i);var c=Oo;if(c&&r){var f=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+Vn(f)+'"][href="'+Vn(r)+'"]',v=g;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Lo(r)}if(!ja.has(v)&&(r=p({rel:"modulepreload",href:r},i),ja.set(v,r),c.querySelector(g)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(sc(v)))return}f=c.createElement("link"),Bn(f,"link",r),sn(f),c.head.appendChild(f)}}}function Gw(r,i,c){Yr.S(r,i,c);var f=Oo;if(f&&r){var g=ir(f).hoistableStyles,v=Do(r);i=i||"default";var C=g.get(v);if(!C){var M={loading:0,preload:null};if(C=f.querySelector(rc(v)))M.loading=5;else{r=p({rel:"stylesheet",href:r,"data-precedence":i},c),(c=ja.get(v))&&gm(r,c);var z=C=f.createElement("link");sn(z),Bn(z,"link",r),z._p=new Promise(function(K,ae){z.onload=K,z.onerror=ae}),z.addEventListener("load",function(){M.loading|=1}),z.addEventListener("error",function(){M.loading|=2}),M.loading|=4,dd(C,i,f)}C={type:"stylesheet",instance:C,count:1,state:M},g.set(v,C)}}}function qw(r,i){Yr.X(r,i);var c=Oo;if(c&&r){var f=ir(c).hoistableScripts,g=Lo(r),v=f.get(g);v||(v=c.querySelector(sc(g)),v||(r=p({src:r,async:!0},i),(i=ja.get(g))&&ym(r,i),v=c.createElement("script"),sn(v),Bn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function Vw(r,i){Yr.M(r,i);var c=Oo;if(c&&r){var f=ir(c).hoistableScripts,g=Lo(r),v=f.get(g);v||(v=c.querySelector(sc(g)),v||(r=p({src:r,async:!0,type:"module"},i),(i=ja.get(g))&&ym(r,i),v=c.createElement("script"),sn(v),Bn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function tb(r,i,c,f){var g=(g=En.current)?ud(g):null;if(!g)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(i=Do(c.href),c=ir(g).hoistableStyles,f=c.get(i),f||(f={type:"style",instance:null,count:0,state:null},c.set(i,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=Do(c.href);var v=ir(g).hoistableStyles,C=v.get(r);if(C||(g=g.ownerDocument||g,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,C),(v=g.querySelector(rc(r)))&&!v._p&&(C.instance=v,C.state.loading=5),ja.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},ja.set(r,c),v||Ww(g,r,c,C.state))),i&&f===null)throw Error(a(528,""));return C}if(i&&f!==null)throw Error(a(529,""));return null;case"script":return i=c.async,c=c.src,typeof c=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Lo(c),c=ir(g).hoistableScripts,f=c.get(i),f||(f={type:"script",instance:null,count:0,state:null},c.set(i,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Do(r){return'href="'+Vn(r)+'"'}function rc(r){return'link[rel="stylesheet"]['+r+"]"}function nb(r){return p({},r,{"data-precedence":r.precedence,precedence:null})}function Ww(r,i,c,f){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?f.loading=1:(i=r.createElement("link"),f.preload=i,i.addEventListener("load",function(){return f.loading|=1}),i.addEventListener("error",function(){return f.loading|=2}),Bn(i,"link",c),sn(i),r.head.appendChild(i))}function Lo(r){return'[src="'+Vn(r)+'"]'}function sc(r){return"script[async]"+r}function ab(r,i,c){if(i.count++,i.instance===null)switch(i.type){case"style":var f=r.querySelector('style[data-href~="'+Vn(c.href)+'"]');if(f)return i.instance=f,sn(f),f;var g=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(r.ownerDocument||r).createElement("style"),sn(f),Bn(f,"style",g),dd(f,c.precedence,r),i.instance=f;case"stylesheet":g=Do(c.href);var v=r.querySelector(rc(g));if(v)return i.state.loading|=4,i.instance=v,sn(v),v;f=nb(c),(g=ja.get(g))&&gm(f,g),v=(r.ownerDocument||r).createElement("link"),sn(v);var C=v;return C._p=new Promise(function(M,z){C.onload=M,C.onerror=z}),Bn(v,"link",f),i.state.loading|=4,dd(v,c.precedence,r),i.instance=v;case"script":return v=Lo(c.src),(g=r.querySelector(sc(v)))?(i.instance=g,sn(g),g):(f=c,(g=ja.get(v))&&(f=p({},c),ym(f,g)),r=r.ownerDocument||r,g=r.createElement("script"),sn(g),Bn(g,"link",f),r.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(f=i.instance,i.state.loading|=4,dd(f,c.precedence,r));return i.instance}function dd(r,i,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=f.length?f[f.length-1]:null,v=g,C=0;C<f.length;C++){var M=f[C];if(M.dataset.precedence===i)v=M;else if(v!==g)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=c.nodeType===9?c.head:c,i.insertBefore(r,i.firstChild))}function gm(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function ym(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var fd=null;function rb(r,i,c){if(fd===null){var f=new Map,g=fd=new Map;g.set(c,f)}else g=fd,f=g.get(c),f||(f=new Map,g.set(c,f));if(f.has(r))return f;for(f.set(r,null),c=c.getElementsByTagName(r),g=0;g<c.length;g++){var v=c[g];if(!(v[di]||v[rn]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var C=v.getAttribute(i)||"";C=r+C;var M=f.get(C);M?M.push(v):f.set(C,[v])}}return f}function sb(r,i,c){r=r.ownerDocument||r,r.head.insertBefore(c,i==="title"?r.querySelector("head > title"):null)}function Kw(r,i,c){if(c===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function ib(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function Yw(r,i,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=Do(f.href),v=i.querySelector(rc(g));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=hd.bind(r),i.then(r,r)),c.state.loading|=4,c.instance=v,sn(v);return}v=i.ownerDocument||i,f=nb(f),(g=ja.get(g))&&gm(f,g),v=v.createElement("link"),sn(v);var C=v;C._p=new Promise(function(M,z){C.onload=M,C.onerror=z}),Bn(v,"link",f),c.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,i),(i=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=hd.bind(r),i.addEventListener("load",c),i.addEventListener("error",c))}}var vm=0;function Zw(r,i){return r.stylesheets&&r.count===0&&pd(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var f=setTimeout(function(){if(r.stylesheets&&pd(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&vm===0&&(vm=62500*Mw());var g=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&pd(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>vm?50:800)+i);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(f),clearTimeout(g)}}:null}function hd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)pd(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var md=null;function pd(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,md=new Map,i.forEach(Xw,r),md=null,hd.call(r))}function Xw(r,i){if(!(i.state.loading&4)){var c=md.get(r);if(c)var f=c.get(null);else{c=new Map,md.set(r,c);for(var g=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var C=g[v];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(c.set(C.dataset.precedence,C),f=C)}f&&c.set(null,f)}g=i.instance,C=g.getAttribute("data-precedence"),v=c.get(C)||f,v===f&&c.set(null,g),c.set(C,g),this.count++,f=hd.bind(this),g.addEventListener("load",f),g.addEventListener("error",f),v?v.parentNode.insertBefore(g,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(g,r.firstChild)),i.state.loading|=4}}var ic={$$typeof:B,Provider:null,Consumer:null,_currentValue:ge,_currentValue2:ge,_threadCount:0};function Qw(r,i,c,f,g,v,C,M,z){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=eo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=eo(0),this.hiddenUpdates=eo(null),this.identifierPrefix=f,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.incompleteTransitions=new Map}function ob(r,i,c,f,g,v,C,M,z,K,ae,se){return r=new Qw(r,i,c,C,z,K,ae,se,M),i=1,v===!0&&(i|=24),v=ha(3,null,null,i),r.current=v,v.stateNode=r,i=Xf(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:f,isDehydrated:c,cache:i},th(v),r}function lb(r){return r?(r=uo,r):uo}function cb(r,i,c,f,g,v){g=lb(g),f.context===null?f.context=g:f.pendingContext=g,f=Cs(i),f.payload={element:c},v=v===void 0?null:v,v!==null&&(f.callback=v),c=Ts(r,f,i),c!==null&&(ia(c,r,i),Il(c,r,i))}function ub(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<i?c:i}}function bm(r,i){ub(r,i),(r=r.alternate)&&ub(r,i)}function db(r){if(r.tag===13||r.tag===31){var i=gi(r,67108864);i!==null&&ia(i,r,67108864),bm(r,67108864)}}function fb(r){if(r.tag===13||r.tag===31){var i=va();i=ci(i);var c=gi(r,i);c!==null&&ia(c,r,i),bm(r,i)}}var gd=!0;function Jw(r,i,c,f){var g=q.T;q.T=null;var v=oe.p;try{oe.p=2,xm(r,i,c,f)}finally{oe.p=v,q.T=g}}function eS(r,i,c,f){var g=q.T;q.T=null;var v=oe.p;try{oe.p=8,xm(r,i,c,f)}finally{oe.p=v,q.T=g}}function xm(r,i,c,f){if(gd){var g=wm(f);if(g===null)im(r,i,f,yd,c),mb(r,f);else if(nS(g,r,i,c,f))f.stopPropagation();else if(mb(r,f),i&4&&-1<tS.indexOf(r)){for(;g!==null;){var v=Rr(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var C=Wa(v.pendingLanes);if(C!==0){var M=v;for(M.pendingLanes|=2,M.entangledLanes|=2;C;){var z=1<<31-Mn(C);M.entanglements[1]|=z,C&=~z}ur(v),(_t&6)===0&&(Ju=yt()+500,ec(0))}}break;case 31:case 13:M=gi(v,2),M!==null&&ia(M,v,2),td(),bm(v,2)}if(v=wm(f),v===null&&im(r,i,f,yd,c),v===g)break;g=v}g!==null&&f.stopPropagation()}else im(r,i,f,null,c)}}function wm(r){return r=kf(r),Sm(r)}var yd=null;function Sm(r){if(yd=null,r=vs(r),r!==null){var i=o(r);if(i===null)r=null;else{var c=i.tag;if(c===13){if(r=l(i),r!==null)return r;r=null}else if(c===31){if(r=u(i),r!==null)return r;r=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return yd=r,null}function hb(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Nn()){case rr:return 2;case ps:return 8;case ca:case Ar:return 32;case zn:return 268435456;default:return 32}default:return 32}}var km=!1,Ps=null,Is=null,zs=null,oc=new Map,lc=new Map,$s=[],tS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function mb(r,i){switch(r){case"focusin":case"focusout":Ps=null;break;case"dragenter":case"dragleave":Is=null;break;case"mouseover":case"mouseout":zs=null;break;case"pointerover":case"pointerout":oc.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":lc.delete(i.pointerId)}}function cc(r,i,c,f,g,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:c,eventSystemFlags:f,nativeEvent:v,targetContainers:[g]},i!==null&&(i=Rr(i),i!==null&&db(i)),r):(r.eventSystemFlags|=f,i=r.targetContainers,g!==null&&i.indexOf(g)===-1&&i.push(g),r)}function nS(r,i,c,f,g){switch(i){case"focusin":return Ps=cc(Ps,r,i,c,f,g),!0;case"dragenter":return Is=cc(Is,r,i,c,f,g),!0;case"mouseover":return zs=cc(zs,r,i,c,f,g),!0;case"pointerover":var v=g.pointerId;return oc.set(v,cc(oc.get(v)||null,r,i,c,f,g)),!0;case"gotpointercapture":return v=g.pointerId,lc.set(v,cc(lc.get(v)||null,r,i,c,f,g)),!0}return!1}function pb(r){var i=vs(r.target);if(i!==null){var c=o(i);if(c!==null){if(i=c.tag,i===13){if(i=l(c),i!==null){r.blockedOn=i,vl(r.priority,function(){fb(c)});return}}else if(i===31){if(i=u(c),i!==null){r.blockedOn=i,vl(r.priority,function(){fb(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function vd(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var c=wm(r.nativeEvent);if(c===null){c=r.nativeEvent;var f=new c.constructor(c.type,c);Sf=f,c.target.dispatchEvent(f),Sf=null}else return i=Rr(c),i!==null&&db(i),r.blockedOn=c,!1;i.shift()}return!0}function gb(r,i,c){vd(r)&&c.delete(i)}function aS(){km=!1,Ps!==null&&vd(Ps)&&(Ps=null),Is!==null&&vd(Is)&&(Is=null),zs!==null&&vd(zs)&&(zs=null),oc.forEach(gb),lc.forEach(gb)}function bd(r,i){r.blockedOn===i&&(r.blockedOn=null,km||(km=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,aS)))}var xd=null;function yb(r){xd!==r&&(xd=r,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){xd===r&&(xd=null);for(var i=0;i<r.length;i+=3){var c=r[i],f=r[i+1],g=r[i+2];if(typeof f!="function"){if(Sm(f||c)===null)continue;break}var v=Rr(c);v!==null&&(r.splice(i,3),i-=3,wh(v,{pending:!0,data:g,method:c.method,action:f},f,g))}}))}function Bo(r){function i(z){return bd(z,r)}Ps!==null&&bd(Ps,r),Is!==null&&bd(Is,r),zs!==null&&bd(zs,r),oc.forEach(i),lc.forEach(i);for(var c=0;c<$s.length;c++){var f=$s[c];f.blockedOn===r&&(f.blockedOn=null)}for(;0<$s.length&&(c=$s[0],c.blockedOn===null);)pb(c),c.blockedOn===null&&$s.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var g=c[f],v=c[f+1],C=g[Rn]||null;if(typeof v=="function")C||yb(c);else if(C){var M=null;if(v&&v.hasAttribute("formAction")){if(g=v,C=v[Rn]||null)M=C.formAction;else if(Sm(g)!==null)continue}else M=C.action;typeof M=="function"?c[f+1]=M:(c.splice(f,3),f-=3),yb(c)}}}function vb(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(C){return g=C})},focusReset:"manual",scroll:"manual"})}function i(){g!==null&&(g(),g=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,g=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),g!==null&&(g(),g=null)}}}function _m(r){this._internalRoot=r}wd.prototype.render=_m.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var c=i.current,f=va();cb(c,f,r,i,null,null)},wd.prototype.unmount=_m.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;cb(r.current,2,null,r,null,null),td(),i[sr]=null}};function wd(r){this._internalRoot=r}wd.prototype.unstable_scheduleHydration=function(r){if(r){var i=yl();r={blockedOn:null,target:r,priority:i};for(var c=0;c<$s.length&&i!==0&&i<$s[c].priority;c++);$s.splice(c,0,r),c===0&&pb(r)}};var bb=e.version;if(bb!=="19.2.7")throw Error(a(527,bb,"19.2.7"));oe.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?m(r):null,r=r===null?null:r.stateNode,r};var rS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sd.isDisabled&&Sd.supportsFiber)try{gs=Sd.inject(rS),$n=Sd}catch{}}return dc.createRoot=function(r,i){if(!s(r))throw Error(a(299));var c=!1,f="",g=Tv,v=Av,C=Ev;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError)),i=ob(r,1,!1,null,null,c,f,null,g,v,C,vb),r[sr]=i.current,sm(r),new _m(i)},dc.hydrateRoot=function(r,i,c){if(!s(r))throw Error(a(299));var f=!1,g="",v=Tv,C=Av,M=Ev,z=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(C=c.onCaughtError),c.onRecoverableError!==void 0&&(M=c.onRecoverableError),c.formState!==void 0&&(z=c.formState)),i=ob(r,1,!0,i,c??null,f,g,z,v,C,M,vb),i.context=lb(null),c=i.current,f=va(),f=ci(f),g=Cs(f),g.callback=null,Ts(c,g,f),c=f,i.current.lanes=c,Nr(i,c),ur(i),r[sr]=i.current,sm(r),new wd(i)},dc.version="19.2.7",dc}var Ob;function ok(){if(Ob)return Am.exports;Ob=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Am.exports=ik(),Am.exports}var lk=ok();const ck=$3(lk),uk="modulepreload",dk=function(n){return"/"+n},Db={},D=function(e,t,a){let s=Promise.resolve();if(t&&t.length>0){let l=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=l(t.map(h=>{if(h=dk(h),h in Db)return;Db[h]=!0;const m=h.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":uk,m||(b.as="script"),b.crossOrigin="",b.href=h,d&&b.setAttribute("nonce",d),document.head.appendChild(b),m)return new Promise((x,w)=>{b.addEventListener("load",x),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return s.then(l=>{for(const u of l||[])u.status==="rejected"&&o(u.reason);return e().catch(o)})},qe=n=>typeof n=="string",fc=()=>{let n,e;const t=new Promise((a,s)=>{n=a,e=s});return t.resolve=n,t.reject=e,t},Lb=n=>n==null?"":String(n),fk=(n,e,t)=>{n.forEach(a=>{e[a]&&(t[a]=e[a])})},hk=/###/g,Bb=n=>n&&n.includes("###")?n.replace(hk,"."):n,jb=n=>!n||qe(n),Ec=(n,e,t)=>{const a=qe(e)?e.split("."):e;let s=0;for(;s<a.length-1;){if(jb(n))return{};const o=Bb(a[s]);!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={},++s}return jb(n)?{}:{obj:n,k:Bb(a[s])}},Pb=(n,e,t)=>{const{obj:a,k:s}=Ec(n,e,Object);if(a!==void 0||e.length===1){a[s]=t;return}let o=e[e.length-1],l=e.slice(0,e.length-1),u=Ec(n,l,Object);for(;u.obj===void 0&&l.length;)o=`${l[l.length-1]}.${o}`,l=l.slice(0,l.length-1),u=Ec(n,l,Object),u!=null&&u.obj&&typeof u.obj[`${u.k}.${o}`]<"u"&&(u.obj=void 0);u.obj[`${u.k}.${o}`]=t},mk=(n,e,t,a)=>{const{obj:s,k:o}=Ec(n,e,Object);s[o]=s[o]||[],s[o].push(t)},o0=(n,e)=>{const{obj:t,k:a}=Ec(n,e);if(t&&Object.prototype.hasOwnProperty.call(t,a))return t[a]},pk=(n,e,t)=>{const a=o0(n,t);return a!==void 0?a:o0(e,t)},ax=(n,e,t)=>{for(const a in e)a!=="__proto__"&&a!=="constructor"&&(Object.prototype.hasOwnProperty.call(n,a)?qe(n[a])||n[a]instanceof String||qe(e[a])||e[a]instanceof String?t&&(n[a]=e[a]):ax(n[a],e[a],t):n[a]=e[a]);return n},Zr=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),gk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},yk=n=>qe(n)?n.replace(/[&<>"'\/]/g,e=>gk[e]):n;class vk{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const a=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,a),this.regExpQueue.push(e),a}}const bk=[" ",",","?","!",";"],xk=new vk(20),wk=(n,e,t)=>{e=e||"",t=t||"";const a=bk.filter(l=>!e.includes(l)&&!t.includes(l));if(a.length===0)return!0;const s=xk.getRegExp(`(${a.map(l=>l==="?"?"\\?":l).join("|")})`);let o=!s.test(n);if(!o){const l=n.indexOf(t);l>0&&!s.test(n.substring(0,l))&&(o=!0)}return o},jp=(n,e,t=".")=>{if(!n)return;if(n[e])return Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;const a=e.split(t);let s=n;for(let o=0;o<a.length;){if(!s||typeof s!="object")return;let l,u="";for(let d=o;d<a.length;++d)if(d!==o&&(u+=t),u+=a[d],l=s[u],l!==void 0){if(["string","number","boolean"].includes(typeof l)&&d<a.length-1)continue;o+=d-o+1;break}s=l}return s},$c=n=>n==null?void 0:n.replace(/_/g,"-"),Sk={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){var t,a;(a=(t=console==null?void 0:console[n])==null?void 0:t.apply)==null||a.call(t,console,e)}};class l0{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Sk,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,a,s){return s&&!this.debug?null:(e=e.map(o=>qe(o)?o.replace(/[\r\n\x00-\x1F\x7F]/g," "):o),qe(e[0])&&(e[0]=`${a}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new l0(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new l0(this.logger,e)}}var gr=new l0;class $0{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(a=>{this.observers[a]||(this.observers[a]=new Map);const s=this.observers[a].get(t)||0;this.observers[a].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){const a=(...s)=>{t(...s),this.off(e,a)};return this.on(e,a),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,o])=>{for(let l=0;l<o;l++)s(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,o])=>{for(let l=0;l<o;l++)s(e,...t)})}}class Ib extends $0{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,a,s={}){var h,m;const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,l=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let u;e.includes(".")?u=e.split("."):(u=[e,t],a&&(Array.isArray(a)?u.push(...a):qe(a)&&o?u.push(...a.split(o)):u.push(a)));const d=o0(this.data,u);return!d&&!t&&!a&&e.includes(".")&&(e=u[0],t=u[1],a=u.slice(2).join(".")),d||!l||!qe(a)?d:jp((m=(h=this.data)==null?void 0:h[e])==null?void 0:m[t],a,o)}addResource(e,t,a,s,o={silent:!1}){const l=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let u=[e,t];a&&(u=u.concat(l?a.split(l):a)),e.includes(".")&&(u=e.split("."),s=t,t=u[1]),this.addNamespaces(t),Pb(this.data,u,s),o.silent||this.emit("added",e,t,a,s)}addResources(e,t,a,s={silent:!1}){for(const o in a)(qe(a[o])||Array.isArray(a[o]))&&this.addResource(e,t,o,a[o],{silent:!0});s.silent||this.emit("added",e,t,a)}addResourceBundle(e,t,a,s,o,l={silent:!1,skipCopy:!1}){let u=[e,t];e.includes(".")&&(u=e.split("."),s=a,a=t,t=u[1]),this.addNamespaces(t);let d=o0(this.data,u)||{};l.skipCopy||(a=JSON.parse(JSON.stringify(a))),s?ax(d,a,o):d={...d,...a},Pb(this.data,u,d),l.silent||this.emit("added",e,t,a)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var rx={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,a,s){return n.forEach(o=>{var l;e=((l=this.processors[o])==null?void 0:l.process(e,t,a,s))??e}),e}};const sx=Symbol("i18next/PATH_KEY");function kk(){const n=[],e=Object.create(null);let t;return e.get=(a,s)=>{var o;return(o=t==null?void 0:t.revoke)==null||o.call(t),s===sx?n:(n.push(s),t=Proxy.revocable(a,e),t.proxy)},Proxy.revocable(Object.create(null),e).proxy}function Yo(n,e){const{[sx]:t}=n(kk()),a=(e==null?void 0:e.keySeparator)??".",s=(e==null?void 0:e.nsSeparator)??":",o=(e==null?void 0:e.enableSelector)==="strict";if(t.length>1&&s){const l=e==null?void 0:e.ns,u=o?Array.isArray(l)?l:l?[l]:null:Array.isArray(l)?l:null;if(u&&(o?u:u.length>1?u.slice(1):[]).includes(t[0]))return`${t[0]}${s}${t.slice(1).join(a)}`}return t.join(a)}const Mm=n=>!qe(n)&&typeof n!="boolean"&&typeof n!="number";class c0 extends $0{constructor(e,t={}){super(),fk(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=gr.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const a={...t};if(e==null)return!1;const s=this.resolve(e,a);if((s==null?void 0:s.res)===void 0)return!1;const o=Mm(s.res);return!(a.returnObjects===!1&&o)}extractFromKey(e,t){let a=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;a===void 0&&(a=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let o=t.ns||this.options.defaultNS||[];const l=a&&e.includes(a),u=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!wk(e,a,s);if(l&&!u){const d=e.match(this.interpolator.nestingRegexp);if(d&&d.length>0)return{key:e,namespaces:qe(o)?[o]:o};const h=e.split(a);(a!==s||a===s&&this.options.ns.includes(h[0]))&&(o=h.shift()),e=h.join(s)}return{key:e,namespaces:qe(o)?[o]:o}}translate(e,t,a){let s=typeof t=="object"?{...t}:t;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),e==null)return"";typeof e=="function"&&(e=Yo(e,{...this.options,...s})),Array.isArray(e)||(e=[String(e)]),e=e.map(ie=>typeof ie=="function"?Yo(ie,{...this.options,...s}):String(ie));const o=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,l=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:u,namespaces:d}=this.extractFromKey(e[e.length-1],s),h=d[d.length-1];let m=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;m===void 0&&(m=":");const p=s.lng||this.language,b=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((p==null?void 0:p.toLowerCase())==="cimode")return b?o?{res:`${h}${m}${u}`,usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h,usedParams:this.getUsedParamsDetails(s)}:`${h}${m}${u}`:o?{res:u,usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h,usedParams:this.getUsedParamsDetails(s)}:u;const x=this.resolve(e,s);let w=x==null?void 0:x.res;const _=(x==null?void 0:x.usedKey)||u,T=(x==null?void 0:x.exactUsedKey)||u,N=["[object Number]","[object Function]","[object RegExp]"],E=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,B=!this.i18nFormat||this.i18nFormat.handleAsObject,L=s.count!==void 0&&!qe(s.count),j=c0.hasDefaultValue(s),F=L?this.pluralResolver.getSuffix(p,s.count,s):"",Y=s.ordinal&&L?this.pluralResolver.getSuffix(p,s.count,{ordinal:!1}):"",ee=L&&!s.ordinal&&s.count===0,te=ee&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${F}`]||s[`defaultValue${Y}`]||s.defaultValue;let xe=w;B&&!w&&j&&(xe=te);const De=Mm(xe),ce=Object.prototype.toString.apply(xe);if(B&&xe&&De&&!N.includes(ce)&&!(qe(E)&&Array.isArray(xe))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ie=this.options.returnedObjectHandler?this.options.returnedObjectHandler(_,xe,{...s,ns:d}):`key '${u} (${this.language})' returned an object instead of string.`;return o?(x.res=ie,x.usedParams=this.getUsedParamsDetails(s),x):ie}if(l){const ie=Array.isArray(xe),pe=ie?[]:{},we=ie?T:_;for(const q in xe)if(Object.prototype.hasOwnProperty.call(xe,q)){const oe=`${we}${l}${q}`;j&&!w?pe[q]=this.translate(oe,{...s,defaultValue:Mm(te)?te[q]:void 0,joinArrays:!1,ns:d}):pe[q]=this.translate(oe,{...s,joinArrays:!1,ns:d}),pe[q]===oe&&(pe[q]=xe[q])}w=pe}}else if(B&&qe(E)&&Array.isArray(w))w=w.join(E),w&&(w=this.extendTranslation(w,e,s,a));else{let ie=!1,pe=!1;!this.isValidLookup(w)&&j&&(ie=!0,w=te),this.isValidLookup(w)||(pe=!0,w=u);const q=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&pe?void 0:w,oe=j&&te!==w&&this.options.updateMissing;if(pe||ie||oe){if(this.logger.log(oe?"updateKey":"missingKey",p,h,L&&!oe?`${u}${this.pluralResolver.getSuffix(p,s.count,s)}`:u,oe?te:w),l){const We=this.resolve(u,{...s,keySeparator:!1});We&&We.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let ge=[];const be=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&be&&be[0])for(let We=0;We<be.length;We++)ge.push(be[We]);else this.options.saveMissingTo==="all"?ge=this.languageUtils.toResolveHierarchy(s.lng||this.language):ge.push(s.lng||this.language);const Ve=(We,ze,Re)=>{var kt;const lt=j&&Re!==w?Re:q;this.options.missingKeyHandler?this.options.missingKeyHandler(We,h,ze,lt,oe,s):(kt=this.backendConnector)!=null&&kt.saveMissing&&this.backendConnector.saveMissing(We,h,ze,lt,oe,s),this.emit("missingKey",We,h,ze,w)};this.options.saveMissing&&(this.options.saveMissingPlurals&&L?ge.forEach(We=>{const ze=this.pluralResolver.getSuffixes(We,s);ee&&s[`defaultValue${this.options.pluralSeparator}zero`]&&!ze.includes(`${this.options.pluralSeparator}zero`)&&ze.push(`${this.options.pluralSeparator}zero`),ze.forEach(Re=>{Ve([We],u+Re,s[`defaultValue${Re}`]||te)})}):Ve(ge,u,te))}w=this.extendTranslation(w,e,s,x,a),pe&&w===u&&this.options.appendNamespaceToMissingKey&&(w=`${h}${m}${u}`),(pe||ie)&&this.options.parseMissingKeyHandler&&(w=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${h}${m}${u}`:u,ie?w:void 0,s))}return o?(x.res=w,x.usedParams=this.getUsedParamsDetails(s),x):w}extendTranslation(e,t,a,s,o){var d,h;if((d=this.i18nFormat)!=null&&d.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...a},a.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!a.skipInterpolation){a.interpolation&&this.interpolator.init({...a,interpolation:{...this.options.interpolation,...a.interpolation}});const m=qe(e)&&(((h=a==null?void 0:a.interpolation)==null?void 0:h.skipOnVariables)!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(m){const x=e.match(this.interpolator.nestingRegexp);p=x&&x.length}let b=a.replace&&!qe(a.replace)?a.replace:a;if(this.options.interpolation.defaultVariables&&(b={...this.options.interpolation.defaultVariables,...b}),e=this.interpolator.interpolate(e,b,a.lng||this.language||s.usedLng,a),m){const x=e.match(this.interpolator.nestingRegexp),w=x&&x.length;p<w&&(a.nest=!1)}!a.lng&&s&&s.res&&(a.lng=this.language||s.usedLng),a.nest!==!1&&(e=this.interpolator.nest(e,(...x)=>(o==null?void 0:o[0])===x[0]&&!a.context?(this.logger.warn(`It seems you are nesting recursively key: ${x[0]} in key: ${t[0]}`),null):this.translate(...x,t),a)),a.interpolation&&this.interpolator.reset()}const l=a.postProcess||this.options.postProcess,u=qe(l)?[l]:l;return e!=null&&(u!=null&&u.length)&&a.applyPostProcessor!==!1&&(e=rx.handle(u,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(a)},...a}:a,this)),e}resolve(e,t={}){let a,s,o,l,u;return qe(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(d=>typeof d=="function"?Yo(d,{...this.options,...t}):d)),e.forEach(d=>{if(this.isValidLookup(a))return;const h=this.extractFromKey(d,t),m=h.key;s=m;let p=h.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));const b=t.count!==void 0&&!qe(t.count),x=b&&!t.ordinal&&t.count===0,w=t.context!==void 0&&(qe(t.context)||typeof t.context=="number")&&t.context!=="",_=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);p.forEach(T=>{var N,E;this.isValidLookup(a)||(u=T,!this.checkedLoadedFor[`${_[0]}-${T}`]&&((N=this.utils)!=null&&N.hasLoadedNamespace)&&!((E=this.utils)!=null&&E.hasLoadedNamespace(u))&&(this.checkedLoadedFor[`${_[0]}-${T}`]=!0,this.logger.warn(`key "${s}" for languages "${_.join(", ")}" won't get resolved as namespace "${u}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(B=>{var F;if(this.isValidLookup(a))return;l=B;const L=[m];if((F=this.i18nFormat)!=null&&F.addLookupKeys)this.i18nFormat.addLookupKeys(L,m,B,T,t);else{let Y;b&&(Y=this.pluralResolver.getSuffix(B,t.count,t));const ee=`${this.options.pluralSeparator}zero`,te=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(b&&(t.ordinal&&Y.startsWith(te)&&L.push(m+Y.replace(te,this.options.pluralSeparator)),L.push(m+Y),x&&L.push(m+ee)),w){const xe=`${m}${this.options.contextSeparator||"_"}${t.context}`;L.push(xe),b&&(t.ordinal&&Y.startsWith(te)&&L.push(xe+Y.replace(te,this.options.pluralSeparator)),L.push(xe+Y),x&&L.push(xe+ee))}}let j;for(;j=L.pop();)this.isValidLookup(a)||(o=j,a=this.getResource(B,T,j,t))}))})}),{res:a,usedKey:s,exactUsedKey:o,usedLng:l,usedNS:u}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,a,s={}){var o;return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(e,t,a,s):this.resourceStore.getResource(e,t,a,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],a=e.replace&&!qe(e.replace);let s=a?e.replace:e;if(a&&typeof e.count<"u"&&(s={...s,count:e.count}),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!a){s={...s};for(const o of t)delete s[o]}return s}static hasDefaultValue(e){const t="defaultValue";for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&a.startsWith(t)&&e[a]!==void 0)return!0;return!1}}class zb{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=gr.create("languageUtils")}getScriptPartFromCode(e){if(e=$c(e),!e||!e.includes("-"))return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=$c(e),!e||!e.includes("-"))return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(qe(e)&&e.includes("-")){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(a=>{if(t)return;const s=this.formatLanguageCode(a);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(a=>{if(t)return;const s=this.getScriptPartFromCode(a);if(this.isSupportedCode(s))return t=s;const o=this.getLanguagePartFromCode(a);if(this.isSupportedCode(o))return t=o;t=this.options.supportedLngs.find(l=>l===o?!0:!l.includes("-")&&!o.includes("-")?!1:!!(l.includes("-")&&!o.includes("-")&&l.slice(0,l.indexOf("-"))===o||l.startsWith(o)&&o.length>1))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),qe(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let a=e[t];return a||(a=e[this.getScriptPartFromCode(t)]),a||(a=e[this.formatLanguageCode(t)]),a||(a=e[this.getLanguagePartFromCode(t)]),a||(a=e.default),a||[]}toResolveHierarchy(e,t){const a=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),s=[],o=l=>{l&&(this.isSupportedCode(l)?s.push(l):this.logger.warn(`rejecting language code not found in supportedLngs: ${l}`))};return qe(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):qe(e)&&o(this.formatLanguageCode(e)),a.forEach(l=>{s.includes(l)||o(this.formatLanguageCode(l))}),s}}const $b={zero:0,one:1,two:2,few:3,many:4,other:5},Hb={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class _k{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=gr.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const a=$c(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:a,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let l;try{l=new Intl.PluralRules(a,{type:s})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Hb;if(!e.match(/-|_/))return Hb;const d=this.languageUtils.getLanguagePartFromCode(e);l=this.getRule(d,t)}return this.pluralRulesCache[o]=l,l}needsPlural(e,t={}){let a=this.getRule(e,t);return a||(a=this.getRule("dev",t)),(a==null?void 0:a.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,a={}){return this.getSuffixes(e,a).map(s=>`${t}${s}`)}getSuffixes(e,t={}){let a=this.getRule(e,t);return a||(a=this.getRule("dev",t)),a?a.resolvedOptions().pluralCategories.sort((s,o)=>$b[s]-$b[o]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,t,a={}){const s=this.getRule(e,a);return s?`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,a))}}const Ub=(n,e,t,a=".",s=!0)=>{let o=pk(n,e,t);return!o&&s&&qe(t)&&(o=jp(n,t,a),o===void 0&&(o=jp(e,t,a))),o},Ck=n=>n.replace(/\$/g,"$$$$");class Fb{constructor(e={}){var t;this.logger=gr.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(a=>a),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:a,useRawValueToEscape:s,prefix:o,prefixEscaped:l,suffix:u,suffixEscaped:d,formatSeparator:h,unescapeSuffix:m,unescapePrefix:p,nestingPrefix:b,nestingPrefixEscaped:x,nestingSuffix:w,nestingSuffixEscaped:_,nestingOptionsSeparator:T,maxReplaces:N,alwaysFormat:E}=e.interpolation;this.escape=t!==void 0?t:yk,this.escapeValue=a!==void 0?a:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?Zr(o):l||"{{",this.suffix=u?Zr(u):d||"}}",this.formatSeparator=h||",",this.unescapePrefix=m?"":p?Zr(p):"-",this.unescapeSuffix=this.unescapePrefix?"":m?Zr(m):"",this.nestingPrefix=b?Zr(b):x||Zr("$t("),this.nestingSuffix=w?Zr(w):_||Zr(")"),this.nestingOptionsSeparator=T||",",this.maxReplaces=N||1e3,this.alwaysFormat=E!==void 0?E:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,a)=>(t==null?void 0:t.source)===a?(t.lastIndex=0,t):new RegExp(a,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,a,s){var x;let o,l,u;const d=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},h=w=>{if(!w.includes(this.formatSeparator)){const E=Ub(t,d,w,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(E,void 0,a,{...s,...t,interpolationkey:w}):E}const _=w.split(this.formatSeparator),T=_.shift().trim(),N=_.join(this.formatSeparator).trim();return this.format(Ub(t,d,T,this.options.keySeparator,this.options.ignoreJSONStructure),N,a,{...s,...t,interpolationkey:T})};this.resetRegExp(),!this.escapeValue&&typeof e=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const m=(s==null?void 0:s.missingInterpolationHandler)||this.options.missingInterpolationHandler,p=((x=s==null?void 0:s.interpolation)==null?void 0:x.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:w=>w},{regex:this.regexp,safeValue:w=>this.escapeValue?this.escape(w):w}].forEach(w=>{for(u=0;o=w.regex.exec(e);){const _=o[1].trim();if(l=h(_),l===void 0)if(typeof m=="function"){const N=m(e,o,s);l=qe(N)?N:""}else if(s&&Object.prototype.hasOwnProperty.call(s,_))l="";else if(p){l=o[0];continue}else this.logger.warn(`missed to pass in variable ${_} for interpolating ${e}`),l="";else!qe(l)&&!this.useRawValueToEscape&&(l=Lb(l));const T=w.safeValue(l);if(e=e.replace(o[0],Ck(T)),p?(w.regex.lastIndex+=T.length,w.regex.lastIndex-=o[0].length):w.regex.lastIndex=0,u++,u>=this.maxReplaces)break}}),e}nest(e,t,a={}){let s,o,l;const u=(d,h)=>{const m=this.nestingOptionsSeparator;if(!d.includes(m))return d;const p=d.split(new RegExp(`${Zr(m)}[ ]*{`));let b=`{${p[1]}`;d=p[0],b=this.interpolate(b,l);const x=b.match(/'/g),w=b.match(/"/g);(((x==null?void 0:x.length)??0)%2===0&&!w||((w==null?void 0:w.length)??0)%2!==0)&&(b=b.replace(/'/g,'"'));try{l=JSON.parse(b),h&&(l={...h,...l})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${d}`,_),`${d}${m}${b}`}return l.defaultValue&&l.defaultValue.includes(this.prefix)&&delete l.defaultValue,d};for(;s=this.nestingRegexp.exec(e);){let d=[];l={...a},l=l.replace&&!qe(l.replace)?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;const h=/{.*}/s.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(h!==-1&&(d=s[1].slice(h).split(this.formatSeparator).map(m=>m.trim()).filter(Boolean),s[1]=s[1].slice(0,h)),o=t(u.call(this,s[1].trim(),l),l),o&&s[0]===e&&!qe(o))return o;qe(o)||(o=Lb(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),o=""),d.length&&(o=d.reduce((m,p)=>this.format(m,p,a.lng,{...a,interpolationkey:s[1].trim()}),o.trim())),e=e.replace(s[0],o),this.regexp.lastIndex=0}return e}}const Tk=n=>{let e=n.toLowerCase().trim();const t={};if(n.includes("(")){const a=n.split("(");e=a[0].toLowerCase().trim();const s=a[1].slice(0,-1);e==="currency"&&!s.includes(":")?t.currency||(t.currency=s.trim()):e==="relativetime"&&!s.includes(":")?t.range||(t.range=s.trim()):s.split(";").forEach(l=>{if(l){const[u,...d]=l.split(":"),h=d.join(":").trim().replace(/^'+|'+$/g,""),m=u.trim();t[m]||(t[m]=h),h==="false"&&(t[m]=!1),h==="true"&&(t[m]=!0),isNaN(h)||(t[m]=parseInt(h,10))}})}return{formatName:e,formatOptions:t}},Gb=n=>{const e={};return(t,a,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});const l=a+JSON.stringify(o);let u=e[l];return u||(u=n($c(a),s),e[l]=u),u(t)}},Ak=n=>(e,t,a)=>n($c(t),a)(e);class Ek{constructor(e={}){this.logger=gr.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const a=t.cacheInBuiltFormats?Gb:Ak;this.formats={number:a((s,o)=>{const l=new Intl.NumberFormat(s,{...o});return u=>l.format(u)}),currency:a((s,o)=>{const l=new Intl.NumberFormat(s,{...o,style:"currency"});return u=>l.format(u)}),datetime:a((s,o)=>{const l=new Intl.DateTimeFormat(s,{...o});return u=>l.format(u)}),relativetime:a((s,o)=>{const l=new Intl.RelativeTimeFormat(s,{...o});return u=>l.format(u,o.range||"day")}),list:a((s,o)=>{const l=new Intl.ListFormat(s,{...o});return u=>l.format(u)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Gb(t)}format(e,t,a,s={}){if(!t||e==null)return e;const o=t.split(this.formatSeparator),l=[];for(let d=0;d<o.length;d++){let h=o[d];for(;h.indexOf("(")>-1&&!h.includes(")")&&d+1<o.length;)h=`${h}${this.formatSeparator}${o[++d]}`;l.push(h)}return l.reduce((d,h)=>{var b;const{formatName:m,formatOptions:p}=Tk(h);if(this.formats[m]){let x=d;try{const w=((b=s==null?void 0:s.formatParams)==null?void 0:b[s.interpolationkey])||{},_=w.locale||w.lng||s.locale||s.lng||a;x=this.formats[m](d,_,{...p,...s,...w})}catch(w){this.logger.warn(w)}return x}else this.logger.warn(`there was no format function for ${m}`);return d},e)}}const Nk=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class Mk extends $0{constructor(e,t,a,s={}){var o,l;super(),this.backend=e,this.store=t,this.services=a,this.languageUtils=a.languageUtils,this.options=s,this.logger=gr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],(l=(o=this.backend)==null?void 0:o.init)==null||l.call(o,a,s.backend,s)}queueLoad(e,t,a,s){const o={},l={},u={},d={};return e.forEach(h=>{let m=!0;t.forEach(p=>{const b=`${h}|${p}`;!a.reload&&this.store.hasResourceBundle(h,p)?this.state[b]=2:this.state[b]<0||(this.state[b]===1?l[b]===void 0&&(l[b]=!0):(this.state[b]=1,m=!1,l[b]===void 0&&(l[b]=!0),o[b]===void 0&&(o[b]=!0),d[p]===void 0&&(d[p]=!0)))}),m||(u[h]=!0)}),(Object.keys(o).length||Object.keys(l).length)&&this.queue.push({pending:l,pendingCount:Object.keys(l).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(l),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(d)}}loaded(e,t,a){const s=e.split("|"),o=s[0],l=s[1];t&&this.emit("failedLoading",o,l,t),!t&&a&&this.store.addResourceBundle(o,l,a,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&a&&(this.state[e]=0);const u={};this.queue.forEach(d=>{mk(d.loaded,[o],l),Nk(d,e),t&&d.errors.push(t),d.pendingCount===0&&!d.done&&(Object.keys(d.loaded).forEach(h=>{u[h]||(u[h]={});const m=d.loaded[h];m.length&&m.forEach(p=>{u[h][p]===void 0&&(u[h][p]=!0)})}),d.done=!0,d.errors.length?d.callback(d.errors):d.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(d=>!d.done)}read(e,t,a,s=0,o=this.retryTimeout,l){if(!e.length)return l(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:a,tried:s,wait:o,callback:l});return}this.readingCalls++;const u=(h,m)=>{if(this.readingCalls--,this.waitingReads.length>0){const p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(h&&m&&s<this.maxRetries){setTimeout(()=>{this.read(e,t,a,s+1,o*2,l)},o);return}l(h,m)},d=this.backend[a].bind(this.backend);if(d.length===2){try{const h=d(e,t);h&&typeof h.then=="function"?h.then(m=>u(null,m)).catch(u):u(null,h)}catch(h){u(h)}return}return d(e,t,u)}prepareLoading(e,t,a={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();qe(e)&&(e=this.languageUtils.toResolveHierarchy(e)),qe(t)&&(t=[t]);const o=this.queueLoad(e,t,a,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.toLoad.forEach(l=>{this.loadOne(l)})}load(e,t,a){this.prepareLoading(e,t,{},a)}reload(e,t,a){this.prepareLoading(e,t,{reload:!0},a)}loadOne(e,t=""){const a=e.split("|"),s=a[0],o=a[1];this.read(s,o,"read",void 0,void 0,(l,u)=>{l&&this.logger.warn(`${t}loading namespace ${o} for language ${s} failed`,l),!l&&u&&this.logger.log(`${t}loaded namespace ${o} for language ${s}`,u),this.loaded(e,l,u)})}saveMissing(e,t,a,s,o,l={},u=()=>{}){var d,h,m,p,b;if((h=(d=this.services)==null?void 0:d.utils)!=null&&h.hasLoadedNamespace&&!((p=(m=this.services)==null?void 0:m.utils)!=null&&p.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${a}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(a==null||a==="")){if((b=this.backend)!=null&&b.create){const x={...l,isUpdate:o},w=this.backend.create.bind(this.backend);if(w.length<6)try{let _;w.length===5?_=w(e,t,a,s,x):_=w(e,t,a,s),_&&typeof _.then=="function"?_.then(T=>u(null,T)).catch(u):u(null,_)}catch(_){u(_)}else w(e,t,a,s,u,x)}!e||!e[0]||this.store.addResource(e[0],t,a,s)}}}const Rm=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),qe(n[1])&&(e.defaultValue=n[1]),qe(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(a=>{e[a]=t[a]})}return e},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),qb=n=>(qe(n.ns)&&(n.ns=[n.ns]),qe(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),qe(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&!n.supportedLngs.includes("cimode")&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n),_d=()=>{},Rk=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};class Nc extends $0{constructor(e={},t){if(super(),this.options=qb(e),this.services={},this.logger=gr,this.modules={external:[]},Rk(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(qe(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const a=Rm();this.options={...a,...this.options,...qb(e)},this.options.interpolation={...a.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=a.overloadTranslationOptionHandler);const s=h=>h?typeof h=="function"?new h:h:null;if(!this.options.isClone){this.modules.logger?gr.init(s(this.modules.logger),this.options):gr.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:h=Ek;const m=new zb(this.options);this.store=new Ib(this.options.resources,this.options);const p=this.services;p.logger=gr,p.resourceStore=this.store,p.languageUtils=m,p.pluralResolver=new _k(m,{prepend:this.options.pluralSeparator}),h&&(p.formatter=s(h),p.formatter.init&&p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new Fb(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new Mk(s(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",(b,...x)=>{this.emit(b,...x)}),this.modules.languageDetector&&(p.languageDetector=s(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=s(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new c0(this.services,this.options),this.translator.on("*",(b,...x)=>{this.emit(b,...x)}),this.modules.external.forEach(b=>{b.init&&b.init(this)})}if(this.format=this.options.interpolation.format,t||(t=_d),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(h=>{this[h]=(...m)=>this.store[h](...m)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=(...m)=>(this.store[h](...m),this)});const u=fc(),d=()=>{const h=(m,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),u.resolve(p),t(m,p)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),u}loadResources(e,t=_d){var o,l;let a=t;const s=qe(e)?e:this.language;if(typeof e=="function"&&(a=e),!this.options.resources||this.options.partialBundledLanguages){if((s==null?void 0:s.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return a();const u=[],d=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(p=>{p!=="cimode"&&(u.includes(p)||u.push(p))})};s?d(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(m=>d(m)),(l=(o=this.options.preload)==null?void 0:o.forEach)==null||l.call(o,h=>d(h)),this.services.backendConnector.load(u,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),a(h)})}else a(null)}reloadResources(e,t,a){const s=fc();return typeof e=="function"&&(a=e,e=void 0),typeof t=="function"&&(a=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),a||(a=_d),this.services.backendConnector.reload(e,t,o=>{s.resolve(),a(o)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&rx.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!["cimode","dev"].includes(e)){for(let t=0;t<this.languages.length;t++){const a=this.languages[t];if(!["cimode","dev"].includes(a)&&this.store.hasLanguageSomeTranslations(a)){this.resolvedLanguage=a;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const a=fc();this.emit("languageChanging",e);const s=u=>{this.language=u,this.languages=this.services.languageUtils.toResolveHierarchy(u),this.resolvedLanguage=void 0,this.setResolvedLanguage(u)},o=(u,d)=>{d?this.isLanguageChangingTo===e&&(s(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,a.resolve((...h)=>this.t(...h)),t&&t(u,(...h)=>this.t(...h))},l=u=>{var m,p;!e&&!u&&this.services.languageDetector&&(u=[]);const d=qe(u)?u:u&&u[0],h=this.store.hasLanguageSomeTranslations(d)?d:this.services.languageUtils.getBestMatchFromCodes(qe(u)?[u]:u);h&&(this.language||s(h),this.translator.language||this.translator.changeLanguage(h),(p=(m=this.services.languageDetector)==null?void 0:m.cacheUserLanguage)==null||p.call(m,h)),this.loadResources(h,b=>{o(b,h)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),a}getFixedT(e,t,a,s){const o=s==null?void 0:s.scopeNs,l=(u,d,...h)=>{let m;typeof d!="object"?m=this.options.overloadTranslationOptionHandler([u,d].concat(h)):m={...d},m.lng=m.lng||l.lng,m.lngs=m.lngs||l.lngs;const p=m.ns!==void 0&&m.ns!==null;m.ns=m.ns||l.ns,m.keyPrefix!==""&&(m.keyPrefix=m.keyPrefix||a||l.keyPrefix);const b={...this.options,...m};Array.isArray(o)&&!p&&(b.ns=o),typeof m.keyPrefix=="function"&&(m.keyPrefix=Yo(m.keyPrefix,b));const x=this.options.keySeparator||".";let w;return m.keyPrefix&&Array.isArray(u)?w=u.map(_=>(typeof _=="function"&&(_=Yo(_,b)),`${m.keyPrefix}${x}${_}`)):(typeof u=="function"&&(u=Yo(u,b)),w=m.keyPrefix?`${m.keyPrefix}${x}${u}`:u),this.t(w,m)};return qe(e)?l.lng=e:l.lngs=e,l.ns=t,l.keyPrefix=a,l}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const a=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;const l=(u,d)=>{const h=this.services.backendConnector.state[`${u}|${d}`];return h===-1||h===0||h===2};if(t.precheck){const u=t.precheck(this,l);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||l(a,e)&&(!s||l(o,e)))}loadNamespaces(e,t){const a=fc();return this.options.ns?(qe(e)&&(e=[e]),e.forEach(s=>{this.options.ns.includes(s)||this.options.ns.push(s)}),this.loadResources(s=>{a.resolve(),t&&t(s)}),a):(t&&t(),Promise.resolve())}loadLanguages(e,t){const a=fc();qe(e)&&(e=[e]);const s=this.options.preload||[],o=e.filter(l=>!s.includes(l)&&this.services.languageUtils.isSupportedCode(l));return o.length?(this.options.preload=s.concat(o),this.loadResources(l=>{a.resolve(),t&&t(l)}),a):(t&&t(),Promise.resolve())}dir(e){var s,o;if(e||(e=this.resolvedLanguage||(((s=this.languages)==null?void 0:s.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const l=new Intl.Locale(e);if(l&&l.getTextInfo){const u=l.getTextInfo();if(u&&u.direction)return u.direction}}catch{}const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],a=((o=this.services)==null?void 0:o.languageUtils)||new zb(Rm());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.includes(a.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const a=new Nc(e,t);return a.createInstance=Nc.createInstance,a}cloneInstance(e={},t=_d){const a=e.forkResourceStore;a&&delete e.forkResourceStore;const s={...this.options,...e,isClone:!0},o=new Nc(s);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(u=>{o[u]=this[u]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},a){const u=Object.keys(this.store.data).reduce((d,h)=>(d[h]={...this.store.data[h]},d[h]=Object.keys(d[h]).reduce((m,p)=>(m[p]={...d[h][p]},m),d[h]),d),{});o.store=new Ib(u,s),o.services.resourceStore=o.store}if(e.interpolation){const d={...Rm().interpolation,...this.options.interpolation,...e.interpolation},h={...s,interpolation:d};o.services.interpolator=new Fb(h)}return o.translator=new c0(o.services,s),o.translator.on("*",(u,...d)=>{o.emit(u,...d)}),o.init(s,t),o.translator.options=s,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Sn=Nc.createInstance();Sn.createInstance;Sn.dir;Sn.init;Sn.loadResources;Sn.reloadResources;Sn.use;Sn.changeLanguage;Sn.getFixedT;Sn.t;Sn.exists;Sn.setDefaultNamespace;Sn.hasLoadedNamespace;Sn.loadNamespaces;Sn.loadLanguages;const Ok=(n,e,t,a)=>{var o,l,u,d;const s=[t,{code:e,...a||{}}];if((l=(o=n==null?void 0:n.services)==null?void 0:o.logger)!=null&&l.forward)return n.services.logger.forward(s,"warn","react-i18next::",!0);Gi(s[0])&&(s[0]=`react-i18next:: ${s[0]}`),(d=(u=n==null?void 0:n.services)==null?void 0:u.logger)!=null&&d.warn?n.services.logger.warn(...s):console!=null&&console.warn&&console.warn(...s)},Vb={},Pp=(n,e,t,a)=>{Gi(t)&&Vb[t]||(Gi(t)&&(Vb[t]=new Date),Ok(n,e,t,a))},ix=(n,e)=>()=>{if(n.isInitialized)e();else{const t=()=>{setTimeout(()=>{n.off("initialized",t)},0),e()};n.on("initialized",t)}},Ip=(n,e,t)=>{n.loadNamespaces(e,ix(n,t))},Wb=(n,e,t,a)=>{if(Gi(t)&&(t=[t]),n.options.preload&&n.options.preload.indexOf(e)>-1)return Ip(n,t,a);t.forEach(s=>{n.options.ns.indexOf(s)<0&&n.options.ns.push(s)}),n.loadLanguages(e,ix(n,a))},Dk=(n,e,t={})=>!e.languages||!e.languages.length?(Pp(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(n,{lng:t.lng,precheck:(a,s)=>{if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!s(a.isLanguageChangingTo,n))return!1}}),Gi=n=>typeof n=="string",Lk=n=>typeof n=="object"&&n!==null,Bk=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,jk={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Pk=n=>jk[n],Ik=n=>n.replace(Bk,Pk);let zp={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Ik,transDefaultProps:void 0};const zk=(n={})=>{zp={...zp,...n}},$k=()=>zp;let ox;const Hk=n=>{ox=n},Uk=()=>ox,Fk={type:"3rdParty",init(n){zk(n.options.react),Hk(n)}},Gk=O.createContext();class qk{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Vk=ak();const Wk=(n,e)=>{if(Gi(e))return e;if(Lk(e)&&Gi(e.defaultValue))return e.defaultValue;if(typeof n=="function")return"";if(Array.isArray(n)){const t=n[n.length-1];return typeof t=="function"?"":t}return n},Kk={t:Wk,ready:!1},Yk=()=>()=>{},vt=(n,e={})=>{var te,xe,De;const{i18n:t}=e,{i18n:a,defaultNS:s}=O.useContext(Gk)||{},o=t||a||Uk();o&&!o.reportNamespaces&&(o.reportNamespaces=new qk),o||Pp(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const l=O.useMemo(()=>{var ce;return{...$k(),...(ce=o==null?void 0:o.options)==null?void 0:ce.react,...e}},[o,e]),{useSuspense:u,keyPrefix:d}=l,h=n||s||((te=o==null?void 0:o.options)==null?void 0:te.defaultNS),m=Gi(h)?[h]:h||["translation"],p=O.useMemo(()=>m,m);(De=(xe=o==null?void 0:o.reportNamespaces)==null?void 0:xe.addUsedNamespaces)==null||De.call(xe,p);const b=O.useRef(0),x=O.useCallback(ce=>{if(!o)return Yk;const{bindI18n:ie,bindI18nStore:pe}=l,we=()=>{b.current+=1,ce()};return ie&&o.on(ie,we),pe&&o.store.on(pe,we),()=>{ie&&ie.split(" ").forEach(q=>o.off(q,we)),pe&&pe.split(" ").forEach(q=>o.store.off(q,we))}},[o,l]),w=O.useRef(),_=O.useCallback(()=>{if(!o)return Kk;const ce=!!(o.isInitialized||o.initializedStoreOnce)&&p.every(ge=>Dk(ge,o,l)),ie=e.lng||o.language,pe=b.current,we=w.current;if(we&&we.ready===ce&&we.lng===ie&&we.keyPrefix===d&&we.revision===pe)return we;const oe={t:o.getFixedT(ie,l.nsMode==="fallback"?p:p[0],d,{scopeNs:p}),ready:ce,lng:ie,keyPrefix:d,revision:pe};return w.current=oe,oe},[o,p,d,l,e.lng]),[T,N]=O.useState(0),{t:E,ready:B}=Vk.useSyncExternalStore(x,_,_);O.useEffect(()=>{if(o&&!B&&!u){const ce=()=>N(ie=>ie+1);e.lng?Wb(o,e.lng,p,ce):Ip(o,p,ce)}},[o,e.lng,p,B,u,T]);const L=o||{},j=O.useRef(null),F=O.useRef(),Y=ce=>{const ie=Object.getOwnPropertyDescriptors(ce);ie.__original&&delete ie.__original;const pe=Object.create(Object.getPrototypeOf(ce),ie);if(!Object.prototype.hasOwnProperty.call(pe,"__original"))try{Object.defineProperty(pe,"__original",{value:ce,writable:!1,enumerable:!1,configurable:!1})}catch{}return pe},ee=O.useMemo(()=>{const ce=L,ie=ce==null?void 0:ce.language;let pe=ce;ce&&(j.current&&j.current.__original===ce?F.current!==ie?(pe=Y(ce),j.current=pe,F.current=ie):pe=j.current:(pe=Y(ce),j.current=pe,F.current=ie));const we=!B&&!u?(...oe)=>(Pp(o,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),E(...oe)):E,q=[we,pe,B];return q.t=we,q.i18n=pe,q.ready=B,q},[E,L,B,L.resolvedLanguage,L.language,L.languages]);if(o&&u&&!B)throw new Promise(ce=>{const ie=()=>ce();e.lng?Wb(o,e.lng,p,ie):Ip(o,p,ie)});return ee},Zk={};function Xk(n,e){let t;try{t=n()}catch{return}return{getItem:s=>{var o;const l=d=>d===null?null:JSON.parse(d,void 0),u=(o=t.getItem(s))!=null?o:null;return u instanceof Promise?u.then(l):l(u)},setItem:(s,o)=>t.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>t.removeItem(s)}}const Hc=n=>e=>{try{const t=n(e);return t instanceof Promise?t:{then(a){return Hc(a)(t)},catch(a){return this}}}catch(t){return{then(a){return this},catch(a){return Hc(a)(t)}}}},Qk=(n,e)=>(t,a,s)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:T=>T,version:0,merge:(T,N)=>({...N,...T}),...e},l=!1;const u=new Set,d=new Set;let h;try{h=o.getStorage()}catch{}if(!h)return n((...T)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),t(...T)},a,s);const m=Hc(o.serialize),p=()=>{const T=o.partialize({...a()});let N;const E=m({state:T,version:o.version}).then(B=>h.setItem(o.name,B)).catch(B=>{N=B});if(N)throw N;return E},b=s.setState;s.setState=(T,N)=>{b(T,N),p()};const x=n((...T)=>{t(...T),p()},a,s);let w;const _=()=>{var T;if(!h)return;l=!1,u.forEach(E=>E(a()));const N=((T=o.onRehydrateStorage)==null?void 0:T.call(o,a()))||void 0;return Hc(h.getItem.bind(h))(o.name).then(E=>{if(E)return o.deserialize(E)}).then(E=>{if(E)if(typeof E.version=="number"&&E.version!==o.version){if(o.migrate)return o.migrate(E.state,E.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return E.state}).then(E=>{var B;return w=o.merge(E,(B=a())!=null?B:x),t(w,!0),p()}).then(()=>{N==null||N(w,void 0),l=!0,d.forEach(E=>E(w))}).catch(E=>{N==null||N(void 0,E)})};return s.persist={setOptions:T=>{o={...o,...T},T.getStorage&&(h=T.getStorage())},clearStorage:()=>{h==null||h.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>_(),hasHydrated:()=>l,onHydrate:T=>(u.add(T),()=>{u.delete(T)}),onFinishHydration:T=>(d.add(T),()=>{d.delete(T)})},_(),w||x},Jk=(n,e)=>(t,a,s)=>{let o={storage:Xk(()=>localStorage),partialize:_=>_,version:0,merge:(_,T)=>({...T,..._}),...e},l=!1;const u=new Set,d=new Set;let h=o.storage;if(!h)return n((..._)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),t(..._)},a,s);const m=()=>{const _=o.partialize({...a()});return h.setItem(o.name,{state:_,version:o.version})},p=s.setState;s.setState=(_,T)=>{p(_,T),m()};const b=n((..._)=>{t(..._),m()},a,s);s.getInitialState=()=>b;let x;const w=()=>{var _,T;if(!h)return;l=!1,u.forEach(E=>{var B;return E((B=a())!=null?B:b)});const N=((T=o.onRehydrateStorage)==null?void 0:T.call(o,(_=a())!=null?_:b))||void 0;return Hc(h.getItem.bind(h))(o.name).then(E=>{if(E)if(typeof E.version=="number"&&E.version!==o.version){if(o.migrate)return[!0,o.migrate(E.state,E.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,E.state];return[!1,void 0]}).then(E=>{var B;const[L,j]=E;if(x=o.merge(j,(B=a())!=null?B:b),t(x,!0),L)return m()}).then(()=>{N==null||N(x,void 0),x=a(),l=!0,d.forEach(E=>E(x))}).catch(E=>{N==null||N(void 0,E)})};return s.persist={setOptions:_=>{o={...o,..._},_.storage&&(h=_.storage)},clearStorage:()=>{h==null||h.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>w(),hasHydrated:()=>l,onHydrate:_=>(u.add(_),()=>{u.delete(_)}),onFinishHydration:_=>(d.add(_),()=>{d.delete(_)})},o.skipHydration||w(),x||b},e_=(n,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((Zk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Qk(n,e)):Jk(n,e),oi=e_;let Kb=!1;function yr(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():(Kb||(Kb=!0,console.warn("[uuid] crypto.randomUUID unavailable (non-secure context) — using Math.random fallback")),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)}))}const t_=4e3,Pi=new Map;function Yb(n,e){const t=Pi.get(n);t&&clearTimeout(t),!(e<=0)&&Pi.set(n,setTimeout(()=>{Pi.delete(n),is.setState(a=>({toasts:a.toasts.filter(s=>s.id!==n)}))},e))}const is=mn(n=>({toasts:[],addToast:(e,t,a)=>{const s=a??t_;n(o=>{const l=o.toasts.find(h=>h.type===e&&h.message===t);if(l)return Yb(l.id,s),{toasts:o.toasts.map(h=>h.id===l.id?{...h,count:h.count+1,createdAt:Date.now()}:h)};const u=`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;Yb(u,s);const d={id:u,type:e,message:t,duration:s,createdAt:Date.now(),count:1};return{toasts:[...o.toasts,d].slice(-10)}})},dismissToast:e=>{const t=Pi.get(e);t&&(clearTimeout(t),Pi.delete(e)),n(a=>({toasts:a.toasts.filter(s=>s.id!==e)}))},clearAll:()=>{for(const e of Pi.values())clearTimeout(e);Pi.clear(),n({toasts:[]})}})),Ze={info:(n,e)=>is.getState().addToast("info",n,e),success:(n,e)=>is.getState().addToast("success",n,e),warning:(n,e)=>is.getState().addToast("warning",n,e),error:(n,e)=>is.getState().addToast("error",n,e??6e3)},qo=24;function Zd(n){if(n.preview){const s=String(n.preview).replace(/\s+/g," ").trim();return s.length>qo?s.slice(0,qo)+"…":s}const e=Ue.getState().getMessages(n.id);if(!e||e.length===0)return"";const t=e.find(s=>s.type==="user"&&!s.deleted)||e.find(s=>!s.deleted)||e[0],a=String((t==null?void 0:t.content)||"").replace(/\s+/g," ").trim();return a?a.length>qo?a.slice(0,qo)+"…":a:""}function lx(n,e){if(!e)return!1;const t=n.replace(/\s+/g," ").replace(/\.\.\.$/,"");return t?!e.startsWith(t):!0}const n_=3e4;function Jg(n){let e=0;function t(l,u){try{return localStorage.setItem(l,JSON.stringify(u)),e=0,!0}catch{return!1}}return{getItem:l=>{const u=localStorage.getItem(l);if(!u)return null;try{const d=JSON.parse(u);return d&&typeof d=="object"&&"state"in d?d:{state:d,version:0}}catch{return null}},setItem:(l,u)=>{var m;if(t(l,u))return;let d=u;for(const p of n.trims??[]){try{d=p(d)}catch{continue}if(t(l,d))return}const h=Date.now();if(h-e>n_){e=h;const p=new Error(`localStorage 配额已满或不可用(${n.key}),已降级为仅内存持久化,刷新页面将丢失部分历史。`);console.warn(`[${n.key}] 持久化失败:`,p);try{(m=n.onFailure)==null||m.call(n,p)}catch{}}},removeItem:l=>{try{localStorage.removeItem(l)}catch{}}}}const $p=6,cx=50,Zb=50;let Xb=0,Qb=0;function a_(){const n=Date.now();n!==Qb&&(Qb=n,Xb=0);const e=(++Xb).toString(36),t=Math.random().toString(36).slice(2,6);return`s_${n.toString(36)}${e}${t}`}const r_=100,hc=2e3,mc=(n,e)=>n&&(n.length>e?`${n.slice(0,e)}…`:n),ux=n=>{const{logs:e,...t}=n;return{...t,description:mc(t.description,hc),result:mc(t.result,hc),error:mc(t.error,hc),stepPrompt:mc(t.stepPrompt,hc),context:t.context?Object.fromEntries(Object.entries(t.context).map(([a,s])=>[a,mc(s,hc)??""])):void 0,children:t.children?t.children.map(ux):void 0}},Xd=n=>[...n].sort((e,t)=>(t.lastActiveAt??t.createdAt??0)-(e.lastActiveAt??e.createdAt??0));function Om(n,e){const t=new Set(n.map(u=>u.id)),a=[],s=new Set,o=Math.max(0,cx-n.length);let l=0;for(const u of Xd(e)){if(t.has(u.id)){a.push(u);continue}if(l>=o){s.add(u.id);continue}a.push(u),l++}return{history:a,droppedIds:s}}function Jb(n,e,t,a){return a.size===0?{sessions:n,tasksBySession:e,sessionWorkspaceDirs:t}:{sessions:n.filter(s=>!a.has(s.id)),tasksBySession:Object.fromEntries(Object.entries(e).filter(([s])=>!a.has(s))),sessionWorkspaceDirs:Object.fromEntries(Object.entries(t).filter(([s])=>!a.has(s)))}}const Ke=mn()(oi((n,e)=>({sessions:[],activeSessionId:null,sessionTabs:[],layout:"single",sessionWorkspaceDirs:{},tasksBySession:{},historySessions:[],addSession:t=>n(a=>({sessions:[t,...a.sessions].slice(0,Zb),activeSessionId:t.id})),removeSession:t=>n(a=>{var s;return{sessions:a.sessions.filter(o=>o.id!==t),activeSessionId:a.activeSessionId===t?((s=a.sessions[0])==null?void 0:s.id)||null:a.activeSessionId}}),updateSession:(t,a)=>n(s=>({sessions:s.sessions.map(o=>o.id===t?{...o,...a}:o)})),setActiveSession:t=>n({activeSessionId:t}),setSessionWorkspaceDir:(t,a)=>n(s=>({sessionWorkspaceDirs:{...s.sessionWorkspaceDirs,[t]:a}})),getSessionWorkspaceDir:t=>e().sessionWorkspaceDirs[t]||"",addSessionTab:(t,a)=>{const s=e();if(s.sessionTabs.length>=$p){const w=s.sessionTabs.reduce((_,T)=>_.createdAt<T.createdAt?_:T);e().closeSessionTab(w.id)}const o=a_(),l=a&&a.split(/[\\/]/).filter(Boolean).pop()||void 0,u={id:o,title:t||`对话 ${s.sessionTabs.length+1}`,createdAt:Date.now(),lastActiveAt:Date.now(),project:l,status:"done"},d={id:o,title:t||`对话 ${s.sessionTabs.length+1}`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0},h={...s.sessionWorkspaceDirs};a&&(h[o]=a);const m={...s.tasksBySession};m[o]||(m[o]=[]);const p=Xd([u,...s.sessionTabs]),b=Om(p,[u,...s.historySessions.filter(w=>w.id!==o)]),x=Jb([...s.sessions,d].slice(-Zb),m,h,b.droppedIds);return n({sessionTabs:p,sessions:x.sessions,sessionWorkspaceDirs:x.sessionWorkspaceDirs,tasksBySession:x.tasksBySession,activeSessionId:o,historySessions:b.history}),o},closeSessionTab:t=>{var m;const a=e(),s=a.sessionTabs.find(p=>p.id===t),o=a.sessionTabs.filter(p=>p.id!==t);if(o.length===0)return;let l=a.historySessions;s&&(l=[s,...l.filter(p=>p.id!==t)]);const u=Om(o,l),d=Jb(a.sessions,a.tasksBySession,a.sessionWorkspaceDirs,u.droppedIds),h=o[o.length-1];n({sessionTabs:o,historySessions:u.history,sessions:d.sessions,tasksBySession:d.tasksBySession,sessionWorkspaceDirs:d.sessionWorkspaceDirs,activeSessionId:a.activeSessionId===t?h?h.id:((m=o[0])==null?void 0:m.id)||null:a.activeSessionId})},renameSessionTab:(t,a)=>n(s=>({sessionTabs:s.sessionTabs.map(o=>o.id===t?{...o,title:a}:o),sessions:s.sessions.map(o=>o.id===t?{...o,title:a,updatedAt:new Date().toISOString()}:o),historySessions:s.historySessions.map(o=>o.id===t?{...o,title:a}:o)})),getActiveSessionTab:()=>{const t=e();return t.sessionTabs.find(a=>a.id===t.activeSessionId)||null},getVisibleSessionTabs:()=>{const t=e(),a=t.sessionTabs.find(s=>s.id===t.activeSessionId);return a?[a]:t.sessionTabs.slice(0,1)},addSessionTask:(t,a,s,o)=>n(l=>{const u=l.tasksBySession[t]||[],d={id:`session-task-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:a.trim(),completed:!1,createdAt:Date.now(),backendId:s,description:o};return{tasksBySession:{...l.tasksBySession,[t]:[...u,d]}}}),toggleSessionTask:(t,a)=>n(s=>{const o=s.tasksBySession[t]||[];return{tasksBySession:{...s.tasksBySession,[t]:o.map(l=>l.id===a?{...l,completed:!l.completed}:l)}}}),removeSessionTask:(t,a)=>n(s=>({tasksBySession:{...s.tasksBySession,[t]:(s.tasksBySession[t]||[]).filter(o=>o.id!==a)}})),updateSessionTask:(t,a,s)=>n(o=>{const l=o.tasksBySession[t]||[];return{tasksBySession:{...o.tasksBySession,[t]:l.map(u=>u.id===a?{...u,title:s.trim()}:u)}}}),getSessionTasks:t=>e().tasksBySession[t]||[],setSessionTasks:(t,a)=>n(s=>({tasksBySession:{...s.tasksBySession,[t]:a}})),updateTaskPlanStatus:(t,a,s)=>n(o=>{const l=o.tasksBySession[t]||[];return{tasksBySession:{...o.tasksBySession,[t]:l.map(u=>u.id===a?{...u,...s}:u)}}}),autoNameSession:(t,a)=>{const o=e().sessionTabs.find(d=>d.id===t);if(!o||!/^对话 \d+$/.test(o.title))return;const l=a.replace(/\s+/g," ").trim(),u=l.slice(0,20)+(l.length>20?"...":"");u&&e().renameSessionTab(t,u)},updateSessionStatus:(t,a)=>n(s=>({sessionTabs:s.sessionTabs.map(o=>o.id===t?{...o,status:a}:o)})),touchSession:(t,a)=>n(s=>{const o=Date.now();let l;if(a){const d=a.replace(/\s+/g," ").trim();l=d.length>qo?d.slice(0,qo)+"…":d}const u=d=>({...d,lastActiveAt:o,...l&&!d.preview?{preview:l}:{}});return{sessionTabs:Xd(s.sessionTabs.map(d=>d.id===t?u(d):d)),sessions:s.sessions.map(d=>d.id===t?{...d,updatedAt:new Date(o).toISOString()}:d),historySessions:s.historySessions.map(d=>d.id===t?u(d):d)}}),getHistorySessions:()=>e().historySessions,restoreHistorySession:t=>{const a=e(),s=a.historySessions.find(d=>d.id===t);if(!s)return;const o=a.historySessions.filter(d=>d.id!==t);if(a.sessionTabs.some(d=>d.id===t)){n({historySessions:o,activeSessionId:t});return}let l=a.sessionTabs;if(l.length>=$p){const d=l.reduce((h,m)=>h.createdAt<m.createdAt?h:m);l=l.filter(h=>h.id!==d.id),o.unshift(d)}const u=Xd([s,...l]);n({sessionTabs:u,historySessions:Om(u,o).history,activeSessionId:t})},clearHistorySessions:()=>n({historySessions:[]}),removeHistorySession:t=>n(a=>({historySessions:a.historySessions.filter(s=>s.id!==t)}))}),{name:"deepseekcode-session-storage",storage:Jg({key:"sessionStore",trims:[n=>({...n,state:{...n.state,tasksBySession:Object.fromEntries(Object.entries(n.state.tasksBySession).map(([e,t])=>[e,t.map(a=>({id:a.id,title:a.title,completed:a.completed,createdAt:a.createdAt,planStatus:a.planStatus,backendId:a.backendId,backendStatus:a.backendStatus,agentType:a.agentType,progress:a.progress}))]))}}),n=>{const e=new Set([...n.state.sessionTabs.map(t=>t.id),...n.state.historySessions.map(t=>t.id)]);return n.state.activeSessionId&&e.add(n.state.activeSessionId),{...n,state:{...n.state,tasksBySession:Object.fromEntries(Object.entries(n.state.tasksBySession).filter(([t])=>e.has(t)))}}},n=>({...n,state:{...n.state,tasksBySession:{}}})],onFailure:()=>{try{is.getState().addToast("warning","会话数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失,建议清理旧会话或导出数据。",8e3)}catch{}}}),partialize:n=>{const e=new Set;for(const s of n.sessionTabs)e.add(s.id);for(const s of n.historySessions)e.add(s.id);n.activeSessionId&&e.add(n.activeSessionId);const t=n.sessions.filter(s=>e.has(s.id)),a={};for(const[s,o]of Object.entries(n.tasksBySession))e.has(s)&&(a[s]=o.slice(0,r_).map(ux));return{sessions:t,sessionTabs:n.sessionTabs,activeSessionId:n.activeSessionId,layout:n.layout,sessionWorkspaceDirs:n.sessionWorkspaceDirs,tasksBySession:a,historySessions:n.historySessions}}})),s_="deepseekcode-chat-store",i_=500,o_=3e4,l_=2e4,u0=4e3;let mr=null,Dm=0,Mc=null;const Rc=(n,e)=>!n||n.length<=e?n:n.slice(0,e)+"…",e2=n=>({...n,args:typeof n.args=="string"?Rc(n.args,u0)??n.args:n.args,result:typeof n.result=="string"?Rc(n.result,u0)??n.result:n.result}),c_=n=>{const e={...n,thinkingBlocks:void 0,content:Rc(n.content,l_)??n.content};return n.steps&&(e.steps=n.steps.map(t=>{var a;return{...t,thought:Rc(t.thought,u0),result:Rc(t.result,u0),toolCalls:(a=t.toolCalls)==null?void 0:a.map(e2)}})),n.toolCalls&&(e.toolCalls=n.toolCalls.map(e2)),e},u_=[n=>{const e=Ke.getState(),t=new Set;for(const s of e.sessionTabs)t.add(s.id);for(const s of e.historySessions)t.add(s.id);e.activeSessionId&&t.add(e.activeSessionId);const a={};for(const[s,o]of Object.entries(n.state.messagesBySession||{}))t.has(s)&&Array.isArray(o)&&o.length>0&&(a[s]=o);return{...n,state:{...n.state,messagesBySession:a}}},n=>{const e={};for(const[t,a]of Object.entries(n.state.messagesBySession||{}))e[t]=(Array.isArray(a)?a:[]).slice(-60).map(c_);return{...n,state:{...n.state,messagesBySession:e}}},n=>{const e=Ke.getState().activeSessionId||"",t=(n.state.messagesBySession||{})[e]||[],a=(Array.isArray(t)?t:[]).slice(-30).map(s=>({id:s.id,type:s.type,content:s.content,timestamp:s.timestamp,...s.thinking?{thinking:s.thinking}:{}}));return{...n,state:{...n.state,messagesBySession:e?{[e]:a}:{}}}}];function dx(n,e){const t=o=>{try{return localStorage.setItem(n,JSON.stringify(o)),Dm=0,!0}catch{return!1}};if(t(e))return;let a=e;for(const o of u_){try{a=o(a)}catch{continue}if(t(a))return}const s=Date.now();if(s-Dm>o_){Dm=s,console.error("[chatStore] localStorage 持久化失败,刷新页面将丢失历史消息:",new Error("quota exceeded or storage unavailable"));try{is.getState().addToast("warning","聊天记录保存失败:浏览器本地存储已满或不可用。刷新页面将丢失历史消息,建议导出会话或清理旧会话。",8e3)}catch{}}}function d_(){mr&&(clearTimeout(mr),mr=null);const n=Mc;Mc=null,n&&dx(n.name,n.value)}const f_={getItem:n=>{const e=localStorage.getItem(n);if(!e)return null;try{const t=JSON.parse(e);return t&&typeof t=="object"&&"state"in t?t:{state:t,version:0}}catch{return null}},setItem:(n,e)=>{Mc={name:n,value:e},mr&&clearTimeout(mr),mr=setTimeout(()=>{mr=null,Mc=null,dx(n,e)},i_)},removeItem:n=>{Mc=null,mr&&(clearTimeout(mr),mr=null);try{localStorage.removeItem(n)}catch{}}};if(typeof window<"u"){const n=()=>d_();window.addEventListener("pagehide",n),window.addEventListener("beforeunload",n)}function t2(n,e,t){const a=n.thinkingBlocks?n.thinkingBlocks.map(s=>({...s})):n.thinking?[{index:Number.MIN_SAFE_INTEGER,text:n.thinking}]:[];if(typeof t=="number"){const s=a.find(o=>o.index===t);s?s.text+=e:a.push({index:t,text:e})}else if(a.length>0){const s=a.length-1,o=a[s];o?a[s]={...o,text:o.text+e}:a.push({index:0,text:e})}else a.push({index:0,text:e});return a.sort((s,o)=>s.index-o.index),{...n,thinkingBlocks:a,thinking:a.map(s=>s.text).join("")}}const Ue=mn()(oi((n,e)=>({messagesBySession:{},generatingSessions:[],pausedSessions:[],sessionInputs:{},getMessages:t=>e().messagesBySession[t]||[],replaceMessages:(t,a)=>n(s=>({messagesBySession:{...s.messagesBySession,[t]:a.slice(-200)}})),addMessage:(t,a)=>n(s=>{const l=[...s.messagesBySession[t]||[],a].slice(-200);return{messagesBySession:{...s.messagesBySession,[t]:l}}}),updateLastMessage:(t,a)=>n(s=>{const o=(s.messagesBySession[t]||[]).map((l,u,d)=>u===d.length-1&&l.type==="assistant"?{...l,content:a}:l);return{messagesBySession:{...s.messagesBySession,[t]:o}}}),appendToLastMessage:(t,a)=>n(s=>{const o=s.messagesBySession[t];if(!o||o.length===0)return s;const l=o.length-1,u=o[l];if(u&&u.type==="assistant"){const d=o.slice();return d[l]={...u,content:u.content+a},{messagesBySession:{...s.messagesBySession,[t]:d}}}return{messagesBySession:{...s.messagesBySession,[t]:[...o,{id:yr(),type:"assistant",content:a,timestamp:Date.now()}].slice(-200)}}}),setThinking:(t,a)=>n(s=>{const o=(s.messagesBySession[t]||[]).map((l,u,d)=>{var m;if(u!==d.length-1||l.type!=="assistant")return l;const h=(m=l.steps)==null?void 0:m.findIndex(p=>p.status==="running");if(h!==void 0&&h!==-1&&l.steps&&l.steps[h]){const p=l.steps.map((b,x)=>x===h?{...b,thought:a}:b);return{...l,steps:p}}return{...l,thinking:a,thinkingBlocks:a?[{index:0,text:a}]:[]}});return{messagesBySession:{...s.messagesBySession,[t]:o}}}),appendToLastMessageThinking:(t,a,s)=>n(o=>{var b,x;const l=o.messagesBySession[t];if(!l||l.length===0)return o;const u=l.length-1,d=l[u];if(!d||d.type!=="assistant")return{messagesBySession:{...o.messagesBySession,[t]:[...l,t2({id:yr(),type:"assistant",content:"",timestamp:Date.now()},a,s)].slice(-200)}};let h;const m=(b=d.steps)==null?void 0:b.findIndex(w=>w.status==="running");if(m!==void 0&&m!==-1&&((x=d.steps)!=null&&x[m])){const w=d.steps.slice(),_=w[m];w[m]={..._,thought:(_.thought||"")+a},h={...d,steps:w}}else if(d.steps&&d.steps.length>0){const w=d.steps.length-1,_=d.steps.slice(),T=_[w];_[w]={...T,thought:(T.thought||"")+a},h={...d,steps:_}}else h=t2(d,a,s);const p=l.slice();return p[u]=h,{messagesBySession:{...o.messagesBySession,[t]:p}}}),addStep:(t,a)=>n(s=>{const o=(s.messagesBySession[t]||[]).map((l,u,d)=>{var b,x;if(u!==d.length-1||l.type!=="assistant")return l;const h=(b=l.toolCalls)==null?void 0:b.filter(w=>{var _;return!((_=l.steps)!=null&&_.some(T=>{var N;return(N=T.toolCalls)==null?void 0:N.some(E=>E.id===w.id)}))}),m={...a};h!=null&&h.length&&(m.toolCalls=[...m.toolCalls||[],...h]);let p=l.thinking||"";return p.trim().length>0&&(m.thought=(m.thought||"")+p,p=""),{...l,thinking:p,thinkingBlocks:[],toolCalls:h!=null&&h.length?(x=l.toolCalls)==null?void 0:x.filter(w=>!h.some(_=>_.id===w.id)):l.toolCalls,steps:[...l.steps||[],m]}});return{messagesBySession:{...s.messagesBySession,[t]:o}}}),updateStep:(t,a,s)=>n(o=>{const l=(o.messagesBySession[t]||[]).map((u,d,h)=>{if(d!==h.length-1||!u.steps)return u;const m=u.steps.findIndex(b=>b.id===a);if(m===-1)return u;const p=u.steps.map((b,x)=>x===m?{...b,...s}:b);return{...u,steps:p}});return{messagesBySession:{...o.messagesBySession,[t]:l}}}),addToolCall:(t,a)=>n(s=>{const o=(s.messagesBySession[t]||[]).map((l,u,d)=>{var m;if(u!==d.length-1||l.type!=="assistant")return l;const h=(m=l.steps)==null?void 0:m.findIndex(p=>p.status==="running");if(h!==void 0&&h!==-1&&l.steps&&l.steps[h]){const p=l.steps.map((b,x)=>x===h?{...b,toolCalls:[...b.toolCalls||[],a]}:b);return{...l,steps:p}}if(l.steps&&l.steps.length>0){const p=l.steps.length-1,b=l.steps.map((x,w)=>w===p?{...x,toolCalls:[...x.toolCalls||[],a]}:x);return{...l,steps:b}}return{...l,toolCalls:[...l.toolCalls||[],a]}});return{messagesBySession:{...s.messagesBySession,[t]:o}}}),updateToolCall:(t,a,s)=>n(o=>{const l=d=>{if(!d)return null;const h=d.findIndex(m=>m.id===a);return h===-1?null:d.map((m,p)=>p===h?{...m,...s}:m)},u=(o.messagesBySession[t]||[]).map((d,h,m)=>{var x,w;if(h!==m.length-1||d.type!=="assistant")return d;const p=(x=d.steps)==null?void 0:x.findIndex(_=>_.status==="running");if(p!==void 0&&p!==-1&&d.steps&&d.steps[p]){const _=l((w=d.steps[p])==null?void 0:w.toolCalls);if(_){const T=d.steps.map((N,E)=>E===p?{...N,toolCalls:_}:N);return{...d,steps:T}}}if(d.steps){let _=!1;const T=d.steps.map(N=>{if(_)return N;const E=l(N.toolCalls);return E?(_=!0,{...N,toolCalls:E}):N});if(_)return{...d,steps:T}}const b=l(d.toolCalls);return b?{...d,toolCalls:b}:d});return{messagesBySession:{...o.messagesBySession,[t]:u}}}),appendToLastToolCallArgs:(t,a,s,o)=>n(l=>{const u=m=>{let p=m.args;if(typeof p=="string")p=p+s;else if(typeof p=="object"&&p!==null){const b=s.trim();if(b.startsWith("{")&&b.endsWith("}"))try{const x=JSON.parse(b);typeof p=="string"?p={...x}:p={...p,...x}}catch{p=JSON.stringify(p).slice(0,-1)+","+b.slice(1)}else typeof p=="string"?p=p+b:p=JSON.stringify(p)+b}else p=s;return{...m,args:p}},d=m=>{if(!m)return null;const p=m.findIndex(b=>o!==void 0&&b.index===o||b.id===a);return p===-1?null:m.map((b,x)=>x===p?u(b):b)},h=(l.messagesBySession[t]||[]).map((m,p,b)=>{var _,T;if(p!==b.length-1||m.type!=="assistant")return m;const x=(_=m.steps)==null?void 0:_.findIndex(N=>N.status==="running");if(x!==void 0&&x!==-1&&m.steps&&m.steps[x]){const N=d((T=m.steps[x])==null?void 0:T.toolCalls);if(N){const E=m.steps.map((B,L)=>L===x?{...B,toolCalls:N}:B);return{...m,steps:E}}}if(m.steps){let N=!1;const E=m.steps.map(B=>{if(N)return B;const L=d(B.toolCalls);return L?(N=!0,{...B,toolCalls:L}):B});if(N)return{...m,steps:E}}const w=d(m.toolCalls);return w?{...m,toolCalls:w}:m});return{messagesBySession:{...l.messagesBySession,[t]:h}}}),startGeneration:t=>n(a=>({generatingSessions:a.generatingSessions.includes(t)?a.generatingSessions:[...a.generatingSessions,t]})),endGeneration:(t,a)=>n(s=>{var h,m,p;const o=s.messagesBySession[t]||[],l=Date.now(),u=o.map(b=>{var T,N;let x=!1;const w=(T=b.steps)==null?void 0:T.map(E=>{if(!E.toolCalls)return E;const B=E.toolCalls.map(L=>L.status!=="running"?L:(x=!0,{...L,status:"error",result:"生成已结束(工具执行超时或连接中断)",duration:Math.floor((l-(L.timestamp||l))/1e3)}));return B!==E.toolCalls?{...E,toolCalls:B}:E}),_=(N=b.toolCalls)==null?void 0:N.map(E=>E.status!=="running"?E:(x=!0,{...E,status:"error",result:"生成已结束(工具执行超时或连接中断)",duration:Math.floor((l-(E.timestamp||l))/1e3)}));return x?{...b,steps:w,toolCalls:_}:b}),d=u[u.length-1];if(d&&d.type==="assistant"&&!d.content&&!d.thinking&&!((h=d.thinkingBlocks)!=null&&h.length)&&!((m=d.steps)!=null&&m.length)&&!((p=d.toolCalls)!=null&&p.length)&&!d.hookApproval){const{[t]:b,...x}=s.messagesBySession;return{generatingSessions:s.generatingSessions.filter(w=>w!==t),pausedSessions:s.pausedSessions.filter(w=>w!==t),messagesBySession:{...x,[t]:u.slice(0,-1)}}}return{generatingSessions:s.generatingSessions.filter(b=>b!==t),pausedSessions:s.pausedSessions.filter(b=>b!==t),messagesBySession:{...s.messagesBySession,[t]:u}}}),pauseGeneration:t=>n(a=>({pausedSessions:a.pausedSessions.includes(t)?a.pausedSessions:[...a.pausedSessions,t]})),resumeGeneration:t=>n(a=>({pausedSessions:a.pausedSessions.filter(s=>s!==t)})),clearMessages:t=>n(a=>{const{[t]:s,...o}=a.messagesBySession;return{messagesBySession:o}}),removeSession:t=>n(a=>{const{[t]:s,...o}=a.messagesBySession,{[t]:l,...u}=a.sessionInputs;return{messagesBySession:o,sessionInputs:u,generatingSessions:a.generatingSessions.filter(d=>d!==t)}}),setSessionInput:(t,a)=>n(s=>({sessionInputs:{...s.sessionInputs,[t]:a}})),getSessionInput:t=>e().sessionInputs[t]||"",attachHookApproval:(t,a)=>n(s=>{const o=s.messagesBySession[t]||[];if(o.length===0){const h={id:`hook-approval-${a.approvalId||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:a};return{messagesBySession:{...s.messagesBySession,[t]:[h]}}}const l=o.length-1,u=o[l];if(u&&u.type==="assistant"){const h=o.slice();return h[l]={...u,hookApproval:a},{messagesBySession:{...s.messagesBySession,[t]:h}}}const d={id:`hook-approval-${a.approvalId||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:a};return{messagesBySession:{...s.messagesBySession,[t]:[...o,d].slice(-200)}}}),updateHookApprovalStatus:(t,a,s)=>n(o=>{const l=o.messagesBySession[t];if(!l)return o;const u=l.map(d=>{var h;return((h=d.hookApproval)==null?void 0:h.approvalId)===a?{...d,hookApproval:{...d.hookApproval,status:s}}:d});return{messagesBySession:{...o.messagesBySession,[t]:u}}}),setMessageFileJob:(t,a)=>n(s=>{const o=s.messagesBySession[t]||[];if(o.length===0){const h={id:`filejob-${a.jobId}`,type:"assistant",content:"",timestamp:Date.now(),fileJob:a};return{messagesBySession:{...s.messagesBySession,[t]:[h]}}}const l=o.length-1,u=o[l];if(u&&u.type==="assistant"){const h=o.slice();return h[l]={...u,fileJob:u.fileJob?{...u.fileJob,...a,attachments:a.attachments??u.fileJob.attachments,jobId:u.fileJob.jobId,updatedAt:Date.now()}:{...a,updatedAt:Date.now()}},{messagesBySession:{...s.messagesBySession,[t]:h}}}const d={id:`filejob-${a.jobId}`,type:"assistant",content:"",timestamp:Date.now(),fileJob:a};return{messagesBySession:{...s.messagesBySession,[t]:[...o,d].slice(-200)}}}),attachErrorCard:(t,a)=>n(s=>{const o=s.messagesBySession[t];if(!o||o.length===0)return s;const l=o.length-1,u=o[l];if(u&&u.type==="assistant"){const d=o.slice();return d[l]={...u,errorCard:a},{messagesBySession:{...s.messagesBySession,[t]:d}}}return s}),setTurnSummary:(t,a)=>n(s=>{const o=s.messagesBySession[t];if(!o||o.length===0)return s;const l=o.length-1,u=o[l];if(!u||u.type!=="assistant")return s;const d=o.slice();return d[l]={...u,summary:a},{messagesBySession:{...s.messagesBySession,[t]:d}}}),applyTombstone:(t,a)=>n(s=>{const o=s.messagesBySession[t];if(!o||o.length===0)return s;const l=new Set(a),u=o.map(d=>l.has(d.id)?{...d,deleted:!0}:d);return{messagesBySession:{...s.messagesBySession,[t]:u}}}),isGenerating:t=>e().generatingSessions.includes(t),isPaused:t=>e().pausedSessions.includes(t)}),{name:s_,storage:f_,partialize:n=>({messagesBySession:n.messagesBySession,sessionInputs:n.sessionInputs})})),h_=mn(n=>({isOpen:!1,status:"idle",port:null,wsUrl:null,errorMessage:null,openTerminal:()=>n({isOpen:!0}),closeTerminal:()=>n({isOpen:!1}),toggleTerminal:()=>n(e=>({isOpen:!e.isOpen})),setStarting:()=>n({status:"starting",errorMessage:null}),setRunning:(e,t)=>n({status:"running",port:e,wsUrl:t}),setStopping:()=>n({status:"stopping"}),setIdle:()=>n({status:"idle",port:null,wsUrl:null,errorMessage:null}),setError:e=>n({status:"error",errorMessage:e})})),n2={bg:"#0d1117",surface:"#161b22",border:"#30363d",text:"#c9d1d9",muted:"#8b949e",accentBlue:"#58a6ff",accentGreen:"#238636",accentRed:"#f85149",accentYellow:"#d29922",accentPurple:"#a855f7"},GP=["off","low","medium","high","extra_high","max"],m_=8,qi=mn()(oi(n=>({theme:"light",themePresetId:"linear",language:"zh-CN",fontSize:14,streamingEnabled:!0,workspaceDir:"",recentDirs:[],effort:"medium",customTheme:n2,customThemeEnabled:!1,developerView:!1,setTheme:e=>n({theme:e}),setThemePreset:e=>n({themePresetId:e,customThemeEnabled:!1}),setLanguage:e=>n({language:e}),setFontSize:e=>n({fontSize:e}),setStreamingEnabled:e=>n({streamingEnabled:e}),setCustomTheme:e=>n(t=>({customTheme:{...t.customTheme,...e}})),setCustomThemeEnabled:e=>n({customThemeEnabled:e}),resetCustomTheme:()=>n({customTheme:n2}),setDeveloperView:e=>n({developerView:e}),setWorkspaceDir:e=>n(t=>{const a=e.trim();if(!a)return{workspaceDir:""};const s=[a,...t.recentDirs.filter(o=>o!==a)].slice(0,m_);return{workspaceDir:a,recentDirs:s}}),setEffort:e=>n({effort:e})}),{name:"deepseekcode-settings-storage",version:5,migrate:(n,e)=>{const t=n;return e<2&&t&&typeof t=="object"&&((t.themePresetId==="github"||t.themePresetId==="mimo")&&(t.themePresetId="linear"),t.theme==="dark"&&(t.theme="light")),e<3&&t&&typeof t=="object"&&(t.recentDirs=Array.isArray(t.recentDirs)?t.recentDirs:[]),e<4&&t&&typeof t=="object"&&(delete t.yolo,delete t.autoSwarm,delete t.workspaceGuardBypass),e<5&&t&&typeof t=="object"&&(t.developerView=t.developerView===!0),t}}));var St;(function(n){n.assertEqual=s=>{};function e(s){}n.assertIs=e;function t(s){throw new Error}n.assertNever=t,n.arrayToEnum=s=>{const o={};for(const l of s)o[l]=l;return o},n.getValidEnumValues=s=>{const o=n.objectKeys(s).filter(u=>typeof s[s[u]]!="number"),l={};for(const u of o)l[u]=s[u];return n.objectValues(l)},n.objectValues=s=>n.objectKeys(s).map(function(o){return s[o]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const l in s)Object.prototype.hasOwnProperty.call(s,l)&&o.push(l);return o},n.find=(s,o)=>{for(const l of s)if(o(l))return l},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function a(s,o=" | "){return s.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}n.joinValues=a,n.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(St||(St={}));var a2;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(a2||(a2={}));const Ae=St.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ws=n=>{switch(typeof n){case"undefined":return Ae.undefined;case"string":return Ae.string;case"number":return Number.isNaN(n)?Ae.nan:Ae.number;case"boolean":return Ae.boolean;case"function":return Ae.function;case"bigint":return Ae.bigint;case"symbol":return Ae.symbol;case"object":return Array.isArray(n)?Ae.array:n===null?Ae.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Ae.promise:typeof Map<"u"&&n instanceof Map?Ae.map:typeof Set<"u"&&n instanceof Set?Ae.set:typeof Date<"u"&&n instanceof Date?Ae.date:Ae.object;default:return Ae.unknown}},ye=St.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class us extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(o){return o.message},a={_errors:[]},s=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(s);else if(l.code==="invalid_return_type")s(l.returnTypeError);else if(l.code==="invalid_arguments")s(l.argumentsError);else if(l.path.length===0)a._errors.push(t(l));else{let u=a,d=0;for(;d<l.path.length;){const h=l.path[d];d===l.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(t(l))):u[h]=u[h]||{_errors:[]},u=u[h],d++}}};return s(this),a}static assert(e){if(!(e instanceof us))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,St.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},a=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];t[o]=t[o]||[],t[o].push(e(s))}else a.push(e(s));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}us.create=n=>new us(n);const Hp=(n,e)=>{let t;switch(n.code){case ye.invalid_type:n.received===Ae.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case ye.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,St.jsonStringifyReplacer)}`;break;case ye.unrecognized_keys:t=`Unrecognized key(s) in object: ${St.joinValues(n.keys,", ")}`;break;case ye.invalid_union:t="Invalid input";break;case ye.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${St.joinValues(n.options)}`;break;case ye.invalid_enum_value:t=`Invalid enum value. Expected ${St.joinValues(n.options)}, received '${n.received}'`;break;case ye.invalid_arguments:t="Invalid function arguments";break;case ye.invalid_return_type:t="Invalid function return type";break;case ye.invalid_date:t="Invalid date";break;case ye.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:St.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case ye.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case ye.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case ye.custom:t="Invalid input";break;case ye.invalid_intersection_types:t="Intersection results could not be merged";break;case ye.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case ye.not_finite:t="Number must be finite";break;default:t=e.defaultError,St.assertNever(n)}return{message:t}};let p_=Hp;function g_(){return p_}const y_=n=>{const{data:e,path:t,errorMaps:a,issueData:s}=n,o=[...t,...s.path||[]],l={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let u="";const d=a.filter(h=>!!h).slice().reverse();for(const h of d)u=h(l,{data:e,defaultError:u}).message;return{...s,path:o,message:u}};function ke(n,e){const t=g_(),a=y_({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Hp?void 0:Hp].filter(s=>!!s)});n.common.issues.push(a)}class Jn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const s of t){if(s.status==="aborted")return Xe;s.status==="dirty"&&e.dirty(),a.push(s.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const s of t){const o=await s.key,l=await s.value;a.push({key:o,value:l})}return Jn.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const s of t){const{key:o,value:l}=s;if(o.status==="aborted"||l.status==="aborted")return Xe;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||s.alwaysSet)&&(a[o.value]=l.value)}return{status:e.value,value:a}}}const Xe=Object.freeze({status:"aborted"}),wc=n=>({status:"dirty",value:n}),Va=n=>({status:"valid",value:n}),r2=n=>n.status==="aborted",s2=n=>n.status==="dirty",el=n=>n.status==="valid",d0=n=>typeof Promise<"u"&&n instanceof Promise;var Ne;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ne||(Ne={}));class kr{constructor(e,t,a,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const i2=(n,e)=>{if(el(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new us(n.common.issues);return this._error=t,this._error}}};function st(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:a,description:s}=n;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(l,u)=>{const{message:d}=n;return l.code==="invalid_enum_value"?{message:d??u.defaultError}:typeof u.data>"u"?{message:d??a??u.defaultError}:l.code!=="invalid_type"?{message:u.defaultError}:{message:d??t??u.defaultError}},description:s}}class mt{get description(){return this._def.description}_getType(e){return Ws(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ws(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jn,ctx:{common:e.parent.common,data:e.data,parsedType:Ws(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(d0(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){const a={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ws(e)},s=this._parseSync({data:e,path:a.path,parent:a});return i2(a,s)}"~validate"(e){var a,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ws(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:t});return el(o)?{value:o.value}:{issues:t.common.issues}}catch(o){(s=(a=o==null?void 0:o.message)==null?void 0:a.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(o=>el(o)?{value:o.value}:{issues:t.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ws(e)},s=this._parse({data:e,path:a.path,parent:a}),o=await(d0(s)?s:Promise.resolve(s));return i2(a,o)}refine(e,t){const a=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,o)=>{const l=e(s),u=()=>o.addIssue({code:ye.custom,...a(s)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(u(),!1)):l?!0:(u(),!1)})}refinement(e,t){return this._refinement((a,s)=>e(a)?!0:(s.addIssue(typeof t=="function"?t(a,s):t),!1))}_refinement(e){return new al({schema:this,typeName:Ye.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Qs.create(this,this._def)}nullable(){return rl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wr.create(this)}promise(){return g0.create(this,this._def)}or(e){return h0.create([this,e],this._def)}and(e){return m0.create(this,e,this._def)}transform(e){return new al({...st(this._def),schema:this,typeName:Ye.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Wp({...st(this._def),innerType:this,defaultValue:t,typeName:Ye.ZodDefault})}brand(){return new $_({typeName:Ye.ZodBranded,type:this,...st(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Kp({...st(this._def),innerType:this,catchValue:t,typeName:Ye.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return e1.create(this,e)}readonly(){return Yp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const v_=/^c[^\s-]{8,}$/i,b_=/^[0-9a-z]+$/,x_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,w_=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,S_=/^[a-z0-9_-]{21}$/i,k_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,__=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,C_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,T_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Lm;const A_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,E_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,N_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,M_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,R_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,O_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fx="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",D_=new RegExp(`^${fx}$`);function hx(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function L_(n){return new RegExp(`^${hx(n)}$`)}function B_(n){let e=`${fx}T${hx(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function j_(n,e){return!!((e==="v4"||!e)&&A_.test(n)||(e==="v6"||!e)&&N_.test(n))}function P_(n,e){if(!k_.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(a));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function I_(n,e){return!!((e==="v4"||!e)&&E_.test(n)||(e==="v6"||!e)&&M_.test(n))}class os extends mt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ae.string){const o=this._getOrReturnCtx(e);return ke(o,{code:ye.invalid_type,expected:Ae.string,received:o.parsedType}),Xe}const a=new Jn;let s;for(const o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),a.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),a.dirty());else if(o.kind==="length"){const l=e.data.length>o.value,u=e.data.length<o.value;(l||u)&&(s=this._getOrReturnCtx(e,s),l?ke(s,{code:ye.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):u&&ke(s,{code:ye.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),a.dirty())}else if(o.kind==="email")C_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"email",code:ye.invalid_string,message:o.message}),a.dirty());else if(o.kind==="emoji")Lm||(Lm=new RegExp(T_,"u")),Lm.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"emoji",code:ye.invalid_string,message:o.message}),a.dirty());else if(o.kind==="uuid")w_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"uuid",code:ye.invalid_string,message:o.message}),a.dirty());else if(o.kind==="nanoid")S_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"nanoid",code:ye.invalid_string,message:o.message}),a.dirty());else if(o.kind==="cuid")v_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"cuid",code:ye.invalid_string,message:o.message}),a.dirty());else if(o.kind==="cuid2")b_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"cuid2",code:ye.invalid_string,message:o.message}),a.dirty());else if(o.kind==="ulid")x_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"ulid",code:ye.invalid_string,message:o.message}),a.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),ke(s,{validation:"url",code:ye.invalid_string,message:o.message}),a.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"regex",code:ye.invalid_string,message:o.message}),a.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),a.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.invalid_string,validation:{startsWith:o.value},message:o.message}),a.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.invalid_string,validation:{endsWith:o.value},message:o.message}),a.dirty()):o.kind==="datetime"?B_(o).test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.invalid_string,validation:"datetime",message:o.message}),a.dirty()):o.kind==="date"?D_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.invalid_string,validation:"date",message:o.message}),a.dirty()):o.kind==="time"?L_(o).test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.invalid_string,validation:"time",message:o.message}),a.dirty()):o.kind==="duration"?__.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"duration",code:ye.invalid_string,message:o.message}),a.dirty()):o.kind==="ip"?j_(e.data,o.version)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"ip",code:ye.invalid_string,message:o.message}),a.dirty()):o.kind==="jwt"?P_(e.data,o.alg)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"jwt",code:ye.invalid_string,message:o.message}),a.dirty()):o.kind==="cidr"?I_(e.data,o.version)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"cidr",code:ye.invalid_string,message:o.message}),a.dirty()):o.kind==="base64"?R_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"base64",code:ye.invalid_string,message:o.message}),a.dirty()):o.kind==="base64url"?O_.test(e.data)||(s=this._getOrReturnCtx(e,s),ke(s,{validation:"base64url",code:ye.invalid_string,message:o.message}),a.dirty()):St.assertNever(o);return{status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(s=>e.test(s),{validation:t,code:ye.invalid_string,...Ne.errToObj(a)})}_addCheck(e){return new os({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ne.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ne.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ne.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ne.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ne.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ne.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ne.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ne.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ne.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ne.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ne.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ne.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ne.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Ne.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ne.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ne.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ne.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Ne.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ne.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ne.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ne.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ne.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ne.errToObj(t)})}nonempty(e){return this.min(1,Ne.errToObj(e))}trim(){return new os({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new os({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new os({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}os.create=n=>new os({checks:[],typeName:Ye.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...st(n)});function z_(n,e){const t=(n.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,s=t>a?t:a,o=Number.parseInt(n.toFixed(s).replace(".","")),l=Number.parseInt(e.toFixed(s).replace(".",""));return o%l/10**s}class tl extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ae.number){const o=this._getOrReturnCtx(e);return ke(o,{code:ye.invalid_type,expected:Ae.number,received:o.parsedType}),Xe}let a;const s=new Jn;for(const o of this._def.checks)o.kind==="int"?St.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),ke(a,{code:ye.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(a=this._getOrReturnCtx(e,a),ke(a,{code:ye.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(a=this._getOrReturnCtx(e,a),ke(a,{code:ye.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?z_(e.data,o.value)!==0&&(a=this._getOrReturnCtx(e,a),ke(a,{code:ye.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),ke(a,{code:ye.not_finite,message:o.message}),s.dirty()):St.assertNever(o);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ne.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ne.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ne.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ne.toString(t))}setLimit(e,t,a,s){return new tl({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Ne.toString(s)}]})}_addCheck(e){return new tl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ne.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ne.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ne.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ne.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ne.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ne.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&St.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}tl.create=n=>new tl({checks:[],typeName:Ye.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...st(n)});class Uc extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ae.bigint)return this._getInvalidInput(e);let a;const s=new Jn;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(a=this._getOrReturnCtx(e,a),ke(a,{code:ye.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(a=this._getOrReturnCtx(e,a),ke(a,{code:ye.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),ke(a,{code:ye.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):St.assertNever(o);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return ke(t,{code:ye.invalid_type,expected:Ae.bigint,received:t.parsedType}),Xe}gte(e,t){return this.setLimit("min",e,!0,Ne.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ne.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ne.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ne.toString(t))}setLimit(e,t,a,s){return new Uc({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Ne.toString(s)}]})}_addCheck(e){return new Uc({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ne.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ne.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ne.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ne.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ne.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Uc.create=n=>new Uc({checks:[],typeName:Ye.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...st(n)});class Up extends mt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ae.boolean){const a=this._getOrReturnCtx(e);return ke(a,{code:ye.invalid_type,expected:Ae.boolean,received:a.parsedType}),Xe}return Va(e.data)}}Up.create=n=>new Up({typeName:Ye.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...st(n)});class f0 extends mt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ae.date){const o=this._getOrReturnCtx(e);return ke(o,{code:ye.invalid_type,expected:Ae.date,received:o.parsedType}),Xe}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return ke(o,{code:ye.invalid_date}),Xe}const a=new Jn;let s;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),a.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),ke(s,{code:ye.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),a.dirty()):St.assertNever(o);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new f0({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ne.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ne.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}f0.create=n=>new f0({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:Ye.ZodDate,...st(n)});class o2 extends mt{_parse(e){if(this._getType(e)!==Ae.symbol){const a=this._getOrReturnCtx(e);return ke(a,{code:ye.invalid_type,expected:Ae.symbol,received:a.parsedType}),Xe}return Va(e.data)}}o2.create=n=>new o2({typeName:Ye.ZodSymbol,...st(n)});class l2 extends mt{_parse(e){if(this._getType(e)!==Ae.undefined){const a=this._getOrReturnCtx(e);return ke(a,{code:ye.invalid_type,expected:Ae.undefined,received:a.parsedType}),Xe}return Va(e.data)}}l2.create=n=>new l2({typeName:Ye.ZodUndefined,...st(n)});class c2 extends mt{_parse(e){if(this._getType(e)!==Ae.null){const a=this._getOrReturnCtx(e);return ke(a,{code:ye.invalid_type,expected:Ae.null,received:a.parsedType}),Xe}return Va(e.data)}}c2.create=n=>new c2({typeName:Ye.ZodNull,...st(n)});class Fp extends mt{constructor(){super(...arguments),this._any=!0}_parse(e){return Va(e.data)}}Fp.create=n=>new Fp({typeName:Ye.ZodAny,...st(n)});class Gp extends mt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Va(e.data)}}Gp.create=n=>new Gp({typeName:Ye.ZodUnknown,...st(n)});class ni extends mt{_parse(e){const t=this._getOrReturnCtx(e);return ke(t,{code:ye.invalid_type,expected:Ae.never,received:t.parsedType}),Xe}}ni.create=n=>new ni({typeName:Ye.ZodNever,...st(n)});class u2 extends mt{_parse(e){if(this._getType(e)!==Ae.undefined){const a=this._getOrReturnCtx(e);return ke(a,{code:ye.invalid_type,expected:Ae.void,received:a.parsedType}),Xe}return Va(e.data)}}u2.create=n=>new u2({typeName:Ye.ZodVoid,...st(n)});class wr extends mt{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),s=this._def;if(t.parsedType!==Ae.array)return ke(t,{code:ye.invalid_type,expected:Ae.array,received:t.parsedType}),Xe;if(s.exactLength!==null){const l=t.data.length>s.exactLength.value,u=t.data.length<s.exactLength.value;(l||u)&&(ke(t,{code:l?ye.too_big:ye.too_small,minimum:u?s.exactLength.value:void 0,maximum:l?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),a.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(ke(t,{code:ye.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),a.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(ke(t,{code:ye.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((l,u)=>s.type._parseAsync(new kr(t,l,t.path,u)))).then(l=>Jn.mergeArray(a,l));const o=[...t.data].map((l,u)=>s.type._parseSync(new kr(t,l,t.path,u)));return Jn.mergeArray(a,o)}get element(){return this._def.type}min(e,t){return new wr({...this._def,minLength:{value:e,message:Ne.toString(t)}})}max(e,t){return new wr({...this._def,maxLength:{value:e,message:Ne.toString(t)}})}length(e,t){return new wr({...this._def,exactLength:{value:e,message:Ne.toString(t)}})}nonempty(e){return this.min(1,e)}}wr.create=(n,e)=>new wr({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Ye.ZodArray,...st(e)});function Uo(n){if(n instanceof dn){const e={};for(const t in n.shape){const a=n.shape[t];e[t]=Qs.create(Uo(a))}return new dn({...n._def,shape:()=>e})}else return n instanceof wr?new wr({...n._def,type:Uo(n.element)}):n instanceof Qs?Qs.create(Uo(n.unwrap())):n instanceof rl?rl.create(Uo(n.unwrap())):n instanceof Vi?Vi.create(n.items.map(e=>Uo(e))):n}class dn extends mt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=St.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ae.object){const h=this._getOrReturnCtx(e);return ke(h,{code:ye.invalid_type,expected:Ae.object,received:h.parsedType}),Xe}const{status:a,ctx:s}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),u=[];if(!(this._def.catchall instanceof ni&&this._def.unknownKeys==="strip"))for(const h in s.data)l.includes(h)||u.push(h);const d=[];for(const h of l){const m=o[h],p=s.data[h];d.push({key:{status:"valid",value:h},value:m._parse(new kr(s,p,s.path,h)),alwaysSet:h in s.data})}if(this._def.catchall instanceof ni){const h=this._def.unknownKeys;if(h==="passthrough")for(const m of u)d.push({key:{status:"valid",value:m},value:{status:"valid",value:s.data[m]}});else if(h==="strict")u.length>0&&(ke(s,{code:ye.unrecognized_keys,keys:u}),a.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const m of u){const p=s.data[m];d.push({key:{status:"valid",value:m},value:h._parse(new kr(s,p,s.path,m)),alwaysSet:m in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const h=[];for(const m of d){const p=await m.key,b=await m.value;h.push({key:p,value:b,alwaysSet:m.alwaysSet})}return h}).then(h=>Jn.mergeObjectSync(a,h)):Jn.mergeObjectSync(a,d)}get shape(){return this._def.shape()}strict(e){return Ne.errToObj,new dn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,a)=>{var o,l;const s=((l=(o=this._def).errorMap)==null?void 0:l.call(o,t,a).message)??a.defaultError;return t.code==="unrecognized_keys"?{message:Ne.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new dn({...this._def,unknownKeys:"strip"})}passthrough(){return new dn({...this._def,unknownKeys:"passthrough"})}extend(e){return new dn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new dn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ye.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new dn({...this._def,catchall:e})}pick(e){const t={};for(const a of St.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new dn({...this._def,shape:()=>t})}omit(e){const t={};for(const a of St.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new dn({...this._def,shape:()=>t})}deepPartial(){return Uo(this)}partial(e){const t={};for(const a of St.objectKeys(this.shape)){const s=this.shape[a];e&&!e[a]?t[a]=s:t[a]=s.optional()}return new dn({...this._def,shape:()=>t})}required(e){const t={};for(const a of St.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let o=this.shape[a];for(;o instanceof Qs;)o=o._def.innerType;t[a]=o}return new dn({...this._def,shape:()=>t})}keyof(){return mx(St.objectKeys(this.shape))}}dn.create=(n,e)=>new dn({shape:()=>n,unknownKeys:"strip",catchall:ni.create(),typeName:Ye.ZodObject,...st(e)});dn.strictCreate=(n,e)=>new dn({shape:()=>n,unknownKeys:"strict",catchall:ni.create(),typeName:Ye.ZodObject,...st(e)});dn.lazycreate=(n,e)=>new dn({shape:n,unknownKeys:"strip",catchall:ni.create(),typeName:Ye.ZodObject,...st(e)});class h0 extends mt{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;function s(o){for(const u of o)if(u.result.status==="valid")return u.result;for(const u of o)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;const l=o.map(u=>new us(u.ctx.common.issues));return ke(t,{code:ye.invalid_union,unionErrors:l}),Xe}if(t.common.async)return Promise.all(a.map(async o=>{const l={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(s);{let o;const l=[];for(const d of a){const h={...t,common:{...t.common,issues:[]},parent:null},m=d._parseSync({data:t.data,path:t.path,parent:h});if(m.status==="valid")return m;m.status==="dirty"&&!o&&(o={result:m,ctx:h}),h.common.issues.length&&l.push(h.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;const u=l.map(d=>new us(d));return ke(t,{code:ye.invalid_union,unionErrors:u}),Xe}}get options(){return this._def.options}}h0.create=(n,e)=>new h0({options:n,typeName:Ye.ZodUnion,...st(e)});function qp(n,e){const t=Ws(n),a=Ws(e);if(n===e)return{valid:!0,data:n};if(t===Ae.object&&a===Ae.object){const s=St.objectKeys(e),o=St.objectKeys(n).filter(u=>s.indexOf(u)!==-1),l={...n,...e};for(const u of o){const d=qp(n[u],e[u]);if(!d.valid)return{valid:!1};l[u]=d.data}return{valid:!0,data:l}}else if(t===Ae.array&&a===Ae.array){if(n.length!==e.length)return{valid:!1};const s=[];for(let o=0;o<n.length;o++){const l=n[o],u=e[o],d=qp(l,u);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return t===Ae.date&&a===Ae.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class m0 extends mt{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),s=(o,l)=>{if(r2(o)||r2(l))return Xe;const u=qp(o.value,l.value);return u.valid?((s2(o)||s2(l))&&t.dirty(),{status:t.value,value:u.data}):(ke(a,{code:ye.invalid_intersection_types}),Xe)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([o,l])=>s(o,l)):s(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}m0.create=(n,e,t)=>new m0({left:n,right:e,typeName:Ye.ZodIntersection,...st(t)});class Vi extends mt{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==Ae.array)return ke(a,{code:ye.invalid_type,expected:Ae.array,received:a.parsedType}),Xe;if(a.data.length<this._def.items.length)return ke(a,{code:ye.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Xe;!this._def.rest&&a.data.length>this._def.items.length&&(ke(a,{code:ye.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const o=[...a.data].map((l,u)=>{const d=this._def.items[u]||this._def.rest;return d?d._parse(new kr(a,l,a.path,u)):null}).filter(l=>!!l);return a.common.async?Promise.all(o).then(l=>Jn.mergeArray(t,l)):Jn.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Vi({...this._def,rest:e})}}Vi.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vi({items:n,typeName:Ye.ZodTuple,rest:null,...st(e)})};class p0 extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==Ae.object)return ke(a,{code:ye.invalid_type,expected:Ae.object,received:a.parsedType}),Xe;const s=[],o=this._def.keyType,l=this._def.valueType;for(const u in a.data)s.push({key:o._parse(new kr(a,u,a.path,u)),value:l._parse(new kr(a,a.data[u],a.path,u)),alwaysSet:u in a.data});return a.common.async?Jn.mergeObjectAsync(t,s):Jn.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof mt?new p0({keyType:e,valueType:t,typeName:Ye.ZodRecord,...st(a)}):new p0({keyType:os.create(),valueType:e,typeName:Ye.ZodRecord,...st(t)})}}class d2 extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==Ae.map)return ke(a,{code:ye.invalid_type,expected:Ae.map,received:a.parsedType}),Xe;const s=this._def.keyType,o=this._def.valueType,l=[...a.data.entries()].map(([u,d],h)=>({key:s._parse(new kr(a,u,a.path,[h,"key"])),value:o._parse(new kr(a,d,a.path,[h,"value"]))}));if(a.common.async){const u=new Map;return Promise.resolve().then(async()=>{for(const d of l){const h=await d.key,m=await d.value;if(h.status==="aborted"||m.status==="aborted")return Xe;(h.status==="dirty"||m.status==="dirty")&&t.dirty(),u.set(h.value,m.value)}return{status:t.value,value:u}})}else{const u=new Map;for(const d of l){const h=d.key,m=d.value;if(h.status==="aborted"||m.status==="aborted")return Xe;(h.status==="dirty"||m.status==="dirty")&&t.dirty(),u.set(h.value,m.value)}return{status:t.value,value:u}}}}d2.create=(n,e,t)=>new d2({valueType:e,keyType:n,typeName:Ye.ZodMap,...st(t)});class Fc extends mt{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==Ae.set)return ke(a,{code:ye.invalid_type,expected:Ae.set,received:a.parsedType}),Xe;const s=this._def;s.minSize!==null&&a.data.size<s.minSize.value&&(ke(a,{code:ye.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&a.data.size>s.maxSize.value&&(ke(a,{code:ye.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const o=this._def.valueType;function l(d){const h=new Set;for(const m of d){if(m.status==="aborted")return Xe;m.status==="dirty"&&t.dirty(),h.add(m.value)}return{status:t.value,value:h}}const u=[...a.data.values()].map((d,h)=>o._parse(new kr(a,d,a.path,h)));return a.common.async?Promise.all(u).then(d=>l(d)):l(u)}min(e,t){return new Fc({...this._def,minSize:{value:e,message:Ne.toString(t)}})}max(e,t){return new Fc({...this._def,maxSize:{value:e,message:Ne.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Fc.create=(n,e)=>new Fc({valueType:n,minSize:null,maxSize:null,typeName:Ye.ZodSet,...st(e)});class f2 extends mt{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}f2.create=(n,e)=>new f2({getter:n,typeName:Ye.ZodLazy,...st(e)});class Vp extends mt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ke(t,{received:t.data,code:ye.invalid_literal,expected:this._def.value}),Xe}return{status:"valid",value:e.data}}get value(){return this._def.value}}Vp.create=(n,e)=>new Vp({value:n,typeName:Ye.ZodLiteral,...st(e)});function mx(n,e){return new nl({values:n,typeName:Ye.ZodEnum,...st(e)})}class nl extends mt{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),a=this._def.values;return ke(t,{expected:St.joinValues(a),received:t.parsedType,code:ye.invalid_type}),Xe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return ke(t,{received:t.data,code:ye.invalid_enum_value,options:a}),Xe}return Va(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return nl.create(e,{...this._def,...t})}exclude(e,t=this._def){return nl.create(this.options.filter(a=>!e.includes(a)),{...this._def,...t})}}nl.create=mx;class h2 extends mt{_parse(e){const t=St.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==Ae.string&&a.parsedType!==Ae.number){const s=St.objectValues(t);return ke(a,{expected:St.joinValues(s),received:a.parsedType,code:ye.invalid_type}),Xe}if(this._cache||(this._cache=new Set(St.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=St.objectValues(t);return ke(a,{received:a.data,code:ye.invalid_enum_value,options:s}),Xe}return Va(e.data)}get enum(){return this._def.values}}h2.create=(n,e)=>new h2({values:n,typeName:Ye.ZodNativeEnum,...st(e)});class g0 extends mt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ae.promise&&t.common.async===!1)return ke(t,{code:ye.invalid_type,expected:Ae.promise,received:t.parsedType}),Xe;const a=t.parsedType===Ae.promise?t.data:Promise.resolve(t.data);return Va(a.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}g0.create=(n,e)=>new g0({type:n,typeName:Ye.ZodPromise,...st(e)});class al extends mt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ye.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:l=>{ke(a,l),l.fatal?t.abort():t.dirty()},get path(){return a.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const l=s.transform(a.data,o);if(a.common.async)return Promise.resolve(l).then(async u=>{if(t.value==="aborted")return Xe;const d=await this._def.schema._parseAsync({data:u,path:a.path,parent:a});return d.status==="aborted"?Xe:d.status==="dirty"||t.value==="dirty"?wc(d.value):d});{if(t.value==="aborted")return Xe;const u=this._def.schema._parseSync({data:l,path:a.path,parent:a});return u.status==="aborted"?Xe:u.status==="dirty"||t.value==="dirty"?wc(u.value):u}}if(s.type==="refinement"){const l=u=>{const d=s.refinement(u,o);if(a.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(a.common.async===!1){const u=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return u.status==="aborted"?Xe:(u.status==="dirty"&&t.dirty(),l(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(u=>u.status==="aborted"?Xe:(u.status==="dirty"&&t.dirty(),l(u.value).then(()=>({status:t.value,value:u.value}))))}if(s.type==="transform")if(a.common.async===!1){const l=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!el(l))return Xe;const u=s.transform(l.value,o);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(l=>el(l)?Promise.resolve(s.transform(l.value,o)).then(u=>({status:t.value,value:u})):Xe);St.assertNever(s)}}al.create=(n,e,t)=>new al({schema:n,typeName:Ye.ZodEffects,effect:e,...st(t)});al.createWithPreprocess=(n,e,t)=>new al({schema:e,effect:{type:"preprocess",transform:n},typeName:Ye.ZodEffects,...st(t)});class Qs extends mt{_parse(e){return this._getType(e)===Ae.undefined?Va(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qs.create=(n,e)=>new Qs({innerType:n,typeName:Ye.ZodOptional,...st(e)});class rl extends mt{_parse(e){return this._getType(e)===Ae.null?Va(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rl.create=(n,e)=>new rl({innerType:n,typeName:Ye.ZodNullable,...st(e)});class Wp extends mt{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===Ae.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Wp.create=(n,e)=>new Wp({innerType:n,typeName:Ye.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...st(e)});class Kp extends mt{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return d0(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new us(a.common.issues)},input:a.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new us(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}Kp.create=(n,e)=>new Kp({innerType:n,typeName:Ye.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...st(e)});class m2 extends mt{_parse(e){if(this._getType(e)!==Ae.nan){const a=this._getOrReturnCtx(e);return ke(a,{code:ye.invalid_type,expected:Ae.nan,received:a.parsedType}),Xe}return{status:"valid",value:e.data}}}m2.create=n=>new m2({typeName:Ye.ZodNaN,...st(n)});class $_ extends mt{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class e1 extends mt{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?Xe:o.status==="dirty"?(t.dirty(),wc(o.value)):this._def.out._parseAsync({data:o.value,path:a.path,parent:a})})();{const s=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?Xe:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:a.path,parent:a})}}static create(e,t){return new e1({in:e,out:t,typeName:Ye.ZodPipeline})}}class Yp extends mt{_parse(e){const t=this._def.innerType._parse(e),a=s=>(el(s)&&(s.value=Object.freeze(s.value)),s);return d0(t)?t.then(s=>a(s)):a(t)}unwrap(){return this._def.innerType}}Yp.create=(n,e)=>new Yp({innerType:n,typeName:Ye.ZodReadonly,...st(e)});var Ye;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Ye||(Ye={}));const Me=os.create,jn=tl.create,px=Up.create,Vo=Fp.create,tu=Gp.create;ni.create;const Gc=wr.create,Et=dn.create,H_=h0.create;m0.create;Vi.create;const U_=p0.create,t1=Vp.create,F_=nl.create;g0.create;Qs.create;rl.create;function J(n){return{schema:tu(),...n}}const H0=[];let p2=new Set;function wa(n){for(const e of n){if(p2.has(e.type))throw new Error(`[protocol] duplicate event type: ${e.type}`);p2.add(e.type),H0.push(e)}return n}function Cd(n){return H0.find(e=>e.type===n)}new Proxy({},{get:(n,e)=>{var t;return typeof e=="string"?(t=Cd(e))==null?void 0:t.schema:void 0},has:(n,e)=>{var t;return typeof e=="string"?!!((t=Cd(e))!=null&&t.schema):!1},ownKeys:()=>H0.map(n=>n.type),getOwnPropertyDescriptor:(n,e)=>{var t;return typeof e=="string"&&Cd(e)?{enumerable:!0,configurable:!0,value:(t=Cd(e))==null?void 0:t.schema}:void 0}});wa([J({type:"connected",description:"WebSocket 已连接",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),J({type:"session_created",description:"新会话已创建",category:"session",emittedBy:["server","core"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 均已处理(Web: systemHandlers session_created)",schema:Et({id:Me(),title:Me().optional()}).partial()}),J({type:"session_resumed",description:"会话从存储中恢复",category:"session",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 均已处理(Web: systemHandlers session_resumed)",schema:Et({id:Me()}).partial()}),J({type:"auth_required",description:"需要认证",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),J({type:"auth_success",description:"认证成功",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),J({type:"auth_failed",description:"认证失败",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),J({type:"message_ack",description:"消息确认",category:"session",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"CLI 发送给服务器的入站事件,无需 handler"}),J({type:"workspace_changed",description:"工作空间已切换",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,schema:Et({workspaceDir:Me()}).partial()}),J({type:"session_switched",description:"会话已切换",category:"session",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(切换 activeSessionId)",schema:Et({id:Me()}).partial()}),J({type:"disconnected",description:"连接断开",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0})]);wa([J({type:"start",description:"AI 开始生成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"content",description:"生成内容增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:Et({content:Me()}).partial()}),J({type:"thinking",description:"思考过程增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:Et({thinking:Me()}).partial()}),J({type:"tool_call",description:"工具调用流式增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"tool_result",description:"工具执行结果",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"tool_execution_start",description:"工具执行阶段开始(无流事件时段开始)",category:"stream",emittedBy:["core"],handledByCli:!1,handledByWeb:!1,note:"纯 core 内部遥测:供运行时暂停/恢复 stall 心跳与全局看门狗;CLI/Web 无 handler(前端无需展示),仅 queryEngine 消费"}),J({type:"tool_execution_end",description:"工具执行阶段结束(恢复 stall 心跳与全局看门狗)",category:"stream",emittedBy:["core"],handledByCli:!1,handledByWeb:!1,note:"配合 tool_execution_start:防止 180s 心跳把合法长等待误判为流挂起而 abort + 重放整轮工具调用;CLI/Web 无 handler"}),J({type:"tool_diff",description:"工具执行中的参数 diff 增量(P0-2 diffConsumer 生产者推送)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"step_start",description:"步骤开始",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"step_thinking",description:"步骤思考",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"step_action",description:"步骤动作",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"step_complete",description:"步骤完成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"turn_summary",description:"回合结束摘要(思考时长+工具计数+头条)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 渲染为折叠摘要行(Thought for Ns, ran N …)"}),J({type:"cache_stats",description:"本轮 run 前缀缓存命中统计(命中/未命中 token、命中率、调用次数)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"run 结束时由 queryEngine 发送;CLI/Web 在模型名旁展示命中率",schema:Et({cacheHitTokens:jn(),cacheMissTokens:jn(),cacheHitRate:jn().optional(),cacheStatsCalls:jn()}).partial()}),J({type:"web_search",description:"模型内置联网搜索状态(DeepSeek Responses web_search_call:searching/completed/failed)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由服务端执行搜索,客户端仅展示状态(🔍搜索中 → ✅完成)",schema:Et({state:Me()}).partial()}),J({type:"progress",description:"通用进度(当前未使用)",category:"stream",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"已定义但从未发送;SendMessageTool 的 progress 是消息类型而非 WS 事件"}),J({type:"complete",description:"生成完成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"error",description:"生成错误",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:Et({message:Me()}).partial()}),J({type:"generation_paused",description:"生成已暂停",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"generation_resumed",description:"生成已恢复",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"stall_detected",description:"流级卡死检测(自动重试/通知)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 StreamHeartbeat 或 StallDetector 触发;CLI/Web 显示重试进度"}),J({type:"task_interrupted",description:"任务中断(服务重启/异常退出)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"服务启动扫描时将 running activeRun 标记为 interrupted 后触发;提示用户使用 /continue 恢复生成,或用 /resume 切换会话"}),J({type:"step_prompt",description:"步骤提示(Web 路由用)",category:"stream",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,note:"Web 路由的内部事件,不通过 WS 发送"})]);wa([J({type:"plan_start",description:"计划开始",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 EnterPlanMode 工具 emit"}),J({type:"plan_thinking",description:"计划思考",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"plan_tasks",description:"计划任务列表生成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 ExitPlanMode 工具 emit(解析计划内容为任务列表);CLI handler 解析 data.tasks",schema:Et({tasks:Gc(Vo())}).partial()}),J({type:"plan_task_start",description:"计划任务开始",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"plan_task_update",description:"计划任务更新",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"plan_task_result",description:"计划任务结果",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"plan_complete",description:"计划完成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 ExitPlanMode 工具 emit(携带 currentPlan/proposedPlan)"}),J({type:"plan_error",description:"计划错误",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"plan_mode_change",description:"计划模式切换",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01);Web planHandlers 已处理(2026-08-07)"}),J({type:"plan_mode_enter",description:"进入计划模式(CLI 遗留)",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"兼容遗留代码,应改用 plan_mode_change"}),J({type:"plan_mode_exit",description:"退出计划模式(CLI 遗留)",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"兼容遗留代码,应改用 plan_mode_change"}),J({type:"plan_confirm",description:"计划等待确认",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web planHandlers 已处理(2026-08-07)"}),J({type:"plan_waiting",description:"计划等待用户输入",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),J({type:"plan_continue",description:"计划继续执行",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),J({type:"plan_settled",description:"计划已定稿",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),J({type:"plan_cleared",description:"计划已清除",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),J({type:"user_exit_plan_mode",description:"用户手动退出计划模式",category:"plan",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),客户端无需 handler"}),J({type:"plan_task_complete",description:"计划任务完成(单个)",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"core TaskUpdateTool 在 completed/failed 时 emit,data 携带 id/title/status/result/error;CLI 与 Web 均更新看板并输出通知(toast / 状态区)",schema:Et({id:Me(),title:Me(),status:Me(),result:Me().optional(),error:Me().optional()}).partial()}),J({type:"plan_subagent_start",description:"Plan 设计子代理启动",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"PlanSubAgentTool 启动只读设计子代理时 emit;data 携带 scope/agentId/planSlug/title",schema:Et({scope:Me(),agentId:Me(),planSlug:Me().optional(),title:Me().optional()}).partial()}),J({type:"plan_subagent_done",description:"Plan 设计子代理完成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"PlanSubAgentTool 子代理完成(成功或失败)时 emit;data 携带 scope/agentId/status/designDocPath/error",schema:Et({scope:Me(),agentId:Me(),status:Me(),designDocPath:Me().optional(),error:Me().optional()}).partial()}),J({type:"plan_mode_change_ack",description:"模式切换 ACK(服务器确认 plan 模式变更)",category:"plan",emittedBy:["server"],handledByCli:!0,handledByWeb:!1,note:"server app.ts 对 plan_mode_change 消息的应答;data 携带 mode/auto"})]);wa([J({type:"token_update",description:"Token 用量更新",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"context_compressed",description:"上下文已压缩",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"compaction_progress",description:"压缩进度更新",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"context_analysis",description:"上下文分布分析",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),J({type:"threshold_warning",description:"Token 阈值警告",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),J({type:"threshold_error",description:"Token 阈值错误",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"功能存在但被 context_blocked 覆盖,事件未使用"}),J({type:"context_blocked",description:"上下文已满,生成被阻止",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),J({type:"blocking_limit",description:"已达到阻止极限",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),J({type:"compaction_started",description:"压缩任务已启动(phase/trigger)",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"compaction_finished",description:"压缩任务结束(done/failed/aborted)",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"tool_retry",description:"工具重试",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"重试信息已含于 tool_result/error,Web handler 保留但路由不可达"}),J({type:"model_fallback",description:"模型回退",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"降级信息已含于 degradation_update,Web handler 保留但路由不可达"}),J({type:"usage",description:"Token 用量",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"context_breakdown",description:"上下文容量分类占比(系统提示词/消息/工具/技能/MCP),供 Web 底部上下文条抽屉展示",category:"context",emittedBy:["core"],handledByCli:!1,handledByWeb:!0,note:"每轮 query 上下文组装后估算各组件 token,Web 端点状态栏上下文条上拉展示"})]);wa([J({type:"workflow_started",description:"工作流已启动",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"data.nodes 携带 LLM 合成完整节点清单(含 type/children/priority,前端可分层渲染)",schema:Et({workflowId:Me().optional(),title:Me().optional(),goalId:Me().optional(),totalNodes:jn().optional(),nodes:Gc(Vo()).optional()}).partial()}),J({type:"workflow_event",description:"工作流事件",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"workflow_progress",description:"工作流进度",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"nodeStatuses: 逐节点状态全量映射(断线重连可重建视图)",schema:Et({runId:Me().optional(),status:Me().optional(),completedNodes:jn().optional(),totalNodes:jn().optional(),tokensUsed:jn().optional(),tokensRemaining:jn().optional(),currentNodeId:Me().optional(),nodeStatuses:U_(Me(),Me()).optional()}).partial()}),J({type:"workflow_finished",description:"工作流完成",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:Et({runId:Me().optional(),status:Me().optional(),output:Vo().optional(),error:Me().optional()}).partial()}),J({type:"workflow_error",description:"工作流错误",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"workflow_checkpoint",description:"工作流检查点",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"workflow_node_start",description:"工作流节点开始",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:Et({nodeId:Me().optional(),title:Me().optional(),type:Me().optional()}).partial()}),J({type:"workflow_node_complete",description:"工作流节点完成",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"durationMs: 节点耗时;attempts: retry 重试次数(retry 原语节点)",schema:Et({nodeId:Me().optional(),title:Me().optional(),status:Me().optional(),result:Vo().optional(),error:Me().optional(),durationMs:jn().optional(),attempts:jn().optional()}).partial()}),J({type:"workflow_node_retry",description:"工作流节点重试(retry 原语每次重试发出)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"attempt > 1 时发出;reason 为上一次尝试的失败原因",schema:Et({nodeId:Me().optional(),childId:Me().optional(),attempt:jn().optional(),maxAttempts:jn().optional(),reason:Me().optional()}).partial()}),J({type:"workflow_paused",description:"工作流已暂停",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"workflow_resumed",description:"工作流已恢复",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"workflow_cancelled",description:"工作流已取消",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"workflow_recovered",description:"工作流已恢复(从故障)",category:"workflow",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"已被 workflow_resumed 覆盖,核心从未发送"}),J({type:"workflow_handoff",description:"ReAct 转交 workflow(范式切换)",category:"workflow",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"Agent Loop 单核模型重构后退役:workflow 判定改为计划注入(见 workflow_plan_ready),核心不再发送;CLI/Web 保留 handler 兼容旧服务端回放"}),J({type:"workflow_plan_ready",description:"范式路由:LLM 合成的执行计划就绪(PlanCard 数据源;confirm 恒为 false,无确认门,计划由运行中的循环直接采纳)",category:"workflow",emittedBy:["core"],handledByCli:!1,handledByWeb:!0,note:"Agent Loop 单核模型:payload 携带 planId/title/nodes(步骤清单),字段名与旧交接卡片兼容"}),J({type:"workflow_status",description:"workflow run 状态查询响应(状态对账:连接/重连后拉取终态)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-08-14: 配合 get_workflow_status 请求,修复一次性事件流漏终态导致的 UI 卡死;runs[].nodeStatuses 为逐节点状态映射",schema:Et({runs:Gc(Vo()).optional()}).partial()})]);wa([J({type:"task_update",description:"任务更新",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),J({type:"task_output",description:"任务输出",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),J({type:"task_finished",description:"任务完成",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),J({type:"task_error",description:"任务错误",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),J({type:"filejob_start",description:"文件处理任务开始(解析/渲染)",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"对话内嵌文件处理面板;Web 已处理,CLI 已处理(2026-08-07 状态行)"}),J({type:"filejob_progress",description:"文件处理进度更新",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"解析/渲染进度百分比",schema:Et({progress:jn()}).partial()}),J({type:"filejob_result",description:"文件处理完成(结果文件列表)",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"携带 RenderedFileResult[]",schema:Gc(Vo())}),J({type:"filejob_error",description:"文件处理失败",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"脱敏错误详情"})]);wa([J({type:"goal_created",description:"目标已创建",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: Web handled via goal_tasks/goal_task_update"}),J({type:"goal_tasks",description:"目标任务列表(批量初始化看板)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: 统一看板数据源"}),J({type:"goal_task_update",description:"目标任务更新",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: Web 已添加 handler"}),J({type:"goal_update",description:"目标元信息更新(retitle / 看板整体刷新)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"漂移修复:goalManager.retitle / GoalTool 此前已在发射但未注册;tasks 为空数组时 Web 清空看板"}),J({type:"goal_completed",description:"目标已完成(workflow 终态自动推导)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-08-14: 此前 goals.complete() 无任何调用点,goal 工作流跑完后 goal 永远停在 active —— 新增终态事件供两端对账"})]);wa([J({type:"hook_ask",description:"Hook 审批请求",category:"hook",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),J({type:"hook_allow",description:"Hook 允许响应",category:"hook",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),无需 handler"}),J({type:"hook_deny",description:"Hook 拒绝响应",category:"hook",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),无需 handler"}),J({type:"hook_response_ack",description:"Hook 响应确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01); Web systemHandlers 已处理(2026-08-07)"}),J({type:"ask_user_question",description:"向用户提问",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"question_answer_ack",description:"提问回答确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web useWebSocket 已处理(dismiss 提问弹窗)"}),J({type:"hook_auto_ack",description:"Hook 自动模式确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"})]);wa([J({type:"mcp_update",description:"MCP 状态更新",category:"mcp",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"})]);wa([J({type:"doctor_result",description:"诊断完成",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"degradation",description:"降级状态更新(遗留)",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"degradation_update",description:"降级状态更新",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0})]);wa([J({type:"commands_list",description:"命令列表(服务器→客户端)",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(setDynamicCommands); Web systemHandlers 已处理(2026-08-07)"}),J({type:"ping",description:"心跳 Ping",category:"system",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"由 Server 的 WS 层自动处理"}),J({type:"pong",description:"心跳 Pong",category:"system",emittedBy:["server"],handledByCli:!1,handledByWeb:!1,note:"由 Client 的 WS 层自动处理"}),J({type:"log",description:"服务端日志",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"notification",description:"通知消息",category:"system",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),J({type:"channel_message",description:"频道入站消息(转发到 Web UI)",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(2026-08-07 通知)"}),J({type:"channel_status",description:"频道连接状态变更",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(channelsStore)"}),J({type:"channel_error",description:"频道运行时错误",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(2026-08-07 通知)"}),J({type:"todo_update",description:"待办事项更新",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),J({type:"todo_item_done",description:"待办项完成",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"运行时可能发送"}),J({type:"todo_progress",description:"待办进度",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"运行时可能发送"}),J({type:"tombstone",description:"消息已删除/墓碑",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"Web/CLI 本地消息删除渲染概念,无 WS 发射端"}),J({type:"status",description:"状态更新(modelName/connected/statusText)",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,schema:Et({modelName:Me(),connected:px(),statusText:Me()}).partial()}),J({type:"model_name",description:"当前模型名称",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,schema:Et({model:Me()}).partial()}),J({type:"models_updated",description:"模型列表已更新(models.dev 快照刷新后广播)",category:"system",emittedBy:["server"],handledByCli:!1,handledByWeb:!1,note:"漂移修复:app.ts 模型端点写入后全量广播,但此前未注册;两端尚未接 handler,先做类型层登记"}),J({type:"throttle",description:"速率限制状态",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"}),J({type:"code_review_ready",description:"代码审查结果就绪",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"}),J({type:"pdca_phase",description:"PDCA 循环阶段",category:"system",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,deprecated:!0,note:"已退役:5-phase light pipeline 被 WorkflowRuntime 取代"}),J({type:"command_start",description:"命令开始(Web 路由用)",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"Web systemHandler 有 case 但核心无发送方,保留兼容"}),J({type:"command_complete",description:"命令完成(Web 路由用)",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"Web systemHandler 有 case 但核心无发送方,保留兼容"}),J({type:"command_error",description:"命令错误(Web 路由用)",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"core index.ts:1270 真实 emit;CLI useStreamHandlers:741 与 Web systemHandlers 均已处理"})]);wa([J({type:"tool.approval_required",description:"工具调用需要审批(无人值守运行触发,未放行即拒绝)",category:"inbox",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"无人值守/定时运行时写操作需审批的通知;Inbox 审批队列已移除,CLI/Web 仅提示状态"})]);wa([J({type:"automation.update",description:"自动化任务新增/更新/删除/状态变更",category:"automation",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"REST /api/automations 已可用;Web 自动化视图消费"}),J({type:"automation.run",description:"自动化触发运行(started/finished/error)",category:"automation",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 状态提示;Web RunDetail 消费"})]);const G_=/^[a-z][a-z0-9._-]*$/,y0=Me().min(1).max(128).regex(G_,"command id must match ^[a-z][a-z0-9._-]*$");Et({id:Me().min(1).max(128),command:y0,payload:tu().optional(),timeoutMs:jn().int().positive().max(3e5).optional(),sender:Me().max(128).optional()});Et({success:px(),requestId:Me(),command:y0,result:tu().optional(),error:Me().optional(),durationMs:jn().min(0).optional()});const q_=Et({capability:y0,command:y0,description:Me().max(500).optional(),provider:Me().max(128).optional()});Et({version:t1("1"),capabilities:Gc(q_)});const V_="1",W_=["ready","select","inspect","screenshot","highlight","command","event"],K_=Et({version:t1(V_),type:F_(W_),requestId:Me().min(1).max(128),payload:tu().optional()}).passthrough();Et({type:Me().min(1).max(128).regex(/^[a-z][a-z0-9._-]*$/,"event type must match ^[a-z][a-z0-9._-]*$"),payload:tu().optional(),source:Me().max(128).optional(),timestamp:jn().nonnegative().optional()});const Y_="workspace_event";Et({type:t1(Y_),sessionId:Me().optional(),data:H_([Me(),K_]).optional(),traceId:Me().optional()});const Z_=H0.map(n=>({eventType:n.type,description:n.description,category:n.category,emittedBy:n.emittedBy,handledByCli:n.handledByCli,handledByWeb:n.handledByWeb,...n.deprecated!==void 0?{deprecated:n.deprecated}:{},...n.note!==void 0?{note:n.note}:{}}));function Ia(n){return n==="auto-plan"?"plan":n==="auto-act"?"act":n==="auto-goal"?"goal":n}function Wo(n){return n==="auto-plan"||n==="auto-act"||n==="auto-goal"}function X_(n){switch(n){case"plan":return"auto-plan";case"auto-plan":return"plan";case"act":return"auto-act";case"auto-act":return"act";case"goal":return"auto-goal";case"auto-goal":return"goal"}}const qP=["plan","act","goal"];function Zp(n,e){return e?n==="plan"?"auto-plan":n==="act"?"auto-act":"auto-goal":n}function Q_(n){const e=["plan","act","goal"],t=e.indexOf(Ia(n)),a=e[(t+1)%e.length]??"act";return Zp(a,Wo(n))}const J_={plan:{label:"Plan",accent:"blue"},"auto-plan":{label:"Auto-Plan",accent:"cyan"},act:{label:"Act",accent:"green"},"auto-act":{label:"Auto-Act",accent:"yellow"},goal:{label:"Goal",accent:"magenta"},"auto-goal":{label:"Auto-Goal",accent:"red"}},VP={low:{label:"Low",accent:"green"},medium:{label:"Medium",accent:"cyan"},high:{label:"High",accent:"yellow"},critical:{label:"Critical",accent:"red"}},WP={allow:{label:"Allow"},deny:{label:"Deny"},allow_session:{label:"Allow session"},auto:{label:"Auto mode"}};function e9(n){return n==="plan"||n==="auto-plan"||n==="act"||n==="auto-act"||n==="goal"||n==="auto-goal"?n:"auto-act"}function pc(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}function t9(n){return n<=0?"":n>=100?`${Math.round(n)}t/s`:`${n.toFixed(1)}t/s`}function gx(n){if(n<=0)return"";if(n>=60){const e=Math.floor(n/60),t=n%60;return`${e}m${t}s`}return`${n}s`}function n9(n,e){switch(n){case"bash":case"shell":case"PowerShell":return`ran ${e} shell command${e>1?"s":""}`;case"read_file":return`read ${e} file${e>1?"s":""}`;case"write_file":return`wrote ${e} file${e>1?"s":""}`;case"edit_file":return`edited ${e} file${e>1?"s":""}`;default:return`ran ${e} ${n}${e>1?"s":""}`}}function KP(n){const e=Object.entries(n.toolCounts).filter(([,s])=>s>0).sort((s,o)=>o[1]-s[1]),t=n.headline||`Thought for ${gx(Math.max(1,Math.round(n.durationMs/1e3)))}`,a=e.map(([s,o])=>n9(s,o));return a.length>0?`${t}, ${a.join(", ")}`:t}function a9(n,e){const t=n.toLowerCase();return/\b(rm|del|delete|drop|truncate|format|mkfs)\b/.test(t)?"critical":/\b(bash|shell|exec|cmd|powershell|terminal)\b/.test(t)?/\b(rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs)\b/i.test(e)?"critical":"high":/\b(write|edit|save|upload|deploy|publish)\b/i.test(t)||/\b(install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf)\b/i.test(t)?"high":/\b(git|commit|push|merge|rebase)\b/i.test(t)?/\b(push|force|hard\s*reset|rebase)\b/i.test(e)?"high":"medium":/\b(http|fetch|curl|wget|api|request|download)\b/i.test(t)?"medium":/\b(read|open|list|ls|dir|cat|view|search|find|grep|glob)\b/i.test(t)?"low":"medium"}function r9(n,e){if(e==null)return null;if(/\b(bash|shell|exec|cmd|powershell|terminal)\b/i.test(n))return e||null;if(/\b(write|edit|save|create)\b/i.test(n)){const t=e.match(/(?:file_path|path|file)["\s:=]+([^\s",}]+)/i);return t?`${t[1]}
27
- ${e.slice(0,200)}`:e.slice(0,200)||null}return e&&e.length>0?e.length>200?`${e.slice(0,200)}...`:e:null}function g2(n){const t=(String(n||"").trim().replace(/^v/i,"").split(/[-+]/)[0]??"").split(".").map(a=>parseInt(a,10));for(;t.length<3;)t.push(0);return t.map(a=>Number.isFinite(a)?a:0)}function s9(n,e){const t=g2(n),a=g2(e);for(let s=0;s<3;s+=1){const o=t[s]??0,l=a[s]??0;if(o!==l)return o-l}return 0}const v0=[{version:"1.0.29",title:{zh:"更新内容提示",en:"What's New notice"},items:[{zh:"CLI 与 Web 新增「更新内容」提示:每次版本升级后首次启动/打开时展示本次更新内容,之后不再打扰",en:`CLI and Web now show a "What's New" notice on first launch after a version upgrade — once per version, never again`},{zh:"CLI 新增 /whatsnew 命令,可随时查看历史更新内容",en:"New /whatsnew command in the CLI to view the changelog anytime"},{zh:"Web 设置页「关于」区域新增「查看更新内容」入口",en:`Web settings "About" section gains a "What's New" entry point`}]}];function i9(n,e){const t=a=>{if(a)return e==="zh"?a.zh:a.en};return{version:n.version,date:n.date,title:t(n.title),items:n.items.map(a=>e==="zh"?a.zh:a.en)}}function o9(n){return n?v0.filter(e=>s9(e.version,n)>0):v0}function l9(){const n=v0[0];return n?n.version:null}const YP=["openai-chat-completions","openai-completions","openai-responses","anthropic-messages","codex-responses","claude-code"];Z_.map(n=>n.eventType);function c9(){return`err-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}const Ko=mn(n=>({errors:[],push:(e,t,a,s,o)=>{let l="";return n(u=>{const d=u.errors.find(p=>!p.dismissed&&!p.action&&p.level===e&&p.title===t);if(d)return l=d.id,{errors:u.errors.map(p=>p.id===d.id?{...p,count:p.count+1,timestamp:Date.now()}:p)};const h=c9();l=h;const m={id:h,level:e,title:t,detail:a,action:s,timestamp:Date.now(),dismissed:!1,durationMs:o,count:1};return{errors:[...u.errors.slice(-49),m]}}),l},dismiss:e=>n(t=>({errors:t.errors.map(a=>a.id===e?{...a,dismissed:!0}:a)})),clearAll:()=>n({errors:[]})})),vr={info:(n,e,t)=>Ko.getState().push("info",n,e,void 0,t),warn:(n,e,t)=>Ko.getState().push("warning",n,e,void 0,t),error:(n,e,t)=>Ko.getState().push("error",n,e,void 0,t),critical:(n,e,t)=>Ko.getState().push("critical",n,e,void 0,t)},gc=20,n1=()=>{const n=window.location.protocol==="https:"?"wss:":"ws:",e=window.location.hostname,t=window.location.port,a=t?String(Number(t)+1):"",s=a?`${e}:${a}`:e;return`${n}//${s}/ws`},u9=n1(),y2="dscode_client_id";function d9(){try{const n=localStorage.getItem(y2);if(n)return n;const e=`web-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,10)}`;return localStorage.setItem(y2,e),e}catch{return`web-${Math.random().toString(36).slice(2,10)}`}}class f9{constructor(e){V(this,"ws",null);V(this,"url");V(this,"clientId",d9());V(this,"messageHandlers",new Set);V(this,"openHandlers",new Set);V(this,"closeHandlers",new Set);V(this,"errorHandlers",new Set);V(this,"reconnectAttempts",0);V(this,"reconnectHandlers",new Set);V(this,"reconnectSuccessHandlers",new Set);V(this,"reconnectGiveUpHandlers",new Set);V(this,"isManualClose",!1);V(this,"authenticated",!1);V(this,"sessionId",null);V(this,"heartbeatInterval",null);V(this,"reconnectTimer",null);V(this,"lastPongTime",0);V(this,"HEARTBEAT_INTERVAL",15e3);V(this,"HEARTBEAT_TIMEOUT",45e3);this.url=e||u9}setSessionId(e){this.sessionId=e}getSessionId(){return this.sessionId}getReconnectState(){var e;return{attempts:this.reconnectAttempts,maxAttempts:gc,reconnecting:this.reconnectAttempts>0&&((e=this.ws)==null?void 0:e.readyState)!==WebSocket.OPEN}}onReconnectAttempt(e){return this.reconnectHandlers.add(e),()=>this.reconnectHandlers.delete(e)}onReconnectSuccess(e){return this.reconnectSuccessHandlers.add(e),()=>this.reconnectSuccessHandlers.delete(e)}onReconnectGiveUp(e){return this.reconnectGiveUpHandlers.add(e),()=>this.reconnectGiveUpHandlers.delete(e)}connect(){var a,s;if(((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN||((s=this.ws)==null?void 0:s.readyState)===WebSocket.CONNECTING)return;this.isManualClose=!1;const e=new URLSearchParams;this.sessionId&&e.set("sessionId",this.sessionId),e.set("clientId",this.clientId);const t=e.toString()?`${this.url}?${e.toString()}`:this.url;this.ws=new WebSocket(t),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{var l;console.log("WebSocket connected");const o=this.reconnectAttempts>0;this.reconnectAttempts=0,this.lastPongTime=Date.now(),o&&this.reconnectSuccessHandlers.forEach(u=>u()),((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"ping"})),this.startHeartbeat(),this.openHandlers.forEach(u=>u())},this.ws.onclose=()=>{console.log("WebSocket closed"),this.stopHeartbeat(),this.closeHandlers.forEach(o=>o()),this.isManualClose||this.scheduleReconnect()},this.ws.onerror=o=>{vr.error("WebSocket connection error",o.message||"Connection failed"),this.errorHandlers.forEach(l=>l())},this.ws.onmessage=o=>{this._onMessage(o)}}async _onMessage(e){var t,a;try{let s;if(e.data instanceof Blob?s=await e.data.text():e.data instanceof ArrayBuffer?s=new TextDecoder().decode(e.data):typeof e.data=="string"?s=e.data:s=String(e.data),s=s.trim(),!s)return;const o=JSON.parse(s);if(console.log("[WS←]",o.type,o.sessionId,JSON.stringify(o.data||o.message||"").slice(0,200)),(o.type==="pong"||o.type==="ping")&&(this.lastPongTime=Date.now(),o.type==="pong"))return;o.seq!==void 0&&o.seq>=0&&this.send({type:"message_ack",data:JSON.stringify({seq:o.seq})}),this.messageHandlers.forEach(l=>l(o))}catch(s){const o=((a=(t=e.data)==null?void 0:t.constructor)==null?void 0:a.name)||typeof e.data;let l;if(e.data instanceof Blob?l=`[Blob ${e.data.size} bytes]`:e.data instanceof ArrayBuffer?l=`[ArrayBuffer ${e.data.byteLength} bytes]`:l=String(e.data).slice(0,500),typeof e.data=="string"&&e.data.trim()){const u=e.data.trim();try{this.messageHandlers.forEach(d=>d({type:"log",data:JSON.stringify({level:"info",message:u})}));return}catch{}}vr.error("Failed to parse WebSocket message",`type=${o} data=${l} error=${s}`)}}startHeartbeat(){this.stopHeartbeat(),this.lastPongTime=Date.now(),this.heartbeatInterval=setInterval(()=>{var e,t;if(Date.now()-this.lastPongTime>this.HEARTBEAT_TIMEOUT){console.warn("[WS] Heartbeat timeout, reconnecting..."),this.stopHeartbeat(),this.isManualClose=!0,(e=this.ws)==null||e.close(),this.ws=null,this.scheduleReconnect();return}((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN&&this.send({type:"ping"})},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}scheduleReconnect(){if(this.reconnectAttempts++,this.reconnectAttempts>gc){console.error(`[WS] Max reconnect attempts (${gc}) reached — giving up.`),vr.error("WebSocket",`Connection lost — max reconnect attempts (${gc}) reached. Refresh the page to try again.`),this.reconnectGiveUpHandlers.forEach(s=>s());return}const e=Math.min(3e3*Math.pow(2,this.reconnectAttempts),3e4),t=Math.random()*1e3-500,a=Math.max(100,Math.round(e+t));console.log(`[WS] Reconnecting... Attempt ${this.reconnectAttempts}, delay=${a}ms`),this.reconnectHandlers.forEach(s=>s(this.reconnectAttempts,gc)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},a)}disconnect(){var e;this.isManualClose=!0,this.reconnectAttempts=0,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(e=this.ws)==null||e.close(),this.ws=null}send(e){var t,a;if(((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN){const s=JSON.stringify(e);console.log("[WS→]",e.type,e.sessionId,s.slice(0,200)),this.ws.send(s)}else console.warn("[WS] NOT CONNECTED — dropping:",e.type,e.sessionId,"readyState=",(a=this.ws)==null?void 0:a.readyState)}onMessage(e){return this.messageHandlers.add(e),()=>this.messageHandlers.delete(e)}onOpen(e){return this.openHandlers.add(e),()=>this.openHandlers.delete(e)}onClose(e){return this.closeHandlers.add(e),()=>this.closeHandlers.delete(e)}onError(e){return this.errorHandlers.add(e),()=>this.errorHandlers.delete(e)}get isConnected(){var e;return((e=this.ws)==null?void 0:e.readyState)===WebSocket.OPEN}setToken(e){try{sessionStorage.setItem("auth_token",e)}catch{}}get isAuthenticated(){return this.authenticated}setAuthenticated(e){this.authenticated=e}}const Oe=new f9;function v2(n,e){return`ext:${n}:${e.toLowerCase()}`}const ns=mn()(oi((n,e)=>({pendingApprovals:[],autoMode:!0,sessionAllowList:[],showConfigHint:!0,addApproval:t=>n(a=>({pendingApprovals:[...a.pendingApprovals,t]})),removeApproval:t=>n(a=>({pendingApprovals:a.pendingApprovals.filter(s=>s.approvalId!==t)})),clearApprovals:()=>n({pendingApprovals:[]}),setAutoMode:t=>n({autoMode:t}),addToSessionAllowList:(t,a)=>n(s=>{const o=a?v2(t,a):t;return s.sessionAllowList.includes(o)?s:{sessionAllowList:[...s.sessionAllowList,o]}}),isSessionAllowed:(t,a)=>{const s=e().sessionAllowList;return a?s.includes(v2(t,a)):s.includes(t)},setShowConfigHint:t=>n({showConfigHint:t})}),{name:"deepseekcode-hook-approval",partialize:n=>({autoMode:n.autoMode,showConfigHint:n.showConfigHint})}));function h9(n){if(!n)return 0;const e=(n.match(/[\u4e00-\u9fff]/g)||[]).length,t=n.length-e;return Math.ceil(e*1.5+t*.25)}const rt=mn((n,e)=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},maxContextTokens:1e6,degradation:null,compactingUntil:0,lastCompactInfo:null,compactionProgress:null,cacheStats:null,showTokenInfo:!1,model:"",modelRef:"",modelSource:"",history:[],_hasBackendData:!1,tokenRate:0,sessionBaseTotal:0,workflowTokens:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,retryState:null,contextBreakdown:null,setContextDistribution:t=>n({contextDistribution:t}),setContextBreakdown:t=>n({contextBreakdown:t}),setThresholdWarning:t=>n({thresholdWarning:t}),setRetryState:t=>n({retryState:t}),updateUsage:t=>n(a=>{const s=t.totalTokens??a.currentUsage.totalTokens,o=Date.now(),l=a._lastTotal,u=a._lastTotalTs;let d=a.tokenRate;if(u>0&&l>0&&o>u&&s>l){const h=s-l,m=(o-u)/1e3,p=h/m;d=d>0?d*.6+p*.4:p}return{currentUsage:{...a.currentUsage,...t},_hasBackendData:!0,tokenRate:d,_lastTotal:s,_lastTotalTs:o}}),setModel:t=>n({model:t}),setModelRef:t=>n({modelRef:t}),setModelSource:t=>n({modelSource:t}),addWorkflowTokens:t=>n(a=>({workflowTokens:a.workflowTokens+(Number(t)||0)})),setMaxContextTokens:t=>n({maxContextTokens:t}),setDegradation:t=>n({degradation:t}),setCompacting:t=>n({compactingUntil:Date.now()+3e3,lastCompactInfo:t}),setCompactionProgress:t=>n({compactionProgress:t}),setCacheStats:t=>n({cacheStats:t}),accumulateCacheStats:(t,a)=>n(s=>{const o=s.cacheStats,l=((o==null?void 0:o.cacheHitTokens)??0)+t,u=((o==null?void 0:o.cacheMissTokens)??0)+a;return{cacheStats:{cacheHitTokens:l,cacheMissTokens:u,cacheHitRate:l+u>0?l/(l+u):void 0,cacheStatsCalls:((o==null?void 0:o.cacheStatsCalls)??0)+1}}}),setShowTokenInfo:t=>n({showTokenInfo:t}),addToHistory:t=>n(a=>({history:[...a.history.slice(-100),{timestamp:Date.now(),usage:t}]})),estimateTokens:t=>h9(t),recalculateFromMessages:t=>{if(!t||t.length===0){n({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1});return}if(e()._hasBackendData)return;const a=e().estimateTokens;let s=0,o=0;for(const d of t){let h=d.content||"";if(d.thinking&&(h+=" "+d.thinking),d.steps)for(const p of d.steps)p.thought&&(h+=" "+p.thought),p.action&&(h+=" "+p.action),p.result&&(h+=" "+p.result);if(d.toolCalls)for(const p of d.toolCalls)p.args&&(h+=" "+(typeof p.args=="string"?p.args:JSON.stringify(p.args)));const m=a(h);d.type==="user"?s+=m:o+=m}const l=s+o,u=s/1e6*.15+o/1e6*.6;n({currentUsage:{promptTokens:s,completionTokens:o,totalTokens:l,estimatedCost:u}})},resetUsage:()=>n(t=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1,sessionBaseTotal:t.currentUsage.totalTokens,workflowTokens:0,tokenRate:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,contextBreakdown:null}))})),yx="";function Qd(n){return`${yx}${n}`}class m9{constructor(e){V(this,"baseUrl");this.baseUrl=e}async request(e,t={}){try{const a=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token"),s={"Content-Type":"application/json",...t.headers};a&&(s.Authorization=`Bearer ${a}`);const o=await fetch(`${this.baseUrl}${e}`,{headers:s,...t}),l=await o.json();return o.ok?l&&typeof l.success=="boolean"?{success:l.success,data:l.data,error:l.error}:{success:!0,data:l}:{success:!1,error:l.error||`HTTP ${o.status}`,data:l.data}}catch(a){return{success:!1,error:a instanceof Error?a.message:"Network error"}}}get(e){return this.request(e,{method:"GET"})}post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}delete(e,t){return this.request(e,{method:"DELETE",body:t?JSON.stringify(t):void 0})}patch(e,t){return this.request(e,{method:"PATCH",body:t?JSON.stringify(t):void 0})}}const Z=new m9(yx),ht={providers:{presets:()=>Z.get("/api/providers/presets"),refresh:()=>Z.post("/api/providers/refresh"),testConnection:(n,e)=>Z.post("/api/providers/test-connection",{baseUrl:n,apiKey:e})},models:{list:async()=>{var e;const n=await Z.get("/api/models");return n.success&&((e=n.data)!=null&&e.models)&&(n.data.models=n.data.models.map(t=>({...t,isGlobalDefault:t.isDefault===!0}))),n},get:n=>Z.get(`/api/models/${n}`),create:n=>Z.post("/api/models",n),update:(n,e,t)=>Z.post("/api/models/update",{provider:n,modelId:e,...t}),delete:(n,e)=>Z.post("/api/models/delete",{provider:n,modelId:e}),test:n=>Z.post(`/api/models/${n}/test`),fetch:(n,e,t)=>Z.post("/api/models/fetch",{baseUrl:n,apiKey:e,fullPath:t}),byProvider:(n,e)=>{const t=new URLSearchParams({provider:n});return e&&t.set("q",e),Z.get(`/api/models/by-provider?${t.toString()}`)},catalogSearch:n=>{const e=new URLSearchParams;n.q&&e.set("q",n.q),n.toolCall&&e.set("toolCall","1"),n.reasoning&&e.set("reasoning","1"),n.minContext&&e.set("minContext",String(n.minContext)),n.limit&&e.set("limit",String(n.limit));const t=e.toString();return Z.get(`/api/models/catalog${t?`?${t}`:""}`)},toggle:(n,e)=>Z.post("/api/models/toggle",{provider:n,modelId:e}),setDefaults:n=>Z.post("/api/models/defaults",n),getSessionModel:n=>Z.get(`/api/sessions/${encodeURIComponent(n)}/model`),setSessionModel:(n,e,t)=>Z.put(`/api/sessions/${encodeURIComponent(n)}/model`,{provider:e,model:t}),clearSessionModel:n=>Z.delete(`/api/sessions/${encodeURIComponent(n)}/model`)},tools:{list:()=>Z.get("/api/tools"),get:n=>Z.get(`/api/tools/${n}`),update:(n,e)=>Z.put(`/api/tools/${n}`,e),toggle:(n,e)=>Z.post(`/api/tools/${n}/toggle`,{enabled:e})},connectors:{list:()=>Z.get("/api/connectors"),get:n=>Z.get(`/api/connectors/${encodeURIComponent(n)}`),toggle:(n,e,t)=>Z.post(`/api/connectors/${encodeURIComponent(n)}/toggle`,{enabled:e,env:t}),addCustom:n=>Z.post("/api/connectors/custom",n),removeCustom:n=>Z.delete(`/api/connectors/custom/${encodeURIComponent(n)}`)},skills:{list:()=>Z.get("/api/skills"),get:n=>Z.get(`/api/skills/${n}`),create:n=>Z.post("/api/skills",n),update:(n,e)=>Z.put(`/api/skills/${n}`,e),toggle:(n,e)=>Z.post(`/api/skills/${n}/toggle`,{enabled:e}),delete:n=>Z.delete(`/api/skills/${n}`),import:n=>Z.post("/api/skills/import",n),marketplaces:{list:()=>Z.get("/api/skills/marketplaces"),add:n=>Z.post("/api/skills/marketplaces",n),remove:n=>Z.delete(`/api/skills/marketplaces/${n}`),get:n=>Z.get(`/api/skills/marketplaces/${n}`),refresh:n=>Z.post(`/api/skills/marketplaces/${n}/refresh`,{}),install:(n,e)=>Z.post(`/api/skills/marketplaces/${n}/install`,{skillId:e})},workshop:{list:n=>Z.get(`/api/skills/workshop${n?`?status=${n}`:""}`),propose:n=>Z.post("/api/skills/workshop",n),apply:n=>Z.post(`/api/skills/workshop/${n}/apply`,{}),reject:n=>Z.post(`/api/skills/workshop/${n}/reject`,{})},config:{get:n=>Z.get(`/api/skills/${n}/config`),update:(n,e)=>Z.put(`/api/skills/${n}/config`,e)}},files:{list:n=>Z.get(`/api/files${n?`?path=${encodeURIComponent(n)}`:""}`),read:n=>Z.get(`/api/files/read?path=${encodeURIComponent(n)}`),create:(n,e)=>Z.post("/api/files",{path:n,content:e}),update:(n,e)=>Z.put("/api/files/write",{path:n,content:e}),delete:n=>Z.delete(`/api/files?path=${encodeURIComponent(n)}`),download:async n=>{try{const e={},t=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token");t&&(e.Authorization=`Bearer ${t}`);const a=await fetch(Qd(`/api/files/download?path=${encodeURIComponent(n)}`),{headers:e});if(!a.ok){let u=`HTTP ${a.status}`;try{const d=await a.json();d!=null&&d.error&&(u=d.error)}catch{}return{success:!1,error:u}}const s=await a.blob(),o=URL.createObjectURL(s),l=document.createElement("a");return l.href=o,l.download=n.split(/[\\/]/).pop()||"download",l.click(),URL.revokeObjectURL(o),{success:!0}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Download failed"}}},upload:async(n,e)=>{try{const t=await p9(n);return Z.post("/api/files/upload",{path:e,content:t,base64:!0})}catch(t){return{success:!1,error:t instanceof Error?t.message:"Upload failed"}}}},dirs:{list:n=>Z.get(`/api/dirs${n?`?path=${encodeURIComponent(n)}`:""}`)},sessions:{list:()=>Z.get("/api/sessions"),get:n=>Z.get(`/api/sessions/${n}`),create:n=>Z.post("/api/sessions",{title:n}),delete:n=>Z.delete(`/api/sessions/${n}`),resume:n=>Z.get(`/api/sessions/${encodeURIComponent(n)}/resume`)},trajectory:{events:async(n,e=0,t=500)=>{var l,u;const a=encodeURIComponent(n),s=await Z.get(`/api/plugins/http/trajectory/api/events?sessionId=${a}&cursor=${e}&limit=${t}`);if(s.success&&Array.isArray((l=s.data)==null?void 0:l.events))return{success:!0,data:{events:s.data.events,hasMore:!!s.data.hasMore||s.data.events.length===t}};const o=await Z.get(`/api/plugins/http/trajectory/api/trajectory?sid=${a}&off=${e}&lim=${t}`);if(o.success&&Array.isArray((u=o.data)==null?void 0:u.events)){const d=o.data.events,h=o.data.nextOffset??e+d.length,m=o.data.total??h;return{success:!0,data:{events:d,hasMore:h<m&&d.length>0}}}return{success:!1,error:s.error||o.error||"轨迹插件不可用"}}},tasks:{list:n=>Z.get(n?`/api/tasks?sessionId=${encodeURIComponent(n)}`:"/api/tasks"),get:n=>Z.get(`/api/tasks/${n}`),create:n=>Z.post("/api/tasks",n),update:(n,e)=>Z.put(`/api/tasks/${n}`,e),updateStatus:(n,e)=>Z.patch(`/api/tasks/${n}/status`,{status:e}),delete:n=>Z.delete(`/api/tasks/${n}`),clearCompleted:()=>Z.delete("/api/tasks")},config:{provider:{get:()=>Z.get("/api/config/provider"),save:n=>Z.post("/api/config/provider",n),delete:n=>Z.post("/api/config/provider/remove",{provider:n}),setDefault:n=>Z.post("/api/config/provider",{provider:n,setDefault:!0})},files:{list:()=>Z.get("/api/config/files"),read:n=>Z.get(`/api/config/files/read?file=${encodeURIComponent(n)}`),write:(n,e)=>Z.put("/api/config/files/write",{file:n,content:e})},context:{get:()=>Z.get("/api/config/context"),save:n=>Z.post("/api/config/context",n)}},git:{status:()=>Z.get("/api/git/status"),branches:()=>Z.get("/api/git/branches"),commit:n=>Z.post("/api/git/commit",n),push:()=>Z.post("/api/git/push"),checkout:n=>Z.post("/api/git/checkout",{branch:n}),prStatus:()=>Z.get("/api/repos/pr")},fileJob:{parse:n=>Z.post("/api/filejob/parse",{files:n}),parsePaths:n=>Z.post("/api/filejob/parse",{paths:n}),importPaths:n=>Z.post("/api/filejob/import",{paths:n}),render:n=>Z.post("/api/filejob/render",n)},system:{status:()=>Z.get("/api/system/status"),restart:()=>Z.post("/api/system/restart"),shutdown:()=>Z.post("/api/system/shutdown")},observability:{summary:()=>Z.get("/api/observability/summary"),costs:()=>Z.get("/api/observability/costs"),listRuns:()=>Z.get("/api/observability/runs"),getRun:n=>Z.get(`/api/observability/runs/${encodeURIComponent(n)}`),getRunEvents:(n,e=0,t=50)=>Z.get(`/api/observability/runs/${encodeURIComponent(n)}/events?page=${e}&size=${t}`)},templates:{list:()=>Z.get("/api/templates"),get:n=>Z.get(`/api/templates/${encodeURIComponent(n)}`),create:n=>Z.post("/api/templates",n),update:(n,e)=>Z.put(`/api/templates/${encodeURIComponent(n)}`,e),remove:n=>Z.delete(`/api/templates/${encodeURIComponent(n)}`),versions:n=>Z.get(`/api/templates/${encodeURIComponent(n)}/versions`),getVersion:(n,e)=>Z.get(`/api/templates/${encodeURIComponent(n)}/versions/${e}`),render:(n,e)=>Z.post(`/api/templates/${encodeURIComponent(n)}/render`,{inputs:e}),createFromRun:(n,e)=>Z.post("/api/templates",{sourceRunId:n,generalize:(e==null?void 0:e.generalize)===!0,name:e==null?void 0:e.name,message:e==null?void 0:e.message})},workflows:{list:()=>Z.get("/api/workflows"),start:n=>Z.post("/api/workflows",n),get:n=>Z.get(`/api/workflows/${encodeURIComponent(n)}`),synthesize:n=>Z.post("/api/workflows/synthesize",{message:n})},plans:{list:()=>Z.get("/api/plans"),read:n=>Z.get(`/api/plans/${encodeURIComponent(n)}`),delete:n=>Z.delete(`/api/plans/${encodeURIComponent(n)}`)},logs:{list:()=>Z.get("/api/logs"),read:(n,e)=>Z.get(`/api/logs/read?file=${encodeURIComponent(n)}${e?`&maxLines=${e}`:""}`),downloadUrl:n=>`/api/logs/download?file=${encodeURIComponent(n)}`},stt:{status:()=>Z.get("/api/stt/status"),transcribe:(n,e,t="wav")=>Z.post("/api/stt/transcribe",{language:n,audio:e,format:t}),install:n=>Z.post("/api/stt/install",{backend:n}),installStatus:()=>Z.get("/api/stt/install/status"),cancelInstall:()=>Z.post("/api/stt/install/cancel")},hooks:{list:()=>Z.get("/api/hooks/rules"),get:n=>Z.get(`/api/hooks/rules/${encodeURIComponent(n)}`),create:n=>Z.post("/api/hooks/rules",n),update:(n,e)=>Z.put(`/api/hooks/rules/${encodeURIComponent(n)}`,e),delete:n=>Z.delete(`/api/hooks/rules/${encodeURIComponent(n)}`),batchDelete:n=>Z.post("/api/hooks/rules/batch-delete",{names:n}),toggle:(n,e)=>Z.patch(`/api/hooks/rules/${encodeURIComponent(n)}/toggle`,{enabled:e}),batchToggle:(n,e)=>Z.post("/api/hooks/rules/batch-toggle",{names:n,enabled:e}),dryRun:n=>Z.post("/api/hooks/dry-run",n),stats:()=>Z.get("/api/hooks/stats"),events:()=>Z.get("/api/hooks/events"),agents:()=>Z.get("/api/hooks/agents"),export:()=>Z.get("/api/hooks/export"),import:n=>Z.post("/api/hooks/import",n)},channels:{list:()=>Z.get("/api/channels"),types:()=>Z.get("/api/channels/types"),create:n=>Z.post("/api/channels",n),update:(n,e)=>Z.put(`/api/channels/${encodeURIComponent(n)}`,e),delete:n=>Z.delete(`/api/channels/${encodeURIComponent(n)}`),toggle:(n,e)=>Z.patch(`/api/channels/${encodeURIComponent(n)}/toggle`,{enabled:e}),test:n=>Z.post(`/api/channels/${encodeURIComponent(n)}/test`),wechat:{qrcode:(n,e)=>Z.get(`/api/channels/${encodeURIComponent(n)}/wechat/qrcode?token=${encodeURIComponent(e)}`),qrcodeStatus:(n,e,t)=>Z.get(`/api/channels/${encodeURIComponent(n)}/wechat/qrcode/status?token=${encodeURIComponent(e)}&qrcode=${encodeURIComponent(t)}`)},weixin:{bind:()=>Z.get("/api/weixin/bind"),bindStatus:n=>Z.get(`/api/weixin/bind/status?qrcode=${encodeURIComponent(n)}`)}},automations:{list:()=>Z.get("/api/automations"),create:n=>Z.post("/api/automations",n),update:(n,e)=>Z.put(`/api/automations/${encodeURIComponent(n)}`,e),remove:n=>Z.delete(`/api/automations/${encodeURIComponent(n)}`),toggle:(n,e)=>Z.post(`/api/automations/${encodeURIComponent(n)}/toggle`,{enabled:e}),run:n=>Z.post(`/api/automations/${encodeURIComponent(n)}/run`),runs:n=>Z.get(`/api/automations/${encodeURIComponent(n)}/runs`),addPermission:(n,e,t)=>Z.post(`/api/automations/${encodeURIComponent(n)}/permissions`,{tool:e,target:t}),revokePermission:(n,e)=>Z.delete(`/api/automations/${encodeURIComponent(n)}/permissions`,{entry:e})}};function p9(n){return new Promise((e,t)=>{const a=new FileReader;a.onload=()=>{const s=a.result,o=s.indexOf(",");e(o>=0?s.slice(o+1):s)},a.onerror=()=>t(a.error||new Error("Failed to read file")),a.readAsDataURL(n)})}const Bm=n=>n==="normal"?"act":n;let Td=0;const g9=n=>n==="normal"?"normal":n==="auto"?"auto-act":e9(typeof n=="string"?n:void 0),yc=n=>n==="normal"?"act":Wo(n)?"auto":Ia(n),Zo=mn()(oi((n,e)=>({mode:"auto-act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null,setMode:t=>{const a=e().mode;if(a===t)return;n(h=>({mode:t,modeHistory:[...h.modeHistory,{previousMode:a,newMode:t,description:`Mode changed: ${a} -> ${t}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(t!=="normal"&&Wo(t));const s=yc(a),o=yc(t),l=a==="normal"?"act":Ia(a),u=t==="normal"?"act":Ia(t);if(l===u&&s===o)return;try{const h=Ke.getState().activeSessionId||Oe.getSessionId();h&&Oe.send({type:"plan_mode_change",sessionId:h,data:JSON.stringify({previousMode:yc(a),newMode:yc(t),frontendMode:t,timestamp:Date.now()})})}catch(h){console.warn("[ExecutionModeStore] Failed to notify mode change via WS:",h)}const d=++Td;ht.models.list().then(h=>{var _;if(d!==Td||!h.success||!((_=h.data)!=null&&_.models))return;const m=h.data.models.filter(T=>T.enabled!==!1),p=Ia(Bm(t)),b=m.find(T=>T.defaultFor===p),x=m.find(T=>T.isDefault||T.defaultFor==="global"),w=b||x||m[0];w&&(rt.getState().setModel(w.id),rt.getState().setModelRef(`${w.provider}:${w.id}`))}).catch(h=>{console.warn("[ExecutionModeStore] Failed to refresh models:",h)})},applyBackendMode:t=>{const a=e().mode;if(a===t)return;n(o=>({mode:t,prePlanMode:t!=="plan"?null:o.prePlanMode,modeHistory:[...o.modeHistory,{previousMode:a,newMode:t,description:`Backend mode changed: ${a} -> ${t}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(t!=="normal"&&Wo(t));const s=++Td;ht.models.list().then(o=>{var p;if(s!==Td||!o.success||!((p=o.data)!=null&&p.models))return;const l=o.data.models.filter(b=>b.enabled!==!1),u=Ia(Bm(t)),d=l.find(b=>b.defaultFor===u),h=l.find(b=>b.isDefault||b.defaultFor==="global"),m=d||h||l[0];m&&(rt.getState().setModel(m.id),rt.getState().setModelRef(`${m.provider}:${m.id}`))}).catch(o=>{console.warn("[ExecutionModeStore] Failed to refresh models after backend mode change:",o)})},toggleMode:()=>{const t=e().mode,a=t==="normal"?"act":Q_(t);e().setMode(a)},setBaseMode:t=>{const a=e().mode,s=a!=="normal"&&Wo(a);e().setMode(Zp(t,s))},setAuto:t=>{e().setMode(Zp(Ia(Bm(e().mode)),t))},toggleAuto:()=>{const t=e().mode;e().setMode(t==="normal"?"auto-act":X_(t))},enterPlanMode:(t,a)=>{const s=e().mode,o=s!=="normal"&&Ia(s)!=="plan"?s:e().prePlanMode,l=s!=="normal"&&Ia(s)==="goal"?"goal":"plan";n(u=>({mode:l,prePlanMode:o,modeHistory:[...u.modeHistory,{previousMode:s,newMode:l,description:`Enter ${l} mode: ${a}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(!1)},exitPlanMode:(t,a)=>{const s=e().mode,o=e().prePlanMode,l=o&&(o==="normal"||Ia(o)!=="plan")?o:"act";n(u=>({mode:l,prePlanMode:null,modeHistory:[...u.modeHistory,{previousMode:s,newMode:l,description:`Exit to ${l} mode: ${a}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(l!=="normal"&&Wo(l))},enterGoalMode:(t,a)=>{const s=e().mode;n(o=>({mode:"goal",modeHistory:[...o.modeHistory,{previousMode:s,newMode:"goal",description:`Enter Goal mode: ${a}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(!1);try{const o=Ke.getState().activeSessionId||Oe.getSessionId()||void 0;Oe.send({type:"plan_mode_change",sessionId:o,data:JSON.stringify({previousMode:yc(s),newMode:"goal",frontendMode:"goal",goalDescription:a,timestamp:Date.now()})})}catch(o){console.warn("[ExecutionModeStore] Failed to notify goal mode change via WS:",o)}},exitGoalMode:()=>{const t=e().mode;n(a=>({mode:"act",modeHistory:[...a.modeHistory,{previousMode:t,newMode:"act",description:"Exit Goal mode",timestamp:Date.now()}]})),ns.getState().setAutoMode(!1)},setPlanContent:t=>n({currentPlanContent:t}),setThinkingStatus:(t,a)=>n(s=>({thinkingStatusBySession:{...s.thinkingStatusBySession,[t]:a}})),getThinkingStatus:t=>e().thinkingStatusBySession[t]||"",reset:()=>n({mode:"auto-act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null})}),{name:"deepseekcode-plan-storage",version:1,migrate:n=>n,merge:(n,e)=>{const t=n??{};return{...e,...t,mode:g9(t.mode)}},partialize:n=>({mode:n.mode,currentPlanContent:n.currentPlanContent,modeHistory:n.modeHistory})}));function vx(n){var e,t,a="";if(typeof n=="string"||typeof n=="number")a+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=vx(n[e]))&&(a&&(a+=" "),a+=t)}else for(t in n)n[t]&&(a&&(a+=" "),a+=t);return a}function y9(){for(var n,e,t=0,a="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=vx(n))&&(a&&(a+=" "),a+=e);return a}function Wt(...n){return y9(n)}const jm=200,b2=(n,e)=>({runId:e,sessionId:n,status:"RUNNING",completedPhases:0,totalPhases:0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,updatedAt:Date.now()}),er=()=>Date.now(),Sr=(n,e)=>{const t=String(n||"").toLowerCase();return e||t==="done"||t==="success"||t==="completed"||t==="complete"?"completed":t==="running"||t==="in_progress"||t==="started"?"running":t==="failed"||t==="error"?"failed":t==="skipped"||t==="cancelled"||t==="canceled"?"skipped":"pending"},x2=n=>n.id||`${n.type||"event"}-${n.timestamp||er()}-${Math.random().toString(36).slice(2,8)}`;function Pm(n){if(!Array.isArray(n)||n.length===0)return{totalPhases:0,completedNodes:0};const e=n.length,t=n.filter(a=>a.status==="completed"||a.status==="skipped"||a.status==="failed").length;return{totalPhases:e,completedNodes:t}}const wt=mn()(oi((n,e)=>({bySession:{},byRun:{},agentsBySession:{},tasksBySession:{},eventsBySession:{},plansBySession:{},upsert:(t,a)=>n(s=>{const o=a.runId,l=s.byRun[o]||s.bySession[t]||b2(t,o),u={...l.agentNodes||{}};a.agentNode&&(u[a.agentNode.nodeId]=a.agentNode);const{agentNode:d,...h}=a,m={...l,...h,agentNodes:u,sessionId:t,runId:o,updatedAt:er()},p={...s.agentsBySession[t]||{}};d&&(p[d.nodeId]={...p[d.nodeId]||{},id:d.nodeId,sessionId:t,name:d.role,role:d.role,source:"workflow",runId:o,phase:d.phase,status:d.status,tokens:d.tokens,error:d.error,updatedAt:d.updatedAt||er()});const b=a.lastEventType||a.status||"workflow_update",w=[{id:x2({type:b}),sessionId:t,type:b,source:"workflow",timestamp:er(),status:m.status,runId:o,agentId:d==null?void 0:d.nodeId,message:m.error,data:h},...s.eventsBySession[t]||[]].slice(0,jm);return{bySession:{...s.bySession,[t]:m},byRun:{...s.byRun,[o]:m},agentsBySession:{...s.agentsBySession,[t]:p},eventsBySession:{...s.eventsBySession,[t]:w}}}),fail:(t,a,s)=>e().upsert(t,{runId:a,status:"ERROR",error:s,lastEventType:"workflow_error"}),getForSession:t=>e().bySession[t],setPlan:(t,a)=>n(s=>({plansBySession:{...s.plansBySession,[t]:a}})),clearPlan:t=>n(a=>{if(!a.plansBySession[t])return{};const s={...a.plansBySession};return delete s[t],{plansBySession:s}}),getPlanForSession:t=>e().plansBySession[t],setNodes:(t,a,s)=>n(o=>{const l=o.byRun[a],u=l||o.bySession[t]||b2(t,a),d=s.map(b=>{var x;return((x=u.nodes)==null?void 0:x.find(w=>w.id===b.id))||b}),{totalPhases:h,completedNodes:m}=Pm(d),p={...u,runId:a,sessionId:t,nodes:d,totalPhases:h||u.totalPhases,completedPhases:l?m||u.completedPhases:m,updatedAt:er()};return{bySession:{...o.bySession,[t]:p},byRun:{...o.byRun,[a]:p}}}),setNodeStatus:(t,a,s,o)=>n(l=>{const u=l.byRun[a],d=u||l.bySession[t];if(!d)return{};const h=(d.nodes||[]).map(x=>x.id===s?{...x,...o}:x),{totalPhases:m,completedNodes:p}=Pm(h),b={...d,nodes:h,totalPhases:m||d.totalPhases,completedPhases:u?p||d.completedPhases:p,updatedAt:er()};return{bySession:{...l.bySession,[t]:b},byRun:{...l.byRun,[a]:b}}}),finalizeNodes:(t,a,s)=>n(o=>{const l=o.byRun[a]||o.bySession[t];if(!l||!Array.isArray(l.nodes))return{};const u=l.nodes.map(p=>p.status==="pending"||p.status==="ready"||p.status==="blocked"?{...p,status:"skipped"}:p),{totalPhases:d,completedNodes:h}=Pm(u),m={...l,nodes:u,completedPhases:h||l.completedPhases,totalPhases:d||l.totalPhases,updatedAt:er()};return{bySession:{...o.bySession,[t]:m},byRun:{...o.byRun,[a]:m}}}),upsertAgent:(t,a)=>n(s=>{var u;const o=(u=s.agentsBySession[t])==null?void 0:u[a.id],l={id:a.id,sessionId:t,name:a.name||a.role||(o==null?void 0:o.name)||a.id,role:a.role||(o==null?void 0:o.role)||a.name||a.id,source:a.source||(o==null?void 0:o.source)||"agent",status:a.status||(o==null?void 0:o.status)||"idle",runId:a.runId??(o==null?void 0:o.runId),phase:a.phase??(o==null?void 0:o.phase),taskId:a.taskId??(o==null?void 0:o.taskId),currentTask:a.currentTask??(o==null?void 0:o.currentTask),tokens:a.tokens??(o==null?void 0:o.tokens),error:a.error??(o==null?void 0:o.error),updatedAt:a.updatedAt||er()};return{agentsBySession:{...s.agentsBySession,[t]:{...s.agentsBySession[t]||{},[a.id]:l}}}}),upsertTask:(t,a)=>n(s=>{var h;const o=(h=s.tasksBySession[t])==null?void 0:h[a.id],l=er(),u=a.status||(o==null?void 0:o.status)||"pending",d={id:a.id,sessionId:t,title:a.title||(o==null?void 0:o.title)||a.description||a.id,status:u,source:a.source||(o==null?void 0:o.source)||"task",description:a.description??(o==null?void 0:o.description),agentType:a.agentType??(o==null?void 0:o.agentType),progress:a.progress??(o==null?void 0:o.progress),result:a.result??(o==null?void 0:o.result),error:a.error??(o==null?void 0:o.error),runId:a.runId??(o==null?void 0:o.runId),dependencies:a.dependencies??(o==null?void 0:o.dependencies),startedAt:a.startedAt??(o==null?void 0:o.startedAt)??(u==="running"?l:void 0),completedAt:a.completedAt??(o==null?void 0:o.completedAt)??(u==="completed"||u==="failed"?l:void 0),createdAt:a.createdAt||(o==null?void 0:o.createdAt)||l,updatedAt:a.updatedAt||l,raw:a.raw??(o==null?void 0:o.raw)};return{tasksBySession:{...s.tasksBySession,[t]:{...s.tasksBySession[t]||{},[a.id]:d}}}}),setTasks:(t,a,s="plan")=>n(o=>{const l=o.tasksBySession[t]||{},u=Object.fromEntries(Object.entries(l).filter(([,m])=>m.source!==s)),d=er(),h=Object.fromEntries(a.map((m,p)=>{const b=l[m.id],x=m.status||(b==null?void 0:b.status)||"pending",w={id:m.id,sessionId:t,title:m.title||(b==null?void 0:b.title)||m.description||`Task ${p+1}`,status:x,source:m.source||s,description:m.description??(b==null?void 0:b.description),agentType:m.agentType??(b==null?void 0:b.agentType),progress:m.progress??(b==null?void 0:b.progress),result:m.result??(b==null?void 0:b.result),error:m.error??(b==null?void 0:b.error),runId:m.runId??(b==null?void 0:b.runId),dependencies:m.dependencies??(b==null?void 0:b.dependencies),startedAt:m.startedAt??(b==null?void 0:b.startedAt),completedAt:m.completedAt??(b==null?void 0:b.completedAt),createdAt:m.createdAt||(b==null?void 0:b.createdAt)||d+p,updatedAt:m.updatedAt||d,raw:m.raw??(b==null?void 0:b.raw)};return[w.id,w]}));return{tasksBySession:{...o.tasksBySession,[t]:{...u,...h}}}}),recordEvent:(t,a)=>n(s=>{const o={id:x2(a),sessionId:t,type:a.type,source:a.source||"system",timestamp:a.timestamp||er(),title:a.title,message:a.message,status:a.status,runId:a.runId,agentId:a.agentId,taskId:a.taskId,data:a.data};return{eventsBySession:{...s.eventsBySession,[t]:[o,...s.eventsBySession[t]||[]].slice(0,jm)}}}),getAgentsForSession:t=>Object.values(e().agentsBySession[t]||{}).sort((a,s)=>s.updatedAt-a.updatedAt),getTasksForSession:t=>Object.values(e().tasksBySession[t]||{}).sort((a,s)=>{const o={running:0,pending:1,failed:2,completed:3,skipped:4};return o[a.status]-o[s.status]||a.createdAt-s.createdAt}),getEventsForSession:t=>e().eventsBySession[t]||[],getAgentTree:t=>{const a=Object.values(e().agentsBySession[t]||{}),s=new Map(a.map(d=>[d.id,d])),o=a.filter(d=>!d.parentId||!s.has(d.parentId)),l=d=>a.filter(h=>h.parentId===d),u=d=>({agent:d,children:l(d.id).map(u),isRunning:d.status==="running",tokensUsed:d.tokens||0});return o.map(u)},getRunningAgentCount:t=>Object.values(e().agentsBySession[t]||{}).filter(s=>s.status==="running").length}),{name:"deepseekcode-workflow-store",storage:Jg({key:"workflowStore",trims:[n=>({...n,state:{...n.state,eventsBySession:Object.fromEntries(Object.entries(n.state.eventsBySession).map(([e,t])=>[e,t.slice(-50)])),tasksBySession:Object.fromEntries(Object.entries(n.state.tasksBySession).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([a,s])=>[a,{...s,result:s.result?String(s.result).slice(0,1e3):void 0,error:s.error?String(s.error).slice(0,1e3):void 0}]))]))}}),n=>({...n,state:{...n.state,eventsBySession:{}}}),n=>({...n,state:{...n.state,tasksBySession:{},agentsBySession:{}}})],onFailure:()=>{try{is.getState().addToast("warning","任务看板数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失。",8e3)}catch{}}}),partialize:n=>({bySession:n.bySession,byRun:n.byRun,agentsBySession:n.agentsBySession,plansBySession:n.plansBySession,tasksBySession:Object.fromEntries(Object.entries(n.tasksBySession).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([a,s])=>{const{raw:o,...l}=s;return[a,l]}))])),eventsBySession:Object.fromEntries(Object.entries(n.eventsBySession).map(([e,t])=>[e,t.slice(-jm).map(a=>{const{data:s,...o}=a;return o})]))})}));function v9(n,e){const t=String(n);let a=t.indexOf(e),s=a,o=0,l=0;for(;a!==-1;)a===s?++o>l&&(l=o):o=1,s=a+e.length,a=t.indexOf(e,s);return l}function b9(){return{enter:{mathFlow:n,mathFlowFenceMeta:e,mathText:o},exit:{mathFlow:s,mathFlowFence:a,mathFlowFenceMeta:t,mathFlowValue:u,mathText:l,mathTextData:u}};function n(d){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},d)}function e(){this.buffer()}function t(){const d=this.resume(),h=this.stack[this.stack.length-1];uc(h.type==="math"),h.meta=d}function a(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];uc(m.type==="math"),this.exit(d),m.value=h;const p=m.data.hChildren[0];uc(p.type==="element"),uc(p.tagName==="code"),p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function o(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];uc(m.type==="inlineMath"),this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function u(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function x9(n){let e=(n||{}).singleDollarTextMath;return e==null&&(e=!0),a.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
27
+ ${e.slice(0,200)}`:e.slice(0,200)||null}return e&&e.length>0?e.length>200?`${e.slice(0,200)}...`:e:null}function g2(n){const t=(String(n||"").trim().replace(/^v/i,"").split(/[-+]/)[0]??"").split(".").map(a=>parseInt(a,10));for(;t.length<3;)t.push(0);return t.map(a=>Number.isFinite(a)?a:0)}function s9(n,e){const t=g2(n),a=g2(e);for(let s=0;s<3;s+=1){const o=t[s]??0,l=a[s]??0;if(o!==l)return o-l}return 0}const v0=[{version:"1.0.29",title:{zh:"更新内容提示",en:"What's New notice"},items:[{zh:"CLI 与 Web 新增「更新内容」提示:每次版本升级后首次启动/打开时展示本次更新内容,之后不再打扰",en:`CLI and Web now show a "What's New" notice on first launch after a version upgrade — once per version, never again`},{zh:"CLI 新增 /whatsnew 命令,可随时查看历史更新内容",en:"New /whatsnew command in the CLI to view the changelog anytime"},{zh:"Web 设置页「关于」区域新增「查看更新内容」入口",en:`Web settings "About" section gains a "What's New" entry point`}]}];function i9(n,e){const t=a=>{if(a)return e==="zh"?a.zh:a.en};return{version:n.version,date:n.date,title:t(n.title),items:n.items.map(a=>e==="zh"?a.zh:a.en)}}function o9(n){return n?v0.filter(e=>s9(e.version,n)>0):v0}function l9(){const n=v0[0];return n?n.version:null}const YP=["openai-chat-completions","openai-completions","openai-responses","anthropic-messages","codex-responses","claude-code"];Z_.map(n=>n.eventType);function c9(){return`err-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}const Ko=mn(n=>({errors:[],push:(e,t,a,s,o)=>{let l="";return n(u=>{const d=u.errors.find(p=>!p.dismissed&&!p.action&&p.level===e&&p.title===t);if(d)return l=d.id,{errors:u.errors.map(p=>p.id===d.id?{...p,count:p.count+1,timestamp:Date.now()}:p)};const h=c9();l=h;const m={id:h,level:e,title:t,detail:a,action:s,timestamp:Date.now(),dismissed:!1,durationMs:o,count:1};return{errors:[...u.errors.slice(-49),m]}}),l},dismiss:e=>n(t=>({errors:t.errors.map(a=>a.id===e?{...a,dismissed:!0}:a)})),clearAll:()=>n({errors:[]})})),vr={info:(n,e,t)=>Ko.getState().push("info",n,e,void 0,t),warn:(n,e,t)=>Ko.getState().push("warning",n,e,void 0,t),error:(n,e,t)=>Ko.getState().push("error",n,e,void 0,t),critical:(n,e,t)=>Ko.getState().push("critical",n,e,void 0,t)},gc=20,n1=()=>{const n=window.location.protocol==="https:"?"wss:":"ws:",e=window.location.hostname,t=window.location.port,a=t?String(Number(t)+1):"",s=a?`${e}:${a}`:e;return`${n}//${s}/ws`},u9=n1(),y2="dscode_client_id";function d9(){try{const n=localStorage.getItem(y2);if(n)return n;const e=`web-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,10)}`;return localStorage.setItem(y2,e),e}catch{return`web-${Math.random().toString(36).slice(2,10)}`}}class f9{constructor(e){V(this,"ws",null);V(this,"url");V(this,"clientId",d9());V(this,"messageHandlers",new Set);V(this,"openHandlers",new Set);V(this,"closeHandlers",new Set);V(this,"errorHandlers",new Set);V(this,"reconnectAttempts",0);V(this,"reconnectHandlers",new Set);V(this,"reconnectSuccessHandlers",new Set);V(this,"reconnectGiveUpHandlers",new Set);V(this,"isManualClose",!1);V(this,"authenticated",!1);V(this,"sessionId",null);V(this,"heartbeatInterval",null);V(this,"reconnectTimer",null);V(this,"lastPongTime",0);V(this,"HEARTBEAT_INTERVAL",15e3);V(this,"HEARTBEAT_TIMEOUT",45e3);this.url=e||u9}setSessionId(e){this.sessionId=e}getSessionId(){return this.sessionId}getReconnectState(){var e;return{attempts:this.reconnectAttempts,maxAttempts:gc,reconnecting:this.reconnectAttempts>0&&((e=this.ws)==null?void 0:e.readyState)!==WebSocket.OPEN}}onReconnectAttempt(e){return this.reconnectHandlers.add(e),()=>this.reconnectHandlers.delete(e)}onReconnectSuccess(e){return this.reconnectSuccessHandlers.add(e),()=>this.reconnectSuccessHandlers.delete(e)}onReconnectGiveUp(e){return this.reconnectGiveUpHandlers.add(e),()=>this.reconnectGiveUpHandlers.delete(e)}connect(){var a,s;if(((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN||((s=this.ws)==null?void 0:s.readyState)===WebSocket.CONNECTING)return;this.isManualClose=!1;const e=new URLSearchParams;this.sessionId&&e.set("sessionId",this.sessionId),e.set("clientId",this.clientId);const t=e.toString()?`${this.url}?${e.toString()}`:this.url;this.ws=new WebSocket(t),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{var l;console.log("WebSocket connected");const o=this.reconnectAttempts>0;this.reconnectAttempts=0,this.lastPongTime=Date.now(),o&&this.reconnectSuccessHandlers.forEach(u=>u()),((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"ping"})),this.startHeartbeat(),this.openHandlers.forEach(u=>u())},this.ws.onclose=()=>{console.log("WebSocket closed"),this.stopHeartbeat(),this.closeHandlers.forEach(o=>o()),this.isManualClose||this.scheduleReconnect()},this.ws.onerror=o=>{vr.error("WebSocket connection error",o.message||"Connection failed"),this.errorHandlers.forEach(l=>l())},this.ws.onmessage=o=>{this._onMessage(o)}}async _onMessage(e){var t,a;try{let s;if(e.data instanceof Blob?s=await e.data.text():e.data instanceof ArrayBuffer?s=new TextDecoder().decode(e.data):typeof e.data=="string"?s=e.data:s=String(e.data),s=s.trim(),!s)return;const o=JSON.parse(s);if(console.log("[WS←]",o.type,o.sessionId,JSON.stringify(o.data||o.message||"").slice(0,200)),(o.type==="pong"||o.type==="ping")&&(this.lastPongTime=Date.now(),o.type==="pong"))return;o.seq!==void 0&&o.seq>=0&&this.send({type:"message_ack",data:JSON.stringify({seq:o.seq})}),this.messageHandlers.forEach(l=>l(o))}catch(s){const o=((a=(t=e.data)==null?void 0:t.constructor)==null?void 0:a.name)||typeof e.data;let l;if(e.data instanceof Blob?l=`[Blob ${e.data.size} bytes]`:e.data instanceof ArrayBuffer?l=`[ArrayBuffer ${e.data.byteLength} bytes]`:l=String(e.data).slice(0,500),typeof e.data=="string"&&e.data.trim()){const u=e.data.trim();try{this.messageHandlers.forEach(d=>d({type:"log",data:JSON.stringify({level:"info",message:u})}));return}catch{}}vr.error("Failed to parse WebSocket message",`type=${o} data=${l} error=${s}`)}}startHeartbeat(){this.stopHeartbeat(),this.lastPongTime=Date.now(),this.heartbeatInterval=setInterval(()=>{var e,t;if(Date.now()-this.lastPongTime>this.HEARTBEAT_TIMEOUT){console.warn("[WS] Heartbeat timeout, reconnecting..."),this.stopHeartbeat(),this.isManualClose=!0,(e=this.ws)==null||e.close(),this.ws=null,this.scheduleReconnect();return}((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN&&this.send({type:"ping"})},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}scheduleReconnect(){if(this.reconnectAttempts++,this.reconnectAttempts>gc){console.error(`[WS] Max reconnect attempts (${gc}) reached — giving up.`),vr.error("WebSocket",`Connection lost — max reconnect attempts (${gc}) reached. Refresh the page to try again.`),this.reconnectGiveUpHandlers.forEach(s=>s());return}const e=Math.min(3e3*Math.pow(2,this.reconnectAttempts),3e4),t=Math.random()*1e3-500,a=Math.max(100,Math.round(e+t));console.log(`[WS] Reconnecting... Attempt ${this.reconnectAttempts}, delay=${a}ms`),this.reconnectHandlers.forEach(s=>s(this.reconnectAttempts,gc)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},a)}disconnect(){var e;this.isManualClose=!0,this.reconnectAttempts=0,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(e=this.ws)==null||e.close(),this.ws=null}send(e){var t,a;if(((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN){const s=JSON.stringify(e);console.log("[WS→]",e.type,e.sessionId,s.slice(0,200)),this.ws.send(s)}else console.warn("[WS] NOT CONNECTED — dropping:",e.type,e.sessionId,"readyState=",(a=this.ws)==null?void 0:a.readyState)}onMessage(e){return this.messageHandlers.add(e),()=>this.messageHandlers.delete(e)}onOpen(e){return this.openHandlers.add(e),()=>this.openHandlers.delete(e)}onClose(e){return this.closeHandlers.add(e),()=>this.closeHandlers.delete(e)}onError(e){return this.errorHandlers.add(e),()=>this.errorHandlers.delete(e)}get isConnected(){var e;return((e=this.ws)==null?void 0:e.readyState)===WebSocket.OPEN}setToken(e){try{sessionStorage.setItem("auth_token",e)}catch{}}get isAuthenticated(){return this.authenticated}setAuthenticated(e){this.authenticated=e}}const Oe=new f9;function v2(n,e){return`ext:${n}:${e.toLowerCase()}`}const ns=mn()(oi((n,e)=>({pendingApprovals:[],autoMode:!0,sessionAllowList:[],showConfigHint:!0,addApproval:t=>n(a=>({pendingApprovals:[...a.pendingApprovals,t]})),removeApproval:t=>n(a=>({pendingApprovals:a.pendingApprovals.filter(s=>s.approvalId!==t)})),clearApprovals:()=>n({pendingApprovals:[]}),setAutoMode:t=>n({autoMode:t}),addToSessionAllowList:(t,a)=>n(s=>{const o=a?v2(t,a):t;return s.sessionAllowList.includes(o)?s:{sessionAllowList:[...s.sessionAllowList,o]}}),isSessionAllowed:(t,a)=>{const s=e().sessionAllowList;return a?s.includes(v2(t,a)):s.includes(t)},setShowConfigHint:t=>n({showConfigHint:t})}),{name:"deepseekcode-hook-approval",partialize:n=>({autoMode:n.autoMode,showConfigHint:n.showConfigHint})}));function h9(n){if(!n)return 0;const e=(n.match(/[\u4e00-\u9fff]/g)||[]).length,t=n.length-e;return Math.ceil(e*1.5+t*.25)}const rt=mn((n,e)=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},maxContextTokens:1e6,degradation:null,compactingUntil:0,lastCompactInfo:null,compactionProgress:null,cacheStats:null,showTokenInfo:!1,model:"",modelRef:"",modelSource:"",history:[],_hasBackendData:!1,tokenRate:0,sessionBaseTotal:0,workflowTokens:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,retryState:null,contextBreakdown:null,setContextDistribution:t=>n({contextDistribution:t}),setContextBreakdown:t=>n({contextBreakdown:t}),setThresholdWarning:t=>n({thresholdWarning:t}),setRetryState:t=>n({retryState:t}),updateUsage:t=>n(a=>{const s=t.totalTokens??a.currentUsage.totalTokens,o=Date.now(),l=a._lastTotal,u=a._lastTotalTs;let d=a.tokenRate;if(u>0&&l>0&&o>u&&s>l){const h=s-l,m=(o-u)/1e3,p=h/m;d=d>0?d*.6+p*.4:p}return{currentUsage:{...a.currentUsage,...t},_hasBackendData:!0,tokenRate:d,_lastTotal:s,_lastTotalTs:o}}),setModel:t=>n({model:t}),setModelRef:t=>n({modelRef:t}),setModelSource:t=>n({modelSource:t}),addWorkflowTokens:t=>n(a=>({workflowTokens:a.workflowTokens+(Number(t)||0)})),setMaxContextTokens:t=>n({maxContextTokens:t}),setDegradation:t=>n({degradation:t}),setCompacting:t=>n({compactingUntil:Date.now()+3e3,lastCompactInfo:t}),setCompactionProgress:t=>n({compactionProgress:t}),setCacheStats:t=>n({cacheStats:t}),accumulateCacheStats:(t,a)=>n(s=>{const o=s.cacheStats,l=((o==null?void 0:o.cacheHitTokens)??0)+t,u=((o==null?void 0:o.cacheMissTokens)??0)+a;return{cacheStats:{cacheHitTokens:l,cacheMissTokens:u,cacheHitRate:l+u>0?l/(l+u):void 0,cacheStatsCalls:((o==null?void 0:o.cacheStatsCalls)??0)+1}}}),setShowTokenInfo:t=>n({showTokenInfo:t}),addToHistory:t=>n(a=>({history:[...a.history.slice(-100),{timestamp:Date.now(),usage:t}]})),estimateTokens:t=>h9(t),recalculateFromMessages:t=>{if(!t||t.length===0){n({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1});return}if(e()._hasBackendData)return;const a=e().estimateTokens;let s=0,o=0;for(const d of t){let h=d.content||"";if(d.thinking&&(h+=" "+d.thinking),d.steps)for(const p of d.steps)p.thought&&(h+=" "+p.thought),p.action&&(h+=" "+p.action),p.result&&(h+=" "+p.result);if(d.toolCalls)for(const p of d.toolCalls)p.args&&(h+=" "+(typeof p.args=="string"?p.args:JSON.stringify(p.args)));const m=a(h);d.type==="user"?s+=m:o+=m}const l=s+o,u=s/1e6*.15+o/1e6*.6;n({currentUsage:{promptTokens:s,completionTokens:o,totalTokens:l,estimatedCost:u}})},resetUsage:()=>n(t=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1,sessionBaseTotal:t.currentUsage.totalTokens,workflowTokens:0,tokenRate:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,contextBreakdown:null}))})),yx="";function Qd(n){return`${yx}${n}`}class m9{constructor(e){V(this,"baseUrl");this.baseUrl=e}async request(e,t={}){try{const a=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token"),s={"Content-Type":"application/json",...t.headers};a&&(s.Authorization=`Bearer ${a}`);const o=await fetch(`${this.baseUrl}${e}`,{headers:s,...t}),l=await o.json();return o.ok?l&&typeof l.success=="boolean"?{success:l.success,data:l.data,error:l.error}:{success:!0,data:l}:{success:!1,error:l.error||`HTTP ${o.status}`,data:l.data}}catch(a){return{success:!1,error:a instanceof Error?a.message:"Network error"}}}get(e){return this.request(e,{method:"GET"})}post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}delete(e,t){return this.request(e,{method:"DELETE",body:t?JSON.stringify(t):void 0})}patch(e,t){return this.request(e,{method:"PATCH",body:t?JSON.stringify(t):void 0})}}const Z=new m9(yx),ht={providers:{presets:()=>Z.get("/api/providers/presets"),refresh:()=>Z.post("/api/providers/refresh"),testConnection:(n,e)=>Z.post("/api/providers/test-connection",{baseUrl:n,apiKey:e})},models:{list:async()=>{var e;const n=await Z.get("/api/models");return n.success&&((e=n.data)!=null&&e.models)&&(n.data.models=n.data.models.map(t=>({...t,isGlobalDefault:t.isDefault===!0}))),n},get:n=>Z.get(`/api/models/${n}`),create:n=>Z.post("/api/models",n),update:(n,e,t)=>Z.post("/api/models/update",{provider:n,modelId:e,...t}),delete:(n,e)=>Z.post("/api/models/delete",{provider:n,modelId:e}),test:n=>Z.post(`/api/models/${n}/test`),fetch:(n,e,t)=>Z.post("/api/models/fetch",{baseUrl:n,apiKey:e,fullPath:t}),byProvider:(n,e)=>{const t=new URLSearchParams({provider:n});return e&&t.set("q",e),Z.get(`/api/models/by-provider?${t.toString()}`)},catalogSearch:n=>{const e=new URLSearchParams;n.q&&e.set("q",n.q),n.toolCall&&e.set("toolCall","1"),n.reasoning&&e.set("reasoning","1"),n.minContext&&e.set("minContext",String(n.minContext)),n.limit&&e.set("limit",String(n.limit));const t=e.toString();return Z.get(`/api/models/catalog${t?`?${t}`:""}`)},toggle:(n,e)=>Z.post("/api/models/toggle",{provider:n,modelId:e}),setDefaults:n=>Z.post("/api/models/defaults",n),getSessionModel:n=>Z.get(`/api/sessions/${encodeURIComponent(n)}/model`),setSessionModel:(n,e,t)=>Z.put(`/api/sessions/${encodeURIComponent(n)}/model`,{provider:e,model:t}),clearSessionModel:n=>Z.delete(`/api/sessions/${encodeURIComponent(n)}/model`)},tools:{list:()=>Z.get("/api/tools"),get:n=>Z.get(`/api/tools/${n}`),update:(n,e)=>Z.put(`/api/tools/${n}`,e),toggle:(n,e)=>Z.post(`/api/tools/${n}/toggle`,{enabled:e})},connectors:{list:()=>Z.get("/api/connectors"),get:n=>Z.get(`/api/connectors/${encodeURIComponent(n)}`),toggle:(n,e,t)=>Z.post(`/api/connectors/${encodeURIComponent(n)}/toggle`,{enabled:e,env:t}),connect:(n,e)=>Z.post(`/api/connectors/${encodeURIComponent(n)}/connect`,{env:e}),addCustom:n=>Z.post("/api/connectors/custom",n),removeCustom:n=>Z.delete(`/api/connectors/custom/${encodeURIComponent(n)}`)},skills:{list:()=>Z.get("/api/skills"),get:n=>Z.get(`/api/skills/${n}`),create:n=>Z.post("/api/skills",n),update:(n,e)=>Z.put(`/api/skills/${n}`,e),toggle:(n,e)=>Z.post(`/api/skills/${n}/toggle`,{enabled:e}),delete:n=>Z.delete(`/api/skills/${n}`),import:n=>Z.post("/api/skills/import",n),marketplaces:{list:()=>Z.get("/api/skills/marketplaces"),add:n=>Z.post("/api/skills/marketplaces",n),remove:n=>Z.delete(`/api/skills/marketplaces/${n}`),get:n=>Z.get(`/api/skills/marketplaces/${n}`),refresh:n=>Z.post(`/api/skills/marketplaces/${n}/refresh`,{}),install:(n,e)=>Z.post(`/api/skills/marketplaces/${n}/install`,{skillId:e})},workshop:{list:n=>Z.get(`/api/skills/workshop${n?`?status=${n}`:""}`),propose:n=>Z.post("/api/skills/workshop",n),apply:n=>Z.post(`/api/skills/workshop/${n}/apply`,{}),reject:n=>Z.post(`/api/skills/workshop/${n}/reject`,{})},config:{get:n=>Z.get(`/api/skills/${n}/config`),update:(n,e)=>Z.put(`/api/skills/${n}/config`,e)}},files:{list:n=>Z.get(`/api/files${n?`?path=${encodeURIComponent(n)}`:""}`),read:n=>Z.get(`/api/files/read?path=${encodeURIComponent(n)}`),create:(n,e)=>Z.post("/api/files",{path:n,content:e}),update:(n,e)=>Z.put("/api/files/write",{path:n,content:e}),delete:n=>Z.delete(`/api/files?path=${encodeURIComponent(n)}`),download:async n=>{try{const e={},t=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token");t&&(e.Authorization=`Bearer ${t}`);const a=await fetch(Qd(`/api/files/download?path=${encodeURIComponent(n)}`),{headers:e});if(!a.ok){let u=`HTTP ${a.status}`;try{const d=await a.json();d!=null&&d.error&&(u=d.error)}catch{}return{success:!1,error:u}}const s=await a.blob(),o=URL.createObjectURL(s),l=document.createElement("a");return l.href=o,l.download=n.split(/[\\/]/).pop()||"download",l.click(),URL.revokeObjectURL(o),{success:!0}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Download failed"}}},upload:async(n,e)=>{try{const t=await p9(n);return Z.post("/api/files/upload",{path:e,content:t,base64:!0})}catch(t){return{success:!1,error:t instanceof Error?t.message:"Upload failed"}}}},dirs:{list:n=>Z.get(`/api/dirs${n?`?path=${encodeURIComponent(n)}`:""}`)},sessions:{list:()=>Z.get("/api/sessions"),get:n=>Z.get(`/api/sessions/${n}`),create:n=>Z.post("/api/sessions",{title:n}),delete:n=>Z.delete(`/api/sessions/${n}`),resume:n=>Z.get(`/api/sessions/${encodeURIComponent(n)}/resume`)},trajectory:{events:async(n,e=0,t=500)=>{var l,u;const a=encodeURIComponent(n),s=await Z.get(`/api/plugins/http/trajectory/api/events?sessionId=${a}&cursor=${e}&limit=${t}`);if(s.success&&Array.isArray((l=s.data)==null?void 0:l.events))return{success:!0,data:{events:s.data.events,hasMore:!!s.data.hasMore||s.data.events.length===t}};const o=await Z.get(`/api/plugins/http/trajectory/api/trajectory?sid=${a}&off=${e}&lim=${t}`);if(o.success&&Array.isArray((u=o.data)==null?void 0:u.events)){const d=o.data.events,h=o.data.nextOffset??e+d.length,m=o.data.total??h;return{success:!0,data:{events:d,hasMore:h<m&&d.length>0}}}return{success:!1,error:s.error||o.error||"轨迹插件不可用"}}},tasks:{list:n=>Z.get(n?`/api/tasks?sessionId=${encodeURIComponent(n)}`:"/api/tasks"),get:n=>Z.get(`/api/tasks/${n}`),create:n=>Z.post("/api/tasks",n),update:(n,e)=>Z.put(`/api/tasks/${n}`,e),updateStatus:(n,e)=>Z.patch(`/api/tasks/${n}/status`,{status:e}),delete:n=>Z.delete(`/api/tasks/${n}`),clearCompleted:()=>Z.delete("/api/tasks")},config:{provider:{get:()=>Z.get("/api/config/provider"),save:n=>Z.post("/api/config/provider",n),delete:n=>Z.post("/api/config/provider/remove",{provider:n}),setDefault:n=>Z.post("/api/config/provider",{provider:n,setDefault:!0})},files:{list:()=>Z.get("/api/config/files"),read:n=>Z.get(`/api/config/files/read?file=${encodeURIComponent(n)}`),write:(n,e)=>Z.put("/api/config/files/write",{file:n,content:e})},context:{get:()=>Z.get("/api/config/context"),save:n=>Z.post("/api/config/context",n)}},git:{status:()=>Z.get("/api/git/status"),branches:()=>Z.get("/api/git/branches"),commit:n=>Z.post("/api/git/commit",n),push:()=>Z.post("/api/git/push"),checkout:n=>Z.post("/api/git/checkout",{branch:n}),prStatus:()=>Z.get("/api/repos/pr")},fileJob:{parse:n=>Z.post("/api/filejob/parse",{files:n}),parsePaths:n=>Z.post("/api/filejob/parse",{paths:n}),importPaths:n=>Z.post("/api/filejob/import",{paths:n}),render:n=>Z.post("/api/filejob/render",n)},system:{status:()=>Z.get("/api/system/status"),restart:()=>Z.post("/api/system/restart"),shutdown:()=>Z.post("/api/system/shutdown")},observability:{summary:()=>Z.get("/api/observability/summary"),costs:()=>Z.get("/api/observability/costs"),listRuns:()=>Z.get("/api/observability/runs"),getRun:n=>Z.get(`/api/observability/runs/${encodeURIComponent(n)}`),getRunEvents:(n,e=0,t=50)=>Z.get(`/api/observability/runs/${encodeURIComponent(n)}/events?page=${e}&size=${t}`)},templates:{list:()=>Z.get("/api/templates"),get:n=>Z.get(`/api/templates/${encodeURIComponent(n)}`),create:n=>Z.post("/api/templates",n),update:(n,e)=>Z.put(`/api/templates/${encodeURIComponent(n)}`,e),remove:n=>Z.delete(`/api/templates/${encodeURIComponent(n)}`),versions:n=>Z.get(`/api/templates/${encodeURIComponent(n)}/versions`),getVersion:(n,e)=>Z.get(`/api/templates/${encodeURIComponent(n)}/versions/${e}`),render:(n,e)=>Z.post(`/api/templates/${encodeURIComponent(n)}/render`,{inputs:e}),createFromRun:(n,e)=>Z.post("/api/templates",{sourceRunId:n,generalize:(e==null?void 0:e.generalize)===!0,name:e==null?void 0:e.name,message:e==null?void 0:e.message})},workflows:{list:()=>Z.get("/api/workflows"),start:n=>Z.post("/api/workflows",n),get:n=>Z.get(`/api/workflows/${encodeURIComponent(n)}`),synthesize:n=>Z.post("/api/workflows/synthesize",{message:n})},plans:{list:()=>Z.get("/api/plans"),read:n=>Z.get(`/api/plans/${encodeURIComponent(n)}`),delete:n=>Z.delete(`/api/plans/${encodeURIComponent(n)}`)},logs:{list:()=>Z.get("/api/logs"),read:(n,e)=>Z.get(`/api/logs/read?file=${encodeURIComponent(n)}${e?`&maxLines=${e}`:""}`),downloadUrl:n=>`/api/logs/download?file=${encodeURIComponent(n)}`},stt:{status:()=>Z.get("/api/stt/status"),transcribe:(n,e,t="wav")=>Z.post("/api/stt/transcribe",{language:n,audio:e,format:t}),install:n=>Z.post("/api/stt/install",{backend:n}),installStatus:()=>Z.get("/api/stt/install/status"),cancelInstall:()=>Z.post("/api/stt/install/cancel")},hooks:{list:()=>Z.get("/api/hooks/rules"),get:n=>Z.get(`/api/hooks/rules/${encodeURIComponent(n)}`),create:n=>Z.post("/api/hooks/rules",n),update:(n,e)=>Z.put(`/api/hooks/rules/${encodeURIComponent(n)}`,e),delete:n=>Z.delete(`/api/hooks/rules/${encodeURIComponent(n)}`),batchDelete:n=>Z.post("/api/hooks/rules/batch-delete",{names:n}),toggle:(n,e)=>Z.patch(`/api/hooks/rules/${encodeURIComponent(n)}/toggle`,{enabled:e}),batchToggle:(n,e)=>Z.post("/api/hooks/rules/batch-toggle",{names:n,enabled:e}),dryRun:n=>Z.post("/api/hooks/dry-run",n),stats:()=>Z.get("/api/hooks/stats"),events:()=>Z.get("/api/hooks/events"),agents:()=>Z.get("/api/hooks/agents"),export:()=>Z.get("/api/hooks/export"),import:n=>Z.post("/api/hooks/import",n)},channels:{list:()=>Z.get("/api/channels"),types:()=>Z.get("/api/channels/types"),create:n=>Z.post("/api/channels",n),update:(n,e)=>Z.put(`/api/channels/${encodeURIComponent(n)}`,e),delete:n=>Z.delete(`/api/channels/${encodeURIComponent(n)}`),toggle:(n,e)=>Z.patch(`/api/channels/${encodeURIComponent(n)}/toggle`,{enabled:e}),test:n=>Z.post(`/api/channels/${encodeURIComponent(n)}/test`),wechat:{qrcode:(n,e)=>Z.get(`/api/channels/${encodeURIComponent(n)}/wechat/qrcode?token=${encodeURIComponent(e)}`),qrcodeStatus:(n,e,t)=>Z.get(`/api/channels/${encodeURIComponent(n)}/wechat/qrcode/status?token=${encodeURIComponent(e)}&qrcode=${encodeURIComponent(t)}`)},weixin:{bind:()=>Z.get("/api/weixin/bind"),bindStatus:n=>Z.get(`/api/weixin/bind/status?qrcode=${encodeURIComponent(n)}`)}},automations:{list:()=>Z.get("/api/automations"),create:n=>Z.post("/api/automations",n),update:(n,e)=>Z.put(`/api/automations/${encodeURIComponent(n)}`,e),remove:n=>Z.delete(`/api/automations/${encodeURIComponent(n)}`),toggle:(n,e)=>Z.post(`/api/automations/${encodeURIComponent(n)}/toggle`,{enabled:e}),run:n=>Z.post(`/api/automations/${encodeURIComponent(n)}/run`),runs:n=>Z.get(`/api/automations/${encodeURIComponent(n)}/runs`),addPermission:(n,e,t)=>Z.post(`/api/automations/${encodeURIComponent(n)}/permissions`,{tool:e,target:t}),revokePermission:(n,e)=>Z.delete(`/api/automations/${encodeURIComponent(n)}/permissions`,{entry:e})}};function p9(n){return new Promise((e,t)=>{const a=new FileReader;a.onload=()=>{const s=a.result,o=s.indexOf(",");e(o>=0?s.slice(o+1):s)},a.onerror=()=>t(a.error||new Error("Failed to read file")),a.readAsDataURL(n)})}const Bm=n=>n==="normal"?"act":n;let Td=0;const g9=n=>n==="normal"?"normal":n==="auto"?"auto-act":e9(typeof n=="string"?n:void 0),yc=n=>n==="normal"?"act":Wo(n)?"auto":Ia(n),Zo=mn()(oi((n,e)=>({mode:"auto-act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null,setMode:t=>{const a=e().mode;if(a===t)return;n(h=>({mode:t,modeHistory:[...h.modeHistory,{previousMode:a,newMode:t,description:`Mode changed: ${a} -> ${t}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(t!=="normal"&&Wo(t));const s=yc(a),o=yc(t),l=a==="normal"?"act":Ia(a),u=t==="normal"?"act":Ia(t);if(l===u&&s===o)return;try{const h=Ke.getState().activeSessionId||Oe.getSessionId();h&&Oe.send({type:"plan_mode_change",sessionId:h,data:JSON.stringify({previousMode:yc(a),newMode:yc(t),frontendMode:t,timestamp:Date.now()})})}catch(h){console.warn("[ExecutionModeStore] Failed to notify mode change via WS:",h)}const d=++Td;ht.models.list().then(h=>{var _;if(d!==Td||!h.success||!((_=h.data)!=null&&_.models))return;const m=h.data.models.filter(T=>T.enabled!==!1),p=Ia(Bm(t)),b=m.find(T=>T.defaultFor===p),x=m.find(T=>T.isDefault||T.defaultFor==="global"),w=b||x||m[0];w&&(rt.getState().setModel(w.id),rt.getState().setModelRef(`${w.provider}:${w.id}`))}).catch(h=>{console.warn("[ExecutionModeStore] Failed to refresh models:",h)})},applyBackendMode:t=>{const a=e().mode;if(a===t)return;n(o=>({mode:t,prePlanMode:t!=="plan"?null:o.prePlanMode,modeHistory:[...o.modeHistory,{previousMode:a,newMode:t,description:`Backend mode changed: ${a} -> ${t}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(t!=="normal"&&Wo(t));const s=++Td;ht.models.list().then(o=>{var p;if(s!==Td||!o.success||!((p=o.data)!=null&&p.models))return;const l=o.data.models.filter(b=>b.enabled!==!1),u=Ia(Bm(t)),d=l.find(b=>b.defaultFor===u),h=l.find(b=>b.isDefault||b.defaultFor==="global"),m=d||h||l[0];m&&(rt.getState().setModel(m.id),rt.getState().setModelRef(`${m.provider}:${m.id}`))}).catch(o=>{console.warn("[ExecutionModeStore] Failed to refresh models after backend mode change:",o)})},toggleMode:()=>{const t=e().mode,a=t==="normal"?"act":Q_(t);e().setMode(a)},setBaseMode:t=>{const a=e().mode,s=a!=="normal"&&Wo(a);e().setMode(Zp(t,s))},setAuto:t=>{e().setMode(Zp(Ia(Bm(e().mode)),t))},toggleAuto:()=>{const t=e().mode;e().setMode(t==="normal"?"auto-act":X_(t))},enterPlanMode:(t,a)=>{const s=e().mode,o=s!=="normal"&&Ia(s)!=="plan"?s:e().prePlanMode,l=s!=="normal"&&Ia(s)==="goal"?"goal":"plan";n(u=>({mode:l,prePlanMode:o,modeHistory:[...u.modeHistory,{previousMode:s,newMode:l,description:`Enter ${l} mode: ${a}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(!1)},exitPlanMode:(t,a)=>{const s=e().mode,o=e().prePlanMode,l=o&&(o==="normal"||Ia(o)!=="plan")?o:"act";n(u=>({mode:l,prePlanMode:null,modeHistory:[...u.modeHistory,{previousMode:s,newMode:l,description:`Exit to ${l} mode: ${a}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(l!=="normal"&&Wo(l))},enterGoalMode:(t,a)=>{const s=e().mode;n(o=>({mode:"goal",modeHistory:[...o.modeHistory,{previousMode:s,newMode:"goal",description:`Enter Goal mode: ${a}`,timestamp:Date.now()}]})),ns.getState().setAutoMode(!1);try{const o=Ke.getState().activeSessionId||Oe.getSessionId()||void 0;Oe.send({type:"plan_mode_change",sessionId:o,data:JSON.stringify({previousMode:yc(s),newMode:"goal",frontendMode:"goal",goalDescription:a,timestamp:Date.now()})})}catch(o){console.warn("[ExecutionModeStore] Failed to notify goal mode change via WS:",o)}},exitGoalMode:()=>{const t=e().mode;n(a=>({mode:"act",modeHistory:[...a.modeHistory,{previousMode:t,newMode:"act",description:"Exit Goal mode",timestamp:Date.now()}]})),ns.getState().setAutoMode(!1)},setPlanContent:t=>n({currentPlanContent:t}),setThinkingStatus:(t,a)=>n(s=>({thinkingStatusBySession:{...s.thinkingStatusBySession,[t]:a}})),getThinkingStatus:t=>e().thinkingStatusBySession[t]||"",reset:()=>n({mode:"auto-act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null})}),{name:"deepseekcode-plan-storage",version:1,migrate:n=>n,merge:(n,e)=>{const t=n??{};return{...e,...t,mode:g9(t.mode)}},partialize:n=>({mode:n.mode,currentPlanContent:n.currentPlanContent,modeHistory:n.modeHistory})}));function vx(n){var e,t,a="";if(typeof n=="string"||typeof n=="number")a+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=vx(n[e]))&&(a&&(a+=" "),a+=t)}else for(t in n)n[t]&&(a&&(a+=" "),a+=t);return a}function y9(){for(var n,e,t=0,a="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=vx(n))&&(a&&(a+=" "),a+=e);return a}function Wt(...n){return y9(n)}const jm=200,b2=(n,e)=>({runId:e,sessionId:n,status:"RUNNING",completedPhases:0,totalPhases:0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,updatedAt:Date.now()}),er=()=>Date.now(),Sr=(n,e)=>{const t=String(n||"").toLowerCase();return e||t==="done"||t==="success"||t==="completed"||t==="complete"?"completed":t==="running"||t==="in_progress"||t==="started"?"running":t==="failed"||t==="error"?"failed":t==="skipped"||t==="cancelled"||t==="canceled"?"skipped":"pending"},x2=n=>n.id||`${n.type||"event"}-${n.timestamp||er()}-${Math.random().toString(36).slice(2,8)}`;function Pm(n){if(!Array.isArray(n)||n.length===0)return{totalPhases:0,completedNodes:0};const e=n.length,t=n.filter(a=>a.status==="completed"||a.status==="skipped"||a.status==="failed").length;return{totalPhases:e,completedNodes:t}}const wt=mn()(oi((n,e)=>({bySession:{},byRun:{},agentsBySession:{},tasksBySession:{},eventsBySession:{},plansBySession:{},upsert:(t,a)=>n(s=>{const o=a.runId,l=s.byRun[o]||s.bySession[t]||b2(t,o),u={...l.agentNodes||{}};a.agentNode&&(u[a.agentNode.nodeId]=a.agentNode);const{agentNode:d,...h}=a,m={...l,...h,agentNodes:u,sessionId:t,runId:o,updatedAt:er()},p={...s.agentsBySession[t]||{}};d&&(p[d.nodeId]={...p[d.nodeId]||{},id:d.nodeId,sessionId:t,name:d.role,role:d.role,source:"workflow",runId:o,phase:d.phase,status:d.status,tokens:d.tokens,error:d.error,updatedAt:d.updatedAt||er()});const b=a.lastEventType||a.status||"workflow_update",w=[{id:x2({type:b}),sessionId:t,type:b,source:"workflow",timestamp:er(),status:m.status,runId:o,agentId:d==null?void 0:d.nodeId,message:m.error,data:h},...s.eventsBySession[t]||[]].slice(0,jm);return{bySession:{...s.bySession,[t]:m},byRun:{...s.byRun,[o]:m},agentsBySession:{...s.agentsBySession,[t]:p},eventsBySession:{...s.eventsBySession,[t]:w}}}),fail:(t,a,s)=>e().upsert(t,{runId:a,status:"ERROR",error:s,lastEventType:"workflow_error"}),getForSession:t=>e().bySession[t],setPlan:(t,a)=>n(s=>({plansBySession:{...s.plansBySession,[t]:a}})),clearPlan:t=>n(a=>{if(!a.plansBySession[t])return{};const s={...a.plansBySession};return delete s[t],{plansBySession:s}}),getPlanForSession:t=>e().plansBySession[t],setNodes:(t,a,s)=>n(o=>{const l=o.byRun[a],u=l||o.bySession[t]||b2(t,a),d=s.map(b=>{var x;return((x=u.nodes)==null?void 0:x.find(w=>w.id===b.id))||b}),{totalPhases:h,completedNodes:m}=Pm(d),p={...u,runId:a,sessionId:t,nodes:d,totalPhases:h||u.totalPhases,completedPhases:l?m||u.completedPhases:m,updatedAt:er()};return{bySession:{...o.bySession,[t]:p},byRun:{...o.byRun,[a]:p}}}),setNodeStatus:(t,a,s,o)=>n(l=>{const u=l.byRun[a],d=u||l.bySession[t];if(!d)return{};const h=(d.nodes||[]).map(x=>x.id===s?{...x,...o}:x),{totalPhases:m,completedNodes:p}=Pm(h),b={...d,nodes:h,totalPhases:m||d.totalPhases,completedPhases:u?p||d.completedPhases:p,updatedAt:er()};return{bySession:{...l.bySession,[t]:b},byRun:{...l.byRun,[a]:b}}}),finalizeNodes:(t,a,s)=>n(o=>{const l=o.byRun[a]||o.bySession[t];if(!l||!Array.isArray(l.nodes))return{};const u=l.nodes.map(p=>p.status==="pending"||p.status==="ready"||p.status==="blocked"?{...p,status:"skipped"}:p),{totalPhases:d,completedNodes:h}=Pm(u),m={...l,nodes:u,completedPhases:h||l.completedPhases,totalPhases:d||l.totalPhases,updatedAt:er()};return{bySession:{...o.bySession,[t]:m},byRun:{...o.byRun,[a]:m}}}),upsertAgent:(t,a)=>n(s=>{var u;const o=(u=s.agentsBySession[t])==null?void 0:u[a.id],l={id:a.id,sessionId:t,name:a.name||a.role||(o==null?void 0:o.name)||a.id,role:a.role||(o==null?void 0:o.role)||a.name||a.id,source:a.source||(o==null?void 0:o.source)||"agent",status:a.status||(o==null?void 0:o.status)||"idle",runId:a.runId??(o==null?void 0:o.runId),phase:a.phase??(o==null?void 0:o.phase),taskId:a.taskId??(o==null?void 0:o.taskId),currentTask:a.currentTask??(o==null?void 0:o.currentTask),tokens:a.tokens??(o==null?void 0:o.tokens),error:a.error??(o==null?void 0:o.error),updatedAt:a.updatedAt||er()};return{agentsBySession:{...s.agentsBySession,[t]:{...s.agentsBySession[t]||{},[a.id]:l}}}}),upsertTask:(t,a)=>n(s=>{var h;const o=(h=s.tasksBySession[t])==null?void 0:h[a.id],l=er(),u=a.status||(o==null?void 0:o.status)||"pending",d={id:a.id,sessionId:t,title:a.title||(o==null?void 0:o.title)||a.description||a.id,status:u,source:a.source||(o==null?void 0:o.source)||"task",description:a.description??(o==null?void 0:o.description),agentType:a.agentType??(o==null?void 0:o.agentType),progress:a.progress??(o==null?void 0:o.progress),result:a.result??(o==null?void 0:o.result),error:a.error??(o==null?void 0:o.error),runId:a.runId??(o==null?void 0:o.runId),dependencies:a.dependencies??(o==null?void 0:o.dependencies),startedAt:a.startedAt??(o==null?void 0:o.startedAt)??(u==="running"?l:void 0),completedAt:a.completedAt??(o==null?void 0:o.completedAt)??(u==="completed"||u==="failed"?l:void 0),createdAt:a.createdAt||(o==null?void 0:o.createdAt)||l,updatedAt:a.updatedAt||l,raw:a.raw??(o==null?void 0:o.raw)};return{tasksBySession:{...s.tasksBySession,[t]:{...s.tasksBySession[t]||{},[a.id]:d}}}}),setTasks:(t,a,s="plan")=>n(o=>{const l=o.tasksBySession[t]||{},u=Object.fromEntries(Object.entries(l).filter(([,m])=>m.source!==s)),d=er(),h=Object.fromEntries(a.map((m,p)=>{const b=l[m.id],x=m.status||(b==null?void 0:b.status)||"pending",w={id:m.id,sessionId:t,title:m.title||(b==null?void 0:b.title)||m.description||`Task ${p+1}`,status:x,source:m.source||s,description:m.description??(b==null?void 0:b.description),agentType:m.agentType??(b==null?void 0:b.agentType),progress:m.progress??(b==null?void 0:b.progress),result:m.result??(b==null?void 0:b.result),error:m.error??(b==null?void 0:b.error),runId:m.runId??(b==null?void 0:b.runId),dependencies:m.dependencies??(b==null?void 0:b.dependencies),startedAt:m.startedAt??(b==null?void 0:b.startedAt),completedAt:m.completedAt??(b==null?void 0:b.completedAt),createdAt:m.createdAt||(b==null?void 0:b.createdAt)||d+p,updatedAt:m.updatedAt||d,raw:m.raw??(b==null?void 0:b.raw)};return[w.id,w]}));return{tasksBySession:{...o.tasksBySession,[t]:{...u,...h}}}}),recordEvent:(t,a)=>n(s=>{const o={id:x2(a),sessionId:t,type:a.type,source:a.source||"system",timestamp:a.timestamp||er(),title:a.title,message:a.message,status:a.status,runId:a.runId,agentId:a.agentId,taskId:a.taskId,data:a.data};return{eventsBySession:{...s.eventsBySession,[t]:[o,...s.eventsBySession[t]||[]].slice(0,jm)}}}),getAgentsForSession:t=>Object.values(e().agentsBySession[t]||{}).sort((a,s)=>s.updatedAt-a.updatedAt),getTasksForSession:t=>Object.values(e().tasksBySession[t]||{}).sort((a,s)=>{const o={running:0,pending:1,failed:2,completed:3,skipped:4};return o[a.status]-o[s.status]||a.createdAt-s.createdAt}),getEventsForSession:t=>e().eventsBySession[t]||[],getAgentTree:t=>{const a=Object.values(e().agentsBySession[t]||{}),s=new Map(a.map(d=>[d.id,d])),o=a.filter(d=>!d.parentId||!s.has(d.parentId)),l=d=>a.filter(h=>h.parentId===d),u=d=>({agent:d,children:l(d.id).map(u),isRunning:d.status==="running",tokensUsed:d.tokens||0});return o.map(u)},getRunningAgentCount:t=>Object.values(e().agentsBySession[t]||{}).filter(s=>s.status==="running").length}),{name:"deepseekcode-workflow-store",storage:Jg({key:"workflowStore",trims:[n=>({...n,state:{...n.state,eventsBySession:Object.fromEntries(Object.entries(n.state.eventsBySession).map(([e,t])=>[e,t.slice(-50)])),tasksBySession:Object.fromEntries(Object.entries(n.state.tasksBySession).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([a,s])=>[a,{...s,result:s.result?String(s.result).slice(0,1e3):void 0,error:s.error?String(s.error).slice(0,1e3):void 0}]))]))}}),n=>({...n,state:{...n.state,eventsBySession:{}}}),n=>({...n,state:{...n.state,tasksBySession:{},agentsBySession:{}}})],onFailure:()=>{try{is.getState().addToast("warning","任务看板数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失。",8e3)}catch{}}}),partialize:n=>({bySession:n.bySession,byRun:n.byRun,agentsBySession:n.agentsBySession,plansBySession:n.plansBySession,tasksBySession:Object.fromEntries(Object.entries(n.tasksBySession).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([a,s])=>{const{raw:o,...l}=s;return[a,l]}))])),eventsBySession:Object.fromEntries(Object.entries(n.eventsBySession).map(([e,t])=>[e,t.slice(-jm).map(a=>{const{data:s,...o}=a;return o})]))})}));function v9(n,e){const t=String(n);let a=t.indexOf(e),s=a,o=0,l=0;for(;a!==-1;)a===s?++o>l&&(l=o):o=1,s=a+e.length,a=t.indexOf(e,s);return l}function b9(){return{enter:{mathFlow:n,mathFlowFenceMeta:e,mathText:o},exit:{mathFlow:s,mathFlowFence:a,mathFlowFenceMeta:t,mathFlowValue:u,mathText:l,mathTextData:u}};function n(d){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},d)}function e(){this.buffer()}function t(){const d=this.resume(),h=this.stack[this.stack.length-1];uc(h.type==="math"),h.meta=d}function a(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(d){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];uc(m.type==="math"),this.exit(d),m.value=h;const p=m.data.hChildren[0];uc(p.type==="element"),uc(p.tagName==="code"),p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function o(d){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},d),this.buffer()}function l(d){const h=this.resume(),m=this.stack[this.stack.length-1];uc(m.type==="inlineMath"),this.exit(d),m.value=h,m.data.hChildren.push({type:"text",value:h})}function u(d){this.config.enter.data.call(this,d),this.config.exit.data.call(this,d)}}function x9(n){let e=(n||{}).singleDollarTextMath;return e==null&&(e=!0),a.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
28
28
  `,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:t,inlineMath:a}};function t(o,l,u,d){const h=o.value||"",m=u.createTracker(d),p="$".repeat(Math.max(v9(h,"$")+1,2)),b=u.enter("mathFlow");let x=m.move(p);if(o.meta){const w=u.enter("mathFlowMeta");x+=m.move(u.safe(o.meta,{after:`
29
29
  `,before:x,encode:["$"],...m.current()})),w()}return x+=m.move(`
30
30
  `),h&&(x+=m.move(h+`
@@ -463,8 +463,8 @@ XID_Start XIDS`.split(/\s/).map(n=>[uf(n),n])),kR=new Map([["s",wn(383)],[wn(383
463
463
  </body>
464
464
  </html>`;function d3({slotId:n,defId:e}){const{eventBus:t,commandBus:a}=hf(),s=R1(),[o,l]=O.useState(0),[u,d]=O.useState(null);return O.useEffect(()=>{const h=t.on(Bc,()=>l(b=>b+1));let m;e==="panel-b"&&(m=a.register(jg,()=>(d(new Date().toISOString()),{pong:!0,slotId:n})));let p;return e==="panel-a"&&(p=setTimeout(()=>t.emit(Bc,{from:e}),0)),()=>{h(),m==null||m(),p&&clearTimeout(p)}},[t,a,e,n]),y.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-3","data-testid":`test-panel-${e}`,children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"text-xs font-semibold text-dark-text",children:e}),y.jsxs("span",{className:"text-[10px] text-dark-muted",children:["slot: ",n]})]}),y.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[y.jsx("span",{"data-testid":`ping-count-${e}`,children:o}),y.jsx("button",{type:"button",onClick:()=>t.emit(Bc,{from:e}),className:"rounded bg-accent-blue/10 px-2 py-0.5 text-accent-blue hover:bg-accent-blue/20",children:"emit ping"}),e==="panel-b"&&y.jsx("button",{type:"button",onClick:()=>{const h=URL.createObjectURL(new Blob([AD],{type:"text/html"}));s.setArtifactId("demo/index.html"),s.setKind("web"),s.setPreviewUrl(h)},className:"rounded bg-accent-green/10 px-2 py-0.5 text-accent-green hover:bg-accent-green/20","data-testid":"demo-preview-button",children:"preview demo"})]}),u&&y.jsxs("div",{className:"text-[10px] text-emerald-400","data-testid":`pong-${e}`,children:["pong @ ",u]})]})}function ED(n=M1){const e=n.register({id:"panel-a",capability:"demo.panel.a",component:d3,slots:["left"],priority:10,metadata:{label:"Panel A"},lifecycle:{mount:()=>{},unmount:()=>{}}}),t=n.register({id:"panel-b",capability:"demo.panel.b",component:d3,slots:["right"],priority:10,metadata:{label:"Panel B"},aiManifest:{description:"Demo panel that responds to demo.pong commands",commands:[jg],capabilities:[{capability:"demo.panel.b.pong",command:jg,description:"Ping back from panel-b",parameters:[{name:"from",type:"string",description:"who is pinging",required:!1}]}],events:{listen:[Bc],emit:[Bc]}}});return()=>{e(),t()}}const ND={select:"preview.element.select",inspect:"preview.element.inspect",screenshot:"preview.element.screenshot",highlight:"preview.element.highlight"};function MD(n,e){const t=e??{},a=typeof t.selector=="string"&&t.selector.trim()!==""?t.selector:void 0,s=typeof t.elementId=="string"&&t.elementId.trim()!==""?t.elementId:void 0;return!a&&!s?{ok:!1,error:`interactive "${n}" message requires a non-empty selector or elementId`}:{ok:!0,elementRef:{selector:a,elementId:s}}}function RD(n,e){var s,o,l,u,d,h,m,p,b;const t=CD(n);if(!t.ok)return(s=e.onError)==null||s.call(e,t.error),!1;const a=t.data;switch(a.type){case"ready":return(o=e.onReady)==null||o.call(e,a),!0;case"event":{const x=a.payload??{};return typeof x.event!="string"?((l=e.onError)==null||l.call(e,`iframe event message requires payload.event string, got ${JSON.stringify(x.event)}`),!1):((u=e.onEvent)==null||u.call(e,x.event,x.data,a),!0)}case"command":{const x=a.payload??{};return typeof x.command!="string"?((d=e.onError)==null||d.call(e,`iframe command message requires payload.command string, got ${JSON.stringify(x.command)}`),!1):((h=e.onCommand)==null||h.call(e,x.command,x.payload,a),!0)}case"select":case"inspect":case"screenshot":case"highlight":{const x=MD(a.type,a.payload);return x.ok?((p=e.onEvent)==null||p.call(e,ND[a.type],{...a.payload??{},elementRef:x.elementRef},a),!0):((m=e.onError)==null||m.call(e,x.error),!1)}default:return(b=e.onError)==null||b.call(e,`unsupported message type: ${JSON.stringify(a.type)}`),!1}}function OD(n,e){const t=O.useRef(e);t.current=e;const a=s=>{var l;const o=(l=n.current)==null?void 0:l.contentWindow;o&&o.postMessage(s,"*")};return O.useEffect(()=>{const s=o=>{var p;const l=(p=n.current)==null?void 0:p.contentWindow;if(l&&o.source!==l||l===void 0&&o.source!==null)return;const{eventBus:u,onCommand:d,onReady:h,onError:m}=t.current;RD(o.data,{onEvent:(b,x)=>u.emit(b,x),onCommand:d??(()=>{}),onReady:h,onError:m})};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)},[n]),{post:a}}function DD(n,e){const t=(n.split(".").pop()||"").toLowerCase();return e==="web"||t==="html"||t==="htm"?"html":["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(t)||e==="document"?"image":"text"}function LD({slotId:n}){const{artifactId:e,kind:t,previewUrl:a}=R1(),{eventBus:s}=hf(),[o,l]=O.useState(null),[u,d]=O.useState(null),[h,m]=O.useState(null),p=O.useRef(null),b=e??null,x=b?DD(b,t):"text";return OD(p,{eventBus:s,onError:w=>m(w)}),O.useEffect(()=>{if(x!=="html"||!b)return;if(a&&a.startsWith("blob:")){d(a),m(null);return}let w=!1;return m(null),l(null),(async()=>{try{const _=await ht.files.read(b);if(w)return;if(!_.success||_.data===void 0){m(_.error||"failed to read artifact");return}const T=new Blob([String(_.data)],{type:"text/html"}),N=URL.createObjectURL(T);l(String(_.data)),d(N)}catch(_){w||m(_ instanceof Error?_.message:String(_))}})(),()=>{w=!0,u&&URL.revokeObjectURL(u)}},[x,b,a]),y.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col","data-testid":`web-preview-${n}`,children:[y.jsxs("div",{className:"shrink-0 flex items-center gap-2 border-b border-dark-border/60 px-2 py-1 text-[10px] text-dark-muted",children:[y.jsx("span",{className:"truncate font-mono",children:b??"no artifact"}),y.jsx("span",{className:"ml-auto shrink-0 uppercase",children:x})]}),h&&y.jsx("div",{className:"m-2 rounded border border-accent-red/30 bg-accent-red/5 px-2 py-1.5 text-[11px] text-accent-red",children:h}),y.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:b?x==="html"&&u?y.jsx("iframe",{ref:p,title:`preview-${b}`,sandbox:"allow-scripts allow-forms allow-modals",src:u,className:"h-full w-full border-0 bg-white","data-testid":"web-preview-iframe"}):x==="image"?y.jsx("img",{src:a??void 0,alt:b,className:"mx-auto max-h-full max-w-full object-contain","data-testid":"web-preview-image"}):y.jsx("pre",{className:"whitespace-pre-wrap break-all p-3 font-mono text-[11px] leading-relaxed text-dark-text",children:o??(a?`Loading ${b}…`:`Preview ${b}`)}):y.jsx("div",{className:"grid h-full place-items-center p-4 text-center text-xs text-dark-muted/70",children:"Select an artifact to preview it here."})})]})}function BD(n){return n.register({id:"web-preview",capability:"preview.artifact",component:LD,slots:["preview"],priority:10,metadata:{label:"Preview"},aiManifest:{description:"Renders the current artifact (HTML in a sandboxed iframe, images, text)",commands:[],events:{listen:[],emit:[]}}})}const jD=["write_file","edit_file","file_write","file_edit","file_create","file_append","notebook_edit","notebook_write","apply_patch","git_apply_patch","git_commit","FileEditTool","FileWriteTool","EditTool","NotebookEditTool","Write","Edit","WriteTool","FileCreateTool"],PD=/(?:^|[_\W])(write|edit|save|create|update|modify|patch|output|export|render|generate|build)(?:[_\W]|$)/i,ID=/(?:^|[_\W])(read|open|cat|view|list|ls|dir|find|grep|glob|search)(?:[_\W]|$)/i;function ll(n){return jD.includes(n)?!0:PD.test(n)&&!ID.test(n)}function zD(n){let e=null;if(typeof n=="string")try{const t=JSON.parse(n);t&&typeof t=="object"&&!Array.isArray(t)&&(e=t)}catch{return}else n&&typeof n=="object"&&!Array.isArray(n)&&(e=n);if(e)return e.filePath||e.path||e.file||e.file_path||e.outputPath||e.output}function jc(n){const e=n.split(/[\\/]/);return e[e.length-1]||n}function Pg(n){const e=(n.split(".").pop()||"").toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(e)?"image":["md","markdown","mdown"].includes(e)?"markdown":["ts","tsx","js","jsx","json","css","html","htm","py","sh","yaml","yml","go","rs","toml","sql","java","c","cpp","h","rb","php"].includes(e)?"code":"file"}function $D({kind:n,size:e=14}){return n==="image"?y.jsx(_S,{size:e,className:"text-dark-muted shrink-0"}):n==="markdown"?y.jsx(Jo,{size:e,className:"text-dark-muted shrink-0"}):n==="code"?y.jsx(CS,{size:e,className:"text-dark-muted shrink-0"}):y.jsx(K3,{size:e,className:"text-dark-muted shrink-0"})}function I7(n){var t;const e=new Map;for(const a of n){if((t=a.fileJob)!=null&&t.result)for(const s of a.fileJob.result)s.path&&!e.has(s.path)&&e.set(s.path,{path:s.path,name:s.fileName||jc(s.path),source:"filejob"});for(const s of a.toolCalls??[]){if(s.status==="error")continue;const o=zD(s.args);o&&ll(s.name)&&!e.has(o)&&e.set(o,{path:o,name:jc(o),source:"toolcall"})}}return Array.from(e.values())}function HD({status:n}){return n==="running"?y.jsx(Ga,{size:12,className:"animate-spin text-accent-blue shrink-0 mt-0.5"}):n==="completed"?y.jsx(I0,{size:12,className:"text-accent-green shrink-0 mt-0.5"}):n==="failed"?y.jsx(Zg,{size:12,className:"text-accent-red shrink-0 mt-0.5"}):n==="skipped"?y.jsx(kS,{size:12,className:"text-dark-muted shrink-0 mt-0.5"}):y.jsx(Yg,{size:12,className:"text-dark-muted shrink-0 mt-0.5"})}function UD({sessionId:n}){const{t:e}=vt(),t=wt(m=>n?m.getTasksForSession(n):[]),a=wt(m=>n?m.getRunningAgentCount(n):0),s=wt(m=>n?m.getForSession(n):void 0),l=Ue(m=>n?m.isGenerating(n):!1)||a>0||(s==null?void 0:s.status)==="RUNNING"||(s==null?void 0:s.status)==="RESUMING",u=O.useMemo(()=>n?wt.getState().getEventsForSession(n).filter(p=>p.type==="tool_call"||p.title).length:0,[n,t.length,a,s==null?void 0:s.updatedAt]);if(t.length===0)return l?y.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted py-0.5",children:[y.jsx(Ga,{size:13,className:"animate-spin text-accent-blue shrink-0"}),y.jsx("span",{className:"truncate",children:a>0?e("chat.sidebarWorkingWithAgents",{n:a}):u>0?e("chat.sidebarWorkingToolcalls",{n:u}):e("chat.sidebarWorking")})]}):y.jsx("p",{className:"text-[11px] leading-relaxed text-dark-muted/70",children:e("chat.sidebarIdle")});const d=t.slice(0,12),h=t.length-d.length;return y.jsxs("div",{className:"space-y-1.5",children:[d.map(m=>y.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[y.jsx(HD,{status:m.status}),y.jsxs("span",{className:Wt("min-w-0 flex-1 leading-snug break-words",m.status==="completed"&&"text-dark-muted/70 line-through decoration-dark-muted/40",m.status==="failed"&&"text-accent-red/90"),children:[m.title,m.status==="running"&&m.progress!==void 0&&y.jsx("span",{className:"block mt-1",children:y.jsx("span",{className:"block w-full h-1 bg-dark-surface rounded-full overflow-hidden",children:y.jsx("span",{className:"block h-full bg-accent-blue rounded-full transition-all duration-500",style:{width:`${Math.max(0,Math.min(100,m.progress))}%`}})})})]})]},m.id)),h>0&&y.jsxs("p",{className:"text-[10px] text-dark-muted/70",children:["+",h," ",e("chat.sidebarMoreTasks")]}),l&&y.jsx("p",{className:"text-[10px] text-dark-muted/70 pt-0.5",children:a>0?e("chat.sidebarRunningAgents",{n:a}):e("chat.sidebarToolcallsSoFar",{n:u})})]})}function z7({sessionId:n,messages:e,previewFile:t,onPreview:a,onClosePreview:s}){const{t:o}=vt(),[l,u]=O.useState(null),[d,h]=O.useState(!1),[m,p]=O.useState(null),b=O.useCallback(async T=>{h(!0),p(null),u(null);try{const N=await ht.files.read(T);N.success&&N.data!==void 0&&N.data!==null?u(String(N.data)):p(N.error||o("chat.fileReadError"))}catch(N){p(N instanceof Error?N.message:o("chat.fileReadError"))}finally{h(!1)}},[o]);O.useEffect(()=>{if(!t){u(null),h(!1),p(null);return}if(Pg(t)==="file"){u(null),h(!1),p(null);return}b(t)},[t,b]);const x=O.useCallback(async T=>{const N=await ht.files.download(T);N.success||Ze.error(N.error||o("chat.fileReadError"))},[o]),w=O.useCallback(async T=>{try{await navigator.clipboard.writeText(T),Ze.success(o("chat.copiedPath"))}catch{Ze.error(o("chat.copyPathFailed"))}},[o]),_=t?Pg(t):"file";return y.jsx("div",{className:"flex-1 min-h-0 min-w-0 flex flex-col overflow-hidden",children:t?y.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[y.jsx("div",{className:"shrink-0 px-2 py-2 border-b border-dark-border/60",children:y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-dark-hover transition-colors text-dark-muted shrink-0",title:o("chat.backToArtifacts"),"aria-label":o("chat.backToArtifacts"),children:y.jsx(Xg,{size:15})}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center gap-1 text-xs font-semibold text-dark-text truncate",children:[y.jsx("span",{className:"text-dark-muted font-normal shrink-0",children:o("chat.artifactPanel")}),y.jsx("span",{className:"text-dark-muted/50 shrink-0",children:"/"}),y.jsx("span",{className:"truncate",children:jc(t)})]}),y.jsx("div",{className:"text-[10px] font-mono text-dark-muted truncate mt-0.5",title:t,children:t})]}),y.jsx("button",{onClick:()=>void w(t),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:o("chat.copyPath"),"aria-label":o("chat.copyPath"),children:y.jsx(U3,{size:14})}),y.jsx("a",{href:Qd(`/api/files/read?path=${encodeURIComponent(t)}`),target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:o("chat.openInNewTab"),"aria-label":o("chat.openInNewTab"),children:y.jsx(Cb,{size:14})}),y.jsx("button",{onClick:()=>void x(t),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:o("fileJob.download"),"aria-label":o("fileJob.download"),children:y.jsx(zc,{size:14})})]})}),y.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 custom-scrollbar p-3",children:d?y.jsx("div",{className:"flex items-center justify-center py-10 text-dark-muted",children:y.jsx(Ga,{size:18,className:"animate-spin text-accent-blue"})}):m?y.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-accent-red/30 bg-accent-red/5 px-3 py-2.5 text-xs text-accent-red",children:[y.jsx(P0,{size:14,className:"shrink-0 mt-0.5"}),y.jsx("span",{className:"break-words",children:m})]}):_==="image"?y.jsx("img",{src:Qd(`/api/files/download?path=${encodeURIComponent(t)}`),alt:jc(t),className:"max-w-full h-auto rounded-lg border border-dark-border"}):_==="markdown"&&l!=null?y.jsx(SO,{content:l}):_==="code"?y.jsx("pre",{className:"text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-all text-dark-text",children:l??""}):y.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center",children:[y.jsx("span",{className:"grid w-16 h-16 shrink-0 place-items-center rounded-2xl bg-dark-surface border border-dark-border shadow-sm",children:y.jsx(K3,{size:30,className:"text-accent-blue"})}),y.jsxs("div",{className:"min-w-0 w-full max-w-sm",children:[y.jsx("div",{className:"text-sm font-semibold text-dark-text break-all leading-snug",children:jc(t)}),y.jsx("div",{className:"mt-1.5 text-[11px] font-mono text-dark-muted break-all leading-relaxed",title:t,children:t})]}),y.jsx("p",{className:"text-[11px] text-dark-muted/70 leading-relaxed max-w-xs",children:o("chat.filePreviewHint")}),y.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[y.jsxs("a",{href:Qd(`/api/files/read?path=${encodeURIComponent(t)}`),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-lg bg-accent-blue/10 text-accent-blue px-3 py-1.5 text-xs font-medium hover:bg-accent-blue/20 transition-colors",title:o("chat.openInNewTab"),children:[y.jsx(Cb,{size:13}),o("chat.openInNewTab")]}),y.jsxs("button",{onClick:()=>void x(t),className:"inline-flex items-center gap-1 rounded-lg bg-dark-surface border border-dark-border text-dark-text px-3 py-1.5 text-xs hover:bg-dark-hover transition-colors",title:o("fileJob.download"),children:[y.jsx(zc,{size:13}),o("fileJob.download")]})]})]})})]}):y.jsx($O,{sessionId:n,messages:e,onPreview:a})})}function FD({sessionId:n,messages:e,previewFile:t,onPreview:a,onClosePreview:s,isMaximized:o,onToggleMaximize:l}){const{t:u}=vt(),d=O.useMemo(()=>I7(e),[e]),[h,m]=O.useState("artifacts"),p=O.useMemo(()=>({type:"split",direction:"horizontal",children:[{type:"slot",id:"left"},{type:"split",direction:"vertical",children:[{type:"slot",id:"right"},{type:"slot",id:"preview"}]}]}),[]);return y.jsxs("div",{className:"w-full h-full border-l border-dark-border bg-dark-surface flex flex-col overflow-hidden",children:[y.jsxs("div",{className:"shrink-0 px-3 py-2.5 border-b border-dark-border bg-dark-surface flex items-center gap-2",children:[y.jsx(W3,{size:14,className:"text-accent-blue shrink-0"}),y.jsx("span",{className:"text-xs font-semibold text-dark-text truncate",children:u(h==="workspace"?"chat.workspaceTitle":"chat.artifactPanel")}),y.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[h==="artifacts"&&!t&&d.length>0&&y.jsx("span",{className:"text-[10px] text-dark-muted tabular-nums",children:d.length}),y.jsx("button",{onClick:()=>m(b=>b==="workspace"?"artifacts":"workspace"),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:u(h==="workspace"?"chat.artifactsToggle":"chat.workspaceToggle"),"aria-label":u(h==="workspace"?"chat.artifactsToggle":"chat.workspaceToggle"),"data-testid":"sidebar-view-toggle",children:y.jsx(TS,{size:14})}),l&&y.jsx("button",{onClick:l,className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:u(o?"chat.sidebarRestore":"chat.sidebarMaximize"),"aria-label":u(o?"chat.sidebarRestore":"chat.sidebarMaximize"),children:o?y.jsx(AS,{size:14}):y.jsx(ES,{size:14})})]})]}),h==="workspace"?y.jsx(TD,{layout:p,onRegister:b=>{const x=[ED(b),BD(b)];return()=>x.forEach(w=>w())}}):y.jsx(z7,{sessionId:n,messages:e,previewFile:t,onPreview:a,onClosePreview:s}),y.jsx("div",{className:"shrink-0 px-3 py-2 border-t border-dark-border/60",children:y.jsx("p",{className:"text-[10px] text-dark-muted/60 leading-relaxed",children:u(h==="workspace"?"chat.workspaceHint":"chat.artifactHint")})})]})}O.createContext(null);function pf({isOpen:n,onClose:e,title:t,children:a,size:s="md",className:o}){if(O.useEffect(()=>{const u=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),e())};return n&&(document.addEventListener("keydown",u),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=""}},[n,e]),!n)return null;const l={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-3xl","3xl":"max-w-5xl"};return y.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-hidden p-4",children:[y.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),y.jsxs("div",{className:Wt("relative w-full mx-4 bg-dark-surface border border-dark-border rounded-xl shadow-2xl animate-fade-in","max-h-[calc(100vh-2rem)] flex flex-col overflow-hidden",l[s],o),children:[t&&y.jsxs("div",{className:"flex shrink-0 items-center justify-between px-6 py-4 border-b border-dark-border",children:[y.jsx("h2",{className:"text-lg font-semibold text-dark-text",children:t}),y.jsx("button",{onClick:e,"aria-label":"Close",className:"p-1 rounded-lg text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:y.jsx(xr,{className:"w-5 h-5","aria-hidden":"true"})})]}),y.jsx("div",{className:"min-h-0 overflow-y-auto custom-scrollbar p-6",children:a})]})]})}function QP({isOpen:n,onClose:e,onConfirm:t,title:a,message:s,confirmText:o,cancelText:l,variant:u="default"}){const{t:d}=vt(),h=()=>{t(),e()};return y.jsxs(pf,{isOpen:n,onClose:e,title:a??d("common.confirm"),size:"sm",children:[y.jsx("p",{className:"text-dark-muted mb-6",children:s}),y.jsxs("div",{className:"flex gap-3 justify-end",children:[y.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:l??d("common.cancel")}),y.jsx("button",{onClick:h,className:Wt("px-4 py-2 rounded-lg text-white transition-colors",u==="danger"?"bg-accent-red hover:bg-accent-red/90":"bg-accent-blue hover:bg-accent-blue/90"),children:o??d("common.confirm")})]})]})}function f3({children:n,variant:e="default",size:t="md",className:a}){const s={default:"bg-dark-border text-dark-muted",success:"bg-accent-green/20 text-accent-green",warning:"bg-accent-yellow/20 text-accent-yellow",error:"bg-accent-red/20 text-accent-red",info:"bg-accent-blue/20 text-accent-blue"},o={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs"};return y.jsx("span",{className:Wt("inline-flex items-center rounded-full font-medium",s[e],o[t],a),children:n})}const GD={string:"templates.typeString",number:"templates.typeNumber",select:"templates.typeSelect",boolean:"templates.typeBoolean",folder:"templates.typeFolder",connector:"templates.typeConnector"};function qD({template:n,onCancel:e,onSubmit:t,submitLabel:a,busy:s=!1}){const{t:o}=vt(),l=a??o("templates.launch"),u=n.inputs??[],d=O.useMemo(()=>{const _={};for(const T of u)T.default!==void 0&&T.default!==null&&(_[T.name]=T.default);return _},[u]),[h,m]=O.useState(d),[p,b]=O.useState({});if(u.length===0)return y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-sm text-dark-muted",children:o("templates.noInputsNeeded")}),y.jsx("div",{className:"text-xs text-dark-muted/80 break-all",children:n.description||"—"}),y.jsxs("div",{className:"flex justify-end gap-3",children:[y.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:o("templates.cancel")}),y.jsx("button",{onClick:()=>t({}),disabled:s,className:"px-4 py-2 rounded-lg bg-accent-blue text-white hover:bg-accent-blue/90 disabled:opacity-50 transition-colors",children:s?o("templates.starting"):l})]})]});const x=(_,T)=>{m(N=>({...N,[_]:T})),b(N=>{if(!N[_])return N;const E={...N};return delete E[_],E})},w=()=>{const _={},T={};for(const N of u){let E=h[N.name];typeof E=="string"&&(E=E.trim());const B=E==null||E==="";if(N.required&&B){_[N.name]=o("templates.requiredError");continue}if(!B)if(N.type==="number"){const L=Number(E);if(!Number.isFinite(L)){_[N.name]=o("templates.numberError");continue}T[N.name]=L}else T[N.name]=E}if(Object.keys(_).length>0){b(_);return}t(T)};return y.jsxs("div",{className:"space-y-4",children:[y.jsx("div",{className:"text-sm text-dark-muted",children:n.description||""}),u.map(_=>y.jsxs("div",{children:[y.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-dark-text mb-1.5",children:[y.jsx("span",{children:_.label||_.name}),_.required&&y.jsx("span",{className:"text-accent-red",children:"*"}),_.type!=="boolean"&&y.jsx("span",{className:"text-[10px] text-dark-muted/70",children:o(GD[_.type])})]}),VD(_,h[_.name],x,o("templates.selectNone")),_.description&&y.jsx("div",{className:"mt-1 text-xs text-dark-muted/70",children:_.description}),p[_.name]&&y.jsx("div",{className:"mt-1 text-xs text-accent-red",children:p[_.name]})]},_.name)),y.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[y.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:o("templates.cancel")}),y.jsx("button",{onClick:w,disabled:s,className:"px-4 py-2 rounded-lg bg-accent-blue text-white hover:bg-accent-blue/90 disabled:opacity-50 transition-colors",children:s?o("templates.starting"):l})]})]})}function VD(n,e,t,a){const s="w-full px-3 py-2 rounded-lg bg-dark-bg border border-dark-border text-sm text-dark-text focus:outline-none focus:ring-1 focus:ring-accent-blue placeholder:text-dark-muted/50";switch(n.type){case"select":return y.jsxs("select",{value:typeof e=="string"?e:n.default||"",onChange:o=>t(n.name,o.target.value),className:s,children:[!n.required&&y.jsx("option",{value:"",children:a}),(n.options||[]).map(o=>y.jsx("option",{value:o,children:o},o))]});case"boolean":return y.jsx("button",{type:"button",onClick:()=>t(n.name,e!==!0),className:Wt("h-6 w-11 rounded-full transition-colors relative flex items-center px-0.5",e===!0?"bg-accent-blue":"bg-dark-border"),"aria-pressed":e===!0,children:y.jsx("span",{className:Wt("h-5 w-5 rounded-full bg-white transition-transform",e===!0&&"translate-x-5")})});case"number":return y.jsx("input",{type:"number",value:typeof e=="number"||typeof e=="string"?e:"",onChange:o=>t(n.name,o.target.value),placeholder:typeof n.default=="number"?String(n.default):"0",className:s});default:return y.jsx("input",{type:"text",value:typeof e=="string"?e:"",onChange:o=>t(n.name,o.target.value),placeholder:typeof n.default=="string"?n.default:"",className:s})}}function WD({collapsed:n=!1,onDirect:e,onStartTemplate:t,onManageTemplates:a}){const{t:s}=vt(),[o,l]=O.useState(!1),[u,d]=O.useState({kind:"list"}),[h,m]=O.useState([]),[p,b]=O.useState(!1),[x,w]=O.useState(""),[_,T]=O.useState({top:0,left:0}),N=O.useRef(null),E=O.useCallback(()=>{d({kind:"list"}),l(!0)},[]);O.useEffect(()=>{var ee;if(!o)return;const Y=(ee=N.current)==null?void 0:ee.getBoundingClientRect();Y&&T({top:Y.bottom+6,left:Math.max(8,Y.left)})},[o,n]),O.useEffect(()=>{if(!o||u.kind!=="list")return;let Y=!1;return b(!0),w(""),ht.templates.list().then(ee=>{Y||(ee.success&&ee.data?m(ee.data):w(ee.error||s("templates.loadFailed")))}).catch(()=>{Y||w(s("templates.loadFailed"))}).finally(()=>{Y||b(!1)}),()=>{Y=!0}},[o,u.kind]);const B=O.useMemo(()=>{const Y=new Map;for(const ee of h){const te=ee.category||s("templates.uncategorized"),xe=Y.get(te)||[];xe.push(ee),Y.set(te,xe)}return[...Y.entries()]},[h,s]),L=async Y=>{const ee=await ht.templates.get(Y.id);ee.success&&ee.data?d({kind:"form",template:ee.data}):w(ee.error||s("templates.loadFailed"))},j=Y=>{u.kind==="form"&&(t(u.template,Y),l(!1),d({kind:"list"}))},F={top:_.top,left:_.left,width:Math.min(360,typeof window<"u"?window.innerWidth-16:360)};return y.jsxs("div",{ref:N,className:"relative",children:[y.jsx("div",{className:"flex",children:n?y.jsx("button",{onClick:E,className:"btn btn-primary w-full !px-0 aspect-square",title:s("templates.newSession"),"aria-label":s("templates.newSession"),children:y.jsx(s0,{size:16,"aria-hidden":"true"})}):y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:e,className:"btn btn-primary flex-1 !px-3 py-2 rounded-l-lg",children:[y.jsx(s0,{size:15,"aria-hidden":"true"}),s("templates.newSession")]}),y.jsx("button",{onClick:()=>o?l(!1):E(),className:"px-2.5 rounded-r-lg bg-accent-blue text-white border-l border-white/25 hover:opacity-95 flex items-center",title:s("templates.newFromTemplateTitle"),"aria-label":s("templates.chooseTemplateAria"),children:y.jsx(ti,{size:13,"aria-hidden":"true"})})]})}),o&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>l(!1)}),y.jsx("div",{className:"fixed z-50 bg-dark-surface border border-dark-border rounded-xl shadow-2xl p-1.5 max-h-[70vh] overflow-y-auto custom-scrollbar",style:F,children:u.kind==="form"?y.jsxs("div",{className:"p-2",children:[y.jsxs("button",{onClick:()=>d({kind:"list"}),className:"mb-2 inline-flex items-center gap-1 text-xs text-dark-muted hover:text-dark-text transition-colors",children:[y.jsx(NS,{className:"w-3.5 h-3.5"})," ",s("templates.backToList")]}),y.jsx("div",{className:"text-sm font-medium text-dark-text mb-3",children:u.template.name}),y.jsx(qD,{template:u.template,onCancel:()=>d({kind:"list"}),onSubmit:j,submitLabel:s("templates.launch")})]}):y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"px-2 py-1 text-[10.5px] uppercase tracking-[0.06em] text-dark-muted/70 font-semibold",children:s("templates.startSessionHeader")}),y.jsxs("button",{onClick:()=>{l(!1),e()},className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-lg hover:bg-dark-hover text-left",children:[y.jsx("span",{className:"w-6 h-6 rounded-md bg-accent-blue/10 border border-accent-blue/30 grid place-items-center text-accent-blue shrink-0",children:y.jsx(z0,{className:"w-3.5 h-3.5"})}),y.jsxs("span",{className:"min-w-0",children:[y.jsx("span",{className:"block text-[13px] font-medium text-dark-text",children:s("templates.directChat")}),y.jsx("span",{className:"block text-[11px] text-dark-muted truncate",children:s("templates.directChatHint")})]})]}),p&&y.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-xs text-dark-muted",children:[y.jsx(Ga,{className:"w-3.5 h-3.5 animate-spin"})," ",s("templates.loadingTemplates")]}),x&&!p&&y.jsx("div",{className:"px-2 py-2 text-xs text-accent-red",children:x}),!p&&!x&&B.length===0&&y.jsx("div",{className:"px-2 py-2 text-xs text-dark-muted",children:s("templates.noTemplatesYet")}),B.map(([Y,ee])=>y.jsxs("div",{className:"mt-1",children:[y.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[y.jsx(i0,{className:"w-3 h-3 text-dark-muted/70"}),y.jsx("span",{className:"text-[10px] uppercase tracking-[0.06em] text-dark-muted/70 font-semibold",children:Y}),y.jsx(f3,{size:"sm",children:ee.length})]}),ee.map(te=>y.jsxs("button",{onClick:()=>void L(te),className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-lg hover:bg-dark-hover text-left",children:[y.jsx("span",{className:"w-6 h-6 rounded-md bg-dark-border/60 border border-dark-border grid place-items-center text-dark-muted shrink-0",children:y.jsx(i0,{className:"w-3.5 h-3.5"})}),y.jsxs("span",{className:"min-w-0 flex-1",children:[y.jsxs("span",{className:"flex items-center gap-1.5",children:[y.jsx("span",{className:"block text-[13px] font-medium text-dark-text truncate",children:te.name}),y.jsxs(f3,{size:"sm",variant:"info",children:["v",te.version]})]}),te.description&&y.jsx("span",{className:"block text-[11px] text-dark-muted truncate",children:te.description})]})]},te.id))]},Y)),y.jsx("div",{className:"border-t border-dark-border mt-1 pt-1",children:y.jsx("button",{onClick:()=>{l(!1),a()},className:"w-full px-2 py-1.5 rounded-lg hover:bg-dark-hover text-left text-[12.5px] text-dark-muted",children:s("templates.libraryMenu")})})]})})]})]})}function Ig(n,e=Date.now(),t){const a=typeof n=="number"?n:new Date(n).getTime();if(!Number.isFinite(a))return"";const s=e-a;if(s<6e4)return t?t("time.justNow"):"刚刚";const o=Math.floor(s/6e4);if(o<60)return t?t("time.minutesAgo",{count:o}):`${o}分钟前`;const l=Math.floor(o/60);if(l<24)return t?t("time.hoursAgo",{count:l}):`${l}小时前`;const u=Math.floor(l/24);if(u<7)return t?t("time.daysAgo",{count:u}):`${u}天前`;const d=new Date(a);return`${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,"0")}-${String(d.getDate()).padStart(2,"0")}`}const bc=10;function KD({isOpen:n,onClose:e,onSwitchSession:t}){const{t:a}=vt(),s=Ke(N=>N.sessionTabs),o=Ke(N=>N.historySessions),l=Ke(N=>N.activeSessionId),u=Ue(N=>N.generatingSessions),[d,h]=O.useState(0),m=O.useMemo(()=>{const N=new Map;for(const E of s)N.set(E.id,E);for(const E of o)N.has(E.id)||N.set(E.id,E);return[...N.values()].sort((E,B)=>(B.lastActiveAt??B.createdAt??0)-(E.lastActiveAt??E.createdAt??0))},[s,o]),p=Math.max(1,Math.ceil(m.length/bc)),b=Math.min(d,p-1),x=O.useMemo(()=>{const N=new Map,E=b*bc;for(const B of m.slice(E,E+bc)){const L=B.project||"default",j=N.get(L)||[];j.push(B),N.set(L,j)}return Array.from(N.entries())},[m,b]),w=m.length===0?0:b*bc+1,_=Math.min((b+1)*bc,m.length),T=N=>u.includes(N.id)?"running":N.status||"done";return y.jsx(pf,{isOpen:n,onClose:e,title:a("chat.sessionPickerTitle"),size:"lg",children:y.jsxs("div",{className:"flex flex-col gap-3",children:[y.jsx("div",{className:"max-h-[320px] overflow-y-auto custom-scrollbar rounded-lg border border-dark-border bg-dark-bg p-1.5",children:m.length===0?y.jsx("div",{className:"px-3 py-6 text-center text-xs text-dark-muted/60",children:a("chat.noSessions")}):x.map(([N,E])=>y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 text-[10px] text-dark-muted/70",children:[y.jsx(Y3,{size:10,"aria-hidden":"true",className:"shrink-0 opacity-60"}),y.jsx("span",{className:"truncate",children:N==="default"?a("nav.mySessions"):N}),y.jsx("span",{className:"ml-auto text-[9px] text-dark-muted/40",children:E.length})]}),y.jsx("div",{className:"space-y-0.5",children:E.map(B=>{const L=B.id===l,j=T(B),F=Ig(B.lastActiveAt??B.createdAt,Date.now(),a),Y=Zd(B),ee=lx(B.title,Y);return y.jsxs("button",{onClick:()=>{t(B.id),e()},title:a("chat.clickToOpenSession"),className:`group flex w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[7px] text-left text-[13px] transition-colors ${L?"bg-accent-blue/10 font-medium text-accent-blue":"text-dark-muted hover:bg-dark-hover/60 hover:text-dark-text"}`,children:[y.jsx(z0,{size:13,"aria-hidden":"true",className:"shrink-0 opacity-60"}),y.jsxs("span",{className:"min-w-0 flex-1",children:[y.jsxs("span",{className:"flex items-center gap-1.5",children:[y.jsx("span",{className:"min-w-0 flex-1 truncate",children:B.title}),j==="running"&&y.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-red animate-pulse",title:a("nav.sessionRunning")}),j==="waiting"&&y.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-yellow",title:a("nav.sessionWaiting")}),j==="failed"&&y.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-red",title:a("nav.sessionFailed")}),j==="done"&&y.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-green",title:a("nav.sessionDone")})]}),y.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[11px] leading-tight text-dark-muted/60",children:[ee&&y.jsx("span",{className:"min-w-0 flex-1 truncate",children:Y}),y.jsx("span",{className:`shrink-0 ${ee?"":"ml-auto"}`,children:F})]})]})]},B.id)})})]},N))}),y.jsxs("div",{className:"flex items-center justify-between text-xs text-dark-muted",children:[y.jsx("span",{children:a("common.pageInfo",{start:w,end:_,total:m.length})}),y.jsxs("div",{className:"flex items-center gap-1",children:[y.jsxs("button",{onClick:()=>h(N=>Math.max(0,N-1)),disabled:b===0,className:"flex items-center gap-0.5 rounded-md border border-dark-border px-2 py-1 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text disabled:cursor-not-allowed disabled:opacity-40",children:[y.jsx(Xg,{size:13,"aria-hidden":"true"}),a("common.prevPage")]}),y.jsxs("span",{className:"min-w-[48px] text-center font-mono",children:[b+1,"/",p]}),y.jsxs("button",{onClick:()=>h(N=>Math.min(p-1,N+1)),disabled:b>=p-1,className:"flex items-center gap-0.5 rounded-md border border-dark-border px-2 py-1 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text disabled:cursor-not-allowed disabled:opacity-40",children:[a("common.nextPage"),y.jsx(Z3,{size:13,"aria-hidden":"true"})]})]})]})]})})}function YD(){return{activities:{},order:[],taskTitles:{},artifacts:[]}}const Zn=mn()(n=>({bySession:{},applyEvent:(e,t)=>n(a=>{const s=a.bySession[e]??YD();switch(t.type){case"activity_started":return s.activities[t.activity.id]?a:{...a,bySession:{...a.bySession,[e]:{...s,activities:{...s.activities,[t.activity.id]:t.activity},order:[...s.order,t.activity.id]}}};case"activity_updated":{const o=s.activities[t.activityId];return o?{...a,bySession:{...a.bySession,[e]:{...s,activities:{...s.activities,[t.activityId]:{...o,...t.patch}}}}}:a}case"activity_finalized":{const o=s.activities[t.activityId];return o?{...a,bySession:{...a.bySession,[e]:{...s,activities:{...s.activities,[t.activityId]:{...o,status:t.status,endedAt:t.endedAt}}}}}:a}case"artifact_produced":return s.artifacts.some(o=>o.id===t.artifact.id)?a:{...a,bySession:{...a.bySession,[e]:{...s,artifacts:[...s.artifacts,t.artifact]}}};case"task_title_set":return{...a,bySession:{...a.bySession,[e]:{...s,taskTitles:{...s.taskTitles,[t.messageId]:t.title}}}};case"next_action_set":return{...a,bySession:{...a.bySession,[e]:{...s,nextAction:t.text??void 0}}};default:return a}}),resetSession:e=>n(t=>{if(!t.bySession[e])return t;const a={...t.bySession};return delete a[e],{bySession:a}}),finalizeSession:(e,t)=>n(a=>{const s=a.bySession[e];if(!s)return a;const o=Date.now(),l=["pending","running","paused","waiting_user"];let u=!1;const d={};for(const[h,m]of Object.entries(s.activities))l.includes(m.status)?(d[h]={...m,status:t,endedAt:o},u=!0):d[h]=m;return u?{...a,bySession:{...a.bySession,[e]:{...s,activities:d}}}:a}),markStatus:(e,t,a)=>n(s=>{const o=s.bySession[e];if(!o)return s;let l=!1;const u={};for(const[d,h]of Object.entries(o.activities))t.includes(h.status)?(u[d]={...h,status:a},l=!0):u[d]=h;return l?{...s,bySession:{...s.bySession,[e]:{...o,activities:u}}}:s})}));function JP(n,e,t){if(!e)return[];const a=n.bySession[e];if(!a)return[];const s=[];for(const o of a.order){const l=a.activities[o];l&&l.messageId===t&&s.push(l)}return s.sort((o,l)=>o.blockRange[0]-l.blockRange[0])}function ZD(n,e){if(!e)return;const t=n.bySession[e];if(t)for(let a=t.order.length-1;a>=0;a--){const s=t.order[a];if(!s)continue;const o=t.activities[s];if(o&&(o.status==="running"||o.status==="waiting_user"||o.status==="paused"||o.status==="blocked"))return o}}function XD(n,e,t){var a;if(!(!e||!t))return(a=n.bySession[e])==null?void 0:a.taskTitles[t]}function QD(n){const e=Zn(a=>{var s;return n?(s=a.bySession[n])==null?void 0:s.taskTitles:void 0}),t=Ue(a=>n?a.messagesBySession[n]??[]:[]);if(!n||!e)return null;for(let a=t.length-1;a>=0;a--){const s=t[a];if(!s||s.type!=="assistant")continue;const o=e[s.id];if(o)return o}return null}const xp=["templates","plugins","connectors","skills","channels"],$o=mn()(oi(n=>({pinned:xp,moreExpanded:!1,morePinned:!1,togglePin:e=>n(t=>({pinned:t.pinned.includes(e)?t.pinned.filter(a=>a!==e):[...t.pinned,e]})),setMoreExpanded:e=>n({moreExpanded:e}),toggleMorePinned:()=>n(e=>({morePinned:!e.morePinned}))}),{name:"deepseekcode-nav-storage",merge:(n,e)=>{var s;const t=n??{},a=(s=t.pinned)!=null&&s.length?[...t.pinned,...xp.filter(o=>!t.pinned.includes(o))]:xp;return{...e,...t,pinned:a}}})),Gd=10;function JD({sessionId:n,fallback:e}){const t=QD(n);return y.jsx("span",{className:"min-w-0 flex-1 truncate",title:t??e,children:t??e})}const h3=["chat","plan","agentflow"],m3=O.memo(function({collapsed:e,onToggleCollapse:t,tabs:a,activeTab:s,onTabChange:o,isConnected:l,onNewSession:u,onStartTemplate:d,onManageTemplates:h,onSwitchSession:m,onCloseSession:p,onRenameSession:b,getTabTitle:x}){const{t:w}=vt(),_=Ke(fe=>fe.sessionTabs),T=Ke(fe=>fe.activeSessionId),N=Ke(fe=>fe.historySessions),E=Ke(fe=>fe.restoreHistorySession),B=Ke(fe=>fe.removeHistorySession),[L,j]=O.useState(!1),[F,Y]=O.useState(!1),[ee,te]=O.useState(null),[xe,De]=O.useState(""),[ce,ie]=O.useState(""),pe=O.useRef(null),we=$o(fe=>fe.pinned),q=$o(fe=>fe.moreExpanded),oe=$o(fe=>fe.morePinned),ge=$o(fe=>fe.togglePin),be=$o(fe=>fe.setMoreExpanded),Ve=$o(fe=>fe.toggleMorePinned),We=O.useMemo(()=>we.filter(fe=>!h3.includes(fe)).map(fe=>a.find(ct=>ct.id===fe)).filter(fe=>!!fe),[a,we]),ze=O.useMemo(()=>a.filter(fe=>!h3.includes(fe.id)&&!we.includes(fe.id)),[a,we]),Re=O.useCallback((fe,ct)=>{te(fe),De(ct),setTimeout(()=>{var Fe;return(Fe=pe.current)==null?void 0:Fe.select()},50)},[]),lt=O.useCallback(()=>{ee&&xe.trim()&&b(ee,xe.trim()),te(null)},[ee,xe,b]),kt=O.useCallback((fe,ct)=>{var Jt;const Fe=Ue.getState().getMessages(fe),Pe=[];Pe.push(`# ${ct||w("nav.chat")}`),Pe.push(""),Pe.push(`> ${w("chat.exportMd")} · ${new Date().toLocaleString()}`),Pe.push(""),Pe.push("---"),Pe.push(""),(!Fe||Fe.length===0)&&(Pe.push(w("chat.noSessions")),Pe.push(""));for(const Ht of Fe){if(Ht.deleted)continue;const yt=Ht.type==="user"?w("chat.you"):w("chat.assistantLabel");if(Pe.push(`## ${yt} · ${new Date(Ht.timestamp).toLocaleString()}`),Pe.push(""),Ht.thinking&&Ht.thinking.trim()&&(Pe.push("<details>"),Pe.push(`<summary>💭 ${w("chat.thoughtProcess")}</summary>`),Pe.push(""),Pe.push(Ht.thinking.trim()),Pe.push(""),Pe.push("</details>"),Pe.push("")),Ht.content&&Ht.content.trim()&&(Pe.push(Ht.content.trim()),Pe.push("")),Ht.steps&&Ht.steps.length>0){Pe.push(`**${w("chat.runningSteps")}:**`),Pe.push("");for(const Nn of Ht.steps){if(Pe.push(`- **${Nn.title}**${Nn.status?` (\`${Nn.status}\`)`:""}`),Nn.thought&&Pe.push(` - 💭 ${Nn.thought}`),(Jt=Nn.toolCalls)!=null&&Jt.length)for(const rr of Nn.toolCalls)Pe.push(` - 🛠 \`${rr.name}\``);Nn.result&&Pe.push(` - ${Nn.result}`)}Pe.push("")}Pe.push("---"),Pe.push("")}const Ce=new Blob([Pe.join(`
465
465
  `)],{type:"text/markdown;charset=utf-8"}),Ge=URL.createObjectURL(Ce),At=document.createElement("a");At.href=Ge,At.download=`${(ct||"session").replace(/[\\/:*?"<>|]/g,"_").slice(0,80)}.md`,At.click(),URL.revokeObjectURL(Ge)},[w]),En=O.useCallback(fe=>{E(fe),Oe.setSessionId(fe)},[E]),an=O.useCallback(fe=>{m(fe),s!=="chat"&&o("chat")},[m,o,s]),In=O.useCallback(fe=>{!_.some(Fe=>Fe.id===fe)?(En(fe),s!=="chat"&&o("chat")):an(fe)},[_,En,an,s,o]),gn=Ue(fe=>fe.generatingSessions),_a=O.useCallback(fe=>gn.includes(fe.id)?"running":fe.status||"done",[gn]),Ca=O.useMemo(()=>{const fe=new Map,ct=ce.trim().toLowerCase(),Pe=[...ct?_.filter(Ge=>{const At=Zd(Ge);return Ge.title.toLowerCase().includes(ct)||(Ge.project||"").toLowerCase().includes(ct)||(At||"").toLowerCase().includes(ct)}):_].sort((Ge,At)=>(At.lastActiveAt??At.createdAt??0)-(Ge.lastActiveAt??Ge.createdAt??0));let Ce=Pe;if(Pe.length>Gd){const Ge=Pe.slice(0,Gd),At=Pe.find(Jt=>Jt.id===T);At&&!Ge.some(Jt=>Jt.id===At.id)?Ce=[At,...Ge.filter(Jt=>Jt.id!==At.id)].slice(0,Gd):Ce=Ge}for(const Ge of Ce){const At=Ge.project||"default",Jt=fe.get(At)||[];Jt.push(Ge),fe.set(At,Jt)}return Array.from(fe.entries())},[_,T,ce]),Ta=O.useMemo(()=>{const fe=new Set(_.map(ct=>ct.id));return _.length+N.filter(ct=>!fe.has(ct.id)).length},[_,N]),la=(fe,ct)=>{const Fe=s===fe.id,Pe=fe.iconComponent,Ce=w(ct?"nav.unpin":"nav.pin");return e?y.jsx("button",{onClick:()=>o(fe.id),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-colors ${Fe?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:x(fe.id,fe.title),"aria-label":x(fe.id,fe.title),"aria-current":Fe?"page":void 0,children:Pe&&y.jsx(Pe,{size:17,"aria-hidden":"true"})},fe.id):y.jsxs("button",{onClick:()=>o(fe.id),className:"side-nav-item group","data-active":Fe,"aria-current":Fe?"page":void 0,children:[Pe&&y.jsx(Pe,{size:15,"aria-hidden":"true",className:"shrink-0"}),y.jsx("span",{className:"truncate",children:x(fe.id,fe.title)}),y.jsx("span",{role:"button",tabIndex:0,onClick:Ge=>{Ge.stopPropagation(),ge(fe.id)},onKeyDown:Ge=>{(Ge.key==="Enter"||Ge.key===" ")&&(Ge.stopPropagation(),ge(fe.id))},className:"ml-auto shrink-0 rounded p-0.5 text-dark-muted/60 opacity-0 transition-all hover:bg-dark-bg hover:text-dark-text group-hover:opacity-100",title:Ce,"aria-label":Ce,children:y.jsx(Dp,{size:11,"aria-hidden":"true",className:ct?"fill-current text-accent-blue":""})})]},fe.id)},pt=fe=>{if(ze.length===0)return null;const ct=`${w("nav.moreOptions")} (${ze.length})`,Fe=w(oe?"nav.unpinMore":"nav.pinMore"),Pe=e?y.jsx("button",{onClick:()=>be(!q),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-colors ${q?"bg-dark-hover text-dark-text":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:ct,"aria-label":ct,"aria-expanded":q,children:y.jsx(Lp,{size:17,"aria-hidden":"true"})},"more"):y.jsxs("div",{className:"group flex items-center",children:[y.jsxs("button",{onClick:()=>be(!q),className:`side-nav-item flex-1 ${q?"bg-dark-hover text-dark-text":""}`,"data-active":!1,"aria-expanded":q,children:[y.jsx(Lp,{size:15,"aria-hidden":"true",className:"shrink-0"}),y.jsx("span",{className:"truncate",children:w("nav.moreOptions")}),y.jsx("span",{className:"ml-auto rounded bg-dark-bg px-1.5 py-px text-[10px] text-dark-muted/70",children:ze.length}),y.jsx(ti,{size:13,"aria-hidden":"true",className:`shrink-0 text-dark-muted/70 transition-transform duration-150 ${q?"rotate-180":""}`})]}),y.jsx("span",{role:"button",tabIndex:0,onClick:Ge=>{Ge.stopPropagation(),Ve()},onKeyDown:Ge=>{(Ge.key==="Enter"||Ge.key===" ")&&(Ge.stopPropagation(),Ve())},className:"mr-1 shrink-0 rounded p-0.5 text-dark-muted/60 opacity-0 transition-all hover:bg-dark-bg hover:text-dark-text group-hover:opacity-100",title:Fe,"aria-label":Fe,children:y.jsx(Dp,{size:11,"aria-hidden":"true",className:oe?"fill-current text-accent-blue":""})})]},"more"),Ce=q&&y.jsx("div",{className:`mt-0.5 space-y-0.5 ${e?"flex flex-col items-center":""}`,children:ze.map(Ge=>la(Ge,!1))});return y.jsxs("div",{className:`${fe?"mt-1 border-t border-dark-border/40 pt-1":"mt-1.5 border-t border-dark-border/40 pt-1.5"}`,children:[Pe,Ce]},"more-section")};return y.jsxs("div",{className:"workbench-sidebar flex h-full flex-col",children:[y.jsxs("div",{className:`flex h-14 shrink-0 items-center gap-2.5 border-b border-dark-border/70 bg-dark-bg/20 ${e?"justify-center px-2":"px-4"}`,children:[y.jsx("img",{src:"/logo.svg",alt:"deepseekcode",className:"h-7 w-7 shadow-sm"}),!e&&y.jsx("span",{className:"flex-1 truncate text-[15px] font-semibold tracking-tight text-dark-text",children:"deepseekcode"}),y.jsx("button",{onClick:t,className:`rounded-md p-1.5 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text ${e?"hidden":""}`,title:w("nav.collapseSidebar"),"aria-label":w("nav.collapseSidebar"),children:y.jsx(MS,{size:16,"aria-hidden":"true"})})]}),y.jsx("div",{className:e?"p-2":"px-3 pt-3",children:d&&h?y.jsx(WD,{collapsed:e,onDirect:u,onStartTemplate:d,onManageTemplates:h}):y.jsxs("button",{onClick:u,className:"btn btn-primary w-full shadow-[0_8px_20px_rgb(var(--color-accent-blue)/0.14)]",children:[y.jsx(s0,{size:15,"aria-hidden":"true"}),w("chat.newSession")]})}),y.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar px-3 pb-2 min-h-0",children:[y.jsxs("nav",{className:"sticky top-0 z-10 border-b border-dark-border/50 bg-dark-surface pt-2",children:[(We.length>0||oe)&&y.jsxs("div",{className:`space-y-0.5 ${e?"flex flex-col items-center":""}`,children:[We.map(fe=>la(fe,!0)),oe&&pt(!0)]}),!oe&&pt(!1)]}),!e&&y.jsxs("div",{className:"pt-2",children:[y.jsxs("div",{className:"mb-2 flex items-center gap-2 rounded-lg border border-dark-border/70 bg-dark-bg/45 px-2.5 py-1.5 focus-within:border-accent-blue/45",children:[y.jsx(X3,{size:13,className:"shrink-0 text-dark-muted","aria-hidden":"true"}),y.jsx("input",{value:ce,onChange:fe=>ie(fe.target.value),className:"min-w-0 flex-1 bg-transparent text-xs text-dark-text placeholder:text-dark-muted/55 focus:outline-none",placeholder:w("nav.searchSessionsPlaceholder"),"aria-label":w("nav.searchSessions")}),ce&&y.jsx("button",{onClick:()=>ie(""),className:"rounded p-0.5 text-dark-muted hover:bg-dark-hover hover:text-dark-text","aria-label":w("nav.clearSessionSearch"),children:y.jsx(xr,{size:11,"aria-hidden":"true"})})]}),y.jsxs("div",{className:"side-group-label flex items-center justify-between",children:[y.jsx("span",{children:w("nav.sessions")}),N.length>0&&y.jsxs("button",{onClick:()=>j(fe=>!fe),className:"flex items-center gap-0.5 rounded px-1 py-0.5 text-dark-muted/70 transition-colors hover:text-dark-text",title:w("chat.sessionHistory"),"aria-expanded":L,children:[y.jsx(Tb,{size:11,"aria-hidden":"true"}),y.jsx(ti,{size:11,"aria-hidden":"true",className:`transition-transform ${L?"":"-rotate-90"}`})]})]}),y.jsxs("div",{className:"space-y-1.5",children:[Ca.map(([fe,ct])=>y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 text-[10px] text-dark-muted/70",children:[y.jsx(Y3,{size:10,"aria-hidden":"true",className:"shrink-0 opacity-60"}),y.jsx("span",{className:"truncate",children:fe==="default"?w("nav.mySessions"):fe}),y.jsx("span",{className:"ml-auto text-[9px] text-dark-muted/40",children:ct.length})]}),y.jsx("div",{className:"space-y-0.5",children:ct.map(Fe=>{const Pe=Fe.id===T,Ce=ee===Fe.id,Ge=_a(Fe),At=Ig(Fe.lastActiveAt??Fe.createdAt,Date.now(),w),Jt=Zd(Fe),Ht=lx(Fe.title,Jt);return y.jsxs("div",{onClick:()=>!Ce&&an(Fe.id),onDoubleClick:()=>Re(Fe.id,Fe.title),className:`group flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[6px] text-[13px] transition-colors ${Pe?"bg-dark-hover font-medium text-dark-text":"text-dark-muted hover:bg-dark-hover/60 hover:text-dark-text"}`,children:[y.jsx(z0,{size:13,"aria-hidden":"true",className:"shrink-0 opacity-60"}),Ce?y.jsx("input",{ref:pe,value:xe,onChange:yt=>De(yt.target.value),onBlur:lt,onKeyDown:yt=>{yt.key==="Enter"?lt():yt.key==="Escape"&&te(null)},onClick:yt=>yt.stopPropagation(),className:"min-w-0 flex-1 rounded border border-accent-blue bg-dark-bg px-1 py-0.5 text-xs text-dark-text outline-none",autoFocus:!0}):y.jsxs("span",{className:"min-w-0 flex-1",children:[y.jsxs("span",{className:"flex items-center gap-1.5",children:[y.jsx(JD,{sessionId:Fe.id,fallback:Fe.title}),Ge==="running"&&y.jsxs("span",{className:"pixel-spinner shrink-0 text-accent-red",title:w("nav.sessionRunning"),"aria-hidden":"true",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]}),Ge==="waiting"&&y.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-yellow",title:w("nav.sessionWaiting")}),Ge==="failed"&&y.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-red",title:w("nav.sessionFailed")}),Ge==="done"&&y.jsxs("span",{className:"pixel-grid shrink-0 text-accent-green",title:w("nav.sessionDone"),"aria-hidden":"true",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]}),y.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[11px] leading-tight text-dark-muted/50",children:[Ht&&y.jsx("span",{className:"min-w-0 flex-1 truncate",children:Jt}),y.jsx("span",{className:`shrink-0 ${Ht?"":"ml-auto"}`,children:At})]})]}),!Ce&&y.jsxs(y.Fragment,{children:[y.jsx("button",{onClick:yt=>{yt.stopPropagation(),Re(Fe.id,Fe.title)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100",title:w("chat.renameSession"),"aria-label":w("chat.renameSession"),children:y.jsx(RS,{size:11,"aria-hidden":"true"})}),y.jsx("button",{onClick:yt=>{yt.stopPropagation(),kt(Fe.id,Fe.title)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100",title:w("chat.exportMd"),"aria-label":w("chat.exportMd"),children:y.jsx(zc,{size:11,"aria-hidden":"true"})}),_.length>1&&y.jsx("button",{onClick:yt=>{yt.stopPropagation(),p(Fe.id)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100","aria-label":w("a11y.close"),children:y.jsx(xr,{size:12,"aria-hidden":"true"})})]})]},Fe.id)})})]},fe)),Ca.length===0&&y.jsx("div",{className:"px-2.5 py-2 text-xs text-dark-muted/60",children:w("chat.noSessions")})]}),Ta>Gd&&y.jsxs("button",{onClick:()=>Y(!0),className:"mt-1.5 flex w-full items-center justify-center gap-1 rounded-lg border border-dashed border-dark-border px-2 py-1.5 text-xs text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:w("chat.viewAllSessions"),children:[y.jsx(OS,{size:12,"aria-hidden":"true"}),w("chat.viewAllSessions"),y.jsxs("span",{className:"text-dark-muted/50",children:["(",Ta,")"]})]}),L&&N.length>0&&y.jsx("div",{className:"mt-1 space-y-0.5 border-t border-dark-border/50 pt-1",children:N.slice(0,10).map(fe=>{const ct=Zd(fe);return y.jsxs("div",{onClick:()=>En(fe.id),className:"group flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-xs text-dark-muted transition-colors hover:bg-dark-hover/60 hover:text-dark-text",children:[y.jsx(Tb,{size:11,"aria-hidden":"true",className:"shrink-0 opacity-50"}),y.jsxs("span",{className:"min-w-0 flex-1",children:[y.jsx("span",{className:"block truncate",children:fe.title}),ct&&y.jsx("span",{className:"block truncate text-[10px] text-dark-muted/50",children:ct})]}),y.jsx("span",{className:"shrink-0 text-[10px] text-dark-muted/50",children:Ig(fe.lastActiveAt??fe.createdAt,Date.now(),w)}),y.jsx("button",{onClick:Fe=>{Fe.stopPropagation(),B(fe.id)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100","aria-label":w("chat.removeFromHistory"),children:y.jsx(xr,{size:11,"aria-hidden":"true"})})]},fe.id)})})]})]}),y.jsxs("div",{className:`shrink-0 border-t border-dark-border/70 ${e?"p-2":"p-3"}`,children:[e&&y.jsx("button",{onClick:t,className:"mb-2 flex w-full items-center justify-center rounded-md p-1.5 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:w("nav.expandSidebar"),"aria-label":w("nav.expandSidebar"),children:y.jsx(DS,{size:16,"aria-hidden":"true"})}),y.jsxs("div",{className:`flex items-center gap-2 text-xs text-dark-muted ${e?"justify-center":"px-1.5"}`,role:"status","aria-label":w("a11y.connectionStatus"),children:[y.jsx("span",{className:`h-2 w-2 shrink-0 rounded-[1px] ${l?"bg-accent-green":"bg-accent-red"}`,"aria-hidden":"true"}),!e&&y.jsx("span",{className:"truncate",children:w(l?"chat.connected":"chat.disconnected")})]})]}),y.jsx(KD,{isOpen:F,onClose:()=>Y(!1),onSwitchSession:In})]})}),eL={info:"bg-accent-blue",warn:"bg-accent-yellow",error:"bg-accent-red",success:"bg-accent-green",tool:"bg-accent-purple"};function tL(n){return n==null||n===""?"-":new Date(n).toLocaleString()}function nL(){const{t:n}=vt(),[e,t]=O.useState([]),[a,s]=O.useState(!0),[o,l]=O.useState(null),[u,d]=O.useState(null),[h,m]=O.useState(!1),p=O.useCallback(async()=>{s(!0);try{const _=await ht.logs.list();_.success&&Array.isArray(_.data)&&t(_.data)}catch(_){console.error("Failed to load log files:",_)}s(!1)},[]);O.useEffect(()=>{p()},[p]);const b=O.useCallback(async _=>{if(!_.previewable)return;l(_),m(!0);const T=await ht.logs.read(_.name,500);T.success&&T.data&&d(T.data),m(!1)},[]),x=O.useCallback(()=>{l(null),d(null)},[]),w=_=>_<1024?`${_} B`:_<1024*1024?`${(_/1024).toFixed(1)} KB`:`${(_/(1024*1024)).toFixed(1)} MB`;return o&&u?y.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[y.jsxs("div",{className:"flex items-center gap-2 mb-2 shrink-0",children:[y.jsx("button",{onClick:x,className:"p-1 rounded hover:bg-dark-hover transition-colors",title:n("logs.backToList"),children:y.jsx(Xg,{size:16})}),y.jsx("span",{className:"text-sm font-medium text-dark-text truncate flex-1",children:o.name}),y.jsxs("a",{href:ht.logs.downloadUrl(o.name),download:o.name,className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent-blue text-white rounded hover:opacity-90 transition-opacity",children:[y.jsx(zc,{size:12}),n("logs.download")]})]}),h?y.jsx("div",{className:"flex-1 flex items-center justify-center",children:y.jsx(Ga,{size:20,className:"animate-spin text-accent-blue"})}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"text-[10px] text-dark-muted mb-1 shrink-0",children:[w(u.size)," · ",n("logs.totalLines",{count:u.totalLines}),u.startLine>1&&` ${n("logs.showingLatest",{count:u.totalLines-u.startLine+1})}`]}),y.jsx("div",{className:`flex-1 overflow-y-auto min-h-0 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all
466
- bg-dark-bg border border-dark-border rounded p-3 custom-scrollbar`,style:{scrollbarWidth:"thin",scrollbarColor:"#30363d transparent"},children:u.content||y.jsx("span",{className:"text-dark-muted italic",children:n("logs.emptyFile")})})]})]}):y.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[y.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[y.jsx("span",{className:"text-xs font-medium text-dark-text",children:n("logs.files")}),y.jsx("button",{onClick:p,className:"px-2 py-1 text-[10px] bg-dark-hover rounded hover:bg-dark-border transition-colors",disabled:a,children:n(a?"logs.refreshing":"logs.refresh")})]}),a?y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsx(Ga,{size:16,className:"animate-spin text-accent-blue"})}):e.length===0?y.jsxs("div",{className:"text-center py-8 text-dark-muted",children:[y.jsx(Jo,{size:32,className:"mx-auto mb-1 opacity-50"}),y.jsx("p",{className:"text-xs",children:n("logs.noFiles")})]}):y.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-1 custom-scrollbar",children:e.map(_=>y.jsxs("div",{className:"flex items-center gap-2 p-2 rounded hover:bg-dark-hover transition-colors group",children:[y.jsx(Jo,{size:14,className:"text-accent-blue shrink-0"}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("div",{className:"text-xs text-dark-text truncate",children:_.name}),y.jsxs("div",{className:"text-[10px] text-dark-muted",children:[w(_.size)," · ",tL(_.modified)]})]}),y.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[_.previewable&&y.jsx("button",{onClick:()=>b(_),className:"p-1.5 rounded hover:bg-dark-border transition-colors",title:n("logs.preview"),children:y.jsx(LS,{size:14})}),y.jsx("a",{href:ht.logs.downloadUrl(_.name),download:_.name,className:"p-1.5 rounded hover:bg-dark-border transition-colors block",title:n("logs.download"),children:y.jsx(zc,{size:14})})]})]},_.name))})]})}const p3=O.memo(O.forwardRef(function({logs:e},t){const{t:a}=vt();return y.jsx("div",{ref:t,className:"flex-1 overflow-y-auto min-h-0 font-mono text-xs space-y-0.5 custom-scrollbar",children:e.length===0?y.jsxs("div",{className:"text-center text-dark-muted py-12",children:[y.jsx(Ac,{size:48,className:"mx-auto mb-2 opacity-50"}),y.jsx("p",{children:a("logs.noLogs")})]}):e.map(s=>y.jsxs("div",{className:`p-2 rounded hover:bg-dark-surface transition-colors ${s.level==="error"?"bg-accent-red/10":s.level==="warn"?"bg-accent-yellow/10":s.level==="success"?"bg-accent-green/10":""}`,children:[y.jsx("span",{className:"text-dark-muted text-xs",children:new Date(s.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})})," ",y.jsx("span",{className:`px-1.5 py-0.5 rounded text-white text-xs ${eL[s.level]}`,children:s.level.toUpperCase()})," ",y.jsxs("span",{className:"text-dark-muted text-xs",children:["[",s.source,"]"]})," ",y.jsx("span",{className:"text-dark-text whitespace-pre-wrap break-all",children:s.message})]},s.id))})})),aL=O.memo(function({logs:e,onClear:t,compact:a}){const{t:s}=vt(),[o,l]=O.useState("stream"),u=O.useRef(null),d=O.useRef(!0),h=O.useCallback(()=>{const p=u.current;return p?p.scrollHeight-p.scrollTop-p.clientHeight<50:!0},[]),m=O.useCallback(()=>{const p=u.current;p&&(p.scrollTop=p.scrollHeight)},[]);return O.useEffect(()=>{const p=u.current;if(!p)return;const b=()=>{d.current=h()};return p.addEventListener("scroll",b,{passive:!0}),()=>p.removeEventListener("scroll",b)},[h]),O.useEffect(()=>{d.current&&m()},[e,m]),O.useEffect(()=>{const p=u.current;if(!p)return;let b=p.clientHeight;const x=new ResizeObserver(()=>{const w=p.clientHeight;w>0&&b===0&&m(),b=w});return x.observe(p),()=>x.disconnect()},[m]),a?y.jsxs("div",{className:"flex flex-col min-h-0 flex-1 p-2",children:[y.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[y.jsxs("h2",{className:"flex items-center gap-2 text-xs font-semibold",children:[y.jsx(Ac,{size:14,className:"text-accent-blue"}),s("logs.title"),y.jsxs("span",{className:"text-sm font-normal text-dark-muted",children:["(",e.length,")"]})]}),y.jsx("button",{onClick:t,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-2 py-1 text-[10px]",children:s("logs.clear")})]}),y.jsx(p3,{ref:u,logs:e})]}):y.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden p-4",children:[y.jsx("div",{className:"flex items-center justify-between mb-3 shrink-0",children:y.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[y.jsx(Ac,{size:18,className:"text-accent-blue"}),s("logs.backendLogs")]})}),y.jsx("div",{className:"flex gap-1 mb-3 shrink-0 border-b border-dark-border",children:[["stream",s("logs.streamTab"),Ac],["files",s("logs.files"),Jo]].map(([p,b,x])=>y.jsxs("button",{onClick:()=>l(p),className:`flex items-center gap-1.5 px-4 py-2 text-sm rounded-t transition-colors border-b-2 ${o===p?"border-accent-blue text-accent-blue bg-accent-blue/5":"border-transparent text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:[y.jsx(x,{size:14}),b,p==="stream"&&e.length>0&&y.jsxs("span",{className:"ml-1 text-[10px] text-dark-muted",children:["(",e.length,")"]})]},p))}),o==="stream"&&y.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[y.jsx("div",{className:"flex items-center justify-end mb-2 shrink-0",children:y.jsx("button",{onClick:t,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-3 py-1.5 text-sm",children:s("logs.clear")})}),y.jsx(p3,{ref:u,logs:e})]}),o==="files"&&y.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:y.jsx("div",{className:"border border-dark-border rounded-lg p-3 bg-dark-surface h-full",children:y.jsx(nL,{})})})]})}),rL=n=>{if(n==null||n==="")return{};if(typeof n!="string")return n;try{return JSON.parse(n)}catch{return n}},qd=(n,e="")=>typeof n=="string"?n:String((n==null?void 0:n.content)||(n==null?void 0:n.message)||(n==null?void 0:n.text)||(n==null?void 0:n.error)||e||""),sL=n=>Array.isArray(n)?n:Array.isArray(n==null?void 0:n.tasks)?n.tasks:Array.isArray(n==null?void 0:n.items)?n.items:Array.isArray(n==null?void 0:n.planTasks)?n.planTasks:[],wp=(n,e,t=0)=>{const a=String(n.id||n.taskId||n.backendId||`plan-task-${t+1}`),s=Sr(n.status||n.planStatus,n.completed),o=Date.now()+t;return{id:a,sessionId:e,title:String(n.title||n.name||n.content||n.description||`Task ${t+1}`),description:n.description||n.details||n.content,status:s,source:"plan",agentType:n.agentType||n.agent||n.role,progress:n.progress!=null?Number(n.progress):void 0,result:n.result,error:n.error,dependencies:Array.isArray(n.dependencies)?n.dependencies.map(String):void 0,startedAt:n.startedAt?Number(n.startedAt):s==="running"?o:void 0,completedAt:n.completedAt?Number(n.completedAt):s==="completed"||s==="failed"?o:void 0,createdAt:n.createdAt&&Number(n.createdAt)||o,updatedAt:o,raw:n}},g3=(n,e,t=0)=>{const a=String(n.id||n.taskId||n.backendId||`goal-task-${t+1}`),s=Sr(n.status),o=Date.now()+t;return{id:a,sessionId:e,title:String(n.title||n.name||n.content||n.description||`Task ${t+1}`),description:n.description||n.details||n.content,status:s,source:"goal",agentType:n.agentType||n.agent||n.role,progress:n.progress!=null?Number(n.progress):void 0,result:n.result,error:n.error,dependencies:Array.isArray(n.parentIds)?n.parentIds.map(String):void 0,startedAt:n.startedAt?Number(n.startedAt):s==="running"?o:void 0,completedAt:n.completedAt?Number(n.completedAt):s==="completed"||s==="failed"?o:void 0,createdAt:n.createdAt&&Number(n.createdAt)||o,updatedAt:n.updatedAt?Number(n.updatedAt):o,raw:n}},iL=(n,e)=>{const t=String((e==null?void 0:e.taskId)||(e==null?void 0:e.id)||"");if(!t)return;const a=wt.getState().getTasksForSession(n).find(u=>u.id===t),s=Ke.getState().getSessionTasks(n).find(u=>u.id===t||u.backendId===t),o=e!=null&&e.status?Sr(e.status):(a==null?void 0:a.status)||"pending",l={id:t,sessionId:n,title:(e==null?void 0:e.title)||(a==null?void 0:a.title)||(s==null?void 0:s.title)||t,description:(e==null?void 0:e.description)??(a==null?void 0:a.description)??(s==null?void 0:s.description),status:o,source:"goal",agentType:(e==null?void 0:e.agentType)||(a==null?void 0:a.agentType),progress:(e==null?void 0:e.progress)!=null?Number(e.progress):a==null?void 0:a.progress,result:(e==null?void 0:e.result)??(a==null?void 0:a.result),error:(e==null?void 0:e.error)??(a==null?void 0:a.error),startedAt:o==="running"?Date.now():a==null?void 0:a.startedAt,completedAt:o==="completed"||o==="failed"?Date.now():a==null?void 0:a.completedAt,createdAt:(a==null?void 0:a.createdAt)||Date.now(),updatedAt:Date.now(),raw:e};return wt.getState().upsertTask(n,l),zg(n,l),l},Cc=n=>({id:n.id,title:n.title,completed:n.status==="completed",createdAt:n.createdAt,description:n.description,planStatus:n.status,agentType:n.agentType,dependencies:n.dependencies,result:n.result,error:n.error,startedAt:n.startedAt,completedAt:n.completedAt,progress:n.progress}),zg=(n,e)=>{const t=Ke.getState(),a=t.getSessionTasks(n),s=Cc(e);if(a.some(o=>o.id===e.id||o.backendId===e.id)){t.updateTaskPlanStatus(n,e.id,s);return}t.setSessionTasks(n,[...a,s])},Vd=n=>{const e=Ue.getState(),t=e.getMessages(n),a=t[t.length-1];(!a||a.type!=="assistant")&&e.addMessage(n,{id:`plan-${Date.now()}`,type:"assistant",content:"",timestamp:Date.now()})};function y3(n,e,t){const a=Zo.getState(),s=Ue.getState(),o=wt.getState(),l=rL(e);switch(n){case"plan_start":{s.startGeneration(t),Vd(t);const u=qd(l,"Plan started");u&&a.setThinkingStatus(t,u),o.recordEvent(t,{type:n,source:"plan",title:"Plan started",message:u,status:"running",data:l});break}case"plan_thinking":{const u=qd(l,"Analyzing request...");a.setThinkingStatus(t,u),Vd(t),s.setThinking(t,u),o.recordEvent(t,{type:n,source:"plan",title:"Plan thinking",message:u,status:"running",data:l});break}case"plan_complete":{const u=(l==null?void 0:l.plan)||(l==null?void 0:l.content)||(l==null?void 0:l.result)||(l==null?void 0:l.markdown);if(u){a.setPlanContent(String(u)),Vd(t);const d=s.getMessages(t),h=d[d.length-1];(h==null?void 0:h.type)==="assistant"&&!h.content.trim()&&s.updateLastMessage(t,String(u))}else{const d=[...s.getMessages(t)].reverse().find(h=>h.type==="assistant");d!=null&&d.content&&a.setPlanContent(d.content)}s.endGeneration(t),o.recordEvent(t,{type:n,source:"plan",title:"Plan complete",message:qd(l,"Plan complete"),status:"completed",data:l});break}case"plan_error":{const u=qd(l,"Plan failed");Vd(t),s.updateLastMessage(t,`Plan failed: ${u}`),s.endGeneration(t,u),o.recordEvent(t,{type:n,source:"plan",title:"Plan failed",message:u,status:"failed",data:l});break}case"plan_tasks":{const u=sL(l).map((d,h)=>wp(d,t,h));o.setTasks(t,u,"plan"),Ke.getState().setSessionTasks(t,u.map(Cc)),o.recordEvent(t,{type:n,source:"plan",title:"Plan tasks updated",message:`${u.length} tasks`,status:"pending",data:l});break}case"plan_task_start":case"plan_task_update":case"plan_task_result":{const u=wp(l,t),d=n==="plan_task_start"?"running":Sr(n==="plan_task_result"?l.status||(l.error?"failed":"completed"):l.status||l.planStatus),h={...u,status:d,startedAt:u.startedAt||(d==="running"?Date.now():void 0),completedAt:u.completedAt||(d==="completed"||d==="failed"?Date.now():void 0)};o.upsertTask(t,h),zg(t,h),o.recordEvent(t,{type:n,source:"plan",title:h.title,message:h.result||h.error||h.description,status:h.status,taskId:h.id,data:l});break}case"plan_task_complete":{const u=wp(l,t),d=String(l.status||"")==="failed"||!!l.error,m={...u,status:d?"failed":"completed",completedAt:u.completedAt||Date.now()};o.upsertTask(t,m),zg(t,m),o.recordEvent(t,{type:n,source:"plan",title:m.title,message:m.result||m.error||m.description,status:m.status,taskId:m.id,data:l});const p=m.title||`task ${m.id}`;d?Ze.error(`✘ ${p} 失败`,6e3):Ze.success(`✓ ${p} 完成`,4e3);break}case"plan_subagent_start":{const u=(l==null?void 0:l.scope)||(l==null?void 0:l.agentId)||"design sub-agent";o.recordEvent(t,{type:n,source:"plan",title:`设计子代理: ${u}`,message:(l==null?void 0:l.title)||"Reading codebase and designing implementation details...",status:"running",data:l});break}case"plan_subagent_done":{const u=(l==null?void 0:l.scope)||(l==null?void 0:l.agentId)||"design sub-agent",d=(l==null?void 0:l.status)==="error"||(l==null?void 0:l.status)==="timeout"||(l==null?void 0:l.status)==="max_iterations"||!!(l!=null&&l.error);o.recordEvent(t,{type:n,source:"plan",title:`设计子代理: ${u}`,message:d?`设计失败: ${(l==null?void 0:l.error)||(l==null?void 0:l.status)||"error"}`:l!=null&&l.designDocPath?`设计完成 → ${l.designDocPath}`:"设计完成",status:d?"failed":"completed",data:l});break}case"plan_mode_change":{const u=(l==null?void 0:l.frontendMode)||(l==null?void 0:l.newMode),d=l==null?void 0:l.planPath;u==="normal"?a.applyBackendMode("normal"):u==="auto"?a.setAuto(!0):(u==="plan"||u==="act"||u==="goal"||u==="auto-plan"||u==="auto-act"||u==="auto-goal")&&a.applyBackendMode(u);const h=d?` [plan: ${d}]`:"";o.recordEvent(t,{type:n,source:"system",title:"Mode changed",message:`${(l==null?void 0:l.previousMode)||"unknown"} -> ${u||"unknown"}${h}`,status:(l==null?void 0:l.success)===!1?"failed":"completed",data:l});break}case"goal_created":{o.recordEvent(t,{type:n,source:"goal",title:(l==null?void 0:l.goalTitle)||(l==null?void 0:l.title)||"Goal created",message:l!=null&&l.goalId?`Goal ${l.goalId}`:"Goal created",status:"pending",data:l});break}case"goal_tasks":{const u=Array.isArray(l==null?void 0:l.tasks)?l.tasks.map((d,h)=>g3(d,t,h)):[];o.setTasks(t,u,"goal"),Ke.getState().setSessionTasks(t,u.map(Cc)),o.recordEvent(t,{type:n,source:"goal",title:(l==null?void 0:l.goalTitle)||"Goal tasks",message:`${u.length} tasks`,status:"pending",data:l});break}case"goal_task_update":{const u=String((l==null?void 0:l.taskId)||(l==null?void 0:l.id)||""),d=iL(t,l);o.recordEvent(t,{type:n,source:"goal",title:(d==null?void 0:d.title)||u||"Goal task update",message:(l==null?void 0:l.result)||(l==null?void 0:l.error)||(l!=null&&l.status?`status: ${l.status}`:"updated"),status:d==null?void 0:d.status,taskId:u||void 0,data:l});break}case"goal_update":{const u=Array.isArray(l==null?void 0:l.tasks)?l.tasks.map((d,h)=>g3(d,t,h)):[];o.setTasks(t,u,"goal"),Ke.getState().setSessionTasks(t,u.map(Cc)),o.recordEvent(t,{type:n,source:"goal",title:(l==null?void 0:l.goalTitle)||(l==null?void 0:l.title)||"Goal update",message:(l==null?void 0:l.status)||(l!=null&&l.id?`Goal ${l.id}`:"Goal updated"),status:l!=null&&l.status?Sr(l.status):void 0,data:l});break}case"goal_completed":{const u=String((l==null?void 0:l.goalId)||""),d=o.getTasksForSession(t).filter(h=>h.source==="goal");if(d.length>0){const h=d.map(m=>m.status==="pending"||m.status==="running"?{...m,status:"completed",completedAt:Date.now(),updatedAt:Date.now()}:m);o.setTasks(t,h,"goal"),Ke.getState().setSessionTasks(t,h.map(Cc))}o.recordEvent(t,{type:n,source:"goal",title:l!=null&&l.goalTitle?`Goal 完成: ${String(l.goalTitle).slice(0,60)}`:"Goal completed",message:l!=null&&l.result?String(l.result).slice(0,200):u?`Goal ${u} completed`:"Goal completed",status:"completed",data:l});break}}}const oL={confirm:"确认",cancel:"取消",save:"保存",saving:"保存中...",delete:"删除",close:"关闭",refresh:"刷新",retry:"重试",loading:"加载中...",collapse:"折叠",expand:"展开",collapse_short:"收起",clear:"清空",noData:"暂无数据",noResults:"暂无结果",unknown:"未知",unknownError:"未知错误",connecting:"连接中…",back:"返回",send:"发送",copy:"复制",copied:"已复制",search:"搜索...",filter:"全部",pageInfo:"显示 {{start}}-{{end}} 条,共 {{total}} 条",prevPage:"上一页",nextPage:"下一页",enabled:"已启用",disabled:"已禁用",online:"在线",offline:"离线",busy:"忙碌",away:"离开",default:"默认"},lL={chat:"对话",terminal:"终端",files:"文件",models:"模型",tools:"工具",skills:"技能",templates:"预设",hooks:"Hooks",agentFlow:"Agent Flow",settings:"设置",logs:"日志",channels:"频道",sessions:"会话",groupWorkspace:"工作台",groupConfig:"配置",groupSystem:"系统",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",moreOptions:"更多",scheduled:"定时任务",plugins:"插件",mySessions:"我的会话",sessionRunning:"运行中",sessionWaiting:"待确认",sessionFailed:"失败",sessionDone:"已完成",connectors:"连接器",pin:"置顶",unpin:"取消置顶",pinMore:"置顶「更多」",unpinMore:"取消置顶「更多」",clearSessionSearch:"清除会话搜索",searchSessions:"搜索会话",searchSessionsPlaceholder:"搜索会话..."},cL={newSession:"新建会话",noSessions:"暂无会话",renameSession:"重命名会话",exportMd:"导出为 Markdown",you:"你",thinkingEllipsis:"思考中…",messageRail:"消息导航",messageIndex:"对话索引",backToBottom:"回到最新消息",generatingPlaceholder:"AI 正在生成中…",defaultSessionTitle:"对话 {{n}}",welcome:"欢迎使用 deepseekcode",welcomeDesc:"我可以帮你编写代码、分析项目、自动化任务。试试发送一条消息吧!",suggestionCode:"代码编写",suggestionCodePrompt:"用 Python 实现快速排序,并解释它的时间复杂度",suggestionAnalyze:"代码分析",suggestionAnalyzePrompt:"分析当前项目的目录结构,告诉我它是如何组织的",suggestionAutomate:"自动化任务",suggestionAutomatePrompt:"帮我写一个脚本,自动整理当前目录下的文件",quickCommands:"查看快捷命令",refFiles:"引用文件",inputPlaceholder:"输入消息... Shift+Enter 换行,/ 命令,@ 引用文件,↑ 历史",charTokens:"{{chars}} 字符 · ~{{tokens}} tokens",nearLimit:"接近上限",shiftEnter:"Shift+Enter 换行",escHint:"Esc 暂停 · 双击 Esc 停止",resume:"恢复",resumeGen:"恢复生成",stop:"终止",stopGen:"终止生成",pause:"暂停",pauseGen:"暂停生成",sendBtn:"发送",voiceInput:"语音输入",voiceListening:"正在聆听...",voiceTranscribing:"识别中...",voiceUnsupported:"当前浏览器不支持语音输入",voiceError:"语音识别出错,请重试",connected:"已连接",disconnected:"未连接",sessionHistory:"会话历史",noHistory:"暂无历史会话",clearHistory:"清空历史",clearHistoryTitle:"清空历史",restoreSession:"点击恢复「{{title}}」",removeFromHistory:"从历史移除",viewAllSessions:"更多会话",allSessions:"全部会话",sessionPickerTitle:"选择会话",clickToOpenSession:"打开会话",workingDir:"工作目录",switchDir:"切换",clickToSwitchDir:"点击切换工作目录",switchDirPrompt:"请输入新的工作目录路径:",addTask:"添加",addTaskPlaceholder:"添加任务...",noTasks:"暂无任务,在上方输入添加",taskBoardDragHint:"下拉展开 · 上推收起 · 点击切换",doubleClickEdit:"双击编辑",deleteTask:"删除任务",backgroundLogs:"后台日志",effort:"推理力度",effortOff:"关闭思考",effortLow:"低",effortMedium:"中",effortHigh:"高",effortExtraHigh:"超高",effortMax:"最高",noWorkspaceDir:"未设置工作目录",recentDirs:"最近记录",noRecentDirs:"暂无最近目录",chooseOtherDir:"选择其他目录…",dirPickerTitle:"选择工作目录",dirPickerEnterPath:"输入完整路径后回车跳转",dirPickerGo:"跳转",dirPickerUp:"上一级",dirPickerNoDirs:"无子目录",dirPickerConfirm:"选择此目录",dirPickerLoadError:"目录读取失败",artifactPanel:"AI 输出物",workspaceTitle:"工作台",workspaceToggle:"切换到工作台",artifactsToggle:"切换到输出物",workspaceHint:"工作台为 AI Agent 工作区:组件按动态布局加载,可响应事件与命令。",artifactEmpty:"暂无输出文件。点击聊天中的文件 / 路径链接即可在右侧预览。",artifactHint:"点击聊天中的文件 / 路径链接即可在右侧预览;拖拽边缘可调整宽度,右上角可最大化",previewInPanel:"预览",backToArtifacts:"返回清单",openInNewTab:"新标签页打开",copyPath:"复制路径",copiedPath:"已复制路径",copyPathFailed:"复制失败",filePreviewHint:"该文件类型不支持内嵌预览,可下载或在新标签页中打开。",sidebarProgress:"进度",sidebarArtifacts:"AI 输出物",sidebarOpen:"打开",sidebarOpenFolder:"打开首个输出文件",sidebarExpandAll:"展开全部",sidebarMaximize:"最大化",sidebarRestore:"恢复大小",sidebarWorking:"正在处理…",sidebarWorkingWithAgents:"正在处理({{n}} 个 Agent 运行中)…",sidebarWorkingToolcalls:"正在处理(已调用 {{n}} 次工具)…",sidebarIdle:"多步骤任务运行时,进度会显示在这里:计划、工具调用、审批与产出文件。",sidebarMoreTasks:"更多任务",sidebarRunningAgents:"{{n}} 个 Agent 运行中",sidebarToolcallsSoFar:"已调用 {{n}} 次工具",tokenPrompt:"提示词",tokenCompletion:"补全",tokenTotal:"总计",totalChars:"总字符数",avgTokens:"平均 token/条",estimatedCost:"预估成本: ${{cost}}",contextTrimming:"上下文裁剪",keepMore:"保留更多",trimMore:"裁剪更多",trimContext:"裁剪上下文 (保留 ~{{n}} 条消息)",currentMessages:"当前 {{n}} 条消息",totalCharsInfo:"· 共 {{n}} 字符",contextManager:"上下文管理",showContext:"显示上下文信息",taskBoard:"任务看板",morePending:"还有 {{n}} 个待处理任务...",moreCompleted:"还有 {{n}} 个已完成任务...",dependencyCount:"🔗 依赖 {{n}} 个任务",contextSuggestions:"展开 ({{n}}条建议)",collapseSuggestions:"收起",toolRequest:"工具请求: ",toolResult:"工具结果: ",memory:"记忆: ",filesCount:"({{n}}文件)",saveTokens:"可节省 ~{{n}}",ignoreSuggestion:"忽略此建议",fileMention:"@ 引用文件",fileMentionSearch:'@ 搜索: "{{query}}"',fileMentionHelp:"↑↓ 选择 · Enter 插入 · Esc 关闭",fileBrowser:"文件浏览器",fileSaved:"文件已保存",fileReadError:"读取文件失败",fileSaveError:"保存失败",fileModified:"● 已修改",selectFilePreview:"选择文件以预览或编辑",kbdHint:"命令面板",clickToSwitchMode:"点击切换模式 (Plan → Goal → Act)",selectModel:"选择模型",clickToSelectModel:"选择模型 / 推理力度",noEnabledModels:"暂无可用模型",globalDefault:"全局默认",planDefault:"Plan 默认",actDefault:"Act 默认",goalDefault:"Goal 默认",followGlobalDefault:"跟随全局默认",followGlobalDefaultHint:"清除本模式默认,回退到全局默认",sessionModel:"会话",sessionModelTitle:"仅本会话生效的模型覆盖(全局默认未改变)",noGlobalDefault:"未设置全局默认",browseMoreModels:"浏览 Provider 更多模型…",backToModels:"返回模型列表",selectProvider:"选择 Provider",searchModels:"搜索模型…",loadingModels:"加载模型列表…",noModelsFound:"未找到匹配的模型",noProviderModels:"该 Provider 暂无可用的模型列表",noConfiguredProviders:"暂未配置 Provider",addAndSwitch:"添加并切换",alreadyAdded:"已添加",addingModel:"添加中…",currentModel:"当前模型",loadModelsFailed:"获取模型列表失败",addModelFailed:"添加模型失败",switchModelFailed:"切换模型失败",modelsSourceProviderApi:"实时从 Provider API 获取",modelsSourceCatalog:"来自模型目录 (models.dev)",assistantLabel:"DeepSeekCode",thoughtProcess:"思维过程",runningSteps:"执行中",stepCount:"步",stepCountPlural:"步",copyMessage:"复制",regenerate:"重新生成",deleteMessage:"删除消息",historyCount:"{{n}} 条",startChatHint:"请先开始对话",panelTitle:"面板",messageDeleted:"消息已删除",thinking:"思考中",askAnswerPlaceholder:"输入您的回答...",askAnswered:"✓ 已回答",askAutoContinue:"⏱ {{seconds}}s 后未回答将自动按推荐项继续",askBackToEdit:"返回修改",askBatchTitle:"批量确认",askConfirmQuestion:"确认本题",askCustomDesc:"输入自定义答案",askCustomTag:"(自定义)",askDirectTag:"(直接继续)",askEmptyInputValue:"(用户未输入)",askEnterHint:"Enter 提交,Shift+Enter 换行",askFinishQuestion:"完成本题 ({{count}} 项)",askMultiHintBatch:"点击选项勾选,再点击「完成本题」提交本题;「推进」表示按 AI 判断继续",askMultiHintSingle:"点击选项勾选,再点击「提交所选」提交;「推进」表示按 AI 判断继续",askNextQuestion:"下一题",askNotAnswered:"未回答",askOtherLabel:"其他(我来说明)",askPendingBadge:"待回答",askPrevQuestion:"上一题",askProceedDesc:"不选具体项,按你的最佳判断继续",askProceedLabel:"推进",askReviewTitle:"确认答案",askSingleHintBatch:"点击选项完成本题自动进入下一题,或点击「确认本题」提交当前高亮项",askSingleHintSingle:"点击选项立即提交,或点击下方「提交」确认当前选项",askSingleTitle:"请回答",askSubmit:"提交",askSubmitAll:"提交全部答案",askSubmitSelected:"提交所选 ({{count}} 项)",askSubmitting:"提交中...",askUnansweredValue:"(用户未回答)",askUnansweredWarning:"有 {{count}} 题未回答,将记为「未回答」。点击上方题号可回到对应题目修改。",askViewSubmit:"查看提交",assemblyOrderHint:"按后端上下文组装顺序(上→下):系统提示词 → 系统工具 → MCP 工具 → 技能 → 消息 → 其他(估算差额)",avgCacheHitRate:"平均缓存命中率",byAssemblyOrder:"按组装顺序 ↓",cacheHitTitle:"缓存命中 {{hit}} / 未命中 {{miss}}({{calls}} 次调用)",cacheNoStats:"暂无缓存统计(provider 未返回 prompt_cache_hit/miss 字段)",cacheWaitingRun:"本轮 run 进行中,等待 provider 上报缓存统计",categoryBreakdown:"分类占比",contextCapacity:"上下文容量",ctxMcpTools:"MCP 工具",ctxMessages:"消息",ctxOther:"其他",ctxSkills:"技能",ctxSystemPrompt:"系统提示词",ctxSystemTools:"系统工具",distAssistantMessages:"助理消息",distToolRequest:"工具请求",distToolResult:"工具结果",distUserMessages:"用户消息",duplicateReads:"⚠️ 重复读取: {{pct}}%",enterInsertMulti:"Enter 插入 · 可连续多选",fileMentionHelpMulti:"↑↓ 选择 · Enter 插入(可连续多选)· Esc 关闭",finishMention:"完成引用",keepPercent:"{{pct}}% 保留",lastCompactInfo:"上次压缩: {{orig}}→{{comp}} · {{saved}} tok",noMatchingFiles:"未找到匹配的文件",saveAsTemplate:"保存为模板",searchingFiles:"搜索文件中...",selectedCountShort:"已选 {{n}}",selectedFilesCount:"已选 {{n}} 个文件",templateLibrary:"模板库",tokenDistribution:"Token 分布",unitWan:"万",unitYi:"亿",viewContextDetail:"查看上下文容量详情",loading:"加载中…",applyScopeGlobal:"全局",applyScopeSession:"仅本会话",sessionScopeHint:"仅对当前会话生效,不改变全局默认"},uL={title:"键盘快捷键",commandPalette:"打开命令面板",clearLogs:"清空日志",help:"显示快捷键帮助",submit:"提交输入",newline:"换行",closeDialog:"关闭弹窗 / 暂停生成",slashCommand:"快捷命令",fileRef:"引用文件",stopGen:"终止生成(连按两次 Esc)"},dL={placeholder:"搜索命令或跳转面板...",navGroup:"导航",commandGroup:"命令",empty:"没有匹配的命令",hint:"↑↓ 选择 · Enter 执行 · Esc 关闭",running:"执行中..."},fL={openMenu:"打开菜单",closeMenu:"关闭菜单",close:"关闭",expand:"展开",collapse:"折叠",delete:"删除",remove:"移除",send:"发送消息",newSession:"新建会话",messageInput:"消息输入框",connectionStatus:"连接状态",loading:"加载中",toggleAgentFlow:"切换 Agent 信息流",commandPalette:"命令面板",shortcutsHelp:"快捷键帮助"},hL={mode:"模式",planMode:"Plan 模式 — 只读分析",planModeDesc:"在 Plan 模式下,AI 将使用只读工具分析需求和代码,不会修改任何文件。",planModeHint:"分析完成后,请切换到 Act 模式执行具体实现。",switchToAct:"切换到 Act 模式执行",actMode:"Act 模式",actModeDesc:"在 Act 模式下,AI 可以读取、修改文件并执行命令。",actModeHint:"需要先分析需求?切换到 Plan 模式进行只读探索。",switchToPlan:"切换到 Plan 模式分析",readOnlyMode:"只读模式",planTitle:"Plan Mode:只读探索,不能修改代码",actTitle:"Act Mode:可以读写和执行",switchToPlanMode:"切换到规划模式",switchToActMode:"切换到执行模式",autoMode:"自动模式:自动批准工具调用",goalMode:"Goal 模式",planModeShort:"只读分析与规划,不修改文件",actModeShort:"读写文件并执行命令",goalModeShort:"围绕目标持续推进直到完成",autoApprove:"Auto 自动批准",autoApproveShort:"自动批准所有工具调用",planContent:"Plan 文件内容",analyzing:"正在分析需求...",modePlanTitle:"Plan 模式 — 只读探索",modePlanDesc:"只读模式。AI 只能读取文件和分析代码,不能进行任何修改。分析完成后使用 ExitPlanMode 切换到 Act 模式执行。",modeActTitle:"Act 模式 — 执行",modeActDesc:"读写模式。AI 可以读取、修改文件并执行命令。低风险操作自动放行,高风险操作需要确认。",modeGoalTitle:"Goal 模式 — 目标任务",modeGoalDesc:"面向目标的执行模式。AI 在活跃任务范围内可以读写和执行,超出范围的操作需要确认。",modeNormalTitle:"Normal 模式 — 标准交互",modeNormalDesc:"标准交互模式。所有工具正常使用,写操作和命令执行需要用户确认。",readOnlyBadge:"🔒 只读",autoApproveBadge:"✅ 自动审批",toPlanMode:"切换到 Plan 模式",toActMode:"切换到 Act 模式",modeCycleHint:"模式切换: Plan → Act → Goal 循环,Auto 为独立开关"},mL={title:"更新内容"},pL={title:"设置",theme:"主题",themeDark:"🌙 深色",themeLight:"☀️ 浅色",themeAuto:"🔄 自动",themePresets:"主题预设",themePresetLinear:"极简 Linear",themePresetLinearDesc:"中性灰 + 单一强调色 — 极简专业",themePresetGithub:"GitHub 默认",themePresetGithubDesc:"中性暗/亮色 — 简洁专业",themePresetCherry:"Cherry Studio",themePresetCherryDesc:"蓝色渐变 — 清爽科技感",themePresetOcean:"海洋 Ocean",themePresetOceanDesc:"深蓝/青色 — 冷静专业",themePresetMint:"薄荷 Mint",themePresetMintDesc:"青绿/薄荷 — 清新爽朗",themePresetLavender:"薰衣草 Lavender",themePresetLavenderDesc:"柔紫 — 优雅精致",themePresetMidnight:"午夜 Midnight",themePresetMidnightDesc:"深海军蓝 — 极简高对比",themePresetSunset:"日落 Sunset",themePresetSunsetDesc:"暖橙/金色 — 活力充沛",themePresetForest:"森林 Forest",themePresetForestDesc:"自然绿 — 大地色系宁静",themePresetCandy:"糖果 Candy",themePresetCandyDesc:"明亮多彩 — 活泼生动",themePresetNord:"Nord",themePresetNordDesc:"北极蓝 — 流行精心设计",customOverrides:"自定义覆盖",customOverridesHint:"调整单个颜色以覆盖当前主题预设",customColors:"自定义配色",colorBg:"背景色",colorSurface:"面板色",colorBorder:"边框色",colorText:"文字色",colorMuted:"次要文字",colorAccentBlue:"强调蓝",colorAccentGreen:"强调绿",colorAccentRed:"强调红",colorAccentYellow:"强调黄",colorAccentPurple:"强调紫",resetColors:"重置为默认配色",about:"关于",aboutDesc:"基于 Web 的 AI 编码助手界面",whatsNew:"查看更新内容",language:"语言",languageZh:"中文",languageEn:"English",display:"界面",developerView:"开发者视图(显示原始工具调用)",developerViewHint:"默认显示 AI 活动摘要;开启后显示原始工具日志",capabilities:{title:"Agent 能力管理",loadFailed:"能力配置加载失败",toggleFailed:"切换失败"},contextOffload:{title:"Context Offload(工具结果外置)",desc:"大体积工具输出不再整体进入上下文,而是存入磁盘 artifact 存储,上下文中只保留摘要与句柄;AI 需要细节时通过 artifact_query / artifact_read 按需取回。可显著降低长会话的 token 占用并提升缓存命中率。",enableLabel:"启用工具结果外置",currently:"当前生效",maxTotalMb:"存储总容量上限(MB)",ttlDays:"保留天数",outboundBytes:"外置触发阈值(字节,工具输出超过即外置)",turnBudget:"单轮上下文增长预算(token)",dir:"存储目录",optional:"可选,留空使用默认",stats:"当前已存储 {{count}} 个 artifact,共 {{size}} MB",saved:"Context Offload 设置已保存",saveFailed:"保存失败",invalidNumber:"数字字段必须为正整数",envHint:"标有 ⚠ env 的字段被同名环境变量覆盖,修改环境变量后重启生效"}},gL={title:"模型配置",providerConfig:"Provider 配置",configured:"已配置",notConfigured:"未配置",modelsCount:"{{n}} 个模型 · {{apiType}}",clickToConfig:"点击配置 →",apiKeyHint:"已配置 API Key,输入新 Key 将覆盖旧配置。",apiKeyPlaceholder:"输入新 Key 以覆盖...",apiKeyDefaultPlaceholder:"sk-...",enterApiKey:"请输入 API Key",removeConfirm:'确定要移除 "{{providerKey}}" 的配置吗?这将删除其 API Key 和模型。',loadFailed:"加载模型失败",saveFailed:"保存失败",overallStatus:"总体状态",healthy:"健康",degraded:"降级",abnormal:"异常",healthRate:"健康率",onlineInstances:"在线实例",totalRequests:"总请求数",configuredModels:"已配置模型",addModel:"添加模型",provider_qwen:"通义千问 (Qwen)",provider_glm:"智谱 (GLM)",provider_baichuan:"百川 (Baichuan)",provider_minimax:"MiniMax / 海螺",provider_doubao:"豆包 (Doubao)",provider_hunyuan:"腾讯混元 (Hunyuan)",provider_spark:"讯飞星火 (Spark)",provider_custom:"Custom (自定义)",globalShort:"全局",setDefaultProvider:"设为默认 Provider",deleteProviderConfirm:'确定要删除 "{{key}}" 的配置吗?',deleteProvider:"删除 Provider",catalogTitle:"models.dev 模型目录搜索",catalogSearchPlaceholder:"搜索全厂商模型,如 gpt-4o / deepseek / claude ...(匹配模型 id / 名称 / 厂商)",catalogOnlyToolCall:"仅工具调用",catalogOnlyReasoning:"仅推理模型",searching:"搜索中...",catalogNoResults:"无匹配模型,换个关键词试试",badgeReasoning:"推理",badgeToolCall:"工具",badgeMultimodal:"多模态",ctxLimit:"上下文 {{k}}K",outLimit:"输出 {{k}}K",catalogAddTitle:"添加到模型 ID 输入框",add:"添加",catalogSourceHint:"数据源:models.dev 模型目录(内置快照,离线可用)。点击「添加」将模型 ID 写入「模型 ID」输入框。",baseUrlRequired:"请先填写 Base URL",apiKeySanitized:"API Key 包含非法字符,已自动过滤",fetchedCount:"获取到 {{n}} 个模型",fetchFailed:"获取模型列表失败,请检查 Base URL 和 API Key",requestFailed:"请求失败",hintJoiner:";",connectionFailed:"连接失败",catalogSearchFailed:"目录搜索失败",addedModel:"已添加 {{id}}",operationFailed:"操作失败,请重试",providerNameRequired:"请先输入 Provider 名称",apiKeyRequired:"请至少输入一把 API Key",defaultsAutoUpdated:"已自动更新默认模型",unknownError:"未知错误",loading:"加载中...",providerListRefreshed:"Provider 列表已刷新",refreshFailed:"刷新失败,请稍后重试",refreshListTitle:"从远端刷新 Provider 列表",collapse:"收起",addProvider:"新增 Provider",providerSearchPlaceholder:"搜索 Provider 名称 / 模型...",clear:"清除",clearSearch:"清除搜索",noMatchingProviders:"未找到匹配的 Provider",noMatchingProvidersHint:"没有与「{{query}}」匹配的 Provider,请检查拼写或改用完整列表",noDefaultModel:"无默认模型",configuredCount:"{{n}} 个模型",availableCount:"{{n}} 可用",defaultProviderBadge:"默认 Provider",deleteProviderNamed:"删除 {{name}}",none:"无",loadLabel:"负载",inputPrice:"输入价格",outputPrice:"输出价格",inputTokensLabel:"输入 token",outputTokensLabel:"输出 token",totalTokensLabel:"总 token",setGlobalDefaultFailed:"设置全局默认失败",setGlobalDefaultTitle:"设为全局默认",setPlanDefaultFailed:"设置 Plan 默认失败",setPlanDefaultTitle:"设为 Plan 默认",unsetPlanDefaultFailed:"取消 Plan 默认失败",unsetPlanDefaultTitle:"取消 Plan 默认(该模式回退到全局默认)",setActDefaultFailed:"设置 Act 默认失败",setActDefaultTitle:"设为 Act 默认",unsetActDefaultFailed:"取消 Act 默认失败",unsetActDefaultTitle:"取消 Act 默认(该模式回退到全局默认)",setGoalDefaultFailed:"设置 Goal 默认失败",setGoalDefaultTitle:"设为 Goal 默认",unsetGoalDefaultFailed:"取消 Goal 默认失败",unsetGoalDefaultTitle:"取消 Goal 默认(该模式回退到全局默认)",editModel:"编辑模型",deleteModel:"删除模型",refresh:"刷新",enable:"启用",disable:"禁用",emptyHint:"暂无模型,请先在上方配置 Provider",selectProvider:"选择 Provider",customProvider:"自定义 Provider",customProviderDesc:"手动填写 Provider 名称、Base URL 和模型 ID",editExistingConfig:"编辑已有配置(可选)",newCustomProviderOption:"+ 新建自定义 Provider",editExistingConfigHint:"默认新建空表单;选择已保存的配置可回填继续编辑(API Key 不回显,留空保存即保留原 Key)。",providerNameLabel:"Provider 名称 *",providerNamePlaceholder:"例如: my-provider",apiKeysHintConfigured:",留空则保留已保存的 Key",apiKeysHintNew:"(每行一把,可多把)",apiKeyMultiPlaceholder:"每行输入一把 API Key\\n支持多把(运行时取第一把,其余备用)",modelIdLabel:"模型 ID",modelIdPlaceholder:"gpt-4o, deepseek-chat (格式: id|名称|别名)",fetchModelsTitle:"从 API 获取模型列表",fetchingModels:"获取中...",fetchModels:"获取模型列表",testConnectionTitle:"探测端点连通性,自动推断 API 类型并修复 Base URL",testingConnection:"测试中...",testConnection:"测试连接",catalogSearchTitle:"搜索 models.dev 全厂商模型目录(含 context/价格/能力元数据)",modelSearchPlaceholder:"搜索模型...",fullPathLabel:"完整路径(不自动拼接 /chat/completions、/responses、/v1/messages)",fullPathHint:"开启后 Base URL 按原样使用(如 https://host/v1/chat/completions),后端不再转换。",apiTypeLabel:"API 类型",apiTypeAutoDetect:"自动探测(推荐)",autoRemovedMissingModels:"已自动移除服务端不存在的模型:{{models}}",autoSkippedMissingModels:"已自动跳过服务端不存在的模型:{{models}}",defaultModelDisableBlocked:"无法禁用 {{name}}:请先将默认模型切换为其他模型",deleteModelConfirm:"确认从配置中删除模型 {{id}}?",connectionSuccessWithHints:"{{message}}。{{hints}}。",loadingProviders:"加载中...",refreshList:"刷新列表",editProviderNamed:"编辑 {{name}}",globalDefault:"全局默认",planDefault:"Plan 默认",actDefault:"Act 默认",goalDefault:"Goal 默认",unsetActDefault:"取消 Act 默认",unsetPlanDefault:"取消 Plan 默认",unsetGoalDefault:"取消 Goal 默认",connectionSuccess:"连接成功",baseUrlAutoCompleted:"Base URL 已自动补全为 {{url}}",apiTypeAutoSelected:"API 类型已自动选择为 {{type}}",hasKey:"已有 Key",noKey:"无 Key",defaultShort:"默认",overrideBadge:"覆盖",overrideTitle:"手动覆盖模型列表",customBaseUrl:"自定义 Base URL",catalogSearch:"搜索目录模型",close:"关闭",apiTypeHint:"留空 = 根据 Base URL 自动识别协议",modelApiTypeLabel:"API 类型(目录模型)",modelApiTypeHint:"目录模型的响应协议,默认跟随 Provider 设置",modelApiTypeEmpty:"当前目录没有可选的 API 类型",addCustomProvider:"新增自定义 Provider",configuredPanelPrefix:"已配置 ",configuredPanelSuffix:" 个模型",configuredPanelHint:"(勾选即时生效,与「模型 ID」输入框双向同步)",fetchedPanelPrefix:"已获取 ",fetchedPanelMiddle:" 个,已选 ",fetchedPanelSuffix:" 个",fetchedPanelHint:"(勾选将写入「模型 ID」输入框)",noModelsInProvider:"该 Provider 下暂无模型",reset:"重置"},yL={title:"工具列表",searchTools:"搜索工具...",disabled:"禁用",enabled:"启用",params:"参数",loadFailed:"加载工具失败",noTools:"暂无工具",loading:"加载中...",retry:"重试",refresh:"刷新",all:"全部",invalidData:"服务端返回的工具数据格式异常"},vL={title:"技能管理",list:"技能列表",noSkills:"暂无技能",loadFailed:"加载技能失败",loadFailedFallback:"加载失败",enable:"启用",disable:"禁用",enabled:"已启用",disabled:"已关闭",new:"新建技能",import:"导入",importTitle:"导入技能",edit:"编辑",save:"保存",cancel:"取消",retry:"重试",refresh:"刷新",tags:"标签",none:"无",source:"来源",localSkill:"本地技能",systemPrompt:"系统提示词",selectSkill:"选择一个技能",fieldId:"ID",fieldName:"名称",fieldCategory:"分类",fieldTrigger:"触发词",fieldTools:"所需工具",description:"描述",saving:"保存中",chooseFile:"选择技能文件",importHint:"支持 .skill.md 文件",marketplace:"技能市场",marketplaceDesc:"从远程市场浏览并安装技能",marketplaceTitle:"技能市场",addMarketplace:"添加市场",addMarketplaceTitle:"添加技能市场",marketplaceUrl:"市场地址",marketplaceUrlPlaceholder:"GitHub 仓库 / index.json 链接 / 本地技能文件夹,如 https://github.com/obra/superpowers 或 D:\\agent\\agentic-awesome-skills",marketplaceName:"市场名称(可选)",marketplaceHint:"支持 GitHub 仓库(自动扫描 skills/ 目录)、返回 index.json 的 URL、或本机技能文件夹(完全离线,直接浏览/安装磁盘上的技能库)。GitHub 无法访问时可设置 DEEPSEEKCODE_GITHUB_MIRROR 镜像加速。",marketFilterPlaceholder:"在当前市场搜索技能...",marketCategoryAll:"全部分类",riskCritical:"高危",riskUnknown:"风险未知",refreshMarketplace:"刷新",removeMarketplace:"移除市场",installSkill:"安装",installed:"已安装",installFail:"安装失败",loadMarketplaceFail:"加载技能市场失败",noMarketplaces:"暂无市场,先添加一个",noSkillsInMarket:"该市场暂无技能",marketplaceError:"市场索引加载失败:{{error}}",retryMarket:"重试",presets:"内置市场",marketplaces:"已添加的市场",skillCount:"{{count}} 个技能",installedSkills:"已安装技能",addFail:"添加市场失败",installing:"安装中...",adding:"添加中...",marketplaceTab:"技能市场",mineTab:"我的技能",installedTab:"已安装",workshopTab:"技能工坊",workshopHint:"技能提案:从会话/手动生成,审核后一键应用为技能",workshopPropose:"新建提案",workshopName:"技能名 (skill-name) 如 format-json",workshopTrigger:"触发关键词(可选)",workshopDescription:"一句话描述",workshopContent:"技能正文(系统提示 / 工作流指令)",workshopSubmit:"提交提案",workshopApply:"应用",workshopEmpty:"暂无技能提案",workshopFormRequired:"技能名和正文为必填",uninstall:"卸载",uninstallConfirm:"确定卸载已安装技能「{{name}}」?",uninstalling:"卸载中...",uninstallFail:"卸载失败",pagePrev:"上一页",pageNext:"下一页",pageOf:"第 {{page}} / {{total}} 页",emptyInstalled:"还没有已安装的市场技能",emptyInstalledHint:"前往「技能市场」浏览并下载安装",browseMarket:"去市场逛逛",use:"使用",useHint:"使用此技能:将 $技能名 插入输入框,补充任务描述后发送",pickTitle:"选择技能",pickPlaceholder:"搜索技能...",pickEmpty:"没有可用的技能",pickUse:"点击使用"},bL={permissionRequest:"权限申请",hookApproval:"Hook 拦截审批",hookConfirm:"Hook 请求确认",morePending:"还有 {{n}} 项待审批",tool:"工具:",reason:"原因:",needConfirm:"需要用户确认此操作",allow:"允许",deny:"拒绝",allowAlways:"本次会话始终允许",allowAlwaysDesc:"当前会话中不再询问此工具",autoMode:"自动模式",autoModeLabel:"自动模式(全部允许)",autoModeDesc:"自动批准所有 Hook 请求",moreOptions:"更多选项",highRiskWarning:"此操作可能造成不可逆的影响,请仔细确认",mediumRiskConfirm:"请确认此操作为预期行为",alreadyAllowed:"已允许:",alreadyDenied:"已拒绝:",risk_critical:"破坏性操作 - 可能删除数据",risk_critical_cmd:"高危命令 - 包含系统级操作",risk_high_shell:"Shell 命令执行",risk_high_file:"文件写入操作",risk_high_pkg:"包管理操作",risk_git_force:"Git 强制操作",risk_git:"Git 操作",risk_network:"网络请求",risk_low:"只读操作",risk_default:"工具调用",hookConfigTitle:"自定义 Hook 配置说明",hookConfigDesc:"你可以在项目根目录的 .agent/hooks.json 文件中添加或修改 Hook 拦截规则。",hookConfigDetail:"Hook 支持 SHELL(外部脚本)和 HTTP(REST 端点)两种类型,可以在工具执行前(PRE_TOOL_USE)或执行后(POST_TOOL_USE)触发。",hookConfigBuiltin:"内置了 BashSafetyHook(危险命令拦截)、FileWriteAuditHook(文件写入审计)、ToolUsageStatsHook(工具调用统计)三套 Hook。设置 enabled: false 可禁用任意 Hook。",optionAllow:"允许 — 执行此操作",optionAllowHint:"点击或按 Enter 确认",optionDeny:"拒绝 — 取消此操作",optionDenyHint:"点击或按 Esc 取消",optionAllowAlways:"本次会话始终允许",optionAllowAlwaysHint:"不再询问 {{tool}}",optionAllowPathHint:"不再询问该外部路径",timeoutWaitUser:"等待用户输入(无超时)",optionAutoMode:"自动模式 — 全部允许",optionAutoModeHint:"之后所有 Hook 将自动批准",shortcutHint:"快捷键: 1-4 选择 · Enter 允许 · Esc 拒绝",lastItem:"最后一项",modalHint:"请在弹窗中处理此审批请求",clickToSelect:"点击选择 · 1/2/3/4 键盘快捷键",verbRunCommand:"运行命令",verbWriteFile:"写入文件",verbEditFile:"编辑文件",verbReadFile:"读取文件",verbDeleteFile:"删除文件",verbFindFiles:"查找文件",verbSearchContents:"搜索内容",verbFetchUrl:"请求网络",verbSearchWeb:"搜索网络",verbGit:"Git 操作",verbInstall:"安装依赖",verbSendMessage:"发送消息",verbRunTool:"执行操作",scopeLocal:"作用于当前工作区",scopeExternal:"外部路径",showAllLines:"展开全部 {{n}} 行",showAll:"显示完整内容",showLess:"收起",importMergeConfirm:`合并到现有配置吗?
467
- "确定"=合并 / "取消"=替换`,configTitle:"Hook 配置",configDesc:"在工具执行、任务流转等生命周期事件上挂载拦截器,实现审批与自定义逻辑",import:"导入",export:"导出",newRule:"新增规则",ruleList:"规则列表",ruleCount:"{{n}} 条",implShell:"Shell 脚本",implShellDesc:"执行外部脚本,stdin 接收 JSON,stdout 返回决策",implHttp:"HTTP 端点",implHttpDesc:"POST JSON 到外部端点",implPromptDesc:"发送单轮 Prompt 给 LLM 做风险评估",implAgentDesc:"启动只读子代理做深度调查",stepBasicTitle:"基本信息",stepBasicDesc:"名称、描述、事件",stepImplTitle:"实现配置",stepImplDesc:"执行方式与参数",stepAdvancedTitle:"高级选项",stepAdvancedDesc:"优先级、过滤、测试",editRule:"编辑: {{name}}",addRule:"添加 Hook 规则",fieldName:"名称 *",fieldDescription:"描述",descriptionPlaceholder:"这个 Hook 的作用...",fieldEvents:"事件 *",eventsSelected:"{{n}} 已选",searchEventsPlaceholder:"搜索事件...",toggleAllEvents:"全选/取消",fieldImplType:"实现类型 *",fieldCommand:"命令 *",fieldPromptTemplate:"Prompt 模板 *",promptTemplatePlaceholder:"你是一个安全审计专家,请分析以下工具调用...",selectAgentPlaceholder:"选择 Agent...",agentReadOnlyHint:"Agent 将以只读模式运行(Read/Grep/Glob),不会修改文件",fieldPriority:"优先级",fieldTimeout:"超时 (ms)",labelEnabled:"启用",failOpenLabel:"Fail-open(超时放行)",fieldToolFilter:"工具过滤(正则,可选)",dryRunResultTitle:"Dry-run 结果",dryRunDecision:"决策: ",dryRunReason:"原因: ",dryRunOutput:"输出: ",dryRunButton:"试运行 (Dry Run)",prevStep:"上一步",nextStep:"下一步",saveChanges:"保存修改",createRule:"创建规则",noRules:"暂无 Hook 规则",noRulesHint:'点击右上角"新增规则"创建第一个 Hook',batchDeleteConfirm:"确认删除 {{n}} 条规则?",selectedItems:"已选 {{n}} 项",enableAll:"全部启用",disableAll:"全部禁用",colName:"名称",colEvents:"事件",colType:"类型",colStatus:"状态",colActions:"操作",clickToDisable:"点击禁用",clickToEnable:"点击启用",actionEdit:"编辑",deleteRuleConfirm:'删除规则 "{{name}}"?',statTotal:"总规则数"},xL={pending:"等待",thinking:"思考",action:"执行",result:"结果",running:"运行中",error:"错误",completed:"完成",params:"参数"},wL={linesTotal:"… (共 {{n}} 行)",expandAll:"展开全部 ({{n}} 行)",collapse:"收起"},SL={quickCommands:"快捷命令",search:'搜索: "{{filter}}"',help:"↑↓ 选择 · Enter 执行 · Esc 关闭",backend:"后端",backendCommand:"后端命令",chat_desc:"切换到对话面板",chat_result:"已切换到对话面板",terminal_desc:"切换到终端面板",terminal_result:"已切换到终端面板",files_desc:"切换到文件面板",files_result:"已切换到文件面板",models_desc:"切换到模型面板",models_result:"已切换到模型面板",tools_desc:"列出可用工具",tools_result:"已切换到工具面板",skills_desc:"列出可用技能",skills_result:"已切换到技能面板",settings_desc:"切换到设置面板",settings_result:"已切换到设置面板",logs_desc:"切换到日志面板",logs_result:"已切换到日志面板",new_desc:"创建新会话",new_result:"新会话已创建",clear_desc:"清空当前会话消息",clear_result:"消息已清空",theme_desc:"切换主题 (dark/light/auto)",theme_error:"用法: /theme <dark|light|auto>",theme_result:"主题已切换为 ",theme_preset_result:"主题预设已切换为 ",theme_preset_unavailable:"主题预设切换不可用",toggle_terminal_desc:"切换底部终端面板显示",toggle_terminal_result:"终端面板已切换",logs_clear_desc:"清空日志",logs_clear_result:"日志已清空",doctor_desc:"系统自诊断 (Config/API Key/Network/Docker/Disk)",compact_desc:"压缩当前会话上下文",help_desc:"显示所有快捷命令",token_desc:"显示 token 使用量和 API 费用统计",review_desc:"代码审查 — 检查变更的正确性、安全性和代码质量",security_review_desc:"安全审查 — OWASP Top 10 + 命令注入/路径遍历/权限提升",memory_desc:"管理 AI 持久记忆 (list/add/delete/clear)",ps_desc:"查看和管理后台任务、子代理和 shell 进程",model_desc:"查看或切换 AI 模型",status_desc:"显示当前会话状态 (会话ID/消息数/模型/工作目录)",config_desc:"管理应用程序配置 (get/set/list/delete)",exit_desc:"退出应用",exit_result:"正在关闭服务...",benchmark_desc:"运行 DeepSeekCode 能力评测 (simple/medium/complex/full/list)",goal_desc:"设置多步工作目标",goal_list_desc:"列出活跃目标",goal_status_desc:"查看目标进度",workflow_list_desc:"列出工作流运行记录",workflow_status_desc:"查看工作流状态",workflow_checkpoints_desc:"列出工作流检查点",mcp_desc:"列出或重新加载 MCP 服务器",sessions_desc:"列出会话",resume_desc:"按 ID 恢复会话",permissions_desc:"显示权限规则和待审批项",init_desc:"生成 agent.md 项目指导文件",self_test_desc:"运行工具能力自测并生成报告",context_desc:"显示上下文分析报告",version_desc:"显示版本信息","check-update_desc":"检查可用更新",upgrade_desc:"升级到最新版本",acceptance_desc:"运行或检查验收工作流 (quick/full/list/report)",diff_desc:"查看未提交的 Git 变更",summary_desc:"总结当前会话内容",effort_desc:"显示或设置推理力度 (low|medium|high)",export_desc:"导出当前会话为 JSON",rename_desc:"重命名当前会话",hooks_desc:"显示活跃钩子配置",cost_desc:"显示预估会话成本",sent_command:"已发送命令 ",noActiveSession:"无活跃会话",unknownCommand:"未知命令 {{cmd}} — 输入 /help 查看可用命令"},kL={pageError:"页面出现错误",unknownError:"发生了未知错误,请尝试刷新页面",refreshPage:"刷新页面",genEnded:"生成已结束(工具执行超时或连接中断)"},_L={backendConnected:"后端已连接",backendDisconnected:"后端连接断开,正在重连...",paused:"已暂停,再按 ESC 终止",terminated:"已终止 (ESC×2)",contextCompressed:"上下文压缩: {{original}} → {{compressed}} 条消息, 释放 {{saved}} tokens",errorPrefix:"❌ 错误: {{error}}",uncaughtError:"未捕获错误:",uncaughtRejection:"未捕获的 Promise 拒绝: ",unknownReason:"未知原因",diagnosing:"⏳ 诊断中...",runDiagnostic:"🔍 运行诊断",inspectorOn:"开启检查模式 (Ctrl+Shift+Alt+C)",inspectorOff:"关闭检查模式"},CL={title:"频道管理",subtitle:"接入外部 IM 平台,通过微信、飞书、钉钉等与 AI 交互",newChannel:"新建频道",editChannel:"编辑频道",table:{name:"频道名称",type:"类型",appId:"App ID",status:"连接状态",enabled:"启用",actions:"操作",emptyHint:"点击右上角「新建频道」接入微信、飞书或钉钉"},status:{connected:"已连接",disconnected:"未连接",connecting:"连接中",error:"错误"},empty:"还没有配置任何频道",emptyHint:"点击「新建频道」添加一个 IM 平台机器人",form:{basicInfo:"基础信息",name:"频道名称",namePlaceholder:"例如:公司群机器人",type:"频道类型",credentials:"凭证信息",appId:"App ID / 企业ID",appIdPlaceholder:"填写应用 AppID",appSecret:"App Secret",appSecretPlaceholder:"填写应用密钥",token:"Token / Bot Token",tokenPlaceholder:"填写机器人 Token",encodingAESKey:"EncodingAESKey",encodingAESKeyPlaceholder:"仅微信需要,可选",enabled:"启用频道",wechatQrHint:"保存后可使用微信扫码登录",feishuWsHint:"飞书使用 WebSocket 连接,自动接收消息",namePlaceholderDev:"例如:研发群机器人",typeLocked:"频道类型创建后不可修改",leaveBlankUnchanged:"留空不修改",leaveBlankMeansUnchanged:"留空表示不修改",appSecretValue:"应用密钥",tokenCallback:"回调校验 Token",optionalShort:"选填",encodingAesOptional:"选填,消息加解密密钥",wechatIlinkHint:"微信 iLink 机器人通过扫码授权,凭证可留空,保存后扫码登录即可。",wechatIlinkHintList:"微信 iLink 机器人通过扫码授权,凭证可留空,保存后在列表点击「扫码登录」。",enabledOffHint:"关闭后停止收发消息"},actions:{scanQr:"扫码",edit:"编辑",delete:"删除",deleteConfirm:"确定要删除此频道?",test:"测试连接",save:"保存频道",cancel:"取消",refresh:"刷新",qrLogin:"扫码登录",deleteConfirmNamed:"确认删除频道「{{name}}」?",deleteConfirmShort:"确认删除该频道?"},errors:{loadFailed:"加载频道列表失败",createFailed:"创建频道失败",updateFailed:"更新频道失败",deleteFailed:"删除频道失败",notFound:"频道未找到",notImplemented:"尚未实现",nameRequired:"频道名称不能为空"},qr:{title:"微信扫码登录",generating:"二维码生成中...",waiting:"请使用微信扫描二维码",scanned:"已扫描,请在手机上确认",confirmed:"登录成功",expired:"二维码已失效",expiredHint:"点击重试重新生成二维码",error:"获取二维码失败",openInNewTab:"在新标签页打开"},typeLabels:{wechat:"微信",feishu:"飞书",dingtalk:"钉钉",telegram:"Telegram",discord:"Discord",slack:"Slack",signal:"Signal",whatsapp:"WhatsApp",line:"LINE",qqbot:"QQ Bot",matrix:"Matrix",mattermost:"Mattermost",msteams:"Teams",googlechat:"Google Chat",irc:"IRC"},viewSubtitle:"接入微信、飞书、钉钉,用户可通过频道发送任务并实时接收进度与结果",experimentalLabel:"实验性",experimentalShort:"实验",experimentalTip:"实验性实现,功能不完整",experimentalDesc:"此频道为基础适配器封装,支持基础消息收发,部分高级功能可能不完整",pluginMissingLabel:"插件未安装",pluginMissingTip:"该频道类型的插件未安装或未激活,无法启动实例",pluginMissingWarning:"该频道类型的插件未安装或未激活,实例无法启动。请到「插件」页安装并激活{{name}}插件后重试。",selectTypeHint:"请从左侧选择一个频道类型",instancesCount:"{{n}} 个配置实例",notConfiguredYet:"尚未配置",createInstance:"新建实例",createShort:"新建",selectInstance:"选择实例",emptyWithType:"还没有配置 {{type}}",wechatBindHint:"点击下方按钮,用微信扫码即可自动完成绑定",startWithCreate:"点击上方「新建实例」开始配置",scanToBind:"扫码绑定",qrLoginReauth:"扫码登录 / 重新授权",editConfig:"编辑配置",createConfig:"新建配置",save:"保存",saving:"保存中...",unknownError:"未知错误",retry:"重试",bindSuccess:"绑定成功",bindTitle:"扫码绑定 · {{name}}",startUsing:"开始使用",clickToRefresh:"点击刷新",connectedReady:"「{{name}}」已连接,可开始使用",createdConnectedReady:"微信频道已创建并连接,可开始使用",waitingAuthorize:"请使用微信扫描二维码授权机器人",scannedConfirming:"已扫描,请在手机上确认...",confirmedClosing:"机器人已授权并启动,即将自动关闭",connectingIlink:"正在连接 iLink 服务...",openInNewTabFallback:"在新标签页打开(备用)",toastReauthSuccess:"微信「{{name}}」重新授权成功,频道已连接",toastBindSuccess:"微信绑定成功,频道已自动创建并连接",pollFailedRefresh:"轮询状态失败次数过多,请刷新二维码重试",pollFailedToast:"微信绑定状态轮询失败,请刷新二维码重试",qrDataMissing:"二维码数据缺失: {{data}}",fetchWechatQrFailed:"获取微信二维码失败:{{error}}",sidebar:{title:"频道列表",configuredCount:"{{n}} 个已配置",clickToConfigure:"点击下方频道开始配置",configuredMissing:"已配置 · 插件未安装",unconfigured:"未配置",empty:"未安装任何频道插件",emptyHint:"安装频道插件后才会在此显示,请前往「插件」页从插件市场安装",partialConnected:"{{connected}}/{{count}} 已连接",waitingPlugin:"等待安装插件"},categories:{im:"即时通讯",international:"国际主流",eastAsia:"东亚",collaboration:"协作平台",classic:"经典协议",other:"其他",builtin:"内置",plugins:"插件扩展"}},TL={stageUploaded:"等待处理",stageParsing:"正在解析数据文件",stageMapping:"模板映射",stageRendering:"正在生成文件",stageComplete:"文件处理完成",stageError:"文件处理失败",parsing:"正在解析 {{file}} …",parsedSummary:"{{rows}} 行 · {{fields}} 个字段",mappingTitle:"模板 ↔ 数据字段映射",templatePlaceholder:"模板占位符",dataField:"数据字段",mappingMore:"另有 {{n}} 个映射",rendering:"正在逐条生成 {{current}}/{{total}} …",download:"下载",downloadFailed:"下载失败",error:"处理失败",roleData:"数据文件",roleTemplate:"模板文件",attach:"上传文件或图片,支持多选",dropHint:"松开以添加附件",unsupportedType:"不支持的文件类型: {{name}}",fileTooLarge:"文件过大: {{name}}(≤50MB)",duplicateFile:"重复文件: {{name}}",maxAttachments:"单次最多 {{n}} 个文件",uploadFailed:"上传失败",stillUploading:"附件正在上传中,请稍候…",importFailed:"Import files failed",kindText:"文本",moreRows:"+{{n}} 行",rowsDone:"{{done}}/{{total}} 行",rowsFailed:"{{n}} 行失败",imagePreview:"图片预览"},AL={reconnecting:"重连中 {{attempt}}/{{max}}",hint:"正在重新连接后端…"},EL={title:"Full access(自动批准)已开启",desc:"Agent 可不经确认直接编辑文件和执行命令,存在数据丢失风险。",dismiss:"本次关闭",neverShow:"不再显示"},NL={panelTitle:"环境与变更",noRepo:"非 Git 仓库",notGitDesc:"当前工作目录不是 Git 仓库,无法展示变更统计。",refresh:"刷新",changes:"变更统计",clean:"工作区干净",branch:"分支",upstream:"相对上游",commit:"提交",push:"推送",commitConfirm:"提交",commitPlaceholder:"提交信息(Agent 生成草稿,可编辑)…",commitSuccess:"提交成功",commitFailed:"提交失败",pushSuccess:"推送成功",pushFailed:"推送失败",checkoutSuccess:"已切换到 {{branch}}",checkoutFailed:"切换失败",prReady:"PR 检查状态正常",prUnavailable:"Pull request status unavailable(未关联远端)",prLoading:"加载 PR 状态…",environment:"环境信息",ok:"操作成功",loading:"加载中…",emptyCommitMsg:"请输入提交信息"},ML={retry:"重试",details:"详情",modelSettings:"模型设置"},RL={comingSoon:"即将上线"},OL={lspGroup:"语言服务器 (LSP)",mcpGroup:"MCP 服务器",notInstalled:"未安装",installed:"已安装",ready:"已连接",connecting:"连接中",installing:"安装中…",error:"错误",disabled:"已禁用",toolCount:"{{count}} 个工具",docs:"文档",official:"官方",cloud:"云端",local:"本地",needCredentials:"此连接器需要凭据才能启动:",connect:"连接",missing:"未配置",envConfigured:"已配置",searchPlaceholder:"搜索连接器(名称、id、描述)…",all:"全部",noResults:"没有匹配的连接器。",custom:"自定义",addCustom:"添加自定义",customTitle:"添加自定义 MCP 服务器(来自 awesome-mcp-servers 或自建)",customName:"名称 (id)",customCommand:"启动命令",customArgs:"参数(空格分隔)",customEnv:"环境变量(KEY=value,逗号分隔)",customUrl:"MCP 端点 URL",customHeaders:"请求头(KEY=value,逗号分隔)",customLocal:"本地命令",customFormRequired:"名称和启动命令/URL 必填。",removeCustom:"删除此自定义连接器",add:"添加"},DL={justNow:"刚刚",minutesAgo:"{{count}}分钟前",hoursAgo:"{{count}}小时前",daysAgo:"{{count}}天前"},LL={title:"语音输入(Whisper:英语等 / FunASR:中文)",stopTitle:"停止录音并转写",langToggle:"语音识别语言",multiHint:"中文使用 FunASR,其他语言使用 faster-whisper",noSpeech:"未识别到语音内容,请重试",backendMissing:"语音服务未就绪,已打开设置页引导安装",setup:{title:"语音服务",envCard:"运行环境检测",envChecking:"检测中…",recheck:"重新检测",pythonOk:"Python {{version}} 已就绪",pythonMissing:"未检测到 Python,请先安装 Python 3.10+",pythonGuide:"下载安装 Python",pipOk:"pip 可用",whisperTitle:"Whisper · 英语",whisperDesc:"英语语音识别",funasrTitle:"FunASR · 中文",funasrDesc:"中文语音识别",installed:"已安装",notInstalled:"未安装",install:"一键安装",installing:"安装中…",cancel:"取消安装",installDone:"安装完成,可回到聊天页使用语音输入",installFailed:"安装失败",installTimeout:"安装超时",installCancelled:"安装已取消",jobInProgress:"已有安装任务进行中,正在接管进度",manualCommand:"手动安装命令",copyCommand:"复制命令",copySuccess:"已复制到剪贴板",copyFailed:"复制失败",torchHint:"中文引擎需安装 torch,体积较大,请耐心等待",logWaiting:"正在准备安装…",chooseHint:"环境已就绪,请选择上方引擎进行安装",defaultEngine:"默认识别引擎",defaultEngineHint:"选择语音输入默认使用的引擎,可在聊天输入框随时切换",inUse:"使用中",engineNotInstalledHint:"该引擎尚未安装,选中后录音时会引导安装",probeError:"依赖检测失败:",installDoneButMissing:"安装命令已执行成功,但引擎检测仍不可用",installDoneButMissingHint:"语音服务已自动重启并重新检测;若仍失败,请复制下方手动命令在终端执行排查(常见原因:torch 与系统 DLL 不兼容)。",pipGuide:"请先安装 Python(含 pip),完成后重启应用再重试。",pipMissing:"未找到 pip,请先安装 Python 环境。"}},BL={verb:{researching:"分析代码",coding:"修改代码",validating:"运行验证",summarizing:"整理结果"},title:{withFile:"{{verb}} {{file}}",withCount:"{{verb}} · {{count}} 项"},evidenceMore:"等 {{count}} 项",toolCallCount:"{{count}} 次工具调用",toolNamesMore:"等 {{count}} 个工具",waitingUser:"等待你的回答",blocked:"被阻塞:{{reason}}",paused:"已暂停,可恢复",viewAndAnswer:"查看并回答",evidence:"执行明细",phase:{analysis:"分析",implementation:"实现",optimization:"优化"}},jL={next:"下一步",idle:"空闲"},PL={title:"定时自动化",refresh:"刷新",new:"新建",namePlaceholder:"名称(如:每早 9 点汇总 Git 状态)",instructionsPlaceholder:"指令(agent 每次触发时执行的内容)",cronPlaceholder:"cron(5 段,如 0 9 * * *)",create:"创建",cronDaily9:"每天 9:00",cronWeekday9:"工作日 9:00",cronEvery30Min:"每 30 分钟",empty:"还没有定时自动化。新建一个,让 agent 无人值守干活。",enable:"启用",disable:"停用",runNow:"手动触发",delete:"删除",historyTitle:"运行历史",noRuns:"暂无运行记录",permissionsTitle:"作用域放行(tool target)",permissionsEmpty:"无。未放行的写操作需人工批准,超时后自动拒绝。",permissionPlaceholder:"如:write_file docs/report.md",add:"添加"},IL="定时任务(如每晚跑测试数据)将在这里管理。",zL="插件管理入口。可启停文件处理技能等扩展能力。",$L="功能开发中…",HL={title:"文件浏览器",searchPlaceholder:"搜索...",refresh:"刷新",collapse:"折叠",uploadTo:"上传到 {{dir}}",uploadToRoot:"上传到工作区根目录",setUploadDirHint:"点击设为上传目录并展开",download:"下载",close:"关闭",modified:"已修改",saving:"保存中...",save:"保存",saved:"文件已保存",saveFail:"保存失败",readFail:"读取文件失败",downloadFail:"下载失败",downloadStarted:"已开始下载",uploadedCount:"已上传 {{count}} 个文件",uploadFailedCount:"{{count}} 个文件上传失败",selectFileHint:"选择文件以预览或编辑"},UL={title:"日志",backendLogs:"后台日志",streamTab:"实时日志流",files:"日志文件",clear:"清空",refresh:"刷新",refreshing:"刷新中...",noLogs:"暂无实时日志",noFiles:"暂无日志文件",preview:"预览",download:"下载",backToList:"返回文件列表",emptyFile:"(空文件)",totalLines:"{{count}} 行",showingLatest:"(显示最新 {{count}} 行)"},FL={installedTab:"已安装 ({{count}})",availableTab:"可安装 ({{count}})",searchPlaceholder:"搜索插件(名称 / id / 描述 / 标签)",clear:"清除",allCategories:"全部",marketFilterAll:"全部来源",marketFilterBuiltin:"内置",prevPage:"上一页",nextPage:"下一页",pageInfo:"第 {{page}} / {{pages}} 页 · 共 {{count}} 条",noMatch:"无匹配插件",emptyInstalled:"暂无插件 — 到「可安装」页从市场安装",emptyMarket:"市场暂无可用插件",applyProviderTitle:"把插件 provider preset 写入 ProviderConfigStore(用户授权)",activate:"激活",deactivate:"停用",uninstall:"卸载",installActivate:"安装并激活",installOnly:"仅安装",uninstallTitle:"卸载插件",uninstallConfirm:"确定要卸载 {{id}} 吗?插件文件将被删除(bundled 除外)。"},GL={starterTitle:"新模板",starterNodeTitle:"任务",starterNodeDesc:"描述任务",sourceSaved:"沉淀",sourceScript:"脚本",sourceHandwritten:"手写",roleExplore:"探索",rolePlan:"规划",roleExecute:"执行",roleVerify:"校验",roleSummarize:"总结",roleGeneric:"通用",noNodes:"此模板暂无节点。",filterAll:"全部",noMatchTemplates:"没有匹配的模板",emptyTemplates:"暂无模板。完成动态工作流后保存为模板,或由 AI 起草。",aiPromptRequired:"描述不能为空",aiDraftFailed:"AI 起草失败,请重试或改用手写",nameRequired:"模板名称不能为空",jsonParseFailed:"JSON 解析失败:{{error}}",invalidDefinition:"definition 必须是含 nodes 数组的 WorkflowDefinition",createFailed:"创建失败",loadFailed:"加载模板失败",uncategorized:"其他",savedVersion:"已保存(v{{version}})",saveFailed:"保存失败",renderFailed:"渲染失败",selectTemplateHint:"从左侧选择一个模板查看 / 编辑",selectTemplateHintSub:"内置预设开箱即用;也可以把一次工作流运行「保存为模板」沉淀复用。",loading:"加载…",deleteTemplate:"删除模板",categoryLabel:"分类(category)",descriptionLabel:"描述(description)",nodeCount:"{{n}} 个节点",topologyHint:"拓扑:串行 / 并行依赖",inputCount:"{{n}} 个输入参数",workflowNodes:"工作流节点",sortedByDeps:"按依赖拓扑排序",launchWithTemplate:"用模板新建会话",testRun:"试跑",versionHistory:"版本历史",advancedJson:"高级(JSON)",refresh:"刷新",inputsSchemaLabel:"inputs(参数 schema,JSON)— 修改后保存会升版本",definitionLabel:"definition(WorkflowDefinition,JSON)",saveChanges:"保存修改",versionSnapshotLabel:"不可变版本快照(versions/{v}.json)",noVersions:"暂无版本记录",viewingVersion:"当前查看中",libraryTitle:"模板库",newTemplate:"新建模板",newShort:"新建",searchPlaceholder:"搜索模板…",paramCount:"{{n}} 参数",viewing:"查看中",view:"查看",launchModalTitle:"用「{{name}}」新建会话",previewModalTitle:"试跑「{{name}}」",launch:"启动",renderPreview:"渲染预览",renderSuccess:"渲染成功 — 产物 definition 可直接启动",nameLabel:"名称 *",namePlaceholder:"如:Triage Inbox",categoryField:"分类",descriptionField:"描述",aiDraftTab:"让 AI 起草",manualJsonTab:"手写 JSON",aiPromptLabel:"用一句话描述要做什么(AI 会拆成带角色的工作流节点)",aiPromptPlaceholder:"如:审查当前仓库代码的安全/性能/正确性,输出分级报告,全程只读",aiWorking:"AI 拆解中…",generateWorkflow:"生成工作流",aiTimeHint:"约 30-60s(推理模型可能更久),生成后可手动微调",newInputsLabel:"inputs(参数 schema,JSON,用 <<input:name>> 引用)",inputsExamplePlaceholder:'[{ "name": "folder", "label": "目录", "type": "folder", "required": true }]',cancel:"取消",create:"创建",deleteConfirm:"确定删除模板「{{name}}」?该操作不可恢复。",delete:"删除",typeString:"文本",typeNumber:"数字",typeSelect:"选择",typeBoolean:"开关",typeFolder:"目录",typeConnector:"连接器",noInputsNeeded:"该模板无需参数,直接启动。",starting:"启动中…",requiredError:"必填",numberError:"请输入数字",selectNone:"(不选)",newSession:"新建会话",newFromTemplateTitle:"用模板新建",chooseTemplateAria:"选择模板新建会话",backToList:"返回模板列表",startSessionHeader:"开始一个会话",directChat:"直接对话",directChatHint:"不选模板,AI 现场拆解任务(动态工作流)",loadingTemplates:"加载模板…",noTemplatesYet:"暂无已保存模板。",libraryMenu:"模板库…"},qL={autoFollowOn:"跟随输出:开",autoFollowOff:"跟随输出:关"},VL={title:"测试与观测",evalIntro:"运行能力评估测试,验证系统功能是否正常。",running:"运行中...",evalTriggered:"{{label}} 已触发,请在对话中查看结果",evalQuickDesc:"验收检查 (无需 LLM)",evalFullDesc:"真实 LLM 调用 (耗时)",evalListDesc:"列出所有评测任务",historyTitle:"运行历史",refresh:"刷新"},WL={taskBoard:{title:"任务看板"},card:{collapse:"折叠",expand:"展开",auto:"自动",unpin:"取消固定",pinKeep:"固定(不自动收起)",pin:"固定",close:"关闭此小组件"},workflow:{fallbackTitle:"工作流",statusRunning:"运行中",statusCompleted:"完成",statusFailed:"失败",statusSkipped:"跳过",statusBlocked:"等待",statusPending:"待执行",resume:"恢复",pause:"暂停",cancel:"取消"},agentFlow:{statusRunning:"运行中",statusCompleted:"完成",statusFailed:"失败",statusIdle:"空闲",moreAgents:"+{{count}} 个 Agent",eventLog:"事件日志({{count}})"},plan:{title:"AI 计划",fallbackTitle:"工作流计划",stepCount:"{{count}} 步",moreSteps:"+{{count}} 步",start:"开始执行",change:"更换流程",changeHint:"取消此方案,换个说法重新描述",cancelTitle:"取消工作流",cancel:"取消"}},KL={drawerCollapseTitle:"折叠抽屉,查看消息",drawerExpandTitle:"展开抽屉,做出选择",openFile:"打开 ›"},YL={viewToggle:"轨迹",viewToggleTitle:"切换聊天 / 轨迹视图",toolbar:{duration:"时长",actualDuration:"按记录时长显示时间轴块",equalWidth:"按等宽显示时间轴块",turns:"轮次",calls:"调用",collapseTurns:"折叠所有轮次",expandTurns:"展开所有轮次",collapseCalls:"折叠所有工具调用",expandCalls:"展开所有工具调用",search:"搜索轨迹",searchPlaceholder:"搜索轨迹…"}},v3={common:oL,nav:lL,chat:cL,shortcuts:uL,palette:dL,a11y:fL,plan:hL,whatsnew:mL,settings:pL,models:gL,tools:yL,skills:vL,hook:bL,step:xL,toolCall:wL,slashCommands:SL,error:kL,toast:_L,channels:CL,fileJob:TL,reconnect:AL,autoAccess:EL,git:NL,errorCard:ML,placeholder:RL,connectors:OL,time:DL,stt:LL,activity:BL,taskbar:jL,automation:PL,placeholderScheduledDesc:IL,placeholderPluginsDesc:zL,featureInProgress:$L,fileTree:HL,logs:UL,plugins:FL,templates:GL,terminal:qL,testing:VL,widgets:WL,commonUi:KL,trajectory:YL},ZL={confirm:"Confirm",cancel:"Cancel",save:"Save",saving:"Saving...",delete:"Delete",close:"Close",refresh:"Refresh",retry:"Retry",loading:"Loading...",collapse:"Collapse",expand:"Expand",collapse_short:"Collapse",clear:"Clear",noData:"No data",noResults:"No results",unknown:"Unknown",unknownError:"Unknown error",connecting:"Connecting…",back:"Back",send:"Send",copy:"Copy",copied:"Copied",search:"Search...",filter:"All",pageInfo:"Showing {{start}}-{{end}} of {{total}}",prevPage:"Previous",nextPage:"Next",enabled:"Enabled",disabled:"Disabled",online:"Online",offline:"Offline",busy:"Busy",away:"Away",default:"Default"},XL={chat:"Chat",terminal:"Terminal",files:"Files",models:"Models",tools:"Tools",skills:"Skills",templates:"Presets",hooks:"Hooks",agentFlow:"Agent Flow",settings:"Settings",logs:"Logs",channels:"Channels",sessions:"Sessions",groupWorkspace:"Workspace",groupConfig:"Configuration",groupSystem:"System",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",moreOptions:"More",scheduled:"Scheduled",plugins:"Plugins",mySessions:"My sessions",sessionRunning:"Running",sessionWaiting:"Awaiting confirmation",sessionFailed:"Failed",sessionDone:"Completed",connectors:"Connectors",pin:"Pin to top",unpin:"Unpin",pinMore:"Pin 'More' to top",unpinMore:"Unpin 'More'",clearSessionSearch:"Clear session search",searchSessions:"Search sessions",searchSessionsPlaceholder:"Search sessions..."},QL=JSON.parse(`{"newSession":"New Session","noSessions":"No sessions yet","renameSession":"Rename session","exportMd":"Export as Markdown","you":"You","thinkingEllipsis":"Thinking…","messageRail":"Message navigation","messageIndex":"Conversation index","backToBottom":"Back to latest","generatingPlaceholder":"AI is generating…","defaultSessionTitle":"Chat {{n}}","welcome":"Welcome to deepseekcode","welcomeDesc":"I can help you write code, analyze projects, and automate tasks. Try sending a message!","suggestionCode":"Code Writing","suggestionCodePrompt":"Implement quicksort in Python and explain its time complexity","suggestionAnalyze":"Code Analysis","suggestionAnalyzePrompt":"Analyze the current project structure and explain how it is organized","suggestionAutomate":"Automation","suggestionAutomatePrompt":"Write a script to organize the files in the current directory","quickCommands":"View quick commands","refFiles":"Reference files","inputPlaceholder":"Type a message... Shift+Enter for newline, / commands, @ file refs, ↑ history","charTokens":"{{chars}} chars · ~{{tokens}} tokens","nearLimit":"Near limit","shiftEnter":"Shift+Enter newline","escHint":"Esc to pause · Double-Esc to stop","resume":"Resume","resumeGen":"Resume generation","stop":"Stop","stopGen":"Stop generation","pause":"Pause","pauseGen":"Pause generation","sendBtn":"Send","voiceInput":"Voice Input","voiceListening":"Listening...","voiceTranscribing":"Transcribing...","voiceUnsupported":"Voice input is not supported in this browser","voiceError":"Voice recognition error, please try again","connected":"Connected","disconnected":"Disconnected","sessionHistory":"Session History","noHistory":"No history sessions","clearHistory":"Clear history","clearHistoryTitle":"Clear history","restoreSession":"Click to restore \\"{{title}}\\"","removeFromHistory":"Remove from history","viewAllSessions":"More sessions","allSessions":"All sessions","sessionPickerTitle":"Select session","clickToOpenSession":"Open session","workingDir":"Working Directory","switchDir":"Switch","clickToSwitchDir":"Click to switch working directory","switchDirPrompt":"Enter new working directory path:","addTask":"Add","addTaskPlaceholder":"Add task...","noTasks":"No tasks, add one above","taskBoardDragHint":"Drag down to expand · drag up to collapse · click to toggle","doubleClickEdit":"Double-click to edit","deleteTask":"Delete task","backgroundLogs":"Background Logs","effort":"Effort","effortOff":"Thinking off","effortLow":"Low","effortMedium":"Medium","effortHigh":"High","effortExtraHigh":"Extra high","effortMax":"Max","noWorkspaceDir":"No working directory","recentDirs":"Recent directories","noRecentDirs":"No recent directories","chooseOtherDir":"Choose another directory…","dirPickerTitle":"Select working directory","dirPickerEnterPath":"Type a full path and press Enter","dirPickerGo":"Go","dirPickerUp":"Up","dirPickerNoDirs":"No subdirectories","dirPickerConfirm":"Select this directory","dirPickerLoadError":"Failed to load directory","artifactPanel":"AI Outputs","workspaceTitle":"Workspace","workspaceToggle":"Switch to workspace","artifactsToggle":"Switch to outputs","workspaceHint":"AI Agent workspace: components load into a dynamic layout and respond to events and commands.","artifactEmpty":"No output files yet. Click a file/path link in the chat to preview it here.","artifactHint":"Click a file/path link in the chat to preview it here — drag the panel edge to resize, or use the maximize button in the corner","previewInPanel":"Preview","backToArtifacts":"Back to list","openInNewTab":"Open in new tab","copyPath":"Copy path","copiedPath":"Path copied","copyPathFailed":"Failed to copy","filePreviewHint":"This file type can't be previewed inline — download it or open it in a new tab.","sidebarProgress":"Progress","sidebarArtifacts":"AI Outputs","sidebarOpen":"Open","sidebarOpenFolder":"Open first output file","sidebarExpandAll":"Expand all","sidebarMaximize":"Maximize","sidebarRestore":"Restore size","sidebarWorking":"Working on this…","sidebarWorkingWithAgents":"Working ({{n}} agent(s) running)…","sidebarWorkingToolcalls":"Working ({{n}} tool call(s))…","sidebarIdle":"Progress for multi-step tasks shows up here: planning, tool calls, approvals, and produced files.","sidebarMoreTasks":"more tasks","sidebarRunningAgents":"{{n}} agent(s) running","sidebarToolcallsSoFar":"{{n}} tool call(s) so far","tokenPrompt":"Prompt","tokenCompletion":"Completion","tokenTotal":"Total","totalChars":"Total chars","avgTokens":"Avg tokens/msg","estimatedCost":"Est. cost: \${{cost}}","contextTrimming":"Context Trimming","keepMore":"Keep more","trimMore":"Trim more","trimContext":"Trim context (keep ~{{n}} messages)","currentMessages":"{{n}} messages","totalCharsInfo":"· {{n}} chars total","contextManager":"Context Manager","showContext":"Show context info","taskBoard":"Task Board","morePending":"{{n}} more pending...","moreCompleted":"{{n}} more completed...","dependencyCount":"🔗 {{n}} dependencies","contextSuggestions":"Expand ({{n}} suggestions)","collapseSuggestions":"Collapse","toolRequest":"Tool request: ","toolResult":"Tool result: ","memory":"Memory: ","filesCount":"({{n}} files)","saveTokens":"Save ~{{n}}","ignoreSuggestion":"Ignore suggestion","fileMention":"@ Reference file","fileMentionSearch":"@ Search: \\"{{query}}\\"","fileMentionHelp":"↑↓ Select · Enter Insert · Esc Close","fileBrowser":"File Browser","fileSaved":"File saved","fileReadError":"Failed to read file","fileSaveError":"Save failed","fileModified":"● Modified","selectFilePreview":"Select a file to preview or edit","kbdHint":"command palette","clickToSwitchMode":"Click to toggle mode (Plan → Goal → Act)","selectModel":"Select model","clickToSelectModel":"Select model / reasoning effort","noEnabledModels":"No enabled models","globalDefault":"Global default","planDefault":"Plan default","actDefault":"Act default","goalDefault":"Goal default","followGlobalDefault":"Follow global default","followGlobalDefaultHint":"Clear this mode's default and fall back to the global default","sessionModel":"Session","sessionModelTitle":"Session-scoped model override (global default unchanged)","noGlobalDefault":"No global default","browseMoreModels":"Browse more models…","backToModels":"Back to models","selectProvider":"Select provider","searchModels":"Search models…","loadingModels":"Loading models…","noModelsFound":"No matching models","noProviderModels":"No models available for this provider","noConfiguredProviders":"No providers configured","addAndSwitch":"Add & switch","alreadyAdded":"Added","addingModel":"Adding…","currentModel":"Current","loadModelsFailed":"Failed to load models","addModelFailed":"Failed to add model","switchModelFailed":"Failed to switch model","modelsSourceProviderApi":"Fetched live from provider API","modelsSourceCatalog":"From model catalog (models.dev)","assistantLabel":"DeepSeekCode","thoughtProcess":"Thought process","runningSteps":"Running","stepCount":"step","stepCountPlural":"steps","copyMessage":"Copy","regenerate":"Regenerate","deleteMessage":"Delete message","historyCount":"{{n}} items","startChatHint":"Start a conversation first","panelTitle":"Panel","messageDeleted":"Message deleted","thinking":"Thinking","askAnswerPlaceholder":"Type your answer...","askAnswered":"✓ Answered","askAutoContinue":"⏱ Auto-continue with the recommended option in {{seconds}}s if unanswered","askBackToEdit":"Back to edit","askBatchTitle":"Batch confirmation","askConfirmQuestion":"Confirm this question","askCustomDesc":"Enter a custom answer","askCustomTag":"(custom)","askDirectTag":"(continue directly)","askEmptyInputValue":"(no input)","askEnterHint":"Enter to submit, Shift+Enter for newline","askFinishQuestion":"Finish question ({{count}} selected)","askMultiHintBatch":"Click options to check them, then click \\"Finish question\\" to submit; \\"Proceed\\" means continue by AI judgment","askMultiHintSingle":"Click options to check them, then click \\"Submit selected\\" to submit; \\"Proceed\\" means continue by AI judgment","askNextQuestion":"Next","askNotAnswered":"Not answered","askOtherLabel":"Other (I'll explain)","askPendingBadge":"Pending","askPrevQuestion":"Previous","askProceedDesc":"Don't pick a specific option — continue with your best judgment","askProceedLabel":"Proceed","askReviewTitle":"Review answers","askSingleHintBatch":"Click an option to answer and move on, or click \\"Confirm this question\\" to submit the highlighted option","askSingleHintSingle":"Click an option to submit immediately, or click \\"Submit\\" below to confirm the current option","askSingleTitle":"Please answer","askSubmit":"Submit","askSubmitAll":"Submit all answers","askSubmitSelected":"Submit selected ({{count}})","askSubmitting":"Submitting...","askUnansweredValue":"(not answered)","askUnansweredWarning":"{{count}} question(s) unanswered — they will be recorded as \\"Not answered\\". Click a question number above to go back and edit.","askViewSubmit":"Review & submit","assemblyOrderHint":"In backend context assembly order (top→bottom): system prompt → system tools → MCP tools → skills → messages → other (estimated gap)","avgCacheHitRate":"Avg cache hit rate","byAssemblyOrder":"By assembly order ↓","cacheHitTitle":"Cache hit {{hit}} / miss {{miss}} ({{calls}} calls)","cacheNoStats":"No cache stats yet (provider did not report prompt_cache_hit/miss fields)","cacheWaitingRun":"Run in progress — waiting for provider cache stats","categoryBreakdown":"Category breakdown","contextCapacity":"Context capacity","ctxMcpTools":"MCP tools","ctxMessages":"Messages","ctxOther":"Other","ctxSkills":"Skills","ctxSystemPrompt":"System prompt","ctxSystemTools":"System tools","distAssistantMessages":"Assistant messages","distToolRequest":"Tool requests","distToolResult":"Tool results","distUserMessages":"User messages","duplicateReads":"⚠️ Duplicate reads: {{pct}}%","enterInsertMulti":"Enter to insert · multi-select supported","fileMentionHelpMulti":"↑↓ Select · Enter insert (multi-select) · Esc close","finishMention":"Done","keepPercent":"{{pct}}% kept","lastCompactInfo":"Last compact: {{orig}}→{{comp}} · {{saved}} tok","noMatchingFiles":"No matching files","saveAsTemplate":"Save as template","searchingFiles":"Searching files...","selectedCountShort":"Selected {{n}}","selectedFilesCount":"{{n}} files selected","templateLibrary":"Template library","tokenDistribution":"Token distribution","unitWan":"×10K","unitYi":"×100M","viewContextDetail":"View context capacity details","loading":"Loading…","applyScopeGlobal":"Global","applyScopeSession":"This session","sessionScopeHint":"Applies to this session only; global default unchanged"}`),JL={title:"Keyboard Shortcuts",commandPalette:"Open command palette",clearLogs:"Clear logs",help:"Show shortcuts help",submit:"Submit input",newline:"New line",closeDialog:"Close dialog / pause generation",slashCommand:"Quick commands",fileRef:"Reference files",stopGen:"Stop generation (double Esc)"},eB={placeholder:"Search commands or jump to panel...",navGroup:"Navigation",commandGroup:"Commands",empty:"No matching commands",hint:"↑↓ Select · Enter Run · Esc Close",running:"Running..."},tB={openMenu:"Open menu",closeMenu:"Close menu",close:"Close",expand:"Expand",collapse:"Collapse",delete:"Delete",remove:"Remove",send:"Send message",newSession:"New session",messageInput:"Message input",connectionStatus:"Connection status",loading:"Loading",toggleAgentFlow:"Toggle agent flow",commandPalette:"Command palette",shortcutsHelp:"Shortcuts help"},nB={mode:"Mode",planMode:"Plan Mode — Read-only analysis",planModeDesc:"In Plan mode, AI uses read-only tools to analyze requirements and code without modifying any files.",planModeHint:"After analysis, switch to Act mode to implement changes.",switchToAct:"Switch to Act mode",actMode:"Act Mode",actModeDesc:"In Act mode, AI can read, modify files, and execute commands.",actModeHint:"Need to analyze first? Switch to Plan mode for read-only exploration.",switchToPlan:"Switch to Plan mode",readOnlyMode:"Read-only",planTitle:"Plan Mode: Read-only exploration, cannot modify code",actTitle:"Act Mode: Full read/write access",switchToPlanMode:"Switch to plan mode",switchToActMode:"Switch to act mode",autoMode:"Auto mode: auto-approve tool calls",goalMode:"Goal Mode",planModeShort:"Read-only analysis and planning",actModeShort:"Read/write files and run commands",goalModeShort:"Keep working toward the goal until done",autoApprove:"Auto Approve",autoApproveShort:"Auto-approve all tool calls",planContent:"Plan file content",analyzing:"Analyzing requirements...",modePlanTitle:"Plan Mode — Read-only exploration",modePlanDesc:"Read-only mode. AI can only read files and analyze code; no modifications are allowed. After analysis, use ExitPlanMode to switch to Act mode.",modeActTitle:"Act Mode — Execute",modeActDesc:"Read-write mode. AI can read, modify files, and execute commands. Low-risk operations are auto-approved; high-risk ones require confirmation.",modeGoalTitle:"Goal Mode — Goal-driven tasks",modeGoalDesc:"Goal-oriented execution mode. AI can read/write and execute within the active task scope; out-of-scope operations require confirmation.",modeNormalTitle:"Normal Mode — Standard interaction",modeNormalDesc:"Standard interaction mode. All tools work normally; writes and command execution require user confirmation.",readOnlyBadge:"🔒 Read-only",autoApproveBadge:"✅ Auto-approve",toPlanMode:"Switch to Plan Mode",toActMode:"Switch to Act Mode",modeCycleHint:"Mode cycle: Plan → Act → Goal; Auto is an independent toggle"},aB={title:"What's New"},rB={title:"Settings",theme:"Theme",themeDark:"🌙 Dark",themeLight:"☀️ Light",themeAuto:"🔄 Auto",themePresets:"Theme Presets",themePresetLinear:"Linear (minimal)",themePresetLinearDesc:"Neutral grays with a single accent — clean and focused",themePresetGithub:"GitHub",themePresetGithubDesc:"Neutral dark/light — clean and professional",themePresetCherry:"Cherry Studio",themePresetCherryDesc:"Blue gradient inspired — clean tech feel",themePresetOcean:"Ocean",themePresetOceanDesc:"Deep blue/cyan — calm and professional",themePresetMint:"Mint",themePresetMintDesc:"Teal/mint green — fresh and refreshing",themePresetLavender:"Lavender",themePresetLavenderDesc:"Soft purple — elegant and sophisticated",themePresetMidnight:"Midnight",themePresetMidnightDesc:"Deep navy — minimal and high contrast",themePresetSunset:"Sunset",themePresetSunsetDesc:"Warm orange/golden — energetic",themePresetForest:"Forest",themePresetForestDesc:"Natural green — earthy and calm",themePresetCandy:"Candy",themePresetCandyDesc:"Bright multi-color — vibrant and lively",themePresetNord:"Nord",themePresetNordDesc:"Arctic blue — popular well-designed palette",customOverrides:"Custom Overrides",customOverridesHint:"Tweak individual colors to override the active preset",customColors:"Custom Colors",colorBg:"Background",colorSurface:"Surface",colorBorder:"Border",colorText:"Text",colorMuted:"Muted Text",colorAccentBlue:"Accent Blue",colorAccentGreen:"Accent Green",colorAccentRed:"Accent Red",colorAccentYellow:"Accent Yellow",colorAccentPurple:"Accent Purple",resetColors:"Reset to default",about:"About",aboutDesc:"Web-based AI coding assistant interface",whatsNew:"What's New",language:"Language",languageZh:"中文",languageEn:"English",display:"Display",developerView:"Developer view (show raw tool calls)",developerViewHint:"Shows the AI activity feed by default; enable to see raw tool logs",capabilities:{title:"Agent Capabilities",loadFailed:"Failed to load capabilities",toggleFailed:"Toggle failed"},contextOffload:{title:"Context Offload (Artifact Store)",desc:"Large tool outputs are stored on disk as artifacts instead of living in the context forever. Only a summary + handle stays in context; the AI retrieves details on demand via artifact_query / artifact_read. This significantly reduces token usage in long sessions and improves cache hit rate.",enableLabel:"Enable tool-result offloading",currently:"currently",maxTotalMb:"Max total storage (MB)",ttlDays:"Retention (days)",outboundBytes:"Spill threshold (bytes; outputs larger are offloaded)",turnBudget:"Per-turn context growth budget (tokens)",dir:"Storage directory",optional:"optional, defaults to config dir",stats:"{{count}} artifacts stored, {{size}} MB total",saved:"Context Offload settings saved",saveFailed:"Failed to save",invalidNumber:"Number fields must be positive integers",envHint:"Fields marked ⚠ env are overridden by environment variables of the same name"}},sB={title:"Model Configuration",providerConfig:"Provider Config",configured:"Configured",notConfigured:"Not configured",modelsCount:"{{n}} models · {{apiType}}",clickToConfig:"Click to configure →",apiKeyHint:"API Key configured. Enter new key to overwrite.",apiKeyPlaceholder:"Enter new key to overwrite...",apiKeyDefaultPlaceholder:"sk-...",enterApiKey:"Please enter API Key",removeConfirm:'Are you sure you want to remove "{{providerKey}}" configuration? This will delete its API Key and models.',loadFailed:"Failed to load models",saveFailed:"Save failed",overallStatus:"Overall Status",healthy:"Healthy",degraded:"Degraded",abnormal:"Abnormal",healthRate:"Health Rate",onlineInstances:"Online Instances",totalRequests:"Total Requests",configuredModels:"Configured Models",addModel:"Add Model",provider_qwen:"Qwen (Tongyi Qianwen)",provider_glm:"GLM (Zhipu)",provider_baichuan:"Baichuan",provider_minimax:"MiniMax / Hailuo",provider_doubao:"Doubao",provider_hunyuan:"Tencent Hunyuan",provider_spark:"iFlytek Spark",provider_custom:"Custom",globalShort:"Global",setDefaultProvider:"Set as default provider",deleteProviderConfirm:'Delete the configuration for "{{key}}"?',deleteProvider:"Delete provider",catalogTitle:"models.dev Catalog Search",catalogSearchPlaceholder:"Search models across providers, e.g. gpt-4o / deepseek / claude... (matches model id, name, or provider)",catalogOnlyToolCall:"Tool call only",catalogOnlyReasoning:"Reasoning only",searching:"Searching...",catalogNoResults:"No matching models — try another keyword",badgeReasoning:"Reasoning",badgeToolCall:"Tools",badgeMultimodal:"Multimodal",ctxLimit:"Context {{k}}K",outLimit:"Output {{k}}K",catalogAddTitle:"Add to model ID input",add:"Add",catalogSourceHint:'Source: models.dev model catalog (built-in snapshot, works offline). Click "Add" to write the model ID into the Model ID input.',autoRemovedMissingModels:"Auto-removed models missing on server: {{models}}",autoSkippedMissingModels:"Auto-skipped models missing on server: {{models}}",defaultModelDisableBlocked:"Cannot disable {{name}}: switch the default model to another one first",deleteModelConfirm:"Remove model {{id}} from configuration?",connectionSuccessWithHints:"{{message}}. {{hints}}.",hintJoiner:"; ",loadingProviders:"Loading...",addProvider:"Add Provider",collapse:"Collapse",refreshList:"Refresh list",none:"None",availableCount:"{{n}} available",configuredCount:"{{n}} models",editProviderNamed:"Edit {{name}}",deleteProviderNamed:"Delete {{name}}",globalDefault:"Global default",planDefault:"Plan default",actDefault:"Act default",goalDefault:"Goal default",unsetActDefault:"Unset Act default",unsetPlanDefault:"Unset Plan default",unsetGoalDefault:"Unset Goal default",setActDefaultTitle:"Set as Act default",setPlanDefaultTitle:"Set as Plan default",setGoalDefaultTitle:"Set as Goal default",unsetActDefaultTitle:"Unset Act default (falls back to global default)",unsetPlanDefaultTitle:"Unset Plan default (falls back to global default)",unsetGoalDefaultTitle:"Unset Goal default (falls back to global default)",outputPrice:"Output price",inputPrice:"Input price",outputTokensLabel:"Output tokens",inputTokensLabel:"Input tokens",totalTokensLabel:"Total tokens",connectionSuccess:"Connected",baseUrlAutoCompleted:"Base URL auto-completed to {{url}}",apiTypeAutoSelected:"API type auto-selected as {{type}}",hasKey:"Key set",noKey:"No key",defaultShort:"Default",overrideBadge:"Override",overrideTitle:"Manually overridden model list",customBaseUrl:"Custom base URL",catalogSearch:"Search catalog models",close:"Close",apiTypeHint:"Leave empty to auto-detect protocol from Base URL",modelApiTypeLabel:"API type (catalog models)",modelApiTypeHint:"Response protocol for catalog models; defaults to provider setting",modelApiTypeEmpty:"No API types available in this catalog",addCustomProvider:"Add custom provider",configuredPanelPrefix:"Configured ",configuredPanelSuffix:" models",configuredPanelHint:"(applies instantly, two-way synced with Model IDs input)",fetchedPanelPrefix:"Fetched ",fetchedPanelMiddle:" models, selected ",fetchedPanelSuffix:"",fetchedPanelHint:"(checked models will be written into the Model IDs input)",fetchingModels:"Fetching...",fetchModels:"Fetch model list",baseUrlRequired:"Base URL is required",apiKeySanitized:"API Key contains invalid characters; filtered automatically",fetchedCount:"Fetched {{n}} models",fetchFailed:"Failed to fetch model list. Check Base URL and API Key",requestFailed:"Request failed",connectionFailed:"Connection failed",catalogSearchFailed:"Catalog search failed",addedModel:"Added {{id}}",operationFailed:"Operation failed, please retry",providerNameRequired:"Provider name is required",apiKeyRequired:"At least one API Key is required",defaultsAutoUpdated:"Default models updated automatically",unknownError:"Unknown error",loading:"Loading...",providerListRefreshed:"Provider list refreshed",refreshFailed:"Refresh failed, please try again later",refreshListTitle:"Refresh provider list from remote",providerSearchPlaceholder:"Search providers / models...",clear:"Clear",clearSearch:"Clear search",noMatchingProviders:"No matching providers",noMatchingProvidersHint:'No provider matches "{{query}}". Check the spelling or use the full list',noModelsInProvider:"No models in this provider",noDefaultModel:"No default model",defaultProviderBadge:"Default provider",loadLabel:"Load",setGlobalDefaultFailed:"Failed to set global default",setGlobalDefaultTitle:"Set as global default",setPlanDefaultFailed:"Failed to set Plan default",unsetPlanDefaultFailed:"Failed to unset Plan default",setActDefaultFailed:"Failed to set Act default",unsetActDefaultFailed:"Failed to unset Act default",setGoalDefaultFailed:"Failed to set Goal default",unsetGoalDefaultFailed:"Failed to unset Goal default",editModel:"Edit model",deleteModel:"Delete model",refresh:"Refresh",reset:"Reset",enable:"Enable",disable:"Disable",emptyHint:"No models yet. Configure a provider above first",selectProvider:"Select provider",customProvider:"Custom provider",customProviderDesc:"Manually enter provider name, Base URL and model IDs",editExistingConfig:"Edit existing configuration (optional)",newCustomProviderOption:"+ New custom provider",editExistingConfigHint:"Starts empty by default; pick a saved configuration to refill the form (API Keys are never echoed back; leave empty to keep the saved key).",providerNameLabel:"Provider name *",providerNamePlaceholder:"e.g. my-provider",apiKeysHintConfigured:", leave empty to keep the saved key",apiKeysHintNew:"(one per line, multiple allowed)",apiKeyMultiPlaceholder:`One API Key per line
466
+ bg-dark-bg border border-dark-border rounded p-3 custom-scrollbar`,style:{scrollbarWidth:"thin",scrollbarColor:"#30363d transparent"},children:u.content||y.jsx("span",{className:"text-dark-muted italic",children:n("logs.emptyFile")})})]})]}):y.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[y.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[y.jsx("span",{className:"text-xs font-medium text-dark-text",children:n("logs.files")}),y.jsx("button",{onClick:p,className:"px-2 py-1 text-[10px] bg-dark-hover rounded hover:bg-dark-border transition-colors",disabled:a,children:n(a?"logs.refreshing":"logs.refresh")})]}),a?y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsx(Ga,{size:16,className:"animate-spin text-accent-blue"})}):e.length===0?y.jsxs("div",{className:"text-center py-8 text-dark-muted",children:[y.jsx(Jo,{size:32,className:"mx-auto mb-1 opacity-50"}),y.jsx("p",{className:"text-xs",children:n("logs.noFiles")})]}):y.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-1 custom-scrollbar",children:e.map(_=>y.jsxs("div",{className:"flex items-center gap-2 p-2 rounded hover:bg-dark-hover transition-colors group",children:[y.jsx(Jo,{size:14,className:"text-accent-blue shrink-0"}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("div",{className:"text-xs text-dark-text truncate",children:_.name}),y.jsxs("div",{className:"text-[10px] text-dark-muted",children:[w(_.size)," · ",tL(_.modified)]})]}),y.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[_.previewable&&y.jsx("button",{onClick:()=>b(_),className:"p-1.5 rounded hover:bg-dark-border transition-colors",title:n("logs.preview"),children:y.jsx(LS,{size:14})}),y.jsx("a",{href:ht.logs.downloadUrl(_.name),download:_.name,className:"p-1.5 rounded hover:bg-dark-border transition-colors block",title:n("logs.download"),children:y.jsx(zc,{size:14})})]})]},_.name))})]})}const p3=O.memo(O.forwardRef(function({logs:e},t){const{t:a}=vt();return y.jsx("div",{ref:t,className:"flex-1 overflow-y-auto min-h-0 font-mono text-xs space-y-0.5 custom-scrollbar",children:e.length===0?y.jsxs("div",{className:"text-center text-dark-muted py-12",children:[y.jsx(Ac,{size:48,className:"mx-auto mb-2 opacity-50"}),y.jsx("p",{children:a("logs.noLogs")})]}):e.map(s=>y.jsxs("div",{className:`p-2 rounded hover:bg-dark-surface transition-colors ${s.level==="error"?"bg-accent-red/10":s.level==="warn"?"bg-accent-yellow/10":s.level==="success"?"bg-accent-green/10":""}`,children:[y.jsx("span",{className:"text-dark-muted text-xs",children:new Date(s.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})})," ",y.jsx("span",{className:`px-1.5 py-0.5 rounded text-white text-xs ${eL[s.level]}`,children:s.level.toUpperCase()})," ",y.jsxs("span",{className:"text-dark-muted text-xs",children:["[",s.source,"]"]})," ",y.jsx("span",{className:"text-dark-text whitespace-pre-wrap break-all",children:s.message})]},s.id))})})),aL=O.memo(function({logs:e,onClear:t,compact:a}){const{t:s}=vt(),[o,l]=O.useState("stream"),u=O.useRef(null),d=O.useRef(!0),h=O.useCallback(()=>{const p=u.current;return p?p.scrollHeight-p.scrollTop-p.clientHeight<50:!0},[]),m=O.useCallback(()=>{const p=u.current;p&&(p.scrollTop=p.scrollHeight)},[]);return O.useEffect(()=>{const p=u.current;if(!p)return;const b=()=>{d.current=h()};return p.addEventListener("scroll",b,{passive:!0}),()=>p.removeEventListener("scroll",b)},[h]),O.useEffect(()=>{d.current&&m()},[e,m]),O.useEffect(()=>{const p=u.current;if(!p)return;let b=p.clientHeight;const x=new ResizeObserver(()=>{const w=p.clientHeight;w>0&&b===0&&m(),b=w});return x.observe(p),()=>x.disconnect()},[m]),a?y.jsxs("div",{className:"flex flex-col min-h-0 flex-1 p-2",children:[y.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[y.jsxs("h2",{className:"flex items-center gap-2 text-xs font-semibold",children:[y.jsx(Ac,{size:14,className:"text-accent-blue"}),s("logs.title"),y.jsxs("span",{className:"text-sm font-normal text-dark-muted",children:["(",e.length,")"]})]}),y.jsx("button",{onClick:t,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-2 py-1 text-[10px]",children:s("logs.clear")})]}),y.jsx(p3,{ref:u,logs:e})]}):y.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden p-4",children:[y.jsx("div",{className:"flex items-center justify-between mb-3 shrink-0",children:y.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[y.jsx(Ac,{size:18,className:"text-accent-blue"}),s("logs.backendLogs")]})}),y.jsx("div",{className:"flex gap-1 mb-3 shrink-0 border-b border-dark-border",children:[["stream",s("logs.streamTab"),Ac],["files",s("logs.files"),Jo]].map(([p,b,x])=>y.jsxs("button",{onClick:()=>l(p),className:`flex items-center gap-1.5 px-4 py-2 text-sm rounded-t transition-colors border-b-2 ${o===p?"border-accent-blue text-accent-blue bg-accent-blue/5":"border-transparent text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:[y.jsx(x,{size:14}),b,p==="stream"&&e.length>0&&y.jsxs("span",{className:"ml-1 text-[10px] text-dark-muted",children:["(",e.length,")"]})]},p))}),o==="stream"&&y.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[y.jsx("div",{className:"flex items-center justify-end mb-2 shrink-0",children:y.jsx("button",{onClick:t,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-3 py-1.5 text-sm",children:s("logs.clear")})}),y.jsx(p3,{ref:u,logs:e})]}),o==="files"&&y.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:y.jsx("div",{className:"border border-dark-border rounded-lg p-3 bg-dark-surface h-full",children:y.jsx(nL,{})})})]})}),rL=n=>{if(n==null||n==="")return{};if(typeof n!="string")return n;try{return JSON.parse(n)}catch{return n}},qd=(n,e="")=>typeof n=="string"?n:String((n==null?void 0:n.content)||(n==null?void 0:n.message)||(n==null?void 0:n.text)||(n==null?void 0:n.error)||e||""),sL=n=>Array.isArray(n)?n:Array.isArray(n==null?void 0:n.tasks)?n.tasks:Array.isArray(n==null?void 0:n.items)?n.items:Array.isArray(n==null?void 0:n.planTasks)?n.planTasks:[],wp=(n,e,t=0)=>{const a=String(n.id||n.taskId||n.backendId||`plan-task-${t+1}`),s=Sr(n.status||n.planStatus,n.completed),o=Date.now()+t;return{id:a,sessionId:e,title:String(n.title||n.name||n.content||n.description||`Task ${t+1}`),description:n.description||n.details||n.content,status:s,source:"plan",agentType:n.agentType||n.agent||n.role,progress:n.progress!=null?Number(n.progress):void 0,result:n.result,error:n.error,dependencies:Array.isArray(n.dependencies)?n.dependencies.map(String):void 0,startedAt:n.startedAt?Number(n.startedAt):s==="running"?o:void 0,completedAt:n.completedAt?Number(n.completedAt):s==="completed"||s==="failed"?o:void 0,createdAt:n.createdAt&&Number(n.createdAt)||o,updatedAt:o,raw:n}},g3=(n,e,t=0)=>{const a=String(n.id||n.taskId||n.backendId||`goal-task-${t+1}`),s=Sr(n.status),o=Date.now()+t;return{id:a,sessionId:e,title:String(n.title||n.name||n.content||n.description||`Task ${t+1}`),description:n.description||n.details||n.content,status:s,source:"goal",agentType:n.agentType||n.agent||n.role,progress:n.progress!=null?Number(n.progress):void 0,result:n.result,error:n.error,dependencies:Array.isArray(n.parentIds)?n.parentIds.map(String):void 0,startedAt:n.startedAt?Number(n.startedAt):s==="running"?o:void 0,completedAt:n.completedAt?Number(n.completedAt):s==="completed"||s==="failed"?o:void 0,createdAt:n.createdAt&&Number(n.createdAt)||o,updatedAt:n.updatedAt?Number(n.updatedAt):o,raw:n}},iL=(n,e)=>{const t=String((e==null?void 0:e.taskId)||(e==null?void 0:e.id)||"");if(!t)return;const a=wt.getState().getTasksForSession(n).find(u=>u.id===t),s=Ke.getState().getSessionTasks(n).find(u=>u.id===t||u.backendId===t),o=e!=null&&e.status?Sr(e.status):(a==null?void 0:a.status)||"pending",l={id:t,sessionId:n,title:(e==null?void 0:e.title)||(a==null?void 0:a.title)||(s==null?void 0:s.title)||t,description:(e==null?void 0:e.description)??(a==null?void 0:a.description)??(s==null?void 0:s.description),status:o,source:"goal",agentType:(e==null?void 0:e.agentType)||(a==null?void 0:a.agentType),progress:(e==null?void 0:e.progress)!=null?Number(e.progress):a==null?void 0:a.progress,result:(e==null?void 0:e.result)??(a==null?void 0:a.result),error:(e==null?void 0:e.error)??(a==null?void 0:a.error),startedAt:o==="running"?Date.now():a==null?void 0:a.startedAt,completedAt:o==="completed"||o==="failed"?Date.now():a==null?void 0:a.completedAt,createdAt:(a==null?void 0:a.createdAt)||Date.now(),updatedAt:Date.now(),raw:e};return wt.getState().upsertTask(n,l),zg(n,l),l},Cc=n=>({id:n.id,title:n.title,completed:n.status==="completed",createdAt:n.createdAt,description:n.description,planStatus:n.status,agentType:n.agentType,dependencies:n.dependencies,result:n.result,error:n.error,startedAt:n.startedAt,completedAt:n.completedAt,progress:n.progress}),zg=(n,e)=>{const t=Ke.getState(),a=t.getSessionTasks(n),s=Cc(e);if(a.some(o=>o.id===e.id||o.backendId===e.id)){t.updateTaskPlanStatus(n,e.id,s);return}t.setSessionTasks(n,[...a,s])},Vd=n=>{const e=Ue.getState(),t=e.getMessages(n),a=t[t.length-1];(!a||a.type!=="assistant")&&e.addMessage(n,{id:`plan-${Date.now()}`,type:"assistant",content:"",timestamp:Date.now()})};function y3(n,e,t){const a=Zo.getState(),s=Ue.getState(),o=wt.getState(),l=rL(e);switch(n){case"plan_start":{s.startGeneration(t),Vd(t);const u=qd(l,"Plan started");u&&a.setThinkingStatus(t,u),o.recordEvent(t,{type:n,source:"plan",title:"Plan started",message:u,status:"running",data:l});break}case"plan_thinking":{const u=qd(l,"Analyzing request...");a.setThinkingStatus(t,u),Vd(t),s.setThinking(t,u),o.recordEvent(t,{type:n,source:"plan",title:"Plan thinking",message:u,status:"running",data:l});break}case"plan_complete":{const u=(l==null?void 0:l.plan)||(l==null?void 0:l.content)||(l==null?void 0:l.result)||(l==null?void 0:l.markdown);if(u){a.setPlanContent(String(u)),Vd(t);const d=s.getMessages(t),h=d[d.length-1];(h==null?void 0:h.type)==="assistant"&&!h.content.trim()&&s.updateLastMessage(t,String(u))}else{const d=[...s.getMessages(t)].reverse().find(h=>h.type==="assistant");d!=null&&d.content&&a.setPlanContent(d.content)}s.endGeneration(t),o.recordEvent(t,{type:n,source:"plan",title:"Plan complete",message:qd(l,"Plan complete"),status:"completed",data:l});break}case"plan_error":{const u=qd(l,"Plan failed");Vd(t),s.updateLastMessage(t,`Plan failed: ${u}`),s.endGeneration(t,u),o.recordEvent(t,{type:n,source:"plan",title:"Plan failed",message:u,status:"failed",data:l});break}case"plan_tasks":{const u=sL(l).map((d,h)=>wp(d,t,h));o.setTasks(t,u,"plan"),Ke.getState().setSessionTasks(t,u.map(Cc)),o.recordEvent(t,{type:n,source:"plan",title:"Plan tasks updated",message:`${u.length} tasks`,status:"pending",data:l});break}case"plan_task_start":case"plan_task_update":case"plan_task_result":{const u=wp(l,t),d=n==="plan_task_start"?"running":Sr(n==="plan_task_result"?l.status||(l.error?"failed":"completed"):l.status||l.planStatus),h={...u,status:d,startedAt:u.startedAt||(d==="running"?Date.now():void 0),completedAt:u.completedAt||(d==="completed"||d==="failed"?Date.now():void 0)};o.upsertTask(t,h),zg(t,h),o.recordEvent(t,{type:n,source:"plan",title:h.title,message:h.result||h.error||h.description,status:h.status,taskId:h.id,data:l});break}case"plan_task_complete":{const u=wp(l,t),d=String(l.status||"")==="failed"||!!l.error,m={...u,status:d?"failed":"completed",completedAt:u.completedAt||Date.now()};o.upsertTask(t,m),zg(t,m),o.recordEvent(t,{type:n,source:"plan",title:m.title,message:m.result||m.error||m.description,status:m.status,taskId:m.id,data:l});const p=m.title||`task ${m.id}`;d?Ze.error(`✘ ${p} 失败`,6e3):Ze.success(`✓ ${p} 完成`,4e3);break}case"plan_subagent_start":{const u=(l==null?void 0:l.scope)||(l==null?void 0:l.agentId)||"design sub-agent";o.recordEvent(t,{type:n,source:"plan",title:`设计子代理: ${u}`,message:(l==null?void 0:l.title)||"Reading codebase and designing implementation details...",status:"running",data:l});break}case"plan_subagent_done":{const u=(l==null?void 0:l.scope)||(l==null?void 0:l.agentId)||"design sub-agent",d=(l==null?void 0:l.status)==="error"||(l==null?void 0:l.status)==="timeout"||(l==null?void 0:l.status)==="max_iterations"||!!(l!=null&&l.error);o.recordEvent(t,{type:n,source:"plan",title:`设计子代理: ${u}`,message:d?`设计失败: ${(l==null?void 0:l.error)||(l==null?void 0:l.status)||"error"}`:l!=null&&l.designDocPath?`设计完成 → ${l.designDocPath}`:"设计完成",status:d?"failed":"completed",data:l});break}case"plan_mode_change":{const u=(l==null?void 0:l.frontendMode)||(l==null?void 0:l.newMode),d=l==null?void 0:l.planPath;u==="normal"?a.applyBackendMode("normal"):u==="auto"?a.setAuto(!0):(u==="plan"||u==="act"||u==="goal"||u==="auto-plan"||u==="auto-act"||u==="auto-goal")&&a.applyBackendMode(u);const h=d?` [plan: ${d}]`:"";o.recordEvent(t,{type:n,source:"system",title:"Mode changed",message:`${(l==null?void 0:l.previousMode)||"unknown"} -> ${u||"unknown"}${h}`,status:(l==null?void 0:l.success)===!1?"failed":"completed",data:l});break}case"goal_created":{o.recordEvent(t,{type:n,source:"goal",title:(l==null?void 0:l.goalTitle)||(l==null?void 0:l.title)||"Goal created",message:l!=null&&l.goalId?`Goal ${l.goalId}`:"Goal created",status:"pending",data:l});break}case"goal_tasks":{const u=Array.isArray(l==null?void 0:l.tasks)?l.tasks.map((d,h)=>g3(d,t,h)):[];o.setTasks(t,u,"goal"),Ke.getState().setSessionTasks(t,u.map(Cc)),o.recordEvent(t,{type:n,source:"goal",title:(l==null?void 0:l.goalTitle)||"Goal tasks",message:`${u.length} tasks`,status:"pending",data:l});break}case"goal_task_update":{const u=String((l==null?void 0:l.taskId)||(l==null?void 0:l.id)||""),d=iL(t,l);o.recordEvent(t,{type:n,source:"goal",title:(d==null?void 0:d.title)||u||"Goal task update",message:(l==null?void 0:l.result)||(l==null?void 0:l.error)||(l!=null&&l.status?`status: ${l.status}`:"updated"),status:d==null?void 0:d.status,taskId:u||void 0,data:l});break}case"goal_update":{const u=Array.isArray(l==null?void 0:l.tasks)?l.tasks.map((d,h)=>g3(d,t,h)):[];o.setTasks(t,u,"goal"),Ke.getState().setSessionTasks(t,u.map(Cc)),o.recordEvent(t,{type:n,source:"goal",title:(l==null?void 0:l.goalTitle)||(l==null?void 0:l.title)||"Goal update",message:(l==null?void 0:l.status)||(l!=null&&l.id?`Goal ${l.id}`:"Goal updated"),status:l!=null&&l.status?Sr(l.status):void 0,data:l});break}case"goal_completed":{const u=String((l==null?void 0:l.goalId)||""),d=o.getTasksForSession(t).filter(h=>h.source==="goal");if(d.length>0){const h=d.map(m=>m.status==="pending"||m.status==="running"?{...m,status:"completed",completedAt:Date.now(),updatedAt:Date.now()}:m);o.setTasks(t,h,"goal"),Ke.getState().setSessionTasks(t,h.map(Cc))}o.recordEvent(t,{type:n,source:"goal",title:l!=null&&l.goalTitle?`Goal 完成: ${String(l.goalTitle).slice(0,60)}`:"Goal completed",message:l!=null&&l.result?String(l.result).slice(0,200):u?`Goal ${u} completed`:"Goal completed",status:"completed",data:l});break}}}const oL={confirm:"确认",cancel:"取消",save:"保存",saving:"保存中...",delete:"删除",close:"关闭",refresh:"刷新",retry:"重试",loading:"加载中...",collapse:"折叠",expand:"展开",collapse_short:"收起",clear:"清空",noData:"暂无数据",noResults:"暂无结果",unknown:"未知",unknownError:"未知错误",connecting:"连接中…",back:"返回",send:"发送",copy:"复制",copied:"已复制",search:"搜索...",filter:"全部",pageInfo:"显示 {{start}}-{{end}} 条,共 {{total}} 条",prevPage:"上一页",nextPage:"下一页",enabled:"已启用",disabled:"已禁用",online:"在线",offline:"离线",busy:"忙碌",away:"离开",default:"默认"},lL={chat:"对话",terminal:"终端",files:"文件",models:"模型",tools:"工具",skills:"技能",templates:"预设",hooks:"Hooks",agentFlow:"Agent Flow",settings:"设置",logs:"日志",channels:"频道",sessions:"会话",groupWorkspace:"工作台",groupConfig:"配置",groupSystem:"系统",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",moreOptions:"更多",scheduled:"定时任务",plugins:"插件",mySessions:"我的会话",sessionRunning:"运行中",sessionWaiting:"待确认",sessionFailed:"失败",sessionDone:"已完成",connectors:"连接器",pin:"置顶",unpin:"取消置顶",pinMore:"置顶「更多」",unpinMore:"取消置顶「更多」",clearSessionSearch:"清除会话搜索",searchSessions:"搜索会话",searchSessionsPlaceholder:"搜索会话..."},cL={newSession:"新建会话",noSessions:"暂无会话",renameSession:"重命名会话",exportMd:"导出为 Markdown",you:"你",thinkingEllipsis:"思考中…",messageRail:"消息导航",messageIndex:"对话索引",backToBottom:"回到最新消息",generatingPlaceholder:"AI 正在生成中…",defaultSessionTitle:"对话 {{n}}",welcome:"欢迎使用 deepseekcode",welcomeDesc:"我可以帮你编写代码、分析项目、自动化任务。试试发送一条消息吧!",suggestionCode:"代码编写",suggestionCodePrompt:"用 Python 实现快速排序,并解释它的时间复杂度",suggestionAnalyze:"代码分析",suggestionAnalyzePrompt:"分析当前项目的目录结构,告诉我它是如何组织的",suggestionAutomate:"自动化任务",suggestionAutomatePrompt:"帮我写一个脚本,自动整理当前目录下的文件",quickCommands:"查看快捷命令",refFiles:"引用文件",inputPlaceholder:"输入消息... Shift+Enter 换行,/ 命令,@ 引用文件,↑ 历史",charTokens:"{{chars}} 字符 · ~{{tokens}} tokens",nearLimit:"接近上限",shiftEnter:"Shift+Enter 换行",escHint:"Esc 暂停 · 双击 Esc 停止",resume:"恢复",resumeGen:"恢复生成",stop:"终止",stopGen:"终止生成",pause:"暂停",pauseGen:"暂停生成",sendBtn:"发送",voiceInput:"语音输入",voiceListening:"正在聆听...",voiceTranscribing:"识别中...",voiceUnsupported:"当前浏览器不支持语音输入",voiceError:"语音识别出错,请重试",connected:"已连接",disconnected:"未连接",sessionHistory:"会话历史",noHistory:"暂无历史会话",clearHistory:"清空历史",clearHistoryTitle:"清空历史",restoreSession:"点击恢复「{{title}}」",removeFromHistory:"从历史移除",viewAllSessions:"更多会话",allSessions:"全部会话",sessionPickerTitle:"选择会话",clickToOpenSession:"打开会话",workingDir:"工作目录",switchDir:"切换",clickToSwitchDir:"点击切换工作目录",switchDirPrompt:"请输入新的工作目录路径:",addTask:"添加",addTaskPlaceholder:"添加任务...",noTasks:"暂无任务,在上方输入添加",taskBoardDragHint:"下拉展开 · 上推收起 · 点击切换",doubleClickEdit:"双击编辑",deleteTask:"删除任务",backgroundLogs:"后台日志",effort:"推理力度",effortOff:"关闭思考",effortLow:"低",effortMedium:"中",effortHigh:"高",effortExtraHigh:"超高",effortMax:"最高",noWorkspaceDir:"未设置工作目录",recentDirs:"最近记录",noRecentDirs:"暂无最近目录",chooseOtherDir:"选择其他目录…",dirPickerTitle:"选择工作目录",dirPickerEnterPath:"输入完整路径后回车跳转",dirPickerGo:"跳转",dirPickerUp:"上一级",dirPickerNoDirs:"无子目录",dirPickerConfirm:"选择此目录",dirPickerLoadError:"目录读取失败",artifactPanel:"AI 输出物",workspaceTitle:"工作台",workspaceToggle:"切换到工作台",artifactsToggle:"切换到输出物",workspaceHint:"工作台为 AI Agent 工作区:组件按动态布局加载,可响应事件与命令。",artifactEmpty:"暂无输出文件。点击聊天中的文件 / 路径链接即可在右侧预览。",artifactHint:"点击聊天中的文件 / 路径链接即可在右侧预览;拖拽边缘可调整宽度,右上角可最大化",previewInPanel:"预览",backToArtifacts:"返回清单",openInNewTab:"新标签页打开",copyPath:"复制路径",copiedPath:"已复制路径",copyPathFailed:"复制失败",filePreviewHint:"该文件类型不支持内嵌预览,可下载或在新标签页中打开。",sidebarProgress:"进度",sidebarArtifacts:"AI 输出物",sidebarOpen:"打开",sidebarOpenFolder:"打开首个输出文件",sidebarExpandAll:"展开全部",sidebarMaximize:"最大化",sidebarRestore:"恢复大小",sidebarWorking:"正在处理…",sidebarWorkingWithAgents:"正在处理({{n}} 个 Agent 运行中)…",sidebarWorkingToolcalls:"正在处理(已调用 {{n}} 次工具)…",sidebarIdle:"多步骤任务运行时,进度会显示在这里:计划、工具调用、审批与产出文件。",sidebarMoreTasks:"更多任务",sidebarRunningAgents:"{{n}} 个 Agent 运行中",sidebarToolcallsSoFar:"已调用 {{n}} 次工具",tokenPrompt:"提示词",tokenCompletion:"补全",tokenTotal:"总计",totalChars:"总字符数",avgTokens:"平均 token/条",estimatedCost:"预估成本: ${{cost}}",contextTrimming:"上下文裁剪",keepMore:"保留更多",trimMore:"裁剪更多",trimContext:"裁剪上下文 (保留 ~{{n}} 条消息)",currentMessages:"当前 {{n}} 条消息",totalCharsInfo:"· 共 {{n}} 字符",contextManager:"上下文管理",showContext:"显示上下文信息",taskBoard:"任务看板",morePending:"还有 {{n}} 个待处理任务...",moreCompleted:"还有 {{n}} 个已完成任务...",dependencyCount:"🔗 依赖 {{n}} 个任务",contextSuggestions:"展开 ({{n}}条建议)",collapseSuggestions:"收起",toolRequest:"工具请求: ",toolResult:"工具结果: ",memory:"记忆: ",filesCount:"({{n}}文件)",saveTokens:"可节省 ~{{n}}",ignoreSuggestion:"忽略此建议",fileMention:"@ 引用文件",fileMentionSearch:'@ 搜索: "{{query}}"',fileMentionHelp:"↑↓ 选择 · Enter 插入 · Esc 关闭",fileBrowser:"文件浏览器",fileSaved:"文件已保存",fileReadError:"读取文件失败",fileSaveError:"保存失败",fileModified:"● 已修改",selectFilePreview:"选择文件以预览或编辑",kbdHint:"命令面板",clickToSwitchMode:"点击切换模式 (Plan → Goal → Act)",selectModel:"选择模型",clickToSelectModel:"选择模型 / 推理力度",noEnabledModels:"暂无可用模型",globalDefault:"全局默认",planDefault:"Plan 默认",actDefault:"Act 默认",goalDefault:"Goal 默认",followGlobalDefault:"跟随全局默认",followGlobalDefaultHint:"清除本模式默认,回退到全局默认",sessionModel:"会话",sessionModelTitle:"仅本会话生效的模型覆盖(全局默认未改变)",noGlobalDefault:"未设置全局默认",browseMoreModels:"浏览 Provider 更多模型…",backToModels:"返回模型列表",selectProvider:"选择 Provider",searchModels:"搜索模型…",loadingModels:"加载模型列表…",noModelsFound:"未找到匹配的模型",noProviderModels:"该 Provider 暂无可用的模型列表",noConfiguredProviders:"暂未配置 Provider",addAndSwitch:"添加并切换",alreadyAdded:"已添加",addingModel:"添加中…",currentModel:"当前模型",loadModelsFailed:"获取模型列表失败",addModelFailed:"添加模型失败",switchModelFailed:"切换模型失败",modelsSourceProviderApi:"实时从 Provider API 获取",modelsSourceCatalog:"来自模型目录 (models.dev)",assistantLabel:"DeepSeekCode",thoughtProcess:"思维过程",runningSteps:"执行中",stepCount:"步",stepCountPlural:"步",copyMessage:"复制",regenerate:"重新生成",deleteMessage:"删除消息",historyCount:"{{n}} 条",startChatHint:"请先开始对话",panelTitle:"面板",messageDeleted:"消息已删除",thinking:"思考中",askAnswerPlaceholder:"输入您的回答...",askAnswered:"✓ 已回答",askAutoContinue:"⏱ {{seconds}}s 后未回答将自动按推荐项继续",askBackToEdit:"返回修改",askBatchTitle:"批量确认",askConfirmQuestion:"确认本题",askCustomDesc:"输入自定义答案",askCustomTag:"(自定义)",askDirectTag:"(直接继续)",askEmptyInputValue:"(用户未输入)",askEnterHint:"Enter 提交,Shift+Enter 换行",askFinishQuestion:"完成本题 ({{count}} 项)",askMultiHintBatch:"点击选项勾选,再点击「完成本题」提交本题;「推进」表示按 AI 判断继续",askMultiHintSingle:"点击选项勾选,再点击「提交所选」提交;「推进」表示按 AI 判断继续",askNextQuestion:"下一题",askNotAnswered:"未回答",askOtherLabel:"其他(我来说明)",askPendingBadge:"待回答",askPrevQuestion:"上一题",askProceedDesc:"不选具体项,按你的最佳判断继续",askProceedLabel:"推进",askReviewTitle:"确认答案",askSingleHintBatch:"点击选项完成本题自动进入下一题,或点击「确认本题」提交当前高亮项",askSingleHintSingle:"点击选项立即提交,或点击下方「提交」确认当前选项",askSingleTitle:"请回答",askSubmit:"提交",askSubmitAll:"提交全部答案",askSubmitSelected:"提交所选 ({{count}} 项)",askSubmitting:"提交中...",askUnansweredValue:"(用户未回答)",askUnansweredWarning:"有 {{count}} 题未回答,将记为「未回答」。点击上方题号可回到对应题目修改。",askViewSubmit:"查看提交",assemblyOrderHint:"按后端上下文组装顺序(上→下):系统提示词 → 系统工具 → MCP 工具 → 技能 → 消息 → 其他(估算差额)",avgCacheHitRate:"平均缓存命中率",byAssemblyOrder:"按组装顺序 ↓",cacheHitTitle:"缓存命中 {{hit}} / 未命中 {{miss}}({{calls}} 次调用)",cacheNoStats:"暂无缓存统计(provider 未返回 prompt_cache_hit/miss 字段)",cacheWaitingRun:"本轮 run 进行中,等待 provider 上报缓存统计",categoryBreakdown:"分类占比",contextCapacity:"上下文容量",ctxMcpTools:"MCP 工具",ctxMessages:"消息",ctxOther:"其他",ctxSkills:"技能",ctxSystemPrompt:"系统提示词",ctxSystemTools:"系统工具",distAssistantMessages:"助理消息",distToolRequest:"工具请求",distToolResult:"工具结果",distUserMessages:"用户消息",duplicateReads:"⚠️ 重复读取: {{pct}}%",enterInsertMulti:"Enter 插入 · 可连续多选",fileMentionHelpMulti:"↑↓ 选择 · Enter 插入(可连续多选)· Esc 关闭",finishMention:"完成引用",keepPercent:"{{pct}}% 保留",lastCompactInfo:"上次压缩: {{orig}}→{{comp}} · {{saved}} tok",noMatchingFiles:"未找到匹配的文件",saveAsTemplate:"保存为模板",searchingFiles:"搜索文件中...",selectedCountShort:"已选 {{n}}",selectedFilesCount:"已选 {{n}} 个文件",templateLibrary:"模板库",tokenDistribution:"Token 分布",unitWan:"万",unitYi:"亿",viewContextDetail:"查看上下文容量详情",loading:"加载中…",applyScopeGlobal:"全局",applyScopeSession:"仅本会话",sessionScopeHint:"仅对当前会话生效,不改变全局默认"},uL={title:"键盘快捷键",commandPalette:"打开命令面板",clearLogs:"清空日志",help:"显示快捷键帮助",submit:"提交输入",newline:"换行",closeDialog:"关闭弹窗 / 暂停生成",slashCommand:"快捷命令",fileRef:"引用文件",stopGen:"终止生成(连按两次 Esc)"},dL={placeholder:"搜索命令或跳转面板...",navGroup:"导航",commandGroup:"命令",empty:"没有匹配的命令",hint:"↑↓ 选择 · Enter 执行 · Esc 关闭",running:"执行中..."},fL={openMenu:"打开菜单",closeMenu:"关闭菜单",close:"关闭",expand:"展开",collapse:"折叠",delete:"删除",remove:"移除",send:"发送消息",newSession:"新建会话",messageInput:"消息输入框",connectionStatus:"连接状态",loading:"加载中",toggleAgentFlow:"切换 Agent 信息流",commandPalette:"命令面板",shortcutsHelp:"快捷键帮助"},hL={mode:"模式",planMode:"Plan 模式 — 只读分析",planModeDesc:"在 Plan 模式下,AI 将使用只读工具分析需求和代码,不会修改任何文件。",planModeHint:"分析完成后,请切换到 Act 模式执行具体实现。",switchToAct:"切换到 Act 模式执行",actMode:"Act 模式",actModeDesc:"在 Act 模式下,AI 可以读取、修改文件并执行命令。",actModeHint:"需要先分析需求?切换到 Plan 模式进行只读探索。",switchToPlan:"切换到 Plan 模式分析",readOnlyMode:"只读模式",planTitle:"Plan Mode:只读探索,不能修改代码",actTitle:"Act Mode:可以读写和执行",switchToPlanMode:"切换到规划模式",switchToActMode:"切换到执行模式",autoMode:"自动模式:自动批准工具调用",goalMode:"Goal 模式",planModeShort:"只读分析与规划,不修改文件",actModeShort:"读写文件并执行命令",goalModeShort:"围绕目标持续推进直到完成",autoApprove:"Auto 自动批准",autoApproveShort:"自动批准所有工具调用",planContent:"Plan 文件内容",analyzing:"正在分析需求...",modePlanTitle:"Plan 模式 — 只读探索",modePlanDesc:"只读模式。AI 只能读取文件和分析代码,不能进行任何修改。分析完成后使用 ExitPlanMode 切换到 Act 模式执行。",modeActTitle:"Act 模式 — 执行",modeActDesc:"读写模式。AI 可以读取、修改文件并执行命令。低风险操作自动放行,高风险操作需要确认。",modeGoalTitle:"Goal 模式 — 目标任务",modeGoalDesc:"面向目标的执行模式。AI 在活跃任务范围内可以读写和执行,超出范围的操作需要确认。",modeNormalTitle:"Normal 模式 — 标准交互",modeNormalDesc:"标准交互模式。所有工具正常使用,写操作和命令执行需要用户确认。",readOnlyBadge:"🔒 只读",autoApproveBadge:"✅ 自动审批",toPlanMode:"切换到 Plan 模式",toActMode:"切换到 Act 模式",modeCycleHint:"模式切换: Plan → Act → Goal 循环,Auto 为独立开关"},mL={title:"更新内容"},pL={title:"设置",theme:"主题",themeDark:"🌙 深色",themeLight:"☀️ 浅色",themeAuto:"🔄 自动",themePresets:"主题预设",themePresetLinear:"极简 Linear",themePresetLinearDesc:"中性灰 + 单一强调色 — 极简专业",themePresetGithub:"GitHub 默认",themePresetGithubDesc:"中性暗/亮色 — 简洁专业",themePresetCherry:"Cherry Studio",themePresetCherryDesc:"蓝色渐变 — 清爽科技感",themePresetOcean:"海洋 Ocean",themePresetOceanDesc:"深蓝/青色 — 冷静专业",themePresetMint:"薄荷 Mint",themePresetMintDesc:"青绿/薄荷 — 清新爽朗",themePresetLavender:"薰衣草 Lavender",themePresetLavenderDesc:"柔紫 — 优雅精致",themePresetMidnight:"午夜 Midnight",themePresetMidnightDesc:"深海军蓝 — 极简高对比",themePresetSunset:"日落 Sunset",themePresetSunsetDesc:"暖橙/金色 — 活力充沛",themePresetForest:"森林 Forest",themePresetForestDesc:"自然绿 — 大地色系宁静",themePresetCandy:"糖果 Candy",themePresetCandyDesc:"明亮多彩 — 活泼生动",themePresetNord:"Nord",themePresetNordDesc:"北极蓝 — 流行精心设计",customOverrides:"自定义覆盖",customOverridesHint:"调整单个颜色以覆盖当前主题预设",customColors:"自定义配色",colorBg:"背景色",colorSurface:"面板色",colorBorder:"边框色",colorText:"文字色",colorMuted:"次要文字",colorAccentBlue:"强调蓝",colorAccentGreen:"强调绿",colorAccentRed:"强调红",colorAccentYellow:"强调黄",colorAccentPurple:"强调紫",resetColors:"重置为默认配色",about:"关于",aboutDesc:"基于 Web 的 AI 编码助手界面",whatsNew:"查看更新内容",language:"语言",languageZh:"中文",languageEn:"English",display:"界面",developerView:"开发者视图(显示原始工具调用)",developerViewHint:"默认显示 AI 活动摘要;开启后显示原始工具日志",capabilities:{title:"Agent 能力管理",loadFailed:"能力配置加载失败",toggleFailed:"切换失败"},contextOffload:{title:"Context Offload(工具结果外置)",desc:"大体积工具输出不再整体进入上下文,而是存入磁盘 artifact 存储,上下文中只保留摘要与句柄;AI 需要细节时通过 artifact_query / artifact_read 按需取回。可显著降低长会话的 token 占用并提升缓存命中率。",enableLabel:"启用工具结果外置",currently:"当前生效",maxTotalMb:"存储总容量上限(MB)",ttlDays:"保留天数",outboundBytes:"外置触发阈值(字节,工具输出超过即外置)",turnBudget:"单轮上下文增长预算(token)",dir:"存储目录",optional:"可选,留空使用默认",stats:"当前已存储 {{count}} 个 artifact,共 {{size}} MB",saved:"Context Offload 设置已保存",saveFailed:"保存失败",invalidNumber:"数字字段必须为正整数",envHint:"标有 ⚠ env 的字段被同名环境变量覆盖,修改环境变量后重启生效"}},gL={title:"模型配置",providerConfig:"Provider 配置",configured:"已配置",notConfigured:"未配置",modelsCount:"{{n}} 个模型 · {{apiType}}",clickToConfig:"点击配置 →",apiKeyHint:"已配置 API Key,输入新 Key 将覆盖旧配置。",apiKeyPlaceholder:"输入新 Key 以覆盖...",apiKeyDefaultPlaceholder:"sk-...",enterApiKey:"请输入 API Key",removeConfirm:'确定要移除 "{{providerKey}}" 的配置吗?这将删除其 API Key 和模型。',loadFailed:"加载模型失败",saveFailed:"保存失败",overallStatus:"总体状态",healthy:"健康",degraded:"降级",abnormal:"异常",healthRate:"健康率",onlineInstances:"在线实例",totalRequests:"总请求数",configuredModels:"已配置模型",addModel:"添加模型",provider_qwen:"通义千问 (Qwen)",provider_glm:"智谱 (GLM)",provider_baichuan:"百川 (Baichuan)",provider_minimax:"MiniMax / 海螺",provider_doubao:"豆包 (Doubao)",provider_hunyuan:"腾讯混元 (Hunyuan)",provider_spark:"讯飞星火 (Spark)",provider_custom:"Custom (自定义)",globalShort:"全局",setDefaultProvider:"设为默认 Provider",deleteProviderConfirm:'确定要删除 "{{key}}" 的配置吗?',deleteProvider:"删除 Provider",catalogTitle:"models.dev 模型目录搜索",catalogSearchPlaceholder:"搜索全厂商模型,如 gpt-4o / deepseek / claude ...(匹配模型 id / 名称 / 厂商)",catalogOnlyToolCall:"仅工具调用",catalogOnlyReasoning:"仅推理模型",searching:"搜索中...",catalogNoResults:"无匹配模型,换个关键词试试",badgeReasoning:"推理",badgeToolCall:"工具",badgeMultimodal:"多模态",ctxLimit:"上下文 {{k}}K",outLimit:"输出 {{k}}K",catalogAddTitle:"添加到模型 ID 输入框",add:"添加",catalogSourceHint:"数据源:models.dev 模型目录(内置快照,离线可用)。点击「添加」将模型 ID 写入「模型 ID」输入框。",baseUrlRequired:"请先填写 Base URL",apiKeySanitized:"API Key 包含非法字符,已自动过滤",fetchedCount:"获取到 {{n}} 个模型",fetchFailed:"获取模型列表失败,请检查 Base URL 和 API Key",requestFailed:"请求失败",hintJoiner:";",connectionFailed:"连接失败",catalogSearchFailed:"目录搜索失败",addedModel:"已添加 {{id}}",operationFailed:"操作失败,请重试",providerNameRequired:"请先输入 Provider 名称",apiKeyRequired:"请至少输入一把 API Key",defaultsAutoUpdated:"已自动更新默认模型",unknownError:"未知错误",loading:"加载中...",providerListRefreshed:"Provider 列表已刷新",refreshFailed:"刷新失败,请稍后重试",refreshListTitle:"从远端刷新 Provider 列表",collapse:"收起",addProvider:"新增 Provider",providerSearchPlaceholder:"搜索 Provider 名称 / 模型...",clear:"清除",clearSearch:"清除搜索",noMatchingProviders:"未找到匹配的 Provider",noMatchingProvidersHint:"没有与「{{query}}」匹配的 Provider,请检查拼写或改用完整列表",noDefaultModel:"无默认模型",configuredCount:"{{n}} 个模型",availableCount:"{{n}} 可用",defaultProviderBadge:"默认 Provider",deleteProviderNamed:"删除 {{name}}",none:"无",loadLabel:"负载",inputPrice:"输入价格",outputPrice:"输出价格",inputTokensLabel:"输入 token",outputTokensLabel:"输出 token",totalTokensLabel:"总 token",setGlobalDefaultFailed:"设置全局默认失败",setGlobalDefaultTitle:"设为全局默认",setPlanDefaultFailed:"设置 Plan 默认失败",setPlanDefaultTitle:"设为 Plan 默认",unsetPlanDefaultFailed:"取消 Plan 默认失败",unsetPlanDefaultTitle:"取消 Plan 默认(该模式回退到全局默认)",setActDefaultFailed:"设置 Act 默认失败",setActDefaultTitle:"设为 Act 默认",unsetActDefaultFailed:"取消 Act 默认失败",unsetActDefaultTitle:"取消 Act 默认(该模式回退到全局默认)",setGoalDefaultFailed:"设置 Goal 默认失败",setGoalDefaultTitle:"设为 Goal 默认",unsetGoalDefaultFailed:"取消 Goal 默认失败",unsetGoalDefaultTitle:"取消 Goal 默认(该模式回退到全局默认)",editModel:"编辑模型",deleteModel:"删除模型",refresh:"刷新",enable:"启用",disable:"禁用",emptyHint:"暂无模型,请先在上方配置 Provider",selectProvider:"选择 Provider",customProvider:"自定义 Provider",customProviderDesc:"手动填写 Provider 名称、Base URL 和模型 ID",editExistingConfig:"编辑已有配置(可选)",newCustomProviderOption:"+ 新建自定义 Provider",editExistingConfigHint:"默认新建空表单;选择已保存的配置可回填继续编辑(API Key 不回显,留空保存即保留原 Key)。",providerNameLabel:"Provider 名称 *",providerNamePlaceholder:"例如: my-provider",apiKeysHintConfigured:",留空则保留已保存的 Key",apiKeysHintNew:"(每行一把,可多把)",apiKeyMultiPlaceholder:"每行输入一把 API Key\\n支持多把(运行时取第一把,其余备用)",modelIdLabel:"模型 ID",modelIdPlaceholder:"gpt-4o, deepseek-chat (格式: id|名称|别名)",fetchModelsTitle:"从 API 获取模型列表",fetchingModels:"获取中...",fetchModels:"获取模型列表",testConnectionTitle:"探测端点连通性,自动推断 API 类型并修复 Base URL",testingConnection:"测试中...",testConnection:"测试连接",catalogSearchTitle:"搜索 models.dev 全厂商模型目录(含 context/价格/能力元数据)",modelSearchPlaceholder:"搜索模型...",fullPathLabel:"完整路径(不自动拼接 /chat/completions、/responses、/v1/messages)",fullPathHint:"开启后 Base URL 按原样使用(如 https://host/v1/chat/completions),后端不再转换。",apiTypeLabel:"API 类型",apiTypeAutoDetect:"自动探测(推荐)",autoRemovedMissingModels:"已自动移除服务端不存在的模型:{{models}}",autoSkippedMissingModels:"已自动跳过服务端不存在的模型:{{models}}",defaultModelDisableBlocked:"无法禁用 {{name}}:请先将默认模型切换为其他模型",deleteModelConfirm:"确认从配置中删除模型 {{id}}?",connectionSuccessWithHints:"{{message}}。{{hints}}。",loadingProviders:"加载中...",refreshList:"刷新列表",editProviderNamed:"编辑 {{name}}",globalDefault:"全局默认",planDefault:"Plan 默认",actDefault:"Act 默认",goalDefault:"Goal 默认",unsetActDefault:"取消 Act 默认",unsetPlanDefault:"取消 Plan 默认",unsetGoalDefault:"取消 Goal 默认",connectionSuccess:"连接成功",baseUrlAutoCompleted:"Base URL 已自动补全为 {{url}}",apiTypeAutoSelected:"API 类型已自动选择为 {{type}}",hasKey:"已有 Key",noKey:"无 Key",defaultShort:"默认",overrideBadge:"覆盖",overrideTitle:"手动覆盖模型列表",customBaseUrl:"自定义 Base URL",catalogSearch:"搜索目录模型",close:"关闭",apiTypeHint:"留空 = 根据 Base URL 自动识别协议",modelApiTypeLabel:"API 类型(目录模型)",modelApiTypeHint:"目录模型的响应协议,默认跟随 Provider 设置",modelApiTypeEmpty:"当前目录没有可选的 API 类型",addCustomProvider:"新增自定义 Provider",configuredPanelPrefix:"已配置 ",configuredPanelSuffix:" 个模型",configuredPanelHint:"(勾选即时生效,与「模型 ID」输入框双向同步)",fetchedPanelPrefix:"已获取 ",fetchedPanelMiddle:" 个,已选 ",fetchedPanelSuffix:" 个",fetchedPanelHint:"(勾选将写入「模型 ID」输入框)",noModelsInProvider:"该 Provider 下暂无模型",reset:"重置",actIsGlobalHint:"全局默认 = Act 默认(二者合并),故不单独提供「设为 Act 默认」",globalDefaultUnsettable:"全局默认不可取消(当前会话必须有生效模型)"},yL={title:"工具列表",searchTools:"搜索工具...",disabled:"禁用",enabled:"启用",params:"参数",loadFailed:"加载工具失败",noTools:"暂无工具",loading:"加载中...",retry:"重试",refresh:"刷新",all:"全部",invalidData:"服务端返回的工具数据格式异常"},vL={title:"技能管理",list:"技能列表",noSkills:"暂无技能",loadFailed:"加载技能失败",loadFailedFallback:"加载失败",enable:"启用",disable:"禁用",enabled:"已启用",disabled:"已关闭",new:"新建技能",import:"导入",importTitle:"导入技能",edit:"编辑",save:"保存",cancel:"取消",retry:"重试",refresh:"刷新",tags:"标签",none:"无",source:"来源",localSkill:"本地技能",systemPrompt:"系统提示词",selectSkill:"选择一个技能",fieldId:"ID",fieldName:"名称",fieldCategory:"分类",fieldTrigger:"触发词",fieldTools:"所需工具",description:"描述",saving:"保存中",chooseFile:"选择技能文件",importHint:"支持 .skill.md 文件",marketplace:"技能市场",marketplaceDesc:"从远程市场浏览并安装技能",marketplaceTitle:"技能市场",addMarketplace:"添加市场",addMarketplaceTitle:"添加技能市场",marketplaceUrl:"市场地址",marketplaceUrlPlaceholder:"GitHub 仓库 / index.json 链接 / 本地技能文件夹,如 https://github.com/obra/superpowers 或 D:\\agent\\agentic-awesome-skills",marketplaceName:"市场名称(可选)",marketplaceHint:"支持 GitHub 仓库(自动扫描 skills/ 目录)、返回 index.json 的 URL、或本机技能文件夹(完全离线,直接浏览/安装磁盘上的技能库)。GitHub 无法访问时可设置 DEEPSEEKCODE_GITHUB_MIRROR 镜像加速。",marketFilterPlaceholder:"在当前市场搜索技能...",marketCategoryAll:"全部分类",riskCritical:"高危",riskUnknown:"风险未知",refreshMarketplace:"刷新",removeMarketplace:"移除市场",installSkill:"安装",installed:"已安装",installFail:"安装失败",loadMarketplaceFail:"加载技能市场失败",noMarketplaces:"暂无市场,先添加一个",noSkillsInMarket:"该市场暂无技能",marketplaceError:"市场索引加载失败:{{error}}",retryMarket:"重试",presets:"内置市场",marketplaces:"已添加的市场",skillCount:"{{count}} 个技能",installedSkills:"已安装技能",addFail:"添加市场失败",installing:"安装中...",adding:"添加中...",marketplaceTab:"技能市场",mineTab:"我的技能",installedTab:"已安装",workshopTab:"技能工坊",workshopHint:"技能提案:从会话/手动生成,审核后一键应用为技能",workshopPropose:"新建提案",workshopName:"技能名 (skill-name) 如 format-json",workshopTrigger:"触发关键词(可选)",workshopDescription:"一句话描述",workshopContent:"技能正文(系统提示 / 工作流指令)",workshopSubmit:"提交提案",workshopApply:"应用",workshopEmpty:"暂无技能提案",workshopFormRequired:"技能名和正文为必填",uninstall:"卸载",uninstallConfirm:"确定卸载已安装技能「{{name}}」?",uninstalling:"卸载中...",uninstallFail:"卸载失败",pagePrev:"上一页",pageNext:"下一页",pageOf:"第 {{page}} / {{total}} 页",emptyInstalled:"还没有已安装的市场技能",emptyInstalledHint:"前往「技能市场」浏览并下载安装",browseMarket:"去市场逛逛",use:"使用",useHint:"使用此技能:将 $技能名 插入输入框,补充任务描述后发送",pickTitle:"选择技能",pickPlaceholder:"搜索技能...",pickEmpty:"没有可用的技能",pickUse:"点击使用"},bL={permissionRequest:"权限申请",hookApproval:"Hook 拦截审批",hookConfirm:"Hook 请求确认",morePending:"还有 {{n}} 项待审批",tool:"工具:",reason:"原因:",needConfirm:"需要用户确认此操作",allow:"允许",deny:"拒绝",allowAlways:"本次会话始终允许",allowAlwaysDesc:"当前会话中不再询问此工具",autoMode:"自动模式",autoModeLabel:"自动模式(全部允许)",autoModeDesc:"自动批准所有 Hook 请求",moreOptions:"更多选项",highRiskWarning:"此操作可能造成不可逆的影响,请仔细确认",mediumRiskConfirm:"请确认此操作为预期行为",alreadyAllowed:"已允许:",alreadyDenied:"已拒绝:",risk_critical:"破坏性操作 - 可能删除数据",risk_critical_cmd:"高危命令 - 包含系统级操作",risk_high_shell:"Shell 命令执行",risk_high_file:"文件写入操作",risk_high_pkg:"包管理操作",risk_git_force:"Git 强制操作",risk_git:"Git 操作",risk_network:"网络请求",risk_low:"只读操作",risk_default:"工具调用",hookConfigTitle:"自定义 Hook 配置说明",hookConfigDesc:"你可以在项目根目录的 .agent/hooks.json 文件中添加或修改 Hook 拦截规则。",hookConfigDetail:"Hook 支持 SHELL(外部脚本)和 HTTP(REST 端点)两种类型,可以在工具执行前(PRE_TOOL_USE)或执行后(POST_TOOL_USE)触发。",hookConfigBuiltin:"内置了 BashSafetyHook(危险命令拦截)、FileWriteAuditHook(文件写入审计)、ToolUsageStatsHook(工具调用统计)三套 Hook。设置 enabled: false 可禁用任意 Hook。",optionAllow:"允许 — 执行此操作",optionAllowHint:"点击或按 Enter 确认",optionDeny:"拒绝 — 取消此操作",optionDenyHint:"点击或按 Esc 取消",optionAllowAlways:"本次会话始终允许",optionAllowAlwaysHint:"不再询问 {{tool}}",optionAllowPathHint:"不再询问该外部路径",timeoutWaitUser:"等待用户输入(无超时)",optionAutoMode:"自动模式 — 全部允许",optionAutoModeHint:"之后所有 Hook 将自动批准",shortcutHint:"快捷键: 1-4 选择 · Enter 允许 · Esc 拒绝",lastItem:"最后一项",modalHint:"请在弹窗中处理此审批请求",clickToSelect:"点击选择 · 1/2/3/4 键盘快捷键",verbRunCommand:"运行命令",verbWriteFile:"写入文件",verbEditFile:"编辑文件",verbReadFile:"读取文件",verbDeleteFile:"删除文件",verbFindFiles:"查找文件",verbSearchContents:"搜索内容",verbFetchUrl:"请求网络",verbSearchWeb:"搜索网络",verbGit:"Git 操作",verbInstall:"安装依赖",verbSendMessage:"发送消息",verbRunTool:"执行操作",scopeLocal:"作用于当前工作区",scopeExternal:"外部路径",showAllLines:"展开全部 {{n}} 行",showAll:"显示完整内容",showLess:"收起",importMergeConfirm:`合并到现有配置吗?
467
+ "确定"=合并 / "取消"=替换`,configTitle:"Hook 配置",configDesc:"在工具执行、任务流转等生命周期事件上挂载拦截器,实现审批与自定义逻辑",import:"导入",export:"导出",newRule:"新增规则",ruleList:"规则列表",ruleCount:"{{n}} 条",implShell:"Shell 脚本",implShellDesc:"执行外部脚本,stdin 接收 JSON,stdout 返回决策",implHttp:"HTTP 端点",implHttpDesc:"POST JSON 到外部端点",implPromptDesc:"发送单轮 Prompt 给 LLM 做风险评估",implAgentDesc:"启动只读子代理做深度调查",stepBasicTitle:"基本信息",stepBasicDesc:"名称、描述、事件",stepImplTitle:"实现配置",stepImplDesc:"执行方式与参数",stepAdvancedTitle:"高级选项",stepAdvancedDesc:"优先级、过滤、测试",editRule:"编辑: {{name}}",addRule:"添加 Hook 规则",fieldName:"名称 *",fieldDescription:"描述",descriptionPlaceholder:"这个 Hook 的作用...",fieldEvents:"事件 *",eventsSelected:"{{n}} 已选",searchEventsPlaceholder:"搜索事件...",toggleAllEvents:"全选/取消",fieldImplType:"实现类型 *",fieldCommand:"命令 *",fieldPromptTemplate:"Prompt 模板 *",promptTemplatePlaceholder:"你是一个安全审计专家,请分析以下工具调用...",selectAgentPlaceholder:"选择 Agent...",agentReadOnlyHint:"Agent 将以只读模式运行(Read/Grep/Glob),不会修改文件",fieldPriority:"优先级",fieldTimeout:"超时 (ms)",labelEnabled:"启用",failOpenLabel:"Fail-open(超时放行)",fieldToolFilter:"工具过滤(正则,可选)",dryRunResultTitle:"Dry-run 结果",dryRunDecision:"决策: ",dryRunReason:"原因: ",dryRunOutput:"输出: ",dryRunButton:"试运行 (Dry Run)",prevStep:"上一步",nextStep:"下一步",saveChanges:"保存修改",createRule:"创建规则",noRules:"暂无 Hook 规则",noRulesHint:'点击右上角"新增规则"创建第一个 Hook',batchDeleteConfirm:"确认删除 {{n}} 条规则?",selectedItems:"已选 {{n}} 项",enableAll:"全部启用",disableAll:"全部禁用",colName:"名称",colEvents:"事件",colType:"类型",colStatus:"状态",colActions:"操作",clickToDisable:"点击禁用",clickToEnable:"点击启用",actionEdit:"编辑",deleteRuleConfirm:'删除规则 "{{name}}"?',statTotal:"总规则数"},xL={pending:"等待",thinking:"思考",action:"执行",result:"结果",running:"运行中",error:"错误",completed:"完成",params:"参数"},wL={linesTotal:"… (共 {{n}} 行)",expandAll:"展开全部 ({{n}} 行)",collapse:"收起"},SL={quickCommands:"快捷命令",search:'搜索: "{{filter}}"',help:"↑↓ 选择 · Enter 执行 · Esc 关闭",backend:"后端",backendCommand:"后端命令",chat_desc:"切换到对话面板",chat_result:"已切换到对话面板",terminal_desc:"切换到终端面板",terminal_result:"已切换到终端面板",files_desc:"切换到文件面板",files_result:"已切换到文件面板",models_desc:"切换到模型面板",models_result:"已切换到模型面板",tools_desc:"列出可用工具",tools_result:"已切换到工具面板",skills_desc:"列出可用技能",skills_result:"已切换到技能面板",settings_desc:"切换到设置面板",settings_result:"已切换到设置面板",logs_desc:"切换到日志面板",logs_result:"已切换到日志面板",new_desc:"创建新会话",new_result:"新会话已创建",clear_desc:"清空当前会话消息",clear_result:"消息已清空",theme_desc:"切换主题 (dark/light/auto)",theme_error:"用法: /theme <dark|light|auto>",theme_result:"主题已切换为 ",theme_preset_result:"主题预设已切换为 ",theme_preset_unavailable:"主题预设切换不可用",toggle_terminal_desc:"切换底部终端面板显示",toggle_terminal_result:"终端面板已切换",logs_clear_desc:"清空日志",logs_clear_result:"日志已清空",doctor_desc:"系统自诊断 (Config/API Key/Network/Docker/Disk)",compact_desc:"压缩当前会话上下文",help_desc:"显示所有快捷命令",token_desc:"显示 token 使用量和 API 费用统计",review_desc:"代码审查 — 检查变更的正确性、安全性和代码质量",security_review_desc:"安全审查 — OWASP Top 10 + 命令注入/路径遍历/权限提升",memory_desc:"管理 AI 持久记忆 (list/add/delete/clear)",ps_desc:"查看和管理后台任务、子代理和 shell 进程",model_desc:"查看或切换 AI 模型",status_desc:"显示当前会话状态 (会话ID/消息数/模型/工作目录)",config_desc:"管理应用程序配置 (get/set/list/delete)",exit_desc:"退出应用",exit_result:"正在关闭服务...",benchmark_desc:"运行 DeepSeekCode 能力评测 (simple/medium/complex/full/list)",goal_desc:"设置多步工作目标",goal_list_desc:"列出活跃目标",goal_status_desc:"查看目标进度",workflow_list_desc:"列出工作流运行记录",workflow_status_desc:"查看工作流状态",workflow_checkpoints_desc:"列出工作流检查点",mcp_desc:"列出或重新加载 MCP 服务器",sessions_desc:"列出会话",resume_desc:"按 ID 恢复会话",permissions_desc:"显示权限规则和待审批项",init_desc:"生成 agent.md 项目指导文件",self_test_desc:"运行工具能力自测并生成报告",context_desc:"显示上下文分析报告",version_desc:"显示版本信息","check-update_desc":"检查可用更新",upgrade_desc:"升级到最新版本",acceptance_desc:"运行或检查验收工作流 (quick/full/list/report)",diff_desc:"查看未提交的 Git 变更",summary_desc:"总结当前会话内容",effort_desc:"显示或设置推理力度 (low|medium|high)",export_desc:"导出当前会话为 JSON",rename_desc:"重命名当前会话",hooks_desc:"显示活跃钩子配置",cost_desc:"显示预估会话成本",sent_command:"已发送命令 ",noActiveSession:"无活跃会话",unknownCommand:"未知命令 {{cmd}} — 输入 /help 查看可用命令"},kL={pageError:"页面出现错误",unknownError:"发生了未知错误,请尝试刷新页面",refreshPage:"刷新页面",genEnded:"生成已结束(工具执行超时或连接中断)"},_L={backendConnected:"后端已连接",backendDisconnected:"后端连接断开,正在重连...",paused:"已暂停,再按 ESC 终止",terminated:"已终止 (ESC×2)",contextCompressed:"上下文压缩: {{original}} → {{compressed}} 条消息, 释放 {{saved}} tokens",errorPrefix:"❌ 错误: {{error}}",uncaughtError:"未捕获错误:",uncaughtRejection:"未捕获的 Promise 拒绝: ",unknownReason:"未知原因",diagnosing:"⏳ 诊断中...",runDiagnostic:"🔍 运行诊断",inspectorOn:"开启检查模式 (Ctrl+Shift+Alt+C)",inspectorOff:"关闭检查模式"},CL={title:"频道管理",subtitle:"接入外部 IM 平台,通过微信、飞书、钉钉等与 AI 交互",newChannel:"新建频道",editChannel:"编辑频道",table:{name:"频道名称",type:"类型",appId:"App ID",status:"连接状态",enabled:"启用",actions:"操作",emptyHint:"点击右上角「新建频道」接入微信、飞书或钉钉"},status:{connected:"已连接",disconnected:"未连接",connecting:"连接中",error:"错误"},empty:"还没有配置任何频道",emptyHint:"点击「新建频道」添加一个 IM 平台机器人",form:{basicInfo:"基础信息",name:"频道名称",namePlaceholder:"例如:公司群机器人",type:"频道类型",credentials:"凭证信息",appId:"App ID / 企业ID",appIdPlaceholder:"填写应用 AppID",appSecret:"App Secret",appSecretPlaceholder:"填写应用密钥",token:"Token / Bot Token",tokenPlaceholder:"填写机器人 Token",encodingAESKey:"EncodingAESKey",encodingAESKeyPlaceholder:"仅微信需要,可选",enabled:"启用频道",wechatQrHint:"保存后可使用微信扫码登录",feishuWsHint:"飞书使用 WebSocket 连接,自动接收消息",namePlaceholderDev:"例如:研发群机器人",typeLocked:"频道类型创建后不可修改",leaveBlankUnchanged:"留空不修改",leaveBlankMeansUnchanged:"留空表示不修改",appSecretValue:"应用密钥",tokenCallback:"回调校验 Token",optionalShort:"选填",encodingAesOptional:"选填,消息加解密密钥",wechatIlinkHint:"微信 iLink 机器人通过扫码授权,凭证可留空,保存后扫码登录即可。",wechatIlinkHintList:"微信 iLink 机器人通过扫码授权,凭证可留空,保存后在列表点击「扫码登录」。",enabledOffHint:"关闭后停止收发消息"},actions:{scanQr:"扫码",edit:"编辑",delete:"删除",deleteConfirm:"确定要删除此频道?",test:"测试连接",save:"保存频道",cancel:"取消",refresh:"刷新",qrLogin:"扫码登录",deleteConfirmNamed:"确认删除频道「{{name}}」?",deleteConfirmShort:"确认删除该频道?"},errors:{loadFailed:"加载频道列表失败",createFailed:"创建频道失败",updateFailed:"更新频道失败",deleteFailed:"删除频道失败",notFound:"频道未找到",notImplemented:"尚未实现",nameRequired:"频道名称不能为空"},qr:{title:"微信扫码登录",generating:"二维码生成中...",waiting:"请使用微信扫描二维码",scanned:"已扫描,请在手机上确认",confirmed:"登录成功",expired:"二维码已失效",expiredHint:"点击重试重新生成二维码",error:"获取二维码失败",openInNewTab:"在新标签页打开"},typeLabels:{wechat:"微信",feishu:"飞书",dingtalk:"钉钉",telegram:"Telegram",discord:"Discord",slack:"Slack",signal:"Signal",whatsapp:"WhatsApp",line:"LINE",qqbot:"QQ Bot",matrix:"Matrix",mattermost:"Mattermost",msteams:"Teams",googlechat:"Google Chat",irc:"IRC"},viewSubtitle:"接入微信、飞书、钉钉,用户可通过频道发送任务并实时接收进度与结果",experimentalLabel:"实验性",experimentalShort:"实验",experimentalTip:"实验性实现,功能不完整",experimentalDesc:"此频道为基础适配器封装,支持基础消息收发,部分高级功能可能不完整",pluginMissingLabel:"插件未安装",pluginMissingTip:"该频道类型的插件未安装或未激活,无法启动实例",pluginMissingWarning:"该频道类型的插件未安装或未激活,实例无法启动。请到「插件」页安装并激活{{name}}插件后重试。",selectTypeHint:"请从左侧选择一个频道类型",instancesCount:"{{n}} 个配置实例",notConfiguredYet:"尚未配置",createInstance:"新建实例",createShort:"新建",selectInstance:"选择实例",emptyWithType:"还没有配置 {{type}}",wechatBindHint:"点击下方按钮,用微信扫码即可自动完成绑定",startWithCreate:"点击上方「新建实例」开始配置",scanToBind:"扫码绑定",qrLoginReauth:"扫码登录 / 重新授权",editConfig:"编辑配置",createConfig:"新建配置",save:"保存",saving:"保存中...",unknownError:"未知错误",retry:"重试",bindSuccess:"绑定成功",bindTitle:"扫码绑定 · {{name}}",startUsing:"开始使用",clickToRefresh:"点击刷新",connectedReady:"「{{name}}」已连接,可开始使用",createdConnectedReady:"微信频道已创建并连接,可开始使用",waitingAuthorize:"请使用微信扫描二维码授权机器人",scannedConfirming:"已扫描,请在手机上确认...",confirmedClosing:"机器人已授权并启动,即将自动关闭",connectingIlink:"正在连接 iLink 服务...",openInNewTabFallback:"在新标签页打开(备用)",toastReauthSuccess:"微信「{{name}}」重新授权成功,频道已连接",toastBindSuccess:"微信绑定成功,频道已自动创建并连接",pollFailedRefresh:"轮询状态失败次数过多,请刷新二维码重试",pollFailedToast:"微信绑定状态轮询失败,请刷新二维码重试",qrDataMissing:"二维码数据缺失: {{data}}",fetchWechatQrFailed:"获取微信二维码失败:{{error}}",sidebar:{title:"频道列表",configuredCount:"{{n}} 个已配置",clickToConfigure:"点击下方频道开始配置",configuredMissing:"已配置 · 插件未安装",unconfigured:"未配置",empty:"未安装任何频道插件",emptyHint:"安装频道插件后才会在此显示,请前往「插件」页从插件市场安装",partialConnected:"{{connected}}/{{count}} 已连接",waitingPlugin:"等待安装插件"},categories:{im:"即时通讯",international:"国际主流",eastAsia:"东亚",collaboration:"协作平台",classic:"经典协议",other:"其他",builtin:"内置",plugins:"插件扩展"}},TL={stageUploaded:"等待处理",stageParsing:"正在解析数据文件",stageMapping:"模板映射",stageRendering:"正在生成文件",stageComplete:"文件处理完成",stageError:"文件处理失败",parsing:"正在解析 {{file}} …",parsedSummary:"{{rows}} 行 · {{fields}} 个字段",mappingTitle:"模板 ↔ 数据字段映射",templatePlaceholder:"模板占位符",dataField:"数据字段",mappingMore:"另有 {{n}} 个映射",rendering:"正在逐条生成 {{current}}/{{total}} …",download:"下载",downloadFailed:"下载失败",error:"处理失败",roleData:"数据文件",roleTemplate:"模板文件",attach:"上传文件或图片,支持多选",dropHint:"松开以添加附件",unsupportedType:"不支持的文件类型: {{name}}",fileTooLarge:"文件过大: {{name}}(≤50MB)",duplicateFile:"重复文件: {{name}}",maxAttachments:"单次最多 {{n}} 个文件",uploadFailed:"上传失败",stillUploading:"附件正在上传中,请稍候…",importFailed:"Import files failed",kindText:"文本",moreRows:"+{{n}} 行",rowsDone:"{{done}}/{{total}} 行",rowsFailed:"{{n}} 行失败",imagePreview:"图片预览"},AL={reconnecting:"重连中 {{attempt}}/{{max}}",hint:"正在重新连接后端…"},EL={title:"Full access(自动批准)已开启",desc:"Agent 可不经确认直接编辑文件和执行命令,存在数据丢失风险。",dismiss:"本次关闭",neverShow:"不再显示"},NL={panelTitle:"环境与变更",noRepo:"非 Git 仓库",notGitDesc:"当前工作目录不是 Git 仓库,无法展示变更统计。",refresh:"刷新",changes:"变更统计",clean:"工作区干净",branch:"分支",upstream:"相对上游",commit:"提交",push:"推送",commitConfirm:"提交",commitPlaceholder:"提交信息(Agent 生成草稿,可编辑)…",commitSuccess:"提交成功",commitFailed:"提交失败",pushSuccess:"推送成功",pushFailed:"推送失败",checkoutSuccess:"已切换到 {{branch}}",checkoutFailed:"切换失败",prReady:"PR 检查状态正常",prUnavailable:"Pull request status unavailable(未关联远端)",prLoading:"加载 PR 状态…",environment:"环境信息",ok:"操作成功",loading:"加载中…",emptyCommitMsg:"请输入提交信息"},ML={retry:"重试",details:"详情",modelSettings:"模型设置"},RL={comingSoon:"即将上线"},OL={lspGroup:"语言服务器 (LSP)",mcpGroup:"MCP 服务器",notInstalled:"未安装",installed:"已安装",ready:"已连接",connecting:"连接中",installing:"安装中…",error:"错误",disabled:"已禁用",toolCount:"{{count}} 个工具",docs:"文档",official:"官方",cloud:"云端",local:"本地",needCredentials:"此连接器需要凭据才能启动:",connect:"连接",missing:"未配置",envConfigured:"已配置",searchPlaceholder:"搜索连接器(名称、id、描述)…",all:"全部",noResults:"没有匹配的连接器。",custom:"自定义",addCustom:"添加自定义",customTitle:"添加自定义 MCP 服务器(来自 awesome-mcp-servers 或自建)",customName:"名称 (id)",customCommand:"启动命令",customArgs:"参数(空格分隔)",customEnv:"环境变量(KEY=value,逗号分隔)",customUrl:"MCP 端点 URL",customHeaders:"请求头(KEY=value,逗号分隔)",customLocal:"本地命令",customFormRequired:"名称和启动命令/URL 必填。",removeCustom:"删除此自定义连接器",add:"添加"},DL={justNow:"刚刚",minutesAgo:"{{count}}分钟前",hoursAgo:"{{count}}小时前",daysAgo:"{{count}}天前"},LL={title:"语音输入(Whisper:英语等 / FunASR:中文)",stopTitle:"停止录音并转写",langToggle:"语音识别语言",multiHint:"中文使用 FunASR,其他语言使用 faster-whisper",noSpeech:"未识别到语音内容,请重试",backendMissing:"语音服务未就绪,已打开设置页引导安装",setup:{title:"语音服务",envCard:"运行环境检测",envChecking:"检测中…",recheck:"重新检测",pythonOk:"Python {{version}} 已就绪",pythonMissing:"未检测到 Python,请先安装 Python 3.10+",pythonGuide:"下载安装 Python",pipOk:"pip 可用",whisperTitle:"Whisper · 英语",whisperDesc:"英语语音识别",funasrTitle:"FunASR · 中文",funasrDesc:"中文语音识别",installed:"已安装",notInstalled:"未安装",install:"一键安装",installing:"安装中…",cancel:"取消安装",installDone:"安装完成,可回到聊天页使用语音输入",installFailed:"安装失败",installTimeout:"安装超时",installCancelled:"安装已取消",jobInProgress:"已有安装任务进行中,正在接管进度",manualCommand:"手动安装命令",copyCommand:"复制命令",copySuccess:"已复制到剪贴板",copyFailed:"复制失败",torchHint:"中文引擎需安装 torch,体积较大,请耐心等待",logWaiting:"正在准备安装…",chooseHint:"环境已就绪,请选择上方引擎进行安装",defaultEngine:"默认识别引擎",defaultEngineHint:"选择语音输入默认使用的引擎,可在聊天输入框随时切换",inUse:"使用中",engineNotInstalledHint:"该引擎尚未安装,选中后录音时会引导安装",probeError:"依赖检测失败:",installDoneButMissing:"安装命令已执行成功,但引擎检测仍不可用",installDoneButMissingHint:"语音服务已自动重启并重新检测;若仍失败,请复制下方手动命令在终端执行排查(常见原因:torch 与系统 DLL 不兼容)。",pipGuide:"请先安装 Python(含 pip),完成后重启应用再重试。",pipMissing:"未找到 pip,请先安装 Python 环境。"}},BL={verb:{researching:"分析代码",coding:"修改代码",validating:"运行验证",summarizing:"整理结果"},title:{withFile:"{{verb}} {{file}}",withCount:"{{verb}} · {{count}} 项"},evidenceMore:"等 {{count}} 项",toolCallCount:"{{count}} 次工具调用",toolNamesMore:"等 {{count}} 个工具",waitingUser:"等待你的回答",blocked:"被阻塞:{{reason}}",paused:"已暂停,可恢复",viewAndAnswer:"查看并回答",evidence:"执行明细",phase:{analysis:"分析",implementation:"实现",optimization:"优化"}},jL={next:"下一步",idle:"空闲"},PL={title:"定时自动化",refresh:"刷新",new:"新建",namePlaceholder:"名称(如:每早 9 点汇总 Git 状态)",instructionsPlaceholder:"指令(agent 每次触发时执行的内容)",cronPlaceholder:"cron(5 段,如 0 9 * * *)",create:"创建",cronDaily9:"每天 9:00",cronWeekday9:"工作日 9:00",cronEvery30Min:"每 30 分钟",empty:"还没有定时自动化。新建一个,让 agent 无人值守干活。",enable:"启用",disable:"停用",runNow:"手动触发",delete:"删除",historyTitle:"运行历史",noRuns:"暂无运行记录",permissionsTitle:"作用域放行(tool target)",permissionsEmpty:"无。未放行的写操作需人工批准,超时后自动拒绝。",permissionPlaceholder:"如:write_file docs/report.md",add:"添加"},IL="定时任务(如每晚跑测试数据)将在这里管理。",zL="插件管理入口。可启停文件处理技能等扩展能力。",$L="功能开发中…",HL={title:"文件浏览器",searchPlaceholder:"搜索...",refresh:"刷新",collapse:"折叠",uploadTo:"上传到 {{dir}}",uploadToRoot:"上传到工作区根目录",setUploadDirHint:"点击设为上传目录并展开",download:"下载",close:"关闭",modified:"已修改",saving:"保存中...",save:"保存",saved:"文件已保存",saveFail:"保存失败",readFail:"读取文件失败",downloadFail:"下载失败",downloadStarted:"已开始下载",uploadedCount:"已上传 {{count}} 个文件",uploadFailedCount:"{{count}} 个文件上传失败",selectFileHint:"选择文件以预览或编辑"},UL={title:"日志",backendLogs:"后台日志",streamTab:"实时日志流",files:"日志文件",clear:"清空",refresh:"刷新",refreshing:"刷新中...",noLogs:"暂无实时日志",noFiles:"暂无日志文件",preview:"预览",download:"下载",backToList:"返回文件列表",emptyFile:"(空文件)",totalLines:"{{count}} 行",showingLatest:"(显示最新 {{count}} 行)"},FL={installedTab:"已安装 ({{count}})",availableTab:"可安装 ({{count}})",searchPlaceholder:"搜索插件(名称 / id / 描述 / 标签)",clear:"清除",allCategories:"全部",marketFilterAll:"全部来源",marketFilterBuiltin:"内置",prevPage:"上一页",nextPage:"下一页",pageInfo:"第 {{page}} / {{pages}} 页 · 共 {{count}} 条",noMatch:"无匹配插件",emptyInstalled:"暂无插件 — 到「可安装」页从市场安装",emptyMarket:"市场暂无可用插件",applyProviderTitle:"把插件 provider preset 写入 ProviderConfigStore(用户授权)",activate:"激活",deactivate:"停用",uninstall:"卸载",installActivate:"安装并激活",installOnly:"仅安装",uninstallTitle:"卸载插件",uninstallConfirm:"确定要卸载 {{id}} 吗?插件文件将被删除(bundled 除外)。"},GL={starterTitle:"新模板",starterNodeTitle:"任务",starterNodeDesc:"描述任务",sourceSaved:"沉淀",sourceScript:"脚本",sourceHandwritten:"手写",roleExplore:"探索",rolePlan:"规划",roleExecute:"执行",roleVerify:"校验",roleSummarize:"总结",roleGeneric:"通用",noNodes:"此模板暂无节点。",filterAll:"全部",noMatchTemplates:"没有匹配的模板",emptyTemplates:"暂无模板。完成动态工作流后保存为模板,或由 AI 起草。",aiPromptRequired:"描述不能为空",aiDraftFailed:"AI 起草失败,请重试或改用手写",nameRequired:"模板名称不能为空",jsonParseFailed:"JSON 解析失败:{{error}}",invalidDefinition:"definition 必须是含 nodes 数组的 WorkflowDefinition",createFailed:"创建失败",loadFailed:"加载模板失败",uncategorized:"其他",savedVersion:"已保存(v{{version}})",saveFailed:"保存失败",renderFailed:"渲染失败",selectTemplateHint:"从左侧选择一个模板查看 / 编辑",selectTemplateHintSub:"内置预设开箱即用;也可以把一次工作流运行「保存为模板」沉淀复用。",loading:"加载…",deleteTemplate:"删除模板",categoryLabel:"分类(category)",descriptionLabel:"描述(description)",nodeCount:"{{n}} 个节点",topologyHint:"拓扑:串行 / 并行依赖",inputCount:"{{n}} 个输入参数",workflowNodes:"工作流节点",sortedByDeps:"按依赖拓扑排序",launchWithTemplate:"用模板新建会话",testRun:"试跑",versionHistory:"版本历史",advancedJson:"高级(JSON)",refresh:"刷新",inputsSchemaLabel:"inputs(参数 schema,JSON)— 修改后保存会升版本",definitionLabel:"definition(WorkflowDefinition,JSON)",saveChanges:"保存修改",versionSnapshotLabel:"不可变版本快照(versions/{v}.json)",noVersions:"暂无版本记录",viewingVersion:"当前查看中",libraryTitle:"模板库",newTemplate:"新建模板",newShort:"新建",searchPlaceholder:"搜索模板…",paramCount:"{{n}} 参数",viewing:"查看中",view:"查看",launchModalTitle:"用「{{name}}」新建会话",previewModalTitle:"试跑「{{name}}」",launch:"启动",renderPreview:"渲染预览",renderSuccess:"渲染成功 — 产物 definition 可直接启动",nameLabel:"名称 *",namePlaceholder:"如:Triage Inbox",categoryField:"分类",descriptionField:"描述",aiDraftTab:"让 AI 起草",manualJsonTab:"手写 JSON",aiPromptLabel:"用一句话描述要做什么(AI 会拆成带角色的工作流节点)",aiPromptPlaceholder:"如:审查当前仓库代码的安全/性能/正确性,输出分级报告,全程只读",aiWorking:"AI 拆解中…",generateWorkflow:"生成工作流",aiTimeHint:"约 30-60s(推理模型可能更久),生成后可手动微调",newInputsLabel:"inputs(参数 schema,JSON,用 <<input:name>> 引用)",inputsExamplePlaceholder:'[{ "name": "folder", "label": "目录", "type": "folder", "required": true }]',cancel:"取消",create:"创建",deleteConfirm:"确定删除模板「{{name}}」?该操作不可恢复。",delete:"删除",typeString:"文本",typeNumber:"数字",typeSelect:"选择",typeBoolean:"开关",typeFolder:"目录",typeConnector:"连接器",noInputsNeeded:"该模板无需参数,直接启动。",starting:"启动中…",requiredError:"必填",numberError:"请输入数字",selectNone:"(不选)",newSession:"新建会话",newFromTemplateTitle:"用模板新建",chooseTemplateAria:"选择模板新建会话",backToList:"返回模板列表",startSessionHeader:"开始一个会话",directChat:"直接对话",directChatHint:"不选模板,AI 现场拆解任务(动态工作流)",loadingTemplates:"加载模板…",noTemplatesYet:"暂无已保存模板。",libraryMenu:"模板库…"},qL={autoFollowOn:"跟随输出:开",autoFollowOff:"跟随输出:关"},VL={title:"测试与观测",evalIntro:"运行能力评估测试,验证系统功能是否正常。",running:"运行中...",evalTriggered:"{{label}} 已触发,请在对话中查看结果",evalQuickDesc:"验收检查 (无需 LLM)",evalFullDesc:"真实 LLM 调用 (耗时)",evalListDesc:"列出所有评测任务",historyTitle:"运行历史",refresh:"刷新"},WL={taskBoard:{title:"任务看板"},card:{collapse:"折叠",expand:"展开",auto:"自动",unpin:"取消固定",pinKeep:"固定(不自动收起)",pin:"固定",close:"关闭此小组件"},workflow:{fallbackTitle:"工作流",statusRunning:"运行中",statusCompleted:"完成",statusFailed:"失败",statusSkipped:"跳过",statusBlocked:"等待",statusPending:"待执行",resume:"恢复",pause:"暂停",cancel:"取消"},agentFlow:{statusRunning:"运行中",statusCompleted:"完成",statusFailed:"失败",statusIdle:"空闲",moreAgents:"+{{count}} 个 Agent",eventLog:"事件日志({{count}})"},plan:{title:"AI 计划",fallbackTitle:"工作流计划",stepCount:"{{count}} 步",moreSteps:"+{{count}} 步",start:"开始执行",change:"更换流程",changeHint:"取消此方案,换个说法重新描述",cancelTitle:"取消工作流",cancel:"取消"}},KL={drawerCollapseTitle:"折叠抽屉,查看消息",drawerExpandTitle:"展开抽屉,做出选择",openFile:"打开 ›"},YL={viewToggle:"轨迹",viewToggleTitle:"切换聊天 / 轨迹视图",toolbar:{duration:"时长",actualDuration:"按记录时长显示时间轴块",equalWidth:"按等宽显示时间轴块",turns:"轮次",calls:"调用",collapseTurns:"折叠所有轮次",expandTurns:"展开所有轮次",collapseCalls:"折叠所有工具调用",expandCalls:"展开所有工具调用",search:"搜索轨迹",searchPlaceholder:"搜索轨迹…"}},v3={common:oL,nav:lL,chat:cL,shortcuts:uL,palette:dL,a11y:fL,plan:hL,whatsnew:mL,settings:pL,models:gL,tools:yL,skills:vL,hook:bL,step:xL,toolCall:wL,slashCommands:SL,error:kL,toast:_L,channels:CL,fileJob:TL,reconnect:AL,autoAccess:EL,git:NL,errorCard:ML,placeholder:RL,connectors:OL,time:DL,stt:LL,activity:BL,taskbar:jL,automation:PL,placeholderScheduledDesc:IL,placeholderPluginsDesc:zL,featureInProgress:$L,fileTree:HL,logs:UL,plugins:FL,templates:GL,terminal:qL,testing:VL,widgets:WL,commonUi:KL,trajectory:YL},ZL={confirm:"Confirm",cancel:"Cancel",save:"Save",saving:"Saving...",delete:"Delete",close:"Close",refresh:"Refresh",retry:"Retry",loading:"Loading...",collapse:"Collapse",expand:"Expand",collapse_short:"Collapse",clear:"Clear",noData:"No data",noResults:"No results",unknown:"Unknown",unknownError:"Unknown error",connecting:"Connecting…",back:"Back",send:"Send",copy:"Copy",copied:"Copied",search:"Search...",filter:"All",pageInfo:"Showing {{start}}-{{end}} of {{total}}",prevPage:"Previous",nextPage:"Next",enabled:"Enabled",disabled:"Disabled",online:"Online",offline:"Offline",busy:"Busy",away:"Away",default:"Default"},XL={chat:"Chat",terminal:"Terminal",files:"Files",models:"Models",tools:"Tools",skills:"Skills",templates:"Presets",hooks:"Hooks",agentFlow:"Agent Flow",settings:"Settings",logs:"Logs",channels:"Channels",sessions:"Sessions",groupWorkspace:"Workspace",groupConfig:"Configuration",groupSystem:"System",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",moreOptions:"More",scheduled:"Scheduled",plugins:"Plugins",mySessions:"My sessions",sessionRunning:"Running",sessionWaiting:"Awaiting confirmation",sessionFailed:"Failed",sessionDone:"Completed",connectors:"Connectors",pin:"Pin to top",unpin:"Unpin",pinMore:"Pin 'More' to top",unpinMore:"Unpin 'More'",clearSessionSearch:"Clear session search",searchSessions:"Search sessions",searchSessionsPlaceholder:"Search sessions..."},QL=JSON.parse(`{"newSession":"New Session","noSessions":"No sessions yet","renameSession":"Rename session","exportMd":"Export as Markdown","you":"You","thinkingEllipsis":"Thinking…","messageRail":"Message navigation","messageIndex":"Conversation index","backToBottom":"Back to latest","generatingPlaceholder":"AI is generating…","defaultSessionTitle":"Chat {{n}}","welcome":"Welcome to deepseekcode","welcomeDesc":"I can help you write code, analyze projects, and automate tasks. Try sending a message!","suggestionCode":"Code Writing","suggestionCodePrompt":"Implement quicksort in Python and explain its time complexity","suggestionAnalyze":"Code Analysis","suggestionAnalyzePrompt":"Analyze the current project structure and explain how it is organized","suggestionAutomate":"Automation","suggestionAutomatePrompt":"Write a script to organize the files in the current directory","quickCommands":"View quick commands","refFiles":"Reference files","inputPlaceholder":"Type a message... Shift+Enter for newline, / commands, @ file refs, ↑ history","charTokens":"{{chars}} chars · ~{{tokens}} tokens","nearLimit":"Near limit","shiftEnter":"Shift+Enter newline","escHint":"Esc to pause · Double-Esc to stop","resume":"Resume","resumeGen":"Resume generation","stop":"Stop","stopGen":"Stop generation","pause":"Pause","pauseGen":"Pause generation","sendBtn":"Send","voiceInput":"Voice Input","voiceListening":"Listening...","voiceTranscribing":"Transcribing...","voiceUnsupported":"Voice input is not supported in this browser","voiceError":"Voice recognition error, please try again","connected":"Connected","disconnected":"Disconnected","sessionHistory":"Session History","noHistory":"No history sessions","clearHistory":"Clear history","clearHistoryTitle":"Clear history","restoreSession":"Click to restore \\"{{title}}\\"","removeFromHistory":"Remove from history","viewAllSessions":"More sessions","allSessions":"All sessions","sessionPickerTitle":"Select session","clickToOpenSession":"Open session","workingDir":"Working Directory","switchDir":"Switch","clickToSwitchDir":"Click to switch working directory","switchDirPrompt":"Enter new working directory path:","addTask":"Add","addTaskPlaceholder":"Add task...","noTasks":"No tasks, add one above","taskBoardDragHint":"Drag down to expand · drag up to collapse · click to toggle","doubleClickEdit":"Double-click to edit","deleteTask":"Delete task","backgroundLogs":"Background Logs","effort":"Effort","effortOff":"Thinking off","effortLow":"Low","effortMedium":"Medium","effortHigh":"High","effortExtraHigh":"Extra high","effortMax":"Max","noWorkspaceDir":"No working directory","recentDirs":"Recent directories","noRecentDirs":"No recent directories","chooseOtherDir":"Choose another directory…","dirPickerTitle":"Select working directory","dirPickerEnterPath":"Type a full path and press Enter","dirPickerGo":"Go","dirPickerUp":"Up","dirPickerNoDirs":"No subdirectories","dirPickerConfirm":"Select this directory","dirPickerLoadError":"Failed to load directory","artifactPanel":"AI Outputs","workspaceTitle":"Workspace","workspaceToggle":"Switch to workspace","artifactsToggle":"Switch to outputs","workspaceHint":"AI Agent workspace: components load into a dynamic layout and respond to events and commands.","artifactEmpty":"No output files yet. Click a file/path link in the chat to preview it here.","artifactHint":"Click a file/path link in the chat to preview it here — drag the panel edge to resize, or use the maximize button in the corner","previewInPanel":"Preview","backToArtifacts":"Back to list","openInNewTab":"Open in new tab","copyPath":"Copy path","copiedPath":"Path copied","copyPathFailed":"Failed to copy","filePreviewHint":"This file type can't be previewed inline — download it or open it in a new tab.","sidebarProgress":"Progress","sidebarArtifacts":"AI Outputs","sidebarOpen":"Open","sidebarOpenFolder":"Open first output file","sidebarExpandAll":"Expand all","sidebarMaximize":"Maximize","sidebarRestore":"Restore size","sidebarWorking":"Working on this…","sidebarWorkingWithAgents":"Working ({{n}} agent(s) running)…","sidebarWorkingToolcalls":"Working ({{n}} tool call(s))…","sidebarIdle":"Progress for multi-step tasks shows up here: planning, tool calls, approvals, and produced files.","sidebarMoreTasks":"more tasks","sidebarRunningAgents":"{{n}} agent(s) running","sidebarToolcallsSoFar":"{{n}} tool call(s) so far","tokenPrompt":"Prompt","tokenCompletion":"Completion","tokenTotal":"Total","totalChars":"Total chars","avgTokens":"Avg tokens/msg","estimatedCost":"Est. cost: \${{cost}}","contextTrimming":"Context Trimming","keepMore":"Keep more","trimMore":"Trim more","trimContext":"Trim context (keep ~{{n}} messages)","currentMessages":"{{n}} messages","totalCharsInfo":"· {{n}} chars total","contextManager":"Context Manager","showContext":"Show context info","taskBoard":"Task Board","morePending":"{{n}} more pending...","moreCompleted":"{{n}} more completed...","dependencyCount":"🔗 {{n}} dependencies","contextSuggestions":"Expand ({{n}} suggestions)","collapseSuggestions":"Collapse","toolRequest":"Tool request: ","toolResult":"Tool result: ","memory":"Memory: ","filesCount":"({{n}} files)","saveTokens":"Save ~{{n}}","ignoreSuggestion":"Ignore suggestion","fileMention":"@ Reference file","fileMentionSearch":"@ Search: \\"{{query}}\\"","fileMentionHelp":"↑↓ Select · Enter Insert · Esc Close","fileBrowser":"File Browser","fileSaved":"File saved","fileReadError":"Failed to read file","fileSaveError":"Save failed","fileModified":"● Modified","selectFilePreview":"Select a file to preview or edit","kbdHint":"command palette","clickToSwitchMode":"Click to toggle mode (Plan → Goal → Act)","selectModel":"Select model","clickToSelectModel":"Select model / reasoning effort","noEnabledModels":"No enabled models","globalDefault":"Global default","planDefault":"Plan default","actDefault":"Act default","goalDefault":"Goal default","followGlobalDefault":"Follow global default","followGlobalDefaultHint":"Clear this mode's default and fall back to the global default","sessionModel":"Session","sessionModelTitle":"Session-scoped model override (global default unchanged)","noGlobalDefault":"No global default","browseMoreModels":"Browse more models…","backToModels":"Back to models","selectProvider":"Select provider","searchModels":"Search models…","loadingModels":"Loading models…","noModelsFound":"No matching models","noProviderModels":"No models available for this provider","noConfiguredProviders":"No providers configured","addAndSwitch":"Add & switch","alreadyAdded":"Added","addingModel":"Adding…","currentModel":"Current","loadModelsFailed":"Failed to load models","addModelFailed":"Failed to add model","switchModelFailed":"Failed to switch model","modelsSourceProviderApi":"Fetched live from provider API","modelsSourceCatalog":"From model catalog (models.dev)","assistantLabel":"DeepSeekCode","thoughtProcess":"Thought process","runningSteps":"Running","stepCount":"step","stepCountPlural":"steps","copyMessage":"Copy","regenerate":"Regenerate","deleteMessage":"Delete message","historyCount":"{{n}} items","startChatHint":"Start a conversation first","panelTitle":"Panel","messageDeleted":"Message deleted","thinking":"Thinking","askAnswerPlaceholder":"Type your answer...","askAnswered":"✓ Answered","askAutoContinue":"⏱ Auto-continue with the recommended option in {{seconds}}s if unanswered","askBackToEdit":"Back to edit","askBatchTitle":"Batch confirmation","askConfirmQuestion":"Confirm this question","askCustomDesc":"Enter a custom answer","askCustomTag":"(custom)","askDirectTag":"(continue directly)","askEmptyInputValue":"(no input)","askEnterHint":"Enter to submit, Shift+Enter for newline","askFinishQuestion":"Finish question ({{count}} selected)","askMultiHintBatch":"Click options to check them, then click \\"Finish question\\" to submit; \\"Proceed\\" means continue by AI judgment","askMultiHintSingle":"Click options to check them, then click \\"Submit selected\\" to submit; \\"Proceed\\" means continue by AI judgment","askNextQuestion":"Next","askNotAnswered":"Not answered","askOtherLabel":"Other (I'll explain)","askPendingBadge":"Pending","askPrevQuestion":"Previous","askProceedDesc":"Don't pick a specific option — continue with your best judgment","askProceedLabel":"Proceed","askReviewTitle":"Review answers","askSingleHintBatch":"Click an option to answer and move on, or click \\"Confirm this question\\" to submit the highlighted option","askSingleHintSingle":"Click an option to submit immediately, or click \\"Submit\\" below to confirm the current option","askSingleTitle":"Please answer","askSubmit":"Submit","askSubmitAll":"Submit all answers","askSubmitSelected":"Submit selected ({{count}})","askSubmitting":"Submitting...","askUnansweredValue":"(not answered)","askUnansweredWarning":"{{count}} question(s) unanswered — they will be recorded as \\"Not answered\\". Click a question number above to go back and edit.","askViewSubmit":"Review & submit","assemblyOrderHint":"In backend context assembly order (top→bottom): system prompt → system tools → MCP tools → skills → messages → other (estimated gap)","avgCacheHitRate":"Avg cache hit rate","byAssemblyOrder":"By assembly order ↓","cacheHitTitle":"Cache hit {{hit}} / miss {{miss}} ({{calls}} calls)","cacheNoStats":"No cache stats yet (provider did not report prompt_cache_hit/miss fields)","cacheWaitingRun":"Run in progress — waiting for provider cache stats","categoryBreakdown":"Category breakdown","contextCapacity":"Context capacity","ctxMcpTools":"MCP tools","ctxMessages":"Messages","ctxOther":"Other","ctxSkills":"Skills","ctxSystemPrompt":"System prompt","ctxSystemTools":"System tools","distAssistantMessages":"Assistant messages","distToolRequest":"Tool requests","distToolResult":"Tool results","distUserMessages":"User messages","duplicateReads":"⚠️ Duplicate reads: {{pct}}%","enterInsertMulti":"Enter to insert · multi-select supported","fileMentionHelpMulti":"↑↓ Select · Enter insert (multi-select) · Esc close","finishMention":"Done","keepPercent":"{{pct}}% kept","lastCompactInfo":"Last compact: {{orig}}→{{comp}} · {{saved}} tok","noMatchingFiles":"No matching files","saveAsTemplate":"Save as template","searchingFiles":"Searching files...","selectedCountShort":"Selected {{n}}","selectedFilesCount":"{{n}} files selected","templateLibrary":"Template library","tokenDistribution":"Token distribution","unitWan":"×10K","unitYi":"×100M","viewContextDetail":"View context capacity details","loading":"Loading…","applyScopeGlobal":"Global","applyScopeSession":"This session","sessionScopeHint":"Applies to this session only; global default unchanged"}`),JL={title:"Keyboard Shortcuts",commandPalette:"Open command palette",clearLogs:"Clear logs",help:"Show shortcuts help",submit:"Submit input",newline:"New line",closeDialog:"Close dialog / pause generation",slashCommand:"Quick commands",fileRef:"Reference files",stopGen:"Stop generation (double Esc)"},eB={placeholder:"Search commands or jump to panel...",navGroup:"Navigation",commandGroup:"Commands",empty:"No matching commands",hint:"↑↓ Select · Enter Run · Esc Close",running:"Running..."},tB={openMenu:"Open menu",closeMenu:"Close menu",close:"Close",expand:"Expand",collapse:"Collapse",delete:"Delete",remove:"Remove",send:"Send message",newSession:"New session",messageInput:"Message input",connectionStatus:"Connection status",loading:"Loading",toggleAgentFlow:"Toggle agent flow",commandPalette:"Command palette",shortcutsHelp:"Shortcuts help"},nB={mode:"Mode",planMode:"Plan Mode — Read-only analysis",planModeDesc:"In Plan mode, AI uses read-only tools to analyze requirements and code without modifying any files.",planModeHint:"After analysis, switch to Act mode to implement changes.",switchToAct:"Switch to Act mode",actMode:"Act Mode",actModeDesc:"In Act mode, AI can read, modify files, and execute commands.",actModeHint:"Need to analyze first? Switch to Plan mode for read-only exploration.",switchToPlan:"Switch to Plan mode",readOnlyMode:"Read-only",planTitle:"Plan Mode: Read-only exploration, cannot modify code",actTitle:"Act Mode: Full read/write access",switchToPlanMode:"Switch to plan mode",switchToActMode:"Switch to act mode",autoMode:"Auto mode: auto-approve tool calls",goalMode:"Goal Mode",planModeShort:"Read-only analysis and planning",actModeShort:"Read/write files and run commands",goalModeShort:"Keep working toward the goal until done",autoApprove:"Auto Approve",autoApproveShort:"Auto-approve all tool calls",planContent:"Plan file content",analyzing:"Analyzing requirements...",modePlanTitle:"Plan Mode — Read-only exploration",modePlanDesc:"Read-only mode. AI can only read files and analyze code; no modifications are allowed. After analysis, use ExitPlanMode to switch to Act mode.",modeActTitle:"Act Mode — Execute",modeActDesc:"Read-write mode. AI can read, modify files, and execute commands. Low-risk operations are auto-approved; high-risk ones require confirmation.",modeGoalTitle:"Goal Mode — Goal-driven tasks",modeGoalDesc:"Goal-oriented execution mode. AI can read/write and execute within the active task scope; out-of-scope operations require confirmation.",modeNormalTitle:"Normal Mode — Standard interaction",modeNormalDesc:"Standard interaction mode. All tools work normally; writes and command execution require user confirmation.",readOnlyBadge:"🔒 Read-only",autoApproveBadge:"✅ Auto-approve",toPlanMode:"Switch to Plan Mode",toActMode:"Switch to Act Mode",modeCycleHint:"Mode cycle: Plan → Act → Goal; Auto is an independent toggle"},aB={title:"What's New"},rB={title:"Settings",theme:"Theme",themeDark:"🌙 Dark",themeLight:"☀️ Light",themeAuto:"🔄 Auto",themePresets:"Theme Presets",themePresetLinear:"Linear (minimal)",themePresetLinearDesc:"Neutral grays with a single accent — clean and focused",themePresetGithub:"GitHub",themePresetGithubDesc:"Neutral dark/light — clean and professional",themePresetCherry:"Cherry Studio",themePresetCherryDesc:"Blue gradient inspired — clean tech feel",themePresetOcean:"Ocean",themePresetOceanDesc:"Deep blue/cyan — calm and professional",themePresetMint:"Mint",themePresetMintDesc:"Teal/mint green — fresh and refreshing",themePresetLavender:"Lavender",themePresetLavenderDesc:"Soft purple — elegant and sophisticated",themePresetMidnight:"Midnight",themePresetMidnightDesc:"Deep navy — minimal and high contrast",themePresetSunset:"Sunset",themePresetSunsetDesc:"Warm orange/golden — energetic",themePresetForest:"Forest",themePresetForestDesc:"Natural green — earthy and calm",themePresetCandy:"Candy",themePresetCandyDesc:"Bright multi-color — vibrant and lively",themePresetNord:"Nord",themePresetNordDesc:"Arctic blue — popular well-designed palette",customOverrides:"Custom Overrides",customOverridesHint:"Tweak individual colors to override the active preset",customColors:"Custom Colors",colorBg:"Background",colorSurface:"Surface",colorBorder:"Border",colorText:"Text",colorMuted:"Muted Text",colorAccentBlue:"Accent Blue",colorAccentGreen:"Accent Green",colorAccentRed:"Accent Red",colorAccentYellow:"Accent Yellow",colorAccentPurple:"Accent Purple",resetColors:"Reset to default",about:"About",aboutDesc:"Web-based AI coding assistant interface",whatsNew:"What's New",language:"Language",languageZh:"中文",languageEn:"English",display:"Display",developerView:"Developer view (show raw tool calls)",developerViewHint:"Shows the AI activity feed by default; enable to see raw tool logs",capabilities:{title:"Agent Capabilities",loadFailed:"Failed to load capabilities",toggleFailed:"Toggle failed"},contextOffload:{title:"Context Offload (Artifact Store)",desc:"Large tool outputs are stored on disk as artifacts instead of living in the context forever. Only a summary + handle stays in context; the AI retrieves details on demand via artifact_query / artifact_read. This significantly reduces token usage in long sessions and improves cache hit rate.",enableLabel:"Enable tool-result offloading",currently:"currently",maxTotalMb:"Max total storage (MB)",ttlDays:"Retention (days)",outboundBytes:"Spill threshold (bytes; outputs larger are offloaded)",turnBudget:"Per-turn context growth budget (tokens)",dir:"Storage directory",optional:"optional, defaults to config dir",stats:"{{count}} artifacts stored, {{size}} MB total",saved:"Context Offload settings saved",saveFailed:"Failed to save",invalidNumber:"Number fields must be positive integers",envHint:"Fields marked ⚠ env are overridden by environment variables of the same name"}},sB={title:"Model Configuration",providerConfig:"Provider Config",configured:"Configured",notConfigured:"Not configured",modelsCount:"{{n}} models · {{apiType}}",clickToConfig:"Click to configure →",apiKeyHint:"API Key configured. Enter new key to overwrite.",apiKeyPlaceholder:"Enter new key to overwrite...",apiKeyDefaultPlaceholder:"sk-...",enterApiKey:"Please enter API Key",removeConfirm:'Are you sure you want to remove "{{providerKey}}" configuration? This will delete its API Key and models.',loadFailed:"Failed to load models",saveFailed:"Save failed",overallStatus:"Overall Status",healthy:"Healthy",degraded:"Degraded",abnormal:"Abnormal",healthRate:"Health Rate",onlineInstances:"Online Instances",totalRequests:"Total Requests",configuredModels:"Configured Models",addModel:"Add Model",provider_qwen:"Qwen (Tongyi Qianwen)",provider_glm:"GLM (Zhipu)",provider_baichuan:"Baichuan",provider_minimax:"MiniMax / Hailuo",provider_doubao:"Doubao",provider_hunyuan:"Tencent Hunyuan",provider_spark:"iFlytek Spark",provider_custom:"Custom",globalShort:"Global",setDefaultProvider:"Set as default provider",deleteProviderConfirm:'Delete the configuration for "{{key}}"?',deleteProvider:"Delete provider",catalogTitle:"models.dev Catalog Search",catalogSearchPlaceholder:"Search models across providers, e.g. gpt-4o / deepseek / claude... (matches model id, name, or provider)",catalogOnlyToolCall:"Tool call only",catalogOnlyReasoning:"Reasoning only",searching:"Searching...",catalogNoResults:"No matching models — try another keyword",badgeReasoning:"Reasoning",badgeToolCall:"Tools",badgeMultimodal:"Multimodal",ctxLimit:"Context {{k}}K",outLimit:"Output {{k}}K",catalogAddTitle:"Add to model ID input",add:"Add",catalogSourceHint:'Source: models.dev model catalog (built-in snapshot, works offline). Click "Add" to write the model ID into the Model ID input.',autoRemovedMissingModels:"Auto-removed models missing on server: {{models}}",autoSkippedMissingModels:"Auto-skipped models missing on server: {{models}}",defaultModelDisableBlocked:"Cannot disable {{name}}: switch the default model to another one first",deleteModelConfirm:"Remove model {{id}} from configuration?",connectionSuccessWithHints:"{{message}}. {{hints}}.",hintJoiner:"; ",loadingProviders:"Loading...",addProvider:"Add Provider",collapse:"Collapse",refreshList:"Refresh list",none:"None",availableCount:"{{n}} available",configuredCount:"{{n}} models",editProviderNamed:"Edit {{name}}",deleteProviderNamed:"Delete {{name}}",globalDefault:"Global default",planDefault:"Plan default",actDefault:"Act default",goalDefault:"Goal default",unsetActDefault:"Unset Act default",unsetPlanDefault:"Unset Plan default",unsetGoalDefault:"Unset Goal default",setActDefaultTitle:"Set as Act default",setPlanDefaultTitle:"Set as Plan default",setGoalDefaultTitle:"Set as Goal default",unsetActDefaultTitle:"Unset Act default (falls back to global default)",unsetPlanDefaultTitle:"Unset Plan default (falls back to global default)",unsetGoalDefaultTitle:"Unset Goal default (falls back to global default)",outputPrice:"Output price",inputPrice:"Input price",outputTokensLabel:"Output tokens",inputTokensLabel:"Input tokens",totalTokensLabel:"Total tokens",connectionSuccess:"Connected",baseUrlAutoCompleted:"Base URL auto-completed to {{url}}",apiTypeAutoSelected:"API type auto-selected as {{type}}",hasKey:"Key set",noKey:"No key",defaultShort:"Default",overrideBadge:"Override",overrideTitle:"Manually overridden model list",customBaseUrl:"Custom base URL",catalogSearch:"Search catalog models",close:"Close",apiTypeHint:"Leave empty to auto-detect protocol from Base URL",modelApiTypeLabel:"API type (catalog models)",modelApiTypeHint:"Response protocol for catalog models; defaults to provider setting",modelApiTypeEmpty:"No API types available in this catalog",addCustomProvider:"Add custom provider",configuredPanelPrefix:"Configured ",configuredPanelSuffix:" models",configuredPanelHint:"(applies instantly, two-way synced with Model IDs input)",fetchedPanelPrefix:"Fetched ",fetchedPanelMiddle:" models, selected ",fetchedPanelSuffix:"",fetchedPanelHint:"(checked models will be written into the Model IDs input)",fetchingModels:"Fetching...",fetchModels:"Fetch model list",baseUrlRequired:"Base URL is required",apiKeySanitized:"API Key contains invalid characters; filtered automatically",fetchedCount:"Fetched {{n}} models",fetchFailed:"Failed to fetch model list. Check Base URL and API Key",requestFailed:"Request failed",connectionFailed:"Connection failed",catalogSearchFailed:"Catalog search failed",addedModel:"Added {{id}}",operationFailed:"Operation failed, please retry",providerNameRequired:"Provider name is required",apiKeyRequired:"At least one API Key is required",defaultsAutoUpdated:"Default models updated automatically",unknownError:"Unknown error",loading:"Loading...",providerListRefreshed:"Provider list refreshed",refreshFailed:"Refresh failed, please try again later",refreshListTitle:"Refresh provider list from remote",providerSearchPlaceholder:"Search providers / models...",clear:"Clear",clearSearch:"Clear search",noMatchingProviders:"No matching providers",noMatchingProvidersHint:'No provider matches "{{query}}". Check the spelling or use the full list',noModelsInProvider:"No models in this provider",noDefaultModel:"No default model",defaultProviderBadge:"Default provider",loadLabel:"Load",setGlobalDefaultFailed:"Failed to set global default",setGlobalDefaultTitle:"Set as global default",setPlanDefaultFailed:"Failed to set Plan default",unsetPlanDefaultFailed:"Failed to unset Plan default",setActDefaultFailed:"Failed to set Act default",unsetActDefaultFailed:"Failed to unset Act default",setGoalDefaultFailed:"Failed to set Goal default",unsetGoalDefaultFailed:"Failed to unset Goal default",editModel:"Edit model",deleteModel:"Delete model",refresh:"Refresh",reset:"Reset",enable:"Enable",disable:"Disable",actIsGlobalHint:'Global default = Act default (merged), so no separate "Set as Act default" is offered',globalDefaultUnsettable:"Global default cannot be cleared (the active session must always have an effective model)",emptyHint:"No models yet. Configure a provider above first",selectProvider:"Select provider",customProvider:"Custom provider",customProviderDesc:"Manually enter provider name, Base URL and model IDs",editExistingConfig:"Edit existing configuration (optional)",newCustomProviderOption:"+ New custom provider",editExistingConfigHint:"Starts empty by default; pick a saved configuration to refill the form (API Keys are never echoed back; leave empty to keep the saved key).",providerNameLabel:"Provider name *",providerNamePlaceholder:"e.g. my-provider",apiKeysHintConfigured:", leave empty to keep the saved key",apiKeysHintNew:"(one per line, multiple allowed)",apiKeyMultiPlaceholder:`One API Key per line
468
468
  Multiple supported (first is used at runtime, rest are fallbacks)`,modelIdLabel:"Model IDs",modelIdPlaceholder:"gpt-4o, deepseek-chat (format: id|name|alias)",fetchModelsTitle:"Fetch model list from API",testConnectionTitle:"Probe endpoint connectivity, auto-detect API type and fix Base URL",testingConnection:"Testing...",testConnection:"Test connection",catalogSearchTitle:"Search the models.dev catalog (context/pricing/capability metadata included)",modelSearchPlaceholder:"Search models...",fullPathLabel:"Full path (no auto-appending of /chat/completions, /responses, /v1/messages)",fullPathHint:"When enabled, the Base URL is used as-is (e.g. https://host/v1/chat/completions); the backend will not transform it.",apiTypeLabel:"API type",apiTypeAutoDetect:"Auto-detect (recommended)"},iB={title:"Tool List",searchTools:"Search tools...",disabled:"Disable",enabled:"Enable",params:"Parameters",loadFailed:"Failed to load tools",noTools:"No tools available",loading:"Loading...",retry:"Retry",refresh:"Refresh",all:"All",invalidData:"Invalid tool data format returned by server"},oB={title:"Skills Manager",list:"Skill List",noSkills:"No skills available",loadFailed:"Failed to load skills",loadFailedFallback:"Load failed",enable:"Enable",disable:"Disable",enabled:"Enabled",disabled:"Disabled",new:"New Skill",import:"Import",importTitle:"Import Skill",edit:"Edit",save:"Save",cancel:"Cancel",retry:"Retry",refresh:"Refresh",tags:"Tags",none:"None",source:"Source",localSkill:"Local skill",systemPrompt:"System Prompt",selectSkill:"Select a skill",fieldId:"ID",fieldName:"Name",fieldCategory:"Category",fieldTrigger:"Trigger",fieldTools:"Tools",description:"Description",saving:"Saving",chooseFile:"Choose skill file",importHint:"Supports `.skill.md` files.",marketplace:"Marketplace",marketplaceDesc:"Browse and install skills from remote marketplaces",marketplaceTitle:"Skill Marketplace",addMarketplace:"Add Marketplace",addMarketplaceTitle:"Add Skill Marketplace",marketplaceUrl:"Marketplace URL",marketplaceUrlPlaceholder:"GitHub repo / index.json link / local skills folder, e.g. https://github.com/obra/superpowers or D:\\agent\\agentic-awesome-skills",marketplaceName:"Marketplace name (optional)",marketplaceHint:"Supports GitHub repos (auto-scans skills/ dir), an index.json URL, or a local skills folder (fully offline — browse & install from disk). If GitHub is unreachable, set the DEEPSEEKCODE_GITHUB_MIRROR env var to a mirror prefix.",marketFilterPlaceholder:"Search skills in this marketplace...",marketCategoryAll:"All categories",riskCritical:"High risk",riskUnknown:"Risk unknown",refreshMarketplace:"Refresh",removeMarketplace:"Remove",installSkill:"Install",installed:"Installed",installFail:"Install failed",loadMarketplaceFail:"Failed to load skill marketplace",noMarketplaces:"No marketplaces yet — add one",noSkillsInMarket:"No skills in this marketplace",marketplaceError:"Marketplace index failed to load: {{error}}",retryMarket:"Retry",presets:"Built-in marketplaces",marketplaces:"Added marketplaces",skillCount:"{{count}} skills",installedSkills:"Installed skills",addFail:"Failed to add marketplace",installing:"Installing...",adding:"Adding...",marketplaceTab:"Marketplace",mineTab:"My Skills",installedTab:"Installed",workshopTab:"Workshop",workshopHint:"Skill proposals: generated from sessions or manually, apply as skills after review",workshopPropose:"New Proposal",workshopName:"Skill name (skill-name) e.g. format-json",workshopTrigger:"Trigger keywords (optional)",workshopDescription:"One-line description",workshopContent:"Skill body (system prompt / workflow instructions)",workshopSubmit:"Submit",workshopApply:"Apply",workshopEmpty:"No skill proposals yet",workshopFormRequired:"Skill name and content are required",uninstall:"Uninstall",uninstallConfirm:'Uninstall installed skill "{{name}}"?',uninstalling:"Uninstalling...",uninstallFail:"Uninstall failed",pagePrev:"Prev",pageNext:"Next",pageOf:"Page {{page}} / {{total}}",emptyInstalled:"No marketplace skills installed yet",emptyInstalledHint:"Head to the Marketplace tab to browse and install",browseMarket:"Go to Marketplace",use:"Use",useHint:"Insert $skill into the input box, then add your task and send",pickTitle:"Pick a Skill",pickPlaceholder:"Search skills...",pickEmpty:"No usable skills",pickUse:"Use it"},lB={permissionRequest:"Permission Request",hookApproval:"Hook Interception Approval",hookConfirm:"Hook Request Confirmation",morePending:"{{n}} more pending",tool:"Tool: ",reason:"Reason: ",needConfirm:"Requires user confirmation",allow:"Allow",deny:"Deny",allowAlways:"Always allow this session",allowAlwaysDesc:"Don't ask again for this tool in current session",autoMode:"Auto Mode",autoModeLabel:"Auto mode (allow all)",autoModeDesc:"Auto-approve all hook requests",moreOptions:"More options",highRiskWarning:"This action may cause irreversible effects, please confirm carefully",mediumRiskConfirm:"Please confirm this is the intended action",alreadyAllowed:"Allowed: ",alreadyDenied:"Denied: ",risk_critical:"Destructive operation - may delete data",risk_critical_cmd:"High-risk command - system-level operations",risk_high_shell:"Shell command execution",risk_high_file:"File write operation",risk_high_pkg:"Package management operation",risk_git_force:"Git force operation",risk_git:"Git operation",risk_network:"Network request",risk_low:"Read-only operation",risk_default:"Tool call",hookConfigTitle:"Custom Hook Configuration",hookConfigDesc:"You can add or modify hook interception rules in the .agent/hooks.json file in the project root directory.",hookConfigDetail:"Hooks support SHELL (external scripts) and HTTP (REST endpoints) types, and can be triggered before (PRE_TOOL_USE) or after (POST_TOOL_USE) tool execution.",hookConfigBuiltin:"Built-in hooks: BashSafetyHook (dangerous command interception), FileWriteAuditHook (file write audit), ToolUsageStatsHook (tool usage statistics). Set enabled: false to disable any hook.",optionAllow:"Allow — execute this operation",optionAllowHint:"Click or press Enter to confirm",optionDeny:"Deny — cancel this operation",optionDenyHint:"Click or press Esc to cancel",optionAllowAlways:"Allow always this session",optionAllowAlwaysHint:"Don't ask again for {{tool}}",optionAllowPathHint:"Don't ask again for this external path",timeoutWaitUser:"waiting for user (no timeout)",optionAutoMode:"Auto mode — allow all hooks",optionAutoModeHint:"All future hooks will be auto-approved",shortcutHint:"Shortcuts: 1-4 select · Enter allow · Esc deny",lastItem:"Last item",modalHint:"Please handle this approval request in the popup modal",clickToSelect:"Click to select · 1/2/3/4 keyboard shortcuts",verbRunCommand:"Run command",verbWriteFile:"Write file",verbEditFile:"Edit file",verbReadFile:"Read file",verbDeleteFile:"Delete file",verbFindFiles:"Find files",verbSearchContents:"Search contents",verbFetchUrl:"Fetch URL",verbSearchWeb:"Search web",verbGit:"Git operation",verbInstall:"Install package",verbSendMessage:"Send message",verbRunTool:"Run operation",scopeLocal:"acts on this workspace",scopeExternal:"external path",showAllLines:"Show all {{n}} lines",showAll:"Show the full message",showLess:"Show less",importMergeConfirm:`Merge into the existing configuration?
469
469
  "OK" = merge / "Cancel" = replace`,configTitle:"Hook Configuration",configDesc:"Attach interceptors to lifecycle events such as tool execution and task transitions for approvals and custom logic",import:"Import",export:"Export",newRule:"New Rule",ruleList:"Rules",ruleCount:"{{n}} rules",implShell:"Shell script",implShellDesc:"Run an external script; receives JSON via stdin and returns a decision via stdout",implHttp:"HTTP endpoint",implHttpDesc:"POST JSON to an external endpoint",implPromptDesc:"Send a single-turn prompt to the LLM for risk assessment",implAgentDesc:"Launch a read-only sub-agent for deep investigation",stepBasicTitle:"Basic Info",stepBasicDesc:"Name, description, events",stepImplTitle:"Implementation",stepImplDesc:"Execution type and parameters",stepAdvancedTitle:"Advanced",stepAdvancedDesc:"Priority, filters, testing",editRule:"Edit: {{name}}",addRule:"Add Hook Rule",fieldName:"Name *",fieldDescription:"Description",descriptionPlaceholder:"What this hook does...",fieldEvents:"Events *",eventsSelected:"{{n}} selected",searchEventsPlaceholder:"Search events...",toggleAllEvents:"Select all / none",fieldImplType:"Implementation type *",fieldCommand:"Command *",fieldPromptTemplate:"Prompt template *",promptTemplatePlaceholder:"You are a security audit expert. Please analyze the following tool call...",selectAgentPlaceholder:"Select agent...",agentReadOnlyHint:"The agent runs in read-only mode (Read/Grep/Glob) and cannot modify files",fieldPriority:"Priority",fieldTimeout:"Timeout (ms)",labelEnabled:"Enabled",failOpenLabel:"Fail-open (allow on timeout)",fieldToolFilter:"Tool filter (regex, optional)",dryRunResultTitle:"Dry-run result",dryRunDecision:"Decision: ",dryRunReason:"Reason: ",dryRunOutput:"Output: ",dryRunButton:"Dry Run",prevStep:"Previous",nextStep:"Next",saveChanges:"Save Changes",createRule:"Create Rule",noRules:"No hook rules yet",noRulesHint:'Click "New Rule" in the top-right corner to create your first hook',batchDeleteConfirm:"Delete {{n}} selected rules?",selectedItems:"{{n}} selected",enableAll:"Enable all",disableAll:"Disable all",colName:"Name",colEvents:"Events",colType:"Type",colStatus:"Status",colActions:"Actions",clickToDisable:"Click to disable",clickToEnable:"Click to enable",actionEdit:"Edit",deleteRuleConfirm:'Delete rule "{{name}}"?',statTotal:"Total rules"},cB={pending:"Waiting",thinking:"Thinking",action:"Action",result:"Result",running:"Running",error:"Error",completed:"Completed",params:"Parameters"},uB={linesTotal:"… ({{n}} lines total)",expandAll:"Expand all ({{n}} lines)",collapse:"Collapse"},dB={quickCommands:"Quick Commands",search:'Search: "{{filter}}"',help:"↑↓ Select · Enter Execute · Esc Close",backend:"Backend",backendCommand:"Backend command",chat_desc:"Switch to chat panel",chat_result:"Switched to chat panel",terminal_desc:"Switch to terminal panel",terminal_result:"Switched to terminal panel",files_desc:"Switch to file panel",files_result:"Switched to file panel",models_desc:"Switch to model panel",models_result:"Switched to model panel",tools_desc:"List available tools",tools_result:"Switched to tool panel",skills_desc:"List available skills",skills_result:"Switched to skills panel",settings_desc:"Switch to settings panel",settings_result:"Switched to settings panel",logs_desc:"Switch to logs panel",logs_result:"Switched to logs panel",new_desc:"Create new session",new_result:"New session created",clear_desc:"Clear current session messages",clear_result:"Messages cleared",theme_desc:"Toggle theme (dark/light/auto)",theme_error:"Usage: /theme <dark|light|auto|{{presets}}>",theme_result:"Theme switched to ",theme_preset_result:"Theme preset switched to ",theme_preset_unavailable:"Theme preset switching not available",toggle_terminal_desc:"Toggle terminal panel display",toggle_terminal_result:"Terminal panel toggled",logs_clear_desc:"Clear logs",logs_clear_result:"Logs cleared",doctor_desc:"System diagnostics (Config/API Key/Network/Docker/Disk)",compact_desc:"Compact current session context",help_desc:"Show all quick commands",token_desc:"Show token usage and API cost statistics",review_desc:"Code review — check correctness, security, and code quality",security_review_desc:"Security review — OWASP Top 10 + command injection/path traversal/privilege escalation",memory_desc:"Manage AI persistent memory (list/add/delete/clear)",ps_desc:"View and manage background tasks, sub-agents, and shell processes",model_desc:"View or switch AI models",status_desc:"Show current session status (session ID/message count/model/working directory)",config_desc:"Manage application configuration (get/set/list/delete)",exit_desc:"Exit application",exit_result:"Shutting down...",benchmark_desc:"Run DeepSeekCode capability benchmark (simple/medium/complex/full/list)",goal_desc:"Set a goal for multi-step work",goal_list_desc:"List active goals",goal_status_desc:"Show goal progress",workflow_list_desc:"List workflow runs",workflow_status_desc:"Show workflow status",workflow_checkpoints_desc:"List workflow checkpoints",mcp_desc:"List or reload MCP servers",sessions_desc:"List sessions",resume_desc:"Resume a session by id",permissions_desc:"Show permission rules and pending approvals",init_desc:"Generate agent.md project guidance file",self_test_desc:"Run tool capability self-test and generate a report",context_desc:"Show context analysis report",version_desc:"Show version information","check-update_desc":"Check for available updates",upgrade_desc:"Upgrade to the latest version",acceptance_desc:"Run or inspect acceptance workflows (quick/full/list/report)",diff_desc:"View uncommitted git changes in the workspace",summary_desc:"Summarize the current session conversation",effort_desc:"Show or set reasoning effort level (low|medium|high)",export_desc:"Export the current conversation as JSON",rename_desc:"Rename the current session",hooks_desc:"Show active hook configurations",cost_desc:"Show estimated session cost and duration",sent_command:"Command sent: ",noActiveSession:"No active session",unknownCommand:"Unknown command {{cmd}} — type /help to see available commands"},fB={pageError:"Page error",unknownError:"An unknown error occurred, please try refreshing the page",refreshPage:"Refresh page",genEnded:"Generation ended (tool execution timeout or connection lost)"},hB={backendConnected:"Backend connected",backendDisconnected:"Backend disconnected, reconnecting...",paused:"Paused, press ESC again to stop",terminated:"Stopped (ESC×2)",contextCompressed:"Context compressed: {{original}} → {{compressed}} messages, saved {{saved}} tokens",errorPrefix:"❌ Error: {{error}}",uncaughtError:"Uncaught error: ",uncaughtRejection:"Uncaught Promise rejection: ",unknownReason:"Unknown reason",diagnosing:"⏳ Diagnosing...",runDiagnostic:"🔍 Run Diagnostic",inspectorOn:"Enable inspector (Ctrl+Shift+Alt+C)",inspectorOff:"Disable inspector"},mB={title:"Channel Management",subtitle:"Connect external IM platforms to interact with AI via WeChat, Feishu, DingTalk, etc.",newChannel:"New Channel",editChannel:"Edit Channel",table:{name:"Channel Name",type:"Type",appId:"App ID",status:"Status",enabled:"Enabled",actions:"Actions",emptyHint:'Click "New Channel" in the top right to connect WeChat, Feishu or DingTalk'},status:{connected:"Connected",disconnected:"Disconnected",connecting:"Connecting",error:"Error"},empty:"No channels configured yet",emptyHint:'Click "New Channel" to add an IM platform bot',form:{basicInfo:"Basic Info",name:"Channel Name",namePlaceholder:"e.g. Office Group Bot",type:"Channel Type",credentials:"Credentials",appId:"App ID",appIdPlaceholder:"Enter App ID",appSecret:"App Secret",appSecretPlaceholder:"Enter App Secret",token:"Token",tokenPlaceholder:"Enter Bot Token",encodingAESKey:"EncodingAESKey",encodingAESKeyPlaceholder:"WeChat only, optional",enabled:"Enable Channel",wechatQrHint:"Save first, then scan QR code to login",feishuWsHint:"Feishu uses WebSocket to receive messages automatically",namePlaceholderDev:"e.g. Dev Group Bot",typeLocked:"Channel type cannot be changed after creation",leaveBlankUnchanged:"Leave blank to keep unchanged",leaveBlankMeansUnchanged:"Leave blank to keep unchanged",appSecretValue:"App secret",tokenCallback:"Callback verification token",optionalShort:"Optional",encodingAesOptional:"Optional, message encryption/decryption key",wechatIlinkHint:"The WeChat iLink bot authorizes via QR scan; credentials can be left empty — just save and scan to log in.",wechatIlinkHintList:'The WeChat iLink bot authorizes via QR scan; credentials can be left empty — after saving, click "QR Login" in the list.',enabledOffHint:"Sending and receiving messages stops when disabled"},actions:{scanQr:"Scan QR",edit:"Edit",delete:"Delete",deleteConfirm:"Are you sure you want to delete this channel?",test:"Test Connection",save:"Save Channel",cancel:"Cancel",refresh:"Refresh",qrLogin:"QR Login",deleteConfirmNamed:'Delete channel "{{name}}"?',deleteConfirmShort:"Delete this channel?"},errors:{loadFailed:"Failed to load channels",createFailed:"Failed to create channel",updateFailed:"Failed to update channel",deleteFailed:"Failed to delete channel",notFound:"Channel not found",notImplemented:"Not implemented",nameRequired:"Channel name is required"},qr:{title:"WeChat QR Login",generating:"Generating QR code...",waiting:"Scan the QR code with WeChat",scanned:"Scanned, please confirm on your phone",confirmed:"Login successful",expired:"QR code expired",expiredHint:"Click retry to generate a new QR code",error:"Failed to get QR code",openInNewTab:"Open in new tab"},typeLabels:{wechat:"WeChat",feishu:"Feishu",dingtalk:"DingTalk",telegram:"Telegram",discord:"Discord",slack:"Slack",signal:"Signal",whatsapp:"WhatsApp",line:"LINE",qqbot:"QQ Bot",matrix:"Matrix",mattermost:"Mattermost",msteams:"Teams",googlechat:"Google Chat",irc:"IRC"},viewSubtitle:"Connect WeChat, Feishu and DingTalk so users can send tasks via channels and receive progress and results in real time",experimentalLabel:"Experimental",experimentalShort:"Exp",experimentalTip:"Experimental implementation, features may be incomplete",experimentalDesc:"This channel is a basic adapter wrapper supporting basic message send/receive; some advanced features may be incomplete",pluginMissingLabel:"Plugin missing",pluginMissingTip:"The plugin for this channel type is not installed or activated; instances cannot start",pluginMissingWarning:'The plugin for this channel type is not installed or activated, so instances cannot start. Go to the "Plugins" page, install and activate the{{name}}plugin, then retry.',selectTypeHint:"Select a channel type on the left",instancesCount:"{{n}} configured instances",notConfiguredYet:"Not configured yet",createInstance:"New Instance",createShort:"New",selectInstance:"Select Instance",emptyWithType:"No {{type}} configured yet",wechatBindHint:"Click the button below and scan the QR code with WeChat to bind automatically",startWithCreate:'Click "New Instance" above to start configuration',scanToBind:"Scan to Bind",qrLoginReauth:"QR Login / Re-authorize",editConfig:"Edit Config",createConfig:"New Config",save:"Save",saving:"Saving...",unknownError:"Unknown error",retry:"Retry",bindSuccess:"Bound successfully",bindTitle:"Scan to Bind · {{name}}",startUsing:"Start Using",clickToRefresh:"Click to refresh",connectedReady:'"{{name}}" is connected and ready to use',createdConnectedReady:"WeChat channel created and connected, ready to use",waitingAuthorize:"Scan the QR code with WeChat to authorize the bot",scannedConfirming:"Scanned, please confirm on your phone...",confirmedClosing:"Bot authorized and started, closing automatically soon",connectingIlink:"Connecting to iLink service...",openInNewTabFallback:"Open in new tab (fallback)",toastReauthSuccess:'WeChat "{{name}}" re-authorized successfully, channel connected',toastBindSuccess:"WeChat bound successfully, channel created and connected automatically",pollFailedRefresh:"Too many polling failures, please refresh the QR code and retry",pollFailedToast:"Failed to poll WeChat binding status, please refresh the QR code and retry",qrDataMissing:"QR code data missing: {{data}}",fetchWechatQrFailed:"Failed to get WeChat QR code: {{error}}",sidebar:{title:"Channels",configuredCount:"{{n}} configured",clickToConfigure:"Click a channel below to start configuration",configuredMissing:"Configured · plugin missing",unconfigured:"Not configured",empty:"No channel plugins installed",emptyHint:"Channel types appear here after you install their plugins from the Plugins page",partialConnected:"{{connected}}/{{count}} connected",waitingPlugin:"Waiting for plugin installation"},categories:{im:"Instant Messaging",international:"International",eastAsia:"East Asia",collaboration:"Collaboration Platforms",classic:"Classic Protocols",other:"Others",builtin:"Built-in",plugins:"Plugin Extensions"}},pB={stageUploaded:"Pending",stageParsing:"Parsing data file",stageMapping:"Template mapping",stageRendering:"Generating file",stageComplete:"File processing complete",stageError:"File processing failed",parsing:"Parsing {{file}}…",parsedSummary:"{{rows}} rows · {{fields}} fields",mappingTitle:"Template ↔ data field mapping",templatePlaceholder:"Template placeholder",dataField:"Data field",mappingMore:"{{n}} more mappings",rendering:"Generating {{current}}/{{total}}…",download:"Download",downloadFailed:"Download failed",error:"Processing failed",roleData:"Data file",roleTemplate:"Template file",attach:"Upload files or images (multi-select supported)",dropHint:"Drop to add attachments",unsupportedType:"Unsupported file type: {{name}}",fileTooLarge:"File too large: {{name}} (≤50MB)",duplicateFile:"Duplicate file: {{name}}",maxAttachments:"Up to {{n}} files at a time",uploadFailed:"Upload failed",stillUploading:"Attachments are still uploading, please wait…",importFailed:"Import files failed",kindText:"Text",moreRows:"+{{n}} rows",rowsDone:"{{done}}/{{total}} rows",rowsFailed:"{{n}} rows failed",imagePreview:"Image preview"},gB={reconnecting:"Reconnecting {{attempt}}/{{max}}",hint:"Reconnecting to backend…"},yB={title:"Full access (auto-approve) is on",desc:"The agent can edit files and run commands without confirmation. Risk of data loss.",dismiss:"Dismiss for now",neverShow:"Don't show again"},vB={panelTitle:"Environment & Changes",noRepo:"Not a Git repo",notGitDesc:"The current working directory is not a Git repository; change stats are unavailable.",refresh:"Refresh",changes:"Changes",clean:"Working tree clean",branch:"Branch",upstream:"Ahead of upstream",commit:"Commit",push:"Push",commitConfirm:"Commit",commitPlaceholder:"Commit message (drafted by agent, editable)…",commitSuccess:"Committed",commitFailed:"Commit failed",pushSuccess:"Pushed",pushFailed:"Push failed",checkoutSuccess:"Switched to {{branch}}",checkoutFailed:"Checkout failed",prReady:"PR checks passing",prUnavailable:"Pull request status unavailable (no remote)",prLoading:"Loading PR status…",environment:"Environment",ok:"Done",loading:"Loading…",emptyCommitMsg:"Please enter a commit message"},bB={retry:"Retry",details:"Details",modelSettings:"Model settings"},xB={comingSoon:"Coming soon"},wB={lspGroup:"Language Servers (LSP)",mcpGroup:"MCP Servers",notInstalled:"Not installed",installed:"Installed",ready:"Ready",connecting:"Connecting",installing:"Installing…",error:"Error",disabled:"Disabled",toolCount:"{{count}} tools",docs:"Docs",official:"Official",cloud:"Cloud",local:"Local",needCredentials:"This connector needs credentials to start:",connect:"Connect",missing:"missing",envConfigured:"credentials set",searchPlaceholder:"Search connectors (name, id, description)…",all:"All",noResults:"No connectors match your search/filter.",custom:"Custom",addCustom:"Add custom",customTitle:"Add custom MCP server (from awesome-mcp-servers or your own)",customName:"Name (id)",customCommand:"Command",customArgs:"Args (space separated)",customEnv:"Env (KEY=value, comma separated)",customUrl:"MCP endpoint URL",customHeaders:"Headers (KEY=value, comma separated)",customLocal:"Local command",customFormRequired:"Name and command/URL are required.",removeCustom:"Remove this custom connector",add:"Add"},SB={justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},kB={title:"Voice input (Chinese: FunASR / other languages: whisper)",stopTitle:"Stop recording and transcribe",langToggle:"Speech recognition language",multiHint:"Chinese uses FunASR; other languages use faster-whisper",noSpeech:"No speech detected, please try again",backendMissing:"STT service not ready — opened settings to guide installation",setup:{title:"Voice Service",envCard:"Environment check",envChecking:"Checking…",recheck:"Re-check",pythonOk:"Python {{version}} ready",pythonMissing:"Python not detected. Please install Python 3.10+ first",pythonGuide:"Download Python",pipOk:"pip available",pipMissing:"pip is missing. Install pip first, then install the speech engine",whisperTitle:"Whisper · English & multilingual",whisperDesc:"English speech recognition",funasrTitle:"FunASR · Chinese",funasrDesc:"Chinese speech recognition",installed:"Installed",notInstalled:"Not installed",install:"Install",installing:"Installing…",cancel:"Cancel install",installDone:"Install complete — voice input is ready",installFailed:"Install failed",installTimeout:"Install timed out",installCancelled:"Install cancelled",jobInProgress:"An install task is already running, taking over its progress",manualCommand:"Manual install command",copyCommand:"Copy",copySuccess:"Copied to clipboard",copyFailed:"Copy failed",torchHint:"Chinese engine requires torch — large download, please wait",logWaiting:"Preparing install…",chooseHint:"Environment ready — pick an engine above to install",defaultEngine:"Default recognition engine",defaultEngineHint:"Choose the default engine for voice input. You can switch anytime in the chat input.",inUse:"In use",engineNotInstalledHint:"This engine is not installed yet. Recording will guide you to install it.",probeError:"Dependency check failed: ",installDoneButMissing:"Install command finished, but the engine is still unavailable",installDoneButMissingHint:"The voice service was restarted and re-checked automatically. If it still fails, run the manual command below in a terminal to diagnose (common cause: torch incompatible with system DLLs).",pipGuide:"Install Python (with pip) first, then restart the app and retry."}},_B={verb:{researching:"Analyzing code",coding:"Editing code",validating:"Running checks",summarizing:"Wrapping up"},title:{withFile:"{{verb}} {{file}}",withCount:"{{verb}} · {{count}} items"},evidenceMore:"+ {{count}} more",toolCallCount:"{{count}} tool calls",toolNamesMore:"+{{count}} more tools",waitingUser:"Waiting for your answer",blocked:"Blocked: {{reason}}",paused:"Paused — resumable",viewAndAnswer:"View & answer",evidence:"Execution details",phase:{analysis:"Analysis",implementation:"Implement",optimization:"Optimize"}},CB={next:"Next",idle:"Idle"},TB={title:"Scheduled Automations",refresh:"Refresh",new:"New",namePlaceholder:"Name (e.g. summarize Git status every morning at 9)",instructionsPlaceholder:"Instructions (what the agent executes on each trigger)",cronPlaceholder:"cron (5 fields, e.g. 0 9 * * *)",create:"Create",cronDaily9:"Daily at 9:00",cronWeekday9:"Weekdays at 9:00",cronEvery30Min:"Every 30 minutes",empty:"No scheduled automations yet. Create one to let the agent work unattended.",enable:"Enable",disable:"Disable",runNow:"Trigger manually",delete:"Delete",historyTitle:"Run History",noRuns:"No runs recorded yet",permissionsTitle:"Scoped allow rules (tool target)",permissionsEmpty:"None. Write operations not allowed here require manual approval and are auto-rejected after timeout.",permissionPlaceholder:"e.g. write_file docs/report.md",add:"Add"},AB="Scheduled tasks (e.g. nightly test-data runs) will be managed here.",EB="Manage plugins. Enable or disable extensions such as file-processing skills.",NB="Feature under development…",MB={title:"Files",searchPlaceholder:"Search...",refresh:"Refresh",collapse:"Collapse",uploadTo:"Upload to {{dir}}",uploadToRoot:"Upload to workspace root",setUploadDirHint:"Click to set as upload directory and expand",download:"Download",close:"Close",modified:"Modified",saving:"Saving...",save:"Save",saved:"File saved",saveFail:"Save failed",readFail:"Failed to read file",downloadFail:"Download failed",downloadStarted:"Download started",uploadedCount:"Uploaded {{count}} files",uploadFailedCount:"Failed to upload {{count}} files",selectFileHint:"Select a file to preview or edit"},RB={title:"Logs",backendLogs:"Backend Logs",streamTab:"Live Stream",files:"Log Files",clear:"Clear",refresh:"Refresh",refreshing:"Refreshing...",noLogs:"No live logs",noFiles:"No log files",preview:"Preview",download:"Download",backToList:"Back to file list",emptyFile:"(empty file)",totalLines:"{{count}} lines",showingLatest:"(showing latest {{count}} lines)"},OB={installedTab:"Installed ({{count}})",availableTab:"Available ({{count}})",searchPlaceholder:"Search plugins (name / id / description / tags)",clear:"Clear",allCategories:"All",marketFilterAll:"All sources",marketFilterBuiltin:"Built-in",prevPage:"Prev",nextPage:"Next",pageInfo:"Page {{page}} / {{pages}} · {{count}} items",noMatch:"No matching plugins",emptyInstalled:'No plugins yet — install from the market on the "Available" tab',emptyMarket:"No plugins available in the market",applyProviderTitle:"Write the plugin's provider preset into ProviderConfigStore (user-authorized)",activate:"Activate",deactivate:"Deactivate",uninstall:"Uninstall",installActivate:"Install & Activate",installOnly:"Install only",uninstallTitle:"Uninstall Plugin",uninstallConfirm:"Uninstall {{id}}? Plugin files will be deleted (except bundled)."},DB={starterTitle:"New template",starterNodeTitle:"Task",starterNodeDesc:"Describe the task",sourceSaved:"Distilled",sourceScript:"Script",sourceHandwritten:"Handwritten",roleExplore:"Explore",rolePlan:"Plan",roleExecute:"Execute",roleVerify:"Verify",roleSummarize:"Summarize",roleGeneric:"Generic",noNodes:"This template has no nodes yet.",filterAll:"All",noMatchTemplates:"No matching templates",emptyTemplates:"No templates yet. Save a dynamic workflow run as a template, or draft one with AI.",aiPromptRequired:"Description cannot be empty",aiDraftFailed:"AI drafting failed. Please try again or write the JSON manually.",nameRequired:"Template name cannot be empty",jsonParseFailed:"Failed to parse JSON: {{error}}",invalidDefinition:"definition must be a WorkflowDefinition containing a nodes array",createFailed:"Failed to create template",loadFailed:"Failed to load template",uncategorized:"Other",savedVersion:"Saved (v{{version}})",saveFailed:"Failed to save",renderFailed:"Render failed",selectTemplateHint:"Select a template on the left to view or edit",selectTemplateHintSub:"Built-in presets work out of the box; you can also save a workflow run as a template to reuse it later.",loading:"Loading…",deleteTemplate:"Delete template",categoryLabel:"Category (category)",descriptionLabel:"Description (description)",nodeCount:"{{n}} nodes",topologyHint:"Topology: serial / parallel dependencies",inputCount:"{{n}} input parameters",workflowNodes:"Workflow nodes",sortedByDeps:"Sorted by dependency topology",launchWithTemplate:"New session from template",testRun:"Test run",versionHistory:"Version history",advancedJson:"Advanced (JSON)",refresh:"Refresh",inputsSchemaLabel:"inputs (parameter schema, JSON) — saving changes bumps the version",definitionLabel:"definition (WorkflowDefinition, JSON)",saveChanges:"Save changes",versionSnapshotLabel:"Immutable version snapshots (versions/{v}.json)",noVersions:"No versions yet",viewingVersion:"Currently viewing",libraryTitle:"Template library",newTemplate:"New template",newShort:"New",searchPlaceholder:"Search templates…",paramCount:"{{n}} params",viewing:"Viewing",view:"View",launchModalTitle:'New session from "{{name}}"',previewModalTitle:'Test run "{{name}}"',launch:"Launch",renderPreview:"Render preview",renderSuccess:"Rendered successfully — the resulting definition can be launched directly",nameLabel:"Name *",namePlaceholder:"e.g. Triage Inbox",categoryField:"Category",descriptionField:"Description",aiDraftTab:"Draft with AI",manualJsonTab:"Write JSON manually",aiPromptLabel:"Describe in one sentence what you want (the AI will break it down into role-based workflow nodes)",aiPromptPlaceholder:"e.g. Review the current repo's code for security/performance/correctness and produce a graded report, read-only throughout",aiWorking:"AI is breaking down the task…",generateWorkflow:"Generate workflow",aiTimeHint:"Takes about 30–60s (reasoning models may take longer); you can tweak the result manually afterwards",newInputsLabel:"inputs (parameter schema, JSON; referenced via <<input:name>>)",inputsExamplePlaceholder:'[{ "name": "folder", "label": "Folder", "type": "folder", "required": true }]',cancel:"Cancel",create:"Create",deleteConfirm:'Delete template "{{name}}"? This action cannot be undone.',delete:"Delete",typeString:"Text",typeNumber:"Number",typeSelect:"Select",typeBoolean:"Toggle",typeFolder:"Folder",typeConnector:"Connector",noInputsNeeded:"This template needs no parameters — start directly.",starting:"Starting…",requiredError:"Required",numberError:"Please enter a number",selectNone:"(none)",newSession:"New session",newFromTemplateTitle:"New from template",chooseTemplateAria:"Choose a template to start a session",backToList:"Back to template list",startSessionHeader:"Start a session",directChat:"Direct chat",directChatHint:"No template — the AI breaks down the task on the fly (dynamic workflow)",loadingTemplates:"Loading templates…",noTemplatesYet:"No saved templates yet.",libraryMenu:"Template library…"},LB={autoFollowOn:"Follow output: on",autoFollowOff:"Follow output: off"},BB={title:"Testing & Observability",evalIntro:"Run capability evaluation tests to verify that system features work correctly.",running:"Running...",evalTriggered:"{{label}} triggered. Check the conversation for results.",evalQuickDesc:"Acceptance checks (no LLM required)",evalFullDesc:"Real LLM calls (slow)",evalListDesc:"List all evaluation tasks",historyTitle:"Run History",refresh:"Refresh"},jB={taskBoard:{title:"Task Board"},card:{collapse:"Collapse",expand:"Expand",auto:"Auto",unpin:"Unpin",pinKeep:"Pin (won't auto-hide)",pin:"Pin",close:"Close this widget"},workflow:{fallbackTitle:"Workflow",statusRunning:"Running",statusCompleted:"Done",statusFailed:"Failed",statusSkipped:"Skipped",statusBlocked:"Waiting",statusPending:"Pending",resume:"Resume",pause:"Pause",cancel:"Cancel"},agentFlow:{statusRunning:"Running",statusCompleted:"Done",statusFailed:"Failed",statusIdle:"Idle",moreAgents:"+{{count}} agents",eventLog:"Event log ({{count}})"},plan:{title:"AI Plan",fallbackTitle:"Workflow plan",stepCount:"{{count}} steps",moreSteps:"+{{count}} steps",start:"Start execution",change:"Change flow",changeHint:"Discard this plan and rephrase your request",cancelTitle:"Cancel workflow",cancel:"Cancel"}},PB={drawerCollapseTitle:"Collapse drawer to view messages",drawerExpandTitle:"Expand drawer to make a choice",openFile:"Open ›"},IB={viewToggle:"Trajectory",viewToggleTitle:"Switch chat / trajectory view",toolbar:{duration:"Duration",actualDuration:"Show timeline blocks at recorded duration",equalWidth:"Show timeline blocks at equal width",turns:"Turns",calls:"Calls",collapseTurns:"Collapse all turns",expandTurns:"Expand all turns",collapseCalls:"Collapse all tool calls",expandCalls:"Expand all tool calls",search:"Search trajectory",searchPlaceholder:"Search trajectory…"}},b3={common:ZL,nav:XL,chat:QL,shortcuts:JL,palette:eB,a11y:tB,plan:nB,whatsnew:aB,settings:rB,models:sB,tools:iB,skills:oB,hook:lB,step:cB,toolCall:uB,slashCommands:dB,error:fB,toast:hB,channels:mB,fileJob:pB,reconnect:gB,autoAccess:yB,git:vB,errorCard:bB,placeholder:xB,connectors:wB,time:SB,stt:kB,activity:_B,taskbar:CB,automation:TB,placeholderScheduledDesc:AB,placeholderPluginsDesc:EB,featureInProgress:NB,fileTree:MB,logs:RB,plugins:OB,templates:DB,terminal:LB,testing:BB,widgets:jB,commonUi:PB,trajectory:IB},zB=qi.getState().language||"zh-CN";Sn.use(Fk).init({resources:{"zh-CN":{translation:v3,hook:v3.hook},en:{translation:b3,hook:b3.hook}},lng:zB,fallbackLng:"zh-CN",interpolation:{escapeValue:!1}});qi.subscribe((n,e)=>{n.language!==e.language&&Sn.changeLanguage(n.language)});function $g(n){let e=null;if(typeof n=="string")try{const t=JSON.parse(n);t&&typeof t=="object"&&!Array.isArray(t)&&(e=t)}catch{return}else n&&typeof n=="object"&&!Array.isArray(n)&&(e=n);if(e)return e.filePath||e.path||e.file||e.file_path}const $7=/(?:^|\s|\/|\\)(test|tests|lint|build|tsc|vitest|jest|pytest|typecheck|check)(?:\s|\.|"|'|`|$)/i,H7=/bash|shell|run|exec|terminal|command/i,$B=/read|grep|glob|search|list|find|open|view|web_search|fetch/i;function Hg(n){return n.some(e=>ll(e.name))?"coding":n.some(e=>H7.test(e.name))&&n.some(e=>{const t=typeof e.args=="string"?e.args:JSON.stringify(e.args??"");return $7.test(t)})?"validating":n.some(e=>$B.test(e.name))?"researching":"summarizing"}function Ug(n){return n.some(e=>ll(e.name))?"implementation":n.some(e=>H7.test(e.name))&&n.some(e=>{const t=typeof e.args=="string"?e.args:JSON.stringify(e.args??"");return $7.test(t)})?"optimization":"analysis"}function Fg(n){return Sn.t(`activity.verb.${n}`)}function U7(n){const e=n.replace(/\\/g,"/");return e.slice(e.lastIndexOf("/")+1)||n}function F7(n,e){const t=Fg(n);for(const a of e){const s=$g(a.args);if(s)return Sn.t("activity.title.withFile",{verb:t,file:U7(s)})}return e.length>1?Sn.t("activity.title.withCount",{verb:t,count:e.length}):t}const HB=1500,UB=3,FB=3,x3=24;let r0=!1,Xs=[],B0=0,$i=null;function Gg(){return B0>=FB}function w3(){$i==null||$i.abort(),$i=null;const n=Xs;Xs=[],r0=!1,B0=0;for(const e of n)e.resolve(null)}function GB(n){const e=n.replace(/[\r\n]+/g," ").replace(/^["'「『]+|["'」』。.,,、]+$/g,"").trim();return e?e.length>x3?`${e.slice(0,x3-1)}…`:e:null}async function qB(n){var a,s,o;const e=new AbortController;$i=e;const t=setTimeout(()=>e.abort(),HB);try{const l=[`行为类型: ${n.kind}`,n.files.length>0?`涉及文件: ${n.files.map(U7).join(", ")}`:"",`工具调用数: ${n.toolCount}`].filter(Boolean).join(`
470
470
  `),u=await fetch("/v1/chat/completions",{method:"POST",headers:{"content-type":"application/json"},signal:e.signal,body:JSON.stringify({messages:[{role:"system",content:"你是标题生成器。根据给定的行为类型、涉及文件和工具数,生成一句不超过 16 字的中文活动标题(动词开头,不要标点结尾,不要引号)。只输出标题本身。"},{role:"user",content:l}],max_tokens:60,temperature:.3,stream:!1})});if(!u.ok)return null;const h=(o=(s=(a=(await u.json()).choices)==null?void 0:a[0])==null?void 0:s.message)==null?void 0:o.content;return typeof h=="string"?GB(h):null}catch{return null}finally{clearTimeout(t),$i===e&&($i=null)}}async function G7(){if(r0)return;const n=Xs.shift();if(n){r0=!0;try{const e=await qB(n.req);e?(B0=0,n.resolve(e)):(B0+=1,n.resolve(null))}finally{if(r0=!1,Xs.length>0&&!Gg())G7();else if(Gg()){const e=Xs;Xs=[];for(const t of e)t.resolve(null)}}}}function VB(n){return Gg()||Xs.length>=UB?Promise.resolve(null):new Promise(e=>{Xs.push({req:n,resolve:e}),G7()})}const WB=new Set(["content","thinking","tool_call","tool_result"]),KB=/api ?key|unauthorized|401|no such file|not found|eacces|permission denied|file (?:does not exist|not exist)|missing (?:api key|file|dependency)|command not found|is not a function|ENOENT/i;function YB(n){return KB.test(n)?"blocked":"failed"}const ZB=6;function XB(n,e){const t=n[n.length-1];if(!t)return!1;const a=ll(t.name),s=/bash|shell|run|exec|terminal/i.test(e);return a&&s||!a&&s&&ll(e)}class QB{constructor(){V(this,"sessions",new Map)}session(e){let t=this.sessions.get(e);return t||(t={messageId:null,batch:null,lastBlockIndex:Number.NEGATIVE_INFINITY,seq:0},this.sessions.set(e,t)),t}currentMessageId(e){const t=this.session(e);if(t.messageId)return t.messageId;const a=Ue.getState().messagesBySession[e]||[],s=a[a.length-1];return(s==null?void 0:s.id)??null}resetSession(e){this.sessions.delete(e),Zn.getState().resetSession(e)}onWsEvent(e,t,a,s){if(!(s&&WB.has(t)))switch(t){case"start":this.onStart(e);break;case"thinking":this.onThinking(e,a);break;case"content":this.onContent(e);break;case"tool_call":this.onToolCall(e,a);break;case"tool_result":this.onToolResult(e,a);break;case"turn_summary":this.onTurnSummary(e,a);break;case"ask_user_question":case"hook_ask":this.onWaitingUser(e);break;case"generation_paused":Zn.getState().markStatus(e,["running","waiting_user"],"paused");break;case"generation_resumed":Zn.getState().markStatus(e,["paused"],"running");break;case"error":this.finalizeAll(e,"failed"),w3();break;case"complete":this.finalizeAll(e,"completed"),w3();break}}onStart(e){const t=this.session(e),a=Ue.getState().messagesBySession[e]||[],s=a[a.length-1];t.messageId=(s==null?void 0:s.id)??null,t.batch=null,t.seq=0,t.lastBlockIndex=Number.NEGATIVE_INFINITY}onThinking(e,t){const a=this.session(e);if(!a.batch||a.batch.toolCallIds.length===0){this.advanceBlockIndex(a,t);return}const s=this.parseIndex(t);typeof s=="number"&&s>a.lastBlockIndex&&this.sealBatch(a.batch),this.advanceBlockIndex(a,t)}onContent(e){const t=this.session(e);t.batch&&this.sealBatch(t.batch)}onToolCall(e,t){const a=this.session(e),s=this.parseObj(t);if(!s)return;const o=typeof s.id=="string"?s.id:void 0,l=typeof s.index=="number"?s.index:void 0,u=typeof s.name=="string"?s.name:"Unknown",d=s.args??s.arguments??"",h=this.currentMessageId(e)??`session:${e}`;let m=a.batch;if(!m||m.messageId!==h||m.sealed){m&&!m.sealed&&m.toolCallIds.length>0&&this.finalizeBatch(e,m,m.hadError?this.errorStatus(m):"completed"),a.seq+=1;const N=`${h}:act:${a.seq}`,E=Hg([{name:u,args:d}]),B=Ug([{name:u,args:d}]),L=Date.now(),j=l??(a.lastBlockIndex===Number.NEGATIVE_INFINITY?0:a.lastBlockIndex+1);m={sessionId:e,messageId:h,activityId:N,kind:E,phase:B,tools:[],toolCallIds:[],toolIndexByKey:new Map,pending:new Set,hadError:!1,blockRange:[j,j],startedAt:L,sealed:!1},a.batch=m,Zn.getState().applyEvent(e,{type:"activity_started",activity:{id:N,sessionId:e,messageId:h,kind:E,phase:B,status:"running",title:Fg(E),titleSource:"rule",toolCallIds:[],blockRange:m.blockRange,startedAt:L}})}if(!m.sealed&&m.toolCallIds.length>=ZB&&XB(m.tools,u)){this.finalizeBatch(e,m,m.hadError?"failed":"completed"),a.batch=null,this.onToolCall(e,t);return}const p=l!==void 0?`idx:${l}`:o??null;if(p!==null&&m.toolIndexByKey.has(p)){const N=m.toolIndexByKey.get(p),E=m.tools[N];let B=!1;E&&(E.name==="Unknown"&&u!=="Unknown"&&(E.name=u,B=!0),!E.args&&d&&(E.args=d,B=!0));const L=m.toolCallIds[N];o&&L&&L.startsWith("tc-")&&(m.toolCallIds[N]=o,m.pending.delete(L),m.pending.add(o),B=!0),B&&Zn.getState().applyEvent(e,{type:"activity_updated",activityId:m.activityId,patch:{toolCallIds:[...m.toolCallIds]}});return}const b={name:u,args:d};m.tools.push(b),p!==null&&m.toolIndexByKey.set(p,m.tools.length-1);const x=o??`tc-${m.toolCallIds.length}-${m.activityId}`;m.toolCallIds.push(x),m.pending.add(x),l!==void 0&&(m.blockRange=[Math.min(m.blockRange[0],l),Math.max(m.blockRange[1],l)],a.lastBlockIndex=Math.max(a.lastBlockIndex,l));const w=Hg(m.tools),_=Ug(m.tools),T=Zn.getState();if(T.applyEvent(e,{type:"activity_updated",activityId:m.activityId,patch:{kind:w,phase:_,toolCallIds:[...m.toolCallIds],...w!==m.kind?{title:Fg(w)}:{}}}),m.kind=w,m.phase=_,ll(u)){const N=$g(d);N&&T.applyEvent(e,{type:"artifact_produced",artifact:{id:`${m.activityId}:${N}`,path:N,action:"modified",activityId:m.activityId}})}}onToolResult(e,t){const a=this.session(e);if(!a.batch)return;const s=this.parseObj(t);if(!s)return;const o=a.batch,l=typeof s.id=="string"?s.id:void 0,u=typeof s.index=="number"?s.index:void 0;if(!(l!==void 0&&o.toolCallIds.includes(l)||l===void 0&&u!==void 0&&u>=o.blockRange[0]&&u<=o.blockRange[1]))return;if(l!==void 0)o.pending.delete(l);else{const p=[...o.pending][0];p&&o.pending.delete(p)}const h=s.result;typeof h=="string"&&h.startsWith("Error:")&&(o.hadError=!0,o.lastError=String(h).slice(0,200)),o.sealed&&o.pending.size===0&&this.finalizeBatch(e,o,o.hadError?"failed":"completed")}onTurnSummary(e,t){const a=this.parseObj(t);if(!a)return;const s=typeof a.headline=="string"?a.headline:void 0;if(!s)return;const o=this.currentMessageId(e);o&&Zn.getState().applyEvent(e,{type:"task_title_set",messageId:o,title:s})}onWaitingUser(e){const t=Zn.getState(),a=t.bySession[e];if(a)for(let s=a.order.length-1;s>=0;s--){const o=a.order[s];if(!o)continue;const l=a.activities[o];if(l&&l.status==="running"){t.applyEvent(e,{type:"activity_updated",activityId:l.id,patch:{status:"waiting_user"}});return}}}finalizeAll(e,t){const a=this.session(e);a.batch&&(this.finalizeBatch(e,a.batch,a.batch.hadError?this.errorStatus(a.batch):t),a.batch=null),Zn.getState().finalizeSession(e,t)}errorStatus(e){return e.lastError?YB(e.lastError):"failed"}sealBatch(e){!e||e.sealed||(e.sealed=!0,this.finalizeBatch(e.sessionId,e,e.hadError?this.errorStatus(e):"completed"))}finalizeBatch(e,t,a){if(!t)return;const s=Zn.getState(),o=t.kind,l=t.tools,u=F7(o,l);if(s.applyEvent(e,{type:"activity_finalized",activityId:t.activityId,status:a,endedAt:Date.now()}),s.applyEvent(e,{type:"activity_updated",activityId:t.activityId,patch:{title:u,titleSource:"inferred",...(a==="failed"||a==="blocked")&&t.lastError?{blockedReason:t.lastError}:{}}}),a==="completed"&&l.length>=2){const d=l.map(h=>$g(h.args)).filter(h=>typeof h=="string");VB({kind:o,files:d,toolCount:l.length}).then(h=>{h&&Zn.getState().applyEvent(e,{type:"activity_updated",activityId:t.activityId,patch:{title:h,titleSource:"llm"}})})}}parseObj(e){if(e&&typeof e=="object"&&!Array.isArray(e))return e;if(typeof e=="string")try{const t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}return null}parseIndex(e){const t=this.parseObj(e),a=t==null?void 0:t.index;return typeof a=="number"?a:void 0}advanceBlockIndex(e,t){const a=this.parseIndex(t);typeof a=="number"&&(e.lastBlockIndex=Math.max(e.lastBlockIndex,a))}}const JB=new QB;function eI(n,e){const t=[];for(const l of e.thinkingBlocks??[])t.push({index:l.index,kind:"thinking"});for(const l of e.toolCalls??[])t.push({index:l.index??Number.MAX_SAFE_INTEGER,kind:"tool",tc:l});t.sort((l,u)=>l.index-u.index);const a=[];let s=[];for(const l of t)l.kind==="thinking"?s.length>0&&(a.push(s),s=[]):l.tc&&s.push(l.tc);if(s.length>0&&a.push(s),a.length===0)return[];const o=e.timestamp??Date.now();return a.map((l,u)=>{const d=Hg(l),h=l.map(_=>_.index??Number.MAX_SAFE_INTEGER),m=Math.min(...h),p=Math.max(...h),b=l.some(_=>_.status==="error"),x=Math.min(...l.map(_=>_.timestamp),o),w=Math.max(...l.map(_=>_.timestamp+(_.duration??0)*1e3),o);return{id:`${e.id}:act:${u+1}`,sessionId:n,messageId:e.id,kind:d,phase:Ug(l),status:b?"failed":"completed",title:F7(d,l),titleSource:"inferred",toolCallIds:l.map(_=>_.id),blockRange:m===Number.MAX_SAFE_INTEGER?[u,u]:[m,p===Number.MAX_SAFE_INTEGER?m:p],startedAt:x,endedAt:w}})}let S3=0;const Sp=mn(n=>({compactedBySession:{},ttftBySession:{},addCompacted:(e,t)=>n(a=>{const s=a.compactedBySession[e]??[];return s.some(o=>o.seq===t.seq)?a:{compactedBySession:{...a.compactedBySession,[e]:[...s,t].sort((o,l)=>o.timestamp-l.timestamp)}}}),recordTtft:(e,t,a)=>n(s=>{const o=s.ttftBySession[e]??{};return o[t]!==void 0?s:{ttftBySession:{...s.ttftBySession,[e]:{...o,[t]:a}}}}),resetSession:e=>n(t=>{if(t.compactedBySession[e]===void 0&&t.ttftBySession[e]===void 0)return t;const a={...t.compactedBySession},s={...t.ttftBySession};return delete a[e],delete s[e],{compactedBySession:a,ttftBySession:s}})}));function ej(){return S3+=1,S3}class tj{constructor(){V(this,"sessions",new Map)}session(e){let t=this.sessions.get(e);return t||(t={messageId:null,ttftRecorded:!1},this.sessions.set(e,t)),t}currentMessageId(e){const t=this.session(e);if(t.messageId)return t.messageId;const a=Ue.getState().messagesBySession[e]||[],s=a[a.length-1];return(s==null?void 0:s.id)??null}resetSession(e){this.sessions.delete(e),Sp.getState().resetSession(e)}onWsEvent(e,t,a,s){if(!s)switch(t){case"start":this.onStart(e);break;case"content":case"thinking":this.onFirstToken(e);break;case"context_compressed":this.onCompacted(e,a);break;case"complete":case"error":this.onEnd(e);break}}onStart(e){const t=this.session(e),a=Ue.getState().messagesBySession[e]||[],s=a[a.length-1];t.messageId=(s==null?void 0:s.id)??null,t.ttftRecorded=!1}onFirstToken(e){const t=this.session(e);if(t.ttftRecorded)return;const a=t.messageId??this.currentMessageId(e);a&&(t.ttftRecorded=!0,Sp.getState().recordTtft(e,a,Date.now()))}onCompacted(e,t){let a=null;if(t&&typeof t=="object"&&!Array.isArray(t))a=t;else if(typeof t=="string")try{const s=JSON.parse(t);s&&typeof s=="object"&&!Array.isArray(s)&&(a=s)}catch{a=null}a&&Sp.getState().addCompacted(e,{seq:ej(),timestamp:Date.now(),...typeof a.originalCount=="number"?{originalCount:a.originalCount}:{},...typeof a.compressedCount=="number"?{compressedCount:a.compressedCount}:{},...typeof a.tokensSaved=="number"?{tokensSaved:a.tokensSaved}:{}})}onEnd(e){const t=this.session(e);t.messageId=null,t.ttftRecorded=!1}}const nj=new tj;function aj(n){const e=n.toLowerCase();let t="unknown";return e.includes("401")||e.includes("unauthorized")||e.includes("invalid api key")||/api ?key.*invalid/.test(e)?t="auth":e.includes("429")||e.includes("rate limit")||e.includes("quota")||e.includes("insufficient_quota")?t="rate_limit":e.includes("timeout")||e.includes("timed out")||e.includes("timedout")?t="timeout":e.includes("network")||e.includes("econnrefused")||e.includes("fetch failed")||e.includes("socket")||e.includes("websocket")?t="network":e.includes("tool")||e.includes("bash")||e.includes("command failed")?t="tool":(e.includes("model")||e.includes("api")||e.includes("provider")||e.includes("response"))&&(t="model"),{id:`error-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,category:t,summary:rj(n,t),detail:n,retryable:t!=="auth",timestamp:Date.now()}}function rj(n,e){const t={auth:"API Key 无效或已失效(401 Unauthorized)",rate_limit:"请求频率超限或配额不足(429)",timeout:"请求超时",network:"网络连接异常",tool:"工具执行失败",model:"模型调用失败",unknown:"发生未知错误"},a=(n.split(`
@@ -473,7 +473,7 @@ Multiple supported (first is used at runtime, rest are fallbacks)`,modelIdLabel:
473
473
  ---
474
474
  ${d}
475
475
 
476
- `),Ze.info(d,5e3),rt.getState().setCompacting({originalCount:u.originalCount||0,compressedCount:u.compressedCount||0,tokensSaved:u.tokensSaved||0}),rt.getState().setCompactionProgress(null)}catch(u){console.error("Failed to parse context_compressed:",u)}break;case"error":{s.endGeneration(t);const u=typeof e=="string"?e:String(e||"Error occurred"),d=aj(u),h=s.messagesBySession[t]||[],m=h[h.length-1];m&&m.type==="assistant"&&!m.errorCard?s.attachErrorCard(t,d):s.addMessage(t,{id:yr(),type:"assistant",content:"",timestamp:Date.now(),errorCard:d}),Ke.getState().touchSession(t);break}case"context_analysis":try{const u=JSON.parse(e||"{}");u&&u.total!==void 0&&rt.getState().setContextDistribution(u)}catch(u){console.error("Failed to parse context_analysis:",u)}break;case"threshold_warning":try{const u=JSON.parse(e||"{}");rt.getState().setThresholdWarning(u);const d=u.percentLeft!==void 0?u.percentLeft:0;d<=5?console.warn(`Context nearly full (${d}% remaining)`):d<=15&&console.info(`Context running low (${d}% remaining)`)}catch(u){console.error("Failed to parse threshold_warning:",u)}break;case"blocking_limit":try{const u=JSON.parse(e||"{}");rt.getState().setThresholdWarning(u),console.error(u.message||"Context blocked")}catch(u){console.error("Failed to parse blocking_limit:",u)}break;case"context_blocked":try{const u=JSON.parse(e||"{}");rt.getState().setThresholdWarning(u),console.error(u.message||"Context is full — generation blocked")}catch(u){console.error("Failed to parse context_blocked:",u)}break;case"tool_retry":try{const u=JSON.parse(e||"{}");rt.getState().setRetryState({active:u.attempt<(u.maxRetries||3),attempt:u.attempt||0,maxRetries:u.maxRetries||3,errorCategory:u.errorCategory||"unknown",toolName:u.toolName})}catch(u){console.error("Failed to parse tool_retry:",u)}break;case"model_fallback":try{const u=JSON.parse(e||"{}");console.warn(`Model fallback: ${u.fromModel||"?"} → ${u.toModel||"?"}`)}catch(u){console.error("Failed to parse model_fallback:",u)}break;case"tombstone":try{const d=JSON.parse(e||"{}").messageIds||[];d.length>0&&s.applyTombstone(t,d)}catch(u){console.warn("Failed to parse tombstone",String(u))}break;case"stall_detected":try{const u=JSON.parse(e||"{}"),d=u.attempt||0,h=u.maxRetries||3,m=u.reason||"no response from model";u.recovering?Ze.warning(`⚠ Generation stalled (${m}) — retrying ${d}/${h}`,8e3):Ze.error(`⚠ Generation stalled (${m}) — giving up`,1e4)}catch(u){console.warn("Failed to parse stall_detected",String(u))}break}JB.onWsEvent(t,n,e,a),nj.onWsEvent(t,n,e,a)}}const O1=mn()((n,e)=>({backendCommands:[],loaded:!1,setBackendCommands:t=>{n({backendCommands:t,loaded:!0})},getAllCommands:()=>e().backendCommands}));async function ij(n="",e){try{let t=`${n}/api/commands`;e&&(t+=`?lang=${encodeURIComponent(e)}`);const a=await fetch(t);if(!a.ok)return[];const s=await a.json(),o=Array.isArray(s==null?void 0:s.data)?s.data:[];return O1.getState().setBackendCommands(o),o}catch{return[]}}function kp(n,e,t,a,s){var o,l,u;switch(n){case"token_update":try{const h=typeof e=="string"?JSON.parse(e):e||{};if(h.source==="workflow"){rt.getState().addWorkflowTokens(Number(h.workflowNodeTokens)||0);break}h.totalTokens>0&&rt.getState().updateUsage({promptTokens:h.promptTokens||0,completionTokens:h.completionTokens||0,totalTokens:h.totalTokens||0});const m=h.promptCacheHitTokens??h.prompt_cache_hit_tokens,p=h.promptCacheMissTokens??h.prompt_cache_miss_tokens;(m!==void 0||p!==void 0)&&rt.getState().accumulateCacheStats(Number(m)||0,Number(p)||0),h.model&&rt.getState().setModel(h.model)}catch{}break;case"context_breakdown":try{const h=typeof e=="string"?JSON.parse(e):e||{};rt.getState().setContextBreakdown({systemPromptTokens:Number(h.systemPromptTokens)||0,messagesTokens:Number(h.messagesTokens)||0,toolContentTokens:Number(h.toolContentTokens)||0,toolDefTokens:Number(h.toolDefTokens)||0,mcpToolTokens:Number(h.mcpToolTokens)||0,skillTokens:Number(h.skillTokens)||0,dynamicTokens:Number(h.dynamicTokens)||0,total:Number(h.total)||0})}catch{}break;case"model_name":try{const h=s&&typeof s.model=="string"&&s.model||(typeof e=="string"?e:(e==null?void 0:e.model)||"");h&&rt.getState().setModel(h);const m=s&&typeof s.modelRef=="string"&&s.modelRef||(typeof e=="object"&&e!==null&&typeof e.modelRef=="string"?e.modelRef:"");m&&rt.getState().setModelRef(m);const p=s&&typeof s.source=="string"&&s.source||(typeof e=="object"&&e!==null&&typeof e.source=="string"?e.source:"");p&&rt.getState().setModelSource(p)}catch{}break;case"auth_required":let d=localStorage.getItem("auth_token");d||(d="default-token",localStorage.setItem("auth_token",d)),Oe.setToken(d),Oe.setAuthenticated(!1),Oe.send({type:"auth",token:d});break;case"auth_success":Oe.setAuthenticated(!0),Oe.send({type:"subscribe_logs"});{const h=qi.getState();ij("",(o=h.language)!=null&&o.startsWith("zh")?"zh":"en");const m=h.workspaceDir;m&&Oe.send({type:"workspace",message:m})}break;case"auth_failed":vr.error("Auth failed",String(e));break;case"log":try{const h=typeof e=="string"?JSON.parse(e):e,m={id:`log-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,level:h.level||"info",source:h.source||"System",message:h.message||"",timestamp:h.timestamp||Date.now()};a.setLogs(p=>[...p,m].slice(-500)),a.activeTab!=="logs"&&a.setUnreadLogs(p=>p+1)}catch(h){console.warn("Failed to parse log entry",String(h))}break;case"commands_list":try{const h=JSON.parse(e||"[]");O1.getState().setBackendCommands(Array.isArray(h)?h:[])}catch(h){console.warn("Failed to parse commands list",String(h))}break;case"command_error":try{const h=typeof e=="string"?JSON.parse(e):e||{};Ze.error((h.error||"Command failed").toString(),6e3)}catch{}break;case"notification":{try{const h=typeof e=="string"?JSON.parse(e):e||{},m=h.result&&typeof h.result=="object"?h.result:{},p=String(h.message||m.message||"").trim();if(!p)break;if(h.kind==="command"){const b=Ke.getState().activeSessionId;b&&Ue.getState().addMessage(b,{id:`cmd-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"assistant",content:`⚙️ ${String(h.command||"")} → ${p}`,timestamp:Date.now()})}else Ze.info(p,5e3)}catch{}break}case"ping":Oe.send({type:"pong",data:Date.now().toString()});break;case"workspace_changed":try{const h=JSON.parse(e||"{}");h.newDir&&qi.getState().setWorkspaceDir(h.newDir)}catch{}break;case"degradation_update":try{const h=typeof e=="string"?JSON.parse(e):e||{},m=h.active,p=h.mode||"normal",b=Number(h.retryCount)||0,x=Number(h.maxRetries)||0,w=h.message||"",T={normal:"normal",retrying:"retrying",alternative:"alternative model",degraded:"degraded",verifying:"verifying",verified_fail:"verify failed"}[p]||p;if(rt.getState().setDegradation({active:m,retryCount:b,maxRetries:x,mode:p,message:w,label:T}),m){const N=b>0?` (${b}/${x})`:"";Ze.warning(w||`API Degraded: ${T}${N}`,8e3),a.setLogs(E=>[...E,{id:`deg-${Date.now()}`,level:"warn",source:"Infrastructure",message:`Degradation: ${T} | ${w||"no details"}`,timestamp:Date.now()}].slice(-500))}else Ze.success("API Normal")}catch(h){console.warn("Degradation update parse error",String(h))}break;case"doctor_result":try{const h=typeof e=="string"?JSON.parse(e):e||{},m=h.overallStatus||h.status||"unknown",p=h.healthRate,b=h.issues||[],w={healthy:"healthy",degraded:"degraded",unhealthy:"unhealthy",unknown:"unknown"}[m]||m,_=typeof p=="number"?` (${Math.round(p*100)}%)`:"";if(m==="healthy")Ze.success(`Doctor: ${w}${_}`);else if(Ze.warning(`Doctor: ${w}${_}`,1e4),b&&b.length>0)for(const T of b)a.setLogs(N=>[...N,{id:`doctor-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,level:"warn",source:"Doctor",message:typeof T=="string"?T:T.message||JSON.stringify(T),timestamp:Date.now()}].slice(-500))}catch(h){console.warn("Doctor result parse error",String(h))}break;case"session_created":{try{const h=typeof e=="string"?JSON.parse(e):e||{};h.id&&(Oe.setSessionId(h.id),Ke.getState().updateSession(h.id,h))}catch{}typeof e=="string"&&e&&vr.info(`Session event: ${n}`);break}case"session_resumed":{try{const h=typeof e=="string"?JSON.parse(e):e||{};if((l=h.session)!=null&&l.id&&(Oe.setSessionId(h.session.id),Ke.getState().updateSession(h.session.id,h.session)),h.messages&&Array.isArray(h.messages)){const m=((u=h.session)==null?void 0:u.id)||t;Ue.getState().replaceMessages(m,h.messages.map(x=>({id:x.id||`msg-${x.timestamp||Date.now()}`,type:x.type==="user"?"user":"assistant",content:x.content||"",timestamp:x.timestamp||Date.now(),thinking:x.thinking||void 0})));const p=h.messages.find(x=>x.type==="user"&&!x.deleted),b=typeof(p==null?void 0:p.content)=="string"?p.content.replace(/\s+/g," ").trim():"";Ke.getState().touchSession(m,b||void 0)}}catch(h){console.warn("Failed to process session_resumed",String(h))}typeof e=="string"&&e&&vr.info(`Session event: ${n}`);break}case"mcp_update":try{const h=typeof e=="string"?JSON.parse(e):e||{},m=h.server||h.name||"MCP",p=h.action||h.status||"updated";vr.info(`MCP ${m}: ${p}`)}catch{}break}}function tI(n,e){switch(a9(n,e)){case"critical":return{level:"CRITICAL",reasonKey:"risk_critical"};case"high":return{level:"HIGH",reasonKey:/rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs/i.test(e)?"risk_critical_cmd":/write|edit|save|upload|deploy|publish/i.test(n)?"risk_high_file":/install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf/i.test(n)?"risk_high_pkg":"risk_high_shell"};case"low":return{level:"LOW",reasonKey:"risk_low"};default:return{level:"MEDIUM",reasonKey:/git|commit|push|merge|rebase/i.test(n)?"risk_git":"risk_network"}}}const nI={CRITICAL:{bg:"bg-red-900/20",border:"border-red-500/40",text:"text-red-400",badge:"bg-red-500/20 text-red-400 border-red-500/30",icon:"🚨"},HIGH:{bg:"bg-orange-900/15",border:"border-orange-500/30",text:"text-orange-400",badge:"bg-orange-500/20 text-orange-400 border-orange-500/30",icon:"⚠️"},MEDIUM:{bg:"bg-yellow-900/10",border:"border-yellow-500/25",text:"text-yellow-400",badge:"bg-yellow-500/15 text-yellow-400 border-yellow-500/25",icon:"📋"},LOW:{bg:"bg-blue-900/10",border:"border-blue-500/25",text:"text-blue-400",badge:"bg-blue-500/15 text-blue-400 border-blue-500/25",icon:"✅"}};function aI(n,e){return r9(n,e)}function oj(n){try{const e=JSON.parse(n),t=e.payload&&typeof e.payload=="object"?e.payload:e,a=t.resolvedPath;if(typeof a=="string"&&a)return a;const s=t.requestedPath;return typeof s=="string"&&s?s:null}catch{return null}}function lj(n,e){try{const t=typeof n=="string"?JSON.parse(n):n||{},a=ns.getState(),{approvalId:s,toolName:o,askPayload:l,timeoutMs:u,timeoutAction:d}=t,h=oj(String(l||""));if(a.isSessionAllowed(o,h??void 0)){Oe.send({type:"hook_allow",data:JSON.stringify({approvalId:s})});return}if(a.autoMode&&o!=="exit_plan_mode"){Oe.send({type:"hook_allow",data:JSON.stringify({approvalId:s})});return}Ue.getState().addMessage(e,{id:`hook-approval-${s||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:{approvalId:s||"",toolName:o||"unknown",askPayload:l||"",status:"pending",timestamp:Date.now(),timeoutMs:typeof u=="number"?u:void 0,timeoutAction:d==="allow"||d==="deny"?d:void 0}}),a.addApproval({approvalId:s||"",toolName:o||"unknown",askPayload:l||"",timestamp:Date.now(),timeoutMs:typeof u=="number"?u:void 0,timeoutAction:d==="allow"||d==="deny"?d:void 0}),window.dispatchEvent(new CustomEvent("hook-approval-required"))}catch{}}function _p(n,e){try{const t=typeof n=="string"?JSON.parse(n):n||{};typeof t.sessionId=="string"&&t.sessionId&&(e=t.sessionId);const a=Ke.getState(),s=wt.getState(),{action:o,taskId:l,data:u}=t;if(o==="created"&&u){const d={id:l||`task-${Date.now()}`,title:u.title||"",completed:u.status==="COMPLETED",createdAt:Date.parse(u.createdAt)||Date.now(),backendId:l,backendStatus:u.status,description:u.description},h=a.tasksBySession[e]||[];a.setSessionTasks(e,[...h,d]),s.upsertTask(e,{id:d.id,title:d.title,description:d.description,status:Sr(u.status),source:"task",progress:u.progress!=null?Number(u.progress):void 0,raw:t})}else if((o==="updated"||o==="status_changed")&&u)a.updateTaskPlanStatus(e,l,{backendStatus:u.status,progress:u.progress}),s.upsertTask(e,{id:l,title:u.title||l,description:u.description,status:Sr(u.status),source:"task",progress:u.progress!=null?Number(u.progress):void 0,raw:t});else if(o==="deleted"){const d=a.tasksBySession[e]||[];a.setSessionTasks(e,d.filter(h=>h.id!==l&&h.backendId!==l))}else if(t&&!o&&(t.id||t.taskId)){const d=String(t.id||t.taskId),h=t,m=String(h.status||"").toUpperCase()==="COMPLETED",p={id:d,title:String(h.title||h.name||d),completed:m,createdAt:Date.parse(h.createdAt)||Date.now(),backendId:d,backendStatus:h.status,description:h.description,progress:h.progress!=null?Number(h.progress):void 0},b=a.getSessionTasks(e);b.some(x=>x.id===d||x.backendId===d)?a.updateTaskPlanStatus(e,d,{backendStatus:h.status,progress:p.progress,completed:m}):a.setSessionTasks(e,[...b,p]),s.upsertTask(e,{id:d,title:p.title,description:p.description,status:Sr(h.status),source:"task",progress:p.progress,raw:t})}s.recordEvent(e,{type:"task_update",source:"task",title:(u==null?void 0:u.title)||t&&(t.title||t.id||t.taskId)||l||"Task update",message:o||"updated",status:(u==null?void 0:u.status)||(t==null?void 0:t.status),taskId:l||(t==null?void 0:t.id)||(t==null?void 0:t.taskId),data:t})}catch{}}function cj(n,e,t,a){try{const s=JSON.parse(e||"{}"),o=a(t,n,s);if(o){const l=Ue.getState();switch(n){case"step_start":l.updateStep(t,o.id,{title:s.step||o.title,description:s.description||o.description,status:s.status==="start"?"running":s.status||"running"});break;case"step_thinking":l.updateStep(t,o.id,{thought:s.thought});break;case"step_action":l.updateStep(t,o.id,{action:s.action});break;case"step_complete":l.updateStep(t,o.id,{status:s.status??"success",result:s.result});break}}}catch(s){console.warn("Failed to parse "+n,String(s))}}function uj(n,e){var t,a;try{const s=typeof n=="string"?JSON.parse(n):n||{};let o=[];if(Array.isArray(s)?o=s:(t=s.tasks)!=null&&t.length?o=s.tasks:(a=s.items)!=null&&a.length&&(o=s.items),o.length>0&&e){const l=Ke.getState(),u=wt.getState();o.forEach(d=>{const h=d.content||d.title||d.name||"";if(h.trim()){if(!l.getSessionTasks(e).find(w=>w.title===h.trim())&&(l.addSessionTask(e,h.trim()),d.completed||d.status==="completed"||d.status==="COMPLETED"||d.status==="done"||d.activeForm==="completed")){const T=l.getSessionTasks(e).find(N=>N.title===h.trim());T&&l.toggleSessionTask(e,T.id)}const b=String(d.id||d.taskId||h.trim()),x=d.completed||d.status==="completed"||d.status==="COMPLETED"||d.status==="done"||d.activeForm==="completed";u.upsertTask(e,{id:b,title:h.trim(),description:d.description,status:Sr(d.status,x),source:"todo",raw:d})}}),u.recordEvent(e,{type:"todo_update",source:"todo",title:"Todo list updated",message:`${o.length} items`,status:"updated",data:s})}}catch{}}function dj(n,e){try{const t=typeof n=="string"?JSON.parse(n):n||{},a=t.questionId||"",s=t.question||"";if(!a||!s)return;const o=Array.isArray(t.questions)?t.questions.map(d=>({question:String(d.question||""),header:d.header?String(d.header):void 0,options:Array.isArray(d.options)?d.options:void 0,multiSelect:d.multiSelect===!0})).filter(d=>d.question):[{question:s,header:t.header||void 0,options:Array.isArray(t.options)?t.options:void 0,multiSelect:t.multiSelect===!0}],l=window;l.__answeredQuestionIds=l.__answeredQuestionIds||new Set,l.__pendingQuestions=l.__pendingQuestions||{};const u={questionId:a,question:s,header:t.header||void 0,options:Array.isArray(t.options)?t.options:void 0,multiSelect:t.multiSelect===!0,autoResolutionMs:typeof t.autoResolutionMs=="number"?t.autoResolutionMs:void 0,questions:o,sessionId:e};l.__pendingQuestions[e]=u,l.__pendingQuestion=u,window.dispatchEvent(new CustomEvent("ask-question-required",{detail:e}))}catch{}}function fj(n,e){try{const t=typeof n=="string"?JSON.parse(n):n||{},a=t.title||t.name||"";if(a&&e){const o=Ke.getState().getSessionTasks(e).find(l=>l.title===a&&!l.completed);o&&Ke.getState().toggleSessionTask(e,o.id),wt.getState().upsertTask(e,{id:(o==null?void 0:o.id)||a,title:a,status:"completed",source:"todo"}),wt.getState().recordEvent(e,{type:"todo_item_done",source:"todo",title:a,status:"completed",taskId:(o==null?void 0:o.id)||a,data:t})}}catch{}}function k3(n){if(!n)return null;try{return JSON.parse(n)}catch{return null}}const _3=mn((n,e)=>({automations:[],runsByAutomation:{},loading:!1,error:null,fetchAutomations:async()=>{const t=await ht.automations.list();t.success&&t.data?n({automations:t.data}):n({error:t.error||"加载自动化失败"})},createAutomation:async t=>{const a=await ht.automations.create(t);return a.success&&a.data?(await e().fetchAutomations(),a.data):(n({error:a.error||"创建自动化失败"}),null)},deleteAutomation:async t=>{const a=await ht.automations.remove(t);return a.success?(await e().fetchAutomations(),!0):(n({error:a.error||"删除失败"}),!1)},toggleAutomation:async(t,a)=>{const s=await ht.automations.toggle(t,a);s.success?await e().fetchAutomations():n({error:s.error||"切换失败"})},runAutomation:async t=>{const a=await ht.automations.run(t);a.success?(await e().fetchRuns(t),await e().fetchAutomations()):n({error:a.error||"触发失败"})},fetchRuns:async t=>{const a=await ht.automations.runs(t);a.success&&a.data&&n(s=>({runsByAutomation:{...s.runsByAutomation,[t]:a.data}}))},onAutomationUpdate:t=>{n(a=>({automations:a.automations.some(o=>o.id===t.id)?a.automations.map(o=>o.id===t.id?t:o):[...a.automations,t]}))},onAutomationRun:t=>{n(a=>({runsByAutomation:{...a.runsByAutomation,[t.automationId]:[t,...a.runsByAutomation[t.automationId]||[]].slice(0,50)}}))}})),C3={automationUpdate:n=>{const e=k3(n);e!=null&&e.automation&&_3.getState().onAutomationUpdate(e.automation)},automationRun:n=>{const e=k3(n);e!=null&&e.run&&_3.getState().onAutomationRun(e.run)}};function hj(n,e,t){let a={};if(e&&typeof e=="object")a=e;else try{a=JSON.parse(String(e||"{}"))}catch{}const s=String(a.jobId||`fjob-${Date.now()}`),o=a.stage||(n==="filejob_result"?"complete":n==="filejob_error"?"error":"uploaded"),l={jobId:s,stage:o,parseProgress:a.parseProgress,parsedFiles:a.parsedFiles,mapping:a.mapping,renderProgress:a.renderProgress,currentRow:a.currentRow,totalRows:a.totalRows,result:a.result,error:a.error,errorDetail:a.errorDetail};a.attachments&&(l.attachments=a.attachments),Ue.getState().setMessageFileJob(t,l)}const mj=mn((n,e)=>({channels:[],availableTypes:[],typesLoaded:!1,loading:!1,error:null,formOpen:!1,editing:null,qrOpen:!1,qrChannel:null,selectedType:null,loadTypes:async()=>{const t=await ht.channels.types(),a=t.success&&Array.isArray(t.data)?t.data:[];n({availableTypes:a,typesLoaded:!0})},load:async()=>{n({loading:!0,error:null});const t=await ht.channels.list(),a=t.success&&Array.isArray(t.data)?t.data:[];if(n({loading:!1,channels:a,...t.success&&!Array.isArray(t.data)?{error:"服务端返回的频道数据格式异常"}:t.success?{}:{error:t.error??"Failed to load"}}),!e().selectedType&&a.length>0){const o=a[0].type;n({selectedType:o})}},create:async t=>{const a=await ht.channels.create(t);return a.success?(await e().load(),n({formOpen:!1,editing:null}),!0):(n({error:a.error??"Create failed"}),!1)},update:async(t,a)=>{const s=await ht.channels.update(t,a);return s.success?(await e().load(),n({formOpen:!1,editing:null}),!0):(n({error:s.error??"Update failed"}),!1)},remove:async t=>{const a=await ht.channels.delete(t);return a.success?(n(s=>({channels:s.channels.filter(o=>o.id!==t)})),!0):(n({error:a.error??"Delete failed"}),!1)},toggle:async(t,a)=>(await ht.channels.toggle(t,a)).success?(n(o=>({channels:o.channels.map(l=>l.id===t?{...l,enabled:a}:l)})),!0):(await e().load(),!1),openForm:t=>n({formOpen:!0,editing:t??null,error:null}),closeForm:()=>n({formOpen:!1,editing:null,error:null}),openQr:t=>n({qrOpen:!0,qrChannel:t??null}),closeQr:()=>{n({qrOpen:!1,qrChannel:null}),e().load()},clearError:()=>n({error:null}),selectType:t=>n({selectedType:t,error:null}),updateChannelStatus:t=>{n(a=>({channels:a.channels.map(s=>s.id===t.channelId?{...s,connected:t.connected,_state:t.state}:s)}))}})),pj=["start","content","thinking","tool_call","tool_result","tool_diff","cache_stats","turn_summary","web_search","cache_stats","complete","generation_paused","generation_resumed","error","context_compressed","compaction_progress","context_analysis","threshold_warning","blocking_limit","context_blocked","stall_detected"],qg=(n,e=[])=>{if(!n)return e;if(Array.isArray(n))return n.forEach(s=>qg(s,e)),e;if(typeof n!="object")return e;const t=n,a=t.content;return typeof a=="string"&&a.trim()&&e.push(a.trim()),Object.entries(t).forEach(([s,o])=>{s!=="content"&&s!=="structuredOutput"&&qg(o,e)}),e},gj=n=>{const e=qg(n);return e[e.length-1]||""};function yj({activeTab:n,setLogs:e,setUnreadLogs:t}){const a=Ue,s=O.useCallback(m=>{if(!m)return{};if(typeof m=="object")return m;if(typeof m!="string")return{};try{return JSON.parse(m)}catch{return{}}},[]),o=O.useCallback((m,p,b,x)=>{const w=s(p),_=wt.getState(),T=Ue.getState();if(m==="workflow_plan_ready"&&w.planId){_.setPlan(b,{planId:String(w.planId),title:typeof w.title=="string"&&w.title?String(w.title):"工作流计划",reason:typeof w.reason=="string"?String(w.reason):void 0,confirm:w.confirm===!0,nodes:Array.isArray(w.nodes)?w.nodes:void 0,createdAt:Date.now()});return}if(m==="workflow_confirm_ack"){_.clearPlan(b);return}const N=w.runId||x||"";if(!N)return;if(m==="workflow_error"){_.fail(b,N,w.error||"Workflow failed"),(T.isGenerating(b)||T.isPaused(b))&&T.endGeneration(b,w.error||"Workflow failed");return}const E=m==="workflow_finished"?w.status||"COMPLETED":m==="workflow_started"?w.status||"RUNNING":m==="workflow_paused"?w.status||"PAUSED":m==="workflow_resumed"?w.status||"RESUMING":m==="workflow_cancelled"?w.status||"CANCELLED":w.status||void 0,B=w.type||m,L=w.data&&typeof w.data=="object"?w.data:{},j=String(w.kind||L.kind||""),F=w.nodeId||w.node_id||L.nodeId||L.node_id,Y=w.role||w.agentRole||w.agent_role||L.role||L.agentRole||L.agent_role,ee=w.phase||w.phaseId||L.phase||L.phaseId,te=w.effectId||L.effectId||F,xe=w.toolName||w.tool_name||L.toolName||L.tool_name,De=w.error||L.error,ce=["effect.scheduled","effect.completed","effect.failed"].includes(B)&&F&&j!=="tool",ie=["effect.scheduled","effect.completed","effect.failed"].includes(B)&&j==="tool"&&(xe||F),pe=F?_.getAgentsForSession(b).find(we=>we.id===String(F)):void 0;if(_.upsert(b,{runId:N,status:E,title:typeof w.title=="string"&&w.title?String(w.title):void 0,completedPhases:Number(w.completedPhases||0),totalPhases:Number(w.totalPhases||0),completedEffects:Number(w.completedEffects||0),totalEffects:Number(w.totalEffects||0),tokensUsed:Number(w.tokensUsed||0),tokensRemaining:Number(w.tokensRemaining||0),lastEventType:B,agentNode:ce?{nodeId:String(F),role:String(Y||(pe==null?void 0:pe.role)||(pe==null?void 0:pe.name)||"agent"),phase:ee?String(ee):pe==null?void 0:pe.phase,status:B==="effect.failed"?"failed":B==="effect.completed"?"completed":"scheduled",tokens:w.tokensUsed!=null?Number(w.tokensUsed):L.tokens!=null&&typeof L.tokens=="number"?Number(L.tokens):void 0,error:De?String(De):void 0,updatedAt:Date.now()}:void 0}),ie){const we=B==="effect.failed"?"failed":B==="effect.completed"?"completed":"running",q=String(te||`${N}-${xe||F}`);_.upsertTask(b,{id:q,title:String(xe||F),description:F?String(F):void 0,status:we,source:"workflow",runId:N,result:L.artifactRef?String(L.artifactRef):void 0,error:De?String(De):void 0,raw:w}),_.recordEvent(b,{type:B,source:"workflow",title:String(xe||F),status:we,runId:N,taskId:q,message:De?String(De):void 0,data:w})}if((m==="workflow_started"||m==="workflow_handoff")&&Array.isArray(w.nodes)?_.setNodes(b,N,w.nodes):m==="workflow_node_start"&&F?_.setNodeStatus(b,N,String(F),{status:"running"}):m==="workflow_node_complete"&&F&&_.setNodeStatus(b,N,String(F),{status:String(L.status||w.status||"completed"),result:(L.result??w.result)!=null?String(L.result??w.result):void 0,error:De?String(De):void 0}),m==="workflow_started")_.clearPlan(b),T.startGeneration(b);else if(m==="workflow_finished"){_.finalizeNodes(b,N,String(E||"COMPLETED"));const we=gj(w.output);if(we){const q=T.getMessages(b),oe=q[q.length-1];(oe==null?void 0:oe.type)==="assistant"?T.appendToLastMessage(b,we):T.addMessage(b,{id:yr(),type:"assistant",content:we,timestamp:Date.now()})}T.endGeneration(b)}else E==="PAUSED"?T.pauseGeneration(b):(E==="RUNNING"||E==="RESUMING")&&T.resumeGeneration(b)},[s]),l=O.useCallback((m,p)=>{const b=s(m),x=Array.isArray(b.runs)?b.runs:[];if(x.length===0)return;const w=x.slice().sort((E,B)=>String(B.updatedAt||"").localeCompare(String(E.updatedAt||"")))[0],_=String(w.status||"").toUpperCase();if(!_)return;const T=wt.getState(),N=String(w.runId||"");T.upsert(p,{runId:N,status:_,title:w.workflowId?`workflow: ${String(w.workflowId)}`:void 0,totalPhases:Number(w.totalNodes||0),completedPhases:Number(w.completedNodes||0),lastEventType:"workflow_status",error:w.error?String(w.error):void 0}),["COMPLETED","FAILED","ERROR","CANCELLED","CANCELED","PAUSED"].includes(_)&&T.recordEvent(p,{type:"workflow_status",source:"workflow",title:`Workflow ${_}`,message:w.output?String(w.output).slice(0,200):w.error?String(w.error):void 0,status:_==="COMPLETED"?"completed":"failed",runId:N,data:w})},[s]),u=O.useCallback(m=>{var w;const b=a.getState().messagesBySession[m]||[],x=b[b.length-1];return(w=x==null?void 0:x.steps)==null?void 0:w[x.steps.length-1]},[a]),d=O.useCallback((m,p,b)=>{const x=u(m),w=p==="step_complete",_=x&&(x.status==="success"||x.status==="error");if(!x||_&&!w){const T=(b==null?void 0:b.step)||p.replace("step_","").replace("_"," ");return a.getState().addStep(m,{id:`step-${Date.now()}`,title:T,description:(b==null?void 0:b.description)||"Executing...",status:"running",timestamp:Date.now()}),u(m)}return x},[u,a]),h=O.useCallback(m=>{var w,_;const p=m.type,b=m.data;if(p==="model_name"){kp(p,b,m.sessionId||"",{activeTab:n,setLogs:e,setUnreadLogs:t},m);return}if(p==="models_updated"||p==="models.updated"){window.dispatchEvent(new CustomEvent("models-updated"));return}if(p==="workspace_changed"){kp(p,b,m.sessionId||"",{activeTab:n,setLogs:e,setUnreadLogs:t});return}if(p==="question_answer_ack"){const T=s(b),N=T==null?void 0:T.questionId;if(N){const E=window;E.__answeredQuestionIds=E.__answeredQuestionIds||new Set,E.__answeredQuestionIds.add(N);const B=E.__pendingQuestions||{};for(const L of Object.keys(B))((w=B[L])==null?void 0:w.questionId)===N&&delete B[L];((_=E.__pendingQuestion)==null?void 0:_.questionId)===N&&(E.__pendingQuestion=null)}window.dispatchEvent(new CustomEvent("ask-question-dismiss",{detail:T==null?void 0:T.questionId}));return}const x=m.sessionId||"";if(!x){if(p==="task_update"||p==="task_finished"||p==="task_error"){const T=s(b);T&&typeof T.sessionId=="string"&&T.sessionId&&_p(b,T.sessionId)}return}if(p==="hook_ask"){lj(b,x);return}if(p==="ask_user_question"){dj(b,x);return}if(p==="task_update"){_p(b,x);return}if(p==="task_output"){try{a.getState().appendToLastMessage(x,String(b||""))}catch{}return}if(p==="task_finished"||p==="task_error"){p==="task_error"?vr.error("Task error",String(b)):_p(b,x);return}if(p==="filejob_start"||p==="filejob_progress"||p==="filejob_result"||p==="filejob_error"){hj(p,b,x);return}if(p.startsWith("step_")){cj(p,b,x,d);return}if(p.startsWith("plan_")){try{y3(p,b,x)}catch(T){vr.error(`Failed to handle ${p}`,String(T))}return}if(p.startsWith("goal_")){try{y3(p,b,x)}catch(T){vr.error(`Failed to handle ${p}`,String(T))}return}if(p==="todo_update"){uj(b,x);return}if(p==="todo_item_done"){fj(b,x);return}if(p!=="todo_progress"){if(p==="automation.update"){C3.automationUpdate(b);return}if(p==="automation.run"){C3.automationRun(b);return}if(p!=="tool.approval_required"){if(["workflow_started","workflow_event","workflow_progress","workflow_finished","workflow_error","workflow_checkpoint","workflow_node_start","workflow_node_complete","workflow_paused","workflow_resumed","workflow_cancelled","workflow_handoff","workflow_plan_ready","workflow_confirm_ack","workflow_recovered"].includes(p)){o(p,b,x,m.runId);return}if(p==="workflow_status"){l(b,x);return}if(pj.includes(p)){sj(p,b,x,m.nodeId);return}if(p==="channel_status"){try{const T=JSON.parse(b||"{}");mj.getState().updateChannelStatus(T)}catch{}return}if(p==="channel_message"||p==="channel_error"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.channel||T.platform||"Channel";if(p==="channel_error")Ze.error(`${N}: ${T.error||T.message||"channel error"}`);else{const E=T.from||T.sender||"",B=T.text||T.content||T.message||"";B&&Ze.info(`📨 ${N}${E?` · ${E}`:""}: ${String(B).slice(0,120)}`)}}catch{}return}if(p==="session_switched"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.id||T.sessionId||(typeof b=="string"?b:"");N&&Ke.getState().setActiveSession(String(N))}catch{}return}if(p==="task_interrupted"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.title||T.taskId||"Task";Ze.warning(`⏸ ${N} interrupted — 使用 /continue 恢复生成`,1e4)}catch{Ze.warning("A running task was interrupted",1e4)}return}if(p==="code_review_ready"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.title||T.skillId||"Code Review",E=T.summary||"";Ze.success(`🔍 ${N} ready${E?`: ${String(E).slice(0,120)}`:""}`,8e3)}catch{Ze.success("🔍 Code review ready",8e3)}return}if(p==="hook_auto_ack"){try{const T=typeof b=="string"?JSON.parse(b):b||{};Ze.info(`Hook auto-approved: ${T.tool||T.name||"tool"}`,4e3)}catch{}return}if(p==="throttle"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.limit||T.remaining!=null?` (${T.remaining} left)`:"";Ze.warning(`⚠ Rate limited${N}`,6e3)}catch{}return}if(["token_update","context_breakdown","auth_required","auth_success","auth_failed","log","commands_list","ping","degradation_update","doctor_result","session_created","session_resumed","mcp_update","hook_response_ack","notification"].includes(p)){kp(p,b,x,{activeTab:n,setLogs:e,setUnreadLogs:t});return}}}},[n,d,o,l,s,e,t]);O.useEffect(()=>{Oe.connect();const m=Oe.onMessage(h),p=Oe.onClose(()=>{const x=Ue.getState();for(const w of x.generatingSessions)x.endGeneration(w,"WebSocket disconnected")}),b=Oe.onOpen(()=>{var w;const x=((w=Oe.getSessionId)==null?void 0:w.call(Oe))||Ke.getState().activeSessionId;if(x){Oe.send({type:"get_workflow_status",sessionId:x,data:JSON.stringify({sessionId:x})});const _=Zo.getState().mode;Oe.send({type:"plan_mode_change",sessionId:x,data:JSON.stringify({mode:_})})}});return()=>{m(),p(),b()}},[h])}const Pc={linear:{id:"linear",nameKey:"settings.themePresetLinear",descriptionKey:"settings.themePresetLinearDesc",dark:{bg:"#0a0a0c",surface:"#121215",border:"#26262b",text:"#e4e4e7",muted:"#8e8e96",accentBlue:"#7c83f8",accentGreen:"#4ade80",accentRed:"#f87171",accentYellow:"#fbbf24",accentPurple:"#c084fc"},light:{bg:"#ffffff",surface:"#f6f6f7",border:"#e4e4e8",text:"#18181b",muted:"#71717a",accentBlue:"#5e6ad2",accentGreen:"#16a34a",accentRed:"#dc2626",accentYellow:"#b45309",accentPurple:"#7c3aed"}},mimo:{id:"mimo",nameKey:"settings.themePresetMimo",descriptionKey:"settings.themePresetMimoDesc",dark:{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"},light:{bg:"#ffffff",surface:"#f8f4ef",border:"#e2d8cd",text:"#24221c",muted:"#605b52",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"}},github:{id:"github",nameKey:"settings.themePresetGithub",descriptionKey:"settings.themePresetGithubDesc",dark:{bg:"#0d1117",surface:"#161b22",border:"#30363d",text:"#c9d1d9",muted:"#8b949e",accentBlue:"#58a6ff",accentGreen:"#238636",accentRed:"#f85149",accentYellow:"#d29922",accentPurple:"#a855f7"},light:{bg:"#ffffff",surface:"#f6f8fa",border:"#d0d7de",text:"#24292f",muted:"#57606a",accentBlue:"#0969da",accentGreen:"#1a7f37",accentRed:"#cf222e",accentYellow:"#9a6700",accentPurple:"#8250df"}},cherry:{id:"cherry",nameKey:"settings.themePresetCherry",descriptionKey:"settings.themePresetCherryDesc",dark:{bg:"#0f1419",surface:"#1a2332",border:"#2d3f50",text:"#e1e8ed",muted:"#8899aa",accentBlue:"#01a9ff",accentGreen:"#00c853",accentRed:"#ff5252",accentYellow:"#ffab00",accentPurple:"#7c4dff"},light:{bg:"#f5f9ff",surface:"#ffffff",border:"#cce0ff",text:"#1a2332",muted:"#5c6f87",accentBlue:"#0160ff",accentGreen:"#00a844",accentRed:"#e53935",accentYellow:"#f9a825",accentPurple:"#651fff"}},ocean:{id:"ocean",nameKey:"settings.themePresetOcean",descriptionKey:"settings.themePresetOceanDesc",dark:{bg:"#0b1e2e",surface:"#122b3d",border:"#1e4057",text:"#d4e6f5",muted:"#7a9bb5",accentBlue:"#00bcd4",accentGreen:"#26a69a",accentRed:"#ef5350",accentYellow:"#ffca28",accentPurple:"#ab47bc"},light:{bg:"#edf7fc",surface:"#ffffff",border:"#b3d9e8",text:"#0b1e2e",muted:"#4f7a94",accentBlue:"#00838f",accentGreen:"#00897b",accentRed:"#d32f2f",accentYellow:"#f57f17",accentPurple:"#8e24aa"}},mint:{id:"mint",nameKey:"settings.themePresetMint",descriptionKey:"settings.themePresetMintDesc",dark:{bg:"#0d1f1c",surface:"#162d28",border:"#264b41",text:"#d1f0e8",muted:"#7dafa3",accentBlue:"#26c6da",accentGreen:"#66bb6a",accentRed:"#ef5350",accentYellow:"#ffd54f",accentPurple:"#ad8aff"},light:{bg:"#edf7f4",surface:"#ffffff",border:"#b8d9cf",text:"#0d1f1c",muted:"#4a7f72",accentBlue:"#0097a7",accentGreen:"#388e3c",accentRed:"#d32f2f",accentYellow:"#f9a825",accentPurple:"#7c4dff"}},lavender:{id:"lavender",nameKey:"settings.themePresetLavender",descriptionKey:"settings.themePresetLavenderDesc",dark:{bg:"#1a1428",surface:"#261f38",border:"#3c3354",text:"#e2daf2",muted:"#9387b5",accentBlue:"#86bef5",accentGreen:"#81c784",accentRed:"#ef9a9a",accentYellow:"#ffe082",accentPurple:"#ce93d8"},light:{bg:"#f5f0ff",surface:"#ffffff",border:"#d4c8e8",text:"#1a1428",muted:"#6c5b8a",accentBlue:"#1565c0",accentGreen:"#2e7d32",accentRed:"#c62828",accentYellow:"#f57f17",accentPurple:"#7b1fa2"}},midnight:{id:"midnight",nameKey:"settings.themePresetMidnight",descriptionKey:"settings.themePresetMidnightDesc",dark:{bg:"#0a0e1a",surface:"#111726",border:"#1e2740",text:"#c8d2e8",muted:"#6a7596",accentBlue:"#4fc3f7",accentGreen:"#4caf50",accentRed:"#e57373",accentYellow:"#ffd54f",accentPurple:"#b39ddb"},light:{bg:"#eef1f7",surface:"#ffffff",border:"#c0c9dc",text:"#0a0e1a",muted:"#4f5a78",accentBlue:"#0288d1",accentGreen:"#2e7d32",accentRed:"#d32f2f",accentYellow:"#f57f17",accentPurple:"#5e35b1"}},sunset:{id:"sunset",nameKey:"settings.themePresetSunset",descriptionKey:"settings.themePresetSunsetDesc",dark:{bg:"#1e1410",surface:"#2a1d16",border:"#443124",text:"#f0dfcf",muted:"#b8957a",accentBlue:"#5fa5e8",accentGreen:"#81c784",accentRed:"#ff7043",accentYellow:"#ffb74d",accentPurple:"#e0a0e0"},light:{bg:"#fff6f0",surface:"#ffffff",border:"#f0d5c0",text:"#2a1d16",muted:"#8a6e5a",accentBlue:"#1976d2",accentGreen:"#388e3c",accentRed:"#e64a19",accentYellow:"#ef6c00",accentPurple:"#8e24aa"}},forest:{id:"forest",nameKey:"settings.themePresetForest",descriptionKey:"settings.themePresetForestDesc",dark:{bg:"#0e1a12",surface:"#172a1d",border:"#2a4733",text:"#d1e8d6",muted:"#7da684",accentBlue:"#5bb8e8",accentGreen:"#66bb6a",accentRed:"#ef9a9a",accentYellow:"#e6c35c",accentPurple:"#ae8ad9"},light:{bg:"#f0f7f0",surface:"#ffffff",border:"#b8d9be",text:"#0e1a12",muted:"#477a50",accentBlue:"#1565c0",accentGreen:"#2e7d32",accentRed:"#c62828",accentYellow:"#827717",accentPurple:"#6a1b9a"}},candy:{id:"candy",nameKey:"settings.themePresetCandy",descriptionKey:"settings.themePresetCandyDesc",dark:{bg:"#16101a",surface:"#22182a",border:"#3d284a",text:"#f0def5",muted:"#b28dc2",accentBlue:"#5fc3f5",accentGreen:"#81e080",accentRed:"#ff6b6b",accentYellow:"#ffd93d",accentPurple:"#e066ff"},light:{bg:"#faf0ff",surface:"#ffffff",border:"#e0cce8",text:"#1a0a24",muted:"#7a5c8a",accentBlue:"#1976d2",accentGreen:"#388e3c",accentRed:"#d32f2f",accentYellow:"#f9a825",accentPurple:"#8e24aa"}},nord:{id:"nord",nameKey:"settings.themePresetNord",descriptionKey:"settings.themePresetNordDesc",dark:{bg:"#2e3440",surface:"#3b4252",border:"#4c566a",text:"#eceff4",muted:"#81a1c1",accentBlue:"#88c0d0",accentGreen:"#a3be8c",accentRed:"#bf616a",accentYellow:"#ebcb8b",accentPurple:"#b48ead"},light:{bg:"#f5f7fa",surface:"#ffffff",border:"#d8dee9",text:"#2e3440",muted:"#5e6d85",accentBlue:"#5e81ac",accentGreen:"#6f9e6f",accentRed:"#bf616a",accentYellow:"#b48d56",accentPurple:"#8f6f9e"}}},Vg="linear";function T3(n,e,t){const a=Pc[n]||Pc[Vg];if(!a)return{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"};const s={...e==="dark"?a.dark:a.light};return t&&Object.assign(s,t),s}const dr=n=>{const e=parseInt(n.slice(1,3),16),t=parseInt(n.slice(3,5),16),a=parseInt(n.slice(5,7),16);return`${e} ${t} ${a}`},vj=(n,e,t)=>{const a=[parseInt(n.slice(1,3),16),parseInt(n.slice(3,5),16),parseInt(n.slice(5,7),16)],s=[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)];return a.map((o,l)=>Math.round(o+((s[l]??o)-o)*t)).join(" ")};function A3(n,e,t,a,s){t.classList.toggle("dark",n==="dark"),t.classList.toggle("light",n==="light"),t.style.setProperty("--color-bg",dr(e.bg)),t.style.setProperty("--color-surface",dr(e.surface)),t.style.setProperty("--color-border",dr(e.border)),t.style.setProperty("--color-text",dr(e.text)),t.style.setProperty("--color-muted",dr(e.muted)),t.style.setProperty("--color-accent-blue",dr(e.accentBlue)),t.style.setProperty("--color-accent-green",dr(e.accentGreen)),t.style.setProperty("--color-accent-red",dr(e.accentRed)),t.style.setProperty("--color-accent-yellow",dr(e.accentYellow)),t.style.setProperty("--color-accent-purple",dr(e.accentPurple)),t.style.setProperty("--color-hover",vj(e.surface,e.text,.06)),a&&a.setAttribute("content",e.bg),s&&s.setAttribute("content",n)}function bj({theme:n,themePresetId:e,customTheme:t,customThemeEnabled:a}){O.useEffect(()=>{const s=document.documentElement,o=document.querySelector('meta[name="theme-color"]'),l=document.querySelector('meta[name="color-scheme"]'),u=n==="dark"?"dark":n==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",d=a?t:void 0,h=T3(e||Vg,u,d);if(A3(u,h,s,o,l),n==="auto"){const m=window.matchMedia("(prefers-color-scheme: dark)"),p=()=>{const b=m.matches?"dark":"light",x=T3(e||Vg,b,d);A3(b,x,s,o,l)};return m.addEventListener("change",p),()=>m.removeEventListener("change",p)}},[n,e,t,a])}function xj({message:n,onRetry:e}){const{t}=vt();return y.jsx("div",{className:"flex items-center justify-center h-full w-full bg-dark-bg",children:y.jsxs("div",{className:"max-w-md p-8 text-center",children:[y.jsx("div",{className:"flex justify-center mb-4",children:y.jsx("div",{className:"w-16 h-16 rounded-full bg-accent-red/10 flex items-center justify-center",children:y.jsx(Qg,{size:32,className:"text-accent-red"})})}),y.jsx("h2",{className:"text-xl font-semibold text-dark-text mb-2",children:t("error.pageError")}),y.jsx("p",{className:"text-sm text-dark-muted mb-6",children:n||t("error.unknownError")}),y.jsxs("div",{className:"flex items-center justify-center gap-3",children:[y.jsxs("button",{onClick:e,className:"flex items-center gap-2 px-4 py-2 bg-accent-blue text-white rounded-lg hover:opacity-90 transition-opacity",children:[y.jsx(j0,{size:16}),t("common.retry")]}),y.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-dark-hover text-dark-text rounded-lg hover:bg-dark-border transition-colors",children:t("error.refreshPage")})]})]})})}class E3 extends O.Component{constructor(t){super(t);V(this,"handleRetry",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,a){console.error("[ErrorBoundary] Caught error:",t,a)}render(){var t;return this.state.hasError?this.props.fallback?this.props.fallback:y.jsx(xj,{message:(t=this.state.error)==null?void 0:t.message,onRetry:this.handleRetry}):this.props.children}}const wj=10;function Sj(n,e=wj){return n.filter(t=>t&&!!t.id&&(t.messageCount??0)>0).sort((t,a)=>String(a.updatedAt||"").localeCompare(String(t.updatedAt||""))).slice(0,e).map(t=>{const a=new Date(t.createdAt).getTime()||Date.now(),s=new Date(t.updatedAt).getTime()||a;return{id:t.id,title:t.title||t.id,createdAt:a,lastActiveAt:s,messageCount:t.messageCount??0,...t.preview?{preview:t.preview}:{}}})}function N3(n,e){const t=(e==null?void 0:e.wan)??"万",a=(e==null?void 0:e.yi)??"亿";if(n>=1e8)return`${(n/1e8).toFixed(1)}${a}`;if(n>=1e4){const s=n/1e4;return`${s>=100?s.toFixed(0):s.toFixed(1)}${t}`}return String(Math.round(n))}function kj(n){return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}const _j=O.memo(function({open:e,onClose:t}){const{t:a}=vt(),s=rt(L=>L.currentUsage),o=rt(L=>L.maxContextTokens),l=rt(L=>L.contextBreakdown),u=rt(L=>L.cacheStats),d=rt(L=>L.estimateTokens),h=Ue(L=>L.messagesBySession),m=Ke(L=>L.activeSessionId),p=m?h[m]||[]:[];O.useEffect(()=>{if(!e)return;const L=j=>{j.key==="Escape"&&t()};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[e,t]);const b=O.useMemo(()=>{if(l)return null;let L=0,j=0;for(const F of p){let Y=F.content||"",ee="";if(F.thinking&&(Y+=" "+F.thinking),F.steps)for(const te of F.steps)te.thought&&(Y+=" "+te.thought),te.action&&(ee+=" "+te.action),te.result&&(ee+=" "+te.result);if(F.toolCalls)for(const te of F.toolCalls)ee+=" "+(typeof te.args=="string"?te.args:JSON.stringify(te.args));L+=d(Y),j+=d(ee)}return{messagesTokens:L,toolTokens:j,total:L+j}},[l,p,d]),w=O.useMemo(()=>{const L=l,j=L?L.messagesTokens:(b==null?void 0:b.messagesTokens)??0,F=L?L.toolContentTokens+L.toolDefTokens:(b==null?void 0:b.toolTokens)??0,Y=L?L.systemPromptTokens:0,ee=L?L.skillTokens:0,te=L?L.mcpToolTokens:0,xe=L?L.dynamicTokens:0,De=L?L.total:(b==null?void 0:b.total)??0,ce=Math.max(0,s.totalTokens-De)+xe,ie=Math.max(s.totalTokens,De,1);return[{key:"system",label:a("chat.ctxSystemPrompt"),tokens:Y,color:"bg-dark-text/70"},{key:"tools",label:a("chat.ctxSystemTools"),tokens:F,color:"bg-accent-purple"},{key:"mcp",label:a("chat.ctxMcpTools"),tokens:te,color:"bg-accent-cyan"},{key:"skills",label:a("chat.ctxSkills"),tokens:ee,color:"bg-accent-yellow"},{key:"messages",label:a("chat.ctxMessages"),tokens:j,color:"bg-accent-blue"},{key:"other",label:a("chat.ctxOther"),tokens:ce,color:"bg-dark-muted/60"}].map(pe=>({...pe,pct:pe.tokens/ie*100}))},[l,b,s.totalTokens,a]).filter(L=>L.pct>=.05||L.tokens>0),_=s.totalTokens,T=o>0?Math.min(100,_/o*100):0,N=T>=90?"bg-accent-red":T>=70?"bg-accent-yellow":"bg-dark-text/70",E=T>=90?"text-accent-red":T>=70?"text-accent-yellow":"text-dark-text",B=u&&u.cacheStatsCalls>0&&u.cacheHitRate!==void 0?u.cacheHitRate:null;return e?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]",onClick:t,"aria-hidden":"true"}),y.jsx("div",{className:"fixed inset-x-0 bottom-9 z-50 mx-auto max-w-lg px-2 pb-2",children:y.jsxs("div",{className:"animate-slide-up rounded-t-xl rounded-b-md border border-dark-border bg-dark-surface/95 backdrop-blur shadow-[0_-12px_40px_-10px_rgba(0,0,0,0.6)] overflow-hidden",children:[y.jsxs("div",{className:"flex items-center justify-between px-4 pt-3 pb-2",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(BS,{size:15,className:E}),y.jsx("span",{className:"text-sm font-semibold text-dark-text",children:a("chat.contextCapacity")})]}),y.jsx("button",{type:"button","aria-label":a("a11y.close"),onClick:t,className:"p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:y.jsx(xr,{size:15})})]}),y.jsxs("div",{className:"px-4 pb-1",children:[y.jsxs("div",{className:"flex items-baseline gap-2",children:[y.jsxs("span",{className:"text-xl font-bold font-mono text-dark-text",children:[N3(_,{wan:a("chat.unitWan"),yi:a("chat.unitYi")}),y.jsxs("span",{className:"text-dark-muted text-sm font-normal",children:[" / ",N3(o,{wan:a("chat.unitWan"),yi:a("chat.unitYi")})]})]}),y.jsxs("span",{className:`text-xs font-mono ${E}`,children:["(",T.toFixed(1),"%)"]})]}),y.jsx("div",{className:"mt-1.5 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:y.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${N}`,style:{width:`${T}%`}})})]}),y.jsxs("div",{className:"flex items-center justify-between px-4 pt-2 pb-1",children:[y.jsx("span",{className:"text-[11px] font-medium text-dark-muted",children:a("chat.categoryBreakdown")}),y.jsx("span",{className:"text-[10px] text-dark-muted/50 select-none",title:a("chat.assemblyOrderHint"),children:a("chat.byAssemblyOrder")})]}),y.jsx("div",{className:"px-4 pb-2 space-y-1.5",children:w.map(L=>y.jsxs("div",{"data-row-key":L.key,className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-[11px] text-dark-muted w-16 shrink-0",children:L.label}),y.jsx("div",{className:"flex-1 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:y.jsx("div",{className:`h-full ${L.color} rounded-full`,style:{width:`${Math.max(.5,L.pct)}%`}})}),y.jsx("span",{className:"text-[11px] font-mono text-dark-text w-12 text-right shrink-0",children:kj(L.pct)})]},L.key))}),y.jsxs("div",{className:"mx-4 mb-3 mt-1 flex items-center justify-between rounded-md bg-dark-bg/70 px-3 py-1.5",children:[y.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-dark-muted",children:[y.jsx(jS,{size:11}),a("chat.avgCacheHitRate")]}),B!==null?y.jsxs("span",{className:`text-[11px] font-mono font-semibold ${B>=.5?"text-accent-green":"text-accent-yellow"}`,children:[(B*100).toFixed(0),"%"]}):y.jsx("span",{className:"text-[11px] font-mono text-dark-muted/60",children:"–"})]})]})})]}):null});function q7(n){const e=n.trim();if(!e)return{model:""};const t=e.indexOf("/"),a=e.indexOf(":"),s=t>=0&&(a<0||t<a)?t:a;if(s>0){const o=e.slice(0,s).trim(),l=e.slice(s+1).trim();if(o&&l)return{provider:o,model:l}}return{model:e}}function rI(n){return q7(n).provider??""}function Cj(n,e){const t=q7(e),a=n||t.model;return t.provider&&a?`${t.provider} · ${a}`:a}function sI(n){const e=new Map;for(const t of n){const a=t.provider||"default",s=e.get(a);s?s.push(t):e.set(a,[t])}return Array.from(e.entries())}const Tj=O.memo(function(e){const{t}=vt(),a=rt(be=>be.currentUsage),s=rt(be=>be.maxContextTokens),o=rt(be=>be.model),l=rt(be=>be.modelRef),u=rt(be=>be.modelSource),d=rt(be=>be.tokenRate),h=rt(be=>be.compactingUntil),m=rt(be=>be.lastCompactInfo),p=rt(be=>be.degradation),b=rt(be=>be.compactionProgress),x=rt(be=>be.cacheStats),w=Ke(be=>be.activeSessionId),_=Ue(be=>w?be.isGenerating(w):!1),T=wt(be=>w?be.bySession[w]:void 0),N=wt(be=>w?be.getRunningAgentCount(w):0),E=Zo(be=>be.mode),B=ns(be=>be.autoMode),[L,j]=O.useState(0),F=O.useRef(0),[Y,ee]=O.useState(!1),[te,xe]=O.useState(null);O.useEffect(()=>{const be=Oe.onReconnectAttempt((Re,lt)=>xe({attempt:Re,max:lt})),Ve=Oe.onReconnectSuccess(()=>xe(null)),We=Oe.onReconnectGiveUp(()=>xe(null)),ze=Oe.onOpen(()=>xe(null));return()=>{be(),Ve(),We(),ze()}},[]),O.useEffect(()=>{if(_&&!F.current&&(F.current=Date.now()),!_){F.current=0,j(0);return}const be=setInterval(()=>j(Math.floor((Date.now()-F.current)/1e3)),1e3);return()=>clearInterval(be)},[_]);const De=a.totalTokens,ce=s>0?Math.min(100,Math.round(a.totalTokens/s*100)):0,ie=t9(d),pe=E==="normal"?"act":E,we=J_[pe],q=Cj(o,l),oe=Ia(pe),ge=oe==="plan"?"brand":oe==="goal"?"purple":"green";return y.jsxs("div",{className:"h-9 border-t border-dark-border bg-dark-bg flex items-center px-3 gap-2 shrink-0 select-none text-xs overflow-hidden",children:[y.jsx("span",{className:"font-semibold text-dark-text whitespace-nowrap",children:"DeepSeekCode"}),y.jsx("span",{className:"status-pill","data-tone":ge,children:we.label}),B&&y.jsx("span",{className:"status-pill","data-tone":"yellow",children:"Auto"}),te&&y.jsxs("span",{className:"status-pill","data-tone":"yellow",title:t("reconnect.hint"),"data-testid":"reconnect-pill",children:[y.jsx(j0,{size:10,className:"animate-spin"}),t("reconnect.reconnecting",{attempt:te.attempt,max:te.max})]}),y.jsx("span",{className:"text-dark-muted truncate max-w-[14rem]",title:q||void 0,children:q||t("common.connecting")}),u==="session"&&y.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-purple/20 text-accent-purple whitespace-nowrap",title:t("chat.sessionModelTitle"),children:t("chat.sessionModel")}),y.jsxs("span",{className:"inline-flex items-center text-[11px] whitespace-nowrap shrink-0",title:x&&x.cacheStatsCalls>0?t("chat.cacheHitTitle",{hit:pc(x.cacheHitTokens),miss:pc(x.cacheMissTokens),calls:x.cacheStatsCalls}):t(_?"chat.cacheWaitingRun":"chat.cacheNoStats"),children:[y.jsx("span",{className:"text-dark-muted",children:"cache"})," ",x&&x.cacheStatsCalls>0?y.jsx("span",{className:x.cacheHitRate!==void 0&&x.cacheHitRate>=.5?"text-accent-green":"text-accent-yellow",children:x.cacheHitRate!==void 0?`${(x.cacheHitRate*100).toFixed(0)}%`:"n/a"}):_?y.jsx("span",{className:"text-dark-muted/60",children:"–"}):y.jsx("span",{className:"text-dark-muted/60",children:"n/a"})]}),y.jsxs("button",{type:"button",onClick:()=>ee(!0),title:t("chat.viewContextDetail"),className:"group inline-flex items-center gap-1.5 shrink-0 -mx-1 px-1 rounded transition-colors cursor-pointer hover:bg-dark-hover/60",children:[y.jsxs("span",{className:"hidden md:inline-flex items-center gap-1 text-dark-muted whitespace-nowrap",children:[y.jsx("span",{className:"text-dark-text",children:pc(De)}),y.jsx("span",{className:"text-dark-muted/60",children:"/"}),y.jsx("span",{children:pc(s)})]}),y.jsxs("span",{className:"inline-flex items-center gap-1",children:[y.jsx("span",{className:"w-16 lg:w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden inline-flex",children:y.jsx("span",{className:`h-full transition-all rounded-full ${ce>=90?"bg-accent-red":ce>=70?"bg-accent-yellow":"bg-dark-text/70"}`,style:{width:`${ce}%`}})}),y.jsxs("span",{className:ce>=90?"text-accent-red font-bold":ce>=70?"text-accent-yellow":"",children:[ce,"%"]})]}),y.jsx(PS,{size:12,className:"text-dark-muted/50 group-hover:text-dark-text transition-colors"})]}),_&&y.jsxs(y.Fragment,{children:[y.jsxs("span",{className:"text-dark-text flex items-center gap-1 whitespace-nowrap",children:[y.jsx(Ga,{size:12,className:"animate-spin"}),gx(L)]}),ie&&y.jsx("span",{className:"text-accent-purple whitespace-nowrap",children:ie})]}),N>0&&y.jsxs("span",{className:"text-dark-text whitespace-nowrap",children:[N," agent",N>1?"s":""]}),y.jsx("div",{className:"flex-1"}),T&&y.jsxs("span",{className:"hidden xl:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[y.jsx("span",{className:"text-dark-muted",children:"wf"}),y.jsx("span",{className:"font-mono",children:T.status}),y.jsxs("span",{children:[T.completedPhases,"/",T.totalPhases||0]}),y.jsx("span",{className:"text-dark-muted",children:pc(T.tokensUsed)})]}),b&&y.jsxs("span",{className:"hidden lg:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[y.jsx("span",{children:"compact"}),y.jsxs("span",{children:[b.percent,"%"]}),y.jsx("span",{className:"w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:y.jsx("span",{className:"h-full bg-dark-text/70 rounded-full block",style:{width:`${b.percent}%`}})})]}),!b&&Date.now()<h&&m&&y.jsxs("span",{className:"hidden lg:inline text-dark-muted text-[11px] whitespace-nowrap",children:[m.originalCount," ","->"," ",m.compressedCount]}),(p==null?void 0:p.active)&&y.jsxs("span",{className:"text-accent-yellow text-[11px] whitespace-nowrap",children:[p.label," ",p.retryCount>0?`${p.retryCount}/${p.maxRetries}`:""]}),y.jsx(_j,{open:Y,onClose:()=>ee(!1)})]})}),Aj=O.memo(function({sessionId:e}){const{t}=vt(),a=Ue(x=>{if(!e)return;const w=x.messagesBySession[e]??[];for(let _=w.length-1;_>=0;_--){const T=w[_];if(T&&T.type==="assistant")return T.id}}),s=Zn(x=>ZD(x,e)),o=Zn(x=>XD(x,e,a)),l=Ue(x=>{if(!e)return;const w=x.messagesBySession[e]??[];for(let _=w.length-1;_>=0;_--){const T=w[_];if(T&&T.type==="user")return T.content}}),u=Ue(x=>e?x.generatingSessions.includes(e):!1),d=wt(x=>e?x.getForSession(e):void 0),h=o||(l?l.replace(/\s+/g," ").trim().slice(0,20):void 0),m=O.useMemo(()=>{const x=d==null?void 0:d.nodes;if(!x)return;const w=x.find(_=>_.status==="pending"||_.status==="scheduled"||_.status==="running");return w==null?void 0:w.title},[d==null?void 0:d.nodes]);if(!e||!h&&!s&&!m&&!u)return null;const p=(s==null?void 0:s.status)==="waiting_user"?"text-accent-yellow":(s==null?void 0:s.status)==="blocked"?"text-accent-red":(s==null?void 0:s.status)==="paused"?"text-dark-300":(s==null?void 0:s.status)==="failed"?"text-accent-red":"text-accent-blue",b=(s==null?void 0:s.status)==="waiting_user"?"bg-accent-yellow":(s==null?void 0:s.status)==="blocked"?"bg-accent-red":(s==null?void 0:s.status)==="paused"?"bg-dark-300":(s==null?void 0:s.status)==="failed"?"bg-accent-red":(s==null?void 0:s.status)==="running"?"bg-accent-blue animate-pulse":"bg-accent-blue";return y.jsxs("div",{className:"h-7 shrink-0 flex items-center gap-2.5 px-3 border-b border-dark-border bg-dark-bg/80 text-[11px] select-none","data-testid":"task-status-bar",children:[h&&y.jsx("span",{className:"min-w-0 truncate font-medium text-dark-text","data-testid":"taskbar-title",children:h}),s&&y.jsxs("span",{title:(s==null?void 0:s.status)==="blocked"?s.blockedReason:void 0,className:`flex min-w-0 items-center gap-1.5 shrink-0 ${p}`,"data-testid":"taskbar-current",children:[y.jsx("span",{className:`inline-block w-1.5 h-1.5 shrink-0 rounded-full ${b}`}),y.jsx("span",{className:"truncate max-w-[18rem]",children:s.title})]}),m&&y.jsxs("span",{className:"shrink-0 min-w-0 truncate text-dark-muted","data-testid":"taskbar-next",children:[t("taskbar.next"),": ",m]}),!s&&u&&y.jsxs("span",{className:"shrink-0 text-dark-muted",children:[t("chat.thinking"),"…"]})]})}),Ja=mn()((n,e)=>({status:null,branches:null,loading:!1,refreshing:!1,lastAction:null,busy:!1,refreshStatus:async()=>{const t=await ht.git.status();return t.success&&t.data?(n({status:t.data}),t.data):(n({status:{available:!1,error:t.error||"Failed to load git status"}}),null)},refreshBranches:async()=>{const t=await ht.git.branches();t.success&&t.data?n({branches:t.data}):n({branches:null})},refreshAll:async()=>{if(!e().refreshing){n({refreshing:!0,loading:e().status===null});try{await e().refreshStatus(),await e().refreshBranches()}finally{n({refreshing:!1,loading:!1})}}},commit:async t=>{n({busy:!0});const a=await ht.git.commit({message:t});return n({busy:!1,lastAction:a.success&&a.data?a.data:{ok:!1,error:a.error||"Commit failed"}}),e().refreshStatus(),e().lastAction},push:async()=>{n({busy:!0});const t=await ht.git.push();return n({busy:!1,lastAction:t.success&&t.data?t.data:{ok:!1,error:t.error||"Push failed"}}),e().refreshStatus(),e().lastAction},checkout:async t=>{n({busy:!0});const a=await ht.git.checkout(t);return n({busy:!1,lastAction:a.success&&a.data?a.data:{ok:!1,error:a.error||"Checkout failed"}}),e().refreshAll(),e().lastAction}})),Cp="dsc-git-commit-draft",Ej=O.memo(function(){const{t:e}=vt(),t=Ja(j=>j.status),a=Ja(j=>j.branches),s=Ja(j=>j.busy),o=Ja(j=>j.lastAction),l=qi(j=>j.workspaceDir),[u,d]=O.useState(!1),[h,m]=O.useState(""),[p,b]=O.useState(!1),[x,w]=O.useState(null),_=O.useRef(null);O.useEffect(()=>{Ja.getState().refreshAll();const j=setInterval(()=>{document.visibilityState==="visible"&&Ja.getState().refreshStatus()},3e4);return()=>clearInterval(j)},[]),O.useEffect(()=>{const j=localStorage.getItem(Cp);j&&m(j)},[]);const T=O.useCallback(async()=>{try{const j=await ht.git.prStatus();j.success&&w(j.data||{available:!1,message:""})}catch{}},[]);O.useEffect(()=>{T()},[T]),O.useEffect(()=>{if(!u)return;const j=F=>{_.current&&!_.current.contains(F.target)&&d(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[u]);const N=O.useCallback(async()=>{const j=h.trim();if(!j){Ze.warning(e("git.emptyCommitMsg"));return}const Y=await Ja.getState().commit(j);Y.ok?(Ze.success(e("git.commitSuccess")),b(!1),localStorage.removeItem(Cp),m("")):Ze.error(Y.error||e("git.commitFailed"))},[h,e]),E=O.useCallback(async()=>{const F=await Ja.getState().push();F.ok?Ze.success(e("git.pushSuccess")):Ze.error(F.error||e("git.pushFailed"))},[e]),B=O.useCallback(async j=>{const Y=await Ja.getState().checkout(j);Y.ok?Ze.success(e("git.checkoutSuccess",{branch:j})):Ze.error(Y.error||e("git.checkoutFailed"))},[e]),L=t&&t.available===!1;return y.jsxs("div",{ref:_,className:"relative",children:[y.jsxs("button",{onClick:()=>d(j=>!j),className:Wt("flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs transition-colors",u?"bg-dark-hover text-dark-text":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"),title:e("git.panelTitle"),"aria-expanded":u,children:[y.jsx(Ab,{size:13,className:Wt(L?"text-dark-muted/50":"text-accent-blue")}),y.jsx("span",{className:"max-w-[120px] truncate font-mono",children:L?e("git.noRepo"):(t==null?void 0:t.branch)||"—"}),(t==null?void 0:t.dirty)&&y.jsxs("span",{className:"hidden sm:flex items-center gap-1 text-[10px] font-mono tabular-nums",children:[y.jsxs("span",{className:"text-accent-green",children:["+",t.totalAdded??0]}),y.jsxs("span",{className:"text-accent-red",children:["−",t.totalRemoved??0]})]}),y.jsx(ti,{size:11,className:Wt("transition-transform",u&&"rotate-180")})]}),u&&y.jsxs("div",{className:"absolute right-0 top-full z-40 mt-1.5 w-[380px] max-w-[90vw] rounded-xl border border-dark-border bg-dark-surface shadow-2xl overflow-hidden",children:[y.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 border-b border-dark-border bg-dark-surface",children:[y.jsx(Ab,{size:14,className:"text-accent-blue"}),y.jsx("span",{className:"text-xs font-medium text-dark-text",children:e("git.panelTitle")}),y.jsx("div",{className:"flex-1"}),y.jsx("button",{onClick:()=>void Ja.getState().refreshAll(),className:"rounded p-1 text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",title:e("git.refresh"),children:y.jsx(j0,{size:12,className:Wt(Ja.getState().refreshing&&"animate-spin")})})]}),L?y.jsxs("div",{className:"px-3.5 py-4 text-center",children:[y.jsx(IS,{size:20,className:"mx-auto mb-2 text-dark-muted/50"}),y.jsx("div",{className:"text-xs text-dark-muted",children:e("git.notGitDesc")}),y.jsx("div",{className:"mt-1 text-[10px] font-mono text-dark-muted/60 break-all",children:l})]}):t?y.jsxs("div",{className:"p-3.5 space-y-3 max-h-[60vh] overflow-y-auto custom-scrollbar",children:[y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[y.jsx("span",{className:"text-[11px] text-dark-muted",children:e("git.changes")}),y.jsxs("span",{className:"text-[11px] font-mono tabular-nums",children:[y.jsxs("span",{className:"text-accent-green",children:["+",t.totalAdded??0]}),y.jsx("span",{className:"text-dark-muted/40",children:" / "}),y.jsxs("span",{className:"text-accent-red",children:["−",t.totalRemoved??0]})]})]}),y.jsxs("div",{className:"space-y-0.5 max-h-40 overflow-y-auto custom-scrollbar",children:[(t.changes||[]).slice(0,30).map(j=>y.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[y.jsx("span",{className:Wt("w-6 shrink-0 rounded px-1 text-center text-[9px]",j.status.includes("?")?"bg-accent-purple/15 text-accent-purple":j.status===j.status.toUpperCase()&&j.status.trim()?"bg-accent-green/15 text-accent-green":"bg-accent-yellow/15 text-accent-yellow"),children:j.status}),y.jsx("span",{className:"flex-1 truncate text-dark-text",children:j.path}),y.jsxs("span",{className:"shrink-0 text-[10px] tabular-nums text-dark-muted/60",children:[j.added>0&&y.jsxs("span",{className:"text-accent-green",children:["+",j.added]}),j.removed>0&&y.jsxs("span",{className:"text-accent-red",children:["−",j.removed]})]})]},j.path)),(t.changes||[]).length===0&&y.jsx("div",{className:"py-2 text-center text-[11px] text-dark-muted/60",children:e("git.clean")})]})]}),y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] text-dark-muted mb-1",children:e("git.branch")}),y.jsx("div",{className:"flex flex-wrap gap-1",children:((a==null?void 0:a.branches)||[t.branch||""]).slice(0,8).map(j=>y.jsx("button",{onClick:()=>j!==t.branch&&B(j),disabled:j===t.branch,className:Wt("rounded-md px-2 py-1 text-[11px] font-mono transition-colors",j===t.branch?"bg-accent-blue/10 text-accent-blue cursor-default":"bg-dark-bg border border-dark-border text-dark-muted hover:border-accent-blue/40 hover:text-dark-text"),children:j},j))}),(t.ahead??0)>0||(t.behind??0)>0?y.jsxs("div",{className:"mt-1 text-[10px] text-dark-muted/70",children:[(t.ahead??0)>0&&y.jsxs("span",{className:"text-accent-green",children:["↑ ",t.ahead," "]}),(t.behind??0)>0&&y.jsxs("span",{className:"text-accent-yellow",children:["↓ ",t.behind]}),e("git.upstream")]}):null]}),y.jsx("div",{children:p?y.jsxs("div",{className:"space-y-1.5",children:[y.jsx("textarea",{value:h,onChange:j=>{m(j.target.value),localStorage.setItem(Cp,j.target.value)},placeholder:e("git.commitPlaceholder"),rows:2,className:"w-full rounded-md border border-dark-border bg-dark-bg px-2.5 py-1.5 text-xs text-dark-text placeholder-dark-muted/50 resize-none focus:outline-none focus:border-accent-blue/50"}),y.jsxs("div",{className:"flex gap-1.5",children:[y.jsxs("button",{onClick:N,disabled:s||!h.trim(),className:"flex flex-1 items-center justify-center gap-1 rounded-md bg-accent-green/15 text-accent-green px-2.5 py-1.5 text-xs hover:bg-accent-green/25 transition-colors disabled:opacity-40",children:[s?y.jsx(Ga,{size:12,className:"animate-spin"}):y.jsx(Eb,{size:12}),e("git.commitConfirm")]}),y.jsx("button",{onClick:()=>b(!1),className:"rounded-md px-2.5 py-1.5 text-xs text-dark-muted hover:bg-dark-hover transition-colors",children:e("common.cancel")})]})]}):y.jsxs("div",{className:"flex gap-1.5",children:[y.jsxs("button",{onClick:()=>b(!0),disabled:s,className:"flex flex-1 items-center justify-center gap-1.5 rounded-md bg-accent-blue/10 text-accent-blue px-2.5 py-1.5 text-xs hover:bg-accent-blue/20 transition-colors disabled:opacity-50",children:[y.jsx(Eb,{size:13}),e("git.commit")]}),y.jsxs("button",{onClick:E,disabled:s||!t.dirty,className:"flex items-center justify-center gap-1.5 rounded-md bg-dark-bg border border-dark-border text-dark-muted px-2.5 py-1.5 text-xs hover:border-accent-green/40 hover:text-accent-green transition-colors disabled:opacity-40",children:[y.jsx(zS,{size:13}),e("git.push")]})]})}),y.jsxs("div",{className:"flex items-center gap-1.5 rounded-md bg-dark-bg border border-dark-border px-2.5 py-2",children:[y.jsx($S,{size:13,className:"text-accent-purple shrink-0"}),y.jsx("span",{className:"text-[11px] text-dark-muted truncate",children:x?x.available?e("git.prReady"):x.message||e("git.prUnavailable"):e("git.prLoading")})]}),y.jsxs("div",{className:"rounded-md bg-dark-bg border border-dark-border px-2.5 py-2 space-y-0.5",children:[y.jsx("div",{className:"text-[10px] text-dark-muted",children:e("git.environment")}),y.jsx("div",{className:"text-[11px] font-mono text-dark-text/80 break-all",children:l||"—"}),t.lastCommit&&y.jsxs("div",{className:"text-[10px] font-mono text-dark-muted/60 truncate",children:[t.lastCommit.hash.slice(0,7)," ",t.lastCommit.subject]})]}),o&&y.jsxs("div",{className:Wt("flex items-center gap-1.5 text-[11px]",o.ok?"text-accent-green":"text-accent-red"),children:[o.ok?y.jsx(I0,{size:12}):y.jsx(P0,{size:12}),y.jsx("span",{className:"truncate",children:o.ok?e("git.ok"):o.error||""})]})]}):y.jsx("div",{className:"px-3.5 py-4 text-center text-xs text-dark-muted",children:e("git.loading")})]})]})});function Nj({onOpenTemplates:n,onSaveAsTemplate:e,saveAsBusy:t}){const{t:a}=vt(),[s,o]=O.useState(!1),l=O.useRef(null);return O.useEffect(()=>{if(!s)return;const u=d=>{l.current&&!l.current.contains(d.target)&&o(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),y.jsxs("div",{ref:l,className:"relative",children:[y.jsx("button",{onClick:()=>o(u=>!u),className:"p-1.5 rounded-lg text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors",title:a("nav.moreOptions"),"aria-label":a("nav.moreOptions"),"aria-expanded":s,children:y.jsx(Lp,{size:16,"aria-hidden":"true"})}),s&&y.jsxs("div",{className:"absolute right-0 top-full z-40 mt-1.5 w-44 rounded-xl border border-dark-border bg-dark-surface shadow-2xl overflow-hidden py-1",children:[y.jsxs("button",{onClick:()=>{o(!1),n()},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors",children:[y.jsx(i0,{size:13,className:"text-dark-muted shrink-0"})," ",a("chat.templateLibrary")]}),y.jsxs("button",{onClick:()=>{o(!1),e()},disabled:t,className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors disabled:opacity-40",children:[t?y.jsx(Ga,{size:13,className:"animate-spin shrink-0"}):y.jsx(HS,{size:13,className:"text-dark-muted shrink-0"}),a("chat.saveAsTemplate")]})]})]})}const Mj={info:Q3,success:H3,warning:Qg,error:Zg},Rj={info:"text-accent-blue",success:"text-accent-green",warning:"text-accent-yellow",error:"text-accent-red"},Oj=O.memo(function(){const{toasts:e,dismissToast:t}=is();return e.length===0?null:y.jsx("div",{className:"fixed bottom-20 right-4 z-[100] flex flex-col gap-2 max-w-sm",children:e.slice(-3).map(a=>{const s=Mj[a.type];return y.jsxs("div",{className:"toast-card animate-fade-in-up",role:"status",children:[y.jsx(s,{size:16,className:`shrink-0 mt-0.5 ${Rj[a.type]}`}),y.jsxs("span",{className:"text-xs flex-1 text-dark-text leading-relaxed",children:[a.message,a.count>1&&y.jsxs("span",{className:"toast-card-count ml-1.5",children:["×",a.count]})]}),y.jsx("button",{onClick:()=>t(a.id),className:"shrink-0 p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":"Dismiss",children:y.jsx(xr,{size:12})})]},a.id)})})}),Dj={critical:{icon:US,text:"text-accent-red"},error:{icon:Zg,text:"text-accent-red"},warning:{icon:Qg,text:"text-accent-yellow"},info:{icon:Q3,text:"text-accent-blue"}},Lj={info:6e3,warning:1e4},Bj=O.memo(function(){const e=Ko(s=>s.errors),t=Ko(s=>s.dismiss),a=e.filter(s=>!s.dismissed);return O.useEffect(()=>{const s=a.filter(o=>!o.action).map(o=>{const l=o.durationMs??Lj[o.level];return l?setTimeout(()=>t(o.id),l):null}).filter(o=>o!==null);return()=>s.forEach(clearTimeout)},[a,t]),a.length===0?null:y.jsx("div",{className:"fixed bottom-4 right-4 z-[110] flex flex-col gap-2 max-w-sm",children:a.map(s=>{const o=Dj[s.level],l=o.icon;return y.jsx(jj,{entry:s,icon:l,config:o,onDismiss:()=>t(s.id)},s.id)})})});function jj({entry:n,icon:e,config:t,onDismiss:a}){const[s,o]=O.useState(!1);return y.jsxs("div",{className:"toast-card animate-fade-in-up",role:"alert",children:[y.jsx(e,{size:16,className:`shrink-0 mt-0.5 ${t.text}`}),y.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[y.jsxs("span",{className:`text-xs leading-relaxed ${t.text}`,children:[n.title,n.count!=null&&n.count>1&&y.jsxs("span",{className:"toast-card-count ml-1.5",children:["×",n.count]})]}),s&&n.detail&&y.jsx("div",{className:"mt-1.5 text-[11px] text-dark-muted whitespace-pre-wrap break-words leading-relaxed border-t border-dark-border/50 pt-1.5",children:n.detail}),n.action&&y.jsx("button",{onClick:n.action.onClick,className:"mt-1.5 self-start text-[11px] px-2 py-0.5 rounded-md bg-dark-hover hover:bg-dark-border transition-colors text-dark-text",children:n.action.label})]}),y.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[n.detail&&y.jsx("button",{onClick:()=>o(!s),className:"p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":s?"Collapse":"Expand",children:s?y.jsx(ti,{size:12}):y.jsx(Z3,{size:12})}),y.jsx("button",{onClick:a,className:"p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":"Dismiss",children:y.jsx(xr,{size:12})})]})]})}function Pj(n){const{t:e}=vt(),{setActiveTab:t,createNewSession:a,clearMessages:s,setTheme:o,setThemePreset:l,toggleTerminal:u,setLogs:d,setUnreadLogs:h}=n,m=O1(ie=>ie.backendCommands),p=Array.isArray(m)?m:[],[b,x]=O.useState(!1),[w,_]=O.useState(""),[T,N]=O.useState(0),E=O.useRef(null),B=O.useCallback((ie,pe)=>{const we=Ke.getState().activeSessionId;return we?(Oe.setSessionId(we),Oe.send({type:"command_execute",sessionId:we,data:JSON.stringify({command:`/${ie}`,args:pe||""})}),{success:!0,message:e("slashCommands.sent_command")+`/${ie}`}):{success:!1,message:e("slashCommands.noActiveSession")}},[e]),L=O.useMemo(()=>[{id:"chat",name:"chat",description:e("slashCommands.chat_desc"),icon:"💬",local:!0,action:()=>(t("chat"),{success:!0,message:e("slashCommands.chat_result")})},{id:"terminal",name:"terminal",description:e("slashCommands.terminal_desc"),icon:"💻",local:!0,action:()=>(t("terminal"),{success:!0,message:e("slashCommands.terminal_result")})},{id:"files",name:"files",description:e("slashCommands.files_desc"),icon:"📁",local:!0,action:()=>(t("files"),{success:!0,message:e("slashCommands.files_result")})},{id:"models",name:"models",description:e("slashCommands.models_desc"),icon:"🧠",local:!0,action:()=>(t("models"),{success:!0,message:e("slashCommands.models_result")})},{id:"tools",name:"tools",description:e("slashCommands.tools_desc"),icon:"🔧",local:!0,action:()=>(t("tools"),{success:!0,message:e("slashCommands.tools_result")})},{id:"skills",name:"skills",description:e("slashCommands.skills_desc"),icon:"🎯",local:!0,action:()=>(t("skills"),{success:!0,message:e("slashCommands.skills_result")})},{id:"settings",name:"settings",description:e("slashCommands.settings_desc"),icon:"⚙️",local:!0,action:()=>(t("settings"),{success:!0,message:e("slashCommands.settings_result")})},{id:"logs",name:"logs",description:e("slashCommands.logs_desc"),icon:"📜",local:!0,action:()=>(t("logs"),h(0),{success:!0,message:e("slashCommands.logs_result")})},{id:"new",name:"new",description:e("slashCommands.new_desc"),icon:"✨",local:!0,action:()=>(a(),{success:!0,message:e("slashCommands.new_result")})},{id:"clear",name:"clear",description:e("slashCommands.clear_desc"),icon:"🗑️",local:!0,action:()=>(s(),{success:!0,message:e("slashCommands.clear_result")})},{id:"theme",name:"theme",description:e("slashCommands.theme_desc"),args:"<dark|light|auto|preset-name>",icon:"🎨",local:!0,action:ie=>{const pe=ie.trim().toLowerCase();if(["dark","light","auto"].includes(pe))return o(pe),{success:!0,message:e("slashCommands.theme_result")+pe};if(Pc[pe])return l?(l(pe),{success:!0,message:e("slashCommands.theme_preset_result")+Pc[pe].nameKey}):{success:!1,message:e("slashCommands.theme_preset_unavailable")};const we=Object.keys(Pc).join("|");return{success:!1,message:e("slashCommands.theme_error",{presets:we})}}},{id:"terminal-toggle",name:"terminal-toggle",description:e("slashCommands.toggle_terminal_desc"),icon:"🔲",local:!0,action:()=>(u(),{success:!0,message:e("slashCommands.toggle_terminal_result")})},{id:"clear-logs",name:"clear-logs",description:e("slashCommands.logs_clear_desc"),icon:"📭",local:!0,action:()=>(d([]),h(0),{success:!0,message:e("slashCommands.logs_clear_result")})},{id:"doctor",name:"doctor",description:e("slashCommands.doctor_desc"),icon:"🩺",local:!1,action:()=>B("doctor")},{id:"compact",name:"compact",description:e("slashCommands.compact_desc"),args:"[aggressive|summary]",icon:"🗜️",local:!1,action:ie=>B("compact",ie)},{id:"help",name:"help",description:e("slashCommands.help_desc"),icon:"❓",local:!1,action:()=>B("help")},{id:"cost",name:"cost",description:e("slashCommands.token_desc"),args:"[detail|reset]",icon:"💰",local:!1,action:ie=>B("cost",ie)},{id:"model",name:"model",description:e("slashCommands.model_desc"),args:"[model-name]",icon:"🤖",local:!1,action:ie=>B("model",ie)},{id:"status",name:"status",description:e("slashCommands.status_desc"),icon:"📊",local:!1,action:()=>B("status")},{id:"config",name:"config",description:e("slashCommands.config_desc"),args:"<get|set|list|delete> [key] [value]",icon:"🔧",local:!1,action:ie=>B("config",ie)},{id:"exit",name:"exit",description:e("slashCommands.exit_desc"),icon:"🚪",local:!1,action:()=>{const ie=Ke.getState().activeSessionId;return ie&&(Oe.setSessionId(ie),Oe.send({type:"exit",sessionId:ie})),{success:!0,message:e("slashCommands.exit_result")}}},{id:"test",name:"test",description:e("slashCommands.benchmark_desc"),args:"[simple|medium|complex|full|list]",icon:"🧪",local:!1,action:ie=>B("test",ie)}],[t,a,s,o,l,u,d,h,B,e]),j=O.useMemo(()=>p.map(ie=>{const pe=e(`slashCommands.${ie.name}_desc`,ie.description||ie.usage||"");return{id:`backend-${ie.name}`,name:ie.name,description:pe,icon:"🔌",local:!1,action:we=>{const q=Ke.getState().activeSessionId;return q?(Oe.setSessionId(q),Oe.send({type:"command_execute",sessionId:q,data:JSON.stringify({command:`/${ie.name}`,args:we||""})}),{success:!0,message:e("slashCommands.sent_command")+`/${ie.name}`}):{success:!1,message:e("slashCommands.noActiveSession")}}}}),[p,e]),F=O.useMemo(()=>{const ie=new Set;return[...L,...j].filter(pe=>ie.has(pe.name)?!1:(ie.add(pe.name),!0))},[L,j]),Y=O.useMemo(()=>{if(!w)return F;const ie=w.toLowerCase();return F.filter(pe=>pe.name.toLowerCase().includes(ie)||pe.description.toLowerCase().includes(ie))},[F,w]),ee=O.useCallback(()=>{x(!0),_(""),N(0)},[]),te=O.useCallback(()=>{x(!1),_(""),N(0)},[]),xe=O.useCallback(()=>{N(ie=>ie>=Y.length-1?0:ie+1)},[Y.length]),De=O.useCallback(()=>{N(ie=>ie<=0?Y.length-1:ie-1)},[Y.length]),ce=O.useCallback((ie,pe)=>{const we=ie.action(pe);return te(),we},[te]);return O.useEffect(()=>{if(b&&E.current){const ie=E.current.querySelector(`[data-index="${T}"]`);ie&&ie.scrollIntoView({block:"nearest"})}},[T,b]),{isOpen:b,filter:w,setFilter:_,selectedIndex:T,setSelectedIndex:N,filteredCommands:Y,allCommands:F,openMenu:ee,closeMenu:te,selectNext:xe,selectPrev:De,executeCommand:ce,containerRef:E,commands:L}}function iI(n){const e=n.trim();if(!e.startsWith("/"))return null;const a=e.slice(1).split(/\s+/),s=a[0]||"",o=a.slice(1).join(" ");return{command:s,args:o}}function Ij({open:n,onClose:e,options:t}){const{t:a}=vt(),{filter:s,setFilter:o,filteredCommands:l,selectedIndex:u,setSelectedIndex:d,selectNext:h,selectPrev:m,executeCommand:p,openMenu:b,closeMenu:x}=Pj(t),w=O.useRef(null),_=O.useRef(null),[T,N]=O.useState(!1);if(O.useEffect(()=>{n?(b(),N(!1),setTimeout(()=>{var L;return(L=w.current)==null?void 0:L.focus()},0)):x()},[n,b,x]),O.useEffect(()=>{if(!n||!_.current)return;const L=_.current.querySelector(`[data-cmd-index="${u}"]`);L&&L.scrollIntoView({block:"nearest"})},[u,n]),!n)return null;const E=L=>{L.local||(N(!0),Ze.info(a("palette.running")));const j=p(L,"");L.local&&(j!=null&&j.message)&&Ze.success(j.message),e()},B=L=>{if(L.key==="ArrowDown")L.preventDefault(),h();else if(L.key==="ArrowUp")L.preventDefault(),m();else if(L.key==="Enter"){L.preventDefault();const j=l[u];j&&E(j)}else L.key==="Escape"&&(L.preventDefault(),e())};return y.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center bg-black/50 backdrop-blur-sm pt-[12vh] px-4 animate-fade-in",onClick:e,role:"dialog","aria-modal":"true","aria-label":a("a11y.commandPalette"),children:y.jsxs("div",{className:"w-full max-w-xl bg-dark-surface border border-dark-border rounded-xl shadow-2xl overflow-hidden",onClick:L=>L.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-dark-border",children:[y.jsx(X3,{size:16,className:"text-dark-muted shrink-0","aria-hidden":"true"}),y.jsx("input",{ref:w,value:s,onChange:L=>{o(L.target.value),d(0)},onKeyDown:B,placeholder:a("palette.placeholder"),"aria-label":a("palette.placeholder"),className:"flex-1 bg-transparent text-sm text-dark-text placeholder-dark-muted outline-none"}),T&&y.jsx("span",{className:"text-[10px] text-accent-blue animate-pulse-soft shrink-0",children:a("palette.running")})]}),y.jsx("div",{ref:_,className:"max-h-[50vh] overflow-y-auto custom-scrollbar py-1",children:l.length===0?y.jsx("div",{className:"px-4 py-8 text-center text-sm text-dark-muted",children:a("palette.empty")}):l.map((L,j)=>y.jsxs("button",{"data-cmd-index":j,onClick:()=>E(L),onMouseEnter:()=>d(j),className:`w-full px-4 py-2.5 flex items-center gap-3 text-left transition-colors ${j===u?"bg-accent-blue/10 border-l-2 border-accent-blue":"border-l-2 border-transparent hover:bg-dark-hover"}`,children:[y.jsx("span",{className:"text-lg shrink-0","aria-hidden":"true",children:L.icon}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("span",{className:"text-sm font-medium text-dark-text",children:["/",L.name]}),L.args&&y.jsx("span",{className:"text-xs text-dark-muted",children:L.args}),!L.local&&y.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-blue/20 text-accent-blue shrink-0",children:a("slashCommands.backend")})]}),y.jsx("div",{className:"text-xs text-dark-muted truncate",children:L.description})]}),j===u&&y.jsx(FS,{size:14,className:"text-dark-muted shrink-0","aria-hidden":"true"})]},L.id))}),y.jsx("div",{className:"px-4 py-2 border-t border-dark-border text-[10px] text-dark-muted bg-dark-bg",children:a("palette.hint")})]})})}function es({keys:n,label:e}){return y.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-dark-border/50 last:border-0",children:[y.jsx("span",{className:"text-sm text-dark-text",children:e}),y.jsx("span",{className:"flex items-center gap-1",children:n.map(t=>y.jsx("kbd",{className:"px-2 py-0.5 text-xs font-mono bg-dark-bg rounded border border-dark-border text-dark-muted",children:t},t))})]})}function zj({open:n,onClose:e}){const{t}=vt(),a=navigator.platform.toLowerCase().includes("mac")?"⌘":"Ctrl";return y.jsx(pf,{isOpen:n,onClose:e,title:t("shortcuts.title"),size:"md",children:y.jsxs("div",{className:"space-y-0.5",children:[y.jsx(es,{keys:[a,"K"],label:t("shortcuts.commandPalette")}),y.jsx(es,{keys:[a,"L"],label:t("shortcuts.clearLogs")}),y.jsx(es,{keys:[a,"/"],label:t("shortcuts.help")}),y.jsx(es,{keys:[a,"Enter"],label:t("shortcuts.submit")}),y.jsx(es,{keys:["Shift","Enter"],label:t("shortcuts.newline")}),y.jsx(es,{keys:["/"],label:t("shortcuts.slashCommand")}),y.jsx(es,{keys:["@"],label:t("shortcuts.fileRef")}),y.jsx(es,{keys:["Esc"],label:t("shortcuts.closeDialog")}),y.jsx(es,{keys:["Esc","Esc"],label:t("shortcuts.stopGen")})]})})}const V7=mn(n=>({isOpen:!1,entries:null,openWhatsNew:e=>n({isOpen:!0,entries:e??null}),closeWhatsNew:()=>n({isOpen:!1})}));function $j(){var u;const{t:n,i18n:e}=vt(),{isOpen:t,entries:a,closeWhatsNew:s}=V7(),o=a??v0,l=(u=e.language)!=null&&u.toLowerCase().startsWith("zh")?"zh":"en";return y.jsx(pf,{isOpen:t,onClose:s,title:y.jsxs("span",{className:"flex items-center gap-2",children:[y.jsx(J3,{className:"w-4 h-4 text-accent-yellow","aria-hidden":"true"}),n("whatsnew.title")]}),size:"2xl",children:y.jsx("div",{className:"space-y-6",children:o.map(d=>{const h=i9(d,l);return y.jsxs("section",{className:"space-y-2",children:[y.jsxs("header",{className:"flex items-baseline gap-3",children:[y.jsxs("h3",{className:"text-base font-semibold text-dark-text font-mono",children:["v",h.version]}),h.title&&y.jsx("span",{className:"text-sm text-dark-muted",children:h.title}),h.date&&y.jsx("span",{className:"text-xs text-dark-muted/60 ml-auto",children:h.date})]}),y.jsx("ul",{className:"space-y-1.5",children:h.items.map((m,p)=>y.jsxs("li",{className:"flex gap-2 text-sm text-dark-muted leading-relaxed",children:[y.jsx("span",{className:"text-accent-blue shrink-0 mt-0.5","aria-hidden":"true",children:"•"}),y.jsx("span",{children:m})]},p))})]},d.version)})})})}function Hj({isOpen:n,onClose:e,title:t,collapsedSummary:a,badge:s,children:o,maxHeight:l="45vh",onExpandedChange:u,className:d}){const{t:h}=vt(),[m,p]=O.useState(!0);O.useEffect(()=>{n&&p(!0)},[n]),O.useEffect(()=>{u==null||u(m)},[m,u]);const b=O.useCallback(()=>{p(x=>!x)},[]);return n?y.jsxs("div",{className:Wt("shrink-0 bg-dark-surface/95 backdrop-blur border-t border-dark-border shadow-[0_-10px_30px_-15px_rgba(0,0,0,0.5)]",d),children:[y.jsxs("div",{role:"button","aria-expanded":m,tabIndex:0,onClick:b,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),b())},title:h(m?"commonUi.drawerCollapseTitle":"commonUi.drawerExpandTitle"),className:Wt("flex items-center gap-2 px-4 py-2 cursor-pointer select-none transition-colors","hover:bg-dark-hover/60"),children:[y.jsx("span",{className:Wt("shrink-0 text-dark-muted transition-transform duration-200",!m&&"rotate-180"),children:y.jsx(ti,{size:16})}),y.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[y.jsx("span",{className:"text-sm font-semibold text-dark-text truncate",children:t}),s,!m&&a&&y.jsx("span",{className:"min-w-0 flex items-center gap-1.5 text-xs text-dark-muted truncate",children:a})]}),y.jsx("button",{type:"button","aria-label":h("common.close"),onClick:x=>{x.stopPropagation(),e()},className:"shrink-0 p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:y.jsx(xr,{size:15})})]}),m&&y.jsx("div",{className:"animate-slide-up border-t border-dark-border/60 overflow-y-auto custom-scrollbar p-4",style:{maxHeight:l},children:o})]}):null}const Uj=O.lazy(()=>D(()=>import("./ModelsView-Dbo4GErV.js"),__vite__mapDeps([125,126,127,128,129,130])).then(n=>({default:n.ModelsView}))),Fj=O.lazy(()=>D(()=>import("./ToolsView-DO0_61eJ.js"),__vite__mapDeps([131,126,127,128,129,130])).then(n=>({default:n.ToolsView}))),Gj=O.lazy(()=>D(()=>import("./SkillsView-CecX9sxV.js"),__vite__mapDeps([132,126,127,128,129,130])).then(n=>({default:n.SkillsView}))),qj=O.lazy(()=>D(()=>import("./TemplatesTab-BtbjQDQk.js"),__vite__mapDeps([133,126,127,128,129,130])).then(n=>({default:n.TemplatesTab}))),Vj=O.lazy(()=>D(()=>import("./HookConfigView-japq3zFX.js"),__vite__mapDeps([134,126,127,129,128,130])).then(n=>({default:n.HookConfigView}))),Wj=O.lazy(()=>D(()=>import("./FileTreeView-BWPOqGPh.js"),__vite__mapDeps([135,126,127,128,129,130])).then(n=>({default:n.FileTreeView}))),Kj=O.lazy(()=>D(()=>import("./TerminalView-6U_87hSL.js"),__vite__mapDeps([136,126,127,137,128,129,130,138])).then(n=>({default:n.TerminalView}))),Yj=O.lazy(()=>D(()=>import("./SessionGrid-F23LrdJ2.js"),__vite__mapDeps([139,126,127,128,140,129,130,141])).then(n=>({default:n.SessionGrid}))),Zj=O.lazy(()=>D(()=>import("./SettingsPanel-CGJbV37j.js"),__vite__mapDeps([142,126,127,140,128,129,130])).then(n=>({default:n.SettingsPanel}))),Xj=O.lazy(()=>D(()=>import("./ChannelConfigView-BqEclPUB.js"),__vite__mapDeps([143,126,127,128,129,130])).then(n=>({default:n.ChannelConfigView}))),Qj=O.lazy(()=>D(()=>import("./ConnectorsView-Cz4uqSmh.js"),__vite__mapDeps([144,126,127,128,129,130])).then(n=>({default:n.ConnectorsView}))),Jj=O.lazy(()=>D(()=>import("./AutomationView-Y4qkPsrX.js"),__vite__mapDeps([145,126,127,128,129,130])).then(n=>({default:n.AutomationView}))),eP=O.lazy(()=>D(()=>import("./PluginsView-C1BPNAQx.js"),__vite__mapDeps([146,126,127,128,129,130])).then(n=>({default:n.PluginsView}))),tP=O.lazy(()=>D(()=>Promise.resolve().then(()=>TO),void 0).then(n=>({default:n.PluginTabContainer}))),nP=()=>y.jsx("div",{className:"flex-1 flex items-center justify-center bg-dark-bg",children:y.jsx("div",{className:"w-5 h-5 border-2 border-accent-blue border-t-transparent rounded-full animate-spin"})}),D1=[{id:"chat",labelKey:"nav.chat",icon:z0},{id:"terminal",labelKey:"nav.terminal",icon:GS},{id:"files",labelKey:"nav.files",icon:qS},{id:"models",labelKey:"nav.models",icon:VS},{id:"tools",labelKey:"nav.tools",icon:WS},{id:"skills",labelKey:"nav.skills",icon:J3},{id:"templates",labelKey:"nav.templates",icon:i0},{id:"hooks",labelKey:"nav.hooks",icon:KS},{id:"channels",labelKey:"nav.channels",icon:YS},{id:"connectors",labelKey:"nav.connectors",icon:ZS},{id:"scheduled",labelKey:"nav.scheduled",icon:XS},{id:"logs",labelKey:"nav.logs",icon:Ac},{id:"settings",labelKey:"nav.settings",icon:QS},{id:"plugins",labelKey:"nav.plugins",icon:ex}],Tp=Object.fromEntries(D1.map(n=>[n.id,n.labelKey])),aP=D1.map(n=>({id:n.id,title:n.labelKey})),M3=Object.fromEntries(D1.map(n=>[n.id,n.icon]));function rP(){const[n,e]=O.useState("chat"),[t,a]=O.useState(!1),[s,o]=O.useState([]),[,l]=O.useState(0),[u,d]=O.useState(!1),[h,m]=O.useState(!1),[p,b]=O.useState(!1),[x,w]=O.useState(null),[_,T]=O.useState(!1),[N,E]=O.useState(!1),[B,L]=O.useState({}),[j,F]=O.useState(!1),[Y,ee]=O.useState(null),[te,xe]=O.useState(!1),De=O.useRef(null),ce=O.useRef(null),[ie,pe]=O.useState(()=>localStorage.getItem("dsc-sidebar-collapsed")==="1"),we=O.useCallback(()=>{pe(U=>(localStorage.setItem("dsc-sidebar-collapsed",U?"0":"1"),!U))},[]),q=O.useCallback(()=>{F(U=>!U),xe(!1)},[]),oe=O.useCallback(()=>{const U=De.current;U&&(te?U.resize(ce.current??20):(ce.current=U.getSize(),U.resize(68)),xe(ne=>!ne))},[te]);O.useEffect(()=>{const U=window.matchMedia("(min-width: 1400px)"),ne=ue=>{ue.matches||F(!1)};return U.addEventListener("change",ne),()=>U.removeEventListener("change",ne)},[]),O.useEffect(()=>{try{const U=localStorage.getItem("dsc-seen-version"),ne=o9(U);if(ne.length>0){V7.getState().openWhatsNew(ne);const ue=l9();ue&&localStorage.setItem("dsc-seen-version",ue)}}catch{}},[]);const{t:ge,i18n:be}=vt(),{toggleTerminal:Ve}=h_(),{theme:We,setTheme:ze,setThemePreset:Re,language:lt,workspaceDir:kt,setWorkspaceDir:En,effort:an}=qi(),In=ns();O.useEffect(()=>{lt&&be.language!==lt&&be.changeLanguage(lt)},[lt,be]);const gn=O.useMemo(()=>aP.filter(U=>!(U.id==="terminal"&&x===!1)),[x]),[_a,Ca]=O.useState([]);O.useEffect(()=>{let U=!1;return Z.get("/api/plugins/ui").then(ne=>{var ue;U||Ca((((ue=ne==null?void 0:ne.data)==null?void 0:ue.ui)??[]).filter(Le=>Le.mount==="tab"))}).catch(()=>{}),()=>{U=!0}},[]);const Ta=U=>`plugin:${U.pluginId}:${U.id}`,la=O.useMemo(()=>[...gn.map(U=>({...U,iconComponent:M3[U.id]})),..._a.map(U=>({id:Ta(U),title:U.title,icon:U.icon,iconComponent:M3[U.icon??""]??ex}))],[gn,_a]),pt=O.useCallback(U=>{O.startTransition(()=>{e(U)})},[]),[fe,ct]=O.useState(null),Fe=O.useCallback(U=>{ct({section:U,nonce:Date.now()})},[]);O.useEffect(()=>{const U=ue=>{const Le=ue.message||ge("common.unknownError"),$e=ue.filename||"global";$e.includes("chrome-extension://")||$e.includes("moz-extension://")||o(gt=>[...gt,{id:`error-${Date.now()}-${yr()}`,level:"error",source:"Browser",message:`${ge("toast.uncaughtError")}${Le}`,timestamp:Date.now()}].slice(-500))},ne=ue=>{var $e;const Le=(($e=ue.reason)==null?void 0:$e.message)||ue.reason||ge("toast.unknownReason");o(gt=>[...gt,{id:`rejection-${Date.now()}-${yr()}`,level:"error",source:"Promise",message:`${ge("toast.uncaughtRejection")}${Le}`,timestamp:Date.now()}].slice(-500))};return window.addEventListener("error",U),window.addEventListener("unhandledrejection",ne),()=>{window.removeEventListener("error",U),window.removeEventListener("unhandledrejection",ne)}},[ge]);const{sessionTabs:Pe,activeSessionId:Ce,setActiveSession:Ge,addSessionTab:At,closeSessionTab:Jt,renameSessionTab:Ht,getVisibleSessionTabs:yt,autoNameSession:Nn,touchSession:rr}=Ke(),ps=Ce?B[Ce]??!0:!0,ca=wt(U=>Ce?Object.keys(U.tasksBySession[Ce]||{}).length:0),Ar=O.useCallback(()=>{L(U=>Ce?{...U,[Ce]:!(U[Ce]??!0)}:U)},[Ce]),[zn,gf]=O.useState(()=>typeof window<"u"&&window.innerWidth<768);O.useEffect(()=>{const U=window.matchMedia("(max-width: 767px)"),ne=ue=>gf(ue.matches);return U.addEventListener("change",ne),()=>U.removeEventListener("change",ne)},[]);const ua=wt(U=>Ce?U.getForSession(Ce):void 0),gs=O.useRef(null),$n=O.useRef(null);O.useEffect(()=>{if(zn)return;const U=ua&&["RUNNING","RESUMING","PAUSED"].includes(String(ua.status)),ne=ca>0;U&&ua&&gs.current!==ua.runId?(gs.current=ua.runId,F(!0)):ne&&$n.current!==Ce&&($n.current=Ce??null,F(!0))},[ua==null?void 0:ua.runId,ua==null?void 0:ua.status,ca,Ce,zn]);const da=Zn(U=>{var ne;return Ce?((ne=U.bySession[Ce])==null?void 0:ne.artifacts.length)??0:0}),Mn=O.useRef({sessionId:null,count:0});O.useEffect(()=>{const U=Mn.current;if(Ce!==U.sessionId){Mn.current={sessionId:Ce??null,count:da};return}!zn&&da>U.count&&F(!0),Mn.current={sessionId:Ce??null,count:Math.max(da,U.count)}},[da,Ce,zn]);const{clearMessages:ou}=Ue(),lu=Ue(U=>Ce?U.messagesBySession[Ce]||[]:[]),{customTheme:yf,customThemeEnabled:Zi,themePresetId:Xi}=qi();bj({theme:We,themePresetId:Xi,customTheme:yf,customThemeEnabled:Zi}),yj({activeTab:n,setLogs:o,setUnreadLogs:l}),O.useEffect(()=>{Z.get("/api/terminal/status").then(U=>w(U.success&&U.data?U.data.ttydAvailable!==!1:!1)).catch(()=>w(!1))},[]),O.useEffect(()=>{const U=ne=>{const ue=ne.detail,Le=typeof ue=="string"?ue:ue==null?void 0:ue.tab,$e=typeof ue=="string"||ue==null?void 0:ue.section;Le&&Le!==n&&pt(Le),Le==="settings"&&$e&&Fe($e)};return window.addEventListener("switch-tab",U),()=>window.removeEventListener("switch-tab",U)},[n,pt,Fe]),O.useEffect(()=>{const U=ne=>{var Le;const ue=(Le=ne.detail)==null?void 0:Le.path;ue&&(ee(ue),F(!0))};return window.addEventListener("preview-file",U),()=>window.removeEventListener("preview-file",U)},[]);const Er=O.useCallback(()=>{const U=window.location.hash.replace(/^#\/?/,"");if(!U)return;const[ne,ue]=U.split("/");ne&&ne in Tp&&pt(ne),ne==="settings"&&ue==="stt"&&Fe("stt")},[pt,Fe]);O.useEffect(()=>(Er(),window.addEventListener("hashchange",Er),()=>window.removeEventListener("hashchange",Er)),[Er]);const Wa=O.useRef(t);O.useEffect(()=>{const U=Oe.onOpen(()=>{Wa.current=!0,a(!0),Ze.success(ge("toast.backendConnected"))}),ne=Oe.onClose(()=>{const ue=Wa.current;Wa.current=!1,a(!1),ue&&Ze.warning(ge("toast.backendDisconnected"))});return()=>{U(),ne()}},[ge]);const Qi=O.useCallback(async()=>{try{const U=await ht.sessions.list();if(!U.success||!Array.isArray(U.data))return!1;const ne=Sj(U.data);if(ne.length===0)return!1;const ue=ne[0],Le=$e=>({id:$e.id,title:$e.title,createdAt:$e.createdAt,lastActiveAt:$e.lastActiveAt,preview:$e.preview,status:"done"});return Ke.setState($e=>{const gt=$e.sessionTabs.some(et=>et.id===ue.id)?$e.sessionTabs:[Le(ue),...$e.sessionTabs].slice(0,$p),Nt=new Set(gt.map(et=>et.id));let yn=[...ne.map(Le).filter(et=>!Nt.has(et.id)),...$e.historySessions.filter(et=>!ne.some(Hn=>Hn.id===et.id))].slice(0,Math.max(0,cx-gt.length));const Ot=[...ne.map(et=>({id:et.id,title:et.title,createdAt:new Date(et.createdAt).toISOString(),updatedAt:new Date(et.lastActiveAt??et.createdAt).toISOString(),messageCount:et.messageCount??0})),...$e.sessions.filter(et=>!ne.some(Hn=>Hn.id===et.id))];return{sessionTabs:gt,historySessions:yn,sessions:Ot,activeSessionId:ue.id}}),!0}catch{return!1}},[]);O.useEffect(()=>{if(Ke.getState().sessionTabs.length>0)return;let U=!1;return Qi().then(ne=>{U||ne||At(ge("chat.defaultSessionTitle",{n:1}))}),()=>{U=!0}},[]),O.useEffect(()=>{const U=()=>m(!0);return window.addEventListener("hook-approval-required",U),()=>window.removeEventListener("hook-approval-required",U)},[]);const ys=O.useRef(Ce);O.useEffect(()=>{ys.current=Ce},[Ce]);const Ji=O.useCallback(U=>{var Le,$e,gt;if(!U)return!1;const ne=window,ue=(Le=ne.__pendingQuestions)==null?void 0:Le[U];return ue?($e=ne.__answeredQuestionIds)!=null&&$e.has(ue.questionId)?(delete ne.__pendingQuestions[U],((gt=ne.__pendingQuestion)==null?void 0:gt.questionId)===ue.questionId&&(ne.__pendingQuestion=null),!1):(ne.__pendingQuestion=ue,b(!0),!0):!1},[]);O.useEffect(()=>{const U=ne=>{const ue=ne.detail||ys.current;Ji(ue)};return window.addEventListener("ask-question-required",U),()=>window.removeEventListener("ask-question-required",U)},[Ji]),O.useEffect(()=>{Ce&&Ji(Ce)},[Ce,Ji]);const cu=O.useCallback(()=>{var ue;const U=window,ne=U.__pendingQuestion;if(ne!=null&&ne.questionId){U.__answeredQuestionIds=U.__answeredQuestionIds||new Set,U.__answeredQuestionIds.add(ne.questionId);const Le=U.__pendingQuestions||{};for(const $e of Object.keys(Le))((ue=Le[$e])==null?void 0:ue.questionId)===ne.questionId&&delete Le[$e];U.__pendingQuestion=null}b(!1)},[]);O.useEffect(()=>{In.autoMode&&In.pendingApprovals.length>0&&m(!1),In.pendingApprovals.length>0&&!In.autoMode&&m(!0)},[In.autoMode,In.pendingApprovals.length]);const eo=O.useRef(0);O.useEffect(()=>{const U=ne=>{var Ot,et;if(ne.key!=="Escape"||ne.defaultPrevented)return;const ue=(Ot=ne.target)==null?void 0:Ot.tagName;if(ue==="INPUT"||ue==="TEXTAREA"||(et=ne.target)!=null&&et.isContentEditable)return;const Le=Ue.getState(),gt=Ke.getState().activeSessionId;if(!gt||!Le.isGenerating(gt))return;ne.preventDefault();const Nt=Date.now(),yn=eo.current;eo.current=Nt,yn>0&&Nt-yn<500?(Oe.send({type:"stop",sessionId:gt}),Ze.info(ge("toast.terminated"))):(Oe.send({type:"pause",sessionId:gt}),Ze.info(ge("toast.paused")))};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[ge]);const[Nr,uu]=O.useState(!1),Mr=O.useCallback(()=>{O.startTransition(()=>{const U=At(void 0,kt);Oe.setSessionId(U),Zo.getState().setMode("auto-act"),pt("chat")})},[At,kt,pt]),du=O.useCallback(U=>{O.startTransition(()=>{const ne=Ke.getState();let ue=ne.activeSessionId;ue||(ue=ne.addSessionTab(void 0,kt),Oe.setSessionId(ue)),Ue.getState().setSessionInput(ue,`$${U.id} `),pt("chat")})},[kt,pt]),to=O.useCallback(()=>pt("templates"),[pt]),ci=O.useCallback(async(U,ne)=>{var yn;const ue=await ht.templates.render(U.id,ne);if(!ue.success||!ue.data){Ze.error(ue.error||"模板渲染失败");return}const Le=ue.data,$e=At(U.name,kt);Oe.setSessionId($e),Zo.getState().setMode("auto-act"),pt("chat");const gt=`wf-${Date.now()}-${yr()}`;wt.getState().upsert($e,{runId:gt,status:"RUNNING",completedPhases:0,totalPhases:((yn=Le.nodes)==null?void 0:yn.length)??0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,lastEventType:"workflow_start"});const Nt=await ht.workflows.start({sessionId:$e,runId:gt,workflow:Le,message:`[模板] ${U.name}`});if(!Nt.success||!Nt.data){Ze.error(Nt.error||"工作流启动失败"),wt.getState().fail($e,gt,Nt.error||"启动失败");return}if(Nt.data.status==="FAILED"){const Ot=Nt.data.error||"模板定义无效";Ze.error(`工作流启动失败: ${Ot}`),wt.getState().fail($e,gt,Ot)}},[At,kt,pt]),gl=O.useCallback(async()=>{if(Nr||!Ce)return;const U=wt.getState().getForSession(Ce),ne=U==null?void 0:U.runId;if(!ne){Ze.info("当前会话没有可保存的工作流运行");return}uu(!0),Ze.info("正在泛化为模板…");try{const ue=await ht.templates.createFromRun(ne,{generalize:!0});ue.success&&ue.data?ue.data.degraded?Ze.warning(`已保存为模板「${ue.data.name}」(v${ue.data.version}),但 LLM 泛化失败,已原样保存${ue.data.degradeReason?`:${ue.data.degradeReason}`:""}`):Ze.success(`已保存为模板「${ue.data.name}」(v${ue.data.version})`):Ze.error(ue.error||"保存模板失败")}finally{uu(!1)}},[Ce,Nr]),yl=O.useRef(0),vl=O.useCallback(async U=>{if(!U)return;const ne=++yl.current;try{const ue=await ht.sessions.resume(U);if(ne!==yl.current||!ue.success||!ue.data)return;const Le=ue.data;Le.session&&Ke.getState().updateSession(U,Le.session);const $e=Le.messages||[];if($e.length>0){const gt=$e.flatMap(Ot=>Ot.type!=="user"&&Ot.type!=="assistant"&&Ot.type!=="system"?[]:[{id:Ot.id||`msg-${Ot.timestamp||Date.now()}`,type:Ot.type,content:Ot.content||"",timestamp:Ot.timestamp||Date.now(),thinking:Ot.thinking||void 0}]);Ue.getState().replaceMessages(U,gt);const Nt=$e.find(Ot=>Ot.type==="user"),yn=typeof(Nt==null?void 0:Nt.content)=="string"?Nt.content.replace(/\s+/g," ").trim():"";Ke.getState().touchSession(U,yn||void 0)}}catch{}},[]),Ka=O.useCallback(U=>{Ge(U),Oe.setSessionId(U)},[Ge]),rn=O.useCallback(U=>{Jt(U)},[Jt]),Rn=O.useCallback((U,ne)=>{Ht(U,ne)},[Ht]),sr=O.useCallback(()=>{Ce&&ou(Ce)},[Ce,ou]);O.useEffect(()=>{if(!Ce)return;const U=Ue.getState().messagesBySession[Ce];U&&U.length>0&&rt.getState().recalculateFromMessages(U)},[Ce]),O.useEffect(()=>{if(!Ce)return;Ue.getState().getMessages(Ce).length===0&&vl(Ce)},[Ce,vl]);const ui=O.useCallback(async(U,ne,ue,Le,$e)=>{if(!ne.trim())return;Ue.getState().isGenerating(U)&&(console.warn(`[sendMessage] Session ${U} stuck in generating state — force-ending`),Ue.getState().endGeneration(U,"Force-ended: new message"));const Nt=Zo.getState();Ue.getState().resumeGeneration(U),Oe.setSessionId(U),Ue.getState().getMessages(U).some(Aa=>Aa.type==="user")?rr(U):(Nn(U,ne.trim()),rr(U,ne.trim()));let et=ne.trim();if(ue&&ue.length>0){const Aa=[],hu=[...ue].sort((Ea,Or)=>Or.length-Ea.length);for(const Ea of hu){et=et.split(`@${Ea}`).join("").trim();try{const Or=await ht.files.read(Ea),Vn=Or.success&&Or.data?Or.data:null;if(Vn){const Sl=Ea.split(".").pop()||"";Aa.push(`<context ref="${Ea}">
476
+ `),Ze.info(d,5e3),rt.getState().setCompacting({originalCount:u.originalCount||0,compressedCount:u.compressedCount||0,tokensSaved:u.tokensSaved||0}),rt.getState().setCompactionProgress(null)}catch(u){console.error("Failed to parse context_compressed:",u)}break;case"error":{s.endGeneration(t);const u=typeof e=="string"?e:String(e||"Error occurred"),d=aj(u),h=s.messagesBySession[t]||[],m=h[h.length-1];m&&m.type==="assistant"&&!m.errorCard?s.attachErrorCard(t,d):s.addMessage(t,{id:yr(),type:"assistant",content:"",timestamp:Date.now(),errorCard:d}),Ke.getState().touchSession(t);break}case"context_analysis":try{const u=JSON.parse(e||"{}");u&&u.total!==void 0&&rt.getState().setContextDistribution(u)}catch(u){console.error("Failed to parse context_analysis:",u)}break;case"threshold_warning":try{const u=JSON.parse(e||"{}");rt.getState().setThresholdWarning(u);const d=u.percentLeft!==void 0?u.percentLeft:0;d<=5?console.warn(`Context nearly full (${d}% remaining)`):d<=15&&console.info(`Context running low (${d}% remaining)`)}catch(u){console.error("Failed to parse threshold_warning:",u)}break;case"blocking_limit":try{const u=JSON.parse(e||"{}");rt.getState().setThresholdWarning(u),console.error(u.message||"Context blocked")}catch(u){console.error("Failed to parse blocking_limit:",u)}break;case"context_blocked":try{const u=JSON.parse(e||"{}");rt.getState().setThresholdWarning(u),console.error(u.message||"Context is full — generation blocked")}catch(u){console.error("Failed to parse context_blocked:",u)}break;case"tool_retry":try{const u=JSON.parse(e||"{}");rt.getState().setRetryState({active:u.attempt<(u.maxRetries||3),attempt:u.attempt||0,maxRetries:u.maxRetries||3,errorCategory:u.errorCategory||"unknown",toolName:u.toolName})}catch(u){console.error("Failed to parse tool_retry:",u)}break;case"model_fallback":try{const u=JSON.parse(e||"{}");console.warn(`Model fallback: ${u.fromModel||"?"} → ${u.toModel||"?"}`)}catch(u){console.error("Failed to parse model_fallback:",u)}break;case"tombstone":try{const d=JSON.parse(e||"{}").messageIds||[];d.length>0&&s.applyTombstone(t,d)}catch(u){console.warn("Failed to parse tombstone",String(u))}break;case"stall_detected":try{const u=JSON.parse(e||"{}"),d=u.attempt||0,h=u.maxRetries||3,m=u.reason||"no response from model";u.recovering?Ze.warning(`⚠ Generation stalled (${m}) — retrying ${d}/${h}`,8e3):Ze.error(`⚠ Generation stalled (${m}) — giving up`,1e4)}catch(u){console.warn("Failed to parse stall_detected",String(u))}break}JB.onWsEvent(t,n,e,a),nj.onWsEvent(t,n,e,a)}}const O1=mn()((n,e)=>({backendCommands:[],loaded:!1,setBackendCommands:t=>{n({backendCommands:t,loaded:!0})},getAllCommands:()=>e().backendCommands}));async function ij(n="",e){try{let t=`${n}/api/commands`;e&&(t+=`?lang=${encodeURIComponent(e)}`);const a=await fetch(t);if(!a.ok)return[];const s=await a.json(),o=Array.isArray(s==null?void 0:s.data)?s.data:[];return O1.getState().setBackendCommands(o),o}catch{return[]}}function kp(n,e,t,a,s){var o,l,u;switch(n){case"token_update":try{const h=typeof e=="string"?JSON.parse(e):e||{};if(h.source==="workflow"){rt.getState().addWorkflowTokens(Number(h.workflowNodeTokens)||0);break}h.totalTokens>0&&rt.getState().updateUsage({promptTokens:h.promptTokens||0,completionTokens:h.completionTokens||0,totalTokens:h.totalTokens||0});const m=h.promptCacheHitTokens??h.prompt_cache_hit_tokens,p=h.promptCacheMissTokens??h.prompt_cache_miss_tokens;(m!==void 0||p!==void 0)&&rt.getState().accumulateCacheStats(Number(m)||0,Number(p)||0),h.model&&rt.getState().setModel(h.model)}catch{}break;case"context_breakdown":try{const h=typeof e=="string"?JSON.parse(e):e||{};rt.getState().setContextBreakdown({systemPromptTokens:Number(h.systemPromptTokens)||0,messagesTokens:Number(h.messagesTokens)||0,toolContentTokens:Number(h.toolContentTokens)||0,toolDefTokens:Number(h.toolDefTokens)||0,mcpToolTokens:Number(h.mcpToolTokens)||0,skillTokens:Number(h.skillTokens)||0,dynamicTokens:Number(h.dynamicTokens)||0,total:Number(h.total)||0})}catch{}break;case"model_name":try{const h=s&&typeof s.model=="string"&&s.model||(typeof e=="string"?e:(e==null?void 0:e.model)||"");h&&rt.getState().setModel(h);const m=s&&typeof s.modelRef=="string"&&s.modelRef||(typeof e=="object"&&e!==null&&typeof e.modelRef=="string"?e.modelRef:"");m&&rt.getState().setModelRef(m);const p=s&&typeof s.source=="string"&&s.source||(typeof e=="object"&&e!==null&&typeof e.source=="string"?e.source:"");p&&rt.getState().setModelSource(p)}catch{}break;case"auth_required":let d=localStorage.getItem("auth_token");d||(d="default-token",localStorage.setItem("auth_token",d)),Oe.setToken(d),Oe.setAuthenticated(!1),Oe.send({type:"auth",token:d});break;case"auth_success":Oe.setAuthenticated(!0),Oe.send({type:"subscribe_logs"});{const h=qi.getState();ij("",(o=h.language)!=null&&o.startsWith("zh")?"zh":"en");const m=h.workspaceDir;m&&Oe.send({type:"workspace",message:m})}break;case"auth_failed":vr.error("Auth failed",String(e));break;case"log":try{const h=typeof e=="string"?JSON.parse(e):e,m={id:`log-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,level:h.level||"info",source:h.source||"System",message:h.message||"",timestamp:h.timestamp||Date.now()};a.setLogs(p=>[...p,m].slice(-500)),a.activeTab!=="logs"&&a.setUnreadLogs(p=>p+1)}catch(h){console.warn("Failed to parse log entry",String(h))}break;case"commands_list":try{const h=JSON.parse(e||"[]");O1.getState().setBackendCommands(Array.isArray(h)?h:[])}catch(h){console.warn("Failed to parse commands list",String(h))}break;case"command_error":try{const h=typeof e=="string"?JSON.parse(e):e||{};Ze.error((h.error||"Command failed").toString(),6e3)}catch{}break;case"notification":{try{const h=typeof e=="string"?JSON.parse(e):e||{},m=h.result&&typeof h.result=="object"?h.result:{},p=String(h.message||m.message||"").trim();if(!p)break;if(h.kind==="command"){const b=Ke.getState().activeSessionId;b&&Ue.getState().addMessage(b,{id:`cmd-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"assistant",content:`⚙️ ${String(h.command||"")} → ${p}`,timestamp:Date.now()})}else Ze.info(p,5e3)}catch{}break}case"ping":Oe.send({type:"pong",data:Date.now().toString()});break;case"workspace_changed":try{const h=JSON.parse(e||"{}");h.newDir&&qi.getState().setWorkspaceDir(h.newDir)}catch{}break;case"degradation_update":try{const h=typeof e=="string"?JSON.parse(e):e||{},m=h.active,p=h.mode||"normal",b=Number(h.retryCount)||0,x=Number(h.maxRetries)||0,w=h.message||"",T={normal:"normal",retrying:"retrying",alternative:"alternative model",degraded:"degraded",verifying:"verifying",verified_fail:"verify failed"}[p]||p;if(rt.getState().setDegradation({active:m,retryCount:b,maxRetries:x,mode:p,message:w,label:T}),m){const N=b>0?` (${b}/${x})`:"";Ze.warning(w||`API Degraded: ${T}${N}`,8e3),a.setLogs(E=>[...E,{id:`deg-${Date.now()}`,level:"warn",source:"Infrastructure",message:`Degradation: ${T} | ${w||"no details"}`,timestamp:Date.now()}].slice(-500))}else Ze.success("API Normal")}catch(h){console.warn("Degradation update parse error",String(h))}break;case"doctor_result":try{const h=typeof e=="string"?JSON.parse(e):e||{},m=h.overallStatus||h.status||"unknown",p=h.healthRate,b=h.issues||[],w={healthy:"healthy",degraded:"degraded",unhealthy:"unhealthy",unknown:"unknown"}[m]||m,_=typeof p=="number"?` (${Math.round(p*100)}%)`:"";if(m==="healthy")Ze.success(`Doctor: ${w}${_}`);else if(Ze.warning(`Doctor: ${w}${_}`,1e4),b&&b.length>0)for(const T of b)a.setLogs(N=>[...N,{id:`doctor-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,level:"warn",source:"Doctor",message:typeof T=="string"?T:T.message||JSON.stringify(T),timestamp:Date.now()}].slice(-500))}catch(h){console.warn("Doctor result parse error",String(h))}break;case"session_created":{try{const h=typeof e=="string"?JSON.parse(e):e||{};h.id&&(Oe.setSessionId(h.id),Ke.getState().updateSession(h.id,h))}catch{}typeof e=="string"&&e&&vr.info(`Session event: ${n}`);break}case"session_resumed":{try{const h=typeof e=="string"?JSON.parse(e):e||{};if((l=h.session)!=null&&l.id&&(Oe.setSessionId(h.session.id),Ke.getState().updateSession(h.session.id,h.session)),h.messages&&Array.isArray(h.messages)){const m=((u=h.session)==null?void 0:u.id)||t;Ue.getState().replaceMessages(m,h.messages.map(x=>({id:x.id||`msg-${x.timestamp||Date.now()}`,type:x.type==="user"?"user":"assistant",content:x.content||"",timestamp:x.timestamp||Date.now(),thinking:x.thinking||void 0})));const p=h.messages.find(x=>x.type==="user"&&!x.deleted),b=typeof(p==null?void 0:p.content)=="string"?p.content.replace(/\s+/g," ").trim():"";Ke.getState().touchSession(m,b||void 0)}}catch(h){console.warn("Failed to process session_resumed",String(h))}typeof e=="string"&&e&&vr.info(`Session event: ${n}`);break}case"mcp_update":try{const h=typeof e=="string"?JSON.parse(e):e||{},m=h.server||h.name||"MCP",p=h.action||h.status||"updated";vr.info(`MCP ${m}: ${p}`)}catch{}break}}function tI(n,e){switch(a9(n,e)){case"critical":return{level:"CRITICAL",reasonKey:"risk_critical"};case"high":return{level:"HIGH",reasonKey:/rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs/i.test(e)?"risk_critical_cmd":/write|edit|save|upload|deploy|publish/i.test(n)?"risk_high_file":/install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf/i.test(n)?"risk_high_pkg":"risk_high_shell"};case"low":return{level:"LOW",reasonKey:"risk_low"};default:return{level:"MEDIUM",reasonKey:/git|commit|push|merge|rebase/i.test(n)?"risk_git":"risk_network"}}}const nI={CRITICAL:{bg:"bg-red-900/20",border:"border-red-500/40",text:"text-red-400",badge:"bg-red-500/20 text-red-400 border-red-500/30",icon:"🚨"},HIGH:{bg:"bg-orange-900/15",border:"border-orange-500/30",text:"text-orange-400",badge:"bg-orange-500/20 text-orange-400 border-orange-500/30",icon:"⚠️"},MEDIUM:{bg:"bg-yellow-900/10",border:"border-yellow-500/25",text:"text-yellow-400",badge:"bg-yellow-500/15 text-yellow-400 border-yellow-500/25",icon:"📋"},LOW:{bg:"bg-blue-900/10",border:"border-blue-500/25",text:"text-blue-400",badge:"bg-blue-500/15 text-blue-400 border-blue-500/25",icon:"✅"}};function aI(n,e){return r9(n,e)}function oj(n){try{const e=JSON.parse(n),t=e.payload&&typeof e.payload=="object"?e.payload:e,a=t.resolvedPath;if(typeof a=="string"&&a)return a;const s=t.requestedPath;return typeof s=="string"&&s?s:null}catch{return null}}function lj(n,e){try{const t=typeof n=="string"?JSON.parse(n):n||{},a=ns.getState(),{approvalId:s,toolName:o,askPayload:l,timeoutMs:u,timeoutAction:d}=t,h=oj(String(l||""));if(a.isSessionAllowed(o,h??void 0)){Oe.send({type:"hook_allow",data:JSON.stringify({approvalId:s})});return}if(a.autoMode&&o!=="exit_plan_mode"){Oe.send({type:"hook_allow",data:JSON.stringify({approvalId:s})});return}Ue.getState().addMessage(e,{id:`hook-approval-${s||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:{approvalId:s||"",toolName:o||"unknown",askPayload:l||"",status:"pending",timestamp:Date.now(),timeoutMs:typeof u=="number"?u:void 0,timeoutAction:d==="allow"||d==="deny"?d:void 0}}),a.addApproval({approvalId:s||"",toolName:o||"unknown",askPayload:l||"",timestamp:Date.now(),timeoutMs:typeof u=="number"?u:void 0,timeoutAction:d==="allow"||d==="deny"?d:void 0}),window.dispatchEvent(new CustomEvent("hook-approval-required"))}catch{}}function _p(n,e){try{const t=typeof n=="string"?JSON.parse(n):n||{};typeof t.sessionId=="string"&&t.sessionId&&(e=t.sessionId);const a=Ke.getState(),s=wt.getState(),{action:o,taskId:l,data:u}=t;if(o==="created"&&u){const d={id:l||`task-${Date.now()}`,title:u.title||"",completed:u.status==="COMPLETED",createdAt:Date.parse(u.createdAt)||Date.now(),backendId:l,backendStatus:u.status,description:u.description},h=a.tasksBySession[e]||[];a.setSessionTasks(e,[...h,d]),s.upsertTask(e,{id:d.id,title:d.title,description:d.description,status:Sr(u.status),source:"task",progress:u.progress!=null?Number(u.progress):void 0,raw:t})}else if((o==="updated"||o==="status_changed")&&u)a.updateTaskPlanStatus(e,l,{backendStatus:u.status,progress:u.progress}),s.upsertTask(e,{id:l,title:u.title||l,description:u.description,status:Sr(u.status),source:"task",progress:u.progress!=null?Number(u.progress):void 0,raw:t});else if(o==="deleted"){const d=a.tasksBySession[e]||[];a.setSessionTasks(e,d.filter(h=>h.id!==l&&h.backendId!==l))}else if(t&&!o&&(t.id||t.taskId)){const d=String(t.id||t.taskId),h=t,m=String(h.status||"").toUpperCase()==="COMPLETED",p={id:d,title:String(h.title||h.name||d),completed:m,createdAt:Date.parse(h.createdAt)||Date.now(),backendId:d,backendStatus:h.status,description:h.description,progress:h.progress!=null?Number(h.progress):void 0},b=a.getSessionTasks(e);b.some(x=>x.id===d||x.backendId===d)?a.updateTaskPlanStatus(e,d,{backendStatus:h.status,progress:p.progress,completed:m}):a.setSessionTasks(e,[...b,p]),s.upsertTask(e,{id:d,title:p.title,description:p.description,status:Sr(h.status),source:"task",progress:p.progress,raw:t})}s.recordEvent(e,{type:"task_update",source:"task",title:(u==null?void 0:u.title)||t&&(t.title||t.id||t.taskId)||l||"Task update",message:o||"updated",status:(u==null?void 0:u.status)||(t==null?void 0:t.status),taskId:l||(t==null?void 0:t.id)||(t==null?void 0:t.taskId),data:t})}catch{}}function cj(n,e,t,a){try{const s=JSON.parse(e||"{}"),o=a(t,n,s);if(o){const l=Ue.getState();switch(n){case"step_start":l.updateStep(t,o.id,{title:s.step||o.title,description:s.description||o.description,status:s.status==="start"?"running":s.status||"running"});break;case"step_thinking":l.updateStep(t,o.id,{thought:s.thought});break;case"step_action":l.updateStep(t,o.id,{action:s.action});break;case"step_complete":l.updateStep(t,o.id,{status:s.status??"success",result:s.result});break}}}catch(s){console.warn("Failed to parse "+n,String(s))}}function uj(n,e){var t,a;try{const s=typeof n=="string"?JSON.parse(n):n||{};let o=[];if(Array.isArray(s)?o=s:(t=s.tasks)!=null&&t.length?o=s.tasks:(a=s.items)!=null&&a.length&&(o=s.items),o.length>0&&e){const l=Ke.getState(),u=wt.getState();o.forEach(d=>{const h=d.content||d.title||d.name||"";if(h.trim()){if(!l.getSessionTasks(e).find(w=>w.title===h.trim())&&(l.addSessionTask(e,h.trim()),d.completed||d.status==="completed"||d.status==="COMPLETED"||d.status==="done"||d.activeForm==="completed")){const T=l.getSessionTasks(e).find(N=>N.title===h.trim());T&&l.toggleSessionTask(e,T.id)}const b=String(d.id||d.taskId||h.trim()),x=d.completed||d.status==="completed"||d.status==="COMPLETED"||d.status==="done"||d.activeForm==="completed";u.upsertTask(e,{id:b,title:h.trim(),description:d.description,status:Sr(d.status,x),source:"todo",raw:d})}}),u.recordEvent(e,{type:"todo_update",source:"todo",title:"Todo list updated",message:`${o.length} items`,status:"updated",data:s})}}catch{}}function dj(n,e){try{const t=typeof n=="string"?JSON.parse(n):n||{},a=t.questionId||"",s=t.question||"";if(!a||!s)return;const o=Array.isArray(t.questions)?t.questions.map(d=>({question:String(d.question||""),header:d.header?String(d.header):void 0,options:Array.isArray(d.options)?d.options:void 0,multiSelect:d.multiSelect===!0})).filter(d=>d.question):[{question:s,header:t.header||void 0,options:Array.isArray(t.options)?t.options:void 0,multiSelect:t.multiSelect===!0}],l=window;l.__answeredQuestionIds=l.__answeredQuestionIds||new Set,l.__pendingQuestions=l.__pendingQuestions||{};const u={questionId:a,question:s,header:t.header||void 0,options:Array.isArray(t.options)?t.options:void 0,multiSelect:t.multiSelect===!0,autoResolutionMs:typeof t.autoResolutionMs=="number"?t.autoResolutionMs:void 0,questions:o,sessionId:e};l.__pendingQuestions[e]=u,l.__pendingQuestion=u,window.dispatchEvent(new CustomEvent("ask-question-required",{detail:e}))}catch{}}function fj(n,e){try{const t=typeof n=="string"?JSON.parse(n):n||{},a=t.title||t.name||"";if(a&&e){const o=Ke.getState().getSessionTasks(e).find(l=>l.title===a&&!l.completed);o&&Ke.getState().toggleSessionTask(e,o.id),wt.getState().upsertTask(e,{id:(o==null?void 0:o.id)||a,title:a,status:"completed",source:"todo"}),wt.getState().recordEvent(e,{type:"todo_item_done",source:"todo",title:a,status:"completed",taskId:(o==null?void 0:o.id)||a,data:t})}}catch{}}function k3(n){if(!n)return null;try{return JSON.parse(n)}catch{return null}}const _3=mn((n,e)=>({automations:[],runsByAutomation:{},loading:!1,error:null,fetchAutomations:async()=>{const t=await ht.automations.list();t.success&&t.data?n({automations:t.data}):n({error:t.error||"加载自动化失败"})},createAutomation:async t=>{const a=await ht.automations.create(t);return a.success&&a.data?(await e().fetchAutomations(),a.data):(n({error:a.error||"创建自动化失败"}),null)},deleteAutomation:async t=>{const a=await ht.automations.remove(t);return a.success?(await e().fetchAutomations(),!0):(n({error:a.error||"删除失败"}),!1)},toggleAutomation:async(t,a)=>{const s=await ht.automations.toggle(t,a);s.success?await e().fetchAutomations():n({error:s.error||"切换失败"})},runAutomation:async t=>{const a=await ht.automations.run(t);a.success?(await e().fetchRuns(t),await e().fetchAutomations()):n({error:a.error||"触发失败"})},fetchRuns:async t=>{const a=await ht.automations.runs(t);a.success&&a.data&&n(s=>({runsByAutomation:{...s.runsByAutomation,[t]:a.data}}))},onAutomationUpdate:t=>{n(a=>({automations:a.automations.some(o=>o.id===t.id)?a.automations.map(o=>o.id===t.id?t:o):[...a.automations,t]}))},onAutomationRun:t=>{n(a=>({runsByAutomation:{...a.runsByAutomation,[t.automationId]:[t,...a.runsByAutomation[t.automationId]||[]].slice(0,50)}}))}})),C3={automationUpdate:n=>{const e=k3(n);e!=null&&e.automation&&_3.getState().onAutomationUpdate(e.automation)},automationRun:n=>{const e=k3(n);e!=null&&e.run&&_3.getState().onAutomationRun(e.run)}};function hj(n,e,t){let a={};if(e&&typeof e=="object")a=e;else try{a=JSON.parse(String(e||"{}"))}catch{}const s=String(a.jobId||`fjob-${Date.now()}`),o=a.stage||(n==="filejob_result"?"complete":n==="filejob_error"?"error":"uploaded"),l={jobId:s,stage:o,parseProgress:a.parseProgress,parsedFiles:a.parsedFiles,mapping:a.mapping,renderProgress:a.renderProgress,currentRow:a.currentRow,totalRows:a.totalRows,result:a.result,error:a.error,errorDetail:a.errorDetail};a.attachments&&(l.attachments=a.attachments),Ue.getState().setMessageFileJob(t,l)}const mj=mn((n,e)=>({channels:[],availableTypes:[],typesLoaded:!1,loading:!1,error:null,formOpen:!1,editing:null,qrOpen:!1,qrChannel:null,selectedType:null,loadTypes:async()=>{const t=await ht.channels.types(),a=t.success&&Array.isArray(t.data)?t.data:[];n({availableTypes:a,typesLoaded:!0})},load:async()=>{n({loading:!0,error:null});const t=await ht.channels.list(),a=t.success&&Array.isArray(t.data)?t.data:[];if(n({loading:!1,channels:a,...t.success&&!Array.isArray(t.data)?{error:"服务端返回的频道数据格式异常"}:t.success?{}:{error:t.error??"Failed to load"}}),!e().selectedType&&a.length>0){const o=a[0].type;n({selectedType:o})}},create:async t=>{const a=await ht.channels.create(t);return a.success?(await e().load(),n({formOpen:!1,editing:null}),!0):(n({error:a.error??"Create failed"}),!1)},update:async(t,a)=>{const s=await ht.channels.update(t,a);return s.success?(await e().load(),n({formOpen:!1,editing:null}),!0):(n({error:s.error??"Update failed"}),!1)},remove:async t=>{const a=await ht.channels.delete(t);return a.success?(n(s=>({channels:s.channels.filter(o=>o.id!==t)})),!0):(n({error:a.error??"Delete failed"}),!1)},toggle:async(t,a)=>(await ht.channels.toggle(t,a)).success?(n(o=>({channels:o.channels.map(l=>l.id===t?{...l,enabled:a}:l)})),!0):(await e().load(),!1),openForm:t=>n({formOpen:!0,editing:t??null,error:null}),closeForm:()=>n({formOpen:!1,editing:null,error:null}),openQr:t=>n({qrOpen:!0,qrChannel:t??null}),closeQr:()=>{n({qrOpen:!1,qrChannel:null}),e().load()},clearError:()=>n({error:null}),selectType:t=>n({selectedType:t,error:null}),updateChannelStatus:t=>{n(a=>({channels:a.channels.map(s=>s.id===t.channelId?{...s,connected:t.connected,_state:t.state}:s)}))}})),pj=["start","content","thinking","tool_call","tool_result","tool_diff","cache_stats","turn_summary","web_search","cache_stats","complete","generation_paused","generation_resumed","error","context_compressed","compaction_progress","context_analysis","threshold_warning","blocking_limit","context_blocked","stall_detected"],qg=(n,e=[])=>{if(!n)return e;if(Array.isArray(n))return n.forEach(s=>qg(s,e)),e;if(typeof n!="object")return e;const t=n,a=t.content;return typeof a=="string"&&a.trim()&&e.push(a.trim()),Object.entries(t).forEach(([s,o])=>{s!=="content"&&s!=="structuredOutput"&&qg(o,e)}),e},gj=n=>{const e=qg(n);return e[e.length-1]||""};function yj({activeTab:n,setLogs:e,setUnreadLogs:t}){const a=Ue,s=O.useCallback(m=>{if(!m)return{};if(typeof m=="object")return m;if(typeof m!="string")return{};try{return JSON.parse(m)}catch{return{}}},[]),o=O.useCallback((m,p,b,x)=>{const w=s(p),_=wt.getState(),T=Ue.getState();if(m==="workflow_plan_ready"&&w.planId){_.setPlan(b,{planId:String(w.planId),title:typeof w.title=="string"&&w.title?String(w.title):"工作流计划",reason:typeof w.reason=="string"?String(w.reason):void 0,confirm:w.confirm===!0,nodes:Array.isArray(w.nodes)?w.nodes:void 0,createdAt:Date.now()});return}if(m==="workflow_confirm_ack"){_.clearPlan(b);return}const N=w.runId||x||"";if(!N)return;if(m==="workflow_error"){_.fail(b,N,w.error||"Workflow failed"),(T.isGenerating(b)||T.isPaused(b))&&T.endGeneration(b,w.error||"Workflow failed");return}const E=m==="workflow_finished"?w.status||"COMPLETED":m==="workflow_started"?w.status||"RUNNING":m==="workflow_paused"?w.status||"PAUSED":m==="workflow_resumed"?w.status||"RESUMING":m==="workflow_cancelled"?w.status||"CANCELLED":w.status||void 0,B=w.type||m,L=w.data&&typeof w.data=="object"?w.data:{},j=String(w.kind||L.kind||""),F=w.nodeId||w.node_id||L.nodeId||L.node_id,Y=w.role||w.agentRole||w.agent_role||L.role||L.agentRole||L.agent_role,ee=w.phase||w.phaseId||L.phase||L.phaseId,te=w.effectId||L.effectId||F,xe=w.toolName||w.tool_name||L.toolName||L.tool_name,De=w.error||L.error,ce=["effect.scheduled","effect.completed","effect.failed"].includes(B)&&F&&j!=="tool",ie=["effect.scheduled","effect.completed","effect.failed"].includes(B)&&j==="tool"&&(xe||F),pe=F?_.getAgentsForSession(b).find(we=>we.id===String(F)):void 0;if(_.upsert(b,{runId:N,status:E,title:typeof w.title=="string"&&w.title?String(w.title):void 0,completedPhases:Number(w.completedPhases||0),totalPhases:Number(w.totalPhases||0),completedEffects:Number(w.completedEffects||0),totalEffects:Number(w.totalEffects||0),tokensUsed:Number(w.tokensUsed||0),tokensRemaining:Number(w.tokensRemaining||0),lastEventType:B,agentNode:ce?{nodeId:String(F),role:String(Y||(pe==null?void 0:pe.role)||(pe==null?void 0:pe.name)||"agent"),phase:ee?String(ee):pe==null?void 0:pe.phase,status:B==="effect.failed"?"failed":B==="effect.completed"?"completed":"scheduled",tokens:w.tokensUsed!=null?Number(w.tokensUsed):L.tokens!=null&&typeof L.tokens=="number"?Number(L.tokens):void 0,error:De?String(De):void 0,updatedAt:Date.now()}:void 0}),ie){const we=B==="effect.failed"?"failed":B==="effect.completed"?"completed":"running",q=String(te||`${N}-${xe||F}`);_.upsertTask(b,{id:q,title:String(xe||F),description:F?String(F):void 0,status:we,source:"workflow",runId:N,result:L.artifactRef?String(L.artifactRef):void 0,error:De?String(De):void 0,raw:w}),_.recordEvent(b,{type:B,source:"workflow",title:String(xe||F),status:we,runId:N,taskId:q,message:De?String(De):void 0,data:w})}if((m==="workflow_started"||m==="workflow_handoff")&&Array.isArray(w.nodes)?_.setNodes(b,N,w.nodes):m==="workflow_node_start"&&F?_.setNodeStatus(b,N,String(F),{status:"running"}):m==="workflow_node_complete"&&F&&_.setNodeStatus(b,N,String(F),{status:String(L.status||w.status||"completed"),result:(L.result??w.result)!=null?String(L.result??w.result):void 0,error:De?String(De):void 0}),m==="workflow_started")_.clearPlan(b),T.startGeneration(b);else if(m==="workflow_finished"){_.finalizeNodes(b,N,String(E||"COMPLETED"));const we=gj(w.output);if(we){const q=T.getMessages(b),oe=q[q.length-1];(oe==null?void 0:oe.type)==="assistant"?T.appendToLastMessage(b,we):T.addMessage(b,{id:yr(),type:"assistant",content:we,timestamp:Date.now()})}T.endGeneration(b)}else E==="PAUSED"?T.pauseGeneration(b):(E==="RUNNING"||E==="RESUMING")&&T.resumeGeneration(b)},[s]),l=O.useCallback((m,p)=>{const b=s(m),x=Array.isArray(b.runs)?b.runs:[];if(x.length===0)return;const w=x.slice().sort((E,B)=>String(B.updatedAt||"").localeCompare(String(E.updatedAt||"")))[0],_=String(w.status||"").toUpperCase();if(!_)return;const T=wt.getState(),N=String(w.runId||"");T.upsert(p,{runId:N,status:_,title:w.workflowId?`workflow: ${String(w.workflowId)}`:void 0,totalPhases:Number(w.totalNodes||0),completedPhases:Number(w.completedNodes||0),lastEventType:"workflow_status",error:w.error?String(w.error):void 0}),["COMPLETED","FAILED","ERROR","CANCELLED","CANCELED","PAUSED"].includes(_)&&T.recordEvent(p,{type:"workflow_status",source:"workflow",title:`Workflow ${_}`,message:w.output?String(w.output).slice(0,200):w.error?String(w.error):void 0,status:_==="COMPLETED"?"completed":"failed",runId:N,data:w})},[s]),u=O.useCallback(m=>{var w;const b=a.getState().messagesBySession[m]||[],x=b[b.length-1];return(w=x==null?void 0:x.steps)==null?void 0:w[x.steps.length-1]},[a]),d=O.useCallback((m,p,b)=>{const x=u(m),w=p==="step_complete",_=x&&(x.status==="success"||x.status==="error");if(!x||_&&!w){const T=(b==null?void 0:b.step)||p.replace("step_","").replace("_"," ");return a.getState().addStep(m,{id:`step-${Date.now()}`,title:T,description:(b==null?void 0:b.description)||"Executing...",status:"running",timestamp:Date.now()}),u(m)}return x},[u,a]),h=O.useCallback(m=>{var w,_;const p=m.type,b=m.data;if(p==="model_name"){kp(p,b,m.sessionId||"",{activeTab:n,setLogs:e,setUnreadLogs:t},m);return}if(p==="models_updated"||p==="models.updated"){window.dispatchEvent(new CustomEvent("models-updated"));return}if(p==="workspace_changed"){kp(p,b,m.sessionId||"",{activeTab:n,setLogs:e,setUnreadLogs:t});return}if(p==="question_answer_ack"){const T=s(b),N=T==null?void 0:T.questionId;if(N){const E=window;E.__answeredQuestionIds=E.__answeredQuestionIds||new Set,E.__answeredQuestionIds.add(N);const B=E.__pendingQuestions||{};for(const L of Object.keys(B))((w=B[L])==null?void 0:w.questionId)===N&&delete B[L];((_=E.__pendingQuestion)==null?void 0:_.questionId)===N&&(E.__pendingQuestion=null)}window.dispatchEvent(new CustomEvent("ask-question-dismiss",{detail:T==null?void 0:T.questionId}));return}const x=m.sessionId||"";if(!x){if(p==="task_update"||p==="task_finished"||p==="task_error"){const T=s(b);T&&typeof T.sessionId=="string"&&T.sessionId&&_p(b,T.sessionId)}return}if(p==="hook_ask"){lj(b,x);return}if(p==="ask_user_question"){dj(b,x);return}if(p==="task_update"){_p(b,x);return}if(p==="task_output"){try{a.getState().appendToLastMessage(x,String(b||""))}catch{}return}if(p==="task_finished"||p==="task_error"){p==="task_error"?vr.error("Task error",String(b)):_p(b,x);return}if(p==="filejob_start"||p==="filejob_progress"||p==="filejob_result"||p==="filejob_error"){hj(p,b,x);return}if(p.startsWith("step_")){cj(p,b,x,d);return}if(p.startsWith("plan_")){try{y3(p,b,x)}catch(T){vr.error(`Failed to handle ${p}`,String(T))}return}if(p.startsWith("goal_")){try{y3(p,b,x)}catch(T){vr.error(`Failed to handle ${p}`,String(T))}return}if(p==="todo_update"){uj(b,x);return}if(p==="todo_item_done"){fj(b,x);return}if(p!=="todo_progress"){if(p==="automation.update"){C3.automationUpdate(b);return}if(p==="automation.run"){C3.automationRun(b);return}if(p!=="tool.approval_required"){if(["workflow_started","workflow_event","workflow_progress","workflow_finished","workflow_error","workflow_checkpoint","workflow_node_start","workflow_node_complete","workflow_paused","workflow_resumed","workflow_cancelled","workflow_handoff","workflow_plan_ready","workflow_confirm_ack","workflow_recovered"].includes(p)){o(p,b,x,m.runId);return}if(p==="workflow_status"){l(b,x);return}if(pj.includes(p)){sj(p,b,x,m.nodeId);return}if(p==="channel_status"){try{const T=JSON.parse(b||"{}");mj.getState().updateChannelStatus(T)}catch{}return}if(p==="channel_message"||p==="channel_error"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.channel||T.platform||"Channel";if(p==="channel_error")Ze.error(`${N}: ${T.error||T.message||"channel error"}`);else{const E=T.from||T.sender||"",B=T.text||T.content||T.message||"";B&&Ze.info(`📨 ${N}${E?` · ${E}`:""}: ${String(B).slice(0,120)}`)}}catch{}return}if(p==="session_switched"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.id||T.sessionId||(typeof b=="string"?b:"");N&&Ke.getState().setActiveSession(String(N))}catch{}return}if(p==="task_interrupted"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.title||T.taskId||"Task";Ze.warning(`⏸ ${N} interrupted — 使用 /continue 恢复生成`,1e4)}catch{Ze.warning("A running task was interrupted",1e4)}return}if(p==="code_review_ready"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.title||T.skillId||"Code Review",E=T.summary||"";Ze.success(`🔍 ${N} ready${E?`: ${String(E).slice(0,120)}`:""}`,8e3)}catch{Ze.success("🔍 Code review ready",8e3)}return}if(p==="hook_auto_ack"){try{const T=typeof b=="string"?JSON.parse(b):b||{};Ze.info(`Hook auto-approved: ${T.tool||T.name||"tool"}`,4e3)}catch{}return}if(p==="throttle"){try{const T=typeof b=="string"?JSON.parse(b):b||{},N=T.limit||T.remaining!=null?` (${T.remaining} left)`:"";Ze.warning(`⚠ Rate limited${N}`,6e3)}catch{}return}if(["token_update","context_breakdown","auth_required","auth_success","auth_failed","log","commands_list","ping","degradation_update","doctor_result","session_created","session_resumed","mcp_update","hook_response_ack","notification"].includes(p)){kp(p,b,x,{activeTab:n,setLogs:e,setUnreadLogs:t});return}}}},[n,d,o,l,s,e,t]);O.useEffect(()=>{Oe.connect();const m=Oe.onMessage(h),p=Oe.onClose(()=>{const x=Ue.getState();for(const w of x.generatingSessions)x.endGeneration(w,"WebSocket disconnected")}),b=Oe.onOpen(()=>{var w;const x=((w=Oe.getSessionId)==null?void 0:w.call(Oe))||Ke.getState().activeSessionId;if(x){Oe.send({type:"get_workflow_status",sessionId:x,data:JSON.stringify({sessionId:x})});const _=Zo.getState().mode;Oe.send({type:"plan_mode_change",sessionId:x,data:JSON.stringify({mode:_})})}});return()=>{m(),p(),b()}},[h])}const Pc={linear:{id:"linear",nameKey:"settings.themePresetLinear",descriptionKey:"settings.themePresetLinearDesc",dark:{bg:"#0a0a0c",surface:"#121215",border:"#26262b",text:"#e4e4e7",muted:"#8e8e96",accentBlue:"#7c83f8",accentGreen:"#4ade80",accentRed:"#f87171",accentYellow:"#fbbf24",accentPurple:"#c084fc"},light:{bg:"#ffffff",surface:"#f6f6f7",border:"#e4e4e8",text:"#18181b",muted:"#71717a",accentBlue:"#5e6ad2",accentGreen:"#16a34a",accentRed:"#dc2626",accentYellow:"#b45309",accentPurple:"#7c3aed"}},mimo:{id:"mimo",nameKey:"settings.themePresetMimo",descriptionKey:"settings.themePresetMimoDesc",dark:{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"},light:{bg:"#ffffff",surface:"#f8f4ef",border:"#e2d8cd",text:"#24221c",muted:"#605b52",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"}},github:{id:"github",nameKey:"settings.themePresetGithub",descriptionKey:"settings.themePresetGithubDesc",dark:{bg:"#0d1117",surface:"#161b22",border:"#30363d",text:"#c9d1d9",muted:"#8b949e",accentBlue:"#58a6ff",accentGreen:"#238636",accentRed:"#f85149",accentYellow:"#d29922",accentPurple:"#a855f7"},light:{bg:"#ffffff",surface:"#f6f8fa",border:"#d0d7de",text:"#24292f",muted:"#57606a",accentBlue:"#0969da",accentGreen:"#1a7f37",accentRed:"#cf222e",accentYellow:"#9a6700",accentPurple:"#8250df"}},cherry:{id:"cherry",nameKey:"settings.themePresetCherry",descriptionKey:"settings.themePresetCherryDesc",dark:{bg:"#0f1419",surface:"#1a2332",border:"#2d3f50",text:"#e1e8ed",muted:"#8899aa",accentBlue:"#01a9ff",accentGreen:"#00c853",accentRed:"#ff5252",accentYellow:"#ffab00",accentPurple:"#7c4dff"},light:{bg:"#f5f9ff",surface:"#ffffff",border:"#cce0ff",text:"#1a2332",muted:"#5c6f87",accentBlue:"#0160ff",accentGreen:"#00a844",accentRed:"#e53935",accentYellow:"#f9a825",accentPurple:"#651fff"}},ocean:{id:"ocean",nameKey:"settings.themePresetOcean",descriptionKey:"settings.themePresetOceanDesc",dark:{bg:"#0b1e2e",surface:"#122b3d",border:"#1e4057",text:"#d4e6f5",muted:"#7a9bb5",accentBlue:"#00bcd4",accentGreen:"#26a69a",accentRed:"#ef5350",accentYellow:"#ffca28",accentPurple:"#ab47bc"},light:{bg:"#edf7fc",surface:"#ffffff",border:"#b3d9e8",text:"#0b1e2e",muted:"#4f7a94",accentBlue:"#00838f",accentGreen:"#00897b",accentRed:"#d32f2f",accentYellow:"#f57f17",accentPurple:"#8e24aa"}},mint:{id:"mint",nameKey:"settings.themePresetMint",descriptionKey:"settings.themePresetMintDesc",dark:{bg:"#0d1f1c",surface:"#162d28",border:"#264b41",text:"#d1f0e8",muted:"#7dafa3",accentBlue:"#26c6da",accentGreen:"#66bb6a",accentRed:"#ef5350",accentYellow:"#ffd54f",accentPurple:"#ad8aff"},light:{bg:"#edf7f4",surface:"#ffffff",border:"#b8d9cf",text:"#0d1f1c",muted:"#4a7f72",accentBlue:"#0097a7",accentGreen:"#388e3c",accentRed:"#d32f2f",accentYellow:"#f9a825",accentPurple:"#7c4dff"}},lavender:{id:"lavender",nameKey:"settings.themePresetLavender",descriptionKey:"settings.themePresetLavenderDesc",dark:{bg:"#1a1428",surface:"#261f38",border:"#3c3354",text:"#e2daf2",muted:"#9387b5",accentBlue:"#86bef5",accentGreen:"#81c784",accentRed:"#ef9a9a",accentYellow:"#ffe082",accentPurple:"#ce93d8"},light:{bg:"#f5f0ff",surface:"#ffffff",border:"#d4c8e8",text:"#1a1428",muted:"#6c5b8a",accentBlue:"#1565c0",accentGreen:"#2e7d32",accentRed:"#c62828",accentYellow:"#f57f17",accentPurple:"#7b1fa2"}},midnight:{id:"midnight",nameKey:"settings.themePresetMidnight",descriptionKey:"settings.themePresetMidnightDesc",dark:{bg:"#0a0e1a",surface:"#111726",border:"#1e2740",text:"#c8d2e8",muted:"#6a7596",accentBlue:"#4fc3f7",accentGreen:"#4caf50",accentRed:"#e57373",accentYellow:"#ffd54f",accentPurple:"#b39ddb"},light:{bg:"#eef1f7",surface:"#ffffff",border:"#c0c9dc",text:"#0a0e1a",muted:"#4f5a78",accentBlue:"#0288d1",accentGreen:"#2e7d32",accentRed:"#d32f2f",accentYellow:"#f57f17",accentPurple:"#5e35b1"}},sunset:{id:"sunset",nameKey:"settings.themePresetSunset",descriptionKey:"settings.themePresetSunsetDesc",dark:{bg:"#1e1410",surface:"#2a1d16",border:"#443124",text:"#f0dfcf",muted:"#b8957a",accentBlue:"#5fa5e8",accentGreen:"#81c784",accentRed:"#ff7043",accentYellow:"#ffb74d",accentPurple:"#e0a0e0"},light:{bg:"#fff6f0",surface:"#ffffff",border:"#f0d5c0",text:"#2a1d16",muted:"#8a6e5a",accentBlue:"#1976d2",accentGreen:"#388e3c",accentRed:"#e64a19",accentYellow:"#ef6c00",accentPurple:"#8e24aa"}},forest:{id:"forest",nameKey:"settings.themePresetForest",descriptionKey:"settings.themePresetForestDesc",dark:{bg:"#0e1a12",surface:"#172a1d",border:"#2a4733",text:"#d1e8d6",muted:"#7da684",accentBlue:"#5bb8e8",accentGreen:"#66bb6a",accentRed:"#ef9a9a",accentYellow:"#e6c35c",accentPurple:"#ae8ad9"},light:{bg:"#f0f7f0",surface:"#ffffff",border:"#b8d9be",text:"#0e1a12",muted:"#477a50",accentBlue:"#1565c0",accentGreen:"#2e7d32",accentRed:"#c62828",accentYellow:"#827717",accentPurple:"#6a1b9a"}},candy:{id:"candy",nameKey:"settings.themePresetCandy",descriptionKey:"settings.themePresetCandyDesc",dark:{bg:"#16101a",surface:"#22182a",border:"#3d284a",text:"#f0def5",muted:"#b28dc2",accentBlue:"#5fc3f5",accentGreen:"#81e080",accentRed:"#ff6b6b",accentYellow:"#ffd93d",accentPurple:"#e066ff"},light:{bg:"#faf0ff",surface:"#ffffff",border:"#e0cce8",text:"#1a0a24",muted:"#7a5c8a",accentBlue:"#1976d2",accentGreen:"#388e3c",accentRed:"#d32f2f",accentYellow:"#f9a825",accentPurple:"#8e24aa"}},nord:{id:"nord",nameKey:"settings.themePresetNord",descriptionKey:"settings.themePresetNordDesc",dark:{bg:"#2e3440",surface:"#3b4252",border:"#4c566a",text:"#eceff4",muted:"#81a1c1",accentBlue:"#88c0d0",accentGreen:"#a3be8c",accentRed:"#bf616a",accentYellow:"#ebcb8b",accentPurple:"#b48ead"},light:{bg:"#f5f7fa",surface:"#ffffff",border:"#d8dee9",text:"#2e3440",muted:"#5e6d85",accentBlue:"#5e81ac",accentGreen:"#6f9e6f",accentRed:"#bf616a",accentYellow:"#b48d56",accentPurple:"#8f6f9e"}}},Vg="linear";function T3(n,e,t){const a=Pc[n]||Pc[Vg];if(!a)return{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"};const s={...e==="dark"?a.dark:a.light};return t&&Object.assign(s,t),s}const dr=n=>{const e=parseInt(n.slice(1,3),16),t=parseInt(n.slice(3,5),16),a=parseInt(n.slice(5,7),16);return`${e} ${t} ${a}`},vj=(n,e,t)=>{const a=[parseInt(n.slice(1,3),16),parseInt(n.slice(3,5),16),parseInt(n.slice(5,7),16)],s=[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)];return a.map((o,l)=>Math.round(o+((s[l]??o)-o)*t)).join(" ")};function A3(n,e,t,a,s){t.classList.toggle("dark",n==="dark"),t.classList.toggle("light",n==="light"),t.style.setProperty("--color-bg",dr(e.bg)),t.style.setProperty("--color-surface",dr(e.surface)),t.style.setProperty("--color-border",dr(e.border)),t.style.setProperty("--color-text",dr(e.text)),t.style.setProperty("--color-muted",dr(e.muted)),t.style.setProperty("--color-accent-blue",dr(e.accentBlue)),t.style.setProperty("--color-accent-green",dr(e.accentGreen)),t.style.setProperty("--color-accent-red",dr(e.accentRed)),t.style.setProperty("--color-accent-yellow",dr(e.accentYellow)),t.style.setProperty("--color-accent-purple",dr(e.accentPurple)),t.style.setProperty("--color-hover",vj(e.surface,e.text,.06)),a&&a.setAttribute("content",e.bg),s&&s.setAttribute("content",n)}function bj({theme:n,themePresetId:e,customTheme:t,customThemeEnabled:a}){O.useEffect(()=>{const s=document.documentElement,o=document.querySelector('meta[name="theme-color"]'),l=document.querySelector('meta[name="color-scheme"]'),u=n==="dark"?"dark":n==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",d=a?t:void 0,h=T3(e||Vg,u,d);if(A3(u,h,s,o,l),n==="auto"){const m=window.matchMedia("(prefers-color-scheme: dark)"),p=()=>{const b=m.matches?"dark":"light",x=T3(e||Vg,b,d);A3(b,x,s,o,l)};return m.addEventListener("change",p),()=>m.removeEventListener("change",p)}},[n,e,t,a])}function xj({message:n,onRetry:e}){const{t}=vt();return y.jsx("div",{className:"flex items-center justify-center h-full w-full bg-dark-bg",children:y.jsxs("div",{className:"max-w-md p-8 text-center",children:[y.jsx("div",{className:"flex justify-center mb-4",children:y.jsx("div",{className:"w-16 h-16 rounded-full bg-accent-red/10 flex items-center justify-center",children:y.jsx(Qg,{size:32,className:"text-accent-red"})})}),y.jsx("h2",{className:"text-xl font-semibold text-dark-text mb-2",children:t("error.pageError")}),y.jsx("p",{className:"text-sm text-dark-muted mb-6",children:n||t("error.unknownError")}),y.jsxs("div",{className:"flex items-center justify-center gap-3",children:[y.jsxs("button",{onClick:e,className:"flex items-center gap-2 px-4 py-2 bg-accent-blue text-white rounded-lg hover:opacity-90 transition-opacity",children:[y.jsx(j0,{size:16}),t("common.retry")]}),y.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-dark-hover text-dark-text rounded-lg hover:bg-dark-border transition-colors",children:t("error.refreshPage")})]})]})})}class E3 extends O.Component{constructor(t){super(t);V(this,"handleRetry",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,a){console.error("[ErrorBoundary] Caught error:",t,a)}render(){var t;return this.state.hasError?this.props.fallback?this.props.fallback:y.jsx(xj,{message:(t=this.state.error)==null?void 0:t.message,onRetry:this.handleRetry}):this.props.children}}const wj=10;function Sj(n,e=wj){return n.filter(t=>t&&!!t.id&&(t.messageCount??0)>0).sort((t,a)=>String(a.updatedAt||"").localeCompare(String(t.updatedAt||""))).slice(0,e).map(t=>{const a=new Date(t.createdAt).getTime()||Date.now(),s=new Date(t.updatedAt).getTime()||a;return{id:t.id,title:t.title||t.id,createdAt:a,lastActiveAt:s,messageCount:t.messageCount??0,...t.preview?{preview:t.preview}:{}}})}function N3(n,e){const t=(e==null?void 0:e.wan)??"万",a=(e==null?void 0:e.yi)??"亿";if(n>=1e8)return`${(n/1e8).toFixed(1)}${a}`;if(n>=1e4){const s=n/1e4;return`${s>=100?s.toFixed(0):s.toFixed(1)}${t}`}return String(Math.round(n))}function kj(n){return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}const _j=O.memo(function({open:e,onClose:t}){const{t:a}=vt(),s=rt(L=>L.currentUsage),o=rt(L=>L.maxContextTokens),l=rt(L=>L.contextBreakdown),u=rt(L=>L.cacheStats),d=rt(L=>L.estimateTokens),h=Ue(L=>L.messagesBySession),m=Ke(L=>L.activeSessionId),p=m?h[m]||[]:[];O.useEffect(()=>{if(!e)return;const L=j=>{j.key==="Escape"&&t()};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[e,t]);const b=O.useMemo(()=>{if(l)return null;let L=0,j=0;for(const F of p){let Y=F.content||"",ee="";if(F.thinking&&(Y+=" "+F.thinking),F.steps)for(const te of F.steps)te.thought&&(Y+=" "+te.thought),te.action&&(ee+=" "+te.action),te.result&&(ee+=" "+te.result);if(F.toolCalls)for(const te of F.toolCalls)ee+=" "+(typeof te.args=="string"?te.args:JSON.stringify(te.args));L+=d(Y),j+=d(ee)}return{messagesTokens:L,toolTokens:j,total:L+j}},[l,p,d]),w=O.useMemo(()=>{const L=l,j=L?L.messagesTokens:(b==null?void 0:b.messagesTokens)??0,F=L?L.toolContentTokens+L.toolDefTokens:(b==null?void 0:b.toolTokens)??0,Y=L?L.systemPromptTokens:0,ee=L?L.skillTokens:0,te=L?L.mcpToolTokens:0,xe=L?L.dynamicTokens:0,De=L?L.total:(b==null?void 0:b.total)??0,ce=Math.max(0,s.totalTokens-De)+xe,ie=Math.max(s.totalTokens,De,1);return[{key:"system",label:a("chat.ctxSystemPrompt"),tokens:Y,color:"bg-dark-text/70"},{key:"tools",label:a("chat.ctxSystemTools"),tokens:F,color:"bg-accent-purple"},{key:"mcp",label:a("chat.ctxMcpTools"),tokens:te,color:"bg-accent-cyan"},{key:"skills",label:a("chat.ctxSkills"),tokens:ee,color:"bg-accent-yellow"},{key:"messages",label:a("chat.ctxMessages"),tokens:j,color:"bg-accent-blue"},{key:"other",label:a("chat.ctxOther"),tokens:ce,color:"bg-dark-muted/60"}].map(pe=>({...pe,pct:pe.tokens/ie*100}))},[l,b,s.totalTokens,a]).filter(L=>L.pct>=.05||L.tokens>0),_=s.totalTokens,T=o>0?Math.min(100,_/o*100):0,N=T>=90?"bg-accent-red":T>=70?"bg-accent-yellow":"bg-dark-text/70",E=T>=90?"text-accent-red":T>=70?"text-accent-yellow":"text-dark-text",B=u&&u.cacheStatsCalls>0&&u.cacheHitRate!==void 0?u.cacheHitRate:null;return e?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]",onClick:t,"aria-hidden":"true"}),y.jsx("div",{className:"fixed inset-x-0 bottom-9 z-50 mx-auto max-w-lg px-2 pb-2",children:y.jsxs("div",{className:"animate-slide-up rounded-t-xl rounded-b-md border border-dark-border bg-dark-surface/95 backdrop-blur shadow-[0_-12px_40px_-10px_rgba(0,0,0,0.6)] overflow-hidden",children:[y.jsxs("div",{className:"flex items-center justify-between px-4 pt-3 pb-2",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(BS,{size:15,className:E}),y.jsx("span",{className:"text-sm font-semibold text-dark-text",children:a("chat.contextCapacity")})]}),y.jsx("button",{type:"button","aria-label":a("a11y.close"),onClick:t,className:"p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:y.jsx(xr,{size:15})})]}),y.jsxs("div",{className:"px-4 pb-1",children:[y.jsxs("div",{className:"flex items-baseline gap-2",children:[y.jsxs("span",{className:"text-xl font-bold font-mono text-dark-text",children:[N3(_,{wan:a("chat.unitWan"),yi:a("chat.unitYi")}),y.jsxs("span",{className:"text-dark-muted text-sm font-normal",children:[" / ",N3(o,{wan:a("chat.unitWan"),yi:a("chat.unitYi")})]})]}),y.jsxs("span",{className:`text-xs font-mono ${E}`,children:["(",T.toFixed(1),"%)"]})]}),y.jsx("div",{className:"mt-1.5 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:y.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${N}`,style:{width:`${T}%`}})})]}),y.jsxs("div",{className:"flex items-center justify-between px-4 pt-2 pb-1",children:[y.jsx("span",{className:"text-[11px] font-medium text-dark-muted",children:a("chat.categoryBreakdown")}),y.jsx("span",{className:"text-[10px] text-dark-muted/50 select-none",title:a("chat.assemblyOrderHint"),children:a("chat.byAssemblyOrder")})]}),y.jsx("div",{className:"px-4 pb-2 space-y-1.5",children:w.map(L=>y.jsxs("div",{"data-row-key":L.key,className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-[11px] text-dark-muted w-16 shrink-0",children:L.label}),y.jsx("div",{className:"flex-1 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:y.jsx("div",{className:`h-full ${L.color} rounded-full`,style:{width:`${Math.max(.5,L.pct)}%`}})}),y.jsx("span",{className:"text-[11px] font-mono text-dark-text w-12 text-right shrink-0",children:kj(L.pct)})]},L.key))}),y.jsxs("div",{className:"mx-4 mb-3 mt-1 flex items-center justify-between rounded-md bg-dark-bg/70 px-3 py-1.5",children:[y.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-dark-muted",children:[y.jsx(jS,{size:11}),a("chat.avgCacheHitRate")]}),B!==null?y.jsxs("span",{className:`text-[11px] font-mono font-semibold ${B>=.5?"text-accent-green":"text-accent-yellow"}`,children:[(B*100).toFixed(0),"%"]}):y.jsx("span",{className:"text-[11px] font-mono text-dark-muted/60",children:"–"})]})]})})]}):null});function q7(n){const e=n.trim();if(!e)return{model:""};const t=e.indexOf("/"),a=e.indexOf(":"),s=t>=0&&(a<0||t<a)?t:a;if(s>0){const o=e.slice(0,s).trim(),l=e.slice(s+1).trim();if(o&&l)return{provider:o,model:l}}return{model:e}}function rI(n){return q7(n).provider??""}function Cj(n,e){const t=q7(e),a=n||t.model;return t.provider&&a?`${t.provider} · ${a}`:a}function sI(n){const e=new Map;for(const t of n){const a=t.provider||"default",s=e.get(a);s?s.push(t):e.set(a,[t])}return Array.from(e.entries())}const Tj=O.memo(function(e){const{t}=vt(),a=rt(be=>be.currentUsage),s=rt(be=>be.maxContextTokens),o=rt(be=>be.model),l=rt(be=>be.modelRef),u=rt(be=>be.modelSource),d=rt(be=>be.tokenRate),h=rt(be=>be.compactingUntil),m=rt(be=>be.lastCompactInfo),p=rt(be=>be.degradation),b=rt(be=>be.compactionProgress),x=rt(be=>be.cacheStats),w=Ke(be=>be.activeSessionId),_=Ue(be=>w?be.isGenerating(w):!1),T=wt(be=>w?be.bySession[w]:void 0),N=wt(be=>w?be.getRunningAgentCount(w):0),E=Zo(be=>be.mode),B=ns(be=>be.autoMode),[L,j]=O.useState(0),F=O.useRef(0),[Y,ee]=O.useState(!1),[te,xe]=O.useState(null);O.useEffect(()=>{const be=Oe.onReconnectAttempt((Re,lt)=>xe({attempt:Re,max:lt})),Ve=Oe.onReconnectSuccess(()=>xe(null)),We=Oe.onReconnectGiveUp(()=>xe(null)),ze=Oe.onOpen(()=>xe(null));return()=>{be(),Ve(),We(),ze()}},[]),O.useEffect(()=>{if(_&&!F.current&&(F.current=Date.now()),!_){F.current=0,j(0);return}const be=setInterval(()=>j(Math.floor((Date.now()-F.current)/1e3)),1e3);return()=>clearInterval(be)},[_]);const De=a.totalTokens,ce=s>0?Math.min(100,Math.round(a.totalTokens/s*100)):0,ie=t9(d),pe=E==="normal"?"act":E,we=J_[pe],q=Cj(o,l),oe=Ia(pe),ge=oe==="plan"?"brand":oe==="goal"?"purple":"green";return y.jsxs("div",{className:"h-9 border-t border-dark-border bg-dark-bg flex items-center px-3 gap-2 shrink-0 select-none text-xs overflow-hidden",children:[y.jsx("span",{className:"font-semibold text-dark-text whitespace-nowrap",children:"DeepSeekCode"}),y.jsx("span",{className:"status-pill","data-tone":ge,children:we.label}),B&&y.jsx("span",{className:"status-pill","data-tone":"yellow",children:"Auto"}),te&&y.jsxs("span",{className:"status-pill","data-tone":"yellow",title:t("reconnect.hint"),"data-testid":"reconnect-pill",children:[y.jsx(j0,{size:10,className:"animate-spin"}),t("reconnect.reconnecting",{attempt:te.attempt,max:te.max})]}),y.jsx("span",{className:"text-dark-muted truncate max-w-[14rem]",title:q||void 0,children:q||t("common.connecting")}),u==="session"&&y.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-purple/20 text-accent-purple whitespace-nowrap",title:t("chat.sessionModelTitle"),children:t("chat.sessionModel")}),y.jsxs("span",{className:"inline-flex items-center text-[11px] whitespace-nowrap shrink-0",title:x&&x.cacheStatsCalls>0?t("chat.cacheHitTitle",{hit:pc(x.cacheHitTokens),miss:pc(x.cacheMissTokens),calls:x.cacheStatsCalls}):t(_?"chat.cacheWaitingRun":"chat.cacheNoStats"),children:[y.jsx("span",{className:"text-dark-muted",children:"cache"})," ",x&&x.cacheStatsCalls>0?y.jsx("span",{className:x.cacheHitRate!==void 0&&x.cacheHitRate>=.5?"text-accent-green":"text-accent-yellow",children:x.cacheHitRate!==void 0?`${(x.cacheHitRate*100).toFixed(0)}%`:"n/a"}):_?y.jsx("span",{className:"text-dark-muted/60",children:"–"}):y.jsx("span",{className:"text-dark-muted/60",children:"n/a"})]}),y.jsxs("button",{type:"button",onClick:()=>ee(!0),title:t("chat.viewContextDetail"),className:"group inline-flex items-center gap-1.5 shrink-0 -mx-1 px-1 rounded transition-colors cursor-pointer hover:bg-dark-hover/60",children:[y.jsxs("span",{className:"hidden md:inline-flex items-center gap-1 text-dark-muted whitespace-nowrap",children:[y.jsx("span",{className:"text-dark-text",children:pc(De)}),y.jsx("span",{className:"text-dark-muted/60",children:"/"}),y.jsx("span",{children:pc(s)})]}),y.jsxs("span",{className:"inline-flex items-center gap-1",children:[y.jsx("span",{className:"w-16 lg:w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden inline-flex",children:y.jsx("span",{className:`h-full transition-all rounded-full ${ce>=90?"bg-accent-red":ce>=70?"bg-accent-yellow":"bg-dark-text/70"}`,style:{width:`${ce}%`}})}),y.jsxs("span",{className:ce>=90?"text-accent-red font-bold":ce>=70?"text-accent-yellow":"",children:[ce,"%"]})]}),y.jsx(PS,{size:12,className:"text-dark-muted/50 group-hover:text-dark-text transition-colors"})]}),_&&y.jsxs(y.Fragment,{children:[y.jsxs("span",{className:"text-dark-text flex items-center gap-1 whitespace-nowrap",children:[y.jsx(Ga,{size:12,className:"animate-spin"}),gx(L)]}),ie&&y.jsx("span",{className:"text-accent-purple whitespace-nowrap",children:ie})]}),N>0&&y.jsxs("span",{className:"text-dark-text whitespace-nowrap",children:[N," agent",N>1?"s":""]}),y.jsx("div",{className:"flex-1"}),T&&y.jsxs("span",{className:"hidden xl:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[y.jsx("span",{className:"text-dark-muted",children:"wf"}),y.jsx("span",{className:"font-mono",children:T.status}),y.jsxs("span",{children:[T.completedPhases,"/",T.totalPhases||0]}),y.jsx("span",{className:"text-dark-muted",children:pc(T.tokensUsed)})]}),b&&y.jsxs("span",{className:"hidden lg:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[y.jsx("span",{children:"compact"}),y.jsxs("span",{children:[b.percent,"%"]}),y.jsx("span",{className:"w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:y.jsx("span",{className:"h-full bg-dark-text/70 rounded-full block",style:{width:`${b.percent}%`}})})]}),!b&&Date.now()<h&&m&&y.jsxs("span",{className:"hidden lg:inline text-dark-muted text-[11px] whitespace-nowrap",children:[m.originalCount," ","->"," ",m.compressedCount]}),(p==null?void 0:p.active)&&y.jsxs("span",{className:"text-accent-yellow text-[11px] whitespace-nowrap",children:[p.label," ",p.retryCount>0?`${p.retryCount}/${p.maxRetries}`:""]}),y.jsx(_j,{open:Y,onClose:()=>ee(!1)})]})}),Aj=O.memo(function({sessionId:e}){const{t}=vt(),a=Ue(x=>{if(!e)return;const w=x.messagesBySession[e]??[];for(let _=w.length-1;_>=0;_--){const T=w[_];if(T&&T.type==="assistant")return T.id}}),s=Zn(x=>ZD(x,e)),o=Zn(x=>XD(x,e,a)),l=Ue(x=>{if(!e)return;const w=x.messagesBySession[e]??[];for(let _=w.length-1;_>=0;_--){const T=w[_];if(T&&T.type==="user")return T.content}}),u=Ue(x=>e?x.generatingSessions.includes(e):!1),d=wt(x=>e?x.getForSession(e):void 0),h=o||(l?l.replace(/\s+/g," ").trim().slice(0,20):void 0),m=O.useMemo(()=>{const x=d==null?void 0:d.nodes;if(!x)return;const w=x.find(_=>_.status==="pending"||_.status==="scheduled"||_.status==="running");return w==null?void 0:w.title},[d==null?void 0:d.nodes]);if(!e||!h&&!s&&!m&&!u)return null;const p=(s==null?void 0:s.status)==="waiting_user"?"text-accent-yellow":(s==null?void 0:s.status)==="blocked"?"text-accent-red":(s==null?void 0:s.status)==="paused"?"text-dark-300":(s==null?void 0:s.status)==="failed"?"text-accent-red":"text-accent-blue",b=(s==null?void 0:s.status)==="waiting_user"?"bg-accent-yellow":(s==null?void 0:s.status)==="blocked"?"bg-accent-red":(s==null?void 0:s.status)==="paused"?"bg-dark-300":(s==null?void 0:s.status)==="failed"?"bg-accent-red":(s==null?void 0:s.status)==="running"?"bg-accent-blue animate-pulse":"bg-accent-blue";return y.jsxs("div",{className:"h-7 shrink-0 flex items-center gap-2.5 px-3 border-b border-dark-border bg-dark-bg/80 text-[11px] select-none","data-testid":"task-status-bar",children:[h&&y.jsx("span",{className:"min-w-0 truncate font-medium text-dark-text","data-testid":"taskbar-title",children:h}),s&&y.jsxs("span",{title:(s==null?void 0:s.status)==="blocked"?s.blockedReason:void 0,className:`flex min-w-0 items-center gap-1.5 shrink-0 ${p}`,"data-testid":"taskbar-current",children:[y.jsx("span",{className:`inline-block w-1.5 h-1.5 shrink-0 rounded-full ${b}`}),y.jsx("span",{className:"truncate max-w-[18rem]",children:s.title})]}),m&&y.jsxs("span",{className:"shrink-0 min-w-0 truncate text-dark-muted","data-testid":"taskbar-next",children:[t("taskbar.next"),": ",m]}),!s&&u&&y.jsxs("span",{className:"shrink-0 text-dark-muted",children:[t("chat.thinking"),"…"]})]})}),Ja=mn()((n,e)=>({status:null,branches:null,loading:!1,refreshing:!1,lastAction:null,busy:!1,refreshStatus:async()=>{const t=await ht.git.status();return t.success&&t.data?(n({status:t.data}),t.data):(n({status:{available:!1,error:t.error||"Failed to load git status"}}),null)},refreshBranches:async()=>{const t=await ht.git.branches();t.success&&t.data?n({branches:t.data}):n({branches:null})},refreshAll:async()=>{if(!e().refreshing){n({refreshing:!0,loading:e().status===null});try{await e().refreshStatus(),await e().refreshBranches()}finally{n({refreshing:!1,loading:!1})}}},commit:async t=>{n({busy:!0});const a=await ht.git.commit({message:t});return n({busy:!1,lastAction:a.success&&a.data?a.data:{ok:!1,error:a.error||"Commit failed"}}),e().refreshStatus(),e().lastAction},push:async()=>{n({busy:!0});const t=await ht.git.push();return n({busy:!1,lastAction:t.success&&t.data?t.data:{ok:!1,error:t.error||"Push failed"}}),e().refreshStatus(),e().lastAction},checkout:async t=>{n({busy:!0});const a=await ht.git.checkout(t);return n({busy:!1,lastAction:a.success&&a.data?a.data:{ok:!1,error:a.error||"Checkout failed"}}),e().refreshAll(),e().lastAction}})),Cp="dsc-git-commit-draft",Ej=O.memo(function(){const{t:e}=vt(),t=Ja(j=>j.status),a=Ja(j=>j.branches),s=Ja(j=>j.busy),o=Ja(j=>j.lastAction),l=qi(j=>j.workspaceDir),[u,d]=O.useState(!1),[h,m]=O.useState(""),[p,b]=O.useState(!1),[x,w]=O.useState(null),_=O.useRef(null);O.useEffect(()=>{Ja.getState().refreshAll();const j=setInterval(()=>{document.visibilityState==="visible"&&Ja.getState().refreshStatus()},3e4);return()=>clearInterval(j)},[]),O.useEffect(()=>{const j=localStorage.getItem(Cp);j&&m(j)},[]);const T=O.useCallback(async()=>{try{const j=await ht.git.prStatus();j.success&&w(j.data||{available:!1,message:""})}catch{}},[]);O.useEffect(()=>{T()},[T]),O.useEffect(()=>{if(!u)return;const j=F=>{_.current&&!_.current.contains(F.target)&&d(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[u]);const N=O.useCallback(async()=>{const j=h.trim();if(!j){Ze.warning(e("git.emptyCommitMsg"));return}const Y=await Ja.getState().commit(j);Y.ok?(Ze.success(e("git.commitSuccess")),b(!1),localStorage.removeItem(Cp),m("")):Ze.error(Y.error||e("git.commitFailed"))},[h,e]),E=O.useCallback(async()=>{const F=await Ja.getState().push();F.ok?Ze.success(e("git.pushSuccess")):Ze.error(F.error||e("git.pushFailed"))},[e]),B=O.useCallback(async j=>{const Y=await Ja.getState().checkout(j);Y.ok?Ze.success(e("git.checkoutSuccess",{branch:j})):Ze.error(Y.error||e("git.checkoutFailed"))},[e]),L=t&&t.available===!1;return y.jsxs("div",{ref:_,className:"relative",children:[y.jsxs("button",{onClick:()=>d(j=>!j),className:Wt("flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs transition-colors",u?"bg-dark-hover text-dark-text":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"),title:e("git.panelTitle"),"aria-expanded":u,children:[y.jsx(Ab,{size:13,className:Wt(L?"text-dark-muted/50":"text-accent-blue")}),y.jsx("span",{className:"max-w-[120px] truncate font-mono",children:L?e("git.noRepo"):(t==null?void 0:t.branch)||"—"}),(t==null?void 0:t.dirty)&&y.jsxs("span",{className:"hidden sm:flex items-center gap-1 text-[10px] font-mono tabular-nums",children:[y.jsxs("span",{className:"text-accent-green",children:["+",t.totalAdded??0]}),y.jsxs("span",{className:"text-accent-red",children:["−",t.totalRemoved??0]})]}),y.jsx(ti,{size:11,className:Wt("transition-transform",u&&"rotate-180")})]}),u&&y.jsxs("div",{className:"absolute right-0 top-full z-40 mt-1.5 w-[380px] max-w-[90vw] rounded-xl border border-dark-border bg-dark-surface shadow-2xl overflow-hidden",children:[y.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 border-b border-dark-border bg-dark-surface",children:[y.jsx(Ab,{size:14,className:"text-accent-blue"}),y.jsx("span",{className:"text-xs font-medium text-dark-text",children:e("git.panelTitle")}),y.jsx("div",{className:"flex-1"}),y.jsx("button",{onClick:()=>void Ja.getState().refreshAll(),className:"rounded p-1 text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",title:e("git.refresh"),children:y.jsx(j0,{size:12,className:Wt(Ja.getState().refreshing&&"animate-spin")})})]}),L?y.jsxs("div",{className:"px-3.5 py-4 text-center",children:[y.jsx(IS,{size:20,className:"mx-auto mb-2 text-dark-muted/50"}),y.jsx("div",{className:"text-xs text-dark-muted",children:e("git.notGitDesc")}),y.jsx("div",{className:"mt-1 text-[10px] font-mono text-dark-muted/60 break-all",children:l})]}):t?y.jsxs("div",{className:"p-3.5 space-y-3 max-h-[60vh] overflow-y-auto custom-scrollbar",children:[y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[y.jsx("span",{className:"text-[11px] text-dark-muted",children:e("git.changes")}),y.jsxs("span",{className:"text-[11px] font-mono tabular-nums",children:[y.jsxs("span",{className:"text-accent-green",children:["+",t.totalAdded??0]}),y.jsx("span",{className:"text-dark-muted/40",children:" / "}),y.jsxs("span",{className:"text-accent-red",children:["−",t.totalRemoved??0]})]})]}),y.jsxs("div",{className:"space-y-0.5 max-h-40 overflow-y-auto custom-scrollbar",children:[(t.changes||[]).slice(0,30).map(j=>y.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[y.jsx("span",{className:Wt("w-6 shrink-0 rounded px-1 text-center text-[9px]",j.status.includes("?")?"bg-accent-purple/15 text-accent-purple":j.status===j.status.toUpperCase()&&j.status.trim()?"bg-accent-green/15 text-accent-green":"bg-accent-yellow/15 text-accent-yellow"),children:j.status}),y.jsx("span",{className:"flex-1 truncate text-dark-text",children:j.path}),y.jsxs("span",{className:"shrink-0 text-[10px] tabular-nums text-dark-muted/60",children:[j.added>0&&y.jsxs("span",{className:"text-accent-green",children:["+",j.added]}),j.removed>0&&y.jsxs("span",{className:"text-accent-red",children:["−",j.removed]})]})]},j.path)),(t.changes||[]).length===0&&y.jsx("div",{className:"py-2 text-center text-[11px] text-dark-muted/60",children:e("git.clean")})]})]}),y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] text-dark-muted mb-1",children:e("git.branch")}),y.jsx("div",{className:"flex flex-wrap gap-1",children:((a==null?void 0:a.branches)||[t.branch||""]).slice(0,8).map(j=>y.jsx("button",{onClick:()=>j!==t.branch&&B(j),disabled:j===t.branch,className:Wt("rounded-md px-2 py-1 text-[11px] font-mono transition-colors",j===t.branch?"bg-accent-blue/10 text-accent-blue cursor-default":"bg-dark-bg border border-dark-border text-dark-muted hover:border-accent-blue/40 hover:text-dark-text"),children:j},j))}),(t.ahead??0)>0||(t.behind??0)>0?y.jsxs("div",{className:"mt-1 text-[10px] text-dark-muted/70",children:[(t.ahead??0)>0&&y.jsxs("span",{className:"text-accent-green",children:["↑ ",t.ahead," "]}),(t.behind??0)>0&&y.jsxs("span",{className:"text-accent-yellow",children:["↓ ",t.behind]}),e("git.upstream")]}):null]}),y.jsx("div",{children:p?y.jsxs("div",{className:"space-y-1.5",children:[y.jsx("textarea",{value:h,onChange:j=>{m(j.target.value),localStorage.setItem(Cp,j.target.value)},placeholder:e("git.commitPlaceholder"),rows:2,className:"w-full rounded-md border border-dark-border bg-dark-bg px-2.5 py-1.5 text-xs text-dark-text placeholder-dark-muted/50 resize-none focus:outline-none focus:border-accent-blue/50"}),y.jsxs("div",{className:"flex gap-1.5",children:[y.jsxs("button",{onClick:N,disabled:s||!h.trim(),className:"flex flex-1 items-center justify-center gap-1 rounded-md bg-accent-green/15 text-accent-green px-2.5 py-1.5 text-xs hover:bg-accent-green/25 transition-colors disabled:opacity-40",children:[s?y.jsx(Ga,{size:12,className:"animate-spin"}):y.jsx(Eb,{size:12}),e("git.commitConfirm")]}),y.jsx("button",{onClick:()=>b(!1),className:"rounded-md px-2.5 py-1.5 text-xs text-dark-muted hover:bg-dark-hover transition-colors",children:e("common.cancel")})]})]}):y.jsxs("div",{className:"flex gap-1.5",children:[y.jsxs("button",{onClick:()=>b(!0),disabled:s,className:"flex flex-1 items-center justify-center gap-1.5 rounded-md bg-accent-blue/10 text-accent-blue px-2.5 py-1.5 text-xs hover:bg-accent-blue/20 transition-colors disabled:opacity-50",children:[y.jsx(Eb,{size:13}),e("git.commit")]}),y.jsxs("button",{onClick:E,disabled:s||!t.dirty,className:"flex items-center justify-center gap-1.5 rounded-md bg-dark-bg border border-dark-border text-dark-muted px-2.5 py-1.5 text-xs hover:border-accent-green/40 hover:text-accent-green transition-colors disabled:opacity-40",children:[y.jsx(zS,{size:13}),e("git.push")]})]})}),y.jsxs("div",{className:"flex items-center gap-1.5 rounded-md bg-dark-bg border border-dark-border px-2.5 py-2",children:[y.jsx($S,{size:13,className:"text-accent-purple shrink-0"}),y.jsx("span",{className:"text-[11px] text-dark-muted truncate",children:x?x.available?e("git.prReady"):x.message||e("git.prUnavailable"):e("git.prLoading")})]}),y.jsxs("div",{className:"rounded-md bg-dark-bg border border-dark-border px-2.5 py-2 space-y-0.5",children:[y.jsx("div",{className:"text-[10px] text-dark-muted",children:e("git.environment")}),y.jsx("div",{className:"text-[11px] font-mono text-dark-text/80 break-all",children:l||"—"}),t.lastCommit&&y.jsxs("div",{className:"text-[10px] font-mono text-dark-muted/60 truncate",children:[t.lastCommit.hash.slice(0,7)," ",t.lastCommit.subject]})]}),o&&y.jsxs("div",{className:Wt("flex items-center gap-1.5 text-[11px]",o.ok?"text-accent-green":"text-accent-red"),children:[o.ok?y.jsx(I0,{size:12}):y.jsx(P0,{size:12}),y.jsx("span",{className:"truncate",children:o.ok?e("git.ok"):o.error||""})]})]}):y.jsx("div",{className:"px-3.5 py-4 text-center text-xs text-dark-muted",children:e("git.loading")})]})]})});function Nj({onOpenTemplates:n,onSaveAsTemplate:e,saveAsBusy:t}){const{t:a}=vt(),[s,o]=O.useState(!1),l=O.useRef(null);return O.useEffect(()=>{if(!s)return;const u=d=>{l.current&&!l.current.contains(d.target)&&o(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),y.jsxs("div",{ref:l,className:"relative",children:[y.jsx("button",{onClick:()=>o(u=>!u),className:"p-1.5 rounded-lg text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors",title:a("nav.moreOptions"),"aria-label":a("nav.moreOptions"),"aria-expanded":s,children:y.jsx(Lp,{size:16,"aria-hidden":"true"})}),s&&y.jsxs("div",{className:"absolute right-0 top-full z-40 mt-1.5 w-44 rounded-xl border border-dark-border bg-dark-surface shadow-2xl overflow-hidden py-1",children:[y.jsxs("button",{onClick:()=>{o(!1),n()},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors",children:[y.jsx(i0,{size:13,className:"text-dark-muted shrink-0"})," ",a("chat.templateLibrary")]}),y.jsxs("button",{onClick:()=>{o(!1),e()},disabled:t,className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors disabled:opacity-40",children:[t?y.jsx(Ga,{size:13,className:"animate-spin shrink-0"}):y.jsx(HS,{size:13,className:"text-dark-muted shrink-0"}),a("chat.saveAsTemplate")]})]})]})}const Mj={info:Q3,success:H3,warning:Qg,error:Zg},Rj={info:"text-accent-blue",success:"text-accent-green",warning:"text-accent-yellow",error:"text-accent-red"},Oj=O.memo(function(){const{toasts:e,dismissToast:t}=is();return e.length===0?null:y.jsx("div",{className:"fixed bottom-20 right-4 z-[100] flex flex-col gap-2 max-w-sm",children:e.slice(-3).map(a=>{const s=Mj[a.type];return y.jsxs("div",{className:"toast-card animate-fade-in-up",role:"status",children:[y.jsx(s,{size:16,className:`shrink-0 mt-0.5 ${Rj[a.type]}`}),y.jsxs("span",{className:"text-xs flex-1 text-dark-text leading-relaxed",children:[a.message,a.count>1&&y.jsxs("span",{className:"toast-card-count ml-1.5",children:["×",a.count]})]}),y.jsx("button",{onClick:()=>t(a.id),className:"shrink-0 p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":"Dismiss",children:y.jsx(xr,{size:12})})]},a.id)})})}),Dj={critical:{icon:US,text:"text-accent-red"},error:{icon:Zg,text:"text-accent-red"},warning:{icon:Qg,text:"text-accent-yellow"},info:{icon:Q3,text:"text-accent-blue"}},Lj={info:6e3,warning:1e4},Bj=O.memo(function(){const e=Ko(s=>s.errors),t=Ko(s=>s.dismiss),a=e.filter(s=>!s.dismissed);return O.useEffect(()=>{const s=a.filter(o=>!o.action).map(o=>{const l=o.durationMs??Lj[o.level];return l?setTimeout(()=>t(o.id),l):null}).filter(o=>o!==null);return()=>s.forEach(clearTimeout)},[a,t]),a.length===0?null:y.jsx("div",{className:"fixed bottom-4 right-4 z-[110] flex flex-col gap-2 max-w-sm",children:a.map(s=>{const o=Dj[s.level],l=o.icon;return y.jsx(jj,{entry:s,icon:l,config:o,onDismiss:()=>t(s.id)},s.id)})})});function jj({entry:n,icon:e,config:t,onDismiss:a}){const[s,o]=O.useState(!1);return y.jsxs("div",{className:"toast-card animate-fade-in-up",role:"alert",children:[y.jsx(e,{size:16,className:`shrink-0 mt-0.5 ${t.text}`}),y.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[y.jsxs("span",{className:`text-xs leading-relaxed ${t.text}`,children:[n.title,n.count!=null&&n.count>1&&y.jsxs("span",{className:"toast-card-count ml-1.5",children:["×",n.count]})]}),s&&n.detail&&y.jsx("div",{className:"mt-1.5 text-[11px] text-dark-muted whitespace-pre-wrap break-words leading-relaxed border-t border-dark-border/50 pt-1.5",children:n.detail}),n.action&&y.jsx("button",{onClick:n.action.onClick,className:"mt-1.5 self-start text-[11px] px-2 py-0.5 rounded-md bg-dark-hover hover:bg-dark-border transition-colors text-dark-text",children:n.action.label})]}),y.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[n.detail&&y.jsx("button",{onClick:()=>o(!s),className:"p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":s?"Collapse":"Expand",children:s?y.jsx(ti,{size:12}):y.jsx(Z3,{size:12})}),y.jsx("button",{onClick:a,className:"p-0.5 rounded text-dark-muted/70 hover:text-dark-text hover:bg-dark-hover/60 transition-colors","aria-label":"Dismiss",children:y.jsx(xr,{size:12})})]})]})}function Pj(n){const{t:e}=vt(),{setActiveTab:t,createNewSession:a,clearMessages:s,setTheme:o,setThemePreset:l,toggleTerminal:u,setLogs:d,setUnreadLogs:h}=n,m=O1(ie=>ie.backendCommands),p=Array.isArray(m)?m:[],[b,x]=O.useState(!1),[w,_]=O.useState(""),[T,N]=O.useState(0),E=O.useRef(null),B=O.useCallback((ie,pe)=>{const we=Ke.getState().activeSessionId;return we?(Oe.setSessionId(we),Oe.send({type:"command_execute",sessionId:we,data:JSON.stringify({command:`/${ie}`,args:pe||""})}),{success:!0,message:e("slashCommands.sent_command")+`/${ie}`}):{success:!1,message:e("slashCommands.noActiveSession")}},[e]),L=O.useMemo(()=>[{id:"chat",name:"chat",description:e("slashCommands.chat_desc"),icon:"💬",local:!0,action:()=>(t("chat"),{success:!0,message:e("slashCommands.chat_result")})},{id:"terminal",name:"terminal",description:e("slashCommands.terminal_desc"),icon:"💻",local:!0,action:()=>(t("terminal"),{success:!0,message:e("slashCommands.terminal_result")})},{id:"files",name:"files",description:e("slashCommands.files_desc"),icon:"📁",local:!0,action:()=>(t("files"),{success:!0,message:e("slashCommands.files_result")})},{id:"models",name:"models",description:e("slashCommands.models_desc"),icon:"🧠",local:!0,action:()=>(t("models"),{success:!0,message:e("slashCommands.models_result")})},{id:"tools",name:"tools",description:e("slashCommands.tools_desc"),icon:"🔧",local:!0,action:()=>(t("tools"),{success:!0,message:e("slashCommands.tools_result")})},{id:"skills",name:"skills",description:e("slashCommands.skills_desc"),icon:"🎯",local:!0,action:()=>(t("skills"),{success:!0,message:e("slashCommands.skills_result")})},{id:"settings",name:"settings",description:e("slashCommands.settings_desc"),icon:"⚙️",local:!0,action:()=>(t("settings"),{success:!0,message:e("slashCommands.settings_result")})},{id:"logs",name:"logs",description:e("slashCommands.logs_desc"),icon:"📜",local:!0,action:()=>(t("logs"),h(0),{success:!0,message:e("slashCommands.logs_result")})},{id:"new",name:"new",description:e("slashCommands.new_desc"),icon:"✨",local:!0,action:()=>(a(),{success:!0,message:e("slashCommands.new_result")})},{id:"clear",name:"clear",description:e("slashCommands.clear_desc"),icon:"🗑️",local:!0,action:()=>(s(),{success:!0,message:e("slashCommands.clear_result")})},{id:"theme",name:"theme",description:e("slashCommands.theme_desc"),args:"<dark|light|auto|preset-name>",icon:"🎨",local:!0,action:ie=>{const pe=ie.trim().toLowerCase();if(["dark","light","auto"].includes(pe))return o(pe),{success:!0,message:e("slashCommands.theme_result")+pe};if(Pc[pe])return l?(l(pe),{success:!0,message:e("slashCommands.theme_preset_result")+Pc[pe].nameKey}):{success:!1,message:e("slashCommands.theme_preset_unavailable")};const we=Object.keys(Pc).join("|");return{success:!1,message:e("slashCommands.theme_error",{presets:we})}}},{id:"terminal-toggle",name:"terminal-toggle",description:e("slashCommands.toggle_terminal_desc"),icon:"🔲",local:!0,action:()=>(u(),{success:!0,message:e("slashCommands.toggle_terminal_result")})},{id:"clear-logs",name:"clear-logs",description:e("slashCommands.logs_clear_desc"),icon:"📭",local:!0,action:()=>(d([]),h(0),{success:!0,message:e("slashCommands.logs_clear_result")})},{id:"doctor",name:"doctor",description:e("slashCommands.doctor_desc"),icon:"🩺",local:!1,action:()=>B("doctor")},{id:"compact",name:"compact",description:e("slashCommands.compact_desc"),args:"[aggressive|summary]",icon:"🗜️",local:!1,action:ie=>B("compact",ie)},{id:"help",name:"help",description:e("slashCommands.help_desc"),icon:"❓",local:!1,action:()=>B("help")},{id:"cost",name:"cost",description:e("slashCommands.token_desc"),args:"[detail|reset]",icon:"💰",local:!1,action:ie=>B("cost",ie)},{id:"model",name:"model",description:e("slashCommands.model_desc"),args:"[model-name]",icon:"🤖",local:!1,action:ie=>B("model",ie)},{id:"status",name:"status",description:e("slashCommands.status_desc"),icon:"📊",local:!1,action:()=>B("status")},{id:"config",name:"config",description:e("slashCommands.config_desc"),args:"<get|set|list|delete> [key] [value]",icon:"🔧",local:!1,action:ie=>B("config",ie)},{id:"exit",name:"exit",description:e("slashCommands.exit_desc"),icon:"🚪",local:!1,action:()=>{const ie=Ke.getState().activeSessionId;return ie&&(Oe.setSessionId(ie),Oe.send({type:"exit",sessionId:ie})),{success:!0,message:e("slashCommands.exit_result")}}},{id:"test",name:"test",description:e("slashCommands.benchmark_desc"),args:"[simple|medium|complex|full|list]",icon:"🧪",local:!1,action:ie=>B("test",ie)}],[t,a,s,o,l,u,d,h,B,e]),j=O.useMemo(()=>p.map(ie=>{const pe=e(`slashCommands.${ie.name}_desc`,ie.description||ie.usage||"");return{id:`backend-${ie.name}`,name:ie.name,description:pe,icon:"🔌",local:!1,action:we=>{const q=Ke.getState().activeSessionId;return q?(Oe.setSessionId(q),Oe.send({type:"command_execute",sessionId:q,data:JSON.stringify({command:`/${ie.name}`,args:we||""})}),{success:!0,message:e("slashCommands.sent_command")+`/${ie.name}`}):{success:!1,message:e("slashCommands.noActiveSession")}}}}),[p,e]),F=O.useMemo(()=>{const ie=new Set;return[...L,...j].filter(pe=>ie.has(pe.name)?!1:(ie.add(pe.name),!0))},[L,j]),Y=O.useMemo(()=>{if(!w)return F;const ie=w.toLowerCase();return F.filter(pe=>pe.name.toLowerCase().includes(ie)||pe.description.toLowerCase().includes(ie))},[F,w]),ee=O.useCallback(()=>{x(!0),_(""),N(0)},[]),te=O.useCallback(()=>{x(!1),_(""),N(0)},[]),xe=O.useCallback(()=>{N(ie=>ie>=Y.length-1?0:ie+1)},[Y.length]),De=O.useCallback(()=>{N(ie=>ie<=0?Y.length-1:ie-1)},[Y.length]),ce=O.useCallback((ie,pe)=>{const we=ie.action(pe);return te(),we},[te]);return O.useEffect(()=>{if(b&&E.current){const ie=E.current.querySelector(`[data-index="${T}"]`);ie&&ie.scrollIntoView({block:"nearest"})}},[T,b]),{isOpen:b,filter:w,setFilter:_,selectedIndex:T,setSelectedIndex:N,filteredCommands:Y,allCommands:F,openMenu:ee,closeMenu:te,selectNext:xe,selectPrev:De,executeCommand:ce,containerRef:E,commands:L}}function iI(n){const e=n.trim();if(!e.startsWith("/"))return null;const a=e.slice(1).split(/\s+/),s=a[0]||"",o=a.slice(1).join(" ");return{command:s,args:o}}function Ij({open:n,onClose:e,options:t}){const{t:a}=vt(),{filter:s,setFilter:o,filteredCommands:l,selectedIndex:u,setSelectedIndex:d,selectNext:h,selectPrev:m,executeCommand:p,openMenu:b,closeMenu:x}=Pj(t),w=O.useRef(null),_=O.useRef(null),[T,N]=O.useState(!1);if(O.useEffect(()=>{n?(b(),N(!1),setTimeout(()=>{var L;return(L=w.current)==null?void 0:L.focus()},0)):x()},[n,b,x]),O.useEffect(()=>{if(!n||!_.current)return;const L=_.current.querySelector(`[data-cmd-index="${u}"]`);L&&L.scrollIntoView({block:"nearest"})},[u,n]),!n)return null;const E=L=>{L.local||(N(!0),Ze.info(a("palette.running")));const j=p(L,"");L.local&&(j!=null&&j.message)&&Ze.success(j.message),e()},B=L=>{if(L.key==="ArrowDown")L.preventDefault(),h();else if(L.key==="ArrowUp")L.preventDefault(),m();else if(L.key==="Enter"){L.preventDefault();const j=l[u];j&&E(j)}else L.key==="Escape"&&(L.preventDefault(),e())};return y.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center bg-black/50 backdrop-blur-sm pt-[12vh] px-4 animate-fade-in",onClick:e,role:"dialog","aria-modal":"true","aria-label":a("a11y.commandPalette"),children:y.jsxs("div",{className:"w-full max-w-xl bg-dark-surface border border-dark-border rounded-xl shadow-2xl overflow-hidden",onClick:L=>L.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-dark-border",children:[y.jsx(X3,{size:16,className:"text-dark-muted shrink-0","aria-hidden":"true"}),y.jsx("input",{ref:w,value:s,onChange:L=>{o(L.target.value),d(0)},onKeyDown:B,placeholder:a("palette.placeholder"),"aria-label":a("palette.placeholder"),className:"flex-1 bg-transparent text-sm text-dark-text placeholder-dark-muted outline-none"}),T&&y.jsx("span",{className:"text-[10px] text-accent-blue animate-pulse-soft shrink-0",children:a("palette.running")})]}),y.jsx("div",{ref:_,className:"max-h-[50vh] overflow-y-auto custom-scrollbar py-1",children:l.length===0?y.jsx("div",{className:"px-4 py-8 text-center text-sm text-dark-muted",children:a("palette.empty")}):l.map((L,j)=>y.jsxs("button",{"data-cmd-index":j,onClick:()=>E(L),onMouseEnter:()=>d(j),className:`w-full px-4 py-2.5 flex items-center gap-3 text-left transition-colors ${j===u?"bg-accent-blue/10 border-l-2 border-accent-blue":"border-l-2 border-transparent hover:bg-dark-hover"}`,children:[y.jsx("span",{className:"text-lg shrink-0","aria-hidden":"true",children:L.icon}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("span",{className:"text-sm font-medium text-dark-text",children:["/",L.name]}),L.args&&y.jsx("span",{className:"text-xs text-dark-muted",children:L.args}),!L.local&&y.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-blue/20 text-accent-blue shrink-0",children:a("slashCommands.backend")})]}),y.jsx("div",{className:"text-xs text-dark-muted truncate",children:L.description})]}),j===u&&y.jsx(FS,{size:14,className:"text-dark-muted shrink-0","aria-hidden":"true"})]},L.id))}),y.jsx("div",{className:"px-4 py-2 border-t border-dark-border text-[10px] text-dark-muted bg-dark-bg",children:a("palette.hint")})]})})}function es({keys:n,label:e}){return y.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-dark-border/50 last:border-0",children:[y.jsx("span",{className:"text-sm text-dark-text",children:e}),y.jsx("span",{className:"flex items-center gap-1",children:n.map(t=>y.jsx("kbd",{className:"px-2 py-0.5 text-xs font-mono bg-dark-bg rounded border border-dark-border text-dark-muted",children:t},t))})]})}function zj({open:n,onClose:e}){const{t}=vt(),a=navigator.platform.toLowerCase().includes("mac")?"⌘":"Ctrl";return y.jsx(pf,{isOpen:n,onClose:e,title:t("shortcuts.title"),size:"md",children:y.jsxs("div",{className:"space-y-0.5",children:[y.jsx(es,{keys:[a,"K"],label:t("shortcuts.commandPalette")}),y.jsx(es,{keys:[a,"L"],label:t("shortcuts.clearLogs")}),y.jsx(es,{keys:[a,"/"],label:t("shortcuts.help")}),y.jsx(es,{keys:[a,"Enter"],label:t("shortcuts.submit")}),y.jsx(es,{keys:["Shift","Enter"],label:t("shortcuts.newline")}),y.jsx(es,{keys:["/"],label:t("shortcuts.slashCommand")}),y.jsx(es,{keys:["@"],label:t("shortcuts.fileRef")}),y.jsx(es,{keys:["Esc"],label:t("shortcuts.closeDialog")}),y.jsx(es,{keys:["Esc","Esc"],label:t("shortcuts.stopGen")})]})})}const V7=mn(n=>({isOpen:!1,entries:null,openWhatsNew:e=>n({isOpen:!0,entries:e??null}),closeWhatsNew:()=>n({isOpen:!1})}));function $j(){var u;const{t:n,i18n:e}=vt(),{isOpen:t,entries:a,closeWhatsNew:s}=V7(),o=a??v0,l=(u=e.language)!=null&&u.toLowerCase().startsWith("zh")?"zh":"en";return y.jsx(pf,{isOpen:t,onClose:s,title:y.jsxs("span",{className:"flex items-center gap-2",children:[y.jsx(J3,{className:"w-4 h-4 text-accent-yellow","aria-hidden":"true"}),n("whatsnew.title")]}),size:"2xl",children:y.jsx("div",{className:"space-y-6",children:o.map(d=>{const h=i9(d,l);return y.jsxs("section",{className:"space-y-2",children:[y.jsxs("header",{className:"flex items-baseline gap-3",children:[y.jsxs("h3",{className:"text-base font-semibold text-dark-text font-mono",children:["v",h.version]}),h.title&&y.jsx("span",{className:"text-sm text-dark-muted",children:h.title}),h.date&&y.jsx("span",{className:"text-xs text-dark-muted/60 ml-auto",children:h.date})]}),y.jsx("ul",{className:"space-y-1.5",children:h.items.map((m,p)=>y.jsxs("li",{className:"flex gap-2 text-sm text-dark-muted leading-relaxed",children:[y.jsx("span",{className:"text-accent-blue shrink-0 mt-0.5","aria-hidden":"true",children:"•"}),y.jsx("span",{children:m})]},p))})]},d.version)})})})}function Hj({isOpen:n,onClose:e,title:t,collapsedSummary:a,badge:s,children:o,maxHeight:l="45vh",onExpandedChange:u,className:d}){const{t:h}=vt(),[m,p]=O.useState(!0);O.useEffect(()=>{n&&p(!0)},[n]),O.useEffect(()=>{u==null||u(m)},[m,u]);const b=O.useCallback(()=>{p(x=>!x)},[]);return n?y.jsxs("div",{className:Wt("shrink-0 bg-dark-surface/95 backdrop-blur border-t border-dark-border shadow-[0_-10px_30px_-15px_rgba(0,0,0,0.5)]",d),children:[y.jsxs("div",{role:"button","aria-expanded":m,tabIndex:0,onClick:b,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),b())},title:h(m?"commonUi.drawerCollapseTitle":"commonUi.drawerExpandTitle"),className:Wt("flex items-center gap-2 px-4 py-2 cursor-pointer select-none transition-colors","hover:bg-dark-hover/60"),children:[y.jsx("span",{className:Wt("shrink-0 text-dark-muted transition-transform duration-200",!m&&"rotate-180"),children:y.jsx(ti,{size:16})}),y.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[y.jsx("span",{className:"text-sm font-semibold text-dark-text truncate",children:t}),s,!m&&a&&y.jsx("span",{className:"min-w-0 flex items-center gap-1.5 text-xs text-dark-muted truncate",children:a})]}),y.jsx("button",{type:"button","aria-label":h("common.close"),onClick:x=>{x.stopPropagation(),e()},className:"shrink-0 p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:y.jsx(xr,{size:15})})]}),m&&y.jsx("div",{className:"animate-slide-up border-t border-dark-border/60 overflow-y-auto custom-scrollbar p-4",style:{maxHeight:l},children:o})]}):null}const Uj=O.lazy(()=>D(()=>import("./ModelsView-C_hShQeY.js"),__vite__mapDeps([125,126,127,128,129,130])).then(n=>({default:n.ModelsView}))),Fj=O.lazy(()=>D(()=>import("./ToolsView-D3HqxE7K.js"),__vite__mapDeps([131,126,127,128,129,130])).then(n=>({default:n.ToolsView}))),Gj=O.lazy(()=>D(()=>import("./SkillsView-DqLfpF41.js"),__vite__mapDeps([132,126,127,128,129,130])).then(n=>({default:n.SkillsView}))),qj=O.lazy(()=>D(()=>import("./TemplatesTab-CQy-UXLH.js"),__vite__mapDeps([133,126,127,128,129,130])).then(n=>({default:n.TemplatesTab}))),Vj=O.lazy(()=>D(()=>import("./HookConfigView-DYF8WoqD.js"),__vite__mapDeps([134,126,127,129,128,130])).then(n=>({default:n.HookConfigView}))),Wj=O.lazy(()=>D(()=>import("./FileTreeView-BT45_XVy.js"),__vite__mapDeps([135,126,127,128,129,130])).then(n=>({default:n.FileTreeView}))),Kj=O.lazy(()=>D(()=>import("./TerminalView-DFjhMeyT.js"),__vite__mapDeps([136,126,127,137,128,129,130,138])).then(n=>({default:n.TerminalView}))),Yj=O.lazy(()=>D(()=>import("./SessionGrid-aZvfkGsH.js"),__vite__mapDeps([139,126,127,128,140,129,130,141])).then(n=>({default:n.SessionGrid}))),Zj=O.lazy(()=>D(()=>import("./SettingsPanel-DpXhjWLN.js"),__vite__mapDeps([142,126,127,140,128,129,130])).then(n=>({default:n.SettingsPanel}))),Xj=O.lazy(()=>D(()=>import("./ChannelConfigView-egYtlZj-.js"),__vite__mapDeps([143,126,127,128,129,130])).then(n=>({default:n.ChannelConfigView}))),Qj=O.lazy(()=>D(()=>import("./ConnectorsView-5Ii67NnU.js"),__vite__mapDeps([144,126,127,128,129,130])).then(n=>({default:n.ConnectorsView}))),Jj=O.lazy(()=>D(()=>import("./AutomationView-InguWZFs.js"),__vite__mapDeps([145,126,127,128,129,130])).then(n=>({default:n.AutomationView}))),eP=O.lazy(()=>D(()=>import("./PluginsView-CFAStd5I.js"),__vite__mapDeps([146,126,127,128,129,130])).then(n=>({default:n.PluginsView}))),tP=O.lazy(()=>D(()=>Promise.resolve().then(()=>TO),void 0).then(n=>({default:n.PluginTabContainer}))),nP=()=>y.jsx("div",{className:"flex-1 flex items-center justify-center bg-dark-bg",children:y.jsx("div",{className:"w-5 h-5 border-2 border-accent-blue border-t-transparent rounded-full animate-spin"})}),D1=[{id:"chat",labelKey:"nav.chat",icon:z0},{id:"terminal",labelKey:"nav.terminal",icon:GS},{id:"files",labelKey:"nav.files",icon:qS},{id:"models",labelKey:"nav.models",icon:VS},{id:"tools",labelKey:"nav.tools",icon:WS},{id:"skills",labelKey:"nav.skills",icon:J3},{id:"templates",labelKey:"nav.templates",icon:i0},{id:"hooks",labelKey:"nav.hooks",icon:KS},{id:"channels",labelKey:"nav.channels",icon:YS},{id:"connectors",labelKey:"nav.connectors",icon:ZS},{id:"scheduled",labelKey:"nav.scheduled",icon:XS},{id:"logs",labelKey:"nav.logs",icon:Ac},{id:"settings",labelKey:"nav.settings",icon:QS},{id:"plugins",labelKey:"nav.plugins",icon:ex}],Tp=Object.fromEntries(D1.map(n=>[n.id,n.labelKey])),aP=D1.map(n=>({id:n.id,title:n.labelKey})),M3=Object.fromEntries(D1.map(n=>[n.id,n.icon]));function rP(){const[n,e]=O.useState("chat"),[t,a]=O.useState(!1),[s,o]=O.useState([]),[,l]=O.useState(0),[u,d]=O.useState(!1),[h,m]=O.useState(!1),[p,b]=O.useState(!1),[x,w]=O.useState(null),[_,T]=O.useState(!1),[N,E]=O.useState(!1),[B,L]=O.useState({}),[j,F]=O.useState(!1),[Y,ee]=O.useState(null),[te,xe]=O.useState(!1),De=O.useRef(null),ce=O.useRef(null),[ie,pe]=O.useState(()=>localStorage.getItem("dsc-sidebar-collapsed")==="1"),we=O.useCallback(()=>{pe(U=>(localStorage.setItem("dsc-sidebar-collapsed",U?"0":"1"),!U))},[]),q=O.useCallback(()=>{F(U=>!U),xe(!1)},[]),oe=O.useCallback(()=>{const U=De.current;U&&(te?U.resize(ce.current??20):(ce.current=U.getSize(),U.resize(68)),xe(ne=>!ne))},[te]);O.useEffect(()=>{const U=window.matchMedia("(min-width: 1400px)"),ne=ue=>{ue.matches||F(!1)};return U.addEventListener("change",ne),()=>U.removeEventListener("change",ne)},[]),O.useEffect(()=>{try{const U=localStorage.getItem("dsc-seen-version"),ne=o9(U);if(ne.length>0){V7.getState().openWhatsNew(ne);const ue=l9();ue&&localStorage.setItem("dsc-seen-version",ue)}}catch{}},[]);const{t:ge,i18n:be}=vt(),{toggleTerminal:Ve}=h_(),{theme:We,setTheme:ze,setThemePreset:Re,language:lt,workspaceDir:kt,setWorkspaceDir:En,effort:an}=qi(),In=ns();O.useEffect(()=>{lt&&be.language!==lt&&be.changeLanguage(lt)},[lt,be]);const gn=O.useMemo(()=>aP.filter(U=>!(U.id==="terminal"&&x===!1)),[x]),[_a,Ca]=O.useState([]);O.useEffect(()=>{let U=!1;return Z.get("/api/plugins/ui").then(ne=>{var ue;U||Ca((((ue=ne==null?void 0:ne.data)==null?void 0:ue.ui)??[]).filter(Le=>Le.mount==="tab"))}).catch(()=>{}),()=>{U=!0}},[]);const Ta=U=>`plugin:${U.pluginId}:${U.id}`,la=O.useMemo(()=>[...gn.map(U=>({...U,iconComponent:M3[U.id]})),..._a.map(U=>({id:Ta(U),title:U.title,icon:U.icon,iconComponent:M3[U.icon??""]??ex}))],[gn,_a]),pt=O.useCallback(U=>{O.startTransition(()=>{e(U)})},[]),[fe,ct]=O.useState(null),Fe=O.useCallback(U=>{ct({section:U,nonce:Date.now()})},[]);O.useEffect(()=>{const U=ue=>{const Le=ue.message||ge("common.unknownError"),$e=ue.filename||"global";$e.includes("chrome-extension://")||$e.includes("moz-extension://")||o(gt=>[...gt,{id:`error-${Date.now()}-${yr()}`,level:"error",source:"Browser",message:`${ge("toast.uncaughtError")}${Le}`,timestamp:Date.now()}].slice(-500))},ne=ue=>{var $e;const Le=(($e=ue.reason)==null?void 0:$e.message)||ue.reason||ge("toast.unknownReason");o(gt=>[...gt,{id:`rejection-${Date.now()}-${yr()}`,level:"error",source:"Promise",message:`${ge("toast.uncaughtRejection")}${Le}`,timestamp:Date.now()}].slice(-500))};return window.addEventListener("error",U),window.addEventListener("unhandledrejection",ne),()=>{window.removeEventListener("error",U),window.removeEventListener("unhandledrejection",ne)}},[ge]);const{sessionTabs:Pe,activeSessionId:Ce,setActiveSession:Ge,addSessionTab:At,closeSessionTab:Jt,renameSessionTab:Ht,getVisibleSessionTabs:yt,autoNameSession:Nn,touchSession:rr}=Ke(),ps=Ce?B[Ce]??!0:!0,ca=wt(U=>Ce?Object.keys(U.tasksBySession[Ce]||{}).length:0),Ar=O.useCallback(()=>{L(U=>Ce?{...U,[Ce]:!(U[Ce]??!0)}:U)},[Ce]),[zn,gf]=O.useState(()=>typeof window<"u"&&window.innerWidth<768);O.useEffect(()=>{const U=window.matchMedia("(max-width: 767px)"),ne=ue=>gf(ue.matches);return U.addEventListener("change",ne),()=>U.removeEventListener("change",ne)},[]);const ua=wt(U=>Ce?U.getForSession(Ce):void 0),gs=O.useRef(null),$n=O.useRef(null);O.useEffect(()=>{if(zn)return;const U=ua&&["RUNNING","RESUMING","PAUSED"].includes(String(ua.status)),ne=ca>0;U&&ua&&gs.current!==ua.runId?(gs.current=ua.runId,F(!0)):ne&&$n.current!==Ce&&($n.current=Ce??null,F(!0))},[ua==null?void 0:ua.runId,ua==null?void 0:ua.status,ca,Ce,zn]);const da=Zn(U=>{var ne;return Ce?((ne=U.bySession[Ce])==null?void 0:ne.artifacts.length)??0:0}),Mn=O.useRef({sessionId:null,count:0});O.useEffect(()=>{const U=Mn.current;if(Ce!==U.sessionId){Mn.current={sessionId:Ce??null,count:da};return}!zn&&da>U.count&&F(!0),Mn.current={sessionId:Ce??null,count:Math.max(da,U.count)}},[da,Ce,zn]);const{clearMessages:ou}=Ue(),lu=Ue(U=>Ce?U.messagesBySession[Ce]||[]:[]),{customTheme:yf,customThemeEnabled:Zi,themePresetId:Xi}=qi();bj({theme:We,themePresetId:Xi,customTheme:yf,customThemeEnabled:Zi}),yj({activeTab:n,setLogs:o,setUnreadLogs:l}),O.useEffect(()=>{Z.get("/api/terminal/status").then(U=>w(U.success&&U.data?U.data.ttydAvailable!==!1:!1)).catch(()=>w(!1))},[]),O.useEffect(()=>{const U=ne=>{const ue=ne.detail,Le=typeof ue=="string"?ue:ue==null?void 0:ue.tab,$e=typeof ue=="string"||ue==null?void 0:ue.section;Le&&Le!==n&&pt(Le),Le==="settings"&&$e&&Fe($e)};return window.addEventListener("switch-tab",U),()=>window.removeEventListener("switch-tab",U)},[n,pt,Fe]),O.useEffect(()=>{const U=ne=>{var Le;const ue=(Le=ne.detail)==null?void 0:Le.path;ue&&(ee(ue),F(!0))};return window.addEventListener("preview-file",U),()=>window.removeEventListener("preview-file",U)},[]);const Er=O.useCallback(()=>{const U=window.location.hash.replace(/^#\/?/,"");if(!U)return;const[ne,ue]=U.split("/");ne&&ne in Tp&&pt(ne),ne==="settings"&&ue==="stt"&&Fe("stt")},[pt,Fe]);O.useEffect(()=>(Er(),window.addEventListener("hashchange",Er),()=>window.removeEventListener("hashchange",Er)),[Er]);const Wa=O.useRef(t);O.useEffect(()=>{const U=Oe.onOpen(()=>{Wa.current=!0,a(!0),Ze.success(ge("toast.backendConnected"))}),ne=Oe.onClose(()=>{const ue=Wa.current;Wa.current=!1,a(!1),ue&&Ze.warning(ge("toast.backendDisconnected"))});return()=>{U(),ne()}},[ge]);const Qi=O.useCallback(async()=>{try{const U=await ht.sessions.list();if(!U.success||!Array.isArray(U.data))return!1;const ne=Sj(U.data);if(ne.length===0)return!1;const ue=ne[0],Le=$e=>({id:$e.id,title:$e.title,createdAt:$e.createdAt,lastActiveAt:$e.lastActiveAt,preview:$e.preview,status:"done"});return Ke.setState($e=>{const gt=$e.sessionTabs.some(et=>et.id===ue.id)?$e.sessionTabs:[Le(ue),...$e.sessionTabs].slice(0,$p),Nt=new Set(gt.map(et=>et.id));let yn=[...ne.map(Le).filter(et=>!Nt.has(et.id)),...$e.historySessions.filter(et=>!ne.some(Hn=>Hn.id===et.id))].slice(0,Math.max(0,cx-gt.length));const Ot=[...ne.map(et=>({id:et.id,title:et.title,createdAt:new Date(et.createdAt).toISOString(),updatedAt:new Date(et.lastActiveAt??et.createdAt).toISOString(),messageCount:et.messageCount??0})),...$e.sessions.filter(et=>!ne.some(Hn=>Hn.id===et.id))];return{sessionTabs:gt,historySessions:yn,sessions:Ot,activeSessionId:ue.id}}),!0}catch{return!1}},[]);O.useEffect(()=>{if(Ke.getState().sessionTabs.length>0)return;let U=!1;return Qi().then(ne=>{U||ne||At(ge("chat.defaultSessionTitle",{n:1}))}),()=>{U=!0}},[]),O.useEffect(()=>{const U=()=>m(!0);return window.addEventListener("hook-approval-required",U),()=>window.removeEventListener("hook-approval-required",U)},[]);const ys=O.useRef(Ce);O.useEffect(()=>{ys.current=Ce},[Ce]);const Ji=O.useCallback(U=>{var Le,$e,gt;if(!U)return!1;const ne=window,ue=(Le=ne.__pendingQuestions)==null?void 0:Le[U];return ue?($e=ne.__answeredQuestionIds)!=null&&$e.has(ue.questionId)?(delete ne.__pendingQuestions[U],((gt=ne.__pendingQuestion)==null?void 0:gt.questionId)===ue.questionId&&(ne.__pendingQuestion=null),!1):(ne.__pendingQuestion=ue,b(!0),!0):!1},[]);O.useEffect(()=>{const U=ne=>{const ue=ne.detail||ys.current;Ji(ue)};return window.addEventListener("ask-question-required",U),()=>window.removeEventListener("ask-question-required",U)},[Ji]),O.useEffect(()=>{Ce&&Ji(Ce)},[Ce,Ji]);const cu=O.useCallback(()=>{var ue;const U=window,ne=U.__pendingQuestion;if(ne!=null&&ne.questionId){U.__answeredQuestionIds=U.__answeredQuestionIds||new Set,U.__answeredQuestionIds.add(ne.questionId);const Le=U.__pendingQuestions||{};for(const $e of Object.keys(Le))((ue=Le[$e])==null?void 0:ue.questionId)===ne.questionId&&delete Le[$e];U.__pendingQuestion=null}b(!1)},[]);O.useEffect(()=>{In.autoMode&&In.pendingApprovals.length>0&&m(!1),In.pendingApprovals.length>0&&!In.autoMode&&m(!0)},[In.autoMode,In.pendingApprovals.length]);const eo=O.useRef(0);O.useEffect(()=>{const U=ne=>{var Ot,et;if(ne.key!=="Escape"||ne.defaultPrevented)return;const ue=(Ot=ne.target)==null?void 0:Ot.tagName;if(ue==="INPUT"||ue==="TEXTAREA"||(et=ne.target)!=null&&et.isContentEditable)return;const Le=Ue.getState(),gt=Ke.getState().activeSessionId;if(!gt||!Le.isGenerating(gt))return;ne.preventDefault();const Nt=Date.now(),yn=eo.current;eo.current=Nt,yn>0&&Nt-yn<500?(Oe.send({type:"stop",sessionId:gt}),Ze.info(ge("toast.terminated"))):(Oe.send({type:"pause",sessionId:gt}),Ze.info(ge("toast.paused")))};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[ge]);const[Nr,uu]=O.useState(!1),Mr=O.useCallback(()=>{O.startTransition(()=>{const U=At(void 0,kt);Oe.setSessionId(U),Zo.getState().setMode("auto-act"),pt("chat")})},[At,kt,pt]),du=O.useCallback(U=>{O.startTransition(()=>{const ne=Ke.getState();let ue=ne.activeSessionId;ue||(ue=ne.addSessionTab(void 0,kt),Oe.setSessionId(ue)),Ue.getState().setSessionInput(ue,`$${U.id} `),pt("chat")})},[kt,pt]),to=O.useCallback(()=>pt("templates"),[pt]),ci=O.useCallback(async(U,ne)=>{var yn;const ue=await ht.templates.render(U.id,ne);if(!ue.success||!ue.data){Ze.error(ue.error||"模板渲染失败");return}const Le=ue.data,$e=At(U.name,kt);Oe.setSessionId($e),Zo.getState().setMode("auto-act"),pt("chat");const gt=`wf-${Date.now()}-${yr()}`;wt.getState().upsert($e,{runId:gt,status:"RUNNING",completedPhases:0,totalPhases:((yn=Le.nodes)==null?void 0:yn.length)??0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,lastEventType:"workflow_start"});const Nt=await ht.workflows.start({sessionId:$e,runId:gt,workflow:Le,message:`[模板] ${U.name}`});if(!Nt.success||!Nt.data){Ze.error(Nt.error||"工作流启动失败"),wt.getState().fail($e,gt,Nt.error||"启动失败");return}if(Nt.data.status==="FAILED"){const Ot=Nt.data.error||"模板定义无效";Ze.error(`工作流启动失败: ${Ot}`),wt.getState().fail($e,gt,Ot)}},[At,kt,pt]),gl=O.useCallback(async()=>{if(Nr||!Ce)return;const U=wt.getState().getForSession(Ce),ne=U==null?void 0:U.runId;if(!ne){Ze.info("当前会话没有可保存的工作流运行");return}uu(!0),Ze.info("正在泛化为模板…");try{const ue=await ht.templates.createFromRun(ne,{generalize:!0});ue.success&&ue.data?ue.data.degraded?Ze.warning(`已保存为模板「${ue.data.name}」(v${ue.data.version}),但 LLM 泛化失败,已原样保存${ue.data.degradeReason?`:${ue.data.degradeReason}`:""}`):Ze.success(`已保存为模板「${ue.data.name}」(v${ue.data.version})`):Ze.error(ue.error||"保存模板失败")}finally{uu(!1)}},[Ce,Nr]),yl=O.useRef(0),vl=O.useCallback(async U=>{if(!U)return;const ne=++yl.current;try{const ue=await ht.sessions.resume(U);if(ne!==yl.current||!ue.success||!ue.data)return;const Le=ue.data;Le.session&&Ke.getState().updateSession(U,Le.session);const $e=Le.messages||[];if($e.length>0){const gt=$e.flatMap(Ot=>Ot.type!=="user"&&Ot.type!=="assistant"&&Ot.type!=="system"?[]:[{id:Ot.id||`msg-${Ot.timestamp||Date.now()}`,type:Ot.type,content:Ot.content||"",timestamp:Ot.timestamp||Date.now(),thinking:Ot.thinking||void 0}]);Ue.getState().replaceMessages(U,gt);const Nt=$e.find(Ot=>Ot.type==="user"),yn=typeof(Nt==null?void 0:Nt.content)=="string"?Nt.content.replace(/\s+/g," ").trim():"";Ke.getState().touchSession(U,yn||void 0)}}catch{}},[]),Ka=O.useCallback(U=>{Ge(U),Oe.setSessionId(U)},[Ge]),rn=O.useCallback(U=>{Jt(U)},[Jt]),Rn=O.useCallback((U,ne)=>{Ht(U,ne)},[Ht]),sr=O.useCallback(()=>{Ce&&ou(Ce)},[Ce,ou]);O.useEffect(()=>{if(!Ce)return;const U=Ue.getState().messagesBySession[Ce];U&&U.length>0&&rt.getState().recalculateFromMessages(U)},[Ce]),O.useEffect(()=>{if(!Ce)return;Ue.getState().getMessages(Ce).length===0&&vl(Ce)},[Ce,vl]);const ui=O.useCallback(async(U,ne,ue,Le,$e)=>{if(!ne.trim())return;Ue.getState().isGenerating(U)&&(console.warn(`[sendMessage] Session ${U} stuck in generating state — force-ending`),Ue.getState().endGeneration(U,"Force-ended: new message"));const Nt=Zo.getState();Ue.getState().resumeGeneration(U),Oe.setSessionId(U),Ue.getState().getMessages(U).some(Aa=>Aa.type==="user")?rr(U):(Nn(U,ne.trim()),rr(U,ne.trim()));let et=ne.trim();if(ue&&ue.length>0){const Aa=[],hu=[...ue].sort((Ea,Or)=>Or.length-Ea.length);for(const Ea of hu){et=et.split(`@${Ea}`).join("").trim();try{const Or=await ht.files.read(Ea),Vn=Or.success&&Or.data?Or.data:null;if(Vn){const Sl=Ea.split(".").pop()||"";Aa.push(`<context ref="${Ea}">
477
477
  \`\`\`${Sl}
478
478
  ${Vn}
479
479
  \`\`\`