nextclaw 0.13.21 → 0.13.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli/index.js +206 -192
- package/package.json +9 -9
- package/templates/USAGE.md +19 -19
- package/ui-dist/assets/{ChannelsList-CIMYaIji.js → ChannelsList-a063_8pv.js} +1 -1
- package/ui-dist/assets/{ChatPage-B5UpeEIp.js → ChatPage-CMthudUt.js} +1 -1
- package/ui-dist/assets/{DocBrowser-BJ610SPa.js → DocBrowser-BOvBC_5q.js} +1 -1
- package/ui-dist/assets/{LogoBadge-BKq1GKWP.js → LogoBadge-BUvLZbji.js} +1 -1
- package/ui-dist/assets/{MarketplacePage-Bs3sLsgx.js → MarketplacePage-CcbfvtGX.js} +1 -1
- package/ui-dist/assets/{McpMarketplacePage-BWTguHCs.js → McpMarketplacePage-D56yvyWI.js} +1 -1
- package/ui-dist/assets/{ModelConfig-B-oTP-Bc.js → ModelConfig-D5AuTffd.js} +1 -1
- package/ui-dist/assets/{ProvidersList-r7bD0-R0.js → ProvidersList-Bd4n7muZ.js} +1 -1
- package/ui-dist/assets/{RemoteAccessPage-D7On6waK.js → RemoteAccessPage-Be8jduPM.js} +1 -1
- package/ui-dist/assets/{RuntimeConfig-C11xVxH9.js → RuntimeConfig-D8DYogZ1.js} +1 -1
- package/ui-dist/assets/{SearchConfig-BVZdCxiM.js → SearchConfig-BtiGCmXR.js} +1 -1
- package/ui-dist/assets/{SecretsConfig-DuEDdC3X.js → SecretsConfig-fwAjbwlq.js} +1 -1
- package/ui-dist/assets/{SessionsConfig-Y-Blf_-K.js → SessionsConfig-Y7_TDSk2.js} +1 -1
- package/ui-dist/assets/{chat-message-B6VCCEXF.js → chat-message-Cwq8nW0e.js} +1 -1
- package/ui-dist/assets/index-C6dwNe7e.js +8 -0
- package/ui-dist/assets/{label-DzwitL78.js → label-C0dJBNgU.js} +1 -1
- package/ui-dist/assets/{page-layout-DEq5N_8L.js → page-layout-4_789zOC.js} +1 -1
- package/ui-dist/assets/{popover-CY54V8F6.js → popover-CWmq2f6H.js} +1 -1
- package/ui-dist/assets/{security-config-CgbYP57d.js → security-config-CZeVwEwq.js} +1 -1
- package/ui-dist/assets/{skeleton-zjQZMWu9.js → skeleton-kjkadEki.js} +1 -1
- package/ui-dist/assets/{status-dot-CU_P0tvO.js → status-dot-C7cVa53V.js} +1 -1
- package/ui-dist/assets/{switch-PvjTvlcs.js → switch-C6zdGbY0.js} +1 -1
- package/ui-dist/assets/{tabs-custom-Bke5J9ny.js → tabs-custom-BQj0Z-ZC.js} +1 -1
- package/ui-dist/assets/{useConfirmDialog-8tzzp_oW.js → useConfirmDialog-yX-ZMNf9.js} +1 -1
- package/ui-dist/index.html +1 -1
- package/ui-dist/assets/index-DvA7S11O.js +0 -8
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocBrowser-BJ610SPa.js","assets/vendor-CmQZsDAE.js","assets/ModelConfig-B-oTP-Bc.js","assets/label-DzwitL78.js","assets/skeleton-zjQZMWu9.js","assets/config-hints-CApS3K_7.js","assets/provider-models-BOeNnjk9.js","assets/page-layout-DEq5N_8L.js","assets/ChatPage-B5UpeEIp.js","assets/useConfirmDialog-8tzzp_oW.js","assets/chat-message-B6VCCEXF.js","assets/MarketplacePage-Bs3sLsgx.js","assets/tabs-custom-Bke5J9ny.js","assets/marketplace-localization-Dk31LJJJ.js","assets/popover-CY54V8F6.js","assets/SearchConfig-BVZdCxiM.js","assets/config-layout-BHnOoweL.js","assets/ProvidersList-r7bD0-R0.js","assets/switch-PvjTvlcs.js","assets/status-dot-CU_P0tvO.js","assets/LogoBadge-BKq1GKWP.js","assets/ChannelsList-CIMYaIji.js","assets/RuntimeConfig-C11xVxH9.js","assets/security-config-CgbYP57d.js","assets/SessionsConfig-Y-Blf_-K.js","assets/SecretsConfig-DuEDdC3X.js","assets/RemoteAccessPage-D7On6waK.js","assets/McpMarketplacePage-BWTguHCs.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as Pt,c as kt,r as l,j as a,a as Ct,O as Be,P as It,C as Ue,b as Tt,X as Dt,T as Fe,D as Oe,R as Nt,Q as Mt,u as D,d as ze,e as p,K as le,S as Et,L as Rt,f as k,g as b,h as Ke,I as jt,i as _e,k as We,l as Lt,m as He,n as Bt,o as $e,V as Ut,p as qe,q as Qe,s as Ft,v as Ot,w as Kt,x as Ve,y as _t,z as Wt,M as Ht,A as $t,B as qt,E as Qt,F as Vt,G as Gt,H as Jt,J as Yt,W as Xt,N as Zt,U as en,Y as tn,Z as nn,_ as ie,$ as an,a0 as ke,a1 as sn,a2 as rn,a3 as on,a4 as cn,a5 as ln,a6 as dn,a7 as hn,a8 as A,a9 as K,aa as un,ab as mn}from"./vendor-CmQZsDAE.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"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const h of i.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&s(h)}).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 s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();const pn="modulepreload",gn=function(e){return"/"+e},Ce={},N=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let h=function(w){return Promise.all(w.map(S=>Promise.resolve(S).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),y=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));r=h(n.map(w=>{if(w=gn(w),w in Ce)return;Ce[w]=!0;const S=w.endsWith(".css"),u=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${w}"]${u}`))return;const m=document.createElement("link");if(m.rel=S?"stylesheet":pn,S||(m.as="script"),m.crossOrigin="",m.href=w,y&&m.setAttribute("nonce",y),document.head.appendChild(m),S)return new Promise((P,j)=>{m.addEventListener("load",P),m.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${w}`)))})}))}function i(h){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=h,window.dispatchEvent(f),!f.defaultPrevented)throw h}return r.then(h=>{for(const f of h||[])f.status==="rejected"&&i(f.reason);return t().catch(i)})};function z(...e){return Pt(kt(e))}const fn=Ct("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"}}),$=l.forwardRef(({className:e,variant:t,size:n,...s},r)=>a.jsx("button",{className:z(fn({variant:t,size:n,className:e})),ref:r,...s}));$.displayName="Button";const yn=Nt,vn=It,Ge=l.forwardRef(({className:e,...t},n)=>a.jsx(Be,{ref:n,className:z("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}));Ge.displayName=Be.displayName;const Je=l.forwardRef(({className:e,children:t,...n},s)=>a.jsxs(vn,{children:[a.jsx(Ge,{}),a.jsxs(Ue,{ref:s,className:z("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,a.jsxs(Tt,{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:[a.jsx(Dt,{className:"h-4 w-4 text-gray-500"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Je.displayName=Ue.displayName;const Ye=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ye.displayName="DialogHeader";const wn=({className:e,...t})=>a.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-3",e),...t});wn.displayName="DialogFooter";const Xe=l.forwardRef(({className:e,...t},n)=>a.jsx(Fe,{ref:n,className:z("text-lg font-semibold leading-tight tracking-tight text-gray-900",e),...t}));Xe.displayName=Fe.displayName;const Ze=l.forwardRef(({className:e,...t},n)=>a.jsx(Oe,{ref:n,className:z("text-sm text-gray-500 leading-relaxed",e),...t}));Ze.displayName=Oe.displayName;const zn="http://127.0.0.1:18791",B=(()=>{var e;return typeof window<"u"&&((e=window.location)!=null&&e.origin)?window.location.origin:zn})();function Sn(e){return e.replace(/\s+/g," ").trim().slice(0,200)}function xn(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 ne(e,t={}){const n=`${B}${e}`,s=(t.method||"GET").toUpperCase(),r=await fetch(n,{credentials:"include",headers:{"Content-Type":"application/json",...t.headers},...t}),i=await r.text();let h=null;if(i)try{h=JSON.parse(i)}catch{}if(!h){const f=i?Sn(i):"",y=xn(e,r.status),w=[`Non-JSON response (${r.status} ${r.statusText}) on ${s} ${e}`];return f&&w.push(`body=${f}`),y&&w.push(`hint=${y}`),{ok:!1,error:{code:"INVALID_RESPONSE",message:w.join(" | "),details:{status:r.status,statusText:r.statusText,method:s,endpoint:e,url:n,bodySnippet:f||void 0,hint:y}}}}return r.ok,h}const g={get:e=>ne(e,{method:"GET"}),put:(e,t)=>ne(e,{method:"PUT",body:JSON.stringify(t)}),post:(e,t)=>ne(e,{method:"POST",body:JSON.stringify(t)}),delete:e=>ne(e,{method:"DELETE"})};async function et(){const e=await g.get("/api/remote/status");if(!e.ok)throw new Error(e.error.message);return e.data}async function bn(){const e=await g.get("/api/remote/doctor");if(!e.ok)throw new Error(e.error.message);return e.data}async function An(e){const t=await g.post("/api/remote/auth/start",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Pn(e){const t=await g.post("/api/remote/auth/poll",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function kn(){const e=await g.post("/api/remote/logout",{});if(!e.ok)throw new Error(e.error.message);return e.data}async function Ie(e){const t=await g.put("/api/remote/settings",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function ae(e){const t=await g.post(`/api/remote/service/${e}`,{});if(!t.ok)throw new Error(t.error.message);return t.data}const Cn={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."}},In={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."},remoteStatusIssueTitle:{zh:"远程连接当前有异常",en:"The remote connection needs attention"},remoteStatusIssueDescription:{zh:"账号和设备配置都还在,但当前没有稳定连上平台。你可以重新连接,或先去设备列表确认这台设备的状态。",en:"Your account and device settings are still there, but this device is not stably connected to the platform right now. Reconnect it or check the device list first."},remoteStatusIssueDetailTitle:{zh:"当前提示",en:"Current Hint"},remoteStatusIssueDetailGeneric:{zh:"连接曾经建立,但随后被平台侧主动关闭。常见原因包括登录态失效、平台侧中继不可用,或云端配额暂时触顶。",en:"The connection was established and then closed by the platform. Common causes include an expired session, an unavailable relay, or a temporary cloud quota limit."},remoteStatusIssueDetailServiceStopped:{zh:"本地托管服务没有在运行,所以远程连接不会保持在线。",en:"The local managed service is not running, so the remote connection cannot stay online."},remoteSignInAndEnable:{zh:"登录并开启远程访问",en:"Sign In and Enable Remote Access"},remoteEnableNow:{zh:"开启远程访问",en:"Enable Remote Access"},remoteReconnectNow:{zh:"重新连接",en:"Reconnect"},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 and Device Entry"},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"},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:"Register If Needed"},remoteRegisterIfNeededHelp:{zh:"开启后会走平台注册接口,然后自动保存登录态。",en:"When enabled, the UI will register first 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"}},tt="nextclaw.ui.language",Te=[{value:"en",label:"English"},{value:"zh",label:"中文"}],Tn={en:"en-US",zh:"zh-CN"};let Y="en",de=!1;const he=new Set;function Dn(e){return e==="en"||e==="zh"}function Nn(){var t;return typeof navigator>"u"?"en":(((t=navigator.language)==null?void 0:t.toLowerCase())??"en").startsWith("zh")?"zh":"en"}function Mn(){if(typeof window>"u")return"en";try{const e=window.localStorage.getItem(tt);if(Dn(e))return e}catch{}return Nn()}function Se(){return de||(Y=Mn(),de=!0),Y}function W(){return de?Y:Se()}function En(e){if(Se(),Y!==e){if(Y=e,typeof window<"u")try{window.localStorage.setItem(tt,e)}catch{}he.forEach(t=>t(e))}}function Rn(e){return he.add(e),()=>{he.delete(e)}}function xe(e=W()){return Tn[e]}function nt(e,t=W()){if(!e)return"-";const n=e instanceof Date?e:new Date(e);return Number.isNaN(n.getTime())?typeof e=="string"?e:"-":n.toLocaleString(xe(t))}function xs(e,t=W()){if(!e)return"-";const n=e instanceof Date?e:new Date(e);return Number.isNaN(n.getTime())?typeof e=="string"?e:"-":new Intl.DateTimeFormat(xe(t),{year:"numeric",month:"2-digit",day:"2-digit"}).format(n)}function bs(e,t=W()){return new Intl.NumberFormat(xe(t)).format(e)}const De={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"},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"},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"},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"},groupPolicy:{zh:"群组策略",en:"Group Policy"},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."},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."},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"},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"},chatInputAttachComingSoon:{zh:"即将支持",en:"Coming soon"},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"},...Cn,...In,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"}};function o(e,t=W()){var n,s;return((n=De[e])==null?void 0:n[t])||((s=De[e])==null?void 0:s.en)||e}const oe=new Mt({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!0}}}),be=["remote-status"],jn="https://platform.nextclaw.io",Ln="https://nextclaw-platform-console.pages.dev",J=async()=>await oe.fetchQuery({queryKey:be,queryFn:et,staleTime:5e3}),E=async()=>(await oe.invalidateQueries({queryKey:be}),await J()),Ne=(e,t)=>{var r,i;const n=t==null?void 0:t.trim();if(n)return n;const s=(r=e==null?void 0:e.settings.platformApiBase)==null?void 0:r.trim();return s||((i=e==null?void 0:e.account.apiBase)==null?void 0:i.trim())||void 0};function se(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 jn;if(n.hostname.includes("nextclaw-provider-gateway-api")&&n.hostname.endsWith(".workers.dev"))return Ln}const Bn=e=>se(e==null?void 0:e.account.apiBase)||se(e==null?void 0:e.settings.platformApiBase)||se(e==null?void 0:e.platformBase)||se(e==null?void 0:e.account.platformBase)||void 0;function at(){return D({queryKey:be,queryFn:et,staleTime:5e3,refetchOnWindowFocus:!0})}const x=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:s,intervalMs:r,statusMessage:i})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:s,authPollIntervalMs:r,authStatusMessage:i}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(s=>({authStatusMessage:t??s.authStatusMessage,authPollIntervalMs:n??s.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:"",authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));class Un{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=t=>{this.afterSignedIn=t},this.openAccountPanel=()=>{x.getState().openPanel()},this.closeAccountPanel=()=>{x.getState().closePanel()},this.syncRemoteStatus=t=>{t!=null&&t.account.loggedIn&&(this.clearPollTimer(),x.getState().clearBrowserAuth())},this.ensureSignedIn=async t=>{const n=await J();return n.account.loggedIn?!0:(t!=null&&t.pendingAction&&x.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 J(),s=await An({apiBase:Ne(n,t==null?void 0:t.apiBase)});x.getState().beginBrowserAuth({sessionId:s.sessionId,verificationUri:s.verificationUri,expiresAt:s.expiresAt,intervalMs:s.intervalMs,statusMessage:o("remoteBrowserAuthWaiting")}),window.open(s.verificationUri,"_blank","noopener,noreferrer")||x.getState().setAuthStatusMessage(o("remoteBrowserAuthPopupBlocked")),this.scheduleBrowserAuthPoll()}catch(n){const s=n instanceof Error?n.message:o("remoteBrowserAuthStartFailed");p.error(`${o("remoteBrowserAuthStartFailed")}: ${s}`)}},this.resumeBrowserSignIn=()=>{const t=x.getState().authVerificationUri;t&&window.open(t,"_blank","noopener,noreferrer")},this.logout=async()=>{try{await kn(),x.getState().clearPendingAction(),x.getState().clearBrowserAuth(),await E(),p.success(o("remoteLogoutSuccess"))}catch(t){const n=t instanceof Error?t.message:o("remoteLogoutFailed");p.error(`${o("remoteLogoutFailed")}: ${n}`)}},this.openNextClawWeb=async()=>{const t=await J(),n=Bn(t);if(!n){p.error(o("remoteOpenWebUnavailable"));return}window.open(n,"_blank","noopener,noreferrer")},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();const{authSessionId:t,authPollIntervalMs:n}=x.getState();t&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},n))},this.pollBrowserSignIn=async()=>{const t=x.getState();if(t.authSessionId)try{const n=await J(),s=await Pn({sessionId:t.authSessionId,apiBase:Ne(n)});if(s.status==="pending"){x.getState().updateBrowserAuth({statusMessage:o("remoteBrowserAuthWaiting"),intervalMs:s.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(s.status==="expired"){this.clearPollTimer(),x.getState().clearBrowserAuth(),p.error(s.message||o("remoteBrowserAuthExpired"));return}x.getState().setAuthStatusMessage(o("remoteBrowserAuthCompleted"));const r=await E(),{pendingAction:i}=x.getState();this.clearPollTimer(),x.getState().clearBrowserAuth(),p.success(o("remoteLoginSuccess")),i&&this.afterSignedIn&&await this.afterSignedIn(i,r),x.getState().clearPendingAction()}catch(n){this.clearPollTimer(),x.getState().clearBrowserAuth();const s=n instanceof Error?n.message:o("remoteBrowserAuthPollFailed");p.error(`${o("remoteBrowserAuthPollFailed")}: ${s}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{const t=x.getState();return{sessionId:t.authSessionId,expiresAt:t.authExpiresAt?nt(t.authExpiresAt):"-"}}}}const M=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:s})=>e({enabled:t,deviceName:n,platformApiBase:s,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})}));class Fn{constructor(){this.accountManager=null,this.bindAccountManager=t=>{this.accountManager=t},this.syncStatus=t=>{if(!t)return;const n=M.getState();n.draftTouched||n.actionLabel||this.hydrateDraftFromStatus(t)},this.setEnabled=t=>{M.getState().setEnabled(t)},this.setDeviceName=t=>{M.getState().setDeviceName(t)},this.setPlatformApiBase=t=>{M.getState().setPlatformApiBase(t)},this.setAdvancedOpen=t=>{M.getState().setAdvancedOpen(t)},this.enableRemoteAccess=async t=>{var r;const n=t??await E(),s=M.getState();if(!n.account.loggedIn){await((r=this.accountManager)==null?void 0:r.ensureSignedIn({pendingAction:{type:"enable-remote"},apiBase:s.platformApiBase}));return}await this.applyEnabledState(!0,n)},this.disableRemoteAccess=async t=>{const n=t??await E();await this.applyEnabledState(!1,n)},this.repairRemoteAccess=async t=>{var r;const n=t??await E();if(!n.account.loggedIn){await((r=this.accountManager)==null?void 0:r.ensureSignedIn({pendingAction:{type:"enable-remote"}}));return}const s=n.service.running?"restart":"start";await this.runManagedAction({actionLabel:o(s==="restart"?"remoteActionRestarting":"remoteActionStarting"),job:async()=>{await ae(s);const i=await E();this.hydrateDraftFromStatus(i)},successMessage:o("remoteServiceRecovered")})},this.saveAdvancedSettings=async t=>{const n=t??await E(),s=M.getState();await this.runManagedAction({actionLabel:o("remoteActionSavingAdvanced"),job:async()=>{await Ie({enabled:s.enabled,deviceName:s.deviceName.trim(),platformApiBase:s.platformApiBase.trim()});const r=await E();this.hydrateDraftFromStatus(r)},successMessage:n.settings.enabled===s.enabled?o("remoteSettingsSaved"):o("remoteAdvancedSaved")})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:o("remoteDoctorRunning"),job:async()=>{const t=await bn();M.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)=>{t&&t.type==="enable-remote"&&await this.applyEnabledState(!0,n)},this.applyEnabledState=async(t,n)=>{const s=M.getState();await this.runManagedAction({actionLabel:o(t?"remoteActionEnabling":"remoteActionDisabling"),job:async()=>{await Ie({enabled:t,deviceName:s.deviceName.trim(),platformApiBase:s.platformApiBase.trim()});const r=await E();if(this.hydrateDraftFromStatus(r),t){const h=r.service.running?"restart":"start";await ae(h)}else n.service.running&&await ae("restart");const i=await E();this.hydrateDraftFromStatus(i)},successMessage:o(t?"remoteEnabledReady":"remoteDisabledDone")})},this.runServiceAction=async(t,n)=>{await this.runManagedAction({actionLabel:n,job:async()=>{const s=await ae(t),r=await E();this.hydrateDraftFromStatus(r),p.success(s.message)}})},this.hydrateDraftFromStatus=t=>{M.getState().hydrateDraft({enabled:t.settings.enabled,deviceName:t.settings.deviceName,platformApiBase:t.settings.platformApiBase})},this.runManagedAction=async t=>{M.getState().beginAction(t.actionLabel);try{await t.job(),t.successMessage&&p.success(t.successMessage)}catch(n){const s=n instanceof Error?n.message:o("error");throw p.error(s),n}finally{M.getState().finishAction()}}}}class On{constructor(){this.accountManager=new Un,this.remoteAccessManager=new Fn}}const X=new On;X.accountManager.bindSignedInContinuation(X.remoteAccessManager.resumePendingActionAfterSignIn);X.remoteAccessManager.bindAccountManager(X.accountManager);const st=l.createContext(null);function Kn({children:e}){return a.jsx(st.Provider,{value:X,children:e})}function rt(){const e=l.useContext(st);if(!e)throw new Error("useAppPresenter must be used inside AppPresenterProvider");return e}function re(e){var t;return a.jsxs("div",{className:"flex items-start justify-between gap-4 py-2 text-sm",children:[a.jsx("span",{className:"text-gray-500",children:e.label}),a.jsx("span",{className:"text-right text-gray-900",children:((t=e.value)==null?void 0:t.trim())||"-"})]})}function _n(){const e=rt(),t=at(),n=x(y=>y.panelOpen),s=x(y=>y.authSessionId),r=x(y=>y.authVerificationUri),i=x(y=>y.authExpiresAt),h=x(y=>y.authStatusMessage),f=t.data;return l.useEffect(()=>{e.accountManager.syncRemoteStatus(f)},[e,f]),a.jsx(yn,{open:n,onOpenChange:y=>y?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:a.jsxs(Je,{className:"max-w-xl",children:[a.jsxs(Ye,{children:[a.jsxs(Xe,{className:"flex items-center gap-2",children:[a.jsx(le,{className:"h-5 w-5 text-primary"}),o("accountPanelTitle")]}),a.jsx(Ze,{children:o("accountPanelDescription")})]}),f!=null&&f.account.loggedIn?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3",children:[a.jsx("p",{className:"text-sm font-medium text-emerald-800",children:o("accountPanelSignedInTitle")}),a.jsx("p",{className:"mt-1 text-sm text-emerald-700",children:o("accountPanelSignedInDescription")})]}),a.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3",children:[a.jsx(re,{label:o("remoteAccountEmail"),value:f.account.email}),a.jsx(re,{label:o("remoteAccountRole"),value:f.account.role})]}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsxs($,{onClick:()=>void e.accountManager.openNextClawWeb(),children:[a.jsx(Et,{className:"mr-2 h-4 w-4"}),o("remoteOpenDeviceList")]}),a.jsxs($,{variant:"outline",onClick:()=>void e.accountManager.logout(),children:[a.jsx(Rt,{className:"mr-2 h-4 w-4"}),o("remoteLogout")]})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3",children:[a.jsx("p",{className:"text-sm font-medium text-gray-900",children:o("accountPanelSignedOutTitle")}),a.jsx("p",{className:"mt-1 text-sm text-gray-600",children:o("accountPanelSignedOutDescription")}),s?a.jsxs("div",{className:"mt-3 border-t border-white/80 pt-3",children:[a.jsx(re,{label:o("remoteBrowserAuthSession"),value:s}),a.jsx(re,{label:o("remoteBrowserAuthExpiresAt"),value:i?nt(i):"-"})]}):null]}),h?a.jsx("p",{className:"text-sm text-gray-600",children:h}):null,a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsx($,{onClick:()=>void e.accountManager.startBrowserSignIn(),children:o(s?"remoteBrowserAuthActionRetry":"remoteBrowserAuthAction")}),r?a.jsx($,{variant:"outline",onClick:()=>e.accountManager.resumeBrowserSignIn(),children:o("remoteBrowserAuthResume")}):null]})]})]})})}const ot=l.forwardRef(({className:e,hover:t=!0,...n},s)=>a.jsx("div",{ref:s,className:z("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}));ot.displayName="Card";const it=l.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:z("flex flex-col space-y-1.5 p-6",e),...t}));it.displayName="CardHeader";const ct=l.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:z("text-[15px] font-semibold leading-tight tracking-tight text-gray-900",e),...t}));ct.displayName="CardTitle";const lt=l.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:z("text-[13px] text-gray-400 leading-relaxed",e),...t}));lt.displayName="CardDescription";const dt=l.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:z("p-6 pt-0",e),...t}));dt.displayName="CardContent";const Wn=l.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:z("flex items-center justify-between p-6 pt-0",e),...t}));Wn.displayName="CardFooter";const ue=l.forwardRef(({className:e,type:t,...n},s)=>a.jsx("input",{type:t,className:z("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:s,...n}));ue.displayName="Input";async function Hn(){const e=await g.get("/api/auth/status");if(!e.ok)throw new Error(e.error.message);return e.data}async function $n(e){const t=await g.post("/api/auth/setup",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function qn(e){const t=await g.post("/api/auth/login",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Qn(){const e=await g.post("/api/auth/logout",{});if(!e.ok)throw new Error(e.error.message);return e.data}async function Vn(e){const t=await g.put("/api/auth/password",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Gn(e){const t=await g.put("/api/auth/enabled",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function Jn(){const e=await g.get("/api/app/meta");if(!e.ok)throw new Error(e.error.message);return e.data}async function Yn(){const e=await g.get("/api/config");if(!e.ok)throw new Error(e.error.message);return e.data}async function Xn(){const e=await g.get("/api/config/meta");if(!e.ok)throw new Error(e.error.message);return e.data}async function Zn(){const e=await g.get("/api/config/schema");if(!e.ok)throw new Error(e.error.message);return e.data}async function ea(e){const t=await g.put("/api/config/model",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function ta(e){const t=await g.put("/api/config/search",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function na(e,t){const n=await g.put(`/api/config/providers/${e}`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function aa(e={}){const t=await g.post("/api/config/providers",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function sa(e){const t=await g.delete(`/api/config/providers/${e}`);if(!t.ok)throw new Error(t.error.message);return t.data}async function ra(e,t){const n=await g.post(`/api/config/providers/${e}/test`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function oa(e,t={}){const n=await g.post(`/api/config/providers/${e}/auth/start`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function ia(e,t){const n=await g.post(`/api/config/providers/${e}/auth/poll`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function ca(e){const t=await g.post(`/api/config/providers/${e}/auth/import-cli`,{});if(!t.ok)throw new Error(t.error.message);return t.data}async function la(e,t){const n=await g.put(`/api/config/channels/${e}`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function da(e){const t=await g.put("/api/config/runtime",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function ha(e){const t=await g.put("/api/config/secrets",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function ua(e,t){const n=await g.post(`/api/config/actions/${e}/execute`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function ma(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(),s=await g.get(n?"/api/sessions?"+n:"/api/sessions");if(!s.ok)throw new Error(s.error.message);return s.data}async function pa(e,t=200){const n=await g.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 ga(e,t){const n=await g.put(`/api/sessions/${encodeURIComponent(e)}`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function fa(e){const t=await g.delete(`/api/sessions/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(t.error.message);return t.data}function ya(e){const t=e.split(`
|
|
3
|
-
`);let n="";const s=[];for(const r of t){const i=r.trimEnd();if(!(!i||i.startsWith(":"))){if(i.startsWith("event:")){n=i.slice(6).trim();continue}i.startsWith("data:")&&s.push(i.slice(5).trimStart())}}return n?{event:n,data:s.join(`
|
|
4
|
-
`)}:null}async function ht(e){var y;const t=await fetch(`${B}${e.path}`,{method:e.method,credentials:"include",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},...e.body!==void 0?{body:JSON.stringify(e.body)}:{},...e.signal?{signal:e.signal}:{}});if(!t.ok){const w=await t.text(),S=`HTTP ${t.status}`,u=w.trim();throw new Error(u||S)}const n=(y=t.body)==null?void 0:y.getReader();if(!n)throw new Error("SSE response body unavailable");const s=new TextDecoder;let r="",i=null,h=null;const f=w=>{const S=ya(w);if(!S)return;let u;if(S.data)try{u=JSON.parse(S.data)}catch{u=void 0}if(S.event==="ready"){const m=u??{};h=typeof m.sessionKey=="string"&&m.sessionKey.trim()?m.sessionKey:h,e.onReady(m);return}if(S.event==="delta"){e.onDelta(u??{delta:""});return}if(S.event==="session_event"){e.onSessionEvent({data:u});return}if(S.event==="final"){const m=u;i={sessionKey:typeof(m==null?void 0:m.sessionKey)=="string"&&m.sessionKey.trim()?m.sessionKey:h??"",reply:typeof(m==null?void 0:m.reply)=="string"?m.reply:""};return}if(S.event==="error"){const m=u??{};throw new Error((m.message??"").trim()||"chat stream failed")}};try{let w=!0;for(;w;){const{value:S,done:u}=await n.read();if(u){w=!1;continue}r+=s.decode(S,{stream:!0});let m=r.indexOf(`
|
|
5
|
-
|
|
6
|
-
`);for(;m!==-1;){const P=r.slice(0,m);r=r.slice(m+2),f(P),m=r.indexOf(`
|
|
7
|
-
|
|
8
|
-
`)}}r.trim()&&f(r)}finally{n.releaseLock()}if(i)return i;if(h)return{sessionKey:h,reply:""};throw new Error("chat stream ended without final event")}async function As(e,t){return ht({path:"/api/chat/turn/stream",method:"POST",body:e,signal:t.signal,onReady:t.onReady,onDelta:t.onDelta,onSessionEvent:t.onSessionEvent})}async function Ps(e,t){const n=new URLSearchParams;typeof e.fromEventIndex=="number"&&Number.isFinite(e.fromEventIndex)&&n.set("fromEventIndex",String(Math.max(0,Math.trunc(e.fromEventIndex))));const s=n.toString(),r=`/api/chat/runs/${encodeURIComponent(e.runId)}/stream${s?`?${s}`:""}`;return ht({path:r,method:"GET",signal:t.signal,onReady:t.onReady,onDelta:t.onDelta,onSessionEvent:t.onSessionEvent})}async function va(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(),s=await g.get(n?`/api/chat/capabilities?${n}`:"/api/chat/capabilities");if(!s.ok)throw new Error(s.error.message);return s.data}async function wa(){const e=await g.get("/api/chat/session-types");if(!e.ok)throw new Error(e.error.message);return e.data}async function ks(){const e=await g.get("/api/ncp/session-types");if(!e.ok)throw new Error(e.error.message);return e.data}async function Cs(e){const t=await g.post("/api/chat/turn/stop",e);if(!t.ok)throw new Error(t.error.message);return t.data}async function za(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(),s=await g.get(n?`/api/chat/runs?${n}`:"/api/chat/runs");if(!s.ok)throw new Error(s.error.message);return s.data}async function Sa(e){const t=new URLSearchParams;e!=null&&e.all&&t.set("all","1");const n=t.toString(),s=await g.get(n?"/api/cron?"+n:"/api/cron");if(!s.ok)throw new Error(s.error.message);return s.data}async function xa(e){const t=await g.delete(`/api/cron/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(t.error.message);return t.data}async function ba(e,t){const n=await g.put(`/api/cron/${encodeURIComponent(e)}/enable`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Aa(e,t){const n=await g.post(`/api/cron/${encodeURIComponent(e)}/run`,t);if(!n.ok)throw new Error(n.error.message);return n.data}function Pa(){return D({queryKey:["auth-status"],queryFn:Hn,staleTime:5e3,retry:3,retryDelay:e=>Math.min(1e3*e,3e3),refetchOnWindowFocus:!0})}function Z(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 Is(){const e=k();return b({mutationFn:$n,onSuccess:async()=>{await Z(e),p.success(o("authSetupSuccess"))},onError:t=>{p.error(`${o("authActionFailed")}: ${t.message}`)}})}function ka(){const e=k();return b({mutationFn:qn,onSuccess:async()=>{await Z(e),p.success(o("authLoginSuccess"))},onError:t=>{p.error(`${o("authActionFailed")}: ${t.message}`)}})}function Ts(){const e=k();return b({mutationFn:Qn,onSuccess:async()=>{await Z(e),p.success(o("authLogoutSuccess"))},onError:t=>{p.error(`${o("authActionFailed")}: ${t.message}`)}})}function Ds(){const e=k();return b({mutationFn:Vn,onSuccess:async()=>{await Z(e),p.success(o("authPasswordUpdated"))},onError:t=>{p.error(`${o("authActionFailed")}: ${t.message}`)}})}function Ns(){const e=k();return b({mutationFn:Gn,onSuccess:async(t,n)=>{await Z(e),p.success(n.enabled?o("authEnabledSuccess"):o("authDisabledSuccess"))},onError:t=>{p.error(`${o("authActionFailed")}: ${t.message}`)}})}function Ca({username:e}){const t=ka(),[n,s]=l.useState(e??""),[r,i]=l.useState(""),h=n.trim().length>0&&r.length>0&&!t.isPending,f=y=>{y==null||y.preventDefault(),h&&t.mutate({username:n.trim(),password:r})};return a.jsx("main",{className:"flex min-h-screen items-center justify-center bg-secondary px-6 py-10",children:a.jsxs(ot,{hover:!1,className:"w-full max-w-md shadow-card-hover",children:[a.jsxs(it,{children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-gray-500",children:o("authBrand")}),a.jsx(ct,{className:"text-2xl",children:o("authLoginTitle")}),a.jsx(lt,{children:o("authLoginDescription")})]}),a.jsx(dt,{children:a.jsxs("form",{className:"space-y-4",onSubmit:f,children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-800",children:o("authUsername")}),a.jsx(ue,{value:n,onChange:y=>s(y.target.value),placeholder:o("authUsernamePlaceholder"),autoFocus:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-800",children:o("authPassword")}),a.jsx(ue,{type:"password",value:r,onChange:y=>i(y.target.value),placeholder:o("authPasswordPlaceholder")})]}),a.jsx($,{type:"submit",className:"w-full",disabled:!h,children:t.isPending?o("authLoggingIn"):o("authLoginAction")})]})})]})})}const ut="nextclaw.ui.theme",Me=[{value:"warm",labelKey:"themeWarm"},{value:"cool",labelKey:"themeCool"}];let L="warm",me=!1;const pe=new Set;function Ia(e){return e==="warm"||e==="cool"}function mt(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function Ta(){if(typeof window>"u")return"warm";try{const e=window.localStorage.getItem(ut);if(Ia(e))return e}catch{}return"warm"}function Ae(){return me||(L=Ta(),mt(L),me=!0),L}function Da(){return me?L:Ae()}function Na(e){if(Ae(),e!==L){if(L=e,mt(L),typeof window<"u")try{window.localStorage.setItem(ut,L)}catch{}pe.forEach(t=>t(L))}}function Ma(e){return pe.add(e),()=>{pe.delete(e)}}const ge="docs.nextclaw.io",Ee="nextclaw-docs.pages.dev",pt=new Set([ge,`www.${ge}`,Ee,`www.${Ee}`]),fe=`https://${ge}`,gt="/guide/getting-started",ft=l.createContext(null);let Re=0;function Ea(){return Re+=1,`doc-tab-${Date.now()}-${Re}`}function H(e){try{return new URL(e).pathname.replace(/\.html$/,"").replace(/\/$/,"")}catch{return e}}function Ra(e){return e==="zh"?"zh":"en"}function ja(e,t){const n=e.startsWith("/")?e:`/${e}`;return n==="/"||n===""?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function yt(e){const t=Ra(W());try{const n=new URL(e,fe);return pt.has(n.hostname)&&(n.pathname=ja(n.pathname,t)),n.toString()}catch{return new URL(`/${t}${gt}`,fe).toString()}}function _(){return yt(gt)}function La(e,t,n="Docs"){try{const s=new URL(e,fe);if(s.protocol==="data:")return t==="docs"?n:"Detail";const r=s.pathname.split("/").filter(Boolean),i=r[r.length-1]??n;return decodeURIComponent(i).replace(/[-_]/g," ").slice(0,40)||n}catch{return n}}function V(e,t,n){const s=(n==null?void 0:n.trim())||La(e,t,t==="docs"?"Docs":"Detail");return{id:Ea(),kind:t,title:s,currentUrl:e,history:[e],historyIndex:0,navVersion:0}}function G(e,t){return{...e,tabs:e.tabs.map(n=>n.id===e.activeTabId?t(n):n)}}function Pe(){const e=l.useContext(ft);if(!e)throw new Error("useDocBrowser must be used within DocBrowserProvider");return e}function vt(e){try{const t=new URL(e,window.location.origin);return pt.has(t.hostname)}catch{return!1}}function Ba(e){return vt(e)?"docs":"content"}function wt(e,t){return t==="docs"?yt(e):e}function Ua(e){var t;return e.url&&e.url.trim().length>0?wt(e.url,e.kind):e.kind==="docs"?_():((t=e.activeTab)==null?void 0:t.currentUrl)??_()}function Fa({children:e}){const t=_(),n=V(t,"docs","Docs"),[s,r]=l.useState({isOpen:!1,mode:"docked",tabs:[n],activeTabId:n.id}),i=l.useMemo(()=>s.tabs.find(v=>v.id===s.activeTabId)??s.tabs[0],[s.tabs,s.activeTabId]),h=l.useCallback((v,d)=>{r(c=>{const C=c.tabs.find(I=>I.id===c.activeTabId)??c.tabs[0],R=(d==null?void 0:d.kind)??(v?Ba(v):(C==null?void 0:C.kind)??"docs"),F=Ua({url:v,kind:R,activeTab:C});if(!!(d!=null&&d.newTab||!C||C.kind!==R)){const I=V(F,R,d==null?void 0:d.title);return{...c,isOpen:!0,tabs:[...c.tabs,I],activeTabId:I.id}}return{...G(c,I=>H(F)===H(I.currentUrl)?d!=null&&d.title?{...I,title:d.title}:I:{...I,title:(d==null?void 0:d.title)||I.title,kind:R,currentUrl:F,history:[...I.history.slice(0,I.historyIndex+1),F],historyIndex:I.historyIndex+1,navVersion:I.navVersion+1}),isOpen:!0}})},[]),f=l.useCallback(()=>{r(v=>({...v,isOpen:!1}))},[]),y=l.useCallback(()=>{r(v=>({...v,mode:v.mode==="floating"?"docked":"floating"}))},[]),w=l.useCallback(v=>{r(d=>({...d,mode:v}))},[]),S=l.useCallback(v=>{r(d=>{if(!d.tabs.length){const c=V(_(),"docs","Docs");return{...d,tabs:[c],activeTabId:c.id,isOpen:!0}}return G(d,c=>{if(c.kind!=="docs")return c;const C=wt(v,"docs");return H(C)===H(c.currentUrl)?c:{...c,currentUrl:C,history:[...c.history.slice(0,c.historyIndex+1),C],historyIndex:c.historyIndex+1,navVersion:c.navVersion+1}})})},[]),u=l.useCallback(v=>{r(d=>{if(!d.tabs.length){const c=V(_(),"docs","Docs");return{...d,tabs:[c],activeTabId:c.id}}return G(d,c=>c.kind!=="docs"||H(v)===H(c.currentUrl)?c:{...c,currentUrl:v,history:[...c.history.slice(0,c.historyIndex+1),v],historyIndex:c.historyIndex+1})})},[]),m=l.useCallback(()=>{r(v=>G(v,d=>{if(d.kind!=="docs"||d.historyIndex<=0)return d;const c=d.historyIndex-1;return{...d,historyIndex:c,currentUrl:d.history[c]}}))},[]),P=l.useCallback(()=>{r(v=>G(v,d=>{if(d.kind!=="docs"||d.historyIndex>=d.history.length-1)return d;const c=d.historyIndex+1;return{...d,historyIndex:c,currentUrl:d.history[c]}}))},[]),j=l.useCallback((v,d)=>{h(v,{...d??{},newTab:!0})},[h]),U=l.useCallback(v=>{r(d=>{var F;if(d.tabs.length<=1){const O=V(_(),"docs","Docs");return{...d,isOpen:!1,tabs:[O],activeTabId:O.id}}const c=d.tabs.findIndex(O=>O.id===v);if(c<0)return d;const C=d.tabs.filter(O=>O.id!==v),R=d.activeTabId===v?((F=C[Math.max(0,c-1)])==null?void 0:F.id)??C[0].id:d.activeTabId;return{...d,tabs:C,activeTabId:R}})},[]),ee=l.useCallback(v=>{r(d=>d.tabs.some(c=>c.id===v)?{...d,activeTabId:v,isOpen:!0}:d)},[]),q=!!(i&&i.kind==="docs"&&i.historyIndex>0),Q=!!(i&&i.kind==="docs"&&i.historyIndex<i.history.length-1),te=l.useMemo(()=>({...s,currentTab:i,currentUrl:(i==null?void 0:i.currentUrl)??_(),navVersion:(i==null?void 0:i.navVersion)??0,open:h,close:f,toggleMode:y,setMode:w,navigate:S,syncUrl:u,goBack:m,goForward:P,openNewTab:j,closeTab:U,setActiveTab:ee,canGoBack:q,canGoForward:Q}),[s,i,h,f,y,w,S,u,m,P,j,U,ee,q,Q]);return a.jsx(ft.Provider,{value:te,children:e})}function Oa(){const e=Pe();l.useEffect(()=>{const t=n=>{const s=n.target.closest("a[href]");if(!s)return;const r=s.getAttribute("href")||"";vt(r)&&(s.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 Ka(e){const t=new URLSearchParams;Number.isFinite(e.limit)&&t.set("limit",String(Math.max(1,Math.trunc(e.limit))));const n=t.toString(),s=await g.get(n?`/api/ncp/sessions?${n}`:"/api/ncp/sessions");if(!s.ok)throw new Error(s.error.message);return s.data}async function Ms(e,t=200){const n=await g.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 Es(e,t){const n=await g.put(`/api/ncp/sessions/${encodeURIComponent(e)}`,t);if(!n.ok)throw new Error(n.error.message);return n.data}async function Rs(e){const t=await g.delete(`/api/ncp/sessions/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(t.error.message);return t.data}function js(){return D({queryKey:["config"],queryFn:Yn,staleTime:3e4,refetchOnWindowFocus:!0})}function _a(){return D({queryKey:["app-meta"],queryFn:Jn,staleTime:1/0})}function Ls(){return D({queryKey:["config-meta"],queryFn:Xn,staleTime:1/0})}function Bs(){return D({queryKey:["config-schema"],queryFn:Zn,staleTime:1/0})}function Us(){const e=k();return b({mutationFn:ea,onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),p.success(o("configSaved"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function Fs(){const e=k();return b({mutationFn:({data:t})=>ta(t),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function Os(){const e=k();return b({mutationFn:({provider:t,data:n})=>na(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),p.success(o("configSaved"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function Ks(){const e=k();return b({mutationFn:({data:t})=>aa(t??{}),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),p.success(o("configSaved"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function _s(){const e=k();return b({mutationFn:({provider:t})=>sa(t),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),e.invalidateQueries({queryKey:["config-meta"]}),p.success(o("configSaved"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function Ws(){return b({mutationFn:({provider:e,data:t})=>ra(e,t)})}function Hs(){return b({mutationFn:({provider:e,data:t})=>oa(e,t)})}function $s(){return b({mutationFn:({provider:e,data:t})=>ia(e,t)})}function qs(){return b({mutationFn:({provider:e})=>ca(e)})}function Qs(){const e=k();return b({mutationFn:({channel:t,data:n})=>la(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function Vs(){const e=k();return b({mutationFn:({data:t})=>da(t),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function Gs(){const e=k();return b({mutationFn:({data:t})=>ha(t),onSuccess:()=>{e.invalidateQueries({queryKey:["config"]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function Js(){return b({mutationFn:({actionId:e,data:t})=>ua(e,t),onError:e=>{p.error(o("error")+": "+e.message)}})}function Ys(e){return D({queryKey:["sessions",e],queryFn:()=>ma(e),staleTime:1e4})}function Xs(e,t=200){return D({queryKey:["session-history",e,t],queryFn:()=>pa(e,t),enabled:!!e,staleTime:5e3,retry:!1})}function Zs(e){return D({queryKey:["ncp-sessions",e==null?void 0:e.limit],queryFn:()=>Ka(e),staleTime:5e3,retry:!1,refetchInterval:t=>{var s;return!!((s=t.state.data)!=null&&s.sessions.some(r=>r.status==="running"))?800:!1}})}function er(){const e=k();return b({mutationFn:({key:t,data:n})=>ga(t,n),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history",n.key]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function tr(){const e=k();return b({mutationFn:({key:t})=>fa(t),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history"]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function nr(e){var s,r;const t=((s=e==null?void 0:e.sessionKey)==null?void 0:s.trim())||void 0,n=((r=e==null?void 0:e.agentId)==null?void 0:r.trim())||void 0;return D({queryKey:["chat-capabilities",t??null,n??null],queryFn:async()=>{try{return await va({sessionKey:t,agentId:n})}catch{return{stopSupported:!1}}},staleTime:1e4,retry:!1})}function ar(){return D({queryKey:["chat-session-types"],queryFn:wa,staleTime:1e4,retry:!1})}function sr(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,s=!!(n!=null&&n.some(h=>h==="queued"||h==="running")),r=!!(e!=null&&e.syncActiveStates&&s);return D({queryKey:["chat-runs",t??null,n??null,(e==null?void 0:e.limit)??null],queryFn:()=>za({...t?{sessionKey:t}:{},...n?{states:n}:{},...typeof(e==null?void 0:e.limit)=="number"?{limit:e.limit}:{}}),enabled:!!t||!!n,staleTime:5e3,refetchInterval:h=>{if(!r)return!1;if(e!=null&&e.isLocallyRunning)return 800;const{data:f}=h.state;return Array.isArray(f==null?void 0:f.runs)&&f.runs.length>0?800:!1},refetchIntervalInBackground:!1,retry:!1})}function rr(e={all:!0}){return D({queryKey:["cron",e],queryFn:()=>Sa(e),staleTime:1e4})}function or(){const e=k();return b({mutationFn:({id:t})=>xa(t),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function ir(){const e=k();return b({mutationFn:({id:t,enabled:n})=>ba(t,{enabled:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function cr(){const e=k();return b({mutationFn:({id:t,force:n})=>Aa(t,{force:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["cron"]}),p.success(o("configSavedApplied"))},onError:t=>{p.error(o("configSaveFailed")+": "+t.message)}})}function Wa({className:e,suffix:t}){var i;const{data:n}=_a(),s=(n==null?void 0:n.name)??"NextClaw",r=(i=n==null?void 0:n.productVersion)==null?void 0:i.trim();return a.jsxs("div",{className:e??"flex items-center gap-2.5",children:[a.jsx("div",{className:"h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center",children:a.jsx("img",{src:"/logo.svg",alt:s,className:"h-full w-full object-contain"})}),a.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[a.jsx("span",{className:"truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800",children:s}),r?a.jsxs("span",{className:"text-[13px] font-medium text-gray-500",children:["v",r]}):null,t?a.jsx("span",{className:"inline-flex items-center shrink-0",children:t}):null]})]})}const zt=l.createContext(null);function Ha({children:e}){const[t,n]=l.useState(()=>Se());l.useEffect(()=>Rn(f=>{n(f)}),[]);const s=l.useCallback(h=>{En(h),n(W())},[]),r=l.useCallback(()=>{s(t==="en"?"zh":"en")},[t,s]),i=l.useMemo(()=>({language:t,setLanguage:s,toggleLanguage:r}),[t,s,r]);return a.jsx(zt.Provider,{value:i,children:e})}function $a(){const e=l.useContext(zt);if(!e)throw new Error("useI18n must be used within I18nProvider");return{...e,t:o}}const St=l.createContext(null);function qa({children:e}){const[t,n]=l.useState(()=>Ae());l.useEffect(()=>Ma(h=>{n(h)}),[]);const s=l.useCallback(i=>{Na(i),n(Da())},[]),r=l.useMemo(()=>({theme:t,setTheme:s}),[t,s]);return a.jsx(St.Provider,{value:r,children:e})}function Qa(){const e=l.useContext(St);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const je=_t,lr=Wt,ye=l.forwardRef(({className:e,children:t,...n},s)=>a.jsxs(Ke,{ref:s,className:z("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,a.jsx(jt,{asChild:!0,children:a.jsx(_e,{className:"h-4 w-4 opacity-50"})})]}));ye.displayName=Ke.displayName;const xt=l.forwardRef(({className:e,...t},n)=>a.jsx(We,{ref:n,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Lt,{className:"h-4 w-4"})}));xt.displayName=We.displayName;const bt=l.forwardRef(({className:e,...t},n)=>a.jsx(He,{ref:n,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(_e,{className:"h-4 w-4"})}));bt.displayName=He.displayName;const ve=l.forwardRef(({className:e,children:t,position:n="popper",...s},r)=>a.jsx(Bt,{children:a.jsxs($e,{ref:r,className:z("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,...s,children:[a.jsx(xt,{}),a.jsx(Ut,{className:z("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(bt,{})]})}));ve.displayName=$e.displayName;const Va=l.forwardRef(({className:e,...t},n)=>a.jsx(qe,{ref:n,className:z("px-2 py-1.5 text-sm font-semibold",e),...t}));Va.displayName=qe.displayName;const we=l.forwardRef(({className:e,children:t,...n},s)=>a.jsxs(Qe,{ref:s,className:z("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:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Ft,{children:a.jsx(Ot,{className:"h-4 w-4"})})}),a.jsx(Kt,{children:t})]}));we.displayName=Qe.displayName;const Ga=l.forwardRef(({className:e,...t},n)=>a.jsx(Ve,{ref:n,className:z("-mx-1 my-1 h-px bg-muted",e),...t}));Ga.displayName=Ve.displayName;function Ja({mode:e}){var q,Q,te,v,d;const t=rt(),n=Pe(),s=at(),{language:r,setLanguage:i}=$a(),{theme:h,setTheme:f}=Qa(),y=((q=Te.find(c=>c.value===r))==null?void 0:q.label)??r,w=o(((Q=Me.find(c=>c.value===h))==null?void 0:Q.labelKey)??"themeWarm"),S=(v=(te=s.data)==null?void 0:te.account.email)==null?void 0:v.trim(),u=!!((d=s.data)!=null&&d.account.loggedIn),m=c=>{r!==c&&(i(c),window.location.reload())},P=c=>{h!==c&&f(c)},j=[{target:"/chat",label:o("chat"),icon:Ht},{target:"/chat/cron",label:o("cron"),icon:$t},{target:"/chat/skills",label:o("marketplaceFilterSkills"),icon:qt}],U=[{target:"/model",label:o("model"),icon:Qt},{target:"/providers",label:o("providers"),icon:Vt},{target:"/search",label:o("searchChannels"),icon:Gt},{target:"/channels",label:o("channels"),icon:Jt},{target:"/runtime",label:o("runtime"),icon:Yt},{target:"/remote",label:o("remote"),icon:Xt},{target:"/security",label:o("security"),icon:Zt},{target:"/sessions",label:o("sessions"),icon:en},{target:"/secrets",label:o("secrets"),icon:le},{target:"/marketplace/plugins",label:o("marketplaceFilterPlugins"),icon:tn},{target:"/marketplace/mcp",label:o("marketplaceFilterMcp"),icon:nn}],ee=e==="main"?j:U;return a.jsxs("aside",{className:"w-[240px] shrink-0 flex flex-col h-full py-6 px-4 bg-secondary",children:[e==="settings"?a.jsxs("div",{className:"px-2 mb-6",children:[a.jsxs(ie,{to:"/chat",className:"group inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-2.5 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900",children:[a.jsx(an,{className:"h-3.5 w-3.5 text-gray-500 group-hover:text-gray-800"}),a.jsx("span",{children:o("backToMain")})]}),a.jsx("div",{className:"mt-5 px-1",children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx(ke,{className:"h-5 w-5 text-gray-700"}),a.jsx("h1",{className:"text-[28px] leading-none font-semibold tracking-[-0.02em] text-gray-900",children:o("settings")})]})})]}):a.jsx("div",{className:"px-2 mb-8",children:a.jsx(Wa,{className:"flex items-center gap-2.5 cursor-pointer"})}),a.jsx("nav",{className:"flex-1 flex flex-col",children:a.jsx("ul",{className:"space-y-1",children:ee.map(c=>{const C=c.icon;return a.jsx("li",{children:a.jsx(ie,{to:c.target,className:({isActive:R})=>z("group w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-[14px] font-medium transition-all duration-base",R?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-200/60 hover:text-gray-900"),children:({isActive:R})=>a.jsxs(a.Fragment,{children:[a.jsx(C,{className:z("h-[17px] w-[17px] transition-colors",R?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),a.jsx("span",{className:"flex-1 text-left",children:c.label})]})})},c.target)})})}),a.jsxs("div",{className:"pt-3 border-t border-[#dde0ea] mt-3",children:[e==="settings"?a.jsx("button",{onClick:()=>t.accountManager.openAccountPanel(),className:"mb-2 w-full rounded-xl px-3 py-2.5 text-left transition-all duration-base text-gray-600 hover:bg-[#e4e7ef] hover:text-gray-900",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(le,{className:z("mt-0.5 h-[17px] w-[17px]",u?"text-emerald-600":"text-gray-400")}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"flex items-center justify-between gap-3",children:a.jsx("p",{className:"truncate text-[14px] font-medium text-gray-900",children:S||o("remoteAccountEntryManage")})}),a.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:o(u?"remoteAccountEntryConnected":"remoteAccountEntryDisconnected")})]})]})}):null,e==="main"&&a.jsx("div",{className:"mb-2",children:a.jsx(ie,{to:"/settings",className:({isActive:c})=>z("group w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-[14px] font-medium transition-all duration-base",c?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-600 hover:bg-[#e4e7ef] hover:text-gray-900"),children:({isActive:c})=>a.jsxs(a.Fragment,{children:[a.jsx(ke,{className:z("h-[17px] w-[17px] transition-colors",c?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),a.jsx("span",{className:"flex-1 text-left",children:o("settings")})]})})}),a.jsx("div",{className:"mb-2",children:a.jsxs(je,{value:h,onValueChange:c=>P(c),children:[a.jsxs(ye,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2.5 text-[14px] font-medium text-gray-600 hover:bg-[#e4e7ef] focus:ring-0",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx(sn,{className:"h-[17px] w-[17px] text-gray-400"}),a.jsx("span",{className:"text-left",children:o("theme")})]}),a.jsx("span",{className:"ml-auto text-xs text-gray-500",children:w})]}),a.jsx(ve,{children:Me.map(c=>a.jsx(we,{value:c.value,className:"text-xs",children:o(c.labelKey)},c.value))})]})}),a.jsx("div",{className:"mb-2",children:a.jsxs(je,{value:r,onValueChange:c=>m(c),children:[a.jsxs(ye,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2.5 text-[14px] font-medium text-gray-600 hover:bg-[#e4e7ef] focus:ring-0",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx(rn,{className:"h-[17px] w-[17px] text-gray-400"}),a.jsx("span",{className:"text-left",children:o("language")})]}),a.jsx("span",{className:"ml-auto text-xs text-gray-500",children:y})]}),a.jsx(ve,{children:Te.map(c=>a.jsx(we,{value:c.value,className:"text-xs",children:c.label},c.value))})]})}),a.jsxs("button",{onClick:()=>n.open(void 0,{kind:"docs",newTab:!0,title:"Docs"}),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-[14px] font-medium transition-all duration-base text-gray-600 hover:bg-[#e4e7ef] hover:text-gray-800",children:[a.jsx(on,{className:"h-[17px] w-[17px] text-gray-400"}),a.jsx("span",{className:"flex-1 text-left",children:o("docBrowserHelp")})]})]})]})}const Le=l.lazy(async()=>({default:(await N(async()=>{const{DocBrowser:e}=await import("./DocBrowser-BJ610SPa.js");return{DocBrowser:e}},__vite__mapDeps([0,1]))).DocBrowser}));function Ya(e){const t=e.toLowerCase();return t==="/chat"||t.startsWith("/chat/")||t==="/skills"||t.startsWith("/skills/")||t==="/cron"||t.startsWith("/cron/")}function Xa(e){const t=e.toLowerCase();return t==="/channels"||t.startsWith("/channels/")}function Za({children:e}){const{isOpen:t,mode:n}=Pe();Oa();const{pathname:s}=cn(),r=Ya(s),i=Xa(s);return a.jsxs("div",{className:"h-screen flex bg-background font-sans text-foreground",children:[!r&&a.jsx(Ja,{mode:"settings"}),a.jsxs("div",{className:"flex-1 flex min-w-0 overflow-hidden relative",children:[a.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:r?a.jsx("div",{className:"flex-1 h-full overflow-hidden",children:e}):a.jsx("main",{className:z("flex-1 custom-scrollbar p-8",i?"overflow-auto xl:overflow-hidden":"overflow-auto"),children:a.jsx("div",{className:z("max-w-6xl mx-auto animate-fade-in h-full",i&&"min-h-0 xl:overflow-hidden"),children:e})})}),t&&n==="docked"&&a.jsx(l.Suspense,{fallback:null,children:a.jsx(Le,{})})]}),t&&n==="floating"&&a.jsx(l.Suspense,{fallback:null,children:a.jsx(Le,{})})]})}function es({children:e}){return a.jsx(Fa,{children:a.jsx(Za,{children:e})})}class ts{constructor(t){this.url=t,this.ws=null,this.handlers=new Map,this.reconnectTimer=null,this.manualClose=!1}connect(){this.manualClose=!1,this.ws=new WebSocket(this.url),this.ws.onopen=()=>{console.log("WebSocket connected"),this.emit({type:"connection.open",payload:{}})},this.ws.onmessage=t=>{try{const n=JSON.parse(t.data);this.emit(n)}catch(n){console.error("Failed to parse WebSocket message:",n)}},this.ws.onclose=()=>{console.log("WebSocket disconnected"),this.emit({type:"connection.close",payload:{}}),this.manualClose||this.scheduleReconnect()},this.ws.onerror=t=>{console.error("WebSocket error:",t),this.emit({type:"connection.error",payload:{message:"websocket error"}})}}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(n)}off(t,n){var s;(s=this.handlers.get(t))==null||s.delete(n)}emit(t){const n=this.handlers.get(t.type);n==null||n.forEach(s=>s(t))}scheduleReconnect(){this.reconnectTimer||(this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},3e3))}disconnect(){var t;this.manualClose=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null}}const ns=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 as(e){const t=e.trim().toLowerCase();return t?!(t.startsWith("plugins")||t.startsWith("skills")):!0}function ss(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 rs(e){const[t,n]=l.useState(null),{setConnectionStatus:s}=ns();return l.useEffect(()=>{const r=(()=>{const u=B==null?void 0:B.replace(/\/$/,"");if(!u)return"ws://127.0.0.1:18791/ws";try{const m=new URL(u,window.location.origin);return`${m.protocol==="https:"?"wss:":m.protocol==="http:"?"ws:":m.protocol}//${m.host}/ws`}catch{return u.startsWith("wss://")||u.startsWith("ws://")?`${u}/ws`:u.startsWith("https://")?`${u.replace(/^https:/,"wss:")}/ws`:u.startsWith("http://")?`${u.replace(/^http:/,"ws:")}/ws`:`${u}/ws`}})(),i=new ts(r);let h=!1;const f=async()=>{var P;const m=`${(B==null?void 0:B.replace(/\/$/,""))||window.location.origin}/api/health`;try{const j=await fetch(m,{method:"GET",cache:"no-store"});if(!j.ok)return!1;const U=await j.json();return U.ok===!0&&((P=U.data)==null?void 0:P.status)==="ok"}catch{return!1}},y=async()=>{if(h){s("connected");return}const u=await f();s(u?"connected":"disconnected")},w=u=>{if(e){if(e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["ncp-sessions"]}),u&&u.trim().length>0){e.invalidateQueries({queryKey:["session-history",u.trim()]}),e.invalidateQueries({queryKey:["ncp-session-messages",u.trim()]});return}e.invalidateQueries({queryKey:["session-history"]}),e.invalidateQueries({queryKey:["ncp-session-messages"]})}};s("connecting"),i.on("connection.open",()=>{h=!0,s("connected")}),i.on("connection.close",()=>{h=!1,y()}),i.on("connection.error",()=>{h=!1,y()}),i.on("config.updated",u=>{const m=u.payload,P=typeof(m==null?void 0:m.path)=="string"?m.path:"";e&&as(P)&&e.invalidateQueries({queryKey:["config"]}),P.startsWith("session")&&w(),ss(e,P)}),i.on("run.updated",u=>{if(u.type!=="run.updated"||!e)return;const m=u.payload.run.sessionKey,P=u.payload.run.runId;e.invalidateQueries({queryKey:["chat-runs"]}),m?(e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session-history",m]})):e.invalidateQueries({queryKey:["session-history"]}),P&&e.invalidateQueries({queryKey:["chat-run",P]})}),i.on("session.updated",u=>{u.type==="session.updated"&&w(u.payload.sessionKey)}),i.on("error",u=>{u.type==="error"&&console.error("WebSocket error:",u.payload.message)}),i.connect(),n(i),y();const S=window.setInterval(()=>{y()},1e4);return()=>{window.clearInterval(S),h=!1,i.disconnect(),s("disconnected")}},[s,e]),t}const os=l.lazy(async()=>({default:(await N(async()=>{const{ModelConfig:e}=await import("./ModelConfig-B-oTP-Bc.js");return{ModelConfig:e}},__vite__mapDeps([2,1,3,4,5,6,7]))).ModelConfig})),ce=l.lazy(async()=>({default:(await N(async()=>{const{ChatPage:e}=await import("./ChatPage-B5UpeEIp.js");return{ChatPage:e}},__vite__mapDeps([8,1,9,10,11,12,4,13,7,6,14]))).ChatPage})),is=l.lazy(async()=>({default:(await N(async()=>{const{SearchConfig:e}=await import("./SearchConfig-BVZdCxiM.js");return{SearchConfig:e}},__vite__mapDeps([15,1,7,3,16]))).SearchConfig})),cs=l.lazy(async()=>({default:(await N(async()=>{const{ProvidersList:e}=await import("./ProvidersList-r7bD0-R0.js");return{ProvidersList:e}},__vite__mapDeps([17,1,3,5,16,18,14,19,12,20,7]))).ProvidersList})),ls=l.lazy(async()=>({default:(await N(async()=>{const{ChannelsList:e}=await import("./ChannelsList-CIMYaIji.js");return{ChannelsList:e}},__vite__mapDeps([21,1,3,18,19,20,5,16,12,7]))).ChannelsList})),ds=l.lazy(async()=>({default:(await N(async()=>{const{RuntimeConfig:e}=await import("./RuntimeConfig-C11xVxH9.js");return{RuntimeConfig:e}},__vite__mapDeps([22,1,18,5,7]))).RuntimeConfig})),hs=l.lazy(async()=>({default:(await N(async()=>{const{SecurityConfig:e}=await import("./security-config-CgbYP57d.js");return{SecurityConfig:e}},__vite__mapDeps([23,1,3,18,7]))).SecurityConfig})),us=l.lazy(async()=>({default:(await N(async()=>{const{SessionsConfig:e}=await import("./SessionsConfig-Y-Blf_-K.js");return{SessionsConfig:e}},__vite__mapDeps([24,1,9,10,7]))).SessionsConfig})),ms=l.lazy(async()=>({default:(await N(async()=>{const{SecretsConfig:e}=await import("./SecretsConfig-DuEDdC3X.js");return{SecretsConfig:e}},__vite__mapDeps([25,1,3,18,7]))).SecretsConfig})),ps=l.lazy(async()=>({default:(await N(async()=>{const{RemoteAccessPage:e}=await import("./RemoteAccessPage-D7On6waK.js");return{RemoteAccessPage:e}},__vite__mapDeps([26,1,7,19]))).RemoteAccessPage})),gs=l.lazy(async()=>({default:(await N(async()=>{const{MarketplacePage:e}=await import("./MarketplacePage-Bs3sLsgx.js").then(t=>t.f);return{MarketplacePage:e}},__vite__mapDeps([11,1,12,9,4,13,7]))).MarketplacePage})),fs=l.lazy(async()=>({default:(await N(async()=>{const{McpMarketplacePage:e}=await import("./McpMarketplacePage-BWTguHCs.js");return{McpMarketplacePage:e}},__vite__mapDeps([27,1,7,12,18,4,9,13]))).McpMarketplacePage}));function At(){return a.jsx("div",{className:"h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40"})}function T({children:e}){return a.jsx(l.Suspense,{fallback:a.jsx(At,{}),children:e})}function ys(){return rs(oe),a.jsxs(Kn,{children:[a.jsx(es,{children:a.jsx("div",{className:"w-full h-full",children:a.jsxs(hn,{children:[a.jsx(A,{path:"/chat/skills",element:a.jsx(K,{to:"/skills",replace:!0})}),a.jsx(A,{path:"/chat/cron",element:a.jsx(K,{to:"/cron",replace:!0})}),a.jsx(A,{path:"/chat/:sessionId?",element:a.jsx(T,{children:a.jsx(ce,{view:"chat"})})}),a.jsx(A,{path:"/skills",element:a.jsx(T,{children:a.jsx(ce,{view:"skills"})})}),a.jsx(A,{path:"/cron",element:a.jsx(T,{children:a.jsx(ce,{view:"cron"})})}),a.jsx(A,{path:"/model",element:a.jsx(T,{children:a.jsx(os,{})})}),a.jsx(A,{path:"/search",element:a.jsx(T,{children:a.jsx(is,{})})}),a.jsx(A,{path:"/providers",element:a.jsx(T,{children:a.jsx(cs,{})})}),a.jsx(A,{path:"/channels",element:a.jsx(T,{children:a.jsx(ls,{})})}),a.jsx(A,{path:"/runtime",element:a.jsx(T,{children:a.jsx(ds,{})})}),a.jsx(A,{path:"/remote",element:a.jsx(T,{children:a.jsx(ps,{})})}),a.jsx(A,{path:"/security",element:a.jsx(T,{children:a.jsx(hs,{})})}),a.jsx(A,{path:"/sessions",element:a.jsx(T,{children:a.jsx(us,{})})}),a.jsx(A,{path:"/secrets",element:a.jsx(T,{children:a.jsx(ms,{})})}),a.jsx(A,{path:"/settings",element:a.jsx(K,{to:"/model",replace:!0})}),a.jsx(A,{path:"/marketplace/skills",element:a.jsx(K,{to:"/skills",replace:!0})}),a.jsx(A,{path:"/marketplace",element:a.jsx(K,{to:"/marketplace/plugins",replace:!0})}),a.jsx(A,{path:"/marketplace/mcp",element:a.jsx(T,{children:a.jsx(fs,{})})}),a.jsx(A,{path:"/marketplace/:type",element:a.jsx(T,{children:a.jsx(gs,{})})}),a.jsx(A,{path:"/",element:a.jsx(K,{to:"/chat",replace:!0})}),a.jsx(A,{path:"*",element:a.jsx(K,{to:"/chat",replace:!0})})]})})}),a.jsx(_n,{})]})}function vs(){var t;const e=Pa();return e.isLoading&&!e.isError?a.jsx(At,{}):(t=e.data)!=null&&t.enabled&&!e.data.authenticated?a.jsx(Ca,{username:e.data.username}):a.jsx(ys,{})}function ws(){return a.jsxs(ln,{client:oe,children:[a.jsx(vs,{}),a.jsx(dn,{position:"top-right",richColors:!0})]})}un.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(qa,{children:a.jsx(Ha,{children:a.jsx(mn,{children:a.jsx(ws,{})})})})}));export{Ks as $,ga as A,$ as B,ot as C,fe as D,fa as E,As as F,Ps as G,Cs as H,ue as I,za as J,ks as K,Te as L,Zs as M,Es as N,Rs as O,B as P,Ms as Q,Fs as R,je as S,Me as T,Os as U,_s as V,Ws as W,Hs as X,$s as Y,qs as Z,W as _,Ls as a,Qs as a0,Js as a1,Vs as a2,it as a3,ct as a4,lt as a5,Pa as a6,Is as a7,Ns as a8,Ds as a9,Ts as aa,er as ab,tr as ac,xs as ad,Gs as ae,rt as af,at as ag,M as ah,Bn as ai,g as aj,yn as ak,Je as al,Ye as am,Xe as an,Ze as ao,wn as ap,bs as aq,vt as ar,Bs as b,z as c,Us as d,ye as e,lr as f,ve as g,we as h,sr as i,Ys as j,nr as k,Xs as l,ar as m,Pe as n,ns as o,$a as p,Qa as q,Wa as r,nt as s,o as t,js as u,rr as v,or as w,ir as x,cr as y,dt as z};
|