@deepseekcode/cli 1.0.22 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1077 -1211
- package/package.json +1 -1
- package/web/dist/assets/{AutomationView-Z7E_x8jk.js → AutomationView-BbLzZ7Db.js} +1 -1
- package/web/dist/assets/ChannelConfigView-CjcMwBSL.js +8 -0
- package/web/dist/assets/ConnectorsView-CTFoG0sF.js +1 -0
- package/web/dist/assets/{FileTreeView-6huCqCNC.js → FileTreeView-_N5eobgO.js} +1 -1
- package/web/dist/assets/{HookConfigView-BJ-VvTcl.js → HookConfigView-DM6IVFGm.js} +1 -1
- package/web/dist/assets/{ModelsView-DTfQ2XYb.js → ModelsView-CPm2WAbG.js} +2 -2
- package/web/dist/assets/PluginsView-D9pzIe-R.js +1 -0
- package/web/dist/assets/SessionGrid-C-Z-kzmG.js +35 -0
- package/web/dist/assets/SettingsPanel-D9kr-sFj.js +4 -0
- package/web/dist/assets/SkillsView-CS0XvZ4N.js +1 -0
- package/web/dist/assets/{TemplatesTab-M7MnMuN6.js → TemplatesTab-Pwfjxer7.js} +1 -1
- package/web/dist/assets/TerminalView-C__4-QSL.js +3 -0
- package/web/dist/assets/{ToolsView-DmzLnZ1I.js → ToolsView-Y5MpTnXY.js} +1 -1
- package/web/dist/assets/{icons-ZBQi-Ogj.js → icons-BXecaLRH.js} +114 -119
- package/web/dist/assets/index-CFxV9r1K.css +1 -0
- package/web/dist/assets/index-CcPIw0Dj.js +68 -0
- package/web/dist/assets/{markdown-4Q3UQbv9.js → markdown-BASfeONY.js} +1 -1
- package/web/dist/assets/{panels-CwhLUZOq.js → panels-Bod3sKnK.js} +1 -1
- package/web/dist/assets/{react-vendor-LdB92qnf.js → react-vendor-7At16BnY.js} +1 -1
- package/web/dist/assets/{state-4vIOJjS6.js → state-D4zgKwQs.js} +1 -1
- package/web/dist/index.html +7 -7
- package/web/dist/assets/AuditView-C8pvciLV.js +0 -1
- package/web/dist/assets/ChannelConfigView-2-i0ictg.js +0 -8
- package/web/dist/assets/ConnectorsView-CSGJfYer.js +0 -1
- package/web/dist/assets/InboxView-DXjF5APJ.js +0 -1
- package/web/dist/assets/PluginsView-CeIWhIfR.js +0 -1
- package/web/dist/assets/SessionGrid-BCsOMJRn.js +0 -29
- package/web/dist/assets/SettingsPanel-DkKIVWYT.js +0 -4
- package/web/dist/assets/SkillsView-CPT12zSi.js +0 -1
- package/web/dist/assets/TerminalView-j231tG2H.js +0 -3
- package/web/dist/assets/index-BWp0OZYm.css +0 -1
- package/web/dist/assets/index-sYOn5Yyn.js +0 -67
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsView-DTfQ2XYb.js","assets/markdown-4Q3UQbv9.js","assets/icons-ZBQi-Ogj.js","assets/react-vendor-LdB92qnf.js","assets/state-4vIOJjS6.js","assets/panels-CwhLUZOq.js","assets/ToolsView-DmzLnZ1I.js","assets/SkillsView-CPT12zSi.js","assets/TemplatesTab-M7MnMuN6.js","assets/HookConfigView-BJ-VvTcl.js","assets/FileTreeView-6huCqCNC.js","assets/TerminalView-j231tG2H.js","assets/terminal-DgJRGhIz.js","assets/TerminalView-C1Mzzh8g.css","assets/SessionGrid-BCsOMJRn.js","assets/SettingsPanel-DkKIVWYT.js","assets/ChannelConfigView-2-i0ictg.js","assets/ConnectorsView-CSGJfYer.js","assets/InboxView-DXjF5APJ.js","assets/AutomationView-Z7E_x8jk.js","assets/AuditView-C8pvciLV.js","assets/PluginsView-CeIWhIfR.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var Iv=Object.defineProperty;var Pv=(s,t,a)=>t in s?Iv(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a;var Ge=(s,t,a)=>Pv(s,typeof t!="symbol"?t+"":t,a);import{r as Gv,j as h,M as Fv,d as qv}from"./markdown-4Q3UQbv9.js";import{r as Vv,g as mf,a as _,F as Ci,C as Py,b as Gy,d as Ea,P as Wv,e as Kv,X as bs,L as Nn,f as Fy,h as gf,G as qy,i as Vy,S as Yv,j as yf,M as Zv,k as Xo,l as Jo,m as Wy,n as Qv,o as Ky,A as Xv,p as bf,q as Jv,s as e0,t as t0,u as Yy,v as n0,w as s0,x as a0,y as xf,E as xg,D as nl,z as $o,B as i0,H as ec,I as Io,J as Zy,K as Qy,N as r0,O as vg,Q as l0,T as o0,U as c0,V as wi,Y as u0,Z as vf,_ as d0,$ as f0,a0 as p0,a1 as Sg,a2 as h0,a3 as kg,a4 as m0,a5 as g0,a6 as y0,a7 as b0,a8 as Xy,a9 as x0,aa as v0,ab as S0,ac as k0,ad as w0,ae as _0,af as C0,ag as E0,ah as N0,ai as T0,aj as A0,ak as j0,al as R0,am as O0,an as M0,ao as B0,ap as D0,W as L0}from"./icons-ZBQi-Ogj.js";import{r as z0}from"./react-vendor-LdB92qnf.js";import{r as U0,c as Ut}from"./state-4vIOJjS6.js";import{P as Jy,a as Gd,b as eb}from"./panels-CwhLUZOq.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function a(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=a(o);fetch(o.href,c)}})();var md={exports:{}},Rr={},gd={exports:{}},yd={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* scheduler.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var wg;function H0(){return wg||(wg=1,(function(s){function t(H,Q){var ne=H.length;H.push(Q);e:for(;0<ne;){var Be=ne-1>>>1,Pe=H[Be];if(0<o(Pe,Q))H[Be]=Q,H[ne]=Pe,ne=Be;else break e}}function a(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var Q=H[0],ne=H.pop();if(ne!==Q){H[0]=ne;e:for(var Be=0,Pe=H.length,qe=Pe>>>1;Be<qe;){var X=2*(Be+1)-1,se=H[X],le=X+1,ae=H[le];if(0>o(se,ne))le<Pe&&0>o(ae,se)?(H[Be]=ae,H[le]=ne,Be=le):(H[Be]=se,H[X]=ne,Be=X);else if(le<Pe&&0>o(ae,ne))H[Be]=ae,H[le]=ne,Be=le;else break e}}return Q}function o(H,Q){var ne=H.sortIndex-Q.sortIndex;return ne!==0?ne:H.id-Q.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;s.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();s.unstable_now=function(){return u.now()-f}}var m=[],g=[],y=1,b=null,v=3,S=!1,k=!1,C=!1,E=!1,O=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function U(H){for(var Q=a(g);Q!==null;){if(Q.callback===null)r(g);else if(Q.startTime<=H)r(g),Q.sortIndex=Q.expirationTime,t(m,Q);else break;Q=a(g)}}function R(H){if(C=!1,U(H),!k)if(a(m)!==null)k=!0,K||(K=!0,de());else{var Q=a(g);Q!==null&&ve(R,Q.startTime-H)}}var K=!1,Z=-1,te=5,pe=-1;function he(){return E?!0:!(s.unstable_now()-pe<te)}function it(){if(E=!1,K){var H=s.unstable_now();pe=H;var Q=!0;try{e:{k=!1,C&&(C=!1,j(Z),Z=-1),S=!0;var ne=v;try{t:{for(U(H),b=a(m);b!==null&&!(b.expirationTime>H&&he());){var Be=b.callback;if(typeof Be=="function"){b.callback=null,v=b.priorityLevel;var Pe=Be(b.expirationTime<=H);if(H=s.unstable_now(),typeof Pe=="function"){b.callback=Pe,U(H),Q=!0;break t}b===a(m)&&r(m),U(H)}else r(m);b=a(m)}if(b!==null)Q=!0;else{var qe=a(g);qe!==null&&ve(R,qe.startTime-H),Q=!1}}break e}finally{b=null,v=ne,S=!1}Q=void 0}}finally{Q?de():K=!1}}}var de;if(typeof T=="function")de=function(){T(it)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,Y=W.port2;W.port1.onmessage=it,de=function(){Y.postMessage(null)}}else de=function(){O(it,0)};function ve(H,Q){Z=O(function(){H(s.unstable_now())},Q)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(H){H.callback=null},s.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<H?Math.floor(1e3/H):5},s.unstable_getCurrentPriorityLevel=function(){return v},s.unstable_next=function(H){switch(v){case 1:case 2:case 3:var Q=3;break;default:Q=v}var ne=v;v=Q;try{return H()}finally{v=ne}},s.unstable_requestPaint=function(){E=!0},s.unstable_runWithPriority=function(H,Q){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var ne=v;v=H;try{return Q()}finally{v=ne}},s.unstable_scheduleCallback=function(H,Q,ne){var Be=s.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?Be+ne:Be):ne=Be,H){case 1:var Pe=-1;break;case 2:Pe=250;break;case 5:Pe=1073741823;break;case 4:Pe=1e4;break;default:Pe=5e3}return Pe=ne+Pe,H={id:y++,callback:Q,priorityLevel:H,startTime:ne,expirationTime:Pe,sortIndex:-1},ne>Be?(H.sortIndex=ne,t(g,H),a(m)===null&&H===a(g)&&(C?(j(Z),Z=-1):C=!0,ve(R,ne-Be))):(H.sortIndex=Pe,t(m,H),k||S||(k=!0,K||(K=!0,de()))),H},s.unstable_shouldYield=he,s.unstable_wrapCallback=function(H){var Q=v;return function(){var ne=v;v=Q;try{return H.apply(this,arguments)}finally{v=ne}}}})(yd)),yd}var _g;function $0(){return _g||(_g=1,gd.exports=H0()),gd.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-dom-client.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var Cg;function I0(){if(Cg)return Rr;Cg=1;var s=$0(),t=Vv(),a=z0();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function f(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(c(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,l=n;;){var d=i.return;if(d===null)break;var p=d.alternate;if(p===null){if(l=d.return,l!==null){i=l;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===i)return m(d),e;if(p===l)return m(d),n;p=p.sibling}throw Error(r(188))}if(i.return!==l.return)i=d,l=p;else{for(var x=!1,w=d.child;w;){if(w===i){x=!0,i=d,l=p;break}if(w===l){x=!0,l=d,i=p;break}w=w.sibling}if(!x){for(w=p.child;w;){if(w===i){x=!0,i=p,l=d;break}if(w===l){x=!0,l=p,i=d;break}w=w.sibling}if(!x)throw Error(r(189))}}if(i.alternate!==l)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function y(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=y(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),T=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),he=Symbol.for("react.memo_cache_sentinel"),it=Symbol.iterator;function de(e){return e===null||typeof e!="object"?null:(e=it&&e[it]||e["@@iterator"],typeof e=="function"?e:null)}var W=Symbol.for("react.client.reference");function Y(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===W?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case O:return"Profiler";case E:return"StrictMode";case R:return"Suspense";case K:return"SuspenseList";case pe:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case T:return e.displayName||"Context";case j:return(e._context.displayName||"Context")+".Consumer";case U:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return n=e.displayName||null,n!==null?n:Y(e.type)||"Memo";case te:n=e._payload,e=e._init;try{return Y(e(n))}catch{}}return null}var ve=Array.isArray,H=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},Be=[],Pe=-1;function qe(e){return{current:e}}function X(e){0>Pe||(e.current=Be[Pe],Be[Pe]=null,Pe--)}function se(e,n){Pe++,Be[Pe]=e.current,e.current=n}var le=qe(null),ae=qe(null),et=qe(null),lt=qe(null);function jt(e,n){switch(se(et,n),se(ae,e),se(le,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Pm(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Pm(n),e=Gm(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}X(le),se(le,e)}function Ht(){X(le),X(ae),X(et)}function gt(e){e.memoizedState!==null&&se(lt,e);var n=le.current,i=Gm(n,e.type);n!==i&&(se(ae,e),se(le,i))}function Oe(e){ae.current===e&&(X(le),X(ae)),lt.current===e&&(X(lt),Nr._currentValue=ne)}var $t,Ta;function dn(e){if($t===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);$t=n&&n[1]||"",Ta=-1<i.stack.indexOf(`
|
|
19
|
-
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
20
|
-
`+$t+e+Ta}var Mi=!1;function Ee(e,n){if(!e||Mi)return"";Mi=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch($){var z=$}Reflect.construct(e,[],V)}else{try{V.call()}catch($){z=$}e.call(V.prototype)}}else{try{throw Error()}catch($){z=$}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch($){if($&&z&&typeof $.stack=="string")return[$.stack,z.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=l.DetermineComponentFrameRoot(),x=p[0],w=p[1];if(x&&w){var N=x.split(`
|
|
21
|
-
`),L=w.split(`
|
|
22
|
-
`);for(d=l=0;l<N.length&&!N[l].includes("DetermineComponentFrameRoot");)l++;for(;d<L.length&&!L[d].includes("DetermineComponentFrameRoot");)d++;if(l===N.length||d===L.length)for(l=N.length-1,d=L.length-1;1<=l&&0<=d&&N[l]!==L[d];)d--;for(;1<=l&&0<=d;l--,d--)if(N[l]!==L[d]){if(l!==1||d!==1)do if(l--,d--,0>d||N[l]!==L[d]){var G=`
|
|
23
|
-
`+N[l].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),G}while(1<=l&&0<=d);break}}}finally{Mi=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?dn(i):""}function dl(e,n){switch(e.tag){case 26:case 27:case 5:return dn(e.type);case 16:return dn("Lazy");case 13:return e.child!==n&&n!==null?dn("Suspense Fallback"):dn("Suspense");case 19:return dn("SuspenseList");case 0:case 15:return Ee(e.type,!1);case 11:return Ee(e.type.render,!1);case 1:return Ee(e.type,!0);case 31:return dn("Activity");default:return""}}function vs(e){try{var n="",i=null;do n+=dl(e,i),i=e,e=e.return;while(e);return n}catch(l){return`
|
|
24
|
-
Error generating stack: `+l.message+`
|
|
25
|
-
`+l.stack}}var Aa=Object.prototype.hasOwnProperty,ja=s.unstable_scheduleCallback,Bi=s.unstable_cancelCallback,fl=s.unstable_shouldYield,Di=s.unstable_requestPaint,Rt=s.unstable_now,Li=s.unstable_getCurrentPriorityLevel,zi=s.unstable_ImmediatePriority,Vt=s.unstable_UserBlockingPriority,Ra=s.unstable_NormalPriority,en=s.unstable_LowPriority,Ui=s.unstable_IdlePriority,pl=s.log,hl=s.unstable_setDisableYieldValue,Ss=null,It=null;function Un(e){if(typeof pl=="function"&&hl(e),It&&typeof It.setStrictMode=="function")try{It.setStrictMode(Ss,e)}catch{}}var Pt=Math.clz32?Math.clz32:ml,Oa=Math.log,ac=Math.LN2;function ml(e){return e>>>=0,e===0?32:31-(Oa(e)/ac|0)|0}var Zn=256,Ma=262144,ta=4194304;function jn(e){var n=e&42;if(n!==0)return n;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function na(e,n,i){var l=e.pendingLanes;if(l===0)return 0;var d=0,p=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~p,l!==0?d=jn(l):(x&=w,x!==0?d=jn(x):i||(i=w&~e,i!==0&&(d=jn(i))))):(w=l&~p,w!==0?d=jn(w):x!==0?d=jn(x):i||(i=l&~e,i!==0&&(d=jn(i)))),d===0?0:n!==0&&n!==d&&(n&p)===0&&(p=d&-d,i=n&-n,p>=i||p===32&&(i&4194048)!==0)?n:d}function fn(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ic(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Ba(){var e=ta;return ta<<=1,(ta&62914560)===0&&(ta=4194304),e}function sa(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function aa(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gl(e,n,i,l,d,p){var x=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var w=e.entanglements,N=e.expirationTimes,L=e.hiddenUpdates;for(i=x&~i;0<i;){var G=31-Pt(i),V=1<<G;w[G]=0,N[G]=-1;var z=L[G];if(z!==null)for(L[G]=null,G=0;G<z.length;G++){var $=z[G];$!==null&&($.lane&=-536870913)}i&=~V}l!==0&&Hi(e,l,0),p!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=p&~(x&~n))}function Hi(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Pt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function $i(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var l=31-Pt(i),d=1<<l;d&n|e[l]&n&&(e[l]|=n),i&=~d}}function Ii(e,n){var i=n&-n;return i=(i&42)!==0?1:Da(i),(i&(e.suspendedLanes|n))!==0?0:i}function Da(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ia(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function La(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:fg(e.type))}function yl(e,n){var i=Q.p;try{return Q.p=e,n()}finally{Q.p=i}}var Hn=Math.random().toString(36).slice(2),Nt="__reactFiber$"+Hn,zt="__reactProps$"+Hn,ks="__reactContainer$"+Hn,Pi="__reactEvents$"+Hn,bl="__reactListeners$"+Hn,rc="__reactHandles$"+Hn,za="__reactResources$"+Hn,ra="__reactMarker$"+Hn;function B(e){delete e[Nt],delete e[zt],delete e[Pi],delete e[bl],delete e[rc]}function F(e){var n=e[Nt];if(n)return n;for(var i=e.parentNode;i;){if(n=i[ks]||i[Nt]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=Zm(e);e!==null;){if(i=e[Nt])return i;e=Zm(e)}return n}e=i,i=e.parentNode}return null}function ee(e){if(e=e[Nt]||e[ks]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function me(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function be(e){var n=e[za];return n||(n=e[za]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function xe(e){e[ra]=!0}var tt=new Set,St={};function Te(e,n){Ue(e,n),Ue(e+"Capture",n)}function Ue(e,n){for(St[e]=n,e=0;e<n.length;e++)tt.add(n[e])}var ws=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]*$"),Gi={},Rn={};function lc(e){return Aa.call(Rn,e)?!0:Aa.call(Gi,e)?!1:ws.test(e)?Rn[e]=!0:(Gi[e]=!0,!1)}function pn(e,n,i){if(lc(n))if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+i)}}function hn(e,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+i)}}function mn(e,n,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(n,i,""+l)}}function Wt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bf(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Bb(e,n,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var d=l.get,p=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(x){i=""+x,p.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(x){i=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function oc(e){if(!e._valueTracker){var n=Bf(e)?"checked":"value";e._valueTracker=Bb(e,n,""+e[n])}}function Df(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),l="";return e&&(l=Bf(e)?e.checked?"true":"false":e.value),e=l,e!==i?(n.setValue(e),!0):!1}function xl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Db=/[\n"\\]/g;function gn(e){return e.replace(Db,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function cc(e,n,i,l,d,p,x,w){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Wt(n)):e.value!==""+Wt(n)&&(e.value=""+Wt(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?uc(e,x,Wt(n)):i!=null?uc(e,x,Wt(i)):l!=null&&e.removeAttribute("value"),d==null&&p!=null&&(e.defaultChecked=!!p),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Wt(w):e.removeAttribute("name")}function Lf(e,n,i,l,d,p,x,w){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||i!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){oc(e);return}i=i!=null?""+Wt(i):"",n=n!=null?""+Wt(n):i,w||n===e.value||(e.value=n),e.defaultValue=n}l=l??d,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),oc(e)}function uc(e,n,i){n==="number"&&xl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Ua(e,n,i,l){if(e=e.options,n){n={};for(var d=0;d<i.length;d++)n["$"+i[d]]=!0;for(i=0;i<e.length;i++)d=n.hasOwnProperty("$"+e[i].value),e[i].selected!==d&&(e[i].selected=d),d&&l&&(e[i].defaultSelected=!0)}else{for(i=""+Wt(i),n=null,d=0;d<e.length;d++){if(e[d].value===i){e[d].selected=!0,l&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function zf(e,n,i){if(n!=null&&(n=""+Wt(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+Wt(i):""}function Uf(e,n,i,l){if(n==null){if(l!=null){if(i!=null)throw Error(r(92));if(ve(l)){if(1<l.length)throw Error(r(93));l=l[0]}i=l}i==null&&(i=""),n=i}i=Wt(n),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),oc(e)}function Ha(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var Lb=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 Hf(e,n,i){var l=n.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,i):typeof i!="number"||i===0||Lb.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function $f(e,n,i){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var d in n)l=n[d],n.hasOwnProperty(d)&&i[d]!==l&&Hf(e,d,l)}else for(var p in n)n.hasOwnProperty(p)&&Hf(e,p,n[p])}function dc(e){if(e.indexOf("-")===-1)return!1;switch(e){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 zb=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"]]),Ub=/^[\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 vl(e){return Ub.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Qn(){}var fc=null;function pc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var $a=null,Ia=null;function If(e){var n=ee(e);if(n&&(e=n.stateNode)){var i=e[zt]||null;e:switch(e=n.stateNode,n.type){case"input":if(cc(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+gn(""+n)+'"][type="radio"]'),n=0;n<i.length;n++){var l=i[n];if(l!==e&&l.form===e.form){var d=l[zt]||null;if(!d)throw Error(r(90));cc(l,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<i.length;n++)l=i[n],l.form===e.form&&Df(l)}break e;case"textarea":zf(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&Ua(e,!!i.multiple,n,!1)}}}var hc=!1;function Pf(e,n,i){if(hc)return e(n,i);hc=!0;try{var l=e(n);return l}finally{if(hc=!1,($a!==null||Ia!==null)&&(lo(),$a&&(n=$a,e=Ia,Ia=$a=null,If(n),e)))for(n=0;n<e.length;n++)If(e[n])}}function Fi(e,n){var i=e.stateNode;if(i===null)return null;var l=i[zt]||null;if(l===null)return null;i=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var Xn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mc=!1;if(Xn)try{var qi={};Object.defineProperty(qi,"passive",{get:function(){mc=!0}}),window.addEventListener("test",qi,qi),window.removeEventListener("test",qi,qi)}catch{mc=!1}var _s=null,gc=null,Sl=null;function Gf(){if(Sl)return Sl;var e,n=gc,i=n.length,l,d="value"in _s?_s.value:_s.textContent,p=d.length;for(e=0;e<i&&n[e]===d[e];e++);var x=i-e;for(l=1;l<=x&&n[i-l]===d[p-l];l++);return Sl=d.slice(e,1<l?1-l:void 0)}function kl(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function wl(){return!0}function Ff(){return!1}function Kt(e){function n(i,l,d,p,x){this._reactName=i,this._targetInst=d,this.type=l,this.nativeEvent=p,this.target=x,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(p):p[w]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?wl:Ff,this.isPropagationStopped=Ff,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=wl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=wl)},persist:function(){},isPersistent:wl}),n}var la={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_l=Kt(la),Vi=b({},la,{view:0,detail:0}),Hb=Kt(Vi),yc,bc,Wi,Cl=b({},Vi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Wi&&(Wi&&e.type==="mousemove"?(yc=e.screenX-Wi.screenX,bc=e.screenY-Wi.screenY):bc=yc=0,Wi=e),yc)},movementY:function(e){return"movementY"in e?e.movementY:bc}}),qf=Kt(Cl),$b=b({},Cl,{dataTransfer:0}),Ib=Kt($b),Pb=b({},Vi,{relatedTarget:0}),xc=Kt(Pb),Gb=b({},la,{animationName:0,elapsedTime:0,pseudoElement:0}),Fb=Kt(Gb),qb=b({},la,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Vb=Kt(qb),Wb=b({},la,{data:0}),Vf=Kt(Wb),Kb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yb={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"},Zb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qb(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Zb[e])?!!n[e]:!1}function vc(){return Qb}var Xb=b({},Vi,{key:function(e){if(e.key){var n=Kb[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=kl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Yb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vc,charCode:function(e){return e.type==="keypress"?kl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?kl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Jb=Kt(Xb),ex=b({},Cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wf=Kt(ex),tx=b({},Vi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vc}),nx=Kt(tx),sx=b({},la,{propertyName:0,elapsedTime:0,pseudoElement:0}),ax=Kt(sx),ix=b({},Cl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),rx=Kt(ix),lx=b({},la,{newState:0,oldState:0}),ox=Kt(lx),cx=[9,13,27,32],Sc=Xn&&"CompositionEvent"in window,Ki=null;Xn&&"documentMode"in document&&(Ki=document.documentMode);var ux=Xn&&"TextEvent"in window&&!Ki,Kf=Xn&&(!Sc||Ki&&8<Ki&&11>=Ki),Yf=" ",Zf=!1;function Qf(e,n){switch(e){case"keyup":return cx.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Pa=!1;function dx(e,n){switch(e){case"compositionend":return Xf(n);case"keypress":return n.which!==32?null:(Zf=!0,Yf);case"textInput":return e=n.data,e===Yf&&Zf?null:e;default:return null}}function fx(e,n){if(Pa)return e==="compositionend"||!Sc&&Qf(e,n)?(e=Gf(),Sl=gc=_s=null,Pa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Kf&&n.locale!=="ko"?null:n.data;default:return null}}var px={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 Jf(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!px[e.type]:n==="textarea"}function ep(e,n,i,l){$a?Ia?Ia.push(l):Ia=[l]:$a=l,n=mo(n,"onChange"),0<n.length&&(i=new _l("onChange","change",null,i,l),e.push({event:i,listeners:n}))}var Yi=null,Zi=null;function hx(e){Lm(e,0)}function El(e){var n=me(e);if(Df(n))return e}function tp(e,n){if(e==="change")return n}var np=!1;if(Xn){var kc;if(Xn){var wc="oninput"in document;if(!wc){var sp=document.createElement("div");sp.setAttribute("oninput","return;"),wc=typeof sp.oninput=="function"}kc=wc}else kc=!1;np=kc&&(!document.documentMode||9<document.documentMode)}function ap(){Yi&&(Yi.detachEvent("onpropertychange",ip),Zi=Yi=null)}function ip(e){if(e.propertyName==="value"&&El(Zi)){var n=[];ep(n,Zi,e,pc(e)),Pf(hx,n)}}function mx(e,n,i){e==="focusin"?(ap(),Yi=n,Zi=i,Yi.attachEvent("onpropertychange",ip)):e==="focusout"&&ap()}function gx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return El(Zi)}function yx(e,n){if(e==="click")return El(n)}function bx(e,n){if(e==="input"||e==="change")return El(n)}function xx(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var tn=typeof Object.is=="function"?Object.is:xx;function Qi(e,n){if(tn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),l=Object.keys(n);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var d=i[l];if(!Aa.call(n,d)||!tn(e[d],n[d]))return!1}return!0}function rp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function lp(e,n){var i=rp(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=n&&l>=n)return{node:i,offset:n-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=rp(i)}}function op(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?op(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function cp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=xl(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=xl(e.document)}return n}function _c(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var vx=Xn&&"documentMode"in document&&11>=document.documentMode,Ga=null,Cc=null,Xi=null,Ec=!1;function up(e,n,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Ec||Ga==null||Ga!==xl(l)||(l=Ga,"selectionStart"in l&&_c(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Xi&&Qi(Xi,l)||(Xi=l,l=mo(Cc,"onSelect"),0<l.length&&(n=new _l("onSelect","select",null,n,i),e.push({event:n,listeners:l}),n.target=Ga)))}function oa(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Fa={animationend:oa("Animation","AnimationEnd"),animationiteration:oa("Animation","AnimationIteration"),animationstart:oa("Animation","AnimationStart"),transitionrun:oa("Transition","TransitionRun"),transitionstart:oa("Transition","TransitionStart"),transitioncancel:oa("Transition","TransitionCancel"),transitionend:oa("Transition","TransitionEnd")},Nc={},dp={};Xn&&(dp=document.createElement("div").style,"AnimationEvent"in window||(delete Fa.animationend.animation,delete Fa.animationiteration.animation,delete Fa.animationstart.animation),"TransitionEvent"in window||delete Fa.transitionend.transition);function ca(e){if(Nc[e])return Nc[e];if(!Fa[e])return e;var n=Fa[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in dp)return Nc[e]=n[i];return e}var fp=ca("animationend"),pp=ca("animationiteration"),hp=ca("animationstart"),Sx=ca("transitionrun"),kx=ca("transitionstart"),wx=ca("transitioncancel"),mp=ca("transitionend"),gp=new Map,Tc="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(" ");Tc.push("scrollEnd");function On(e,n){gp.set(e,n),Te(n,[e])}var Nl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},yn=[],qa=0,Ac=0;function Tl(){for(var e=qa,n=Ac=qa=0;n<e;){var i=yn[n];yn[n++]=null;var l=yn[n];yn[n++]=null;var d=yn[n];yn[n++]=null;var p=yn[n];if(yn[n++]=null,l!==null&&d!==null){var x=l.pending;x===null?d.next=d:(d.next=x.next,x.next=d),l.pending=d}p!==0&&yp(i,d,p)}}function Al(e,n,i,l){yn[qa++]=e,yn[qa++]=n,yn[qa++]=i,yn[qa++]=l,Ac|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function jc(e,n,i,l){return Al(e,n,i,l),jl(e)}function ua(e,n){return Al(e,null,null,n),jl(e)}function yp(e,n,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var d=!1,p=e.return;p!==null;)p.childLanes|=i,l=p.alternate,l!==null&&(l.childLanes|=i),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(d=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,d&&n!==null&&(d=31-Pt(i),e=p.hiddenUpdates,l=e[d],l===null?e[d]=[n]:l.push(n),n.lane=i|536870912),p):null}function jl(e){if(50<vr)throw vr=0,Hu=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Va={};function _x(e,n,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nn(e,n,i,l){return new _x(e,n,i,l)}function Rc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jn(e,n){var i=e.alternate;return i===null?(i=nn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function bp(e,n){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,n=i.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Rl(e,n,i,l,d,p){var x=0;if(l=e,typeof e=="function")Rc(e)&&(x=1);else if(typeof e=="string")x=Av(e,i,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case pe:return e=nn(31,i,n,d),e.elementType=pe,e.lanes=p,e;case C:return da(i.children,d,p,n);case E:x=8,d|=24;break;case O:return e=nn(12,i,n,d|2),e.elementType=O,e.lanes=p,e;case R:return e=nn(13,i,n,d),e.elementType=R,e.lanes=p,e;case K:return e=nn(19,i,n,d),e.elementType=K,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case T:x=10;break e;case j:x=9;break e;case U:x=11;break e;case Z:x=14;break e;case te:x=16,l=null;break e}x=29,i=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=nn(x,i,n,d),n.elementType=e,n.type=l,n.lanes=p,n}function da(e,n,i,l){return e=nn(7,e,l,n),e.lanes=i,e}function Oc(e,n,i){return e=nn(6,e,null,n),e.lanes=i,e}function xp(e){var n=nn(18,null,null,0);return n.stateNode=e,n}function Mc(e,n,i){return n=nn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var vp=new WeakMap;function bn(e,n){if(typeof e=="object"&&e!==null){var i=vp.get(e);return i!==void 0?i:(n={value:e,source:n,stack:vs(n)},vp.set(e,n),n)}return{value:e,source:n,stack:vs(n)}}var Wa=[],Ka=0,Ol=null,Ji=0,xn=[],vn=0,Cs=null,$n=1,In="";function es(e,n){Wa[Ka++]=Ji,Wa[Ka++]=Ol,Ol=e,Ji=n}function Sp(e,n,i){xn[vn++]=$n,xn[vn++]=In,xn[vn++]=Cs,Cs=e;var l=$n;e=In;var d=32-Pt(l)-1;l&=~(1<<d),i+=1;var p=32-Pt(n)+d;if(30<p){var x=d-d%5;p=(l&(1<<x)-1).toString(32),l>>=x,d-=x,$n=1<<32-Pt(n)+d|i<<d|l,In=p+e}else $n=1<<p|i<<d|l,In=e}function Bc(e){e.return!==null&&(es(e,1),Sp(e,1,0))}function Dc(e){for(;e===Ol;)Ol=Wa[--Ka],Wa[Ka]=null,Ji=Wa[--Ka],Wa[Ka]=null;for(;e===Cs;)Cs=xn[--vn],xn[vn]=null,In=xn[--vn],xn[vn]=null,$n=xn[--vn],xn[vn]=null}function kp(e,n){xn[vn++]=$n,xn[vn++]=In,xn[vn++]=Cs,$n=n.id,In=n.overflow,Cs=e}var Ot=null,ot=null,Ie=!1,Es=null,Sn=!1,Lc=Error(r(519));function Ns(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw er(bn(n,e)),Lc}function wp(e){var n=e.stateNode,i=e.type,l=e.memoizedProps;switch(n[Nt]=e,n[zt]=l,i){case"dialog":Le("cancel",n),Le("close",n);break;case"iframe":case"object":case"embed":Le("load",n);break;case"video":case"audio":for(i=0;i<kr.length;i++)Le(kr[i],n);break;case"source":Le("error",n);break;case"img":case"image":case"link":Le("error",n),Le("load",n);break;case"details":Le("toggle",n);break;case"input":Le("invalid",n),Lf(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Le("invalid",n);break;case"textarea":Le("invalid",n),Uf(n,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||n.textContent===""+i||l.suppressHydrationWarning===!0||$m(n.textContent,i)?(l.popover!=null&&(Le("beforetoggle",n),Le("toggle",n)),l.onScroll!=null&&Le("scroll",n),l.onScrollEnd!=null&&Le("scrollend",n),l.onClick!=null&&(n.onclick=Qn),n=!0):n=!1,n||Ns(e,!0)}function _p(e){for(Ot=e.return;Ot;)switch(Ot.tag){case 5:case 31:case 13:Sn=!1;return;case 27:case 3:Sn=!0;return;default:Ot=Ot.return}}function Ya(e){if(e!==Ot)return!1;if(!Ie)return _p(e),Ie=!0,!1;var n=e.tag,i;if((i=n!==3&&n!==27)&&((i=n===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||ed(e.type,e.memoizedProps)),i=!i),i&&ot&&Ns(e),_p(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));ot=Ym(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));ot=Ym(e)}else n===27?(n=ot,Is(e.type)?(e=id,id=null,ot=e):ot=n):ot=Ot?wn(e.stateNode.nextSibling):null;return!0}function fa(){ot=Ot=null,Ie=!1}function zc(){var e=Es;return e!==null&&(Xt===null?Xt=e:Xt.push.apply(Xt,e),Es=null),e}function er(e){Es===null?Es=[e]:Es.push(e)}var Uc=qe(null),pa=null,ts=null;function Ts(e,n,i){se(Uc,n._currentValue),n._currentValue=i}function ns(e){e._currentValue=Uc.current,X(Uc)}function Hc(e,n,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===i)break;e=e.return}}function $c(e,n,i,l){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var p=d.dependencies;if(p!==null){var x=d.child;p=p.firstContext;e:for(;p!==null;){var w=p;p=d;for(var N=0;N<n.length;N++)if(w.context===n[N]){p.lanes|=i,w=p.alternate,w!==null&&(w.lanes|=i),Hc(p.return,i,e),l||(x=null);break e}p=w.next}}else if(d.tag===18){if(x=d.return,x===null)throw Error(r(341));x.lanes|=i,p=x.alternate,p!==null&&(p.lanes|=i),Hc(x,i,e),x=null}else x=d.child;if(x!==null)x.return=d;else for(x=d;x!==null;){if(x===e){x=null;break}if(d=x.sibling,d!==null){d.return=x.return,x=d;break}x=x.return}d=x}}function Za(e,n,i,l){e=null;for(var d=n,p=!1;d!==null;){if(!p){if((d.flags&524288)!==0)p=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var x=d.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var w=d.type;tn(d.pendingProps.value,x.value)||(e!==null?e.push(w):e=[w])}}else if(d===lt.current){if(x=d.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Nr):e=[Nr])}d=d.return}e!==null&&$c(n,e,i,l),n.flags|=262144}function Ml(e){for(e=e.firstContext;e!==null;){if(!tn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ha(e){pa=e,ts=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Mt(e){return Cp(pa,e)}function Bl(e,n){return pa===null&&ha(e),Cp(e,n)}function Cp(e,n){var i=n._currentValue;if(n={context:n,memoizedValue:i,next:null},ts===null){if(e===null)throw Error(r(308));ts=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else ts=ts.next=n;return i}var Cx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(i){return i()})}},Ex=s.unstable_scheduleCallback,Nx=s.unstable_NormalPriority,kt={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ic(){return{controller:new Cx,data:new Map,refCount:0}}function tr(e){e.refCount--,e.refCount===0&&Ex(Nx,function(){e.controller.abort()})}var nr=null,Pc=0,Qa=0,Xa=null;function Tx(e,n){if(nr===null){var i=nr=[];Pc=0,Qa=qu(),Xa={status:"pending",value:void 0,then:function(l){i.push(l)}}}return Pc++,n.then(Ep,Ep),n}function Ep(){if(--Pc===0&&nr!==null){Xa!==null&&(Xa.status="fulfilled");var e=nr;nr=null,Qa=0,Xa=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Ax(e,n){var i=[],l={status:"pending",value:null,reason:null,then:function(d){i.push(d)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var d=0;d<i.length;d++)(0,i[d])(n)},function(d){for(l.status="rejected",l.reason=d,d=0;d<i.length;d++)(0,i[d])(void 0)}),l}var Np=H.S;H.S=function(e,n){um=Rt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Tx(e,n),Np!==null&&Np(e,n)};var ma=qe(null);function Gc(){var e=ma.current;return e!==null?e:rt.pooledCache}function Dl(e,n){n===null?se(ma,ma.current):se(ma,n.pool)}function Tp(){var e=Gc();return e===null?null:{parent:kt._currentValue,pool:e}}var Ja=Error(r(460)),Fc=Error(r(474)),Ll=Error(r(542)),zl={then:function(){}};function Ap(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jp(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(Qn,Qn),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Op(e),e;default:if(typeof n.status=="string")n.then(Qn,Qn);else{if(e=rt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=l}},function(l){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Op(e),e}throw ya=n,Ja}}function ga(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(ya=i,Ja):i}}var ya=null;function Rp(){if(ya===null)throw Error(r(459));var e=ya;return ya=null,e}function Op(e){if(e===Ja||e===Ll)throw Error(r(483))}var ei=null,sr=0;function Ul(e){var n=sr;return sr+=1,ei===null&&(ei=[]),jp(ei,e,n)}function ar(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Hl(e,n){throw n.$$typeof===v?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Mp(e){function n(M,A){if(e){var D=M.deletions;D===null?(M.deletions=[A],M.flags|=16):D.push(A)}}function i(M,A){if(!e)return null;for(;A!==null;)n(M,A),A=A.sibling;return null}function l(M){for(var A=new Map;M!==null;)M.key!==null?A.set(M.key,M):A.set(M.index,M),M=M.sibling;return A}function d(M,A){return M=Jn(M,A),M.index=0,M.sibling=null,M}function p(M,A,D){return M.index=D,e?(D=M.alternate,D!==null?(D=D.index,D<A?(M.flags|=67108866,A):D):(M.flags|=67108866,A)):(M.flags|=1048576,A)}function x(M){return e&&M.alternate===null&&(M.flags|=67108866),M}function w(M,A,D,q){return A===null||A.tag!==6?(A=Oc(D,M.mode,q),A.return=M,A):(A=d(A,D),A.return=M,A)}function N(M,A,D,q){var fe=D.type;return fe===C?G(M,A,D.props.children,q,D.key):A!==null&&(A.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===te&&ga(fe)===A.type)?(A=d(A,D.props),ar(A,D),A.return=M,A):(A=Rl(D.type,D.key,D.props,null,M.mode,q),ar(A,D),A.return=M,A)}function L(M,A,D,q){return A===null||A.tag!==4||A.stateNode.containerInfo!==D.containerInfo||A.stateNode.implementation!==D.implementation?(A=Mc(D,M.mode,q),A.return=M,A):(A=d(A,D.children||[]),A.return=M,A)}function G(M,A,D,q,fe){return A===null||A.tag!==7?(A=da(D,M.mode,q,fe),A.return=M,A):(A=d(A,D),A.return=M,A)}function V(M,A,D){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=Oc(""+A,M.mode,D),A.return=M,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case S:return D=Rl(A.type,A.key,A.props,null,M.mode,D),ar(D,A),D.return=M,D;case k:return A=Mc(A,M.mode,D),A.return=M,A;case te:return A=ga(A),V(M,A,D)}if(ve(A)||de(A))return A=da(A,M.mode,D,null),A.return=M,A;if(typeof A.then=="function")return V(M,Ul(A),D);if(A.$$typeof===T)return V(M,Bl(M,A),D);Hl(M,A)}return null}function z(M,A,D,q){var fe=A!==null?A.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return fe!==null?null:w(M,A,""+D,q);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case S:return D.key===fe?N(M,A,D,q):null;case k:return D.key===fe?L(M,A,D,q):null;case te:return D=ga(D),z(M,A,D,q)}if(ve(D)||de(D))return fe!==null?null:G(M,A,D,q,null);if(typeof D.then=="function")return z(M,A,Ul(D),q);if(D.$$typeof===T)return z(M,A,Bl(M,D),q);Hl(M,D)}return null}function $(M,A,D,q,fe){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return M=M.get(D)||null,w(A,M,""+q,fe);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case S:return M=M.get(q.key===null?D:q.key)||null,N(A,M,q,fe);case k:return M=M.get(q.key===null?D:q.key)||null,L(A,M,q,fe);case te:return q=ga(q),$(M,A,D,q,fe)}if(ve(q)||de(q))return M=M.get(D)||null,G(A,M,q,fe,null);if(typeof q.then=="function")return $(M,A,D,Ul(q),fe);if(q.$$typeof===T)return $(M,A,D,Bl(A,q),fe);Hl(A,q)}return null}function re(M,A,D,q){for(var fe=null,We=null,ce=A,Ae=A=0,$e=null;ce!==null&&Ae<D.length;Ae++){ce.index>Ae?($e=ce,ce=null):$e=ce.sibling;var Ke=z(M,ce,D[Ae],q);if(Ke===null){ce===null&&(ce=$e);break}e&&ce&&Ke.alternate===null&&n(M,ce),A=p(Ke,A,Ae),We===null?fe=Ke:We.sibling=Ke,We=Ke,ce=$e}if(Ae===D.length)return i(M,ce),Ie&&es(M,Ae),fe;if(ce===null){for(;Ae<D.length;Ae++)ce=V(M,D[Ae],q),ce!==null&&(A=p(ce,A,Ae),We===null?fe=ce:We.sibling=ce,We=ce);return Ie&&es(M,Ae),fe}for(ce=l(ce);Ae<D.length;Ae++)$e=$(ce,M,Ae,D[Ae],q),$e!==null&&(e&&$e.alternate!==null&&ce.delete($e.key===null?Ae:$e.key),A=p($e,A,Ae),We===null?fe=$e:We.sibling=$e,We=$e);return e&&ce.forEach(function(Vs){return n(M,Vs)}),Ie&&es(M,Ae),fe}function ye(M,A,D,q){if(D==null)throw Error(r(151));for(var fe=null,We=null,ce=A,Ae=A=0,$e=null,Ke=D.next();ce!==null&&!Ke.done;Ae++,Ke=D.next()){ce.index>Ae?($e=ce,ce=null):$e=ce.sibling;var Vs=z(M,ce,Ke.value,q);if(Vs===null){ce===null&&(ce=$e);break}e&&ce&&Vs.alternate===null&&n(M,ce),A=p(Vs,A,Ae),We===null?fe=Vs:We.sibling=Vs,We=Vs,ce=$e}if(Ke.done)return i(M,ce),Ie&&es(M,Ae),fe;if(ce===null){for(;!Ke.done;Ae++,Ke=D.next())Ke=V(M,Ke.value,q),Ke!==null&&(A=p(Ke,A,Ae),We===null?fe=Ke:We.sibling=Ke,We=Ke);return Ie&&es(M,Ae),fe}for(ce=l(ce);!Ke.done;Ae++,Ke=D.next())Ke=$(ce,M,Ae,Ke.value,q),Ke!==null&&(e&&Ke.alternate!==null&&ce.delete(Ke.key===null?Ae:Ke.key),A=p(Ke,A,Ae),We===null?fe=Ke:We.sibling=Ke,We=Ke);return e&&ce.forEach(function($v){return n(M,$v)}),Ie&&es(M,Ae),fe}function at(M,A,D,q){if(typeof D=="object"&&D!==null&&D.type===C&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case S:e:{for(var fe=D.key;A!==null;){if(A.key===fe){if(fe=D.type,fe===C){if(A.tag===7){i(M,A.sibling),q=d(A,D.props.children),q.return=M,M=q;break e}}else if(A.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===te&&ga(fe)===A.type){i(M,A.sibling),q=d(A,D.props),ar(q,D),q.return=M,M=q;break e}i(M,A);break}else n(M,A);A=A.sibling}D.type===C?(q=da(D.props.children,M.mode,q,D.key),q.return=M,M=q):(q=Rl(D.type,D.key,D.props,null,M.mode,q),ar(q,D),q.return=M,M=q)}return x(M);case k:e:{for(fe=D.key;A!==null;){if(A.key===fe)if(A.tag===4&&A.stateNode.containerInfo===D.containerInfo&&A.stateNode.implementation===D.implementation){i(M,A.sibling),q=d(A,D.children||[]),q.return=M,M=q;break e}else{i(M,A);break}else n(M,A);A=A.sibling}q=Mc(D,M.mode,q),q.return=M,M=q}return x(M);case te:return D=ga(D),at(M,A,D,q)}if(ve(D))return re(M,A,D,q);if(de(D)){if(fe=de(D),typeof fe!="function")throw Error(r(150));return D=fe.call(D),ye(M,A,D,q)}if(typeof D.then=="function")return at(M,A,Ul(D),q);if(D.$$typeof===T)return at(M,A,Bl(M,D),q);Hl(M,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,A!==null&&A.tag===6?(i(M,A.sibling),q=d(A,D),q.return=M,M=q):(i(M,A),q=Oc(D,M.mode,q),q.return=M,M=q),x(M)):i(M,A)}return function(M,A,D,q){try{sr=0;var fe=at(M,A,D,q);return ei=null,fe}catch(ce){if(ce===Ja||ce===Ll)throw ce;var We=nn(29,ce,null,M.mode);return We.lanes=q,We.return=M,We}finally{}}}var ba=Mp(!0),Bp=Mp(!1),As=!1;function qc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vc(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function js(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Rs(e,n,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ze&2)!==0){var d=l.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),l.pending=n,n=jl(e),yp(e,null,i),n}return Al(e,l,n,i),jl(e)}function ir(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,$i(e,i)}}function Wc(e,n){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var d=null,p=null;if(i=i.firstBaseUpdate,i!==null){do{var x={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};p===null?d=p=x:p=p.next=x,i=i.next}while(i!==null);p===null?d=p=n:p=p.next=n}else d=p=n;i={baseState:l.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var Kc=!1;function rr(){if(Kc){var e=Xa;if(e!==null)throw e}}function lr(e,n,i,l){Kc=!1;var d=e.updateQueue;As=!1;var p=d.firstBaseUpdate,x=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var N=w,L=N.next;N.next=null,x===null?p=L:x.next=L,x=N;var G=e.alternate;G!==null&&(G=G.updateQueue,w=G.lastBaseUpdate,w!==x&&(w===null?G.firstBaseUpdate=L:w.next=L,G.lastBaseUpdate=N))}if(p!==null){var V=d.baseState;x=0,G=L=N=null,w=p;do{var z=w.lane&-536870913,$=z!==w.lane;if($?(He&z)===z:(l&z)===z){z!==0&&z===Qa&&(Kc=!0),G!==null&&(G=G.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var re=e,ye=w;z=n;var at=i;switch(ye.tag){case 1:if(re=ye.payload,typeof re=="function"){V=re.call(at,V,z);break e}V=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=ye.payload,z=typeof re=="function"?re.call(at,V,z):re,z==null)break e;V=b({},V,z);break e;case 2:As=!0}}z=w.callback,z!==null&&(e.flags|=64,$&&(e.flags|=8192),$=d.callbacks,$===null?d.callbacks=[z]:$.push(z))}else $={lane:z,tag:w.tag,payload:w.payload,callback:w.callback,next:null},G===null?(L=G=$,N=V):G=G.next=$,x|=z;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;$=w,w=$.next,$.next=null,d.lastBaseUpdate=$,d.shared.pending=null}}while(!0);G===null&&(N=V),d.baseState=N,d.firstBaseUpdate=L,d.lastBaseUpdate=G,p===null&&(d.shared.lanes=0),Ls|=x,e.lanes=x,e.memoizedState=V}}function Dp(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Lp(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)Dp(i[e],n)}var ti=qe(null),$l=qe(0);function zp(e,n){e=ds,se($l,e),se(ti,n),ds=e|n.baseLanes}function Yc(){se($l,ds),se(ti,ti.current)}function Zc(){ds=$l.current,X(ti),X($l)}var sn=qe(null),kn=null;function Os(e){var n=e.alternate;se(xt,xt.current&1),se(sn,e),kn===null&&(n===null||ti.current!==null||n.memoizedState!==null)&&(kn=e)}function Qc(e){se(xt,xt.current),se(sn,e),kn===null&&(kn=e)}function Up(e){e.tag===22?(se(xt,xt.current),se(sn,e),kn===null&&(kn=e)):Ms()}function Ms(){se(xt,xt.current),se(sn,sn.current)}function an(e){X(sn),kn===e&&(kn=null),X(xt)}var xt=qe(0);function Il(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||sd(i)||ad(i)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ss=0,Ne=null,nt=null,wt=null,Pl=!1,ni=!1,xa=!1,Gl=0,or=0,si=null,jx=0;function yt(){throw Error(r(321))}function Xc(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!tn(e[i],n[i]))return!1;return!0}function Jc(e,n,i,l,d,p){return ss=p,Ne=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=e===null||e.memoizedState===null?Sh:hu,xa=!1,p=i(l,d),xa=!1,ni&&(p=$p(n,i,l,d)),Hp(e),p}function Hp(e){H.H=dr;var n=nt!==null&&nt.next!==null;if(ss=0,wt=nt=Ne=null,Pl=!1,or=0,si=null,n)throw Error(r(300));e===null||_t||(e=e.dependencies,e!==null&&Ml(e)&&(_t=!0))}function $p(e,n,i,l){Ne=e;var d=0;do{if(ni&&(si=null),or=0,ni=!1,25<=d)throw Error(r(301));if(d+=1,wt=nt=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}H.H=kh,p=n(i,l)}while(ni);return p}function Rx(){var e=H.H,n=e.useState()[0];return n=typeof n.then=="function"?cr(n):n,e=e.useState()[0],(nt!==null?nt.memoizedState:null)!==e&&(Ne.flags|=1024),n}function eu(){var e=Gl!==0;return Gl=0,e}function tu(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function nu(e){if(Pl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Pl=!1}ss=0,wt=nt=Ne=null,ni=!1,or=Gl=0,si=null}function Gt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?Ne.memoizedState=wt=e:wt=wt.next=e,wt}function vt(){if(nt===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=nt.next;var n=wt===null?Ne.memoizedState:wt.next;if(n!==null)wt=n,nt=e;else{if(e===null)throw Ne.alternate===null?Error(r(467)):Error(r(310));nt=e,e={memoizedState:nt.memoizedState,baseState:nt.baseState,baseQueue:nt.baseQueue,queue:nt.queue,next:null},wt===null?Ne.memoizedState=wt=e:wt=wt.next=e}return wt}function Fl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function cr(e){var n=or;return or+=1,si===null&&(si=[]),e=jp(si,e,n),n=Ne,(wt===null?n.memoizedState:wt.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?Sh:hu),e}function ql(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return cr(e);if(e.$$typeof===T)return Mt(e)}throw Error(r(438,String(e)))}function su(e){var n=null,i=Ne.updateQueue;if(i!==null&&(n=i.memoCache),n==null){var l=Ne.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),i===null&&(i=Fl(),Ne.updateQueue=i),i.memoCache=n,i=n.data[n.index],i===void 0)for(i=n.data[n.index]=Array(e),l=0;l<e;l++)i[l]=he;return n.index++,i}function as(e,n){return typeof n=="function"?n(e):n}function Vl(e){var n=vt();return au(n,nt,e)}function au(e,n,i){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=i;var d=e.baseQueue,p=l.pending;if(p!==null){if(d!==null){var x=d.next;d.next=p.next,p.next=x}n.baseQueue=d=p,l.pending=null}if(p=e.baseState,d===null)e.memoizedState=p;else{n=d.next;var w=x=null,N=null,L=n,G=!1;do{var V=L.lane&-536870913;if(V!==L.lane?(He&V)===V:(ss&V)===V){var z=L.revertLane;if(z===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),V===Qa&&(G=!0);else if((ss&z)===z){L=L.next,z===Qa&&(G=!0);continue}else V={lane:0,revertLane:L.revertLane,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},N===null?(w=N=V,x=p):N=N.next=V,Ne.lanes|=z,Ls|=z;V=L.action,xa&&i(p,V),p=L.hasEagerState?L.eagerState:i(p,V)}else z={lane:V,revertLane:L.revertLane,gesture:L.gesture,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},N===null?(w=N=z,x=p):N=N.next=z,Ne.lanes|=V,Ls|=V;L=L.next}while(L!==null&&L!==n);if(N===null?x=p:N.next=w,!tn(p,e.memoizedState)&&(_t=!0,G&&(i=Xa,i!==null)))throw i;e.memoizedState=p,e.baseState=x,e.baseQueue=N,l.lastRenderedState=p}return d===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function iu(e){var n=vt(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var l=i.dispatch,d=i.pending,p=n.memoizedState;if(d!==null){i.pending=null;var x=d=d.next;do p=e(p,x.action),x=x.next;while(x!==d);tn(p,n.memoizedState)||(_t=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),i.lastRenderedState=p}return[p,l]}function Ip(e,n,i){var l=Ne,d=vt(),p=Ie;if(p){if(i===void 0)throw Error(r(407));i=i()}else i=n();var x=!tn((nt||d).memoizedState,i);if(x&&(d.memoizedState=i,_t=!0),d=d.queue,ou(Fp.bind(null,l,d,e),[e]),d.getSnapshot!==n||x||wt!==null&&wt.memoizedState.tag&1){if(l.flags|=2048,ai(9,{destroy:void 0},Gp.bind(null,l,d,i,n),null),rt===null)throw Error(r(349));p||(ss&127)!==0||Pp(l,n,i)}return i}function Pp(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Ne.updateQueue,n===null?(n=Fl(),Ne.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Gp(e,n,i,l){n.value=i,n.getSnapshot=l,qp(n)&&Vp(e)}function Fp(e,n,i){return i(function(){qp(n)&&Vp(e)})}function qp(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!tn(e,i)}catch{return!0}}function Vp(e){var n=ua(e,2);n!==null&&Jt(n,e,2)}function ru(e){var n=Gt();if(typeof e=="function"){var i=e;if(e=i(),xa){Un(!0);try{i()}finally{Un(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:e},n}function Wp(e,n,i,l){return e.baseState=i,au(e,nt,typeof l=="function"?l:as)}function Ox(e,n,i,l,d){if(Yl(e))throw Error(r(485));if(e=n.action,e!==null){var p={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){p.listeners.push(x)}};H.T!==null?i(!0):p.isTransition=!1,l(p),i=n.pending,i===null?(p.next=n.pending=p,Kp(n,p)):(p.next=i.next,n.pending=i.next=p)}}function Kp(e,n){var i=n.action,l=n.payload,d=e.state;if(n.isTransition){var p=H.T,x={};H.T=x;try{var w=i(d,l),N=H.S;N!==null&&N(x,w),Yp(e,n,w)}catch(L){lu(e,n,L)}finally{p!==null&&x.types!==null&&(p.types=x.types),H.T=p}}else try{p=i(d,l),Yp(e,n,p)}catch(L){lu(e,n,L)}}function Yp(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Zp(e,n,l)},function(l){return lu(e,n,l)}):Zp(e,n,i)}function Zp(e,n,i){n.status="fulfilled",n.value=i,Qp(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,Kp(e,i)))}function lu(e,n,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=i,Qp(n),n=n.next;while(n!==l)}e.action=null}function Qp(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Xp(e,n){return n}function Jp(e,n){if(Ie){var i=rt.formState;if(i!==null){e:{var l=Ne;if(Ie){if(ot){t:{for(var d=ot,p=Sn;d.nodeType!==8;){if(!p){d=null;break t}if(d=wn(d.nextSibling),d===null){d=null;break t}}p=d.data,d=p==="F!"||p==="F"?d:null}if(d){ot=wn(d.nextSibling),l=d.data==="F!";break e}}Ns(l)}l=!1}l&&(n=i[0])}}return i=Gt(),i.memoizedState=i.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xp,lastRenderedState:n},i.queue=l,i=bh.bind(null,Ne,l),l.dispatch=i,l=ru(!1),p=pu.bind(null,Ne,!1,l.queue),l=Gt(),d={state:n,dispatch:null,action:e,pending:null},l.queue=d,i=Ox.bind(null,Ne,d,p,i),d.dispatch=i,l.memoizedState=e,[n,i,!1]}function eh(e){var n=vt();return th(n,nt,e)}function th(e,n,i){if(n=au(e,n,Xp)[0],e=Vl(as)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=cr(n)}catch(x){throw x===Ja?Ll:x}else l=n;n=vt();var d=n.queue,p=d.dispatch;return i!==n.memoizedState&&(Ne.flags|=2048,ai(9,{destroy:void 0},Mx.bind(null,d,i),null)),[l,p,e]}function Mx(e,n){e.action=n}function nh(e){var n=vt(),i=nt;if(i!==null)return th(n,i,e);vt(),n=n.memoizedState,i=vt();var l=i.queue.dispatch;return i.memoizedState=e,[n,l,!1]}function ai(e,n,i,l){return e={tag:e,create:i,deps:l,inst:n,next:null},n=Ne.updateQueue,n===null&&(n=Fl(),Ne.updateQueue=n),i=n.lastEffect,i===null?n.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,n.lastEffect=e),e}function sh(){return vt().memoizedState}function Wl(e,n,i,l){var d=Gt();Ne.flags|=e,d.memoizedState=ai(1|n,{destroy:void 0},i,l===void 0?null:l)}function Kl(e,n,i,l){var d=vt();l=l===void 0?null:l;var p=d.memoizedState.inst;nt!==null&&l!==null&&Xc(l,nt.memoizedState.deps)?d.memoizedState=ai(n,p,i,l):(Ne.flags|=e,d.memoizedState=ai(1|n,p,i,l))}function ah(e,n){Wl(8390656,8,e,n)}function ou(e,n){Kl(2048,8,e,n)}function Bx(e){Ne.flags|=4;var n=Ne.updateQueue;if(n===null)n=Fl(),Ne.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function ih(e){var n=vt().memoizedState;return Bx({ref:n,nextImpl:e}),function(){if((Ze&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function rh(e,n){return Kl(4,2,e,n)}function lh(e,n){return Kl(4,4,e,n)}function oh(e,n){if(typeof n=="function"){e=e();var i=n(e);return function(){typeof i=="function"?i():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function ch(e,n,i){i=i!=null?i.concat([e]):null,Kl(4,4,oh.bind(null,n,e),i)}function cu(){}function uh(e,n){var i=vt();n=n===void 0?null:n;var l=i.memoizedState;return n!==null&&Xc(n,l[1])?l[0]:(i.memoizedState=[e,n],e)}function dh(e,n){var i=vt();n=n===void 0?null:n;var l=i.memoizedState;if(n!==null&&Xc(n,l[1]))return l[0];if(l=e(),xa){Un(!0);try{e()}finally{Un(!1)}}return i.memoizedState=[l,n],l}function uu(e,n,i){return i===void 0||(ss&1073741824)!==0&&(He&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=fm(),Ne.lanes|=e,Ls|=e,i)}function fh(e,n,i,l){return tn(i,n)?i:ti.current!==null?(e=uu(e,i,l),tn(e,n)||(_t=!0),e):(ss&42)===0||(ss&1073741824)!==0&&(He&261930)===0?(_t=!0,e.memoizedState=i):(e=fm(),Ne.lanes|=e,Ls|=e,n)}function ph(e,n,i,l,d){var p=Q.p;Q.p=p!==0&&8>p?p:8;var x=H.T,w={};H.T=w,pu(e,!1,n,i);try{var N=d(),L=H.S;if(L!==null&&L(w,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var G=Ax(N,l);ur(e,n,G,on(e))}else ur(e,n,l,on(e))}catch(V){ur(e,n,{then:function(){},status:"rejected",reason:V},on())}finally{Q.p=p,x!==null&&w.types!==null&&(x.types=w.types),H.T=x}}function Dx(){}function du(e,n,i,l){if(e.tag!==5)throw Error(r(476));var d=hh(e).queue;ph(e,d,n,ne,i===null?Dx:function(){return mh(e),i(l)})}function hh(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:ne},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function mh(e){var n=hh(e);n.next===null&&(n=e.alternate.memoizedState),ur(e,n.next.queue,{},on())}function fu(){return Mt(Nr)}function gh(){return vt().memoizedState}function yh(){return vt().memoizedState}function Lx(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=on();e=js(i);var l=Rs(n,e,i);l!==null&&(Jt(l,n,i),ir(l,n,i)),n={cache:Ic()},e.payload=n;return}n=n.return}}function zx(e,n,i){var l=on();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Yl(e)?xh(n,i):(i=jc(e,n,i,l),i!==null&&(Jt(i,e,l),vh(i,n,l)))}function bh(e,n,i){var l=on();ur(e,n,i,l)}function ur(e,n,i,l){var d={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Yl(e))xh(n,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var x=n.lastRenderedState,w=p(x,i);if(d.hasEagerState=!0,d.eagerState=w,tn(w,x))return Al(e,n,d,0),rt===null&&Tl(),!1}catch{}finally{}if(i=jc(e,n,d,l),i!==null)return Jt(i,e,l),vh(i,n,l),!0}return!1}function pu(e,n,i,l){if(l={lane:2,revertLane:qu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Yl(e)){if(n)throw Error(r(479))}else n=jc(e,i,l,2),n!==null&&Jt(n,e,2)}function Yl(e){var n=e.alternate;return e===Ne||n!==null&&n===Ne}function xh(e,n){ni=Pl=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function vh(e,n,i){if((i&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,$i(e,i)}}var dr={readContext:Mt,use:ql,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useLayoutEffect:yt,useInsertionEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useSyncExternalStore:yt,useId:yt,useHostTransitionStatus:yt,useFormState:yt,useActionState:yt,useOptimistic:yt,useMemoCache:yt,useCacheRefresh:yt};dr.useEffectEvent=yt;var Sh={readContext:Mt,use:ql,useCallback:function(e,n){return Gt().memoizedState=[e,n===void 0?null:n],e},useContext:Mt,useEffect:ah,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,Wl(4194308,4,oh.bind(null,n,e),i)},useLayoutEffect:function(e,n){return Wl(4194308,4,e,n)},useInsertionEffect:function(e,n){Wl(4,2,e,n)},useMemo:function(e,n){var i=Gt();n=n===void 0?null:n;var l=e();if(xa){Un(!0);try{e()}finally{Un(!1)}}return i.memoizedState=[l,n],l},useReducer:function(e,n,i){var l=Gt();if(i!==void 0){var d=i(n);if(xa){Un(!0);try{i(n)}finally{Un(!1)}}}else d=n;return l.memoizedState=l.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},l.queue=e,e=e.dispatch=zx.bind(null,Ne,e),[l.memoizedState,e]},useRef:function(e){var n=Gt();return e={current:e},n.memoizedState=e},useState:function(e){e=ru(e);var n=e.queue,i=bh.bind(null,Ne,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:cu,useDeferredValue:function(e,n){var i=Gt();return uu(i,e,n)},useTransition:function(){var e=ru(!1);return e=ph.bind(null,Ne,e.queue,!0,!1),Gt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var l=Ne,d=Gt();if(Ie){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),rt===null)throw Error(r(349));(He&127)!==0||Pp(l,n,i)}d.memoizedState=i;var p={value:i,getSnapshot:n};return d.queue=p,ah(Fp.bind(null,l,p,e),[e]),l.flags|=2048,ai(9,{destroy:void 0},Gp.bind(null,l,p,i,n),null),i},useId:function(){var e=Gt(),n=rt.identifierPrefix;if(Ie){var i=In,l=$n;i=(l&~(1<<32-Pt(l)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Gl++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=jx++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:fu,useFormState:Jp,useActionState:Jp,useOptimistic:function(e){var n=Gt();n.memoizedState=n.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=i,n=pu.bind(null,Ne,!0,i),i.dispatch=n,[e,n]},useMemoCache:su,useCacheRefresh:function(){return Gt().memoizedState=Lx.bind(null,Ne)},useEffectEvent:function(e){var n=Gt(),i={impl:e};return n.memoizedState=i,function(){if((Ze&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},hu={readContext:Mt,use:ql,useCallback:uh,useContext:Mt,useEffect:ou,useImperativeHandle:ch,useInsertionEffect:rh,useLayoutEffect:lh,useMemo:dh,useReducer:Vl,useRef:sh,useState:function(){return Vl(as)},useDebugValue:cu,useDeferredValue:function(e,n){var i=vt();return fh(i,nt.memoizedState,e,n)},useTransition:function(){var e=Vl(as)[0],n=vt().memoizedState;return[typeof e=="boolean"?e:cr(e),n]},useSyncExternalStore:Ip,useId:gh,useHostTransitionStatus:fu,useFormState:eh,useActionState:eh,useOptimistic:function(e,n){var i=vt();return Wp(i,nt,e,n)},useMemoCache:su,useCacheRefresh:yh};hu.useEffectEvent=ih;var kh={readContext:Mt,use:ql,useCallback:uh,useContext:Mt,useEffect:ou,useImperativeHandle:ch,useInsertionEffect:rh,useLayoutEffect:lh,useMemo:dh,useReducer:iu,useRef:sh,useState:function(){return iu(as)},useDebugValue:cu,useDeferredValue:function(e,n){var i=vt();return nt===null?uu(i,e,n):fh(i,nt.memoizedState,e,n)},useTransition:function(){var e=iu(as)[0],n=vt().memoizedState;return[typeof e=="boolean"?e:cr(e),n]},useSyncExternalStore:Ip,useId:gh,useHostTransitionStatus:fu,useFormState:nh,useActionState:nh,useOptimistic:function(e,n){var i=vt();return nt!==null?Wp(i,nt,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:su,useCacheRefresh:yh};kh.useEffectEvent=ih;function mu(e,n,i,l){n=e.memoizedState,i=i(l,n),i=i==null?n:b({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var gu={enqueueSetState:function(e,n,i){e=e._reactInternals;var l=on(),d=js(l);d.payload=n,i!=null&&(d.callback=i),n=Rs(e,d,l),n!==null&&(Jt(n,e,l),ir(n,e,l))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var l=on(),d=js(l);d.tag=1,d.payload=n,i!=null&&(d.callback=i),n=Rs(e,d,l),n!==null&&(Jt(n,e,l),ir(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=on(),l=js(i);l.tag=2,n!=null&&(l.callback=n),n=Rs(e,l,i),n!==null&&(Jt(n,e,i),ir(n,e,i))}};function wh(e,n,i,l,d,p,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,p,x):n.prototype&&n.prototype.isPureReactComponent?!Qi(i,l)||!Qi(d,p):!0}function _h(e,n,i,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,l),n.state!==e&&gu.enqueueReplaceState(n,n.state,null)}function va(e,n){var i=n;if("ref"in n){i={};for(var l in n)l!=="ref"&&(i[l]=n[l])}if(e=e.defaultProps){i===n&&(i=b({},i));for(var d in e)i[d]===void 0&&(i[d]=e[d])}return i}function Ch(e){Nl(e)}function Eh(e){console.error(e)}function Nh(e){Nl(e)}function Zl(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Th(e,n,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function yu(e,n,i){return i=js(i),i.tag=3,i.payload={element:null},i.callback=function(){Zl(e,n)},i}function Ah(e){return e=js(e),e.tag=3,e}function jh(e,n,i,l){var d=i.type.getDerivedStateFromError;if(typeof d=="function"){var p=l.value;e.payload=function(){return d(p)},e.callback=function(){Th(n,i,l)}}var x=i.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Th(n,i,l),typeof d!="function"&&(zs===null?zs=new Set([this]):zs.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function Ux(e,n,i,l,d){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=i.alternate,n!==null&&Za(n,i,d,!0),i=sn.current,i!==null){switch(i.tag){case 31:case 13:return kn===null?oo():i.alternate===null&&bt===0&&(bt=3),i.flags&=-257,i.flags|=65536,i.lanes=d,l===zl?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([l]):n.add(l),Pu(e,l,d)),!1;case 22:return i.flags|=65536,l===zl?i.flags|=16384:(n=i.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=n):(i=n.retryQueue,i===null?n.retryQueue=new Set([l]):i.add(l)),Pu(e,l,d)),!1}throw Error(r(435,i.tag))}return Pu(e,l,d),oo(),!1}if(Ie)return n=sn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,l!==Lc&&(e=Error(r(422),{cause:l}),er(bn(e,i)))):(l!==Lc&&(n=Error(r(423),{cause:l}),er(bn(n,i))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,l=bn(l,i),d=yu(e.stateNode,l,d),Wc(e,d),bt!==4&&(bt=2)),!1;var p=Error(r(520),{cause:l});if(p=bn(p,i),xr===null?xr=[p]:xr.push(p),bt!==4&&(bt=2),n===null)return!0;l=bn(l,i),i=n;do{switch(i.tag){case 3:return i.flags|=65536,e=d&-d,i.lanes|=e,e=yu(i.stateNode,l,e),Wc(i,e),!1;case 1:if(n=i.type,p=i.stateNode,(i.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(zs===null||!zs.has(p))))return i.flags|=65536,d&=-d,i.lanes|=d,d=Ah(d),jh(d,e,i,l),Wc(i,d),!1}i=i.return}while(i!==null);return!1}var bu=Error(r(461)),_t=!1;function Bt(e,n,i,l){n.child=e===null?Bp(n,null,i,l):ba(n,e.child,i,l)}function Rh(e,n,i,l,d){i=i.render;var p=n.ref;if("ref"in l){var x={};for(var w in l)w!=="ref"&&(x[w]=l[w])}else x=l;return ha(n),l=Jc(e,n,i,x,p,d),w=eu(),e!==null&&!_t?(tu(e,n,d),is(e,n,d)):(Ie&&w&&Bc(n),n.flags|=1,Bt(e,n,l,d),n.child)}function Oh(e,n,i,l,d){if(e===null){var p=i.type;return typeof p=="function"&&!Rc(p)&&p.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=p,Mh(e,n,p,l,d)):(e=Rl(i.type,null,l,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,!Eu(e,d)){var x=p.memoizedProps;if(i=i.compare,i=i!==null?i:Qi,i(x,l)&&e.ref===n.ref)return is(e,n,d)}return n.flags|=1,e=Jn(p,l),e.ref=n.ref,e.return=n,n.child=e}function Mh(e,n,i,l,d){if(e!==null){var p=e.memoizedProps;if(Qi(p,l)&&e.ref===n.ref)if(_t=!1,n.pendingProps=l=p,Eu(e,d))(e.flags&131072)!==0&&(_t=!0);else return n.lanes=e.lanes,is(e,n,d)}return xu(e,n,i,l,d)}function Bh(e,n,i,l){var d=l.children,p=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|i:i,e!==null){for(l=n.child=e.child,d=0;l!==null;)d=d|l.lanes|l.childLanes,l=l.sibling;l=d&~p}else l=0,n.child=null;return Dh(e,n,p,i,l)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Dl(n,p!==null?p.cachePool:null),p!==null?zp(n,p):Yc(),Up(n);else return l=n.lanes=536870912,Dh(e,n,p!==null?p.baseLanes|i:i,i,l)}else p!==null?(Dl(n,p.cachePool),zp(n,p),Ms(),n.memoizedState=null):(e!==null&&Dl(n,null),Yc(),Ms());return Bt(e,n,d,i),n.child}function fr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Dh(e,n,i,l,d){var p=Gc();return p=p===null?null:{parent:kt._currentValue,pool:p},n.memoizedState={baseLanes:i,cachePool:p},e!==null&&Dl(n,null),Yc(),Up(n),e!==null&&Za(e,n,l,!0),n.childLanes=d,null}function Ql(e,n){return n=Jl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Lh(e,n,i){return ba(n,e.child,null,i),e=Ql(n,n.pendingProps),e.flags|=2,an(n),n.memoizedState=null,e}function Hx(e,n,i){var l=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ie){if(l.mode==="hidden")return e=Ql(n,l),n.lanes=536870912,fr(null,e);if(Qc(n),(e=ot)?(e=Km(e,Sn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:$n,overflow:In}:null,retryLane:536870912,hydrationErrors:null},i=xp(e),i.return=n,n.child=i,Ot=n,ot=null)):e=null,e===null)throw Ns(n);return n.lanes=536870912,null}return Ql(n,l)}var p=e.memoizedState;if(p!==null){var x=p.dehydrated;if(Qc(n),d)if(n.flags&256)n.flags&=-257,n=Lh(e,n,i);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(_t||Za(e,n,i,!1),d=(i&e.childLanes)!==0,_t||d){if(l=rt,l!==null&&(x=Ii(l,i),x!==0&&x!==p.retryLane))throw p.retryLane=x,ua(e,x),Jt(l,e,x),bu;oo(),n=Lh(e,n,i)}else e=p.treeContext,ot=wn(x.nextSibling),Ot=n,Ie=!0,Es=null,Sn=!1,e!==null&&kp(n,e),n=Ql(n,l),n.flags|=4096;return n}return e=Jn(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Xl(e,n){var i=n.ref;if(i===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(e===null||e.ref!==i)&&(n.flags|=4194816)}}function xu(e,n,i,l,d){return ha(n),i=Jc(e,n,i,l,void 0,d),l=eu(),e!==null&&!_t?(tu(e,n,d),is(e,n,d)):(Ie&&l&&Bc(n),n.flags|=1,Bt(e,n,i,d),n.child)}function zh(e,n,i,l,d,p){return ha(n),n.updateQueue=null,i=$p(n,l,i,d),Hp(e),l=eu(),e!==null&&!_t?(tu(e,n,p),is(e,n,p)):(Ie&&l&&Bc(n),n.flags|=1,Bt(e,n,i,p),n.child)}function Uh(e,n,i,l,d){if(ha(n),n.stateNode===null){var p=Va,x=i.contextType;typeof x=="object"&&x!==null&&(p=Mt(x)),p=new i(l,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=gu,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=l,p.state=n.memoizedState,p.refs={},qc(n),x=i.contextType,p.context=typeof x=="object"&&x!==null?Mt(x):Va,p.state=n.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&(mu(n,i,x,l),p.state=n.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(x=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),x!==p.state&&gu.enqueueReplaceState(p,p.state,null),lr(n,l,p,d),rr(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){p=n.stateNode;var w=n.memoizedProps,N=va(i,w);p.props=N;var L=p.context,G=i.contextType;x=Va,typeof G=="object"&&G!==null&&(x=Mt(G));var V=i.getDerivedStateFromProps;G=typeof V=="function"||typeof p.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,G||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w||L!==x)&&_h(n,p,l,x),As=!1;var z=n.memoizedState;p.state=z,lr(n,l,p,d),rr(),L=n.memoizedState,w||z!==L||As?(typeof V=="function"&&(mu(n,i,V,l),L=n.memoizedState),(N=As||wh(n,i,N,l,z,L,x))?(G||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=L),p.props=l,p.state=L,p.context=x,l=N):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{p=n.stateNode,Vc(e,n),x=n.memoizedProps,G=va(i,x),p.props=G,V=n.pendingProps,z=p.context,L=i.contextType,N=Va,typeof L=="object"&&L!==null&&(N=Mt(L)),w=i.getDerivedStateFromProps,(L=typeof w=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==V||z!==N)&&_h(n,p,l,N),As=!1,z=n.memoizedState,p.state=z,lr(n,l,p,d),rr();var $=n.memoizedState;x!==V||z!==$||As||e!==null&&e.dependencies!==null&&Ml(e.dependencies)?(typeof w=="function"&&(mu(n,i,w,l),$=n.memoizedState),(G=As||wh(n,i,G,l,z,$,N)||e!==null&&e.dependencies!==null&&Ml(e.dependencies))?(L||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,$,N),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,$,N)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===e.memoizedProps&&z===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&z===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=$),p.props=l,p.state=$,p.context=N,l=G):(typeof p.componentDidUpdate!="function"||x===e.memoizedProps&&z===e.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&z===e.memoizedState||(n.flags|=1024),l=!1)}return p=l,Xl(e,n),l=(n.flags&128)!==0,p||l?(p=n.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,e!==null&&l?(n.child=ba(n,e.child,null,d),n.child=ba(n,null,i,d)):Bt(e,n,i,d),n.memoizedState=p.state,e=n.child):e=is(e,n,d),e}function Hh(e,n,i,l){return fa(),n.flags|=256,Bt(e,n,i,l),n.child}var vu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Su(e){return{baseLanes:e,cachePool:Tp()}}function ku(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=ln),e}function $h(e,n,i){var l=n.pendingProps,d=!1,p=(n.flags&128)!==0,x;if((x=p)||(x=e!==null&&e.memoizedState===null?!1:(xt.current&2)!==0),x&&(d=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ie){if(d?Os(n):Ms(),(e=ot)?(e=Km(e,Sn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:$n,overflow:In}:null,retryLane:536870912,hydrationErrors:null},i=xp(e),i.return=n,n.child=i,Ot=n,ot=null)):e=null,e===null)throw Ns(n);return ad(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,d?(Ms(),d=n.mode,w=Jl({mode:"hidden",children:w},d),l=da(l,d,i,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=Su(i),l.childLanes=ku(e,x,i),n.memoizedState=vu,fr(null,l)):(Os(n),wu(n,w))}var N=e.memoizedState;if(N!==null&&(w=N.dehydrated,w!==null)){if(p)n.flags&256?(Os(n),n.flags&=-257,n=_u(e,n,i)):n.memoizedState!==null?(Ms(),n.child=e.child,n.flags|=128,n=null):(Ms(),w=l.fallback,d=n.mode,l=Jl({mode:"visible",children:l.children},d),w=da(w,d,i,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,ba(n,e.child,null,i),l=n.child,l.memoizedState=Su(i),l.childLanes=ku(e,x,i),n.memoizedState=vu,n=fr(null,l));else if(Os(n),ad(w)){if(x=w.nextSibling&&w.nextSibling.dataset,x)var L=x.dgst;x=L,l=Error(r(419)),l.stack="",l.digest=x,er({value:l,source:null,stack:null}),n=_u(e,n,i)}else if(_t||Za(e,n,i,!1),x=(i&e.childLanes)!==0,_t||x){if(x=rt,x!==null&&(l=Ii(x,i),l!==0&&l!==N.retryLane))throw N.retryLane=l,ua(e,l),Jt(x,e,l),bu;sd(w)||oo(),n=_u(e,n,i)}else sd(w)?(n.flags|=192,n.child=e.child,n=null):(e=N.treeContext,ot=wn(w.nextSibling),Ot=n,Ie=!0,Es=null,Sn=!1,e!==null&&kp(n,e),n=wu(n,l.children),n.flags|=4096);return n}return d?(Ms(),w=l.fallback,d=n.mode,N=e.child,L=N.sibling,l=Jn(N,{mode:"hidden",children:l.children}),l.subtreeFlags=N.subtreeFlags&65011712,L!==null?w=Jn(L,w):(w=da(w,d,i,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,fr(null,l),l=n.child,w=e.child.memoizedState,w===null?w=Su(i):(d=w.cachePool,d!==null?(N=kt._currentValue,d=d.parent!==N?{parent:N,pool:N}:d):d=Tp(),w={baseLanes:w.baseLanes|i,cachePool:d}),l.memoizedState=w,l.childLanes=ku(e,x,i),n.memoizedState=vu,fr(e.child,l)):(Os(n),i=e.child,e=i.sibling,i=Jn(i,{mode:"visible",children:l.children}),i.return=n,i.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=i,n.memoizedState=null,i)}function wu(e,n){return n=Jl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Jl(e,n){return e=nn(22,e,null,n),e.lanes=0,e}function _u(e,n,i){return ba(n,e.child,null,i),e=wu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ih(e,n,i){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),Hc(e.return,n,i)}function Cu(e,n,i,l,d,p){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:d,treeForkCount:p}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=i,x.tailMode=d,x.treeForkCount=p)}function Ph(e,n,i){var l=n.pendingProps,d=l.revealOrder,p=l.tail;l=l.children;var x=xt.current,w=(x&2)!==0;if(w?(x=x&1|2,n.flags|=128):x&=1,se(xt,x),Bt(e,n,l,i),l=Ie?Ji:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ih(e,i,n);else if(e.tag===19)Ih(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(i=n.child,d=null;i!==null;)e=i.alternate,e!==null&&Il(e)===null&&(d=i),i=i.sibling;i=d,i===null?(d=n.child,n.child=null):(d=i.sibling,i.sibling=null),Cu(n,!1,d,i,p,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&Il(e)===null){n.child=d;break}e=d.sibling,d.sibling=i,i=d,d=e}Cu(n,!0,i,null,p,l);break;case"together":Cu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function is(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Ls|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(Za(e,n,i,!1),(i&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=Jn(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=Jn(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function Eu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ml(e)))}function $x(e,n,i){switch(n.tag){case 3:jt(n,n.stateNode.containerInfo),Ts(n,kt,e.memoizedState.cache),fa();break;case 27:case 5:gt(n);break;case 4:jt(n,n.stateNode.containerInfo);break;case 10:Ts(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Qc(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(Os(n),n.flags|=128,null):(i&n.child.childLanes)!==0?$h(e,n,i):(Os(n),e=is(e,n,i),e!==null?e.sibling:null);Os(n);break;case 19:var d=(e.flags&128)!==0;if(l=(i&n.childLanes)!==0,l||(Za(e,n,i,!1),l=(i&n.childLanes)!==0),d){if(l)return Ph(e,n,i);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),se(xt,xt.current),l)break;return null;case 22:return n.lanes=0,Bh(e,n,i,n.pendingProps);case 24:Ts(n,kt,e.memoizedState.cache)}return is(e,n,i)}function Gh(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)_t=!0;else{if(!Eu(e,i)&&(n.flags&128)===0)return _t=!1,$x(e,n,i);_t=(e.flags&131072)!==0}else _t=!1,Ie&&(n.flags&1048576)!==0&&Sp(n,Ji,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=ga(n.elementType),n.type=e,typeof e=="function")Rc(e)?(l=va(e,l),n.tag=1,n=Uh(null,n,e,l,i)):(n.tag=0,n=xu(null,n,e,l,i));else{if(e!=null){var d=e.$$typeof;if(d===U){n.tag=11,n=Rh(null,n,e,l,i);break e}else if(d===Z){n.tag=14,n=Oh(null,n,e,l,i);break e}}throw n=Y(e)||e,Error(r(306,n,""))}}return n;case 0:return xu(e,n,n.type,n.pendingProps,i);case 1:return l=n.type,d=va(l,n.pendingProps),Uh(e,n,l,d,i);case 3:e:{if(jt(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var p=n.memoizedState;d=p.element,Vc(e,n),lr(n,l,null,i);var x=n.memoizedState;if(l=x.cache,Ts(n,kt,l),l!==p.cache&&$c(n,[kt],i,!0),rr(),l=x.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=Hh(e,n,l,i);break e}else if(l!==d){d=bn(Error(r(424)),n),er(d),n=Hh(e,n,l,i);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ot=wn(e.firstChild),Ot=n,Ie=!0,Es=null,Sn=!0,i=Bp(n,null,l,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(fa(),l===d){n=is(e,n,i);break e}Bt(e,n,l,i)}n=n.child}return n;case 26:return Xl(e,n),e===null?(i=eg(n.type,null,n.pendingProps,null))?n.memoizedState=i:Ie||(i=n.type,e=n.pendingProps,l=go(et.current).createElement(i),l[Nt]=n,l[zt]=e,Dt(l,i,e),xe(l),n.stateNode=l):n.memoizedState=eg(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return gt(n),e===null&&Ie&&(l=n.stateNode=Qm(n.type,n.pendingProps,et.current),Ot=n,Sn=!0,d=ot,Is(n.type)?(id=d,ot=wn(l.firstChild)):ot=d),Bt(e,n,n.pendingProps.children,i),Xl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ie&&((d=l=ot)&&(l=gv(l,n.type,n.pendingProps,Sn),l!==null?(n.stateNode=l,Ot=n,ot=wn(l.firstChild),Sn=!1,d=!0):d=!1),d||Ns(n)),gt(n),d=n.type,p=n.pendingProps,x=e!==null?e.memoizedProps:null,l=p.children,ed(d,p)?l=null:x!==null&&ed(d,x)&&(n.flags|=32),n.memoizedState!==null&&(d=Jc(e,n,Rx,null,null,i),Nr._currentValue=d),Xl(e,n),Bt(e,n,l,i),n.child;case 6:return e===null&&Ie&&((e=i=ot)&&(i=yv(i,n.pendingProps,Sn),i!==null?(n.stateNode=i,Ot=n,ot=null,e=!0):e=!1),e||Ns(n)),null;case 13:return $h(e,n,i);case 4:return jt(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=ba(n,null,l,i):Bt(e,n,l,i),n.child;case 11:return Rh(e,n,n.type,n.pendingProps,i);case 7:return Bt(e,n,n.pendingProps,i),n.child;case 8:return Bt(e,n,n.pendingProps.children,i),n.child;case 12:return Bt(e,n,n.pendingProps.children,i),n.child;case 10:return l=n.pendingProps,Ts(n,n.type,l.value),Bt(e,n,l.children,i),n.child;case 9:return d=n.type._context,l=n.pendingProps.children,ha(n),d=Mt(d),l=l(d),n.flags|=1,Bt(e,n,l,i),n.child;case 14:return Oh(e,n,n.type,n.pendingProps,i);case 15:return Mh(e,n,n.type,n.pendingProps,i);case 19:return Ph(e,n,i);case 31:return Hx(e,n,i);case 22:return Bh(e,n,i,n.pendingProps);case 24:return ha(n),l=Mt(kt),e===null?(d=Gc(),d===null&&(d=rt,p=Ic(),d.pooledCache=p,p.refCount++,p!==null&&(d.pooledCacheLanes|=i),d=p),n.memoizedState={parent:l,cache:d},qc(n),Ts(n,kt,d)):((e.lanes&i)!==0&&(Vc(e,n),lr(n,null,null,i),rr()),d=e.memoizedState,p=n.memoizedState,d.parent!==l?(d={parent:l,cache:l},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),Ts(n,kt,l)):(l=p.cache,Ts(n,kt,l),l!==d.cache&&$c(n,[kt],i,!0))),Bt(e,n,n.pendingProps.children,i),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function rs(e){e.flags|=4}function Nu(e,n,i,l,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(gm())e.flags|=8192;else throw ya=zl,Fc}else e.flags&=-16777217}function Fh(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ig(n))if(gm())e.flags|=8192;else throw ya=zl,Fc}function eo(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Ba():536870912,e.lanes|=n,oi|=n)}function pr(e,n){if(!Ie)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function ct(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(n)for(var d=e.child;d!==null;)i|=d.lanes|d.childLanes,l|=d.subtreeFlags&65011712,l|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)i|=d.lanes|d.childLanes,l|=d.subtreeFlags,l|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=l,e.childLanes=i,n}function Ix(e,n,i){var l=n.pendingProps;switch(Dc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(n),null;case 1:return ct(n),null;case 3:return i=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),ns(kt),Ht(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ya(n)?rs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,zc())),ct(n),null;case 26:var d=n.type,p=n.memoizedState;return e===null?(rs(n),p!==null?(ct(n),Fh(n,p)):(ct(n),Nu(n,d,null,l,i))):p?p!==e.memoizedState?(rs(n),ct(n),Fh(n,p)):(ct(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&rs(n),ct(n),Nu(n,d,e,l,i)),null;case 27:if(Oe(n),i=et.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&rs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return ct(n),null}e=le.current,Ya(n)?wp(n):(e=Qm(d,l,i),n.stateNode=e,rs(n))}return ct(n),null;case 5:if(Oe(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&rs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return ct(n),null}if(p=le.current,Ya(n))wp(n);else{var x=go(et.current);switch(p){case 1:p=x.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:p=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":p=x.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":p=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":p=x.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?x.createElement(d,{is:l.is}):x.createElement(d)}}p[Nt]=n,p[zt]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=p;e:switch(Dt(p,d,l),d){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&rs(n)}}return ct(n),Nu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&rs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=et.current,Ya(n)){if(e=n.stateNode,i=n.memoizedProps,l=null,d=Ot,d!==null)switch(d.tag){case 27:case 5:l=d.memoizedProps}e[Nt]=n,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||$m(e.nodeValue,i)),e||Ns(n,!0)}else e=go(e).createTextNode(l),e[Nt]=n,n.stateNode=e}return ct(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(l=Ya(n),i!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Nt]=n}else fa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ct(n),e=!1}else i=zc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(an(n),n):(an(n),null);if((n.flags&128)!==0)throw Error(r(558))}return ct(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=Ya(n),l!==null&&l.dehydrated!==null){if(e===null){if(!d)throw Error(r(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[Nt]=n}else fa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ct(n),d=!1}else d=zc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(an(n),n):(an(n),null)}return an(n),(n.flags&128)!==0?(n.lanes=i,n):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=n.child,d=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(d=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==d&&(l.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),eo(n,n.updateQueue),ct(n),null);case 4:return Ht(),e===null&&Yu(n.stateNode.containerInfo),ct(n),null;case 10:return ns(n.type),ct(n),null;case 19:if(X(xt),l=n.memoizedState,l===null)return ct(n),null;if(d=(n.flags&128)!==0,p=l.rendering,p===null)if(d)pr(l,!1);else{if(bt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=Il(e),p!==null){for(n.flags|=128,pr(l,!1),e=p.updateQueue,n.updateQueue=e,eo(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)bp(i,e),i=i.sibling;return se(xt,xt.current&1|2),Ie&&es(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Rt()>io&&(n.flags|=128,d=!0,pr(l,!1),n.lanes=4194304)}else{if(!d)if(e=Il(p),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,eo(n,e),pr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!Ie)return ct(n),null}else 2*Rt()-l.renderingStartTime>io&&i!==536870912&&(n.flags|=128,d=!0,pr(l,!1),n.lanes=4194304);l.isBackwards?(p.sibling=n.child,n.child=p):(e=l.last,e!==null?e.sibling=p:n.child=p,l.last=p)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Rt(),e.sibling=null,i=xt.current,se(xt,d?i&1|2:i&1),Ie&&es(n,l.treeForkCount),e):(ct(n),null);case 22:case 23:return an(n),Zc(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(i&536870912)!==0&&(n.flags&128)===0&&(ct(n),n.subtreeFlags&6&&(n.flags|=8192)):ct(n),i=n.updateQueue,i!==null&&eo(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==i&&(n.flags|=2048),e!==null&&X(ma),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),ns(kt),ct(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function Px(e,n){switch(Dc(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ns(kt),Ht(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Oe(n),null;case 31:if(n.memoizedState!==null){if(an(n),n.alternate===null)throw Error(r(340));fa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(an(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));fa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return X(xt),null;case 4:return Ht(),null;case 10:return ns(n.type),null;case 22:case 23:return an(n),Zc(),e!==null&&X(ma),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return ns(kt),null;case 25:return null;default:return null}}function qh(e,n){switch(Dc(n),n.tag){case 3:ns(kt),Ht();break;case 26:case 27:case 5:Oe(n);break;case 4:Ht();break;case 31:n.memoizedState!==null&&an(n);break;case 13:an(n);break;case 19:X(xt);break;case 10:ns(n.type);break;case 22:case 23:an(n),Zc(),e!==null&&X(ma);break;case 24:ns(kt)}}function hr(e,n){try{var i=n.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var d=l.next;i=d;do{if((i.tag&e)===e){l=void 0;var p=i.create,x=i.inst;l=p(),x.destroy=l}i=i.next}while(i!==d)}}catch(w){Je(n,n.return,w)}}function Bs(e,n,i){try{var l=n.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var p=d.next;l=p;do{if((l.tag&e)===e){var x=l.inst,w=x.destroy;if(w!==void 0){x.destroy=void 0,d=n;var N=i,L=w;try{L()}catch(G){Je(d,N,G)}}}l=l.next}while(l!==p)}}catch(G){Je(n,n.return,G)}}function Vh(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{Lp(n,i)}catch(l){Je(e,e.return,l)}}}function Wh(e,n,i){i.props=va(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){Je(e,n,l)}}function mr(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(d){Je(e,n,d)}}function Pn(e,n){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(d){Je(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(d){Je(e,n,d)}else i.current=null}function Kh(e){var n=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(d){Je(e,e.return,d)}}function Tu(e,n,i){try{var l=e.stateNode;uv(l,e.type,i,n),l[zt]=n}catch(d){Je(e,e.return,d)}}function Yh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Is(e.type)||e.tag===4}function Au(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Is(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ju(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(e),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Qn));else if(l!==4&&(l===27&&Is(e.type)&&(i=e.stateNode,n=null),e=e.child,e!==null))for(ju(e,n,i),e=e.sibling;e!==null;)ju(e,n,i),e=e.sibling}function to(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(l!==4&&(l===27&&Is(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(to(e,n,i),e=e.sibling;e!==null;)to(e,n,i),e=e.sibling}function Zh(e){var n=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);Dt(n,l,i),n[Nt]=e,n[zt]=i}catch(p){Je(e,e.return,p)}}var ls=!1,Ct=!1,Ru=!1,Qh=typeof WeakSet=="function"?WeakSet:Set,At=null;function Gx(e,n){if(e=e.containerInfo,Xu=wo,e=cp(e),_c(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var d=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{i.nodeType,p.nodeType}catch{i=null;break e}var x=0,w=-1,N=-1,L=0,G=0,V=e,z=null;t:for(;;){for(var $;V!==i||d!==0&&V.nodeType!==3||(w=x+d),V!==p||l!==0&&V.nodeType!==3||(N=x+l),V.nodeType===3&&(x+=V.nodeValue.length),($=V.firstChild)!==null;)z=V,V=$;for(;;){if(V===e)break t;if(z===i&&++L===d&&(w=x),z===p&&++G===l&&(N=x),($=V.nextSibling)!==null)break;V=z,z=V.parentNode}V=$}i=w===-1||N===-1?null:{start:w,end:N}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ju={focusedElem:e,selectionRange:i},wo=!1,At=n;At!==null;)if(n=At,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,At=e;else for(;At!==null;){switch(n=At,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)d=e[i],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,i=n,d=p.memoizedProps,p=p.memoizedState,l=i.stateNode;try{var re=va(i.type,d);e=l.getSnapshotBeforeUpdate(re,p),l.__reactInternalSnapshotBeforeUpdate=e}catch(ye){Je(i,i.return,ye)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,i=e.nodeType,i===9)nd(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":nd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,At=e;break}At=n.return}}function Xh(e,n,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:cs(e,i),l&4&&hr(5,i);break;case 1:if(cs(e,i),l&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(x){Je(i,i.return,x)}else{var d=va(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){Je(i,i.return,x)}}l&64&&Vh(i),l&512&&mr(i,i.return);break;case 3:if(cs(e,i),l&64&&(e=i.updateQueue,e!==null)){if(n=null,i.child!==null)switch(i.child.tag){case 27:case 5:n=i.child.stateNode;break;case 1:n=i.child.stateNode}try{Lp(e,n)}catch(x){Je(i,i.return,x)}}break;case 27:n===null&&l&4&&Zh(i);case 26:case 5:cs(e,i),n===null&&l&4&&Kh(i),l&512&&mr(i,i.return);break;case 12:cs(e,i);break;case 31:cs(e,i),l&4&&tm(e,i);break;case 13:cs(e,i),l&4&&nm(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Xx.bind(null,i),bv(e,i))));break;case 22:if(l=i.memoizedState!==null||ls,!l){n=n!==null&&n.memoizedState!==null||Ct,d=ls;var p=Ct;ls=l,(Ct=n)&&!p?us(e,i,(i.subtreeFlags&8772)!==0):cs(e,i),ls=d,Ct=p}break;case 30:break;default:cs(e,i)}}function Jh(e){var n=e.alternate;n!==null&&(e.alternate=null,Jh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&B(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var dt=null,Yt=!1;function os(e,n,i){for(i=i.child;i!==null;)em(e,n,i),i=i.sibling}function em(e,n,i){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(Ss,i)}catch{}switch(i.tag){case 26:Ct||Pn(i,n),os(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Ct||Pn(i,n);var l=dt,d=Yt;Is(i.type)&&(dt=i.stateNode,Yt=!1),os(e,n,i),_r(i.stateNode),dt=l,Yt=d;break;case 5:Ct||Pn(i,n);case 6:if(l=dt,d=Yt,dt=null,os(e,n,i),dt=l,Yt=d,dt!==null)if(Yt)try{(dt.nodeType===9?dt.body:dt.nodeName==="HTML"?dt.ownerDocument.body:dt).removeChild(i.stateNode)}catch(p){Je(i,n,p)}else try{dt.removeChild(i.stateNode)}catch(p){Je(i,n,p)}break;case 18:dt!==null&&(Yt?(e=dt,Vm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),gi(e)):Vm(dt,i.stateNode));break;case 4:l=dt,d=Yt,dt=i.stateNode.containerInfo,Yt=!0,os(e,n,i),dt=l,Yt=d;break;case 0:case 11:case 14:case 15:Bs(2,i,n),Ct||Bs(4,i,n),os(e,n,i);break;case 1:Ct||(Pn(i,n),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Wh(i,n,l)),os(e,n,i);break;case 21:os(e,n,i);break;case 22:Ct=(l=Ct)||i.memoizedState!==null,os(e,n,i),Ct=l;break;default:os(e,n,i)}}function tm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{gi(e)}catch(i){Je(n,n.return,i)}}}function nm(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{gi(e)}catch(i){Je(n,n.return,i)}}function Fx(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Qh),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Qh),n;default:throw Error(r(435,e.tag))}}function no(e,n){var i=Fx(e);n.forEach(function(l){if(!i.has(l)){i.add(l);var d=Jx.bind(null,e,l);l.then(d,d)}})}function Zt(e,n){var i=n.deletions;if(i!==null)for(var l=0;l<i.length;l++){var d=i[l],p=e,x=n,w=x;e:for(;w!==null;){switch(w.tag){case 27:if(Is(w.type)){dt=w.stateNode,Yt=!1;break e}break;case 5:dt=w.stateNode,Yt=!1;break e;case 3:case 4:dt=w.stateNode.containerInfo,Yt=!0;break e}w=w.return}if(dt===null)throw Error(r(160));em(p,x,d),dt=null,Yt=!1,p=d.alternate,p!==null&&(p.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)sm(n,e),n=n.sibling}var Mn=null;function sm(e,n){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Zt(n,e),Qt(e),l&4&&(Bs(3,e,e.return),hr(3,e),Bs(5,e,e.return));break;case 1:Zt(n,e),Qt(e),l&512&&(Ct||i===null||Pn(i,i.return)),l&64&&ls&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var d=Mn;if(Zt(n,e),Qt(e),l&512&&(Ct||i===null||Pn(i,i.return)),l&4){var p=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,d=d.ownerDocument||d;t:switch(l){case"title":p=d.getElementsByTagName("title")[0],(!p||p[ra]||p[Nt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=d.createElement(l),d.head.insertBefore(p,d.querySelector("head > title"))),Dt(p,l,i),p[Nt]=e,xe(p),l=p;break e;case"link":var x=sg("link","href",d).get(l+(i.href||""));if(x){for(var w=0;w<x.length;w++)if(p=x[w],p.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&p.getAttribute("rel")===(i.rel==null?null:i.rel)&&p.getAttribute("title")===(i.title==null?null:i.title)&&p.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){x.splice(w,1);break t}}p=d.createElement(l),Dt(p,l,i),d.head.appendChild(p);break;case"meta":if(x=sg("meta","content",d).get(l+(i.content||""))){for(w=0;w<x.length;w++)if(p=x[w],p.getAttribute("content")===(i.content==null?null:""+i.content)&&p.getAttribute("name")===(i.name==null?null:i.name)&&p.getAttribute("property")===(i.property==null?null:i.property)&&p.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&p.getAttribute("charset")===(i.charSet==null?null:i.charSet)){x.splice(w,1);break t}}p=d.createElement(l),Dt(p,l,i),d.head.appendChild(p);break;default:throw Error(r(468,l))}p[Nt]=e,xe(p),l=p}e.stateNode=l}else ag(d,e.type,e.stateNode);else e.stateNode=ng(d,l,e.memoizedProps);else p!==l?(p===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):p.count--,l===null?ag(d,e.type,e.stateNode):ng(d,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Tu(e,e.memoizedProps,i.memoizedProps)}break;case 27:Zt(n,e),Qt(e),l&512&&(Ct||i===null||Pn(i,i.return)),i!==null&&l&4&&Tu(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Zt(n,e),Qt(e),l&512&&(Ct||i===null||Pn(i,i.return)),e.flags&32){d=e.stateNode;try{Ha(d,"")}catch(re){Je(e,e.return,re)}}l&4&&e.stateNode!=null&&(d=e.memoizedProps,Tu(e,d,i!==null?i.memoizedProps:d)),l&1024&&(Ru=!0);break;case 6:if(Zt(n,e),Qt(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(re){Je(e,e.return,re)}}break;case 3:if(xo=null,d=Mn,Mn=yo(n.containerInfo),Zt(n,e),Mn=d,Qt(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{gi(n.containerInfo)}catch(re){Je(e,e.return,re)}Ru&&(Ru=!1,am(e));break;case 4:l=Mn,Mn=yo(e.stateNode.containerInfo),Zt(n,e),Qt(e),Mn=l;break;case 12:Zt(n,e),Qt(e);break;case 31:Zt(n,e),Qt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,no(e,l)));break;case 13:Zt(n,e),Qt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(ao=Rt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,no(e,l)));break;case 22:d=e.memoizedState!==null;var N=i!==null&&i.memoizedState!==null,L=ls,G=Ct;if(ls=L||d,Ct=G||N,Zt(n,e),Ct=G,ls=L,Qt(e),l&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(i===null||N||ls||Ct||Sa(e)),i=null,n=e;;){if(n.tag===5||n.tag===26){if(i===null){N=i=n;try{if(p=N.stateNode,d)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{w=N.stateNode;var V=N.memoizedProps.style,z=V!=null&&V.hasOwnProperty("display")?V.display:null;w.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(re){Je(N,N.return,re)}}}else if(n.tag===6){if(i===null){N=n;try{N.stateNode.nodeValue=d?"":N.memoizedProps}catch(re){Je(N,N.return,re)}}}else if(n.tag===18){if(i===null){N=n;try{var $=N.stateNode;d?Wm($,!0):Wm(N.stateNode,!1)}catch(re){Je(N,N.return,re)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;i===n&&(i=null),n=n.return}i===n&&(i=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,no(e,i))));break;case 19:Zt(n,e),Qt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,no(e,l)));break;case 30:break;case 21:break;default:Zt(n,e),Qt(e)}}function Qt(e){var n=e.flags;if(n&2){try{for(var i,l=e.return;l!==null;){if(Yh(l)){i=l;break}l=l.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var d=i.stateNode,p=Au(e);to(e,p,d);break;case 5:var x=i.stateNode;i.flags&32&&(Ha(x,""),i.flags&=-33);var w=Au(e);to(e,w,x);break;case 3:case 4:var N=i.stateNode.containerInfo,L=Au(e);ju(e,L,N);break;default:throw Error(r(161))}}catch(G){Je(e,e.return,G)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function am(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;am(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function cs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Xh(e,n.alternate,n),n=n.sibling}function Sa(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Bs(4,n,n.return),Sa(n);break;case 1:Pn(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&Wh(n,n.return,i),Sa(n);break;case 27:_r(n.stateNode);case 26:case 5:Pn(n,n.return),Sa(n);break;case 22:n.memoizedState===null&&Sa(n);break;case 30:Sa(n);break;default:Sa(n)}e=e.sibling}}function us(e,n,i){for(i=i&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,d=e,p=n,x=p.flags;switch(p.tag){case 0:case 11:case 15:us(d,p,i),hr(4,p);break;case 1:if(us(d,p,i),l=p,d=l.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(L){Je(l,l.return,L)}if(l=p,d=l.updateQueue,d!==null){var w=l.stateNode;try{var N=d.shared.hiddenCallbacks;if(N!==null)for(d.shared.hiddenCallbacks=null,d=0;d<N.length;d++)Dp(N[d],w)}catch(L){Je(l,l.return,L)}}i&&x&64&&Vh(p),mr(p,p.return);break;case 27:Zh(p);case 26:case 5:us(d,p,i),i&&l===null&&x&4&&Kh(p),mr(p,p.return);break;case 12:us(d,p,i);break;case 31:us(d,p,i),i&&x&4&&tm(d,p);break;case 13:us(d,p,i),i&&x&4&&nm(d,p);break;case 22:p.memoizedState===null&&us(d,p,i),mr(p,p.return);break;case 30:break;default:us(d,p,i)}n=n.sibling}}function Ou(e,n){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&tr(i))}function Mu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&tr(e))}function Bn(e,n,i,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)im(e,n,i,l),n=n.sibling}function im(e,n,i,l){var d=n.flags;switch(n.tag){case 0:case 11:case 15:Bn(e,n,i,l),d&2048&&hr(9,n);break;case 1:Bn(e,n,i,l);break;case 3:Bn(e,n,i,l),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&tr(e)));break;case 12:if(d&2048){Bn(e,n,i,l),e=n.stateNode;try{var p=n.memoizedProps,x=p.id,w=p.onPostCommit;typeof w=="function"&&w(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Je(n,n.return,N)}}else Bn(e,n,i,l);break;case 31:Bn(e,n,i,l);break;case 13:Bn(e,n,i,l);break;case 23:break;case 22:p=n.stateNode,x=n.alternate,n.memoizedState!==null?p._visibility&2?Bn(e,n,i,l):gr(e,n):p._visibility&2?Bn(e,n,i,l):(p._visibility|=2,ii(e,n,i,l,(n.subtreeFlags&10256)!==0||!1)),d&2048&&Ou(x,n);break;case 24:Bn(e,n,i,l),d&2048&&Mu(n.alternate,n);break;default:Bn(e,n,i,l)}}function ii(e,n,i,l,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=e,x=n,w=i,N=l,L=x.flags;switch(x.tag){case 0:case 11:case 15:ii(p,x,w,N,d),hr(8,x);break;case 23:break;case 22:var G=x.stateNode;x.memoizedState!==null?G._visibility&2?ii(p,x,w,N,d):gr(p,x):(G._visibility|=2,ii(p,x,w,N,d)),d&&L&2048&&Ou(x.alternate,x);break;case 24:ii(p,x,w,N,d),d&&L&2048&&Mu(x.alternate,x);break;default:ii(p,x,w,N,d)}n=n.sibling}}function gr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var i=e,l=n,d=l.flags;switch(l.tag){case 22:gr(i,l),d&2048&&Ou(l.alternate,l);break;case 24:gr(i,l),d&2048&&Mu(l.alternate,l);break;default:gr(i,l)}n=n.sibling}}var yr=8192;function ri(e,n,i){if(e.subtreeFlags&yr)for(e=e.child;e!==null;)rm(e,n,i),e=e.sibling}function rm(e,n,i){switch(e.tag){case 26:ri(e,n,i),e.flags&yr&&e.memoizedState!==null&&jv(i,Mn,e.memoizedState,e.memoizedProps);break;case 5:ri(e,n,i);break;case 3:case 4:var l=Mn;Mn=yo(e.stateNode.containerInfo),ri(e,n,i),Mn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=yr,yr=16777216,ri(e,n,i),yr=l):ri(e,n,i));break;default:ri(e,n,i)}}function lm(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function br(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];At=l,cm(l,e)}lm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)om(e),e=e.sibling}function om(e){switch(e.tag){case 0:case 11:case 15:br(e),e.flags&2048&&Bs(9,e,e.return);break;case 3:br(e);break;case 12:br(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,so(e)):br(e);break;default:br(e)}}function so(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];At=l,cm(l,e)}lm(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Bs(8,n,n.return),so(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,so(n));break;default:so(n)}e=e.sibling}}function cm(e,n){for(;At!==null;){var i=At;switch(i.tag){case 0:case 11:case 15:Bs(8,i,n);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:tr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,At=l;else e:for(i=e;At!==null;){l=At;var d=l.sibling,p=l.return;if(Jh(l),l===i){At=null;break e}if(d!==null){d.return=p,At=d;break e}At=p}}}var qx={getCacheForType:function(e){var n=Mt(kt),i=n.data.get(e);return i===void 0&&(i=e(),n.data.set(e,i)),i},cacheSignal:function(){return Mt(kt).controller.signal}},Vx=typeof WeakMap=="function"?WeakMap:Map,Ze=0,rt=null,De=null,He=0,Xe=0,rn=null,Ds=!1,li=!1,Bu=!1,ds=0,bt=0,Ls=0,ka=0,Du=0,ln=0,oi=0,xr=null,Xt=null,Lu=!1,ao=0,um=0,io=1/0,ro=null,zs=null,Tt=0,Us=null,ci=null,fs=0,zu=0,Uu=null,dm=null,vr=0,Hu=null;function on(){return(Ze&2)!==0&&He!==0?He&-He:H.T!==null?qu():La()}function fm(){if(ln===0)if((He&536870912)===0||Ie){var e=Ma;Ma<<=1,(Ma&3932160)===0&&(Ma=262144),ln=e}else ln=536870912;return e=sn.current,e!==null&&(e.flags|=32),ln}function Jt(e,n,i){(e===rt&&(Xe===2||Xe===9)||e.cancelPendingCommit!==null)&&(ui(e,0),Hs(e,He,ln,!1)),aa(e,i),((Ze&2)===0||e!==rt)&&(e===rt&&((Ze&2)===0&&(ka|=i),bt===4&&Hs(e,He,ln,!1)),Gn(e))}function pm(e,n,i){if((Ze&6)!==0)throw Error(r(327));var l=!i&&(n&127)===0&&(n&e.expiredLanes)===0||fn(e,n),d=l?Yx(e,n):Iu(e,n,!0),p=l;do{if(d===0){li&&!l&&Hs(e,n,0,!1);break}else{if(i=e.current.alternate,p&&!Wx(i)){d=Iu(e,n,!1),p=!1;continue}if(d===2){if(p=n,e.errorRecoveryDisabledLanes&p)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var w=e;d=xr;var N=w.current.memoizedState.isDehydrated;if(N&&(ui(w,x).flags|=256),x=Iu(w,x,!1),x!==2){if(Bu&&!N){w.errorRecoveryDisabledLanes|=p,ka|=p,d=4;break e}p=Xt,Xt=d,p!==null&&(Xt===null?Xt=p:Xt.push.apply(Xt,p))}d=x}if(p=!1,d!==2)continue}}if(d===1){ui(e,0),Hs(e,n,0,!0);break}e:{switch(l=e,p=d,p){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Hs(l,n,ln,!Ds);break e;case 2:Xt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(d=ao+300-Rt(),10<d)){if(Hs(l,n,ln,!Ds),na(l,0,!0)!==0)break e;fs=n,l.timeoutHandle=Fm(hm.bind(null,l,i,Xt,ro,Lu,n,ln,ka,oi,Ds,p,"Throttled",-0,0),d);break e}hm(l,i,Xt,ro,Lu,n,ln,ka,oi,Ds,p,null,-0,0)}}break}while(!0);Gn(e)}function hm(e,n,i,l,d,p,x,w,N,L,G,V,z,$){if(e.timeoutHandle=-1,V=n.subtreeFlags,V&8192||(V&16785408)===16785408){V={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qn},rm(n,p,V);var re=(p&62914560)===p?ao-Rt():(p&4194048)===p?um-Rt():0;if(re=Rv(V,re),re!==null){fs=p,e.cancelPendingCommit=re(km.bind(null,e,n,p,i,l,d,x,w,N,G,V,null,z,$)),Hs(e,p,x,!L);return}}km(e,n,p,i,l,d,x,w,N)}function Wx(e){for(var n=e;;){var i=n.tag;if((i===0||i===11||i===15)&&n.flags&16384&&(i=n.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var d=i[l],p=d.getSnapshot;d=d.value;try{if(!tn(p(),d))return!1}catch{return!1}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Hs(e,n,i,l){n&=~Du,n&=~ka,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var d=n;0<d;){var p=31-Pt(d),x=1<<p;l[p]=-1,d&=~x}i!==0&&Hi(e,i,n)}function lo(){return(Ze&6)===0?(Sr(0),!1):!0}function $u(){if(De!==null){if(Xe===0)var e=De.return;else e=De,ts=pa=null,nu(e),ei=null,sr=0,e=De;for(;e!==null;)qh(e.alternate,e),e=e.return;De=null}}function ui(e,n){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,pv(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),fs=0,$u(),rt=e,De=i=Jn(e.current,null),He=n,Xe=0,rn=null,Ds=!1,li=fn(e,n),Bu=!1,oi=ln=Du=ka=Ls=bt=0,Xt=xr=null,Lu=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var d=31-Pt(l),p=1<<d;n|=e[d],l&=~p}return ds=n,Tl(),i}function mm(e,n){Ne=null,H.H=dr,n===Ja||n===Ll?(n=Rp(),Xe=3):n===Fc?(n=Rp(),Xe=4):Xe=n===bu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,rn=n,De===null&&(bt=1,Zl(e,bn(n,e.current)))}function gm(){var e=sn.current;return e===null?!0:(He&4194048)===He?kn===null:(He&62914560)===He||(He&536870912)!==0?e===kn:!1}function ym(){var e=H.H;return H.H=dr,e===null?dr:e}function bm(){var e=H.A;return H.A=qx,e}function oo(){bt=4,Ds||(He&4194048)!==He&&sn.current!==null||(li=!0),(Ls&134217727)===0&&(ka&134217727)===0||rt===null||Hs(rt,He,ln,!1)}function Iu(e,n,i){var l=Ze;Ze|=2;var d=ym(),p=bm();(rt!==e||He!==n)&&(ro=null,ui(e,n)),n=!1;var x=bt;e:do try{if(Xe!==0&&De!==null){var w=De,N=rn;switch(Xe){case 8:$u(),x=6;break e;case 3:case 2:case 9:case 6:sn.current===null&&(n=!0);var L=Xe;if(Xe=0,rn=null,di(e,w,N,L),i&&li){x=0;break e}break;default:L=Xe,Xe=0,rn=null,di(e,w,N,L)}}Kx(),x=bt;break}catch(G){mm(e,G)}while(!0);return n&&e.shellSuspendCounter++,ts=pa=null,Ze=l,H.H=d,H.A=p,De===null&&(rt=null,He=0,Tl()),x}function Kx(){for(;De!==null;)xm(De)}function Yx(e,n){var i=Ze;Ze|=2;var l=ym(),d=bm();rt!==e||He!==n?(ro=null,io=Rt()+500,ui(e,n)):li=fn(e,n);e:do try{if(Xe!==0&&De!==null){n=De;var p=rn;t:switch(Xe){case 1:Xe=0,rn=null,di(e,n,p,1);break;case 2:case 9:if(Ap(p)){Xe=0,rn=null,vm(n);break}n=function(){Xe!==2&&Xe!==9||rt!==e||(Xe=7),Gn(e)},p.then(n,n);break e;case 3:Xe=7;break e;case 4:Xe=5;break e;case 7:Ap(p)?(Xe=0,rn=null,vm(n)):(Xe=0,rn=null,di(e,n,p,7));break;case 5:var x=null;switch(De.tag){case 26:x=De.memoizedState;case 5:case 27:var w=De;if(x?ig(x):w.stateNode.complete){Xe=0,rn=null;var N=w.sibling;if(N!==null)De=N;else{var L=w.return;L!==null?(De=L,co(L)):De=null}break t}}Xe=0,rn=null,di(e,n,p,5);break;case 6:Xe=0,rn=null,di(e,n,p,6);break;case 8:$u(),bt=6;break e;default:throw Error(r(462))}}Zx();break}catch(G){mm(e,G)}while(!0);return ts=pa=null,H.H=l,H.A=d,Ze=i,De!==null?0:(rt=null,He=0,Tl(),bt)}function Zx(){for(;De!==null&&!fl();)xm(De)}function xm(e){var n=Gh(e.alternate,e,ds);e.memoizedProps=e.pendingProps,n===null?co(e):De=n}function vm(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=zh(i,n,n.pendingProps,n.type,void 0,He);break;case 11:n=zh(i,n,n.pendingProps,n.type.render,n.ref,He);break;case 5:nu(n);default:qh(i,n),n=De=bp(n,ds),n=Gh(i,n,ds)}e.memoizedProps=e.pendingProps,n===null?co(e):De=n}function di(e,n,i,l){ts=pa=null,nu(n),ei=null,sr=0;var d=n.return;try{if(Ux(e,d,n,i,He)){bt=1,Zl(e,bn(i,e.current)),De=null;return}}catch(p){if(d!==null)throw De=d,p;bt=1,Zl(e,bn(i,e.current)),De=null;return}n.flags&32768?(Ie||l===1?e=!0:li||(He&536870912)!==0?e=!1:(Ds=e=!0,(l===2||l===9||l===3||l===6)&&(l=sn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Sm(n,e)):co(n)}function co(e){var n=e;do{if((n.flags&32768)!==0){Sm(n,Ds);return}e=n.return;var i=Ix(n.alternate,n,ds);if(i!==null){De=i;return}if(n=n.sibling,n!==null){De=n;return}De=n=e}while(n!==null);bt===0&&(bt=5)}function Sm(e,n){do{var i=Px(e.alternate,e);if(i!==null){i.flags&=32767,De=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!n&&(e=e.sibling,e!==null)){De=e;return}De=e=i}while(e!==null);bt=6,De=null}function km(e,n,i,l,d,p,x,w,N){e.cancelPendingCommit=null;do uo();while(Tt!==0);if((Ze&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(p=n.lanes|n.childLanes,p|=Ac,gl(e,i,p,x,w,N),e===rt&&(De=rt=null,He=0),ci=n,Us=e,fs=i,zu=p,Uu=d,dm=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,ev(Ra,function(){return Nm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=H.T,H.T=null,d=Q.p,Q.p=2,x=Ze,Ze|=4;try{Gx(e,n,i)}finally{Ze=x,Q.p=d,H.T=l}}Tt=1,wm(),_m(),Cm()}}function wm(){if(Tt===1){Tt=0;var e=Us,n=ci,i=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||i){i=H.T,H.T=null;var l=Q.p;Q.p=2;var d=Ze;Ze|=4;try{sm(n,e);var p=Ju,x=cp(e.containerInfo),w=p.focusedElem,N=p.selectionRange;if(x!==w&&w&&w.ownerDocument&&op(w.ownerDocument.documentElement,w)){if(N!==null&&_c(w)){var L=N.start,G=N.end;if(G===void 0&&(G=L),"selectionStart"in w)w.selectionStart=L,w.selectionEnd=Math.min(G,w.value.length);else{var V=w.ownerDocument||document,z=V&&V.defaultView||window;if(z.getSelection){var $=z.getSelection(),re=w.textContent.length,ye=Math.min(N.start,re),at=N.end===void 0?ye:Math.min(N.end,re);!$.extend&&ye>at&&(x=at,at=ye,ye=x);var M=lp(w,ye),A=lp(w,at);if(M&&A&&($.rangeCount!==1||$.anchorNode!==M.node||$.anchorOffset!==M.offset||$.focusNode!==A.node||$.focusOffset!==A.offset)){var D=V.createRange();D.setStart(M.node,M.offset),$.removeAllRanges(),ye>at?($.addRange(D),$.extend(A.node,A.offset)):(D.setEnd(A.node,A.offset),$.addRange(D))}}}}for(V=[],$=w;$=$.parentNode;)$.nodeType===1&&V.push({element:$,left:$.scrollLeft,top:$.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<V.length;w++){var q=V[w];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}wo=!!Xu,Ju=Xu=null}finally{Ze=d,Q.p=l,H.T=i}}e.current=n,Tt=2}}function _m(){if(Tt===2){Tt=0;var e=Us,n=ci,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=H.T,H.T=null;var l=Q.p;Q.p=2;var d=Ze;Ze|=4;try{Xh(e,n.alternate,n)}finally{Ze=d,Q.p=l,H.T=i}}Tt=3}}function Cm(){if(Tt===4||Tt===3){Tt=0,Di();var e=Us,n=ci,i=fs,l=dm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Tt=5:(Tt=0,ci=Us=null,Em(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(zs=null),ia(i),n=n.stateNode,It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(Ss,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=H.T,d=Q.p,Q.p=2,H.T=null;try{for(var p=e.onRecoverableError,x=0;x<l.length;x++){var w=l[x];p(w.value,{componentStack:w.stack})}}finally{H.T=n,Q.p=d}}(fs&3)!==0&&uo(),Gn(e),d=e.pendingLanes,(i&261930)!==0&&(d&42)!==0?e===Hu?vr++:(vr=0,Hu=e):vr=0,Sr(0)}}function Em(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,tr(n)))}function uo(){return wm(),_m(),Cm(),Nm()}function Nm(){if(Tt!==5)return!1;var e=Us,n=zu;zu=0;var i=ia(fs),l=H.T,d=Q.p;try{Q.p=32>i?32:i,H.T=null,i=Uu,Uu=null;var p=Us,x=fs;if(Tt=0,ci=Us=null,fs=0,(Ze&6)!==0)throw Error(r(331));var w=Ze;if(Ze|=4,om(p.current),im(p,p.current,x,i),Ze=w,Sr(0,!1),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(Ss,p)}catch{}return!0}finally{Q.p=d,H.T=l,Em(e,n)}}function Tm(e,n,i){n=bn(i,n),n=yu(e.stateNode,n,2),e=Rs(e,n,2),e!==null&&(aa(e,2),Gn(e))}function Je(e,n,i){if(e.tag===3)Tm(e,e,i);else for(;n!==null;){if(n.tag===3){Tm(n,e,i);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(zs===null||!zs.has(l))){e=bn(i,e),i=Ah(2),l=Rs(n,i,2),l!==null&&(jh(i,l,n,e),aa(l,2),Gn(l));break}}n=n.return}}function Pu(e,n,i){var l=e.pingCache;if(l===null){l=e.pingCache=new Vx;var d=new Set;l.set(n,d)}else d=l.get(n),d===void 0&&(d=new Set,l.set(n,d));d.has(i)||(Bu=!0,d.add(i),e=Qx.bind(null,e,n,i),n.then(e,e))}function Qx(e,n,i){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,rt===e&&(He&i)===i&&(bt===4||bt===3&&(He&62914560)===He&&300>Rt()-ao?(Ze&2)===0&&ui(e,0):Du|=i,oi===He&&(oi=0)),Gn(e)}function Am(e,n){n===0&&(n=Ba()),e=ua(e,n),e!==null&&(aa(e,n),Gn(e))}function Xx(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),Am(e,i)}function Jx(e,n){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,d=e.memoizedState;d!==null&&(i=d.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),Am(e,i)}function ev(e,n){return ja(e,n)}var fo=null,fi=null,Gu=!1,po=!1,Fu=!1,$s=0;function Gn(e){e!==fi&&e.next===null&&(fi===null?fo=fi=e:fi=fi.next=e),po=!0,Gu||(Gu=!0,nv())}function Sr(e,n){if(!Fu&&po){Fu=!0;do for(var i=!1,l=fo;l!==null;){if(e!==0){var d=l.pendingLanes;if(d===0)var p=0;else{var x=l.suspendedLanes,w=l.pingedLanes;p=(1<<31-Pt(42|e)+1)-1,p&=d&~(x&~w),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(i=!0,Mm(l,p))}else p=He,p=na(l,l===rt?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||fn(l,p)||(i=!0,Mm(l,p));l=l.next}while(i);Fu=!1}}function tv(){jm()}function jm(){po=Gu=!1;var e=0;$s!==0&&fv()&&(e=$s);for(var n=Rt(),i=null,l=fo;l!==null;){var d=l.next,p=Rm(l,n);p===0?(l.next=null,i===null?fo=d:i.next=d,d===null&&(fi=i)):(i=l,(e!==0||(p&3)!==0)&&(po=!0)),l=d}Tt!==0&&Tt!==5||Sr(e),$s!==0&&($s=0)}function Rm(e,n){for(var i=e.suspendedLanes,l=e.pingedLanes,d=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var x=31-Pt(p),w=1<<x,N=d[x];N===-1?((w&i)===0||(w&l)!==0)&&(d[x]=ic(w,n)):N<=n&&(e.expiredLanes|=w),p&=~w}if(n=rt,i=He,i=na(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===n&&(Xe===2||Xe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Bi(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||fn(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(l!==null&&Bi(l),ia(i)){case 2:case 8:i=Vt;break;case 32:i=Ra;break;case 268435456:i=Ui;break;default:i=Ra}return l=Om.bind(null,e),i=ja(i,l),e.callbackPriority=n,e.callbackNode=i,n}return l!==null&&l!==null&&Bi(l),e.callbackPriority=2,e.callbackNode=null,2}function Om(e,n){if(Tt!==0&&Tt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(uo()&&e.callbackNode!==i)return null;var l=He;return l=na(e,e===rt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(pm(e,l,n),Rm(e,Rt()),e.callbackNode!=null&&e.callbackNode===i?Om.bind(null,e):null)}function Mm(e,n){if(uo())return null;pm(e,n,!0)}function nv(){hv(function(){(Ze&6)!==0?ja(zi,tv):jm()})}function qu(){if($s===0){var e=Qa;e===0&&(e=Zn,Zn<<=1,(Zn&261888)===0&&(Zn=256)),$s=e}return $s}function Bm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:vl(""+e)}function Dm(e,n){var i=n.ownerDocument.createElement("input");return i.name=n.name,i.value=n.value,e.id&&i.setAttribute("form",e.id),n.parentNode.insertBefore(i,n),e=new FormData(e),i.parentNode.removeChild(i),e}function sv(e,n,i,l,d){if(n==="submit"&&i&&i.stateNode===d){var p=Bm((d[zt]||null).action),x=l.submitter;x&&(n=(n=x[zt]||null)?Bm(n.formAction):x.getAttribute("formAction"),n!==null&&(p=n,x=null));var w=new _l("action","action",null,l,d);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if($s!==0){var N=x?Dm(d,x):new FormData(d);du(i,{pending:!0,data:N,method:d.method,action:p},null,N)}}else typeof p=="function"&&(w.preventDefault(),N=x?Dm(d,x):new FormData(d),du(i,{pending:!0,data:N,method:d.method,action:p},p,N))},currentTarget:d}]})}}for(var Vu=0;Vu<Tc.length;Vu++){var Wu=Tc[Vu],av=Wu.toLowerCase(),iv=Wu[0].toUpperCase()+Wu.slice(1);On(av,"on"+iv)}On(fp,"onAnimationEnd"),On(pp,"onAnimationIteration"),On(hp,"onAnimationStart"),On("dblclick","onDoubleClick"),On("focusin","onFocus"),On("focusout","onBlur"),On(Sx,"onTransitionRun"),On(kx,"onTransitionStart"),On(wx,"onTransitionCancel"),On(mp,"onTransitionEnd"),Ue("onMouseEnter",["mouseout","mouseover"]),Ue("onMouseLeave",["mouseout","mouseover"]),Ue("onPointerEnter",["pointerout","pointerover"]),Ue("onPointerLeave",["pointerout","pointerover"]),Te("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Te("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Te("onBeforeInput",["compositionend","keypress","textInput","paste"]),Te("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Te("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Te("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var kr="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(" "),rv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(kr));function Lm(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],d=l.event;l=l.listeners;e:{var p=void 0;if(n)for(var x=l.length-1;0<=x;x--){var w=l[x],N=w.instance,L=w.currentTarget;if(w=w.listener,N!==p&&d.isPropagationStopped())break e;p=w,d.currentTarget=L;try{p(d)}catch(G){Nl(G)}d.currentTarget=null,p=N}else for(x=0;x<l.length;x++){if(w=l[x],N=w.instance,L=w.currentTarget,w=w.listener,N!==p&&d.isPropagationStopped())break e;p=w,d.currentTarget=L;try{p(d)}catch(G){Nl(G)}d.currentTarget=null,p=N}}}}function Le(e,n){var i=n[Pi];i===void 0&&(i=n[Pi]=new Set);var l=e+"__bubble";i.has(l)||(zm(n,e,2,!1),i.add(l))}function Ku(e,n,i){var l=0;n&&(l|=4),zm(i,e,l,n)}var ho="_reactListening"+Math.random().toString(36).slice(2);function Yu(e){if(!e[ho]){e[ho]=!0,tt.forEach(function(i){i!=="selectionchange"&&(rv.has(i)||Ku(i,!1,e),Ku(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[ho]||(n[ho]=!0,Ku("selectionchange",!1,n))}}function zm(e,n,i,l){switch(fg(n)){case 2:var d=Bv;break;case 8:d=Dv;break;default:d=ud}i=d.bind(null,n,i,e),d=void 0,!mc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),l?d!==void 0?e.addEventListener(n,i,{capture:!0,passive:d}):e.addEventListener(n,i,!0):d!==void 0?e.addEventListener(n,i,{passive:d}):e.addEventListener(n,i,!1)}function Zu(e,n,i,l,d){var p=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var w=l.stateNode.containerInfo;if(w===d)break;if(x===4)for(x=l.return;x!==null;){var N=x.tag;if((N===3||N===4)&&x.stateNode.containerInfo===d)return;x=x.return}for(;w!==null;){if(x=F(w),x===null)return;if(N=x.tag,N===5||N===6||N===26||N===27){l=p=x;continue e}w=w.parentNode}}l=l.return}Pf(function(){var L=p,G=pc(i),V=[];e:{var z=gp.get(e);if(z!==void 0){var $=_l,re=e;switch(e){case"keypress":if(kl(i)===0)break e;case"keydown":case"keyup":$=Jb;break;case"focusin":re="focus",$=xc;break;case"focusout":re="blur",$=xc;break;case"beforeblur":case"afterblur":$=xc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$=qf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$=Ib;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$=nx;break;case fp:case pp:case hp:$=Fb;break;case mp:$=ax;break;case"scroll":case"scrollend":$=Hb;break;case"wheel":$=rx;break;case"copy":case"cut":case"paste":$=Vb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$=Wf;break;case"toggle":case"beforetoggle":$=ox}var ye=(n&4)!==0,at=!ye&&(e==="scroll"||e==="scrollend"),M=ye?z!==null?z+"Capture":null:z;ye=[];for(var A=L,D;A!==null;){var q=A;if(D=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||D===null||M===null||(q=Fi(A,M),q!=null&&ye.push(wr(A,q,D))),at)break;A=A.return}0<ye.length&&(z=new $(z,re,null,i,G),V.push({event:z,listeners:ye}))}}if((n&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",$=e==="mouseout"||e==="pointerout",z&&i!==fc&&(re=i.relatedTarget||i.fromElement)&&(F(re)||re[ks]))break e;if(($||z)&&(z=G.window===G?G:(z=G.ownerDocument)?z.defaultView||z.parentWindow:window,$?(re=i.relatedTarget||i.toElement,$=L,re=re?F(re):null,re!==null&&(at=c(re),ye=re.tag,re!==at||ye!==5&&ye!==27&&ye!==6)&&(re=null)):($=null,re=L),$!==re)){if(ye=qf,q="onMouseLeave",M="onMouseEnter",A="mouse",(e==="pointerout"||e==="pointerover")&&(ye=Wf,q="onPointerLeave",M="onPointerEnter",A="pointer"),at=$==null?z:me($),D=re==null?z:me(re),z=new ye(q,A+"leave",$,i,G),z.target=at,z.relatedTarget=D,q=null,F(G)===L&&(ye=new ye(M,A+"enter",re,i,G),ye.target=D,ye.relatedTarget=at,q=ye),at=q,$&&re)t:{for(ye=lv,M=$,A=re,D=0,q=M;q;q=ye(q))D++;q=0;for(var fe=A;fe;fe=ye(fe))q++;for(;0<D-q;)M=ye(M),D--;for(;0<q-D;)A=ye(A),q--;for(;D--;){if(M===A||A!==null&&M===A.alternate){ye=M;break t}M=ye(M),A=ye(A)}ye=null}else ye=null;$!==null&&Um(V,z,$,ye,!1),re!==null&&at!==null&&Um(V,at,re,ye,!0)}}e:{if(z=L?me(L):window,$=z.nodeName&&z.nodeName.toLowerCase(),$==="select"||$==="input"&&z.type==="file")var We=tp;else if(Jf(z))if(np)We=bx;else{We=gx;var ce=mx}else $=z.nodeName,!$||$.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?L&&dc(L.elementType)&&(We=tp):We=yx;if(We&&(We=We(e,L))){ep(V,We,i,G);break e}ce&&ce(e,z,L),e==="focusout"&&L&&z.type==="number"&&L.memoizedProps.value!=null&&uc(z,"number",z.value)}switch(ce=L?me(L):window,e){case"focusin":(Jf(ce)||ce.contentEditable==="true")&&(Ga=ce,Cc=L,Xi=null);break;case"focusout":Xi=Cc=Ga=null;break;case"mousedown":Ec=!0;break;case"contextmenu":case"mouseup":case"dragend":Ec=!1,up(V,i,G);break;case"selectionchange":if(vx)break;case"keydown":case"keyup":up(V,i,G)}var Ae;if(Sc)e:{switch(e){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else Pa?Qf(e,i)&&($e="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&($e="onCompositionStart");$e&&(Kf&&i.locale!=="ko"&&(Pa||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Pa&&(Ae=Gf()):(_s=G,gc="value"in _s?_s.value:_s.textContent,Pa=!0)),ce=mo(L,$e),0<ce.length&&($e=new Vf($e,e,null,i,G),V.push({event:$e,listeners:ce}),Ae?$e.data=Ae:(Ae=Xf(i),Ae!==null&&($e.data=Ae)))),(Ae=ux?dx(e,i):fx(e,i))&&($e=mo(L,"onBeforeInput"),0<$e.length&&(ce=new Vf("onBeforeInput","beforeinput",null,i,G),V.push({event:ce,listeners:$e}),ce.data=Ae)),sv(V,e,L,i,G)}Lm(V,n)})}function wr(e,n,i){return{instance:e,listener:n,currentTarget:i}}function mo(e,n){for(var i=n+"Capture",l=[];e!==null;){var d=e,p=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||p===null||(d=Fi(e,i),d!=null&&l.unshift(wr(e,d,p)),d=Fi(e,n),d!=null&&l.push(wr(e,d,p))),e.tag===3)return l;e=e.return}return[]}function lv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Um(e,n,i,l,d){for(var p=n._reactName,x=[];i!==null&&i!==l;){var w=i,N=w.alternate,L=w.stateNode;if(w=w.tag,N!==null&&N===l)break;w!==5&&w!==26&&w!==27||L===null||(N=L,d?(L=Fi(i,p),L!=null&&x.unshift(wr(i,L,N))):d||(L=Fi(i,p),L!=null&&x.push(wr(i,L,N)))),i=i.return}x.length!==0&&e.push({event:n,listeners:x})}var ov=/\r\n?/g,cv=/\u0000|\uFFFD/g;function Hm(e){return(typeof e=="string"?e:""+e).replace(ov,`
|
|
26
|
-
`).replace(cv,"")}function $m(e,n){return n=Hm(n),Hm(e)===n}function st(e,n,i,l,d,p){switch(i){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Ha(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Ha(e,""+l);break;case"className":hn(e,"class",l);break;case"tabIndex":hn(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":hn(e,i,l);break;case"style":$f(e,l,p);break;case"data":if(n!=="object"){hn(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=vl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"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 p=="function"&&(i==="formAction"?(n!=="input"&&st(e,n,"name",d.name,d,null),st(e,n,"formEncType",d.formEncType,d,null),st(e,n,"formMethod",d.formMethod,d,null),st(e,n,"formTarget",d.formTarget,d,null)):(st(e,n,"encType",d.encType,d,null),st(e,n,"method",d.method,d,null),st(e,n,"target",d.target,d,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=vl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Qn);break;case"onScroll":l!=null&&Le("scroll",e);break;case"onScrollEnd":l!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=vl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Le("beforetoggle",e),Le("toggle",e),pn(e,"popover",l);break;case"xlinkActuate":mn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":mn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":mn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":mn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":mn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":mn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":mn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":mn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":mn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":pn(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=zb.get(i)||i,pn(e,i,l))}}function Qu(e,n,i,l,d,p){switch(i){case"style":$f(e,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(d.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof l=="string"?Ha(e,l):(typeof l=="number"||typeof l=="bigint")&&Ha(e,""+l);break;case"onScroll":l!=null&&Le("scroll",e);break;case"onScrollEnd":l!=null&&Le("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Qn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!St.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(d=i.endsWith("Capture"),n=i.slice(2,d?i.length-7:void 0),p=e[zt]||null,p=p!=null?p[i]:null,typeof p=="function"&&e.removeEventListener(n,p,d),typeof l=="function")){typeof p!="function"&&p!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(n,l,d);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):pn(e,i,l)}}}function Dt(e,n,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var l=!1,d=!1,p;for(p in i)if(i.hasOwnProperty(p)){var x=i[p];if(x!=null)switch(p){case"src":l=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:st(e,n,p,x,i,null)}}d&&st(e,n,"srcSet",i.srcSet,i,null),l&&st(e,n,"src",i.src,i,null);return;case"input":Le("invalid",e);var w=p=x=d=null,N=null,L=null;for(l in i)if(i.hasOwnProperty(l)){var G=i[l];if(G!=null)switch(l){case"name":d=G;break;case"type":x=G;break;case"checked":N=G;break;case"defaultChecked":L=G;break;case"value":p=G;break;case"defaultValue":w=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,n));break;default:st(e,n,l,G,i,null)}}Lf(e,p,w,N,L,x,d,!1);return;case"select":Le("invalid",e),l=x=p=null;for(d in i)if(i.hasOwnProperty(d)&&(w=i[d],w!=null))switch(d){case"value":p=w;break;case"defaultValue":x=w;break;case"multiple":l=w;default:st(e,n,d,w,i,null)}n=p,i=x,e.multiple=!!l,n!=null?Ua(e,!!l,n,!1):i!=null&&Ua(e,!!l,i,!0);return;case"textarea":Le("invalid",e),p=d=l=null;for(x in i)if(i.hasOwnProperty(x)&&(w=i[x],w!=null))switch(x){case"value":l=w;break;case"defaultValue":d=w;break;case"children":p=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:st(e,n,x,w,i,null)}Uf(e,l,d,p);return;case"option":for(N in i)if(i.hasOwnProperty(N)&&(l=i[N],l!=null))switch(N){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:st(e,n,N,l,i,null)}return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(l=0;l<kr.length;l++)Le(kr[l],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(L in i)if(i.hasOwnProperty(L)&&(l=i[L],l!=null))switch(L){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:st(e,n,L,l,i,null)}return;default:if(dc(n)){for(G in i)i.hasOwnProperty(G)&&(l=i[G],l!==void 0&&Qu(e,n,G,l,i,void 0));return}}for(w in i)i.hasOwnProperty(w)&&(l=i[w],l!=null&&st(e,n,w,l,i,null))}function uv(e,n,i,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,p=null,x=null,w=null,N=null,L=null,G=null;for($ in i){var V=i[$];if(i.hasOwnProperty($)&&V!=null)switch($){case"checked":break;case"value":break;case"defaultValue":N=V;default:l.hasOwnProperty($)||st(e,n,$,null,l,V)}}for(var z in l){var $=l[z];if(V=i[z],l.hasOwnProperty(z)&&($!=null||V!=null))switch(z){case"type":p=$;break;case"name":d=$;break;case"checked":L=$;break;case"defaultChecked":G=$;break;case"value":x=$;break;case"defaultValue":w=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,n));break;default:$!==V&&st(e,n,z,$,l,V)}}cc(e,x,w,N,L,G,p,d);return;case"select":$=x=w=z=null;for(p in i)if(N=i[p],i.hasOwnProperty(p)&&N!=null)switch(p){case"value":break;case"multiple":$=N;default:l.hasOwnProperty(p)||st(e,n,p,null,l,N)}for(d in l)if(p=l[d],N=i[d],l.hasOwnProperty(d)&&(p!=null||N!=null))switch(d){case"value":z=p;break;case"defaultValue":w=p;break;case"multiple":x=p;default:p!==N&&st(e,n,d,p,l,N)}n=w,i=x,l=$,z!=null?Ua(e,!!i,z,!1):!!l!=!!i&&(n!=null?Ua(e,!!i,n,!0):Ua(e,!!i,i?[]:"",!1));return;case"textarea":$=z=null;for(w in i)if(d=i[w],i.hasOwnProperty(w)&&d!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:st(e,n,w,null,l,d)}for(x in l)if(d=l[x],p=i[x],l.hasOwnProperty(x)&&(d!=null||p!=null))switch(x){case"value":z=d;break;case"defaultValue":$=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==p&&st(e,n,x,d,l,p)}zf(e,z,$);return;case"option":for(var re in i)if(z=i[re],i.hasOwnProperty(re)&&z!=null&&!l.hasOwnProperty(re))switch(re){case"selected":e.selected=!1;break;default:st(e,n,re,null,l,z)}for(N in l)if(z=l[N],$=i[N],l.hasOwnProperty(N)&&z!==$&&(z!=null||$!=null))switch(N){case"selected":e.selected=z&&typeof z!="function"&&typeof z!="symbol";break;default:st(e,n,N,z,l,$)}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 ye in i)z=i[ye],i.hasOwnProperty(ye)&&z!=null&&!l.hasOwnProperty(ye)&&st(e,n,ye,null,l,z);for(L in l)if(z=l[L],$=i[L],l.hasOwnProperty(L)&&z!==$&&(z!=null||$!=null))switch(L){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(137,n));break;default:st(e,n,L,z,l,$)}return;default:if(dc(n)){for(var at in i)z=i[at],i.hasOwnProperty(at)&&z!==void 0&&!l.hasOwnProperty(at)&&Qu(e,n,at,void 0,l,z);for(G in l)z=l[G],$=i[G],!l.hasOwnProperty(G)||z===$||z===void 0&&$===void 0||Qu(e,n,G,z,l,$);return}}for(var M in i)z=i[M],i.hasOwnProperty(M)&&z!=null&&!l.hasOwnProperty(M)&&st(e,n,M,null,l,z);for(V in l)z=l[V],$=i[V],!l.hasOwnProperty(V)||z===$||z==null&&$==null||st(e,n,V,z,l,$)}function Im(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var d=i[l],p=d.transferSize,x=d.initiatorType,w=d.duration;if(p&&w&&Im(x)){for(x=0,w=d.responseEnd,l+=1;l<i.length;l++){var N=i[l],L=N.startTime;if(L>w)break;var G=N.transferSize,V=N.initiatorType;G&&Im(V)&&(N=N.responseEnd,x+=G*(N<w?1:(w-L)/(N-L)))}if(--l,n+=8*(p+x)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Xu=null,Ju=null;function go(e){return e.nodeType===9?e:e.ownerDocument}function Pm(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Gm(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function ed(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var td=null;function fv(){var e=window.event;return e&&e.type==="popstate"?e===td?!1:(td=e,!0):(td=null,!1)}var Fm=typeof setTimeout=="function"?setTimeout:void 0,pv=typeof clearTimeout=="function"?clearTimeout:void 0,qm=typeof Promise=="function"?Promise:void 0,hv=typeof queueMicrotask=="function"?queueMicrotask:typeof qm<"u"?function(e){return qm.resolve(null).then(e).catch(mv)}:Fm;function mv(e){setTimeout(function(){throw e})}function Is(e){return e==="head"}function Vm(e,n){var i=n,l=0;do{var d=i.nextSibling;if(e.removeChild(i),d&&d.nodeType===8)if(i=d.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(d),gi(n);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")_r(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,_r(i);for(var p=i.firstChild;p;){var x=p.nextSibling,w=p.nodeName;p[ra]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&p.rel.toLowerCase()==="stylesheet"||i.removeChild(p),p=x}}else i==="body"&&_r(e.ownerDocument.body);i=d}while(i);gi(n)}function Wm(e,n){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?n?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(n?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function nd(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var i=n;switch(n=n.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":nd(i),B(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function gv(e,n,i,l){for(;e.nodeType===1;){var d=i;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[ra])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var p=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=wn(e.nextSibling),e===null)break}return null}function yv(e,n,i){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=wn(e.nextSibling),e===null))return null;return e}function Km(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=wn(e.nextSibling),e===null))return null;return e}function sd(e){return e.data==="$?"||e.data==="$~"}function ad(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function bv(e,n){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||i.readyState!=="loading")n();else{var l=function(){n(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function wn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var id=null;function Ym(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(n===0)return wn(e.nextSibling);n--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||n++}e=e.nextSibling}return null}function Zm(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(n===0)return e;n--}else i!=="/$"&&i!=="/&"||n++}e=e.previousSibling}return null}function Qm(e,n,i){switch(n=go(i),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function _r(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);B(e)}var _n=new Map,Xm=new Set;function yo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ps=Q.d;Q.d={f:xv,r:vv,D:Sv,C:kv,L:wv,m:_v,X:Ev,S:Cv,M:Nv};function xv(){var e=ps.f(),n=lo();return e||n}function vv(e){var n=ee(e);n!==null&&n.tag===5&&n.type==="form"?mh(n):ps.r(e)}var pi=typeof document>"u"?null:document;function Jm(e,n,i){var l=pi;if(l&&typeof n=="string"&&n){var d=gn(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof i=="string"&&(d+='[crossorigin="'+i+'"]'),Xm.has(d)||(Xm.add(d),e={rel:e,crossOrigin:i,href:n},l.querySelector(d)===null&&(n=l.createElement("link"),Dt(n,"link",e),xe(n),l.head.appendChild(n)))}}function Sv(e){ps.D(e),Jm("dns-prefetch",e,null)}function kv(e,n){ps.C(e,n),Jm("preconnect",e,n)}function wv(e,n,i){ps.L(e,n,i);var l=pi;if(l&&e&&n){var d='link[rel="preload"][as="'+gn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(d+='[imagesrcset="'+gn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(d+='[imagesizes="'+gn(i.imageSizes)+'"]')):d+='[href="'+gn(e)+'"]';var p=d;switch(n){case"style":p=hi(e);break;case"script":p=mi(e)}_n.has(p)||(e=b({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),_n.set(p,e),l.querySelector(d)!==null||n==="style"&&l.querySelector(Cr(p))||n==="script"&&l.querySelector(Er(p))||(n=l.createElement("link"),Dt(n,"link",e),xe(n),l.head.appendChild(n)))}}function _v(e,n){ps.m(e,n);var i=pi;if(i&&e){var l=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+gn(l)+'"][href="'+gn(e)+'"]',p=d;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=mi(e)}if(!_n.has(p)&&(e=b({rel:"modulepreload",href:e},n),_n.set(p,e),i.querySelector(d)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Er(p)))return}l=i.createElement("link"),Dt(l,"link",e),xe(l),i.head.appendChild(l)}}}function Cv(e,n,i){ps.S(e,n,i);var l=pi;if(l&&e){var d=be(l).hoistableStyles,p=hi(e);n=n||"default";var x=d.get(p);if(!x){var w={loading:0,preload:null};if(x=l.querySelector(Cr(p)))w.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},i),(i=_n.get(p))&&rd(e,i);var N=x=l.createElement("link");xe(N),Dt(N,"link",e),N._p=new Promise(function(L,G){N.onload=L,N.onerror=G}),N.addEventListener("load",function(){w.loading|=1}),N.addEventListener("error",function(){w.loading|=2}),w.loading|=4,bo(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:w},d.set(p,x)}}}function Ev(e,n){ps.X(e,n);var i=pi;if(i&&e){var l=be(i).hoistableScripts,d=mi(e),p=l.get(d);p||(p=i.querySelector(Er(d)),p||(e=b({src:e,async:!0},n),(n=_n.get(d))&&ld(e,n),p=i.createElement("script"),xe(p),Dt(p,"link",e),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function Nv(e,n){ps.M(e,n);var i=pi;if(i&&e){var l=be(i).hoistableScripts,d=mi(e),p=l.get(d);p||(p=i.querySelector(Er(d)),p||(e=b({src:e,async:!0,type:"module"},n),(n=_n.get(d))&&ld(e,n),p=i.createElement("script"),xe(p),Dt(p,"link",e),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function eg(e,n,i,l){var d=(d=et.current)?yo(d):null;if(!d)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=hi(i.href),i=be(d).hoistableStyles,l=i.get(n),l||(l={type:"style",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=hi(i.href);var p=be(d).hoistableStyles,x=p.get(e);if(x||(d=d.ownerDocument||d,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,x),(p=d.querySelector(Cr(e)))&&!p._p&&(x.instance=p,x.state.loading=5),_n.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},_n.set(e,i),p||Tv(d,e,i,x.state))),n&&l===null)throw Error(r(528,""));return x}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=mi(i),i=be(d).hoistableScripts,l=i.get(n),l||(l={type:"script",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function hi(e){return'href="'+gn(e)+'"'}function Cr(e){return'link[rel="stylesheet"]['+e+"]"}function tg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Tv(e,n,i,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),Dt(n,"link",i),xe(n),e.head.appendChild(n))}function mi(e){return'[src="'+gn(e)+'"]'}function Er(e){return"script[async]"+e}function ng(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+gn(i.href)+'"]');if(l)return n.instance=l,xe(l),l;var d=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),xe(l),Dt(l,"style",d),bo(l,i.precedence,e),n.instance=l;case"stylesheet":d=hi(i.href);var p=e.querySelector(Cr(d));if(p)return n.state.loading|=4,n.instance=p,xe(p),p;l=tg(i),(d=_n.get(d))&&rd(l,d),p=(e.ownerDocument||e).createElement("link"),xe(p);var x=p;return x._p=new Promise(function(w,N){x.onload=w,x.onerror=N}),Dt(p,"link",l),n.state.loading|=4,bo(p,i.precedence,e),n.instance=p;case"script":return p=mi(i.src),(d=e.querySelector(Er(p)))?(n.instance=d,xe(d),d):(l=i,(d=_n.get(p))&&(l=b({},i),ld(l,d)),e=e.ownerDocument||e,d=e.createElement("script"),xe(d),Dt(d,"link",l),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,bo(l,i.precedence,e));return n.instance}function bo(e,n,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=l.length?l[l.length-1]:null,p=d,x=0;x<l.length;x++){var w=l[x];if(w.dataset.precedence===n)p=w;else if(p!==d)break}p?p.parentNode.insertBefore(e,p.nextSibling):(n=i.nodeType===9?i.head:i,n.insertBefore(e,n.firstChild))}function rd(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function ld(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var xo=null;function sg(e,n,i){if(xo===null){var l=new Map,d=xo=new Map;d.set(i,l)}else d=xo,l=d.get(i),l||(l=new Map,d.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),d=0;d<i.length;d++){var p=i[d];if(!(p[ra]||p[Nt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(n)||"";x=e+x;var w=l.get(x);w?w.push(p):l.set(x,[p])}}return l}function ag(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function Av(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function ig(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function jv(e,n,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var d=hi(l.href),p=n.querySelector(Cr(d));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=vo.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=p,xe(p);return}p=n.ownerDocument||n,l=tg(l),(d=_n.get(d))&&rd(l,d),p=p.createElement("link"),xe(p);var x=p;x._p=new Promise(function(w,N){x.onload=w,x.onerror=N}),Dt(p,"link",l),i.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=vo.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var od=0;function Rv(e,n){return e.stylesheets&&e.count===0&&ko(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&ko(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+n);0<e.imgBytes&&od===0&&(od=62500*dv());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ko(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>od?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(d)}}:null}function vo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ko(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var So=null;function ko(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,So=new Map,n.forEach(Ov,e),So=null,vo.call(e))}function Ov(e,n){if(!(n.state.loading&4)){var i=So.get(e);if(i)var l=i.get(null);else{i=new Map,So.set(e,i);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<d.length;p++){var x=d[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(i.set(x.dataset.precedence,x),l=x)}l&&i.set(null,l)}d=n.instance,x=d.getAttribute("data-precedence"),p=i.get(x)||l,p===l&&i.set(null,d),i.set(x,d),this.count++,l=vo.bind(this),d.addEventListener("load",l),d.addEventListener("error",l),p?p.parentNode.insertBefore(d,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var Nr={$$typeof:T,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function Mv(e,n,i,l,d,p,x,w,N){this.tag=1,this.containerInfo=e,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=sa(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sa(0),this.hiddenUpdates=sa(null),this.identifierPrefix=l,this.onUncaughtError=d,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function rg(e,n,i,l,d,p,x,w,N,L,G,V){return e=new Mv(e,n,i,x,N,L,G,V,w),n=1,p===!0&&(n|=24),p=nn(3,null,null,n),e.current=p,p.stateNode=e,n=Ic(),n.refCount++,e.pooledCache=n,n.refCount++,p.memoizedState={element:l,isDehydrated:i,cache:n},qc(p),e}function lg(e){return e?(e=Va,e):Va}function og(e,n,i,l,d,p){d=lg(d),l.context===null?l.context=d:l.pendingContext=d,l=js(n),l.payload={element:i},p=p===void 0?null:p,p!==null&&(l.callback=p),i=Rs(e,l,n),i!==null&&(Jt(i,e,n),ir(i,e,n))}function cg(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function cd(e,n){cg(e,n),(e=e.alternate)&&cg(e,n)}function ug(e){if(e.tag===13||e.tag===31){var n=ua(e,67108864);n!==null&&Jt(n,e,67108864),cd(e,67108864)}}function dg(e){if(e.tag===13||e.tag===31){var n=on();n=Da(n);var i=ua(e,n);i!==null&&Jt(i,e,n),cd(e,n)}}var wo=!0;function Bv(e,n,i,l){var d=H.T;H.T=null;var p=Q.p;try{Q.p=2,ud(e,n,i,l)}finally{Q.p=p,H.T=d}}function Dv(e,n,i,l){var d=H.T;H.T=null;var p=Q.p;try{Q.p=8,ud(e,n,i,l)}finally{Q.p=p,H.T=d}}function ud(e,n,i,l){if(wo){var d=dd(l);if(d===null)Zu(e,n,l,_o,i),pg(e,l);else if(zv(d,e,n,i,l))l.stopPropagation();else if(pg(e,l),n&4&&-1<Lv.indexOf(e)){for(;d!==null;){var p=ee(d);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=jn(p.pendingLanes);if(x!==0){var w=p;for(w.pendingLanes|=2,w.entangledLanes|=2;x;){var N=1<<31-Pt(x);w.entanglements[1]|=N,x&=~N}Gn(p),(Ze&6)===0&&(io=Rt()+500,Sr(0))}}break;case 31:case 13:w=ua(p,2),w!==null&&Jt(w,p,2),lo(),cd(p,2)}if(p=dd(l),p===null&&Zu(e,n,l,_o,i),p===d)break;d=p}d!==null&&l.stopPropagation()}else Zu(e,n,l,null,i)}}function dd(e){return e=pc(e),fd(e)}var _o=null;function fd(e){if(_o=null,e=F(e),e!==null){var n=c(e);if(n===null)e=null;else{var i=n.tag;if(i===13){if(e=u(n),e!==null)return e;e=null}else if(i===31){if(e=f(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return _o=e,null}function fg(e){switch(e){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(Li()){case zi:return 2;case Vt:return 8;case Ra:case en:return 32;case Ui:return 268435456;default:return 32}default:return 32}}var pd=!1,Ps=null,Gs=null,Fs=null,Tr=new Map,Ar=new Map,qs=[],Lv="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 pg(e,n){switch(e){case"focusin":case"focusout":Ps=null;break;case"dragenter":case"dragleave":Gs=null;break;case"mouseover":case"mouseout":Fs=null;break;case"pointerover":case"pointerout":Tr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ar.delete(n.pointerId)}}function jr(e,n,i,l,d,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:i,eventSystemFlags:l,nativeEvent:p,targetContainers:[d]},n!==null&&(n=ee(n),n!==null&&ug(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function zv(e,n,i,l,d){switch(n){case"focusin":return Ps=jr(Ps,e,n,i,l,d),!0;case"dragenter":return Gs=jr(Gs,e,n,i,l,d),!0;case"mouseover":return Fs=jr(Fs,e,n,i,l,d),!0;case"pointerover":var p=d.pointerId;return Tr.set(p,jr(Tr.get(p)||null,e,n,i,l,d)),!0;case"gotpointercapture":return p=d.pointerId,Ar.set(p,jr(Ar.get(p)||null,e,n,i,l,d)),!0}return!1}function hg(e){var n=F(e.target);if(n!==null){var i=c(n);if(i!==null){if(n=i.tag,n===13){if(n=u(i),n!==null){e.blockedOn=n,yl(e.priority,function(){dg(i)});return}}else if(n===31){if(n=f(i),n!==null){e.blockedOn=n,yl(e.priority,function(){dg(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Co(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=dd(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);fc=l,i.target.dispatchEvent(l),fc=null}else return n=ee(i),n!==null&&ug(n),e.blockedOn=i,!1;n.shift()}return!0}function mg(e,n,i){Co(e)&&i.delete(n)}function Uv(){pd=!1,Ps!==null&&Co(Ps)&&(Ps=null),Gs!==null&&Co(Gs)&&(Gs=null),Fs!==null&&Co(Fs)&&(Fs=null),Tr.forEach(mg),Ar.forEach(mg)}function Eo(e,n){e.blockedOn===n&&(e.blockedOn=null,pd||(pd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Uv)))}var No=null;function gg(e){No!==e&&(No=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){No===e&&(No=null);for(var n=0;n<e.length;n+=3){var i=e[n],l=e[n+1],d=e[n+2];if(typeof l!="function"){if(fd(l||i)===null)continue;break}var p=ee(i);p!==null&&(e.splice(n,3),n-=3,du(p,{pending:!0,data:d,method:i.method,action:l},l,d))}}))}function gi(e){function n(N){return Eo(N,e)}Ps!==null&&Eo(Ps,e),Gs!==null&&Eo(Gs,e),Fs!==null&&Eo(Fs,e),Tr.forEach(n),Ar.forEach(n);for(var i=0;i<qs.length;i++){var l=qs[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<qs.length&&(i=qs[0],i.blockedOn===null);)hg(i),i.blockedOn===null&&qs.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var d=i[l],p=i[l+1],x=d[zt]||null;if(typeof p=="function")x||gg(i);else if(x){var w=null;if(p&&p.hasAttribute("formAction")){if(d=p,x=p[zt]||null)w=x.formAction;else if(fd(d)!==null)continue}else w=x.action;typeof w=="function"?i[l+1]=w:(i.splice(l,3),l-=3),gg(i)}}}function yg(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return d=x})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function hd(e){this._internalRoot=e}To.prototype.render=hd.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var i=n.current,l=on();og(i,l,e,n,null,null)},To.prototype.unmount=hd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;og(e.current,2,null,e,null,null),lo(),n[ks]=null}};function To(e){this._internalRoot=e}To.prototype.unstable_scheduleHydration=function(e){if(e){var n=La();e={blockedOn:null,target:e,priority:n};for(var i=0;i<qs.length&&n!==0&&n<qs[i].priority;i++);qs.splice(i,0,e),i===0&&hg(e)}};var bg=t.version;if(bg!=="19.2.7")throw Error(r(527,bg,"19.2.7"));Q.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Hv={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ao=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ao.isDisabled&&Ao.supportsFiber)try{Ss=Ao.inject(Hv),It=Ao}catch{}}return Rr.createRoot=function(e,n){if(!o(e))throw Error(r(299));var i=!1,l="",d=Ch,p=Eh,x=Nh;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=rg(e,1,!1,null,null,i,l,null,d,p,x,yg),e[ks]=n.current,Yu(e),new hd(n)},Rr.hydrateRoot=function(e,n,i){if(!o(e))throw Error(r(299));var l=!1,d="",p=Ch,x=Eh,w=Nh,N=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(p=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError),i.formState!==void 0&&(N=i.formState)),n=rg(e,1,!0,n,i??null,l,d,N,p,x,w,yg),n.context=lg(null),i=n.current,l=on(),l=Da(l),d=js(l),d.callback=null,Rs(i,d,l),i=l,n.current.lanes=i,aa(n,i),Gn(n),e[ks]=n.current,Yu(e),new To(n)},Rr.version="19.2.7",Rr}var Eg;function P0(){if(Eg)return md.exports;Eg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(t){console.error(t)}}return s(),md.exports=I0(),md.exports}var G0=P0();const F0=mf(G0),q0="modulepreload",V0=function(s){return"/"+s},Ng={},Ft=function(t,a,r){let o=Promise.resolve();if(a&&a.length>0){let u=function(g){return Promise.all(g.map(y=>Promise.resolve(y).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=u(a.map(g=>{if(g=V0(g),g in Ng)return;Ng[g]=!0;const y=g.endsWith(".css"),b=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":q0,y||(v.as="script"),v.crossOrigin="",v.href=g,m&&v.setAttribute("nonce",m),document.head.appendChild(v),y)return new Promise((S,k)=>{v.addEventListener("load",S),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return o.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},Se=s=>typeof s=="string",Or=()=>{let s,t;const a=new Promise((r,o)=>{s=r,t=o});return a.resolve=s,a.reject=t,a},Tg=s=>s==null?"":String(s),W0=(s,t,a)=>{s.forEach(r=>{t[r]&&(a[r]=t[r])})},K0=/###/g,Ag=s=>s&&s.includes("###")?s.replace(K0,"."):s,jg=s=>!s||Se(s),Wr=(s,t,a)=>{const r=Se(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(jg(s))return{};const c=Ag(r[o]);!s[c]&&a&&(s[c]=new a),Object.prototype.hasOwnProperty.call(s,c)?s=s[c]:s={},++o}return jg(s)?{}:{obj:s,k:Ag(r[o])}},Rg=(s,t,a)=>{const{obj:r,k:o}=Wr(s,t,Object);if(r!==void 0||t.length===1){r[o]=a;return}let c=t[t.length-1],u=t.slice(0,t.length-1),f=Wr(s,u,Object);for(;f.obj===void 0&&u.length;)c=`${u[u.length-1]}.${c}`,u=u.slice(0,u.length-1),f=Wr(s,u,Object),f!=null&&f.obj&&typeof f.obj[`${f.k}.${c}`]<"u"&&(f.obj=void 0);f.obj[`${f.k}.${c}`]=a},Y0=(s,t,a,r)=>{const{obj:o,k:c}=Wr(s,t,Object);o[c]=o[c]||[],o[c].push(a)},Po=(s,t)=>{const{obj:a,k:r}=Wr(s,t);if(a&&Object.prototype.hasOwnProperty.call(a,r))return a[r]},Z0=(s,t,a)=>{const r=Po(s,a);return r!==void 0?r:Po(t,a)},tb=(s,t,a)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(Object.prototype.hasOwnProperty.call(s,r)?Se(s[r])||s[r]instanceof String||Se(t[r])||t[r]instanceof String?a&&(s[r]=t[r]):tb(s[r],t[r],a):s[r]=t[r]);return s},hs=s=>s.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),Q0={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},X0=s=>Se(s)?s.replace(/[&<>"'\/]/g,t=>Q0[t]):s;class J0{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const eS=[" ",",","?","!",";"],tS=new J0(20),nS=(s,t,a)=>{t=t||"",a=a||"";const r=eS.filter(u=>!t.includes(u)&&!a.includes(u));if(r.length===0)return!0;const o=tS.getRegExp(`(${r.map(u=>u==="?"?"\\?":u).join("|")})`);let c=!o.test(s);if(!c){const u=s.indexOf(a);u>0&&!o.test(s.substring(0,u))&&(c=!0)}return c},Fd=(s,t,a=".")=>{if(!s)return;if(s[t])return Object.prototype.hasOwnProperty.call(s,t)?s[t]:void 0;const r=t.split(a);let o=s;for(let c=0;c<r.length;){if(!o||typeof o!="object")return;let u,f="";for(let m=c;m<r.length;++m)if(m!==c&&(f+=a),f+=r[m],u=o[f],u!==void 0){if(["string","number","boolean"].includes(typeof u)&&m<r.length-1)continue;c+=m-c+1;break}o=u}return o},sl=s=>s==null?void 0:s.replace(/_/g,"-"),sS={type:"logger",log(s){this.output("log",s)},warn(s){this.output("warn",s)},error(s){this.output("error",s)},output(s,t){var a,r;(r=(a=console==null?void 0:console[s])==null?void 0:a.apply)==null||r.call(a,console,t)}};class Go{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||sS,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,r,o){return o&&!this.debug?null:(t=t.map(c=>Se(c)?c.replace(/[\r\n\x00-\x1F\x7F]/g," "):c),Se(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new Go(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Go(this.logger,t)}}var Vn=new Go;class tc{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(a)||0;this.observers[r].set(a,o+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}once(t,a){const r=(...o)=>{a(...o),this.off(t,r)};return this.on(t,r),this}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,c])=>{for(let u=0;u<c;u++)o(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let u=0;u<c;u++)o(t,...a)})}}class Og extends tc{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,r,o={}){var g,y;const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,u=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let f;t.includes(".")?f=t.split("."):(f=[t,a],r&&(Array.isArray(r)?f.push(...r):Se(r)&&c?f.push(...r.split(c)):f.push(r)));const m=Po(this.data,f);return!m&&!a&&!r&&t.includes(".")&&(t=f[0],a=f[1],r=f.slice(2).join(".")),m||!u||!Se(r)?m:Fd((y=(g=this.data)==null?void 0:g[t])==null?void 0:y[a],r,c)}addResource(t,a,r,o,c={silent:!1}){const u=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let f=[t,a];r&&(f=f.concat(u?r.split(u):r)),t.includes(".")&&(f=t.split("."),o=a,a=f[1]),this.addNamespaces(a),Rg(this.data,f,o),c.silent||this.emit("added",t,a,r,o)}addResources(t,a,r,o={silent:!1}){for(const c in r)(Se(r[c])||Array.isArray(r[c]))&&this.addResource(t,a,c,r[c],{silent:!0});o.silent||this.emit("added",t,a,r)}addResourceBundle(t,a,r,o,c,u={silent:!1,skipCopy:!1}){let f=[t,a];t.includes(".")&&(f=t.split("."),o=r,r=a,a=f[1]),this.addNamespaces(a);let m=Po(this.data,f)||{};u.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?tb(m,r,c):m={...m,...r},Rg(this.data,f,m),u.silent||this.emit("added",t,a,r)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(o=>a[o]&&Object.keys(a[o]).length>0)}toJSON(){return this.data}}var nb={processors:{},addPostProcessor(s){this.processors[s.name]=s},handle(s,t,a,r,o){return s.forEach(c=>{var u;t=((u=this.processors[c])==null?void 0:u.process(t,a,r,o))??t}),t}};const sb=Symbol("i18next/PATH_KEY");function aS(){const s=[],t=Object.create(null);let a;return t.get=(r,o)=>{var c;return(c=a==null?void 0:a.revoke)==null||c.call(a),o===sb?s:(s.push(o),a=Proxy.revocable(r,t),a.proxy)},Proxy.revocable(Object.create(null),t).proxy}function _i(s,t){const{[sb]:a}=s(aS()),r=(t==null?void 0:t.keySeparator)??".",o=(t==null?void 0:t.nsSeparator)??":",c=(t==null?void 0:t.enableSelector)==="strict";if(a.length>1&&o){const u=t==null?void 0:t.ns,f=c?Array.isArray(u)?u:u?[u]:null:Array.isArray(u)?u:null;if(f&&(c?f:f.length>1?f.slice(1):[]).includes(a[0]))return`${a[0]}${o}${a.slice(1).join(r)}`}return a.join(r)}const bd=s=>!Se(s)&&typeof s!="boolean"&&typeof s!="number";class Fo extends tc{constructor(t,a={}){super(),W0(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Vn.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const r={...a};if(t==null)return!1;const o=this.resolve(t,r);if((o==null?void 0:o.res)===void 0)return!1;const c=bd(o.res);return!(r.returnObjects===!1&&c)}extractFromKey(t,a){let r=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let c=a.ns||this.options.defaultNS||[];const u=r&&t.includes(r),f=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!nS(t,r,o);if(u&&!f){const m=t.match(this.interpolator.nestingRegexp);if(m&&m.length>0)return{key:t,namespaces:Se(c)?[c]:c};const g=t.split(r);(r!==o||r===o&&this.options.ns.includes(g[0]))&&(c=g.shift()),t=g.join(o)}return{key:t,namespaces:Se(c)?[c]:c}}translate(t,a,r){let o=typeof a=="object"?{...a}:a;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),t==null)return"";typeof t=="function"&&(t=_i(t,{...this.options,...o})),Array.isArray(t)||(t=[String(t)]),t=t.map(W=>typeof W=="function"?_i(W,{...this.options,...o}):String(W));const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,u=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:f,namespaces:m}=this.extractFromKey(t[t.length-1],o),g=m[m.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const b=o.lng||this.language,v=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((b==null?void 0:b.toLowerCase())==="cimode")return v?c?{res:`${g}${y}${f}`,usedKey:f,exactUsedKey:f,usedLng:b,usedNS:g,usedParams:this.getUsedParamsDetails(o)}:`${g}${y}${f}`:c?{res:f,usedKey:f,exactUsedKey:f,usedLng:b,usedNS:g,usedParams:this.getUsedParamsDetails(o)}:f;const S=this.resolve(t,o);let k=S==null?void 0:S.res;const C=(S==null?void 0:S.usedKey)||f,E=(S==null?void 0:S.exactUsedKey)||f,O=["[object Number]","[object Function]","[object RegExp]"],j=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,T=!this.i18nFormat||this.i18nFormat.handleAsObject,U=o.count!==void 0&&!Se(o.count),R=Fo.hasDefaultValue(o),K=U?this.pluralResolver.getSuffix(b,o.count,o):"",Z=o.ordinal&&U?this.pluralResolver.getSuffix(b,o.count,{ordinal:!1}):"",te=U&&!o.ordinal&&o.count===0,pe=te&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${K}`]||o[`defaultValue${Z}`]||o.defaultValue;let he=k;T&&!k&&R&&(he=pe);const it=bd(he),de=Object.prototype.toString.apply(he);if(T&&he&&it&&!O.includes(de)&&!(Se(j)&&Array.isArray(he))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const W=this.options.returnedObjectHandler?this.options.returnedObjectHandler(C,he,{...o,ns:m}):`key '${f} (${this.language})' returned an object instead of string.`;return c?(S.res=W,S.usedParams=this.getUsedParamsDetails(o),S):W}if(u){const W=Array.isArray(he),Y=W?[]:{},ve=W?E:C;for(const H in he)if(Object.prototype.hasOwnProperty.call(he,H)){const Q=`${ve}${u}${H}`;R&&!k?Y[H]=this.translate(Q,{...o,defaultValue:bd(pe)?pe[H]:void 0,joinArrays:!1,ns:m}):Y[H]=this.translate(Q,{...o,joinArrays:!1,ns:m}),Y[H]===Q&&(Y[H]=he[H])}k=Y}}else if(T&&Se(j)&&Array.isArray(k))k=k.join(j),k&&(k=this.extendTranslation(k,t,o,r));else{let W=!1,Y=!1;!this.isValidLookup(k)&&R&&(W=!0,k=pe),this.isValidLookup(k)||(Y=!0,k=f);const H=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Y?void 0:k,Q=R&&pe!==k&&this.options.updateMissing;if(Y||W||Q){if(this.logger.log(Q?"updateKey":"missingKey",b,g,U&&!Q?`${f}${this.pluralResolver.getSuffix(b,o.count,o)}`:f,Q?pe:k),u){const qe=this.resolve(f,{...o,keySeparator:!1});qe&&qe.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 ne=[];const Be=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Be&&Be[0])for(let qe=0;qe<Be.length;qe++)ne.push(Be[qe]);else this.options.saveMissingTo==="all"?ne=this.languageUtils.toResolveHierarchy(o.lng||this.language):ne.push(o.lng||this.language);const Pe=(qe,X,se)=>{var ae;const le=R&&se!==k?se:H;this.options.missingKeyHandler?this.options.missingKeyHandler(qe,g,X,le,Q,o):(ae=this.backendConnector)!=null&&ae.saveMissing&&this.backendConnector.saveMissing(qe,g,X,le,Q,o),this.emit("missingKey",qe,g,X,k)};this.options.saveMissing&&(this.options.saveMissingPlurals&&U?ne.forEach(qe=>{const X=this.pluralResolver.getSuffixes(qe,o);te&&o[`defaultValue${this.options.pluralSeparator}zero`]&&!X.includes(`${this.options.pluralSeparator}zero`)&&X.push(`${this.options.pluralSeparator}zero`),X.forEach(se=>{Pe([qe],f+se,o[`defaultValue${se}`]||pe)})}):Pe(ne,f,pe))}k=this.extendTranslation(k,t,o,S,r),Y&&k===f&&this.options.appendNamespaceToMissingKey&&(k=`${g}${y}${f}`),(Y||W)&&this.options.parseMissingKeyHandler&&(k=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${g}${y}${f}`:f,W?k:void 0,o))}return c?(S.res=k,S.usedParams=this.getUsedParamsDetails(o),S):k}extendTranslation(t,a,r,o,c){var m,g;if((m=this.i18nFormat)!=null&&m.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const y=Se(t)&&(((g=r==null?void 0:r.interpolation)==null?void 0:g.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let b;if(y){const S=t.match(this.interpolator.nestingRegexp);b=S&&S.length}let v=r.replace&&!Se(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(v={...this.options.interpolation.defaultVariables,...v}),t=this.interpolator.interpolate(t,v,r.lng||this.language||o.usedLng,r),y){const S=t.match(this.interpolator.nestingRegexp),k=S&&S.length;b<k&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>(c==null?void 0:c[0])===S[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${a[0]}`),null):this.translate(...S,a),r)),r.interpolation&&this.interpolator.reset()}const u=r.postProcess||this.options.postProcess,f=Se(u)?[u]:u;return t!=null&&(f!=null&&f.length)&&r.applyPostProcessor!==!1&&(t=nb.handle(f,t,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,a={}){let r,o,c,u,f;return Se(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(m=>typeof m=="function"?_i(m,{...this.options,...a}):m)),t.forEach(m=>{if(this.isValidLookup(r))return;const g=this.extractFromKey(m,a),y=g.key;o=y;let b=g.namespaces;this.options.fallbackNS&&(b=b.concat(this.options.fallbackNS));const v=a.count!==void 0&&!Se(a.count),S=v&&!a.ordinal&&a.count===0,k=a.context!==void 0&&(Se(a.context)||typeof a.context=="number")&&a.context!=="",C=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);b.forEach(E=>{var O,j;this.isValidLookup(r)||(f=E,!this.checkedLoadedFor[`${C[0]}-${E}`]&&((O=this.utils)!=null&&O.hasLoadedNamespace)&&!((j=this.utils)!=null&&j.hasLoadedNamespace(f))&&(this.checkedLoadedFor[`${C[0]}-${E}`]=!0,this.logger.warn(`key "${o}" for languages "${C.join(", ")}" won't get resolved as namespace "${f}" 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!!!")),C.forEach(T=>{var K;if(this.isValidLookup(r))return;u=T;const U=[y];if((K=this.i18nFormat)!=null&&K.addLookupKeys)this.i18nFormat.addLookupKeys(U,y,T,E,a);else{let Z;v&&(Z=this.pluralResolver.getSuffix(T,a.count,a));const te=`${this.options.pluralSeparator}zero`,pe=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(v&&(a.ordinal&&Z.startsWith(pe)&&U.push(y+Z.replace(pe,this.options.pluralSeparator)),U.push(y+Z),S&&U.push(y+te)),k){const he=`${y}${this.options.contextSeparator||"_"}${a.context}`;U.push(he),v&&(a.ordinal&&Z.startsWith(pe)&&U.push(he+Z.replace(pe,this.options.pluralSeparator)),U.push(he+Z),S&&U.push(he+te))}}let R;for(;R=U.pop();)this.isValidLookup(r)||(c=R,r=this.getResource(T,E,R,a))}))})}),{res:r,usedKey:o,exactUsedKey:c,usedLng:u,usedNS:f}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,r,o={}){var c;return(c=this.i18nFormat)!=null&&c.getResource?this.i18nFormat.getResource(t,a,r,o):this.resourceStore.getResource(t,a,r,o)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!Se(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o={...o,count:t.count}),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const c of a)delete o[c]}return o}static hasDefaultValue(t){const a="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r.startsWith(a)&&t[r]!==void 0)return!0;return!1}}class Mg{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Vn.create("languageUtils")}getScriptPartFromCode(t){if(t=sl(t),!t||!t.includes("-"))return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=sl(t),!t||!t.includes("-"))return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(Se(t)&&t.includes("-")){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(r=>{if(a)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(a=o)}),!a&&this.options.supportedLngs&&t.forEach(r=>{if(a)return;const o=this.getScriptPartFromCode(r);if(this.isSupportedCode(o))return a=o;const c=this.getLanguagePartFromCode(r);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(u=>u===c?!0:!u.includes("-")&&!c.includes("-")?!1:!!(u.includes("-")&&!c.includes("-")&&u.slice(0,u.indexOf("-"))===c||u.startsWith(c)&&c.length>1))}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),Se(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let r=t[a];return r||(r=t[this.getScriptPartFromCode(a)]),r||(r=t[this.formatLanguageCode(a)]),r||(r=t[this.getLanguagePartFromCode(a)]),r||(r=t.default),r||[]}toResolveHierarchy(t,a){const r=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),o=[],c=u=>{u&&(this.isSupportedCode(u)?o.push(u):this.logger.warn(`rejecting language code not found in supportedLngs: ${u}`))};return Se(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):Se(t)&&c(this.formatLanguageCode(t)),r.forEach(u=>{o.includes(u)||c(this.formatLanguageCode(u))}),o}}const Bg={zero:0,one:1,two:2,few:3,many:4,other:5},Dg={select:s=>s===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class iS{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=Vn.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const r=sl(t==="dev"?"en":t),o=a.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:r,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let u;try{u=new Intl.PluralRules(r,{type:o})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Dg;if(!t.match(/-|_/))return Dg;const m=this.languageUtils.getLanguagePartFromCode(t);u=this.getRule(m,a)}return this.pluralRulesCache[c]=u,u}needsPlural(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,a,r={}){return this.getSuffixes(t,r).map(o=>`${a}${o}`)}getSuffixes(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?r.resolvedOptions().pluralCategories.sort((o,c)=>Bg[o]-Bg[c]).map(o=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,a,r={}){const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,r))}}const Lg=(s,t,a,r=".",o=!0)=>{let c=Z0(s,t,a);return!c&&o&&Se(a)&&(c=Fd(s,a,r),c===void 0&&(c=Fd(t,a,r))),c},rS=s=>s.replace(/\$/g,"$$$$");class zg{constructor(t={}){var a;this.logger=Vn.create("interpolator"),this.options=t,this.format=((a=t==null?void 0:t.interpolation)==null?void 0:a.format)||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:r,useRawValueToEscape:o,prefix:c,prefixEscaped:u,suffix:f,suffixEscaped:m,formatSeparator:g,unescapeSuffix:y,unescapePrefix:b,nestingPrefix:v,nestingPrefixEscaped:S,nestingSuffix:k,nestingSuffixEscaped:C,nestingOptionsSeparator:E,maxReplaces:O,alwaysFormat:j}=t.interpolation;this.escape=a!==void 0?a:X0,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?hs(c):u||"{{",this.suffix=f?hs(f):m||"}}",this.formatSeparator=g||",",this.unescapePrefix=y?"":b?hs(b):"-",this.unescapeSuffix=this.unescapePrefix?"":y?hs(y):"",this.nestingPrefix=v?hs(v):S||hs("$t("),this.nestingSuffix=k?hs(k):C||hs(")"),this.nestingOptionsSeparator=E||",",this.maxReplaces=O||1e3,this.alwaysFormat=j!==void 0?j:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,r)=>(a==null?void 0:a.source)===r?(a.lastIndex=0,a):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,a,r,o){var S;let c,u,f;const m=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},g=k=>{if(!k.includes(this.formatSeparator)){const j=Lg(a,m,k,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(j,void 0,r,{...o,...a,interpolationkey:k}):j}const C=k.split(this.formatSeparator),E=C.shift().trim(),O=C.join(this.formatSeparator).trim();return this.format(Lg(a,m,E,this.options.keySeparator,this.options.ignoreJSONStructure),O,r,{...o,...a,interpolationkey:E})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&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 y=(o==null?void 0:o.missingInterpolationHandler)||this.options.missingInterpolationHandler,b=((S=o==null?void 0:o.interpolation)==null?void 0:S.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:k=>k},{regex:this.regexp,safeValue:k=>this.escapeValue?this.escape(k):k}].forEach(k=>{for(f=0;c=k.regex.exec(t);){const C=c[1].trim();if(u=g(C),u===void 0)if(typeof y=="function"){const O=y(t,c,o);u=Se(O)?O:""}else if(o&&Object.prototype.hasOwnProperty.call(o,C))u="";else if(b){u=c[0];continue}else this.logger.warn(`missed to pass in variable ${C} for interpolating ${t}`),u="";else!Se(u)&&!this.useRawValueToEscape&&(u=Tg(u));const E=k.safeValue(u);if(t=t.replace(c[0],rS(E)),b?(k.regex.lastIndex+=E.length,k.regex.lastIndex-=c[0].length):k.regex.lastIndex=0,f++,f>=this.maxReplaces)break}}),t}nest(t,a,r={}){let o,c,u;const f=(m,g)=>{const y=this.nestingOptionsSeparator;if(!m.includes(y))return m;const b=m.split(new RegExp(`${hs(y)}[ ]*{`));let v=`{${b[1]}`;m=b[0],v=this.interpolate(v,u);const S=v.match(/'/g),k=v.match(/"/g);(((S==null?void 0:S.length)??0)%2===0&&!k||((k==null?void 0:k.length)??0)%2!==0)&&(v=v.replace(/'/g,'"'));try{u=JSON.parse(v),g&&(u={...g,...u})}catch(C){return this.logger.warn(`failed parsing options string in nesting for key ${m}`,C),`${m}${y}${v}`}return u.defaultValue&&u.defaultValue.includes(this.prefix)&&delete u.defaultValue,m};for(;o=this.nestingRegexp.exec(t);){let m=[];u={...r},u=u.replace&&!Se(u.replace)?u.replace:u,u.applyPostProcessor=!1,delete u.defaultValue;const g=/{.*}/s.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(g!==-1&&(m=o[1].slice(g).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,g)),c=a(f.call(this,o[1].trim(),u),u),c&&o[0]===t&&!Se(c))return c;Se(c)||(c=Tg(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),c=""),m.length&&(c=m.reduce((y,b)=>this.format(y,b,r.lng,{...r,interpolationkey:o[1].trim()}),c.trim())),t=t.replace(o[0],c),this.regexp.lastIndex=0}return t}}const lS=s=>{let t=s.toLowerCase().trim();const a={};if(s.includes("(")){const r=s.split("(");t=r[0].toLowerCase().trim();const o=r[1].slice(0,-1);t==="currency"&&!o.includes(":")?a.currency||(a.currency=o.trim()):t==="relativetime"&&!o.includes(":")?a.range||(a.range=o.trim()):o.split(";").forEach(u=>{if(u){const[f,...m]=u.split(":"),g=m.join(":").trim().replace(/^'+|'+$/g,""),y=f.trim();a[y]||(a[y]=g),g==="false"&&(a[y]=!1),g==="true"&&(a[y]=!0),isNaN(g)||(a[y]=parseInt(g,10))}})}return{formatName:t,formatOptions:a}},Ug=s=>{const t={};return(a,r,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const u=r+JSON.stringify(c);let f=t[u];return f||(f=s(sl(r),o),t[u]=f),f(a)}},oS=s=>(t,a,r)=>s(sl(a),r)(t);class cS{constructor(t={}){this.logger=Vn.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const r=a.cacheInBuiltFormats?Ug:oS;this.formats={number:r((o,c)=>{const u=new Intl.NumberFormat(o,{...c});return f=>u.format(f)}),currency:r((o,c)=>{const u=new Intl.NumberFormat(o,{...c,style:"currency"});return f=>u.format(f)}),datetime:r((o,c)=>{const u=new Intl.DateTimeFormat(o,{...c});return f=>u.format(f)}),relativetime:r((o,c)=>{const u=new Intl.RelativeTimeFormat(o,{...c});return f=>u.format(f,c.range||"day")}),list:r((o,c)=>{const u=new Intl.ListFormat(o,{...c});return f=>u.format(f)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=Ug(a)}format(t,a,r,o={}){if(!a||t==null)return t;const c=a.split(this.formatSeparator),u=[];for(let m=0;m<c.length;m++){let g=c[m];for(;g.indexOf("(")>-1&&!g.includes(")")&&m+1<c.length;)g=`${g}${this.formatSeparator}${c[++m]}`;u.push(g)}return u.reduce((m,g)=>{var v;const{formatName:y,formatOptions:b}=lS(g);if(this.formats[y]){let S=m;try{const k=((v=o==null?void 0:o.formatParams)==null?void 0:v[o.interpolationkey])||{},C=k.locale||k.lng||o.locale||o.lng||r;S=this.formats[y](m,C,{...b,...o,...k})}catch(k){this.logger.warn(k)}return S}else this.logger.warn(`there was no format function for ${y}`);return m},t)}}const uS=(s,t)=>{s.pending[t]!==void 0&&(delete s.pending[t],s.pendingCount--)};class dS extends tc{constructor(t,a,r,o={}){var c,u;super(),this.backend=t,this.store=a,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=Vn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],(u=(c=this.backend)==null?void 0:c.init)==null||u.call(c,r,o.backend,o)}queueLoad(t,a,r,o){const c={},u={},f={},m={};return t.forEach(g=>{let y=!0;a.forEach(b=>{const v=`${g}|${b}`;!r.reload&&this.store.hasResourceBundle(g,b)?this.state[v]=2:this.state[v]<0||(this.state[v]===1?u[v]===void 0&&(u[v]=!0):(this.state[v]=1,y=!1,u[v]===void 0&&(u[v]=!0),c[v]===void 0&&(c[v]=!0),m[b]===void 0&&(m[b]=!0)))}),y||(f[g]=!0)}),(Object.keys(c).length||Object.keys(u).length)&&this.queue.push({pending:u,pendingCount:Object.keys(u).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(u),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(m)}}loaded(t,a,r){const o=t.split("|"),c=o[0],u=o[1];a&&this.emit("failedLoading",c,u,a),!a&&r&&this.store.addResourceBundle(c,u,r,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&r&&(this.state[t]=0);const f={};this.queue.forEach(m=>{Y0(m.loaded,[c],u),uS(m,t),a&&m.errors.push(a),m.pendingCount===0&&!m.done&&(Object.keys(m.loaded).forEach(g=>{f[g]||(f[g]={});const y=m.loaded[g];y.length&&y.forEach(b=>{f[g][b]===void 0&&(f[g][b]=!0)})}),m.done=!0,m.errors.length?m.callback(m.errors):m.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(m=>!m.done)}read(t,a,r,o=0,c=this.retryTimeout,u){if(!t.length)return u(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:r,tried:o,wait:c,callback:u});return}this.readingCalls++;const f=(g,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const b=this.waitingReads.shift();this.read(b.lng,b.ns,b.fcName,b.tried,b.wait,b.callback)}if(g&&y&&o<this.maxRetries){setTimeout(()=>{this.read(t,a,r,o+1,c*2,u)},c);return}u(g,y)},m=this.backend[r].bind(this.backend);if(m.length===2){try{const g=m(t,a);g&&typeof g.then=="function"?g.then(y=>f(null,y)).catch(f):f(null,g)}catch(g){f(g)}return}return m(t,a,f)}prepareLoading(t,a,r={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();Se(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Se(a)&&(a=[a]);const c=this.queueLoad(t,a,r,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(u=>{this.loadOne(u)})}load(t,a,r){this.prepareLoading(t,a,{},r)}reload(t,a,r){this.prepareLoading(t,a,{reload:!0},r)}loadOne(t,a=""){const r=t.split("|"),o=r[0],c=r[1];this.read(o,c,"read",void 0,void 0,(u,f)=>{u&&this.logger.warn(`${a}loading namespace ${c} for language ${o} failed`,u),!u&&f&&this.logger.log(`${a}loaded namespace ${c} for language ${o}`,f),this.loaded(t,u,f)})}saveMissing(t,a,r,o,c,u={},f=()=>{}){var m,g,y,b,v;if((g=(m=this.services)==null?void 0:m.utils)!=null&&g.hasLoadedNamespace&&!((b=(y=this.services)==null?void 0:y.utils)!=null&&b.hasLoadedNamespace(a))){this.logger.warn(`did not save key "${r}" as the namespace "${a}" 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(!(r==null||r==="")){if((v=this.backend)!=null&&v.create){const S={...u,isUpdate:c},k=this.backend.create.bind(this.backend);if(k.length<6)try{let C;k.length===5?C=k(t,a,r,o,S):C=k(t,a,r,o),C&&typeof C.then=="function"?C.then(E=>f(null,E)).catch(f):f(null,C)}catch(C){f(C)}else k(t,a,r,o,f,S)}!t||!t[0]||this.store.addResource(t[0],a,r,o)}}}const xd=()=>({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:s=>{let t={};if(typeof s[1]=="object"&&(t=s[1]),Se(s[1])&&(t.defaultValue=s[1]),Se(s[2])&&(t.tDescription=s[2]),typeof s[2]=="object"||typeof s[3]=="object"){const a=s[3]||s[2];Object.keys(a).forEach(r=>{t[r]=a[r]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Hg=s=>(Se(s.ns)&&(s.ns=[s.ns]),Se(s.fallbackLng)&&(s.fallbackLng=[s.fallbackLng]),Se(s.fallbackNS)&&(s.fallbackNS=[s.fallbackNS]),s.supportedLngs&&!s.supportedLngs.includes("cimode")&&(s.supportedLngs=s.supportedLngs.concat(["cimode"])),s),jo=()=>{},fS=s=>{Object.getOwnPropertyNames(Object.getPrototypeOf(s)).forEach(a=>{typeof s[a]=="function"&&(s[a]=s[a].bind(s))})};class Kr extends tc{constructor(t={},a){if(super(),this.options=Hg(t),this.services={},this.logger=Vn,this.modules={external:[]},fS(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(Se(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const r=xd();this.options={...r,...this.options,...Hg(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const o=g=>g?typeof g=="function"?new g:g:null;if(!this.options.isClone){this.modules.logger?Vn.init(o(this.modules.logger),this.options):Vn.init(null,this.options);let g;this.modules.formatter?g=this.modules.formatter:g=cS;const y=new Mg(this.options);this.store=new Og(this.options.resources,this.options);const b=this.services;b.logger=Vn,b.resourceStore=this.store,b.languageUtils=y,b.pluralResolver=new iS(y,{prepend:this.options.pluralSeparator}),g&&(b.formatter=o(g),b.formatter.init&&b.formatter.init(b,this.options),this.options.interpolation.format=b.formatter.format.bind(b.formatter)),b.interpolator=new zg(this.options),b.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},b.backendConnector=new dS(o(this.modules.backend),b.resourceStore,b,this.options),b.backendConnector.on("*",(v,...S)=>{this.emit(v,...S)}),this.modules.languageDetector&&(b.languageDetector=o(this.modules.languageDetector),b.languageDetector.init&&b.languageDetector.init(b,this.options.detection,this.options)),this.modules.i18nFormat&&(b.i18nFormat=o(this.modules.i18nFormat),b.i18nFormat.init&&b.i18nFormat.init(this)),this.translator=new Fo(this.services,this.options),this.translator.on("*",(v,...S)=>{this.emit(v,...S)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,a||(a=jo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const g=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);g.length>0&&g[0]!=="dev"&&(this.options.lng=g[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(g=>{this[g]=(...y)=>this.store[g](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(g=>{this[g]=(...y)=>(this.store[g](...y),this)});const f=Or(),m=()=>{const g=(y,b)=>{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),f.resolve(b),a(y,b)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return g(null,this.t.bind(this));this.changeLanguage(this.options.lng,g)};return this.options.resources||!this.options.initAsync?m():setTimeout(m,0),f}loadResources(t,a=jo){var c,u;let r=a;const o=Se(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if((o==null?void 0:o.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const f=[],m=g=>{if(!g||g==="cimode")return;this.services.languageUtils.toResolveHierarchy(g).forEach(b=>{b!=="cimode"&&(f.includes(b)||f.push(b))})};o?m(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(y=>m(y)),(u=(c=this.options.preload)==null?void 0:c.forEach)==null||u.call(c,g=>m(g)),this.services.backendConnector.load(f,this.options.ns,g=>{!g&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(g)})}else r(null)}reloadResources(t,a,r){const o=Or();return typeof t=="function"&&(r=t,t=void 0),typeof a=="function"&&(r=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),r||(r=jo),this.services.backendConnector.reload(t,a,c=>{o.resolve(),r(c)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&nb.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let a=0;a<this.languages.length;a++){const r=this.languages[a];if(!["cimode","dev"].includes(r)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const r=Or();this.emit("languageChanging",t);const o=f=>{this.language=f,this.languages=this.services.languageUtils.toResolveHierarchy(f),this.resolvedLanguage=void 0,this.setResolvedLanguage(f)},c=(f,m)=>{m?this.isLanguageChangingTo===t&&(o(m),this.translator.changeLanguage(m),this.isLanguageChangingTo=void 0,this.emit("languageChanged",m),this.logger.log("languageChanged",m)):this.isLanguageChangingTo=void 0,r.resolve((...g)=>this.t(...g)),a&&a(f,(...g)=>this.t(...g))},u=f=>{var y,b;!t&&!f&&this.services.languageDetector&&(f=[]);const m=Se(f)?f:f&&f[0],g=this.store.hasLanguageSomeTranslations(m)?m:this.services.languageUtils.getBestMatchFromCodes(Se(f)?[f]:f);g&&(this.language||o(g),this.translator.language||this.translator.changeLanguage(g),(b=(y=this.services.languageDetector)==null?void 0:y.cacheUserLanguage)==null||b.call(y,g)),this.loadResources(g,v=>{c(v,g)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(u):this.services.languageDetector.detect(u):u(t),r}getFixedT(t,a,r,o){const c=o==null?void 0:o.scopeNs,u=(f,m,...g)=>{let y;typeof m!="object"?y=this.options.overloadTranslationOptionHandler([f,m].concat(g)):y={...m},y.lng=y.lng||u.lng,y.lngs=y.lngs||u.lngs;const b=y.ns!==void 0&&y.ns!==null;y.ns=y.ns||u.ns,y.keyPrefix!==""&&(y.keyPrefix=y.keyPrefix||r||u.keyPrefix);const v={...this.options,...y};Array.isArray(c)&&!b&&(v.ns=c),typeof y.keyPrefix=="function"&&(y.keyPrefix=_i(y.keyPrefix,v));const S=this.options.keySeparator||".";let k;return y.keyPrefix&&Array.isArray(f)?k=f.map(C=>(typeof C=="function"&&(C=_i(C,v)),`${y.keyPrefix}${S}${C}`)):(typeof f=="function"&&(f=_i(f,v)),k=y.keyPrefix?`${y.keyPrefix}${S}${f}`:f),this.t(k,y)};return Se(t)?u.lng=t:u.lngs=t,u.ns=a,u.keyPrefix=r,u}t(...t){var a;return(a=this.translator)==null?void 0:a.translate(...t)}exists(...t){var a;return(a=this.translator)==null?void 0:a.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){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 r=a.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const u=(f,m)=>{const g=this.services.backendConnector.state[`${f}|${m}`];return g===-1||g===0||g===2};if(a.precheck){const f=a.precheck(this,u);if(f!==void 0)return f}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||u(r,t)&&(!o||u(c,t)))}loadNamespaces(t,a){const r=Or();return this.options.ns?(Se(t)&&(t=[t]),t.forEach(o=>{this.options.ns.includes(o)||this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),a&&a(o)}),r):(a&&a(),Promise.resolve())}loadLanguages(t,a){const r=Or();Se(t)&&(t=[t]);const o=this.options.preload||[],c=t.filter(u=>!o.includes(u)&&this.services.languageUtils.isSupportedCode(u));return c.length?(this.options.preload=o.concat(c),this.loadResources(u=>{r.resolve(),a&&a(u)}),r):(a&&a(),Promise.resolve())}dir(t){var o,c;if(t||(t=this.resolvedLanguage||(((o=this.languages)==null?void 0:o.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const u=new Intl.Locale(t);if(u&&u.getTextInfo){const f=u.getTextInfo();if(f&&f.direction)return f.direction}}catch{}const a=["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"],r=((c=this.services)==null?void 0:c.languageUtils)||new Mg(xd());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.includes(r.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){const r=new Kr(t,a);return r.createInstance=Kr.createInstance,r}cloneInstance(t={},a=jo){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},c=new Kr(o);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(f=>{c[f]=this[f]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},r){const f=Object.keys(this.store.data).reduce((m,g)=>(m[g]={...this.store.data[g]},m[g]=Object.keys(m[g]).reduce((y,b)=>(y[b]={...m[g][b]},y),m[g]),m),{});c.store=new Og(f,o),c.services.resourceStore=c.store}if(t.interpolation){const m={...xd().interpolation,...this.options.interpolation,...t.interpolation},g={...o,interpolation:m};c.services.interpolator=new zg(g)}return c.translator=new Fo(c.services,o),c.translator.on("*",(f,...m)=>{c.emit(f,...m)}),c.init(o,a),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const qt=Kr.createInstance();qt.createInstance;qt.dir;qt.init;qt.loadResources;qt.reloadResources;qt.use;qt.changeLanguage;qt.getFixedT;qt.t;qt.exists;qt.setDefaultNamespace;qt.hasLoadedNamespace;qt.loadNamespaces;qt.loadLanguages;const pS=(s,t,a,r)=>{var c,u,f,m;const o=[a,{code:t,...r||{}}];if((u=(c=s==null?void 0:s.services)==null?void 0:c.logger)!=null&&u.forward)return s.services.logger.forward(o,"warn","react-i18next::",!0);_a(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),(m=(f=s==null?void 0:s.services)==null?void 0:f.logger)!=null&&m.warn?s.services.logger.warn(...o):console!=null&&console.warn&&console.warn(...o)},$g={},qd=(s,t,a,r)=>{_a(a)&&$g[a]||(_a(a)&&($g[a]=new Date),pS(s,t,a,r))},ab=(s,t)=>()=>{if(s.isInitialized)t();else{const a=()=>{setTimeout(()=>{s.off("initialized",a)},0),t()};s.on("initialized",a)}},Vd=(s,t,a)=>{s.loadNamespaces(t,ab(s,a))},Ig=(s,t,a,r)=>{if(_a(a)&&(a=[a]),s.options.preload&&s.options.preload.indexOf(t)>-1)return Vd(s,a,r);a.forEach(o=>{s.options.ns.indexOf(o)<0&&s.options.ns.push(o)}),s.loadLanguages(t,ab(s,r))},hS=(s,t,a={})=>!t.languages||!t.languages.length?(qd(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(s,{lng:a.lng,precheck:(r,o)=>{if(a.bindI18n&&a.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,s))return!1}}),_a=s=>typeof s=="string",mS=s=>typeof s=="object"&&s!==null,gS=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,yS={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},bS=s=>yS[s],xS=s=>s.replace(gS,bS);let Wd={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:xS,transDefaultProps:void 0};const vS=(s={})=>{Wd={...Wd,...s}},SS=()=>Wd;let ib;const kS=s=>{ib=s},wS=()=>ib,_S={type:"3rdParty",init(s){vS(s.options.react),kS(s)}},CS=_.createContext();class ES{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var NS=U0();const TS=(s,t)=>{if(_a(t))return t;if(mS(t)&&_a(t.defaultValue))return t.defaultValue;if(typeof s=="function")return"";if(Array.isArray(s)){const a=s[s.length-1];return typeof a=="function"?"":a}return s},AS={t:TS,ready:!1},jS=()=>()=>{},Tn=(s,t={})=>{var pe,he,it;const{i18n:a}=t,{i18n:r,defaultNS:o}=_.useContext(CS)||{},c=a||r||wS();c&&!c.reportNamespaces&&(c.reportNamespaces=new ES),c||qd(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const u=_.useMemo(()=>{var de;return{...SS(),...(de=c==null?void 0:c.options)==null?void 0:de.react,...t}},[c,t]),{useSuspense:f,keyPrefix:m}=u,g=s||o||((pe=c==null?void 0:c.options)==null?void 0:pe.defaultNS),y=_a(g)?[g]:g||["translation"],b=_.useMemo(()=>y,y);(it=(he=c==null?void 0:c.reportNamespaces)==null?void 0:he.addUsedNamespaces)==null||it.call(he,b);const v=_.useRef(0),S=_.useCallback(de=>{if(!c)return jS;const{bindI18n:W,bindI18nStore:Y}=u,ve=()=>{v.current+=1,de()};return W&&c.on(W,ve),Y&&c.store.on(Y,ve),()=>{W&&W.split(" ").forEach(H=>c.off(H,ve)),Y&&Y.split(" ").forEach(H=>c.store.off(H,ve))}},[c,u]),k=_.useRef(),C=_.useCallback(()=>{if(!c)return AS;const de=!!(c.isInitialized||c.initializedStoreOnce)&&b.every(ne=>hS(ne,c,u)),W=t.lng||c.language,Y=v.current,ve=k.current;if(ve&&ve.ready===de&&ve.lng===W&&ve.keyPrefix===m&&ve.revision===Y)return ve;const Q={t:c.getFixedT(W,u.nsMode==="fallback"?b:b[0],m,{scopeNs:b}),ready:de,lng:W,keyPrefix:m,revision:Y};return k.current=Q,Q},[c,b,m,u,t.lng]),[E,O]=_.useState(0),{t:j,ready:T}=NS.useSyncExternalStore(S,C,C);_.useEffect(()=>{if(c&&!T&&!f){const de=()=>O(W=>W+1);t.lng?Ig(c,t.lng,b,de):Vd(c,b,de)}},[c,t.lng,b,T,f,E]);const U=c||{},R=_.useRef(null),K=_.useRef(),Z=de=>{const W=Object.getOwnPropertyDescriptors(de);W.__original&&delete W.__original;const Y=Object.create(Object.getPrototypeOf(de),W);if(!Object.prototype.hasOwnProperty.call(Y,"__original"))try{Object.defineProperty(Y,"__original",{value:de,writable:!1,enumerable:!1,configurable:!1})}catch{}return Y},te=_.useMemo(()=>{const de=U,W=de==null?void 0:de.language;let Y=de;de&&(R.current&&R.current.__original===de?K.current!==W?(Y=Z(de),R.current=Y,K.current=W):Y=R.current:(Y=Z(de),R.current=Y,K.current=W));const ve=!T&&!f?(...Q)=>(qd(c,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),j(...Q)):j,H=[ve,Y,T];return H.t=ve,H.i18n=Y,H.ready=T,H},[j,U,T,U.resolvedLanguage,U.language,U.languages]);if(c&&f&&!T)throw new Promise(de=>{const W=()=>de();t.lng?Ig(c,t.lng,b,W):Vd(c,b,W)});return te},RS={};function OS(s,t){let a;try{a=s()}catch{return}return{getItem:o=>{var c;const u=m=>m===null?null:JSON.parse(m,void 0),f=(c=a.getItem(o))!=null?c:null;return f instanceof Promise?f.then(u):u(f)},setItem:(o,c)=>a.setItem(o,JSON.stringify(c,void 0)),removeItem:o=>a.removeItem(o)}}const al=s=>t=>{try{const a=s(t);return a instanceof Promise?a:{then(r){return al(r)(a)},catch(r){return this}}}catch(a){return{then(r){return this},catch(r){return al(r)(a)}}}},MS=(s,t)=>(a,r,o)=>{let c={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:E=>E,version:0,merge:(E,O)=>({...O,...E}),...t},u=!1;const f=new Set,m=new Set;let g;try{g=c.getStorage()}catch{}if(!g)return s((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),a(...E)},r,o);const y=al(c.serialize),b=()=>{const E=c.partialize({...r()});let O;const j=y({state:E,version:c.version}).then(T=>g.setItem(c.name,T)).catch(T=>{O=T});if(O)throw O;return j},v=o.setState;o.setState=(E,O)=>{v(E,O),b()};const S=s((...E)=>{a(...E),b()},r,o);let k;const C=()=>{var E;if(!g)return;u=!1,f.forEach(j=>j(r()));const O=((E=c.onRehydrateStorage)==null?void 0:E.call(c,r()))||void 0;return al(g.getItem.bind(g))(c.name).then(j=>{if(j)return c.deserialize(j)}).then(j=>{if(j)if(typeof j.version=="number"&&j.version!==c.version){if(c.migrate)return c.migrate(j.state,j.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return j.state}).then(j=>{var T;return k=c.merge(j,(T=r())!=null?T:S),a(k,!0),b()}).then(()=>{O==null||O(k,void 0),u=!0,m.forEach(j=>j(k))}).catch(j=>{O==null||O(void 0,j)})};return o.persist={setOptions:E=>{c={...c,...E},E.getStorage&&(g=E.getStorage())},clearStorage:()=>{g==null||g.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>C(),hasHydrated:()=>u,onHydrate:E=>(f.add(E),()=>{f.delete(E)}),onFinishHydration:E=>(m.add(E),()=>{m.delete(E)})},C(),k||S},BS=(s,t)=>(a,r,o)=>{let c={storage:OS(()=>localStorage),partialize:C=>C,version:0,merge:(C,E)=>({...E,...C}),...t},u=!1;const f=new Set,m=new Set;let g=c.storage;if(!g)return s((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),a(...C)},r,o);const y=()=>{const C=c.partialize({...r()});return g.setItem(c.name,{state:C,version:c.version})},b=o.setState;o.setState=(C,E)=>{b(C,E),y()};const v=s((...C)=>{a(...C),y()},r,o);o.getInitialState=()=>v;let S;const k=()=>{var C,E;if(!g)return;u=!1,f.forEach(j=>{var T;return j((T=r())!=null?T:v)});const O=((E=c.onRehydrateStorage)==null?void 0:E.call(c,(C=r())!=null?C:v))||void 0;return al(g.getItem.bind(g))(c.name).then(j=>{if(j)if(typeof j.version=="number"&&j.version!==c.version){if(c.migrate)return[!0,c.migrate(j.state,j.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,j.state];return[!1,void 0]}).then(j=>{var T;const[U,R]=j;if(S=c.merge(R,(T=r())!=null?T:v),a(S,!0),U)return y()}).then(()=>{O==null||O(S,void 0),S=r(),u=!0,m.forEach(j=>j(S))}).catch(j=>{O==null||O(void 0,j)})};return o.persist={setOptions:C=>{c={...c,...C},C.storage&&(g=C.storage)},clearStorage:()=>{g==null||g.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>k(),hasHydrated:()=>u,onHydrate:C=>(f.add(C),()=>{f.delete(C)}),onFinishHydration:C=>(m.add(C),()=>{m.delete(C)})},c.skipHydration||k(),S||v},DS=(s,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((RS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),MS(s,t)):BS(s,t),Na=DS;let Pg=!1;function Wn(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():(Pg||(Pg=!0,console.warn("[uuid] crypto.randomUUID unavailable (non-secure context) — using Math.random fallback")),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const t=Math.random()*16|0;return(s==="x"?t:t&3|8).toString(16)}))}const LS=4e3,Ys=Ut(s=>({toasts:[],addToast:(t,a,r)=>{const o=`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,c={id:o,type:t,message:a,duration:r??LS,createdAt:Date.now()};s(u=>({toasts:[...u.toasts.slice(-9),c]})),c.duration>0&&setTimeout(()=>{s(u=>({toasts:u.toasts.filter(f=>f.id!==o)}))},c.duration)},dismissToast:t=>s(a=>({toasts:a.toasts.filter(r=>r.id!==t)})),clearAll:()=>s({toasts:[]})})),ke={info:(s,t)=>Ys.getState().addToast("info",s,t),success:(s,t)=>Ys.getState().addToast("success",s,t),warning:(s,t)=>Ys.getState().addToast("warning",s,t),error:(s,t)=>Ys.getState().addToast("error",s,t??6e3)},vi=24;function Kd(s){if(s.preview){const o=String(s.preview).replace(/\s+/g," ").trim();return o.length>vi?o.slice(0,vi)+"…":o}const t=je.getState().getMessages(s.id);if(!t||t.length===0)return"";const a=t.find(o=>o.type==="user"&&!o.deleted)||t.find(o=>!o.deleted)||t[0],r=String((a==null?void 0:a.content)||"").replace(/\s+/g," ").trim();return r?r.length>vi?r.slice(0,vi)+"…":r:""}function rb(s,t){if(!t)return!1;const a=s.replace(/\s+/g," ").replace(/\.\.\.$/,"");return a?!t.startsWith(a):!0}const zS=3e4;function Sf(s){let t=0;function a(u,f){try{return localStorage.setItem(u,JSON.stringify(f)),t=0,!0}catch{return!1}}return{getItem:u=>{const f=localStorage.getItem(u);if(!f)return null;try{const m=JSON.parse(f);return m&&typeof m=="object"&&"state"in m?m:{state:m,version:0}}catch{return null}},setItem:(u,f)=>{var y;if(a(u,f))return;let m=f;for(const b of s.trims??[]){try{m=b(m)}catch{continue}if(a(u,m))return}const g=Date.now();if(g-t>zS){t=g;const b=new Error(`localStorage 配额已满或不可用(${s.key}),已降级为仅内存持久化,刷新页面将丢失部分历史。`);console.warn(`[${s.key}] 持久化失败:`,b);try{(y=s.onFailure)==null||y.call(s,b)}catch{}}},removeItem:u=>{try{localStorage.removeItem(u)}catch{}}}}const Yd=6,Uo=50,Gg=60;let US=0;const HS=100,Mr=2e3,Br=(s,t)=>s&&(s.length>t?`${s.slice(0,t)}…`:s),lb=s=>{const{logs:t,...a}=s;return{...a,description:Br(a.description,Mr),result:Br(a.result,Mr),error:Br(a.error,Mr),stepPrompt:Br(a.stepPrompt,Mr),context:a.context?Object.fromEntries(Object.entries(a.context).map(([r,o])=>[r,Br(o,Mr)??""])):void 0,children:a.children?a.children.map(lb):void 0}},vd=s=>[...s].sort((t,a)=>(a.lastActiveAt??a.createdAt??0)-(t.lastActiveAt??t.createdAt??0)),we=Ut()(Na((s,t)=>({sessions:[],activeSessionId:null,sessionTabs:[],layout:"single",sessionWorkspaceDirs:{},tasksBySession:{},historySessions:[],addSession:a=>s(r=>({sessions:[a,...r.sessions].slice(0,Gg),activeSessionId:a.id})),removeSession:a=>s(r=>{var o;return{sessions:r.sessions.filter(c=>c.id!==a),activeSessionId:r.activeSessionId===a?((o=r.sessions[0])==null?void 0:o.id)||null:r.activeSessionId}}),updateSession:(a,r)=>s(o=>({sessions:o.sessions.map(c=>c.id===a?{...c,...r}:c)})),setActiveSession:a=>s({activeSessionId:a}),setSessionWorkspaceDir:(a,r)=>s(o=>({sessionWorkspaceDirs:{...o.sessionWorkspaceDirs,[a]:r}})),getSessionWorkspaceDir:a=>t().sessionWorkspaceDirs[a]||"",addSessionTab:(a,r)=>{const o=t();if(o.sessionTabs.length>=Yd){const v=o.sessionTabs.reduce((S,k)=>S.createdAt<k.createdAt?S:k);t().closeSessionTab(v.id)}const c=`session-${Date.now()}-${++US}`,u=r&&r.split(/[\\/]/).filter(Boolean).pop()||void 0,f={id:c,title:a||`对话 ${o.sessionTabs.length+1}`,createdAt:Date.now(),lastActiveAt:Date.now(),project:u,status:"done"},m={id:c,title:a||`对话 ${o.sessionTabs.length+1}`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0},g={...o.sessionWorkspaceDirs};r&&(g[c]=r);const y={...o.tasksBySession};y[c]||(y[c]=[]);const b=[f,...o.historySessions.filter(v=>v.id!==c)].slice(0,Uo);return s({sessionTabs:vd([f,...o.sessionTabs]),sessions:[...o.sessions,m].slice(-Gg),sessionWorkspaceDirs:g,tasksBySession:y,activeSessionId:c,historySessions:b}),c},closeSessionTab:a=>{var m;const r=t(),o=r.sessionTabs.find(g=>g.id===a),c=r.sessionTabs.filter(g=>g.id!==a);if(c.length===0)return;let u=r.historySessions;o&&(u=[o,...u.filter(g=>g.id!==a)].slice(0,Uo));const f=c[c.length-1];s({sessionTabs:c,historySessions:u,activeSessionId:r.activeSessionId===a?f?f.id:((m=c[0])==null?void 0:m.id)||null:r.activeSessionId})},renameSessionTab:(a,r)=>s(o=>({sessionTabs:o.sessionTabs.map(c=>c.id===a?{...c,title:r}:c),sessions:o.sessions.map(c=>c.id===a?{...c,title:r,updatedAt:new Date().toISOString()}:c),historySessions:o.historySessions.map(c=>c.id===a?{...c,title:r}:c)})),getActiveSessionTab:()=>{const a=t();return a.sessionTabs.find(r=>r.id===a.activeSessionId)||null},getVisibleSessionTabs:()=>{const a=t(),r=a.sessionTabs.find(o=>o.id===a.activeSessionId);return r?[r]:a.sessionTabs.slice(0,1)},addSessionTask:(a,r,o,c)=>s(u=>{const f=u.tasksBySession[a]||[],m={id:`session-task-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,title:r.trim(),completed:!1,createdAt:Date.now(),backendId:o,description:c};return{tasksBySession:{...u.tasksBySession,[a]:[...f,m]}}}),toggleSessionTask:(a,r)=>s(o=>{const c=o.tasksBySession[a]||[];return{tasksBySession:{...o.tasksBySession,[a]:c.map(u=>u.id===r?{...u,completed:!u.completed}:u)}}}),removeSessionTask:(a,r)=>s(o=>({tasksBySession:{...o.tasksBySession,[a]:(o.tasksBySession[a]||[]).filter(c=>c.id!==r)}})),updateSessionTask:(a,r,o)=>s(c=>{const u=c.tasksBySession[a]||[];return{tasksBySession:{...c.tasksBySession,[a]:u.map(f=>f.id===r?{...f,title:o.trim()}:f)}}}),getSessionTasks:a=>t().tasksBySession[a]||[],setSessionTasks:(a,r)=>s(o=>({tasksBySession:{...o.tasksBySession,[a]:r}})),updateTaskPlanStatus:(a,r,o)=>s(c=>{const u=c.tasksBySession[a]||[];return{tasksBySession:{...c.tasksBySession,[a]:u.map(f=>f.id===r?{...f,...o}:f)}}}),autoNameSession:(a,r)=>{const c=t().sessionTabs.find(m=>m.id===a);if(!c||!/^对话 \d+$/.test(c.title))return;const u=r.replace(/\s+/g," ").trim(),f=u.slice(0,20)+(u.length>20?"...":"");f&&t().renameSessionTab(a,f)},updateSessionStatus:(a,r)=>s(o=>({sessionTabs:o.sessionTabs.map(c=>c.id===a?{...c,status:r}:c)})),touchSession:(a,r)=>s(o=>{const c=Date.now();let u;if(r){const m=r.replace(/\s+/g," ").trim();u=m.length>vi?m.slice(0,vi)+"…":m}const f=m=>({...m,lastActiveAt:c,...u&&!m.preview?{preview:u}:{}});return{sessionTabs:vd(o.sessionTabs.map(m=>m.id===a?f(m):m)),sessions:o.sessions.map(m=>m.id===a?{...m,updatedAt:new Date(c).toISOString()}:m),historySessions:o.historySessions.map(m=>m.id===a?f(m):m)}}),getHistorySessions:()=>t().historySessions,restoreHistorySession:a=>{const r=t(),o=r.historySessions.find(f=>f.id===a);if(!o)return;const c=r.historySessions.filter(f=>f.id!==a);if(r.sessionTabs.some(f=>f.id===a)){s({historySessions:c,activeSessionId:a});return}let u=r.sessionTabs;if(u.length>=Yd){const f=u.reduce((m,g)=>m.createdAt<g.createdAt?m:g);u=u.filter(m=>m.id!==f.id),c.unshift(f)}s({sessionTabs:vd([o,...u]),historySessions:c.slice(0,Uo),activeSessionId:a})},clearHistorySessions:()=>s({historySessions:[]}),removeHistorySession:a=>s(r=>({historySessions:r.historySessions.filter(o=>o.id!==a)}))}),{name:"deepseekcode-session-storage",storage:Sf({key:"sessionStore",trims:[s=>({...s,state:{...s.state,tasksBySession:Object.fromEntries(Object.entries(s.state.tasksBySession).map(([t,a])=>[t,a.map(r=>({id:r.id,title:r.title,completed:r.completed,createdAt:r.createdAt,planStatus:r.planStatus,backendId:r.backendId,backendStatus:r.backendStatus,agentType:r.agentType,progress:r.progress}))]))}}),s=>{const t=new Set([...s.state.sessionTabs.map(a=>a.id),...s.state.historySessions.map(a=>a.id)]);return s.state.activeSessionId&&t.add(s.state.activeSessionId),{...s,state:{...s.state,tasksBySession:Object.fromEntries(Object.entries(s.state.tasksBySession).filter(([a])=>t.has(a)))}}},s=>({...s,state:{...s.state,tasksBySession:{}}})],onFailure:()=>{try{Ys.getState().addToast("warning","会话数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失,建议清理旧会话或导出数据。",8e3)}catch{}}}),partialize:s=>{const t=new Set;for(const o of s.sessionTabs)t.add(o.id);for(const o of s.historySessions)t.add(o.id);s.activeSessionId&&t.add(s.activeSessionId);const a=s.sessions.filter(o=>t.has(o.id)),r={};for(const[o,c]of Object.entries(s.tasksBySession))t.has(o)&&(r[o]=c.slice(0,HS).map(lb));return{sessions:a,sessionTabs:s.sessionTabs,activeSessionId:s.activeSessionId,layout:s.layout,sessionWorkspaceDirs:s.sessionWorkspaceDirs,tasksBySession:r,historySessions:s.historySessions}}})),$S="deepseekcode-chat-store",IS=500,PS=3e4,GS=2e4,qo=4e3;let qn=null,Sd=0,Yr=null;const Zr=(s,t)=>!s||s.length<=t?s:s.slice(0,t)+"…",Fg=s=>({...s,args:typeof s.args=="string"?Zr(s.args,qo)??s.args:s.args,result:typeof s.result=="string"?Zr(s.result,qo)??s.result:s.result}),FS=s=>{const t={...s,thinkingBlocks:void 0,content:Zr(s.content,GS)??s.content};return s.steps&&(t.steps=s.steps.map(a=>{var r;return{...a,thought:Zr(a.thought,qo),result:Zr(a.result,qo),toolCalls:(r=a.toolCalls)==null?void 0:r.map(Fg)}})),s.toolCalls&&(t.toolCalls=s.toolCalls.map(Fg)),t},qS=[s=>{const t=we.getState(),a=new Set;for(const o of t.sessionTabs)a.add(o.id);for(const o of t.historySessions)a.add(o.id);t.activeSessionId&&a.add(t.activeSessionId);const r={};for(const[o,c]of Object.entries(s.state.messagesBySession||{}))a.has(o)&&Array.isArray(c)&&c.length>0&&(r[o]=c);return{...s,state:{...s.state,messagesBySession:r}}},s=>{const t={};for(const[a,r]of Object.entries(s.state.messagesBySession||{}))t[a]=(Array.isArray(r)?r:[]).slice(-60).map(FS);return{...s,state:{...s.state,messagesBySession:t}}},s=>{const t=we.getState().activeSessionId||"",a=(s.state.messagesBySession||{})[t]||[],r=(Array.isArray(a)?a:[]).slice(-30).map(o=>({id:o.id,type:o.type,content:o.content,timestamp:o.timestamp,...o.thinking?{thinking:o.thinking}:{}}));return{...s,state:{...s.state,messagesBySession:t?{[t]:r}:{}}}}];function ob(s,t){const a=c=>{try{return localStorage.setItem(s,JSON.stringify(c)),Sd=0,!0}catch{return!1}};if(a(t))return;let r=t;for(const c of qS){try{r=c(r)}catch{continue}if(a(r))return}const o=Date.now();if(o-Sd>PS){Sd=o,console.error("[chatStore] localStorage 持久化失败,刷新页面将丢失历史消息:",new Error("quota exceeded or storage unavailable"));try{Ys.getState().addToast("warning","聊天记录保存失败:浏览器本地存储已满或不可用。刷新页面将丢失历史消息,建议导出会话或清理旧会话。",8e3)}catch{}}}function VS(){qn&&(clearTimeout(qn),qn=null);const s=Yr;Yr=null,s&&ob(s.name,s.value)}const WS={getItem:s=>{const t=localStorage.getItem(s);if(!t)return null;try{const a=JSON.parse(t);return a&&typeof a=="object"&&"state"in a?a:{state:a,version:0}}catch{return null}},setItem:(s,t)=>{Yr={name:s,value:t},qn&&clearTimeout(qn),qn=setTimeout(()=>{qn=null,Yr=null,ob(s,t)},IS)},removeItem:s=>{Yr=null,qn&&(clearTimeout(qn),qn=null);try{localStorage.removeItem(s)}catch{}}};if(typeof window<"u"){const s=()=>VS();window.addEventListener("pagehide",s),window.addEventListener("beforeunload",s)}function qg(s,t,a){const r=s.thinkingBlocks?s.thinkingBlocks.map(o=>({...o})):s.thinking?[{index:Number.MIN_SAFE_INTEGER,text:s.thinking}]:[];if(typeof a=="number"){const o=r.find(c=>c.index===a);o?o.text+=t:r.push({index:a,text:t})}else if(r.length>0){const o=r.length-1,c=r[o];c?r[o]={...c,text:c.text+t}:r.push({index:0,text:t})}else r.push({index:0,text:t});return r.sort((o,c)=>o.index-c.index),{...s,thinkingBlocks:r,thinking:r.map(o=>o.text).join("")}}const je=Ut()(Na((s,t)=>({messagesBySession:{},generatingSessions:[],pausedSessions:[],sessionInputs:{},getMessages:a=>t().messagesBySession[a]||[],replaceMessages:(a,r)=>s(o=>({messagesBySession:{...o.messagesBySession,[a]:r.slice(-200)}})),addMessage:(a,r)=>s(o=>{const u=[...o.messagesBySession[a]||[],r].slice(-200);return{messagesBySession:{...o.messagesBySession,[a]:u}}}),updateLastMessage:(a,r)=>s(o=>{const c=(o.messagesBySession[a]||[]).map((u,f,m)=>f===m.length-1&&u.type==="assistant"?{...u,content:r}:u);return{messagesBySession:{...o.messagesBySession,[a]:c}}}),appendToLastMessage:(a,r)=>s(o=>{const c=o.messagesBySession[a];if(!c||c.length===0)return o;const u=c.length-1,f=c[u];if(f&&f.type==="assistant"){const m=c.slice();return m[u]={...f,content:f.content+r},{messagesBySession:{...o.messagesBySession,[a]:m}}}return{messagesBySession:{...o.messagesBySession,[a]:[...c,{id:Wn(),type:"assistant",content:r,timestamp:Date.now()}].slice(-200)}}}),setThinking:(a,r)=>s(o=>{const c=(o.messagesBySession[a]||[]).map((u,f,m)=>{var y;if(f!==m.length-1||u.type!=="assistant")return u;const g=(y=u.steps)==null?void 0:y.findIndex(b=>b.status==="running");if(g!==void 0&&g!==-1&&u.steps&&u.steps[g]){const b=u.steps.map((v,S)=>S===g?{...v,thought:r}:v);return{...u,steps:b}}return{...u,thinking:r,thinkingBlocks:r?[{index:0,text:r}]:[]}});return{messagesBySession:{...o.messagesBySession,[a]:c}}}),appendToLastMessageThinking:(a,r,o)=>s(c=>{var v,S;const u=c.messagesBySession[a];if(!u||u.length===0)return c;const f=u.length-1,m=u[f];if(!m||m.type!=="assistant")return{messagesBySession:{...c.messagesBySession,[a]:[...u,qg({id:Wn(),type:"assistant",content:"",timestamp:Date.now()},r,o)].slice(-200)}};let g;const y=(v=m.steps)==null?void 0:v.findIndex(k=>k.status==="running");if(y!==void 0&&y!==-1&&((S=m.steps)!=null&&S[y])){const k=m.steps.slice(),C=k[y];k[y]={...C,thought:(C.thought||"")+r},g={...m,steps:k}}else if(m.steps&&m.steps.length>0){const k=m.steps.length-1,C=m.steps.slice(),E=C[k];C[k]={...E,thought:(E.thought||"")+r},g={...m,steps:C}}else g=qg(m,r,o);const b=u.slice();return b[f]=g,{messagesBySession:{...c.messagesBySession,[a]:b}}}),addStep:(a,r)=>s(o=>{const c=(o.messagesBySession[a]||[]).map((u,f,m)=>{var v,S;if(f!==m.length-1||u.type!=="assistant")return u;const g=(v=u.toolCalls)==null?void 0:v.filter(k=>{var C;return!((C=u.steps)!=null&&C.some(E=>{var O;return(O=E.toolCalls)==null?void 0:O.some(j=>j.id===k.id)}))}),y={...r};g!=null&&g.length&&(y.toolCalls=[...y.toolCalls||[],...g]);let b=u.thinking||"";return b.trim().length>0&&(y.thought=(y.thought||"")+b,b=""),{...u,thinking:b,thinkingBlocks:[],toolCalls:g!=null&&g.length?(S=u.toolCalls)==null?void 0:S.filter(k=>!g.some(C=>C.id===k.id)):u.toolCalls,steps:[...u.steps||[],y]}});return{messagesBySession:{...o.messagesBySession,[a]:c}}}),updateStep:(a,r,o)=>s(c=>{const u=(c.messagesBySession[a]||[]).map((f,m,g)=>{if(m!==g.length-1||!f.steps)return f;const y=f.steps.findIndex(v=>v.id===r);if(y===-1)return f;const b=f.steps.map((v,S)=>S===y?{...v,...o}:v);return{...f,steps:b}});return{messagesBySession:{...c.messagesBySession,[a]:u}}}),addToolCall:(a,r)=>s(o=>{const c=(o.messagesBySession[a]||[]).map((u,f,m)=>{var y;if(f!==m.length-1||u.type!=="assistant")return u;const g=(y=u.steps)==null?void 0:y.findIndex(b=>b.status==="running");if(g!==void 0&&g!==-1&&u.steps&&u.steps[g]){const b=u.steps.map((v,S)=>S===g?{...v,toolCalls:[...v.toolCalls||[],r]}:v);return{...u,steps:b}}if(u.steps&&u.steps.length>0){const b=u.steps.length-1,v=u.steps.map((S,k)=>k===b?{...S,toolCalls:[...S.toolCalls||[],r]}:S);return{...u,steps:v}}return{...u,toolCalls:[...u.toolCalls||[],r]}});return{messagesBySession:{...o.messagesBySession,[a]:c}}}),updateToolCall:(a,r,o)=>s(c=>{const u=m=>{if(!m)return null;const g=m.findIndex(y=>y.id===r);return g===-1?null:m.map((y,b)=>b===g?{...y,...o}:y)},f=(c.messagesBySession[a]||[]).map((m,g,y)=>{var S,k;if(g!==y.length-1||m.type!=="assistant")return m;const b=(S=m.steps)==null?void 0:S.findIndex(C=>C.status==="running");if(b!==void 0&&b!==-1&&m.steps&&m.steps[b]){const C=u((k=m.steps[b])==null?void 0:k.toolCalls);if(C){const E=m.steps.map((O,j)=>j===b?{...O,toolCalls:C}:O);return{...m,steps:E}}}if(m.steps){let C=!1;const E=m.steps.map(O=>{if(C)return O;const j=u(O.toolCalls);return j?(C=!0,{...O,toolCalls:j}):O});if(C)return{...m,steps:E}}const v=u(m.toolCalls);return v?{...m,toolCalls:v}:m});return{messagesBySession:{...c.messagesBySession,[a]:f}}}),appendToLastToolCallArgs:(a,r,o,c)=>s(u=>{const f=y=>{let b=y.args;if(typeof b=="string")b=b+o;else if(typeof b=="object"&&b!==null){const v=o.trim();if(v.startsWith("{")&&v.endsWith("}"))try{const S=JSON.parse(v);typeof b=="string"?b={...S}:b={...b,...S}}catch{b=JSON.stringify(b).slice(0,-1)+","+v.slice(1)}else typeof b=="string"?b=b+v:b=JSON.stringify(b)+v}else b=o;return{...y,args:b}},m=y=>{if(!y)return null;const b=y.findIndex(v=>c!==void 0&&v.index===c||v.id===r);return b===-1?null:y.map((v,S)=>S===b?f(v):v)},g=(u.messagesBySession[a]||[]).map((y,b,v)=>{var C,E;if(b!==v.length-1||y.type!=="assistant")return y;const S=(C=y.steps)==null?void 0:C.findIndex(O=>O.status==="running");if(S!==void 0&&S!==-1&&y.steps&&y.steps[S]){const O=m((E=y.steps[S])==null?void 0:E.toolCalls);if(O){const j=y.steps.map((T,U)=>U===S?{...T,toolCalls:O}:T);return{...y,steps:j}}}if(y.steps){let O=!1;const j=y.steps.map(T=>{if(O)return T;const U=m(T.toolCalls);return U?(O=!0,{...T,toolCalls:U}):T});if(O)return{...y,steps:j}}const k=m(y.toolCalls);return k?{...y,toolCalls:k}:y});return{messagesBySession:{...u.messagesBySession,[a]:g}}}),startGeneration:a=>s(r=>({generatingSessions:r.generatingSessions.includes(a)?r.generatingSessions:[...r.generatingSessions,a]})),endGeneration:(a,r)=>s(o=>{var g,y,b;const c=o.messagesBySession[a]||[],u=Date.now(),f=c.map(v=>{var E,O;let S=!1;const k=(E=v.steps)==null?void 0:E.map(j=>{if(!j.toolCalls)return j;const T=j.toolCalls.map(U=>U.status!=="running"?U:(S=!0,{...U,status:"error",result:"生成已结束(工具执行超时或连接中断)",duration:Math.floor((u-(U.timestamp||u))/1e3)}));return T!==j.toolCalls?{...j,toolCalls:T}:j}),C=(O=v.toolCalls)==null?void 0:O.map(j=>j.status!=="running"?j:(S=!0,{...j,status:"error",result:"生成已结束(工具执行超时或连接中断)",duration:Math.floor((u-(j.timestamp||u))/1e3)}));return S?{...v,steps:k,toolCalls:C}:v}),m=f[f.length-1];if(m&&m.type==="assistant"&&!m.content&&!m.thinking&&!((g=m.thinkingBlocks)!=null&&g.length)&&!((y=m.steps)!=null&&y.length)&&!((b=m.toolCalls)!=null&&b.length)&&!m.hookApproval){const{[a]:v,...S}=o.messagesBySession;return{generatingSessions:o.generatingSessions.filter(k=>k!==a),pausedSessions:o.pausedSessions.filter(k=>k!==a),messagesBySession:{...S,[a]:f.slice(0,-1)}}}return{generatingSessions:o.generatingSessions.filter(v=>v!==a),pausedSessions:o.pausedSessions.filter(v=>v!==a),messagesBySession:{...o.messagesBySession,[a]:f}}}),pauseGeneration:a=>s(r=>({pausedSessions:r.pausedSessions.includes(a)?r.pausedSessions:[...r.pausedSessions,a]})),resumeGeneration:a=>s(r=>({pausedSessions:r.pausedSessions.filter(o=>o!==a)})),clearMessages:a=>s(r=>{const{[a]:o,...c}=r.messagesBySession;return{messagesBySession:c}}),removeSession:a=>s(r=>{const{[a]:o,...c}=r.messagesBySession,{[a]:u,...f}=r.sessionInputs;return{messagesBySession:c,sessionInputs:f,generatingSessions:r.generatingSessions.filter(m=>m!==a)}}),setSessionInput:(a,r)=>s(o=>({sessionInputs:{...o.sessionInputs,[a]:r}})),getSessionInput:a=>t().sessionInputs[a]||"",attachHookApproval:(a,r)=>s(o=>{const c=o.messagesBySession[a]||[];if(c.length===0){const g={id:`hook-approval-${r.approvalId||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:r};return{messagesBySession:{...o.messagesBySession,[a]:[g]}}}const u=c.length-1,f=c[u];if(f&&f.type==="assistant"){const g=c.slice();return g[u]={...f,hookApproval:r},{messagesBySession:{...o.messagesBySession,[a]:g}}}const m={id:`hook-approval-${r.approvalId||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:r};return{messagesBySession:{...o.messagesBySession,[a]:[...c,m].slice(-200)}}}),updateHookApprovalStatus:(a,r,o)=>s(c=>{const u=c.messagesBySession[a];if(!u)return c;const f=u.map(m=>{var g;return((g=m.hookApproval)==null?void 0:g.approvalId)===r?{...m,hookApproval:{...m.hookApproval,status:o}}:m});return{messagesBySession:{...c.messagesBySession,[a]:f}}}),setMessageFileJob:(a,r)=>s(o=>{const c=o.messagesBySession[a]||[];if(c.length===0){const g={id:`filejob-${r.jobId}`,type:"assistant",content:"",timestamp:Date.now(),fileJob:r};return{messagesBySession:{...o.messagesBySession,[a]:[g]}}}const u=c.length-1,f=c[u];if(f&&f.type==="assistant"){const g=c.slice();return g[u]={...f,fileJob:f.fileJob?{...f.fileJob,...r,attachments:r.attachments??f.fileJob.attachments,jobId:f.fileJob.jobId,updatedAt:Date.now()}:{...r,updatedAt:Date.now()}},{messagesBySession:{...o.messagesBySession,[a]:g}}}const m={id:`filejob-${r.jobId}`,type:"assistant",content:"",timestamp:Date.now(),fileJob:r};return{messagesBySession:{...o.messagesBySession,[a]:[...c,m].slice(-200)}}}),attachErrorCard:(a,r)=>s(o=>{const c=o.messagesBySession[a];if(!c||c.length===0)return o;const u=c.length-1,f=c[u];if(f&&f.type==="assistant"){const m=c.slice();return m[u]={...f,errorCard:r},{messagesBySession:{...o.messagesBySession,[a]:m}}}return o}),setTurnSummary:(a,r)=>s(o=>{const c=o.messagesBySession[a];if(!c||c.length===0)return o;const u=c.length-1,f=c[u];if(!f||f.type!=="assistant")return o;const m=c.slice();return m[u]={...f,summary:r},{messagesBySession:{...o.messagesBySession,[a]:m}}}),applyTombstone:(a,r)=>s(o=>{const c=o.messagesBySession[a];if(!c||c.length===0)return o;const u=new Set(r),f=c.map(m=>u.has(m.id)?{...m,deleted:!0}:m);return{messagesBySession:{...o.messagesBySession,[a]:f}}}),isGenerating:a=>t().generatingSessions.includes(a),isPaused:a=>t().pausedSessions.includes(a)}),{name:$S,storage:WS,partialize:s=>({messagesBySession:s.messagesBySession,sessionInputs:s.sessionInputs})})),KS=Ut(s=>({isOpen:!1,status:"idle",port:null,wsUrl:null,errorMessage:null,openTerminal:()=>s({isOpen:!0}),closeTerminal:()=>s({isOpen:!1}),toggleTerminal:()=>s(t=>({isOpen:!t.isOpen})),setStarting:()=>s({status:"starting",errorMessage:null}),setRunning:(t,a)=>s({status:"running",port:t,wsUrl:a}),setStopping:()=>s({status:"stopping"}),setIdle:()=>s({status:"idle",port:null,wsUrl:null,errorMessage:null}),setError:t=>s({status:"error",errorMessage:t})})),Vg={bg:"#0d1117",surface:"#161b22",border:"#30363d",text:"#c9d1d9",muted:"#8b949e",accentBlue:"#58a6ff",accentGreen:"#238636",accentRed:"#f85149",accentYellow:"#d29922",accentPurple:"#a855f7"},CE=["off","low","medium","high","extra_high","max"],YS=8,Ei=Ut()(Na(s=>({theme:"light",themePresetId:"linear",language:"zh-CN",fontSize:14,streamingEnabled:!0,workspaceDir:"",recentDirs:[],effort:"medium",customTheme:Vg,customThemeEnabled:!1,setTheme:t=>s({theme:t}),setThemePreset:t=>s({themePresetId:t,customThemeEnabled:!1}),setLanguage:t=>s({language:t}),setFontSize:t=>s({fontSize:t}),setStreamingEnabled:t=>s({streamingEnabled:t}),setCustomTheme:t=>s(a=>({customTheme:{...a.customTheme,...t}})),setCustomThemeEnabled:t=>s({customThemeEnabled:t}),resetCustomTheme:()=>s({customTheme:Vg}),setWorkspaceDir:t=>s(a=>{const r=t.trim();if(!r)return{workspaceDir:""};const o=[r,...a.recentDirs.filter(c=>c!==r)].slice(0,YS);return{workspaceDir:r,recentDirs:o}}),setEffort:t=>s({effort:t})}),{name:"deepseekcode-settings-storage",version:4,migrate:(s,t)=>{const a=s;return t<2&&a&&typeof a=="object"&&((a.themePresetId==="github"||a.themePresetId==="mimo")&&(a.themePresetId="linear"),a.theme==="dark"&&(a.theme="light")),t<3&&a&&typeof a=="object"&&(a.recentDirs=Array.isArray(a.recentDirs)?a.recentDirs:[]),t<4&&a&&typeof a=="object"&&(delete a.yolo,delete a.autoSwarm,delete a.workspaceGuardBypass),a}}));var Ye;(function(s){s.assertEqual=o=>{};function t(o){}s.assertIs=t;function a(o){throw new Error}s.assertNever=a,s.arrayToEnum=o=>{const c={};for(const u of o)c[u]=u;return c},s.getValidEnumValues=o=>{const c=s.objectKeys(o).filter(f=>typeof o[o[f]]!="number"),u={};for(const f of c)u[f]=o[f];return s.objectValues(u)},s.objectValues=o=>s.objectKeys(o).map(function(c){return o[c]}),s.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const c=[];for(const u in o)Object.prototype.hasOwnProperty.call(o,u)&&c.push(u);return c},s.find=(o,c)=>{for(const u of o)if(c(u))return u},s.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,c=" | "){return o.map(u=>typeof u=="string"?`'${u}'`:u).join(c)}s.joinValues=r,s.jsonStringifyReplacer=(o,c)=>typeof c=="bigint"?c.toString():c})(Ye||(Ye={}));var Wg;(function(s){s.mergeShapes=(t,a)=>({...t,...a})})(Wg||(Wg={}));const oe=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ks=s=>{switch(typeof s){case"undefined":return oe.undefined;case"string":return oe.string;case"number":return Number.isNaN(s)?oe.nan:oe.number;case"boolean":return oe.boolean;case"function":return oe.function;case"bigint":return oe.bigint;case"symbol":return oe.symbol;case"object":return Array.isArray(s)?oe.array:s===null?oe.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?oe.promise:typeof Map<"u"&&s instanceof Map?oe.map:typeof Set<"u"&&s instanceof Set?oe.set:typeof Date<"u"&&s instanceof Date?oe.date:oe.object;default:return oe.unknown}},J=Ye.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 xs extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=t}format(t){const a=t||function(c){return c.message},r={_errors:[]},o=c=>{for(const u of c.issues)if(u.code==="invalid_union")u.unionErrors.map(o);else if(u.code==="invalid_return_type")o(u.returnTypeError);else if(u.code==="invalid_arguments")o(u.argumentsError);else if(u.path.length===0)r._errors.push(a(u));else{let f=r,m=0;for(;m<u.path.length;){const g=u.path[m];m===u.path.length-1?(f[g]=f[g]||{_errors:[]},f[g]._errors.push(a(u))):f[g]=f[g]||{_errors:[]},f=f[g],m++}}};return o(this),r}static assert(t){if(!(t instanceof xs))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=a=>a.message){const a={},r=[];for(const o of this.issues)if(o.path.length>0){const c=o.path[0];a[c]=a[c]||[],a[c].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}xs.create=s=>new xs(s);const Zd=(s,t)=>{let a;switch(s.code){case J.invalid_type:s.received===oe.undefined?a="Required":a=`Expected ${s.expected}, received ${s.received}`;break;case J.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(s.expected,Ye.jsonStringifyReplacer)}`;break;case J.unrecognized_keys:a=`Unrecognized key(s) in object: ${Ye.joinValues(s.keys,", ")}`;break;case J.invalid_union:a="Invalid input";break;case J.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${Ye.joinValues(s.options)}`;break;case J.invalid_enum_value:a=`Invalid enum value. Expected ${Ye.joinValues(s.options)}, received '${s.received}'`;break;case J.invalid_arguments:a="Invalid function arguments";break;case J.invalid_return_type:a="Invalid function return type";break;case J.invalid_date:a="Invalid date";break;case J.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(a=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?a=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?a=`Invalid input: must end with "${s.validation.endsWith}"`:Ye.assertNever(s.validation):s.validation!=="regex"?a=`Invalid ${s.validation}`:a="Invalid";break;case J.too_small:s.type==="array"?a=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?a=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?a=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?a=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?a=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:a="Invalid input";break;case J.too_big:s.type==="array"?a=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?a=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?a=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?a=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?a=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:a="Invalid input";break;case J.custom:a="Invalid input";break;case J.invalid_intersection_types:a="Intersection results could not be merged";break;case J.not_multiple_of:a=`Number must be a multiple of ${s.multipleOf}`;break;case J.not_finite:a="Number must be finite";break;default:a=t.defaultError,Ye.assertNever(s)}return{message:a}};let ZS=Zd;function QS(){return ZS}const XS=s=>{const{data:t,path:a,errorMaps:r,issueData:o}=s,c=[...a,...o.path||[]],u={...o,path:c};if(o.message!==void 0)return{...o,path:c,message:o.message};let f="";const m=r.filter(g=>!!g).slice().reverse();for(const g of m)f=g(u,{data:t,defaultError:f}).message;return{...o,path:c,message:f}};function ie(s,t){const a=QS(),r=XS({issueData:t,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,a,a===Zd?void 0:Zd].filter(o=>!!o)});s.common.issues.push(r)}class cn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,a){const r=[];for(const o of a){if(o.status==="aborted")return _e;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,a){const r=[];for(const o of a){const c=await o.key,u=await o.value;r.push({key:c,value:u})}return cn.mergeObjectSync(t,r)}static mergeObjectSync(t,a){const r={};for(const o of a){const{key:c,value:u}=o;if(c.status==="aborted"||u.status==="aborted")return _e;c.status==="dirty"&&t.dirty(),u.status==="dirty"&&t.dirty(),c.value!=="__proto__"&&(typeof u.value<"u"||o.alwaysSet)&&(r[c.value]=u.value)}return{status:t.value,value:r}}}const _e=Object.freeze({status:"aborted"}),Fr=s=>({status:"dirty",value:s}),An=s=>({status:"valid",value:s}),Kg=s=>s.status==="aborted",Yg=s=>s.status==="dirty",Ni=s=>s.status==="valid",Vo=s=>typeof Promise<"u"&&s instanceof Promise;var ue;(function(s){s.errToObj=t=>typeof t=="string"?{message:t}:t||{},s.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ue||(ue={}));class Js{constructor(t,a,r,o){this._cachedPath=[],this.parent=t,this.data=a,this._path=r,this._key=o}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 Zg=(s,t)=>{if(Ni(t))return{success:!0,data:t.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new xs(s.common.issues);return this._error=a,this._error}}};function Me(s){if(!s)return{};const{errorMap:t,invalid_type_error:a,required_error:r,description:o}=s;if(t&&(a||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(u,f)=>{const{message:m}=s;return u.code==="invalid_enum_value"?{message:m??f.defaultError}:typeof f.data>"u"?{message:m??r??f.defaultError}:u.code!=="invalid_type"?{message:f.defaultError}:{message:m??a??f.defaultError}},description:o}}class Ve{get description(){return this._def.description}_getType(t){return Ks(t.data)}_getOrReturnCtx(t,a){return a||{common:t.parent.common,data:t.data,parsedType:Ks(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new cn,ctx:{common:t.parent.common,data:t.data,parsedType:Ks(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const a=this._parse(t);if(Vo(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(t){const a=this._parse(t);return Promise.resolve(a)}parse(t,a){const r=this.safeParse(t,a);if(r.success)return r.data;throw r.error}safeParse(t,a){const r={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ks(t)},o=this._parseSync({data:t,path:r.path,parent:r});return Zg(r,o)}"~validate"(t){var r,o;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ks(t)};if(!this["~standard"].async)try{const c=this._parseSync({data:t,path:[],parent:a});return Ni(c)?{value:c.value}:{issues:a.common.issues}}catch(c){(o=(r=c==null?void 0:c.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(c=>Ni(c)?{value:c.value}:{issues:a.common.issues})}async parseAsync(t,a){const r=await this.safeParseAsync(t,a);if(r.success)return r.data;throw r.error}async safeParseAsync(t,a){const r={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ks(t)},o=this._parse({data:t,path:r.path,parent:r}),c=await(Vo(o)?o:Promise.resolve(o));return Zg(r,c)}refine(t,a){const r=o=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(o):a;return this._refinement((o,c)=>{const u=t(o),f=()=>c.addIssue({code:J.custom,...r(o)});return typeof Promise<"u"&&u instanceof Promise?u.then(m=>m?!0:(f(),!1)):u?!0:(f(),!1)})}refinement(t,a){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof a=="function"?a(r,o):a),!1))}_refinement(t){return new ji({schema:this,typeName:Ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:a=>this["~validate"](a)}}optional(){return Xs.create(this,this._def)}nullable(){return Ri.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kn.create(this)}promise(){return Zo.create(this,this._def)}or(t){return Ko.create([this,t],this._def)}and(t){return Yo.create(this,t,this._def)}transform(t){return new ji({...Me(this._def),schema:this,typeName:Ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const a=typeof t=="function"?t:()=>t;return new nf({...Me(this._def),innerType:this,defaultValue:a,typeName:Ce.ZodDefault})}brand(){return new Sk({typeName:Ce.ZodBranded,type:this,...Me(this._def)})}catch(t){const a=typeof t=="function"?t:()=>t;return new sf({...Me(this._def),innerType:this,catchValue:a,typeName:Ce.ZodCatch})}describe(t){const a=this.constructor;return new a({...this._def,description:t})}pipe(t){return kf.create(this,t)}readonly(){return af.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const JS=/^c[^\s-]{8,}$/i,ek=/^[0-9a-z]+$/,tk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nk=/^[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,sk=/^[a-z0-9_-]{21}$/i,ak=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ik=/^[-+]?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)?)??$/,rk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let kd;const ok=/^(?:(?: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])$/,ck=/^(?:(?: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])$/,uk=/^(([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]))$/,dk=/^(([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])$/,fk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cb="((\\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])))",hk=new RegExp(`^${cb}$`);function ub(s){let t="[0-5]\\d";s.precision?t=`${t}\\.\\d{${s.precision}}`:s.precision==null&&(t=`${t}(\\.\\d+)?`);const a=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${a}`}function mk(s){return new RegExp(`^${ub(s)}$`)}function gk(s){let t=`${cb}T${ub(s)}`;const a=[];return a.push(s.local?"Z?":"Z"),s.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function yk(s,t){return!!((t==="v4"||!t)&&ok.test(s)||(t==="v6"||!t)&&uk.test(s))}function bk(s,t){if(!ak.test(s))return!1;try{const[a]=s.split(".");if(!a)return!1;const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function xk(s,t){return!!((t==="v4"||!t)&&ck.test(s)||(t==="v6"||!t)&&dk.test(s))}class Zs extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==oe.string){const c=this._getOrReturnCtx(t);return ie(c,{code:J.invalid_type,expected:oe.string,received:c.parsedType}),_e}const r=new cn;let o;for(const c of this._def.checks)if(c.kind==="min")t.data.length<c.value&&(o=this._getOrReturnCtx(t,o),ie(o,{code:J.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),r.dirty());else if(c.kind==="max")t.data.length>c.value&&(o=this._getOrReturnCtx(t,o),ie(o,{code:J.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),r.dirty());else if(c.kind==="length"){const u=t.data.length>c.value,f=t.data.length<c.value;(u||f)&&(o=this._getOrReturnCtx(t,o),u?ie(o,{code:J.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):f&&ie(o,{code:J.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),r.dirty())}else if(c.kind==="email")rk.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"email",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="emoji")kd||(kd=new RegExp(lk,"u")),kd.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"emoji",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="uuid")nk.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"uuid",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="nanoid")sk.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"nanoid",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="cuid")JS.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cuid",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="cuid2")ek.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cuid2",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="ulid")tk.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"ulid",code:J.invalid_string,message:c.message}),r.dirty());else if(c.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ie(o,{validation:"url",code:J.invalid_string,message:c.message}),r.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"regex",code:J.invalid_string,message:c.message}),r.dirty())):c.kind==="trim"?t.data=t.data.trim():c.kind==="includes"?t.data.includes(c.value,c.position)||(o=this._getOrReturnCtx(t,o),ie(o,{code:J.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),r.dirty()):c.kind==="toLowerCase"?t.data=t.data.toLowerCase():c.kind==="toUpperCase"?t.data=t.data.toUpperCase():c.kind==="startsWith"?t.data.startsWith(c.value)||(o=this._getOrReturnCtx(t,o),ie(o,{code:J.invalid_string,validation:{startsWith:c.value},message:c.message}),r.dirty()):c.kind==="endsWith"?t.data.endsWith(c.value)||(o=this._getOrReturnCtx(t,o),ie(o,{code:J.invalid_string,validation:{endsWith:c.value},message:c.message}),r.dirty()):c.kind==="datetime"?gk(c).test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:J.invalid_string,validation:"datetime",message:c.message}),r.dirty()):c.kind==="date"?hk.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:J.invalid_string,validation:"date",message:c.message}),r.dirty()):c.kind==="time"?mk(c).test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{code:J.invalid_string,validation:"time",message:c.message}),r.dirty()):c.kind==="duration"?ik.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"duration",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="ip"?yk(t.data,c.version)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"ip",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="jwt"?bk(t.data,c.alg)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"jwt",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="cidr"?xk(t.data,c.version)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"cidr",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="base64"?fk.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"base64",code:J.invalid_string,message:c.message}),r.dirty()):c.kind==="base64url"?pk.test(t.data)||(o=this._getOrReturnCtx(t,o),ie(o,{validation:"base64url",code:J.invalid_string,message:c.message}),r.dirty()):Ye.assertNever(c);return{status:r.value,value:t.data}}_regex(t,a,r){return this.refinement(o=>t.test(o),{validation:a,code:J.invalid_string,...ue.errToObj(r)})}_addCheck(t){return new Zs({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ue.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ue.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ue.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ue.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ue.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ue.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ue.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ue.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ue.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ue.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ue.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ue.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ue.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...ue.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ue.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ue.errToObj(t)})}regex(t,a){return this._addCheck({kind:"regex",regex:t,...ue.errToObj(a)})}includes(t,a){return this._addCheck({kind:"includes",value:t,position:a==null?void 0:a.position,...ue.errToObj(a==null?void 0:a.message)})}startsWith(t,a){return this._addCheck({kind:"startsWith",value:t,...ue.errToObj(a)})}endsWith(t,a){return this._addCheck({kind:"endsWith",value:t,...ue.errToObj(a)})}min(t,a){return this._addCheck({kind:"min",value:t,...ue.errToObj(a)})}max(t,a){return this._addCheck({kind:"max",value:t,...ue.errToObj(a)})}length(t,a){return this._addCheck({kind:"length",value:t,...ue.errToObj(a)})}nonempty(t){return this.min(1,ue.errToObj(t))}trim(){return new Zs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Zs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Zs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxLength(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}Zs.create=s=>new Zs({checks:[],typeName:Ce.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...Me(s)});function vk(s,t){const a=(s.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=a>r?a:r,c=Number.parseInt(s.toFixed(o).replace(".","")),u=Number.parseInt(t.toFixed(o).replace(".",""));return c%u/10**o}class Ti extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==oe.number){const c=this._getOrReturnCtx(t);return ie(c,{code:J.invalid_type,expected:oe.number,received:c.parsedType}),_e}let r;const o=new cn;for(const c of this._def.checks)c.kind==="int"?Ye.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ie(r,{code:J.invalid_type,expected:"integer",received:"float",message:c.message}),o.dirty()):c.kind==="min"?(c.inclusive?t.data<c.value:t.data<=c.value)&&(r=this._getOrReturnCtx(t,r),ie(r,{code:J.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?t.data>c.value:t.data>=c.value)&&(r=this._getOrReturnCtx(t,r),ie(r,{code:J.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="multipleOf"?vk(t.data,c.value)!==0&&(r=this._getOrReturnCtx(t,r),ie(r,{code:J.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):c.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ie(r,{code:J.not_finite,message:c.message}),o.dirty()):Ye.assertNever(c);return{status:o.value,value:t.data}}gte(t,a){return this.setLimit("min",t,!0,ue.toString(a))}gt(t,a){return this.setLimit("min",t,!1,ue.toString(a))}lte(t,a){return this.setLimit("max",t,!0,ue.toString(a))}lt(t,a){return this.setLimit("max",t,!1,ue.toString(a))}setLimit(t,a,r,o){return new Ti({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:ue.toString(o)}]})}_addCheck(t){return new Ti({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ue.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ue.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:ue.toString(a)})}finite(t){return this._addCheck({kind:"finite",message:ue.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ue.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ue.toString(t)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ye.isInteger(t.value))}get isFinite(){let t=null,a=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(a===null||r.value>a)&&(a=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(a)&&Number.isFinite(t)}}Ti.create=s=>new Ti({checks:[],typeName:Ce.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...Me(s)});class il extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==oe.bigint)return this._getInvalidInput(t);let r;const o=new cn;for(const c of this._def.checks)c.kind==="min"?(c.inclusive?t.data<c.value:t.data<=c.value)&&(r=this._getOrReturnCtx(t,r),ie(r,{code:J.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?t.data>c.value:t.data>=c.value)&&(r=this._getOrReturnCtx(t,r),ie(r,{code:J.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="multipleOf"?t.data%c.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ie(r,{code:J.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):Ye.assertNever(c);return{status:o.value,value:t.data}}_getInvalidInput(t){const a=this._getOrReturnCtx(t);return ie(a,{code:J.invalid_type,expected:oe.bigint,received:a.parsedType}),_e}gte(t,a){return this.setLimit("min",t,!0,ue.toString(a))}gt(t,a){return this.setLimit("min",t,!1,ue.toString(a))}lte(t,a){return this.setLimit("max",t,!0,ue.toString(a))}lt(t,a){return this.setLimit("max",t,!1,ue.toString(a))}setLimit(t,a,r,o){return new il({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:ue.toString(o)}]})}_addCheck(t){return new il({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ue.toString(t)})}multipleOf(t,a){return this._addCheck({kind:"multipleOf",value:t,message:ue.toString(a)})}get minValue(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t}get maxValue(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t}}il.create=s=>new il({checks:[],typeName:Ce.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...Me(s)});class Qd extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==oe.boolean){const r=this._getOrReturnCtx(t);return ie(r,{code:J.invalid_type,expected:oe.boolean,received:r.parsedType}),_e}return An(t.data)}}Qd.create=s=>new Qd({typeName:Ce.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...Me(s)});class Wo extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==oe.date){const c=this._getOrReturnCtx(t);return ie(c,{code:J.invalid_type,expected:oe.date,received:c.parsedType}),_e}if(Number.isNaN(t.data.getTime())){const c=this._getOrReturnCtx(t);return ie(c,{code:J.invalid_date}),_e}const r=new cn;let o;for(const c of this._def.checks)c.kind==="min"?t.data.getTime()<c.value&&(o=this._getOrReturnCtx(t,o),ie(o,{code:J.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),r.dirty()):c.kind==="max"?t.data.getTime()>c.value&&(o=this._getOrReturnCtx(t,o),ie(o,{code:J.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),r.dirty()):Ye.assertNever(c);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Wo({...this._def,checks:[...this._def.checks,t]})}min(t,a){return this._addCheck({kind:"min",value:t.getTime(),message:ue.toString(a)})}max(t,a){return this._addCheck({kind:"max",value:t.getTime(),message:ue.toString(a)})}get minDate(){let t=null;for(const a of this._def.checks)a.kind==="min"&&(t===null||a.value>t)&&(t=a.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const a of this._def.checks)a.kind==="max"&&(t===null||a.value<t)&&(t=a.value);return t!=null?new Date(t):null}}Wo.create=s=>new Wo({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:Ce.ZodDate,...Me(s)});class Qg extends Ve{_parse(t){if(this._getType(t)!==oe.symbol){const r=this._getOrReturnCtx(t);return ie(r,{code:J.invalid_type,expected:oe.symbol,received:r.parsedType}),_e}return An(t.data)}}Qg.create=s=>new Qg({typeName:Ce.ZodSymbol,...Me(s)});class Xg extends Ve{_parse(t){if(this._getType(t)!==oe.undefined){const r=this._getOrReturnCtx(t);return ie(r,{code:J.invalid_type,expected:oe.undefined,received:r.parsedType}),_e}return An(t.data)}}Xg.create=s=>new Xg({typeName:Ce.ZodUndefined,...Me(s)});class Jg extends Ve{_parse(t){if(this._getType(t)!==oe.null){const r=this._getOrReturnCtx(t);return ie(r,{code:J.invalid_type,expected:oe.null,received:r.parsedType}),_e}return An(t.data)}}Jg.create=s=>new Jg({typeName:Ce.ZodNull,...Me(s)});class Xd extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return An(t.data)}}Xd.create=s=>new Xd({typeName:Ce.ZodAny,...Me(s)});class Jd extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return An(t.data)}}Jd.create=s=>new Jd({typeName:Ce.ZodUnknown,...Me(s)});class ea extends Ve{_parse(t){const a=this._getOrReturnCtx(t);return ie(a,{code:J.invalid_type,expected:oe.never,received:a.parsedType}),_e}}ea.create=s=>new ea({typeName:Ce.ZodNever,...Me(s)});class ey extends Ve{_parse(t){if(this._getType(t)!==oe.undefined){const r=this._getOrReturnCtx(t);return ie(r,{code:J.invalid_type,expected:oe.void,received:r.parsedType}),_e}return An(t.data)}}ey.create=s=>new ey({typeName:Ce.ZodVoid,...Me(s)});class Kn extends Ve{_parse(t){const{ctx:a,status:r}=this._processInputParams(t),o=this._def;if(a.parsedType!==oe.array)return ie(a,{code:J.invalid_type,expected:oe.array,received:a.parsedType}),_e;if(o.exactLength!==null){const u=a.data.length>o.exactLength.value,f=a.data.length<o.exactLength.value;(u||f)&&(ie(a,{code:u?J.too_big:J.too_small,minimum:f?o.exactLength.value:void 0,maximum:u?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&a.data.length<o.minLength.value&&(ie(a,{code:J.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&a.data.length>o.maxLength.value&&(ie(a,{code:J.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),a.common.async)return Promise.all([...a.data].map((u,f)=>o.type._parseAsync(new Js(a,u,a.path,f)))).then(u=>cn.mergeArray(r,u));const c=[...a.data].map((u,f)=>o.type._parseSync(new Js(a,u,a.path,f)));return cn.mergeArray(r,c)}get element(){return this._def.type}min(t,a){return new Kn({...this._def,minLength:{value:t,message:ue.toString(a)}})}max(t,a){return new Kn({...this._def,maxLength:{value:t,message:ue.toString(a)}})}length(t,a){return new Kn({...this._def,exactLength:{value:t,message:ue.toString(a)}})}nonempty(t){return this.min(1,t)}}Kn.create=(s,t)=>new Kn({type:s,minLength:null,maxLength:null,exactLength:null,typeName:Ce.ZodArray,...Me(t)});function xi(s){if(s instanceof Et){const t={};for(const a in s.shape){const r=s.shape[a];t[a]=Xs.create(xi(r))}return new Et({...s._def,shape:()=>t})}else return s instanceof Kn?new Kn({...s._def,type:xi(s.element)}):s instanceof Xs?Xs.create(xi(s.unwrap())):s instanceof Ri?Ri.create(xi(s.unwrap())):s instanceof Ca?Ca.create(s.items.map(t=>xi(t))):s}class Et extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),a=Ye.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(t){if(this._getType(t)!==oe.object){const g=this._getOrReturnCtx(t);return ie(g,{code:J.invalid_type,expected:oe.object,received:g.parsedType}),_e}const{status:r,ctx:o}=this._processInputParams(t),{shape:c,keys:u}=this._getCached(),f=[];if(!(this._def.catchall instanceof ea&&this._def.unknownKeys==="strip"))for(const g in o.data)u.includes(g)||f.push(g);const m=[];for(const g of u){const y=c[g],b=o.data[g];m.push({key:{status:"valid",value:g},value:y._parse(new Js(o,b,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof ea){const g=this._def.unknownKeys;if(g==="passthrough")for(const y of f)m.push({key:{status:"valid",value:y},value:{status:"valid",value:o.data[y]}});else if(g==="strict")f.length>0&&(ie(o,{code:J.unrecognized_keys,keys:f}),r.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const y of f){const b=o.data[y];m.push({key:{status:"valid",value:y},value:g._parse(new Js(o,b,o.path,y)),alwaysSet:y in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const g=[];for(const y of m){const b=await y.key,v=await y.value;g.push({key:b,value:v,alwaysSet:y.alwaysSet})}return g}).then(g=>cn.mergeObjectSync(r,g)):cn.mergeObjectSync(r,m)}get shape(){return this._def.shape()}strict(t){return ue.errToObj,new Et({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(a,r)=>{var c,u;const o=((u=(c=this._def).errorMap)==null?void 0:u.call(c,a,r).message)??r.defaultError;return a.code==="unrecognized_keys"?{message:ue.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new Et({...this._def,unknownKeys:"strip"})}passthrough(){return new Et({...this._def,unknownKeys:"passthrough"})}extend(t){return new Et({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Et({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ce.ZodObject})}setKey(t,a){return this.augment({[t]:a})}catchall(t){return new Et({...this._def,catchall:t})}pick(t){const a={};for(const r of Ye.objectKeys(t))t[r]&&this.shape[r]&&(a[r]=this.shape[r]);return new Et({...this._def,shape:()=>a})}omit(t){const a={};for(const r of Ye.objectKeys(this.shape))t[r]||(a[r]=this.shape[r]);return new Et({...this._def,shape:()=>a})}deepPartial(){return xi(this)}partial(t){const a={};for(const r of Ye.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?a[r]=o:a[r]=o.optional()}return new Et({...this._def,shape:()=>a})}required(t){const a={};for(const r of Ye.objectKeys(this.shape))if(t&&!t[r])a[r]=this.shape[r];else{let c=this.shape[r];for(;c instanceof Xs;)c=c._def.innerType;a[r]=c}return new Et({...this._def,shape:()=>a})}keyof(){return db(Ye.objectKeys(this.shape))}}Et.create=(s,t)=>new Et({shape:()=>s,unknownKeys:"strip",catchall:ea.create(),typeName:Ce.ZodObject,...Me(t)});Et.strictCreate=(s,t)=>new Et({shape:()=>s,unknownKeys:"strict",catchall:ea.create(),typeName:Ce.ZodObject,...Me(t)});Et.lazycreate=(s,t)=>new Et({shape:s,unknownKeys:"strip",catchall:ea.create(),typeName:Ce.ZodObject,...Me(t)});class Ko extends Ve{_parse(t){const{ctx:a}=this._processInputParams(t),r=this._def.options;function o(c){for(const f of c)if(f.result.status==="valid")return f.result;for(const f of c)if(f.result.status==="dirty")return a.common.issues.push(...f.ctx.common.issues),f.result;const u=c.map(f=>new xs(f.ctx.common.issues));return ie(a,{code:J.invalid_union,unionErrors:u}),_e}if(a.common.async)return Promise.all(r.map(async c=>{const u={...a,common:{...a.common,issues:[]},parent:null};return{result:await c._parseAsync({data:a.data,path:a.path,parent:u}),ctx:u}})).then(o);{let c;const u=[];for(const m of r){const g={...a,common:{...a.common,issues:[]},parent:null},y=m._parseSync({data:a.data,path:a.path,parent:g});if(y.status==="valid")return y;y.status==="dirty"&&!c&&(c={result:y,ctx:g}),g.common.issues.length&&u.push(g.common.issues)}if(c)return a.common.issues.push(...c.ctx.common.issues),c.result;const f=u.map(m=>new xs(m));return ie(a,{code:J.invalid_union,unionErrors:f}),_e}}get options(){return this._def.options}}Ko.create=(s,t)=>new Ko({options:s,typeName:Ce.ZodUnion,...Me(t)});function ef(s,t){const a=Ks(s),r=Ks(t);if(s===t)return{valid:!0,data:s};if(a===oe.object&&r===oe.object){const o=Ye.objectKeys(t),c=Ye.objectKeys(s).filter(f=>o.indexOf(f)!==-1),u={...s,...t};for(const f of c){const m=ef(s[f],t[f]);if(!m.valid)return{valid:!1};u[f]=m.data}return{valid:!0,data:u}}else if(a===oe.array&&r===oe.array){if(s.length!==t.length)return{valid:!1};const o=[];for(let c=0;c<s.length;c++){const u=s[c],f=t[c],m=ef(u,f);if(!m.valid)return{valid:!1};o.push(m.data)}return{valid:!0,data:o}}else return a===oe.date&&r===oe.date&&+s==+t?{valid:!0,data:s}:{valid:!1}}class Yo extends Ve{_parse(t){const{status:a,ctx:r}=this._processInputParams(t),o=(c,u)=>{if(Kg(c)||Kg(u))return _e;const f=ef(c.value,u.value);return f.valid?((Yg(c)||Yg(u))&&a.dirty(),{status:a.value,value:f.data}):(ie(r,{code:J.invalid_intersection_types}),_e)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([c,u])=>o(c,u)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Yo.create=(s,t,a)=>new Yo({left:s,right:t,typeName:Ce.ZodIntersection,...Me(a)});class Ca extends Ve{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.array)return ie(r,{code:J.invalid_type,expected:oe.array,received:r.parsedType}),_e;if(r.data.length<this._def.items.length)return ie(r,{code:J.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_e;!this._def.rest&&r.data.length>this._def.items.length&&(ie(r,{code:J.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const c=[...r.data].map((u,f)=>{const m=this._def.items[f]||this._def.rest;return m?m._parse(new Js(r,u,r.path,f)):null}).filter(u=>!!u);return r.common.async?Promise.all(c).then(u=>cn.mergeArray(a,u)):cn.mergeArray(a,c)}get items(){return this._def.items}rest(t){return new Ca({...this._def,rest:t})}}Ca.create=(s,t)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ca({items:s,typeName:Ce.ZodTuple,rest:null,...Me(t)})};class ty extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.map)return ie(r,{code:J.invalid_type,expected:oe.map,received:r.parsedType}),_e;const o=this._def.keyType,c=this._def.valueType,u=[...r.data.entries()].map(([f,m],g)=>({key:o._parse(new Js(r,f,r.path,[g,"key"])),value:c._parse(new Js(r,m,r.path,[g,"value"]))}));if(r.common.async){const f=new Map;return Promise.resolve().then(async()=>{for(const m of u){const g=await m.key,y=await m.value;if(g.status==="aborted"||y.status==="aborted")return _e;(g.status==="dirty"||y.status==="dirty")&&a.dirty(),f.set(g.value,y.value)}return{status:a.value,value:f}})}else{const f=new Map;for(const m of u){const g=m.key,y=m.value;if(g.status==="aborted"||y.status==="aborted")return _e;(g.status==="dirty"||y.status==="dirty")&&a.dirty(),f.set(g.value,y.value)}return{status:a.value,value:f}}}}ty.create=(s,t,a)=>new ty({valueType:t,keyType:s,typeName:Ce.ZodMap,...Me(a)});class rl extends Ve{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.set)return ie(r,{code:J.invalid_type,expected:oe.set,received:r.parsedType}),_e;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(ie(r,{code:J.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),a.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(ie(r,{code:J.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),a.dirty());const c=this._def.valueType;function u(m){const g=new Set;for(const y of m){if(y.status==="aborted")return _e;y.status==="dirty"&&a.dirty(),g.add(y.value)}return{status:a.value,value:g}}const f=[...r.data.values()].map((m,g)=>c._parse(new Js(r,m,r.path,g)));return r.common.async?Promise.all(f).then(m=>u(m)):u(f)}min(t,a){return new rl({...this._def,minSize:{value:t,message:ue.toString(a)}})}max(t,a){return new rl({...this._def,maxSize:{value:t,message:ue.toString(a)}})}size(t,a){return this.min(t,a).max(t,a)}nonempty(t){return this.min(1,t)}}rl.create=(s,t)=>new rl({valueType:s,minSize:null,maxSize:null,typeName:Ce.ZodSet,...Me(t)});class ny extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:a}=this._processInputParams(t);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}ny.create=(s,t)=>new ny({getter:s,typeName:Ce.ZodLazy,...Me(t)});class tf extends Ve{_parse(t){if(t.data!==this._def.value){const a=this._getOrReturnCtx(t);return ie(a,{received:a.data,code:J.invalid_literal,expected:this._def.value}),_e}return{status:"valid",value:t.data}}get value(){return this._def.value}}tf.create=(s,t)=>new tf({value:s,typeName:Ce.ZodLiteral,...Me(t)});function db(s,t){return new Ai({values:s,typeName:Ce.ZodEnum,...Me(t)})}class Ai extends Ve{_parse(t){if(typeof t.data!="string"){const a=this._getOrReturnCtx(t),r=this._def.values;return ie(a,{expected:Ye.joinValues(r),received:a.parsedType,code:J.invalid_type}),_e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const a=this._getOrReturnCtx(t),r=this._def.values;return ie(a,{received:a.data,code:J.invalid_enum_value,options:r}),_e}return An(t.data)}get options(){return this._def.values}get enum(){const t={};for(const a of this._def.values)t[a]=a;return t}get Values(){const t={};for(const a of this._def.values)t[a]=a;return t}get Enum(){const t={};for(const a of this._def.values)t[a]=a;return t}extract(t,a=this._def){return Ai.create(t,{...this._def,...a})}exclude(t,a=this._def){return Ai.create(this.options.filter(r=>!t.includes(r)),{...this._def,...a})}}Ai.create=db;class sy extends Ve{_parse(t){const a=Ye.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==oe.string&&r.parsedType!==oe.number){const o=Ye.objectValues(a);return ie(r,{expected:Ye.joinValues(o),received:r.parsedType,code:J.invalid_type}),_e}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=Ye.objectValues(a);return ie(r,{received:r.data,code:J.invalid_enum_value,options:o}),_e}return An(t.data)}get enum(){return this._def.values}}sy.create=(s,t)=>new sy({values:s,typeName:Ce.ZodNativeEnum,...Me(t)});class Zo extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:a}=this._processInputParams(t);if(a.parsedType!==oe.promise&&a.common.async===!1)return ie(a,{code:J.invalid_type,expected:oe.promise,received:a.parsedType}),_e;const r=a.parsedType===oe.promise?a.data:Promise.resolve(a.data);return An(r.then(o=>this._def.type.parseAsync(o,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Zo.create=(s,t)=>new Zo({type:s,typeName:Ce.ZodPromise,...Me(t)});class ji extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:r}=this._processInputParams(t),o=this._def.effect||null,c={addIssue:u=>{ie(r,u),u.fatal?a.abort():a.dirty()},get path(){return r.path}};if(c.addIssue=c.addIssue.bind(c),o.type==="preprocess"){const u=o.transform(r.data,c);if(r.common.async)return Promise.resolve(u).then(async f=>{if(a.value==="aborted")return _e;const m=await this._def.schema._parseAsync({data:f,path:r.path,parent:r});return m.status==="aborted"?_e:m.status==="dirty"||a.value==="dirty"?Fr(m.value):m});{if(a.value==="aborted")return _e;const f=this._def.schema._parseSync({data:u,path:r.path,parent:r});return f.status==="aborted"?_e:f.status==="dirty"||a.value==="dirty"?Fr(f.value):f}}if(o.type==="refinement"){const u=f=>{const m=o.refinement(f,c);if(r.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return f};if(r.common.async===!1){const f=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return f.status==="aborted"?_e:(f.status==="dirty"&&a.dirty(),u(f.value),{status:a.value,value:f.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(f=>f.status==="aborted"?_e:(f.status==="dirty"&&a.dirty(),u(f.value).then(()=>({status:a.value,value:f.value}))))}if(o.type==="transform")if(r.common.async===!1){const u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ni(u))return _e;const f=o.transform(u.value,c);if(f instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:f}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ni(u)?Promise.resolve(o.transform(u.value,c)).then(f=>({status:a.value,value:f})):_e);Ye.assertNever(o)}}ji.create=(s,t,a)=>new ji({schema:s,typeName:Ce.ZodEffects,effect:t,...Me(a)});ji.createWithPreprocess=(s,t,a)=>new ji({schema:t,effect:{type:"preprocess",transform:s},typeName:Ce.ZodEffects,...Me(a)});class Xs extends Ve{_parse(t){return this._getType(t)===oe.undefined?An(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Xs.create=(s,t)=>new Xs({innerType:s,typeName:Ce.ZodOptional,...Me(t)});class Ri extends Ve{_parse(t){return this._getType(t)===oe.null?An(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ri.create=(s,t)=>new Ri({innerType:s,typeName:Ce.ZodNullable,...Me(t)});class nf extends Ve{_parse(t){const{ctx:a}=this._processInputParams(t);let r=a.data;return a.parsedType===oe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}nf.create=(s,t)=>new nf({innerType:s,typeName:Ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Me(t)});class sf extends Ve{_parse(t){const{ctx:a}=this._processInputParams(t),r={...a,common:{...a.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Vo(o)?o.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new xs(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new xs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}sf.create=(s,t)=>new sf({innerType:s,typeName:Ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Me(t)});class ay extends Ve{_parse(t){if(this._getType(t)!==oe.nan){const r=this._getOrReturnCtx(t);return ie(r,{code:J.invalid_type,expected:oe.nan,received:r.parsedType}),_e}return{status:"valid",value:t.data}}}ay.create=s=>new ay({typeName:Ce.ZodNaN,...Me(s)});class Sk extends Ve{_parse(t){const{ctx:a}=this._processInputParams(t),r=a.data;return this._def.type._parse({data:r,path:a.path,parent:a})}unwrap(){return this._def.type}}class kf extends Ve{_parse(t){const{status:a,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const c=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?_e:c.status==="dirty"?(a.dirty(),Fr(c.value)):this._def.out._parseAsync({data:c.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?_e:o.status==="dirty"?(a.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,a){return new kf({in:t,out:a,typeName:Ce.ZodPipeline})}}class af extends Ve{_parse(t){const a=this._def.innerType._parse(t),r=o=>(Ni(o)&&(o.value=Object.freeze(o.value)),o);return Vo(a)?a.then(o=>r(o)):r(a)}unwrap(){return this._def.innerType}}af.create=(s,t)=>new af({innerType:s,typeName:Ce.ZodReadonly,...Me(t)});var Ce;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(Ce||(Ce={}));const Re=Zs.create,Qs=Ti.create,fb=Qd.create,pb=Xd.create,cl=Jd.create;ea.create;const wf=Kn.create,ht=Et.create,kk=Ko.create;Yo.create;Ca.create;const _f=tf.create,wk=Ai.create;Zo.create;Xs.create;Ri.create;function P(s){return{schema:cl(),...s}}const Cf=[];let iy=new Set;function un(s){for(const t of s){if(iy.has(t.type))throw new Error(`[protocol] duplicate event type: ${t.type}`);iy.add(t.type),Cf.push(t)}return s}Object.fromEntries(Cf.map(s=>[s.type,s.schema]));un([P({type:"connected",description:"WebSocket 已连接",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"session_created",description:"新会话已创建",category:"session",emittedBy:["server","core"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 均已处理(Web: systemHandlers session_created)",schema:ht({id:Re(),title:Re().optional()}).partial()}),P({type:"session_resumed",description:"会话从存储中恢复",category:"session",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 均已处理(Web: systemHandlers session_resumed)",schema:ht({id:Re()}).partial()}),P({type:"auth_required",description:"需要认证",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"auth_success",description:"认证成功",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"auth_failed",description:"认证失败",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18)"}),P({type:"message_ack",description:"消息确认",category:"session",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"CLI 发送给服务器的入站事件,无需 handler"}),P({type:"workspace_changed",description:"工作空间已切换",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,schema:ht({workspaceDir:Re()}).partial()}),P({type:"session_switched",description:"会话已切换",category:"session",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(切换 activeSessionId)",schema:ht({id:Re()}).partial()}),P({type:"disconnected",description:"连接断开",category:"session",emittedBy:["server"],handledByCli:!0,handledByWeb:!0})]);un([P({type:"start",description:"AI 开始生成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"content",description:"生成内容增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:ht({content:Re()}).partial()}),P({type:"thinking",description:"思考过程增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:ht({thinking:Re()}).partial()}),P({type:"tool_call",description:"工具调用流式增量",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_result",description:"工具执行结果",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_execution_start",description:"工具执行阶段开始(无流事件时段开始)",category:"stream",emittedBy:["core"],handledByCli:!1,handledByWeb:!1,note:"纯 core 内部遥测:供运行时暂停/恢复 stall 心跳与全局看门狗;CLI/Web 无 handler(前端无需展示),仅 queryEngine 消费"}),P({type:"tool_execution_end",description:"工具执行阶段结束(恢复 stall 心跳与全局看门狗)",category:"stream",emittedBy:["core"],handledByCli:!1,handledByWeb:!1,note:"配合 tool_execution_start:防止 180s 心跳把合法长等待误判为流挂起而 abort + 重放整轮工具调用;CLI/Web 无 handler"}),P({type:"tool_diff",description:"工具执行中的参数 diff 增量(P0-2 diffConsumer 生产者推送)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_start",description:"步骤开始",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_thinking",description:"步骤思考",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_action",description:"步骤动作",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"step_complete",description:"步骤完成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"turn_summary",description:"回合结束摘要(思考时长+工具计数+头条)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI/Web 渲染为折叠摘要行(Thought for Ns, ran N …)"}),P({type:"cache_stats",description:"本轮 run 前缀缓存命中统计(命中/未命中 token、命中率、调用次数)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"run 结束时由 queryEngine 发送;CLI/Web 在模型名旁展示命中率",schema:ht({cacheHitTokens:Qs(),cacheMissTokens:Qs(),cacheHitRate:Qs().optional(),cacheStatsCalls:Qs()}).partial()}),P({type:"web_search",description:"模型内置联网搜索状态(DeepSeek Responses web_search_call:searching/completed/failed)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由服务端执行搜索,客户端仅展示状态(🔍搜索中 → ✅完成)",schema:ht({state:Re()}).partial()}),P({type:"progress",description:"通用进度(当前未使用)",category:"stream",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"已定义但从未发送;SendMessageTool 的 progress 是消息类型而非 WS 事件"}),P({type:"complete",description:"生成完成",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"error",description:"生成错误",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,schema:ht({message:Re()}).partial()}),P({type:"generation_paused",description:"生成已暂停",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"generation_resumed",description:"生成已恢复",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"stall_detected",description:"流级卡死检测(自动重试/通知)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 StreamHeartbeat 或 StallDetector 触发;CLI/Web 显示重试进度"}),P({type:"task_interrupted",description:"任务中断(服务重启/异常退出)",category:"stream",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"服务启动扫描时将 running activeRun 标记为 interrupted 后触发;提示用户使用 /continue 恢复生成,或用 /resume 切换会话"}),P({type:"step_prompt",description:"步骤提示(Web 路由用)",category:"stream",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,note:"Web 路由的内部事件,不通过 WS 发送"})]);un([P({type:"plan_start",description:"计划开始",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 EnterPlanMode 工具 emit"}),P({type:"plan_thinking",description:"计划思考",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_tasks",description:"计划任务列表生成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 ExitPlanMode 工具 emit(解析计划内容为任务列表);CLI handler 解析 data.tasks",schema:ht({tasks:wf(pb())}).partial()}),P({type:"plan_task_start",description:"计划任务开始",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_task_update",description:"计划任务更新",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_task_result",description:"计划任务结果",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_complete",description:"计划完成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"由 ExitPlanMode 工具 emit(携带 currentPlan/proposedPlan)"}),P({type:"plan_error",description:"计划错误",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"plan_mode_change",description:"计划模式切换",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01);Web planHandlers 已处理(2026-08-07)"}),P({type:"plan_mode_enter",description:"进入计划模式(CLI 遗留)",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"兼容遗留代码,应改用 plan_mode_change"}),P({type:"plan_mode_exit",description:"退出计划模式(CLI 遗留)",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!0,deprecated:!0,note:"兼容遗留代码,应改用 plan_mode_change"}),P({type:"plan_confirm",description:"计划等待确认",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web planHandlers 已处理(2026-08-07)"}),P({type:"plan_waiting",description:"计划等待用户输入",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_continue",description:"计划继续执行",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_settled",description:"计划已定稿",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"plan_cleared",description:"计划已清除",category:"plan",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,note:"核心未发射(仅 CLI 兼容订阅),已从 emittedBy 移除 core"}),P({type:"user_exit_plan_mode",description:"用户手动退出计划模式",category:"plan",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),客户端无需 handler"}),P({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:ht({id:Re(),title:Re(),status:Re(),result:Re().optional(),error:Re().optional()}).partial()}),P({type:"plan_subagent_start",description:"Plan 设计子代理启动",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"PlanSubAgentTool 启动只读设计子代理时 emit;data 携带 scope/agentId/planSlug/title",schema:ht({scope:Re(),agentId:Re(),planSlug:Re().optional(),title:Re().optional()}).partial()}),P({type:"plan_subagent_done",description:"Plan 设计子代理完成",category:"plan",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"PlanSubAgentTool 子代理完成(成功或失败)时 emit;data 携带 scope/agentId/status/designDocPath/error",schema:ht({scope:Re(),agentId:Re(),status:Re(),designDocPath:Re().optional(),error:Re().optional()}).partial()})]);un([P({type:"token_update",description:"Token 用量更新",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_compressed",description:"上下文已压缩",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"compaction_progress",description:"压缩进度更新",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_analysis",description:"上下文分布分析",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"threshold_warning",description:"Token 阈值警告",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"threshold_error",description:"Token 阈值错误",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"功能存在但被 context_blocked 覆盖,事件未使用"}),P({type:"context_blocked",description:"上下文已满,生成被阻止",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"blocking_limit",description:"已达到阻止极限",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 有 handler 但路由不可达"}),P({type:"compaction_started",description:"压缩任务已启动(phase/trigger)",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"compaction_finished",description:"压缩任务结束(done/failed/aborted)",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"tool_retry",description:"工具重试",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"重试信息已含于 tool_result/error,Web handler 保留但路由不可达"}),P({type:"model_fallback",description:"模型回退",category:"context",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"降级信息已含于 degradation_update,Web handler 保留但路由不可达"}),P({type:"usage",description:"Token 用量",category:"context",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"context_breakdown",description:"上下文容量分类占比(系统提示词/消息/工具/技能/MCP),供 Web 底部上下文条抽屉展示",category:"context",emittedBy:["core"],handledByCli:!1,handledByWeb:!0,note:"每轮 query 上下文组装后估算各组件 token,Web 端点状态栏上下文条上拉展示"})]);un([P({type:"workflow_started",description:"工作流已启动",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_event",description:"工作流事件",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_progress",description:"工作流进度",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_finished",description:"工作流完成",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_error",description:"工作流错误",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_checkpoint",description:"工作流检查点",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_node_start",description:"工作流节点开始",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_node_complete",description:"工作流节点完成",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_paused",description:"工作流已暂停",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_resumed",description:"工作流已恢复",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_cancelled",description:"工作流已取消",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_recovered",description:"工作流已恢复(从故障)",category:"workflow",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"已被 workflow_resumed 覆盖,核心从未发送"}),P({type:"workflow_handoff",description:"ReAct 转交 workflow(范式切换)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"workflow_status",description:"workflow run 状态查询响应(状态对账:连接/重连后拉取终态)",category:"workflow",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-08-14: 配合 get_workflow_status 请求,修复一次性事件流漏终态导致的 UI 卡死"})]);un([P({type:"task_update",description:"任务更新",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_output",description:"任务输出",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_finished",description:"任务完成",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"task_error",description:"任务错误",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"}),P({type:"filejob_start",description:"文件处理任务开始(解析/渲染)",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"对话内嵌文件处理面板;Web 已处理,CLI 已处理(2026-08-07 状态行)"}),P({type:"filejob_progress",description:"文件处理进度更新",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"解析/渲染进度百分比",schema:ht({progress:Qs()}).partial()}),P({type:"filejob_result",description:"文件处理完成(结果文件列表)",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"携带 RenderedFileResult[]",schema:wf(pb())}),P({type:"filejob_error",description:"文件处理失败",category:"task",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"脱敏错误详情"})]);un([P({type:"goal_created",description:"目标已创建",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: Web handled via goal_tasks/goal_task_update"}),P({type:"goal_tasks",description:"目标任务列表(批量初始化看板)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: 统一看板数据源"}),P({type:"goal_task_update",description:"目标任务更新",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-07-21: Web 已添加 handler"}),P({type:"goal_completed",description:"目标已完成(workflow 终态自动推导)",category:"goal",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"2026-08-14: 此前 goals.complete() 无任何调用点,goal 工作流跑完后 goal 永远停在 active —— 新增终态事件供两端对账"})]);un([P({type:"hook_ask",description:"Hook 审批请求",category:"hook",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"hook_allow",description:"Hook 允许响应",category:"hook",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),无需 handler"}),P({type:"hook_deny",description:"Hook 拒绝响应",category:"hook",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"入站事件(CLI→服务器),无需 handler"}),P({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)"}),P({type:"ask_user_question",description:"向用户提问",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"question_answer_ack",description:"提问回答确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web useWebSocket 已处理(dismiss 提问弹窗)"}),P({type:"hook_auto_ack",description:"Hook 自动模式确认",category:"hook",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"})]);un([P({type:"mcp_update",description:"MCP 状态更新",category:"mcp",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已添加 handler(2026-07-01)"})]);un([P({type:"doctor_result",description:"诊断完成",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"degradation",description:"降级状态更新(遗留)",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"degradation_update",description:"降级状态更新",category:"diagnostic",emittedBy:["core"],handledByCli:!0,handledByWeb:!0})]);un([P({type:"commands_list",description:"命令列表(服务器→客户端)",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(setDynamicCommands); Web systemHandlers 已处理(2026-08-07)"}),P({type:"ping",description:"心跳 Ping",category:"system",emittedBy:["client"],handledByCli:!1,handledByWeb:!1,note:"由 Server 的 WS 层自动处理"}),P({type:"pong",description:"心跳 Pong",category:"system",emittedBy:["server"],handledByCli:!1,handledByWeb:!1,note:"由 Client 的 WS 层自动处理"}),P({type:"log",description:"服务端日志",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"notification",description:"通知消息",category:"system",emittedBy:["server"],handledByCli:!0,handledByWeb:!0}),P({type:"channel_message",description:"频道入站消息(转发到 Web UI)",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(2026-08-07 通知)"}),P({type:"channel_status",description:"频道连接状态变更",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(channelsStore)"}),P({type:"channel_error",description:"频道运行时错误",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 已处理(2026-07-18); Web 已处理(2026-08-07 通知)"}),P({type:"todo_update",description:"待办事项更新",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0}),P({type:"todo_item_done",description:"待办项完成",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"运行时可能发送"}),P({type:"todo_progress",description:"待办进度",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"运行时可能发送"}),P({type:"tombstone",description:"消息已删除/墓碑",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!1,deprecated:!0,note:"Web/CLI 本地消息删除渲染概念,无 WS 发射端"}),P({type:"status",description:"状态更新(modelName/connected/statusText)",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,schema:ht({modelName:Re(),connected:fb(),statusText:Re()}).partial()}),P({type:"model_name",description:"当前模型名称",category:"system",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,schema:ht({model:Re()}).partial()}),P({type:"throttle",description:"速率限制状态",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"}),P({type:"code_review_ready",description:"代码审查结果就绪",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"Web 已处理(2026-08-07 toast 提示)"}),P({type:"pdca_phase",description:"PDCA 循环阶段",category:"system",emittedBy:["none"],handledByCli:!0,handledByWeb:!1,deprecated:!0,note:"已退役:5-phase light pipeline 被 WorkflowRuntime 取代"}),P({type:"command_start",description:"命令开始(Web 路由用)",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"Web systemHandler 有 case 但核心无发送方,保留兼容"}),P({type:"command_complete",description:"命令完成(Web 路由用)",category:"system",emittedBy:["none"],handledByCli:!1,handledByWeb:!0,deprecated:!0,note:"Web systemHandler 有 case 但核心无发送方,保留兼容"}),P({type:"command_error",description:"命令错误(Web 路由用)",category:"system",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"core index.ts:1270 真实 emit;CLI useStreamHandlers:741 与 Web systemHandlers 均已处理"})]);un([P({type:"tool.approval_required",description:"工具调用需要审批(停放入口)",category:"inbox",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"无人值守/定时运行时写操作先停放;CLI 状态提示,Web Inbox 视图消费(2026-08-07 标记修正)"}),P({type:"inbox.pending",description:"Inbox 新待办(审批/提问/通知)",category:"inbox",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 状态提示;Web Inbox 视图消费"}),P({type:"inbox.resolved",description:"Inbox 待办已解决(approve/reject)",category:"inbox",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 状态提示;Web Inbox 视图消费"}),P({type:"audit.record",description:"审计记录新增(工具批准/拒绝历史)",category:"inbox",emittedBy:["core"],handledByCli:!0,handledByWeb:!0,note:"CLI 忽略(避免刷屏);tools 页审计视图数据源"})]);un([P({type:"automation.update",description:"自动化任务新增/更新/删除/状态变更",category:"automation",emittedBy:["server"],handledByCli:!0,handledByWeb:!0,note:"REST /api/automations 已可用;Web 自动化视图消费"}),P({type:"automation.run",description:"自动化触发运行(started/finished/error)",category:"automation",emittedBy:["core","server"],handledByCli:!0,handledByWeb:!0,note:"CLI 状态提示;Web RunDetail 消费"})]);const _k=/^[a-z][a-z0-9._-]*$/,Qo=Re().min(1).max(128).regex(_k,"command id must match ^[a-z][a-z0-9._-]*$");ht({id:Re().min(1).max(128),command:Qo,payload:cl().optional(),timeoutMs:Qs().int().positive().max(3e5).optional(),sender:Re().max(128).optional()});ht({success:fb(),requestId:Re(),command:Qo,result:cl().optional(),error:Re().optional(),durationMs:Qs().min(0).optional()});const Ck=ht({capability:Qo,command:Qo,description:Re().max(500).optional(),provider:Re().max(128).optional()});ht({version:_f("1"),capabilities:wf(Ck)});const Ek="1",Nk=["ready","select","inspect","screenshot","highlight","command","event"],Tk=ht({version:_f(Ek),type:wk(Nk),requestId:Re().min(1).max(128),payload:cl().optional()}).passthrough();ht({type:Re().min(1).max(128).regex(/^[a-z][a-z0-9._-]*$/,"event type must match ^[a-z][a-z0-9._-]*$"),payload:cl().optional(),source:Re().max(128).optional(),timestamp:Qs().nonnegative().optional()});const Ak="workspace_event";ht({type:_f(Ak),sessionId:Re().optional(),data:kk([Re(),Tk]).optional(),traceId:Re().optional()});const jk=Cf.map(s=>({eventType:s.type,description:s.description,category:s.category,emittedBy:s.emittedBy,handledByCli:s.handledByCli,handledByWeb:s.handledByWeb,...s.deprecated!==void 0?{deprecated:s.deprecated}:{},...s.note!==void 0?{note:s.note}:{}}));function Cn(s){return s==="auto-plan"?"plan":s==="auto-act"?"act":s==="auto-goal"?"goal":s}function Si(s){return s==="auto-plan"||s==="auto-act"||s==="auto-goal"}function Rk(s){switch(s){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 EE=["plan","act","goal"];function rf(s,t){return t?s==="plan"?"auto-plan":s==="act"?"auto-act":"auto-goal":s}function Ok(s){const t=["plan","act","goal"],a=t.indexOf(Cn(s)),r=t[(a+1)%t.length]??"act";return rf(r,Si(s))}const Mk={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"}},NE={low:{label:"Low",accent:"green"},medium:{label:"Medium",accent:"cyan"},high:{label:"High",accent:"yellow"},critical:{label:"Critical",accent:"red"}},TE={allow:{label:"Allow"},deny:{label:"Deny"},allow_session:{label:"Allow session"},auto:{label:"Auto mode"}};function Bk(s){return s==="plan"||s==="auto-plan"||s==="act"||s==="auto-act"||s==="goal"||s==="auto-goal"?s:"act"}function Dr(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${Math.round(s/1e3)}K`:String(s)}function Dk(s){return s<=0?"":s>=100?`${Math.round(s)}t/s`:`${s.toFixed(1)}t/s`}function hb(s){if(s<=0)return"";if(s>=60){const t=Math.floor(s/60),a=s%60;return`${t}m${a}s`}return`${s}s`}function Lk(s,t){switch(s){case"bash":case"shell":case"PowerShell":return`ran ${t} shell command${t>1?"s":""}`;case"read_file":return`read ${t} file${t>1?"s":""}`;case"write_file":return`wrote ${t} file${t>1?"s":""}`;case"edit_file":return`edited ${t} file${t>1?"s":""}`;default:return`ran ${t} ${s}${t>1?"s":""}`}}function AE(s){const t=Object.entries(s.toolCounts).filter(([,o])=>o>0).sort((o,c)=>c[1]-o[1]),a=s.headline||`Thought for ${hb(Math.max(1,Math.round(s.durationMs/1e3)))}`,r=t.map(([o,c])=>Lk(o,c));return r.length>0?`${a}, ${r.join(", ")}`:a}function zk(s,t){const a=s.toLowerCase();return/\b(rm|del|delete|drop|truncate|format|mkfs)\b/.test(a)?"critical":/\b(bash|shell|exec|cmd|powershell|terminal)\b/.test(a)?/\b(rm\s+-rf|sudo|chmod\s+777|curl.*\|\s*(ba)?sh|wget.*-O|>\/dev\/|mkfs)\b/i.test(t)?"critical":"high":/\b(write|edit|save|upload|deploy|publish)\b/i.test(a)||/\b(install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf)\b/i.test(a)?"high":/\b(git|commit|push|merge|rebase)\b/i.test(a)?/\b(push|force|hard\s*reset|rebase)\b/i.test(t)?"high":"medium":/\b(http|fetch|curl|wget|api|request|download)\b/i.test(a)?"medium":/\b(read|open|list|ls|dir|cat|view|search|find|grep|glob)\b/i.test(a)?"low":"medium"}function Uk(s,t){if(t==null)return null;if(/\b(bash|shell|exec|cmd|powershell|terminal)\b/i.test(s))return t||null;if(/\b(write|edit|save|create)\b/i.test(s)){const a=t.match(/(?:file_path|path|file)["\s:=]+([^\s",}]+)/i);return a?`${a[1]}
|
|
27
|
-
${t.slice(0,200)}`:t.slice(0,200)||null}return t&&t.length>0?t.length>200?`${t.slice(0,200)}...`:t:null}const jE=["openai-chat-completions","openai-completions","openai-responses","anthropic-messages"];jk.map(s=>s.eventType);function Hk(){return`err-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}const ki=Ut(s=>({errors:[],push:(t,a,r,o)=>{const c=Hk(),u={id:c,level:t,title:a,detail:r,action:o,timestamp:Date.now(),dismissed:!1};return s(f=>({errors:[...f.errors.slice(-49),u]})),c},dismiss:t=>s(a=>({errors:a.errors.map(r=>r.id===t?{...r,dismissed:!0}:r)})),clearAll:()=>s({errors:[]})})),ut={info:(s,t)=>ki.getState().push("info",s,t),warn:(s,t)=>ki.getState().push("warning",s,t),error:(s,t)=>ki.getState().push("error",s,t),critical:(s,t)=>ki.getState().push("critical",s,t)},Lr=20,$k=()=>{const s=window.location.protocol==="https:"?"wss:":"ws:",t=window.location.hostname,a=window.location.port,r=a?String(Number(a)+1):"",o=r?`${t}:${r}`:t;return`${s}//${o}/ws`},Ik=$k(),ry="dscode_client_id";function Pk(){try{const s=localStorage.getItem(ry);if(s)return s;const t=`web-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,10)}`;return localStorage.setItem(ry,t),t}catch{return`web-${Math.random().toString(36).slice(2,10)}`}}class Gk{constructor(t){Ge(this,"ws",null);Ge(this,"url");Ge(this,"clientId",Pk());Ge(this,"messageHandlers",new Set);Ge(this,"openHandlers",new Set);Ge(this,"closeHandlers",new Set);Ge(this,"errorHandlers",new Set);Ge(this,"reconnectAttempts",0);Ge(this,"reconnectHandlers",new Set);Ge(this,"reconnectSuccessHandlers",new Set);Ge(this,"reconnectGiveUpHandlers",new Set);Ge(this,"isManualClose",!1);Ge(this,"authenticated",!1);Ge(this,"sessionId",null);Ge(this,"heartbeatInterval",null);Ge(this,"reconnectTimer",null);Ge(this,"lastPongTime",0);Ge(this,"HEARTBEAT_INTERVAL",15e3);Ge(this,"HEARTBEAT_TIMEOUT",45e3);this.url=t||Ik}setSessionId(t){this.sessionId=t}getSessionId(){return this.sessionId}getReconnectState(){var t;return{attempts:this.reconnectAttempts,maxAttempts:Lr,reconnecting:this.reconnectAttempts>0&&((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN}}onReconnectAttempt(t){return this.reconnectHandlers.add(t),()=>this.reconnectHandlers.delete(t)}onReconnectSuccess(t){return this.reconnectSuccessHandlers.add(t),()=>this.reconnectSuccessHandlers.delete(t)}onReconnectGiveUp(t){return this.reconnectGiveUpHandlers.add(t),()=>this.reconnectGiveUpHandlers.delete(t)}connect(){var r,o;if(((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN||((o=this.ws)==null?void 0:o.readyState)===WebSocket.CONNECTING)return;this.isManualClose=!1;const t=new URLSearchParams;this.sessionId&&t.set("sessionId",this.sessionId),t.set("clientId",this.clientId);const a=t.toString()?`${this.url}?${t.toString()}`:this.url;this.ws=new WebSocket(a),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{var u;console.log("WebSocket connected");const c=this.reconnectAttempts>0;this.reconnectAttempts=0,this.lastPongTime=Date.now(),c&&this.reconnectSuccessHandlers.forEach(f=>f()),((u=this.ws)==null?void 0:u.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"ping"})),this.startHeartbeat(),this.openHandlers.forEach(f=>f())},this.ws.onclose=()=>{console.log("WebSocket closed"),this.stopHeartbeat(),this.closeHandlers.forEach(c=>c()),this.isManualClose||this.scheduleReconnect()},this.ws.onerror=c=>{ut.error("WebSocket connection error",c.message||"Connection failed"),this.errorHandlers.forEach(u=>u())},this.ws.onmessage=c=>{this._onMessage(c)}}async _onMessage(t){var a,r;try{let o;if(t.data instanceof Blob?o=await t.data.text():t.data instanceof ArrayBuffer?o=new TextDecoder().decode(t.data):typeof t.data=="string"?o=t.data:o=String(t.data),o=o.trim(),!o)return;const c=JSON.parse(o);if(console.log("[WS←]",c.type,c.sessionId,JSON.stringify(c.data||c.message||"").slice(0,200)),(c.type==="pong"||c.type==="ping")&&(this.lastPongTime=Date.now(),c.type==="pong"))return;c.seq!==void 0&&c.seq>=0&&this.send({type:"message_ack",data:JSON.stringify({seq:c.seq})}),this.messageHandlers.forEach(u=>u(c))}catch(o){const c=((r=(a=t.data)==null?void 0:a.constructor)==null?void 0:r.name)||typeof t.data;let u;if(t.data instanceof Blob?u=`[Blob ${t.data.size} bytes]`:t.data instanceof ArrayBuffer?u=`[ArrayBuffer ${t.data.byteLength} bytes]`:u=String(t.data).slice(0,500),typeof t.data=="string"&&t.data.trim()){const f=t.data.trim();try{this.messageHandlers.forEach(m=>m({type:"log",data:JSON.stringify({level:"info",message:f})}));return}catch{}}ut.error("Failed to parse WebSocket message",`type=${c} data=${u} error=${o}`)}}startHeartbeat(){this.stopHeartbeat(),this.lastPongTime=Date.now(),this.heartbeatInterval=setInterval(()=>{var t,a;if(Date.now()-this.lastPongTime>this.HEARTBEAT_TIMEOUT){console.warn("[WS] Heartbeat timeout, reconnecting..."),this.stopHeartbeat(),this.isManualClose=!0,(t=this.ws)==null||t.close(),this.ws=null,this.scheduleReconnect();return}((a=this.ws)==null?void 0:a.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>Lr){console.error(`[WS] Max reconnect attempts (${Lr}) reached — giving up.`),ut.error("WebSocket",`Connection lost — max reconnect attempts (${Lr}) reached. Refresh the page to try again.`),this.reconnectGiveUpHandlers.forEach(o=>o());return}const t=Math.min(3e3*Math.pow(2,this.reconnectAttempts),3e4),a=Math.random()*1e3-500,r=Math.max(100,Math.round(t+a));console.log(`[WS] Reconnecting... Attempt ${this.reconnectAttempts}, delay=${r}ms`),this.reconnectHandlers.forEach(o=>o(this.reconnectAttempts,Lr)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},r)}disconnect(){var t;this.isManualClose=!0,this.reconnectAttempts=0,this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null}send(t){var a,r;if(((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN){const o=JSON.stringify(t);console.log("[WS→]",t.type,t.sessionId,o.slice(0,200)),this.ws.send(o)}else console.warn("[WS] NOT CONNECTED — dropping:",t.type,t.sessionId,"readyState=",(r=this.ws)==null?void 0:r.readyState)}onMessage(t){return this.messageHandlers.add(t),()=>this.messageHandlers.delete(t)}onOpen(t){return this.openHandlers.add(t),()=>this.openHandlers.delete(t)}onClose(t){return this.closeHandlers.add(t),()=>this.closeHandlers.delete(t)}onError(t){return this.errorHandlers.add(t),()=>this.errorHandlers.delete(t)}get isConnected(){var t;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN}setToken(t){try{sessionStorage.setItem("auth_token",t)}catch{}}get isAuthenticated(){return this.authenticated}setAuthenticated(t){this.authenticated=t}}const ge=new Gk;function ly(s,t){return`ext:${s}:${t.toLowerCase()}`}const ys=Ut()(Na((s,t)=>({pendingApprovals:[],autoMode:!1,sessionAllowList:[],showConfigHint:!0,addApproval:a=>s(r=>({pendingApprovals:[...r.pendingApprovals,a]})),removeApproval:a=>s(r=>({pendingApprovals:r.pendingApprovals.filter(o=>o.approvalId!==a)})),clearApprovals:()=>s({pendingApprovals:[]}),setAutoMode:a=>s({autoMode:a}),addToSessionAllowList:(a,r)=>s(o=>{const c=r?ly(a,r):a;return o.sessionAllowList.includes(c)?o:{sessionAllowList:[...o.sessionAllowList,c]}}),isSessionAllowed:(a,r)=>{const o=t().sessionAllowList;return r?o.includes(ly(a,r)):o.includes(a)},setShowConfigHint:a=>s({showConfigHint:a})}),{name:"deepseekcode-hook-approval",partialize:s=>({autoMode:s.autoMode,showConfigHint:s.showConfigHint})}));function Fk(s){if(!s)return 0;const t=(s.match(/[\u4e00-\u9fff]/g)||[]).length,a=s.length-t;return Math.ceil(t*1.5+a*.25)}const Fe=Ut((s,t)=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},maxContextTokens:1e6,degradation:null,compactingUntil:0,lastCompactInfo:null,compactionProgress:null,cacheStats:null,showTokenInfo:!1,model:"",history:[],_hasBackendData:!1,tokenRate:0,sessionBaseTotal:0,workflowTokens:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,retryState:null,contextBreakdown:null,setContextDistribution:a=>s({contextDistribution:a}),setContextBreakdown:a=>s({contextBreakdown:a}),setThresholdWarning:a=>s({thresholdWarning:a}),setRetryState:a=>s({retryState:a}),updateUsage:a=>s(r=>{const o=a.totalTokens??r.currentUsage.totalTokens,c=Date.now(),u=r._lastTotal,f=r._lastTotalTs;let m=r.tokenRate;if(f>0&&u>0&&c>f&&o>u){const g=o-u,y=(c-f)/1e3,b=g/y;m=m>0?m*.6+b*.4:b}return{currentUsage:{...r.currentUsage,...a},_hasBackendData:!0,tokenRate:m,_lastTotal:o,_lastTotalTs:c}}),setModel:a=>s({model:a}),addWorkflowTokens:a=>s(r=>({workflowTokens:r.workflowTokens+(Number(a)||0)})),setMaxContextTokens:a=>s({maxContextTokens:a}),setDegradation:a=>s({degradation:a}),setCompacting:a=>s({compactingUntil:Date.now()+3e3,lastCompactInfo:a}),setCompactionProgress:a=>s({compactionProgress:a}),setCacheStats:a=>s({cacheStats:a}),accumulateCacheStats:(a,r)=>s(o=>{const c=o.cacheStats,u=((c==null?void 0:c.cacheHitTokens)??0)+a,f=((c==null?void 0:c.cacheMissTokens)??0)+r;return{cacheStats:{cacheHitTokens:u,cacheMissTokens:f,cacheHitRate:u+f>0?u/(u+f):void 0,cacheStatsCalls:((c==null?void 0:c.cacheStatsCalls)??0)+1}}}),setShowTokenInfo:a=>s({showTokenInfo:a}),addToHistory:a=>s(r=>({history:[...r.history.slice(-100),{timestamp:Date.now(),usage:a}]})),estimateTokens:a=>Fk(a),recalculateFromMessages:a=>{if(!a||a.length===0){s({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1});return}const r=t().estimateTokens;let o=0,c=0;for(const m of a){let g=m.content||"";if(m.thinking&&(g+=" "+m.thinking),m.steps)for(const b of m.steps)b.thought&&(g+=" "+b.thought),b.action&&(g+=" "+b.action),b.result&&(g+=" "+b.result);if(m.toolCalls)for(const b of m.toolCalls)b.args&&(g+=" "+(typeof b.args=="string"?b.args:JSON.stringify(b.args)));const y=r(g);m.type==="user"?o+=y:c+=y}const u=o+c,f=o/1e6*.15+c/1e6*.6;s({currentUsage:{promptTokens:o,completionTokens:c,totalTokens:u,estimatedCost:f}})},resetUsage:()=>s(a=>({currentUsage:{promptTokens:0,completionTokens:0,totalTokens:0,estimatedCost:0},_hasBackendData:!1,sessionBaseTotal:a.currentUsage.totalTokens,workflowTokens:0,tokenRate:0,_lastTotal:0,_lastTotalTs:0,contextDistribution:null,thresholdWarning:null,contextBreakdown:null}))})),mb="";function Ho(s){return`${mb}${s}`}class qk{constructor(t){Ge(this,"baseUrl");this.baseUrl=t}async request(t,a={}){try{const r=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token"),o={"Content-Type":"application/json",...a.headers};r&&(o.Authorization=`Bearer ${r}`);const c=await fetch(`${this.baseUrl}${t}`,{headers:o,...a}),u=await c.json();return c.ok?u&&typeof u.success=="boolean"?{success:u.success,data:u.data,error:u.error}:{success:!0,data:u}:{success:!1,error:u.error||`HTTP ${c.status}`,data:u.data}}catch(r){return{success:!1,error:r instanceof Error?r.message:"Network error"}}}get(t){return this.request(t,{method:"GET"})}post(t,a){return this.request(t,{method:"POST",body:a?JSON.stringify(a):void 0})}put(t,a){return this.request(t,{method:"PUT",body:a?JSON.stringify(a):void 0})}delete(t,a){return this.request(t,{method:"DELETE",body:a?JSON.stringify(a):void 0})}patch(t,a){return this.request(t,{method:"PATCH",body:a?JSON.stringify(a):void 0})}}const I=new qk(mb),ze={providers:{presets:()=>I.get("/api/providers/presets"),refresh:()=>I.post("/api/providers/refresh")},models:{list:async()=>{var t;const s=await I.get("/api/models");return s.success&&((t=s.data)!=null&&t.models)&&(s.data.models=s.data.models.map(a=>({...a,isGlobalDefault:a.isDefault===!0,isPlanDefault:a.defaultFor==="plan",isActDefault:a.defaultFor==="act",isGoalDefault:a.defaultFor==="goal"}))),s},get:s=>I.get(`/api/models/${s}`),create:s=>I.post("/api/models",s),update:(s,t,a)=>I.post("/api/models/update",{provider:s,modelId:t,...a}),delete:(s,t)=>I.post("/api/models/delete",{provider:s,modelId:t}),test:s=>I.post(`/api/models/${s}/test`),fetch:(s,t)=>I.post("/api/models/fetch",{baseUrl:s,apiKey:t}),catalogSearch:s=>{const t=new URLSearchParams;s.q&&t.set("q",s.q),s.toolCall&&t.set("toolCall","1"),s.reasoning&&t.set("reasoning","1"),s.minContext&&t.set("minContext",String(s.minContext)),s.limit&&t.set("limit",String(s.limit));const a=t.toString();return I.get(`/api/models/catalog${a?`?${a}`:""}`)},toggle:(s,t)=>I.post("/api/models/toggle",{provider:s,modelId:t}),setDefaults:s=>I.post("/api/models/defaults",s)},tools:{list:()=>I.get("/api/tools"),get:s=>I.get(`/api/tools/${s}`),update:(s,t)=>I.put(`/api/tools/${s}`,t),toggle:(s,t)=>I.post(`/api/tools/${s}/toggle`,{enabled:t})},connectors:{list:()=>I.get("/api/connectors"),get:s=>I.get(`/api/connectors/${encodeURIComponent(s)}`),toggle:(s,t,a)=>I.post(`/api/connectors/${encodeURIComponent(s)}/toggle`,{enabled:t,env:a}),addCustom:s=>I.post("/api/connectors/custom",s),removeCustom:s=>I.delete(`/api/connectors/custom/${encodeURIComponent(s)}`)},skills:{list:()=>I.get("/api/skills"),get:s=>I.get(`/api/skills/${s}`),create:s=>I.post("/api/skills",s),update:(s,t)=>I.put(`/api/skills/${s}`,t),toggle:(s,t)=>I.post(`/api/skills/${s}/toggle`,{enabled:t}),delete:s=>I.delete(`/api/skills/${s}`),import:s=>I.post("/api/skills/import",s),marketplaces:{list:()=>I.get("/api/skills/marketplaces"),add:s=>I.post("/api/skills/marketplaces",s),remove:s=>I.delete(`/api/skills/marketplaces/${s}`),get:s=>I.get(`/api/skills/marketplaces/${s}`),refresh:s=>I.post(`/api/skills/marketplaces/${s}/refresh`,{}),install:(s,t)=>I.post(`/api/skills/marketplaces/${s}/install`,{skillId:t})}},files:{list:s=>I.get(`/api/files${s?`?path=${encodeURIComponent(s)}`:""}`),read:s=>I.get(`/api/files/read?path=${encodeURIComponent(s)}`),create:(s,t)=>I.post("/api/files",{path:s,content:t}),update:(s,t)=>I.put("/api/files/write",{path:s,content:t}),delete:s=>I.delete(`/api/files?path=${encodeURIComponent(s)}`),download:async s=>{try{const t={},a=sessionStorage.getItem("auth_token")??localStorage.getItem("auth_token");a&&(t.Authorization=`Bearer ${a}`);const r=await fetch(Ho(`/api/files/download?path=${encodeURIComponent(s)}`),{headers:t});if(!r.ok){let f=`HTTP ${r.status}`;try{const m=await r.json();m!=null&&m.error&&(f=m.error)}catch{}return{success:!1,error:f}}const o=await r.blob(),c=URL.createObjectURL(o),u=document.createElement("a");return u.href=c,u.download=s.split(/[\\/]/).pop()||"download",u.click(),URL.revokeObjectURL(c),{success:!0}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Download failed"}}},upload:async(s,t)=>{try{const a=await Vk(s);return I.post("/api/files/upload",{path:t,content:a,base64:!0})}catch(a){return{success:!1,error:a instanceof Error?a.message:"Upload failed"}}}},dirs:{list:s=>I.get(`/api/dirs${s?`?path=${encodeURIComponent(s)}`:""}`)},sessions:{list:()=>I.get("/api/sessions"),get:s=>I.get(`/api/sessions/${s}`),create:s=>I.post("/api/sessions",{title:s}),delete:s=>I.delete(`/api/sessions/${s}`),resume:s=>I.get(`/api/sessions/${encodeURIComponent(s)}/resume`)},tasks:{list:s=>I.get(s?`/api/tasks?sessionId=${encodeURIComponent(s)}`:"/api/tasks"),get:s=>I.get(`/api/tasks/${s}`),create:s=>I.post("/api/tasks",s),update:(s,t)=>I.put(`/api/tasks/${s}`,t),updateStatus:(s,t)=>I.patch(`/api/tasks/${s}/status`,{status:t}),delete:s=>I.delete(`/api/tasks/${s}`),clearCompleted:()=>I.delete("/api/tasks")},config:{provider:{get:()=>I.get("/api/config/provider"),save:s=>I.post("/api/config/provider",s),delete:s=>I.post("/api/config/provider/remove",{provider:s}),setDefault:s=>I.post("/api/config/provider",{provider:s,setDefault:!0})},files:{list:()=>I.get("/api/config/files"),read:s=>I.get(`/api/config/files/read?file=${encodeURIComponent(s)}`),write:(s,t)=>I.put("/api/config/files/write",{file:s,content:t})}},git:{status:()=>I.get("/api/git/status"),branches:()=>I.get("/api/git/branches"),commit:s=>I.post("/api/git/commit",s),push:()=>I.post("/api/git/push"),checkout:s=>I.post("/api/git/checkout",{branch:s}),prStatus:()=>I.get("/api/repos/pr")},fileJob:{parse:s=>I.post("/api/filejob/parse",{files:s}),parsePaths:s=>I.post("/api/filejob/parse",{paths:s}),importPaths:s=>I.post("/api/filejob/import",{paths:s}),render:s=>I.post("/api/filejob/render",s)},system:{status:()=>I.get("/api/system/status"),restart:()=>I.post("/api/system/restart"),shutdown:()=>I.post("/api/system/shutdown")},observability:{summary:()=>I.get("/api/observability/summary"),costs:()=>I.get("/api/observability/costs"),listRuns:()=>I.get("/api/observability/runs"),getRun:s=>I.get(`/api/observability/runs/${encodeURIComponent(s)}`),getRunEvents:(s,t=0,a=50)=>I.get(`/api/observability/runs/${encodeURIComponent(s)}/events?page=${t}&size=${a}`)},templates:{list:()=>I.get("/api/templates"),get:s=>I.get(`/api/templates/${encodeURIComponent(s)}`),create:s=>I.post("/api/templates",s),update:(s,t)=>I.put(`/api/templates/${encodeURIComponent(s)}`,t),remove:s=>I.delete(`/api/templates/${encodeURIComponent(s)}`),versions:s=>I.get(`/api/templates/${encodeURIComponent(s)}/versions`),getVersion:(s,t)=>I.get(`/api/templates/${encodeURIComponent(s)}/versions/${t}`),render:(s,t)=>I.post(`/api/templates/${encodeURIComponent(s)}/render`,{inputs:t}),createFromRun:(s,t)=>I.post("/api/templates",{sourceRunId:s,generalize:(t==null?void 0:t.generalize)===!0,name:t==null?void 0:t.name,message:t==null?void 0:t.message})},workflows:{list:()=>I.get("/api/workflows"),start:s=>I.post("/api/workflows",s),get:s=>I.get(`/api/workflows/${encodeURIComponent(s)}`),synthesize:s=>I.post("/api/workflows/synthesize",{message:s})},plans:{list:()=>I.get("/api/plans"),read:s=>I.get(`/api/plans/${encodeURIComponent(s)}`),delete:s=>I.delete(`/api/plans/${encodeURIComponent(s)}`)},logs:{list:()=>I.get("/api/logs"),read:(s,t)=>I.get(`/api/logs/read?file=${encodeURIComponent(s)}${t?`&maxLines=${t}`:""}`),downloadUrl:s=>`/api/logs/download?file=${encodeURIComponent(s)}`},stt:{status:()=>I.get("/api/stt/status"),transcribe:(s,t,a="wav")=>I.post("/api/stt/transcribe",{language:s,audio:t,format:a}),install:s=>I.post("/api/stt/install",{backend:s}),installStatus:()=>I.get("/api/stt/install/status"),cancelInstall:()=>I.post("/api/stt/install/cancel")},hooks:{list:()=>I.get("/api/hooks/rules"),get:s=>I.get(`/api/hooks/rules/${encodeURIComponent(s)}`),create:s=>I.post("/api/hooks/rules",s),update:(s,t)=>I.put(`/api/hooks/rules/${encodeURIComponent(s)}`,t),delete:s=>I.delete(`/api/hooks/rules/${encodeURIComponent(s)}`),batchDelete:s=>I.post("/api/hooks/rules/batch-delete",{names:s}),toggle:(s,t)=>I.patch(`/api/hooks/rules/${encodeURIComponent(s)}/toggle`,{enabled:t}),batchToggle:(s,t)=>I.post("/api/hooks/rules/batch-toggle",{names:s,enabled:t}),dryRun:s=>I.post("/api/hooks/dry-run",s),stats:()=>I.get("/api/hooks/stats"),events:()=>I.get("/api/hooks/events"),agents:()=>I.get("/api/hooks/agents"),export:()=>I.get("/api/hooks/export"),import:s=>I.post("/api/hooks/import",s)},channels:{list:()=>I.get("/api/channels"),create:s=>I.post("/api/channels",s),update:(s,t)=>I.put(`/api/channels/${encodeURIComponent(s)}`,t),delete:s=>I.delete(`/api/channels/${encodeURIComponent(s)}`),toggle:(s,t)=>I.patch(`/api/channels/${encodeURIComponent(s)}/toggle`,{enabled:t}),test:s=>I.post(`/api/channels/${encodeURIComponent(s)}/test`),wechat:{qrcode:(s,t)=>I.get(`/api/channels/${encodeURIComponent(s)}/wechat/qrcode?token=${encodeURIComponent(t)}`),qrcodeStatus:(s,t,a)=>I.get(`/api/channels/${encodeURIComponent(s)}/wechat/qrcode/status?token=${encodeURIComponent(t)}&qrcode=${encodeURIComponent(a)}`)},weixin:{bind:()=>I.get("/api/weixin/bind"),bindStatus:s=>I.get(`/api/weixin/bind/status?qrcode=${encodeURIComponent(s)}`)}},inbox:{list:s=>I.get(`/api/inbox?${new URLSearchParams(s).toString()}`),stats:()=>I.get("/api/inbox/stats"),resolve:(s,t)=>I.post(`/api/inbox/${encodeURIComponent(s)}/resolve`,{resolution:t})},audit:{query:s=>I.get(`/api/audit?${new URLSearchParams(Object.fromEntries(Object.entries(s||{}).map(([t,a])=>[t,String(a)]))).toString()}`),stats:()=>I.get("/api/audit/stats")},automations:{list:()=>I.get("/api/automations"),create:s=>I.post("/api/automations",s),update:(s,t)=>I.put(`/api/automations/${encodeURIComponent(s)}`,t),remove:s=>I.delete(`/api/automations/${encodeURIComponent(s)}`),toggle:(s,t)=>I.post(`/api/automations/${encodeURIComponent(s)}/toggle`,{enabled:t}),run:s=>I.post(`/api/automations/${encodeURIComponent(s)}/run`),runs:s=>I.get(`/api/automations/${encodeURIComponent(s)}/runs`),addPermission:(s,t,a)=>I.post(`/api/automations/${encodeURIComponent(s)}/permissions`,{tool:t,target:a}),revokePermission:(s,t)=>I.delete(`/api/automations/${encodeURIComponent(s)}/permissions`,{entry:t})}};function Vk(s){return new Promise((t,a)=>{const r=new FileReader;r.onload=()=>{const o=r.result,c=o.indexOf(",");t(c>=0?o.slice(c+1):o)},r.onerror=()=>a(r.error||new Error("Failed to read file")),r.readAsDataURL(s)})}const wd=s=>s==="normal"?"act":s;let Ro=0;const Wk=s=>s==="normal"?"normal":s==="auto"?"auto-act":Bk(typeof s=="string"?s:void 0),zr=s=>s==="normal"?"act":Si(s)?"auto":Cn(s),Qr=Ut()(Na((s,t)=>({mode:"act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null,setMode:a=>{const r=t().mode;if(r===a)return;s(g=>({mode:a,modeHistory:[...g.modeHistory,{previousMode:r,newMode:a,description:`Mode changed: ${r} -> ${a}`,timestamp:Date.now()}]})),ys.getState().setAutoMode(a!=="normal"&&Si(a));const o=zr(r),c=zr(a),u=r==="normal"?"act":Cn(r),f=a==="normal"?"act":Cn(a);if(u===f&&o===c)return;try{const g=we.getState().activeSessionId||ge.getSessionId();g&&ge.send({type:"plan_mode_change",sessionId:g,data:JSON.stringify({previousMode:zr(r),newMode:zr(a),frontendMode:a,timestamp:Date.now()})})}catch(g){console.warn("[ExecutionModeStore] Failed to notify mode change via WS:",g)}const m=++Ro;ze.models.list().then(g=>{var C,E;if(m!==Ro||!g.success||!((C=g.data)!=null&&C.models))return;const y=g.data.models.filter(O=>O.enabled!==!1),b=Cn(wd(a)),v=y.find(O=>O.defaultFor===b),S=y.find(O=>O.isDefault||O.defaultFor==="global"),k=(v==null?void 0:v.id)||(S==null?void 0:S.id)||((E=y[0])==null?void 0:E.id)||"";k&&Fe.getState().setModel(k)}).catch(g=>{console.warn("[ExecutionModeStore] Failed to refresh models:",g)})},applyBackendMode:a=>{const r=t().mode;if(r===a)return;s(c=>({mode:a,prePlanMode:a!=="plan"?null:c.prePlanMode,modeHistory:[...c.modeHistory,{previousMode:r,newMode:a,description:`Backend mode changed: ${r} -> ${a}`,timestamp:Date.now()}]})),ys.getState().setAutoMode(a!=="normal"&&Si(a));const o=++Ro;ze.models.list().then(c=>{var b,v;if(o!==Ro||!c.success||!((b=c.data)!=null&&b.models))return;const u=c.data.models.filter(S=>S.enabled!==!1),f=Cn(wd(a)),m=u.find(S=>S.defaultFor===f),g=u.find(S=>S.isDefault||S.defaultFor==="global"),y=(m==null?void 0:m.id)||(g==null?void 0:g.id)||((v=u[0])==null?void 0:v.id)||"";y&&Fe.getState().setModel(y)}).catch(c=>{console.warn("[ExecutionModeStore] Failed to refresh models after backend mode change:",c)})},toggleMode:()=>{const a=t().mode,r=a==="normal"?"act":Ok(a);t().setMode(r)},setBaseMode:a=>{const r=t().mode,o=r!=="normal"&&Si(r);t().setMode(rf(a,o))},setAuto:a=>{t().setMode(rf(Cn(wd(t().mode)),a))},toggleAuto:()=>{const a=t().mode;t().setMode(a==="normal"?"auto-act":Rk(a))},enterPlanMode:(a,r)=>{const o=t().mode,c=o!=="normal"&&Cn(o)!=="plan"?o:t().prePlanMode,u=o!=="normal"&&Cn(o)==="goal"?"goal":"plan";s(f=>({mode:u,prePlanMode:c,modeHistory:[...f.modeHistory,{previousMode:o,newMode:u,description:`Enter ${u} mode: ${r}`,timestamp:Date.now()}]})),ys.getState().setAutoMode(!1)},exitPlanMode:(a,r)=>{const o=t().mode,c=t().prePlanMode,u=c&&(c==="normal"||Cn(c)!=="plan")?c:"act";s(f=>({mode:u,prePlanMode:null,modeHistory:[...f.modeHistory,{previousMode:o,newMode:u,description:`Exit to ${u} mode: ${r}`,timestamp:Date.now()}]})),ys.getState().setAutoMode(u!=="normal"&&Si(u))},enterGoalMode:(a,r)=>{const o=t().mode;s(c=>({mode:"goal",modeHistory:[...c.modeHistory,{previousMode:o,newMode:"goal",description:`Enter Goal mode: ${r}`,timestamp:Date.now()}]})),ys.getState().setAutoMode(!1);try{const c=we.getState().activeSessionId||ge.getSessionId()||void 0;ge.send({type:"plan_mode_change",sessionId:c,data:JSON.stringify({previousMode:zr(o),newMode:"goal",frontendMode:"goal",goalDescription:r,timestamp:Date.now()})})}catch(c){console.warn("[ExecutionModeStore] Failed to notify goal mode change via WS:",c)}},exitGoalMode:()=>{const a=t().mode;s(r=>({mode:"act",modeHistory:[...r.modeHistory,{previousMode:a,newMode:"act",description:"Exit Goal mode",timestamp:Date.now()}]})),ys.getState().setAutoMode(!1)},setPlanContent:a=>s({currentPlanContent:a}),setThinkingStatus:(a,r)=>s(o=>({thinkingStatusBySession:{...o.thinkingStatusBySession,[a]:r}})),getThinkingStatus:a=>t().thinkingStatusBySession[a]||"",reset:()=>s({mode:"act",currentPlanContent:null,modeHistory:[],thinkingStatusBySession:{},prePlanMode:null})}),{name:"deepseekcode-plan-storage",version:1,migrate:s=>s,merge:(s,t)=>{const a=s??{};return{...t,...a,mode:Wk(a.mode)}},partialize:s=>({mode:s.mode,currentPlanContent:s.currentPlanContent,modeHistory:s.modeHistory})}));function gb(s){var t,a,r="";if(typeof s=="string"||typeof s=="number")r+=s;else if(typeof s=="object")if(Array.isArray(s)){var o=s.length;for(t=0;t<o;t++)s[t]&&(a=gb(s[t]))&&(r&&(r+=" "),r+=a)}else for(a in s)s[a]&&(r&&(r+=" "),r+=a);return r}function Kk(){for(var s,t,a=0,r="",o=arguments.length;a<o;a++)(s=arguments[a])&&(t=gb(s))&&(r&&(r+=" "),r+=t);return r}function pt(...s){return Kk(s)}const _d=200,oy=(s,t)=>({runId:t,sessionId:s,status:"RUNNING",completedPhases:0,totalPhases:0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,updatedAt:Date.now()}),Ln=()=>Date.now(),Yn=(s,t)=>{const a=String(s||"").toLowerCase();return t||a==="done"||a==="success"||a==="completed"||a==="complete"?"completed":a==="running"||a==="in_progress"||a==="started"?"running":a==="failed"||a==="error"?"failed":a==="skipped"||a==="cancelled"||a==="canceled"?"skipped":"pending"},cy=s=>s.id||`${s.type||"event"}-${s.timestamp||Ln()}-${Math.random().toString(36).slice(2,8)}`;function Cd(s){if(!Array.isArray(s)||s.length===0)return{totalPhases:0,completedNodes:0};const t=s.length,a=s.filter(r=>r.status==="completed"||r.status==="skipped"||r.status==="failed").length;return{totalPhases:t,completedNodes:a}}const Qe=Ut()(Na((s,t)=>({bySession:{},byRun:{},agentsBySession:{},tasksBySession:{},eventsBySession:{},plansBySession:{},upsert:(a,r)=>s(o=>{const c=r.runId,u=o.byRun[c]||o.bySession[a]||oy(a,c),f={...u.agentNodes||{}};r.agentNode&&(f[r.agentNode.nodeId]=r.agentNode);const{agentNode:m,...g}=r,y={...u,...g,agentNodes:f,sessionId:a,runId:c,updatedAt:Ln()},b={...o.agentsBySession[a]||{}};m&&(b[m.nodeId]={...b[m.nodeId]||{},id:m.nodeId,sessionId:a,name:m.role,role:m.role,source:"workflow",runId:c,phase:m.phase,status:m.status,tokens:m.tokens,error:m.error,updatedAt:m.updatedAt||Ln()});const v=r.lastEventType||r.status||"workflow_update",k=[{id:cy({type:v}),sessionId:a,type:v,source:"workflow",timestamp:Ln(),status:y.status,runId:c,agentId:m==null?void 0:m.nodeId,message:y.error,data:g},...o.eventsBySession[a]||[]].slice(0,_d);return{bySession:{...o.bySession,[a]:y},byRun:{...o.byRun,[c]:y},agentsBySession:{...o.agentsBySession,[a]:b},eventsBySession:{...o.eventsBySession,[a]:k}}}),fail:(a,r,o)=>t().upsert(a,{runId:r,status:"ERROR",error:o,lastEventType:"workflow_error"}),getForSession:a=>t().bySession[a],setPlan:(a,r)=>s(o=>({plansBySession:{...o.plansBySession,[a]:r}})),clearPlan:a=>s(r=>{if(!r.plansBySession[a])return{};const o={...r.plansBySession};return delete o[a],{plansBySession:o}}),getPlanForSession:a=>t().plansBySession[a],setNodes:(a,r,o)=>s(c=>{const u=c.byRun[r],f=u||c.bySession[a]||oy(a,r),m=o.map(v=>{var S;return((S=f.nodes)==null?void 0:S.find(k=>k.id===v.id))||v}),{totalPhases:g,completedNodes:y}=Cd(m),b={...f,runId:r,sessionId:a,nodes:m,totalPhases:g||f.totalPhases,completedPhases:u?y||f.completedPhases:y,updatedAt:Ln()};return{bySession:{...c.bySession,[a]:b},byRun:{...c.byRun,[r]:b}}}),setNodeStatus:(a,r,o,c)=>s(u=>{const f=u.byRun[r],m=f||u.bySession[a];if(!m)return{};const g=(m.nodes||[]).map(S=>S.id===o?{...S,...c}:S),{totalPhases:y,completedNodes:b}=Cd(g),v={...m,nodes:g,totalPhases:y||m.totalPhases,completedPhases:f?b||m.completedPhases:b,updatedAt:Ln()};return{bySession:{...u.bySession,[a]:v},byRun:{...u.byRun,[r]:v}}}),finalizeNodes:(a,r,o)=>s(c=>{const u=c.byRun[r]||c.bySession[a];if(!u||!Array.isArray(u.nodes))return{};const f=u.nodes.map(b=>b.status==="pending"||b.status==="ready"||b.status==="blocked"?{...b,status:"skipped"}:b),{totalPhases:m,completedNodes:g}=Cd(f),y={...u,nodes:f,completedPhases:g||u.completedPhases,totalPhases:m||u.totalPhases,updatedAt:Ln()};return{bySession:{...c.bySession,[a]:y},byRun:{...c.byRun,[r]:y}}}),upsertAgent:(a,r)=>s(o=>{var f;const c=(f=o.agentsBySession[a])==null?void 0:f[r.id],u={id:r.id,sessionId:a,name:r.name||r.role||(c==null?void 0:c.name)||r.id,role:r.role||(c==null?void 0:c.role)||r.name||r.id,source:r.source||(c==null?void 0:c.source)||"agent",status:r.status||(c==null?void 0:c.status)||"idle",runId:r.runId??(c==null?void 0:c.runId),phase:r.phase??(c==null?void 0:c.phase),taskId:r.taskId??(c==null?void 0:c.taskId),currentTask:r.currentTask??(c==null?void 0:c.currentTask),tokens:r.tokens??(c==null?void 0:c.tokens),error:r.error??(c==null?void 0:c.error),updatedAt:r.updatedAt||Ln()};return{agentsBySession:{...o.agentsBySession,[a]:{...o.agentsBySession[a]||{},[r.id]:u}}}}),upsertTask:(a,r)=>s(o=>{var g;const c=(g=o.tasksBySession[a])==null?void 0:g[r.id],u=Ln(),f=r.status||(c==null?void 0:c.status)||"pending",m={id:r.id,sessionId:a,title:r.title||(c==null?void 0:c.title)||r.description||r.id,status:f,source:r.source||(c==null?void 0:c.source)||"task",description:r.description??(c==null?void 0:c.description),agentType:r.agentType??(c==null?void 0:c.agentType),progress:r.progress??(c==null?void 0:c.progress),result:r.result??(c==null?void 0:c.result),error:r.error??(c==null?void 0:c.error),runId:r.runId??(c==null?void 0:c.runId),dependencies:r.dependencies??(c==null?void 0:c.dependencies),startedAt:r.startedAt??(c==null?void 0:c.startedAt)??(f==="running"?u:void 0),completedAt:r.completedAt??(c==null?void 0:c.completedAt)??(f==="completed"||f==="failed"?u:void 0),createdAt:r.createdAt||(c==null?void 0:c.createdAt)||u,updatedAt:r.updatedAt||u,raw:r.raw??(c==null?void 0:c.raw)};return{tasksBySession:{...o.tasksBySession,[a]:{...o.tasksBySession[a]||{},[r.id]:m}}}}),setTasks:(a,r,o="plan")=>s(c=>{const u=c.tasksBySession[a]||{},f=Object.fromEntries(Object.entries(u).filter(([,y])=>y.source!==o)),m=Ln(),g=Object.fromEntries(r.map((y,b)=>{const v=u[y.id],S=y.status||(v==null?void 0:v.status)||"pending",k={id:y.id,sessionId:a,title:y.title||(v==null?void 0:v.title)||y.description||`Task ${b+1}`,status:S,source:y.source||o,description:y.description??(v==null?void 0:v.description),agentType:y.agentType??(v==null?void 0:v.agentType),progress:y.progress??(v==null?void 0:v.progress),result:y.result??(v==null?void 0:v.result),error:y.error??(v==null?void 0:v.error),runId:y.runId??(v==null?void 0:v.runId),dependencies:y.dependencies??(v==null?void 0:v.dependencies),startedAt:y.startedAt??(v==null?void 0:v.startedAt),completedAt:y.completedAt??(v==null?void 0:v.completedAt),createdAt:y.createdAt||(v==null?void 0:v.createdAt)||m+b,updatedAt:y.updatedAt||m,raw:y.raw??(v==null?void 0:v.raw)};return[k.id,k]}));return{tasksBySession:{...c.tasksBySession,[a]:{...f,...g}}}}),recordEvent:(a,r)=>s(o=>{const c={id:cy(r),sessionId:a,type:r.type,source:r.source||"system",timestamp:r.timestamp||Ln(),title:r.title,message:r.message,status:r.status,runId:r.runId,agentId:r.agentId,taskId:r.taskId,data:r.data};return{eventsBySession:{...o.eventsBySession,[a]:[c,...o.eventsBySession[a]||[]].slice(0,_d)}}}),getAgentsForSession:a=>Object.values(t().agentsBySession[a]||{}).sort((r,o)=>o.updatedAt-r.updatedAt),getTasksForSession:a=>Object.values(t().tasksBySession[a]||{}).sort((r,o)=>{const c={running:0,pending:1,failed:2,completed:3,skipped:4};return c[r.status]-c[o.status]||r.createdAt-o.createdAt}),getEventsForSession:a=>t().eventsBySession[a]||[],getAgentTree:a=>{const r=Object.values(t().agentsBySession[a]||{}),o=new Map(r.map(m=>[m.id,m])),c=r.filter(m=>!m.parentId||!o.has(m.parentId)),u=m=>r.filter(g=>g.parentId===m),f=m=>({agent:m,children:u(m.id).map(f),isRunning:m.status==="running",tokensUsed:m.tokens||0});return c.map(f)},getRunningAgentCount:a=>Object.values(t().agentsBySession[a]||{}).filter(o=>o.status==="running").length}),{name:"deepseekcode-workflow-store",storage:Sf({key:"workflowStore",trims:[s=>({...s,state:{...s.state,eventsBySession:Object.fromEntries(Object.entries(s.state.eventsBySession).map(([t,a])=>[t,a.slice(-50)])),tasksBySession:Object.fromEntries(Object.entries(s.state.tasksBySession).map(([t,a])=>[t,Object.fromEntries(Object.entries(a).map(([r,o])=>[r,{...o,result:o.result?String(o.result).slice(0,1e3):void 0,error:o.error?String(o.error).slice(0,1e3):void 0}]))]))}}),s=>({...s,state:{...s.state,eventsBySession:{}}}),s=>({...s,state:{...s.state,tasksBySession:{},agentsBySession:{}}})],onFailure:()=>{try{Ys.getState().addToast("warning","任务看板数据保存失败:浏览器本地存储已满或不可用。当前数据仅保留在内存中,刷新页面将丢失。",8e3)}catch{}}}),partialize:s=>({bySession:s.bySession,byRun:s.byRun,agentsBySession:s.agentsBySession,plansBySession:s.plansBySession,tasksBySession:Object.fromEntries(Object.entries(s.tasksBySession).map(([t,a])=>[t,Object.fromEntries(Object.entries(a).map(([r,o])=>{const{raw:c,...u}=o;return[r,u]}))])),eventsBySession:Object.fromEntries(Object.entries(s.eventsBySession).map(([t,a])=>[t,a.slice(-_d).map(r=>{const{data:o,...c}=r;return c})]))})}));var Yk=Gv();const Zk=mf(Yk);Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;var uy={},dy;function Qk(){return dy||(dy=1,(function(s){s.languages.typescript=s.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),s.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete s.languages.typescript.parameter,delete s.languages.typescript["literal-property"];var t=s.languages.extend("typescript",{});delete t["class-name"],s.languages.typescript["class-name"].inside=t,s.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),s.languages.ts=s.languages.typescript})(Prism)),uy}Qk();(function(s){var t=s.util.clone(s.languages.javascript),a=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function c(m,g){return m=m.replace(/<S>/g,function(){return a}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return o}),RegExp(m,g)}o=c(o).source,s.languages.jsx=s.languages.extend("markup",t),s.languages.jsx.tag.pattern=c(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),s.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,s.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,s.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,s.languages.jsx.tag.inside.comment=t.comment,s.languages.insertBefore("inside","attr-name",{spread:{pattern:c(/<SPREAD>/.source),inside:s.languages.jsx}},s.languages.jsx.tag),s.languages.insertBefore("inside","special-attr",{script:{pattern:c(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:s.languages.jsx}}},s.languages.jsx.tag);var u=function(m){return m?typeof m=="string"?m:typeof m.content=="string"?m.content:m.content.map(u).join(""):""},f=function(m){for(var g=[],y=0;y<m.length;y++){var b=m[y],v=!1;if(typeof b!="string"&&(b.type==="tag"&&b.content[0]&&b.content[0].type==="tag"?b.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===u(b.content[0].content[1])&&g.pop():b.content[b.content.length-1].content==="/>"||g.push({tagName:u(b.content[0].content[1]),openedBraces:0}):g.length>0&&b.type==="punctuation"&&b.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&b.type==="punctuation"&&b.content==="}"?g[g.length-1].openedBraces--:v=!0),(v||typeof b=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var S=u(b);y<m.length-1&&(typeof m[y+1]=="string"||m[y+1].type==="plain-text")&&(S+=u(m[y+1]),m.splice(y+1,1)),y>0&&(typeof m[y-1]=="string"||m[y-1].type==="plain-text")&&(S=u(m[y-1])+S,m.splice(y-1,1),y--),m[y]=new s.Token("plain-text",S,null,S)}b.content&&typeof b.content!="string"&&f(b.content)}};s.hooks.add("after-tokenize",function(m){m.language!=="jsx"&&m.language!=="tsx"||f(m.tokens)})})(Prism);(function(s){var t=s.util.clone(s.languages.typescript);s.languages.tsx=s.languages.extend("jsx",t),delete s.languages.tsx.parameter,delete s.languages.tsx["literal-property"];var a=s.languages.tsx.tag;a.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.lookbehind=!0})(Prism);(function(s){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var a=s.languages.markup;a&&(a.tag.addInlined("style","css"),a.tag.addAttribute("style","css"))})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(s){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:a,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};s.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},a.inside=s.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],c=r.variable[1].inside,u=0;u<o.length;u++)c[o[u]]=s.languages.bash[o[u]];s.languages.sh=s.languages.bash,s.languages.shell=s.languages.bash})(Prism);var fy={},py;function Xk(){return py||(py=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),fy}Xk();(function(s){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function a(y){return y=y.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+y+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),c=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;s.languages.markdown=s.languages.extend("markup",{}),s.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:s.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+c+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+c+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:s.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+c+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:s.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:a(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:a(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:a(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:a(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(y){["url","bold","italic","strike","code-snippet"].forEach(function(b){y!==b&&(s.languages.markdown[y].inside.content.inside[b]=s.languages.markdown[b])})}),s.hooks.add("after-tokenize",function(y){if(y.language!=="markdown"&&y.language!=="md")return;function b(v){if(!(!v||typeof v=="string"))for(var S=0,k=v.length;S<k;S++){var C=v[S];if(C.type!=="code"){b(C.content);continue}var E=C.content[1],O=C.content[3];if(E&&O&&E.type==="code-language"&&O.type==="code-block"&&typeof E.content=="string"){var j=E.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");j=(/[a-z][\w-]*/i.exec(j)||[""])[0].toLowerCase();var T="language-"+j;O.alias?typeof O.alias=="string"?O.alias=[O.alias,T]:O.alias.push(T):O.alias=[T]}}}b(y.tokens)}),s.hooks.add("wrap",function(y){if(y.type==="code-block"){for(var b="",v=0,S=y.classes.length;v<S;v++){var k=y.classes[v],C=/language-(.+)/.exec(k);if(C){b=C[1];break}}var E=s.languages[b];if(E)y.content=s.highlight(g(y.content),E,b);else if(b&&b!=="none"&&s.plugins.autoloader){var O="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);y.attributes.id=O,s.plugins.autoloader.loadLanguages(b,function(){var j=document.getElementById(O);j&&(j.innerHTML=s.highlight(j.textContent,s.languages[b],b))})}}});var u=RegExp(s.languages.markup.tag.pattern.source,"gi"),f={amp:"&",lt:"<",gt:">",quot:'"'},m=String.fromCodePoint||String.fromCharCode;function g(y){var b=y.replace(u,"");return b=b.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(v,S){if(S=S.toLowerCase(),S[0]==="#"){var k;return S[1]==="x"?k=parseInt(S.slice(2),16):k=Number(S.slice(1)),m(k)}else{var C=f[S];return C||v}}),b}s.languages.md=s.languages.markdown})(Prism);(function(s){var t=/[*&][^\s[\]{},]+/,a=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+a.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+a.source+")?)",o=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),c=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function u(f,m){m=(m||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return f});return RegExp(g,m)}s.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+o+"|"+c+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:u(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:u(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:u(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:u(c),lookbehind:!0,greedy:!0},number:{pattern:u(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:a,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},s.languages.yml=s.languages.yaml})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};function yb(s){window.dispatchEvent(new CustomEvent("preview-file",{detail:{path:s}}))}const Jk={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",python:"Python",bash:"Bash",shell:"Shell",css:"CSS",json:"JSON",yaml:"YAML",yml:"YAML",sql:"SQL",md:"Markdown",markdown:"Markdown",xml:"XML",html:"HTML"};function e1({language:s,code:t}){const[a,r]=_.useState(!1),o=_.useRef(null);_.useEffect(()=>{if(o.current)try{Zk.highlightElement(o.current)}catch{}},[t,s]);const c=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch(f){console.error("Failed to copy:",f)}},u=Jk[s]||s.toUpperCase();return h.jsxs("div",{className:"relative group rounded-lg overflow-hidden border border-dark-border my-2",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[h.jsx("span",{className:"text-xs text-dark-muted font-mono",children:u}),h.jsx("button",{onClick:c,className:"flex items-center gap-1 text-xs px-2 py-1 rounded hover:bg-dark-hover transition-colors",children:a?h.jsxs(h.Fragment,{children:[h.jsx(Py,{size:12,className:"text-accent-green"}),h.jsx("span",{className:"text-accent-green",children:"已复制"})]}):h.jsxs(h.Fragment,{children:[h.jsx(Gy,{size:12}),h.jsx("span",{children:"复制"})]})})]}),h.jsx("pre",{className:"bg-dark-bg p-3 overflow-x-auto custom-scrollbar text-sm",children:h.jsx("code",{ref:o,className:`language-${s}`,children:t})})]})}const hy=80;function t1({path:s,title:t}){const a=s.split(/[\\/]/).pop()||s;return h.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 mx-0.5 my-1 rounded-lg border border-dark-border bg-dark-surface px-2.5 py-1.5 text-left align-middle transition-colors hover:border-accent-blue/40 hover:bg-dark-hover",title:s,onClick:()=>yb(s),children:[h.jsx("span",{className:"grid w-6 h-6 shrink-0 place-items-center rounded-md bg-accent-blue/10 text-accent-blue",children:h.jsx(Ci,{size:13})}),h.jsxs("span",{className:"min-w-0 flex flex-col leading-tight",children:[h.jsx("b",{className:"text-xs font-semibold text-dark-text truncate max-w-[14rem]",children:t||a}),t&&t!==a&&h.jsx("span",{className:"text-[10px] font-mono text-dark-muted truncate max-w-[14rem]",children:a})]}),h.jsx("span",{className:"ml-1 shrink-0 text-[11px] font-medium text-accent-blue",children:"打开 ›"})]})}function my(s){return typeof s=="string"&&s.startsWith("artifact:")}function n1(s){const t=s.slice(9);try{return decodeURIComponent(t)}catch{return t}}function gy(s){return typeof s=="string"&&s.startsWith("dscfile:")}function s1(s){const t=s.slice(8);try{return decodeURIComponent(t)}catch{return t}}function a1(s){return s.replace(/%/g,"%25")}const i1=/((?:[A-Za-z]:[\\/])?[\w@.()[\]{}$%-]+(?:[\\/][\w@.()[\]{}$%-]+)+)/;function r1(s){if(s.length<3||s.length>400||/^[a-z][a-z0-9+.-]*:\/\//i.test(s)||/^www\./i.test(s)||/^\/\//.test(s))return!1;const t=s.split(/[\\/]/);if(t.length>=2&&t.every(o=>/^\d+$/.test(o)))return!1;const a=(t[t.length-1]||"").replace(/[.,;:!?)\]}]+$/g,"");return a?/^(?:[A-Za-z]:|~|\.{1,2})[\\/]/.test(s)||/\.[A-Za-z0-9]{1,12}$/.test(a):!1}function l1(s){const t=s.match(/^(.*?)([.,;:!?)\]}]+)$/);if(!t)return{path:s,tail:""};const a=t[1]??"",r=t[2]??"";if(r==="."){const o=a.split(/[\\/]/).pop()||"";if(!/\.[A-Za-z0-9]{1,12}$/.test(o))return{path:s,tail:""}}return{path:a,tail:r}}function o1({path:s}){return h.jsxs("button",{type:"button",onClick:()=>yb(s),title:s,className:"inline-flex max-w-full items-center gap-1 align-baseline rounded px-1 font-mono text-[0.9em] text-accent-blue underline decoration-accent-blue/40 underline-offset-2 hover:bg-accent-blue/10 hover:decoration-accent-blue transition-colors cursor-pointer",children:[h.jsx(Ci,{size:10,className:"shrink-0"}),h.jsx("span",{className:"break-all",children:s})]})}function c1(){const s=new Set(["code","inlineCode","html","link","linkReference","image","imageReference"]);function t(r){const o=r.split(i1);if(o.length<=1)return[{type:"text",value:r}];const c=[];return o.forEach((u,f)=>{if(f%2===1){const{path:m,tail:g}=l1(u);if(m&&r1(m)){c.push({type:"link",url:`dscfile:${a1(m)}`,title:null,children:[{type:"text",value:m}]}),g&&c.push({type:"text",value:g});return}}c.push({type:"text",value:u})}),c}function a(r){if(!r||typeof r!="object"||s.has(r.type))return;const o=r.children;if(!Array.isArray(o))return;const c=[];for(const u of o)u&&u.type==="text"&&typeof u.value=="string"?c.push(...t(u.value)):(a(u),c.push(u));r.children=c}return function(o){a(o)}}const u1=[c1];function d1({content:s,className:t=""}){const[a,r]=_.useState(s),o=_.useRef(0),c=_.useRef(null),u=_.useRef(s);u.current=s,_.useEffect(()=>{if(s===a)return;const m=Date.now(),g=m-o.current;g>=hy?(r(s),o.current=m):c.current||(c.current=setTimeout(()=>{c.current=null,r(u.current),o.current=Date.now()},hy-g))},[s]),_.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const f=(a||"").replace(/\\n/g,`
|
|
28
|
-
`).replace(/\n{3,}/g,`
|
|
29
|
-
|
|
30
|
-
`);return h.jsx("div",{className:`markdown-content ${t}`,style:{wordBreak:"break-word"},children:h.jsx(Fv,{remarkPlugins:u1,urlTransform:m=>my(m)||gy(m)?m:qv(m),components:{code({className:m,children:g,...y}){const b=/language-(\w+)/.exec(m||""),v=String(g).replace(/\n$/,"");return b&&b[1]?h.jsx(e1,{language:b[1],code:v}):h.jsx("code",{className:"bg-dark-hover px-1.5 py-0.5 rounded text-sm font-mono text-accent-blue",...y,children:g})},a({href:m,children:g}){if(my(m)){const y=Array.isArray(g)?g.join(""):String(g??"");return h.jsx(t1,{path:n1(m),title:y})}return gy(m)?h.jsx(o1,{path:s1(m)}):h.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:underline",children:g})},table({children:m}){return h.jsx("div",{className:"overflow-x-auto custom-scrollbar my-2",children:h.jsx("table",{className:"w-full border-collapse border border-dark-border",children:m})})},th({children:m}){return h.jsx("th",{className:"border border-dark-border px-3 py-2 text-left bg-dark-hover font-medium",children:m})},td({children:m}){return h.jsx("td",{className:"border border-dark-border px-3 py-2",children:m})},p({children:m}){return h.jsx("p",{className:"mb-0.5 leading-snug last:mb-0",children:m})},blockquote({children:m}){return h.jsx("blockquote",{className:"border-l-4 border-accent-blue pl-3 my-1 text-dark-muted italic",children:m})},h1({children:m}){return h.jsx("h1",{className:"text-2xl font-bold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:m})},h2({children:m}){return h.jsx("h2",{className:"text-xl font-semibold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:m})},h3({children:m}){return h.jsx("h3",{className:"text-lg font-semibold mt-2 mb-1 text-dark-text",children:m})}},children:f})})}const Ed=Ut()(Na(s=>({hidden:{},pinned:{},hide:t=>s(a=>({hidden:{...a.hidden,[t]:!0}})),show:t=>s(a=>{const r={...a.hidden};return delete r[t],{hidden:r}}),togglePin:t=>s(a=>{const r=!a.pinned[t],o={...a.hidden};return r&&delete o[t],{pinned:{...a.pinned,[t]:r},hidden:o}}),reset:()=>s({hidden:{},pinned:{}})}),{name:"deepseekcode-widget-store",storage:Sf({key:"widgetStore",trims:[]}),partialize:s=>({hidden:s.hidden,pinned:s.pinned})})),ul=_.memo(function({id:t,title:a,icon:r,action:o,children:c,defaultOpen:u=!0}){const f=Ed(v=>v.pinned[t]),m=Ed(v=>v.togglePin),g=Ed(v=>v.hide),[y,b]=_.useState(u);return h.jsxs("div",{className:"rounded-lg border border-dark-border bg-dark-surface overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1.5",children:[h.jsxs("button",{type:"button",onClick:()=>b(v=>!v),className:"flex-1 min-w-0 flex items-center gap-1.5 text-left transition-colors","aria-expanded":y,title:y?"折叠":"展开",children:[h.jsx(Ea,{size:11,className:pt("text-dark-muted shrink-0 transition-transform duration-200",!y&&"-rotate-90")}),r,h.jsx("span",{className:"text-[11px] font-semibold text-dark-text truncate",children:a}),!f&&h.jsx("span",{className:"text-[8px] text-dark-muted/50 border border-dark-border rounded px-1 py-px shrink-0",children:"自动"})]}),o,h.jsx("button",{type:"button",onClick:()=>m(t),className:pt("p-1 rounded transition-colors shrink-0",f?"text-accent-blue":"text-dark-muted/40 hover:text-dark-muted hover:bg-dark-hover"),title:f?"取消固定":"固定(不自动收起)","aria-label":f?"取消固定":"固定",children:f?h.jsx(Wv,{size:11}):h.jsx(Kv,{size:11})}),h.jsx("button",{type:"button",onClick:()=>g(t),className:"p-1 rounded text-dark-muted/40 hover:text-dark-muted hover:bg-dark-hover transition-colors shrink-0",title:"关闭此小组件","aria-label":"关闭此小组件",children:h.jsx(bs,{size:11})})]}),y&&h.jsx("div",{className:"px-2.5 pb-2.5",children:c})]})}),f1=_.memo(function({sessionId:t}){const a=Qe(c=>t?c.getPlanForSession(t):void 0);if(!a||!a.confirm)return null;const r=a.nodes??[],o=c=>{Qe.getState().clearPlan(t),ge.send({type:"workflow_confirm",sessionId:t,data:JSON.stringify({planId:a.planId,action:c})})};return h.jsx(ul,{id:"plan-card",title:"AI 计划",icon:h.jsx(qy,{size:13,className:"text-accent-purple shrink-0"}),children:h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-dark-text",children:[h.jsx(Nn,{size:11,className:"animate-spin text-accent-blue shrink-0"}),h.jsx("span",{className:"truncate flex-1",children:a.title||"工作流计划"}),h.jsxs("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0",children:[r.length," 步"]})]}),r.length>0&&h.jsxs("ol",{className:"space-y-0.5",children:[r.slice(0,8).map((c,u)=>h.jsxs("li",{className:"flex items-start gap-1.5 text-[11px] text-dark-muted",children:[h.jsx("span",{className:"w-4 h-4 rounded-full grid place-items-center bg-dark-border/60 text-dark-muted text-[9px] font-semibold shrink-0 mt-0.5",children:u+1}),h.jsx("span",{className:"min-w-0 flex-1 leading-snug break-words",children:c.title})]},c.id)),r.length>8&&h.jsxs("li",{className:"text-[10px] text-dark-muted/60 pl-6",children:["+",r.length-8," 步"]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 pt-1 border-t border-dark-border/60",children:[h.jsxs("button",{type:"button",onClick:()=>o("start"),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1 rounded border border-accent-blue/40 bg-accent-blue/10 text-[10px] text-accent-blue hover:bg-accent-blue/20 transition-colors",children:[h.jsx(Fy,{size:10})," 开始执行"]}),h.jsxs("button",{type:"button",onClick:()=>o("change"),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",title:"取消此方案,换个说法重新描述",children:[h.jsx(gf,{size:10})," 更换流程"]}),h.jsxs("button",{type:"button",onClick:()=>o("cancel"),className:"flex items-center justify-center gap-1 px-2 py-1 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",title:"取消工作流",children:[h.jsx(bs,{size:10})," 取消"]})]})]})})}),p1=["RUNNING","RESUMING"];function h1(s){switch(s){case"running":return h.jsx(Nn,{size:12,className:"animate-spin text-accent-blue shrink-0"});case"completed":return h.jsx(Jo,{size:12,className:"text-accent-green shrink-0"});case"failed":return h.jsx(Xo,{size:12,className:"text-accent-red shrink-0"});case"skipped":return h.jsx(Zv,{size:12,className:"text-dark-muted shrink-0"});case"blocked":return h.jsx(Vy,{size:12,className:"text-dark-muted shrink-0"});default:return h.jsx(yf,{size:12,className:"text-dark-muted/70 shrink-0"})}}function m1(s){switch(s){case"running":return"运行中";case"completed":return"完成";case"failed":return"失败";case"skipped":return"跳过";case"blocked":return"等待";default:return"待执行"}}const g1=_.memo(function({sessionId:t}){const a=Qe(y=>t?y.getForSession(t):void 0),r=a==null?void 0:a.nodes;if(!r||r.length===0)return null;const o=r.length,c=r.filter(y=>y.status==="completed"||y.status==="skipped"||y.status==="failed").length,u=r.filter(y=>y.status==="running").length,f=r.filter(y=>y.status==="failed").length,m=Math.round(c/o*100),g=p1.includes(String(a==null?void 0:a.status));return h.jsx(ul,{id:"workflow-strip",title:(a==null?void 0:a.title)||"工作流",icon:h.jsx(qy,{size:13,className:"text-accent-blue shrink-0"}),action:h.jsxs("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0 px-1",children:[c,"/",o]}),children:h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"flex-1 h-1.5 bg-dark-surface rounded-full overflow-hidden",children:h.jsx("div",{className:pt("h-full rounded-full transition-all duration-500",f>0?"bg-accent-red":u>0?"bg-accent-blue":"bg-accent-green"),style:{width:`${m}%`}})}),h.jsxs("span",{className:"text-[10px] text-dark-muted tabular-nums shrink-0",children:[m,"%"]})]}),h.jsx("ul",{className:"space-y-0.5",children:r.map(y=>h.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[h.jsx("span",{className:"mt-0.5 shrink-0",children:h1(y.status)}),h.jsxs("span",{className:pt("min-w-0 flex-1 text-[11px] leading-snug break-words",y.status==="completed"&&"text-dark-muted/70",y.status==="failed"&&"text-accent-red/90",y.status==="running"&&"text-dark-text font-medium",(y.status==="pending"||y.status==="ready")&&"text-dark-muted"),title:y.error||y.title,children:[y.title,h.jsx("span",{className:"ml-1 text-[8px] text-dark-muted/50 align-middle",children:m1(y.status)})]})]},y.id))}),(g||(a==null?void 0:a.status)==="PAUSED")&&h.jsx("div",{className:"flex items-center gap-1.5 pt-1 border-t border-dark-border/60",children:h.jsx(y1,{sessionId:t,runId:a.runId,status:String(a==null?void 0:a.status)})})]})})});function y1({sessionId:s,runId:t,status:a}){const r=a==="PAUSED";return h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button",onClick:()=>ge.send(r?{type:"workflow_resume",sessionId:s,runId:t}:{type:"workflow_pause",sessionId:s,runId:t}),className:"flex items-center gap-1 px-2 py-0.5 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",children:[r?h.jsx(Fy,{size:10,className:"text-accent-green"}):h.jsx(Vy,{size:10,className:"text-accent-blue"}),r?"恢复":"暂停"]}),h.jsxs("button",{type:"button",onClick:()=>ge.send({type:"workflow_cancel",sessionId:s,runId:t}),className:"flex items-center gap-1 px-2 py-0.5 rounded border border-dark-border text-[10px] text-dark-text hover:bg-dark-hover transition-colors",children:[h.jsx(Yv,{size:9,className:"text-accent-red"}),"取消"]})]})}const b1=_.memo(function({sessionId:t}){return Qe(r=>t?r.getTasksForSession(t).length:0)===0?null:h.jsx(ul,{id:"task-board",title:"任务看板",icon:h.jsx(Wy,{size:13,className:"text-accent-blue shrink-0"}),children:h.jsx(Nw,{sessionId:t})})}),x1=_.memo(function({messages:t,onPreview:a}){const{t:r}=Tn(),o=_.useMemo(()=>_b(t),[t]);return o.length===0?null:h.jsx(ul,{id:"artifacts",title:`${r("chat.sidebarArtifacts")} (${o.length})`,icon:h.jsx(Ky,{size:13,className:"text-accent-blue shrink-0"}),action:h.jsx("button",{type:"button",onClick:()=>{const c=o[0];c&&a(c.path)},className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:r("chat.sidebarOpenFolder"),"aria-label":r("chat.sidebarOpenFolder"),children:h.jsx(Qv,{size:12})}),children:h.jsx("div",{className:"space-y-0.5",children:o.map(c=>{const u=uf(c.path);return h.jsxs("button",{type:"button",onClick:()=>a(c.path),className:"w-full flex items-center gap-2 px-1.5 py-1.5 rounded-lg text-left transition-colors group hover:bg-dark-hover",title:c.path,children:[h.jsx("span",{className:pt("w-1.5 h-6 rounded-full shrink-0",c.source==="filejob"?"bg-accent-green":"bg-accent-blue")}),h.jsx(Cw,{kind:u,size:15}),h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:"block text-xs text-dark-text truncate",children:c.name}),h.jsx("span",{className:"block text-[10px] font-mono text-dark-muted truncate",children:c.path})]}),h.jsx("span",{className:"shrink-0 text-[10.5px] font-medium text-dark-muted opacity-0 group-hover:opacity-100 transition-opacity",children:r("chat.sidebarOpen")})]},c.path)})})})}),v1=["Orchestrator","Explorer","Architect","Coder","Tester","Reviewer","Debug","Documenter","Evaluator"];function S1(s){return s==="running"||s==="scheduled"?h.jsx(Nn,{size:11,className:"animate-spin text-accent-blue shrink-0"}):s==="completed"?h.jsx(Jo,{size:11,className:"text-accent-green shrink-0"}):s==="failed"?h.jsx(Xo,{size:11,className:"text-accent-red shrink-0"}):h.jsx(yf,{size:11,className:"text-dark-muted shrink-0"})}const k1=s=>s==="running"||s==="scheduled"?"运行中":s==="completed"?"完成":s==="failed"?"失败":"空闲",yy=s=>s.toLowerCase(),w1=_.memo(function({sessionId:t}){const a=Qe(m=>t?m.getAgentsForSession(t):[]),r=Qe(m=>t?m.getEventsForSession(t).filter(g=>g.source==="agent"||g.source==="plan").slice(0,30):[]),[o,c]=_.useState(!1),u=_.useMemo(()=>{if(a.length===0)return[];const m=new Map(a.map(b=>[yy(b.name),b])),g=v1.map(b=>m.get(yy(b))).filter(Boolean),y=a.filter(b=>!g.some(v=>v.id===b.id));return[...g,...y]},[a]),f=u.filter(m=>m.status==="running"||m.status==="scheduled").length;return u.length===0?null:h.jsx(ul,{id:"agent-flow",title:"Agent",icon:h.jsx(Xv,{size:13,className:"text-accent-purple shrink-0"}),action:f>0?h.jsx("span",{className:"w-1.5 h-1.5 bg-accent-blue rounded-full animate-pulse shrink-0"}):void 0,children:h.jsxs("div",{className:"space-y-1",children:[u.slice(0,8).map(m=>h.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[S1(m.status),h.jsxs("span",{className:pt("min-w-0 flex-1 text-[11px] leading-snug break-words",m.status==="running"||m.status==="scheduled"?"text-dark-text":"text-dark-muted"),children:[m.name,m.currentTask&&h.jsxs("span",{className:"text-dark-muted/70",children:[" · ",m.currentTask]})]}),h.jsx("span",{className:"text-[8px] text-dark-muted/50 shrink-0",children:k1(m.status)})]},m.id)),u.length>8&&h.jsxs("div",{className:"text-[10px] text-dark-muted text-center pt-0.5",children:["+",u.length-8," 个 Agent"]}),r.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button",onClick:()=>c(m=>!m),className:"w-full flex items-center gap-1 pt-1 text-[10px] text-dark-muted hover:text-dark-text transition-colors",children:[h.jsx(Ea,{size:10,className:pt("transition-transform",o&&"rotate-180")}),"事件日志(",r.length,")"]}),o&&h.jsx("div",{className:"space-y-1 pt-1 max-h-32 overflow-y-auto custom-scrollbar",children:r.map(m=>h.jsxs("div",{className:"px-1.5 py-1 rounded border border-dark-border bg-dark-surface text-[9px] text-dark-muted",children:[h.jsx("span",{className:"font-medium text-dark-text",children:m.title||m.type}),m.message&&h.jsx("span",{className:"block text-dark-muted/80 truncate",children:m.message})]},m.id))})]})]})})}),_1=_.memo(function({sessionId:t,messages:a,onPreview:r}){return h.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 custom-scrollbar",children:h.jsxs("div",{className:"p-2 space-y-2",children:[h.jsx(f1,{sessionId:t}),h.jsx(g1,{sessionId:t}),h.jsx(w1,{sessionId:t}),h.jsx(b1,{sessionId:t}),h.jsx(x1,{messages:a,onPreview:r})]})})});function by(s,t){var a,r,o;return{artifactMatch:!!((a=t.artifact)!=null&&a.kind&&((r=s.artifactKinds)!=null&&r.includes(t.artifact.kind))),capabilityMatch:!!((o=t.requiredCapabilities)!=null&&o.includes(s.capability)),priority:s.priority??0}}function C1(s,t){return s.artifactMatch!==t.artifactMatch?s.artifactMatch?1:-1:s.capabilityMatch!==t.capabilityMatch?s.capabilityMatch?1:-1:s.priority-t.priority}function E1(s,t){const a=s.filter(c=>c.slots.includes(t.slotId));if(a.length===0)return;if(t.preferredComponentId){const c=a.find(u=>u.id===t.preferredComponentId);if(c)return c}let r=a[0],o=by(r,t);for(let c=1;c<a.length;c+=1){const u=by(a[c],t);C1(u,o)>0&&(r=a[c],o=u)}return r}const Nd=/^[a-z][a-z0-9._-]*$/;class wa extends Error{}class N1{constructor(){Ge(this,"defs",new Map);Ge(this,"listeners",new Set);Ge(this,"versionCounter",0)}getVersion(){return this.versionCounter}onChange(t){return this.listeners.add(t),()=>this.listeners.delete(t)}register(t){return this.assertValid(t),this.defs.set(t.id,t),this.notify(),()=>this.unregister(t.id)}unregister(t){const a=this.defs.delete(t);return a&&this.notify(),a}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()].sort((a,r)=>(r.priority??0)-(a.priority??0))}listForSlot(t){return this.list().filter(a=>a.slots.includes(t))}resolve(t){return E1(this.list(),t)}capabilities(){return[...new Set(this.list().map(t=>t.capability))]}clear(){this.defs.size!==0&&(this.defs.clear(),this.notify())}get size(){return this.defs.size}notify(){this.versionCounter+=1;for(const t of[...this.listeners])try{t()}catch(a){console.error("[workspace] registry listener error:",a)}}assertValid(t){var a;if(!t||typeof t!="object")throw new wa("[workspace] component def must be an object");if(!Nd.test(t.id))throw new wa(`[workspace] invalid component id: ${JSON.stringify(t.id)} (expected ${Nd})`);if(this.defs.has(t.id))throw new wa(`[workspace] duplicate component id: "${t.id}"`);if(!Nd.test(t.capability))throw new wa(`[workspace] invalid capability id: ${JSON.stringify(t.capability)}`);if(!Array.isArray(t.slots)||t.slots.length===0||t.slots.some(r=>typeof r!="string"||r.length===0))throw new wa(`[workspace] component "${t.id}" must declare at least one non-empty slot`);if(typeof t.component!="function"&&typeof((a=t.component)==null?void 0:a.render)!="function")throw new wa(`[workspace] component "${t.id}" has no renderable component`);if(t.priority!==void 0&&(typeof t.priority!="number"||!Number.isFinite(t.priority)))throw new wa(`[workspace] component "${t.id}" priority must be a finite number`)}}const Ef=new N1,xy=32;function Td(s){if(typeof s!="object"||s===null)return!1;const t=s;return t.type==="slot"||t.type==="split"||t.type==="stack"}function bb(s,t=0){if(!Td(s))return["layout root must be a slot/split/stack node"];const a=[],r=(o,c,u)=>{if(u>xy){a.push(`${c}: exceeds max nesting depth ${xy}`);return}switch(o.type){case"slot":{(typeof o.id!="string"||o.id.length===0)&&a.push(`${c}: slot requires a non-empty id`);break}case"split":{o.direction!=="horizontal"&&o.direction!=="vertical"&&a.push(`${c}: split requires direction "horizontal"|"vertical"`),!Array.isArray(o.children)||o.children.length<2?a.push(`${c}: split requires at least 2 children`):o.sizes!==void 0&&(!Array.isArray(o.sizes)||o.sizes.length!==o.children.length?a.push(`${c}: split sizes must match children count`):o.sizes.some(f=>typeof f!="number"||!Number.isFinite(f)||f<=0)&&a.push(`${c}: split sizes must be positive finite numbers`)),Array.isArray(o.children)&&o.children.forEach((f,m)=>{Td(f)?r(f,`${c}.children[${m}]`,u+1):a.push(`${c}.children[${m}]: invalid node`)});break}case"stack":{!Array.isArray(o.children)||o.children.length<1?a.push(`${c}: stack requires at least 1 child`):o.children.forEach((f,m)=>{Td(f)?r(f,`${c}.children[${m}]`,u+1):a.push(`${c}.children[${m}]: invalid node`)});break}}};return r(s,"$",t),a}class T1{constructor(t={}){Ge(this,"listeners",new Map);Ge(this,"onError");this.onError=t.onError??((a,r)=>{console.error(`[workspace] EventBus handler error for "${String(r)}":`,a)})}on(t,a){let r=this.listeners.get(t);return r||(r=new Set,this.listeners.set(t,r)),r.add(a),()=>this.off(t,a)}once(t,a){const r=o=>{this.off(t,r),a(o)};return this.on(t,r)}off(t,a){const r=this.listeners.get(t);r&&(r.delete(a),r.size===0&&this.listeners.delete(t))}emit(t,a){const r=this.listeners.get(t);if(!(!r||r.size===0))for(const o of[...r])try{o(a)}catch(c){this.onError(c,String(t),o)}}listenerCount(t){var r;if(t!==void 0)return((r=this.listeners.get(t))==null?void 0:r.size)??0;let a=0;for(const o of this.listeners.values())a+=o.size;return a}clear(){this.listeners.clear()}}const A1=/^[a-z][a-z0-9._-]*$/;function Ad(s){return typeof s=="string"&&A1.test(s)}const Oo="";let vy=0;function j1(s="cmd"){const t=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`;return vy+=1,`${s}-${vy}-${t}`}const R1=1e4;class O1{constructor(t={}){Ge(this,"handlers",new Map);Ge(this,"capabilityToCommand",new Map);Ge(this,"pending",new Map);Ge(this,"defaultTimeoutMs");Ge(this,"onError");this.defaultTimeoutMs=t.defaultTimeoutMs??R1,this.onError=t.onError??((a,r)=>{console.error(`[workspace] CommandBus handler error for "${r}":`,a)})}register(t,a,r={}){if(!Ad(t))throw new Error(`[workspace] invalid command id: ${JSON.stringify(t)}`);const o=r.scope??Oo;if(o!==Oo&&!Ad(o))throw new Error(`[workspace] invalid command scope: ${JSON.stringify(o)}`);let c=this.handlers.get(t);if(c||(c=new Map,this.handlers.set(t,c)),c.has(o))throw new Error(`[workspace] duplicate command handler: "${t}"${o?` (scope: ${o})`:""}`);if(r.capability!==void 0){if(!Ad(r.capability))throw new Error(`[workspace] invalid capability id: ${JSON.stringify(r.capability)}`);if(this.capabilityToCommand.has(r.capability))throw new Error(`[workspace] duplicate capability mapping: "${r.capability}"`);this.capabilityToCommand.set(r.capability,t)}c.set(o,a);let u=!1;return()=>{if(u)return;u=!0;const f=this.handlers.get(t);f&&(f.delete(o),f.size===0&&this.handlers.delete(t)),r.capability!==void 0&&this.capabilityToCommand.delete(r.capability)}}has(t){return this.handlers.has(t)}listCommands(){return[...this.handlers.keys()]}resolveCapability(t){return this.capabilityToCommand.get(t)}capabilities(){return[...this.capabilityToCommand.entries()].map(([t,a])=>({capability:t,command:a}))}async execute(t,a,r={}){const o=r.requestId??j1(),c=this.resolveHandler(t,r.scope);if(!c)return{success:!1,requestId:o,command:t,error:`unknown command: "${t}"`,durationMs:0};const u=r.timeoutMs??this.defaultTimeoutMs,f=Date.now(),m=`command "${t}" timed out after ${u}ms`;return await new Promise(g=>{const y=setTimeout(()=>{this.pending.delete(o),g({success:!1,requestId:o,command:t,error:m,durationMs:Date.now()-f})},u);this.pending.set(o,{resolve:g,timer:y,startedAt:f,command:t}),Promise.resolve().then(()=>c(a,{requestId:o,command:t})).then(b=>{this.settle(o,{success:!0,requestId:o,command:t,result:b,durationMs:Date.now()-f})},b=>{this.onError(b,t),this.settle(o,{success:!1,requestId:o,command:t,error:b instanceof Error?b.message:String(b),durationMs:Date.now()-f})})})}handle(t){return this.execute(t.command,t.payload,{timeoutMs:t.timeoutMs,requestId:t.id,scope:t.scope})}resolveHandler(t,a){const r=this.handlers.get(t);if(r){if(a&&a!==Oo){const o=r.get(a);if(o)return o}return r.get(Oo)}}cancel(t,a="cancelled"){const r=this.pending.get(t);return r?(this.pending.delete(t),r.timer&&clearTimeout(r.timer),r.resolve({success:!1,requestId:t,command:r.command,error:a,durationMs:Date.now()-r.startedAt}),!0):!1}pendingCount(){return this.pending.size}settle(t,a){const r=this.pending.get(t);r&&(this.pending.delete(t),r.timer&&clearTimeout(r.timer),r.resolve(a))}}const M1=/^[a-zA-Z]:[\\/]/,B1=/\0/;function D1(s){if(typeof s!="string"||s.length===0||B1.test(s)||M1.test(s)||s.startsWith("/")||s.startsWith("\\"))return!1;const t=s.replace(/\\/g,"/").split("/");let a=0;for(const r of t)if(!(r===""||r==="."))if(r===".."){if(a-=1,a<0)return!1}else a+=1;return!0}function Sy(s,t=""){if(!D1(s))throw new Error(`[workspace] unsafe path rejected: ${JSON.stringify(s)}`);const a=s.replace(/\\/g,"/").split("/"),r=[];for(const u of a)u===""||u==="."||(u===".."?r.pop():r.push(u));const o=r.join("/");return t?`${t.replace(/[\\/]+$/,"")}/${o}`:o}class L1{diff(t,a,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const c=this.castInput(t,r),u=this.castInput(a,r),f=this.removeEmpty(this.tokenize(c,r)),m=this.removeEmpty(this.tokenize(u,r));return this.diffWithOptionsObj(f,m,r,o)}diffWithOptionsObj(t,a,r,o){var c;const u=j=>{if(j=this.postProcess(j,r),o){setTimeout(function(){o(j)},0);return}else return j},f=a.length,m=t.length;let g=1,y=f+m;r.maxEditLength!=null&&(y=Math.min(y,r.maxEditLength));const b=(c=r.timeout)!==null&&c!==void 0?c:1/0,v=Date.now()+b,S=[{oldPos:-1,lastComponent:void 0}];let k=this.extractCommon(S[0],a,t,0,r);if(S[0].oldPos+1>=m&&k+1>=f)return u(this.buildValues(S[0].lastComponent,a,t));let C=-1/0,E=1/0;const O=()=>{for(let j=Math.max(C,-g);j<=Math.min(E,g);j+=2){let T;const U=S[j-1],R=S[j+1];U&&(S[j-1]=void 0);let K=!1;if(R){const te=R.oldPos-j;K=R&&0<=te&&te<f}const Z=U&&U.oldPos+1<m;if(!K&&!Z){S[j]=void 0;continue}if(!Z||K&&U.oldPos<R.oldPos?T=this.addToPath(R,!0,!1,0,r):T=this.addToPath(U,!1,!0,1,r),k=this.extractCommon(T,a,t,j,r),T.oldPos+1>=m&&k+1>=f)return u(this.buildValues(T.lastComponent,a,t))||!0;S[j]=T,T.oldPos+1>=m&&(E=Math.min(E,j-1)),k+1>=f&&(C=Math.max(C,j+1))}g++};if(o)(function j(){setTimeout(function(){if(g>y||Date.now()>v)return o(void 0);O()||j()},0)})();else for(;g<=y&&Date.now()<=v;){const j=O();if(j)return j}}addToPath(t,a,r,o,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===a&&u.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:u.count+1,added:a,removed:r,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:a,removed:r,previousComponent:u}}}extractCommon(t,a,r,o,c){const u=a.length,f=r.length;let m=t.oldPos,g=m-o,y=0;for(;g+1<u&&m+1<f&&this.equals(r[m+1],a[g+1],c);)g++,m++,y++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return y&&!c.oneChangePerToken&&(t.lastComponent={count:y,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=m,g}equals(t,a,r){return r.comparator?r.comparator(t,a):t===a||!!r.ignoreCase&&t.toLowerCase()===a.toLowerCase()}removeEmpty(t){const a=[];for(let r=0;r<t.length;r++)t[r]&&a.push(t[r]);return a}castInput(t,a){return t}tokenize(t,a){return Array.from(t)}join(t){return t.join("")}postProcess(t,a){return t}get useLongestToken(){return!1}buildValues(t,a,r){const o=[];let c;for(;t;)o.push(t),c=t.previousComponent,delete t.previousComponent,t=c;o.reverse();const u=o.length;let f=0,m=0,g=0;for(;f<u;f++){const y=o[f];if(y.removed)y.value=this.join(r.slice(g,g+y.count)),g+=y.count;else{if(!y.added&&this.useLongestToken){let b=a.slice(m,m+y.count);b=b.map(function(v,S){const k=r[g+S];return k.length>v.length?k:v}),y.value=this.join(b)}else y.value=this.join(a.slice(m,m+y.count));m+=y.count,y.added||(g+=y.count)}}return o}}class z1 extends L1{constructor(){super(...arguments),this.tokenize=H1}equals(t,a,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
31
|
-
`))&&(t=t.trim()),(!r.newlineIsToken||!a.includes(`
|
|
32
|
-
`))&&(a=a.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
33
|
-
`)&&(t=t.slice(0,-1)),a.endsWith(`
|
|
34
|
-
`)&&(a=a.slice(0,-1))),super.equals(t,a,r)}}const U1=new z1;function lf(s,t,a){return U1.diff(s,t,a)}function H1(s,t){t.stripTrailingCr&&(s=s.replace(/\r\n/g,`
|
|
35
|
-
`));const a=[],r=s.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const c=r[o];o%2&&!t.newlineIsToken?a[a.length-1]+=c:a.push(c)}return a}function $1(s){for(let t=0;t<s.length;t++)if(s[t]<" "||s[t]>"~"||s[t]==='"'||s[t]==="\\")return!0;return!1}function Ws(s){if(!$1(s))return s;let t='"';const a=new TextEncoder().encode(s);let r=0;for(;r<a.length;){const o=a[r];o===7?t+="\\a":o===8?t+="\\b":o===9?t+="\\t":o===10?t+="\\n":o===11?t+="\\v":o===12?t+="\\f":o===13?t+="\\r":o===34?t+='\\"':o===92?t+="\\\\":o>=32&&o<=126?t+=String.fromCharCode(o):t+="\\"+o.toString(8).padStart(3,"0"),r++}return t+='"',t}const ky={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function I1(s,t,a,r,o,c,u){let f;f={},typeof f.context>"u"&&(f.context=4);const m=f.context;if(f.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(f.callback){const{callback:y}=f;lf(a,r,Object.assign(Object.assign({},f),{callback:b=>{const v=g(b);y(v)}}))}else return g(lf(a,r,f));function g(y){if(!y)return;y.push({value:"",lines:[]});function b(j){return j.map(function(T){return" "+T})}const v=[];let S=0,k=0,C=[],E=1,O=1;for(let j=0;j<y.length;j++){const T=y[j],U=T.lines||P1(T.value);if(T.lines=U,T.added||T.removed){if(!S){const R=y[j-1];S=E,k=O,R&&(C=m>0?b(R.lines.slice(-m)):[],S-=C.length,k-=C.length)}for(const R of U)C.push((T.added?"+":"-")+R);T.added?O+=U.length:E+=U.length}else{if(S)if(U.length<=m*2&&j<y.length-2)for(const R of b(U))C.push(R);else{const R=Math.min(U.length,m);for(const Z of b(U.slice(0,R)))C.push(Z);const K={oldStart:S,oldLines:E-S+R,newStart:k,newLines:O-k+R,lines:C};v.push(K),S=0,k=0,C=[]}E+=U.length,O+=U.length}}for(const j of v)for(let T=0;T<j.lines.length;T++)j.lines[T].endsWith(`
|
|
36
|
-
`)?j.lines[T]=j.lines[T].slice(0,-1):(j.lines.splice(T+1,0,"\"),T++);return{oldFileName:s,newFileName:t,oldHeader:o,newHeader:c,hunks:v}}}function xb(s,t){var a,r,o,c,u,f;if(t||(t=ky),Array.isArray(s)){if(s.length>1&&!t.includeFileHeaders&&!s.every(y=>y.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return s.map(y=>xb(y,t)).join(`
|
|
37
|
-
`)}const m=[];if(s.isGit){if(t=ky,!s.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!s.newFileName)throw new Error("newFileName must be specified for Git patches");let y=s.oldFileName,b=s.newFileName;s.isCreate&&y==="/dev/null"?y=b.replace(/^b\//,"a/"):s.isDelete&&b==="/dev/null"&&(b=y.replace(/^a\//,"b/")),m.push("diff --git "+Ws(y)+" "+Ws(b)),s.isDelete&&m.push("deleted file mode "+((a=s.oldMode)!==null&&a!==void 0?a:"100644")),s.isCreate&&m.push("new file mode "+((r=s.newMode)!==null&&r!==void 0?r:"100644")),s.oldMode&&s.newMode&&!s.isDelete&&!s.isCreate&&(m.push("old mode "+s.oldMode),m.push("new mode "+s.newMode)),s.isRename&&(m.push("rename from "+Ws(((o=s.oldFileName)!==null&&o!==void 0?o:"").replace(/^a\//,""))),m.push("rename to "+Ws(((c=s.newFileName)!==null&&c!==void 0?c:"").replace(/^b\//,"")))),s.isCopy&&(m.push("copy from "+Ws(((u=s.oldFileName)!==null&&u!==void 0?u:"").replace(/^a\//,""))),m.push("copy to "+Ws(((f=s.newFileName)!==null&&f!==void 0?f:"").replace(/^b\//,""))))}else t.includeIndex&&s.oldFileName==s.newFileName&&s.oldFileName!==void 0&&m.push("Index: "+s.oldFileName),t.includeUnderline&&m.push("===================================================================");const g=s.hunks.length>0;t.includeFileHeaders&&s.oldFileName!==void 0&&s.newFileName!==void 0&&(!s.isGit||g)&&(m.push("--- "+Ws(s.oldFileName)+(s.oldHeader?" "+s.oldHeader:"")),m.push("+++ "+Ws(s.newFileName)+(s.newHeader?" "+s.newHeader:"")));for(let y=0;y<s.hunks.length;y++){const b=s.hunks[y],v=b.oldLines===0?b.oldStart-1:b.oldStart,S=b.newLines===0?b.newStart-1:b.newStart;m.push("@@ -"+v+","+b.oldLines+" +"+S+","+b.newLines+" @@");for(const k of b.lines)m.push(k)}return m.join(`
|
|
38
|
-
`)+`
|
|
39
|
-
`}function jd(s,t,a,r,o,c,u){{const f=I1(s,t,a,r,o,c);return f?xb(f,void 0):void 0}}function P1(s){const t=s.endsWith(`
|
|
40
|
-
`),a=s.split(`
|
|
41
|
-
`).map(r=>r+`
|
|
42
|
-
`);return t?a.pop():a.push(a.pop().slice(0,-1)),a}function G1(s,t){const a=s?new Map(s.files.map(f=>[f.path,f.content])):new Map,r=new Map(t.files.map(f=>[f.path,f.content])),c=[...new Set([...a.keys(),...r.keys()])].sort().map(f=>{const m=a.get(f)??"",g=r.get(f)??"",y=a.has(f),b=r.has(f);if(!y&&b){const C=g.length===0?0:(g.match(/\n/g)??[]).length;return{path:f,change:"added",addedLines:C,removedLines:0,patch:jd(f,f,"",g)}}if(y&&!b){const C=m.length===0?0:(m.match(/\n/g)??[]).length;return{path:f,change:"removed",addedLines:0,removedLines:C,patch:jd(f,f,m,"")}}if(m===g)return{path:f,change:"unchanged",addedLines:0,removedLines:0};const v=lf(m,g);let S=0,k=0;for(const C of v){const E=(C.value.match(/\n/g)??[]).length;C.added?S+=E:C.removed&&(k+=E)}return{path:f,change:"modified",addedLines:S,removedLines:k,patch:jd(f,f,m,g)}}),u=c.filter(f=>f.change!=="unchanged");return{fromId:(s==null?void 0:s.id)??null,toId:t.id,files:c,totalAdded:u.reduce((f,m)=>f+m.addedLines,0),totalRemoved:u.reduce((f,m)=>f+m.removedLines,0),changedFileCount:u.length}}const vb=_.createContext(null);function Nf(){const s=_.useContext(vb);if(!s)throw new Error("[workspace] useArtifactContext must be used inside <ArtifactProvider>");return s}let wy=0;function F1(){return wy+=1,`v${wy}-${Date.now().toString(36)}`}function q1({children:s,initial:t,versionStore:a}){const[r,o]=_.useState((t==null?void 0:t.artifactId)??null),[c,u]=_.useState((t==null?void 0:t.kind)??"unknown"),[f,m]=_.useState((t==null?void 0:t.files)??{}),[g,y]=_.useState((t==null?void 0:t.versions)??[]),[b,v]=_.useState((t==null?void 0:t.previewUrl)??null),S=_.useCallback((T,U)=>{const R=Sy(T);m(K=>({...K,[R]:U}))},[]),k=_.useCallback(T=>{const U=Sy(T);m(R=>{if(!(U in R))return R;const K={...R};return delete K[U],K})},[]),C=_.useCallback(T=>{if(Object.keys(f).length===0)return null;const U={id:F1(),createdAt:Date.now(),files:Object.entries(f).map(([R,K])=>({path:R,content:K})),message:T};return y(R=>[...R,U]),a&&r&&a.persistVersion(r,U).then(R=>{R.ok||console.warn("[workspace] failed to persist version snapshot",R.error)}),U},[f,r,a]),E=_.useCallback(T=>{const U=g.find(R=>R.id===T);return U?(m(Object.fromEntries(U.files.map(R=>[R.path,R.content]))),!0):!1},[g]),O=_.useCallback((T,U)=>{const R=g.find(Z=>Z.id===U);if(!R)return null;const K=T===null?null:g.find(Z=>Z.id===T)??null;return G1(K,R)},[g]),j=_.useMemo(()=>({artifactId:r,kind:c,files:f,versions:g,previewUrl:b,setArtifactId:o,setKind:u,saveFile:S,deleteFile:k,addVersion:C,restoreVersion:E,diffVersions:O,setPreviewUrl:v}),[r,c,f,g,b,S,k,C,E,O]);return h.jsx(vb.Provider,{value:j,children:s})}const yi=Ut()(s=>({layout:null,device:"desktop",activeSlot:null,setLayout:t=>s({layout:t}),setDevice:t=>s({device:t}),setActiveSlot:t=>s({activeSlot:t})})),Sb=_.createContext(null);function V1(){const s=_.useContext(Sb);if(!s)throw new Error("[workspace] useViewContext must be used inside <ViewProvider>");return s}function W1({children:s,layout:t,syncOnMount:a=!0}){const r=yi(y=>y.layout),o=yi(y=>y.device),c=yi(y=>y.activeSlot),u=yi(y=>y.setLayout),f=yi(y=>y.setDevice),m=yi(y=>y.setActiveSlot);_.useEffect(()=>{a&&t!==void 0&&t!==r&&u(t)},[]);const g=_.useMemo(()=>({layout:t??r,device:o,activeSlot:c,setLayout:u,setDevice:f,setActiveSlot:m}),[t,r,o,c,u,f,m]);return h.jsx(Sb.Provider,{value:g,children:s})}const kb=_.createContext(null);function K1(){const s=_.useContext(kb);if(!s)throw new Error("[workspace] useSessionContext must be used inside <SessionProvider>");return s}function Y1({children:s,initial:t}){const[a,r]=_.useState((t==null?void 0:t.conversationId)??null),[o,c]=_.useState((t==null?void 0:t.task)??""),[u,f]=_.useState((t==null?void 0:t.toolCalls)??[]),m=_.useCallback(b=>{f(v=>[...v,b])},[]),g=_.useCallback((b,v)=>{f(S=>S.map(k=>k.id===b?{...k,...v}:k))},[]),y=_.useMemo(()=>({conversationId:a,task:o,toolCalls:u,setConversationId:r,setTask:c,appendToolCall:m,updateToolCall:g}),[a,o,u,m,g]);return h.jsx(kb.Provider,{value:y,children:s})}class Z1{constructor(){Ge(this,"providers",new Map)}register(t,a,r){if(this.providers.has(t))throw new Error(`[workspace] duplicate context provider: "${t}"`);return this.providers.set(t,{provider:a,value:r}),()=>this.unregister(t)}unregister(t){return this.providers.delete(t)}get(t){var a;return(a=this.providers.get(t))==null?void 0:a.provider}valueOf(t){var a;return(a=this.providers.get(t))==null?void 0:a.value}entries(){return[...this.providers.entries()].map(([t,a])=>[t,a.provider,a.value])}clear(){this.providers.clear()}}const Q1=new Z1,wb=_.createContext(null);function X1(){const s=_.useContext(wb);if(!s)throw new Error("[workspace] useWorkspace must be used inside <WorkspaceProvider>");return s}function J1({children:s,registry:t=Ef,layout:a,artifact:r,session:o,mountExtraContexts:c=!0}){const u=_.useRef(null);u.current===null&&(u.current={registry:t,eventBus:new T1,commandBus:new O1,registryVersion:0});const[f,m]=_.useState(0);_.useEffect(()=>t.onChange(()=>m(v=>v+1)),[t]);const g=_.useMemo(()=>({...u.current,registryVersion:f}),[f]),y=_.useMemo(()=>c?Q1.entries():[],[c]);let b=s;for(const[v,S,k]of y)b=h.jsx(S,{value:k,children:b},v);return h.jsx(wb.Provider,{value:g,children:h.jsx(q1,{initial:r,children:h.jsx(W1,{layout:a,children:h.jsx(Y1,{initial:o,children:b})})})})}function nc(){const s=X1(),t=Nf(),a=V1(),r=K1();return _.useMemo(()=>({...s,artifact:t,view:a,session:r}),[s,t,a,r])}function ew({label:s}){return h.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs text-dark-muted","data-testid":"workspace-slot-loading",children:s?`Loading ${s}…`:"Loading…"})}function tw({slotId:s}){return h.jsxs("div",{className:"flex h-full w-full items-center justify-center border border-dashed border-dark-border text-xs text-dark-muted","data-testid":`workspace-empty-slot-${s}`,children:["No component for slot “",s,"”"]})}function sc({message:s}){return h.jsx("div",{className:"flex h-full w-full items-center justify-center bg-red-950/30 p-3 text-xs text-red-300","data-testid":"workspace-slot-error",children:s})}class nw extends _.Component{constructor(){super(...arguments);Ge(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a,r){console.error("[workspace] slot component crashed:",a,r.componentStack)}render(){return this.state.error?this.props.fallback?this.props.fallback(this.state.error):sc({message:this.state.error.message}):this.props.children}}function sw({slotId:s,componentId:t,requiredCapabilities:a,preferredComponentId:r}){const{registry:o,artifact:c}=nc(),u=(t?o.get(t):void 0)??o.resolve({slotId:s,artifact:c.artifactId?{kind:c.kind}:null,requiredCapabilities:a,preferredComponentId:r});return h.jsx(aw,{slotId:s,def:u})}function aw({slotId:s,def:t}){const{eventBus:a,commandBus:r,artifact:o}=nc(),c=t==null?void 0:t.component;return _.useEffect(()=>{var u;if((u=t==null?void 0:t.lifecycle)!=null&&u.mount)return t.lifecycle.mount({artifactId:o.artifactId??void 0,eventBus:a,commandBus:r}),()=>{var f,m;return(m=(f=t.lifecycle)==null?void 0:f.unmount)==null?void 0:m.call(f,{artifactId:o.artifactId??void 0,eventBus:a,commandBus:r})}},[t,a,r,o.artifactId]),!t||!c?h.jsx(tw,{slotId:s}):h.jsx(nw,{children:h.jsx(_.Suspense,{fallback:h.jsx(ew,{label:t.id}),children:h.jsx(c,{slotId:s,defId:t.id})})})}function iw({layout:s}){if(!s)return h.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs text-dark-muted","data-testid":"workspace-empty",children:"Workspace is empty — no layout configured"});const t=bb(s);return t.length>0?h.jsx(sc,{message:`Invalid workspace layout: ${t.join("; ")}`}):h.jsx(of,{node:s})}function of({node:s}){switch(s.type){case"slot":return h.jsx(sw,{slotId:s.id,componentId:s.componentId});case"split":return h.jsxs(Jy,{direction:s.direction==="horizontal"?"horizontal":"vertical",className:"h-full w-full overflow-hidden",children:[s.children.map((t,a)=>{var r;return h.jsx(Gd,{defaultSize:((r=s.sizes)==null?void 0:r[a])??50,className:"min-h-0 min-w-0",children:h.jsx(of,{node:t})},a)}),s.children.slice(0,-1).map((t,a)=>h.jsx(eb,{className:"w-px bg-dark-border transition-colors hover:bg-accent-blue data-[resize-handle-state=hover]:bg-accent-blue data-[resize-handle-state=drag]:bg-accent-blue"},`h-${a}`))]});case"stack":return h.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden",children:s.children.map((t,a)=>h.jsx("div",{className:"min-h-0 min-w-0 flex-1 border-b border-dark-border last:border-b-0",children:h.jsx(of,{node:t})},a))});default:return h.jsx(sc,{message:`Unknown layout node: ${JSON.stringify(s)}`})}}const rw="1",lw=["ready","select","inspect","screenshot","highlight","command","event"];function ow(s){return typeof s=="string"&&lw.includes(s)}function cw(s){if(typeof s!="object"||s===null||Array.isArray(s))return{ok:!1,error:"workspace message must be a plain object"};const t=s;return t.version!==rw?{ok:!1,error:`unsupported workspace protocol version: ${JSON.stringify(t.version)}`}:ow(t.type)?typeof t.requestId!="string"||t.requestId.length===0?{ok:!1,error:"workspace message requires a non-empty requestId"}:{ok:!0,data:{version:t.version,type:t.type,requestId:t.requestId,payload:t.payload}}:{ok:!1,error:`unknown workspace message type: ${JSON.stringify(t.type)}`}}function uw({layout:s=null,registry:t=Ef,artifact:a,session:r,onRegister:o,toolbar:c,statusBar:u,onLayoutError:f}){_.useEffect(()=>{o&&o(t)},[]);const m=s?bb(s):[];return m.length>0?(f==null||f(m),h.jsx("div",{className:"flex h-full w-full flex-col bg-dark-surface","data-testid":"workspace-runtime",children:h.jsx(sc,{message:`Invalid workspace layout: ${m.join("; ")}`})})):h.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-dark-surface","data-testid":"workspace-runtime",children:h.jsxs(J1,{registry:t,layout:s,artifact:a,session:r,children:[c&&h.jsx("div",{className:"shrink-0 border-b border-dark-border",children:c}),h.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:h.jsx(iw,{layout:s})}),u&&h.jsx("div",{className:"shrink-0 border-t border-dark-border",children:u})]})})}const Xr="demo.ping",cf="demo.pong",dw=`<!doctype html>
|
|
43
|
-
<html>
|
|
44
|
-
<head><meta charset="utf-8"><title>Demo Artifact</title></head>
|
|
45
|
-
<body style="font-family:system-ui;padding:24px;background:#0f172a;color:#e2e8f0">
|
|
46
|
-
<h2>AI 生成的工作台工件</h2>
|
|
47
|
-
<p>这个页面运行在 <code>sandbox="allow-scripts allow-forms allow-modals"</code> 的 iframe 中。</p>
|
|
48
|
-
<button id="say" onclick="parent.postMessage({version:'1',type:'event',requestId:'demo-1',payload:{event:'preview.interaction',data:{clicked:true}}},'*')">点击向宿主发送事件</button>
|
|
49
|
-
<script>document.getElementById('say').textContent='✓ 已就绪(blob: opaque origin)'<\/script>
|
|
50
|
-
</body>
|
|
51
|
-
</html>`;function _y({slotId:s,defId:t}){const{eventBus:a,commandBus:r}=nc(),o=Nf(),[c,u]=_.useState(0),[f,m]=_.useState(null);return _.useEffect(()=>{const g=a.on(Xr,()=>u(v=>v+1));let y;t==="panel-b"&&(y=r.register(cf,()=>(m(new Date().toISOString()),{pong:!0,slotId:s})));let b;return t==="panel-a"&&(b=setTimeout(()=>a.emit(Xr,{from:t}),0)),()=>{g(),y==null||y(),b&&clearTimeout(b)}},[a,r,t,s]),h.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-3","data-testid":`test-panel-${t}`,children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs font-semibold text-dark-text",children:t}),h.jsxs("span",{className:"text-[10px] text-dark-muted",children:["slot: ",s]})]}),h.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[h.jsx("span",{"data-testid":`ping-count-${t}`,children:c}),h.jsx("button",{type:"button",onClick:()=>a.emit(Xr,{from:t}),className:"rounded bg-accent-blue/10 px-2 py-0.5 text-accent-blue hover:bg-accent-blue/20",children:"emit ping"}),t==="panel-b"&&h.jsx("button",{type:"button",onClick:()=>{const g=URL.createObjectURL(new Blob([dw],{type:"text/html"}));o.setArtifactId("demo/index.html"),o.setKind("web"),o.setPreviewUrl(g)},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"})]}),f&&h.jsxs("div",{className:"text-[10px] text-emerald-400","data-testid":`pong-${t}`,children:["pong @ ",f]})]})}function fw(s=Ef){const t=s.register({id:"panel-a",capability:"demo.panel.a",component:_y,slots:["left"],priority:10,metadata:{label:"Panel A"},lifecycle:{mount:()=>{},unmount:()=>{}}}),a=s.register({id:"panel-b",capability:"demo.panel.b",component:_y,slots:["right"],priority:10,metadata:{label:"Panel B"},aiManifest:{description:"Demo panel that responds to demo.pong commands",commands:[cf],capabilities:[{capability:"demo.panel.b.pong",command:cf,description:"Ping back from panel-b",parameters:[{name:"from",type:"string",description:"who is pinging",required:!1}]}],events:{listen:[Xr],emit:[Xr]}}});return()=>{t(),a()}}const pw={select:"preview.element.select",inspect:"preview.element.inspect",screenshot:"preview.element.screenshot",highlight:"preview.element.highlight"};function hw(s,t){const a=t??{},r=typeof a.selector=="string"&&a.selector.trim()!==""?a.selector:void 0,o=typeof a.elementId=="string"&&a.elementId.trim()!==""?a.elementId:void 0;return!r&&!o?{ok:!1,error:`interactive "${s}" message requires a non-empty selector or elementId`}:{ok:!0,elementRef:{selector:r,elementId:o}}}function mw(s,t){var o,c,u,f,m,g,y,b,v;const a=cw(s);if(!a.ok)return(o=t.onError)==null||o.call(t,a.error),!1;const r=a.data;switch(r.type){case"ready":return(c=t.onReady)==null||c.call(t,r),!0;case"event":{const S=r.payload??{};return typeof S.event!="string"?((u=t.onError)==null||u.call(t,`iframe event message requires payload.event string, got ${JSON.stringify(S.event)}`),!1):((f=t.onEvent)==null||f.call(t,S.event,S.data,r),!0)}case"command":{const S=r.payload??{};return typeof S.command!="string"?((m=t.onError)==null||m.call(t,`iframe command message requires payload.command string, got ${JSON.stringify(S.command)}`),!1):((g=t.onCommand)==null||g.call(t,S.command,S.payload,r),!0)}case"select":case"inspect":case"screenshot":case"highlight":{const S=hw(r.type,r.payload);return S.ok?((b=t.onEvent)==null||b.call(t,pw[r.type],{...r.payload??{},elementRef:S.elementRef},r),!0):((y=t.onError)==null||y.call(t,S.error),!1)}default:return(v=t.onError)==null||v.call(t,`unsupported message type: ${JSON.stringify(r.type)}`),!1}}function gw(s,t){const a=_.useRef(t);a.current=t;const r=o=>{var u;const c=(u=s.current)==null?void 0:u.contentWindow;c&&c.postMessage(o,"*")};return _.useEffect(()=>{const o=c=>{var b;const u=(b=s.current)==null?void 0:b.contentWindow;if(u&&c.source!==u||u===void 0&&c.source!==null)return;const{eventBus:f,onCommand:m,onReady:g,onError:y}=a.current;mw(c.data,{onEvent:(v,S)=>f.emit(v,S),onCommand:m??(()=>{}),onReady:g,onError:y})};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[s]),{post:r}}function yw(s,t){const a=(s.split(".").pop()||"").toLowerCase();return t==="web"||a==="html"||a==="htm"?"html":["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(a)||t==="document"?"image":"text"}function bw({slotId:s}){const{artifactId:t,kind:a,previewUrl:r}=Nf(),{eventBus:o}=nc(),[c,u]=_.useState(null),[f,m]=_.useState(null),[g,y]=_.useState(null),b=_.useRef(null),v=t??null,S=v?yw(v,a):"text";return gw(b,{eventBus:o,onError:k=>y(k)}),_.useEffect(()=>{if(S!=="html"||!v)return;if(r&&r.startsWith("blob:")){m(r),y(null);return}let k=!1;return y(null),u(null),(async()=>{try{const C=await ze.files.read(v);if(k)return;if(!C.success||C.data===void 0){y(C.error||"failed to read artifact");return}const E=new Blob([String(C.data)],{type:"text/html"}),O=URL.createObjectURL(E);u(String(C.data)),m(O)}catch(C){k||y(C instanceof Error?C.message:String(C))}})(),()=>{k=!0,f&&URL.revokeObjectURL(f)}},[S,v,r]),h.jsxs("div",{className:"flex h-full w-full min-h-0 flex-col","data-testid":`web-preview-${s}`,children:[h.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:[h.jsx("span",{className:"truncate font-mono",children:v??"no artifact"}),h.jsx("span",{className:"ml-auto shrink-0 uppercase",children:S})]}),g&&h.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:g}),h.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:v?S==="html"&&f?h.jsx("iframe",{ref:b,title:`preview-${v}`,sandbox:"allow-scripts allow-forms allow-modals",src:f,className:"h-full w-full border-0 bg-white","data-testid":"web-preview-iframe"}):S==="image"?h.jsx("img",{src:r??void 0,alt:v,className:"mx-auto max-h-full max-w-full object-contain","data-testid":"web-preview-image"}):h.jsx("pre",{className:"whitespace-pre-wrap break-all p-3 font-mono text-[11px] leading-relaxed text-dark-text",children:c??(r?`Loading ${v}…`:`Preview ${v}`)}):h.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 xw(s){return s.register({id:"web-preview",capability:"preview.artifact",component:bw,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 vw=["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"],Sw=/(?:^|[_\W])(write|edit|save|create|update|modify|patch|output|export|render|generate|build)(?:[_\W]|$)/i,kw=/(?:^|[_\W])(read|open|cat|view|list|ls|dir|find|grep|glob|search)(?:[_\W]|$)/i;function ww(s){return vw.includes(s)?!0:Sw.test(s)&&!kw.test(s)}function _w(s){let t=null;if(typeof s=="string")try{const a=JSON.parse(s);a&&typeof a=="object"&&!Array.isArray(a)&&(t=a)}catch{return}else s&&typeof s=="object"&&!Array.isArray(s)&&(t=s);if(t)return t.filePath||t.path||t.file||t.file_path||t.outputPath||t.output}function Jr(s){const t=s.split(/[\\/]/);return t[t.length-1]||s}function uf(s){const t=(s.split(".").pop()||"").toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(t)?"image":["md","markdown","mdown"].includes(t)?"markdown":["ts","tsx","js","jsx","json","css","html","htm","py","sh","yaml","yml","go","rs","toml","sql","java","c","cpp","h","rb","php"].includes(t)?"code":"file"}function Cw({kind:s,size:t=14}){return s==="image"?h.jsx(e0,{size:t,className:"text-dark-muted shrink-0"}):s==="markdown"?h.jsx(Ci,{size:t,className:"text-dark-muted shrink-0"}):s==="code"?h.jsx(t0,{size:t,className:"text-dark-muted shrink-0"}):h.jsx(Yy,{size:t,className:"text-dark-muted shrink-0"})}function _b(s){var a;const t=new Map;for(const r of s){if((a=r.fileJob)!=null&&a.result)for(const o of r.fileJob.result)o.path&&!t.has(o.path)&&t.set(o.path,{path:o.path,name:o.fileName||Jr(o.path),source:"filejob"});for(const o of r.toolCalls??[]){if(o.status==="error")continue;const c=_w(o.args);c&&ww(o.name)&&!t.has(c)&&t.set(c,{path:c,name:Jr(c),source:"toolcall"})}}return Array.from(t.values())}function Ew({status:s}){return s==="running"?h.jsx(Nn,{size:12,className:"animate-spin text-accent-blue shrink-0 mt-0.5"}):s==="completed"?h.jsx(Jo,{size:12,className:"text-accent-green shrink-0 mt-0.5"}):s==="failed"?h.jsx(bf,{size:12,className:"text-accent-red shrink-0 mt-0.5"}):s==="skipped"?h.jsx(Jv,{size:12,className:"text-dark-muted shrink-0 mt-0.5"}):h.jsx(yf,{size:12,className:"text-dark-muted shrink-0 mt-0.5"})}function Nw({sessionId:s}){const{t}=Tn(),a=Qe(y=>s?y.getTasksForSession(s):[]),r=Qe(y=>s?y.getRunningAgentCount(s):0),o=Qe(y=>s?y.getForSession(s):void 0),u=je(y=>s?y.isGenerating(s):!1)||r>0||(o==null?void 0:o.status)==="RUNNING"||(o==null?void 0:o.status)==="RESUMING",f=_.useMemo(()=>s?Qe.getState().getEventsForSession(s).filter(b=>b.type==="tool_call"||b.title).length:0,[s,a.length,r,o==null?void 0:o.updatedAt]);if(a.length===0)return u?h.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted py-0.5",children:[h.jsx(Nn,{size:13,className:"animate-spin text-accent-blue shrink-0"}),h.jsx("span",{className:"truncate",children:r>0?t("chat.sidebarWorkingWithAgents",{n:r}):f>0?t("chat.sidebarWorkingToolcalls",{n:f}):t("chat.sidebarWorking")})]}):h.jsx("p",{className:"text-[11px] leading-relaxed text-dark-muted/70",children:t("chat.sidebarIdle")});const m=a.slice(0,12),g=a.length-m.length;return h.jsxs("div",{className:"space-y-1.5",children:[m.map(y=>h.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[h.jsx(Ew,{status:y.status}),h.jsxs("span",{className:pt("min-w-0 flex-1 leading-snug break-words",y.status==="completed"&&"text-dark-muted/70 line-through decoration-dark-muted/40",y.status==="failed"&&"text-accent-red/90"),children:[y.title,y.status==="running"&&y.progress!==void 0&&h.jsx("span",{className:"block mt-1",children:h.jsx("span",{className:"block w-full h-1 bg-dark-surface rounded-full overflow-hidden",children:h.jsx("span",{className:"block h-full bg-accent-blue rounded-full transition-all duration-500",style:{width:`${Math.max(0,Math.min(100,y.progress))}%`}})})})]})]},y.id)),g>0&&h.jsxs("p",{className:"text-[10px] text-dark-muted/70",children:["+",g," ",t("chat.sidebarMoreTasks")]}),u&&h.jsx("p",{className:"text-[10px] text-dark-muted/70 pt-0.5",children:r>0?t("chat.sidebarRunningAgents",{n:r}):t("chat.sidebarToolcallsSoFar",{n:f})})]})}function Cb({sessionId:s,messages:t,previewFile:a,onPreview:r,onClosePreview:o}){const{t:c}=Tn(),[u,f]=_.useState(null),[m,g]=_.useState(!1),[y,b]=_.useState(null),v=_.useCallback(async E=>{g(!0),b(null),f(null);try{const O=await ze.files.read(E);O.success&&O.data!==void 0&&O.data!==null?f(String(O.data)):b(O.error||c("chat.fileReadError"))}catch(O){b(O instanceof Error?O.message:c("chat.fileReadError"))}finally{g(!1)}},[c]);_.useEffect(()=>{if(!a){f(null),g(!1),b(null);return}if(uf(a)==="file"){f(null),g(!1),b(null);return}v(a)},[a,v]);const S=_.useCallback(async E=>{const O=await ze.files.download(E);O.success||ke.error(O.error||c("chat.fileReadError"))},[c]),k=_.useCallback(async E=>{try{await navigator.clipboard.writeText(E),ke.success(c("chat.copiedPath"))}catch{ke.error(c("chat.copyPathFailed"))}},[c]),C=a?uf(a):"file";return h.jsx("div",{className:"flex-1 min-h-0 min-w-0 flex flex-col overflow-hidden",children:a?h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsx("div",{className:"shrink-0 px-2 py-2 border-b border-dark-border/60",children:h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("button",{onClick:o,className:"p-1 rounded hover:bg-dark-hover transition-colors text-dark-muted shrink-0",title:c("chat.backToArtifacts"),"aria-label":c("chat.backToArtifacts"),children:h.jsx(xf,{size:15})}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-1 text-xs font-semibold text-dark-text truncate",children:[h.jsx("span",{className:"text-dark-muted font-normal shrink-0",children:c("chat.artifactPanel")}),h.jsx("span",{className:"text-dark-muted/50 shrink-0",children:"/"}),h.jsx("span",{className:"truncate",children:Jr(a)})]}),h.jsx("div",{className:"text-[10px] font-mono text-dark-muted truncate mt-0.5",title:a,children:a})]}),h.jsx("button",{onClick:()=>void k(a),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:c("chat.copyPath"),"aria-label":c("chat.copyPath"),children:h.jsx(Gy,{size:14})}),h.jsx("a",{href:Ho(`/api/files/read?path=${encodeURIComponent(a)}`),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:c("chat.openInNewTab"),"aria-label":c("chat.openInNewTab"),children:h.jsx(xg,{size:14})}),h.jsx("button",{onClick:()=>void S(a),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:c("fileJob.download"),"aria-label":c("fileJob.download"),children:h.jsx(nl,{size:14})})]})}),h.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 custom-scrollbar p-3",children:m?h.jsx("div",{className:"flex items-center justify-center py-10 text-dark-muted",children:h.jsx(Nn,{size:18,className:"animate-spin text-accent-blue"})}):y?h.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:[h.jsx(Xo,{size:14,className:"shrink-0 mt-0.5"}),h.jsx("span",{className:"break-words",children:y})]}):C==="image"?h.jsx("img",{src:Ho(`/api/files/download?path=${encodeURIComponent(a)}`),alt:Jr(a),className:"max-w-full h-auto rounded-lg border border-dark-border"}):C==="markdown"&&u!=null?h.jsx(d1,{content:u}):C==="code"?h.jsx("pre",{className:"text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-all text-dark-text",children:u??""}):h.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 px-4 text-center",children:[h.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:h.jsx(Yy,{size:30,className:"text-accent-blue"})}),h.jsxs("div",{className:"min-w-0 w-full max-w-sm",children:[h.jsx("div",{className:"text-sm font-semibold text-dark-text break-all leading-snug",children:Jr(a)}),h.jsx("div",{className:"mt-1.5 text-[11px] font-mono text-dark-muted break-all leading-relaxed",title:a,children:a})]}),h.jsx("p",{className:"text-[11px] text-dark-muted/70 leading-relaxed max-w-xs",children:c("chat.filePreviewHint")}),h.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[h.jsxs("a",{href:Ho(`/api/files/read?path=${encodeURIComponent(a)}`),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:c("chat.openInNewTab"),children:[h.jsx(xg,{size:13}),c("chat.openInNewTab")]}),h.jsxs("button",{onClick:()=>void S(a),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:c("fileJob.download"),children:[h.jsx(nl,{size:13}),c("fileJob.download")]})]})]})})]}):h.jsx(_1,{sessionId:s,messages:t,onPreview:r})})}function Tw({sessionId:s,messages:t,previewFile:a,onPreview:r,onClosePreview:o,isMaximized:c,onToggleMaximize:u}){const{t:f}=Tn(),m=_.useMemo(()=>_b(t),[t]),[g,y]=_.useState("artifacts"),b=_.useMemo(()=>({type:"split",direction:"horizontal",children:[{type:"slot",id:"left"},{type:"split",direction:"vertical",children:[{type:"slot",id:"right"},{type:"slot",id:"preview"}]}]}),[]);return h.jsxs("div",{className:"w-full h-full border-l border-dark-border bg-dark-surface flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"shrink-0 px-3 py-2.5 border-b border-dark-border bg-dark-surface flex items-center gap-2",children:[h.jsx(Ky,{size:14,className:"text-accent-blue shrink-0"}),h.jsx("span",{className:"text-xs font-semibold text-dark-text truncate",children:f(g==="workspace"?"chat.workspaceTitle":"chat.artifactPanel")}),h.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[g==="artifacts"&&!a&&m.length>0&&h.jsx("span",{className:"text-[10px] text-dark-muted tabular-nums",children:m.length}),h.jsx("button",{onClick:()=>y(v=>v==="workspace"?"artifacts":"workspace"),className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:f(g==="workspace"?"chat.artifactsToggle":"chat.workspaceToggle"),"aria-label":f(g==="workspace"?"chat.artifactsToggle":"chat.workspaceToggle"),"data-testid":"sidebar-view-toggle",children:h.jsx(n0,{size:14})}),u&&h.jsx("button",{onClick:u,className:"p-1 rounded text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors shrink-0",title:f(c?"chat.sidebarRestore":"chat.sidebarMaximize"),"aria-label":f(c?"chat.sidebarRestore":"chat.sidebarMaximize"),children:c?h.jsx(s0,{size:14}):h.jsx(a0,{size:14})})]})]}),g==="workspace"?h.jsx(uw,{layout:b,onRegister:v=>{const S=[fw(v),xw(v)];return()=>S.forEach(k=>k())}}):h.jsx(Cb,{sessionId:s,messages:t,previewFile:a,onPreview:r,onClosePreview:o}),h.jsx("div",{className:"shrink-0 px-3 py-2 border-t border-dark-border/60",children:h.jsx("p",{className:"text-[10px] text-dark-muted/60 leading-relaxed",children:f(g==="workspace"?"chat.workspaceHint":"chat.artifactHint")})})]})}_.createContext(null);function Tf({isOpen:s,onClose:t,title:a,children:r,size:o="md",className:c}){if(_.useEffect(()=>{const f=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),t())};return s&&(document.addEventListener("keydown",f),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",f),document.body.style.overflow=""}},[s,t]),!s)return null;const u={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 h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center overflow-hidden p-4",children:[h.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),h.jsxs("div",{className:pt("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",u[o],c),children:[a&&h.jsxs("div",{className:"flex shrink-0 items-center justify-between px-6 py-4 border-b border-dark-border",children:[h.jsx("h2",{className:"text-lg font-semibold text-dark-text",children:a}),h.jsx("button",{onClick:t,"aria-label":"Close",className:"p-1 rounded-lg text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:h.jsx(bs,{className:"w-5 h-5","aria-hidden":"true"})})]}),h.jsx("div",{className:"min-h-0 overflow-y-auto custom-scrollbar p-6",children:r})]})]})}function RE({isOpen:s,onClose:t,onConfirm:a,title:r="确认",message:o,confirmText:c="确认",cancelText:u="取消",variant:f="default"}){const m=()=>{a(),t()};return h.jsxs(Tf,{isOpen:s,onClose:t,title:r,size:"sm",children:[h.jsx("p",{className:"text-dark-muted mb-6",children:o}),h.jsxs("div",{className:"flex gap-3 justify-end",children:[h.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:u}),h.jsx("button",{onClick:m,className:pt("px-4 py-2 rounded-lg text-white transition-colors",f==="danger"?"bg-accent-red hover:bg-accent-red/90":"bg-accent-blue hover:bg-accent-blue/90"),children:c})]})]})}function Cy({children:s,variant:t="default",size:a="md",className:r}){const o={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"},c={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs"};return h.jsx("span",{className:pt("inline-flex items-center rounded-full font-medium",o[t],c[a],r),children:s})}const Aw={string:"文本",number:"数字",select:"选择",boolean:"开关",folder:"目录",connector:"连接器"};function jw({template:s,onCancel:t,onSubmit:a,submitLabel:r="启动",busy:o=!1}){const c=s.inputs??[],u=_.useMemo(()=>{const S={};for(const k of c)k.default!==void 0&&k.default!==null&&(S[k.name]=k.default);return S},[c]),[f,m]=_.useState(u),[g,y]=_.useState({});if(c.length===0)return h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"text-sm text-dark-muted",children:"该模板无需参数,直接启动。"}),h.jsx("div",{className:"text-xs text-dark-muted/80 break-all",children:s.description||"—"}),h.jsxs("div",{className:"flex justify-end gap-3",children:[h.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>a({}),disabled:o,className:"px-4 py-2 rounded-lg bg-accent-blue text-white hover:bg-accent-blue/90 disabled:opacity-50 transition-colors",children:o?"启动中…":r})]})]});const b=(S,k)=>{m(C=>({...C,[S]:k})),y(C=>{if(!C[S])return C;const E={...C};return delete E[S],E})},v=()=>{const S={},k={};for(const C of c){let E=f[C.name];typeof E=="string"&&(E=E.trim());const O=E==null||E==="";if(C.required&&O){S[C.name]="必填";continue}if(!O)if(C.type==="number"){const j=Number(E);if(!Number.isFinite(j)){S[C.name]="请输入数字";continue}k[C.name]=j}else k[C.name]=E}if(Object.keys(S).length>0){y(S);return}a(k)};return h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"text-sm text-dark-muted",children:s.description||""}),c.map(S=>h.jsxs("div",{children:[h.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-dark-text mb-1.5",children:[h.jsx("span",{children:S.label||S.name}),S.required&&h.jsx("span",{className:"text-accent-red",children:"*"}),S.type!=="boolean"&&h.jsx("span",{className:"text-[10px] text-dark-muted/70",children:Aw[S.type]})]}),Rw(S,f[S.name],b),S.description&&h.jsx("div",{className:"mt-1 text-xs text-dark-muted/70",children:S.description}),g[S.name]&&h.jsx("div",{className:"mt-1 text-xs text-accent-red",children:g[S.name]})]},S.name)),h.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[h.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg border border-dark-border text-dark-text hover:bg-dark-hover transition-colors",children:"取消"}),h.jsx("button",{onClick:v,disabled:o,className:"px-4 py-2 rounded-lg bg-accent-blue text-white hover:bg-accent-blue/90 disabled:opacity-50 transition-colors",children:o?"启动中…":r})]})]})}function Rw(s,t,a){const r="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(s.type){case"select":return h.jsxs("select",{value:typeof t=="string"?t:s.default||"",onChange:o=>a(s.name,o.target.value),className:r,children:[!s.required&&h.jsx("option",{value:"",children:"(不选)"}),(s.options||[]).map(o=>h.jsx("option",{value:o,children:o},o))]});case"boolean":return h.jsx("button",{type:"button",onClick:()=>a(s.name,t!==!0),className:pt("h-6 w-11 rounded-full transition-colors relative flex items-center px-0.5",t===!0?"bg-accent-blue":"bg-dark-border"),"aria-pressed":t===!0,children:h.jsx("span",{className:pt("h-5 w-5 rounded-full bg-white transition-transform",t===!0&&"translate-x-5")})});case"number":return h.jsx("input",{type:"number",value:typeof t=="number"||typeof t=="string"?t:"",onChange:o=>a(s.name,o.target.value),placeholder:typeof s.default=="number"?String(s.default):"0",className:r});default:return h.jsx("input",{type:"text",value:typeof t=="string"?t:"",onChange:o=>a(s.name,o.target.value),placeholder:typeof s.default=="string"?s.default:"",className:r})}}function Ow({collapsed:s=!1,onDirect:t,onStartTemplate:a,onManageTemplates:r}){const[o,c]=_.useState(!1),[u,f]=_.useState({kind:"list"}),[m,g]=_.useState([]),[y,b]=_.useState(!1),[v,S]=_.useState(""),[k,C]=_.useState({top:0,left:0}),E=_.useRef(null),O=_.useCallback(()=>{f({kind:"list"}),c(!0)},[]);_.useEffect(()=>{var Z;if(!o)return;const K=(Z=E.current)==null?void 0:Z.getBoundingClientRect();K&&C({top:K.bottom+6,left:Math.max(8,K.left)})},[o,s]),_.useEffect(()=>{if(!o||u.kind!=="list")return;let K=!1;return b(!0),S(""),ze.templates.list().then(Z=>{K||(Z.success&&Z.data?g(Z.data):S(Z.error||"加载模板失败"))}).catch(()=>{K||S("加载模板失败")}).finally(()=>{K||b(!1)}),()=>{K=!0}},[o,u.kind]);const j=_.useMemo(()=>{const K=new Map;for(const Z of m){const te=Z.category||"其他",pe=K.get(te)||[];pe.push(Z),K.set(te,pe)}return[...K.entries()]},[m]),T=async K=>{const Z=await ze.templates.get(K.id);Z.success&&Z.data?f({kind:"form",template:Z.data}):S(Z.error||"加载模板失败")},U=K=>{u.kind==="form"&&(a(u.template,K),c(!1),f({kind:"list"}))},R={top:k.top,left:k.left,width:Math.min(360,typeof window<"u"?window.innerWidth-16:360)};return h.jsxs("div",{ref:E,className:"relative",children:[h.jsx("div",{className:"flex",children:s?h.jsx("button",{onClick:O,className:"btn btn-primary w-full !px-0 aspect-square",title:"新建会话","aria-label":"新建会话",children:h.jsx($o,{size:16,"aria-hidden":"true"})}):h.jsxs(h.Fragment,{children:[h.jsxs("button",{onClick:t,className:"btn btn-primary flex-1 !px-3 py-2 rounded-l-lg",children:[h.jsx($o,{size:15,"aria-hidden":"true"}),"新建会话"]}),h.jsx("button",{onClick:()=>o?c(!1):O(),className:"px-2.5 rounded-r-lg bg-accent-blue text-white border-l border-white/25 hover:opacity-95 flex items-center",title:"用模板新建","aria-label":"选择模板新建会话",children:h.jsx(Ea,{size:13,"aria-hidden":"true"})})]})}),o&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(!1)}),h.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:R,children:u.kind==="form"?h.jsxs("div",{className:"p-2",children:[h.jsxs("button",{onClick:()=>f({kind:"list"}),className:"mb-2 inline-flex items-center gap-1 text-xs text-dark-muted hover:text-dark-text transition-colors",children:[h.jsx(i0,{className:"w-3.5 h-3.5"})," 返回模板列表"]}),h.jsx("div",{className:"text-sm font-medium text-dark-text mb-3",children:u.template.name}),h.jsx(jw,{template:u.template,onCancel:()=>f({kind:"list"}),onSubmit:U,submitLabel:"启动"})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"px-2 py-1 text-[10.5px] uppercase tracking-[0.06em] text-dark-muted/70 font-semibold",children:"开始一个会话"}),h.jsxs("button",{onClick:()=>{c(!1),t()},className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-lg hover:bg-dark-hover text-left",children:[h.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:h.jsx(ec,{className:"w-3.5 h-3.5"})}),h.jsxs("span",{className:"min-w-0",children:[h.jsx("span",{className:"block text-[13px] font-medium text-dark-text",children:"直接对话"}),h.jsx("span",{className:"block text-[11px] text-dark-muted truncate",children:"不选模板,AI 现场拆解任务(动态工作流)"})]})]}),y&&h.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-xs text-dark-muted",children:[h.jsx(Nn,{className:"w-3.5 h-3.5 animate-spin"})," 加载模板…"]}),v&&!y&&h.jsx("div",{className:"px-2 py-2 text-xs text-accent-red",children:v}),!y&&!v&&j.length===0&&h.jsx("div",{className:"px-2 py-2 text-xs text-dark-muted",children:"暂无已保存模板。"}),j.map(([K,Z])=>h.jsxs("div",{className:"mt-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[h.jsx(Io,{className:"w-3 h-3 text-dark-muted/70"}),h.jsx("span",{className:"text-[10px] uppercase tracking-[0.06em] text-dark-muted/70 font-semibold",children:K}),h.jsx(Cy,{size:"sm",children:Z.length})]}),Z.map(te=>h.jsxs("button",{onClick:()=>void T(te),className:"w-full flex items-center gap-2.5 px-2 py-2 rounded-lg hover:bg-dark-hover text-left",children:[h.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:h.jsx(Io,{className:"w-3.5 h-3.5"})}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"block text-[13px] font-medium text-dark-text truncate",children:te.name}),h.jsxs(Cy,{size:"sm",variant:"info",children:["v",te.version]})]}),te.description&&h.jsx("span",{className:"block text-[11px] text-dark-muted truncate",children:te.description})]})]},te.id))]},K)),h.jsx("div",{className:"border-t border-dark-border mt-1 pt-1",children:h.jsx("button",{onClick:()=>{c(!1),r()},className:"w-full px-2 py-1.5 rounded-lg hover:bg-dark-hover text-left text-[12.5px] text-dark-muted",children:"模板库…"})})]})})]})]})}function df(s,t=Date.now(),a){const r=typeof s=="number"?s:new Date(s).getTime();if(!Number.isFinite(r))return"";const o=t-r;if(o<6e4)return a?a("time.justNow"):"刚刚";const c=Math.floor(o/6e4);if(c<60)return a?a("time.minutesAgo",{count:c}):`${c}分钟前`;const u=Math.floor(c/60);if(u<24)return a?a("time.hoursAgo",{count:u}):`${u}小时前`;const f=Math.floor(u/24);if(f<7)return a?a("time.daysAgo",{count:f}):`${f}天前`;const m=new Date(r);return`${m.getFullYear()}-${String(m.getMonth()+1).padStart(2,"0")}-${String(m.getDate()).padStart(2,"0")}`}const Ur=10;function Mw({isOpen:s,onClose:t,onSwitchSession:a}){const{t:r}=Tn(),o=we(E=>E.sessionTabs),c=we(E=>E.activeSessionId),u=je(E=>E.generatingSessions),[f,m]=_.useState(0),g=_.useMemo(()=>[...o].sort((E,O)=>(O.lastActiveAt??O.createdAt??0)-(E.lastActiveAt??E.createdAt??0)),[o]),y=Math.max(1,Math.ceil(g.length/Ur)),b=Math.min(f,y-1),v=_.useMemo(()=>{const E=new Map,O=b*Ur;for(const j of g.slice(O,O+Ur)){const T=j.project||"default",U=E.get(T)||[];U.push(j),E.set(T,U)}return Array.from(E.entries())},[g,b]),S=g.length===0?0:b*Ur+1,k=Math.min((b+1)*Ur,g.length),C=E=>u.includes(E.id)?"running":E.status||"done";return h.jsx(Tf,{isOpen:s,onClose:t,title:r("chat.sessionPickerTitle"),size:"lg",children:h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsx("div",{className:"max-h-[320px] overflow-y-auto custom-scrollbar rounded-lg border border-dark-border bg-dark-bg p-1.5",children:g.length===0?h.jsx("div",{className:"px-3 py-6 text-center text-xs text-dark-muted/60",children:r("chat.noSessions")}):v.map(([E,O])=>h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 text-[10px] text-dark-muted/70",children:[h.jsx(Zy,{size:10,"aria-hidden":"true",className:"shrink-0 opacity-60"}),h.jsx("span",{className:"truncate",children:E==="default"?r("nav.mySessions"):E}),h.jsx("span",{className:"ml-auto text-[9px] text-dark-muted/40",children:O.length})]}),h.jsx("div",{className:"space-y-0.5",children:O.map(j=>{const T=j.id===c,U=C(j),R=df(j.lastActiveAt??j.createdAt,Date.now(),r),K=Kd(j),Z=rb(j.title,K);return h.jsxs("button",{onClick:()=>{a(j.id),t()},title:r("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 ${T?"bg-accent-blue/10 font-medium text-accent-blue":"text-dark-muted hover:bg-dark-hover/60 hover:text-dark-text"}`,children:[h.jsx(ec,{size:13,"aria-hidden":"true",className:"shrink-0 opacity-60"}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"min-w-0 flex-1 truncate",children:j.title}),U==="running"&&h.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-red animate-pulse",title:r("nav.sessionRunning")}),U==="waiting"&&h.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-yellow",title:r("nav.sessionWaiting")}),U==="failed"&&h.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-red",title:r("nav.sessionFailed")}),U==="done"&&h.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-accent-green",title:r("nav.sessionDone")})]}),h.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[11px] leading-tight text-dark-muted/60",children:[Z&&h.jsx("span",{className:"min-w-0 flex-1 truncate",children:K}),h.jsx("span",{className:`shrink-0 ${Z?"":"ml-auto"}`,children:R})]})]})]},j.id)})})]},E))}),h.jsxs("div",{className:"flex items-center justify-between text-xs text-dark-muted",children:[h.jsx("span",{children:r("common.pageInfo",{start:S,end:k,total:g.length})}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsxs("button",{onClick:()=>m(E=>Math.max(0,E-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:[h.jsx(xf,{size:13,"aria-hidden":"true"}),r("common.prevPage")]}),h.jsxs("span",{className:"min-w-[48px] text-center font-mono",children:[b+1,"/",y]}),h.jsxs("button",{onClick:()=>m(E=>Math.min(y-1,E+1)),disabled:b>=y-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:[r("common.nextPage"),h.jsx(Qy,{size:13,"aria-hidden":"true"})]})]})]})]})})}const Mo=5,Bw=[{labelKey:"nav.groupWorkspace",ids:["chat","terminal","files"]},{labelKey:"nav.groupConfig",ids:["models","tools","skills","templates","hooks","channels","connectors","scheduled","plugins"]},{labelKey:"nav.groupSystem",ids:["logs","settings"]}],Ey=_.memo(function({collapsed:t,onToggleCollapse:a,tabs:r,activeTab:o,onTabChange:c,isConnected:u,onNewSession:f,onStartTemplate:m,onManageTemplates:g,onSwitchSession:y,onCloseSession:b,onRenameSession:v,getTabTitle:S}){const{t:k}=Tn(),C=we(X=>X.sessionTabs),E=we(X=>X.activeSessionId),O=we(X=>X.historySessions),j=we(X=>X.restoreHistorySession),T=we(X=>X.removeHistorySession),[U,R]=_.useState(!1),[K,Z]=_.useState(!1),[te,pe]=_.useState(null),[he,it]=_.useState(""),de=_.useRef(null),W=_.useMemo(()=>Bw.map(X=>({...X,tabs:X.ids.map(se=>r.find(le=>le.id===se)).filter(se=>!!se)})).filter(X=>X.tabs.length>0),[r]),Y=_.useCallback((X,se)=>{pe(X),it(se),setTimeout(()=>{var le;return(le=de.current)==null?void 0:le.select()},50)},[]),ve=_.useCallback(()=>{te&&he.trim()&&v(te,he.trim()),pe(null)},[te,he,v]),H=_.useCallback((X,se)=>{var Ht;const le=je.getState().getMessages(X),ae=[];ae.push(`# ${se||k("nav.chat")}`),ae.push(""),ae.push(`> ${k("chat.exportMd")} · ${new Date().toLocaleString()}`),ae.push(""),ae.push("---"),ae.push(""),(!le||le.length===0)&&(ae.push(k("chat.noSessions")),ae.push(""));for(const gt of le){if(gt.deleted)continue;const Oe=gt.type==="user"?k("chat.you"):k("chat.assistantLabel");if(ae.push(`## ${Oe} · ${new Date(gt.timestamp).toLocaleString()}`),ae.push(""),gt.thinking&>.thinking.trim()&&(ae.push("<details>"),ae.push(`<summary>💭 ${k("chat.thoughtProcess")}</summary>`),ae.push(""),ae.push(gt.thinking.trim()),ae.push(""),ae.push("</details>"),ae.push("")),gt.content&>.content.trim()&&(ae.push(gt.content.trim()),ae.push("")),gt.steps&>.steps.length>0){ae.push(`**${k("chat.runningSteps")}:**`),ae.push("");for(const $t of gt.steps){if(ae.push(`- **${$t.title}**${$t.status?` (\`${$t.status}\`)`:""}`),$t.thought&&ae.push(` - 💭 ${$t.thought}`),(Ht=$t.toolCalls)!=null&&Ht.length)for(const Ta of $t.toolCalls)ae.push(` - 🛠 \`${Ta.name}\``);$t.result&&ae.push(` - ${$t.result}`)}ae.push("")}ae.push("---"),ae.push("")}const et=new Blob([ae.join(`
|
|
52
|
-
`)],{type:"text/markdown;charset=utf-8"}),lt=URL.createObjectURL(et),jt=document.createElement("a");jt.href=lt,jt.download=`${(se||"session").replace(/[\\/:*?"<>|]/g,"_").slice(0,80)}.md`,jt.click(),URL.revokeObjectURL(lt)},[k]),Q=_.useCallback(X=>{j(X),ge.setSessionId(X)},[j]),ne=_.useCallback(X=>{y(X),o!=="chat"&&c("chat")},[y,c,o]),Be=je(X=>X.generatingSessions),Pe=_.useCallback(X=>Be.includes(X.id)?"running":X.status||"done",[Be]),qe=_.useMemo(()=>{const X=new Map,se=[...C].sort((ae,et)=>(et.lastActiveAt??et.createdAt??0)-(ae.lastActiveAt??ae.createdAt??0));let le=se;if(se.length>Mo){const ae=se.slice(0,Mo),et=se.find(lt=>lt.id===E);et&&!ae.some(lt=>lt.id===et.id)?le=[et,...ae.filter(lt=>lt.id!==et.id)].slice(0,Mo):le=ae}for(const ae of le){const et=ae.project||"default",lt=X.get(et)||[];lt.push(ae),X.set(et,lt)}return Array.from(X.entries())},[C,E]);return h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsxs("div",{className:`flex h-14 shrink-0 items-center gap-2.5 border-b border-dark-border/70 ${t?"justify-center px-2":"px-4"}`,children:[h.jsx("img",{src:"/logo.svg",alt:"deepseekcode",className:"h-7 w-7 rounded-lg shadow-sm"}),!t&&h.jsx("span",{className:"flex-1 truncate text-[15px] font-semibold tracking-tight text-dark-text",children:"deepseekcode"}),h.jsx("button",{onClick:a,className:`rounded-md p-1.5 text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text ${t?"hidden":""}`,title:k("nav.collapseSidebar"),"aria-label":k("nav.collapseSidebar"),children:h.jsx(r0,{size:16,"aria-hidden":"true"})})]}),h.jsx("div",{className:t?"p-2":"px-3 pt-3",children:m&&g?h.jsx(Ow,{collapsed:t,onDirect:f,onStartTemplate:m,onManageTemplates:g}):h.jsxs("button",{onClick:f,className:"btn btn-primary w-full",children:[h.jsx($o,{size:15,"aria-hidden":"true"}),k("chat.newSession")]})}),h.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar px-3 pb-2 min-h-0",children:[!t&&h.jsxs("div",{className:"pt-2",children:[h.jsxs("div",{className:"side-group-label flex items-center justify-between",children:[h.jsx("span",{children:k("nav.sessions")}),O.length>0&&h.jsxs("button",{onClick:()=>R(X=>!X),className:"flex items-center gap-0.5 rounded px-1 py-0.5 text-dark-muted/70 transition-colors hover:text-dark-text",title:k("chat.sessionHistory"),"aria-expanded":U,children:[h.jsx(vg,{size:11,"aria-hidden":"true"}),h.jsx(Ea,{size:11,"aria-hidden":"true",className:`transition-transform ${U?"":"-rotate-90"}`})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[qe.map(([X,se])=>h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 text-[10px] text-dark-muted/70",children:[h.jsx(Zy,{size:10,"aria-hidden":"true",className:"shrink-0 opacity-60"}),h.jsx("span",{className:"truncate",children:X==="default"?k("nav.mySessions"):X}),h.jsx("span",{className:"ml-auto text-[9px] text-dark-muted/40",children:se.length})]}),h.jsx("div",{className:"space-y-0.5",children:se.map(le=>{const ae=le.id===E,et=te===le.id,lt=Pe(le),jt=df(le.lastActiveAt??le.createdAt,Date.now(),k),Ht=Kd(le),gt=rb(le.title,Ht);return h.jsxs("div",{onClick:()=>!et&&ne(le.id),onDoubleClick:()=>Y(le.id,le.title),className:`group flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-[6px] text-[13px] transition-colors ${ae?"bg-dark-hover font-medium text-dark-text":"text-dark-muted hover:bg-dark-hover/60 hover:text-dark-text"}`,children:[h.jsx(ec,{size:13,"aria-hidden":"true",className:"shrink-0 opacity-60"}),et?h.jsx("input",{ref:de,value:he,onChange:Oe=>it(Oe.target.value),onBlur:ve,onKeyDown:Oe=>{Oe.key==="Enter"?ve():Oe.key==="Escape"&&pe(null)},onClick:Oe=>Oe.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}):h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"min-w-0 flex-1 truncate",children:le.title}),lt==="running"&&h.jsxs("span",{className:"pixel-spinner shrink-0 text-accent-red",title:k("nav.sessionRunning"),"aria-hidden":"true",children:[h.jsx("span",{}),h.jsx("span",{}),h.jsx("span",{}),h.jsx("span",{})]}),lt==="waiting"&&h.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-yellow",title:k("nav.sessionWaiting")}),lt==="failed"&&h.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-red",title:k("nav.sessionFailed")}),lt==="done"&&h.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[1px] bg-accent-green",title:k("nav.sessionDone")})]}),h.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[11px] leading-tight text-dark-muted/50",children:[gt&&h.jsx("span",{className:"min-w-0 flex-1 truncate",children:Ht}),h.jsx("span",{className:`shrink-0 ${gt?"":"ml-auto"}`,children:jt})]})]}),!et&&h.jsxs(h.Fragment,{children:[h.jsx("button",{onClick:Oe=>{Oe.stopPropagation(),Y(le.id,le.title)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100",title:k("chat.renameSession"),"aria-label":k("chat.renameSession"),children:h.jsx(l0,{size:11,"aria-hidden":"true"})}),h.jsx("button",{onClick:Oe=>{Oe.stopPropagation(),H(le.id,le.title)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100",title:k("chat.exportMd"),"aria-label":k("chat.exportMd"),children:h.jsx(nl,{size:11,"aria-hidden":"true"})}),C.length>1&&h.jsx("button",{onClick:Oe=>{Oe.stopPropagation(),b(le.id)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100","aria-label":k("a11y.close"),children:h.jsx(bs,{size:12,"aria-hidden":"true"})})]})]},le.id)})})]},X)),C.length===0&&h.jsx("div",{className:"px-2.5 py-2 text-xs text-dark-muted/60",children:k("chat.noSessions")})]}),C.length>Mo&&h.jsxs("button",{onClick:()=>Z(!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:k("chat.viewAllSessions"),children:[h.jsx(o0,{size:12,"aria-hidden":"true"}),k("chat.viewAllSessions"),h.jsxs("span",{className:"text-dark-muted/50",children:["(",C.length,")"]})]}),U&&O.length>0&&h.jsx("div",{className:"mt-1 space-y-0.5 border-t border-dark-border/50 pt-1",children:O.slice(0,10).map(X=>{const se=Kd(X);return h.jsxs("div",{onClick:()=>Q(X.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:[h.jsx(vg,{size:11,"aria-hidden":"true",className:"shrink-0 opacity-50"}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block truncate",children:X.title}),se&&h.jsx("span",{className:"block truncate text-[10px] text-dark-muted/50",children:se})]}),h.jsx("span",{className:"shrink-0 text-[10px] text-dark-muted/50",children:df(X.lastActiveAt??X.createdAt,Date.now(),k)}),h.jsx("button",{onClick:le=>{le.stopPropagation(),T(X.id)},className:"shrink-0 rounded p-0.5 opacity-0 transition-all hover:bg-dark-bg group-hover:opacity-100","aria-label":k("chat.removeFromHistory"),children:h.jsx(bs,{size:11,"aria-hidden":"true"})})]},X.id)})})]}),h.jsx("nav",{className:t?"pt-2":"",children:W.map(X=>h.jsxs("div",{children:[!t&&h.jsx("div",{className:"side-group-label",children:k(X.labelKey)}),t&&h.jsx("div",{className:"mx-2 my-2 border-t border-dark-border/60"}),h.jsx("div",{className:`space-y-0.5 ${t?"flex flex-col items-center":""}`,children:X.tabs.map(se=>{const le=o===se.id,ae=se.iconComponent;return t?h.jsx("button",{onClick:()=>c(se.id),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-colors ${le?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:S(se.id,se.title),"aria-label":S(se.id,se.title),"aria-current":le?"page":void 0,children:ae&&h.jsx(ae,{size:17,"aria-hidden":"true"})},se.id):h.jsxs("button",{onClick:()=>c(se.id),className:"side-nav-item","data-active":le,"aria-current":le?"page":void 0,children:[ae&&h.jsx(ae,{size:15,"aria-hidden":"true",className:"shrink-0"}),h.jsx("span",{className:"truncate",children:S(se.id,se.title)})]},se.id)})})]},X.labelKey))})]}),h.jsxs("div",{className:`shrink-0 border-t border-dark-border/70 ${t?"p-2":"p-3"}`,children:[t&&h.jsx("button",{onClick:a,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:k("nav.expandSidebar"),"aria-label":k("nav.expandSidebar"),children:h.jsx(c0,{size:16,"aria-hidden":"true"})}),h.jsxs("div",{className:`flex items-center gap-2 text-xs text-dark-muted ${t?"justify-center":"px-1.5"}`,role:"status","aria-label":k("a11y.connectionStatus"),children:[h.jsx("span",{className:`h-2 w-2 shrink-0 rounded-[1px] ${u?"bg-accent-green":"bg-accent-red"}`,"aria-hidden":"true"}),!t&&h.jsx("span",{className:"truncate",children:k(u?"chat.connected":"chat.disconnected")})]})]}),h.jsx(Mw,{isOpen:K,onClose:()=>Z(!1),onSwitchSession:X=>ne(X)})]})}),Dw={info:"bg-accent-blue",warn:"bg-accent-yellow",error:"bg-accent-red",success:"bg-accent-green",tool:"bg-accent-purple"};function Lw(s){return s==null||s===""?"-":new Date(s).toLocaleString()}function zw(){const[s,t]=_.useState([]),[a,r]=_.useState(!0),[o,c]=_.useState(null),[u,f]=_.useState(null),[m,g]=_.useState(!1),y=_.useCallback(async()=>{r(!0);try{const k=await ze.logs.list();k.success&&Array.isArray(k.data)&&t(k.data)}catch(k){console.error("Failed to load log files:",k)}r(!1)},[]);_.useEffect(()=>{y()},[y]);const b=_.useCallback(async k=>{if(!k.previewable)return;c(k),g(!0);const C=await ze.logs.read(k.name,500);C.success&&C.data&&f(C.data),g(!1)},[]),v=_.useCallback(()=>{c(null),f(null)},[]),S=k=>k<1024?`${k} B`:k<1024*1024?`${(k/1024).toFixed(1)} KB`:`${(k/(1024*1024)).toFixed(1)} MB`;return o&&u?h.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2 shrink-0",children:[h.jsx("button",{onClick:v,className:"p-1 rounded hover:bg-dark-hover transition-colors",title:"返回文件列表",children:h.jsx(xf,{size:16})}),h.jsx("span",{className:"text-sm font-medium text-dark-text truncate flex-1",children:o.name}),h.jsxs("a",{href:ze.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:[h.jsx(nl,{size:12}),"下载"]})]}),m?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx(Nn,{size:20,className:"animate-spin text-accent-blue"})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"text-[10px] text-dark-muted mb-1 shrink-0",children:[S(u.size)," · ",u.totalLines," 行",u.startLine>1&&` (显示最新 ${u.totalLines-u.startLine+1} 行)`]}),h.jsx("div",{className:`flex-1 overflow-y-auto min-h-0 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all
|
|
53
|
-
bg-dark-bg border border-dark-border rounded p-3 custom-scrollbar`,style:{scrollbarWidth:"thin",scrollbarColor:"#30363d transparent"},children:u.content||h.jsx("span",{className:"text-dark-muted italic",children:"(空文件)"})})]})]}):h.jsxs("div",{className:"flex flex-col min-h-0 h-full",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-dark-text",children:"日志文件"}),h.jsx("button",{onClick:y,className:"px-2 py-1 text-[10px] bg-dark-hover rounded hover:bg-dark-border transition-colors",disabled:a,children:a?"刷新中...":"刷新"})]}),a?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx(Nn,{size:16,className:"animate-spin text-accent-blue"})}):s.length===0?h.jsxs("div",{className:"text-center py-8 text-dark-muted",children:[h.jsx(Ci,{size:32,className:"mx-auto mb-1 opacity-50"}),h.jsx("p",{className:"text-xs",children:"暂无日志文件"})]}):h.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 space-y-1 custom-scrollbar",children:s.map(k=>h.jsxs("div",{className:"flex items-center gap-2 p-2 rounded hover:bg-dark-hover transition-colors group",children:[h.jsx(Ci,{size:14,className:"text-accent-blue shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-xs text-dark-text truncate",children:k.name}),h.jsxs("div",{className:"text-[10px] text-dark-muted",children:[S(k.size)," · ",Lw(k.modified)]})]}),h.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[k.previewable&&h.jsx("button",{onClick:()=>b(k),className:"p-1.5 rounded hover:bg-dark-border transition-colors",title:"预览",children:h.jsx(u0,{size:14})}),h.jsx("a",{href:ze.logs.downloadUrl(k.name),download:k.name,className:"p-1.5 rounded hover:bg-dark-border transition-colors block",title:"下载",children:h.jsx(nl,{size:14})})]})]},k.name))})]})}const Ny=_.memo(_.forwardRef(function({logs:t},a){return h.jsx("div",{ref:a,className:"flex-1 overflow-y-auto min-h-0 font-mono text-xs space-y-0.5 custom-scrollbar",children:t.length===0?h.jsxs("div",{className:"text-center text-dark-muted py-12",children:[h.jsx(wi,{size:48,className:"mx-auto mb-2 opacity-50"}),h.jsx("p",{children:"暂无实时日志"})]}):t.map(r=>h.jsxs("div",{className:`p-2 rounded hover:bg-dark-surface transition-colors ${r.level==="error"?"bg-accent-red/10":r.level==="warn"?"bg-accent-yellow/10":r.level==="success"?"bg-accent-green/10":""}`,children:[h.jsx("span",{className:"text-dark-muted text-xs",children:new Date(r.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})})," ",h.jsx("span",{className:`px-1.5 py-0.5 rounded text-white text-xs ${Dw[r.level]}`,children:r.level.toUpperCase()})," ",h.jsxs("span",{className:"text-dark-muted text-xs",children:["[",r.source,"]"]})," ",h.jsx("span",{className:"text-dark-text whitespace-pre-wrap break-all",children:r.message})]},r.id))})})),Uw=_.memo(function({logs:t,onClear:a,compact:r}){const[o,c]=_.useState("stream"),u=_.useRef(null),f=_.useRef(!0),m=_.useCallback(()=>{const y=u.current;return y?y.scrollHeight-y.scrollTop-y.clientHeight<50:!0},[]),g=_.useCallback(()=>{const y=u.current;y&&(y.scrollTop=y.scrollHeight)},[]);return _.useEffect(()=>{const y=u.current;if(!y)return;const b=()=>{f.current=m()};return y.addEventListener("scroll",b,{passive:!0}),()=>y.removeEventListener("scroll",b)},[m]),_.useEffect(()=>{f.current&&g()},[t,g]),_.useEffect(()=>{const y=u.current;if(!y)return;let b=y.clientHeight;const v=new ResizeObserver(()=>{const S=y.clientHeight;S>0&&b===0&&g(),b=S});return v.observe(y),()=>v.disconnect()},[g]),r?h.jsxs("div",{className:"flex flex-col min-h-0 flex-1 p-2",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[h.jsxs("h2",{className:"flex items-center gap-2 text-xs font-semibold",children:[h.jsx(wi,{size:14,className:"text-accent-blue"}),"日志",h.jsxs("span",{className:"text-sm font-normal text-dark-muted",children:["(",t.length,")"]})]}),h.jsx("button",{onClick:a,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-2 py-1 text-[10px]",children:"清空"})]}),h.jsx(Ny,{ref:u,logs:t})]}):h.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden p-4",children:[h.jsx("div",{className:"flex items-center justify-between mb-3 shrink-0",children:h.jsxs("h2",{className:"flex items-center gap-2 text-lg font-semibold",children:[h.jsx(wi,{size:18,className:"text-accent-blue"}),"后台日志"]})}),h.jsx("div",{className:"flex gap-1 mb-3 shrink-0 border-b border-dark-border",children:[["stream","实时日志流",wi],["files","日志文件",Ci]].map(([y,b,v])=>h.jsxs("button",{onClick:()=>c(y),className:`flex items-center gap-1.5 px-4 py-2 text-sm rounded-t transition-colors border-b-2 ${o===y?"border-accent-blue text-accent-blue bg-accent-blue/5":"border-transparent text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:[h.jsx(v,{size:14}),b,y==="stream"&&t.length>0&&h.jsxs("span",{className:"ml-1 text-[10px] text-dark-muted",children:["(",t.length,")"]})]},y))}),o==="stream"&&h.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[h.jsx("div",{className:"flex items-center justify-end mb-2 shrink-0",children:h.jsx("button",{onClick:a,className:"bg-dark-surface border border-dark-border rounded hover:bg-dark-hover transition-colors px-3 py-1.5 text-sm",children:"清空"})}),h.jsx(Ny,{ref:u,logs:t})]}),o==="files"&&h.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:h.jsx("div",{className:"border border-dark-border rounded-lg p-3 bg-dark-surface h-full",children:h.jsx(zw,{})})})]})}),Hw=s=>{if(s==null||s==="")return{};if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}},Hr=(s,t="")=>typeof s=="string"?s:String((s==null?void 0:s.content)||(s==null?void 0:s.message)||(s==null?void 0:s.text)||(s==null?void 0:s.error)||t||""),$w=s=>Array.isArray(s)?s:Array.isArray(s==null?void 0:s.tasks)?s.tasks:Array.isArray(s==null?void 0:s.items)?s.items:Array.isArray(s==null?void 0:s.planTasks)?s.planTasks:[],Rd=(s,t,a=0)=>{const r=String(s.id||s.taskId||s.backendId||`plan-task-${a+1}`),o=Yn(s.status||s.planStatus,s.completed),c=Date.now()+a;return{id:r,sessionId:t,title:String(s.title||s.name||s.content||s.description||`Task ${a+1}`),description:s.description||s.details||s.content,status:o,source:"plan",agentType:s.agentType||s.agent||s.role,progress:s.progress!=null?Number(s.progress):void 0,result:s.result,error:s.error,dependencies:Array.isArray(s.dependencies)?s.dependencies.map(String):void 0,startedAt:s.startedAt?Number(s.startedAt):o==="running"?c:void 0,completedAt:s.completedAt?Number(s.completedAt):o==="completed"||o==="failed"?c:void 0,createdAt:s.createdAt&&Number(s.createdAt)||c,updatedAt:c,raw:s}},Ty=(s,t,a=0)=>{const r=String(s.id||s.taskId||s.backendId||`goal-task-${a+1}`),o=Yn(s.status),c=Date.now()+a;return{id:r,sessionId:t,title:String(s.title||s.name||s.content||s.description||`Task ${a+1}`),description:s.description||s.details||s.content,status:o,source:"goal",agentType:s.agentType||s.agent||s.role,progress:s.progress!=null?Number(s.progress):void 0,result:s.result,error:s.error,dependencies:Array.isArray(s.parentIds)?s.parentIds.map(String):void 0,startedAt:s.startedAt?Number(s.startedAt):o==="running"?c:void 0,completedAt:s.completedAt?Number(s.completedAt):o==="completed"||o==="failed"?c:void 0,createdAt:s.createdAt&&Number(s.createdAt)||c,updatedAt:s.updatedAt?Number(s.updatedAt):c,raw:s}},Iw=(s,t)=>{const a=String((t==null?void 0:t.taskId)||(t==null?void 0:t.id)||"");if(!a)return;const r=Qe.getState().getTasksForSession(s).find(f=>f.id===a),o=we.getState().getSessionTasks(s).find(f=>f.id===a||f.backendId===a),c=t!=null&&t.status?Yn(t.status):(r==null?void 0:r.status)||"pending",u={id:a,sessionId:s,title:(t==null?void 0:t.title)||(r==null?void 0:r.title)||(o==null?void 0:o.title)||a,description:(t==null?void 0:t.description)??(r==null?void 0:r.description)??(o==null?void 0:o.description),status:c,source:"goal",agentType:(t==null?void 0:t.agentType)||(r==null?void 0:r.agentType),progress:(t==null?void 0:t.progress)!=null?Number(t.progress):r==null?void 0:r.progress,result:(t==null?void 0:t.result)??(r==null?void 0:r.result),error:(t==null?void 0:t.error)??(r==null?void 0:r.error),startedAt:c==="running"?Date.now():r==null?void 0:r.startedAt,completedAt:c==="completed"||c==="failed"?Date.now():r==null?void 0:r.completedAt,createdAt:(r==null?void 0:r.createdAt)||Date.now(),updatedAt:Date.now(),raw:t};return Qe.getState().upsertTask(s,u),ff(s,u),u},qr=s=>({id:s.id,title:s.title,completed:s.status==="completed",createdAt:s.createdAt,description:s.description,planStatus:s.status,agentType:s.agentType,dependencies:s.dependencies,result:s.result,error:s.error,startedAt:s.startedAt,completedAt:s.completedAt,progress:s.progress}),ff=(s,t)=>{const a=we.getState(),r=a.getSessionTasks(s),o=qr(t);if(r.some(c=>c.id===t.id||c.backendId===t.id)){a.updateTaskPlanStatus(s,t.id,o);return}a.setSessionTasks(s,[...r,o])},Bo=s=>{const t=je.getState(),a=t.getMessages(s),r=a[a.length-1];(!r||r.type!=="assistant")&&t.addMessage(s,{id:`plan-${Date.now()}`,type:"assistant",content:"",timestamp:Date.now()})};function Od(s,t,a){const r=Qr.getState(),o=je.getState(),c=Qe.getState(),u=Hw(t);switch(s){case"plan_start":{o.startGeneration(a),Bo(a);const f=Hr(u,"Plan started");f&&r.setThinkingStatus(a,f),c.recordEvent(a,{type:s,source:"plan",title:"Plan started",message:f,status:"running",data:u});break}case"plan_thinking":{const f=Hr(u,"Analyzing request...");r.setThinkingStatus(a,f),Bo(a),o.setThinking(a,f),c.recordEvent(a,{type:s,source:"plan",title:"Plan thinking",message:f,status:"running",data:u});break}case"plan_complete":{const f=(u==null?void 0:u.plan)||(u==null?void 0:u.content)||(u==null?void 0:u.result)||(u==null?void 0:u.markdown);if(f){r.setPlanContent(String(f)),Bo(a);const m=o.getMessages(a),g=m[m.length-1];(g==null?void 0:g.type)==="assistant"&&!g.content.trim()&&o.updateLastMessage(a,String(f))}else{const m=[...o.getMessages(a)].reverse().find(g=>g.type==="assistant");m!=null&&m.content&&r.setPlanContent(m.content)}o.endGeneration(a),c.recordEvent(a,{type:s,source:"plan",title:"Plan complete",message:Hr(u,"Plan complete"),status:"completed",data:u});break}case"plan_error":{const f=Hr(u,"Plan failed");Bo(a),o.updateLastMessage(a,`Plan failed: ${f}`),o.endGeneration(a,f),c.recordEvent(a,{type:s,source:"plan",title:"Plan failed",message:f,status:"failed",data:u});break}case"plan_tasks":{const f=$w(u).map((m,g)=>Rd(m,a,g));c.setTasks(a,f,"plan"),we.getState().setSessionTasks(a,f.map(qr)),c.recordEvent(a,{type:s,source:"plan",title:"Plan tasks updated",message:`${f.length} tasks`,status:"pending",data:u});break}case"plan_task_start":case"plan_task_update":case"plan_task_result":{const f=Rd(u,a),m=s==="plan_task_start"?"running":Yn(s==="plan_task_result"?u.status||(u.error?"failed":"completed"):u.status||u.planStatus),g={...f,status:m,startedAt:f.startedAt||(m==="running"?Date.now():void 0),completedAt:f.completedAt||(m==="completed"||m==="failed"?Date.now():void 0)};c.upsertTask(a,g),ff(a,g),c.recordEvent(a,{type:s,source:"plan",title:g.title,message:g.result||g.error||g.description,status:g.status,taskId:g.id,data:u});break}case"plan_task_complete":{const f=Rd(u,a),m=String(u.status||"")==="failed"||!!u.error,y={...f,status:m?"failed":"completed",completedAt:f.completedAt||Date.now()};c.upsertTask(a,y),ff(a,y),c.recordEvent(a,{type:s,source:"plan",title:y.title,message:y.result||y.error||y.description,status:y.status,taskId:y.id,data:u});const b=y.title||`task ${y.id}`;m?ke.error(`✘ ${b} 失败`,6e3):ke.success(`✓ ${b} 完成`,4e3);break}case"plan_subagent_start":{const f=(u==null?void 0:u.scope)||(u==null?void 0:u.agentId)||"design sub-agent";c.recordEvent(a,{type:s,source:"plan",title:`设计子代理: ${f}`,message:(u==null?void 0:u.title)||"Reading codebase and designing implementation details...",status:"running",data:u});break}case"plan_subagent_done":{const f=(u==null?void 0:u.scope)||(u==null?void 0:u.agentId)||"design sub-agent",m=(u==null?void 0:u.status)==="error"||(u==null?void 0:u.status)==="timeout"||(u==null?void 0:u.status)==="max_iterations"||!!(u!=null&&u.error);c.recordEvent(a,{type:s,source:"plan",title:`设计子代理: ${f}`,message:m?`设计失败: ${(u==null?void 0:u.error)||(u==null?void 0:u.status)||"error"}`:u!=null&&u.designDocPath?`设计完成 → ${u.designDocPath}`:"设计完成",status:m?"failed":"completed",data:u});break}case"step_prompt":{const f=Hr(u),m=(u==null?void 0:u.taskId)||(u==null?void 0:u.id);m&&c.upsertTask(a,{id:String(m),title:u.title||u.step||String(m),status:"running",source:"plan",description:f}),c.recordEvent(a,{type:s,source:"plan",title:(u==null?void 0:u.step)||"Step prompt",message:f,status:"running",taskId:m?String(m):void 0,data:u});break}case"plan_mode_change":{const f=(u==null?void 0:u.frontendMode)||(u==null?void 0:u.newMode),m=u==null?void 0:u.planPath;f==="normal"?r.applyBackendMode("normal"):f==="auto"?r.setAuto(!0):(f==="plan"||f==="act"||f==="goal"||f==="auto-plan"||f==="auto-act"||f==="auto-goal")&&r.applyBackendMode(f);const g=m?` [plan: ${m}]`:"";c.recordEvent(a,{type:s,source:"system",title:"Mode changed",message:`${(u==null?void 0:u.previousMode)||"unknown"} -> ${f||"unknown"}${g}`,status:(u==null?void 0:u.success)===!1?"failed":"completed",data:u});break}case"goal_created":{c.recordEvent(a,{type:s,source:"goal",title:(u==null?void 0:u.goalTitle)||(u==null?void 0:u.title)||"Goal created",message:u!=null&&u.goalId?`Goal ${u.goalId}`:"Goal created",status:"pending",data:u});break}case"goal_tasks":{const f=Array.isArray(u==null?void 0:u.tasks)?u.tasks.map((m,g)=>Ty(m,a,g)):[];c.setTasks(a,f,"goal"),we.getState().setSessionTasks(a,f.map(qr)),c.recordEvent(a,{type:s,source:"goal",title:(u==null?void 0:u.goalTitle)||"Goal tasks",message:`${f.length} tasks`,status:"pending",data:u});break}case"goal_task_update":{const f=String((u==null?void 0:u.taskId)||(u==null?void 0:u.id)||""),m=Iw(a,u);c.recordEvent(a,{type:s,source:"goal",title:(m==null?void 0:m.title)||f||"Goal task update",message:(u==null?void 0:u.result)||(u==null?void 0:u.error)||(u!=null&&u.status?`status: ${u.status}`:"updated"),status:m==null?void 0:m.status,taskId:f||void 0,data:u});break}case"goal_update":{const f=Array.isArray(u==null?void 0:u.tasks)?u.tasks.map((m,g)=>Ty(m,a,g)):[];c.setTasks(a,f,"goal"),we.getState().setSessionTasks(a,f.map(qr)),c.recordEvent(a,{type:s,source:"goal",title:(u==null?void 0:u.goalTitle)||(u==null?void 0:u.title)||"Goal update",message:(u==null?void 0:u.status)||(u!=null&&u.id?`Goal ${u.id}`:"Goal updated"),status:u!=null&&u.status?Yn(u.status):void 0,data:u});break}case"goal_completed":{const f=String((u==null?void 0:u.goalId)||""),m=c.getTasksForSession(a).filter(g=>g.source==="goal");if(m.length>0){const g=m.map(y=>y.status==="pending"||y.status==="running"?{...y,status:"completed",completedAt:Date.now(),updatedAt:Date.now()}:y);c.setTasks(a,g,"goal"),we.getState().setSessionTasks(a,g.map(qr))}c.recordEvent(a,{type:s,source:"goal",title:u!=null&&u.goalTitle?`Goal 完成: ${String(u.goalTitle).slice(0,60)}`:"Goal completed",message:u!=null&&u.result?String(u.result).slice(0,200):f?`Goal ${f} completed`:"Goal completed",status:"completed",data:u});break}}}function Pw(s){const t=s.toLowerCase();let a="unknown";return t.includes("401")||t.includes("unauthorized")||t.includes("invalid api key")||/api ?key.*invalid/.test(t)?a="auth":t.includes("429")||t.includes("rate limit")||t.includes("quota")||t.includes("insufficient_quota")?a="rate_limit":t.includes("timeout")||t.includes("timed out")||t.includes("timedout")?a="timeout":t.includes("network")||t.includes("econnrefused")||t.includes("fetch failed")||t.includes("socket")||t.includes("websocket")?a="network":t.includes("tool")||t.includes("bash")||t.includes("command failed")?a="tool":(t.includes("model")||t.includes("api")||t.includes("provider")||t.includes("response"))&&(a="model"),{id:`error-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,category:a,summary:Gw(s,a),detail:s,retryable:a!=="auth",timestamp:Date.now()}}function Gw(s,t){const a={auth:"API Key 无效或已失效(401 Unauthorized)",rate_limit:"请求频率超限或配额不足(429)",timeout:"请求超时",network:"网络连接异常",tool:"工具执行失败",model:"模型调用失败",unknown:"发生未知错误"},r=(s.split(`
|
|
54
|
-
`)[0]||"").trim().slice(0,120);return r?`${a[t]}: ${r}`:a[t]}function Fw(s,t,a){var o,c;const r=je.getState();switch(s){case"start":r.startGeneration(a),r.addMessage(a,{id:Wn(),type:"assistant",content:"",timestamp:Date.now()}),we.getState().touchSession(a);break;case"content":{let u=String(t||"");try{const m=JSON.parse(t);u=m.text||m.content||u}catch{}const f=u.replace(/\[FINISH\]/g,"");f&&r.appendToLastMessage(a,f)}break;case"thinking":{let u=String(t||""),f;try{const m=JSON.parse(t);u=m.text||m.content||u,f=typeof m.index=="number"?m.index:void 0}catch{}u&&r.appendToLastMessageThinking(a,u,f)}break;case"tool_call":try{const u=JSON.parse(t||"{}"),f=u.id||Wn(),m=typeof u.index=="number"?u.index:void 0,g=u.args||u.arguments||"",y=r.messagesBySession[a]||[],b=y[y.length-1];[...((o=b==null?void 0:b.steps)==null?void 0:o.flatMap(k=>k.toolCalls||[]))||[],...(b==null?void 0:b.toolCalls)||[]].find(k=>m!==void 0&&k.index===m||k.id===f)?r.updateToolCall(a,f,{args:g}):r.addToolCall(a,{id:f,index:m,name:u.name||"Unknown",args:g,status:"running",timestamp:Date.now()})}catch(u){ut.warn("Failed to parse tool call",String(u))}break;case"tool_result":try{const u=JSON.parse(t||"{}"),m=je.getState().messagesBySession[a]||[],g=[];for(const k of m){const C=k.steps||[];for(const E of C)E.toolCalls&&g.push(...E.toolCalls);k.toolCalls&&g.push(...k.toolCalls)}const y=u.toolName,b=u.id,v=typeof u.index=="number"?u.index:void 0;let S;if(b&&(S=g.find(k=>k.id===b)),!S&&v!==void 0&&(S=g.find(k=>k.index===v&&k.name===y)),!S){const k=g.filter(C=>C.name===y&&C.status==="running");k.sort((C,E)=>(C.timestamp||0)-(E.timestamp||0)),S=k[0]}if(!S){const k=g.filter(C=>C.name===y&&C.status==="error"&&C.result==="生成已结束(工具执行超时或连接中断)");k.sort((C,E)=>(E.timestamp||0)-(C.timestamp||0)),S=k[0]}if(S){const k=Math.floor((Date.now()-(S.timestamp||Date.now()))/1e3),C=typeof u.result=="string"&&u.result.startsWith("Error:");r.updateToolCall(a,S.id,{status:C?"error":"completed",result:u.result,duration:k,...u.diff!==void 0?{diff:String(u.diff)}:{}})}}catch(u){ut.warn("Failed to parse tool result",String(u))}break;case"tool_diff":try{const u=JSON.parse(t||"{}"),m=je.getState().messagesBySession[a]||[],g=[];for(const v of m){const S=v.steps||[];for(const k of S)k.toolCalls&&g.push(...k.toolCalls);v.toolCalls&&g.push(...v.toolCalls)}const y=g.filter(v=>v.name===u.toolName&&v.status==="running");y.sort((v,S)=>(v.timestamp||0)-(S.timestamp||0));const b=y[0];b&&typeof u.diff=="string"&&r.updateToolCall(a,b.id,{diff:u.diff})}catch(u){ut.warn("Failed to parse tool diff",String(u))}break;case"turn_summary":{try{const u=JSON.parse(t||"{}"),f={};if(u.toolCounts&&typeof u.toolCounts=="object"&&!Array.isArray(u.toolCounts))for(const[m,g]of Object.entries(u.toolCounts)){const y=Number(g);Number.isFinite(y)&&y>0&&(f[m]=y)}r.setTurnSummary(a,{thoughtMs:Number(u.thoughtMs??u.durationMs??0)||0,durationMs:Number(u.durationMs??u.thoughtMs??0)||0,toolCounts:f,...typeof u.headline=="string"&&u.headline?{headline:u.headline}:{}})}catch(u){ut.warn("Failed to parse turn_summary",String(u))}break}case"web_search":try{const u=JSON.parse(t||"{}"),f=u.callId||`web-search-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,m=typeof u.index=="number"?u.index:void 0,g=u.status==="searching"||u.status==="in_progress",y=u.status==="failed",b=r.messagesBySession[a]||[],v=b[b.length-1],k=[...((c=v==null?void 0:v.steps)==null?void 0:c.flatMap(C=>C.toolCalls||[]))||[],...(v==null?void 0:v.toolCalls)||[]].find(C=>C.id===f||m!==void 0&&C.index===m&&C.name==="web_search");k?g||r.updateToolCall(a,k.id,{status:y?"error":"completed",result:y?"❌ 联网搜索失败":u.searchUrl?`✅ 搜索完成:${u.searchUrl}`:"✅ 搜索完成"}):r.addToolCall(a,{id:f,index:m,name:"web_search",args:"{}",status:g?"running":"completed",result:g?void 0:y?"❌ 联网搜索失败":u.searchUrl?`✅ 搜索完成:${u.searchUrl}`:"✅ 搜索完成",timestamp:Date.now()})}catch(u){ut.warn("Failed to parse web_search",String(u))}break;case"cache_stats":try{const u=JSON.parse(t||"{}");Fe.getState().setCacheStats({cacheHitTokens:Number(u.cacheHitTokens)||0,cacheMissTokens:Number(u.cacheMissTokens)||0,cacheHitRate:u.cacheHitRate!==void 0?Number(u.cacheHitRate):void 0,cacheStatsCalls:Number(u.cacheStatsCalls)||0})}catch(u){ut.warn("Failed to parse cache_stats",String(u))}break;case"complete":r.endGeneration(a);{const u=je.getState().messagesBySession[a]||[];u.length>0&&Fe.getState().recalculateFromMessages(u)}we.getState().touchSession(a);break;case"generation_paused":r.pauseGeneration(a);break;case"generation_resumed":r.resumeGeneration(a);break;case"compaction_progress":try{const u=JSON.parse(t||"{}");Fe.getState().setCompactionProgress({stage:u.stage||"",percent:u.percent||0,message:u.message||""})}catch(u){console.error("Failed to parse compaction_progress:",u)}break;case"context_compressed":try{const u=JSON.parse(t||"{}"),f=`Context compressed: ${u.originalCount} -> ${u.compressedCount} msgs, freed ${u.tokensSaved} tokens`;r.appendToLastMessage(a,`
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
${f}
|
|
58
|
-
|
|
59
|
-
`),ke.info(f,5e3),Fe.getState().setCompacting({originalCount:u.originalCount||0,compressedCount:u.compressedCount||0,tokensSaved:u.tokensSaved||0}),Fe.getState().setCompactionProgress(null)}catch(u){console.error("Failed to parse context_compressed:",u)}break;case"error":{r.endGeneration(a);const u=typeof t=="string"?t:String(t||"Error occurred"),f=Pw(u),m=r.messagesBySession[a]||[],g=m[m.length-1];g&&g.type==="assistant"&&!g.errorCard?r.attachErrorCard(a,f):r.addMessage(a,{id:Wn(),type:"assistant",content:"",timestamp:Date.now(),errorCard:f}),we.getState().touchSession(a);break}case"context_analysis":try{const u=JSON.parse(t||"{}");u&&u.total!==void 0&&Fe.getState().setContextDistribution(u)}catch(u){console.error("Failed to parse context_analysis:",u)}break;case"threshold_warning":try{const u=JSON.parse(t||"{}");Fe.getState().setThresholdWarning(u);const f=u.percentLeft!==void 0?u.percentLeft:0;f<=5?console.warn(`Context nearly full (${f}% remaining)`):f<=15&&console.info(`Context running low (${f}% remaining)`)}catch(u){console.error("Failed to parse threshold_warning:",u)}break;case"blocking_limit":try{const u=JSON.parse(t||"{}");Fe.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(t||"{}");Fe.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(t||"{}");Fe.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(t||"{}");console.warn(`Model fallback: ${u.fromModel||"?"} → ${u.toModel||"?"}`)}catch(u){console.error("Failed to parse model_fallback:",u)}break;case"tombstone":try{const f=JSON.parse(t||"{}").messageIds||[];f.length>0&&r.applyTombstone(a,f)}catch(u){ut.warn("Failed to parse tombstone",String(u))}break;case"stall_detected":try{const u=JSON.parse(t||"{}"),f=u.attempt||0,m=u.maxRetries||3,g=u.reason||"no response from model";u.recovering?ke.warning(`⚠ Generation stalled (${g}) — retrying ${f}/${m}`,8e3):ke.error(`⚠ Generation stalled (${g}) — giving up`,1e4)}catch(u){ut.warn("Failed to parse stall_detected",String(u))}break}}const Af=Ut()((s,t)=>({backendCommands:[],loaded:!1,setBackendCommands:a=>{s({backendCommands:a,loaded:!0})},getAllCommands:()=>t().backendCommands}));async function qw(s="",t){try{let a=`${s}/api/commands`;t&&(a+=`?lang=${encodeURIComponent(t)}`);const r=await fetch(a);if(!r.ok)return[];const o=await r.json(),c=Array.isArray(o==null?void 0:o.data)?o.data:[];return Af.getState().setBackendCommands(c),c}catch{return[]}}function Md(s,t,a,r,o){var c,u,f;switch(s){case"token_update":try{const g=typeof t=="string"?JSON.parse(t):t||{};if(g.source==="workflow"){Fe.getState().addWorkflowTokens(Number(g.workflowNodeTokens)||0);break}g.totalTokens>0&&Fe.getState().updateUsage({promptTokens:g.promptTokens||0,completionTokens:g.completionTokens||0,totalTokens:g.totalTokens||0});const y=g.promptCacheHitTokens??g.prompt_cache_hit_tokens,b=g.promptCacheMissTokens??g.prompt_cache_miss_tokens;(y!==void 0||b!==void 0)&&Fe.getState().accumulateCacheStats(Number(y)||0,Number(b)||0),g.model&&Fe.getState().setModel(g.model)}catch{}break;case"context_breakdown":try{const g=typeof t=="string"?JSON.parse(t):t||{};Fe.getState().setContextBreakdown({systemPromptTokens:Number(g.systemPromptTokens)||0,messagesTokens:Number(g.messagesTokens)||0,toolContentTokens:Number(g.toolContentTokens)||0,toolDefTokens:Number(g.toolDefTokens)||0,mcpToolTokens:Number(g.mcpToolTokens)||0,skillTokens:Number(g.skillTokens)||0,dynamicTokens:Number(g.dynamicTokens)||0,total:Number(g.total)||0})}catch{}break;case"model_name":try{const g=o&&typeof o.model=="string"&&o.model||(typeof t=="string"?t:(t==null?void 0:t.model)||"");g&&Fe.getState().setModel(g)}catch{}break;case"auth_required":let m=localStorage.getItem("auth_token");m||(m="default-token",localStorage.setItem("auth_token",m)),ge.setToken(m),ge.setAuthenticated(!1),ge.send({type:"auth",token:m});break;case"auth_success":ge.setAuthenticated(!0),ge.send({type:"subscribe_logs"});{const g=Ei.getState();qw("",(c=g.language)!=null&&c.startsWith("zh")?"zh":"en");const y=g.workspaceDir;y&&ge.send({type:"workspace",message:y})}break;case"auth_failed":ut.error("Auth failed",String(t));break;case"log":try{const g=typeof t=="string"?JSON.parse(t):t,y={id:`log-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,level:g.level||"info",source:g.source||"System",message:g.message||"",timestamp:g.timestamp||Date.now()};r.setLogs(b=>[...b,y].slice(-500)),r.activeTab!=="logs"&&r.setUnreadLogs(b=>b+1)}catch(g){ut.warn("Failed to parse log entry",String(g))}break;case"commands_list":try{const g=JSON.parse(t||"[]");Af.getState().setBackendCommands(Array.isArray(g)?g:[])}catch(g){ut.warn("Failed to parse commands list",String(g))}break;case"command_start":break;case"command_complete":try{const y=((typeof t=="string"?JSON.parse(t):t||{}).result||"").toString();ke.success(y.length>120?y.slice(0,120)+"...":y||"Command completed",4e3)}catch{}break;case"command_error":try{const g=typeof t=="string"?JSON.parse(t):t||{};ke.error((g.error||"Command failed").toString(),6e3)}catch{}break;case"ping":ge.send({type:"pong",data:Date.now().toString()});break;case"workspace_changed":try{const g=JSON.parse(t||"{}");g.newDir&&Ei.getState().setWorkspaceDir(g.newDir)}catch{}break;case"degradation_update":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.active,b=g.mode||"normal",v=Number(g.retryCount)||0,S=Number(g.maxRetries)||0,k=g.message||"",E={normal:"normal",retrying:"retrying",alternative:"alternative model",degraded:"degraded",verifying:"verifying",verified_fail:"verify failed"}[b]||b;if(Fe.getState().setDegradation({active:y,retryCount:v,maxRetries:S,mode:b,message:k,label:E}),y){const O=v>0?` (${v}/${S})`:"";ke.warning(k||`API Degraded: ${E}${O}`,8e3),r.setLogs(j=>[...j,{id:`deg-${Date.now()}`,level:"warn",source:"Infrastructure",message:`Degradation: ${E} | ${k||"no details"}`,timestamp:Date.now()}].slice(-500))}else ke.success("API Normal")}catch(g){ut.warn("Degradation update parse error",String(g))}break;case"doctor_result":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.overallStatus||g.status||"unknown",b=g.healthRate,v=g.issues||[],k={healthy:"healthy",degraded:"degraded",unhealthy:"unhealthy",unknown:"unknown"}[y]||y,C=typeof b=="number"?` (${Math.round(b*100)}%)`:"";if(y==="healthy")ke.success(`Doctor: ${k}${C}`);else if(ke.warning(`Doctor: ${k}${C}`,1e4),v&&v.length>0)for(const E of v)r.setLogs(O=>[...O,{id:`doctor-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,level:"warn",source:"Doctor",message:typeof E=="string"?E:E.message||JSON.stringify(E),timestamp:Date.now()}].slice(-500))}catch(g){ut.warn("Doctor result parse error",String(g))}break;case"session_created":{try{const g=typeof t=="string"?JSON.parse(t):t||{};g.id&&(ge.setSessionId(g.id),we.getState().updateSession(g.id,g))}catch{}typeof t=="string"&&t&&ut.info(`Session event: ${s}`);break}case"session_resumed":{try{const g=typeof t=="string"?JSON.parse(t):t||{};if((u=g.session)!=null&&u.id&&(ge.setSessionId(g.session.id),we.getState().updateSession(g.session.id,g.session)),g.messages&&Array.isArray(g.messages)){const y=((f=g.session)==null?void 0:f.id)||a;je.getState().replaceMessages(y,g.messages.map(S=>({id:S.id||`msg-${S.timestamp||Date.now()}`,type:S.type==="user"?"user":"assistant",content:S.content||"",timestamp:S.timestamp||Date.now(),thinking:S.thinking||void 0})));const b=g.messages.find(S=>S.type==="user"&&!S.deleted),v=typeof(b==null?void 0:b.content)=="string"?b.content.replace(/\s+/g," ").trim():"";we.getState().touchSession(y,v||void 0)}}catch(g){ut.warn("Failed to process session_resumed",String(g))}typeof t=="string"&&t&&ut.info(`Session event: ${s}`);break}case"mcp_update":try{const g=typeof t=="string"?JSON.parse(t):t||{},y=g.server||g.name||"MCP",b=g.action||g.status||"updated";ut.info(`MCP ${y}: ${b}`)}catch{}break}}function OE(s,t){switch(zk(s,t)){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(t)?"risk_critical_cmd":/write|edit|save|upload|deploy|publish/i.test(s)?"risk_high_file":/install|uninstall|npm|pip|cargo|gem|apt|brew|choco|yum|dnf/i.test(s)?"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(s)?"risk_git":"risk_network"}}}const ME={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 BE(s,t){return Uk(s,t)}function Vw(s){try{const t=JSON.parse(s),a=t.payload&&typeof t.payload=="object"?t.payload:t,r=a.resolvedPath;if(typeof r=="string"&&r)return r;const o=a.requestedPath;return typeof o=="string"&&o?o:null}catch{return null}}function Ww(s,t){try{const a=typeof s=="string"?JSON.parse(s):s||{},r=ys.getState(),{approvalId:o,toolName:c,askPayload:u,timeoutMs:f,timeoutAction:m}=a,g=Vw(String(u||""));if(r.isSessionAllowed(c,g??void 0)){ge.send({type:"hook_allow",data:JSON.stringify({approvalId:o})});return}if(r.autoMode&&c!=="exit_plan_mode"){ge.send({type:"hook_allow",data:JSON.stringify({approvalId:o})});return}je.getState().addMessage(t,{id:`hook-approval-${o||Date.now()}`,type:"assistant",content:"",timestamp:Date.now(),hookApproval:{approvalId:o||"",toolName:c||"unknown",askPayload:u||"",status:"pending",timestamp:Date.now(),timeoutMs:typeof f=="number"?f:void 0,timeoutAction:m==="allow"||m==="deny"?m:void 0}}),r.addApproval({approvalId:o||"",toolName:c||"unknown",askPayload:u||"",timestamp:Date.now(),timeoutMs:typeof f=="number"?f:void 0,timeoutAction:m==="allow"||m==="deny"?m:void 0}),window.dispatchEvent(new CustomEvent("hook-approval-required"))}catch{}}function Bd(s,t){try{const a=typeof s=="string"?JSON.parse(s):s||{};typeof a.sessionId=="string"&&a.sessionId&&(t=a.sessionId);const r=we.getState(),o=Qe.getState(),{action:c,taskId:u,data:f}=a;if(c==="created"&&f){const m={id:u||`task-${Date.now()}`,title:f.title||"",completed:f.status==="COMPLETED",createdAt:Date.parse(f.createdAt)||Date.now(),backendId:u,backendStatus:f.status,description:f.description},g=r.tasksBySession[t]||[];r.setSessionTasks(t,[...g,m]),o.upsertTask(t,{id:m.id,title:m.title,description:m.description,status:Yn(f.status),source:"task",progress:f.progress!=null?Number(f.progress):void 0,raw:a})}else if((c==="updated"||c==="status_changed")&&f)r.updateTaskPlanStatus(t,u,{backendStatus:f.status,progress:f.progress}),o.upsertTask(t,{id:u,title:f.title||u,description:f.description,status:Yn(f.status),source:"task",progress:f.progress!=null?Number(f.progress):void 0,raw:a});else if(c==="deleted"){const m=r.tasksBySession[t]||[];r.setSessionTasks(t,m.filter(g=>g.id!==u&&g.backendId!==u))}else if(a&&!c&&(a.id||a.taskId)){const m=String(a.id||a.taskId),g=a,y=String(g.status||"").toUpperCase()==="COMPLETED",b={id:m,title:String(g.title||g.name||m),completed:y,createdAt:Date.parse(g.createdAt)||Date.now(),backendId:m,backendStatus:g.status,description:g.description,progress:g.progress!=null?Number(g.progress):void 0},v=r.getSessionTasks(t);v.some(S=>S.id===m||S.backendId===m)?r.updateTaskPlanStatus(t,m,{backendStatus:g.status,progress:b.progress,completed:y}):r.setSessionTasks(t,[...v,b]),o.upsertTask(t,{id:m,title:b.title,description:b.description,status:Yn(g.status),source:"task",progress:b.progress,raw:a})}o.recordEvent(t,{type:"task_update",source:"task",title:(f==null?void 0:f.title)||a&&(a.title||a.id||a.taskId)||u||"Task update",message:c||"updated",status:(f==null?void 0:f.status)||(a==null?void 0:a.status),taskId:u||(a==null?void 0:a.id)||(a==null?void 0:a.taskId),data:a})}catch{}}function Kw(s,t,a,r){try{const o=JSON.parse(t||"{}"),c=r(a,s,o);if(c){const u=je.getState();switch(s){case"step_start":u.updateStep(a,c.id,{title:o.step||c.title,description:o.description||c.description,status:o.status==="start"?"running":o.status||"running"});break;case"step_thinking":u.updateStep(a,c.id,{thought:o.thought});break;case"step_action":u.updateStep(a,c.id,{action:o.action});break;case"step_complete":u.updateStep(a,c.id,{status:o.status??"success",result:o.result});break}}}catch(o){ut.warn("Failed to parse "+s,String(o))}}function Yw(s,t){var a,r;try{const o=typeof s=="string"?JSON.parse(s):s||{};let c=[];if(Array.isArray(o)?c=o:(a=o.tasks)!=null&&a.length?c=o.tasks:(r=o.items)!=null&&r.length&&(c=o.items),c.length>0&&t){const u=we.getState(),f=Qe.getState();c.forEach(m=>{const g=m.content||m.title||m.name||"";if(g.trim()){if(!u.getSessionTasks(t).find(k=>k.title===g.trim())&&(u.addSessionTask(t,g.trim()),m.completed||m.status==="completed"||m.status==="COMPLETED"||m.status==="done"||m.activeForm==="completed")){const E=u.getSessionTasks(t).find(O=>O.title===g.trim());E&&u.toggleSessionTask(t,E.id)}const v=String(m.id||m.taskId||g.trim()),S=m.completed||m.status==="completed"||m.status==="COMPLETED"||m.status==="done"||m.activeForm==="completed";f.upsertTask(t,{id:v,title:g.trim(),description:m.description,status:Yn(m.status,S),source:"todo",raw:m})}}),f.recordEvent(t,{type:"todo_update",source:"todo",title:"Todo list updated",message:`${c.length} items`,status:"updated",data:o})}}catch{}}function Zw(s,t){try{const a=typeof s=="string"?JSON.parse(s):s||{},r=a.questionId||"",o=a.question||"";if(!r||!o)return;const c=Array.isArray(a.questions)?a.questions.map(m=>({question:String(m.question||""),header:m.header?String(m.header):void 0,options:Array.isArray(m.options)?m.options:void 0,multiSelect:m.multiSelect===!0})).filter(m=>m.question):[{question:o,header:a.header||void 0,options:Array.isArray(a.options)?a.options:void 0,multiSelect:a.multiSelect===!0}],u=window;u.__answeredQuestionIds=u.__answeredQuestionIds||new Set,u.__pendingQuestions=u.__pendingQuestions||{};const f={questionId:r,question:o,header:a.header||void 0,options:Array.isArray(a.options)?a.options:void 0,multiSelect:a.multiSelect===!0,autoResolutionMs:typeof a.autoResolutionMs=="number"?a.autoResolutionMs:void 0,questions:c,sessionId:t};u.__pendingQuestions[t]=f,u.__pendingQuestion=f,window.dispatchEvent(new CustomEvent("ask-question-required",{detail:t}))}catch{}}function Qw(s,t){try{const a=typeof s=="string"?JSON.parse(s):s||{},r=a.title||a.name||"";if(r&&t){const c=we.getState().getSessionTasks(t).find(u=>u.title===r&&!u.completed);c&&we.getState().toggleSessionTask(t,c.id),Qe.getState().upsertTask(t,{id:(c==null?void 0:c.id)||r,title:r,status:"completed",source:"todo"}),Qe.getState().recordEvent(t,{type:"todo_item_done",source:"todo",title:r,status:"completed",taskId:(c==null?void 0:c.id)||r,data:a})}}catch{}}function $r(s){if(!s)return null;try{return JSON.parse(s)}catch{return null}}const Ir=Ut((s,t)=>({items:[],pendingCount:0,audit:[],auditTotal:0,automations:[],runsByAutomation:{},loading:!1,error:null,fetchInbox:async()=>{const a=await ze.inbox.list({state:"all"});if(a.success&&a.data){const r=a.data.items;s({items:r,pendingCount:r.filter(o=>o.state==="pending").length})}else s({error:a.error||"加载 Inbox 失败"})},resolveInbox:async(a,r)=>{const o=await ze.inbox.resolve(a,r);return o.success?(await t().fetchInbox(),!0):(s({error:o.error||"解决失败"}),!1)},fetchAudit:async a=>{const r=await ze.audit.query(a||{pageSize:100});r.success&&r.data?s({audit:r.data.records,auditTotal:r.data.total}):s({error:r.error||"加载审计失败"})},fetchAutomations:async()=>{const a=await ze.automations.list();a.success&&a.data?s({automations:a.data}):s({error:a.error||"加载自动化失败"})},createAutomation:async a=>{const r=await ze.automations.create(a);return r.success&&r.data?(await t().fetchAutomations(),r.data):(s({error:r.error||"创建自动化失败"}),null)},deleteAutomation:async a=>{const r=await ze.automations.remove(a);return r.success?(await t().fetchAutomations(),!0):(s({error:r.error||"删除失败"}),!1)},toggleAutomation:async(a,r)=>{const o=await ze.automations.toggle(a,r);o.success?await t().fetchAutomations():s({error:o.error||"切换失败"})},runAutomation:async a=>{const r=await ze.automations.run(a);r.success?(await t().fetchRuns(a),await t().fetchAutomations()):s({error:r.error||"触发失败"})},fetchRuns:async a=>{const r=await ze.automations.runs(a);r.success&&r.data&&s(o=>({runsByAutomation:{...o.runsByAutomation,[a]:r.data}}))},onInboxPending:a=>{s(r=>({items:[a,...r.items.filter(o=>o.id!==a.id)],pendingCount:r.pendingCount+1}))},onInboxResolved:a=>{s(r=>{var o;return{items:r.items.map(c=>c.id===a.id?a:c),pendingCount:Math.max(0,r.pendingCount-(a.state==="resolved"&&((o=r.items.find(c=>c.id===a.id))==null?void 0:o.state)==="pending"?1:0))}})},onAuditRecord:a=>{s(r=>({audit:[a,...r.audit].slice(0,200)}))},onAutomationUpdate:a=>{s(r=>({automations:r.automations.some(c=>c.id===a.id)?r.automations.map(c=>c.id===a.id?a:c):[...r.automations,a]}))},onAutomationRun:a=>{s(r=>({runsByAutomation:{...r.runsByAutomation,[a.automationId]:[a,...r.runsByAutomation[a.automationId]||[]].slice(0,50)}}))}})),Pr={pending:s=>{const t=$r(s);t&&Ir.getState().onInboxPending(t)},resolved:s=>{const t=$r(s);t&&Ir.getState().onInboxResolved(t)},auditRecord:s=>{const t=$r(s);t&&Ir.getState().onAuditRecord(t)},automationUpdate:s=>{const t=$r(s);t!=null&&t.automation&&Ir.getState().onAutomationUpdate(t.automation)},automationRun:s=>{const t=$r(s);t!=null&&t.run&&Ir.getState().onAutomationRun(t.run)}};function Xw(s,t,a){let r={};if(t&&typeof t=="object")r=t;else try{r=JSON.parse(String(t||"{}"))}catch{}const o=String(r.jobId||`fjob-${Date.now()}`),c=r.stage||(s==="filejob_result"?"complete":s==="filejob_error"?"error":"uploaded"),u={jobId:o,stage:c,parseProgress:r.parseProgress,parsedFiles:r.parsedFiles,mapping:r.mapping,renderProgress:r.renderProgress,currentRow:r.currentRow,totalRows:r.totalRows,result:r.result,error:r.error,errorDetail:r.errorDetail};r.attachments&&(u.attachments=r.attachments),je.getState().setMessageFileJob(a,u)}const Jw=Ut((s,t)=>({channels:[],loading:!1,error:null,formOpen:!1,editing:null,qrOpen:!1,qrChannel:null,selectedType:null,load:async()=>{s({loading:!0,error:null});const a=await ze.channels.list(),r=a.success&&Array.isArray(a.data)?a.data:[];if(s({loading:!1,channels:r,...a.success&&!Array.isArray(a.data)?{error:"服务端返回的频道数据格式异常"}:a.success?{}:{error:a.error??"Failed to load"}}),!t().selectedType&&r.length>0){const c=r[0].type;s({selectedType:c})}},create:async a=>{const r=await ze.channels.create(a);return r.success?(await t().load(),s({formOpen:!1,editing:null}),!0):(s({error:r.error??"Create failed"}),!1)},update:async(a,r)=>{const o=await ze.channels.update(a,r);return o.success?(await t().load(),s({formOpen:!1,editing:null}),!0):(s({error:o.error??"Update failed"}),!1)},remove:async a=>{const r=await ze.channels.delete(a);return r.success?(s(o=>({channels:o.channels.filter(c=>c.id!==a)})),!0):(s({error:r.error??"Delete failed"}),!1)},toggle:async(a,r)=>(await ze.channels.toggle(a,r)).success?(s(c=>({channels:c.channels.map(u=>u.id===a?{...u,enabled:r}:u)})),!0):(await t().load(),!1),openForm:a=>s({formOpen:!0,editing:a??null,error:null}),closeForm:()=>s({formOpen:!1,editing:null,error:null}),openQr:a=>s({qrOpen:!0,qrChannel:a??null}),closeQr:()=>{s({qrOpen:!1,qrChannel:null}),t().load()},clearError:()=>s({error:null}),selectType:a=>s({selectedType:a,error:null}),updateChannelStatus:a=>{s(r=>({channels:r.channels.map(o=>o.id===a.channelId?{...o,connected:a.connected,_state:a.state}:o)}))}})),e_=["start","content","thinking","tool_call","tool_result","tool_diff","turn_summary","web_search","cache_stats","complete","generation_paused","generation_resumed","error","context_compressed","compaction_progress","tombstone","context_analysis","threshold_warning","blocking_limit","tool_retry","model_fallback","context_blocked","stall_detected"],pf=(s,t=[])=>{if(!s)return t;if(Array.isArray(s))return s.forEach(o=>pf(o,t)),t;if(typeof s!="object")return t;const a=s,r=a.content;return typeof r=="string"&&r.trim()&&t.push(r.trim()),Object.entries(a).forEach(([o,c])=>{o!=="content"&&o!=="structuredOutput"&&pf(c,t)}),t},t_=s=>{const t=pf(s);return t[t.length-1]||""};function n_({activeTab:s,setLogs:t,setUnreadLogs:a}){const r=je,o=_.useCallback(y=>{if(!y)return{};if(typeof y=="object")return y;if(typeof y!="string")return{};try{return JSON.parse(y)}catch{return{}}},[]),c=_.useCallback((y,b,v)=>{const S=o(b),k=Qe.getState(),C=je.getState();if(y==="workflow_plan_ready"&&S.planId){k.setPlan(v,{planId:String(S.planId),title:typeof S.title=="string"&&S.title?String(S.title):"工作流计划",reason:typeof S.reason=="string"?String(S.reason):void 0,confirm:S.confirm===!0,nodes:Array.isArray(S.nodes)?S.nodes:void 0,createdAt:Date.now()});return}if(y==="workflow_confirm_ack"){k.clearPlan(v);return}const E=S.runId||"";if(!E)return;if(y==="workflow_error"){k.fail(v,E,S.error||"Workflow failed"),(C.isGenerating(v)||C.isPaused(v))&&C.endGeneration(v,S.error||"Workflow failed");return}const O=y==="workflow_finished"?S.status||"COMPLETED":y==="workflow_started"?S.status||"RUNNING":y==="workflow_paused"?S.status||"PAUSED":y==="workflow_resumed"?S.status||"RESUMING":y==="workflow_cancelled"?S.status||"CANCELLED":y==="workflow_recovered"?S.status||"RUNNING":S.status||void 0,j=S.type||y,T=S.data&&typeof S.data=="object"?S.data:{},U=String(S.kind||T.kind||""),R=S.nodeId||S.node_id||T.nodeId||T.node_id,K=S.role||S.agentRole||S.agent_role||T.role||T.agentRole||T.agent_role,Z=S.phase||S.phaseId||T.phase||T.phaseId,te=S.effectId||T.effectId||R,pe=S.toolName||S.tool_name||T.toolName||T.tool_name,he=S.error||T.error,it=["effect.scheduled","effect.completed","effect.failed"].includes(j)&&R&&U!=="tool",de=["effect.scheduled","effect.completed","effect.failed"].includes(j)&&U==="tool"&&(pe||R),W=R?k.getAgentsForSession(v).find(Y=>Y.id===String(R)):void 0;if(k.upsert(v,{runId:E,status:O,title:typeof S.title=="string"&&S.title?String(S.title):void 0,completedPhases:Number(S.completedPhases||0),totalPhases:Number(S.totalPhases||0),completedEffects:Number(S.completedEffects||0),totalEffects:Number(S.totalEffects||0),tokensUsed:Number(S.tokensUsed||0),tokensRemaining:Number(S.tokensRemaining||0),lastEventType:j,agentNode:it?{nodeId:String(R),role:String(K||(W==null?void 0:W.role)||(W==null?void 0:W.name)||"agent"),phase:Z?String(Z):W==null?void 0:W.phase,status:j==="effect.failed"?"failed":j==="effect.completed"?"completed":"scheduled",tokens:S.tokensUsed!=null?Number(S.tokensUsed):T.tokens!=null&&typeof T.tokens=="number"?Number(T.tokens):void 0,error:he?String(he):void 0,updatedAt:Date.now()}:void 0}),de){const Y=j==="effect.failed"?"failed":j==="effect.completed"?"completed":"running",ve=String(te||`${E}-${pe||R}`);k.upsertTask(v,{id:ve,title:String(pe||R),description:R?String(R):void 0,status:Y,source:"workflow",runId:E,result:T.artifactRef?String(T.artifactRef):void 0,error:he?String(he):void 0,raw:S}),k.recordEvent(v,{type:j,source:"workflow",title:String(pe||R),status:Y,runId:E,taskId:ve,message:he?String(he):void 0,data:S})}if((y==="workflow_started"||y==="workflow_handoff")&&Array.isArray(S.nodes)?k.setNodes(v,E,S.nodes):y==="workflow_node_start"&&R?k.setNodeStatus(v,E,String(R),{status:"running"}):y==="workflow_node_complete"&&R&&k.setNodeStatus(v,E,String(R),{status:String(T.status||S.status||"completed"),result:T.result!=null?String(T.result):void 0,error:he?String(he):void 0}),y==="workflow_started")k.clearPlan(v),C.startGeneration(v);else if(y==="workflow_finished"){k.finalizeNodes(v,E,String(O||"COMPLETED"));const Y=t_(S.output);if(Y){const ve=C.getMessages(v),H=ve[ve.length-1];(H==null?void 0:H.type)==="assistant"?C.appendToLastMessage(v,Y):C.addMessage(v,{id:Wn(),type:"assistant",content:Y,timestamp:Date.now()})}C.endGeneration(v)}else O==="PAUSED"?C.pauseGeneration(v):(O==="RUNNING"||O==="RESUMING")&&C.resumeGeneration(v)},[o]),u=_.useCallback((y,b)=>{const v=o(y),S=Array.isArray(v.runs)?v.runs:[];if(S.length===0)return;const k=S.slice().sort((j,T)=>String(T.updatedAt||"").localeCompare(String(j.updatedAt||"")))[0],C=String(k.status||"").toUpperCase();if(!C)return;const E=Qe.getState(),O=String(k.runId||"");E.upsert(b,{runId:O,status:C,title:k.workflowId?`workflow: ${String(k.workflowId)}`:void 0,totalPhases:Number(k.totalNodes||0),completedPhases:Number(k.completedNodes||0),lastEventType:"workflow_status",error:k.error?String(k.error):void 0}),["COMPLETED","FAILED","ERROR","CANCELLED","CANCELED","PAUSED"].includes(C)&&E.recordEvent(b,{type:"workflow_status",source:"workflow",title:`Workflow ${C}`,message:k.output?String(k.output).slice(0,200):k.error?String(k.error):void 0,status:C==="COMPLETED"?"completed":"failed",runId:O,data:k})},[o]),f=_.useCallback(y=>{var k;const v=r.getState().messagesBySession[y]||[],S=v[v.length-1];return(k=S==null?void 0:S.steps)==null?void 0:k[S.steps.length-1]},[r]),m=_.useCallback((y,b,v)=>{const S=f(y),k=b==="step_complete",C=S&&(S.status==="success"||S.status==="error");if(!S||C&&!k){const E=(v==null?void 0:v.step)||b.replace("step_","").replace("_"," ");return r.getState().addStep(y,{id:`step-${Date.now()}`,title:E,description:(v==null?void 0:v.description)||"Executing...",status:"running",timestamp:Date.now()}),f(y)}return S},[f,r]),g=_.useCallback(y=>{var k,C;const b=y.type,v=y.data;if(b==="model_name"){Md(b,v,y.sessionId||"",{activeTab:s,setLogs:t,setUnreadLogs:a},y);return}if(b==="models_updated"||b==="models.updated"){window.dispatchEvent(new CustomEvent("models-updated"));return}if(b==="workspace_changed"){Md(b,v,y.sessionId||"",{activeTab:s,setLogs:t,setUnreadLogs:a});return}if(b==="question_answer_ack"){const E=o(v),O=E==null?void 0:E.questionId;if(O){const j=window;j.__answeredQuestionIds=j.__answeredQuestionIds||new Set,j.__answeredQuestionIds.add(O);const T=j.__pendingQuestions||{};for(const U of Object.keys(T))((k=T[U])==null?void 0:k.questionId)===O&&delete T[U];((C=j.__pendingQuestion)==null?void 0:C.questionId)===O&&(j.__pendingQuestion=null)}window.dispatchEvent(new CustomEvent("ask-question-dismiss",{detail:E==null?void 0:E.questionId}));return}const S=y.sessionId||"";if(!S){if(b==="task_update"||b==="task_finished"||b==="task_error"){const E=o(v);E&&typeof E.sessionId=="string"&&E.sessionId&&Bd(v,E.sessionId)}return}if(b==="hook_ask"){Ww(v,S);return}if(b==="ask_user_question"){Zw(v,S);return}if(b==="task_update"){Bd(v,S);return}if(b==="task_output"){try{r.getState().appendToLastMessage(S,String(v||""))}catch{}return}if(b==="task_finished"||b==="task_error"){b==="task_error"?ut.error("Task error",String(v)):Bd(v,S);return}if(b==="filejob_start"||b==="filejob_progress"||b==="filejob_result"||b==="filejob_error"){Xw(b,v,S);return}if(b.startsWith("step_")){Kw(b,v,S,m);return}if(b.startsWith("plan_")){try{Od(b,v,S)}catch(E){ut.error(`Failed to handle ${b}`,String(E))}return}if(b.startsWith("goal_")){try{Od(b,v,S)}catch(E){ut.error(`Failed to handle ${b}`,String(E))}return}if(b==="step_prompt"){try{Od(b,v,S)}catch(E){ut.error(`Failed to handle ${b}`,String(E))}return}if(b==="todo_update"){Yw(v,S);return}if(b==="todo_item_done"){Qw(v,S);return}if(b!=="todo_progress"){if(b==="inbox.pending"){Pr.pending(v);return}if(b==="inbox.resolved"){Pr.resolved(v);return}if(b==="audit.record"){Pr.auditRecord(v);return}if(b==="automation.update"){Pr.automationUpdate(v);return}if(b==="automation.run"){Pr.automationRun(v);return}if(b!=="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(b)){c(b,v,S);return}if(b==="workflow_status"){u(v,S);return}if(e_.includes(b)){Fw(b,v,S);return}if(b==="channel_status"){try{const E=JSON.parse(v||"{}");Jw.getState().updateChannelStatus(E)}catch{}return}if(b==="channel_message"||b==="channel_error"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.channel||E.platform||"Channel";if(b==="channel_error")ke.error(`${O}: ${E.error||E.message||"channel error"}`);else{const j=E.from||E.sender||"",T=E.text||E.content||E.message||"";T&&ke.info(`📨 ${O}${j?` · ${j}`:""}: ${String(T).slice(0,120)}`)}}catch{}return}if(b==="session_switched"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.id||E.sessionId||(typeof v=="string"?v:"");O&&we.getState().setActiveSession(String(O))}catch{}return}if(b==="task_interrupted"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.title||E.taskId||"Task";ke.warning(`⏸ ${O} interrupted — 使用 /continue 恢复生成`,1e4)}catch{ke.warning("A running task was interrupted",1e4)}return}if(b==="code_review_ready"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.title||E.skillId||"Code Review",j=E.summary||"";ke.success(`🔍 ${O} ready${j?`: ${String(j).slice(0,120)}`:""}`,8e3)}catch{ke.success("🔍 Code review ready",8e3)}return}if(b==="hook_auto_ack"){try{const E=typeof v=="string"?JSON.parse(v):v||{};ke.info(`Hook auto-approved: ${E.tool||E.name||"tool"}`,4e3)}catch{}return}if(b==="throttle"){try{const E=typeof v=="string"?JSON.parse(v):v||{},O=E.limit||E.remaining!=null?` (${E.remaining} left)`:"";ke.warning(`⚠ Rate limited${O}`,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"].includes(b)){Md(b,v,S,{activeTab:s,setLogs:t,setUnreadLogs:a});return}}}},[s,m,c,u,o,t,a]);_.useEffect(()=>{ge.connect();const y=ge.onMessage(g),b=ge.onClose(()=>{const S=je.getState();for(const k of S.generatingSessions)S.endGeneration(k,"WebSocket disconnected")}),v=ge.onOpen(()=>{var k;const S=((k=ge.getSessionId)==null?void 0:k.call(ge))||we.getState().activeSessionId;S&&ge.send({type:"get_workflow_status",sessionId:S,data:JSON.stringify({sessionId:S})})});return()=>{y(),b(),v()}},[g])}const el={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"}}},hf="linear";function Ay(s,t,a){const r=el[s]||el[hf];if(!r)return{bg:"#fcfaf8",surface:"#f6f1ea",border:"#e7dfd5",text:"#26251e",muted:"#5a574f",accentBlue:"#26251e",accentGreen:"#1f7a4d",accentRed:"#b84f42",accentYellow:"#a16b2d",accentPurple:"#7a5c8f"};const o={...t==="dark"?r.dark:r.light};return a&&Object.assign(o,a),o}const Fn=s=>{const t=parseInt(s.slice(1,3),16),a=parseInt(s.slice(3,5),16),r=parseInt(s.slice(5,7),16);return`${t} ${a} ${r}`},s_=(s,t,a)=>{const r=[parseInt(s.slice(1,3),16),parseInt(s.slice(3,5),16),parseInt(s.slice(5,7),16)],o=[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)];return r.map((c,u)=>Math.round(c+((o[u]??c)-c)*a)).join(" ")};function jy(s,t,a,r,o){a.classList.toggle("dark",s==="dark"),a.classList.toggle("light",s==="light"),a.style.setProperty("--color-bg",Fn(t.bg)),a.style.setProperty("--color-surface",Fn(t.surface)),a.style.setProperty("--color-border",Fn(t.border)),a.style.setProperty("--color-text",Fn(t.text)),a.style.setProperty("--color-muted",Fn(t.muted)),a.style.setProperty("--color-accent-blue",Fn(t.accentBlue)),a.style.setProperty("--color-accent-green",Fn(t.accentGreen)),a.style.setProperty("--color-accent-red",Fn(t.accentRed)),a.style.setProperty("--color-accent-yellow",Fn(t.accentYellow)),a.style.setProperty("--color-accent-purple",Fn(t.accentPurple)),a.style.setProperty("--color-hover",s_(t.surface,t.text,.06)),r&&r.setAttribute("content",t.bg),o&&o.setAttribute("content",s)}function a_({theme:s,themePresetId:t,customTheme:a,customThemeEnabled:r}){_.useEffect(()=>{const o=document.documentElement,c=document.querySelector('meta[name="theme-color"]'),u=document.querySelector('meta[name="color-scheme"]'),f=s==="dark"?"dark":s==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",m=r?a:void 0,g=Ay(t||hf,f,m);if(jy(f,g,o,c,u),s==="auto"){const y=window.matchMedia("(prefers-color-scheme: dark)"),b=()=>{const v=y.matches?"dark":"light",S=Ay(t||hf,v,m);jy(v,S,o,c,u)};return y.addEventListener("change",b),()=>y.removeEventListener("change",b)}},[s,t,a,r])}class Ry extends _.Component{constructor(a){super(a);Ge(this,"handleRetry",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,r){console.error("[ErrorBoundary] Caught error:",a,r)}render(){var a;return this.state.hasError?this.props.fallback?this.props.fallback:h.jsx("div",{className:"flex items-center justify-center h-full w-full bg-dark-bg",children:h.jsxs("div",{className:"max-w-md p-8 text-center",children:[h.jsx("div",{className:"flex justify-center mb-4",children:h.jsx("div",{className:"w-16 h-16 rounded-full bg-accent-red/10 flex items-center justify-center",children:h.jsx(vf,{size:32,className:"text-accent-red"})})}),h.jsx("h2",{className:"text-xl font-semibold text-dark-text mb-2",children:"页面出现错误"}),h.jsx("p",{className:"text-sm text-dark-muted mb-6",children:((a=this.state.error)==null?void 0:a.message)||"发生了未知错误,请尝试刷新页面"}),h.jsxs("div",{className:"flex items-center justify-center gap-3",children:[h.jsxs("button",{onClick:this.handleRetry,className:"flex items-center gap-2 px-4 py-2 bg-accent-blue text-white rounded-lg hover:opacity-90 transition-opacity",children:[h.jsx(gf,{size:16}),"重试"]}),h.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:"刷新页面"})]})]})}):this.props.children}}const i_=10;function r_(s,t=i_){return s.filter(a=>a&&!!a.id&&(a.messageCount??0)>0).sort((a,r)=>String(r.updatedAt||"").localeCompare(String(a.updatedAt||""))).slice(0,t).map(a=>{const r=new Date(a.createdAt).getTime()||Date.now(),o=new Date(a.updatedAt).getTime()||r;return{id:a.id,title:a.title||a.id,createdAt:r,lastActiveAt:o,messageCount:a.messageCount??0,...a.preview?{preview:a.preview}:{}}})}function Oy(s){if(s>=1e8)return`${(s/1e8).toFixed(1)}亿`;if(s>=1e4){const t=s/1e4;return`${t>=100?t.toFixed(0):t.toFixed(1)}万`}return String(Math.round(s))}function l_(s){return`${s>=10?s.toFixed(0):s.toFixed(1)}%`}const o_=_.memo(function({open:t,onClose:a}){const r=Fe(T=>T.currentUsage),o=Fe(T=>T.maxContextTokens),c=Fe(T=>T.contextBreakdown),u=Fe(T=>T.cacheStats),f=Fe(T=>T.estimateTokens),m=je(T=>T.messagesBySession),g=we(T=>T.activeSessionId),y=g?m[g]||[]:[];_.useEffect(()=>{if(!t)return;const T=U=>{U.key==="Escape"&&a()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[t,a]);const b=_.useMemo(()=>{if(c)return null;let T=0,U=0;for(const R of y){let K=R.content||"",Z="";if(R.thinking&&(K+=" "+R.thinking),R.steps)for(const te of R.steps)te.thought&&(K+=" "+te.thought),te.action&&(Z+=" "+te.action),te.result&&(Z+=" "+te.result);if(R.toolCalls)for(const te of R.toolCalls)Z+=" "+(typeof te.args=="string"?te.args:JSON.stringify(te.args));T+=f(K),U+=f(Z)}return{messagesTokens:T,toolTokens:U,total:T+U}},[c,y,f]),S=_.useMemo(()=>{const T=c,U=T?T.messagesTokens:(b==null?void 0:b.messagesTokens)??0,R=T?T.toolContentTokens+T.toolDefTokens:(b==null?void 0:b.toolTokens)??0,K=T?T.systemPromptTokens:0,Z=T?T.skillTokens:0,te=T?T.mcpToolTokens:0,pe=T?T.dynamicTokens:0,he=T?T.total:(b==null?void 0:b.total)??0,it=Math.max(0,r.totalTokens-he)+pe,de=Math.max(r.totalTokens,he,1);return[{key:"system",label:"系统提示词",tokens:K,color:"bg-dark-text/70"},{key:"tools",label:"系统工具",tokens:R,color:"bg-accent-purple"},{key:"mcp",label:"MCP 工具",tokens:te,color:"bg-accent-cyan"},{key:"skills",label:"技能",tokens:Z,color:"bg-accent-yellow"},{key:"messages",label:"消息",tokens:U,color:"bg-accent-blue"},{key:"other",label:"其他",tokens:it,color:"bg-dark-muted/60"}].map(W=>({...W,pct:W.tokens/de*100}))},[c,b,r.totalTokens]).filter(T=>T.pct>=.05||T.tokens>0),k=r.totalTokens,C=o>0?Math.min(100,k/o*100):0,E=C>=90?"bg-accent-red":C>=70?"bg-accent-yellow":"bg-dark-text/70",O=C>=90?"text-accent-red":C>=70?"text-accent-yellow":"text-dark-text",j=u&&u.cacheStatsCalls>0&&u.cacheHitRate!==void 0?u.cacheHitRate:null;return t?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]",onClick:a,"aria-hidden":"true"}),h.jsx("div",{className:"fixed inset-x-0 bottom-9 z-50 mx-auto max-w-lg px-2 pb-2",children:h.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:[h.jsxs("div",{className:"flex items-center justify-between px-4 pt-3 pb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(d0,{size:15,className:O}),h.jsx("span",{className:"text-sm font-semibold text-dark-text",children:"上下文容量"})]}),h.jsx("button",{type:"button","aria-label":"关闭",onClick:a,className:"p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:h.jsx(bs,{size:15})})]}),h.jsxs("div",{className:"px-4 pb-1",children:[h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsxs("span",{className:"text-xl font-bold font-mono text-dark-text",children:[Oy(k),h.jsxs("span",{className:"text-dark-muted text-sm font-normal",children:[" / ",Oy(o)]})]}),h.jsxs("span",{className:`text-xs font-mono ${O}`,children:["(",C.toFixed(1),"%)"]})]}),h.jsx("div",{className:"mt-1.5 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:h.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${E}`,style:{width:`${C}%`}})})]}),h.jsxs("div",{className:"flex items-center justify-between px-4 pt-2 pb-1",children:[h.jsx("span",{className:"text-[11px] font-medium text-dark-muted",children:"分类占比"}),h.jsx("span",{className:"text-[10px] text-dark-muted/50 select-none",title:"按后端上下文组装顺序(上→下):系统提示词 → 系统工具 → MCP 工具 → 技能 → 消息 → 其他(估算差额)",children:"按组装顺序 ↓"})]}),h.jsx("div",{className:"px-4 pb-2 space-y-1.5",children:S.map(T=>h.jsxs("div",{"data-row-key":T.key,className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[11px] text-dark-muted w-16 shrink-0",children:T.label}),h.jsx("div",{className:"flex-1 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:h.jsx("div",{className:`h-full ${T.color} rounded-full`,style:{width:`${Math.max(.5,T.pct)}%`}})}),h.jsx("span",{className:"text-[11px] font-mono text-dark-text w-12 text-right shrink-0",children:l_(T.pct)})]},T.key))}),h.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:[h.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-dark-muted",children:[h.jsx(f0,{size:11}),"平均缓存命中率"]}),j!==null?h.jsxs("span",{className:`text-[11px] font-mono font-semibold ${j>=.5?"text-accent-green":"text-accent-yellow"}`,children:[(j*100).toFixed(0),"%"]}):h.jsx("span",{className:"text-[11px] font-mono text-dark-muted/60",children:"–"})]})]})})]}):null}),c_=_.memo(function(t){const{t:a}=Tn(),r=Fe(Y=>Y.currentUsage),o=Fe(Y=>Y.maxContextTokens),c=Fe(Y=>Y.model),u=Fe(Y=>Y.tokenRate),f=Fe(Y=>Y.compactingUntil),m=Fe(Y=>Y.lastCompactInfo),g=Fe(Y=>Y.degradation),y=Fe(Y=>Y.compactionProgress),b=Fe(Y=>Y.cacheStats),v=we(Y=>Y.activeSessionId),S=je(Y=>v?Y.isGenerating(v):!1),k=Qe(Y=>v?Y.bySession[v]:void 0),C=Qe(Y=>v?Y.getRunningAgentCount(v):0),E=Qr(Y=>Y.mode),O=ys(Y=>Y.autoMode),[j,T]=_.useState(0),U=_.useRef(0),[R,K]=_.useState(!1);_.useEffect(()=>{if(S&&!U.current&&(U.current=Date.now()),!S){U.current=0,T(0);return}const Y=setInterval(()=>T(Math.floor((Date.now()-U.current)/1e3)),1e3);return()=>clearInterval(Y)},[S]);const Z=r.totalTokens,te=o>0?Math.min(100,Math.round(r.totalTokens/o*100)):0,pe=Dk(u),he=E==="normal"?"act":E,it=Mk[he],de=Cn(he),W=de==="plan"?"border-accent-blue/30 text-accent-blue":de==="goal"?"border-accent-purple/30 text-accent-purple":"border-accent-green/30 text-accent-green";return h.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:[h.jsx("span",{className:"font-semibold text-dark-text whitespace-nowrap",children:"DeepSeekCode"}),h.jsx("span",{className:`px-2 py-0.5 rounded-full border whitespace-nowrap ${W}`,children:it.label}),O&&h.jsx("span",{className:"px-2 py-0.5 rounded-full border border-accent-yellow/30 text-accent-yellow whitespace-nowrap",children:"Auto"}),h.jsx("span",{className:"text-dark-muted truncate max-w-[14rem]",children:c||a("common.connecting")}),h.jsxs("span",{className:"inline-flex items-center text-[11px] whitespace-nowrap shrink-0",title:b&&b.cacheStatsCalls>0?`缓存命中 ${Dr(b.cacheHitTokens)} / 未命中 ${Dr(b.cacheMissTokens)}(${b.cacheStatsCalls} 次调用)`:"暂无缓存统计(本轮 run 未收到 provider 的 prompt_cache_hit/miss 字段)",children:[h.jsx("span",{className:"text-dark-muted",children:"cache"})," ",b&&b.cacheStatsCalls>0?h.jsx("span",{className:b.cacheHitRate!==void 0&&b.cacheHitRate>=.5?"text-accent-green":"text-accent-yellow",children:b.cacheHitRate!==void 0?`${(b.cacheHitRate*100).toFixed(0)}%`:"n/a"}):h.jsx("span",{className:"text-dark-muted/60",children:"–"})]}),h.jsxs("button",{type:"button",onClick:()=>K(!0),title:"查看上下文容量详情",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:[h.jsxs("span",{className:"hidden md:inline-flex items-center gap-1 text-dark-muted whitespace-nowrap",children:[h.jsx("span",{className:"text-dark-text",children:Dr(Z)}),h.jsx("span",{className:"text-dark-muted/60",children:"/"}),h.jsx("span",{children:Dr(o)})]}),h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx("span",{className:"w-16 lg:w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden inline-flex",children:h.jsx("span",{className:`h-full transition-all rounded-full ${te>=90?"bg-accent-red":te>=70?"bg-accent-yellow":"bg-dark-text/70"}`,style:{width:`${te}%`}})}),h.jsxs("span",{className:te>=90?"text-accent-red font-bold":te>=70?"text-accent-yellow":"",children:[te,"%"]})]}),h.jsx(p0,{size:12,className:"text-dark-muted/50 group-hover:text-dark-text transition-colors"})]}),S&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"text-dark-text flex items-center gap-1 whitespace-nowrap",children:[h.jsx(Nn,{size:12,className:"animate-spin"}),hb(j)]}),pe&&h.jsx("span",{className:"text-accent-purple whitespace-nowrap",children:pe})]}),C>0&&h.jsxs("span",{className:"text-dark-text whitespace-nowrap",children:[C," agent",C>1?"s":""]}),h.jsx("div",{className:"flex-1"}),k&&h.jsxs("span",{className:"hidden xl:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[h.jsx("span",{className:"text-dark-muted",children:"wf"}),h.jsx("span",{className:"font-mono",children:k.status}),h.jsxs("span",{children:[k.completedPhases,"/",k.totalPhases||0]}),h.jsx("span",{className:"text-dark-muted",children:Dr(k.tokensUsed)})]}),y&&h.jsxs("span",{className:"hidden lg:flex items-center gap-2 text-[11px] text-dark-text whitespace-nowrap",children:[h.jsx("span",{children:"compact"}),h.jsxs("span",{children:[y.percent,"%"]}),h.jsx("span",{className:"w-20 h-1.5 bg-dark-border/70 rounded-full overflow-hidden",children:h.jsx("span",{className:"h-full bg-dark-text/70 rounded-full block",style:{width:`${y.percent}%`}})})]}),!y&&Date.now()<f&&m&&h.jsxs("span",{className:"hidden lg:inline text-dark-muted text-[11px] whitespace-nowrap",children:[m.originalCount," ","->"," ",m.compressedCount]}),(g==null?void 0:g.active)&&h.jsxs("span",{className:"text-accent-yellow text-[11px] whitespace-nowrap",children:[g.label," ",g.retryCount>0?`${g.retryCount}/${g.maxRetries}`:""]}),h.jsx(o_,{open:R,onClose:()=>K(!1)})]})}),Dn=Ut()((s,t)=>({status:null,branches:null,loading:!1,refreshing:!1,lastAction:null,busy:!1,refreshStatus:async()=>{const a=await ze.git.status();return a.success&&a.data?(s({status:a.data}),a.data):(s({status:{available:!1,error:a.error||"Failed to load git status"}}),null)},refreshBranches:async()=>{const a=await ze.git.branches();a.success&&a.data?s({branches:a.data}):s({branches:null})},refreshAll:async()=>{if(!t().refreshing){s({refreshing:!0,loading:t().status===null});try{await t().refreshStatus(),await t().refreshBranches()}finally{s({refreshing:!1,loading:!1})}}},commit:async a=>{s({busy:!0});const r=await ze.git.commit({message:a});return s({busy:!1,lastAction:r.success&&r.data?r.data:{ok:!1,error:r.error||"Commit failed"}}),t().refreshStatus(),t().lastAction},push:async()=>{s({busy:!0});const a=await ze.git.push();return s({busy:!1,lastAction:a.success&&a.data?a.data:{ok:!1,error:a.error||"Push failed"}}),t().refreshStatus(),t().lastAction},checkout:async a=>{s({busy:!0});const r=await ze.git.checkout(a);return s({busy:!1,lastAction:r.success&&r.data?r.data:{ok:!1,error:r.error||"Checkout failed"}}),t().refreshAll(),t().lastAction}})),Dd="dsc-git-commit-draft",u_=_.memo(function(){const{t}=Tn(),a=Dn(R=>R.status),r=Dn(R=>R.branches),o=Dn(R=>R.busy),c=Dn(R=>R.lastAction),u=Ei(R=>R.workspaceDir),[f,m]=_.useState(!1),[g,y]=_.useState(""),[b,v]=_.useState(!1),[S,k]=_.useState(null),C=_.useRef(null);_.useEffect(()=>{Dn.getState().refreshAll();const R=setInterval(()=>{document.visibilityState==="visible"&&Dn.getState().refreshStatus()},3e4);return()=>clearInterval(R)},[]),_.useEffect(()=>{const R=localStorage.getItem(Dd);R&&y(R)},[]);const E=_.useCallback(async()=>{try{const R=await ze.git.prStatus();R.success&&k(R.data||{available:!1,message:""})}catch{}},[]);_.useEffect(()=>{E()},[E]),_.useEffect(()=>{if(!f)return;const R=K=>{C.current&&!C.current.contains(K.target)&&m(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[f]);const O=_.useCallback(async()=>{const R=g.trim();if(!R){ke.warning(t("git.emptyCommitMsg"));return}const Z=await Dn.getState().commit(R);Z.ok?(ke.success(t("git.commitSuccess")),v(!1),localStorage.removeItem(Dd),y("")):ke.error(Z.error||t("git.commitFailed"))},[g,t]),j=_.useCallback(async()=>{const K=await Dn.getState().push();K.ok?ke.success(t("git.pushSuccess")):ke.error(K.error||t("git.pushFailed"))},[t]),T=_.useCallback(async R=>{const Z=await Dn.getState().checkout(R);Z.ok?ke.success(t("git.checkoutSuccess",{branch:R})):ke.error(Z.error||t("git.checkoutFailed"))},[t]),U=a&&a.available===!1;return h.jsxs("div",{ref:C,className:"relative",children:[h.jsxs("button",{onClick:()=>m(R=>!R),className:pt("flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs transition-colors",f?"bg-dark-hover text-dark-text":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"),title:t("git.panelTitle"),"aria-expanded":f,children:[h.jsx(Sg,{size:13,className:pt(U?"text-dark-muted/50":"text-accent-blue")}),h.jsx("span",{className:"max-w-[120px] truncate font-mono",children:U?t("git.noRepo"):(a==null?void 0:a.branch)||"—"}),(a==null?void 0:a.dirty)&&h.jsxs("span",{className:"hidden sm:flex items-center gap-1 text-[10px] font-mono tabular-nums",children:[h.jsxs("span",{className:"text-accent-green",children:["+",a.totalAdded??0]}),h.jsxs("span",{className:"text-accent-red",children:["−",a.totalRemoved??0]})]}),h.jsx(Ea,{size:11,className:pt("transition-transform",f&&"rotate-180")})]}),f&&h.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:[h.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 border-b border-dark-border bg-dark-surface",children:[h.jsx(Sg,{size:14,className:"text-accent-blue"}),h.jsx("span",{className:"text-xs font-medium text-dark-text",children:t("git.panelTitle")}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:()=>void Dn.getState().refreshAll(),className:"rounded p-1 text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",title:t("git.refresh"),children:h.jsx(gf,{size:12,className:pt(Dn.getState().refreshing&&"animate-spin")})})]}),U?h.jsxs("div",{className:"px-3.5 py-4 text-center",children:[h.jsx(h0,{size:20,className:"mx-auto mb-2 text-dark-muted/50"}),h.jsx("div",{className:"text-xs text-dark-muted",children:t("git.notGitDesc")}),h.jsx("div",{className:"mt-1 text-[10px] font-mono text-dark-muted/60 break-all",children:u})]}):a?h.jsxs("div",{className:"p-3.5 space-y-3 max-h-[60vh] overflow-y-auto custom-scrollbar",children:[h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[h.jsx("span",{className:"text-[11px] text-dark-muted",children:t("git.changes")}),h.jsxs("span",{className:"text-[11px] font-mono tabular-nums",children:[h.jsxs("span",{className:"text-accent-green",children:["+",a.totalAdded??0]}),h.jsx("span",{className:"text-dark-muted/40",children:" / "}),h.jsxs("span",{className:"text-accent-red",children:["−",a.totalRemoved??0]})]})]}),h.jsxs("div",{className:"space-y-0.5 max-h-40 overflow-y-auto custom-scrollbar",children:[(a.changes||[]).slice(0,30).map(R=>h.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[h.jsx("span",{className:pt("w-6 shrink-0 rounded px-1 text-center text-[9px]",R.status.includes("?")?"bg-accent-purple/15 text-accent-purple":R.status===R.status.toUpperCase()&&R.status.trim()?"bg-accent-green/15 text-accent-green":"bg-accent-yellow/15 text-accent-yellow"),children:R.status}),h.jsx("span",{className:"flex-1 truncate text-dark-text",children:R.path}),h.jsxs("span",{className:"shrink-0 text-[10px] tabular-nums text-dark-muted/60",children:[R.added>0&&h.jsxs("span",{className:"text-accent-green",children:["+",R.added]}),R.removed>0&&h.jsxs("span",{className:"text-accent-red",children:["−",R.removed]})]})]},R.path)),(a.changes||[]).length===0&&h.jsx("div",{className:"py-2 text-center text-[11px] text-dark-muted/60",children:t("git.clean")})]})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-[11px] text-dark-muted mb-1",children:t("git.branch")}),h.jsx("div",{className:"flex flex-wrap gap-1",children:((r==null?void 0:r.branches)||[a.branch||""]).slice(0,8).map(R=>h.jsx("button",{onClick:()=>R!==a.branch&&T(R),disabled:R===a.branch,className:pt("rounded-md px-2 py-1 text-[11px] font-mono transition-colors",R===a.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:R},R))}),(a.ahead??0)>0||(a.behind??0)>0?h.jsxs("div",{className:"mt-1 text-[10px] text-dark-muted/70",children:[(a.ahead??0)>0&&h.jsxs("span",{className:"text-accent-green",children:["↑ ",a.ahead," "]}),(a.behind??0)>0&&h.jsxs("span",{className:"text-accent-yellow",children:["↓ ",a.behind]}),t("git.upstream")]}):null]}),h.jsx("div",{children:b?h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("textarea",{value:g,onChange:R=>{y(R.target.value),localStorage.setItem(Dd,R.target.value)},placeholder:t("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"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs("button",{onClick:O,disabled:o||!g.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:[o?h.jsx(Nn,{size:12,className:"animate-spin"}):h.jsx(kg,{size:12}),t("git.commitConfirm")]}),h.jsx("button",{onClick:()=>v(!1),className:"rounded-md px-2.5 py-1.5 text-xs text-dark-muted hover:bg-dark-hover transition-colors",children:t("common.cancel")})]})]}):h.jsxs("div",{className:"flex gap-1.5",children:[h.jsxs("button",{onClick:()=>v(!0),disabled:o,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:[h.jsx(kg,{size:13}),t("git.commit")]}),h.jsxs("button",{onClick:j,disabled:o||!a.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:[h.jsx(m0,{size:13}),t("git.push")]})]})}),h.jsxs("div",{className:"flex items-center gap-1.5 rounded-md bg-dark-bg border border-dark-border px-2.5 py-2",children:[h.jsx(g0,{size:13,className:"text-accent-purple shrink-0"}),h.jsx("span",{className:"text-[11px] text-dark-muted truncate",children:S?S.available?t("git.prReady"):S.message||t("git.prUnavailable"):t("git.prLoading")})]}),h.jsxs("div",{className:"rounded-md bg-dark-bg border border-dark-border px-2.5 py-2 space-y-0.5",children:[h.jsx("div",{className:"text-[10px] text-dark-muted",children:t("git.environment")}),h.jsx("div",{className:"text-[11px] font-mono text-dark-text/80 break-all",children:u||"—"}),a.lastCommit&&h.jsxs("div",{className:"text-[10px] font-mono text-dark-muted/60 truncate",children:[a.lastCommit.hash.slice(0,7)," ",a.lastCommit.subject]})]}),c&&h.jsxs("div",{className:pt("flex items-center gap-1.5 text-[11px]",c.ok?"text-accent-green":"text-accent-red"),children:[c.ok?h.jsx(Jo,{size:12}):h.jsx(Xo,{size:12}),h.jsx("span",{className:"truncate",children:c.ok?t("git.ok"):c.error||""})]})]}):h.jsx("div",{className:"px-3.5 py-4 text-center text-xs text-dark-muted",children:t("git.loading")})]})]})});function d_({onOpenTemplates:s,onSaveAsTemplate:t,saveAsBusy:a}){const[r,o]=_.useState(!1),c=_.useRef(null);return _.useEffect(()=>{if(!r)return;const u=f=>{c.current&&!c.current.contains(f.target)&&o(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),h.jsxs("div",{ref:c,className:"relative",children:[h.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:"更多","aria-label":"更多","aria-expanded":r,children:h.jsx(y0,{size:16,"aria-hidden":"true"})}),r&&h.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:[h.jsxs("button",{onClick:()=>{o(!1),s()},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-dark-text hover:bg-dark-hover transition-colors",children:[h.jsx(Io,{size:13,className:"text-dark-muted shrink-0"})," 模板库"]}),h.jsxs("button",{onClick:()=>{o(!1),t()},disabled:a,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:[a?h.jsx(Nn,{size:13,className:"animate-spin shrink-0"}):h.jsx(b0,{size:13,className:"text-dark-muted shrink-0"}),"保存为模板"]})]})]})}const f_={info:Xy,success:Py,warning:vf,error:bf},p_={info:"border-accent-blue/30 bg-accent-blue/10 text-accent-blue",success:"border-accent-green/30 bg-accent-green/10 text-accent-green",warning:"border-accent-yellow/30 bg-accent-yellow/10 text-accent-yellow",error:"border-accent-red/30 bg-accent-red/10 text-accent-red"},h_=_.memo(function(){const{toasts:t,dismissToast:a}=Ys();return t.length===0?null:h.jsx("div",{className:"fixed bottom-20 right-4 z-[100] flex flex-col gap-2 max-w-sm",children:t.map(r=>{const o=f_[r.type];return h.jsxs("div",{className:`flex items-start gap-2 px-3 py-2.5 rounded-lg border shadow-lg animate-fade-in-up ${p_[r.type]}`,children:[h.jsx(o,{size:16,className:"shrink-0 mt-0.5"}),h.jsx("span",{className:"text-xs flex-1",children:r.message}),h.jsx("button",{onClick:()=>a(r.id),className:"shrink-0 p-0.5 rounded hover:bg-dark-hover/50 transition-colors",children:h.jsx(bs,{size:12})})]},r.id)})})}),m_={critical:{icon:x0,border:"border-accent-red",bg:"bg-accent-red/10",text:"text-accent-red"},error:{icon:bf,border:"border-accent-red/60",bg:"bg-accent-red/5",text:"text-accent-red"},warning:{icon:vf,border:"border-accent-yellow/60",bg:"bg-accent-yellow/5",text:"text-accent-yellow"},info:{icon:Xy,border:"border-accent-blue/60",bg:"bg-accent-blue/5",text:"text-accent-blue"}},g_=_.memo(function(){const t=ki(r=>r.errors.filter(o=>!o.dismissed)),a=ki(r=>r.dismiss);return t.length===0?null:h.jsx("div",{className:"fixed bottom-4 right-4 z-[110] flex flex-col gap-2 max-w-sm",children:t.map(r=>{const o=m_[r.level],c=o.icon;return h.jsx(y_,{entry:r,icon:c,config:o,onDismiss:()=>a(r.id)},r.id)})})});function y_({entry:s,icon:t,config:a,onDismiss:r}){const[o,c]=_.useState(!1);return h.jsxs("div",{className:`flex flex-col px-3 py-2.5 rounded-lg border shadow-lg animate-fade-in-up ${a.bg} ${a.border}`,children:[h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(t,{size:16,className:`shrink-0 mt-0.5 ${a.text}`}),h.jsx("span",{className:`text-xs flex-1 ${a.text}`,children:s.title}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.detail&&h.jsx("button",{onClick:()=>c(!o),className:"p-0.5 rounded hover:bg-dark-hover/50 transition-colors",children:o?h.jsx(Ea,{size:12}):h.jsx(Qy,{size:12})}),h.jsx("button",{onClick:r,className:"p-0.5 rounded hover:bg-dark-hover/50 transition-colors",children:h.jsx(bs,{size:12})})]})]}),o&&s.detail&&h.jsx("div",{className:"mt-1.5 ml-6 text-[11px] text-dark-muted whitespace-pre-wrap break-words leading-relaxed border-t border-dark-border/50 pt-1.5",children:s.detail}),s.action&&h.jsx("button",{onClick:s.action.onClick,className:"mt-1.5 ml-6 self-start text-[11px] px-2 py-0.5 rounded bg-dark-hover hover:bg-dark-border transition-colors",children:s.action.label})]})}function b_(s){const{t}=Tn(),{setActiveTab:a,createNewSession:r,clearMessages:o,setTheme:c,setThemePreset:u,toggleTerminal:f,setLogs:m,setUnreadLogs:g}=s,y=Af(W=>W.backendCommands),b=Array.isArray(y)?y:[],[v,S]=_.useState(!1),[k,C]=_.useState(""),[E,O]=_.useState(0),j=_.useRef(null),T=_.useCallback((W,Y)=>{const ve=we.getState().activeSessionId;return ve?(ge.setSessionId(ve),ge.send({type:"command_execute",sessionId:ve,data:JSON.stringify({command:`/${W}`,args:Y||""})}),{success:!0,message:t("slashCommands.sent_command")+`/${W}`}):{success:!1,message:t("slashCommands.noActiveSession")}},[t]),U=_.useMemo(()=>[{id:"chat",name:"chat",description:t("slashCommands.chat_desc"),icon:"💬",local:!0,action:()=>(a("chat"),{success:!0,message:t("slashCommands.chat_result")})},{id:"terminal",name:"terminal",description:t("slashCommands.terminal_desc"),icon:"💻",local:!0,action:()=>(a("terminal"),{success:!0,message:t("slashCommands.terminal_result")})},{id:"files",name:"files",description:t("slashCommands.files_desc"),icon:"📁",local:!0,action:()=>(a("files"),{success:!0,message:t("slashCommands.files_result")})},{id:"models",name:"models",description:t("slashCommands.models_desc"),icon:"🧠",local:!0,action:()=>(a("models"),{success:!0,message:t("slashCommands.models_result")})},{id:"tools",name:"tools",description:t("slashCommands.tools_desc"),icon:"🔧",local:!0,action:()=>(a("tools"),{success:!0,message:t("slashCommands.tools_result")})},{id:"skills",name:"skills",description:t("slashCommands.skills_desc"),icon:"🎯",local:!0,action:()=>(a("skills"),{success:!0,message:t("slashCommands.skills_result")})},{id:"settings",name:"settings",description:t("slashCommands.settings_desc"),icon:"⚙️",local:!0,action:()=>(a("settings"),{success:!0,message:t("slashCommands.settings_result")})},{id:"logs",name:"logs",description:t("slashCommands.logs_desc"),icon:"📜",local:!0,action:()=>(a("logs"),g(0),{success:!0,message:t("slashCommands.logs_result")})},{id:"new",name:"new",description:t("slashCommands.new_desc"),icon:"✨",local:!0,action:()=>(r(),{success:!0,message:t("slashCommands.new_result")})},{id:"clear",name:"clear",description:t("slashCommands.clear_desc"),icon:"🗑️",local:!0,action:()=>(o(),{success:!0,message:t("slashCommands.clear_result")})},{id:"theme",name:"theme",description:t("slashCommands.theme_desc"),args:"<dark|light|auto|preset-name>",icon:"🎨",local:!0,action:W=>{const Y=W.trim().toLowerCase();if(["dark","light","auto"].includes(Y))return c(Y),{success:!0,message:t("slashCommands.theme_result")+Y};if(el[Y])return u?(u(Y),{success:!0,message:t("slashCommands.theme_preset_result")+el[Y].nameKey}):{success:!1,message:t("slashCommands.theme_preset_unavailable")};const ve=Object.keys(el).join("|");return{success:!1,message:t("slashCommands.theme_error",{presets:ve})}}},{id:"terminal-toggle",name:"terminal-toggle",description:t("slashCommands.toggle_terminal_desc"),icon:"🔲",local:!0,action:()=>(f(),{success:!0,message:t("slashCommands.toggle_terminal_result")})},{id:"clear-logs",name:"clear-logs",description:t("slashCommands.logs_clear_desc"),icon:"📭",local:!0,action:()=>(m([]),g(0),{success:!0,message:t("slashCommands.logs_clear_result")})},{id:"doctor",name:"doctor",description:t("slashCommands.doctor_desc"),icon:"🩺",local:!1,action:()=>T("doctor")},{id:"compact",name:"compact",description:t("slashCommands.compact_desc"),args:"[aggressive|summary]",icon:"🗜️",local:!1,action:W=>T("compact",W)},{id:"help",name:"help",description:t("slashCommands.help_desc"),icon:"❓",local:!1,action:()=>T("help")},{id:"cost",name:"cost",description:t("slashCommands.token_desc"),args:"[detail|reset]",icon:"💰",local:!1,action:W=>T("cost",W)},{id:"model",name:"model",description:t("slashCommands.model_desc"),args:"[model-name]",icon:"🤖",local:!1,action:W=>T("model",W)},{id:"status",name:"status",description:t("slashCommands.status_desc"),icon:"📊",local:!1,action:()=>T("status")},{id:"config",name:"config",description:t("slashCommands.config_desc"),args:"<get|set|list|delete> [key] [value]",icon:"🔧",local:!1,action:W=>T("config",W)},{id:"exit",name:"exit",description:t("slashCommands.exit_desc"),icon:"🚪",local:!1,action:()=>{const W=we.getState().activeSessionId;return W&&(ge.setSessionId(W),ge.send({type:"exit",sessionId:W})),{success:!0,message:t("slashCommands.exit_result")}}},{id:"test",name:"test",description:t("slashCommands.benchmark_desc"),args:"[simple|medium|complex|full|list]",icon:"🧪",local:!1,action:W=>T("test",W)}],[a,r,o,c,u,f,m,g,T,t]),R=_.useMemo(()=>b.map(W=>{const Y=t(`slashCommands.${W.name}_desc`,W.description||W.usage||"");return{id:`backend-${W.name}`,name:W.name,description:Y,icon:"🔌",local:!1,action:ve=>{const H=we.getState().activeSessionId;return H?(ge.setSessionId(H),ge.send({type:"command_execute",sessionId:H,data:JSON.stringify({command:`/${W.name}`,args:ve||""})}),{success:!0,message:t("slashCommands.sent_command")+`/${W.name}`}):{success:!1,message:t("slashCommands.noActiveSession")}}}}),[b,t]),K=_.useMemo(()=>{const W=new Set;return[...U,...R].filter(Y=>W.has(Y.name)?!1:(W.add(Y.name),!0))},[U,R]),Z=_.useMemo(()=>{if(!k)return K;const W=k.toLowerCase();return K.filter(Y=>Y.name.toLowerCase().includes(W)||Y.description.toLowerCase().includes(W))},[K,k]),te=_.useCallback(()=>{S(!0),C(""),O(0)},[]),pe=_.useCallback(()=>{S(!1),C(""),O(0)},[]),he=_.useCallback(()=>{O(W=>W>=Z.length-1?0:W+1)},[Z.length]),it=_.useCallback(()=>{O(W=>W<=0?Z.length-1:W-1)},[Z.length]),de=_.useCallback((W,Y)=>{const ve=W.action(Y);return pe(),ve},[pe]);return _.useEffect(()=>{if(v&&j.current){const W=j.current.querySelector(`[data-index="${E}"]`);W&&W.scrollIntoView({block:"nearest"})}},[E,v]),{isOpen:v,filter:k,setFilter:C,selectedIndex:E,setSelectedIndex:O,filteredCommands:Z,allCommands:K,openMenu:te,closeMenu:pe,selectNext:he,selectPrev:it,executeCommand:de,containerRef:j,commands:U}}function DE(s){const t=s.trim();if(!t.startsWith("/"))return null;const r=t.slice(1).split(/\s+/),o=r[0]||"",c=r.slice(1).join(" ");return{command:o,args:c}}function x_({open:s,onClose:t,options:a}){const{t:r}=Tn(),{filter:o,setFilter:c,filteredCommands:u,selectedIndex:f,setSelectedIndex:m,selectNext:g,selectPrev:y,executeCommand:b,openMenu:v,closeMenu:S}=b_(a),k=_.useRef(null),C=_.useRef(null),[E,O]=_.useState(!1);if(_.useEffect(()=>{s?(v(),O(!1),setTimeout(()=>{var U;return(U=k.current)==null?void 0:U.focus()},0)):S()},[s,v,S]),_.useEffect(()=>{if(!s||!C.current)return;const U=C.current.querySelector(`[data-cmd-index="${f}"]`);U&&U.scrollIntoView({block:"nearest"})},[f,s]),!s)return null;const j=U=>{U.local||(O(!0),ke.info(r("palette.running")));const R=b(U,"");U.local&&(R!=null&&R.message)&&ke.success(R.message),t()},T=U=>{if(U.key==="ArrowDown")U.preventDefault(),g();else if(U.key==="ArrowUp")U.preventDefault(),y();else if(U.key==="Enter"){U.preventDefault();const R=u[f];R&&j(R)}else U.key==="Escape"&&(U.preventDefault(),t())};return h.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:t,role:"dialog","aria-modal":"true","aria-label":r("a11y.commandPalette"),children:h.jsxs("div",{className:"w-full max-w-xl bg-dark-surface border border-dark-border rounded-xl shadow-2xl overflow-hidden",onClick:U=>U.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-dark-border",children:[h.jsx(v0,{size:16,className:"text-dark-muted shrink-0","aria-hidden":"true"}),h.jsx("input",{ref:k,value:o,onChange:U=>{c(U.target.value),m(0)},onKeyDown:T,placeholder:r("palette.placeholder"),"aria-label":r("palette.placeholder"),className:"flex-1 bg-transparent text-sm text-dark-text placeholder-dark-muted outline-none"}),E&&h.jsx("span",{className:"text-[10px] text-accent-blue animate-pulse-soft shrink-0",children:r("palette.running")})]}),h.jsx("div",{ref:C,className:"max-h-[50vh] overflow-y-auto custom-scrollbar py-1",children:u.length===0?h.jsx("div",{className:"px-4 py-8 text-center text-sm text-dark-muted",children:r("palette.empty")}):u.map((U,R)=>h.jsxs("button",{"data-cmd-index":R,onClick:()=>j(U),onMouseEnter:()=>m(R),className:`w-full px-4 py-2.5 flex items-center gap-3 text-left transition-colors ${R===f?"bg-accent-blue/10 border-l-2 border-accent-blue":"border-l-2 border-transparent hover:bg-dark-hover"}`,children:[h.jsx("span",{className:"text-lg shrink-0","aria-hidden":"true",children:U.icon}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("span",{className:"text-sm font-medium text-dark-text",children:["/",U.name]}),U.args&&h.jsx("span",{className:"text-xs text-dark-muted",children:U.args}),!U.local&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-blue/20 text-accent-blue shrink-0",children:r("slashCommands.backend")})]}),h.jsx("div",{className:"text-xs text-dark-muted truncate",children:U.description})]}),R===f&&h.jsx(S0,{size:14,className:"text-dark-muted shrink-0","aria-hidden":"true"})]},U.id))}),h.jsx("div",{className:"px-4 py-2 border-t border-dark-border text-[10px] text-dark-muted bg-dark-bg",children:r("palette.hint")})]})})}function ms({keys:s,label:t}){return h.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-dark-border/50 last:border-0",children:[h.jsx("span",{className:"text-sm text-dark-text",children:t}),h.jsx("span",{className:"flex items-center gap-1",children:s.map(a=>h.jsx("kbd",{className:"px-2 py-0.5 text-xs font-mono bg-dark-bg rounded border border-dark-border text-dark-muted",children:a},a))})]})}function v_({open:s,onClose:t}){const{t:a}=Tn(),r=navigator.platform.toLowerCase().includes("mac")?"⌘":"Ctrl";return h.jsx(Tf,{isOpen:s,onClose:t,title:a("shortcuts.title"),size:"md",children:h.jsxs("div",{className:"space-y-0.5",children:[h.jsx(ms,{keys:[r,"K"],label:a("shortcuts.commandPalette")}),h.jsx(ms,{keys:[r,"L"],label:a("shortcuts.clearLogs")}),h.jsx(ms,{keys:[r,"/"],label:a("shortcuts.help")}),h.jsx(ms,{keys:[r,"Enter"],label:a("shortcuts.submit")}),h.jsx(ms,{keys:["Shift","Enter"],label:a("shortcuts.newline")}),h.jsx(ms,{keys:["/"],label:a("shortcuts.slashCommand")}),h.jsx(ms,{keys:["@"],label:a("shortcuts.fileRef")}),h.jsx(ms,{keys:["Esc"],label:a("shortcuts.closeDialog")}),h.jsx(ms,{keys:["Esc","Esc"],label:a("shortcuts.stopGen")})]})})}function S_({isOpen:s,onClose:t,title:a,collapsedSummary:r,badge:o,children:c,maxHeight:u="45vh",onExpandedChange:f,className:m}){const[g,y]=_.useState(!0);_.useEffect(()=>{s&&y(!0)},[s]),_.useEffect(()=>{f==null||f(g)},[g,f]);const b=_.useCallback(()=>{y(v=>!v)},[]);return s?h.jsxs("div",{className:pt("shrink-0 bg-dark-surface/95 backdrop-blur border-t border-dark-border shadow-[0_-10px_30px_-15px_rgba(0,0,0,0.5)]",m),children:[h.jsxs("div",{role:"button","aria-expanded":g,tabIndex:0,onClick:b,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b())},title:g?"折叠抽屉,查看消息":"展开抽屉,做出选择",className:pt("flex items-center gap-2 px-4 py-2 cursor-pointer select-none transition-colors","hover:bg-dark-hover/60"),children:[h.jsx("span",{className:pt("shrink-0 text-dark-muted transition-transform duration-200",!g&&"rotate-180"),children:h.jsx(Ea,{size:16})}),h.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[h.jsx("span",{className:"text-sm font-semibold text-dark-text truncate",children:a}),o,!g&&r&&h.jsx("span",{className:"min-w-0 flex items-center gap-1.5 text-xs text-dark-muted truncate",children:r})]}),h.jsx("button",{type:"button","aria-label":"关闭",onClick:v=>{v.stopPropagation(),t()},className:"shrink-0 p-1 rounded-md text-dark-muted hover:text-dark-text hover:bg-dark-hover transition-colors",children:h.jsx(bs,{size:15})})]}),g&&h.jsx("div",{className:"animate-slide-up border-t border-dark-border/60 overflow-y-auto custom-scrollbar p-4",style:{maxHeight:u},children:c})]}):null}const k_=_.lazy(()=>Ft(()=>import("./ModelsView-DTfQ2XYb.js"),__vite__mapDeps([0,1,2,3,4,5])).then(s=>({default:s.ModelsView}))),w_=_.lazy(()=>Ft(()=>import("./ToolsView-DmzLnZ1I.js"),__vite__mapDeps([6,1,2,3,4,5])).then(s=>({default:s.ToolsView}))),__=_.lazy(()=>Ft(()=>import("./SkillsView-CPT12zSi.js"),__vite__mapDeps([7,1,2,3,4,5])).then(s=>({default:s.SkillsView}))),C_=_.lazy(()=>Ft(()=>import("./TemplatesTab-M7MnMuN6.js"),__vite__mapDeps([8,1,2,3,4,5])).then(s=>({default:s.TemplatesTab}))),E_=_.lazy(()=>Ft(()=>import("./HookConfigView-BJ-VvTcl.js"),__vite__mapDeps([9,1,2,4,3,5])).then(s=>({default:s.HookConfigView}))),N_=_.lazy(()=>Ft(()=>import("./FileTreeView-6huCqCNC.js"),__vite__mapDeps([10,1,2,3,4,5])).then(s=>({default:s.FileTreeView}))),T_=_.lazy(()=>Ft(()=>import("./TerminalView-j231tG2H.js"),__vite__mapDeps([11,1,2,12,3,4,5,13])).then(s=>({default:s.TerminalView}))),A_=_.lazy(()=>Ft(()=>import("./SessionGrid-BCsOMJRn.js"),__vite__mapDeps([14,1,2,3,4,5])).then(s=>({default:s.SessionGrid}))),j_=_.lazy(()=>Ft(()=>import("./SettingsPanel-DkKIVWYT.js"),__vite__mapDeps([15,1,2,3,4,5])).then(s=>({default:s.SettingsPanel}))),R_=_.lazy(()=>Ft(()=>import("./ChannelConfigView-2-i0ictg.js"),__vite__mapDeps([16,1,2,3,4,5])).then(s=>({default:s.ChannelConfigView}))),O_=_.lazy(()=>Ft(()=>import("./ConnectorsView-CSGJfYer.js"),__vite__mapDeps([17,1,2,3,4,5])).then(s=>({default:s.ConnectorsView}))),M_=_.lazy(()=>Ft(()=>import("./InboxView-DXjF5APJ.js"),__vite__mapDeps([18,1,2,3,4,5])).then(s=>({default:s.InboxView}))),B_=_.lazy(()=>Ft(()=>import("./AutomationView-Z7E_x8jk.js"),__vite__mapDeps([19,1,2,3,4,5])).then(s=>({default:s.AutomationView}))),D_=_.lazy(()=>Ft(()=>import("./AuditView-C8pvciLV.js"),__vite__mapDeps([20,1,2,3,4,5])).then(s=>({default:s.AuditView}))),L_=_.lazy(()=>Ft(()=>import("./PluginsView-CeIWhIfR.js"),__vite__mapDeps([21,1,2,3,4,5])).then(s=>({default:s.PluginsView}))),z_=()=>h.jsx("div",{className:"flex-1 flex items-center justify-center bg-dark-bg",children:h.jsx("div",{className:"w-5 h-5 border-2 border-accent-blue border-t-transparent rounded-full animate-spin"})}),jf=[{id:"chat",labelKey:"nav.chat",icon:ec},{id:"terminal",labelKey:"nav.terminal",icon:k0},{id:"files",labelKey:"nav.files",icon:w0},{id:"models",labelKey:"nav.models",icon:_0},{id:"tools",labelKey:"nav.tools",icon:C0},{id:"skills",labelKey:"nav.skills",icon:E0},{id:"templates",labelKey:"nav.templates",icon:Io},{id:"hooks",labelKey:"nav.hooks",icon:N0},{id:"channels",labelKey:"nav.channels",icon:T0},{id:"connectors",labelKey:"nav.connectors",icon:A0},{id:"inbox",labelKey:"nav.inbox",icon:j0},{id:"audit",labelKey:"nav.audit",icon:wi},{id:"scheduled",labelKey:"nav.scheduled",icon:R0},{id:"logs",labelKey:"nav.logs",icon:wi},{id:"settings",labelKey:"nav.settings",icon:O0},{id:"plugins",labelKey:"nav.plugins",icon:M0}],Ld=Object.fromEntries(jf.map(s=>[s.id,s.labelKey])),U_=jf.map(s=>({id:s.id,title:s.labelKey})),H_=Object.fromEntries(jf.map(s=>[s.id,s.icon]));function $_(){const[s,t]=_.useState("chat"),[a,r]=_.useState(!1),[o,c]=_.useState([]),[,u]=_.useState(0),[f,m]=_.useState(!1),[g,y]=_.useState(!1),[b,v]=_.useState(!1),[S,k]=_.useState(null),[C,E]=_.useState(!1),[O,j]=_.useState(!1),[T,U]=_.useState({}),[R,K]=_.useState(!1),[Z,te]=_.useState(null),[pe,he]=_.useState(!1),it=_.useRef(null),de=_.useRef(null),[W,Y]=_.useState(()=>localStorage.getItem("dsc-sidebar-collapsed")==="1"),ve=_.useCallback(()=>{Y(B=>(localStorage.setItem("dsc-sidebar-collapsed",B?"0":"1"),!B))},[]),H=_.useCallback(()=>{K(B=>!B),he(!1)},[]),Q=_.useCallback(()=>{const B=it.current;B&&(pe?B.resize(de.current??20):(de.current=B.getSize(),B.resize(68)),he(F=>!F))},[pe]);_.useEffect(()=>{const B=window.matchMedia("(min-width: 1400px)"),F=ee=>{ee.matches||K(!1)};return B.addEventListener("change",F),()=>B.removeEventListener("change",F)},[]);const{t:ne,i18n:Be}=Tn(),{toggleTerminal:Pe}=KS(),{theme:qe,setTheme:X,setThemePreset:se,language:le,workspaceDir:ae,setWorkspaceDir:et,effort:lt}=Ei(),jt=ys();_.useEffect(()=>{le&&Be.language!==le&&Be.changeLanguage(le)},[le,Be]);const Ht=_.useMemo(()=>U_.filter(B=>!(B.id==="terminal"&&S===!1)),[S]),gt=_.useMemo(()=>Ht.map(B=>({...B,iconComponent:H_[B.id]})),[Ht]),Oe=_.useCallback(B=>{_.startTransition(()=>{t(B)})},[]),[$t,Ta]=_.useState(null),dn=_.useCallback(B=>{Ta({section:B,nonce:Date.now()})},[]);_.useEffect(()=>{const B=ee=>{const me=ee.message||ne("common.unknownError"),be=ee.filename||"global";be.includes("chrome-extension://")||be.includes("moz-extension://")||c(xe=>[...xe,{id:`error-${Date.now()}-${Wn()}`,level:"error",source:"Browser",message:`${ne("toast.uncaughtError")}${me}`,timestamp:Date.now()}].slice(-500))},F=ee=>{var be;const me=((be=ee.reason)==null?void 0:be.message)||ee.reason||ne("toast.unknownReason");c(xe=>[...xe,{id:`rejection-${Date.now()}-${Wn()}`,level:"error",source:"Promise",message:`${ne("toast.uncaughtRejection")}${me}`,timestamp:Date.now()}].slice(-500))};return window.addEventListener("error",B),window.addEventListener("unhandledrejection",F),()=>{window.removeEventListener("error",B),window.removeEventListener("unhandledrejection",F)}},[ne]);const{sessionTabs:Mi,activeSessionId:Ee,setActiveSession:dl,addSessionTab:vs,closeSessionTab:Aa,renameSessionTab:ja,getVisibleSessionTabs:Bi,autoNameSession:fl,touchSession:Di}=we(),Rt=Ee?T[Ee]??!0:!0,Li=Qe(B=>Ee?Object.keys(B.tasksBySession[Ee]||{}).length:0),zi=_.useCallback(()=>{U(B=>Ee?{...B,[Ee]:!(B[Ee]??!0)}:B)},[Ee]),[Vt,Ra]=_.useState(()=>typeof window<"u"&&window.innerWidth<768);_.useEffect(()=>{const B=window.matchMedia("(max-width: 767px)"),F=ee=>Ra(ee.matches);return B.addEventListener("change",F),()=>B.removeEventListener("change",F)},[]);const en=Qe(B=>Ee?B.getForSession(Ee):void 0),Ui=_.useRef(null),pl=_.useRef(null);_.useEffect(()=>{if(Vt)return;const B=en&&["RUNNING","RESUMING","PAUSED"].includes(String(en.status)),F=Li>0;B&&en&&Ui.current!==en.runId?(Ui.current=en.runId,K(!0)):F&&pl.current!==Ee&&(pl.current=Ee??null,K(!0))},[en==null?void 0:en.runId,en==null?void 0:en.status,Li,Ee,Vt]);const{clearMessages:hl}=je(),Ss=je(B=>Ee?B.messagesBySession[Ee]||[]:[]),{customTheme:It,customThemeEnabled:Un,themePresetId:Pt}=Ei();a_({theme:qe,themePresetId:Pt,customTheme:It,customThemeEnabled:Un}),n_({activeTab:s,setLogs:c,setUnreadLogs:u}),_.useEffect(()=>{I.get("/api/terminal/status").then(B=>k(B.success&&B.data?B.data.ttydAvailable!==!1:!1)).catch(()=>k(!1))},[]),_.useEffect(()=>{const B=F=>{const ee=F.detail,me=typeof ee=="string"?ee:ee==null?void 0:ee.tab,be=typeof ee=="string"||ee==null?void 0:ee.section;me&&me!==s&&Oe(me),me==="settings"&&be&&dn(be)};return window.addEventListener("switch-tab",B),()=>window.removeEventListener("switch-tab",B)},[s,Oe,dn]),_.useEffect(()=>{const B=F=>{var me;const ee=(me=F.detail)==null?void 0:me.path;ee&&(te(ee),K(!0))};return window.addEventListener("preview-file",B),()=>window.removeEventListener("preview-file",B)},[]);const Oa=_.useCallback(()=>{const B=window.location.hash.replace(/^#\/?/,"");if(!B)return;const[F,ee]=B.split("/");F&&F in Ld&&Oe(F),F==="settings"&&ee==="stt"&&dn("stt")},[Oe,dn]);_.useEffect(()=>(Oa(),window.addEventListener("hashchange",Oa),()=>window.removeEventListener("hashchange",Oa)),[Oa]),_.useEffect(()=>{const B=ge.onOpen(()=>{r(!0),ke.success(ne("toast.backendConnected"))}),F=ge.onClose(()=>{a&&ke.warning(ne("toast.backendDisconnected")),r(!1)});return()=>{B(),F()}},[a,ne]);const ac=_.useCallback(async()=>{try{const B=await ze.sessions.list();if(!B.success||!Array.isArray(B.data))return!1;const F=r_(B.data);if(F.length===0)return!1;const ee=F[0],me=be=>({id:be.id,title:be.title,createdAt:be.createdAt,lastActiveAt:be.lastActiveAt,preview:be.preview,status:"done"});return we.setState(be=>{const xe=be.sessionTabs.some(Ue=>Ue.id===ee.id)?be.sessionTabs:[me(ee),...be.sessionTabs].slice(0,Yd),tt=new Set(xe.map(Ue=>Ue.id)),St=[...F.map(me).filter(Ue=>!tt.has(Ue.id)),...be.historySessions.filter(Ue=>!F.some(ws=>ws.id===Ue.id))].slice(0,Uo),Te=[...F.map(Ue=>({id:Ue.id,title:Ue.title,createdAt:new Date(Ue.createdAt).toISOString(),updatedAt:new Date(Ue.lastActiveAt??Ue.createdAt).toISOString(),messageCount:Ue.messageCount??0})),...be.sessions.filter(Ue=>!F.some(ws=>ws.id===Ue.id))];return{sessionTabs:xe,historySessions:St,sessions:Te,activeSessionId:ee.id}}),!0}catch{return!1}},[]);_.useEffect(()=>{if(we.getState().sessionTabs.length>0)return;let B=!1;return ac().then(F=>{B||F||vs(ne("chat.defaultSessionTitle",{n:1}))}),()=>{B=!0}},[]),_.useEffect(()=>{const B=()=>y(!0);return window.addEventListener("hook-approval-required",B),()=>window.removeEventListener("hook-approval-required",B)},[]);const ml=_.useRef(Ee);_.useEffect(()=>{ml.current=Ee},[Ee]);const Zn=_.useCallback(B=>{var me,be,xe;if(!B)return!1;const F=window,ee=(me=F.__pendingQuestions)==null?void 0:me[B];return ee?(be=F.__answeredQuestionIds)!=null&&be.has(ee.questionId)?(delete F.__pendingQuestions[B],((xe=F.__pendingQuestion)==null?void 0:xe.questionId)===ee.questionId&&(F.__pendingQuestion=null),!1):(F.__pendingQuestion=ee,v(!0),!0):!1},[]);_.useEffect(()=>{const B=F=>{const ee=F.detail||ml.current;Zn(ee)};return window.addEventListener("ask-question-required",B),()=>window.removeEventListener("ask-question-required",B)},[Zn]),_.useEffect(()=>{Ee&&Zn(Ee)},[Ee,Zn]);const Ma=_.useCallback(()=>{var ee;const B=window,F=B.__pendingQuestion;if(F!=null&&F.questionId){B.__answeredQuestionIds=B.__answeredQuestionIds||new Set,B.__answeredQuestionIds.add(F.questionId);const me=B.__pendingQuestions||{};for(const be of Object.keys(me))((ee=me[be])==null?void 0:ee.questionId)===F.questionId&&delete me[be];B.__pendingQuestion=null}v(!1)},[]);_.useEffect(()=>{jt.autoMode&&jt.pendingApprovals.length>0&&y(!1),jt.pendingApprovals.length>0&&!jt.autoMode&&y(!0)},[jt.autoMode,jt.pendingApprovals.length]);const ta=_.useRef(0);_.useEffect(()=>{const B=F=>{var Te,Ue;if(F.key!=="Escape"||F.defaultPrevented)return;const ee=(Te=F.target)==null?void 0:Te.tagName;if(ee==="INPUT"||ee==="TEXTAREA"||(Ue=F.target)!=null&&Ue.isContentEditable)return;const me=je.getState(),xe=we.getState().activeSessionId;if(!xe||!me.isGenerating(xe))return;F.preventDefault();const tt=Date.now(),St=ta.current;ta.current=tt,St>0&&tt-St<500?(ge.send({type:"stop",sessionId:xe}),ke.info(ne("toast.terminated"))):(ge.send({type:"pause",sessionId:xe}),ke.info(ne("toast.paused")))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[ne]);const[jn,na]=_.useState(!1),fn=_.useCallback(()=>{_.startTransition(()=>{const B=vs(void 0,ae);ge.setSessionId(B),Qr.getState().setMode("act"),Oe("chat")})},[vs,ae,Oe]),ic=_.useCallback(B=>{_.startTransition(()=>{const F=we.getState();let ee=F.activeSessionId;ee||(ee=F.addSessionTab(void 0,ae),ge.setSessionId(ee)),je.getState().setSessionInput(ee,`$${B.id} `),Oe("chat")})},[ae,Oe]),Ba=_.useCallback(()=>Oe("templates"),[Oe]),sa=_.useCallback(async(B,F)=>{var St;const ee=await ze.templates.render(B.id,F);if(!ee.success||!ee.data){ke.error(ee.error||"模板渲染失败");return}const me=ee.data,be=vs(B.name,ae);ge.setSessionId(be),Qr.getState().setMode("act"),Oe("chat");const xe=`wf-${Date.now()}-${Wn()}`;Qe.getState().upsert(be,{runId:xe,status:"RUNNING",completedPhases:0,totalPhases:((St=me.nodes)==null?void 0:St.length)??0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,lastEventType:"workflow_start"});const tt=await ze.workflows.start({sessionId:be,runId:xe,workflow:me,message:`[模板] ${B.name}`});if(!tt.success||!tt.data){ke.error(tt.error||"工作流启动失败"),Qe.getState().fail(be,xe,tt.error||"启动失败");return}if(tt.data.status==="FAILED"){const Te=tt.data.error||"模板定义无效";ke.error(`工作流启动失败: ${Te}`),Qe.getState().fail(be,xe,Te)}},[vs,ae,Oe]),aa=_.useCallback(async()=>{if(jn||!Ee)return;const B=Qe.getState().getForSession(Ee),F=B==null?void 0:B.runId;if(!F){ke.info("当前会话没有可保存的工作流运行");return}na(!0),ke.info("正在泛化为模板…");try{const ee=await ze.templates.createFromRun(F,{generalize:!0});ee.success&&ee.data?ee.data.degraded?ke.warning(`已保存为模板「${ee.data.name}」(v${ee.data.version}),但 LLM 泛化失败,已原样保存${ee.data.degradeReason?`:${ee.data.degradeReason}`:""}`):ke.success(`已保存为模板「${ee.data.name}」(v${ee.data.version})`):ke.error(ee.error||"保存模板失败")}finally{na(!1)}},[Ee,jn]),gl=_.useRef(0),Hi=_.useCallback(async B=>{if(!B)return;const F=++gl.current;try{const ee=await ze.sessions.resume(B);if(F!==gl.current||!ee.success||!ee.data)return;const me=ee.data;me.session&&we.getState().updateSession(B,me.session);const be=me.messages||[];if(be.length>0){const xe=be.flatMap(Te=>Te.type!=="user"&&Te.type!=="assistant"&&Te.type!=="system"?[]:[{id:Te.id||`msg-${Te.timestamp||Date.now()}`,type:Te.type,content:Te.content||"",timestamp:Te.timestamp||Date.now(),thinking:Te.thinking||void 0}]);je.getState().replaceMessages(B,xe);const tt=be.find(Te=>Te.type==="user"),St=typeof(tt==null?void 0:tt.content)=="string"?tt.content.replace(/\s+/g," ").trim():"";we.getState().touchSession(B,St||void 0)}}catch{}},[]),$i=_.useCallback(B=>{dl(B),ge.setSessionId(B)},[dl]),Ii=_.useCallback(B=>{Aa(B)},[Aa]),Da=_.useCallback((B,F)=>{ja(B,F)},[ja]),ia=_.useCallback(()=>{Ee&&hl(Ee)},[Ee,hl]);_.useEffect(()=>{if(!Ee)return;const B=je.getState().messagesBySession[Ee];B&&B.length>0&&Fe.getState().recalculateFromMessages(B)},[Ee]),_.useEffect(()=>{if(!Ee)return;je.getState().getMessages(Ee).length===0&&Hi(Ee)},[Ee,Hi]);const La=_.useCallback(async(B,F,ee,me)=>{if(!F.trim())return;je.getState().isGenerating(B)&&(console.warn(`[sendMessage] Session ${B} stuck in generating state — force-ending`),je.getState().endGeneration(B,"Force-ended: new message"));const xe=Qr.getState();je.getState().resumeGeneration(B),ge.setSessionId(B),je.getState().getMessages(B).some(Rn=>Rn.type==="user")?Di(B):(fl(B,F.trim()),Di(B,F.trim()));let Te=F.trim();if(ee&&ee.length>0){const Rn=[],lc=[...ee].sort((pn,hn)=>hn.length-pn.length);for(const pn of lc){Te=Te.split(`@${pn}`).join("").trim();try{const hn=await ze.files.read(pn),mn=hn.success&&hn.data?hn.data:null;if(mn){const Wt=pn.split(".").pop()||"";Rn.push(`<context ref="${pn}">
|
|
60
|
-
\`\`\`${Wt}
|
|
61
|
-
${mn}
|
|
62
|
-
\`\`\`
|
|
63
|
-
</context>`)}}catch(hn){console.warn(`Failed to read @-referenced file: ${pn}`,hn)}}Rn.length>0&&(Te=Rn.join(`
|
|
64
|
-
|
|
65
|
-
`)+`
|
|
66
|
-
|
|
67
|
-
`+Te.trim(),Te=Te.trim())}me!=null&&me.skipAddUserMessage||je.getState().addMessage(B,{id:`msg-${Date.now()}`,type:"user",content:Te,timestamp:Date.now()});const Ue=xe.mode,ws=Cn(Ue==="normal"?"act":Ue),Gi=lt==="off"?!1:void 0;if(ws==="plan")ge.send({type:"plan",sessionId:B,message:Te,effort:lt,thinking:Gi});else if(ws==="goal"){const Rn=`wf-${Date.now()}-${Wn()}`;je.getState().startGeneration(B),Qe.getState().upsert(B,{runId:Rn,status:"RUNNING",completedPhases:0,totalPhases:0,completedEffects:0,totalEffects:0,tokensUsed:0,tokensRemaining:0,lastEventType:"workflow_start"}),ge.send({type:"workflow_start",sessionId:B,runId:Rn,message:Te,projectId:ae,memoryEnabled:!0,checkpointPolicy:"phase-and-token"})}else ge.send({type:"chat",sessionId:B,message:Te,effort:lt,thinking:Gi})},[fl,Di,ae,lt]),yl=_.useCallback((B,F)=>{var St,Te;const ee=je.getState(),me=ee.getMessages(B),be=me.findIndex(Ue=>Ue.id===F);if(be===-1)return;let xe=-1;for(let Ue=be-1;Ue>=0;Ue--)if(((St=me[Ue])==null?void 0:St.type)==="user"){xe=Ue;break}if(xe===-1)return;const tt=me[xe];(Te=tt==null?void 0:tt.content)!=null&&Te.trim()&&(ee.replaceMessages(B,me.slice(0,xe+1)),La(B,tt.content,void 0,{skipAddUserMessage:!0}))},[La]),Hn=_.useCallback((B,F)=>{je.getState().applyTombstone(B,[F]),ke.success(ne("chat.messageDeleted"))},[ne]),Nt=_.useCallback(B=>{const F=Qe.getState().getForSession(B);F&&!["COMPLETED","CANCELLED","ERROR","FAILED"].includes(F.status)?ge.send({type:"workflow_cancel",sessionId:B,runId:F.runId}):ge.send({type:"stop",sessionId:B}),je.getState().endGeneration(B)},[]),zt=_.useCallback(B=>{const F=Qe.getState().getForSession(B);F&&["RUNNING","RESUMING"].includes(F.status)?ge.send({type:"workflow_pause",sessionId:B,runId:F.runId}):ge.send({type:"pause",sessionId:B}),je.getState().pauseGeneration(B)},[]),ks=_.useCallback(B=>{const F=Qe.getState().getForSession(B);F&&F.status==="PAUSED"?ge.send({type:"workflow_resume",sessionId:B,runId:F.runId}):ge.send({type:"resume",sessionId:B}),je.getState().resumeGeneration(B)},[]),Pi=_.useCallback(B=>{const F=B.trim();if(!F||F===ae)return;et(F),ge.send({type:"workspace",message:F}),we.getState().sessionTabs.forEach(me=>{je.getState().clearMessages(me.id)}),we.setState({sessionTabs:[],sessions:[],sessionWorkspaceDirs:{},activeSessionId:null}),setTimeout(()=>{we.getState().addSessionTab(ne("chat.defaultSessionTitle",{n:1}),F)},0)},[ae,et,ne]),bl=()=>{c([]),u(0)},rc=_.useMemo(()=>({setActiveTab:Oe,createNewSession:fn,clearMessages:ia,setTheme:X,setThemePreset:se,toggleTerminal:Pe,setLogs:c,setUnreadLogs:u}),[Oe,fn,ia,X,se,Pe]);_.useEffect(()=>{const B=F=>{var xe,tt;const ee=F.ctrlKey||F.metaKey,me=(xe=F.target)==null?void 0:xe.tagName,be=me==="INPUT"||me==="TEXTAREA"||((tt=F.target)==null?void 0:tt.isContentEditable);if(F.key==="Escape"){if(C){F.preventDefault(),E(!1);return}if(O){F.preventDefault(),j(!1);return}if(f){F.preventDefault(),m(!1);return}return}if(ee)if(F.key==="k"||F.key==="K")F.preventDefault(),j(!1),E(St=>!St);else if(F.key==="l"||F.key==="L"){if(be)return;F.preventDefault(),bl(),ke.success(ne("slashCommands.logs_clear_result"))}else F.key==="/"&&(F.preventDefault(),E(!1),j(St=>!St))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[C,O,f,ne]);const za=(B,F)=>Ld[B]?ne(Ld[B]):F,ra=B=>{switch(B){case"chat":{const F=Bi(),ee=Mi.find(me=>me.id===Ee);return h.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[h.jsxs("div",{className:"h-11 flex items-center gap-1 px-3 border-b border-dark-border bg-dark-bg shrink-0 select-none",children:[h.jsx("span",{className:"truncate text-[13px] font-medium text-dark-text",children:(ee==null?void 0:ee.title)||ne("nav.chat")}),h.jsx("div",{className:"flex-1"}),h.jsx(u_,{}),h.jsx(d_,{onOpenTemplates:Ba,onSaveAsTemplate:()=>void aa(),saveAsBusy:jn}),Li>0&&h.jsx("button",{onClick:Vt?zi:H,className:`p-1.5 rounded-lg transition-colors ${Vt?Rt?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text":R?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:Vt?"Task Board":"任务看板(右侧)","aria-label":Vt?"Task Board":"任务看板(右侧)","aria-expanded":Vt?Rt:R,children:h.jsx(Wy,{size:16,"aria-hidden":"true"})}),h.jsx("button",{onClick:H,className:`p-1.5 rounded-lg transition-colors ${R?"bg-accent-blue/10 text-accent-blue":"text-dark-muted hover:bg-dark-hover hover:text-dark-text"}`,title:"右侧面板","aria-label":"切换右侧面板","aria-expanded":R,children:h.jsx(D0,{size:16,"aria-hidden":"true"})})]}),h.jsx(A_,{tabs:F,activeSessionId:Ee,onSend:La,onStop:Nt,onPause:zt,onResume:ks,activeTab:s,setActiveTab:Oe,createNewSession:fn,clearMessages:ia,setTheme:X,setThemePreset:se,toggleTerminal:Pe,setLogs:c,setUnreadLogs:u,showTaskBoard:Rt&&Vt,onToggleTaskBoard:zi,onRegenerate:yl,onDeleteMessage:Hn,hookDrawerOpen:g,onCloseHookDrawer:()=>y(!1),questionDrawerOpen:b,onCloseQuestionDrawer:Ma,workspaceDir:ae,onWorkspaceSelect:Pi})]})}case"terminal":return h.jsx(T_,{});case"files":return h.jsx(N_,{});case"models":return h.jsx(k_,{});case"tools":return h.jsx(w_,{});case"skills":return h.jsx(__,{onUseSkill:ic});case"templates":return h.jsx(C_,{onLaunch:sa});case"hooks":return h.jsx(E_,{});case"channels":return h.jsx(R_,{});case"connectors":return h.jsx(O_,{});case"inbox":return h.jsx(M_,{});case"audit":return h.jsx(D_,{});case"scheduled":return h.jsx(B_,{});case"logs":return h.jsx(Uw,{logs:o,onClear:bl});case"settings":return h.jsx(j_,{onNavigate:Oe,focusSection:$t});case"plugins":return h.jsx(L_,{});default:return null}};return h.jsxs(Ry,{children:[h.jsxs("div",{className:"h-screen w-full flex bg-dark-bg text-dark-text overflow-hidden",children:[h.jsx("aside",{className:`hidden md:block shrink-0 border-r border-dark-border bg-dark-surface transition-[width] duration-200 ease-in-out overflow-hidden ${W?"w-14":"w-60"}`,children:h.jsx(Ey,{collapsed:W,onToggleCollapse:ve,tabs:gt,activeTab:s,onTabChange:Oe,isConnected:a,onNewSession:fn,onStartTemplate:sa,onManageTemplates:Ba,onSwitchSession:$i,onCloseSession:Ii,onRenameSession:Da,getTabTitle:za})}),f&&h.jsxs("div",{className:"md:hidden fixed inset-0 z-50",children:[h.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:()=>m(!1)}),h.jsx("aside",{className:"absolute left-0 top-0 h-full w-64 bg-dark-surface border-r border-dark-border shadow-2xl animate-slide-in",children:h.jsx(Ey,{collapsed:!1,onToggleCollapse:()=>m(!1),tabs:gt,activeTab:s,onTabChange:B=>{Oe(B),m(!1)},isConnected:a,onNewSession:()=>{fn(),m(!1)},onStartTemplate:sa,onManageTemplates:()=>{Ba(),m(!1)},onSwitchSession:B=>{$i(B),m(!1)},onCloseSession:Ii,onRenameSession:Da,getTabTitle:za})})]}),h.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[h.jsxs("header",{className:"md:hidden h-12 bg-dark-surface border-b border-dark-border flex items-center gap-1 px-2 shrink-0",children:[h.jsx("button",{className:"p-2 rounded-lg text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors",onClick:()=>m(!0),"aria-label":ne("a11y.openMenu"),children:h.jsx(B0,{size:18,"aria-hidden":"true"})}),h.jsx("span",{className:"text-sm font-semibold truncate",children:za(s,"")}),h.jsx("div",{className:"flex-1"}),s==="chat"&&h.jsx("button",{onClick:fn,className:"p-2 rounded-lg text-dark-muted hover:bg-dark-hover hover:text-dark-text transition-colors","aria-label":ne("chat.newSession"),children:h.jsx($o,{size:18,"aria-hidden":"true"})})]}),h.jsx("div",{className:"flex-1 flex overflow-hidden min-h-0",children:h.jsxs(Jy,{direction:"horizontal",children:[h.jsx(Gd,{id:"chat-main",minSize:30,className:"min-w-0",children:h.jsx("div",{className:"flex h-full flex-col min-w-0 min-h-0",children:h.jsx(_.Suspense,{fallback:h.jsx(z_,{}),children:h.jsx(Ry,{children:ra(s)})})})}),s==="chat"&&R&&!Vt&&h.jsx(eb,{className:"w-1 bg-dark-border hover:bg-accent-blue transition-colors cursor-col-resize"}),s==="chat"&&R&&!Vt&&h.jsx(Gd,{id:"rightrail",ref:it,defaultSize:20,minSize:14,maxSize:70,className:"min-w-0",children:h.jsx(Tw,{sessionId:Ee??"",messages:Ss,previewFile:Z,onPreview:te,onClosePreview:()=>te(null),isMaximized:pe,onToggleMaximize:Q})})]})}),s==="chat"&&R&&Vt&&h.jsx(S_,{isOpen:!0,onClose:()=>K(!1),title:"输出物 · 任务",maxHeight:"60vh",children:h.jsx("div",{className:"h-[52vh]",children:h.jsx(Cb,{sessionId:Ee??"",messages:Ss,previewFile:Z,onPreview:te,onClosePreview:()=>te(null)})})}),h.jsx(c_,{activeTab:s})]})]}),h.jsx(x_,{open:C,onClose:()=>E(!1),options:rc}),h.jsx(v_,{open:O,onClose:()=>j(!1)}),h.jsx(h_,{}),h.jsx(g_,{})]})}const I_={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:"默认"},P_={chat:"对话",terminal:"终端",files:"文件",models:"模型",tools:"工具",skills:"技能",templates:"模板",hooks:"Hooks",agentFlow:"Agent Flow",settings:"设置",logs:"日志",channels:"频道",sessions:"会话",groupWorkspace:"工作台",groupConfig:"配置",groupSystem:"系统",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",moreOptions:"更多",scheduled:"定时任务",inbox:"Inbox",audit:"审计",plugins:"插件",mySessions:"我的会话",sessionRunning:"运行中",sessionWaiting:"待确认",sessionFailed:"失败",sessionDone:"已完成",connectors:"连接器"},G_={newSession:"新建会话",noSessions:"暂无会话",renameSession:"重命名会话",exportMd:"导出为 Markdown",you:"你",thinkingEllipsis:"思考中…",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 默认",assistantLabel:"DeepSeekCode",thoughtProcess:"思维过程",runningSteps:"执行中",stepCount:"步",stepCountPlural:"步",copyMessage:"复制",regenerate:"重新生成",deleteMessage:"删除消息",historyCount:"{{n}} 条",startChatHint:"请先开始对话",panelTitle:"面板",messageDeleted:"消息已删除",thinking:"思考中"},F_={title:"键盘快捷键",commandPalette:"打开命令面板",clearLogs:"清空日志",help:"显示快捷键帮助",submit:"提交输入",newline:"换行",closeDialog:"关闭弹窗 / 暂停生成",slashCommand:"快捷命令",fileRef:"引用文件",stopGen:"终止生成(连按两次 Esc)"},q_={placeholder:"搜索命令或跳转面板...",navGroup:"导航",commandGroup:"命令",empty:"没有匹配的命令",hint:"↑↓ 选择 · Enter 执行 · Esc 关闭",running:"执行中..."},V_={openMenu:"打开菜单",closeMenu:"关闭菜单",close:"关闭",expand:"展开",collapse:"折叠",delete:"删除",remove:"移除",send:"发送消息",newSession:"新建会话",messageInput:"消息输入框",connectionStatus:"连接状态",loading:"加载中",toggleAgentFlow:"切换 Agent 信息流",commandPalette:"命令面板",shortcutsHelp:"快捷键帮助"},W_={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:"正在分析需求..."},K_={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 编码助手界面",language:"语言",languageZh:"中文",languageEn:"English"},Y_={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 (自定义)"},Z_={title:"工具列表",searchTools:"搜索工具...",disabled:"禁用",enabled:"启用",params:"参数",loadFailed:"加载工具失败",noTools:"暂无工具"},Q_={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:"已安装",uninstall:"卸载",uninstallConfirm:"确定卸载已安装技能「{{name}}」?",uninstalling:"卸载中...",uninstallFail:"卸载失败",pagePrev:"上一页",pageNext:"下一页",pageOf:"第 {{page}} / {{total}} 页",emptyInstalled:"还没有已安装的市场技能",emptyInstalledHint:"前往「技能市场」浏览并下载安装",browseMarket:"去市场逛逛",use:"使用",useHint:"使用此技能:将 $技能名 插入输入框,补充任务描述后发送",pickTitle:"选择技能",pickPlaceholder:"搜索技能...",pickEmpty:"没有可用的技能",pickUse:"点击使用"},X_={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:"收起"},J_={pending:"等待",thinking:"思考",action:"执行",result:"结果",running:"运行中",error:"错误",completed:"完成",params:"参数"},eC={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 查看可用命令"},tC={pageError:"页面出现错误",unknownError:"发生了未知错误,请尝试刷新页面",refreshPage:"刷新页面",genEnded:"生成已结束(工具执行超时或连接中断)"},nC={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:"关闭检查模式"},sC={title:"频道管理",subtitle:"接入外部 IM 平台,通过微信、飞书、钉钉等与 AI 交互",newChannel:"新建频道",editChannel:"编辑频道",table:{name:"频道名称",type:"类型",appId:"App ID",status:"连接状态",enabled:"启用",actions:"操作"},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 连接,自动接收消息"},actions:{scanQr:"扫码",edit:"编辑",delete:"删除",deleteConfirm:"确定要删除此频道?",test:"测试连接",save:"保存频道",cancel:"取消"},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"}},aC={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:"添加附件(Excel/Word/CSV)",dropHint:"松开以添加附件",unsupportedType:"不支持的文件类型: {{name}}",fileTooLarge:"文件过大: {{name}}(≤50MB)",duplicateFile:"重复文件: {{name}}",maxAttachments:"单次最多 {{n}} 个文件",uploadFailed:"上传失败",stillUploading:"附件正在上传中,请稍候…",importFailed:"Import files failed"},iC={reconnecting:"重连中 {{attempt}}/{{max}}",hint:"正在重新连接后端…"},rC={title:"Full access(自动批准)已开启",desc:"Agent 可不经确认直接编辑文件和执行命令,存在数据丢失风险。",dismiss:"本次关闭",neverShow:"不再显示"},lC={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:"请输入提交信息"},oC={retry:"重试",details:"详情",modelSettings:"模型设置"},cC={comingSoon:"即将上线"},uC={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:"添加"},dC={justNow:"刚刚",minutesAgo:"{{count}}分钟前",hoursAgo:"{{count}}小时前",daysAgo:"{{count}}天前"},fC={title:"语音输入(英语 whisper / 中文 FunASR)",stopTitle:"停止录音并转写",langToggle:"切换识别语言:英语(whisper)/ 中文(FunASR)",noSpeech:"未识别到语音内容,请重试",backendMissing:"语音服务未就绪,已打开设置页引导安装",setup:{title:"语音服务",envCard:"运行环境检测",envChecking:"检测中…",recheck:"重新检测",pythonOk:"Python {{version}} 已就绪",pythonMissing:"未检测到 Python,请先安装 Python 3.10+",pythonGuide:"下载安装 Python",pipOk:"pip 可用",pipMissing:"pip 缺失,请先安装 pip 后再安装语音引擎",pipGuide:"执行以下命令修复 pip(再失败可参考 get-pip.py 官方方案):",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:"该引擎尚未安装,选中后录音时会引导安装"}},My={common:I_,nav:P_,chat:G_,shortcuts:F_,palette:q_,a11y:V_,plan:W_,settings:K_,models:Y_,tools:Z_,skills:Q_,hook:X_,step:J_,slashCommands:eC,error:tC,toast:nC,channels:sC,fileJob:aC,reconnect:iC,autoAccess:rC,git:lC,errorCard:oC,placeholder:cC,connectors:uC,time:dC,stt:fC},pC={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"},hC={chat:"Chat",terminal:"Terminal",files:"Files",models:"Models",tools:"Tools",skills:"Skills",templates:"Templates",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",inbox:"Inbox",audit:"Audit",plugins:"Plugins",mySessions:"My sessions",sessionRunning:"Running",sessionWaiting:"Awaiting confirmation",sessionFailed:"Failed",sessionDone:"Completed",connectors:"Connectors"},mC={newSession:"New Session",noSessions:"No sessions yet",renameSession:"Rename session",exportMd:"Export as Markdown",you:"You",thinkingEllipsis:"Thinking…",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",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"},gC={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)"},yC={placeholder:"Search commands or jump to panel...",navGroup:"Navigation",commandGroup:"Commands",empty:"No matching commands",hint:"↑↓ Select · Enter Run · Esc Close",running:"Running..."},bC={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"},xC={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..."},vC={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",language:"Language",languageZh:"中文",languageEn:"English"},SC={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"},kC={title:"Tool List",searchTools:"Search tools...",disabled:"Disable",enabled:"Enable",params:"Parameters",loadFailed:"Failed to load tools",noTools:"No tools available"},wC={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",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"},_C={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"},CC={pending:"Waiting",thinking:"Thinking",action:"Action",result:"Result",running:"Running",error:"Error",completed:"Completed",params:"Parameters"},EC={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"},NC={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)"},TC={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"},AC={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"},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"},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"},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"}},jC={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:"添加附件(Excel/Word/CSV)",dropHint:"松开以添加附件",unsupportedType:"不支持的文件类型: {{name}}",fileTooLarge:"文件过大: {{name}}(≤50MB)",duplicateFile:"重复文件: {{name}}",maxAttachments:"单次最多 {{n}} 个文件",uploadFailed:"上传失败",stillUploading:"附件正在上传中,请稍候…",importFailed:"Import files failed"},RC={reconnecting:"Reconnecting {{attempt}}/{{max}}",hint:"正在重新连接后端…"},OC={title:"Full access(自动批准)已开启",desc:"Agent 可不经确认直接编辑文件和执行命令,存在数据丢失风险。",dismiss:"本次关闭",neverShow:"不再显示"},MC={panelTitle:"环境与变更",noRepo:"非 Git 仓库",notGitDesc:"当前工作目录不是 Git 仓库,无法展示变更统计。",refresh:"刷新",changes:"Changes",clean:"工作区干净",branch:"分支",upstream:"提交领先上游",commit:"Commit",push:"Push",commitConfirm:"提交",commitPlaceholder:"提交信息(Agent 生成草稿,可编辑)…",commitSuccess:"提交成功",commitFailed:"提交失败",pushSuccess:"推送成功",pushFailed:"推送失败",checkoutSuccess:"已切换到 {{branch}}",checkoutFailed:"切换失败",prReady:"PR 检查状态正常",prUnavailable:"Pull request status unavailable(未关联远端)",prLoading:"加载 PR 状态…",environment:"环境信息",ok:"操作成功",loading:"加载中…",emptyCommitMsg:"请输入提交信息"},BC={retry:"重试",details:"详情",modelSettings:"模型设置"},DC={comingSoon:"即将上线"},LC={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"},zC={justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},UC={title:"Voice input (English: whisper / Chinese: FunASR)",stopTitle:"Stop recording and transcribe",langToggle:"Switch recognition language: English (whisper) / Chinese (FunASR)",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",pipGuide:"Run the command below to repair pip (see get-pip.py docs if it fails):",whisperTitle:"Whisper · English",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."}},By={common:pC,nav:hC,chat:mC,shortcuts:gC,palette:yC,a11y:bC,plan:xC,settings:vC,models:SC,tools:kC,skills:wC,hook:_C,step:CC,slashCommands:EC,error:NC,toast:TC,channels:AC,fileJob:jC,reconnect:RC,autoAccess:OC,git:MC,errorCard:BC,placeholder:DC,connectors:LC,time:zC,stt:UC},HC=Ei.getState().language||"zh-CN";qt.use(_S).init({resources:{"zh-CN":{translation:My,hook:My.hook},en:{translation:By,hook:By.hook}},lng:HC,fallbackLng:"zh-CN",interpolation:{escapeValue:!1}});let Do=new Set;function $C(s){function t(){a(window)}function a(y){y&&typeof y.addEventListener=="function"&&(y.addEventListener("click",c,!0),y.addEventListener("mousedown",u,!0),y.addEventListener("mouseover",u,!0),y.addEventListener("mouseup",u,!0),y.addEventListener("pointerdown",f,!0),y.addEventListener("pointerover",m,!0),y.addEventListener("pointerup",g,!0))}function r(){o(window),Do.forEach(y=>{try{o(y.contentWindow)}catch{}}),Do=new Set}function o(y){y&&typeof y.removeEventListener=="function"&&(y.removeEventListener("click",c,!0),y.removeEventListener("mousedown",u,!0),y.removeEventListener("mouseover",u,!0),y.removeEventListener("mouseup",u,!0),y.removeEventListener("pointerdown",f,!0),y.removeEventListener("pointerover",m,!0),y.removeEventListener("pointerup",g,!0))}function c(y){var b;y.preventDefault(),y.stopPropagation(),r(),(b=s.onClick)===null||b===void 0||b.call(s,y.target)}function u(y){y.preventDefault(),y.stopPropagation()}function f(y){y.preventDefault(),y.stopPropagation()}function m(y){var b;y.preventDefault(),y.stopPropagation();const v=y.target;if(v.tagName==="IFRAME"){const S=v;try{if(!Do.has(S)){const k=S.contentWindow;a(k),Do.add(S)}}catch{}}(b=s.onPointerOver)===null||b===void 0||b.call(s,y.target)}function g(y){y.preventDefault(),y.stopPropagation()}return t(),r}const IC=s=>typeof(s==null?void 0:s.type)=="string",Eb=s=>{var t;return typeof((t=s==null?void 0:s.type)===null||t===void 0?void 0:t.$$typeof)=="symbol"},PC=s=>{var t;return((t=s==null?void 0:s.type)===null||t===void 0?void 0:t.$$typeof)===Symbol.for("react.forward_ref")},GC=s=>{const t=Object.keys(s).find(a=>a.startsWith("__reactInternalInstance$")||a.startsWith("__reactFiber$"));if(t)return s[t]},Rf=s=>{if(!s)return;const t=GC(s);return t||Rf(s.parentElement)},FC=s=>{let t=s.return;for(;t;){if(!Eb(t))return t;t=t.return}return null},Nb=s=>{const t=s==null?void 0:s.type;if(!t)return;const{displayName:a,name:r}=t;if(typeof a=="string")return a;if(typeof r=="string")return r},qC=s=>{var t,a;if(!s)return;const r=(t=s._debugSource)!==null&&t!==void 0?t:(a=s._debugOwner)===null||a===void 0?void 0:a._debugSource;if(!r)return;const{fileName:o,lineNumber:c,columnNumber:u}=r;if(o&&c)return{lineNumber:String(c),columnNumber:String(u??1),absolutePath:o.match(/^<.*>$/)?o.replace(/^<|>$/g,""):o}},VC=s=>{if(!(s!=null&&s.pendingProps))return;const{"data-inspector-line":t,"data-inspector-column":a,"data-inspector-relative-path":r}=s.pendingProps;if(t&&a&&r)return{lineNumber:t,columnNumber:a,relativePath:r}},Of=s=>{const t=[qC(s),VC(s)].filter(Boolean);if(t.length)return Object.assign({},...t)},Tb=s=>{if(!s)return;const t=FC(s);if(!t)return;const a=IC(t),r=!t.child.sibling;let o=!a&&r?t:s;const c=o;for(;o;){if(Of(o))return o;o=o.return}return c},Dy=s=>{const t=Rf(s),a=Tb(t);return Of(a)},WC=s=>{var t,a;let r=s,o;for(;r;){let c=(t=r.return)!==null&&t!==void 0?t:void 0,u;for(;Eb(c);)PC(c)&&(u=c),c=(a=c==null?void 0:c.return)!==null&&a!==void 0?a:void 0;if(u&&(r=u),Nb(r)&&(o||(o=r),Of(r)))return r;r=c}return o},Ly=s=>{const t=Rf(s),a=Tb(t),r=WC(a),o=Nb(r),c=s.nodeName.toLowerCase(),u=o?`${c} in <${o}>`:c;return{fiber:a,name:o,title:u}};function zy(s){return s.getBoundingClientRect()}function KC(s){const t=window.getComputedStyle(s);return{borderLeft:Number.parseInt(t.borderLeftWidth,10),borderRight:Number.parseInt(t.borderRightWidth,10),borderTop:Number.parseInt(t.borderTopWidth,10),borderBottom:Number.parseInt(t.borderBottomWidth,10),marginLeft:Number.parseInt(t.marginLeft,10),marginRight:Number.parseInt(t.marginRight,10),marginTop:Number.parseInt(t.marginTop,10),marginBottom:Number.parseInt(t.marginBottom,10),paddingLeft:Number.parseInt(t.paddingLeft,10),paddingRight:Number.parseInt(t.paddingRight,10),paddingTop:Number.parseInt(t.paddingTop,10),paddingBottom:Number.parseInt(t.paddingBottom,10)}}var zd,Uy;function YC(){return Uy||(Uy=1,zd="/__open-stack-frame-in-editor"),zd}var ZC=YC();const Hy=mf(ZC),QC=s=>"codeInfo"in s?s.codeInfo:s,XC=s=>{if(!s)return;const t=QC(s),{lineNumber:a,columnNumber:r,relativePath:o,absolutePath:c}=t,u=!!o,f=u?o:c;if(!f){console.error("[react-dev-inspector] Cannot open editor without source fileName",t);return}const m={fileName:f,lineNumber:a,colNumber:r},g=u?`${Hy}/relative`:Hy;fetch(`${g}?${new URLSearchParams(m)}`)},Ud=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function Hd(s,t,a,r){s.addEventListener?s.addEventListener(t,a,r):s.attachEvent&&s.attachEvent("on".concat(t),a)}function Gr(s,t,a,r){s.removeEventListener?s.removeEventListener(t,a,r):s.detachEvent&&s.detachEvent("on".concat(t),a)}function Ab(s,t){const a=t.slice(0,t.length-1);for(let r=0;r<a.length;r++)a[r]=s[a[r].toLowerCase()];return a}function jb(s){typeof s!="string"&&(s=""),s=s.replace(/\s/g,"");const t=s.split(",");let a=t.lastIndexOf("");for(;a>=0;)t[a-1]+=",",t.splice(a,1),a=t.lastIndexOf("");return t}function JC(s,t){const a=s.length>=t.length?s:t,r=s.length>=t.length?t:s;let o=!0;for(let c=0;c<a.length;c++)r.indexOf(a[c])===-1&&(o=!1);return o}const ll={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":Ud?173:189,"=":Ud?61:187,";":Ud?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},zn={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,meta:91,command:91},Vr={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Lt={16:!1,18:!1,17:!1,91:!1},mt={};for(let s=1;s<20;s++)ll["f".concat(s)]=111+s;let ft=[],tl=null,Rb="all";const gs=new Map,Oi=s=>ll[s.toLowerCase()]||zn[s.toLowerCase()]||s.toUpperCase().charCodeAt(0),eE=s=>Object.keys(ll).find(t=>ll[t]===s),tE=s=>Object.keys(zn).find(t=>zn[t]===s);function Ob(s){Rb=s||"all"}function ol(){return Rb||"all"}function nE(){return ft.slice(0)}function sE(){return ft.map(s=>eE(s)||tE(s)||String.fromCharCode(s))}function aE(){const s=[];return Object.keys(mt).forEach(t=>{mt[t].forEach(a=>{let{key:r,scope:o,mods:c,shortcut:u}=a;s.push({scope:o,shortcut:u,mods:c,keys:r.split("+").map(f=>Oi(f))})})}),s}function iE(s){const t=s.target||s.srcElement,{tagName:a}=t;let r=!0;const o=a==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||a==="TEXTAREA"||a==="SELECT")&&!t.readOnly)&&(r=!1),r}function rE(s){return typeof s=="string"&&(s=Oi(s)),ft.indexOf(s)!==-1}function lE(s,t){let a,r;s||(s=ol());for(const o in mt)if(Object.prototype.hasOwnProperty.call(mt,o))for(a=mt[o],r=0;r<a.length;)a[r].scope===s?a.splice(r,1).forEach(u=>{let{element:f}=u;return Mf(f)}):r++;ol()===s&&Ob(t||"all")}function oE(s){let t=s.keyCode||s.which||s.charCode;s.key&&s.key.toLowerCase()==="capslock"&&(t=Oi(s.key));const a=ft.indexOf(t);if(a>=0&&ft.splice(a,1),s.key&&s.key.toLowerCase()==="meta"&&ft.splice(0,ft.length),(t===93||t===224)&&(t=91),t in Lt){Lt[t]=!1;for(const r in zn)zn[r]===t&&(En[r]=!1)}}function Mb(s){if(typeof s>"u")Object.keys(mt).forEach(o=>{Array.isArray(mt[o])&&mt[o].forEach(c=>Lo(c)),delete mt[o]}),Mf(null);else if(Array.isArray(s))s.forEach(o=>{o.key&&Lo(o)});else if(typeof s=="object")s.key&&Lo(s);else if(typeof s=="string"){for(var t=arguments.length,a=new Array(t>1?t-1:0),r=1;r<t;r++)a[r-1]=arguments[r];let[o,c]=a;typeof o=="function"&&(c=o,o=""),Lo({key:s,scope:o,method:c,splitKey:"+"})}}const Lo=s=>{let{key:t,scope:a,method:r,splitKey:o="+"}=s;jb(t).forEach(u=>{const f=u.split(o),m=f.length,g=f[m-1],y=g==="*"?"*":Oi(g);if(!mt[y])return;a||(a=ol());const b=m>1?Ab(zn,f):[],v=[];mt[y]=mt[y].filter(S=>{const C=(r?S.method===r:!0)&&S.scope===a&&JC(S.mods,b);return C&&v.push(S.element),!C}),v.forEach(S=>Mf(S))})};function $y(s,t,a,r){if(t.element!==r)return;let o;if(t.scope===a||t.scope==="all"){o=t.mods.length>0;for(const c in Lt)Object.prototype.hasOwnProperty.call(Lt,c)&&(!Lt[c]&&t.mods.indexOf(+c)>-1||Lt[c]&&t.mods.indexOf(+c)===-1)&&(o=!1);(t.mods.length===0&&!Lt[16]&&!Lt[18]&&!Lt[17]&&!Lt[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(ft),t.method(s,t)===!1&&(s.preventDefault?s.preventDefault():s.returnValue=!1,s.stopPropagation&&s.stopPropagation(),s.cancelBubble&&(s.cancelBubble=!0)))}}function Iy(s,t){const a=mt["*"];let r=s.keyCode||s.which||s.charCode;if(s.key&&s.key.toLowerCase()==="capslock"||!En.filter.call(this,s))return;if((r===93||r===224)&&(r=91),ft.indexOf(r)===-1&&r!==229&&ft.push(r),["metaKey","ctrlKey","altKey","shiftKey"].forEach(f=>{const m=Vr[f];s[f]&&ft.indexOf(m)===-1?ft.push(m):!s[f]&&ft.indexOf(m)>-1?ft.splice(ft.indexOf(m),1):f==="metaKey"&&s[f]&&(ft=ft.filter(g=>g in Vr||g===r))}),r in Lt){Lt[r]=!0;for(const f in zn)if(Object.prototype.hasOwnProperty.call(zn,f)){const m=Vr[zn[f]];En[f]=s[m]}if(!a)return}for(const f in Lt)Object.prototype.hasOwnProperty.call(Lt,f)&&(Lt[f]=s[Vr[f]]);s.getModifierState&&!(s.altKey&&!s.ctrlKey)&&s.getModifierState("AltGraph")&&(ft.indexOf(17)===-1&&ft.push(17),ft.indexOf(18)===-1&&ft.push(18),Lt[17]=!0,Lt[18]=!0);const o=ol();if(a)for(let f=0;f<a.length;f++)a[f].scope===o&&(s.type==="keydown"&&a[f].keydown||s.type==="keyup"&&a[f].keyup)&&$y(s,a[f],o,t);if(!(r in mt))return;const c=mt[r],u=c.length;for(let f=0;f<u;f++)if((s.type==="keydown"&&c[f].keydown||s.type==="keyup"&&c[f].keyup)&&c[f].key){const m=c[f],{splitKey:g}=m,y=m.key.split(g),b=[];for(let v=0;v<y.length;v++)b.push(Oi(y[v]));b.sort().join("")===ft.sort().join("")&&$y(s,m,o,t)}}function En(s,t,a){ft=[];const r=jb(s);let o=[],c="all",u=document,f=0,m=!1,g=!0,y="+",b=!1,v=!1;for(a===void 0&&typeof t=="function"&&(a=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(c=t.scope),t.element&&(u=t.element),t.keyup&&(m=t.keyup),t.keydown!==void 0&&(g=t.keydown),t.capture!==void 0&&(b=t.capture),typeof t.splitKey=="string"&&(y=t.splitKey),t.single===!0&&(v=!0)),typeof t=="string"&&(c=t),v&&Mb(s,c);f<r.length;f++)s=r[f].split(y),o=[],s.length>1&&(o=Ab(zn,s)),s=s[s.length-1],s=s==="*"?"*":Oi(s),s in mt||(mt[s]=[]),mt[s].push({keyup:m,keydown:g,scope:c,mods:o,shortcut:r[f],method:a,key:r[f],splitKey:y,element:u});if(typeof u<"u"&&window){if(!gs.has(u)){const S=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return Iy(C,u)},k=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;Iy(C,u),oE(C)};gs.set(u,{keydownListener:S,keyupListenr:k,capture:b}),Hd(u,"keydown",S,b),Hd(u,"keyup",k,b)}if(!tl){const S=()=>{ft=[]};tl={listener:S,capture:b},Hd(window,"focus",S,b)}}}function cE(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(mt).forEach(a=>{mt[a].filter(o=>o.scope===t&&o.shortcut===s).forEach(o=>{o&&o.method&&o.method()})})}function Mf(s){const t=Object.values(mt).flat();if(t.findIndex(r=>{let{element:o}=r;return o===s})<0){const{keydownListener:r,keyupListenr:o,capture:c}=gs.get(s)||{};r&&o&&(Gr(s,"keyup",o,c),Gr(s,"keydown",r,c),gs.delete(s))}if((t.length<=0||gs.size<=0)&&(Object.keys(gs).forEach(o=>{const{keydownListener:c,keyupListenr:u,capture:f}=gs.get(o)||{};c&&u&&(Gr(o,"keyup",u,f),Gr(o,"keydown",c,f),gs.delete(o))}),gs.clear(),Object.keys(mt).forEach(o=>delete mt[o]),tl)){const{listener:o,capture:c}=tl;Gr(window,"focus",o,c),tl=null}}const $d={getPressedKeyString:sE,setScope:Ob,getScope:ol,deleteScope:lE,getPressedKeyCodes:nE,getAllKeyCodes:aE,isPressed:rE,filter:iE,trigger:cE,unbind:Mb,keyMap:ll,modifier:zn,modifierMap:Vr};for(const s in $d)Object.prototype.hasOwnProperty.call($d,s)&&(En[s]=$d[s]);if(typeof window<"u"){const s=window.hotkeys;En.noConflict=t=>(t&&window.hotkeys===En&&(window.hotkeys=s),En),window.hotkeys=En}var Id;const uE=typeof window<"u"&&(!((Id=window==null?void 0:window.document)===null||Id===void 0)&&Id.createElement)?_.useLayoutEffect:_.useEffect,bi=s=>{const t=_.useRef(s);t.current=_.useMemo(()=>s,[s]);const a=_.useRef();return a.current||(a.current=(function(...r){var o;return(o=t.current)===null||o===void 0?void 0:o.apply(this,r)})),a.current},dE=({disable:s})=>{const t=_.useRef({x:0,y:0}),a=r=>{t.current.x=r.clientX,t.current.y=r.clientY};return _.useEffect(()=>(s||document.addEventListener("mousemove",a,!0),()=>{document.removeEventListener("mousemove",a,!0)}),[s]),t};class fE{constructor(t,a){Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"border",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"padding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.node=t.createElement("div"),this.border=t.createElement("div"),this.padding=t.createElement("div"),this.content=t.createElement("div"),this.border.style.borderColor=zo.border,this.padding.style.borderColor=zo.padding,this.content.style.backgroundColor=zo.background,Object.assign(this.node.style,{borderColor:zo.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),a.prepend(this.node)}remove(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}update(t,a){Pd(a,"margin",this.node),Pd(a,"border",this.border),Pd(a,"padding",this.padding),Object.assign(this.content.style,{height:`${t.height-a.borderTop-a.borderBottom-a.paddingTop-a.paddingBottom}px`,width:`${t.width-a.borderLeft-a.borderRight-a.paddingLeft-a.paddingRight}px`}),Object.assign(this.node.style,{top:`${t.top-a.marginTop}px`,left:`${t.left-a.marginLeft}px`})}}class pE{constructor(t,a){Object.defineProperty(this,"tip",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nameSpan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"titleDiv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"infoDiv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dimSpan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tip=t.createElement("div"),Object.assign(this.tip.style,{display:"flex",flexFlow:"row nowrap",alignItems:"center",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"6px 8px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=t.createElement("span"),this.tip.appendChild(this.nameSpan),Object.assign(this.nameSpan.style,{display:"flex",flexDirection:"column",borderRight:"1px solid #aaaaaa",paddingRight:"0.8rem",marginRight:"0.8rem"}),this.titleDiv=t.createElement("div"),this.nameSpan.appendChild(this.titleDiv),Object.assign(this.titleDiv.style,{color:"#ee78e6",fontSize:"16px"}),this.infoDiv=t.createElement("div"),this.nameSpan.appendChild(this.infoDiv),Object.assign(this.infoDiv.style,{color:"#ee78e6",fontSize:"14px"}),this.dimSpan=t.createElement("span"),this.tip.appendChild(this.dimSpan),Object.assign(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",a.appendChild(this.tip)}remove(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}updateText(t,a,r,o){this.titleDiv.textContent=t,this.infoDiv.textContent=a??"",this.dimSpan.textContent=`${Math.round(r)}px × ${Math.round(o)}px`}updatePosition(t,a){const r=this.tip.getBoundingClientRect(),o=mE(t,a,{width:r.width,height:r.height});Object.assign(this.tip.style,o.style)}}class hE{constructor(){Object.defineProperty(this,"window",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tipBoundsWindow",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tip",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rects",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"removeCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.window=t;const a=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.tipBoundsWindow=a;const r=t.document;this.container=r.createElement("div"),this.container.style.zIndex="10000000",this.tip=new pE(r,this.container),this.rects=[],this.removeCallback=()=>{},r.body.appendChild(this.container)}remove(){this.tip.remove(),this.rects.forEach(t=>{t.remove()}),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.removeCallback()}setRemoveCallback(t){this.removeCallback=t.bind(this)}inspect(t,a,r){var o;const c=t.filter(m=>m.nodeType===Node.ELEMENT_NODE);for(;this.rects.length>c.length;){const m=this.rects.pop();m==null||m.remove()}if(c.length===0)return;for(;this.rects.length<c.length;)this.rects.push(new fE(this.window.document,this.container));const u={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};if(c.forEach((m,g)=>{const y=zy(m,this.window),b=KC(m);u.top=Math.min(u.top,y.top-b.marginTop),u.right=Math.max(u.right,y.left+y.width+b.marginRight),u.bottom=Math.max(u.bottom,y.top+y.height+b.marginBottom),u.left=Math.min(u.left,y.left-b.marginLeft),this.rects[g].update(y,b)}),!a){a=c[0].nodeName.toLowerCase();const m=c[0],g=(o=m.ownerDocument.defaultView)===null||o===void 0?void 0:o.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g!=null&&g.rendererInterfaces){let y=null;for(const b of g.rendererInterfaces.values()){const v=b.getFiberIDForNative(m,!0);if(v!==null){y=b.getDisplayNameForFiberID(v,!0);break}}y&&(a+=` (in ${y})`)}}this.tip.updateText(a,r,u.right-u.left,u.bottom-u.top);const f=zy(this.tipBoundsWindow.document.documentElement,this.window);this.tip.updatePosition({top:u.top,left:u.left,height:u.bottom-u.top,width:u.right-u.left},{top:f.top+this.tipBoundsWindow.scrollY,left:f.left+this.tipBoundsWindow.scrollX,height:this.tipBoundsWindow.innerHeight,width:this.tipBoundsWindow.innerWidth})}}function mE(s,t,a){const r=Math.max(a.height,20),o=Math.max(a.width,60),c=5;let u;s.top+s.height+r<=t.top+t.height?s.top+s.height<t.top+0?u=t.top+c:u=s.top+s.height+c:s.top-r<=t.top+t.height?s.top-r-c<t.top+c?u=t.top+c:u=s.top-r-c:u=t.top+t.height-r-c;let f=s.left+c;return s.left<t.left&&(f=t.left+c),s.left+o>t.left+t.width&&(f=t.left+t.width-o-c),{style:{top:`${u}px`,left:`${f}px`}}}function Pd(s,t,a){Object.assign(a.style,{borderTopWidth:`${s[`${t}Top`]}px`,borderLeftWidth:`${s[`${t}Left`]}px`,borderRightWidth:`${s[`${t}Right`]}px`,borderBottomWidth:`${s[`${t}Bottom`]}px`,borderStyle:"solid"})}const zo={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"},gE=()=>{var s;return!((s=navigator.platform)===null||s===void 0)&&s.startsWith("Mac")?["Ctrl","Shift","Command","C"]:["Ctrl","Shift","Alt","C"]},yE=s=>{const{keys:t,onHoverElement:a,onClickElement:r,onInspectElement:o,active:c,onActiveChange:u,disableLaunchEditor:f,disable:m=!0,children:g}=s,[y,b]=_.useState(c??!1);uE(()=>{c!==void 0&&b(c)},[c]),_.useEffect(()=>(y?O():j(),j),[y]);const v=t===null?null:(t??[]).join("+"),S=_.useRef(),k=dE({disable:m}),C=bi(()=>{u==null||u(!0),c===void 0&&b(!0)}),E=bi(()=>{u==null||u(!1),c===void 0&&b(!1)}),O=bi(()=>{if(S.current||m)return;const R=new hE;S.current=R,En("esc",E);const K=$C({onPointerOver:T,onClick:U});R.setRemoveCallback(K);const Z=k.current,te=document.elementFromPoint(Z.x,Z.y);te&&T(te)}),j=bi(()=>{var R;(R=S.current)===null||R===void 0||R.remove(),S.current=void 0,En.unbind("esc",E)}),T=bi(R=>{var K;const Z=S.current,te=Dy(R),pe=te==null?void 0:te.relativePath,he=te==null?void 0:te.absolutePath,{fiber:it,name:de,title:W}=Ly(R);(K=Z==null?void 0:Z.inspect)===null||K===void 0||K.call(Z,[R],W,pe??he),a==null||a({element:R,fiber:it,codeInfo:te,name:de})}),U=bi(R=>{E();const K=Dy(R),{fiber:Z,name:te}=Ly(R);r==null||r({element:R,fiber:Z,codeInfo:K,name:te}),Z&&K&&(o==null||o({element:R,fiber:Z,codeInfo:K,name:te}),!o&&!f&&XC(K))});return _.useEffect(()=>{const R=()=>{S.current?E():C()},K=v===null||m?null:v||gE().join("+");if(K)return En(K,R),()=>{En.unbind(K,R)}},[v,m]),h.jsx(h.Fragment,{children:g??null})};function bE(){const[s,t]=_.useState(!1);return _.useEffect(()=>{const a=r=>{r.ctrlKey&&r.shiftKey&&r.altKey&&(r.key==="c"||r.key==="C")&&(r.preventDefault(),t(o=>!o))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]),h.jsxs(h.Fragment,{children:[h.jsx(yE,{active:s,onActiveChange:t}),h.jsx("button",{onClick:()=>t(a=>!a),title:s?"关闭检查模式":"开启检查模式 (Ctrl+Shift+Alt+C)",style:{position:"fixed",bottom:"20px",right:"20px",zIndex:99999,width:"44px",height:"44px",borderRadius:"50%",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px",boxShadow:"0 2px 12px rgba(0,0,0,0.25)",transition:"all 0.2s ease",background:s?"#22c55e":"#1e293b",color:"#fff"},children:h.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.jsx("path",{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10z"}),h.jsx("path",{d:"M12 2v20"}),h.jsx("path",{d:"M2 12h20"})]})})]})}F0.createRoot(document.getElementById("root")).render(h.jsxs(L0.StrictMode,{children:[h.jsx(bE,{}),h.jsx($_,{})]}));export{BE as A,Cy as B,RE as C,L1 as D,CE as E,we as F,TE as G,hb as H,jw as I,Qe as J,hf as K,Jw as L,Tf as M,Ir as N,jE as P,ME as R,el as T,EE as W,ze as a,Cn as b,Tn as c,pt as d,KS as e,Ei as f,I as g,Zk as h,ww as i,Vw as j,OE as k,ys as l,je as m,d1 as n,yb as o,AE as p,Mk as q,Si as r,Fe as s,ke as t,Qr as u,b_ as v,ge as w,DE as x,S_ as y,NE as z};
|