@nextclaw/ui 0.10.3 → 0.10.5
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/CHANGELOG.md +18 -0
- package/dist/assets/{ChannelsList-2FjU5fiD.js → ChannelsList-Nu7Ig6_-.js} +1 -1
- package/dist/assets/{ChatPage-ugiGAeYI.js → ChatPage-CBCFSk4e.js} +24 -24
- package/dist/assets/{DocBrowser-tH07yTO3.js → DocBrowser-3CfKmJA6.js} +1 -1
- package/dist/assets/{LogoBadge-BHszLcFS.js → LogoBadge-DdthDJOp.js} +1 -1
- package/dist/assets/{MarketplacePage-C7sTQxnk.js → MarketplacePage-inGGiv1T.js} +1 -1
- package/dist/assets/{McpMarketplacePage-6pG1exmL.js → McpMarketplacePage-Dg8GSZh6.js} +1 -1
- package/dist/assets/{ModelConfig-ChXV-3uT.js → ModelConfig-DyQ6cC92.js} +1 -1
- package/dist/assets/{ProvidersList-Bq6v0Arn.js → ProvidersList-B2T8Lc_i.js} +1 -1
- package/dist/assets/{RemoteAccessPage-BOWUBcqS.js → RemoteAccessPage-C9LxgK-C.js} +1 -1
- package/dist/assets/{RuntimeConfig-DyVKq5bp.js → RuntimeConfig-Ey4VIqTW.js} +1 -1
- package/dist/assets/{SearchConfig-DLKJzszy.js → SearchConfig-R1BcCLWO.js} +1 -1
- package/dist/assets/{SecretsConfig-D1fC-5yG.js → SecretsConfig-D-jZMHeY.js} +2 -2
- package/dist/assets/{SessionsConfig-CAUcd5m1.js → SessionsConfig-Cawoh4_2.js} +1 -1
- package/dist/assets/{chat-message-BEmJpaTS.js → chat-message-BbuIK4dQ.js} +1 -1
- package/dist/assets/index-BulnQWr6.js +8 -0
- package/dist/assets/index-kaPUhd-8.css +1 -0
- package/dist/assets/{label-B1XIyXpX.js → label-C7yzBvzK.js} +1 -1
- package/dist/assets/{page-layout-x14rIiYp.js → page-layout-DF0xpax2.js} +1 -1
- package/dist/assets/{popover-irxrNZ0V.js → popover-DjaScZDJ.js} +1 -1
- package/dist/assets/{security-config-DsSj-9rH.js → security-config-Bg2eriNx.js} +1 -1
- package/dist/assets/{skeleton-B46IL2X6.js → skeleton-DycBJAJF.js} +1 -1
- package/dist/assets/{status-dot-CKkoylcD.js → status-dot-B9opOZ22.js} +1 -1
- package/dist/assets/{switch-lU9yQaD-.js → switch-l1P0ev4D.js} +1 -1
- package/dist/assets/{tabs-custom-0ADOTWdk.js → tabs-custom-BG9y2JhC.js} +1 -1
- package/dist/assets/{useConfirmDialog-B5VIsGQY.js → useConfirmDialog-DTducNfn.js} +1 -1
- package/dist/index.html +3 -3
- package/index.html +1 -1
- package/package.json +6 -6
- package/src/App.test.tsx +0 -18
- package/src/App.tsx +1 -22
- package/src/api/ncp-attachments.ts +41 -0
- package/src/api/types.ts +13 -0
- package/src/components/chat/adapters/chat-message.adapter.test.ts +27 -0
- package/src/components/chat/adapters/chat-message.adapter.ts +5 -1
- package/src/components/chat/chat-composer-state.test.ts +33 -0
- package/src/components/chat/chat-composer-state.ts +3 -1
- package/src/components/chat/containers/chat-input-bar.container.tsx +9 -8
- package/src/components/chat/ncp/ncp-chat-input.manager.ts +3 -1
- package/src/components/chat/ncp/ncp-session-adapter.test.ts +3 -1
- package/src/components/chat/ncp/ncp-session-adapter.ts +15 -1
- package/src/components/layout/AppLayout.tsx +8 -1
- package/src/hooks/use-auth.test.ts +27 -9
- package/src/hooks/use-auth.ts +18 -9
- package/src/lib/i18n.chat.ts +7 -7
- package/src/lib/i18n.ts +0 -2
- package/src/lib/ui-document-title.ts +41 -0
- package/dist/assets/index-B3MjcTn7.css +0 -1
- package/dist/assets/index-L3D03lUH.js +0 -8
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocBrowser-tH07yTO3.js","assets/vendor-CNhxtHCf.js","assets/ModelConfig-ChXV-3uT.js","assets/label-B1XIyXpX.js","assets/skeleton-B46IL2X6.js","assets/config-hints-CApS3K_7.js","assets/provider-models-BOeNnjk9.js","assets/page-layout-x14rIiYp.js","assets/ChatPage-ugiGAeYI.js","assets/useConfirmDialog-B5VIsGQY.js","assets/chat-message-BEmJpaTS.js","assets/MarketplacePage-C7sTQxnk.js","assets/tabs-custom-0ADOTWdk.js","assets/marketplace-localization-Dk31LJJJ.js","assets/popover-irxrNZ0V.js","assets/SearchConfig-DLKJzszy.js","assets/config-layout-BHnOoweL.js","assets/ProvidersList-Bq6v0Arn.js","assets/switch-lU9yQaD-.js","assets/status-dot-CKkoylcD.js","assets/LogoBadge-BHszLcFS.js","assets/ChannelsList-2FjU5fiD.js","assets/RuntimeConfig-DyVKq5bp.js","assets/security-config-DsSj-9rH.js","assets/SessionsConfig-CAUcd5m1.js","assets/SecretsConfig-D1fC-5yG.js","assets/RemoteAccessPage-BOWUBcqS.js","assets/McpMarketplacePage-6pG1exmL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as Rt,c as jt,r as d,j as s,a as Lt,O as _e,P as Bt,C as We,b as Ut,X as Ft,T as qe,D as Ke,R as Ot,Q as _t,u as E,d as ze,e as m,K as ue,S as Wt,L as qt,f as A,g as x,h as $e,I as Kt,i as He,k as Qe,l as $t,m as Ve,n as Ht,o as Ge,V as Qt,p as Je,q as Ye,s as Vt,v as Gt,w as Jt,x as Xe,y as Yt,z as Xt,N as Ze,M as Zt,A as en,B as tn,E as nn,F as sn,G as an,H as rn,J as on,W as cn,U as ln,Y as dn,Z as hn,_ as un,$ as mn,a0 as pn,a1 as gn,a2 as fn,a3 as yn,a4 as wn,a5 as Sn,a6 as vn,a7 as zn,a8 as b,a9 as U,aa as xn,ab as bn}from"./vendor-CNhxtHCf.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();const An="modulepreload",Pn=function(e){return"/"+e},Te={},N=function(t,n,a){let r=Promise.resolve();if(n&&n.length>0){let c=function(v){return Promise.all(v.map(y=>Promise.resolve(y).then(M=>({status:"fulfilled",value:M}),M=>({status:"rejected",reason:M}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));r=c(n.map(v=>{if(v=Pn(v),v in Te)return;Te[v]=!0;const y=v.endsWith(".css"),M=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${M}`))return;const T=document.createElement("link");if(T.rel=y?"stylesheet":An,y||(T.as="script"),T.crossOrigin="",T.href=v,u&&T.setAttribute("nonce",u),document.head.appendChild(T),y)return new Promise((W,q)=>{T.addEventListener("load",W),T.addEventListener("error",()=>q(new Error(`Unable to preload CSS for ${v}`)))})}))}function i(c){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=c,window.dispatchEvent(l),!l.defaultPrevented)throw c}return r.then(c=>{for(const l of c||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function f(...e){return Rt(jt(e))}const kn=Lt("inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600",secondary:"bg-gray-100 text-gray-700 hover:bg-gray-200/80",ghost:"hover:bg-gray-100/80 hover:text-gray-800",link:"text-primary underline-offset-4 hover:underline",primary:"bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm",subtle:"bg-gray-100 text-gray-600 hover:bg-gray-200/80","primary-outline":"border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",lg:"h-11 px-5 text-[14px]",xl:"h-12 px-6 text-[15px]",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),O=d.forwardRef(({className:e,variant:t,size:n,...a},r)=>s.jsx("button",{className:f(kn({variant:t,size:n,className:e})),ref:r,...a}));O.displayName="Button";const Cn=Ot,Tn=Bt,et=d.forwardRef(({className:e,...t},n)=>s.jsx(_e,{ref:n,className:f("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));et.displayName=_e.displayName;const tt=d.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(Tn,{children:[s.jsx(et,{}),s.jsxs(We,{ref:a,className:f("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200/50 bg-white p-6 shadow-xl duration-base data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-2xl",e),...n,children:[t,s.jsxs(Ut,{className:"absolute right-4 top-4 rounded-lg p-1 opacity-70 ring-offset-white transition-all duration-fast hover:opacity-100 hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(Ft,{className:"h-4 w-4 text-gray-500"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));tt.displayName=We.displayName;const nt=({className:e,...t})=>s.jsx("div",{className:f("flex flex-col space-y-2 text-center sm:text-left",e),...t});nt.displayName="DialogHeader";const In=({className:e,...t})=>s.jsx("div",{className:f("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3",e),...t});In.displayName="DialogFooter";const st=d.forwardRef(({className:e,...t},n)=>s.jsx(qe,{ref:n,className:f("text-lg font-semibold leading-tight tracking-tight text-gray-900",e),...t}));st.displayName=qe.displayName;const at=d.forwardRef(({className:e,...t},n)=>s.jsx(Ke,{ref:n,className:f("text-sm text-gray-500 leading-relaxed",e),...t}));at.displayName=Ke.displayName;const En="http://127.0.0.1:55667",ie=(()=>{var e;return typeof window<"u"&&((e=window.location)!=null&&e.origin)?window.location.origin:En})();function Nn(e){return e.replace(/\s+/g," ").trim().slice(0,200)}function Mn(e,t){if(t===404&&e.startsWith("/api/config/providers/")&&e.endsWith("/test"))return"Provider test endpoint is missing. This usually means nextclaw runtime version is outdated.";if(t===401||t===403)return"Authentication failed. Check apiKey and custom headers.";if(t===429)return"Rate limited by upstream provider. Retry later or switch model/provider.";if(t>=500)return"Upstream service error. Retry later and inspect server logs if it persists."}async function Dn(e,t={}){const n=`${ie}${e}`,a=(t.method||"GET").toUpperCase(),r=await fetch(n,{credentials:"include",headers:{"Content-Type":"application/json",...t.headers},...t}),i=await r.text();let c=null;if(i)try{c=JSON.parse(i)}catch{}if(!c){const l=i?Nn(i):"",u=Mn(e,r.status),v=[`Non-JSON response (${r.status} ${r.statusText}) on ${a} ${e}`];return l&&v.push(`body=${l}`),u&&v.push(`hint=${u}`),{ok:!1,error:{code:"INVALID_RESPONSE",message:v.join(" | "),details:{status:r.status,statusText:r.statusText,method:a,endpoint:e,url:n,bodySnippet:l||void 0,hint:u}}}}return r.ok,c}function Rn(e){const t=e.split(`
|
|
3
|
-
`);let n="";const a=[];for(const c of t){const l=c.trimEnd();if(!(!l||l.startsWith(":"))){if(l.startsWith("event:")){n=l.slice(6).trim();continue}l.startsWith("data:")&&a.push(l.slice(5).trimStart())}}if(!n)return null;let r;const i=a.join(`
|
|
4
|
-
`);if(i)try{r=JSON.parse(i)}catch{r=i}return{name:n,payload:r}}function rt(e,t,n){const a=Rn(e);a&&(a.name==="final"&&n(a.payload),t(a))}function jn(e,t,n){let a=e.value.indexOf(`
|
|
5
|
-
|
|
6
|
-
`);for(;a!==-1;)rt(e.value.slice(0,a),t,n),e.value=e.value.slice(a+2),a=e.value.indexOf(`
|
|
7
|
-
|
|
8
|
-
`)}async function Ln(e,t){var c;const n=(c=e.body)==null?void 0:c.getReader();if(!n)throw new Error("SSE response body unavailable");const a=new TextDecoder,r={value:""};let i;try{for(;;){const{value:l,done:u}=await n.read();if(u)break;r.value+=a.decode(l,{stream:!0}),jn(r,t,v=>{i=v})}r.value.trim()&&rt(r.value,t,l=>{i=l})}finally{n.releaseLock()}return i}function ot(e,t){const n=e.replace(/\/$/,"");try{const a=new URL(n,window.location.origin);return`${a.protocol==="https:"?"wss:":a.protocol==="http:"?"ws:":a.protocol}//${a.host}${t}`}catch{return n.startsWith("wss://")||n.startsWith("ws://")?`${n}${t}`:n.startsWith("https://")?`${n.replace(/^https:/,"wss:")}${t}`:n.startsWith("http://")?`${n.replace(/^http:/,"ws:")}${t}`:`${n}${t}`}}function Bn(e,t){return e.ok?new Error(t):new Error(e.error.message)}class Un{constructor(t){this.wsUrl=t,this.socket=null,this.reconnectTimer=null,this.manualClose=!1,this.subscribers=new Set}subscribe(t){var n;return this.subscribers.add(t),this.subscribers.size===1?this.connect():((n=this.socket)==null?void 0:n.readyState)===WebSocket.OPEN&&t({type:"connection.open",payload:{}}),()=>{this.subscribers.delete(t),this.subscribers.size===0&&this.disconnect()}}emit(t){for(const n of this.subscribers)n(t)}connect(){if(this.socket&&(this.socket.readyState===WebSocket.CONNECTING||this.socket.readyState===WebSocket.OPEN))return;this.manualClose=!1;const t=new WebSocket(this.wsUrl);this.socket=t,t.onopen=()=>{this.emit({type:"connection.open",payload:{}})},t.onmessage=n=>{try{const a=JSON.parse(String(n.data??""));this.emit(a)}catch(a){console.error("Failed to parse websocket message:",a)}},t.onerror=()=>{this.emit({type:"connection.error",payload:{message:"websocket error"}})},t.onclose=()=>{this.emit({type:"connection.close",payload:{}}),this.socket=null,!this.manualClose&&this.subscribers.size>0&&this.scheduleReconnect()}}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}disconnect(){var t;this.manualClose=!0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.socket)==null||t.close(),this.socket=null}}class ${constructor(t={}){this.options=t,this.apiBase=t.apiBase??ie,this.realtimeGateway=new Un(ot(this.apiBase,t.wsPath??"/ws"))}async request(t){const n=Number.isFinite(t.timeoutMs)&&(t.timeoutMs??0)>0?Math.trunc(t.timeoutMs):null,a=n?new AbortController:null,r=n?window.setTimeout(()=>a==null?void 0:a.abort(`Request timed out after ${n}ms: ${t.method} ${t.path}`),n):null;try{const i=await Dn(t.path,{method:t.method,...t.body!==void 0?{body:JSON.stringify(t.body)}:{},...a?{signal:a.signal}:{}});if(!i.ok)throw Bn(i,`Request failed for ${t.method} ${t.path}`);return i.data}catch(i){if(a!=null&&a.signal.aborted){const c=a.signal.reason;throw new Error(typeof c=="string"&&c.trim()?c:`Request timed out: ${t.method} ${t.path}`)}throw i}finally{r!==null&&window.clearTimeout(r)}}openStream(t){const n=new AbortController,a=()=>n.abort();return t.signal&&(t.signal.aborted?a():t.signal.addEventListener("abort",a,{once:!0})),{finished:(async()=>{var c;const i=await fetch(`${this.apiBase}${t.path}`,{method:t.method,credentials:"include",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},...t.body!==void 0?{body:JSON.stringify(t.body)}:{},signal:n.signal});if(!i.ok){const l=await i.text();throw new Error(l.trim()||`HTTP ${i.status}`)}try{return await Ln(i,t.onEvent)}finally{(c=t.signal)==null||c.removeEventListener("abort",a)}})(),cancel:()=>n.abort()}}subscribe(t){return this.realtimeGateway.subscribe(t)}}function Fn(e,t,n){var a;if(typeof e=="object"&&e&&"ok"in e){const r=e;if(r.ok===!1&&((a=r.error)!=null&&a.message))return new Error(r.error.message);if(r.ok===!0)return new Error(n)}return typeof e=="string"&&e.trim()?new Error(e.trim()):new Error(`${n} (${t})`)}function On(e){var t;if(typeof e=="object"&&e&&"ok"in e){const n=e;if(n.ok===!1)throw new Error(((t=n.error)==null?void 0:t.message)??"Remote request failed.");if(n.ok===!0)return n.data}return e}function Ie(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}const _n=15e3;class ne{constructor(t,n=ie){this.runtime=t,this.apiBase=n,this.socket=null,this.connectPromise=null,this.connectTimeoutId=null,this.reconnectTimer=null,this.manualClose=!1,this.subscribers=new Set,this.pendingRequests=new Map,this.pendingStreams=new Map}async request(t){await this.ensureSocket();const n=Ie("req"),a=Number.isFinite(t.timeoutMs)&&(t.timeoutMs??0)>0?Math.trunc(t.timeoutMs):_n;return await new Promise((r,i)=>{const c=window.setTimeout(()=>{this.pendingRequests.delete(n),i(new Error(`Timed out waiting for remote request response after ${a}ms: ${t.method} ${t.path}`))},a);this.pendingRequests.set(n,{resolve:l=>r(l),reject:i,timeoutId:c}),this.send({type:"request",id:n,target:{method:t.method,path:t.path,...t.body!==void 0?{body:t.body}:{}}})})}openStream(t){const n=Ie("stream");let a=!1;const r=y=>{a||(a=!0,c(y))};let i,c;const l=new Promise((y,M)=>{i=y,c=M}),u=()=>{this.pendingStreams.delete(n),!a&&(a=!0,this.send({type:"stream.cancel",streamId:n}),c(new Error("stream cancelled")))};this.pendingStreams.set(n,{onEvent:t.onEvent,finalResult:void 0,resolve:y=>{a||(a=!0,i(y))},reject:y=>{a||(a=!0,c(y))}});const v=()=>u();return t.signal&&(t.signal.aborted?u():t.signal.addEventListener("abort",v,{once:!0})),this.ensureSocket().then(()=>{a||this.send({type:"stream.open",streamId:n,target:{method:t.method,path:t.path,...t.body!==void 0?{body:t.body}:{}}})}).catch(y=>{this.pendingStreams.delete(n),r(y instanceof Error?y:new Error(String(y)))}),{finished:l.finally(()=>{var y;(y=t.signal)==null||y.removeEventListener("abort",v),this.pendingStreams.delete(n)}),cancel:u}}subscribe(t){return this.subscribers.add(t),this.ensureSocket().catch(n=>{t({type:"connection.error",payload:{message:n instanceof Error?n.message:String(n)}})}),()=>{this.subscribers.delete(t)}}emit(t){for(const n of this.subscribers)n(t)}send(t){if(!this.socket||this.socket.readyState!==WebSocket.OPEN)throw new Error("Remote transport websocket is not connected.");this.socket.send(JSON.stringify(t))}async ensureSocket(){var a;if(((a=this.socket)==null?void 0:a.readyState)===WebSocket.OPEN&&this.connectPromise===null)return;if(this.connectPromise)return await this.connectPromise;const t=ot(this.apiBase,this.runtime.wsPath);return this.manualClose=!1,this.connectPromise=new Promise((r,i)=>{const c=new WebSocket(t);this.socket=c;let l=!1;const u=()=>{this.connectTimeoutId!==null&&(window.clearTimeout(this.connectTimeoutId),this.connectTimeoutId=null)};this.connectTimeoutId=window.setTimeout(()=>{this.connectTimeoutId=null,i(new Error("Timed out waiting for remote transport websocket.")),c.close()},8e3),c.onopen=()=>{l=!0,u(),this.connectPromise=null,r(),this.emit({type:"connection.open",payload:{}})},c.onmessage=v=>{try{const y=JSON.parse(String(v.data??""));if(y.type==="connection.ready")return;this.handleFrame(y)}catch(y){console.error("Failed to parse remote websocket frame:",y)}},c.onerror=()=>{this.emit({type:"connection.error",payload:{message:"remote websocket error"}})},c.onclose=()=>{u();const v=this.connectPromise!==null;this.socket=null,this.connectPromise=null,this.failPendingWork(new Error("Remote transport connection closed.")),this.emit({type:"connection.close",payload:{}}),v&&!l&&i(new Error("Remote transport connection closed before ready.")),!this.manualClose&&this.subscribers.size>0&&this.scheduleReconnect()}}),await this.connectPromise}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.ensureSocket().catch(()=>{})},3e3))}failPendingWork(t){for(const n of this.pendingRequests.values())window.clearTimeout(n.timeoutId),n.reject(t);this.pendingRequests.clear();for(const n of this.pendingStreams.values())n.reject(t);this.pendingStreams.clear()}handleFrame(t){if(t.type==="response"||t.type==="request.error"){this.handleRequestFrame(t);return}if(t.type==="stream.event"||t.type==="stream.end"||t.type==="stream.error"){this.handleStreamFrame(t);return}if(t.type==="event"){this.emit(t.event);return}t.type==="connection.error"&&this.emit({type:"connection.error",payload:{message:t.message}})}handleRequestFrame(t){const n=this.pendingRequests.get(t.id);if(n){if(this.pendingRequests.delete(t.id),window.clearTimeout(n.timeoutId),t.type==="request.error"){n.reject(new Error(t.message));return}if(t.status>=400){n.reject(Fn(t.body,t.status,"Remote request failed."));return}try{n.resolve(On(t.body))}catch(a){n.reject(a instanceof Error?a:new Error(String(a)))}}}handleStreamFrame(t){const n=this.pendingStreams.get(t.streamId);if(n){if(t.type==="stream.event"){try{t.event==="final"&&(n.finalResult=t.payload),n.onEvent({name:t.event,payload:t.payload})}catch(a){this.pendingStreams.delete(t.streamId),n.reject(a instanceof Error?a:new Error(String(a)))}return}if(this.pendingStreams.delete(t.streamId),t.type==="stream.end"){n.resolve(n.finalResult);return}n.reject(new Error(t.message))}}}const Wn="/_remote/runtime",le={mode:"remote",protocolVersion:1,wsPath:"/_remote/ws"};async function qn(e){var i,c;const t=`${e.replace(/\/$/,"")}${Wn}`;let n;try{n=await fetch(t,{method:"GET",credentials:"include",cache:"no-store"})}catch{return new $({apiBase:e})}if(n.status===404)return new $({apiBase:e});if(!(((i=n.headers.get("content-type"))==null?void 0:i.toLowerCase())??"").includes("application/json"))return n.status>=400?new ne(le,e):new $({apiBase:e});let r=null;try{r=await n.json()}catch{return n.status>=400?new ne(le,e):new $({apiBase:e})}return n.ok&&r.ok&&((c=r.data)==null?void 0:c.mode)==="remote"?new ne(r.data,e):n.status>=400?new ne(le,e):new $({apiBase:e})}class Kn{constructor(t=ie){this.apiBase=t,this.transportPromise=null}async getTransport(){return this.transportPromise||(this.transportPromise=qn(this.apiBase)),await this.transportPromise}async request(t){return await(await this.getTransport()).request(t)}openStream(t){let n=null,a,r;const i=new Promise((c,l)=>{a=c,r=l});return this.getTransport().then(c=>{n=c.openStream(t),n.finished.then(a).catch(l=>{r(l instanceof Error?l:new Error(String(l)))})}).catch(c=>{r(c instanceof Error?c:new Error(String(c)))}),{finished:i,cancel:()=>n==null?void 0:n.cancel()}}subscribe(t){let n=()=>{},a=!0;return this.getTransport().then(r=>{a&&(n=r.subscribe(t))}).catch(r=>{t({type:"connection.error",payload:{message:r instanceof Error?r.message:String(r)}})}),()=>{a=!1,n()}}}const it=new Kn;async function se(e,t={}){const n=(t.method||"GET").toUpperCase();try{return{ok:!0,data:await it.request({method:n,path:e,...t.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{},...t.body!==void 0?{body:$n(t.body)}:{}})}}catch(a){return{ok:!1,error:{code:"REQUEST_FAILED",message:a instanceof Error?a.message:String(a),details:{method:n,endpoint:e}}}}}const p={get:(e,t={})=>se(e,{...t,method:"GET"}),put:(e,t)=>se(e,{method:"PUT",body:JSON.stringify(t)}),post:(e,t)=>se(e,{method:"POST",body:JSON.stringify(t)}),delete:e=>se(e,{method:"DELETE"})};function $n(e){if(e!=null){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}async function ct(){const e=await p.get("/api/remote/status");if(!e.ok)throw new Error(e.error.message);return e.data}async function Hn(){const e=await p.get("/api/remote/doctor");if(!e.ok)throw new Error(e.error.message);return e.data}async function Qn(e){const t=await p.post("/api/remote/auth/start",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Vn(e){const t=await p.post("/api/remote/auth/poll",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Gn(){const e=await p.post("/api/remote/logout",{});if(!e.ok)throw new Error(e.error.message);return e.data}async function Ee(e){const t=await p.put("/api/remote/settings",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function ae(e){const t=await p.post(`/api/remote/service/${e}`,{});if(!t.ok)throw new Error(t.error.message);return t.data}const Jn={channelsPageTitle:{zh:"消息渠道",en:"Message Channels"},channelsPageDescription:{zh:"在一个页面中连续筛选、切换并配置各个消息渠道。",en:"Filter, switch, and configure messaging channels in one continuous workspace."},channelsLoading:{zh:"加载渠道中...",en:"Loading channels..."},channelsTabEnabled:{zh:"已启用",en:"Enabled"},channelsTabAll:{zh:"全部渠道",en:"All Channels"},channelsFilterPlaceholder:{zh:"搜索渠道",en:"Search channels"},channelsNoMatch:{zh:"没有匹配的渠道",en:"No matching channels"},channelsSelectTitle:{zh:"选择左侧渠道开始配置",en:"Select a channel from the left to configure"},channelsSelectDescription:{zh:"你可以连续切换多个渠道并逐个保存配置。",en:"Switch between channels continuously and save each configuration."},channelsFormDescription:{zh:"配置消息渠道参数",en:"Configure message channel parameters"},channelsEmptyTitle:{zh:"暂无启用渠道",en:"No channels enabled"},channelsEmptyDescription:{zh:"启用一个消息渠道以开始接收消息。",en:"Enable a messaging channel to start receiving messages."},channelDescriptionDefault:{zh:"配置该通信渠道",en:"Configure this communication channel"},channelDescTelegram:{zh:"连接 Telegram 机器人以进行即时消息收发",en:"Connect with Telegram bots for instant messaging"},channelDescSlack:{zh:"接入 Slack 工作区进行团队协作消息处理",en:"Integrate with Slack workspaces for team collaboration"},channelDescEmail:{zh:"通过邮件协议收发消息",en:"Send and receive messages via email protocols"},channelDescWebhook:{zh:"接收 HTTP Webhook 以支持自定义集成",en:"Receive HTTP webhooks for custom integrations"},channelDescDiscord:{zh:"将 Discord 机器人连接到你的社区服务器",en:"Connect Discord bots to your community servers"},channelDescFeishu:{zh:"企业消息与协作平台接入",en:"Enterprise messaging and collaboration platform"},channelDescWeixin:{zh:"通过微信扫码登录并使用长轮询收发个人微信消息",en:"Use QR login and long-poll updates for personal Weixin messaging"},configureMessageChannelParameters:{zh:"配置消息渠道参数",en:"Configure message channel parameters"},channelsGuideTitle:{zh:"查看指南",en:"View Guide"},allowFrom:{zh:"允许来源",en:"Allow From"},token:{zh:"Token",en:"Token"},botToken:{zh:"Bot Token",en:"Bot Token"},appToken:{zh:"App Token",en:"App Token"},appId:{zh:"App ID",en:"App ID"},domain:{zh:"域名",en:"Domain"},corpId:{zh:"企业 ID",en:"Corp ID"},agentId:{zh:"应用 Agent ID",en:"Agent ID"},appSecret:{zh:"App Secret",en:"App Secret"},markdownSupport:{zh:"Markdown 支持",en:"Markdown Support"},clientId:{zh:"Client ID",en:"Client ID"},clientSecret:{zh:"Client Secret",en:"Client Secret"},encryptKey:{zh:"加密密钥",en:"Encrypt Key"},verificationToken:{zh:"验证令牌",en:"Verification Token"},bridgeUrl:{zh:"桥接 URL",en:"Bridge URL"},gatewayUrl:{zh:"网关 URL",en:"Gateway URL"},proxy:{zh:"代理",en:"Proxy"},intents:{zh:"Intents",en:"Intents"},mode:{zh:"模式",en:"Mode"},webhookPath:{zh:"Webhook 路径",en:"Webhook Path"},callbackPort:{zh:"回调端口",en:"Callback Port"},callbackPath:{zh:"回调路径",en:"Callback Path"},defaultAccountId:{zh:"默认账号 ID",en:"Default Account ID"},pollTimeoutMs:{zh:"长轮询超时(毫秒)",en:"Long Poll Timeout (ms)"},accountsJson:{zh:"账号配置 JSON",en:"Accounts JSON"},groupPolicy:{zh:"群组策略",en:"Group Policy"}},Yn={weixinAuthTitle:{zh:"扫码连接微信",en:"Connect Weixin by QR"},weixinAuthDescription:{zh:"微信渠道现在以扫码连接为主流程。",en:"Weixin now uses QR login as the primary setup flow."},weixinAuthHint:{zh:"通常只需要点击按钮并扫码确认,连接成功后会自动写入配置。",en:"In most cases you only need to start the flow, scan the QR code, and confirm on your phone. The config will be saved automatically."},weixinAuthCapabilityHint:{zh:"连接成功后,Agent 可以通过微信渠道向已知微信用户主动发消息。",en:"After connecting, the agent can proactively message known Weixin users through this channel."},weixinAuthPrimaryAccount:{zh:"当前默认账号",en:"Current default account"},weixinAuthConnectedAccounts:{zh:"已连接账号",en:"Connected accounts"},weixinAuthBaseUrl:{zh:"当前接口地址",en:"Current API base URL"},weixinAuthConnect:{zh:"扫码连接微信",en:"Scan QR to connect Weixin"},weixinAuthReconnect:{zh:"重新扫码连接",en:"Reconnect with QR"},weixinAuthStarting:{zh:"正在生成二维码...",en:"Generating QR code..."},weixinAuthWaiting:{zh:"等待扫码确认",en:"Waiting for scan confirmation"},weixinAuthScanned:{zh:"已扫码,等待确认",en:"Scanned, waiting for confirmation"},weixinAuthAuthorized:{zh:"已连接",en:"Connected"},weixinAuthNotConnected:{zh:"未连接",en:"Not connected"},weixinAuthRetryRequired:{zh:"二维码已失效,请重新扫码。",en:"QR session expired. Please start again."},weixinAuthQrAlt:{zh:"微信登录二维码",en:"Weixin login QR code"},weixinAuthScanPrompt:{zh:"请用微信扫码,并在手机上确认登录。",en:"Scan with Weixin and confirm the login on your phone."},weixinAuthExpiresAt:{zh:"二维码过期时间",en:"QR expires at"},weixinAuthOpenQr:{zh:"新窗口打开二维码",en:"Open QR code in new tab"},weixinAuthReadyTitle:{zh:"准备连接微信",en:"Ready to connect Weixin"},weixinAuthReadyDescription:{zh:"点击左侧按钮后,这里会显示二维码。整个首配流程默认不需要手动填写底层参数。",en:"After you start the flow, the QR code will appear here. Most first-time setups do not require filling low-level fields manually."},weixinAuthAdvancedTitle:{zh:"高级设置",en:"Advanced settings"},weixinAuthAdvancedDescription:{zh:"仅在你需要自定义接口地址、账号映射或白名单时再展开这些字段。",en:"Expand these fields only when you need to customize the API base URL, account mapping, or allowlist."}},Xn={chatPageTitle:{zh:"Agent 对话",en:"Agent Chat"},chatPageDescription:{zh:"在 UI 内直接与 Agent 交互,支持多会话与多 Agent 切换。",en:"Chat with your agent directly in UI with multi-session and multi-agent switching."},chatRefresh:{zh:"刷新",en:"Refresh"},chatNewSession:{zh:"新会话",en:"New Session"},chatSearchSessionPlaceholder:{zh:"搜索会话 key / 标签",en:"Search session key / label"},chatAgentLabel:{zh:"目标 Agent",en:"Target Agent"},chatSelectAgent:{zh:"选择 Agent",en:"Select Agent"},chatModelLabel:{zh:"对话模型",en:"Chat Model"},chatSelectModel:{zh:"选择模型",en:"Select model"},chatThinkingLevelOff:{zh:"思考关闭",en:"Thinking Off"},chatThinkingLevelMinimal:{zh:"思考 Minimal",en:"Thinking Minimal"},chatThinkingLevelLow:{zh:"思考 Low",en:"Thinking Low"},chatThinkingLevelMedium:{zh:"思考 Medium",en:"Thinking Medium"},chatThinkingLevelHigh:{zh:"思考 High",en:"Thinking High"},chatThinkingLevelAdaptive:{zh:"思考 Adaptive",en:"Thinking Adaptive"},chatThinkingLevelXhigh:{zh:"思考 XHigh",en:"Thinking XHigh"},chatSessionTypeLabel:{zh:"会话类型",en:"Session Type"},chatSessionTypeNative:{zh:"原生",en:"Native"},chatSessionTypeCodex:{zh:"Codex",en:"Codex"},chatSessionTypeClaude:{zh:"Claude Code",en:"Claude Code"},chatSessionTypeUnavailableSuffix:{zh:"当前不可用,请启用对应插件或新建 Native 会话。",en:"is unavailable now. Re-enable the plugin or create a native session."},chatModelNoOptions:{zh:"暂无可用模型,请先配置提供商。",en:"No available models. Configure a provider first."},chatGoConfigureProvider:{zh:"去配置提供商",en:"Go to Providers"},chatProviderSetupTitle:{zh:"开始前先配置提供商",en:"Configure a Provider First"},chatProviderSetupDescription:{zh:"你还没有可用模型。先在提供商页面配置并保存至少一个 Provider 后,再回来开始对话。",en:"No models are available yet. Configure and save at least one provider, then return to start chatting."},chatSessionLabel:{zh:"当前会话",en:"Current Session"},chatNoSession:{zh:"未选择会话",en:"No session selected"},chatNoSessionHint:{zh:"创建一个会话并发送第一条消息。",en:"Create a session and send your first message."},chatHistoryLoading:{zh:"加载会话历史中...",en:"Loading session history..."},chatNoMessages:{zh:"暂无消息,发送一条开始对话。",en:"No messages yet. Send one to start."},chatTyping:{zh:"Agent 正在思考...",en:"Agent is thinking..."},chatInputPlaceholder:{zh:"输入消息,输入 / 选择技能,Enter 发送,Shift + Enter 换行",en:"Type a message, type / to select skills, Enter to send, Shift + Enter for newline"},chatInputHint:{zh:"支持多轮上下文,默认走当前会话。",en:"Multi-turn context is preserved in the current session."},chatSlashSectionCommands:{zh:"命令",en:"Commands"},chatSlashSectionSkills:{zh:"技能",en:"Skills"},chatSlashTypeCommand:{zh:"命令",en:"Command"},chatSlashTypeSkill:{zh:"技能",en:"Skill"},chatSlashSkillSpec:{zh:"标识",en:"Spec"},chatSlashLoading:{zh:"加载命令与技能中…",en:"Loading commands and skills…"},chatSlashNoResult:{zh:"无匹配项",en:"No matches"},chatSlashHint:{zh:"输入 / 触发命令或技能选择",en:"Type / to access commands and skills"},chatSlashCommandHint:{zh:"回车插入命令,继续输入参数后发送。",en:"Press Enter to insert command, then add args and send."},chatSlashSkillHint:{zh:"回车把该技能加入本轮请求。",en:"Press Enter to add this skill for the next turn."},chatSend:{zh:"发送",en:"Send"},chatStop:{zh:"停止",en:"Stop"},chatStopPreparing:{zh:"正在建立可停止会话,请稍候…",en:"Preparing stoppable run…"},chatStopUnavailable:{zh:"当前后端引擎不支持手动停止。",en:"Manual stop is not supported by the current backend engine."},chatSending:{zh:"发送中...",en:"Sending..."},chatQueueSend:{zh:"排队发送",en:"Queue"},chatQueuedHintPrefix:{zh:"当前有",en:"Queued"},chatQueuedHintSuffix:{zh:"条消息待发送。",en:"pending messages."},chatQueueMoveFirst:{zh:"置顶到下一条",en:"Move to Next"},chatDeleteSession:{zh:"删除会话",en:"Delete Session"},chatDeleteSessionConfirm:{zh:"确认删除当前会话?",en:"Delete the current session?"},chatSendFailed:{zh:"发送消息失败",en:"Failed to send message"},chatRoleUser:{zh:"你",en:"You"},chatRoleAssistant:{zh:"助手",en:"Assistant"},chatRoleTool:{zh:"工具",en:"Tool"},chatRoleSystem:{zh:"系统",en:"System"},chatRoleMessage:{zh:"消息",en:"Message"},chatToolCall:{zh:"工具调用",en:"Tool Call"},chatToolResult:{zh:"工具结果",en:"Tool Result"},chatToolWorkflow:{zh:"工具工作流",en:"Tool Workflow"},chatToolWorkflowDetails:{zh:"展开查看参数和结果",en:"Expand to view params and results"},chatToolOutput:{zh:"查看输出",en:"View Output"},chatToolNoOutput:{zh:"无输出(执行完成)",en:"No output (completed)"},chatReasoning:{zh:"推理过程",en:"Reasoning"},chatImageAttachment:{zh:"图片附件",en:"Image attachment"},chatFileAttachment:{zh:"文件附件",en:"File attachment"},chatUnknownPart:{zh:"未知消息片段",en:"Unknown message part"},chatCodeCopy:{zh:"复制代码",en:"Copy"},chatCodeCopied:{zh:"已复制",en:"Copied"},chatSidebarNewTask:{zh:"新任务",en:"New Task"},chatSidebarSearchPlaceholder:{zh:"搜索对话...",en:"Search conversations..."},chatSidebarScheduledTasks:{zh:"定时任务",en:"Scheduled Tasks"},chatSidebarSkills:{zh:"技能",en:"Skills"},chatSidebarTaskRecords:{zh:"会话记录",en:"Sessions"},chatSidebarToday:{zh:"今天",en:"Today"},chatSidebarYesterday:{zh:"昨天",en:"Yesterday"},chatSidebarPrevious7Days:{zh:"近 7 天",en:"Previous 7 Days"},chatSidebarOlder:{zh:"更早",en:"Older"},chatWelcomeTitle:{zh:"你好,有什么可以帮你的吗?",en:"Hello, how can I help you?"},chatWelcomeSubtitle:{zh:"开始一个新任务或选择已有对话",en:"Start a new task or select an existing conversation"},chatWelcomeCapability1Title:{zh:"智能对话",en:"Smart Conversations"},chatWelcomeCapability1Desc:{zh:"多轮上下文对话,支持多种 AI 模型",en:"Multi-turn context conversations with multiple AI models"},chatWelcomeCapability2Title:{zh:"技能扩展",en:"Skill Extensions"},chatWelcomeCapability2Desc:{zh:"通过安装技能扩展 Agent 能力",en:"Extend Agent capabilities by installing skills"},chatWelcomeCapability3Title:{zh:"定时任务",en:"Scheduled Tasks"},chatWelcomeCapability3Desc:{zh:"设置定时执行的自动化任务",en:"Set up scheduled automated tasks"},chatSkillsPickerTitle:{zh:"技能",en:"Skills"},chatSkillsPickerEmpty:{zh:"暂无已安装技能",en:"No skills installed"},chatSkillsPickerSearchPlaceholder:{zh:"搜索技能",en:"Search skills"},chatSkillsPickerNoDescription:{zh:"暂无描述",en:"No description"},chatSkillsPickerOfficial:{zh:"官方",en:"Official"},chatSkillsPickerManage:{zh:"管理技能",en:"Manage Skills"},chatInputAttach:{zh:"添加附件",en:"Attach file"},chatInputImageUnsupported:{zh:"当前仅支持 PNG、JPEG、WEBP、GIF 图片。",en:"Only PNG, JPEG, WEBP, and GIF images are supported."},chatInputImageTooLarge:{zh:"图片不能超过 {maxMb} MB。",en:"Images must be {maxMb} MB or smaller."},chatInputImageReadFailed:{zh:"读取图片失败,请重试。",en:"Failed to read the image. Please try again."},chatInputAttachComingSoon:{zh:"即将支持",en:"Coming soon"}},Zn={marketplacePluginsPageTitle:{zh:"插件市场",en:"Plugin Marketplace"},marketplacePluginsPageDescription:{zh:"安装、启用与管理插件。",en:"Install, enable, and manage plugins."},marketplaceSkillsPageTitle:{zh:"技能市场",en:"Skill Marketplace"},marketplaceSkillsPageDescription:{zh:"安装与管理技能。",en:"Install and manage skills."},marketplaceMcpPageTitle:{zh:"MCP 市场",en:"MCP Marketplace"},marketplaceMcpPageDescription:{zh:"发现、安装、诊断并管理 MCP servers。",en:"Discover, install, diagnose, and manage MCP servers."},marketplaceTabMarketplacePlugins:{zh:"插件市场",en:"Plugin Market"},marketplaceTabMarketplaceSkills:{zh:"技能市场",en:"Skill Market"},marketplaceMcpTabCatalog:{zh:"MCP 市场",en:"MCP Market"},marketplaceMcpTabInstalled:{zh:"已安装 MCP",en:"Installed MCP"},marketplaceTabInstalledPlugins:{zh:"已安装插件",en:"Installed Plugins"},marketplaceTabInstalledSkills:{zh:"已安装技能",en:"Installed Skills"},marketplaceSearchPlaceholderPlugins:{zh:"搜索插件...",en:"Search plugins..."},marketplaceSearchPlaceholderSkills:{zh:"搜索技能...",en:"Search skills..."},marketplaceMcpSearchPlaceholder:{zh:"搜索 MCP servers...",en:"Search MCP servers..."},marketplaceFilterPlugins:{zh:"插件",en:"Plugins"},marketplaceFilterSkills:{zh:"技能",en:"Skills"},marketplaceFilterMcp:{zh:"MCP",en:"MCP"},marketplaceSortRelevance:{zh:"相关性",en:"Relevance"},marketplaceSortUpdated:{zh:"最近更新",en:"Recently Updated"},marketplaceUnknownItem:{zh:"未知项目",en:"Unknown Item"},marketplaceInstalledLocalSummary:{zh:"已在本地安装,市场暂无详情。",en:"Installed locally. Details are currently unavailable from marketplace."},marketplaceTypePlugin:{zh:"插件",en:"Plugin"},marketplaceTypeSkill:{zh:"技能",en:"Skill"},marketplaceTypeMcp:{zh:"MCP",en:"MCP"},marketplaceTypeExtension:{zh:"扩展",en:"Extension"},marketplaceInstall:{zh:"安装",en:"Install"},marketplaceInstalling:{zh:"安装中...",en:"Installing..."},marketplaceEnable:{zh:"启用",en:"Enable"},marketplaceDisable:{zh:"禁用",en:"Disable"},marketplaceEnabling:{zh:"启用中...",en:"Enabling..."},marketplaceDisabling:{zh:"禁用中...",en:"Disabling..."},marketplaceUninstall:{zh:"卸载",en:"Uninstall"},marketplaceRemoving:{zh:"卸载中...",en:"Removing..."},marketplaceSectionPlugins:{zh:"插件列表",en:"Plugin Catalog"},marketplaceSectionSkills:{zh:"技能列表",en:"Skill Catalog"},marketplaceMcpSectionCatalog:{zh:"MCP 列表",en:"MCP Catalog"},marketplaceMcpSectionInstalled:{zh:"已安装 MCP",en:"Installed MCP"},marketplaceSectionInstalledPlugins:{zh:"已安装插件",en:"Installed Plugins"},marketplaceSectionInstalledSkills:{zh:"已安装技能",en:"Installed Skills"},marketplaceErrorLoadingPluginsData:{zh:"加载插件市场数据失败",en:"Failed to load plugin marketplace data"},marketplaceErrorLoadingSkillsData:{zh:"加载技能市场数据失败",en:"Failed to load skill marketplace data"},marketplaceErrorLoadingInstalledPlugins:{zh:"加载已安装插件失败",en:"Failed to load installed plugins"},marketplaceErrorLoadingInstalledSkills:{zh:"加载已安装技能失败",en:"Failed to load installed skills"},marketplaceNoPlugins:{zh:"未找到插件。",en:"No plugins found."},marketplaceNoSkills:{zh:"未找到技能。",en:"No skills found."},marketplaceNoMcp:{zh:"未找到 MCP server。",en:"No MCP servers found."},marketplaceNoInstalledPlugins:{zh:"未找到已安装插件。",en:"No installed plugins found."},marketplaceNoInstalledSkills:{zh:"未找到已安装技能。",en:"No installed skills found."},marketplaceNoInstalledMcp:{zh:"未找到已安装 MCP server。",en:"No installed MCP servers found."},marketplaceUninstallTitle:{zh:"确认卸载",en:"Uninstall"},marketplaceUninstallDescription:{zh:"该操作会移除扩展,后续可在市场中重新安装。",en:"This will remove the extension. You can install it again from the marketplace."},marketplaceInstallSuccessPlugin:{zh:"插件安装成功",en:"Plugin installed successfully"},marketplaceInstallSuccessSkill:{zh:"技能安装成功",en:"Skill installed successfully"},marketplaceInstallSuccessMcp:{zh:"MCP 安装成功",en:"MCP installed successfully"},marketplaceEnableSuccess:{zh:"启用成功",en:"Enabled successfully"},marketplaceDisableSuccess:{zh:"禁用成功",en:"Disabled successfully"},marketplaceUninstallSuccess:{zh:"卸载成功",en:"Uninstalled successfully"},marketplaceMcpManageSuccess:{zh:"MCP 操作成功",en:"MCP operation completed"},marketplaceInstallFailed:{zh:"安装失败",en:"Install failed"},marketplaceOperationFailed:{zh:"操作失败",en:"Operation failed"},marketplaceInstalledPluginsCountSuffix:{zh:"个已安装插件",en:"installed plugins"},marketplaceInstalledSkillsCountSuffix:{zh:"个已安装技能",en:"installed skills"},marketplaceDetailPanelTitle:{zh:"详情预览",en:"Detail Preview"},marketplaceDetailPanelEmpty:{zh:"点击左侧任意插件/技能,在这里查看详情。",en:"Click an item on the left to preview details here."},marketplaceDetailSummary:{zh:"摘要",en:"Summary"},marketplaceDetailDescription:{zh:"描述",en:"Description"},marketplaceOpenInDocBrowserTab:{zh:"新标签打开",en:"Open in New Tab"},marketplaceMcpInstallDialogTitle:{zh:"安装 MCP Server",en:"Install MCP Server"},marketplaceMcpServerName:{zh:"Server 名称",en:"Server Name"},marketplaceMcpAllAgents:{zh:"默认对全部 Agent 可用",en:"Available to All Agents"},marketplaceMcpAllAgentsDescription:{zh:"默认作为公共资源池接入,不做 runtime 级限制。",en:"Use the server as a shared tool source by default instead of scoping it per runtime."},marketplaceMcpDoctor:{zh:"Doctor",en:"Doctor"},marketplaceMcpDoctorTitle:{zh:"MCP Doctor",en:"MCP Doctor"},marketplaceMcpDoctorAccessible:{zh:"可访问",en:"Accessible"},marketplaceMcpDoctorTransport:{zh:"传输方式",en:"Transport"},marketplaceMcpDoctorTools:{zh:"工具数",en:"Tools"},marketplaceMcpRemove:{zh:"移除",en:"Remove"},marketplaceMcpRemoveTitle:{zh:"确认移除",en:"Remove MCP Server"},marketplaceMcpRemoveDescription:{zh:"该操作会删除 MCP server 配置,并通过热插拔立即从工具源中移除。",en:"This removes the MCP server config and hot-unplugs it from the tool source immediately."}},es={remotePageTitle:{zh:"远程访问",en:"Remote Access"},remotePageDescription:{zh:"让这台设备出现在 NextClaw Platform 的设备列表里,并从网页中打开它。",en:"Make this device appear in your NextClaw Platform device list and open it from the web."},remoteOpenWeb:{zh:"前往 NextClaw Web",en:"Open NextClaw Web"},remoteOpenDeviceList:{zh:"查看我的设备",en:"View My Devices"},remoteOpenWebHint:{zh:"开启后,这台设备会出现在 NextClaw Web 中,你可以在那里点击打开并继续使用。",en:"Once enabled, this device appears in NextClaw Web, where you can open it and keep working."},remoteOpenWebUnavailable:{zh:"暂时还没有可用的平台地址,请先完成登录。",en:"No platform URL is available yet. Sign in first."},remoteLoading:{zh:"正在加载远程访问状态...",en:"Loading remote access status..."},remoteStatusNeedsSignIn:{zh:"先登录 NextClaw",en:"Sign in to NextClaw first"},remoteStatusNeedsSignInDescription:{zh:"远程访问依赖 NextClaw 账号。登录后,这台设备才能和网页版关联起来。",en:"Remote access depends on your NextClaw account. Sign in first to link this device to the web app."},remoteStatusNeedsEnable:{zh:"还没有开启远程访问",en:"Remote access is not enabled yet"},remoteStatusNeedsEnableDescription:{zh:"你已经登录 NextClaw。开启后,这台设备会出现在网页版的设备列表中。",en:"You are already signed in. Enable remote access and this device will appear in your web device list."},remoteStatusConnectingTitle:{zh:"正在把这台设备接入 NextClaw Web",en:"Connecting this device to NextClaw Web"},remoteStatusConnectingDescription:{zh:"后台服务正在建立连接,几秒后刷新即可看到最新状态。",en:"The managed service is establishing the connection. Refresh in a few seconds to see the latest state."},remoteStatusReadyTitle:{zh:"这台设备已经可在网页中打开",en:"This device is ready in the web app"},remoteStatusReadyDescription:{zh:"你现在可以前往 NextClaw Web,在设备列表中点击打开,继续这条 Agent 链路。",en:"You can now open NextClaw Web, find this device in the list, and continue your agent workflow there."},remoteStatusNeedsServiceTitle:{zh:"需要拉起后台服务",en:"The managed service needs to run"},remoteStatusNeedsServiceDescription:{zh:"远程访问已经开启,但后台服务没有运行。拉起后才会真正连到网页版。",en:"Remote access is enabled, but the managed service is not running yet. Start it to connect to the web app."},remoteStatusReauthorizationTitle:{zh:"登录已过期,请重新登录 NextClaw",en:"Your sign-in expired. Sign in to NextClaw again."},remoteStatusReauthorizationDescription:{zh:"为了保护你的账号安全,远程访问已暂停。重新登录后会自动恢复,不需要重新配置设备。",en:"Remote access is paused to protect your account. Sign in again and it will recover automatically without reconfiguring this device."},remoteStatusIssueTitle:{zh:"远程访问暂时没有连上",en:"Remote access is temporarily offline"},remoteStatusIssueDescription:{zh:"设备配置还在,但当前没有稳定连上平台。你可以先重新连接;如果问题持续,再重新登录或稍后再试。",en:"Your device settings are still there, but this device is not stably connected to the platform right now. Reconnect first, then sign in again or try later if it keeps happening."},remoteStatusIssueDetailTitle:{zh:"下一步",en:"Next Step"},remoteStatusRecoveryTitle:{zh:"推荐操作",en:"Recommended Next Step"},remoteStatusIssueDetailGeneric:{zh:"远程访问暂时不可用。你可以先重新连接;如果问题持续,再重新登录或稍后再试。",en:"Remote access is temporarily unavailable. Reconnect first, then sign in again or try later if the issue continues."},remoteStatusIssueDetailServiceStopped:{zh:"后台服务当前没有运行。启动后,这台设备才会重新出现在网页版设备列表里。",en:"The managed service is not running right now. Start it so this device can show up in the web device list again."},remoteStatusReauthorizationHint:{zh:"点击下方按钮后会打开登录页。完成登录后,这台设备会自动恢复远程访问,不需要重新配置。",en:"Use the button below to open the sign-in page. Once you finish signing in, this device will recover remote access automatically."},remoteSignInAndEnable:{zh:"登录并开启远程访问",en:"Sign In and Enable Remote Access"},remoteEnableNow:{zh:"开启远程访问",en:"Enable Remote Access"},remoteReconnectNow:{zh:"重新连接",en:"Reconnect"},remoteReauthorizeNow:{zh:"重新登录并恢复远程访问",en:"Sign In Again and Restore Remote Access"},remoteDisable:{zh:"关闭远程访问",en:"Disable Remote Access"},remoteDeviceSummaryTitle:{zh:"当前设备",en:"This Device"},remoteDeviceSummaryDescription:{zh:"普通用户只需要关心账号、设备名、连接状态和网页版入口。",en:"Users only need the account, device name, connection state, and web entry."},remoteSignedInAccount:{zh:"当前账号",en:"Signed-in Account"},remoteConnectionStatus:{zh:"连接状态",en:"Connection Status"},remoteAdvancedTitle:{zh:"高级设置",en:"Advanced Settings"},remoteAdvancedDescription:{zh:"只有在排查或自定义平台地址时,才需要打开这一层。",en:"Only open this section when you need diagnostics or a custom platform API base."},remoteAdvancedToggleOpen:{zh:"展开高级设置",en:"Show Advanced Settings"},remoteAdvancedToggleClose:{zh:"收起高级设置",en:"Hide Advanced Settings"},remoteAdvancedSaved:{zh:"高级设置已保存",en:"Advanced settings saved"},remoteEnabledReady:{zh:"远程访问已开启,现在可以前往 NextClaw Web 使用",en:"Remote access is enabled. You can now use NextClaw Web."},remoteDisabledDone:{zh:"远程访问已关闭",en:"Remote access is disabled"},remoteServiceRecovered:{zh:"后台服务已重新接上远程访问",en:"The managed service is connected again"},remoteActionEnabling:{zh:"正在开启远程访问...",en:"Enabling remote access..."},remoteActionDisabling:{zh:"正在关闭远程访问...",en:"Disabling remote access..."},remoteActionSavingAdvanced:{zh:"正在保存高级设置...",en:"Saving advanced settings..."},remoteActionStarting:{zh:"正在启动后台服务...",en:"Starting the managed service..."},remoteActionRestarting:{zh:"正在重启后台服务...",en:"Restarting the managed service..."},remoteActionStopping:{zh:"正在停止后台服务...",en:"Stopping the managed service..."},remoteAccountEntryTitle:{zh:"NextClaw 账号",en:"NextClaw Account"},remoteAccountEntryDisconnected:{zh:"未登录,点击连接",en:"Not signed in. Click to connect."},remoteAccountEntryConnected:{zh:"已连接到 NextClaw",en:"Connected to NextClaw"},remoteAccountEntryManage:{zh:"账号",en:"Account"},accountPanelTitle:{zh:"NextClaw 账号",en:"NextClaw Account"},accountPanelDescription:{zh:"远程访问依赖这个账号登录。后续 token、授权和更多云端能力也会基于它展开。",en:"Remote access depends on this account. Tokens, authorization, and future cloud capabilities will build on it."},accountPanelSignedInTitle:{zh:"账号已连接",en:"Account Connected"},accountPanelSignedInDescription:{zh:"这台设备已经和你的 NextClaw 账号关联,可以直接去网页版查看设备。",en:"This device is linked to your NextClaw account. You can go to the web app and open the device there."},accountPanelSignedOutTitle:{zh:"通过浏览器完成登录",en:"Continue Sign-In in Your Browser"},accountPanelSignedOutDescription:{zh:"点击下方按钮后会打开 NextClaw 网页,在网页中登录或注册,当前设备会自动接入。",en:"Click the button below to open NextClaw Web, sign in or create an account there, and this device will attach automatically."},remoteOverviewTitle:{zh:"连接总览",en:"Connection Overview"},remoteOverviewDescription:{zh:"只保留普通用户真正需要知道的信息。",en:"Keep only the information ordinary users actually need."},remoteAccountConnected:{zh:"平台已登录",en:"Platform Connected"},remoteAccountNotConnected:{zh:"平台未登录",en:"Platform Not Connected"},remoteRuntimeMissing:{zh:"连接器未运行",en:"Connector Not Running"},remoteStateConnected:{zh:"已连接",en:"Connected"},remoteStateConnecting:{zh:"连接中",en:"Connecting"},remoteStateError:{zh:"连接异常",en:"Error"},remoteStateDisconnected:{zh:"已断开",en:"Disconnected"},remoteStateDisabled:{zh:"未启用",en:"Disabled"},remoteStateReauthorizationRequired:{zh:"需要重新登录",en:"Sign-In Required"},remoteLocalOrigin:{zh:"本地服务地址",en:"Local Origin"},remotePublicPlatform:{zh:"平台地址",en:"Platform Base"},remoteDeviceId:{zh:"设备 ID",en:"Device ID"},remoteRuntimeUpdatedAt:{zh:"状态更新时间",en:"Status Updated At"},remoteLastConnectedAt:{zh:"上次连接时间",en:"Last Connected At"},remoteLastError:{zh:"最近错误",en:"Last Error"},remoteDeviceTitle:{zh:"设备配置",en:"Device Settings"},remoteDeviceDescription:{zh:"保存远程访问开关、设备名和平台 API Base。",en:"Save remote access state, device name, and platform API base."},remoteDeviceSectionTitle:{zh:"设备信息",en:"Device Info"},remoteDeviceSectionDescription:{zh:"开启之后,这台设备会在平台网页的设备列表中出现。",en:"Once enabled, this device will appear in the platform web device list."},remoteDeviceNameAuto:{zh:"未命名设备",en:"Unnamed Device"},remoteEnabled:{zh:"启用远程访问",en:"Enable Remote Access"},remoteEnabledHelp:{zh:"保存后需要启动或重启后台服务,新的远程配置才会真正生效。",en:"After saving, start or restart the managed service to apply the new remote configuration."},remoteDeviceName:{zh:"设备名称",en:"Device Name"},remoteDeviceNamePlaceholder:{zh:"例如:PeideMacBook-Pro",en:"For example: PeideMacBook-Pro"},remotePlatformApiBase:{zh:"平台 API Base",en:"Platform API Base"},remotePlatformApiBaseHelp:{zh:"留空可回退到登录时写入的 providers.nextclaw.apiBase。",en:"Leave empty to fall back to providers.nextclaw.apiBase saved at login time."},remoteSaveSettings:{zh:"保存设置",en:"Save Settings"},remoteSettingsSaved:{zh:"远程设置已保存",en:"Remote settings saved"},remoteSettingsSaveFailed:{zh:"远程设置保存失败",en:"Failed to save remote settings"},remoteSaveHint:{zh:"推荐流程:先保存设置,再启动或重启服务,最后运行诊断确认。",en:"Recommended flow: save settings, start or restart the service, then run diagnostics."},remoteAccountTitle:{zh:"平台账号",en:"Platform Account"},remoteAccountDescription:{zh:"通过浏览器授权把当前设备安全连接到 NextClaw 平台。",en:"Authorize this device in your browser and connect it to the NextClaw platform."},remoteAccountEmail:{zh:"邮箱",en:"Email"},remoteAccountRole:{zh:"角色",en:"Role"},remoteApiBase:{zh:"API Base",en:"API Base"},remoteBrowserAuthTitle:{zh:"浏览器授权登录",en:"Browser Authorization"},remoteBrowserAuthDescription:{zh:"点击后会打开平台授权页,在浏览器内登录或注册并授权当前设备。",en:"Open the platform authorization page in your browser, then sign in or create an account there."},remoteBrowserAuthAction:{zh:"前往浏览器授权",en:"Continue in Browser"},remoteBrowserAuthActionRetry:{zh:"重新发起浏览器登录",en:"Restart Browser Sign-In"},remoteBrowserAuthResume:{zh:"重新打开授权页",en:"Reopen Authorization Page"},remoteBrowserAuthStarting:{zh:"正在创建授权会话...",en:"Starting authorization..."},remoteBrowserAuthAuthorizing:{zh:"等待浏览器完成授权...",en:"Waiting for browser authorization..."},remoteBrowserAuthWaiting:{zh:"浏览器授权页已打开。请在网页中完成登录或注册,然后此页面会自动接入。",en:"The authorization page is open. Complete sign in or registration there and this page will connect automatically."},remoteBrowserAuthCompleted:{zh:"浏览器授权完成,正在刷新登录状态。",en:"Authorization completed. Refreshing account status."},remoteBrowserAuthExpired:{zh:"授权会话已过期,请重新发起。",en:"Authorization session expired. Start again."},remoteBrowserAuthPopupBlocked:{zh:"浏览器没有自动打开,请点击“重新打开授权页”。",en:'Your browser did not open automatically. Use "Reopen Authorization Page".'},remoteBrowserAuthSession:{zh:"授权会话",en:"Auth Session"},remoteBrowserAuthExpiresAt:{zh:"授权过期时间",en:"Auth Expires At"},remoteBrowserAuthHint:{zh:"如果你刚修改了上方 Platform API Base,建议先保存设置;未保存时当前页面也会沿用你输入的新地址发起授权。",en:"If you just changed the Platform API Base above, saving settings is recommended. This page will still use the current value for browser authorization."},remoteBrowserAuthStartFailed:{zh:"启动浏览器授权失败",en:"Failed to start browser authorization"},remoteBrowserAuthPollFailed:{zh:"浏览器授权状态检查失败",en:"Failed to check browser authorization status"},remoteEmail:{zh:"邮箱",en:"Email"},remotePassword:{zh:"密码",en:"Password"},remotePasswordPlaceholder:{zh:"请输入你的平台密码",en:"Enter your platform password"},remoteRegisterIfNeeded:{zh:"首次验证自动创建账号",en:"Auto-create on First Verification"},remoteRegisterIfNeededHelp:{zh:"如果邮箱还没有对应账号,平台会在验证码验证成功后自动创建账号并保存登录态。",en:"When enabled, the UI will sign in on the platform and then save the resulting login token."},remoteLogin:{zh:"登录平台",en:"Login to Platform"},remoteCreateAccount:{zh:"注册并登录",en:"Create Account & Login"},remoteLoggingIn:{zh:"登录中...",en:"Logging in..."},remoteLoginSuccess:{zh:"平台登录成功",en:"Platform login succeeded"},remoteLoginFailed:{zh:"平台登录失败",en:"Platform login failed"},remoteLogout:{zh:"退出登录",en:"Logout"},remoteLoggingOut:{zh:"退出中...",en:"Logging out..."},remoteLogoutSuccess:{zh:"已退出平台登录",en:"Logged out from platform"},remoteLogoutFailed:{zh:"退出登录失败",en:"Failed to logout"},remoteServiceTitle:{zh:"后台服务",en:"Managed Service"},remoteServiceDescription:{zh:"直接控制托管当前 UI 的后台服务。",en:"Directly control the managed service that hosts the current UI."},remoteServiceRunning:{zh:"服务运行中",en:"Service Running"},remoteServiceManagedRunning:{zh:"当前就是托管服务",en:"Current Managed Service"},remoteServiceStopped:{zh:"服务未运行",en:"Service Stopped"},remoteServicePid:{zh:"进程 PID",en:"Process PID"},remoteServiceUiUrl:{zh:"UI 地址",en:"UI URL"},remoteServiceCurrentProcess:{zh:"当前页面是否由该服务提供",en:"Current Page Served By It"},remoteStartService:{zh:"启动服务",en:"Start Service"},remoteRestartService:{zh:"重启服务",en:"Restart Service"},remoteStopService:{zh:"停止服务",en:"Stop Service"},remoteServiceHint:{zh:"如果当前页面本身就是托管服务,停止或重启时页面会短暂断开,这是预期行为。",en:"If this page is served by the managed service itself, stop/restart may briefly disconnect the page."},remoteServiceActionFailed:{zh:"服务操作失败",en:"Service action failed"},remoteDoctorTitle:{zh:"远程诊断",en:"Remote Diagnostics"},remoteDoctorDescription:{zh:"检查开关、平台登录、本地 UI 健康和连接器状态。",en:"Check config state, platform login, local UI health, and connector status."},remoteRunDoctor:{zh:"运行诊断",en:"Run Diagnostics"},remoteDoctorRunning:{zh:"诊断中...",en:"Running diagnostics..."},remoteDoctorCompleted:{zh:"诊断完成",en:"Diagnostics completed"},remoteDoctorFailed:{zh:"诊断失败",en:"Diagnostics failed"},remoteDoctorGeneratedAt:{zh:"生成时间",en:"Generated At"},remoteDoctorEmpty:{zh:"点击上方按钮运行一次诊断。",en:"Run diagnostics to see the latest checks here."},remoteCheckPassed:{zh:"通过",en:"Passed"},remoteCheckFailed:{zh:"失败",en:"Failed"},connected:{zh:"已连接",en:"Connected"},disconnected:{zh:"未连接",en:"Disconnected"},connecting:{zh:"连接中...",en:"Connecting..."},feishuConnecting:{zh:"验证 / 连接中...",en:"Verifying / connecting..."},statusReady:{zh:"就绪",en:"Ready"},statusSetup:{zh:"待配置",en:"Setup"},statusActive:{zh:"活跃",en:"Active"},statusInactive:{zh:"未启用",en:"Inactive"}},lt="nextclaw.ui.language",Ne=[{value:"en",label:"English"},{value:"zh",label:"中文"}],ts={en:"en-US",zh:"zh-CN"};let G="en",me=!1;const pe=new Set;function ns(e){return e==="en"||e==="zh"}function ss(){var t;return typeof navigator>"u"?"en":(((t=navigator.language)==null?void 0:t.toLowerCase())??"en").startsWith("zh")?"zh":"en"}function as(){if(typeof window>"u")return"en";try{const e=window.localStorage.getItem(lt);if(ns(e))return e}catch{}return ss()}function xe(){return me||(G=as(),me=!0),G}function _(){return me?G:xe()}function rs(e){if(xe(),G!==e){if(G=e,typeof window<"u")try{window.localStorage.setItem(lt,e)}catch{}pe.forEach(t=>t(e))}}function os(e){return pe.add(e),()=>{pe.delete(e)}}function be(e=_()){return ts[e]}function dt(e,t=_()){if(!e)return"-";const n=e instanceof Date?e:new Date(e);return Number.isNaN(n.getTime())?typeof e=="string"?e:"-":n.toLocaleString(be(t))}function tr(e,t=_()){if(!e)return"-";const n=e instanceof Date?e:new Date(e);return Number.isNaN(n.getTime())?typeof e=="string"?e:"-":new Intl.DateTimeFormat(be(t),{year:"numeric",month:"2-digit",day:"2-digit"}).format(n)}function nr(e,t=_()){return new Intl.NumberFormat(be(t)).format(e)}const Me={chat:{zh:"对话",en:"Chat"},model:{zh:"模型",en:"Model"},searchChannels:{zh:"搜索渠道",en:"Search Channels"},providers:{zh:"提供商",en:"Providers"},channels:{zh:"渠道",en:"Channels"},cron:{zh:"定时任务",en:"Cron Jobs"},secrets:{zh:"密钥管理",en:"Secrets"},runtime:{zh:"路由与运行时",en:"Routing & Runtime"},remote:{zh:"远程访问",en:"Remote Access"},marketplace:{zh:"市场",en:"Marketplace"},advanced:{zh:"高级",en:"Advanced"},settings:{zh:"设置",en:"Settings"},security:{zh:"安全",en:"Security"},backToMain:{zh:"返回主界面",en:"Back to Main"},enabled:{zh:"启用",en:"Enabled"},disabled:{zh:"禁用",en:"Disabled"},save:{zh:"保存",en:"Save"},cancel:{zh:"取消",en:"Cancel"},delete:{zh:"删除",en:"Delete"},add:{zh:"添加",en:"Add"},edit:{zh:"编辑",en:"Edit"},loading:{zh:"加载中...",en:"Loading..."},success:{zh:"成功",en:"Success"},error:{zh:"错误",en:"Error"},confirm:{zh:"确认",en:"Confirm"},unchanged:{zh:"未修改",en:"Unchanged"},saving:{zh:"保存中...",en:"Saving..."},remove:{zh:"移除",en:"Remove"},all:{zh:"全部",en:"All"},yes:{zh:"是",en:"Yes"},no:{zh:"否",en:"No"},prev:{zh:"上一页",en:"Prev"},next:{zh:"下一页",en:"Next"},noneOption:{zh:"无",en:"None"},language:{zh:"语言",en:"Language"},theme:{zh:"主题",en:"Theme"},themeWarm:{zh:"暖色",en:"Warm"},themeCool:{zh:"冷色",en:"Cool"},isRequired:{zh:"必填",en:"is required"},duplicate:{zh:"重复",en:"duplicate"},notFound:{zh:"未找到",en:"not found"},modelPageTitle:{zh:"模型配置",en:"Model Configuration"},modelPageDescription:{zh:"配置默认 AI 模型选择",en:"Configure default AI model selection"},defaultModel:{zh:"默认模型",en:"Default Model"},workspace:{zh:"工作空间",en:"Workspace"},modelName:{zh:"模型",en:"Model"},modelPickerNoOptions:{zh:"暂无可选模型",en:"No model options available"},modelPickerUseCustom:{zh:"使用自定义模型:{value}",en:"Use custom model: {value}"},modelInputCustomHint:{zh:"如果列表里没有目标模型,可直接输入自定义模型 ID。",en:"If the model is not listed, type a custom model ID directly."},modelIdentifierHelp:{zh:"Agent 默认模型标识,使用带 provider 前缀的格式。例如:openai/gpt-5.1、anthropic/claude-opus-4-1、deepseek/deepseek-chat、minimax/MiniMax-M2.5、openrouter/openai/gpt-5.3-codex。",en:"Default model identifier used by the agent. Use provider-prefixed format. Examples: openai/gpt-5.1 · anthropic/claude-opus-4-1 · deepseek/deepseek-chat · minimax/MiniMax-M2.5 · openrouter/openai/gpt-5.3-codex."},maxToolIterations:{zh:"最大工具迭代次数",en:"Max Tool Iterations"},saveChanges:{zh:"保存变更",en:"Save Changes"},searchPageTitle:{zh:"搜索渠道",en:"Search Channels"},searchPageDescription:{zh:"配置网页搜索提供商",en:"Configure web search providers."},searchActiveProvider:{zh:"当前搜索提供商",en:"Active Search Provider"},searchDefaultMaxResults:{zh:"默认返回条数",en:"Default Result Count"},searchProviderSummary:{zh:"结果摘要",en:"Result Summary"},searchProviderFreshness:{zh:"时间范围",en:"Freshness"},searchProviderBaseUrl:{zh:"接口地址",en:"API Base URL"},searchProviderOpenDocs:{zh:"获取博查 API",en:"Get Bocha API"},searchProviderActivate:{zh:"激活",en:"Activate"},searchProviderActivated:{zh:"已激活",en:"Activated"},searchProviderDeactivate:{zh:"取消激活",en:"Deactivate"},searchProviderBochaDescription:{zh:"更适合中国大陆用户的 AI 搜索。",en:"AI-ready search that works better for mainland China users."},searchProviderBraveDescription:{zh:"保留 Brave 作为可选 provider。",en:"Keep Brave as an optional provider."},searchStatusConfigured:{zh:"已配置",en:"Configured"},searchStatusNeedsSetup:{zh:"待配置",en:"Needs Setup"},searchFreshnessNoLimit:{zh:"不限",en:"No Limit"},searchFreshnessOneDay:{zh:"一天内",en:"One Day"},searchFreshnessOneWeek:{zh:"一周内",en:"One Week"},searchFreshnessOneMonth:{zh:"一个月内",en:"One Month"},searchFreshnessOneYear:{zh:"一年内",en:"One Year"},searchNoProviderSelected:{zh:"请选择左侧搜索 provider",en:"Select a search provider from the left."},providersPageTitle:{zh:"AI 提供商",en:"AI Providers"},providersPageDescription:{zh:"在一个页面内完成提供商切换、配置与保存。",en:"Switch, configure, and save providers in one continuous workspace."},providersLoading:{zh:"加载中...",en:"Loading..."},providersTabConfigured:{zh:"已配置",en:"Configured"},providersTabAll:{zh:"全部提供商",en:"All Providers"},providersFilterPlaceholder:{zh:"搜索提供商",en:"Search providers"},providersNoMatch:{zh:"没有匹配的提供商",en:"No matching providers"},providerAddCustom:{zh:"新增自定义提供商",en:"Add Custom Provider"},providerDelete:{zh:"删除该提供商",en:"Delete Provider"},providerDeleteConfirm:{zh:"确认删除这个自定义提供商吗?删除后不可恢复。",en:"Delete this custom provider? This action cannot be undone."},providersSelectPlaceholder:{zh:"选择提供商",en:"Select Provider"},providersSelectTitle:{zh:"选择左侧提供商开始配置",en:"Select a provider from the left to configure"},providersSelectDescription:{zh:"你可以连续切换多个提供商并逐个保存配置。",en:"Switch between providers continuously and save each configuration."},providersDefaultDescription:{zh:"为你的 Agent 配置 AI 服务",en:"Configure AI services for your agents"},providersEmptyTitle:{zh:"尚未配置提供商",en:"No providers configured"},providersEmptyDescription:{zh:"添加一个 AI 提供商后即可开始使用。",en:"Add an AI provider to start using the platform."},apiKey:{zh:"API 密钥",en:"API Key"},apiBase:{zh:"API Base URL",en:"API Base URL"},extraHeaders:{zh:"额外请求头",en:"Extra Headers"},wireApi:{zh:"请求接口",en:"Wire API"},wireApiAuto:{zh:"自动(优先 Chat,必要时 Responses)",en:"Auto (Chat with fallback)"},wireApiChat:{zh:"Chat Completions",en:"Chat Completions"},wireApiResponses:{zh:"Responses",en:"Responses"},apiKeySet:{zh:"已设置",en:"Set"},apiKeyNotSet:{zh:"未设置",en:"Not Set"},showKey:{zh:"显示密钥",en:"Show Key"},hideKey:{zh:"隐藏密钥",en:"Hide Key"},providerFormDescription:{zh:"配置 AI 提供商的 API 密钥与参数",en:"Configure API keys and parameters for AI provider"},providerDisplayName:{zh:"自定义名称",en:"Custom Name"},providerDisplayNamePlaceholder:{zh:"例如:中转站 A",en:"For example: Relay A"},providerDisplayNameHelp:{zh:"仅用于界面展示,便于区分多个自定义 Provider。",en:"Display-only label to distinguish multiple custom providers."},enterApiKey:{zh:"请输入 API 密钥",en:"Enter API Key"},providerApiBaseHelp:{zh:"留空或恢复默认即可使用预置 API Base。",en:"Leave empty or reset to use the default API base."},providerApiBaseHelpMinimax:{zh:"MiniMax 中国区请使用 https://api.minimaxi.com/v1;海外请使用 https://api.minimax.io/v1。",en:"Use https://api.minimaxi.com/v1 for Mainland China accounts, and https://api.minimax.io/v1 for overseas accounts."},providerOpenAICompatHint:{zh:"自定义提供商默认按 OpenAI 兼容 API 格式接入(Chat Completions / Responses)。",en:"Custom providers use OpenAI-compatible API format by default (Chat Completions / Responses)."},providerExtraHeadersHelp:{zh:"用于自定义请求头(可选)。",en:"Optional custom request headers."},providerTestConnection:{zh:"测试连接",en:"Test Connection"},providerTestingConnection:{zh:"测试中...",en:"Testing..."},providerTestConnectionSuccess:{zh:"连接测试通过",en:"Connection test passed"},providerTestConnectionFailed:{zh:"连接测试失败",en:"Connection test failed"},providerModelsTitle:{zh:"可用模型列表",en:"Available Models"},providerModelInputPlaceholder:{zh:"输入模型 ID(无需 provider 前缀,不在列表也可)",en:"Enter model id (without provider prefix; custom values allowed)"},providerModelInputHint:{zh:"列表仅作参考,不在列表也可直接输入并添加。",en:"The list is only a reference. You can type and add models that are not listed."},providerAddModel:{zh:"添加模型",en:"Add Model"},providerModelsEmpty:{zh:"当前没有模型,可直接输入并添加。",en:"No models yet. Add one by typing model id."},providerModelDefaultTag:{zh:"默认",en:"Default"},providerModelCustomTag:{zh:"自定义",en:"Custom"},providerModelsHelp:{zh:"系统会先填充预置模型;你可以在这里新增或删除。请填写当前提供商自己的模型 ID(不带当前 provider 前缀);若输入带当前 provider 前缀会自动去除,但会保留后续路径(如 openai/gpt-5)。",en:"Built-in models are prefilled and can be added or removed here. Enter provider-local model ids without the current provider prefix; if prefixed input is entered, only the current provider prefix is removed while the remaining path is preserved (for example, openai/gpt-5)."},providerModelsEmptyShort:{zh:"暂无可用模型",en:"No models available"},providerAddFirstModel:{zh:"添加第一个模型",en:"Add first model"},providerModelThinkingTitle:{zh:"思考档位能力",en:"Thinking Capability"},providerModelThinkingHint:{zh:"为该模型声明可切换的思考档位,聊天会话将按这里的能力展示下拉。",en:"Declare supported thinking levels for this model. Chat sessions will show the selector accordingly."},providerModelThinkingDefault:{zh:"默认思考档位",en:"Default Thinking Level"},providerModelThinkingDefaultNone:{zh:"无默认(回落 off)",en:"No default (fallback off)"},providerModelThinkingNoSupported:{zh:"请先至少选择一个支持档位。",en:"Select at least one supported level first."},providerDisplayNameHelpShort:{zh:"便于区分多个自定义提供商",en:"Helps distinguish multiple custom providers"},providerApiBaseHelpShort:{zh:"一般只需填写域名,系统自动补全路径",en:"Usually just the domain; path auto-appended"},providerExtraHeadersHelpShort:{zh:"可选,用于自定义鉴权等场景",en:"Optional, for custom auth etc."},providerAdvancedSettings:{zh:"高级设置",en:"Advanced Settings"},providerAuthSectionTitle:{zh:"提供商授权",en:"Provider Authorization"},providerAuthStarting:{zh:"启动中...",en:"Starting..."},providerAuthAuthorizing:{zh:"授权中...",en:"Authorizing..."},providerAuthAuthorizeInBrowser:{zh:"浏览器授权",en:"Authorize in Browser"},providerAuthWaitingBrowser:{zh:"等待浏览器完成授权...",en:"Waiting for browser authorization..."},providerAuthCompleted:{zh:"授权已完成。",en:"Authorization completed."},providerAuthOpenPrompt:{zh:"请在浏览器完成授权,验证码:",en:"Open browser and complete authorization (code: "},providerAuthOpenPromptSuffix:{zh:"",en:")"},providerAuthStartFailed:{zh:"启动授权失败",en:"Failed to start authorization"},providerAuthMethodLabel:{zh:"授权区域",en:"Authorization Region"},providerAuthMethodPlaceholder:{zh:"请选择授权方式",en:"Select authorization method"},providerAuthImportFromCli:{zh:"从 Qwen CLI 导入",en:"Import From Qwen CLI"},providerAuthImporting:{zh:"导入中...",en:"Importing..."},providerAuthImportSuccess:{zh:"已从 CLI 导入凭证。",en:"Imported provider credentials from CLI."},providerAuthImportStatusPrefix:{zh:"CLI 导入成功。",en:"Imported credentials from CLI successfully."},providerAuthImportFailed:{zh:"导入凭证失败",en:"Failed to import credentials"},providerAuthSessionLabel:{zh:"会话",en:"Session"},resetToDefault:{zh:"恢复默认",en:"Reset to Default"},leaveBlankToKeepUnchanged:{zh:"留空则保持不变",en:"Leave blank to keep unchanged"},...Jn,consentGranted:{zh:"同意条款",en:"Consent Granted"},imapHost:{zh:"IMAP 服务器",en:"IMAP Host"},imapPort:{zh:"IMAP 端口",en:"IMAP Port"},imapUsername:{zh:"IMAP 用户名",en:"IMAP Username"},imapPassword:{zh:"IMAP 密码",en:"IMAP Password"},imapMailbox:{zh:"IMAP 邮箱",en:"IMAP Mailbox"},imapUseSsl:{zh:"IMAP 使用 SSL",en:"IMAP Use SSL"},smtpHost:{zh:"SMTP 服务器",en:"SMTP Host"},smtpPort:{zh:"SMTP 端口",en:"SMTP Port"},smtpUsername:{zh:"SMTP 用户名",en:"SMTP Username"},smtpPassword:{zh:"SMTP 密码",en:"SMTP Password"},smtpUseTls:{zh:"SMTP 使用 TLS",en:"SMTP Use TLS"},smtpUseSsl:{zh:"SMTP 使用 SSL",en:"SMTP Use SSL"},fromAddress:{zh:"发件地址",en:"From Address"},autoReplyEnabled:{zh:"自动回复已启用",en:"Auto Reply Enabled"},pollIntervalSeconds:{zh:"轮询间隔(秒)",en:"Poll Interval (s)"},markSeen:{zh:"标记为已读",en:"Mark Seen"},maxBodyChars:{zh:"最大正文字符数",en:"Max Body Chars"},subjectPrefix:{zh:"主题前缀",en:"Subject Prefix"},baseUrl:{zh:"Base URL",en:"Base URL"},socketUrl:{zh:"Socket URL",en:"Socket URL"},socketPath:{zh:"Socket 路径",en:"Socket Path"},socketDisableMsgpack:{zh:"禁用 Msgpack",en:"Disable Msgpack"},socketReconnectDelayMs:{zh:"重连延迟(ms)",en:"Reconnect Delay (ms)"},socketMaxReconnectDelayMs:{zh:"最大重连延迟(ms)",en:"Max Reconnect Delay (ms)"},socketConnectTimeoutMs:{zh:"连接超时(ms)",en:"Connect Timeout (ms)"},refreshIntervalMs:{zh:"刷新间隔(ms)",en:"Refresh Interval (ms)"},watchTimeoutMs:{zh:"监视超时(ms)",en:"Watch Timeout (ms)"},watchLimit:{zh:"监视限制",en:"Watch Limit"},retryDelayMs:{zh:"重试延迟(ms)",en:"Retry Delay (ms)"},maxRetryAttempts:{zh:"最大重试次数",en:"Max Retry Attempts"},clawToken:{zh:"Claw Token",en:"Claw Token"},agentUserId:{zh:"代理用户ID",en:"Agent User ID"},sessions:{zh:"会话",en:"Sessions"},panels:{zh:"面板",en:"Panels"},mentionRequireInGroups:{zh:"群组中需要@",en:"Require Mention in Groups"},groups:{zh:"群组",en:"Groups"},replyDelayMode:{zh:"回复延迟模式",en:"Reply Delay Mode"},replyDelayMs:{zh:"回复延迟(ms)",en:"Reply Delay (ms)"},secret:{zh:"密钥",en:"Secret"},accountId:{zh:"账号 ID",en:"Account ID"},dmPolicy:{zh:"私聊策略",en:"DM Policy"},groupAllowFrom:{zh:"群组允许来源",en:"Group Allow From"},requireMention:{zh:"需要 @ 提及",en:"Require Mention"},mentionPatterns:{zh:"提及匹配规则",en:"Mention Patterns"},groupRulesJson:{zh:"群组规则(JSON)",en:"Group Rules (JSON)"},allowBotMessages:{zh:"允许机器人消息",en:"Allow Bot Messages"},attachmentMaxSizeMb:{zh:"附件最大体积(MB)",en:"Attachment Max Size (MB)"},streamingMode:{zh:"流式模式",en:"Streaming Mode"},draftChunkingJson:{zh:"草稿分块(JSON)",en:"Draft Chunking (JSON)"},textChunkLimit:{zh:"文本分块上限",en:"Text Chunk Limit"},invalidJson:{zh:"JSON 格式无效",en:"Invalid JSON"},authBrand:{zh:"NextClaw UI",en:"NextClaw UI"},authLoginTitle:{zh:"管理员登录",en:"Admin Sign In"},authLoginDescription:{zh:"认证已开启。登录后才能查看这台机器的 NextClaw UI。",en:"Authentication is enabled. Sign in to access this machine’s NextClaw UI."},authUsername:{zh:"管理员用户名",en:"Admin Username"},authUsernamePlaceholder:{zh:"输入管理员用户名",en:"Enter admin username"},authPassword:{zh:"管理员密码",en:"Admin Password"},authPasswordPlaceholder:{zh:"输入管理员密码",en:"Enter admin password"},authConfirmPassword:{zh:"确认密码",en:"Confirm Password"},authConfirmPasswordPlaceholder:{zh:"再次输入密码",en:"Enter password again"},authLoginAction:{zh:"登录",en:"Sign In"},authLoggingIn:{zh:"登录中...",en:"Signing in..."},authLoggingOut:{zh:"退出中...",en:"Signing out..."},authActionFailed:{zh:"认证操作失败",en:"Authentication action failed"},authLoginSuccess:{zh:"登录成功",en:"Signed in successfully"},authLogoutSuccess:{zh:"已退出登录",en:"Signed out successfully"},authSetupSuccess:{zh:"认证已开启,当前标签页已自动登录,可直接继续使用",en:"Authentication enabled. This tab is now signed in and ready to use."},authPasswordUpdated:{zh:"管理员密码已更新",en:"Admin password updated"},authEnabledSuccess:{zh:"认证已开启",en:"Authentication enabled"},authDisabledSuccess:{zh:"认证已关闭",en:"Authentication disabled"},authRetryStatus:{zh:"重试",en:"Retry"},authStatusLoadFailed:{zh:"无法获取认证状态,请检查 UI 服务是否正常。",en:"Failed to load authentication status. Check whether the UI server is healthy."},authStatusStarting:{zh:"正在等待本地 UI 服务启动...",en:"Waiting for the local UI service to start..."},authStatusStartingHint:{zh:"开发环境冷启动时,后端可能还在初始化插件、渠道和 MCP 服务。",en:"During a cold dev start, the backend may still be initializing plugins, channels, and MCP services."},runtimePageTitle:{zh:"路由与运行时",en:"Routing & Runtime"},runtimePageDescription:{zh:"对齐 OpenClaw 的多 Agent 路由:绑定规则、Agent 池、私聊范围。",en:"Align multi-agent routing with OpenClaw: bindings, agent pool, and DM scope."},runtimeLoading:{zh:"加载运行时配置中...",en:"Loading runtime settings..."},authSecurityTitle:{zh:"Security",en:"Security"},authSecurityDescription:{zh:"保持本机控制台默认简单;只有在你需要远程暴露时,再给 UI 加一层登录门。",en:"Keep the local console simple by default, and add a lightweight login gate only when you expose the UI remotely."},authSetupTitle:{zh:"开启轻量认证",en:"Enable Lightweight Authentication"},authSetupDescription:{zh:"首次开启时设置单个管理员账号。完成后当前标签页会自动登录。",en:"Create the single admin account the first time you enable authentication. This tab will be signed in automatically."},authSetupAction:{zh:"开启认证",en:"Enable Authentication"},authSettingUp:{zh:"开启中...",en:"Enabling..."},authPasswordMismatch:{zh:"两次输入的密码不一致",en:"Passwords do not match"},authPasswordMinLengthHint:{zh:"密码至少 8 个字符。当前版本只支持单管理员账号。",en:"Passwords must be at least 8 characters. This version supports a single admin account only."},authStatusLabel:{zh:"当前状态",en:"Current Status"},authStatusConfiguredUser:{zh:"管理员账号:{username}",en:"Admin account: {username}"},authUsernameFixedHelp:{zh:"首版不提供修改用户名和多用户管理;如需重新定义账号,请后续扩展这套边界。",en:"This first version does not support renaming the admin account or managing multiple users."},authEnableLabel:{zh:"要求登录",en:"Require Login"},authEnableOnHelp:{zh:"已开启后,除健康检查与认证接口外,其余 UI API 和 WebSocket 都需要登录。",en:"When enabled, every UI API and WebSocket except health and auth endpoints requires login."},authEnableOffHelp:{zh:"当前保持即开即用。重新打开后,这个标签页会自动拿到新的登录会话。",en:"The UI is currently open for local-style use. Re-enabling will issue a fresh signed-in session to this tab."},authPasswordSectionTitle:{zh:"修改管理员密码",en:"Change Admin Password"},authPasswordSectionDescription:{zh:"更新密码后,旧会话会立即失效;当前标签页会自动续成新会话(仅在认证开启时)。",en:"Updating the password invalidates old sessions immediately. This tab gets a fresh session automatically while auth is enabled."},authPasswordAction:{zh:"更新密码",en:"Update Password"},authPasswordUpdating:{zh:"更新中...",en:"Updating..."},authLogoutAction:{zh:"退出当前标签页",en:"Sign Out This Tab"},authSessionMemoryNotice:{zh:"当前版本的会话只保存在服务端内存里。NextClaw UI 进程重启后,需要重新登录。",en:"Sessions are stored only in server memory for now. You will need to sign in again after the NextClaw UI process restarts."},dmScope:{zh:"私聊范围",en:"DM Scope"},dmScopeHelp:{zh:"控制私聊会话如何隔离。",en:"Control how direct-message sessions are isolated."},defaultContextTokens:{zh:"默认上下文 Token",en:"Default Context Tokens"},defaultContextTokensHelp:{zh:"当 Agent 未设置单独值时使用该上下文预算。",en:"Input context budget for agents when no per-agent override is set."},defaultEngine:{zh:"默认引擎",en:"Default Engine"},defaultEngineHelp:{zh:"默认使用的 Agent 引擎类型,例如 native 或 codex-sdk。",en:"Default agent engine kind, for example native or codex-sdk."},maxPingPongTurns:{zh:"最大乒乓轮次",en:"Max Ping-Pong Turns"},maxPingPongTurnsHelp:{zh:"设为 0 可阻止 Agent 间自动 ping-pong。",en:"Set to 0 to block automatic agent-to-agent ping-pong loops."},agentList:{zh:"Agent 列表",en:"Agent List"},agentListHelp:{zh:"在同一个网关进程中运行多个固定角色 Agent。",en:"Run multiple fixed-role agents in one gateway process."},bindings:{zh:"绑定规则",en:"Bindings"},bindingsHelp:{zh:"根据渠道 + 账号 + 对端将入站消息路由到目标 Agent。",en:"Route inbound message by channel + account + peer to target agent."},agentIdRequiredError:{zh:"agents.list[{index}].id 必填",en:"agents.list[{index}].id is required"},duplicateAgentId:{zh:"重复的 agent id",en:"Duplicate agent id"},bindingAgentIdRequired:{zh:"bindings[{index}].agentId 必填",en:"bindings[{index}].agentId is required"},bindingAgentIdNotFound:{zh:"bindings[{index}].agentId 未在 agents.list/main 中找到",en:"bindings[{index}].agentId not found in agents.list/main"},bindingChannelRequired:{zh:"bindings[{index}].match.channel 必填",en:"bindings[{index}].match.channel is required"},bindingPeerIdRequired:{zh:"设置 peer.kind 时,bindings[{index}].match.peer.id 必填",en:"bindings[{index}].match.peer.id is required when peer.kind is set"},agentIdPlaceholder:{zh:"Agent ID(例如 engineer)",en:"Agent ID (e.g. engineer)"},workspaceOverridePlaceholder:{zh:"工作空间覆盖(可选)",en:"Workspace override (optional)"},modelOverridePlaceholder:{zh:"模型覆盖(可选)",en:"Model override (optional)"},defaultEnginePlaceholder:{zh:"默认引擎(如 native 或 codex-sdk)",en:"Default engine (e.g. native or codex-sdk)"},engineOverridePlaceholder:{zh:"引擎覆盖(可选)",en:"Engine override (optional)"},contextTokensPlaceholder:{zh:"上下文 tokens",en:"Context tokens"},maxToolsPlaceholder:{zh:"最大工具次数",en:"Max tools"},defaultAgent:{zh:"默认 Agent",en:"Default agent"},addAgent:{zh:"添加 Agent",en:"Add Agent"},targetAgentIdPlaceholder:{zh:"目标 Agent ID",en:"Target agent ID"},channelPlaceholder:{zh:"渠道(例如 discord)",en:"Channel (e.g. discord)"},accountIdOptionalPlaceholder:{zh:"账号 ID(可选)",en:"Account ID (optional)"},peerKindOptional:{zh:"对端类型(可选)",en:"Peer kind (optional)"},peerIdPlaceholder:{zh:"对端 ID(需先设置对端类型)",en:"Peer ID (requires peer kind)"},addBinding:{zh:"添加绑定",en:"Add Binding"},saveRuntimeSettings:{zh:"保存运行时设置",en:"Save Runtime Settings"},secretsPageTitle:{zh:"密钥管理",en:"Secrets Management"},secretsPageDescription:{zh:"集中管理 secrets.providers、secrets.defaults 与 secrets.refs。",en:"Manage secrets.providers, secrets.defaults, and secrets.refs in one place."},secretsEnabledHelp:{zh:"关闭后不会解析 `{{secret:*}}` 引用。",en:"When disabled, `{{secret:*}}` refs are not resolved."},defaultEnvProvider:{zh:"默认 Env 提供器",en:"Default Env Provider"},defaultFileProvider:{zh:"默认 File 提供器",en:"Default File Provider"},defaultExecProvider:{zh:"默认 Exec 提供器",en:"Default Exec Provider"},secretProvidersTitle:{zh:"Secret Providers",en:"Secret Providers"},secretProvidersDescription:{zh:"定义可复用的 secrets provider(env/file/exec)。",en:"Define reusable secret providers (env/file/exec)."},providerAlias:{zh:"提供器别名",en:"Provider Alias"},removeProvider:{zh:"移除提供器",en:"Remove Provider"},envPrefix:{zh:"环境变量前缀",en:"Environment Prefix"},secretFilePath:{zh:"Secrets 文件路径",en:"Secrets File Path"},secretExecCommand:{zh:"执行命令",en:"Exec Command"},secretExecArgs:{zh:"命令参数(每行一个)",en:"Exec Args (one per line)"},secretExecCwd:{zh:"执行目录(可选)",en:"Exec Working Directory (optional)"},secretExecTimeoutMs:{zh:"超时(毫秒)",en:"Timeout (ms)"},addSecretProvider:{zh:"添加 Provider",en:"Add Provider"},secretRefsTitle:{zh:"Secret Refs",en:"Secret Refs"},secretRefsDescription:{zh:"把配置路径映射到 secret 引用(source/provider/id)。",en:"Map config paths to secret refs (source/provider/id)."},secretConfigPath:{zh:"配置路径",en:"Config Path"},secretId:{zh:"Secret ID",en:"Secret ID"},secretProviderAlias:{zh:"Provider 别名",en:"Provider Alias"},addSecretRef:{zh:"添加 Ref",en:"Add Ref"},sessionsPageTitle:{zh:"会话管理",en:"Sessions"},sessionsPageDescription:{zh:"管理会话:筛选、按渠道分组、查看历史、改标签/偏好模型、清空和删除。",en:"Manage sessions: filter, group by channel, inspect history, edit metadata, clear, and delete."},sessionsFiltersTitle:{zh:"筛选",en:"Filters"},sessionsFiltersDescription:{zh:"按关键词、活跃窗口和分组方式筛选会话。",en:"Filter sessions by query, activity window, and grouping mode."},sessionsSearchPlaceholder:{zh:"搜索 key 或标签",en:"Search session key or label"},sessionsActiveMinutesPlaceholder:{zh:"活跃分钟(0=不限)",en:"Active minutes (0 = no limit)"},sessionsLimitPlaceholder:{zh:"展示上限",en:"Limit"},sessionsGroupModeLabel:{zh:"分组方式",en:"Grouping"},sessionsGroupModeAll:{zh:"不分组 / 全部",en:"All (No grouping)"},sessionsGroupModeByChannel:{zh:"按渠道分组",en:"Group by channel"},sessionsListTitle:{zh:"会话列表",en:"Session list"},sessionsTotalLabel:{zh:"总数",en:"Total"},sessionsCurrentLabel:{zh:"当前展示",en:"Showing"},sessionsLoading:{zh:"加载会话中...",en:"Loading sessions..."},sessionsEmpty:{zh:"暂无会话。",en:"No sessions yet."},sessionsKeyLabel:{zh:"键",en:"Key"},sessionsChannelLabel:{zh:"渠道",en:"Channel"},sessionsMessagesLabel:{zh:"消息数",en:"Messages"},sessionsUpdatedLabel:{zh:"更新时间",en:"Updated"},sessionsLastRoleLabel:{zh:"最后角色",en:"Last Role"},sessionsLabelPlaceholder:{zh:"会话标签(可选)",en:"Session label (optional)"},sessionsModelPlaceholder:{zh:"偏好模型(可选)",en:"Preferred model (optional)"},sessionsShowHistory:{zh:"查看历史",en:"View history"},sessionsHideHistory:{zh:"隐藏历史",en:"Hide history"},sessionsSaveMeta:{zh:"保存元信息",en:"Save metadata"},sessionsClearHistory:{zh:"清空历史",en:"Clear history"},sessionsDeleteConfirm:{zh:"确认删除会话",en:"Delete session"},sessionsHistoryTitle:{zh:"历史",en:"History"},sessionsHistoryDescription:{zh:"最近 200 条消息(展示窗口)。",en:"Latest 200 messages (display window)."},sessionsHistoryLoading:{zh:"加载历史中...",en:"Loading history..."},sessionsApplyingChanges:{zh:"正在应用会话变更...",en:"Applying session changes..."},sessionsUnknownChannel:{zh:"未知渠道",en:"Unknown channel"},sessionsAllChannels:{zh:"全部渠道",en:"All Channels"},sessionsRunStatusRunning:{zh:"运行中",en:"Running"},sessionsRunStatusQueued:{zh:"排队中",en:"Queued"},sessionsMetadata:{zh:"元信息",en:"Metadata"},sessionsNoSelectionTitle:{zh:"未选择会话",en:"No Session Selected"},sessionsNoSelectionDescription:{zh:"从左侧列表选择一个会话以查看聊天历史并配置其元信息。",en:"Select a session from the list on the left to view its chat history and configure its metadata."},...Xn,cronPageTitle:{zh:"定时任务",en:"Cron Jobs"},cronPageDescription:{zh:"查看与删除定时任务,关注执行时间与状态。",en:"View and delete cron jobs, track schedule and status."},cronSearchPlaceholder:{zh:"搜索名称 / 消息 / ID",en:"Search name / message / ID"},cronStatusLabel:{zh:"状态",en:"Status"},cronStatusAll:{zh:"全部",en:"All"},cronStatusEnabled:{zh:"仅启用",en:"Enabled"},cronStatusDisabled:{zh:"仅禁用",en:"Disabled"},cronTotalLabel:{zh:"总数",en:"Total"},cronLoading:{zh:"加载定时任务中...",en:"Loading cron jobs..."},cronEmpty:{zh:"暂无定时任务。",en:"No cron jobs yet."},cronScheduleLabel:{zh:"计划",en:"Schedule"},cronDeliverTo:{zh:"投递到",en:"Deliver to"},cronNextRun:{zh:"下次执行",en:"Next run"},cronLastRun:{zh:"上次执行",en:"Last run"},cronLastStatus:{zh:"上次状态",en:"Last status"},cronDeleteConfirm:{zh:"确认删除定时任务",en:"Delete cron job"},cronOneShot:{zh:"一次性",en:"One-shot"},cronEnable:{zh:"启用",en:"Enable"},cronDisable:{zh:"禁用",en:"Disable"},cronRunNow:{zh:"立即执行",en:"Run now"},cronEnableConfirm:{zh:"确认启用定时任务",en:"Enable cron job"},cronDisableConfirm:{zh:"确认禁用定时任务",en:"Disable cron job"},cronRunConfirm:{zh:"确认立即执行定时任务",en:"Run cron job now"},cronRunForceConfirm:{zh:"任务已禁用,仍要立即执行",en:"Cron job disabled. Force run now"},...Zn,...es,actionConfigure:{zh:"配置",en:"Configure"},actionAddProvider:{zh:"添加提供商",en:"Add Provider"},actionEnable:{zh:"启用",en:"Enable"},configSaved:{zh:"配置已保存",en:"Configuration saved"},configSavedApplied:{zh:"配置已保存并已应用",en:"Configuration saved and applied"},configSaveFailed:{zh:"保存配置失败",en:"Failed to save configuration"},configReloaded:{zh:"配置已重载",en:"Configuration reloaded"},configReloadFailed:{zh:"重载配置失败",en:"Failed to reload configuration"},feishuVerifySuccess:{zh:"验证成功,请到飞书开放平台完成事件订阅与发布后再开始使用。",en:"Verified. Please finish Feishu event subscription and app publishing before using."},feishuVerifyFailed:{zh:"验证失败",en:"Verification failed"},enterTag:{zh:"输入后按回车...",en:"Type and press Enter..."},headerName:{zh:"Header 名称",en:"Header Name"},headerValue:{zh:"Header 值",en:"Header Value"},docBrowserTitle:{zh:"内嵌浏览器",en:"Embedded Browser"},docBrowserSearchPlaceholder:{zh:"搜索,也可以输入文档地址直接打开",en:"Search, or enter a doc URL to open"},docBrowserUrlPlaceholder:{zh:"输入文档路径,如 /guide/channels",en:"Enter a doc path, e.g. /guide/channels"},docBrowserOpenExternal:{zh:"文档中心打开",en:"Open in Docs"},docBrowserFloatMode:{zh:"悬浮窗口",en:"Float Window"},docBrowserDockMode:{zh:"固定到侧栏",en:"Dock to Sidebar"},docBrowserClose:{zh:"关闭",en:"Close"},docBrowserHelp:{zh:"帮助文档",en:"Help Docs"},docBrowserNewTab:{zh:"新建标签",en:"New Tab"},docBrowserCloseTab:{zh:"关闭标签",en:"Close Tab"},docBrowserTabUntitled:{zh:"未命名",en:"Untitled"},...Yn};function o(e,t=_()){var n,a;return((n=Me[e])==null?void 0:n[t])||((a=Me[e])==null?void 0:a.en)||e}const ce=new _t({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!0}}}),Ae=["remote-status"],is="https://platform.nextclaw.io",cs="https://nextclaw-platform-console.pages.dev",V=async()=>await ce.fetchQuery({queryKey:Ae,queryFn:ct,staleTime:5e3}),D=async()=>(await ce.invalidateQueries({queryKey:Ae}),await V()),De=(e,t)=>{var r,i;const n=t==null?void 0:t.trim();if(n)return n;const a=(r=e==null?void 0:e.settings.platformApiBase)==null?void 0:r.trim();return a||((i=e==null?void 0:e.account.apiBase)==null?void 0:i.trim())||void 0};function re(e){const t=e==null?void 0:e.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname==="platform.nextclaw.io"||n.hostname==="nextclaw-platform-console.pages.dev")return n.origin;if(n.hostname==="ai-gateway-api.nextclaw.io")return is;if(n.hostname.includes("nextclaw-provider-gateway-api")&&n.hostname.endsWith(".workers.dev"))return cs}const ls=e=>re(e==null?void 0:e.account.apiBase)||re(e==null?void 0:e.settings.platformApiBase)||re(e==null?void 0:e.platformBase)||re(e==null?void 0:e.account.platformBase)||void 0;function ht(){return E({queryKey:Ae,queryFn:ct,staleTime:5e3,refetchOnWindowFocus:!0})}const z=ze(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:"",authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:a,intervalMs:r,statusMessage:i})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:a,authPollIntervalMs:r,authStatusMessage:i}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(a=>({authStatusMessage:t??a.authStatusMessage,authPollIntervalMs:n??a.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:"",authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));class ds{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=t=>{this.afterSignedIn=t},this.openAccountPanel=()=>{z.getState().openPanel()},this.closeAccountPanel=()=>{z.getState().closePanel()},this.syncRemoteStatus=t=>{t!=null&&t.account.loggedIn&&(this.clearPollTimer(),z.getState().clearBrowserAuth())},this.ensureSignedIn=async t=>{const n=await V();return n.account.loggedIn?!0:(t!=null&&t.pendingAction&&z.getState().setPendingAction(t.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:t==null?void 0:t.apiBase,status:n}),!1)},this.startBrowserSignIn=async t=>{try{const n=(t==null?void 0:t.status)??await V();t!=null&&t.pendingAction&&z.getState().setPendingAction(t.pendingAction);const a=await Qn({apiBase:De(n,t==null?void 0:t.apiBase)});z.getState().beginBrowserAuth({sessionId:a.sessionId,verificationUri:a.verificationUri,expiresAt:a.expiresAt,intervalMs:a.intervalMs,statusMessage:o("remoteBrowserAuthWaiting")}),window.open(a.verificationUri,"_blank","noopener,noreferrer")||z.getState().setAuthStatusMessage(o("remoteBrowserAuthPopupBlocked")),this.scheduleBrowserAuthPoll()}catch(n){const a=n instanceof Error?n.message:o("remoteBrowserAuthStartFailed");m.error(`${o("remoteBrowserAuthStartFailed")}: ${a}`)}},this.resumeBrowserSignIn=()=>{const t=z.getState().authVerificationUri;t&&window.open(t,"_blank","noopener,noreferrer")},this.logout=async()=>{try{await Gn(),z.getState().clearPendingAction(),z.getState().clearBrowserAuth(),await D(),m.success(o("remoteLogoutSuccess"))}catch(t){const n=t instanceof Error?t.message:o("remoteLogoutFailed");m.error(`${o("remoteLogoutFailed")}: ${n}`)}},this.openNextClawWeb=async()=>{const t=await V(),n=ls(t);if(!n){m.error(o("remoteOpenWebUnavailable"));return}window.open(n,"_blank","noopener,noreferrer")},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();const{authSessionId:t,authPollIntervalMs:n}=z.getState();t&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},n))},this.pollBrowserSignIn=async()=>{const t=z.getState();if(t.authSessionId)try{const n=await V(),a=await Vn({sessionId:t.authSessionId,apiBase:De(n)});if(a.status==="pending"){z.getState().updateBrowserAuth({statusMessage:o("remoteBrowserAuthWaiting"),intervalMs:a.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(a.status==="expired"){this.clearPollTimer(),z.getState().clearBrowserAuth(),m.error(a.message||o("remoteBrowserAuthExpired"));return}z.getState().setAuthStatusMessage(o("remoteBrowserAuthCompleted"));const r=await D(),{pendingAction:i}=z.getState();this.clearPollTimer(),z.getState().clearBrowserAuth(),m.success(o("remoteLoginSuccess")),i&&this.afterSignedIn&&await this.afterSignedIn(i,r),z.getState().clearPendingAction()}catch(n){this.clearPollTimer(),z.getState().clearBrowserAuth();const a=n instanceof Error?n.message:o("remoteBrowserAuthPollFailed");m.error(`${o("remoteBrowserAuthPollFailed")}: ${a}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{const t=z.getState();return{sessionId:t.authSessionId,expiresAt:t.authExpiresAt?dt(t.authExpiresAt):"-"}}}}const I=ze(e=>({enabled:!1,deviceName:"",platformApiBase:"",advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:a})=>e({enabled:t,deviceName:n,platformApiBase:a,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})}));class hs{constructor(){this.accountManager=null,this.bindAccountManager=t=>{this.accountManager=t},this.syncStatus=t=>{if(!t)return;const n=I.getState();n.draftTouched||n.actionLabel||this.hydrateDraftFromStatus(t)},this.setEnabled=t=>{I.getState().setEnabled(t)},this.setDeviceName=t=>{I.getState().setDeviceName(t)},this.setPlatformApiBase=t=>{I.getState().setPlatformApiBase(t)},this.setAdvancedOpen=t=>{I.getState().setAdvancedOpen(t)},this.enableRemoteAccess=async t=>{var r;const n=t??await D(),a=I.getState();if(!n.account.loggedIn){await((r=this.accountManager)==null?void 0:r.ensureSignedIn({pendingAction:{type:"enable-remote"},apiBase:a.platformApiBase}));return}await this.applyEnabledState(!0,n)},this.disableRemoteAccess=async t=>{const n=t??await D();await this.applyEnabledState(!1,n)},this.repairRemoteAccess=async t=>{var r;const n=t??await D();if(!n.account.loggedIn){await((r=this.accountManager)==null?void 0:r.ensureSignedIn({pendingAction:{type:"enable-remote"}}));return}const a=n.service.running?"restart":"start";await this.runManagedAction({actionLabel:o(a==="restart"?"remoteActionRestarting":"remoteActionStarting"),job:async()=>{await ae(a);const i=await D();this.hydrateDraftFromStatus(i)},successMessage:o("remoteServiceRecovered")})},this.reauthorizeRemoteAccess=async t=>{var a;const n=t??await D();await((a=this.accountManager)==null?void 0:a.startBrowserSignIn({status:n,apiBase:I.getState().platformApiBase,pendingAction:{type:"repair-remote"}}))},this.saveAdvancedSettings=async t=>{const n=t??await D(),a=I.getState();await this.runManagedAction({actionLabel:o("remoteActionSavingAdvanced"),job:async()=>{await Ee({enabled:a.enabled,deviceName:a.deviceName.trim(),platformApiBase:a.platformApiBase.trim()});const r=await D();this.hydrateDraftFromStatus(r)},successMessage:n.settings.enabled===a.enabled?o("remoteSettingsSaved"):o("remoteAdvancedSaved")})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:o("remoteDoctorRunning"),job:async()=>{const t=await Hn();I.getState().setDoctor(t)},successMessage:o("remoteDoctorCompleted")})},this.startService=async()=>{await this.runServiceAction("start",o("remoteActionStarting"))},this.restartService=async()=>{await this.runServiceAction("restart",o("remoteActionRestarting"))},this.stopService=async()=>{await this.runServiceAction("stop",o("remoteActionStopping"))},this.resumePendingActionAfterSignIn=async(t,n)=>{if(t){if(t.type==="enable-remote"){await this.applyEnabledState(!0,n);return}t.type==="repair-remote"&&await this.repairRemoteAccess(n)}},this.applyEnabledState=async(t,n)=>{const a=I.getState();await this.runManagedAction({actionLabel:o(t?"remoteActionEnabling":"remoteActionDisabling"),job:async()=>{await Ee({enabled:t,deviceName:a.deviceName.trim(),platformApiBase:a.platformApiBase.trim()});const r=await D();if(this.hydrateDraftFromStatus(r),t){const c=r.service.running?"restart":"start";await ae(c)}else n.service.running&&await ae("restart");const i=await D();this.hydrateDraftFromStatus(i)},successMessage:o(t?"remoteEnabledReady":"remoteDisabledDone")})},this.runServiceAction=async(t,n)=>{await this.runManagedAction({actionLabel:n,job:async()=>{const a=await ae(t),r=await D();this.hydrateDraftFromStatus(r),m.success(a.message)}})},this.hydrateDraftFromStatus=t=>{I.getState().hydrateDraft({enabled:t.settings.enabled,deviceName:t.settings.deviceName,platformApiBase:t.settings.platformApiBase})},this.runManagedAction=async t=>{I.getState().beginAction(t.actionLabel);try{await t.job(),t.successMessage&&m.success(t.successMessage)}catch(n){const a=n instanceof Error?n.message:o("error");throw m.error(a),n}finally{I.getState().finishAction()}}}}class us{constructor(){this.accountManager=new ds,this.remoteAccessManager=new hs}}const J=new us;J.accountManager.bindSignedInContinuation(J.remoteAccessManager.resumePendingActionAfterSignIn);J.remoteAccessManager.bindAccountManager(J.accountManager);const ut=d.createContext(null);function ms({children:e}){return s.jsx(ut.Provider,{value:J,children:e})}function mt(){const e=d.useContext(ut);if(!e)throw new Error("useAppPresenter must be used inside AppPresenterProvider");return e}function oe(e){var t;return s.jsxs("div",{className:"flex items-start justify-between gap-4 py-2 text-sm",children:[s.jsx("span",{className:"text-gray-500",children:e.label}),s.jsx("span",{className:"text-right text-gray-900",children:((t=e.value)==null?void 0:t.trim())||"-"})]})}function ps(){const e=mt(),t=ht(),n=z(u=>u.panelOpen),a=z(u=>u.authSessionId),r=z(u=>u.authVerificationUri),i=z(u=>u.authExpiresAt),c=z(u=>u.authStatusMessage),l=t.data;return d.useEffect(()=>{e.accountManager.syncRemoteStatus(l)},[e,l]),s.jsx(Cn,{open:n,onOpenChange:u=>u?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:s.jsxs(tt,{className:"max-w-xl",children:[s.jsxs(nt,{children:[s.jsxs(st,{className:"flex items-center gap-2",children:[s.jsx(ue,{className:"h-5 w-5 text-primary"}),o("accountPanelTitle")]}),s.jsx(at,{children:o("accountPanelDescription")})]}),l!=null&&l.account.loggedIn?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3",children:[s.jsx("p",{className:"text-sm font-medium text-emerald-800",children:o("accountPanelSignedInTitle")}),s.jsx("p",{className:"mt-1 text-sm text-emerald-700",children:o("accountPanelSignedInDescription")})]}),s.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3",children:[s.jsx(oe,{label:o("remoteAccountEmail"),value:l.account.email}),s.jsx(oe,{label:o("remoteAccountRole"),value:l.account.role})]}),s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsxs(O,{onClick:()=>void e.accountManager.openNextClawWeb(),children:[s.jsx(Wt,{className:"mr-2 h-4 w-4"}),o("remoteOpenDeviceList")]}),s.jsxs(O,{variant:"outline",onClick:()=>void e.accountManager.logout(),children:[s.jsx(qt,{className:"mr-2 h-4 w-4"}),o("remoteLogout")]})]})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3",children:[s.jsx("p",{className:"text-sm font-medium text-gray-900",children:o("accountPanelSignedOutTitle")}),s.jsx("p",{className:"mt-1 text-sm text-gray-600",children:o("accountPanelSignedOutDescription")}),a?s.jsxs("div",{className:"mt-3 border-t border-white/80 pt-3",children:[s.jsx(oe,{label:o("remoteBrowserAuthSession"),value:a}),s.jsx(oe,{label:o("remoteBrowserAuthExpiresAt"),value:i?dt(i):"-"})]}):null]}),c?s.jsx("p",{className:"text-sm text-gray-600",children:c}):null,s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsx(O,{onClick:()=>void e.accountManager.startBrowserSignIn(),children:o(a?"remoteBrowserAuthActionRetry":"remoteBrowserAuthAction")}),r?s.jsx(O,{variant:"outline",onClick:()=>e.accountManager.resumeBrowserSignIn(),children:o("remoteBrowserAuthResume")}):null]})]})]})})}const pt=d.forwardRef(({className:e,hover:t=!0,...n},a)=>s.jsx("div",{ref:a,className:f("rounded-2xl border border-gray-200/50 bg-white text-card-foreground shadow-card transition-all duration-base",t&&"hover:shadow-card-hover hover:border-gray-200",e),...n}));pt.displayName="Card";const gt=d.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:f("flex flex-col space-y-1.5 p-6",e),...t}));gt.displayName="CardHeader";const ft=d.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:f("text-[15px] font-semibold leading-tight tracking-tight text-gray-900",e),...t}));ft.displayName="CardTitle";const yt=d.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:f("text-[13px] text-gray-400 leading-relaxed",e),...t}));yt.displayName="CardDescription";const wt=d.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:f("p-6 pt-0",e),...t}));wt.displayName="CardContent";const gs=d.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:f("flex items-center justify-between p-6 pt-0",e),...t}));gs.displayName="CardFooter";const ge=d.forwardRef(({className:e,type:t,...n},a)=>s.jsx("input",{type:t,className:f("flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));ge.displayName="Input";async function fs(){const e=await p.get("/api/auth/status",{timeoutMs:5e3});if(!e.ok)throw new Error(e.error.message);return e.data}async function ys(e){const t=await p.post("/api/auth/setup",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function ws(e){const t=await p.post("/api/auth/login",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Ss(){const e=await p.post("/api/auth/logout",{});if(!e.ok)throw new Error(e.error.message);return e.data}async function vs(e){const t=await p.put("/api/auth/password",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function zs(e){const t=await p.put("/api/auth/enabled",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function xs(){const e=await p.get("/api/app/meta");if(!e.ok)throw new Error(e.error.message);return e.data}async function bs(){const e=await p.get("/api/config");if(!e.ok)throw new Error(e.error.message);return e.data}async function As(){const e=await p.get("/api/config/meta");if(!e.ok)throw new Error(e.error.message);return e.data}async function Ps(){const e=await p.get("/api/config/schema");if(!e.ok)throw new Error(e.error.message);return e.data}async function ks(e){const t=await p.put("/api/config/model",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Cs(e){const t=await p.put("/api/config/search",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Ts(e,t){const n=await p.put(`/api/config/providers/${e}`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Is(e={}){const t=await p.post("/api/config/providers",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Es(e){const t=await p.delete(`/api/config/providers/${e}`);if(!t.ok)throw new Error(t.error.message);return t.data}async function Ns(e,t){const n=await p.post(`/api/config/providers/${e}/test`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Ms(e,t={}){const n=await p.post(`/api/config/providers/${e}/auth/start`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Ds(e,t){const n=await p.post(`/api/config/providers/${e}/auth/poll`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Rs(e){const t=await p.post(`/api/config/providers/${e}/auth/import-cli`,{});if(!t.ok)throw new Error(t.error.message);return t.data}async function js(e,t){const n=await p.put(`/api/config/channels/${e}`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Ls(e){const t=await p.put("/api/config/runtime",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Bs(e){const t=await p.put("/api/config/secrets",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Us(e,t){const n=await p.post(`/api/config/actions/${e}/execute`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Fs(e){var r;const t=new URLSearchParams;(r=e==null?void 0:e.q)!=null&&r.trim()&&t.set("q",e.q.trim()),typeof(e==null?void 0:e.limit)=="number"&&Number.isFinite(e.limit)&&t.set("limit",String(Math.max(0,Math.trunc(e.limit)))),typeof(e==null?void 0:e.activeMinutes)=="number"&&Number.isFinite(e.activeMinutes)&&t.set("activeMinutes",String(Math.max(0,Math.trunc(e.activeMinutes))));const n=t.toString(),a=await p.get(n?"/api/sessions?"+n:"/api/sessions");if(!a.ok)throw new Error(a.error.message);return a.data}async function Os(e,t=200){const n=await p.get(`/api/sessions/${encodeURIComponent(e)}/history?limit=${Math.max(1,Math.trunc(t))}`);if(!n.ok)throw new Error(n.error.message);return n.data}async function _s(e,t){const n=await p.put(`/api/sessions/${encodeURIComponent(e)}`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Ws(e){const t=await p.delete(`/api/sessions/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(t.error.message);return t.data}async function qs(e){var r,i;const t=new URLSearchParams;(r=e==null?void 0:e.sessionKey)!=null&&r.trim()&&t.set("sessionKey",e.sessionKey.trim()),(i=e==null?void 0:e.agentId)!=null&&i.trim()&&t.set("agentId",e.agentId.trim());const n=t.toString(),a=await p.get(n?`/api/chat/capabilities?${n}`:"/api/chat/capabilities");if(!a.ok)throw new Error(a.error.message);return a.data}async function Ks(){const e=await p.get("/api/chat/session-types");if(!e.ok)throw new Error(e.error.message);return e.data}async function sr(){const e=await p.get("/api/ncp/session-types");if(!e.ok)throw new Error(e.error.message);return e.data}async function ar(e){const t=await p.post("/api/chat/turn/stop",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function $s(e){var r;const t=new URLSearchParams;(r=e==null?void 0:e.sessionKey)!=null&&r.trim()&&t.set("sessionKey",e.sessionKey.trim()),Array.isArray(e==null?void 0:e.states)&&e.states.length>0&&t.set("states",e.states.join(",")),typeof(e==null?void 0:e.limit)=="number"&&Number.isFinite(e.limit)&&t.set("limit",String(Math.max(0,Math.trunc(e.limit))));const n=t.toString(),a=await p.get(n?`/api/chat/runs?${n}`:"/api/chat/runs");if(!a.ok)throw new Error(a.error.message);return a.data}async function Hs(e){const t=new URLSearchParams;e!=null&&e.all&&t.set("all","1");const n=t.toString(),a=await p.get(n?"/api/cron?"+n:"/api/cron");if(!a.ok)throw new Error(a.error.message);return a.data}async function Qs(e){const t=await p.delete(`/api/cron/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(t.error.message);return t.data}async function Vs(e,t){const n=await p.put(`/api/cron/${encodeURIComponent(e)}/enable`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Gs(e,t){const n=await p.post(`/api/cron/${encodeURIComponent(e)}/run`,t);if(!n.ok)throw new Error(n.error.message);return n.data}const de=[1e3,1500,2e3,3e3,4e3];function Js(e){if(!(e instanceof Error))return!1;const t=e.message.trim().toLowerCase();return t.includes("failed to fetch")||t.includes("networkerror")||t.includes("network request failed")||t.includes("load failed")||t.includes("timed out")||t.includes("econnrefused")||t.includes("socket hang up")}function Ys(){return E({queryKey:["auth-status"],queryFn:fs,staleTime:5e3,retry:(e,t)=>e<de.length&&Js(t),retryDelay:e=>de[Math.min(e,de.length-1)],refetchOnWindowFocus:!0})}function Y(e){return Promise.all([e.invalidateQueries({queryKey:["auth-status"]}),e.invalidateQueries({queryKey:["app-meta"]}),e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),e.invalidateQueries({queryKey:["config-schema"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history"]}),e.invalidateQueries({queryKey:["chat-runs"]}),e.invalidateQueries({queryKey:["cron-jobs"]})])}function rr(){const e=A();return x({mutationFn:ys,onSuccess:async()=>{await Y(e),m.success(o("authSetupSuccess"))},onError:t=>{m.error(`${o("authActionFailed")}: ${t.message}`)}})}function Xs(){const e=A();return x({mutationFn:ws,onSuccess:async()=>{await Y(e),m.success(o("authLoginSuccess"))},onError:t=>{m.error(`${o("authActionFailed")}: ${t.message}`)}})}function or(){const e=A();return x({mutationFn:Ss,onSuccess:async()=>{await Y(e),m.success(o("authLogoutSuccess"))},onError:t=>{m.error(`${o("authActionFailed")}: ${t.message}`)}})}function ir(){const e=A();return x({mutationFn:vs,onSuccess:async()=>{await Y(e),m.success(o("authPasswordUpdated"))},onError:t=>{m.error(`${o("authActionFailed")}: ${t.message}`)}})}function cr(){const e=A();return x({mutationFn:zs,onSuccess:async(t,n)=>{await Y(e),m.success(n.enabled?o("authEnabledSuccess"):o("authDisabledSuccess"))},onError:t=>{m.error(`${o("authActionFailed")}: ${t.message}`)}})}function Zs({username:e}){const t=Xs(),[n,a]=d.useState(e??""),[r,i]=d.useState(""),c=n.trim().length>0&&r.length>0&&!t.isPending,l=u=>{u==null||u.preventDefault(),c&&t.mutate({username:n.trim(),password:r})};return s.jsx("main",{className:"flex min-h-screen items-center justify-center bg-secondary px-6 py-10",children:s.jsxs(pt,{hover:!1,className:"w-full max-w-md shadow-card-hover",children:[s.jsxs(gt,{children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-gray-500",children:o("authBrand")}),s.jsx(ft,{className:"text-2xl",children:o("authLoginTitle")}),s.jsx(yt,{children:o("authLoginDescription")})]}),s.jsx(wt,{children:s.jsxs("form",{className:"space-y-4",onSubmit:l,children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-gray-800",children:o("authUsername")}),s.jsx(ge,{value:n,onChange:u=>a(u.target.value),placeholder:o("authUsernamePlaceholder"),autoFocus:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-gray-800",children:o("authPassword")}),s.jsx(ge,{type:"password",value:r,onChange:u=>i(u.target.value),placeholder:o("authPasswordPlaceholder")})]}),s.jsx(O,{type:"submit",className:"w-full",disabled:!c,children:t.isPending?o("authLoggingIn"):o("authLoginAction")})]})})]})})}const St="nextclaw.ui.theme",Re=[{value:"warm",labelKey:"themeWarm"},{value:"cool",labelKey:"themeCool"}];let R="warm",fe=!1;const ye=new Set;function ea(e){return e==="warm"||e==="cool"}function vt(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function ta(){if(typeof window>"u")return"warm";try{const e=window.localStorage.getItem(St);if(ea(e))return e}catch{}return"warm"}function Pe(){return fe||(R=ta(),vt(R),fe=!0),R}function na(){return fe?R:Pe()}function sa(e){if(Pe(),e!==R){if(R=e,vt(R),typeof window<"u")try{window.localStorage.setItem(St,R)}catch{}ye.forEach(t=>t(R))}}function aa(e){return ye.add(e),()=>{ye.delete(e)}}const we="docs.nextclaw.io",je="nextclaw-docs.pages.dev",zt=new Set([we,`www.${we}`,je,`www.${je}`]),Se=`https://${we}`,xt="/guide/getting-started",bt=d.createContext(null);let Le=0;function ra(){return Le+=1,`doc-tab-${Date.now()}-${Le}`}function K(e){try{return new URL(e).pathname.replace(/\.html$/,"").replace(/\/$/,"")}catch{return e}}function oa(e){return e==="zh"?"zh":"en"}function ia(e,t){const n=e.startsWith("/")?e:`/${e}`;return n==="/"||n===""?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function At(e){const t=oa(_());try{const n=new URL(e,Se);return zt.has(n.hostname)&&(n.pathname=ia(n.pathname,t)),n.toString()}catch{return new URL(`/${t}${xt}`,Se).toString()}}function F(){return At(xt)}function ca(e,t,n="Docs"){try{const a=new URL(e,Se);if(a.protocol==="data:")return t==="docs"?n:"Detail";const r=a.pathname.split("/").filter(Boolean),i=r[r.length-1]??n;return decodeURIComponent(i).replace(/[-_]/g," ").slice(0,40)||n}catch{return n}}function H(e,t,n){const a=(n==null?void 0:n.trim())||ca(e,t,t==="docs"?"Docs":"Detail");return{id:ra(),kind:t,title:a,currentUrl:e,history:[e],historyIndex:0,navVersion:0}}function Q(e,t){return{...e,tabs:e.tabs.map(n=>n.id===e.activeTabId?t(n):n)}}function ke(){const e=d.useContext(bt);if(!e)throw new Error("useDocBrowser must be used within DocBrowserProvider");return e}function Pt(e){try{const t=new URL(e,window.location.origin);return zt.has(t.hostname)}catch{return!1}}function la(e){return Pt(e)?"docs":"content"}function kt(e,t){return t==="docs"?At(e):e}function da(e){var t;return e.url&&e.url.trim().length>0?kt(e.url,e.kind):e.kind==="docs"?F():((t=e.activeTab)==null?void 0:t.currentUrl)??F()}function ha({children:e}){const t=F(),n=H(t,"docs","Docs"),[a,r]=d.useState({isOpen:!1,mode:"docked",tabs:[n],activeTabId:n.id}),i=d.useMemo(()=>a.tabs.find(w=>w.id===a.activeTabId)??a.tabs[0],[a.tabs,a.activeTabId]),c=d.useCallback((w,h)=>{r(g=>{const P=g.tabs.find(k=>k.id===g.activeTabId)??g.tabs[0],S=(h==null?void 0:h.kind)??(w?la(w):(P==null?void 0:P.kind)??"docs"),L=da({url:w,kind:S,activeTab:P});if(!!(h!=null&&h.newTab||!P||P.kind!==S)){const k=H(L,S,h==null?void 0:h.title);return{...g,isOpen:!0,tabs:[...g.tabs,k],activeTabId:k.id}}return{...Q(g,k=>K(L)===K(k.currentUrl)?h!=null&&h.title?{...k,title:h.title}:k:{...k,title:(h==null?void 0:h.title)||k.title,kind:S,currentUrl:L,history:[...k.history.slice(0,k.historyIndex+1),L],historyIndex:k.historyIndex+1,navVersion:k.navVersion+1}),isOpen:!0}})},[]),l=d.useCallback(()=>{r(w=>({...w,isOpen:!1}))},[]),u=d.useCallback(()=>{r(w=>({...w,mode:w.mode==="floating"?"docked":"floating"}))},[]),v=d.useCallback(w=>{r(h=>({...h,mode:w}))},[]),y=d.useCallback(w=>{r(h=>{if(!h.tabs.length){const g=H(F(),"docs","Docs");return{...h,tabs:[g],activeTabId:g.id,isOpen:!0}}return Q(h,g=>{if(g.kind!=="docs")return g;const P=kt(w,"docs");return K(P)===K(g.currentUrl)?g:{...g,currentUrl:P,history:[...g.history.slice(0,g.historyIndex+1),P],historyIndex:g.historyIndex+1,navVersion:g.navVersion+1}})})},[]),M=d.useCallback(w=>{r(h=>{if(!h.tabs.length){const g=H(F(),"docs","Docs");return{...h,tabs:[g],activeTabId:g.id}}return Q(h,g=>g.kind!=="docs"||K(w)===K(g.currentUrl)?g:{...g,currentUrl:w,history:[...g.history.slice(0,g.historyIndex+1),w],historyIndex:g.historyIndex+1})})},[]),T=d.useCallback(()=>{r(w=>Q(w,h=>{if(h.kind!=="docs"||h.historyIndex<=0)return h;const g=h.historyIndex-1;return{...h,historyIndex:g,currentUrl:h.history[g]}}))},[]),W=d.useCallback(()=>{r(w=>Q(w,h=>{if(h.kind!=="docs"||h.historyIndex>=h.history.length-1)return h;const g=h.historyIndex+1;return{...h,historyIndex:g,currentUrl:h.history[g]}}))},[]),q=d.useCallback((w,h)=>{c(w,{...h??{},newTab:!0})},[c]),X=d.useCallback(w=>{r(h=>{var L;if(h.tabs.length<=1){const B=H(F(),"docs","Docs");return{...h,isOpen:!1,tabs:[B],activeTabId:B.id}}const g=h.tabs.findIndex(B=>B.id===w);if(g<0)return h;const P=h.tabs.filter(B=>B.id!==w),S=h.activeTabId===w?((L=P[Math.max(0,g-1)])==null?void 0:L.id)??P[0].id:h.activeTabId;return{...h,tabs:P,activeTabId:S}})},[]),Z=d.useCallback(w=>{r(h=>h.tabs.some(g=>g.id===w)?{...h,activeTabId:w,isOpen:!0}:h)},[]),ee=!!(i&&i.kind==="docs"&&i.historyIndex>0),j=!!(i&&i.kind==="docs"&&i.historyIndex<i.history.length-1),te=d.useMemo(()=>({...a,currentTab:i,currentUrl:(i==null?void 0:i.currentUrl)??F(),navVersion:(i==null?void 0:i.navVersion)??0,open:c,close:l,toggleMode:u,setMode:v,navigate:y,syncUrl:M,goBack:T,goForward:W,openNewTab:q,closeTab:X,setActiveTab:Z,canGoBack:ee,canGoForward:j}),[a,i,c,l,u,v,y,M,T,W,q,X,Z,ee,j]);return s.jsx(bt.Provider,{value:te,children:e})}function ua(){const e=ke();d.useEffect(()=>{const t=n=>{const a=n.target.closest("a[href]");if(!a)return;const r=a.getAttribute("href")||"";Pt(r)&&(a.hasAttribute("data-doc-external")||n.ctrlKey||n.metaKey||n.shiftKey||(n.preventDefault(),n.stopPropagation(),e.open(r)))};return document.addEventListener("click",t,!0),()=>document.removeEventListener("click",t,!0)},[e])}async function ma(e){const t=new URLSearchParams;Number.isFinite(e.limit)&&t.set("limit",String(Math.max(1,Math.trunc(e.limit))));const n=t.toString(),a=await p.get(n?`/api/ncp/sessions?${n}`:"/api/ncp/sessions");if(!a.ok)throw new Error(a.error.message);return a.data}async function lr(e,t=200){const n=await p.get(`/api/ncp/sessions/${encodeURIComponent(e)}/messages?limit=${Math.max(1,Math.trunc(t))}`);if(!n.ok)throw new Error(n.error.message);return n.data}async function dr(e,t){const n=await p.put(`/api/ncp/sessions/${encodeURIComponent(e)}`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function hr(e){const t=await p.delete(`/api/ncp/sessions/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(t.error.message);return t.data}function ur(){return E({queryKey:["config"],queryFn:bs,staleTime:3e4,refetchOnWindowFocus:!0})}function pa(){return E({queryKey:["app-meta"],queryFn:xs,staleTime:1/0})}function mr(){return E({queryKey:["config-meta"],queryFn:As,staleTime:1/0})}function pr(){return E({queryKey:["config-schema"],queryFn:Ps,staleTime:1/0})}function gr(){const e=A();return x({mutationFn:ks,onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),m.success(o("configSaved"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function fr(){const e=A();return x({mutationFn:({data:t})=>Cs(t),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function yr(){const e=A();return x({mutationFn:({provider:t,data:n})=>Ts(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),m.success(o("configSaved"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function wr(){const e=A();return x({mutationFn:({data:t})=>Is(t??{}),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),m.success(o("configSaved"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function Sr(){const e=A();return x({mutationFn:({provider:t})=>Es(t),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),m.success(o("configSaved"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function vr(){return x({mutationFn:({provider:e,data:t})=>Ns(e,t)})}function zr(){return x({mutationFn:({provider:e,data:t})=>Ms(e,t)})}function xr(){return x({mutationFn:({provider:e,data:t})=>Ds(e,t)})}function br(){return x({mutationFn:({provider:e})=>Rs(e)})}function Ar(){const e=A();return x({mutationFn:({channel:t,data:n})=>js(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function Pr(){const e=A();return x({mutationFn:({data:t})=>Ls(t),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function kr(){const e=A();return x({mutationFn:({data:t})=>Bs(t),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function Cr(){return x({mutationFn:({actionId:e,data:t})=>Us(e,t),onError:e=>{m.error(o("error")+": "+e.message)}})}function Tr(e){return E({queryKey:["sessions",e],queryFn:()=>Fs(e),staleTime:1e4})}function Ir(e,t=200){return E({queryKey:["session-history",e,t],queryFn:()=>Os(e,t),enabled:!!e,staleTime:5e3,retry:!1})}function Er(e){return E({queryKey:["ncp-sessions",e==null?void 0:e.limit],queryFn:()=>ma(e),staleTime:5e3,retry:!1,refetchInterval:t=>{var a;return!!((a=t.state.data)!=null&&a.sessions.some(r=>r.status==="running"))?800:!1}})}function Nr(){const e=A();return x({mutationFn:({key:t,data:n})=>_s(t,n),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history",n.key]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function Mr(){const e=A();return x({mutationFn:({key:t})=>Ws(t),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history"]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function Dr(e){var a,r;const t=((a=e==null?void 0:e.sessionKey)==null?void 0:a.trim())||void 0,n=((r=e==null?void 0:e.agentId)==null?void 0:r.trim())||void 0;return E({queryKey:["chat-capabilities",t??null,n??null],queryFn:async()=>{try{return await qs({sessionKey:t,agentId:n})}catch{return{stopSupported:!1}}},staleTime:1e4,retry:!1})}function Rr(){return E({queryKey:["chat-session-types"],queryFn:Ks,staleTime:1e4,retry:!1})}function jr(e){var i;const t=((i=e==null?void 0:e.sessionKey)==null?void 0:i.trim())||void 0,n=Array.isArray(e==null?void 0:e.states)&&e.states.length>0?e.states:void 0,a=!!(n!=null&&n.some(c=>c==="queued"||c==="running")),r=!!(e!=null&&e.syncActiveStates&&a);return E({queryKey:["chat-runs",t??null,n??null,(e==null?void 0:e.limit)??null],queryFn:()=>$s({...t?{sessionKey:t}:{},...n?{states:n}:{},...typeof(e==null?void 0:e.limit)=="number"?{limit:e.limit}:{}}),enabled:!!t||!!n,staleTime:5e3,refetchInterval:c=>{if(!r)return!1;if(e!=null&&e.isLocallyRunning)return 800;const{data:l}=c.state;return Array.isArray(l==null?void 0:l.runs)&&l.runs.length>0?800:!1},refetchIntervalInBackground:!1,retry:!1})}function Lr(e={all:!0}){return E({queryKey:["cron",e],queryFn:()=>Hs(e),staleTime:1e4})}function Br(){const e=A();return x({mutationFn:({id:t})=>Qs(t),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function Ur(){const e=A();return x({mutationFn:({id:t,enabled:n})=>Vs(t,{enabled:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function Fr(){const e=A();return x({mutationFn:({id:t,force:n})=>Gs(t,{force:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),m.success(o("configSavedApplied"))},onError:t=>{m.error(o("configSaveFailed")+": "+t.message)}})}function ga({className:e,suffix:t}){var i;const{data:n}=pa(),a=(n==null?void 0:n.name)??"NextClaw",r=(i=n==null?void 0:n.productVersion)==null?void 0:i.trim();return s.jsxs("div",{className:e??"flex items-center gap-2.5",children:[s.jsx("div",{className:"h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center",children:s.jsx("img",{src:"/logo.svg",alt:a,className:"h-full w-full object-contain"})}),s.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[s.jsx("span",{className:"truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800",children:a}),r?s.jsxs("span",{className:"text-[13px] font-medium text-gray-500",children:["v",r]}):null,t?s.jsx("span",{className:"inline-flex items-center shrink-0",children:t}):null]})]})}const fa=Yt,Or=Xt,Ct=d.forwardRef(({className:e,children:t,...n},a)=>s.jsxs($e,{ref:a,className:f("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 bg-white",e),...n,children:[t,s.jsx(Kt,{asChild:!0,children:s.jsx(He,{className:"h-4 w-4 opacity-50"})})]}));Ct.displayName=$e.displayName;const Tt=d.forwardRef(({className:e,...t},n)=>s.jsx(Qe,{ref:n,className:f("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx($t,{className:"h-4 w-4"})}));Tt.displayName=Qe.displayName;const It=d.forwardRef(({className:e,...t},n)=>s.jsx(Ve,{ref:n,className:f("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(He,{className:"h-4 w-4"})}));It.displayName=Ve.displayName;const Et=d.forwardRef(({className:e,children:t,position:n="popper",...a},r)=>s.jsx(Ht,{children:s.jsxs(Ge,{ref:r,className:f("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-white",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...a,children:[s.jsx(Tt,{}),s.jsx(Qt,{className:f("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(It,{})]})}));Et.displayName=Ge.displayName;const ya=d.forwardRef(({className:e,...t},n)=>s.jsx(Je,{ref:n,className:f("px-2 py-1.5 text-sm font-semibold",e),...t}));ya.displayName=Je.displayName;const ve=d.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(Ye,{ref:a,className:f("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100",e),...n,children:[s.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Vt,{children:s.jsx(Gt,{className:"h-4 w-4"})})}),s.jsx(Jt,{children:t})]}));ve.displayName=Ye.displayName;const wa=d.forwardRef(({className:e,...t},n)=>s.jsx(Xe,{ref:n,className:f("-mx-1 my-1 h-px bg-muted",e),...t}));wa.displayName=Xe.displayName;const Sa={default:{row:"gap-3 px-3 py-2.5 text-[14px]",icon:"h-[17px] w-[17px]",value:"text-xs",gap:"gap-3"},compact:{row:"gap-2.5 px-3 py-2 text-[13px]",icon:"h-4 w-4",value:"text-[11px]",gap:"gap-2.5"}};function Ce(e){return Sa[e]}function Be({to:e,label:t,icon:n,density:a="default",className:r}){const i=Ce(a);return s.jsx(Ze,{to:e,className:({isActive:c})=>f("group flex w-full items-center rounded-xl font-medium transition-colors duration-base",i.row,c?"bg-gray-200 text-gray-900 shadow-sm":"text-gray-600 hover:bg-gray-200/60 hover:text-gray-900",r),children:({isActive:c})=>s.jsxs(s.Fragment,{children:[s.jsx(n,{className:f(i.icon,"transition-colors",c?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),s.jsx("span",{className:"min-w-0 flex-1 text-left",children:t})]})})}function Ue({label:e,icon:t,onClick:n,density:a="default",className:r,labelClassName:i,trailing:c,trailingClassName:l,testId:u,trailingTestId:v}){const y=Ce(a);return s.jsxs("button",{type:"button",onClick:n,className:f("flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800",y.row,r),"data-testid":u,children:[s.jsx(t,{className:f(y.icon,"shrink-0 text-gray-400")}),s.jsx("span",{className:f("min-w-0 flex-1 text-left",i),children:e}),c?s.jsx("span",{className:f("shrink-0 text-gray-500",y.value,l),"data-testid":v,children:c}):null]})}function Fe({label:e,icon:t,value:n,valueLabel:a,onValueChange:r,density:i="default",children:c}){const l=Ce(i);return s.jsxs(fa,{value:n,onValueChange:r,children:[s.jsxs(Ct,{className:f("h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0",l.row),children:[s.jsxs("div",{className:f("flex min-w-0 items-center",l.gap),children:[s.jsx(t,{className:f(l.icon,"text-gray-400")}),s.jsx("span",{className:"text-left",children:e})]}),s.jsx("span",{className:f("ml-auto text-gray-500",l.value),children:a})]}),s.jsx(Et,{children:c})]})}const Nt=d.createContext(null);function va({children:e}){const[t,n]=d.useState(()=>xe());d.useEffect(()=>os(l=>{n(l)}),[]);const a=d.useCallback(c=>{rs(c),n(_())},[]),r=d.useCallback(()=>{a(t==="en"?"zh":"en")},[t,a]),i=d.useMemo(()=>({language:t,setLanguage:a,toggleLanguage:r}),[t,a,r]);return s.jsx(Nt.Provider,{value:i,children:e})}function za(){const e=d.useContext(Nt);if(!e)throw new Error("useI18n must be used within I18nProvider");return{...e,t:o}}const Mt=d.createContext(null);function xa({children:e}){const[t,n]=d.useState(()=>Pe());d.useEffect(()=>aa(c=>{n(c)}),[]);const a=d.useCallback(i=>{sa(i),n(na())},[]),r=d.useMemo(()=>({theme:t,setTheme:a}),[t,a]);return s.jsx(Mt.Provider,{value:r,children:e})}function ba(){const e=d.useContext(Mt);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Aa({mode:e}){var te,w,h,g,P;const t=mt(),n=ke(),a=ht(),{language:r,setLanguage:i}=za(),{theme:c,setTheme:l}=ba(),u=e==="settings",v=((te=Ne.find(S=>S.value===r))==null?void 0:te.label)??r,y=o(((w=Re.find(S=>S.value===c))==null?void 0:w.labelKey)??"themeWarm"),M=(g=(h=a.data)==null?void 0:h.account.email)==null?void 0:g.trim(),T=!!((P=a.data)!=null&&P.account.loggedIn),W=S=>{r!==S&&(i(S),window.location.reload())},q=S=>{c!==S&&l(S)},X=[{target:"/chat",label:o("chat"),icon:Zt},{target:"/chat/cron",label:o("cron"),icon:en},{target:"/chat/skills",label:o("marketplaceFilterSkills"),icon:tn}],Z=[{target:"/model",label:o("model"),icon:nn},{target:"/providers",label:o("providers"),icon:sn},{target:"/search",label:o("searchChannels"),icon:an},{target:"/channels",label:o("channels"),icon:rn},{target:"/runtime",label:o("runtime"),icon:on},{target:"/remote",label:o("remote"),icon:cn},{target:"/security",label:o("security"),icon:ln},{target:"/sessions",label:o("sessions"),icon:dn},{target:"/secrets",label:o("secrets"),icon:ue},{target:"/marketplace/plugins",label:o("marketplaceFilterPlugins"),icon:hn},{target:"/marketplace/mcp",label:o("marketplaceFilterMcp"),icon:un}],ee=u?Z:X,j=u?"compact":"default";return s.jsxs("aside",{className:"w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6",children:[u?s.jsx("div",{className:"shrink-0 px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1","data-testid":"settings-sidebar-header",children:[s.jsxs(Ze,{to:"/chat",className:"group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900",children:[s.jsx(mn,{className:"h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700"}),s.jsx("span",{className:"truncate",children:o("backToMain")})]}),s.jsx("span",{className:"h-4 w-px shrink-0 bg-[#dddfe6]","aria-hidden":"true"}),s.jsx("h1",{className:"truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800",children:o("settings")})]})}):s.jsx("div",{className:"shrink-0 px-2 pb-8",children:s.jsx(ga,{className:"flex items-center gap-2.5 cursor-pointer"})}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsx("nav",{className:"custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1",children:s.jsx("ul",{className:f(u?"space-y-0.5 pb-3":"space-y-1 pb-4"),children:ee.map(S=>s.jsx("li",{children:s.jsx(Be,{to:S.target,label:S.label,icon:S.icon,density:j})},S.target))})}),s.jsxs("div",{className:f("shrink-0 border-t border-[#dde0ea] bg-secondary",u?"mt-2 pt-3":"mt-3 pt-3"),children:[u?s.jsx(Ue,{onClick:()=>t.accountManager.openAccountPanel(),icon:ue,label:o("remoteAccountEntryManage"),density:"compact",className:"mb-1.5",trailing:T?M||o("remoteAccountEntryConnected"):o("remoteAccountEntryDisconnected"),trailingClassName:"max-w-[92px] truncate text-right",testId:"settings-sidebar-account-entry",trailingTestId:"settings-sidebar-account-status"}):null,e==="main"&&s.jsx("div",{className:"mb-2",children:s.jsx(Be,{to:"/settings",label:o("settings"),icon:pn})}),s.jsx("div",{className:"mb-2",children:s.jsx(Fe,{value:c,onValueChange:S=>q(S),icon:gn,label:o("theme"),valueLabel:y,density:j,children:Re.map(S=>s.jsx(ve,{value:S.value,className:"text-xs",children:o(S.labelKey)},S.value))})}),s.jsx("div",{className:"mb-2",children:s.jsx(Fe,{value:r,onValueChange:S=>W(S),icon:fn,label:o("language"),valueLabel:v,density:j,children:Ne.map(S=>s.jsx(ve,{value:S.value,className:"text-xs",children:S.label},S.value))})}),s.jsx(Ue,{onClick:()=>n.open(void 0,{kind:"docs",newTab:!0,title:"Docs"}),icon:yn,label:o("docBrowserHelp"),density:j})]})]})]})}const Oe=d.lazy(async()=>({default:(await N(async()=>{const{DocBrowser:e}=await import("./DocBrowser-tH07yTO3.js");return{DocBrowser:e}},__vite__mapDeps([0,1]))).DocBrowser}));function Pa(e){const t=e.toLowerCase();return t==="/chat"||t.startsWith("/chat/")||t==="/skills"||t.startsWith("/skills/")||t==="/cron"||t.startsWith("/cron/")}function ka(e){const t=e.toLowerCase();return t==="/channels"||t.startsWith("/channels/")}function Ca({children:e}){const{isOpen:t,mode:n}=ke();ua();const{pathname:a}=wn(),r=Pa(a),i=ka(a);return s.jsxs("div",{className:"h-screen flex bg-background font-sans text-foreground",children:[!r&&s.jsx(Aa,{mode:"settings"}),s.jsxs("div",{className:"flex-1 flex min-w-0 overflow-hidden relative",children:[s.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:r?s.jsx("div",{className:"flex-1 h-full overflow-hidden",children:e}):s.jsx("main",{className:f("flex-1 custom-scrollbar p-8",i?"overflow-auto xl:overflow-hidden":"overflow-auto"),children:s.jsx("div",{className:f("max-w-6xl mx-auto animate-fade-in h-full",i&&"min-h-0 xl:overflow-hidden"),children:e})})}),t&&n==="docked"&&s.jsx(d.Suspense,{fallback:null,children:s.jsx(Oe,{})})]}),t&&n==="floating"&&s.jsx(d.Suspense,{fallback:null,children:s.jsx(Oe,{})})]})}function Ta({children:e}){return s.jsx(ha,{children:s.jsx(Ca,{children:e})})}const Ia=ze(e=>({connectionStatus:"disconnected",setConnectionStatus:t=>e({connectionStatus:t}),channelModal:{open:!1},openChannelModal:t=>e({channelModal:{open:!0,channel:t}}),closeChannelModal:()=>e({channelModal:{open:!1}})}));function Ea(e){const t=e.trim().toLowerCase();return t?!(t.startsWith("plugins")||t.startsWith("skills")):!0}function Na(e,t){t.startsWith("plugins")&&(e==null||e.invalidateQueries({queryKey:["ncp-session-types"]}),e==null||e.invalidateQueries({queryKey:["marketplace-installed","plugin"]}),e==null||e.invalidateQueries({queryKey:["marketplace-items"]})),t.startsWith("mcp")&&(e==null||e.invalidateQueries({queryKey:["marketplace-mcp-installed"]}),e==null||e.invalidateQueries({queryKey:["marketplace-mcp-items"]}),e==null||e.invalidateQueries({queryKey:["marketplace-mcp-doctor"]}))}function Dt(e,t){if(e){if(e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["ncp-sessions"]}),t&&t.trim().length>0){e.invalidateQueries({queryKey:["session-history",t.trim()]}),e.invalidateQueries({queryKey:["ncp-session-messages",t.trim()]});return}e.invalidateQueries({queryKey:["session-history"]}),e.invalidateQueries({queryKey:["ncp-session-messages"]})}}function Ma(e,t){e&&Ea(t)&&e.invalidateQueries({queryKey:["config"]}),t.startsWith("session")&&Dt(e),Na(e,t)}function Da(e,t){if(!e)return;const{sessionKey:n,runId:a}=t.run;e.invalidateQueries({queryKey:["chat-runs"]}),n?(e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history",n]})):e.invalidateQueries({queryKey:["session-history"]}),a&&e.invalidateQueries({queryKey:["chat-run",a]})}function Ra(e,t,n){var a;if(n.type==="connection.open"){t("connected");return}if(n.type==="connection.close"||n.type==="connection.error"){t("disconnected");return}if(n.type==="config.updated"){const r=typeof((a=n.payload)==null?void 0:a.path)=="string"?n.payload.path:"";Ma(e,r);return}if(n.type==="run.updated"){Da(e,n.payload);return}if(n.type==="session.updated"){Dt(e,n.payload.sessionKey);return}n.type==="error"&&console.error("Realtime transport error:",n.payload.message)}function ja(e){const{setConnectionStatus:t}=Ia();d.useEffect(()=>(t("connecting"),it.subscribe(n=>Ra(e,t,n))),[e,t])}const La=d.lazy(async()=>({default:(await N(async()=>{const{ModelConfig:e}=await import("./ModelConfig-ChXV-3uT.js");return{ModelConfig:e}},__vite__mapDeps([2,1,3,4,5,6,7]))).ModelConfig})),he=d.lazy(async()=>({default:(await N(async()=>{const{ChatPage:e}=await import("./ChatPage-ugiGAeYI.js");return{ChatPage:e}},__vite__mapDeps([8,1,9,10,11,12,4,13,7,6,14]))).ChatPage})),Ba=d.lazy(async()=>({default:(await N(async()=>{const{SearchConfig:e}=await import("./SearchConfig-DLKJzszy.js");return{SearchConfig:e}},__vite__mapDeps([15,1,7,3,16]))).SearchConfig})),Ua=d.lazy(async()=>({default:(await N(async()=>{const{ProvidersList:e}=await import("./ProvidersList-Bq6v0Arn.js");return{ProvidersList:e}},__vite__mapDeps([17,1,3,5,16,18,14,19,12,20,7]))).ProvidersList})),Fa=d.lazy(async()=>({default:(await N(async()=>{const{ChannelsList:e}=await import("./ChannelsList-2FjU5fiD.js");return{ChannelsList:e}},__vite__mapDeps([21,1,19,20,5,16,3,18,12,7]))).ChannelsList})),Oa=d.lazy(async()=>({default:(await N(async()=>{const{RuntimeConfig:e}=await import("./RuntimeConfig-DyVKq5bp.js");return{RuntimeConfig:e}},__vite__mapDeps([22,1,18,5,7]))).RuntimeConfig})),_a=d.lazy(async()=>({default:(await N(async()=>{const{SecurityConfig:e}=await import("./security-config-DsSj-9rH.js");return{SecurityConfig:e}},__vite__mapDeps([23,1,3,18,7]))).SecurityConfig})),Wa=d.lazy(async()=>({default:(await N(async()=>{const{SessionsConfig:e}=await import("./SessionsConfig-CAUcd5m1.js");return{SessionsConfig:e}},__vite__mapDeps([24,1,9,10,7]))).SessionsConfig})),qa=d.lazy(async()=>({default:(await N(async()=>{const{SecretsConfig:e}=await import("./SecretsConfig-D1fC-5yG.js");return{SecretsConfig:e}},__vite__mapDeps([25,1,3,18,7]))).SecretsConfig})),Ka=d.lazy(async()=>({default:(await N(async()=>{const{RemoteAccessPage:e}=await import("./RemoteAccessPage-BOWUBcqS.js");return{RemoteAccessPage:e}},__vite__mapDeps([26,1,7,19]))).RemoteAccessPage})),$a=d.lazy(async()=>({default:(await N(async()=>{const{MarketplacePage:e}=await import("./MarketplacePage-C7sTQxnk.js").then(t=>t.f);return{MarketplacePage:e}},__vite__mapDeps([11,1,12,9,4,13,7]))).MarketplacePage})),Ha=d.lazy(async()=>({default:(await N(async()=>{const{McpMarketplacePage:e}=await import("./McpMarketplacePage-6pG1exmL.js");return{McpMarketplacePage:e}},__vite__mapDeps([27,1,7,12,18,4,9,13]))).McpMarketplacePage}));function Qa(){return s.jsx("div",{className:"h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40"})}function C({children:e}){return s.jsx(d.Suspense,{fallback:s.jsx(Qa,{}),children:e})}function Va(e){return s.jsx("main",{className:"flex min-h-screen items-center justify-center bg-secondary px-6 py-10",children:s.jsxs("div",{className:"w-full max-w-lg rounded-3xl border border-gray-200 bg-white p-8 shadow-card",children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-gray-500",children:o("authBrand")}),s.jsx("h1",{className:"mt-3 text-2xl font-semibold text-gray-900",children:o("authStatusLoadFailed")}),s.jsx("p",{className:"mt-3 text-sm leading-6 text-gray-600",children:e.message}),s.jsx("div",{className:"mt-6 flex gap-3",children:s.jsx(O,{onClick:e.onRetry,disabled:e.retrying,children:o("authRetryStatus")})})]})})}function Ga(e){return s.jsx("main",{className:"flex min-h-screen items-center justify-center bg-secondary px-6 py-10",children:s.jsxs("div",{className:"w-full max-w-lg rounded-3xl border border-gray-200 bg-white p-8 shadow-card",children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-gray-500",children:o("authBrand")}),s.jsx("h1",{className:"mt-3 text-2xl font-semibold text-gray-900",children:o("authStatusStarting")}),s.jsx("p",{className:"mt-3 text-sm leading-6 text-gray-600",children:o("authStatusStartingHint")}),e.message?s.jsx("p",{className:"mt-4 rounded-2xl border border-dashed border-gray-200 bg-gray-50 px-4 py-3 text-xs leading-5 text-gray-500",children:e.message}):null]})})}function Ja(){return ja(ce),s.jsxs(ms,{children:[s.jsx(Ta,{children:s.jsx("div",{className:"w-full h-full",children:s.jsxs(zn,{children:[s.jsx(b,{path:"/chat/skills",element:s.jsx(U,{to:"/skills",replace:!0})}),s.jsx(b,{path:"/chat/cron",element:s.jsx(U,{to:"/cron",replace:!0})}),s.jsx(b,{path:"/chat/:sessionId?",element:s.jsx(C,{children:s.jsx(he,{view:"chat"})})}),s.jsx(b,{path:"/skills",element:s.jsx(C,{children:s.jsx(he,{view:"skills"})})}),s.jsx(b,{path:"/cron",element:s.jsx(C,{children:s.jsx(he,{view:"cron"})})}),s.jsx(b,{path:"/model",element:s.jsx(C,{children:s.jsx(La,{})})}),s.jsx(b,{path:"/search",element:s.jsx(C,{children:s.jsx(Ba,{})})}),s.jsx(b,{path:"/providers",element:s.jsx(C,{children:s.jsx(Ua,{})})}),s.jsx(b,{path:"/channels",element:s.jsx(C,{children:s.jsx(Fa,{})})}),s.jsx(b,{path:"/runtime",element:s.jsx(C,{children:s.jsx(Oa,{})})}),s.jsx(b,{path:"/remote",element:s.jsx(C,{children:s.jsx(Ka,{})})}),s.jsx(b,{path:"/security",element:s.jsx(C,{children:s.jsx(_a,{})})}),s.jsx(b,{path:"/sessions",element:s.jsx(C,{children:s.jsx(Wa,{})})}),s.jsx(b,{path:"/secrets",element:s.jsx(C,{children:s.jsx(qa,{})})}),s.jsx(b,{path:"/settings",element:s.jsx(U,{to:"/model",replace:!0})}),s.jsx(b,{path:"/marketplace/skills",element:s.jsx(U,{to:"/skills",replace:!0})}),s.jsx(b,{path:"/marketplace",element:s.jsx(U,{to:"/marketplace/plugins",replace:!0})}),s.jsx(b,{path:"/marketplace/mcp",element:s.jsx(C,{children:s.jsx(Ha,{})})}),s.jsx(b,{path:"/marketplace/:type",element:s.jsx(C,{children:s.jsx($a,{})})}),s.jsx(b,{path:"/",element:s.jsx(U,{to:"/chat",replace:!0})}),s.jsx(b,{path:"*",element:s.jsx(U,{to:"/chat",replace:!0})})]})})}),s.jsx(ps,{})]})}function Ya(){var t;const e=Ys();if(e.isLoading&&!e.isError){const n=e.failureCount>0&&e.failureReason instanceof Error?e.failureReason.message:void 0;return s.jsx(Ga,{message:n})}return e.isError?s.jsx(Va,{message:e.error instanceof Error?e.error.message:o("authStatusLoadFailed"),retrying:e.isRefetching,onRetry:()=>{e.refetch()}}):(t=e.data)!=null&&t.enabled&&!e.data.authenticated?s.jsx(Zs,{username:e.data.username}):s.jsx(Ja,{})}function Xa(){return s.jsxs(Sn,{client:ce,children:[s.jsx(Ya,{}),s.jsx(vn,{position:"top-right",richColors:!0})]})}xn.createRoot(document.getElementById("root")).render(s.jsx(d.StrictMode,{children:s.jsx(xa,{children:s.jsx(va,{children:s.jsx(bn,{children:s.jsx(Xa,{})})})})}));export{br as $,Lr as A,O as B,pt as C,Se as D,Br as E,Ur as F,Fr as G,wt as H,ge as I,Ws as J,it as K,Ne as L,ar as M,$s as N,sr as O,Er as P,hr as Q,ie as R,fa as S,Re as T,lr as U,fr as V,yr as W,Sr as X,vr as Y,zr as Z,xr as _,mr as a,_ as a0,wr as a1,p as a2,Ar as a3,Cr as a4,Pr as a5,gt as a6,ft as a7,yt as a8,Ys as a9,rr as aa,cr as ab,ir as ac,or as ad,Nr as ae,Mr as af,tr as ag,kr as ah,mt as ai,ht as aj,I as ak,ls as al,Cn as am,tt as an,nt as ao,st as ap,at as aq,In as ar,nr as as,Pt as at,pr as b,f as c,gr as d,Ct as e,Or as f,Et as g,ve as h,jr as i,Tr as j,Dr as k,Ir as l,Rr as m,dt as n,dr as o,_s as p,ke as q,Ia as r,za as s,o as t,ur as u,ba as v,ga as w,Be as x,Ue as y,Fe as z};
|