@kafca/agentdock 0.1.19 → 0.1.21
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 +7 -0
- package/dist/renderer/assets/{Badge-DcFVSGwl.js → Badge-BRmQIqbd.js} +1 -1
- package/dist/renderer/assets/{Chat-CTy10fKR.js → Chat-D94ODABB.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-C-ci0dQL.js → ChatMarkdown-DqW7OUvV.js} +1 -1
- package/dist/renderer/assets/{Config-Bl5vuqBS.js → Config-9lgzpTCp.js} +1 -1
- package/dist/renderer/assets/{CronList-BQOEXhHD.js → CronList-BYZ-x_bp.js} +1 -1
- package/dist/renderer/assets/{Dashboard-CauX4_SR.js → Dashboard-COISXbQy.js} +2 -2
- package/dist/renderer/assets/{EmptyState-DVYGGFl9.js → EmptyState-w5-I9zg7.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-BlV8Twrx.js → KnowledgeDetail-DVxwrTLw.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-vd6AO-Fn.js → KnowledgeHome-BKkubcwi.js} +1 -1
- package/dist/renderer/assets/{Logs-BrtF26F7.js → Logs-D7HxZ8Nb.js} +1 -1
- package/dist/renderer/assets/{Modal-D6ucs8W2.js → Modal-Ceu_MP2e.js} +1 -1
- package/dist/renderer/assets/{Page-BdF9afpu.js → Page-CpSczAz8.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-RuoRHs1Q.js → ProjectDetail-FJ_bNXLF.js} +1 -1
- package/dist/renderer/assets/{ProjectList-r9MXhUu7.js → ProjectList-DZKL4K9C.js} +1 -1
- package/dist/renderer/assets/{Select-CEsAkZ5j.js → Select-BHQk6qCU.js} +1 -1
- package/dist/renderer/assets/{SessionChat-DwnZpTVu.js → SessionChat-DpgSXF3m.js} +1 -1
- package/dist/renderer/assets/{SessionList-C89Z6STB.js → SessionList-CU6drQ4N.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-JB9GY3La.js → ThreadChat-D3s4GXGh.js} +1 -1
- package/dist/renderer/assets/Workspace-B7looTVo.js +14 -0
- package/dist/renderer/assets/{arrow-left-DuiS0IaQ.js → arrow-left-Dtal-eOi.js} +1 -1
- package/dist/renderer/assets/{book-open-B6l3y70b.js → book-open-q814R_Ov.js} +1 -1
- package/dist/renderer/assets/{check-CfewkzaJ.js → check-DjfCdLvw.js} +1 -1
- package/dist/renderer/assets/{circle-qzty4gzl.js → circle-vfhmyE8v.js} +1 -1
- package/dist/renderer/assets/{desktop-DTAjgvNs.js → desktop-BPIxWbkM.js} +1 -1
- package/dist/renderer/assets/desktop-DZHC4PDB.js +3 -0
- package/dist/renderer/assets/{funnel-CwjI0g4c.js → funnel-CUQibo1I.js} +1 -1
- package/dist/renderer/assets/{heart-CVHUi-lA.js → heart-DG9_b8P1.js} +1 -1
- package/dist/renderer/assets/{index-tQ6A4Zff.js → index-Bn8ane6_.js} +2 -2
- package/dist/renderer/assets/{index-BbDTSo1y.js → index-Ds0IN5rP.js} +1 -1
- package/dist/renderer/assets/{pencil-BvQPZxH6.js → pencil-Dij0LlRY.js} +1 -1
- package/dist/renderer/assets/{play-hJkkCcS6.js → play-CPFGjIyJ.js} +1 -1
- package/dist/renderer/assets/{plug-BGtbkjYJ.js → plug-DH3RKQyn.js} +1 -1
- package/dist/renderer/assets/{plus-DrYsrZyx.js → plus-afkK9_Y8.js} +1 -1
- package/dist/renderer/assets/projects-DTDS9SnT.js +1 -0
- package/dist/renderer/assets/{save-C8W3Wq2Z.js → save-B-cKgWcy.js} +1 -1
- package/dist/renderer/assets/{search-BuSByDes.js → search-DR6PeYkt.js} +1 -1
- package/dist/renderer/assets/{server-B9wEMLdo.js → server-BM6KOB5a.js} +1 -1
- package/dist/renderer/assets/{session-utils-K8E4S3Qx.js → session-utils-BDuThM0a.js} +1 -1
- package/dist/renderer/assets/{sessions-B-QTvESY.js → sessions-C1yKps4T.js} +1 -1
- package/dist/renderer/assets/{shield-check-C-oxstVp.js → shield-check-BFjMG-r2.js} +1 -1
- package/dist/renderer/assets/{trash-2-BQpE15-6.js → trash-2-CW1heMCf.js} +1 -1
- package/dist/renderer/assets/{user-CM4R9QVx.js → user-r_2sHG7m.js} +1 -1
- package/dist/renderer/assets/{wifi-off-CoaA7hVn.js → wifi-off-VMUokMpE.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/electron/agent-runtime-detector.test.js +11 -0
- package/dist-electron/electron/local-core-refactor.test.js +522 -0
- package/dist-electron/electron/plugin-kernel.test.js +77 -9
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +9 -9
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-content.js +60 -0
- package/dist-electron/services/local-ai-core/src/gateway/local-core-lark-gateway.js +337 -54
- package/dist-electron/services/local-ai-core/src/gateway/local-core-weixin-gateway.js +50 -2
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +2 -1
- package/dist-electron/services/local-ai-core/src/plugins/builtin/agent-localcore-acp-plugin.js +9 -0
- package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +19 -8
- package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +23 -12
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +34 -0
- package/dist-electron/shared/desktop.js +4 -2
- package/package.json +2 -1
- package/dist/renderer/assets/Workspace-Cftl8zps.js +0 -14
- package/dist/renderer/assets/desktop-D4Z7M9RM.js +0 -3
- package/dist/renderer/assets/projects-DcNm9FDK.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Dashboard-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Dashboard-COISXbQy.js","./Badge-BRmQIqbd.js","./EmptyState-w5-I9zg7.js","./Page-CpSczAz8.js","./projects-DTDS9SnT.js","./desktop-BPIxWbkM.js","./server-BM6KOB5a.js","./book-open-q814R_Ov.js","./shield-check-BFjMG-r2.js","./ThreadChat-D3s4GXGh.js","./Modal-Ceu_MP2e.js","./index-Ds0IN5rP.js","./ChatMarkdown-DqW7OUvV.js","./check-DjfCdLvw.js","./session-utils-BDuThM0a.js","./desktop-DZHC4PDB.js","./wifi-off-VMUokMpE.js","./search-DR6PeYkt.js","./circle-vfhmyE8v.js","./pencil-Dij0LlRY.js","./trash-2-CW1heMCf.js","./user-r_2sHG7m.js","./Chat-D94ODABB.js","./sessions-C1yKps4T.js","./Workspace-B7looTVo.js","./Select-BHQk6qCU.js","./plus-afkK9_Y8.js","./save-B-cKgWcy.js","./ProjectList-DZKL4K9C.js","./heart-DG9_b8P1.js","./ProjectDetail-FJ_bNXLF.js","./arrow-left-Dtal-eOi.js","./plug-DH3RKQyn.js","./play-CPFGjIyJ.js","./SessionList-CU6drQ4N.js","./funnel-CUQibo1I.js","./SessionChat-DpgSXF3m.js","./CronList-BYZ-x_bp.js","./Config-9lgzpTCp.js","./Logs-D7HxZ8Nb.js","./KnowledgeHome-BKkubcwi.js","./KnowledgeDetail-DVxwrTLw.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var i0=Object.defineProperty;var u0=(i,l,r)=>l in i?i0(i,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[l]=r;var In=(i,l,r)=>u0(i,typeof l!="symbol"?l+"":l,r);function r0(i,l){for(var r=0;r<l.length;r++){const o=l[r];if(typeof o!="string"&&!Array.isArray(o)){for(const c in o)if(c!=="default"&&!(c in i)){const f=Object.getOwnPropertyDescriptor(o,c);f&&Object.defineProperty(i,c,f.get?f:{enumerable:!0,get:()=>o[c]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=r(c);fetch(c.href,f)}})();function Qm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ho={exports:{}},Fl={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -173,5 +173,5 @@ Error generating stack: `+n.message+`
|
|
|
173
173
|
* @license MIT
|
|
174
174
|
*/var fm="popstate";function dm(i){return typeof i=="object"&&i!=null&&"pathname"in i&&"search"in i&&"hash"in i&&"state"in i&&"key"in i}function lv(i={}){function l(c,f){let{pathname:h="/",search:g="",hash:p=""}=hn(c.location.hash.substring(1));return!h.startsWith("/")&&!h.startsWith(".")&&(h="/"+h),Ao("",{pathname:h,search:g,hash:p},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function r(c,f){let h=c.document.querySelector("base"),g="";if(h&&h.getAttribute("href")){let p=c.location.href,m=p.indexOf("#");g=m===-1?p:p.slice(0,m)}return g+"#"+(typeof f=="string"?f:li(f))}function o(c,f){Ot(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(f)})`)}return uv(l,r,o,i)}function Le(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function Ot(i,l){if(!i){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function iv(){return Math.random().toString(36).substring(2,10)}function hm(i,l){return{usr:i.state,key:i.key,idx:l,masked:i.unstable_mask?{pathname:i.pathname,search:i.search,hash:i.hash}:void 0}}function Ao(i,l,r=null,o,c){return{pathname:typeof i=="string"?i:i.pathname,search:"",hash:"",...typeof l=="string"?hn(l):l,state:r,key:l&&l.key||o||iv(),unstable_mask:c}}function li({pathname:i="/",search:l="",hash:r=""}){return l&&l!=="?"&&(i+=l.charAt(0)==="?"?l:"?"+l),r&&r!=="#"&&(i+=r.charAt(0)==="#"?r:"#"+r),i}function hn(i){let l={};if(i){let r=i.indexOf("#");r>=0&&(l.hash=i.substring(r),i=i.substring(0,r));let o=i.indexOf("?");o>=0&&(l.search=i.substring(o),i=i.substring(0,o)),i&&(l.pathname=i)}return l}function uv(i,l,r,o={}){let{window:c=document.defaultView,v5Compat:f=!1}=o,h=c.history,g="POP",p=null,m=b();m==null&&(m=0,h.replaceState({...h.state,idx:m},""));function b(){return(h.state||{idx:null}).idx}function v(){g="POP";let B=b(),q=B==null?null:B-m;m=B,p&&p({action:g,location:H.location,delta:q})}function N(B,q){g="PUSH";let X=dm(B)?B:Ao(H.location,B,q);r&&r(X,B),m=b()+1;let Q=hm(X,m),J=H.createHref(X.unstable_mask||X);try{h.pushState(Q,"",J)}catch(V){if(V instanceof DOMException&&V.name==="DataCloneError")throw V;c.location.assign(J)}f&&p&&p({action:g,location:H.location,delta:1})}function L(B,q){g="REPLACE";let X=dm(B)?B:Ao(H.location,B,q);r&&r(X,B),m=b();let Q=hm(X,m),J=H.createHref(X.unstable_mask||X);h.replaceState(Q,"",J),f&&p&&p({action:g,location:H.location,delta:0})}function z(B){return rv(B)}let H={get action(){return g},get location(){return i(c,h)},listen(B){if(p)throw new Error("A history only accepts one active listener");return c.addEventListener(fm,v),p=B,()=>{c.removeEventListener(fm,v),p=null}},createHref(B){return l(c,B)},createURL:z,encodeLocation(B){let q=z(B);return{pathname:q.pathname,search:q.search,hash:q.hash}},push:N,replace:L,go(B){return h.go(B)}};return H}function rv(i,l=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Le(r,"No window.location.(origin|href) available to create URL");let o=typeof i=="string"?i:li(i);return o=o.replace(/ $/,"%20"),!l&&o.startsWith("//")&&(o=r+o),new URL(o,r)}function Im(i,l,r="/"){return sv(i,l,r,!1)}function sv(i,l,r,o){let c=typeof l=="string"?hn(l):l,f=ga(c.pathname||"/",r);if(f==null)return null;let h=Pm(i);ov(h);let g=null;for(let p=0;g==null&&p<h.length;++p){let m=Sv(f);g=vv(h[p],m,o)}return g}function Pm(i,l=[],r=[],o="",c=!1){let f=(h,g,p=c,m)=>{let b={relativePath:m===void 0?h.path||"":m,caseSensitive:h.caseSensitive===!0,childrenIndex:g,route:h};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(o)&&p)return;Le(b.relativePath.startsWith(o),`Absolute route path "${b.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(o.length)}let v=Xt([o,b.relativePath]),N=r.concat(b);h.children&&h.children.length>0&&(Le(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Pm(h.children,l,N,v,p)),!(h.path==null&&!h.index)&&l.push({path:v,score:pv(v,h.index),routesMeta:N})};return i.forEach((h,g)=>{var p;if(h.path===""||!((p=h.path)!=null&&p.includes("?")))f(h,g);else for(let m of eg(h.path))f(h,g,!0,m)}),l}function eg(i){let l=i.split("/");if(l.length===0)return[];let[r,...o]=l,c=r.endsWith("?"),f=r.replace(/\?$/,"");if(o.length===0)return c?[f,""]:[f];let h=eg(o.join("/")),g=[];return g.push(...h.map(p=>p===""?f:[f,p].join("/"))),c&&g.push(...h),g.map(p=>i.startsWith("/")&&p===""?"/":p)}function ov(i){i.sort((l,r)=>l.score!==r.score?r.score-l.score:yv(l.routesMeta.map(o=>o.childrenIndex),r.routesMeta.map(o=>o.childrenIndex)))}var cv=/^:[\w-]+$/,fv=3,dv=2,hv=1,mv=10,gv=-2,mm=i=>i==="*";function pv(i,l){let r=i.split("/"),o=r.length;return r.some(mm)&&(o+=gv),l&&(o+=dv),r.filter(c=>!mm(c)).reduce((c,f)=>c+(cv.test(f)?fv:f===""?hv:mv),o)}function yv(i,l){return i.length===l.length&&i.slice(0,-1).every((o,c)=>o===l[c])?i[i.length-1]-l[l.length-1]:0}function vv(i,l,r=!1){let{routesMeta:o}=i,c={},f="/",h=[];for(let g=0;g<o.length;++g){let p=o[g],m=g===o.length-1,b=f==="/"?l:l.slice(f.length)||"/",v=Du({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},b),N=p.route;if(!v&&m&&r&&!o[o.length-1].route.index&&(v=Du({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},b)),!v)return null;Object.assign(c,v.params),h.push({params:c,pathname:Xt([f,v.pathname]),pathnameBase:Rv(Xt([f,v.pathnameBase])),route:N}),v.pathnameBase!=="/"&&(f=Xt([f,v.pathnameBase]))}return h}function Du(i,l){typeof i=="string"&&(i={path:i,caseSensitive:!1,end:!0});let[r,o]=bv(i.path,i.caseSensitive,i.end),c=l.match(r);if(!c)return null;let f=c[0],h=f.replace(/(.)\/+$/,"$1"),g=c.slice(1);return{params:o.reduce((m,{paramName:b,isOptional:v},N)=>{if(b==="*"){let z=g[N]||"";h=f.slice(0,f.length-z.length).replace(/(.)\/+$/,"$1")}const L=g[N];return v&&!L?m[b]=void 0:m[b]=(L||"").replace(/%2F/g,"/"),m},{}),pathname:f,pathnameBase:h,pattern:i}}function bv(i,l=!1,r=!0){Ot(i==="*"||!i.endsWith("*")||i.endsWith("/*"),`Route path "${i}" will be treated as if it were "${i.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${i.replace(/\*$/,"/*")}".`);let o=[],c="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,g,p,m,b)=>{if(o.push({paramName:g,isOptional:p!=null}),p){let v=b.charAt(m+h.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return i.endsWith("*")?(o.push({paramName:"*"}),c+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?c+="\\/*$":i!==""&&i!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,l?void 0:"i"),o]}function Sv(i){try{return i.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Ot(!1,`The URL path "${i}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),i}}function ga(i,l){if(l==="/")return i;if(!i.toLowerCase().startsWith(l.toLowerCase()))return null;let r=l.endsWith("/")?l.length-1:l.length,o=i.charAt(r);return o&&o!=="/"?null:i.slice(r)||"/"}var xv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Ev(i,l="/"){let{pathname:r,search:o="",hash:c=""}=typeof i=="string"?hn(i):i,f;return r?(r=tg(r),r.startsWith("/")?f=gm(r.substring(1),"/"):f=gm(r,l)):f=l,{pathname:f,search:_v(o),hash:Ov(c)}}function gm(i,l){let r=Uu(l).split("/");return i.split("/").forEach(c=>{c===".."?r.length>1&&r.pop():c!=="."&&r.push(c)}),r.length>1?r.join("/"):"/"}function bo(i,l,r,o){return`Cannot include a '${i}' character in a manually specified \`to.${l}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Tv(i){return i.filter((l,r)=>r===0||l.route.path&&l.route.path.length>0)}function Bo(i){let l=Tv(i);return l.map((r,o)=>o===l.length-1?r.pathname:r.pathnameBase)}function Gu(i,l,r,o=!1){let c;typeof i=="string"?c=hn(i):(c={...i},Le(!c.pathname||!c.pathname.includes("?"),bo("?","pathname","search",c)),Le(!c.pathname||!c.pathname.includes("#"),bo("#","pathname","hash",c)),Le(!c.search||!c.search.includes("#"),bo("#","search","hash",c)));let f=i===""||c.pathname==="",h=f?"/":c.pathname,g;if(h==null)g=r;else{let v=l.length-1;if(!o&&h.startsWith("..")){let N=h.split("/");for(;N[0]==="..";)N.shift(),v-=1;c.pathname=N.join("/")}g=v>=0?l[v]:"/"}let p=Ev(c,g),m=h&&h!=="/"&&h.endsWith("/"),b=(f||h===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(m||b)&&(p.pathname+="/"),p}var tg=i=>i.replace(/\/\/+/g,"/"),Xt=i=>tg(i.join("/")),Uu=i=>i.replace(/\/+$/,""),Rv=i=>Uu(i).replace(/^\/*/,"/"),_v=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,Ov=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i,Cv=class{constructor(i,l,r,o=!1){this.status=i,this.statusText=l||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Av(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}function zv(i){let l=i.map(r=>r.route.path).filter(Boolean);return Xt(l)||"/"}var ag=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ng(i,l){let r=i;if(typeof r!="string"||!xv.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let o=r,c=!1;if(ag)try{let f=new URL(window.location.href),h=r.startsWith("//")?new URL(f.protocol+r):new URL(r),g=ga(h.pathname,l);h.origin===f.origin&&g!=null?r=g+h.search+h.hash:c=!0}catch{Ot(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var lg=["POST","PUT","PATCH","DELETE"];new Set(lg);var Nv=["GET",...lg];new Set(Nv);var tl=T.createContext(null);tl.displayName="DataRouter";var Vu=T.createContext(null);Vu.displayName="DataRouterState";var ig=T.createContext(!1);function wv(){return T.useContext(ig)}var ug=T.createContext({isTransitioning:!1});ug.displayName="ViewTransition";var jv=T.createContext(new Map);jv.displayName="Fetchers";var Mv=T.createContext(null);Mv.displayName="Await";var At=T.createContext(null);At.displayName="Navigation";var ci=T.createContext(null);ci.displayName="Location";var qt=T.createContext({outlet:null,matches:[],isDataRoute:!1});qt.displayName="Route";var qo=T.createContext(null);qo.displayName="RouteError";var rg="REACT_ROUTER_ERROR",Lv="REDIRECT",Dv="ROUTE_ERROR_RESPONSE";function Uv(i){if(i.startsWith(`${rg}:${Lv}:{`))try{let l=JSON.parse(i.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function kv(i){if(i.startsWith(`${rg}:${Dv}:{`))try{let l=JSON.parse(i.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new Cv(l.status,l.statusText,l.data)}catch{}}function Hv(i,{relative:l}={}){Le(al(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:o}=T.useContext(At),{hash:c,pathname:f,search:h}=fi(i,{relative:l}),g=f;return r!=="/"&&(g=f==="/"?r:Xt([r,f])),o.createHref({pathname:g,search:h,hash:c})}function al(){return T.useContext(ci)!=null}function zt(){return Le(al(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(ci).location}var sg="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function og(i){T.useContext(At).static||T.useLayoutEffect(i)}function Ku(){let{isDataRoute:i}=T.useContext(qt);return i?Pv():Bv()}function Bv(){Le(al(),"useNavigate() may be used only in the context of a <Router> component.");let i=T.useContext(tl),{basename:l,navigator:r}=T.useContext(At),{matches:o}=T.useContext(qt),{pathname:c}=zt(),f=JSON.stringify(Bo(o)),h=T.useRef(!1);return og(()=>{h.current=!0}),T.useCallback((p,m={})=>{if(Ot(h.current,sg),!h.current)return;if(typeof p=="number"){r.go(p);return}let b=Gu(p,JSON.parse(f),c,m.relative==="path");i==null&&l!=="/"&&(b.pathname=b.pathname==="/"?l:Xt([l,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[l,r,f,c,i])}var qv=T.createContext(null);function Yv(i){let l=T.useContext(qt).outlet;return T.useMemo(()=>l&&T.createElement(qv.Provider,{value:i},l),[l,i])}function cg(){let{matches:i}=T.useContext(qt),l=i[i.length-1];return(l==null?void 0:l.params)??{}}function fi(i,{relative:l}={}){let{matches:r}=T.useContext(qt),{pathname:o}=zt(),c=JSON.stringify(Bo(r));return T.useMemo(()=>Gu(i,JSON.parse(c),o,l==="path"),[i,c,o,l])}function Gv(i,l){return fg(i,l)}function fg(i,l,r){var B;Le(al(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=T.useContext(At),{matches:c}=T.useContext(qt),f=c[c.length-1],h=f?f.params:{},g=f?f.pathname:"/",p=f?f.pathnameBase:"/",m=f&&f.route;{let q=m&&m.path||"";hg(g,!m||q.endsWith("*")||q.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${g}" (under <Route path="${q}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
175
175
|
|
|
176
|
-
Please change the parent <Route path="${q}"> to <Route path="${q==="/"?"*":`${q}/*`}">.`)}let b=zt(),v;if(l){let q=typeof l=="string"?hn(l):l;Le(p==="/"||((B=q.pathname)==null?void 0:B.startsWith(p)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${q.pathname}" was given in the \`location\` prop.`),v=q}else v=b;let N=v.pathname||"/",L=N;if(p!=="/"){let q=p.replace(/^\//,"").split("/");L="/"+N.replace(/^\//,"").split("/").slice(q.length).join("/")}let z=Im(i,{pathname:L});Ot(m||z!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Ot(z==null||z[z.length-1].route.element!==void 0||z[z.length-1].route.Component!==void 0||z[z.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let H=Zv(z&&z.map(q=>Object.assign({},q,{params:Object.assign({},h,q.params),pathname:Xt([p,o.encodeLocation?o.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?p:Xt([p,o.encodeLocation?o.encodeLocation(q.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathnameBase])})),c,r);return l&&H?T.createElement(ci.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},H):H}function Vv(){let i=Iv(),l=Av(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),r=i instanceof Error?i.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},f={padding:"2px 4px",backgroundColor:o},h=null;return console.error("Error handled by React Router default ErrorBoundary:",i),h=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:f},"ErrorBoundary")," or"," ",T.createElement("code",{style:f},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},l),r?T.createElement("pre",{style:c},r):null,h)}var Kv=T.createElement(Vv,null),dg=class extends T.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,l){return l.location!==i.location||l.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:l.error,location:l.location,revalidation:i.revalidation||l.revalidation}}componentDidCatch(i,l){this.props.onError?this.props.onError(i,l):console.error("React Router caught the following error during render",i)}render(){let i=this.state.error;if(this.context&&typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){const r=kv(i.digest);r&&(i=r)}let l=i!==void 0?T.createElement(qt.Provider,{value:this.props.routeContext},T.createElement(qo.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?T.createElement(Xv,{error:i},l):l}};dg.contextType=ig;var So=new WeakMap;function Xv({children:i,error:l}){let{basename:r}=T.useContext(At);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let o=Uv(l.digest);if(o){let c=So.get(l);if(c)throw c;let f=ng(o.location,r);if(ag&&!So.get(l))if(f.isExternal||o.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:o.replace}));throw So.set(l,h),h}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return i}function Qv({routeContext:i,match:l,children:r}){let o=T.useContext(tl);return o&&o.static&&o.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=l.route.id),T.createElement(qt.Provider,{value:i},r)}function Zv(i,l=[],r){let o=r==null?void 0:r.state;if(i==null){if(!o)return null;if(o.errors)i=o.matches;else if(l.length===0&&!o.initialized&&o.matches.length>0)i=o.matches;else return null}let c=i,f=o==null?void 0:o.errors;if(f!=null){let b=c.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);Le(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),c=c.slice(0,Math.min(c.length,b+1))}let h=!1,g=-1;if(r&&o){h=o.renderFallback;for(let b=0;b<c.length;b++){let v=c[b];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=b),v.route.id){let{loaderData:N,errors:L}=o,z=v.route.loader&&!N.hasOwnProperty(v.route.id)&&(!L||L[v.route.id]===void 0);if(v.route.lazy||z){r.isStatic&&(h=!0),g>=0?c=c.slice(0,g+1):c=[c[0]];break}}}}let p=r==null?void 0:r.onError,m=o&&p?(b,v)=>{var N,L;p(b,{location:o.location,params:((L=(N=o.matches)==null?void 0:N[0])==null?void 0:L.params)??{},unstable_pattern:zv(o.matches),errorInfo:v})}:void 0;return c.reduceRight((b,v,N)=>{let L,z=!1,H=null,B=null;o&&(L=f&&v.route.id?f[v.route.id]:void 0,H=v.route.errorElement||Kv,h&&(g<0&&N===0?(hg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),z=!0,B=null):g===N&&(z=!0,B=v.route.hydrateFallbackElement||null)));let q=l.concat(c.slice(0,N+1)),X=()=>{let Q;return L?Q=H:z?Q=B:v.route.Component?Q=T.createElement(v.route.Component,null):v.route.element?Q=v.route.element:Q=b,T.createElement(Qv,{match:v,routeContext:{outlet:b,matches:q,isDataRoute:o!=null},children:Q})};return o&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?T.createElement(dg,{location:o.location,revalidation:o.revalidation,component:H,error:L,children:X(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:m}):X()},null)}function Yo(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $v(i){let l=T.useContext(tl);return Le(l,Yo(i)),l}function Jv(i){let l=T.useContext(Vu);return Le(l,Yo(i)),l}function Fv(i){let l=T.useContext(qt);return Le(l,Yo(i)),l}function Go(i){let l=Fv(i),r=l.matches[l.matches.length-1];return Le(r.route.id,`${i} can only be used on routes that contain a unique "id"`),r.route.id}function Wv(){return Go("useRouteId")}function Iv(){var o;let i=T.useContext(qo),l=Jv("useRouteError"),r=Go("useRouteError");return i!==void 0?i:(o=l.errors)==null?void 0:o[r]}function Pv(){let{router:i}=$v("useNavigate"),l=Go("useNavigate"),r=T.useRef(!1);return og(()=>{r.current=!0}),T.useCallback(async(c,f={})=>{Ot(r.current,sg),r.current&&(typeof c=="number"?await i.navigate(c):await i.navigate(c,{fromRouteId:l,...f}))},[i,l])}var pm={};function hg(i,l,r){!l&&!pm[i]&&(pm[i]=!0,Ot(!1,r))}T.memo(e1);function e1({routes:i,future:l,state:r,isStatic:o,onError:c}){return fg(i,void 0,{state:r,isStatic:o,onError:c})}function Ya({to:i,replace:l,state:r,relative:o}){Le(al(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=T.useContext(At);Ot(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:f}=T.useContext(qt),{pathname:h}=zt(),g=Ku(),p=Gu(i,Bo(f),h,o==="path"),m=JSON.stringify(p);return T.useEffect(()=>{g(JSON.parse(m),{replace:l,state:r,relative:o})},[g,m,o,l,r]),null}function t1(i){return Yv(i.context)}function on(i){Le(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function a1({basename:i="/",children:l=null,location:r,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:h}){Le(!al(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let g=i.replace(/^\/*/,"/"),p=T.useMemo(()=>({basename:g,navigator:c,static:f,unstable_useTransitions:h,future:{}}),[g,c,f,h]);typeof r=="string"&&(r=hn(r));let{pathname:m="/",search:b="",hash:v="",state:N=null,key:L="default",unstable_mask:z}=r,H=T.useMemo(()=>{let B=ga(m,g);return B==null?null:{location:{pathname:B,search:b,hash:v,state:N,key:L,unstable_mask:z},navigationType:o}},[g,m,b,v,N,L,o,z]);return Ot(H!=null,`<Router basename="${g}"> is not able to match the URL "${m}${b}${v}" because it does not start with the basename, so the <Router> won't render anything.`),H==null?null:T.createElement(At.Provider,{value:p},T.createElement(ci.Provider,{children:l,value:H}))}function n1({children:i,location:l}){return Gv(zo(i),l)}function zo(i,l=[]){let r=[];return T.Children.forEach(i,(o,c)=>{if(!T.isValidElement(o))return;let f=[...l,c];if(o.type===T.Fragment){r.push.apply(r,zo(o.props.children,f));return}Le(o.type===on,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Le(!o.props.index||!o.props.children,"An index route cannot have child routes.");let h={id:o.props.id||f.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(h.children=zo(o.props.children,f)),r.push(h)}),r}var ju="get",Mu="application/x-www-form-urlencoded";function Xu(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function l1(i){return Xu(i)&&i.tagName.toLowerCase()==="button"}function i1(i){return Xu(i)&&i.tagName.toLowerCase()==="form"}function u1(i){return Xu(i)&&i.tagName.toLowerCase()==="input"}function r1(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function s1(i,l){return i.button===0&&(!l||l==="_self")&&!r1(i)}function No(i=""){return new URLSearchParams(typeof i=="string"||Array.isArray(i)||i instanceof URLSearchParams?i:Object.keys(i).reduce((l,r)=>{let o=i[r];return l.concat(Array.isArray(o)?o.map(c=>[r,c]):[[r,o]])},[]))}function o1(i,l){let r=No(i);return l&&l.forEach((o,c)=>{r.has(c)||l.getAll(c).forEach(f=>{r.append(c,f)})}),r}var Nu=null;function c1(){if(Nu===null)try{new FormData(document.createElement("form"),0),Nu=!1}catch{Nu=!0}return Nu}var f1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xo(i){return i!=null&&!f1.has(i)?(Ot(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Mu}"`),null):i}function d1(i,l){let r,o,c,f,h;if(i1(i)){let g=i.getAttribute("action");o=g?ga(g,l):null,r=i.getAttribute("method")||ju,c=xo(i.getAttribute("enctype"))||Mu,f=new FormData(i)}else if(l1(i)||u1(i)&&(i.type==="submit"||i.type==="image")){let g=i.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=i.getAttribute("formaction")||g.getAttribute("action");if(o=p?ga(p,l):null,r=i.getAttribute("formmethod")||g.getAttribute("method")||ju,c=xo(i.getAttribute("formenctype"))||xo(g.getAttribute("enctype"))||Mu,f=new FormData(g,i),!c1()){let{name:m,type:b,value:v}=i;if(b==="image"){let N=m?`${m}.`:"";f.append(`${N}x`,"0"),f.append(`${N}y`,"0")}else m&&f.append(m,v)}}else{if(Xu(i))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ju,o=null,c=Mu,h=i}return f&&c==="text/plain"&&(h=f,f=void 0),{action:o,method:r.toLowerCase(),encType:c,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Vo(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function mg(i,l,r,o){let c=typeof i=="string"?new URL(i,typeof window>"u"?"server://singlefetch/":window.location.origin):i;return r?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:l&&ga(c.pathname,l)==="/"?c.pathname=`${Uu(l)}/_root.${o}`:c.pathname=`${Uu(c.pathname)}.${o}`,c}async function h1(i,l){if(i.id in l)return l[i.id];try{let r=await import(i.module);return l[i.id]=r,r}catch(r){return console.error(`Error loading route module \`${i.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function m1(i){return i==null?!1:i.href==null?i.rel==="preload"&&typeof i.imageSrcSet=="string"&&typeof i.imageSizes=="string":typeof i.rel=="string"&&typeof i.href=="string"}async function g1(i,l,r){let o=await Promise.all(i.map(async c=>{let f=l.routes[c.route.id];if(f){let h=await h1(f,r);return h.links?h.links():[]}return[]}));return b1(o.flat(1).filter(m1).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function ym(i,l,r,o,c,f){let h=(p,m)=>r[m]?p.route.id!==r[m].route.id:!0,g=(p,m)=>{var b;return r[m].pathname!==p.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==p.params["*"]};return f==="assets"?l.filter((p,m)=>h(p,m)||g(p,m)):f==="data"?l.filter((p,m)=>{var v;let b=o.routes[p.route.id];if(!b||!b.hasLoader)return!1;if(h(p,m)||g(p,m))return!0;if(p.route.shouldRevalidate){let N=p.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=r[0])==null?void 0:v.params)||{},nextUrl:new URL(i,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof N=="boolean")return N}return!0}):[]}function p1(i,l,{includeHydrateFallback:r}={}){return y1(i.map(o=>{let c=l.routes[o.route.id];if(!c)return[];let f=[c.module];return c.clientActionModule&&(f=f.concat(c.clientActionModule)),c.clientLoaderModule&&(f=f.concat(c.clientLoaderModule)),r&&c.hydrateFallbackModule&&(f=f.concat(c.hydrateFallbackModule)),c.imports&&(f=f.concat(c.imports)),f}).flat(1))}function y1(i){return[...new Set(i)]}function v1(i){let l={},r=Object.keys(i).sort();for(let o of r)l[o]=i[o];return l}function b1(i,l){let r=new Set;return new Set(l),i.reduce((o,c)=>{let f=JSON.stringify(v1(c));return r.has(f)||(r.add(f),o.push({key:f,link:c})),o},[])}function Ko(){let i=T.useContext(tl);return Vo(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function S1(){let i=T.useContext(Vu);return Vo(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Xo=T.createContext(void 0);Xo.displayName="FrameworkContext";function Qo(){let i=T.useContext(Xo);return Vo(i,"You must render this element inside a <HydratedRouter> element"),i}function x1(i,l){let r=T.useContext(Xo),[o,c]=T.useState(!1),[f,h]=T.useState(!1),{onFocus:g,onBlur:p,onMouseEnter:m,onMouseLeave:b,onTouchStart:v}=l,N=T.useRef(null);T.useEffect(()=>{if(i==="render"&&h(!0),i==="viewport"){let H=q=>{q.forEach(X=>{h(X.isIntersecting)})},B=new IntersectionObserver(H,{threshold:.5});return N.current&&B.observe(N.current),()=>{B.disconnect()}}},[i]),T.useEffect(()=>{if(o){let H=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(H)}}},[o]);let L=()=>{c(!0)},z=()=>{c(!1),h(!1)};return r?i!=="intent"?[f,N,{}]:[f,N,{onFocus:Il(g,L),onBlur:Il(p,z),onMouseEnter:Il(m,L),onMouseLeave:Il(b,z),onTouchStart:Il(v,L)}]:[!1,N,{}]}function Il(i,l){return r=>{i&&i(r),r.defaultPrevented||l(r)}}function E1({page:i,...l}){let r=wv(),{router:o}=Ko(),c=T.useMemo(()=>Im(o.routes,i,o.basename),[o.routes,i,o.basename]);return c?r?T.createElement(R1,{page:i,matches:c,...l}):T.createElement(_1,{page:i,matches:c,...l}):null}function T1(i){let{manifest:l,routeModules:r}=Qo(),[o,c]=T.useState([]);return T.useEffect(()=>{let f=!1;return g1(i,l,r).then(h=>{f||c(h)}),()=>{f=!0}},[i,l,r]),o}function R1({page:i,matches:l,...r}){let o=zt(),{future:c}=Qo(),{basename:f}=Ko(),h=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let g=mg(i,f,c.unstable_trailingSlashAwareDataRequests,"rsc"),p=!1,m=[];for(let b of l)typeof b.route.shouldRevalidate=="function"?p=!0:m.push(b.route.id);return p&&m.length>0&&g.searchParams.set("_routes",m.join(",")),[g.pathname+g.search]},[f,c.unstable_trailingSlashAwareDataRequests,i,o,l]);return T.createElement(T.Fragment,null,h.map(g=>T.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...r})))}function _1({page:i,matches:l,...r}){let o=zt(),{future:c,manifest:f,routeModules:h}=Qo(),{basename:g}=Ko(),{loaderData:p,matches:m}=S1(),b=T.useMemo(()=>ym(i,l,m,f,o,"data"),[i,l,m,f,o]),v=T.useMemo(()=>ym(i,l,m,f,o,"assets"),[i,l,m,f,o]),N=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let H=new Set,B=!1;if(l.forEach(X=>{var J;let Q=f.routes[X.route.id];!Q||!Q.hasLoader||(!b.some(V=>V.route.id===X.route.id)&&X.route.id in p&&((J=h[X.route.id])!=null&&J.shouldRevalidate)||Q.hasClientLoader?B=!0:H.add(X.route.id))}),H.size===0)return[];let q=mg(i,g,c.unstable_trailingSlashAwareDataRequests,"data");return B&&H.size>0&&q.searchParams.set("_routes",l.filter(X=>H.has(X.route.id)).map(X=>X.route.id).join(",")),[q.pathname+q.search]},[g,c.unstable_trailingSlashAwareDataRequests,p,o,f,b,l,i,h]),L=T.useMemo(()=>p1(v,f),[v,f]),z=T1(v);return T.createElement(T.Fragment,null,N.map(H=>T.createElement("link",{key:H,rel:"prefetch",as:"fetch",href:H,...r})),L.map(H=>T.createElement("link",{key:H,rel:"modulepreload",href:H,...r})),z.map(({key:H,link:B})=>T.createElement("link",{key:H,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function O1(...i){return l=>{i.forEach(r=>{typeof r=="function"?r(l):r!=null&&(r.current=l)})}}var C1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{C1&&(window.__reactRouterVersion="7.14.2")}catch{}function A1({basename:i,children:l,unstable_useTransitions:r,window:o}){let c=T.useRef();c.current==null&&(c.current=lv({window:o,v5Compat:!0}));let f=c.current,[h,g]=T.useState({action:f.action,location:f.location}),p=T.useCallback(m=>{r===!1?g(m):T.startTransition(()=>g(m))},[r]);return T.useLayoutEffect(()=>f.listen(p),[f,p]),T.createElement(a1,{basename:i,children:l,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:r})}var gg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pg=T.forwardRef(function({onClick:l,discover:r="render",prefetch:o="none",relative:c,reloadDocument:f,replace:h,unstable_mask:g,state:p,target:m,to:b,preventScrollReset:v,viewTransition:N,unstable_defaultShouldRevalidate:L,...z},H){let{basename:B,navigator:q,unstable_useTransitions:X}=T.useContext(At),Q=typeof b=="string"&&gg.test(b),J=ng(b,B);b=J.to;let V=Hv(b,{relative:c}),ue=zt(),K=null;if(g){let De=Gu(g,[],ue.unstable_mask?ue.unstable_mask.pathname:"/",!0);B!=="/"&&(De.pathname=De.pathname==="/"?B:Xt([B,De.pathname])),K=q.createHref(De)}let[te,le,se]=x1(o,z),Ae=w1(b,{replace:h,unstable_mask:g,state:p,target:m,preventScrollReset:v,relative:c,viewTransition:N,unstable_defaultShouldRevalidate:L,unstable_useTransitions:X});function Fe(De){l&&l(De),De.defaultPrevented||Ae(De)}let ze=!(J.isExternal||f),je=T.createElement("a",{...z,...se,href:(ze?K:void 0)||J.absoluteURL||V,onClick:ze?Fe:l,ref:O1(H,le),target:m,"data-discover":!Q&&r==="render"?"true":void 0});return te&&!Q?T.createElement(T.Fragment,null,je,T.createElement(E1,{page:V})):je});pg.displayName="Link";var wo=T.forwardRef(function({"aria-current":l="page",caseSensitive:r=!1,className:o="",end:c=!1,style:f,to:h,viewTransition:g,children:p,...m},b){let v=fi(h,{relative:m.relative}),N=zt(),L=T.useContext(Vu),{navigator:z,basename:H}=T.useContext(At),B=L!=null&&U1(v)&&g===!0,q=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,X=N.pathname,Q=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(X=X.toLowerCase(),Q=Q?Q.toLowerCase():null,q=q.toLowerCase()),Q&&H&&(Q=ga(Q,H)||Q);const J=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let V=X===q||!c&&X.startsWith(q)&&X.charAt(J)==="/",ue=Q!=null&&(Q===q||!c&&Q.startsWith(q)&&Q.charAt(q.length)==="/"),K={isActive:V,isPending:ue,isTransitioning:B},te=V?l:void 0,le;typeof o=="function"?le=o(K):le=[o,V?"active":null,ue?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let se=typeof f=="function"?f(K):f;return T.createElement(pg,{...m,"aria-current":te,className:le,ref:b,style:se,to:h,viewTransition:g},typeof p=="function"?p(K):p)});wo.displayName="NavLink";var z1=T.forwardRef(({discover:i="render",fetcherKey:l,navigate:r,reloadDocument:o,replace:c,state:f,method:h=ju,action:g,onSubmit:p,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N,...L},z)=>{let{unstable_useTransitions:H}=T.useContext(At),B=L1(),q=D1(g,{relative:m}),X=h.toLowerCase()==="get"?"get":"post",Q=typeof g=="string"&&gg.test(g),J=V=>{if(p&&p(V),V.defaultPrevented)return;V.preventDefault();let ue=V.nativeEvent.submitter,K=(ue==null?void 0:ue.getAttribute("formmethod"))||h,te=()=>B(ue||V.currentTarget,{fetcherKey:l,method:K,navigate:r,replace:c,state:f,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N});H&&r!==!1?T.startTransition(()=>te()):te()};return T.createElement("form",{ref:z,method:X,action:q,onSubmit:o?p:J,...L,"data-discover":!Q&&i==="render"?"true":void 0})});z1.displayName="Form";function N1(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yg(i){let l=T.useContext(tl);return Le(l,N1(i)),l}function w1(i,{target:l,replace:r,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let b=Ku(),v=zt(),N=fi(i,{relative:h});return T.useCallback(L=>{if(s1(L,l)){L.preventDefault();let z=r!==void 0?r:li(v)===li(N),H=()=>b(i,{replace:z,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p});m?T.startTransition(()=>H()):H()}},[v,b,N,r,o,c,l,i,f,h,g,p,m])}function IS(i){Ot(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let l=T.useRef(No(i)),r=T.useRef(!1),o=zt(),c=T.useMemo(()=>o1(o.search,r.current?null:l.current),[o.search]),f=Ku(),h=T.useCallback((g,p)=>{const m=No(typeof g=="function"?g(new URLSearchParams(c)):g);r.current=!0,f("?"+m,p)},[f,c]);return[c,h]}var j1=0,M1=()=>`__${String(++j1)}__`;function L1(){let{router:i}=yg("useSubmit"),{basename:l}=T.useContext(At),r=Wv(),o=i.fetch,c=i.navigate;return T.useCallback(async(f,h={})=>{let{action:g,method:p,encType:m,formData:b,body:v}=d1(f,l);if(h.navigate===!1){let N=h.fetcherKey||M1();await o(N,r,h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||p,formEncType:h.encType||m,flushSync:h.flushSync})}else await c(h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||p,formEncType:h.encType||m,replace:h.replace,state:h.state,fromRouteId:r,flushSync:h.flushSync,viewTransition:h.viewTransition})},[o,c,l,r])}function D1(i,{relative:l}={}){let{basename:r}=T.useContext(At),o=T.useContext(qt);Le(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),f={...fi(i||".",{relative:l})},h=zt();if(i==null){f.search=h.search;let g=new URLSearchParams(f.search),p=g.getAll("index");if(p.some(b=>b==="")){g.delete("index"),p.filter(v=>v).forEach(v=>g.append("index",v));let b=g.toString();f.search=b?`?${b}`:""}}return(!i||i===".")&&c.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(f.pathname=f.pathname==="/"?r:Xt([r,f.pathname])),li(f)}function U1(i,{relative:l}={}){let r=T.useContext(ug);Le(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=yg("useViewTransitionState"),c=fi(i,{relative:l});if(!r.isTransitioning)return!1;let f=ga(r.currentLocation.pathname,o)||r.currentLocation.pathname,h=ga(r.nextLocation.pathname,o)||r.nextLocation.pathname;return Du(c.pathname,h)!=null||Du(c.pathname,f)!=null}const vm=i=>{let l;const r=new Set,o=(m,b)=>{const v=typeof m=="function"?m(l):m;if(!Object.is(v,l)){const N=l;l=b??(typeof v!="object"||v===null)?v:Object.assign({},l,v),r.forEach(L=>L(l,N))}},c=()=>l,g={setState:o,getState:c,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=l=i(o,c,g);return g},k1=(i=>i?vm(i):vm),H1=i=>i;function B1(i,l=H1){const r=Pn.useSyncExternalStore(i.subscribe,Pn.useCallback(()=>l(i.getState()),[i,l]),Pn.useCallback(()=>l(i.getInitialState()),[i,l]));return Pn.useDebugValue(r),r}const bm=i=>{const l=k1(i),r=o=>B1(l,o);return Object.assign(r,l),r},Zo=(i=>i?bm(i):bm),Sm="/api/v1";class q1{constructor(){In(this,"token","");In(this,"baseUrl",Sm)}setToken(l){this.token=l}setBaseUrl(l){const r=l.trim();if(!r){this.baseUrl=Sm;return}this.baseUrl=r.endsWith("/api/v1")?r:`${r.replace(/\/+$/,"")}/api/v1`}getToken(){return this.token}getBaseUrl(){return this.baseUrl}headers(){const l={"Content-Type":"application/json"};return this.token&&(l.Authorization=`Bearer ${this.token}`),l}async request(l,r,o,c){let f=this.resolveUrl(r);if(c){const p=new URLSearchParams(c).toString();p&&(f+=`?${p}`)}const h=await fetch(f,{method:l,headers:this.headers(),body:o?JSON.stringify(o):void 0}),g=await h.json();if(!g.ok)throw new Y1(g.error||"Unknown error",h.status);return g.data}get(l,r){return this.request("GET",l,void 0,r)}post(l,r){return this.request("POST",l,r)}patch(l,r){return this.request("PATCH",l,r)}delete(l){return this.request("DELETE",l)}resolveUrl(l){const r=l.replace(/^\/+/,"");return this.baseUrl.startsWith("http://")||this.baseUrl.startsWith("https://")?new URL(r,`${this.baseUrl}/`).toString():`${this.baseUrl}/${r}`.replace(/([^:]\/)\/+/g,"$1")}}class Y1 extends Error{constructor(l,r){super(l),this.status=r,this.name="ApiError"}}const Qe=new q1,Ct=Zo(i=>({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none",login:(l,r)=>{Qe.setToken(l),r&&Qe.setBaseUrl(r),localStorage.setItem("cc_token",l),r&&localStorage.setItem("cc_server_url",r),i({token:l,serverUrl:r||"",isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"})},setManagedSession:(l,r,o)=>{Qe.setToken(l),Qe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!0,managedBy:o})},setDesktopSession:(l,r)=>{Ct.getState().setManagedSession(l,r,"electron")},logout:()=>{Ct.getState().desktopManaged||(Qe.setToken(""),Qe.setBaseUrl(""),localStorage.removeItem("cc_token"),localStorage.removeItem("cc_server_url"),i({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none"}))},init:()=>{const l=localStorage.getItem("cc_token")||"",r=localStorage.getItem("cc_server_url")||"";l&&(Qe.setToken(l),r&&Qe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"}))}})),G1=(i,l,r,o)=>{var f,h,g,p;const c=[r,{code:l,...o||{}}];if((h=(f=i==null?void 0:i.services)==null?void 0:f.logger)!=null&&h.forward)return i.services.logger.forward(c,"warn","react-i18next::",!0);fn(c[0])&&(c[0]=`react-i18next:: ${c[0]}`),(p=(g=i==null?void 0:i.services)==null?void 0:g.logger)!=null&&p.warn?i.services.logger.warn(...c):console!=null&&console.warn&&console.warn(...c)},xm={},jo=(i,l,r,o)=>{fn(r)&&xm[r]||(fn(r)&&(xm[r]=new Date),G1(i,l,r,o))},vg=(i,l)=>()=>{if(i.isInitialized)l();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),l()};i.on("initialized",r)}},Mo=(i,l,r)=>{i.loadNamespaces(l,vg(i,r))},Em=(i,l,r,o)=>{if(fn(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(l)>-1)return Mo(i,r,o);r.forEach(c=>{i.options.ns.indexOf(c)<0&&i.options.ns.push(c)}),i.loadLanguages(l,vg(i,o))},V1=(i,l,r={})=>!l.languages||!l.languages.length?(jo(l,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:l.languages}),!0):l.hasLoadedNamespace(i,{lng:r.lng,precheck:(o,c)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!c(o.isLanguageChangingTo,i))return!1}}),fn=i=>typeof i=="string",K1=i=>typeof i=="object"&&i!==null,X1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Q1={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Z1=i=>Q1[i],$1=i=>i.replace(X1,Z1);let Lo={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$1};const J1=(i={})=>{Lo={...Lo,...i}},F1=()=>Lo;let bg;const W1=i=>{bg=i},I1=()=>bg,P1={type:"3rdParty",init(i){J1(i.options.react),W1(i)}},eb=T.createContext();class tb{constructor(){this.usedNamespaces={}}addUsedNamespaces(l){l.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const ab=(i,l)=>{const r=T.useRef();return T.useEffect(()=>{r.current=i},[i,l]),r.current},Sg=(i,l,r,o)=>i.getFixedT(l,r,o),nb=(i,l,r,o)=>T.useCallback(Sg(i,l,r,o),[i,l,r,o]),xg=(i,l={})=>{var J,V,ue,K;const{i18n:r}=l,{i18n:o,defaultNS:c}=T.useContext(eb)||{},f=r||o||I1();if(f&&!f.reportNamespaces&&(f.reportNamespaces=new tb),!f){jo(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const te=(se,Ae)=>fn(Ae)?Ae:K1(Ae)&&fn(Ae.defaultValue)?Ae.defaultValue:Array.isArray(se)?se[se.length-1]:se,le=[te,{},!1];return le.t=te,le.i18n={},le.ready=!1,le}(J=f.options.react)!=null&&J.wait&&jo(f,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const h={...F1(),...f.options.react,...l},{useSuspense:g,keyPrefix:p}=h;let m=c||((V=f.options)==null?void 0:V.defaultNS);m=fn(m)?[m]:m||["translation"],(K=(ue=f.reportNamespaces).addUsedNamespaces)==null||K.call(ue,m);const b=(f.isInitialized||f.initializedStoreOnce)&&m.every(te=>V1(te,f,h)),v=nb(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),N=()=>v,L=()=>Sg(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),[z,H]=T.useState(N);let B=m.join();l.lng&&(B=`${l.lng}${B}`);const q=ab(B),X=T.useRef(!0);T.useEffect(()=>{const{bindI18n:te,bindI18nStore:le}=h;X.current=!0,!b&&!g&&(l.lng?Em(f,l.lng,m,()=>{X.current&&H(L)}):Mo(f,m,()=>{X.current&&H(L)})),b&&q&&q!==B&&X.current&&H(L);const se=()=>{X.current&&H(L)};return te&&(f==null||f.on(te,se)),le&&(f==null||f.store.on(le,se)),()=>{X.current=!1,f&&te&&(te==null||te.split(" ").forEach(Ae=>f.off(Ae,se))),le&&f&&le.split(" ").forEach(Ae=>f.store.off(Ae,se))}},[f,B]),T.useEffect(()=>{X.current&&b&&H(N)},[f,p,b]);const Q=[z,f,b];if(Q.t=z,Q.i18n=f,Q.ready=b,b||!b&&!g)return Q;throw new Promise(te=>{l.lng?Em(f,l.lng,m,()=>te()):Mo(f,m,()=>te())})};function Eg(i){var l,r,o="";if(typeof i=="string"||typeof i=="number")o+=i;else if(typeof i=="object")if(Array.isArray(i)){var c=i.length;for(l=0;l<c;l++)i[l]&&(r=Eg(i[l]))&&(o&&(o+=" "),o+=r)}else for(r in i)i[r]&&(o&&(o+=" "),o+=r);return o}function lb(){for(var i,l,r=0,o="",c=arguments.length;r<c;r++)(i=arguments[r])&&(l=Eg(i))&&(o&&(o+=" "),o+=l);return o}function He(...i){return lb(i)}function PS(i){return i?new Date(i).toLocaleString():"-"}let ii=typeof window<"u"&&window.desktop?"electron":"local_core";const $o=Zo(i=>({snapshot:null,setSnapshot:l=>i({snapshot:l})}));function dn(){return ii}function Eo(i){ii=i}function ib(){return ii==="electron"}function ub(){return!1}function To(i){$o.getState().setSnapshot(i)}function rb(){return $o.getState().snapshot}function sb(i){return!!(i!=null&&i.knowledge.some(l=>l.enabled!==!1))}function ob(i){return!!(i!=null&&i.schedulers.some(l=>l.enabled!==!1))}function cb(i,l){return!!(i!=null&&i.agents.some(r=>r.agentType===l))}function fb(i){return!!(i!=null&&i.agents.some(l=>l.agentType))}function db(i=rb()){const l=!!i,r=cb(i,"localcore-acp");return{desktopRuntime:l||ii==="electron"||ii==="local_core",desktopChat:r,chatRoute:l?r:!0,desktopWorkspace:l?fb(i):!0,knowledgeModule:l?sb(i):!0,schedulerModule:l?ob(i):!0}}function Jo(){const i=$o(l=>l.snapshot);return db(i)}function Tm(i){return i==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":i}function Rm(i){document.documentElement.classList.toggle("dark",i==="dark")}const Fo=Zo(i=>({theme:"dark",resolved:"dark",setTheme:l=>{const r=Tm(l);localStorage.setItem("cc_theme",l),Rm(r),i({theme:l,resolved:r})},init:()=>{const l=localStorage.getItem("cc_theme")||"dark",r=Tm(l);Rm(r),i({theme:l,resolved:r})}})),hb="modulepreload",mb=function(i,l){return new URL(i,l).href},_m={},Pe=function(l,r,o){let c=Promise.resolve();if(r&&r.length>0){let h=function(b){return Promise.all(b.map(v=>Promise.resolve(v).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};const g=document.getElementsByTagName("link"),p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=h(r.map(b=>{if(b=mb(b,o),b in _m)return;_m[b]=!0;const v=b.endsWith(".css"),N=v?'[rel="stylesheet"]':"";if(!!o)for(let H=g.length-1;H>=0;H--){const B=g[H];if(B.href===b&&(!v||B.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${N}`))return;const z=document.createElement("link");if(z.rel=v?"stylesheet":hb,v||(z.as="script"),z.crossOrigin="",z.href=b,m&&z.setAttribute("nonce",m),document.head.appendChild(z),v)return new Promise((H,B)=>{z.addEventListener("load",H),z.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${b}`)))})}))}function f(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return c.then(h=>{for(const g of h||[])g.status==="rejected"&&f(g.reason);return l().catch(f)})},gb=T.lazy(()=>Pe(()=>import("./Dashboard-CauX4_SR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),pb=T.lazy(()=>Pe(()=>import("./ThreadChat-JB9GY3La.js"),__vite__mapDeps([9,10,11,5,12,13,14,15,16,17,18,19,20,21,8]),import.meta.url)),yb=T.lazy(()=>Pe(()=>import("./Chat-CTy10fKR.js"),__vite__mapDeps([22,10,11,2,12,13,4,23,14,17,19,20,21]),import.meta.url)),vb=T.lazy(()=>Pe(()=>import("./Workspace-Cftl8zps.js"),__vite__mapDeps([24,10,11,25,13,2,3,5,15,20,26,27]),import.meta.url)),bb=T.lazy(()=>Pe(()=>import("./ProjectList-r9MXhUu7.js"),__vite__mapDeps([28,1,2,3,4,6,29]),import.meta.url)),Sb=T.lazy(()=>Pe(()=>import("./ProjectDetail-RuoRHs1Q.js"),__vite__mapDeps([30,1,10,11,2,3,4,31,29,32,26,13,20,33]),import.meta.url)),xb=T.lazy(()=>Pe(()=>import("./SessionList-C89Z6STB.js"),__vite__mapDeps([34,1,25,11,13,2,4,23,35,18,21]),import.meta.url)),Eb=T.lazy(()=>Pe(()=>import("./SessionChat-DwnZpTVu.js"),__vite__mapDeps([36,1,23,12,13,31,18,16,21]),import.meta.url)),Tb=T.lazy(()=>Pe(()=>import("./CronList-BQOEXhHD.js"),__vite__mapDeps([37,1,10,11,25,13,2,3,26,33,19,20]),import.meta.url)),Rb=T.lazy(()=>Pe(()=>import("./Config-Bl5vuqBS.js"),__vite__mapDeps([38,5,1,3,27,32]),import.meta.url)),_b=T.lazy(()=>Pe(()=>import("./Logs-BrtF26F7.js"),__vite__mapDeps([39,1,25,11,13,3,31,35]),import.meta.url)),Ob=T.lazy(()=>Pe(()=>import("./KnowledgeHome-vd6AO-Fn.js"),__vite__mapDeps([40,10,11,2,19,20,17,26,7]),import.meta.url)),Cb=T.lazy(()=>Pe(()=>import("./KnowledgeDetail-BlV8Twrx.js"),__vite__mapDeps([41,2,31,17,20]),import.meta.url));class Ab{constructor(){In(this,"routes",new Map);In(this,"navItems",new Map)}registerRoute(l){this.routes.set(l.id,l)}registerNavItem(l){this.navItems.set(l.id,l)}listRoutes(){return[...this.routes.values()].sort((l,r)=>l.order-r.order)}listNavItems(){return[...this.navItems.values()].sort((l,r)=>l.order-r.order)}}function Pl(i,l,r="/"){return i?l:_.jsx(Ya,{to:r,replace:!0})}function zb(){const{name:i}=cg();return Ct(r=>r.desktopManaged)?_.jsx(Ya,{to:i?`/workspace?project=${encodeURIComponent(i)}`:"/workspace",replace:!0}):_.jsx(Sb,{})}function Om(){const{project:i,id:l}=cg();if(!Ct(c=>c.desktopManaged))return l&&i?_.jsx(Eb,{}):_.jsx(xb,{});const o=new URLSearchParams;return i&&o.set("project",i),l&&o.set("session",l),_.jsx(Ya,{to:`/chat${o.toString()?`?${o.toString()}`:""}`,replace:!0})}function Nb(i){[{id:"dashboard",index:!0,titleKey:"nav.dashboard",order:10,element:()=>_.jsx(gb,{})},{id:"chat",path:"chat",titleKey:"nav.chat",order:20,element:({features:r})=>Pl(r.chatRoute,r.desktopChat?_.jsx(pb,{}):_.jsx(yb,{}))},{id:"workspace",path:"workspace",titleKey:"nav.workspace",order:30,element:({features:r})=>Pl(r.desktopWorkspace,_.jsx(vb,{}))},{id:"knowledge",path:"knowledge",titleKey:"nav.knowledge",order:40,element:({features:r})=>Pl(r.knowledgeModule,_.jsx(Ob,{}))},{id:"knowledge-detail",path:"knowledge/:knowledgebaseId",titleKey:"nav.knowledge",order:41,element:({features:r})=>Pl(r.knowledgeModule,_.jsx(Cb,{}))},{id:"projects",path:"projects",titleKey:"nav.projects",order:50,element:({desktopManaged:r,features:o})=>r&&o.desktopWorkspace?_.jsx(Ya,{to:"/workspace",replace:!0}):_.jsx(bb,{})},{id:"project-detail",path:"projects/:name",titleKey:"nav.projects",order:51,element:()=>_.jsx(zb,{})},{id:"sessions",path:"sessions",titleKey:"nav.sessions",order:60,element:()=>_.jsx(Om,{})},{id:"session-detail",path:"sessions/:project/:id",titleKey:"nav.sessions",order:61,element:()=>_.jsx(Om,{})},{id:"cron",path:"cron",titleKey:"nav.cron",order:70,element:({features:r})=>Pl(r.schedulerModule,_.jsx(Tb,{}))},{id:"system",path:"system",titleKey:"nav.system",order:80,element:()=>_.jsx(Rb,{})},{id:"system-logs",path:"system/logs",titleKey:"nav.system",order:81,element:()=>_.jsx(_b,{})}].forEach(r=>i.registerRoute(r))}function wb(i){[{id:"dashboard",path:"/",labelKey:"nav.dashboard",icon:z0,order:10,end:!0},{id:"chat",path:"/chat",labelKey:"nav.chat",icon:k0,order:20,visible:({features:r})=>r.chatRoute,resolveLabelKey:({features:r,runtimeProvider:o})=>r.desktopChat?o==="electron"?"nav.chatDesktop":"nav.chat":"nav.chatWeb"},{id:"workspace",path:"/workspace",labelKey:"nav.workspace",icon:Z0,order:30,visible:({features:r})=>r.desktopWorkspace},{id:"knowledge",path:"/knowledge",labelKey:"nav.knowledge",icon:w0,order:40,visible:({features:r})=>r.knowledgeModule},{id:"projects",path:"/projects",labelKey:"nav.projects",icon:_0,order:50,visible:({desktopManaged:r})=>!r},{id:"sessions",path:"/sessions",labelKey:"nav.sessions",icon:D0,order:60,visible:({desktopManaged:r})=>!r},{id:"cron",path:"/cron",labelKey:"nav.cron",icon:T0,order:70,visible:({features:r})=>r.schedulerModule},{id:"system",path:"/system",labelKey:"nav.system",icon:G0,order:80}].forEach(r=>i.registerNavItem(r))}const Qu=new Ab;Nb(Qu);wb(Qu);function Tg({className:i,markClassName:l,showWordmark:r=!1}){const o=T.useId(),c=`${o}-bg`,f=`${o}-stroke`;return _.jsxs("div",{className:He("inline-flex items-center gap-3",i),children:[_.jsxs("svg",{className:He("h-8 w-8 shrink-0",l),viewBox:"0 0 64 64",role:"img","aria-label":"AgentDock",fill:"none",children:[_.jsxs("defs",{children:[_.jsxs("linearGradient",{id:c,x1:"7",y1:"5",x2:"57",y2:"59",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{className:"[stop-color:#FFFFFF] dark:[stop-color:#3A3A3C]"}),_.jsx("stop",{offset:"0.52",className:"[stop-color:#F5F5F7] dark:[stop-color:#2C2C2E]"}),_.jsx("stop",{offset:"1",className:"[stop-color:#E5E5EA] dark:[stop-color:#1C1C1E]"})]}),_.jsxs("linearGradient",{id:f,x1:"18",y1:"16",x2:"47",y2:"48",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{stopColor:"#5AC8FA"}),_.jsx("stop",{offset:"0.44",stopColor:"#0A84FF"}),_.jsx("stop",{offset:"1",stopColor:"#007AFF"})]})]}),_.jsx("rect",{x:"4",y:"4",width:"56",height:"56",rx:"16",fill:`url(#${c})`,className:"stroke-black/10 dark:stroke-white/10",strokeWidth:"1.5"}),_.jsx("path",{d:"M14.5 45L25.3 20.1C26.1 18.1 28.9 18.1 29.8 20.1L40.8 45",stroke:`url(#${f})`,strokeWidth:"7.5",strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M20.8 37.5H34.7",className:"stroke-white dark:stroke-white",strokeWidth:"5.25",strokeLinecap:"round"}),_.jsx("path",{d:"M33.8 20.2H37.4C45.1 20.2 50 25.6 50 32.5C50 39.4 45.1 44.8 37.4 44.8H33.8",stroke:`url(#${f})`,strokeWidth:"7",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.82"}),_.jsx("path",{d:"M34 25.5V39.5",className:"stroke-black/70 dark:stroke-black/80",strokeWidth:"3",strokeLinecap:"round",opacity:"0.18"})]}),r&&_.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"AgentDock"})]})}var Ro={};const ae=i=>typeof i=="string",ei=()=>{let i,l;const r=new Promise((o,c)=>{i=o,l=c});return r.resolve=i,r.reject=l,r},Cm=i=>i==null?"":""+i,jb=(i,l,r)=>{i.forEach(o=>{l[o]&&(r[o]=l[o])})},Mb=/###/g,Am=i=>i&&i.indexOf("###")>-1?i.replace(Mb,"."):i,zm=i=>!i||ae(i),ti=(i,l,r)=>{const o=ae(l)?l.split("."):l;let c=0;for(;c<o.length-1;){if(zm(i))return{};const f=Am(o[c]);!i[f]&&r&&(i[f]=new r),Object.prototype.hasOwnProperty.call(i,f)?i=i[f]:i={},++c}return zm(i)?{}:{obj:i,k:Am(o[c])}},Nm=(i,l,r)=>{const{obj:o,k:c}=ti(i,l,Object);if(o!==void 0||l.length===1){o[c]=r;return}let f=l[l.length-1],h=l.slice(0,l.length-1),g=ti(i,h,Object);for(;g.obj===void 0&&h.length;)f=`${h[h.length-1]}.${f}`,h=h.slice(0,h.length-1),g=ti(i,h,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${f}`]<"u"&&(g.obj=void 0);g.obj[`${g.k}.${f}`]=r},Lb=(i,l,r,o)=>{const{obj:c,k:f}=ti(i,l,Object);c[f]=c[f]||[],c[f].push(r)},ku=(i,l)=>{const{obj:r,k:o}=ti(i,l);if(r&&Object.prototype.hasOwnProperty.call(r,o))return r[o]},Db=(i,l,r)=>{const o=ku(i,r);return o!==void 0?o:ku(l,r)},Rg=(i,l,r)=>{for(const o in l)o!=="__proto__"&&o!=="constructor"&&(o in i?ae(i[o])||i[o]instanceof String||ae(l[o])||l[o]instanceof String?r&&(i[o]=l[o]):Rg(i[o],l[o],r):i[o]=l[o]);return i},sn=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ub={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const kb=i=>ae(i)?i.replace(/[&<>"'\/]/g,l=>Ub[l]):i;class Hb{constructor(l){this.capacity=l,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(l){const r=this.regExpMap.get(l);if(r!==void 0)return r;const o=new RegExp(l);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(l,o),this.regExpQueue.push(l),o}}const Bb=[" ",",","?","!",";"],qb=new Hb(20),Yb=(i,l,r)=>{l=l||"",r=r||"";const o=Bb.filter(h=>l.indexOf(h)<0&&r.indexOf(h)<0);if(o.length===0)return!0;const c=qb.getRegExp(`(${o.map(h=>h==="?"?"\\?":h).join("|")})`);let f=!c.test(i);if(!f){const h=i.indexOf(r);h>0&&!c.test(i.substring(0,h))&&(f=!0)}return f},Do=(i,l,r=".")=>{if(!i)return;if(i[l])return Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;const o=l.split(r);let c=i;for(let f=0;f<o.length;){if(!c||typeof c!="object")return;let h,g="";for(let p=f;p<o.length;++p)if(p!==f&&(g+=r),g+=o[p],h=c[g],h!==void 0){if(["string","number","boolean"].indexOf(typeof h)>-1&&p<o.length-1)continue;f+=p-f+1;break}c=h}return c},ui=i=>i==null?void 0:i.replace(/_/g,"-"),Gb={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,l){var r,o;(o=(r=console==null?void 0:console[i])==null?void 0:r.apply)==null||o.call(r,console,l)}};class Hu{constructor(l,r={}){this.init(l,r)}init(l,r={}){this.prefix=r.prefix||"i18next:",this.logger=l||Gb,this.options=r,this.debug=r.debug}log(...l){return this.forward(l,"log","",!0)}warn(...l){return this.forward(l,"warn","",!0)}error(...l){return this.forward(l,"error","")}deprecate(...l){return this.forward(l,"warn","WARNING DEPRECATED: ",!0)}forward(l,r,o,c){return c&&!this.debug?null:(ae(l[0])&&(l[0]=`${o}${this.prefix} ${l[0]}`),this.logger[r](l))}create(l){return new Hu(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new Hu(this.logger,l)}}var Ft=new Hu;class Zu{constructor(){this.observers={}}on(l,r){return l.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(r)||0;this.observers[o].set(r,c+1)}),this}off(l,r){if(this.observers[l]){if(!r){delete this.observers[l];return}this.observers[l].delete(r)}}emit(l,...r){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c.apply(c,[l,...r])})}}class wm extends Zu{constructor(l,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=l||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(l){this.options.ns.indexOf(l)<0&&this.options.ns.push(l)}removeNamespaces(l){const r=this.options.ns.indexOf(l);r>-1&&this.options.ns.splice(r,1)}getResource(l,r,o,c={}){var m,b;const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,h=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;l.indexOf(".")>-1?g=l.split("."):(g=[l,r],o&&(Array.isArray(o)?g.push(...o):ae(o)&&f?g.push(...o.split(f)):g.push(o)));const p=ku(this.data,g);return!p&&!r&&!o&&l.indexOf(".")>-1&&(l=g[0],r=g[1],o=g.slice(2).join(".")),p||!h||!ae(o)?p:Do((b=(m=this.data)==null?void 0:m[l])==null?void 0:b[r],o,f)}addResource(l,r,o,c,f={silent:!1}){const h=f.keySeparator!==void 0?f.keySeparator:this.options.keySeparator;let g=[l,r];o&&(g=g.concat(h?o.split(h):o)),l.indexOf(".")>-1&&(g=l.split("."),c=r,r=g[1]),this.addNamespaces(r),Nm(this.data,g,c),f.silent||this.emit("added",l,r,o,c)}addResources(l,r,o,c={silent:!1}){for(const f in o)(ae(o[f])||Array.isArray(o[f]))&&this.addResource(l,r,f,o[f],{silent:!0});c.silent||this.emit("added",l,r,o)}addResourceBundle(l,r,o,c,f,h={silent:!1,skipCopy:!1}){let g=[l,r];l.indexOf(".")>-1&&(g=l.split("."),c=o,o=r,r=g[1]),this.addNamespaces(r);let p=ku(this.data,g)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?Rg(p,o,f):p={...p,...o},Nm(this.data,g,p),h.silent||this.emit("added",l,r,o)}removeResourceBundle(l,r){this.hasResourceBundle(l,r)&&delete this.data[l][r],this.removeNamespaces(r),this.emit("removed",l,r)}hasResourceBundle(l,r){return this.getResource(l,r)!==void 0}getResourceBundle(l,r){return r||(r=this.options.defaultNS),this.getResource(l,r)}getDataByLanguage(l){return this.data[l]}hasLanguageSomeTranslations(l){const r=this.getDataByLanguage(l);return!!(r&&Object.keys(r)||[]).find(c=>r[c]&&Object.keys(r[c]).length>0)}toJSON(){return this.data}}var _g={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,l,r,o,c){return i.forEach(f=>{var h;l=((h=this.processors[f])==null?void 0:h.process(l,r,o,c))??l}),l}};const Og=Symbol("i18next/PATH_KEY");function Vb(){const i=[],l=Object.create(null);let r;return l.get=(o,c)=>{var f;return(f=r==null?void 0:r.revoke)==null||f.call(r),c===Og?i:(i.push(c),r=Proxy.revocable(o,l),r.proxy)},Proxy.revocable(Object.create(null),l).proxy}function el(i,l){const{[Og]:r}=i(Vb()),o=(l==null?void 0:l.keySeparator)??".",c=(l==null?void 0:l.nsSeparator)??":";if(r.length>1&&c){const f=l==null?void 0:l.ns,h=Array.isArray(f)?f:null;if(h&&h.length>1&&h.slice(1).includes(r[0]))return`${r[0]}${c}${r.slice(1).join(o)}`}return r.join(o)}const jm={},_o=i=>!ae(i)&&typeof i!="boolean"&&typeof i!="number";class Bu extends Zu{constructor(l,r={}){super(),jb(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],l,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ft.create("translator")}changeLanguage(l){l&&(this.language=l)}exists(l,r={interpolation:{}}){const o={...r};if(l==null)return!1;const c=this.resolve(l,o);if((c==null?void 0:c.res)===void 0)return!1;const f=_o(c.res);return!(o.returnObjects===!1&&f)}extractFromKey(l,r){let o=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let f=r.ns||this.options.defaultNS||[];const h=o&&l.indexOf(o)>-1,g=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Yb(l,o,c);if(h&&!g){const p=l.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:l,namespaces:ae(f)?[f]:f};const m=l.split(o);(o!==c||o===c&&this.options.ns.indexOf(m[0])>-1)&&(f=m.shift()),l=m.join(c)}return{key:l,namespaces:ae(f)?[f]:f}}translate(l,r,o){let c=typeof r=="object"?{...r}:r;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),l==null)return"";typeof l=="function"&&(l=el(l,{...this.options,...c})),Array.isArray(l)||(l=[String(l)]),l=l.map(ze=>typeof ze=="function"?el(ze,{...this.options,...c}):String(ze));const f=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,h=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:g,namespaces:p}=this.extractFromKey(l[l.length-1],c),m=p[p.length-1];let b=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;b===void 0&&(b=":");const v=c.lng||this.language,N=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((v==null?void 0:v.toLowerCase())==="cimode")return N?f?{res:`${m}${b}${g}`,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:`${m}${b}${g}`:f?{res:g,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:g;const L=this.resolve(l,c);let z=L==null?void 0:L.res;const H=(L==null?void 0:L.usedKey)||g,B=(L==null?void 0:L.exactUsedKey)||g,q=["[object Number]","[object Function]","[object RegExp]"],X=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,Q=!this.i18nFormat||this.i18nFormat.handleAsObject,J=c.count!==void 0&&!ae(c.count),V=Bu.hasDefaultValue(c),ue=J?this.pluralResolver.getSuffix(v,c.count,c):"",K=c.ordinal&&J?this.pluralResolver.getSuffix(v,c.count,{ordinal:!1}):"",te=J&&!c.ordinal&&c.count===0,le=te&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${ue}`]||c[`defaultValue${K}`]||c.defaultValue;let se=z;Q&&!z&&V&&(se=le);const Ae=_o(se),Fe=Object.prototype.toString.apply(se);if(Q&&se&&Ae&&q.indexOf(Fe)<0&&!(ae(X)&&Array.isArray(se))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ze=this.options.returnedObjectHandler?this.options.returnedObjectHandler(H,se,{...c,ns:p}):`key '${g} (${this.language})' returned an object instead of string.`;return f?(L.res=ze,L.usedParams=this.getUsedParamsDetails(c),L):ze}if(h){const ze=Array.isArray(se),je=ze?[]:{},De=ze?B:H;for(const j in se)if(Object.prototype.hasOwnProperty.call(se,j)){const Y=`${De}${h}${j}`;V&&!z?je[j]=this.translate(Y,{...c,defaultValue:_o(le)?le[j]:void 0,joinArrays:!1,ns:p}):je[j]=this.translate(Y,{...c,joinArrays:!1,ns:p}),je[j]===Y&&(je[j]=se[j])}z=je}}else if(Q&&ae(X)&&Array.isArray(z))z=z.join(X),z&&(z=this.extendTranslation(z,l,c,o));else{let ze=!1,je=!1;!this.isValidLookup(z)&&V&&(ze=!0,z=le),this.isValidLookup(z)||(je=!0,z=g);const j=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&je?void 0:z,Y=V&&le!==z&&this.options.updateMissing;if(je||ze||Y){if(this.logger.log(Y?"updateKey":"missingKey",v,m,g,Y?le:z),h){const x=this.resolve(g,{...c,keySeparator:!1});x&&x.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let P=[];const pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(let x=0;x<pe.length;x++)P.push(pe[x]);else this.options.saveMissingTo==="all"?P=this.languageUtils.toResolveHierarchy(c.lng||this.language):P.push(c.lng||this.language);const Se=(x,D,G)=>{var ne;const Z=V&&G!==z?G:j;this.options.missingKeyHandler?this.options.missingKeyHandler(x,m,D,Z,Y,c):(ne=this.backendConnector)!=null&&ne.saveMissing&&this.backendConnector.saveMissing(x,m,D,Z,Y,c),this.emit("missingKey",x,m,D,z)};this.options.saveMissing&&(this.options.saveMissingPlurals&&J?P.forEach(x=>{const D=this.pluralResolver.getSuffixes(x,c);te&&c[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(G=>{Se([x],g+G,c[`defaultValue${G}`]||le)})}):Se(P,g,le))}z=this.extendTranslation(z,l,c,L,o),je&&z===g&&this.options.appendNamespaceToMissingKey&&(z=`${m}${b}${g}`),(je||ze)&&this.options.parseMissingKeyHandler&&(z=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}${b}${g}`:g,ze?z:void 0,c))}return f?(L.res=z,L.usedParams=this.getUsedParamsDetails(c),L):z}extendTranslation(l,r,o,c,f){var p,m;if((p=this.i18nFormat)!=null&&p.parse)l=this.i18nFormat.parse(l,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const b=ae(l)&&(((m=o==null?void 0:o.interpolation)==null?void 0:m.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let v;if(b){const L=l.match(this.interpolator.nestingRegexp);v=L&&L.length}let N=o.replace&&!ae(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(N={...this.options.interpolation.defaultVariables,...N}),l=this.interpolator.interpolate(l,N,o.lng||this.language||c.usedLng,o),b){const L=l.match(this.interpolator.nestingRegexp),z=L&&L.length;v<z&&(o.nest=!1)}!o.lng&&c&&c.res&&(o.lng=this.language||c.usedLng),o.nest!==!1&&(l=this.interpolator.nest(l,(...L)=>(f==null?void 0:f[0])===L[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${L[0]} in key: ${r[0]}`),null):this.translate(...L,r),o)),o.interpolation&&this.interpolator.reset()}const h=o.postProcess||this.options.postProcess,g=ae(h)?[h]:h;return l!=null&&(g!=null&&g.length)&&o.applyPostProcessor!==!1&&(l=_g.handle(g,l,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),l}resolve(l,r={}){let o,c,f,h,g;return ae(l)&&(l=[l]),Array.isArray(l)&&(l=l.map(p=>typeof p=="function"?el(p,{...this.options,...r}):p)),l.forEach(p=>{if(this.isValidLookup(o))return;const m=this.extractFromKey(p,r),b=m.key;c=b;let v=m.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const N=r.count!==void 0&&!ae(r.count),L=N&&!r.ordinal&&r.count===0,z=r.context!==void 0&&(ae(r.context)||typeof r.context=="number")&&r.context!=="",H=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);v.forEach(B=>{var q,X;this.isValidLookup(o)||(g=B,!jm[`${H[0]}-${B}`]&&((q=this.utils)!=null&&q.hasLoadedNamespace)&&!((X=this.utils)!=null&&X.hasLoadedNamespace(g))&&(jm[`${H[0]}-${B}`]=!0,this.logger.warn(`key "${c}" for languages "${H.join(", ")}" won't get resolved as namespace "${g}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),H.forEach(Q=>{var ue;if(this.isValidLookup(o))return;h=Q;const J=[b];if((ue=this.i18nFormat)!=null&&ue.addLookupKeys)this.i18nFormat.addLookupKeys(J,b,Q,B,r);else{let K;N&&(K=this.pluralResolver.getSuffix(Q,r.count,r));const te=`${this.options.pluralSeparator}zero`,le=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(N&&(r.ordinal&&K.indexOf(le)===0&&J.push(b+K.replace(le,this.options.pluralSeparator)),J.push(b+K),L&&J.push(b+te)),z){const se=`${b}${this.options.contextSeparator||"_"}${r.context}`;J.push(se),N&&(r.ordinal&&K.indexOf(le)===0&&J.push(se+K.replace(le,this.options.pluralSeparator)),J.push(se+K),L&&J.push(se+te))}}let V;for(;V=J.pop();)this.isValidLookup(o)||(f=V,o=this.getResource(Q,B,V,r))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:g}}isValidLookup(l){return l!==void 0&&!(!this.options.returnNull&&l===null)&&!(!this.options.returnEmptyString&&l==="")}getResource(l,r,o,c={}){var f;return(f=this.i18nFormat)!=null&&f.getResource?this.i18nFormat.getResource(l,r,o,c):this.resourceStore.getResource(l,r,o,c)}getUsedParamsDetails(l={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=l.replace&&!ae(l.replace);let c=o?l.replace:l;if(o&&typeof l.count<"u"&&(c.count=l.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const f of r)delete c[f]}return c}static hasDefaultValue(l){const r="defaultValue";for(const o in l)if(Object.prototype.hasOwnProperty.call(l,o)&&r===o.substring(0,r.length)&&l[o]!==void 0)return!0;return!1}}class Mm{constructor(l){this.options=l,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ft.create("languageUtils")}getScriptPartFromCode(l){if(l=ui(l),!l||l.indexOf("-")<0)return null;const r=l.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(l){if(l=ui(l),!l||l.indexOf("-")<0)return l;const r=l.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(l){if(ae(l)&&l.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(l)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?l.toLowerCase():l)}return this.options.cleanCode||this.options.lowerCaseLng?l.toLowerCase():l}isSupportedCode(l){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(l=this.getLanguagePartFromCode(l)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(l)>-1}getBestMatchFromCodes(l){if(!l)return null;let r;return l.forEach(o=>{if(r)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(r=c)}),!r&&this.options.supportedLngs&&l.forEach(o=>{if(r)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return r=c;const f=this.getLanguagePartFromCode(o);if(this.isSupportedCode(f))return r=f;r=this.options.supportedLngs.find(h=>{if(h===f)return h;if(!(h.indexOf("-")<0&&f.indexOf("-")<0)&&(h.indexOf("-")>0&&f.indexOf("-")<0&&h.substring(0,h.indexOf("-"))===f||h.indexOf(f)===0&&f.length>1))return h})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(l,r){if(!l)return[];if(typeof l=="function"&&(l=l(r)),ae(l)&&(l=[l]),Array.isArray(l))return l;if(!r)return l.default||[];let o=l[r];return o||(o=l[this.getScriptPartFromCode(r)]),o||(o=l[this.formatLanguageCode(r)]),o||(o=l[this.getLanguagePartFromCode(r)]),o||(o=l.default),o||[]}toResolveHierarchy(l,r){const o=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],l),c=[],f=h=>{h&&(this.isSupportedCode(h)?c.push(h):this.logger.warn(`rejecting language code not found in supportedLngs: ${h}`))};return ae(l)&&(l.indexOf("-")>-1||l.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&f(this.formatLanguageCode(l)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&f(this.getScriptPartFromCode(l)),this.options.load!=="currentOnly"&&f(this.getLanguagePartFromCode(l))):ae(l)&&f(this.formatLanguageCode(l)),o.forEach(h=>{c.indexOf(h)<0&&f(this.formatLanguageCode(h))}),c}}const Lm={zero:0,one:1,two:2,few:3,many:4,other:5},Dm={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Kb{constructor(l,r={}){this.languageUtils=l,this.options=r,this.logger=Ft.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(l,r={}){const o=ui(l==="dev"?"en":l),c=r.ordinal?"ordinal":"cardinal",f=JSON.stringify({cleanedCode:o,type:c});if(f in this.pluralRulesCache)return this.pluralRulesCache[f];let h;try{h=new Intl.PluralRules(o,{type:c})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Dm;if(!l.match(/-|_/))return Dm;const p=this.languageUtils.getLanguagePartFromCode(l);h=this.getRule(p,r)}return this.pluralRulesCache[f]=h,h}needsPlural(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),(o==null?void 0:o.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(l,r,o={}){return this.getSuffixes(l,o).map(c=>`${r}${c}`)}getSuffixes(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),o?o.resolvedOptions().pluralCategories.sort((c,f)=>Lm[c]-Lm[f]).map(c=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(l,r,o={}){const c=this.getRule(l,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(r)}`:(this.logger.warn(`no plural rule found for: ${l}`),this.getSuffix("dev",r,o))}}const Um=(i,l,r,o=".",c=!0)=>{let f=Db(i,l,r);return!f&&c&&ae(r)&&(f=Do(i,r,o),f===void 0&&(f=Do(l,r,o))),f},Oo=i=>i.replace(/\$/g,"$$$$");class km{constructor(l={}){var r;this.logger=Ft.create("interpolator"),this.options=l,this.format=((r=l==null?void 0:l.interpolation)==null?void 0:r.format)||(o=>o),this.init(l)}init(l={}){l.interpolation||(l.interpolation={escapeValue:!0});const{escape:r,escapeValue:o,useRawValueToEscape:c,prefix:f,prefixEscaped:h,suffix:g,suffixEscaped:p,formatSeparator:m,unescapeSuffix:b,unescapePrefix:v,nestingPrefix:N,nestingPrefixEscaped:L,nestingSuffix:z,nestingSuffixEscaped:H,nestingOptionsSeparator:B,maxReplaces:q,alwaysFormat:X}=l.interpolation;this.escape=r!==void 0?r:kb,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=f?sn(f):h||"{{",this.suffix=g?sn(g):p||"}}",this.formatSeparator=m||",",this.unescapePrefix=b?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=N?sn(N):L||sn("$t("),this.nestingSuffix=z?sn(z):H||sn(")"),this.nestingOptionsSeparator=B||",",this.maxReplaces=q||1e3,this.alwaysFormat=X!==void 0?X:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const l=(r,o)=>(r==null?void 0:r.source)===o?(r.lastIndex=0,r):new RegExp(o,"g");this.regexp=l(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=l(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=l(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(l,r,o,c){var L;let f,h,g;const p=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=z=>{if(z.indexOf(this.formatSeparator)<0){const X=Um(r,p,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(X,void 0,o,{...c,...r,interpolationkey:z}):X}const H=z.split(this.formatSeparator),B=H.shift().trim(),q=H.join(this.formatSeparator).trim();return this.format(Um(r,p,B,this.options.keySeparator,this.options.ignoreJSONStructure),q,o,{...c,...r,interpolationkey:B})};this.resetRegExp();const b=(c==null?void 0:c.missingInterpolationHandler)||this.options.missingInterpolationHandler,v=((L=c==null?void 0:c.interpolation)==null?void 0:L.skipOnVariables)!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:z=>Oo(z)},{regex:this.regexp,safeValue:z=>this.escapeValue?Oo(this.escape(z)):Oo(z)}].forEach(z=>{for(g=0;f=z.regex.exec(l);){const H=f[1].trim();if(h=m(H),h===void 0)if(typeof b=="function"){const q=b(l,f,c);h=ae(q)?q:""}else if(c&&Object.prototype.hasOwnProperty.call(c,H))h="";else if(v){h=f[0];continue}else this.logger.warn(`missed to pass in variable ${H} for interpolating ${l}`),h="";else!ae(h)&&!this.useRawValueToEscape&&(h=Cm(h));const B=z.safeValue(h);if(l=l.replace(f[0],B),v?(z.regex.lastIndex+=h.length,z.regex.lastIndex-=f[0].length):z.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),l}nest(l,r,o={}){let c,f,h;const g=(p,m)=>{const b=this.nestingOptionsSeparator;if(p.indexOf(b)<0)return p;const v=p.split(new RegExp(`${sn(b)}[ ]*{`));let N=`{${v[1]}`;p=v[0],N=this.interpolate(N,h);const L=N.match(/'/g),z=N.match(/"/g);(((L==null?void 0:L.length)??0)%2===0&&!z||((z==null?void 0:z.length)??0)%2!==0)&&(N=N.replace(/'/g,'"'));try{h=JSON.parse(N),m&&(h={...m,...h})}catch(H){return this.logger.warn(`failed parsing options string in nesting for key ${p}`,H),`${p}${b}${N}`}return h.defaultValue&&h.defaultValue.indexOf(this.prefix)>-1&&delete h.defaultValue,p};for(;c=this.nestingRegexp.exec(l);){let p=[];h={...o},h=h.replace&&!ae(h.replace)?h.replace:h,h.applyPostProcessor=!1,delete h.defaultValue;const m=/{.*}/.test(c[1])?c[1].lastIndexOf("}")+1:c[1].indexOf(this.formatSeparator);if(m!==-1&&(p=c[1].slice(m).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,m)),f=r(g.call(this,c[1].trim(),h),h),f&&c[0]===l&&!ae(f))return f;ae(f)||(f=Cm(f)),f||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${l}`),f=""),p.length&&(f=p.reduce((b,v)=>this.format(b,v,o.lng,{...o,interpolationkey:c[1].trim()}),f.trim())),l=l.replace(c[0],f),this.regexp.lastIndex=0}return l}}const Xb=i=>{let l=i.toLowerCase().trim();const r={};if(i.indexOf("(")>-1){const o=i.split("(");l=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);l==="currency"&&c.indexOf(":")<0?r.currency||(r.currency=c.trim()):l==="relativetime"&&c.indexOf(":")<0?r.range||(r.range=c.trim()):c.split(";").forEach(h=>{if(h){const[g,...p]=h.split(":"),m=p.join(":").trim().replace(/^'+|'+$/g,""),b=g.trim();r[b]||(r[b]=m),m==="false"&&(r[b]=!1),m==="true"&&(r[b]=!0),isNaN(m)||(r[b]=parseInt(m,10))}})}return{formatName:l,formatOptions:r}},Hm=i=>{const l={};return(r,o,c)=>{let f=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(f={...f,[c.interpolationkey]:void 0});const h=o+JSON.stringify(f);let g=l[h];return g||(g=i(ui(o),c),l[h]=g),g(r)}},Qb=i=>(l,r,o)=>i(ui(r),o)(l);class Zb{constructor(l={}){this.logger=Ft.create("formatter"),this.options=l,this.init(l)}init(l,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const o=r.cacheInBuiltFormats?Hm:Qb;this.formats={number:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f});return g=>h.format(g)}),currency:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f,style:"currency"});return g=>h.format(g)}),datetime:o((c,f)=>{const h=new Intl.DateTimeFormat(c,{...f});return g=>h.format(g)}),relativetime:o((c,f)=>{const h=new Intl.RelativeTimeFormat(c,{...f});return g=>h.format(g,f.range||"day")}),list:o((c,f)=>{const h=new Intl.ListFormat(c,{...f});return g=>h.format(g)})}}add(l,r){this.formats[l.toLowerCase().trim()]=r}addCached(l,r){this.formats[l.toLowerCase().trim()]=Hm(r)}format(l,r,o,c={}){const f=r.split(this.formatSeparator);if(f.length>1&&f[0].indexOf("(")>1&&f[0].indexOf(")")<0&&f.find(g=>g.indexOf(")")>-1)){const g=f.findIndex(p=>p.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,g)].join(this.formatSeparator)}return f.reduce((g,p)=>{var v;const{formatName:m,formatOptions:b}=Xb(p);if(this.formats[m]){let N=g;try{const L=((v=c==null?void 0:c.formatParams)==null?void 0:v[c.interpolationkey])||{},z=L.locale||L.lng||c.locale||c.lng||o;N=this.formats[m](g,z,{...b,...c,...L})}catch(L){this.logger.warn(L)}return N}else this.logger.warn(`there was no format function for ${m}`);return g},l)}}const $b=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class Jb extends Zu{constructor(l,r,o,c={}){var f,h;super(),this.backend=l,this.store=r,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=Ft.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],(h=(f=this.backend)==null?void 0:f.init)==null||h.call(f,o,c.backend,c)}queueLoad(l,r,o,c){const f={},h={},g={},p={};return l.forEach(m=>{let b=!0;r.forEach(v=>{const N=`${m}|${v}`;!o.reload&&this.store.hasResourceBundle(m,v)?this.state[N]=2:this.state[N]<0||(this.state[N]===1?h[N]===void 0&&(h[N]=!0):(this.state[N]=1,b=!1,h[N]===void 0&&(h[N]=!0),f[N]===void 0&&(f[N]=!0),p[v]===void 0&&(p[v]=!0)))}),b||(g[m]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(p)}}loaded(l,r,o){const c=l.split("|"),f=c[0],h=c[1];r&&this.emit("failedLoading",f,h,r),!r&&o&&this.store.addResourceBundle(f,h,o,void 0,void 0,{skipCopy:!0}),this.state[l]=r?-1:2,r&&o&&(this.state[l]=0);const g={};this.queue.forEach(p=>{Lb(p.loaded,[f],h),$b(p,l),r&&p.errors.push(r),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(m=>{g[m]||(g[m]={});const b=p.loaded[m];b.length&&b.forEach(v=>{g[m][v]===void 0&&(g[m][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(p=>!p.done)}read(l,r,o,c=0,f=this.retryTimeout,h){if(!l.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:l,ns:r,fcName:o,tried:c,wait:f,callback:h});return}this.readingCalls++;const g=(m,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(m&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,l,r,o,c+1,f*2,h)},f);return}h(m,b)},p=this.backend[o].bind(this.backend);if(p.length===2){try{const m=p(l,r);m&&typeof m.then=="function"?m.then(b=>g(null,b)).catch(g):g(null,m)}catch(m){g(m)}return}return p(l,r,g)}prepareLoading(l,r,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();ae(l)&&(l=this.languageUtils.toResolveHierarchy(l)),ae(r)&&(r=[r]);const f=this.queueLoad(l,r,o,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(h=>{this.loadOne(h)})}load(l,r,o){this.prepareLoading(l,r,{},o)}reload(l,r,o){this.prepareLoading(l,r,{reload:!0},o)}loadOne(l,r=""){const o=l.split("|"),c=o[0],f=o[1];this.read(c,f,"read",void 0,void 0,(h,g)=>{h&&this.logger.warn(`${r}loading namespace ${f} for language ${c} failed`,h),!h&&g&&this.logger.log(`${r}loaded namespace ${f} for language ${c}`,g),this.loaded(l,h,g)})}saveMissing(l,r,o,c,f,h={},g=()=>{}){var p,m,b,v,N;if((m=(p=this.services)==null?void 0:p.utils)!=null&&m.hasLoadedNamespace&&!((v=(b=this.services)==null?void 0:b.utils)!=null&&v.hasLoadedNamespace(r))){this.logger.warn(`did not save key "${o}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if((N=this.backend)!=null&&N.create){const L={...h,isUpdate:f},z=this.backend.create.bind(this.backend);if(z.length<6)try{let H;z.length===5?H=z(l,r,o,c,L):H=z(l,r,o,c),H&&typeof H.then=="function"?H.then(B=>g(null,B)).catch(g):g(null,H)}catch(H){g(H)}else z(l,r,o,c,g,L)}!l||!l[0]||this.store.addResource(l[0],r,o,c)}}}const Co=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let l={};if(typeof i[1]=="object"&&(l=i[1]),ae(i[1])&&(l.defaultValue=i[1]),ae(i[2])&&(l.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const r=i[3]||i[2];Object.keys(r).forEach(o=>{l[o]=r[o]})}return l},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Bm=i=>{var l,r;return ae(i.ns)&&(i.ns=[i.ns]),ae(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),ae(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),((r=(l=i.supportedLngs)==null?void 0:l.indexOf)==null?void 0:r.call(l,"cimode"))<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i},wu=()=>{},Fb=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})},Cg="__i18next_supportNoticeShown",Wb=()=>!!(typeof globalThis<"u"&&globalThis[Cg]||typeof process<"u"&&Ro&&Ro.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&Ro),Ib=()=>{typeof globalThis<"u"&&(globalThis[Cg]=!0)},Pb=i=>{var l,r,o,c,f,h,g,p,m,b,v,N,L;return!!(((o=(r=(l=i==null?void 0:i.modules)==null?void 0:l.backend)==null?void 0:r.name)==null?void 0:o.indexOf("Locize"))>0||((g=(h=(f=(c=i==null?void 0:i.modules)==null?void 0:c.backend)==null?void 0:f.constructor)==null?void 0:h.name)==null?void 0:g.indexOf("Locize"))>0||(m=(p=i==null?void 0:i.options)==null?void 0:p.backend)!=null&&m.backends&&i.options.backend.backends.some(z=>{var H,B,q;return((H=z==null?void 0:z.name)==null?void 0:H.indexOf("Locize"))>0||((q=(B=z==null?void 0:z.constructor)==null?void 0:B.name)==null?void 0:q.indexOf("Locize"))>0})||(v=(b=i==null?void 0:i.options)==null?void 0:b.backend)!=null&&v.projectId||(L=(N=i==null?void 0:i.options)==null?void 0:N.backend)!=null&&L.backendOptions&&i.options.backend.backendOptions.some(z=>z==null?void 0:z.projectId))};class ai extends Zu{constructor(l={},r){if(super(),this.options=Bm(l),this.services={},this.logger=Ft,this.modules={external:[]},Fb(this),r&&!this.isInitialized&&!l.isClone){if(!this.options.initAsync)return this.init(l,r),this;setTimeout(()=>{this.init(l,r)},0)}}init(l={},r){this.isInitializing=!0,typeof l=="function"&&(r=l,l={}),l.defaultNS==null&&l.ns&&(ae(l.ns)?l.defaultNS=l.ns:l.ns.indexOf("translation")<0&&(l.defaultNS=l.ns[0]));const o=Co();this.options={...o,...this.options,...Bm(l)},this.options.interpolation={...o.interpolation,...this.options.interpolation},l.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=l.keySeparator),l.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=l.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Pb(this)&&!Wb()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),Ib());const c=m=>m?typeof m=="function"?new m:m:null;if(!this.options.isClone){this.modules.logger?Ft.init(c(this.modules.logger),this.options):Ft.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:m=Zb;const b=new Mm(this.options);this.store=new wm(this.options.resources,this.options);const v=this.services;v.logger=Ft,v.resourceStore=this.store,v.languageUtils=b,v.pluralResolver=new Kb(b,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),m&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(v.formatter=c(m),v.formatter.init&&v.formatter.init(v,this.options),this.options.interpolation.format=v.formatter.format.bind(v.formatter)),v.interpolator=new km(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new Jb(c(this.modules.backend),v.resourceStore,v,this.options),v.backendConnector.on("*",(L,...z)=>{this.emit(L,...z)}),this.modules.languageDetector&&(v.languageDetector=c(this.modules.languageDetector),v.languageDetector.init&&v.languageDetector.init(v,this.options.detection,this.options)),this.modules.i18nFormat&&(v.i18nFormat=c(this.modules.i18nFormat),v.i18nFormat.init&&v.i18nFormat.init(this)),this.translator=new Bu(this.services,this.options),this.translator.on("*",(L,...z)=>{this.emit(L,...z)}),this.modules.external.forEach(L=>{L.init&&L.init(this)})}if(this.format=this.options.interpolation.format,r||(r=wu),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const m=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);m.length>0&&m[0]!=="dev"&&(this.options.lng=m[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(m=>{this[m]=(...b)=>this.store[m](...b)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(m=>{this[m]=(...b)=>(this.store[m](...b),this)});const g=ei(),p=()=>{const m=(b,v)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(v),r(b,v)};if(this.languages&&!this.isInitialized)return m(null,this.t.bind(this));this.changeLanguage(this.options.lng,m)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),g}loadResources(l,r=wu){var f,h;let o=r;const c=ae(l)?l:this.language;if(typeof l=="function"&&(o=l),!this.options.resources||this.options.partialBundledLanguages){if((c==null?void 0:c.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const g=[],p=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(v=>{v!=="cimode"&&g.indexOf(v)<0&&g.push(v)})};c?p(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>p(b)),(h=(f=this.options.preload)==null?void 0:f.forEach)==null||h.call(f,m=>p(m)),this.services.backendConnector.load(g,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(m)})}else o(null)}reloadResources(l,r,o){const c=ei();return typeof l=="function"&&(o=l,l=void 0),typeof r=="function"&&(o=r,r=void 0),l||(l=this.languages),r||(r=this.options.ns),o||(o=wu),this.services.backendConnector.reload(l,r,f=>{c.resolve(),o(f)}),c}use(l){if(!l)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!l.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return l.type==="backend"&&(this.modules.backend=l),(l.type==="logger"||l.log&&l.warn&&l.error)&&(this.modules.logger=l),l.type==="languageDetector"&&(this.modules.languageDetector=l),l.type==="i18nFormat"&&(this.modules.i18nFormat=l),l.type==="postProcessor"&&_g.addPostProcessor(l),l.type==="formatter"&&(this.modules.formatter=l),l.type==="3rdParty"&&this.modules.external.push(l),this}setResolvedLanguage(l){if(!(!l||!this.languages)&&!(["cimode","dev"].indexOf(l)>-1)){for(let r=0;r<this.languages.length;r++){const o=this.languages[r];if(!(["cimode","dev"].indexOf(o)>-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(l)<0&&this.store.hasLanguageSomeTranslations(l)&&(this.resolvedLanguage=l,this.languages.unshift(l))}}changeLanguage(l,r){this.isLanguageChangingTo=l;const o=ei();this.emit("languageChanging",l);const c=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},f=(g,p)=>{p?this.isLanguageChangingTo===l&&(c(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,o.resolve((...m)=>this.t(...m)),r&&r(g,(...m)=>this.t(...m))},h=g=>{var b,v;!l&&!g&&this.services.languageDetector&&(g=[]);const p=ae(g)?g:g&&g[0],m=this.store.hasLanguageSomeTranslations(p)?p:this.services.languageUtils.getBestMatchFromCodes(ae(g)?[g]:g);m&&(this.language||c(m),this.translator.language||this.translator.changeLanguage(m),(v=(b=this.services.languageDetector)==null?void 0:b.cacheUserLanguage)==null||v.call(b,m)),this.loadResources(m,N=>{f(N,m)})};return!l&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!l&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(l),o}getFixedT(l,r,o){const c=(f,h,...g)=>{let p;typeof h!="object"?p=this.options.overloadTranslationOptionHandler([f,h].concat(g)):p={...h},p.lng=p.lng||c.lng,p.lngs=p.lngs||c.lngs,p.ns=p.ns||c.ns,p.keyPrefix!==""&&(p.keyPrefix=p.keyPrefix||o||c.keyPrefix);const m={...this.options,...p};typeof p.keyPrefix=="function"&&(p.keyPrefix=el(p.keyPrefix,m));const b=this.options.keySeparator||".";let v;return p.keyPrefix&&Array.isArray(f)?v=f.map(N=>(typeof N=="function"&&(N=el(N,m)),`${p.keyPrefix}${b}${N}`)):(typeof f=="function"&&(f=el(f,m)),v=p.keyPrefix?`${p.keyPrefix}${b}${f}`:f),this.t(v,p)};return ae(l)?c.lng=l:c.lngs=l,c.ns=r,c.keyPrefix=o,c}t(...l){var r;return(r=this.translator)==null?void 0:r.translate(...l)}exists(...l){var r;return(r=this.translator)==null?void 0:r.exists(...l)}setDefaultNamespace(l){this.options.defaultNS=l}hasLoadedNamespace(l,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=r.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const h=(g,p)=>{const m=this.services.backendConnector.state[`${g}|${p}`];return m===-1||m===0||m===2};if(r.precheck){const g=r.precheck(this,h);if(g!==void 0)return g}return!!(this.hasResourceBundle(o,l)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(o,l)&&(!c||h(f,l)))}loadNamespaces(l,r){const o=ei();return this.options.ns?(ae(l)&&(l=[l]),l.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),r&&r(c)}),o):(r&&r(),Promise.resolve())}loadLanguages(l,r){const o=ei();ae(l)&&(l=[l]);const c=this.options.preload||[],f=l.filter(h=>c.indexOf(h)<0&&this.services.languageUtils.isSupportedCode(h));return f.length?(this.options.preload=c.concat(f),this.loadResources(h=>{o.resolve(),r&&r(h)}),o):(r&&r(),Promise.resolve())}dir(l){var c,f;if(l||(l=this.resolvedLanguage||(((c=this.languages)==null?void 0:c.length)>0?this.languages[0]:this.language)),!l)return"rtl";try{const h=new Intl.Locale(l);if(h&&h.getTextInfo){const g=h.getTextInfo();if(g&&g.direction)return g.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=((f=this.services)==null?void 0:f.languageUtils)||new Mm(Co());return l.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(o.getLanguagePartFromCode(l))>-1||l.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(l={},r){const o=new ai(l,r);return o.createInstance=ai.createInstance,o}cloneInstance(l={},r=wu){const o=l.forkResourceStore;o&&delete l.forkResourceStore;const c={...this.options,...l,isClone:!0},f=new ai(c);if((l.debug!==void 0||l.prefix!==void 0)&&(f.logger=f.logger.clone(l)),["store","services","language"].forEach(g=>{f[g]=this[g]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const g=Object.keys(this.store.data).reduce((p,m)=>(p[m]={...this.store.data[m]},p[m]=Object.keys(p[m]).reduce((b,v)=>(b[v]={...p[m][v]},b),p[m]),p),{});f.store=new wm(g,c),f.services.resourceStore=f.store}if(l.interpolation){const p={...Co().interpolation,...this.options.interpolation,...l.interpolation},m={...c,interpolation:p};f.services.interpolator=new km(m)}return f.translator=new Bu(f.services,c),f.translator.on("*",(g,...p)=>{f.emit(g,...p)}),f.init(c,r),f.translator.options=c,f.translator.backendConnector.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},f}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const $e=ai.createInstance();$e.createInstance;$e.dir;$e.init;$e.loadResources;$e.reloadResources;$e.use;$e.changeLanguage;$e.getFixedT;$e.t;$e.exists;$e.setDefaultNamespace;$e.hasLoadedNamespace;$e.loadNamespaces;$e.loadLanguages;const ni="en",Ag={en:()=>Pe(()=>import("./en-CKhCF6St.js"),[],import.meta.url),zh:()=>Pe(()=>import("./zh-Dz5FLTBV.js"),[],import.meta.url),"zh-TW":()=>Pe(()=>import("./zh-TW-BtRwreY_.js"),[],import.meta.url),ja:()=>Pe(()=>import("./ja-ChF4vbBL.js"),[],import.meta.url),es:()=>Pe(()=>import("./es-C8UBPhxM.js"),[],import.meta.url)},Lu={};function qm(i){return i in Ag}function zg(i){if(qm(i))return i;const l=i.split("-")[0];return qm(l)?l:ni}function eS(){const i=localStorage.getItem("cc_lang");return zg(i||navigator.language||ni)}async function Uo(i){if(Lu[i])return;const l=await Ag[i]();Lu[i]=l.default,$e.isInitialized&&$e.addResourceBundle(i,"translation",Lu[i],!0,!0)}async function tS(){const i=eS();await Promise.all([Uo(ni),i===ni?Promise.resolve():Uo(i)]),$e.isInitialized||await $e.use(P1).init({lng:i,fallbackLng:ni,resources:Object.fromEntries(Object.entries(Lu).map(([l,r])=>[l,{translation:r}])),interpolation:{escapeValue:!1}})}async function Ng(i){const l=zg(i);await Uo(l),await $e.changeLanguage(l),localStorage.setItem("cc_lang",l)}const Ym=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"zh-TW",label:"繁體中文"},{code:"ja",label:"日本語"},{code:"es",label:"Español"}],aS=[{label:"Core",ids:["dashboard","chat","workspace","projects","sessions"]},{label:"Knowledge",ids:["knowledge","cron"]},{label:"System",ids:["system"]}];function nS(){var J;const{pathname:i}=zt(),{t:l,i18n:r}=xg(),{theme:o,setTheme:c}=Fo(),f=Ct(V=>V.logout),h=Ct(V=>V.desktopManaged),g=Jo(),p=dn(),[m,b]=T.useState(!1),[v,N]=T.useState(!1),L=V=>{Ng(V),N(!1)},z={light:Wm,dark:Jm,system:$m},H={light:"dark",dark:"system",system:"light"},B=z[o],q=Qu.listNavItems().filter(V=>{var ue;return((ue=V.visible)==null?void 0:ue.call(V,{desktopManaged:h,features:g}))??!0}),X=q.map(V=>{var te;const ue=V.icon,K=((te=V.resolveLabelKey)==null?void 0:te.call(V,{desktopManaged:h,features:g,runtimeProvider:p}))||V.labelKey;return{...V,Icon:ue,labelKey:K}}),Q=i.startsWith("/chat");return _.jsxs(_.Fragment,{children:[_.jsxs("aside",{className:He("relative hidden h-[100dvh] flex-col overflow-hidden border-r transition-all duration-300 ease-out md:flex","border-white/55 bg-white/24 shadow-[inset_-1px_0_0_rgba(255,255,255,0.36)] backdrop-blur-[34px] supports-[backdrop-filter]:bg-white/18","dark:border-white/[0.10] dark:bg-[#1c1c1e]/34 dark:shadow-[inset_-1px_0_0_rgba(255,255,255,0.08)] dark:supports-[backdrop-filter]:bg-[#1c1c1e]/26",m?"w-16":"w-56"),children:[_.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(180deg,rgba(255,255,255,0.55),rgba(255,255,255,0.18)_48%,rgba(255,255,255,0.08))] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.025)_52%,rgba(255,255,255,0.015))]","aria-hidden":"true"}),_.jsx("div",{className:He("relative flex h-[5.25rem] items-center gap-3 px-4 pt-7 transition-colors"),children:_.jsx(Tg,{showWordmark:!m})}),_.jsx("nav",{className:"relative flex-1 py-3 space-y-4 px-2 overflow-y-auto",children:aS.map(V=>{const ue=q.filter(K=>V.ids.includes(K.id));return ue.length===0?null:_.jsxs("div",{className:"space-y-1",children:[!m&&_.jsx("p",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/80",children:V.label}),ue.map(K=>{var se;const te=K.icon,le=((se=K.resolveLabelKey)==null?void 0:se.call(K,{desktopManaged:h,features:g,runtimeProvider:p}))||K.labelKey;return _.jsxs(wo,{to:K.path,end:K.end,className:({isActive:Ae})=>He("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",Ae?"bg-black/[0.07] text-foreground dark:bg-white/[0.10]":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[_.jsx(te,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l(le)})]},K.id)})]},V.label)})}),_.jsxs("div",{className:He("relative border-t p-2 space-y-1","border-black/10 dark:border-white/[0.08]"),children:[!m&&_.jsxs("div",{className:"px-3 pb-1 pt-0.5 text-[11px] font-medium text-muted-foreground/75",children:["AgentDock v","0.1.19"]}),_.jsxs("div",{className:"relative",children:[_.jsxs("button",{type:"button",onClick:()=>N(!v),className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(C0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:((J=Ym.find(V=>V.code===r.language))==null?void 0:J.label)||"English"})]}),v&&_.jsx("div",{className:He("absolute bottom-full left-0 mb-1 w-48 rounded-xl py-1 z-50 overflow-hidden","border border-black/10 bg-white/90 text-popover-foreground shadow-[0_18px_40px_rgba(0,0,0,0.12)] backdrop-blur-2xl","dark:border-white/[0.08] dark:bg-[#2c2c2e]/90"),children:Ym.map(V=>_.jsx("button",{type:"button",onClick:()=>L(V.code),className:He("w-full text-left px-3 py-2 text-sm transition-colors duration-150",r.language===V.code?"text-primary font-medium bg-primary/10":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:V.label},V.code))})]}),_.jsxs("button",{type:"button",onClick:()=>c(H[o]),className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(B,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l(`theme.${o}`)})]}),!h&&_.jsxs("button",{type:"button",onClick:f,className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-destructive/10 hover:text-destructive","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(M0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l("login.logout")})]}),_.jsx("button",{type:"button",onClick:()=>b(!m),className:He("flex items-center justify-center w-full px-3 py-2 rounded-lg transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:m?_.jsx(b0,{size:18}):_.jsx(y0,{size:18})})]})]}),Q?null:_.jsx("nav",{className:He("fixed inset-x-0 bottom-0 z-50 border-t px-2 pb-[max(env(safe-area-inset-bottom),0.5rem)] pt-2 md:hidden","border-black/10 bg-white/88 shadow-[0_-12px_32px_rgba(15,23,42,0.10)] backdrop-blur-2xl","dark:border-white/[0.08] dark:bg-[#111113]/88 dark:shadow-[0_-16px_42px_rgba(0,0,0,0.34)]"),"aria-label":"Primary navigation",children:_.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:X.map(({id:V,path:ue,end:K,Icon:te,labelKey:le})=>_.jsxs(wo,{to:ue,end:K,className:({isActive:se})=>He("flex min-w-[4.5rem] flex-1 flex-col items-center justify-center gap-1 rounded-xl px-2 py-2 text-[11px] font-medium transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",se?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[_.jsx(te,{size:18,className:"shrink-0"}),_.jsx("span",{className:"max-w-[4.25rem] truncate",children:l(le)})]},V))})})]})}function lS(){const{pathname:i}=zt(),{desktopChat:l}=Jo(),r=i.startsWith("/chat"),o=i.startsWith("/chat")&&l,c=o&&dn()==="electron";return _.jsxs("div",{className:He("flex h-[100dvh] overflow-hidden","bg-background/60 backdrop-blur-2xl"),children:[_.jsx("div",{className:"fixed left-0 right-0 top-0 z-50 hidden h-8 [-webkit-app-region:drag] md:block","aria-hidden":"true"}),_.jsx(nS,{}),_.jsx("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0 bg-background/45 backdrop-blur-2xl",children:_.jsx("main",{className:He("flex-1 min-h-0",o?"overflow-hidden":"overflow-y-auto",c?"p-0":r?"p-4 pb-4 sm:p-6 sm:pb-6":"p-4 pb-24 sm:p-6 sm:pb-6"),children:_.jsx("div",{className:He(o&&"h-full min-h-0",!c&&"mx-auto w-full max-w-7xl"),children:_.jsx(t1,{})})})})]})}const iS=()=>Qe.get("/status"),e2=i=>Qe.post("/restart",i),t2=()=>Qe.post("/reload"),a2=i=>Qe.get("/logs",i);function uS({children:i,className:l,hover:r}){return _.jsx("div",{className:He("rounded-lg p-5 text-card-foreground transition-colors duration-200 animate-float-in","border border-black/[0.08] bg-white/62 shadow-[0_1px_1px_rgba(0,0,0,0.04)] backdrop-blur-2xl","dark:border-white/[0.07] dark:bg-white/[0.06] dark:shadow-none",r&&"cursor-pointer hover:border-black/[0.12] hover:bg-white/76 hover:shadow-[0_10px_26px_rgba(0,0,0,0.07)] dark:hover:border-white/[0.10] dark:hover:bg-white/[0.09] dark:hover:shadow-none",l),children:i})}function Gm(i,l){if(typeof i=="function")return i(l);i!=null&&(i.current=l)}function wg(...i){return l=>{let r=!1;const o=i.map(c=>{const f=Gm(c,l);return!r&&typeof f=="function"&&(r=!0),f});if(r)return()=>{for(let c=0;c<o.length;c++){const f=o[c];typeof f=="function"?f():Gm(i[c],null)}}}}function n2(...i){return T.useCallback(wg(...i),i)}var rS=Symbol.for("react.lazy"),qu=f0[" use ".trim().toString()];function sS(i){return typeof i=="object"&&i!==null&&"then"in i}function jg(i){return i!=null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===rS&&"_payload"in i&&sS(i._payload)}function oS(i){const l=fS(i),r=T.forwardRef((o,c)=>{let{children:f,...h}=o;jg(f)&&typeof qu=="function"&&(f=qu(f._payload));const g=T.Children.toArray(f),p=g.find(hS);if(p){const m=p.props.children,b=g.map(v=>v===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:v);return _.jsx(l,{...h,ref:c,children:T.isValidElement(m)?T.cloneElement(m,void 0,b):null})}return _.jsx(l,{...h,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}var cS=oS("Slot");function fS(i){const l=T.forwardRef((r,o)=>{let{children:c,...f}=r;if(jg(c)&&typeof qu=="function"&&(c=qu(c._payload)),T.isValidElement(c)){const h=gS(c),g=mS(f,c.props);return c.type!==T.Fragment&&(g.ref=o?wg(o,h):h),T.cloneElement(c,g)}return T.Children.count(c)>1?T.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var dS=Symbol("radix.slottable");function hS(i){return T.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===dS}function mS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...g)=>{const p=f(...g);return c(...g),p}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function gS(i){var o,c;let l=(o=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:o.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=(c=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:c.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}const pS={default:"bg-primary text-primary-foreground hover:bg-accent-dim",primary:"bg-primary text-primary-foreground hover:bg-accent-dim",secondary:"bg-black/[0.05] text-secondary-foreground hover:bg-black/[0.08] dark:bg-white/[0.08] dark:hover:bg-white/[0.12]",outline:"border border-input bg-background hover:bg-black/[0.04] hover:text-foreground dark:hover:bg-white/[0.06]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]",link:"text-primary underline-offset-4 hover:underline"},yS={default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",md:"h-9 rounded-md px-4 py-2 text-sm",lg:"h-10 rounded-md px-6 text-sm",icon:"h-9 w-9"};function Yu({variant:i="primary",size:l="md",className:r,children:o,loading:c,asChild:f,disabled:h,type:g="button",...p}){const m=l==="default"?"md":l,b=f?cS:"button";return _.jsxs(b,{...f?{}:{type:g},className:He("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors duration-200","cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:pointer-events-none disabled:opacity-50",pS[i],yS[m],r),disabled:h||c,...p,children:[c&&_.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24","aria-hidden":!0,children:[_.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),_.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o]})}function Vm({label:i,className:l,...r}){return _.jsxs("div",{className:"space-y-1.5",children:[i&&_.jsx("label",{className:"block text-sm font-medium text-foreground",children:i}),_.jsx("input",{className:He("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l),...r})]})}function l2({label:i,className:l,...r}){return _.jsxs("div",{className:"space-y-1.5",children:[i&&_.jsx("label",{className:"block text-sm font-medium text-foreground",children:i}),_.jsx("textarea",{className:He("flex min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors resize-none","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l),...r})]})}const ko="http://127.0.0.1:9831",vS=`${ko}/api/local/v1`;function bS(i){const l=i.trim();return l?l.replace(/\/+$/,""):vS}const ri=bS("/api/local/v1");ri.endsWith("/api/local/v1")&&ri.slice(0,-13);const si=new Set;let _t=null;async function W(i,l,r){const o=await fetch(`${ri}${l}`,{method:i,headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core request failed: ${o.status}`);return c.data}function Mg(){if(_t||typeof window>"u")return;_t=new EventSource(`${ri}/events`);const i=l=>{try{const r=JSON.parse(l.data);si.forEach(o=>o(r))}catch{}};["runtime.updated","runtime.detect.started","runtime.detect.completed","runtime.detect.failed","runtime.status.changed","thread.updated","message.created","message.updated","run.updated","scheduler.job.updated","scheduler.run.updated","presence.updated","stream.updated"].forEach(l=>{_t==null||_t.addEventListener(l,i)}),_t.onerror=()=>{_t==null||_t.close(),_t=null,si.size>0&&window.setTimeout(()=>Mg(),1e3)}}function SS(){si.size===0&&_t&&(_t.close(),_t=null)}function Lg(i){return si.add(i),Mg(),()=>{si.delete(i),SS()}}async function i2(){return W("GET","/runtime")}async function u2(){return W("POST","/runtime/service/start")}async function r2(){return W("POST","/runtime/service/stop")}async function s2(){return W("POST","/runtime/service/restart")}async function o2(i){const l=typeof i=="number"?`?limit=${encodeURIComponent(String(i))}`:"";return W("GET",`/runtime/logs${l}`)}async function c2(){return W("GET","/runtime/agent-runtimes")}async function f2(){return W("POST","/runtimes/refresh")}async function d2(){return W("GET","/runtime/config")}async function h2(i){return W("POST","/runtime/config/raw",{raw:i})}async function m2(i){return W("POST","/runtime/config/structured",{config:i})}async function g2(i){return W("POST","/runtime/settings",i)}async function xS(i){return W("GET",`/platforms/${encodeURIComponent(i)}`)}async function ES(i,l){return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}`)}async function TS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/test`)}async function RS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/enable`)}async function _S(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/disable`)}async function OS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/pairings${r}`)}async function CS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/approve`,{code:l})}async function AS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/reject`,{code:l})}async function zS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/users${r}`)}async function p2(){return xS("lark")}async function y2(i){return ES("lark",i)}async function v2(i){return TS("lark",i)}async function b2(i){return RS("lark",i)}async function S2(i){return _S("lark",i)}async function x2(i){return OS("lark",i)}async function E2(i){return CS("lark",i)}async function T2(i){return AS("lark",i)}async function R2(i){return zS("lark",i)}async function _2(i){return W("POST",`/platforms/weixin/${encodeURIComponent(i)}/qrcode`)}async function O2(i,l){return W("GET",`/platforms/weixin/${encodeURIComponent(i)}/qrcode/status?ticket=${encodeURIComponent(l)}`)}async function C2(){return W("GET","/workspaces")}async function A2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.runtimeId&&l.set("runtime_id",i.runtimeId),i.status&&l.set("status",Array.isArray(i.status)?i.status.join(","):i.status),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/tasks${r}`)}async function z2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.taskId&&l.set("task_id",i.taskId),i.status&&l.set("status",Array.isArray(i.status)?i.status.join(","):i.status),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/approvals${r}`)}async function N2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.taskId&&l.set("task_id",i.taskId),i.approvalId&&l.set("approval_id",i.approvalId),i.type&&l.set("type",Array.isArray(i.type)?i.type.join(","):i.type),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/audit-events${r}`)}async function w2(i){return W("GET","/scheduler/jobs")}async function j2(i){return W("POST","/scheduler/jobs",i)}async function M2(i,l){return W("PATCH",`/scheduler/jobs/${encodeURIComponent(i)}`,l)}async function L2(i){return W("DELETE",`/scheduler/jobs/${encodeURIComponent(i)}`)}async function D2(i){return W("POST",`/scheduler/jobs/${encodeURIComponent(i)}/run`)}async function U2(i){return W("GET",`/threads?workspace_id=${encodeURIComponent(i)}`)}async function k2(i,l){return W("POST","/threads",{workspaceId:i,title:l})}async function H2(i){return W("GET",`/threads/${encodeURIComponent(i)}`)}async function B2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}`,{title:l})}async function q2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}/knowledge-bases`,{knowledgeBaseIds:l})}async function Y2(i){return W("DELETE",`/threads/${encodeURIComponent(i)}`)}async function G2(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/messages`,{content:l})}async function V2(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/actions`,{content:l})}async function K2(i){return W("POST",`/runs/${encodeURIComponent(i)}/interrupt`)}async function X2(){return W("GET","/knowledge/config")}async function Q2(){return W("GET","/knowledge/folders")}async function Z2(i){return W("POST","/knowledge/folders",i)}async function $2(i,l){return W("PATCH",`/knowledge/folders/${encodeURIComponent(i)}`,l)}async function J2(i){return W("DELETE",`/knowledge/folders/${encodeURIComponent(i)}`)}async function F2(){return W("GET","/knowledge/bases")}async function W2(i){return W("POST","/knowledge/bases",i)}async function I2(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}`)}async function P2(i,l){return W("PATCH",`/knowledge/bases/${encodeURIComponent(i)}`,l)}async function ex(i){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}`)}async function tx(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}/files`)}async function ax(i,l){const r=new FormData;r.append("collection",l.collection),r.append("knowledgebase_id",i),l.folder&&r.append("folder",l.folder),l.files.forEach(f=>{r.append("files",f,f.name)});const o=await fetch(`${ri}/knowledge/bases/${encodeURIComponent(i)}/files`,{method:"POST",body:r}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core upload failed: ${o.status}`);return c.data}async function nx(i,l){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}/files/${encodeURIComponent(l)}`)}async function lx(i,l){return W("POST",`/knowledge/bases/${encodeURIComponent(i)}/search`,l)}async function ix(){return W("GET","/capabilities/snapshot")}async function ux(){return W("GET","/plugins/diagnostics")}async function rx(i){return W("POST",`/workspaces/${encodeURIComponent(i)}/streaming-probe`)}function sx(i){return Lg(l=>{l.type==="runtime.updated"&&i(l.runtime)})}function ox(i){return Lg(l=>{l.type==="stream.updated"&&i(l.stream),(l.type==="message.created"||l.type==="message.updated"||l.type==="run.updated")&&"stream"in l&&l.stream&&i(l.stream)})}const NS=[{code:"en",label:"EN"},{code:"zh",label:"中"},{code:"zh-TW",label:"繁"},{code:"ja",label:"日"},{code:"es",label:"ES"}];function wS(){const{t:i,i18n:l}=xg(),r=Ku(),o=Ct(J=>J.login),{theme:c,setTheme:f}=Fo(),[h,g]=T.useState(""),[p,m]=T.useState(""),[b,v]=T.useState(""),[N,L]=T.useState(!1),z=ib(),H=ub(),B=async J=>{if(J.preventDefault(),!(!h.trim()||H)){L(!0),v("");try{p.trim()&&Qe.setBaseUrl(p.trim()),Qe.setToken(h.trim()),await iS(),o(h.trim(),p.trim()),z?window.location.hash="#/":r("/",{replace:!0})}catch{v(i("login.invalidToken")),Qe.setToken(""),Qe.setBaseUrl("")}finally{L(!1)}}},q={light:Wm,dark:Jm,system:$m},X={light:"dark",dark:"system",system:"light"},Q=q[c];return _.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-[radial-gradient(circle_at_top,hsl(var(--secondary))_0,hsl(var(--background))_42%,hsl(var(--background))_78%)] p-4",children:[_.jsxs("div",{className:"fixed top-4 right-4 flex items-center gap-2",children:[_.jsx("div",{className:"flex overflow-hidden rounded-md border bg-card/80 backdrop-blur",children:NS.map(J=>_.jsx("button",{onClick:()=>void Ng(J.code),className:He("px-2.5 py-1.5 text-xs font-medium transition-colors",l.language===J.code?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent/10 hover:text-foreground"),children:J.label},J.code))}),_.jsx(Yu,{variant:"outline",size:"icon",onClick:()=>f(X[c]),"aria-label":i(`theme.${c}`),children:_.jsx(Q,{size:16})})]}),_.jsx("div",{className:"w-full max-w-md animate-fade-in",children:_.jsxs(uS,{className:"p-8 shadow-2xl shadow-primary/10",children:[_.jsx("div",{className:"flex justify-center mb-6",children:_.jsx(Tg,{markClassName:"h-14 w-14 drop-shadow-[0_14px_28px_rgba(0,122,255,0.22)]"})}),_.jsx("h1",{className:"text-2xl font-bold text-center text-foreground mb-1",children:i("login.title")}),_.jsx("p",{className:"text-sm text-center text-muted-foreground mb-3",children:i("login.subtitle")}),_.jsx("div",{className:"mb-8 rounded-lg border bg-muted px-4 py-3 text-xs text-muted-foreground",children:z?"AgentDock 桌面模式会自动连接到本地托管运行时。":"Browser mode requires a reachable API endpoint. Enter the server URL and access token."}),b&&_.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded-lg border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive dark:text-red-200",children:[_.jsx(x0,{size:16}),b]}),_.jsxs("form",{onSubmit:B,className:"space-y-4",children:[_.jsx(Vm,{label:i("login.token"),type:"password",value:h,onChange:J=>g(J.target.value),placeholder:"mgmt-secret-xxx",autoFocus:!0}),_.jsx(Vm,{label:`${i("login.serverUrl")} (${i("common.optional")})`,type:"text",value:p,onChange:J=>m(J.target.value),placeholder:"http://localhost:9820"}),_.jsxs(Yu,{type:"submit",disabled:N||!h.trim()||H,className:"w-full shadow-[0_0_20px_-6px_hsl(var(--primary)/0.55)]",children:[N?_.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[_.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),_.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):_.jsx(J0,{size:16}),i("login.connect")]})]})]})})]})}function jS({children:i}){return Ct(r=>r.isAuthenticated)?_.jsx(_.Fragment,{children:i}):_.jsx(Ya,{to:"/login",replace:!0})}function MS(){return _.jsx("div",{className:"flex min-h-64 items-center justify-center text-sm text-muted-foreground",children:"正在加载…"})}function LS(){const i=Ct(o=>o.isAuthenticated),l=Ct(o=>o.desktopManaged),r=Jo();return _.jsx(T.Suspense,{fallback:_.jsx(MS,{}),children:_.jsxs(n1,{children:[_.jsx(on,{path:"/login",element:i?_.jsx(Ya,{to:"/",replace:!0}):_.jsx(wS,{})}),_.jsxs(on,{element:_.jsx(jS,{children:_.jsx(lS,{})}),children:[Qu.listRoutes().map(o=>o.index?_.jsx(on,{index:!0,element:o.element({desktopManaged:l,features:r})},o.id):_.jsx(on,{path:o.path,element:o.element({desktopManaged:l,features:r})},o.id)),_.jsx(on,{path:"*",element:_.jsx(Ya,{to:"/",replace:!0})})]}),_.jsx(on,{path:"*",element:_.jsx(Ya,{to:i?"/":"/login",replace:!0})})]})})}class DS extends Pn.Component{constructor(){super(...arguments);In(this,"state",{hasError:!1,errorMessage:""})}static getDerivedStateFromError(r){return{hasError:!0,errorMessage:r instanceof Error?r.message:String(r)}}componentDidCatch(r,o){console.error("App render failed",r,o)}render(){return this.state.hasError?_.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"max-w-lg w-full rounded-2xl border border-red-200 dark:border-red-900/40 bg-red-50 dark:bg-red-950/20 px-6 py-5",children:[_.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"页面渲染失败"}),_.jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-400 break-words",children:this.state.errorMessage||"Unknown renderer error"}),_.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700",children:"Reload"})]})}):this.props.children}}const US="http://127.0.0.1:9831",kS=`${US}/api/local/v1`,cn=HS("/api/local/v1"),oi=new Set;let Kt=null;function HS(i){const l=i.trim();return l?l.replace(/\/+$/,""):kS}async function Wo(i,l,r){const o=await fetch(`${cn}${l}`,{method:i,headers:{"Content-Type":"application/json"},body:void 0}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core request failed: ${o.status}`);return c.data}async function BS(i=350){var o;const l=new AbortController,r=window.setTimeout(()=>l.abort(),i);try{const c=await fetch(`${cn}/health`,{signal:l.signal}),f=await c.json();return c.ok&&f.ok&&((o=f.data)==null?void 0:o.name)==="local-ai-core"}catch{return!1}finally{window.clearTimeout(r)}}function Dg(){Kt||typeof window>"u"||(Kt=new EventSource(`${cn}/events`),Kt.addEventListener("runtime.updated",i=>{try{const l=JSON.parse(i.data);l.type==="runtime.updated"&&oi.forEach(r=>r(l.runtime))}catch{}}),Kt.onerror=()=>{Kt==null||Kt.close(),Kt=null,oi.size>0&&window.setTimeout(()=>Dg(),1e3)})}function qS(){oi.size===0&&Kt&&(Kt.close(),Kt=null)}async function YS(){return window.desktop?(Eo("electron"),!0):(await BS(),Eo("local_core"),!0)}function GS(){return dn()==="electron"&&window.desktop?window.desktop.getRuntimeStatus():Wo("GET","/runtime")}function Km(){return Wo("GET","/capabilities/snapshot")}function VS(i){if(dn()==="electron"&&window.desktop)return window.desktop.getLogs(i);const l=`?limit=${encodeURIComponent(String(i))}`;return Wo("GET",`/runtime/logs${l}`)}function KS(i){return dn()==="electron"&&window.desktop?window.desktop.onRuntimeEvent(i):(oi.add(i),Dg(),()=>{oi.delete(i),qS()})}const Xm=20,XS=500;function QS(i){return new Promise(l=>window.setTimeout(l,i))}function ZS(){return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-gray-200 dark:border-white/[0.08] bg-white dark:bg-gray-900 px-5 py-4 text-sm text-gray-600 dark:text-gray-300 shadow-sm",children:[_.jsx(Fm,{size:16,className:"animate-spin"}),"正在初始化 AgentDock 运行时…"]})})}function $S({message:i,logs:l,onRetry:r}){return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"max-w-2xl w-full rounded-3xl border border-red-200 dark:border-red-900/40 bg-white dark:bg-gray-900 shadow-sm overflow-hidden",children:[_.jsx("div",{className:"px-6 py-5 border-b border-red-100 dark:border-red-900/30 bg-red-50/80 dark:bg-red-950/20",children:_.jsxs("div",{className:"flex items-start gap-3",children:[_.jsx("div",{className:"w-10 h-10 rounded-2xl bg-red-100 dark:bg-red-950/40 text-red-600 dark:text-red-300 flex items-center justify-center shrink-0",children:_.jsx(X0,{size:18})}),_.jsxs("div",{children:[_.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"AgentDock 运行时初始化失败"}),_.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 break-words",children:i})]})]})}),_.jsxs("div",{className:"px-6 py-5 space-y-4",children:[_.jsxs("div",{className:"rounded-2xl border border-gray-200 dark:border-white/[0.08] px-4 py-3 text-sm text-gray-600 dark:text-gray-300",children:[_.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"What we can do next"}),_.jsx("p",{className:"mt-1",children:"请先重试本地运行时初始化。如果仍然失败,请检查下方运行时日志,并确认 Local AI Core 配置文件路径与运行环境是否正确。"})]}),l.length>0&&_.jsxs("div",{className:"rounded-2xl border border-gray-200 dark:border-white/[0.08] bg-gray-50 dark:bg-gray-950/40 px-4 py-3",children:[_.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"最近的桌面日志"}),_.jsx("pre",{className:"mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-gray-600 dark:text-gray-300 font-mono",children:l.join(`
|
|
176
|
+
Please change the parent <Route path="${q}"> to <Route path="${q==="/"?"*":`${q}/*`}">.`)}let b=zt(),v;if(l){let q=typeof l=="string"?hn(l):l;Le(p==="/"||((B=q.pathname)==null?void 0:B.startsWith(p)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${q.pathname}" was given in the \`location\` prop.`),v=q}else v=b;let N=v.pathname||"/",L=N;if(p!=="/"){let q=p.replace(/^\//,"").split("/");L="/"+N.replace(/^\//,"").split("/").slice(q.length).join("/")}let z=Im(i,{pathname:L});Ot(m||z!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Ot(z==null||z[z.length-1].route.element!==void 0||z[z.length-1].route.Component!==void 0||z[z.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let H=Zv(z&&z.map(q=>Object.assign({},q,{params:Object.assign({},h,q.params),pathname:Xt([p,o.encodeLocation?o.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?p:Xt([p,o.encodeLocation?o.encodeLocation(q.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathnameBase])})),c,r);return l&&H?T.createElement(ci.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},H):H}function Vv(){let i=Iv(),l=Av(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),r=i instanceof Error?i.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},f={padding:"2px 4px",backgroundColor:o},h=null;return console.error("Error handled by React Router default ErrorBoundary:",i),h=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:f},"ErrorBoundary")," or"," ",T.createElement("code",{style:f},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},l),r?T.createElement("pre",{style:c},r):null,h)}var Kv=T.createElement(Vv,null),dg=class extends T.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,l){return l.location!==i.location||l.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:l.error,location:l.location,revalidation:i.revalidation||l.revalidation}}componentDidCatch(i,l){this.props.onError?this.props.onError(i,l):console.error("React Router caught the following error during render",i)}render(){let i=this.state.error;if(this.context&&typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){const r=kv(i.digest);r&&(i=r)}let l=i!==void 0?T.createElement(qt.Provider,{value:this.props.routeContext},T.createElement(qo.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?T.createElement(Xv,{error:i},l):l}};dg.contextType=ig;var So=new WeakMap;function Xv({children:i,error:l}){let{basename:r}=T.useContext(At);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let o=Uv(l.digest);if(o){let c=So.get(l);if(c)throw c;let f=ng(o.location,r);if(ag&&!So.get(l))if(f.isExternal||o.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:o.replace}));throw So.set(l,h),h}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return i}function Qv({routeContext:i,match:l,children:r}){let o=T.useContext(tl);return o&&o.static&&o.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=l.route.id),T.createElement(qt.Provider,{value:i},r)}function Zv(i,l=[],r){let o=r==null?void 0:r.state;if(i==null){if(!o)return null;if(o.errors)i=o.matches;else if(l.length===0&&!o.initialized&&o.matches.length>0)i=o.matches;else return null}let c=i,f=o==null?void 0:o.errors;if(f!=null){let b=c.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);Le(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),c=c.slice(0,Math.min(c.length,b+1))}let h=!1,g=-1;if(r&&o){h=o.renderFallback;for(let b=0;b<c.length;b++){let v=c[b];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=b),v.route.id){let{loaderData:N,errors:L}=o,z=v.route.loader&&!N.hasOwnProperty(v.route.id)&&(!L||L[v.route.id]===void 0);if(v.route.lazy||z){r.isStatic&&(h=!0),g>=0?c=c.slice(0,g+1):c=[c[0]];break}}}}let p=r==null?void 0:r.onError,m=o&&p?(b,v)=>{var N,L;p(b,{location:o.location,params:((L=(N=o.matches)==null?void 0:N[0])==null?void 0:L.params)??{},unstable_pattern:zv(o.matches),errorInfo:v})}:void 0;return c.reduceRight((b,v,N)=>{let L,z=!1,H=null,B=null;o&&(L=f&&v.route.id?f[v.route.id]:void 0,H=v.route.errorElement||Kv,h&&(g<0&&N===0?(hg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),z=!0,B=null):g===N&&(z=!0,B=v.route.hydrateFallbackElement||null)));let q=l.concat(c.slice(0,N+1)),X=()=>{let Q;return L?Q=H:z?Q=B:v.route.Component?Q=T.createElement(v.route.Component,null):v.route.element?Q=v.route.element:Q=b,T.createElement(Qv,{match:v,routeContext:{outlet:b,matches:q,isDataRoute:o!=null},children:Q})};return o&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?T.createElement(dg,{location:o.location,revalidation:o.revalidation,component:H,error:L,children:X(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:m}):X()},null)}function Yo(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $v(i){let l=T.useContext(tl);return Le(l,Yo(i)),l}function Jv(i){let l=T.useContext(Vu);return Le(l,Yo(i)),l}function Fv(i){let l=T.useContext(qt);return Le(l,Yo(i)),l}function Go(i){let l=Fv(i),r=l.matches[l.matches.length-1];return Le(r.route.id,`${i} can only be used on routes that contain a unique "id"`),r.route.id}function Wv(){return Go("useRouteId")}function Iv(){var o;let i=T.useContext(qo),l=Jv("useRouteError"),r=Go("useRouteError");return i!==void 0?i:(o=l.errors)==null?void 0:o[r]}function Pv(){let{router:i}=$v("useNavigate"),l=Go("useNavigate"),r=T.useRef(!1);return og(()=>{r.current=!0}),T.useCallback(async(c,f={})=>{Ot(r.current,sg),r.current&&(typeof c=="number"?await i.navigate(c):await i.navigate(c,{fromRouteId:l,...f}))},[i,l])}var pm={};function hg(i,l,r){!l&&!pm[i]&&(pm[i]=!0,Ot(!1,r))}T.memo(e1);function e1({routes:i,future:l,state:r,isStatic:o,onError:c}){return fg(i,void 0,{state:r,isStatic:o,onError:c})}function Ya({to:i,replace:l,state:r,relative:o}){Le(al(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=T.useContext(At);Ot(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:f}=T.useContext(qt),{pathname:h}=zt(),g=Ku(),p=Gu(i,Bo(f),h,o==="path"),m=JSON.stringify(p);return T.useEffect(()=>{g(JSON.parse(m),{replace:l,state:r,relative:o})},[g,m,o,l,r]),null}function t1(i){return Yv(i.context)}function on(i){Le(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function a1({basename:i="/",children:l=null,location:r,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:h}){Le(!al(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let g=i.replace(/^\/*/,"/"),p=T.useMemo(()=>({basename:g,navigator:c,static:f,unstable_useTransitions:h,future:{}}),[g,c,f,h]);typeof r=="string"&&(r=hn(r));let{pathname:m="/",search:b="",hash:v="",state:N=null,key:L="default",unstable_mask:z}=r,H=T.useMemo(()=>{let B=ga(m,g);return B==null?null:{location:{pathname:B,search:b,hash:v,state:N,key:L,unstable_mask:z},navigationType:o}},[g,m,b,v,N,L,o,z]);return Ot(H!=null,`<Router basename="${g}"> is not able to match the URL "${m}${b}${v}" because it does not start with the basename, so the <Router> won't render anything.`),H==null?null:T.createElement(At.Provider,{value:p},T.createElement(ci.Provider,{children:l,value:H}))}function n1({children:i,location:l}){return Gv(zo(i),l)}function zo(i,l=[]){let r=[];return T.Children.forEach(i,(o,c)=>{if(!T.isValidElement(o))return;let f=[...l,c];if(o.type===T.Fragment){r.push.apply(r,zo(o.props.children,f));return}Le(o.type===on,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Le(!o.props.index||!o.props.children,"An index route cannot have child routes.");let h={id:o.props.id||f.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(h.children=zo(o.props.children,f)),r.push(h)}),r}var ju="get",Mu="application/x-www-form-urlencoded";function Xu(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function l1(i){return Xu(i)&&i.tagName.toLowerCase()==="button"}function i1(i){return Xu(i)&&i.tagName.toLowerCase()==="form"}function u1(i){return Xu(i)&&i.tagName.toLowerCase()==="input"}function r1(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function s1(i,l){return i.button===0&&(!l||l==="_self")&&!r1(i)}function No(i=""){return new URLSearchParams(typeof i=="string"||Array.isArray(i)||i instanceof URLSearchParams?i:Object.keys(i).reduce((l,r)=>{let o=i[r];return l.concat(Array.isArray(o)?o.map(c=>[r,c]):[[r,o]])},[]))}function o1(i,l){let r=No(i);return l&&l.forEach((o,c)=>{r.has(c)||l.getAll(c).forEach(f=>{r.append(c,f)})}),r}var Nu=null;function c1(){if(Nu===null)try{new FormData(document.createElement("form"),0),Nu=!1}catch{Nu=!0}return Nu}var f1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xo(i){return i!=null&&!f1.has(i)?(Ot(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Mu}"`),null):i}function d1(i,l){let r,o,c,f,h;if(i1(i)){let g=i.getAttribute("action");o=g?ga(g,l):null,r=i.getAttribute("method")||ju,c=xo(i.getAttribute("enctype"))||Mu,f=new FormData(i)}else if(l1(i)||u1(i)&&(i.type==="submit"||i.type==="image")){let g=i.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=i.getAttribute("formaction")||g.getAttribute("action");if(o=p?ga(p,l):null,r=i.getAttribute("formmethod")||g.getAttribute("method")||ju,c=xo(i.getAttribute("formenctype"))||xo(g.getAttribute("enctype"))||Mu,f=new FormData(g,i),!c1()){let{name:m,type:b,value:v}=i;if(b==="image"){let N=m?`${m}.`:"";f.append(`${N}x`,"0"),f.append(`${N}y`,"0")}else m&&f.append(m,v)}}else{if(Xu(i))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ju,o=null,c=Mu,h=i}return f&&c==="text/plain"&&(h=f,f=void 0),{action:o,method:r.toLowerCase(),encType:c,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Vo(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function mg(i,l,r,o){let c=typeof i=="string"?new URL(i,typeof window>"u"?"server://singlefetch/":window.location.origin):i;return r?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:l&&ga(c.pathname,l)==="/"?c.pathname=`${Uu(l)}/_root.${o}`:c.pathname=`${Uu(c.pathname)}.${o}`,c}async function h1(i,l){if(i.id in l)return l[i.id];try{let r=await import(i.module);return l[i.id]=r,r}catch(r){return console.error(`Error loading route module \`${i.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function m1(i){return i==null?!1:i.href==null?i.rel==="preload"&&typeof i.imageSrcSet=="string"&&typeof i.imageSizes=="string":typeof i.rel=="string"&&typeof i.href=="string"}async function g1(i,l,r){let o=await Promise.all(i.map(async c=>{let f=l.routes[c.route.id];if(f){let h=await h1(f,r);return h.links?h.links():[]}return[]}));return b1(o.flat(1).filter(m1).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function ym(i,l,r,o,c,f){let h=(p,m)=>r[m]?p.route.id!==r[m].route.id:!0,g=(p,m)=>{var b;return r[m].pathname!==p.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==p.params["*"]};return f==="assets"?l.filter((p,m)=>h(p,m)||g(p,m)):f==="data"?l.filter((p,m)=>{var v;let b=o.routes[p.route.id];if(!b||!b.hasLoader)return!1;if(h(p,m)||g(p,m))return!0;if(p.route.shouldRevalidate){let N=p.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=r[0])==null?void 0:v.params)||{},nextUrl:new URL(i,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof N=="boolean")return N}return!0}):[]}function p1(i,l,{includeHydrateFallback:r}={}){return y1(i.map(o=>{let c=l.routes[o.route.id];if(!c)return[];let f=[c.module];return c.clientActionModule&&(f=f.concat(c.clientActionModule)),c.clientLoaderModule&&(f=f.concat(c.clientLoaderModule)),r&&c.hydrateFallbackModule&&(f=f.concat(c.hydrateFallbackModule)),c.imports&&(f=f.concat(c.imports)),f}).flat(1))}function y1(i){return[...new Set(i)]}function v1(i){let l={},r=Object.keys(i).sort();for(let o of r)l[o]=i[o];return l}function b1(i,l){let r=new Set;return new Set(l),i.reduce((o,c)=>{let f=JSON.stringify(v1(c));return r.has(f)||(r.add(f),o.push({key:f,link:c})),o},[])}function Ko(){let i=T.useContext(tl);return Vo(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function S1(){let i=T.useContext(Vu);return Vo(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Xo=T.createContext(void 0);Xo.displayName="FrameworkContext";function Qo(){let i=T.useContext(Xo);return Vo(i,"You must render this element inside a <HydratedRouter> element"),i}function x1(i,l){let r=T.useContext(Xo),[o,c]=T.useState(!1),[f,h]=T.useState(!1),{onFocus:g,onBlur:p,onMouseEnter:m,onMouseLeave:b,onTouchStart:v}=l,N=T.useRef(null);T.useEffect(()=>{if(i==="render"&&h(!0),i==="viewport"){let H=q=>{q.forEach(X=>{h(X.isIntersecting)})},B=new IntersectionObserver(H,{threshold:.5});return N.current&&B.observe(N.current),()=>{B.disconnect()}}},[i]),T.useEffect(()=>{if(o){let H=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(H)}}},[o]);let L=()=>{c(!0)},z=()=>{c(!1),h(!1)};return r?i!=="intent"?[f,N,{}]:[f,N,{onFocus:Il(g,L),onBlur:Il(p,z),onMouseEnter:Il(m,L),onMouseLeave:Il(b,z),onTouchStart:Il(v,L)}]:[!1,N,{}]}function Il(i,l){return r=>{i&&i(r),r.defaultPrevented||l(r)}}function E1({page:i,...l}){let r=wv(),{router:o}=Ko(),c=T.useMemo(()=>Im(o.routes,i,o.basename),[o.routes,i,o.basename]);return c?r?T.createElement(R1,{page:i,matches:c,...l}):T.createElement(_1,{page:i,matches:c,...l}):null}function T1(i){let{manifest:l,routeModules:r}=Qo(),[o,c]=T.useState([]);return T.useEffect(()=>{let f=!1;return g1(i,l,r).then(h=>{f||c(h)}),()=>{f=!0}},[i,l,r]),o}function R1({page:i,matches:l,...r}){let o=zt(),{future:c}=Qo(),{basename:f}=Ko(),h=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let g=mg(i,f,c.unstable_trailingSlashAwareDataRequests,"rsc"),p=!1,m=[];for(let b of l)typeof b.route.shouldRevalidate=="function"?p=!0:m.push(b.route.id);return p&&m.length>0&&g.searchParams.set("_routes",m.join(",")),[g.pathname+g.search]},[f,c.unstable_trailingSlashAwareDataRequests,i,o,l]);return T.createElement(T.Fragment,null,h.map(g=>T.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...r})))}function _1({page:i,matches:l,...r}){let o=zt(),{future:c,manifest:f,routeModules:h}=Qo(),{basename:g}=Ko(),{loaderData:p,matches:m}=S1(),b=T.useMemo(()=>ym(i,l,m,f,o,"data"),[i,l,m,f,o]),v=T.useMemo(()=>ym(i,l,m,f,o,"assets"),[i,l,m,f,o]),N=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let H=new Set,B=!1;if(l.forEach(X=>{var J;let Q=f.routes[X.route.id];!Q||!Q.hasLoader||(!b.some(V=>V.route.id===X.route.id)&&X.route.id in p&&((J=h[X.route.id])!=null&&J.shouldRevalidate)||Q.hasClientLoader?B=!0:H.add(X.route.id))}),H.size===0)return[];let q=mg(i,g,c.unstable_trailingSlashAwareDataRequests,"data");return B&&H.size>0&&q.searchParams.set("_routes",l.filter(X=>H.has(X.route.id)).map(X=>X.route.id).join(",")),[q.pathname+q.search]},[g,c.unstable_trailingSlashAwareDataRequests,p,o,f,b,l,i,h]),L=T.useMemo(()=>p1(v,f),[v,f]),z=T1(v);return T.createElement(T.Fragment,null,N.map(H=>T.createElement("link",{key:H,rel:"prefetch",as:"fetch",href:H,...r})),L.map(H=>T.createElement("link",{key:H,rel:"modulepreload",href:H,...r})),z.map(({key:H,link:B})=>T.createElement("link",{key:H,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function O1(...i){return l=>{i.forEach(r=>{typeof r=="function"?r(l):r!=null&&(r.current=l)})}}var C1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{C1&&(window.__reactRouterVersion="7.14.2")}catch{}function A1({basename:i,children:l,unstable_useTransitions:r,window:o}){let c=T.useRef();c.current==null&&(c.current=lv({window:o,v5Compat:!0}));let f=c.current,[h,g]=T.useState({action:f.action,location:f.location}),p=T.useCallback(m=>{r===!1?g(m):T.startTransition(()=>g(m))},[r]);return T.useLayoutEffect(()=>f.listen(p),[f,p]),T.createElement(a1,{basename:i,children:l,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:r})}var gg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pg=T.forwardRef(function({onClick:l,discover:r="render",prefetch:o="none",relative:c,reloadDocument:f,replace:h,unstable_mask:g,state:p,target:m,to:b,preventScrollReset:v,viewTransition:N,unstable_defaultShouldRevalidate:L,...z},H){let{basename:B,navigator:q,unstable_useTransitions:X}=T.useContext(At),Q=typeof b=="string"&&gg.test(b),J=ng(b,B);b=J.to;let V=Hv(b,{relative:c}),ue=zt(),K=null;if(g){let De=Gu(g,[],ue.unstable_mask?ue.unstable_mask.pathname:"/",!0);B!=="/"&&(De.pathname=De.pathname==="/"?B:Xt([B,De.pathname])),K=q.createHref(De)}let[te,le,se]=x1(o,z),Ae=w1(b,{replace:h,unstable_mask:g,state:p,target:m,preventScrollReset:v,relative:c,viewTransition:N,unstable_defaultShouldRevalidate:L,unstable_useTransitions:X});function Fe(De){l&&l(De),De.defaultPrevented||Ae(De)}let ze=!(J.isExternal||f),je=T.createElement("a",{...z,...se,href:(ze?K:void 0)||J.absoluteURL||V,onClick:ze?Fe:l,ref:O1(H,le),target:m,"data-discover":!Q&&r==="render"?"true":void 0});return te&&!Q?T.createElement(T.Fragment,null,je,T.createElement(E1,{page:V})):je});pg.displayName="Link";var wo=T.forwardRef(function({"aria-current":l="page",caseSensitive:r=!1,className:o="",end:c=!1,style:f,to:h,viewTransition:g,children:p,...m},b){let v=fi(h,{relative:m.relative}),N=zt(),L=T.useContext(Vu),{navigator:z,basename:H}=T.useContext(At),B=L!=null&&U1(v)&&g===!0,q=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,X=N.pathname,Q=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(X=X.toLowerCase(),Q=Q?Q.toLowerCase():null,q=q.toLowerCase()),Q&&H&&(Q=ga(Q,H)||Q);const J=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let V=X===q||!c&&X.startsWith(q)&&X.charAt(J)==="/",ue=Q!=null&&(Q===q||!c&&Q.startsWith(q)&&Q.charAt(q.length)==="/"),K={isActive:V,isPending:ue,isTransitioning:B},te=V?l:void 0,le;typeof o=="function"?le=o(K):le=[o,V?"active":null,ue?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let se=typeof f=="function"?f(K):f;return T.createElement(pg,{...m,"aria-current":te,className:le,ref:b,style:se,to:h,viewTransition:g},typeof p=="function"?p(K):p)});wo.displayName="NavLink";var z1=T.forwardRef(({discover:i="render",fetcherKey:l,navigate:r,reloadDocument:o,replace:c,state:f,method:h=ju,action:g,onSubmit:p,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N,...L},z)=>{let{unstable_useTransitions:H}=T.useContext(At),B=L1(),q=D1(g,{relative:m}),X=h.toLowerCase()==="get"?"get":"post",Q=typeof g=="string"&&gg.test(g),J=V=>{if(p&&p(V),V.defaultPrevented)return;V.preventDefault();let ue=V.nativeEvent.submitter,K=(ue==null?void 0:ue.getAttribute("formmethod"))||h,te=()=>B(ue||V.currentTarget,{fetcherKey:l,method:K,navigate:r,replace:c,state:f,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N});H&&r!==!1?T.startTransition(()=>te()):te()};return T.createElement("form",{ref:z,method:X,action:q,onSubmit:o?p:J,...L,"data-discover":!Q&&i==="render"?"true":void 0})});z1.displayName="Form";function N1(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yg(i){let l=T.useContext(tl);return Le(l,N1(i)),l}function w1(i,{target:l,replace:r,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let b=Ku(),v=zt(),N=fi(i,{relative:h});return T.useCallback(L=>{if(s1(L,l)){L.preventDefault();let z=r!==void 0?r:li(v)===li(N),H=()=>b(i,{replace:z,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p});m?T.startTransition(()=>H()):H()}},[v,b,N,r,o,c,l,i,f,h,g,p,m])}function IS(i){Ot(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let l=T.useRef(No(i)),r=T.useRef(!1),o=zt(),c=T.useMemo(()=>o1(o.search,r.current?null:l.current),[o.search]),f=Ku(),h=T.useCallback((g,p)=>{const m=No(typeof g=="function"?g(new URLSearchParams(c)):g);r.current=!0,f("?"+m,p)},[f,c]);return[c,h]}var j1=0,M1=()=>`__${String(++j1)}__`;function L1(){let{router:i}=yg("useSubmit"),{basename:l}=T.useContext(At),r=Wv(),o=i.fetch,c=i.navigate;return T.useCallback(async(f,h={})=>{let{action:g,method:p,encType:m,formData:b,body:v}=d1(f,l);if(h.navigate===!1){let N=h.fetcherKey||M1();await o(N,r,h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||p,formEncType:h.encType||m,flushSync:h.flushSync})}else await c(h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||p,formEncType:h.encType||m,replace:h.replace,state:h.state,fromRouteId:r,flushSync:h.flushSync,viewTransition:h.viewTransition})},[o,c,l,r])}function D1(i,{relative:l}={}){let{basename:r}=T.useContext(At),o=T.useContext(qt);Le(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),f={...fi(i||".",{relative:l})},h=zt();if(i==null){f.search=h.search;let g=new URLSearchParams(f.search),p=g.getAll("index");if(p.some(b=>b==="")){g.delete("index"),p.filter(v=>v).forEach(v=>g.append("index",v));let b=g.toString();f.search=b?`?${b}`:""}}return(!i||i===".")&&c.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(f.pathname=f.pathname==="/"?r:Xt([r,f.pathname])),li(f)}function U1(i,{relative:l}={}){let r=T.useContext(ug);Le(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=yg("useViewTransitionState"),c=fi(i,{relative:l});if(!r.isTransitioning)return!1;let f=ga(r.currentLocation.pathname,o)||r.currentLocation.pathname,h=ga(r.nextLocation.pathname,o)||r.nextLocation.pathname;return Du(c.pathname,h)!=null||Du(c.pathname,f)!=null}const vm=i=>{let l;const r=new Set,o=(m,b)=>{const v=typeof m=="function"?m(l):m;if(!Object.is(v,l)){const N=l;l=b??(typeof v!="object"||v===null)?v:Object.assign({},l,v),r.forEach(L=>L(l,N))}},c=()=>l,g={setState:o,getState:c,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=l=i(o,c,g);return g},k1=(i=>i?vm(i):vm),H1=i=>i;function B1(i,l=H1){const r=Pn.useSyncExternalStore(i.subscribe,Pn.useCallback(()=>l(i.getState()),[i,l]),Pn.useCallback(()=>l(i.getInitialState()),[i,l]));return Pn.useDebugValue(r),r}const bm=i=>{const l=k1(i),r=o=>B1(l,o);return Object.assign(r,l),r},Zo=(i=>i?bm(i):bm),Sm="/api/v1";class q1{constructor(){In(this,"token","");In(this,"baseUrl",Sm)}setToken(l){this.token=l}setBaseUrl(l){const r=l.trim();if(!r){this.baseUrl=Sm;return}this.baseUrl=r.endsWith("/api/v1")?r:`${r.replace(/\/+$/,"")}/api/v1`}getToken(){return this.token}getBaseUrl(){return this.baseUrl}headers(){const l={"Content-Type":"application/json"};return this.token&&(l.Authorization=`Bearer ${this.token}`),l}async request(l,r,o,c){let f=this.resolveUrl(r);if(c){const p=new URLSearchParams(c).toString();p&&(f+=`?${p}`)}const h=await fetch(f,{method:l,headers:this.headers(),body:o?JSON.stringify(o):void 0}),g=await h.json();if(!g.ok)throw new Y1(g.error||"Unknown error",h.status);return g.data}get(l,r){return this.request("GET",l,void 0,r)}post(l,r){return this.request("POST",l,r)}patch(l,r){return this.request("PATCH",l,r)}delete(l){return this.request("DELETE",l)}resolveUrl(l){const r=l.replace(/^\/+/,"");return this.baseUrl.startsWith("http://")||this.baseUrl.startsWith("https://")?new URL(r,`${this.baseUrl}/`).toString():`${this.baseUrl}/${r}`.replace(/([^:]\/)\/+/g,"$1")}}class Y1 extends Error{constructor(l,r){super(l),this.status=r,this.name="ApiError"}}const Qe=new q1,Ct=Zo(i=>({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none",login:(l,r)=>{Qe.setToken(l),r&&Qe.setBaseUrl(r),localStorage.setItem("cc_token",l),r&&localStorage.setItem("cc_server_url",r),i({token:l,serverUrl:r||"",isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"})},setManagedSession:(l,r,o)=>{Qe.setToken(l),Qe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!0,managedBy:o})},setDesktopSession:(l,r)=>{Ct.getState().setManagedSession(l,r,"electron")},logout:()=>{Ct.getState().desktopManaged||(Qe.setToken(""),Qe.setBaseUrl(""),localStorage.removeItem("cc_token"),localStorage.removeItem("cc_server_url"),i({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none"}))},init:()=>{const l=localStorage.getItem("cc_token")||"",r=localStorage.getItem("cc_server_url")||"";l&&(Qe.setToken(l),r&&Qe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"}))}})),G1=(i,l,r,o)=>{var f,h,g,p;const c=[r,{code:l,...o||{}}];if((h=(f=i==null?void 0:i.services)==null?void 0:f.logger)!=null&&h.forward)return i.services.logger.forward(c,"warn","react-i18next::",!0);fn(c[0])&&(c[0]=`react-i18next:: ${c[0]}`),(p=(g=i==null?void 0:i.services)==null?void 0:g.logger)!=null&&p.warn?i.services.logger.warn(...c):console!=null&&console.warn&&console.warn(...c)},xm={},jo=(i,l,r,o)=>{fn(r)&&xm[r]||(fn(r)&&(xm[r]=new Date),G1(i,l,r,o))},vg=(i,l)=>()=>{if(i.isInitialized)l();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),l()};i.on("initialized",r)}},Mo=(i,l,r)=>{i.loadNamespaces(l,vg(i,r))},Em=(i,l,r,o)=>{if(fn(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(l)>-1)return Mo(i,r,o);r.forEach(c=>{i.options.ns.indexOf(c)<0&&i.options.ns.push(c)}),i.loadLanguages(l,vg(i,o))},V1=(i,l,r={})=>!l.languages||!l.languages.length?(jo(l,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:l.languages}),!0):l.hasLoadedNamespace(i,{lng:r.lng,precheck:(o,c)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!c(o.isLanguageChangingTo,i))return!1}}),fn=i=>typeof i=="string",K1=i=>typeof i=="object"&&i!==null,X1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Q1={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Z1=i=>Q1[i],$1=i=>i.replace(X1,Z1);let Lo={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$1};const J1=(i={})=>{Lo={...Lo,...i}},F1=()=>Lo;let bg;const W1=i=>{bg=i},I1=()=>bg,P1={type:"3rdParty",init(i){J1(i.options.react),W1(i)}},eb=T.createContext();class tb{constructor(){this.usedNamespaces={}}addUsedNamespaces(l){l.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const ab=(i,l)=>{const r=T.useRef();return T.useEffect(()=>{r.current=i},[i,l]),r.current},Sg=(i,l,r,o)=>i.getFixedT(l,r,o),nb=(i,l,r,o)=>T.useCallback(Sg(i,l,r,o),[i,l,r,o]),xg=(i,l={})=>{var J,V,ue,K;const{i18n:r}=l,{i18n:o,defaultNS:c}=T.useContext(eb)||{},f=r||o||I1();if(f&&!f.reportNamespaces&&(f.reportNamespaces=new tb),!f){jo(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const te=(se,Ae)=>fn(Ae)?Ae:K1(Ae)&&fn(Ae.defaultValue)?Ae.defaultValue:Array.isArray(se)?se[se.length-1]:se,le=[te,{},!1];return le.t=te,le.i18n={},le.ready=!1,le}(J=f.options.react)!=null&&J.wait&&jo(f,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const h={...F1(),...f.options.react,...l},{useSuspense:g,keyPrefix:p}=h;let m=c||((V=f.options)==null?void 0:V.defaultNS);m=fn(m)?[m]:m||["translation"],(K=(ue=f.reportNamespaces).addUsedNamespaces)==null||K.call(ue,m);const b=(f.isInitialized||f.initializedStoreOnce)&&m.every(te=>V1(te,f,h)),v=nb(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),N=()=>v,L=()=>Sg(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),[z,H]=T.useState(N);let B=m.join();l.lng&&(B=`${l.lng}${B}`);const q=ab(B),X=T.useRef(!0);T.useEffect(()=>{const{bindI18n:te,bindI18nStore:le}=h;X.current=!0,!b&&!g&&(l.lng?Em(f,l.lng,m,()=>{X.current&&H(L)}):Mo(f,m,()=>{X.current&&H(L)})),b&&q&&q!==B&&X.current&&H(L);const se=()=>{X.current&&H(L)};return te&&(f==null||f.on(te,se)),le&&(f==null||f.store.on(le,se)),()=>{X.current=!1,f&&te&&(te==null||te.split(" ").forEach(Ae=>f.off(Ae,se))),le&&f&&le.split(" ").forEach(Ae=>f.store.off(Ae,se))}},[f,B]),T.useEffect(()=>{X.current&&b&&H(N)},[f,p,b]);const Q=[z,f,b];if(Q.t=z,Q.i18n=f,Q.ready=b,b||!b&&!g)return Q;throw new Promise(te=>{l.lng?Em(f,l.lng,m,()=>te()):Mo(f,m,()=>te())})};function Eg(i){var l,r,o="";if(typeof i=="string"||typeof i=="number")o+=i;else if(typeof i=="object")if(Array.isArray(i)){var c=i.length;for(l=0;l<c;l++)i[l]&&(r=Eg(i[l]))&&(o&&(o+=" "),o+=r)}else for(r in i)i[r]&&(o&&(o+=" "),o+=r);return o}function lb(){for(var i,l,r=0,o="",c=arguments.length;r<c;r++)(i=arguments[r])&&(l=Eg(i))&&(o&&(o+=" "),o+=l);return o}function He(...i){return lb(i)}function PS(i){return i?new Date(i).toLocaleString():"-"}let ii=typeof window<"u"&&window.desktop?"electron":"local_core";const $o=Zo(i=>({snapshot:null,setSnapshot:l=>i({snapshot:l})}));function dn(){return ii}function Eo(i){ii=i}function ib(){return ii==="electron"}function ub(){return!1}function To(i){$o.getState().setSnapshot(i)}function rb(){return $o.getState().snapshot}function sb(i){return!!(i!=null&&i.knowledge.some(l=>l.enabled!==!1))}function ob(i){return!!(i!=null&&i.schedulers.some(l=>l.enabled!==!1))}function cb(i,l){return!!(i!=null&&i.agents.some(r=>r.agentType===l))}function fb(i){return!!(i!=null&&i.agents.some(l=>l.agentType))}function db(i=rb()){const l=!!i,r=cb(i,"localcore-acp");return{desktopRuntime:l||ii==="electron"||ii==="local_core",desktopChat:r,chatRoute:l?r:!0,desktopWorkspace:l?fb(i):!0,knowledgeModule:l?sb(i):!0,schedulerModule:l?ob(i):!0}}function Jo(){const i=$o(l=>l.snapshot);return db(i)}function Tm(i){return i==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":i}function Rm(i){document.documentElement.classList.toggle("dark",i==="dark")}const Fo=Zo(i=>({theme:"dark",resolved:"dark",setTheme:l=>{const r=Tm(l);localStorage.setItem("cc_theme",l),Rm(r),i({theme:l,resolved:r})},init:()=>{const l=localStorage.getItem("cc_theme")||"dark",r=Tm(l);Rm(r),i({theme:l,resolved:r})}})),hb="modulepreload",mb=function(i,l){return new URL(i,l).href},_m={},Pe=function(l,r,o){let c=Promise.resolve();if(r&&r.length>0){let h=function(b){return Promise.all(b.map(v=>Promise.resolve(v).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};const g=document.getElementsByTagName("link"),p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=h(r.map(b=>{if(b=mb(b,o),b in _m)return;_m[b]=!0;const v=b.endsWith(".css"),N=v?'[rel="stylesheet"]':"";if(!!o)for(let H=g.length-1;H>=0;H--){const B=g[H];if(B.href===b&&(!v||B.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${N}`))return;const z=document.createElement("link");if(z.rel=v?"stylesheet":hb,v||(z.as="script"),z.crossOrigin="",z.href=b,m&&z.setAttribute("nonce",m),document.head.appendChild(z),v)return new Promise((H,B)=>{z.addEventListener("load",H),z.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${b}`)))})}))}function f(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return c.then(h=>{for(const g of h||[])g.status==="rejected"&&f(g.reason);return l().catch(f)})},gb=T.lazy(()=>Pe(()=>import("./Dashboard-COISXbQy.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),pb=T.lazy(()=>Pe(()=>import("./ThreadChat-D3s4GXGh.js"),__vite__mapDeps([9,10,11,5,12,13,14,15,16,17,18,19,20,21,8]),import.meta.url)),yb=T.lazy(()=>Pe(()=>import("./Chat-D94ODABB.js"),__vite__mapDeps([22,10,11,2,12,13,4,23,14,17,19,20,21]),import.meta.url)),vb=T.lazy(()=>Pe(()=>import("./Workspace-B7looTVo.js"),__vite__mapDeps([24,10,11,25,13,2,3,5,15,20,26,27]),import.meta.url)),bb=T.lazy(()=>Pe(()=>import("./ProjectList-DZKL4K9C.js"),__vite__mapDeps([28,1,2,3,4,6,29]),import.meta.url)),Sb=T.lazy(()=>Pe(()=>import("./ProjectDetail-FJ_bNXLF.js"),__vite__mapDeps([30,1,10,11,2,3,4,31,29,32,26,13,20,33]),import.meta.url)),xb=T.lazy(()=>Pe(()=>import("./SessionList-CU6drQ4N.js"),__vite__mapDeps([34,1,25,11,13,2,4,23,35,18,21]),import.meta.url)),Eb=T.lazy(()=>Pe(()=>import("./SessionChat-DpgSXF3m.js"),__vite__mapDeps([36,1,23,12,13,31,18,16,21]),import.meta.url)),Tb=T.lazy(()=>Pe(()=>import("./CronList-BYZ-x_bp.js"),__vite__mapDeps([37,1,10,11,25,13,2,3,26,33,19,20]),import.meta.url)),Rb=T.lazy(()=>Pe(()=>import("./Config-9lgzpTCp.js"),__vite__mapDeps([38,5,1,3,27,32]),import.meta.url)),_b=T.lazy(()=>Pe(()=>import("./Logs-D7HxZ8Nb.js"),__vite__mapDeps([39,1,25,11,13,3,31,35]),import.meta.url)),Ob=T.lazy(()=>Pe(()=>import("./KnowledgeHome-BKkubcwi.js"),__vite__mapDeps([40,10,11,2,19,20,17,26,7]),import.meta.url)),Cb=T.lazy(()=>Pe(()=>import("./KnowledgeDetail-DVxwrTLw.js"),__vite__mapDeps([41,2,31,17,20]),import.meta.url));class Ab{constructor(){In(this,"routes",new Map);In(this,"navItems",new Map)}registerRoute(l){this.routes.set(l.id,l)}registerNavItem(l){this.navItems.set(l.id,l)}listRoutes(){return[...this.routes.values()].sort((l,r)=>l.order-r.order)}listNavItems(){return[...this.navItems.values()].sort((l,r)=>l.order-r.order)}}function Pl(i,l,r="/"){return i?l:_.jsx(Ya,{to:r,replace:!0})}function zb(){const{name:i}=cg();return Ct(r=>r.desktopManaged)?_.jsx(Ya,{to:i?`/workspace?project=${encodeURIComponent(i)}`:"/workspace",replace:!0}):_.jsx(Sb,{})}function Om(){const{project:i,id:l}=cg();if(!Ct(c=>c.desktopManaged))return l&&i?_.jsx(Eb,{}):_.jsx(xb,{});const o=new URLSearchParams;return i&&o.set("project",i),l&&o.set("session",l),_.jsx(Ya,{to:`/chat${o.toString()?`?${o.toString()}`:""}`,replace:!0})}function Nb(i){[{id:"dashboard",index:!0,titleKey:"nav.dashboard",order:10,element:()=>_.jsx(gb,{})},{id:"chat",path:"chat",titleKey:"nav.chat",order:20,element:({features:r})=>Pl(r.chatRoute,r.desktopChat?_.jsx(pb,{}):_.jsx(yb,{}))},{id:"workspace",path:"workspace",titleKey:"nav.workspace",order:30,element:({features:r})=>Pl(r.desktopWorkspace,_.jsx(vb,{}))},{id:"knowledge",path:"knowledge",titleKey:"nav.knowledge",order:40,element:({features:r})=>Pl(r.knowledgeModule,_.jsx(Ob,{}))},{id:"knowledge-detail",path:"knowledge/:knowledgebaseId",titleKey:"nav.knowledge",order:41,element:({features:r})=>Pl(r.knowledgeModule,_.jsx(Cb,{}))},{id:"projects",path:"projects",titleKey:"nav.projects",order:50,element:({desktopManaged:r,features:o})=>r&&o.desktopWorkspace?_.jsx(Ya,{to:"/workspace",replace:!0}):_.jsx(bb,{})},{id:"project-detail",path:"projects/:name",titleKey:"nav.projects",order:51,element:()=>_.jsx(zb,{})},{id:"sessions",path:"sessions",titleKey:"nav.sessions",order:60,element:()=>_.jsx(Om,{})},{id:"session-detail",path:"sessions/:project/:id",titleKey:"nav.sessions",order:61,element:()=>_.jsx(Om,{})},{id:"cron",path:"cron",titleKey:"nav.cron",order:70,element:({features:r})=>Pl(r.schedulerModule,_.jsx(Tb,{}))},{id:"system",path:"system",titleKey:"nav.system",order:80,element:()=>_.jsx(Rb,{})},{id:"system-logs",path:"system/logs",titleKey:"nav.system",order:81,element:()=>_.jsx(_b,{})}].forEach(r=>i.registerRoute(r))}function wb(i){[{id:"dashboard",path:"/",labelKey:"nav.dashboard",icon:z0,order:10,end:!0},{id:"chat",path:"/chat",labelKey:"nav.chat",icon:k0,order:20,visible:({features:r})=>r.chatRoute,resolveLabelKey:({features:r,runtimeProvider:o})=>r.desktopChat?o==="electron"?"nav.chatDesktop":"nav.chat":"nav.chatWeb"},{id:"workspace",path:"/workspace",labelKey:"nav.workspace",icon:Z0,order:30,visible:({features:r})=>r.desktopWorkspace},{id:"knowledge",path:"/knowledge",labelKey:"nav.knowledge",icon:w0,order:40,visible:({features:r})=>r.knowledgeModule},{id:"projects",path:"/projects",labelKey:"nav.projects",icon:_0,order:50,visible:({desktopManaged:r})=>!r},{id:"sessions",path:"/sessions",labelKey:"nav.sessions",icon:D0,order:60,visible:({desktopManaged:r})=>!r},{id:"cron",path:"/cron",labelKey:"nav.cron",icon:T0,order:70,visible:({features:r})=>r.schedulerModule},{id:"system",path:"/system",labelKey:"nav.system",icon:G0,order:80}].forEach(r=>i.registerNavItem(r))}const Qu=new Ab;Nb(Qu);wb(Qu);function Tg({className:i,markClassName:l,showWordmark:r=!1}){const o=T.useId(),c=`${o}-bg`,f=`${o}-stroke`;return _.jsxs("div",{className:He("inline-flex items-center gap-3",i),children:[_.jsxs("svg",{className:He("h-8 w-8 shrink-0",l),viewBox:"0 0 64 64",role:"img","aria-label":"AgentDock",fill:"none",children:[_.jsxs("defs",{children:[_.jsxs("linearGradient",{id:c,x1:"7",y1:"5",x2:"57",y2:"59",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{className:"[stop-color:#FFFFFF] dark:[stop-color:#3A3A3C]"}),_.jsx("stop",{offset:"0.52",className:"[stop-color:#F5F5F7] dark:[stop-color:#2C2C2E]"}),_.jsx("stop",{offset:"1",className:"[stop-color:#E5E5EA] dark:[stop-color:#1C1C1E]"})]}),_.jsxs("linearGradient",{id:f,x1:"18",y1:"16",x2:"47",y2:"48",gradientUnits:"userSpaceOnUse",children:[_.jsx("stop",{stopColor:"#5AC8FA"}),_.jsx("stop",{offset:"0.44",stopColor:"#0A84FF"}),_.jsx("stop",{offset:"1",stopColor:"#007AFF"})]})]}),_.jsx("rect",{x:"4",y:"4",width:"56",height:"56",rx:"16",fill:`url(#${c})`,className:"stroke-black/10 dark:stroke-white/10",strokeWidth:"1.5"}),_.jsx("path",{d:"M14.5 45L25.3 20.1C26.1 18.1 28.9 18.1 29.8 20.1L40.8 45",stroke:`url(#${f})`,strokeWidth:"7.5",strokeLinecap:"round",strokeLinejoin:"round"}),_.jsx("path",{d:"M20.8 37.5H34.7",className:"stroke-white dark:stroke-white",strokeWidth:"5.25",strokeLinecap:"round"}),_.jsx("path",{d:"M33.8 20.2H37.4C45.1 20.2 50 25.6 50 32.5C50 39.4 45.1 44.8 37.4 44.8H33.8",stroke:`url(#${f})`,strokeWidth:"7",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.82"}),_.jsx("path",{d:"M34 25.5V39.5",className:"stroke-black/70 dark:stroke-black/80",strokeWidth:"3",strokeLinecap:"round",opacity:"0.18"})]}),r&&_.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"AgentDock"})]})}var Ro={};const ae=i=>typeof i=="string",ei=()=>{let i,l;const r=new Promise((o,c)=>{i=o,l=c});return r.resolve=i,r.reject=l,r},Cm=i=>i==null?"":""+i,jb=(i,l,r)=>{i.forEach(o=>{l[o]&&(r[o]=l[o])})},Mb=/###/g,Am=i=>i&&i.indexOf("###")>-1?i.replace(Mb,"."):i,zm=i=>!i||ae(i),ti=(i,l,r)=>{const o=ae(l)?l.split("."):l;let c=0;for(;c<o.length-1;){if(zm(i))return{};const f=Am(o[c]);!i[f]&&r&&(i[f]=new r),Object.prototype.hasOwnProperty.call(i,f)?i=i[f]:i={},++c}return zm(i)?{}:{obj:i,k:Am(o[c])}},Nm=(i,l,r)=>{const{obj:o,k:c}=ti(i,l,Object);if(o!==void 0||l.length===1){o[c]=r;return}let f=l[l.length-1],h=l.slice(0,l.length-1),g=ti(i,h,Object);for(;g.obj===void 0&&h.length;)f=`${h[h.length-1]}.${f}`,h=h.slice(0,h.length-1),g=ti(i,h,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${f}`]<"u"&&(g.obj=void 0);g.obj[`${g.k}.${f}`]=r},Lb=(i,l,r,o)=>{const{obj:c,k:f}=ti(i,l,Object);c[f]=c[f]||[],c[f].push(r)},ku=(i,l)=>{const{obj:r,k:o}=ti(i,l);if(r&&Object.prototype.hasOwnProperty.call(r,o))return r[o]},Db=(i,l,r)=>{const o=ku(i,r);return o!==void 0?o:ku(l,r)},Rg=(i,l,r)=>{for(const o in l)o!=="__proto__"&&o!=="constructor"&&(o in i?ae(i[o])||i[o]instanceof String||ae(l[o])||l[o]instanceof String?r&&(i[o]=l[o]):Rg(i[o],l[o],r):i[o]=l[o]);return i},sn=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ub={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const kb=i=>ae(i)?i.replace(/[&<>"'\/]/g,l=>Ub[l]):i;class Hb{constructor(l){this.capacity=l,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(l){const r=this.regExpMap.get(l);if(r!==void 0)return r;const o=new RegExp(l);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(l,o),this.regExpQueue.push(l),o}}const Bb=[" ",",","?","!",";"],qb=new Hb(20),Yb=(i,l,r)=>{l=l||"",r=r||"";const o=Bb.filter(h=>l.indexOf(h)<0&&r.indexOf(h)<0);if(o.length===0)return!0;const c=qb.getRegExp(`(${o.map(h=>h==="?"?"\\?":h).join("|")})`);let f=!c.test(i);if(!f){const h=i.indexOf(r);h>0&&!c.test(i.substring(0,h))&&(f=!0)}return f},Do=(i,l,r=".")=>{if(!i)return;if(i[l])return Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;const o=l.split(r);let c=i;for(let f=0;f<o.length;){if(!c||typeof c!="object")return;let h,g="";for(let p=f;p<o.length;++p)if(p!==f&&(g+=r),g+=o[p],h=c[g],h!==void 0){if(["string","number","boolean"].indexOf(typeof h)>-1&&p<o.length-1)continue;f+=p-f+1;break}c=h}return c},ui=i=>i==null?void 0:i.replace(/_/g,"-"),Gb={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,l){var r,o;(o=(r=console==null?void 0:console[i])==null?void 0:r.apply)==null||o.call(r,console,l)}};class Hu{constructor(l,r={}){this.init(l,r)}init(l,r={}){this.prefix=r.prefix||"i18next:",this.logger=l||Gb,this.options=r,this.debug=r.debug}log(...l){return this.forward(l,"log","",!0)}warn(...l){return this.forward(l,"warn","",!0)}error(...l){return this.forward(l,"error","")}deprecate(...l){return this.forward(l,"warn","WARNING DEPRECATED: ",!0)}forward(l,r,o,c){return c&&!this.debug?null:(ae(l[0])&&(l[0]=`${o}${this.prefix} ${l[0]}`),this.logger[r](l))}create(l){return new Hu(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new Hu(this.logger,l)}}var Ft=new Hu;class Zu{constructor(){this.observers={}}on(l,r){return l.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(r)||0;this.observers[o].set(r,c+1)}),this}off(l,r){if(this.observers[l]){if(!r){delete this.observers[l];return}this.observers[l].delete(r)}}emit(l,...r){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c.apply(c,[l,...r])})}}class wm extends Zu{constructor(l,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=l||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(l){this.options.ns.indexOf(l)<0&&this.options.ns.push(l)}removeNamespaces(l){const r=this.options.ns.indexOf(l);r>-1&&this.options.ns.splice(r,1)}getResource(l,r,o,c={}){var m,b;const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,h=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;l.indexOf(".")>-1?g=l.split("."):(g=[l,r],o&&(Array.isArray(o)?g.push(...o):ae(o)&&f?g.push(...o.split(f)):g.push(o)));const p=ku(this.data,g);return!p&&!r&&!o&&l.indexOf(".")>-1&&(l=g[0],r=g[1],o=g.slice(2).join(".")),p||!h||!ae(o)?p:Do((b=(m=this.data)==null?void 0:m[l])==null?void 0:b[r],o,f)}addResource(l,r,o,c,f={silent:!1}){const h=f.keySeparator!==void 0?f.keySeparator:this.options.keySeparator;let g=[l,r];o&&(g=g.concat(h?o.split(h):o)),l.indexOf(".")>-1&&(g=l.split("."),c=r,r=g[1]),this.addNamespaces(r),Nm(this.data,g,c),f.silent||this.emit("added",l,r,o,c)}addResources(l,r,o,c={silent:!1}){for(const f in o)(ae(o[f])||Array.isArray(o[f]))&&this.addResource(l,r,f,o[f],{silent:!0});c.silent||this.emit("added",l,r,o)}addResourceBundle(l,r,o,c,f,h={silent:!1,skipCopy:!1}){let g=[l,r];l.indexOf(".")>-1&&(g=l.split("."),c=o,o=r,r=g[1]),this.addNamespaces(r);let p=ku(this.data,g)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?Rg(p,o,f):p={...p,...o},Nm(this.data,g,p),h.silent||this.emit("added",l,r,o)}removeResourceBundle(l,r){this.hasResourceBundle(l,r)&&delete this.data[l][r],this.removeNamespaces(r),this.emit("removed",l,r)}hasResourceBundle(l,r){return this.getResource(l,r)!==void 0}getResourceBundle(l,r){return r||(r=this.options.defaultNS),this.getResource(l,r)}getDataByLanguage(l){return this.data[l]}hasLanguageSomeTranslations(l){const r=this.getDataByLanguage(l);return!!(r&&Object.keys(r)||[]).find(c=>r[c]&&Object.keys(r[c]).length>0)}toJSON(){return this.data}}var _g={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,l,r,o,c){return i.forEach(f=>{var h;l=((h=this.processors[f])==null?void 0:h.process(l,r,o,c))??l}),l}};const Og=Symbol("i18next/PATH_KEY");function Vb(){const i=[],l=Object.create(null);let r;return l.get=(o,c)=>{var f;return(f=r==null?void 0:r.revoke)==null||f.call(r),c===Og?i:(i.push(c),r=Proxy.revocable(o,l),r.proxy)},Proxy.revocable(Object.create(null),l).proxy}function el(i,l){const{[Og]:r}=i(Vb()),o=(l==null?void 0:l.keySeparator)??".",c=(l==null?void 0:l.nsSeparator)??":";if(r.length>1&&c){const f=l==null?void 0:l.ns,h=Array.isArray(f)?f:null;if(h&&h.length>1&&h.slice(1).includes(r[0]))return`${r[0]}${c}${r.slice(1).join(o)}`}return r.join(o)}const jm={},_o=i=>!ae(i)&&typeof i!="boolean"&&typeof i!="number";class Bu extends Zu{constructor(l,r={}){super(),jb(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],l,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ft.create("translator")}changeLanguage(l){l&&(this.language=l)}exists(l,r={interpolation:{}}){const o={...r};if(l==null)return!1;const c=this.resolve(l,o);if((c==null?void 0:c.res)===void 0)return!1;const f=_o(c.res);return!(o.returnObjects===!1&&f)}extractFromKey(l,r){let o=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let f=r.ns||this.options.defaultNS||[];const h=o&&l.indexOf(o)>-1,g=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Yb(l,o,c);if(h&&!g){const p=l.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:l,namespaces:ae(f)?[f]:f};const m=l.split(o);(o!==c||o===c&&this.options.ns.indexOf(m[0])>-1)&&(f=m.shift()),l=m.join(c)}return{key:l,namespaces:ae(f)?[f]:f}}translate(l,r,o){let c=typeof r=="object"?{...r}:r;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),l==null)return"";typeof l=="function"&&(l=el(l,{...this.options,...c})),Array.isArray(l)||(l=[String(l)]),l=l.map(ze=>typeof ze=="function"?el(ze,{...this.options,...c}):String(ze));const f=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,h=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:g,namespaces:p}=this.extractFromKey(l[l.length-1],c),m=p[p.length-1];let b=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;b===void 0&&(b=":");const v=c.lng||this.language,N=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((v==null?void 0:v.toLowerCase())==="cimode")return N?f?{res:`${m}${b}${g}`,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:`${m}${b}${g}`:f?{res:g,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:g;const L=this.resolve(l,c);let z=L==null?void 0:L.res;const H=(L==null?void 0:L.usedKey)||g,B=(L==null?void 0:L.exactUsedKey)||g,q=["[object Number]","[object Function]","[object RegExp]"],X=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,Q=!this.i18nFormat||this.i18nFormat.handleAsObject,J=c.count!==void 0&&!ae(c.count),V=Bu.hasDefaultValue(c),ue=J?this.pluralResolver.getSuffix(v,c.count,c):"",K=c.ordinal&&J?this.pluralResolver.getSuffix(v,c.count,{ordinal:!1}):"",te=J&&!c.ordinal&&c.count===0,le=te&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${ue}`]||c[`defaultValue${K}`]||c.defaultValue;let se=z;Q&&!z&&V&&(se=le);const Ae=_o(se),Fe=Object.prototype.toString.apply(se);if(Q&&se&&Ae&&q.indexOf(Fe)<0&&!(ae(X)&&Array.isArray(se))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const ze=this.options.returnedObjectHandler?this.options.returnedObjectHandler(H,se,{...c,ns:p}):`key '${g} (${this.language})' returned an object instead of string.`;return f?(L.res=ze,L.usedParams=this.getUsedParamsDetails(c),L):ze}if(h){const ze=Array.isArray(se),je=ze?[]:{},De=ze?B:H;for(const j in se)if(Object.prototype.hasOwnProperty.call(se,j)){const Y=`${De}${h}${j}`;V&&!z?je[j]=this.translate(Y,{...c,defaultValue:_o(le)?le[j]:void 0,joinArrays:!1,ns:p}):je[j]=this.translate(Y,{...c,joinArrays:!1,ns:p}),je[j]===Y&&(je[j]=se[j])}z=je}}else if(Q&&ae(X)&&Array.isArray(z))z=z.join(X),z&&(z=this.extendTranslation(z,l,c,o));else{let ze=!1,je=!1;!this.isValidLookup(z)&&V&&(ze=!0,z=le),this.isValidLookup(z)||(je=!0,z=g);const j=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&je?void 0:z,Y=V&&le!==z&&this.options.updateMissing;if(je||ze||Y){if(this.logger.log(Y?"updateKey":"missingKey",v,m,g,Y?le:z),h){const x=this.resolve(g,{...c,keySeparator:!1});x&&x.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let P=[];const pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(let x=0;x<pe.length;x++)P.push(pe[x]);else this.options.saveMissingTo==="all"?P=this.languageUtils.toResolveHierarchy(c.lng||this.language):P.push(c.lng||this.language);const Se=(x,D,G)=>{var ne;const Z=V&&G!==z?G:j;this.options.missingKeyHandler?this.options.missingKeyHandler(x,m,D,Z,Y,c):(ne=this.backendConnector)!=null&&ne.saveMissing&&this.backendConnector.saveMissing(x,m,D,Z,Y,c),this.emit("missingKey",x,m,D,z)};this.options.saveMissing&&(this.options.saveMissingPlurals&&J?P.forEach(x=>{const D=this.pluralResolver.getSuffixes(x,c);te&&c[`defaultValue${this.options.pluralSeparator}zero`]&&D.indexOf(`${this.options.pluralSeparator}zero`)<0&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(G=>{Se([x],g+G,c[`defaultValue${G}`]||le)})}):Se(P,g,le))}z=this.extendTranslation(z,l,c,L,o),je&&z===g&&this.options.appendNamespaceToMissingKey&&(z=`${m}${b}${g}`),(je||ze)&&this.options.parseMissingKeyHandler&&(z=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}${b}${g}`:g,ze?z:void 0,c))}return f?(L.res=z,L.usedParams=this.getUsedParamsDetails(c),L):z}extendTranslation(l,r,o,c,f){var p,m;if((p=this.i18nFormat)!=null&&p.parse)l=this.i18nFormat.parse(l,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const b=ae(l)&&(((m=o==null?void 0:o.interpolation)==null?void 0:m.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let v;if(b){const L=l.match(this.interpolator.nestingRegexp);v=L&&L.length}let N=o.replace&&!ae(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(N={...this.options.interpolation.defaultVariables,...N}),l=this.interpolator.interpolate(l,N,o.lng||this.language||c.usedLng,o),b){const L=l.match(this.interpolator.nestingRegexp),z=L&&L.length;v<z&&(o.nest=!1)}!o.lng&&c&&c.res&&(o.lng=this.language||c.usedLng),o.nest!==!1&&(l=this.interpolator.nest(l,(...L)=>(f==null?void 0:f[0])===L[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${L[0]} in key: ${r[0]}`),null):this.translate(...L,r),o)),o.interpolation&&this.interpolator.reset()}const h=o.postProcess||this.options.postProcess,g=ae(h)?[h]:h;return l!=null&&(g!=null&&g.length)&&o.applyPostProcessor!==!1&&(l=_g.handle(g,l,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),l}resolve(l,r={}){let o,c,f,h,g;return ae(l)&&(l=[l]),Array.isArray(l)&&(l=l.map(p=>typeof p=="function"?el(p,{...this.options,...r}):p)),l.forEach(p=>{if(this.isValidLookup(o))return;const m=this.extractFromKey(p,r),b=m.key;c=b;let v=m.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const N=r.count!==void 0&&!ae(r.count),L=N&&!r.ordinal&&r.count===0,z=r.context!==void 0&&(ae(r.context)||typeof r.context=="number")&&r.context!=="",H=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);v.forEach(B=>{var q,X;this.isValidLookup(o)||(g=B,!jm[`${H[0]}-${B}`]&&((q=this.utils)!=null&&q.hasLoadedNamespace)&&!((X=this.utils)!=null&&X.hasLoadedNamespace(g))&&(jm[`${H[0]}-${B}`]=!0,this.logger.warn(`key "${c}" for languages "${H.join(", ")}" won't get resolved as namespace "${g}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),H.forEach(Q=>{var ue;if(this.isValidLookup(o))return;h=Q;const J=[b];if((ue=this.i18nFormat)!=null&&ue.addLookupKeys)this.i18nFormat.addLookupKeys(J,b,Q,B,r);else{let K;N&&(K=this.pluralResolver.getSuffix(Q,r.count,r));const te=`${this.options.pluralSeparator}zero`,le=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(N&&(r.ordinal&&K.indexOf(le)===0&&J.push(b+K.replace(le,this.options.pluralSeparator)),J.push(b+K),L&&J.push(b+te)),z){const se=`${b}${this.options.contextSeparator||"_"}${r.context}`;J.push(se),N&&(r.ordinal&&K.indexOf(le)===0&&J.push(se+K.replace(le,this.options.pluralSeparator)),J.push(se+K),L&&J.push(se+te))}}let V;for(;V=J.pop();)this.isValidLookup(o)||(f=V,o=this.getResource(Q,B,V,r))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:g}}isValidLookup(l){return l!==void 0&&!(!this.options.returnNull&&l===null)&&!(!this.options.returnEmptyString&&l==="")}getResource(l,r,o,c={}){var f;return(f=this.i18nFormat)!=null&&f.getResource?this.i18nFormat.getResource(l,r,o,c):this.resourceStore.getResource(l,r,o,c)}getUsedParamsDetails(l={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=l.replace&&!ae(l.replace);let c=o?l.replace:l;if(o&&typeof l.count<"u"&&(c.count=l.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const f of r)delete c[f]}return c}static hasDefaultValue(l){const r="defaultValue";for(const o in l)if(Object.prototype.hasOwnProperty.call(l,o)&&r===o.substring(0,r.length)&&l[o]!==void 0)return!0;return!1}}class Mm{constructor(l){this.options=l,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ft.create("languageUtils")}getScriptPartFromCode(l){if(l=ui(l),!l||l.indexOf("-")<0)return null;const r=l.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(l){if(l=ui(l),!l||l.indexOf("-")<0)return l;const r=l.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(l){if(ae(l)&&l.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(l)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?l.toLowerCase():l)}return this.options.cleanCode||this.options.lowerCaseLng?l.toLowerCase():l}isSupportedCode(l){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(l=this.getLanguagePartFromCode(l)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(l)>-1}getBestMatchFromCodes(l){if(!l)return null;let r;return l.forEach(o=>{if(r)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(r=c)}),!r&&this.options.supportedLngs&&l.forEach(o=>{if(r)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return r=c;const f=this.getLanguagePartFromCode(o);if(this.isSupportedCode(f))return r=f;r=this.options.supportedLngs.find(h=>{if(h===f)return h;if(!(h.indexOf("-")<0&&f.indexOf("-")<0)&&(h.indexOf("-")>0&&f.indexOf("-")<0&&h.substring(0,h.indexOf("-"))===f||h.indexOf(f)===0&&f.length>1))return h})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(l,r){if(!l)return[];if(typeof l=="function"&&(l=l(r)),ae(l)&&(l=[l]),Array.isArray(l))return l;if(!r)return l.default||[];let o=l[r];return o||(o=l[this.getScriptPartFromCode(r)]),o||(o=l[this.formatLanguageCode(r)]),o||(o=l[this.getLanguagePartFromCode(r)]),o||(o=l.default),o||[]}toResolveHierarchy(l,r){const o=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],l),c=[],f=h=>{h&&(this.isSupportedCode(h)?c.push(h):this.logger.warn(`rejecting language code not found in supportedLngs: ${h}`))};return ae(l)&&(l.indexOf("-")>-1||l.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&f(this.formatLanguageCode(l)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&f(this.getScriptPartFromCode(l)),this.options.load!=="currentOnly"&&f(this.getLanguagePartFromCode(l))):ae(l)&&f(this.formatLanguageCode(l)),o.forEach(h=>{c.indexOf(h)<0&&f(this.formatLanguageCode(h))}),c}}const Lm={zero:0,one:1,two:2,few:3,many:4,other:5},Dm={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Kb{constructor(l,r={}){this.languageUtils=l,this.options=r,this.logger=Ft.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(l,r={}){const o=ui(l==="dev"?"en":l),c=r.ordinal?"ordinal":"cardinal",f=JSON.stringify({cleanedCode:o,type:c});if(f in this.pluralRulesCache)return this.pluralRulesCache[f];let h;try{h=new Intl.PluralRules(o,{type:c})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Dm;if(!l.match(/-|_/))return Dm;const p=this.languageUtils.getLanguagePartFromCode(l);h=this.getRule(p,r)}return this.pluralRulesCache[f]=h,h}needsPlural(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),(o==null?void 0:o.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(l,r,o={}){return this.getSuffixes(l,o).map(c=>`${r}${c}`)}getSuffixes(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),o?o.resolvedOptions().pluralCategories.sort((c,f)=>Lm[c]-Lm[f]).map(c=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(l,r,o={}){const c=this.getRule(l,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(r)}`:(this.logger.warn(`no plural rule found for: ${l}`),this.getSuffix("dev",r,o))}}const Um=(i,l,r,o=".",c=!0)=>{let f=Db(i,l,r);return!f&&c&&ae(r)&&(f=Do(i,r,o),f===void 0&&(f=Do(l,r,o))),f},Oo=i=>i.replace(/\$/g,"$$$$");class km{constructor(l={}){var r;this.logger=Ft.create("interpolator"),this.options=l,this.format=((r=l==null?void 0:l.interpolation)==null?void 0:r.format)||(o=>o),this.init(l)}init(l={}){l.interpolation||(l.interpolation={escapeValue:!0});const{escape:r,escapeValue:o,useRawValueToEscape:c,prefix:f,prefixEscaped:h,suffix:g,suffixEscaped:p,formatSeparator:m,unescapeSuffix:b,unescapePrefix:v,nestingPrefix:N,nestingPrefixEscaped:L,nestingSuffix:z,nestingSuffixEscaped:H,nestingOptionsSeparator:B,maxReplaces:q,alwaysFormat:X}=l.interpolation;this.escape=r!==void 0?r:kb,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=f?sn(f):h||"{{",this.suffix=g?sn(g):p||"}}",this.formatSeparator=m||",",this.unescapePrefix=b?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=N?sn(N):L||sn("$t("),this.nestingSuffix=z?sn(z):H||sn(")"),this.nestingOptionsSeparator=B||",",this.maxReplaces=q||1e3,this.alwaysFormat=X!==void 0?X:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const l=(r,o)=>(r==null?void 0:r.source)===o?(r.lastIndex=0,r):new RegExp(o,"g");this.regexp=l(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=l(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=l(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(l,r,o,c){var L;let f,h,g;const p=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=z=>{if(z.indexOf(this.formatSeparator)<0){const X=Um(r,p,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(X,void 0,o,{...c,...r,interpolationkey:z}):X}const H=z.split(this.formatSeparator),B=H.shift().trim(),q=H.join(this.formatSeparator).trim();return this.format(Um(r,p,B,this.options.keySeparator,this.options.ignoreJSONStructure),q,o,{...c,...r,interpolationkey:B})};this.resetRegExp();const b=(c==null?void 0:c.missingInterpolationHandler)||this.options.missingInterpolationHandler,v=((L=c==null?void 0:c.interpolation)==null?void 0:L.skipOnVariables)!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:z=>Oo(z)},{regex:this.regexp,safeValue:z=>this.escapeValue?Oo(this.escape(z)):Oo(z)}].forEach(z=>{for(g=0;f=z.regex.exec(l);){const H=f[1].trim();if(h=m(H),h===void 0)if(typeof b=="function"){const q=b(l,f,c);h=ae(q)?q:""}else if(c&&Object.prototype.hasOwnProperty.call(c,H))h="";else if(v){h=f[0];continue}else this.logger.warn(`missed to pass in variable ${H} for interpolating ${l}`),h="";else!ae(h)&&!this.useRawValueToEscape&&(h=Cm(h));const B=z.safeValue(h);if(l=l.replace(f[0],B),v?(z.regex.lastIndex+=h.length,z.regex.lastIndex-=f[0].length):z.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),l}nest(l,r,o={}){let c,f,h;const g=(p,m)=>{const b=this.nestingOptionsSeparator;if(p.indexOf(b)<0)return p;const v=p.split(new RegExp(`${sn(b)}[ ]*{`));let N=`{${v[1]}`;p=v[0],N=this.interpolate(N,h);const L=N.match(/'/g),z=N.match(/"/g);(((L==null?void 0:L.length)??0)%2===0&&!z||((z==null?void 0:z.length)??0)%2!==0)&&(N=N.replace(/'/g,'"'));try{h=JSON.parse(N),m&&(h={...m,...h})}catch(H){return this.logger.warn(`failed parsing options string in nesting for key ${p}`,H),`${p}${b}${N}`}return h.defaultValue&&h.defaultValue.indexOf(this.prefix)>-1&&delete h.defaultValue,p};for(;c=this.nestingRegexp.exec(l);){let p=[];h={...o},h=h.replace&&!ae(h.replace)?h.replace:h,h.applyPostProcessor=!1,delete h.defaultValue;const m=/{.*}/.test(c[1])?c[1].lastIndexOf("}")+1:c[1].indexOf(this.formatSeparator);if(m!==-1&&(p=c[1].slice(m).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,m)),f=r(g.call(this,c[1].trim(),h),h),f&&c[0]===l&&!ae(f))return f;ae(f)||(f=Cm(f)),f||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${l}`),f=""),p.length&&(f=p.reduce((b,v)=>this.format(b,v,o.lng,{...o,interpolationkey:c[1].trim()}),f.trim())),l=l.replace(c[0],f),this.regexp.lastIndex=0}return l}}const Xb=i=>{let l=i.toLowerCase().trim();const r={};if(i.indexOf("(")>-1){const o=i.split("(");l=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);l==="currency"&&c.indexOf(":")<0?r.currency||(r.currency=c.trim()):l==="relativetime"&&c.indexOf(":")<0?r.range||(r.range=c.trim()):c.split(";").forEach(h=>{if(h){const[g,...p]=h.split(":"),m=p.join(":").trim().replace(/^'+|'+$/g,""),b=g.trim();r[b]||(r[b]=m),m==="false"&&(r[b]=!1),m==="true"&&(r[b]=!0),isNaN(m)||(r[b]=parseInt(m,10))}})}return{formatName:l,formatOptions:r}},Hm=i=>{const l={};return(r,o,c)=>{let f=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(f={...f,[c.interpolationkey]:void 0});const h=o+JSON.stringify(f);let g=l[h];return g||(g=i(ui(o),c),l[h]=g),g(r)}},Qb=i=>(l,r,o)=>i(ui(r),o)(l);class Zb{constructor(l={}){this.logger=Ft.create("formatter"),this.options=l,this.init(l)}init(l,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const o=r.cacheInBuiltFormats?Hm:Qb;this.formats={number:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f});return g=>h.format(g)}),currency:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f,style:"currency"});return g=>h.format(g)}),datetime:o((c,f)=>{const h=new Intl.DateTimeFormat(c,{...f});return g=>h.format(g)}),relativetime:o((c,f)=>{const h=new Intl.RelativeTimeFormat(c,{...f});return g=>h.format(g,f.range||"day")}),list:o((c,f)=>{const h=new Intl.ListFormat(c,{...f});return g=>h.format(g)})}}add(l,r){this.formats[l.toLowerCase().trim()]=r}addCached(l,r){this.formats[l.toLowerCase().trim()]=Hm(r)}format(l,r,o,c={}){const f=r.split(this.formatSeparator);if(f.length>1&&f[0].indexOf("(")>1&&f[0].indexOf(")")<0&&f.find(g=>g.indexOf(")")>-1)){const g=f.findIndex(p=>p.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,g)].join(this.formatSeparator)}return f.reduce((g,p)=>{var v;const{formatName:m,formatOptions:b}=Xb(p);if(this.formats[m]){let N=g;try{const L=((v=c==null?void 0:c.formatParams)==null?void 0:v[c.interpolationkey])||{},z=L.locale||L.lng||c.locale||c.lng||o;N=this.formats[m](g,z,{...b,...c,...L})}catch(L){this.logger.warn(L)}return N}else this.logger.warn(`there was no format function for ${m}`);return g},l)}}const $b=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class Jb extends Zu{constructor(l,r,o,c={}){var f,h;super(),this.backend=l,this.store=r,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=Ft.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],(h=(f=this.backend)==null?void 0:f.init)==null||h.call(f,o,c.backend,c)}queueLoad(l,r,o,c){const f={},h={},g={},p={};return l.forEach(m=>{let b=!0;r.forEach(v=>{const N=`${m}|${v}`;!o.reload&&this.store.hasResourceBundle(m,v)?this.state[N]=2:this.state[N]<0||(this.state[N]===1?h[N]===void 0&&(h[N]=!0):(this.state[N]=1,b=!1,h[N]===void 0&&(h[N]=!0),f[N]===void 0&&(f[N]=!0),p[v]===void 0&&(p[v]=!0)))}),b||(g[m]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(p)}}loaded(l,r,o){const c=l.split("|"),f=c[0],h=c[1];r&&this.emit("failedLoading",f,h,r),!r&&o&&this.store.addResourceBundle(f,h,o,void 0,void 0,{skipCopy:!0}),this.state[l]=r?-1:2,r&&o&&(this.state[l]=0);const g={};this.queue.forEach(p=>{Lb(p.loaded,[f],h),$b(p,l),r&&p.errors.push(r),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(m=>{g[m]||(g[m]={});const b=p.loaded[m];b.length&&b.forEach(v=>{g[m][v]===void 0&&(g[m][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(p=>!p.done)}read(l,r,o,c=0,f=this.retryTimeout,h){if(!l.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:l,ns:r,fcName:o,tried:c,wait:f,callback:h});return}this.readingCalls++;const g=(m,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(m&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,l,r,o,c+1,f*2,h)},f);return}h(m,b)},p=this.backend[o].bind(this.backend);if(p.length===2){try{const m=p(l,r);m&&typeof m.then=="function"?m.then(b=>g(null,b)).catch(g):g(null,m)}catch(m){g(m)}return}return p(l,r,g)}prepareLoading(l,r,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();ae(l)&&(l=this.languageUtils.toResolveHierarchy(l)),ae(r)&&(r=[r]);const f=this.queueLoad(l,r,o,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(h=>{this.loadOne(h)})}load(l,r,o){this.prepareLoading(l,r,{},o)}reload(l,r,o){this.prepareLoading(l,r,{reload:!0},o)}loadOne(l,r=""){const o=l.split("|"),c=o[0],f=o[1];this.read(c,f,"read",void 0,void 0,(h,g)=>{h&&this.logger.warn(`${r}loading namespace ${f} for language ${c} failed`,h),!h&&g&&this.logger.log(`${r}loaded namespace ${f} for language ${c}`,g),this.loaded(l,h,g)})}saveMissing(l,r,o,c,f,h={},g=()=>{}){var p,m,b,v,N;if((m=(p=this.services)==null?void 0:p.utils)!=null&&m.hasLoadedNamespace&&!((v=(b=this.services)==null?void 0:b.utils)!=null&&v.hasLoadedNamespace(r))){this.logger.warn(`did not save key "${o}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if((N=this.backend)!=null&&N.create){const L={...h,isUpdate:f},z=this.backend.create.bind(this.backend);if(z.length<6)try{let H;z.length===5?H=z(l,r,o,c,L):H=z(l,r,o,c),H&&typeof H.then=="function"?H.then(B=>g(null,B)).catch(g):g(null,H)}catch(H){g(H)}else z(l,r,o,c,g,L)}!l||!l[0]||this.store.addResource(l[0],r,o,c)}}}const Co=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let l={};if(typeof i[1]=="object"&&(l=i[1]),ae(i[1])&&(l.defaultValue=i[1]),ae(i[2])&&(l.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const r=i[3]||i[2];Object.keys(r).forEach(o=>{l[o]=r[o]})}return l},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Bm=i=>{var l,r;return ae(i.ns)&&(i.ns=[i.ns]),ae(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),ae(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),((r=(l=i.supportedLngs)==null?void 0:l.indexOf)==null?void 0:r.call(l,"cimode"))<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i},wu=()=>{},Fb=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})},Cg="__i18next_supportNoticeShown",Wb=()=>!!(typeof globalThis<"u"&&globalThis[Cg]||typeof process<"u"&&Ro&&Ro.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&Ro),Ib=()=>{typeof globalThis<"u"&&(globalThis[Cg]=!0)},Pb=i=>{var l,r,o,c,f,h,g,p,m,b,v,N,L;return!!(((o=(r=(l=i==null?void 0:i.modules)==null?void 0:l.backend)==null?void 0:r.name)==null?void 0:o.indexOf("Locize"))>0||((g=(h=(f=(c=i==null?void 0:i.modules)==null?void 0:c.backend)==null?void 0:f.constructor)==null?void 0:h.name)==null?void 0:g.indexOf("Locize"))>0||(m=(p=i==null?void 0:i.options)==null?void 0:p.backend)!=null&&m.backends&&i.options.backend.backends.some(z=>{var H,B,q;return((H=z==null?void 0:z.name)==null?void 0:H.indexOf("Locize"))>0||((q=(B=z==null?void 0:z.constructor)==null?void 0:B.name)==null?void 0:q.indexOf("Locize"))>0})||(v=(b=i==null?void 0:i.options)==null?void 0:b.backend)!=null&&v.projectId||(L=(N=i==null?void 0:i.options)==null?void 0:N.backend)!=null&&L.backendOptions&&i.options.backend.backendOptions.some(z=>z==null?void 0:z.projectId))};class ai extends Zu{constructor(l={},r){if(super(),this.options=Bm(l),this.services={},this.logger=Ft,this.modules={external:[]},Fb(this),r&&!this.isInitialized&&!l.isClone){if(!this.options.initAsync)return this.init(l,r),this;setTimeout(()=>{this.init(l,r)},0)}}init(l={},r){this.isInitializing=!0,typeof l=="function"&&(r=l,l={}),l.defaultNS==null&&l.ns&&(ae(l.ns)?l.defaultNS=l.ns:l.ns.indexOf("translation")<0&&(l.defaultNS=l.ns[0]));const o=Co();this.options={...o,...this.options,...Bm(l)},this.options.interpolation={...o.interpolation,...this.options.interpolation},l.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=l.keySeparator),l.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=l.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Pb(this)&&!Wb()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),Ib());const c=m=>m?typeof m=="function"?new m:m:null;if(!this.options.isClone){this.modules.logger?Ft.init(c(this.modules.logger),this.options):Ft.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:m=Zb;const b=new Mm(this.options);this.store=new wm(this.options.resources,this.options);const v=this.services;v.logger=Ft,v.resourceStore=this.store,v.languageUtils=b,v.pluralResolver=new Kb(b,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),m&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(v.formatter=c(m),v.formatter.init&&v.formatter.init(v,this.options),this.options.interpolation.format=v.formatter.format.bind(v.formatter)),v.interpolator=new km(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new Jb(c(this.modules.backend),v.resourceStore,v,this.options),v.backendConnector.on("*",(L,...z)=>{this.emit(L,...z)}),this.modules.languageDetector&&(v.languageDetector=c(this.modules.languageDetector),v.languageDetector.init&&v.languageDetector.init(v,this.options.detection,this.options)),this.modules.i18nFormat&&(v.i18nFormat=c(this.modules.i18nFormat),v.i18nFormat.init&&v.i18nFormat.init(this)),this.translator=new Bu(this.services,this.options),this.translator.on("*",(L,...z)=>{this.emit(L,...z)}),this.modules.external.forEach(L=>{L.init&&L.init(this)})}if(this.format=this.options.interpolation.format,r||(r=wu),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const m=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);m.length>0&&m[0]!=="dev"&&(this.options.lng=m[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(m=>{this[m]=(...b)=>this.store[m](...b)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(m=>{this[m]=(...b)=>(this.store[m](...b),this)});const g=ei(),p=()=>{const m=(b,v)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(v),r(b,v)};if(this.languages&&!this.isInitialized)return m(null,this.t.bind(this));this.changeLanguage(this.options.lng,m)};return this.options.resources||!this.options.initAsync?p():setTimeout(p,0),g}loadResources(l,r=wu){var f,h;let o=r;const c=ae(l)?l:this.language;if(typeof l=="function"&&(o=l),!this.options.resources||this.options.partialBundledLanguages){if((c==null?void 0:c.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const g=[],p=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(v=>{v!=="cimode"&&g.indexOf(v)<0&&g.push(v)})};c?p(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>p(b)),(h=(f=this.options.preload)==null?void 0:f.forEach)==null||h.call(f,m=>p(m)),this.services.backendConnector.load(g,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(m)})}else o(null)}reloadResources(l,r,o){const c=ei();return typeof l=="function"&&(o=l,l=void 0),typeof r=="function"&&(o=r,r=void 0),l||(l=this.languages),r||(r=this.options.ns),o||(o=wu),this.services.backendConnector.reload(l,r,f=>{c.resolve(),o(f)}),c}use(l){if(!l)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!l.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return l.type==="backend"&&(this.modules.backend=l),(l.type==="logger"||l.log&&l.warn&&l.error)&&(this.modules.logger=l),l.type==="languageDetector"&&(this.modules.languageDetector=l),l.type==="i18nFormat"&&(this.modules.i18nFormat=l),l.type==="postProcessor"&&_g.addPostProcessor(l),l.type==="formatter"&&(this.modules.formatter=l),l.type==="3rdParty"&&this.modules.external.push(l),this}setResolvedLanguage(l){if(!(!l||!this.languages)&&!(["cimode","dev"].indexOf(l)>-1)){for(let r=0;r<this.languages.length;r++){const o=this.languages[r];if(!(["cimode","dev"].indexOf(o)>-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(l)<0&&this.store.hasLanguageSomeTranslations(l)&&(this.resolvedLanguage=l,this.languages.unshift(l))}}changeLanguage(l,r){this.isLanguageChangingTo=l;const o=ei();this.emit("languageChanging",l);const c=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},f=(g,p)=>{p?this.isLanguageChangingTo===l&&(c(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,o.resolve((...m)=>this.t(...m)),r&&r(g,(...m)=>this.t(...m))},h=g=>{var b,v;!l&&!g&&this.services.languageDetector&&(g=[]);const p=ae(g)?g:g&&g[0],m=this.store.hasLanguageSomeTranslations(p)?p:this.services.languageUtils.getBestMatchFromCodes(ae(g)?[g]:g);m&&(this.language||c(m),this.translator.language||this.translator.changeLanguage(m),(v=(b=this.services.languageDetector)==null?void 0:b.cacheUserLanguage)==null||v.call(b,m)),this.loadResources(m,N=>{f(N,m)})};return!l&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!l&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(l),o}getFixedT(l,r,o){const c=(f,h,...g)=>{let p;typeof h!="object"?p=this.options.overloadTranslationOptionHandler([f,h].concat(g)):p={...h},p.lng=p.lng||c.lng,p.lngs=p.lngs||c.lngs,p.ns=p.ns||c.ns,p.keyPrefix!==""&&(p.keyPrefix=p.keyPrefix||o||c.keyPrefix);const m={...this.options,...p};typeof p.keyPrefix=="function"&&(p.keyPrefix=el(p.keyPrefix,m));const b=this.options.keySeparator||".";let v;return p.keyPrefix&&Array.isArray(f)?v=f.map(N=>(typeof N=="function"&&(N=el(N,m)),`${p.keyPrefix}${b}${N}`)):(typeof f=="function"&&(f=el(f,m)),v=p.keyPrefix?`${p.keyPrefix}${b}${f}`:f),this.t(v,p)};return ae(l)?c.lng=l:c.lngs=l,c.ns=r,c.keyPrefix=o,c}t(...l){var r;return(r=this.translator)==null?void 0:r.translate(...l)}exists(...l){var r;return(r=this.translator)==null?void 0:r.exists(...l)}setDefaultNamespace(l){this.options.defaultNS=l}hasLoadedNamespace(l,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=r.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const h=(g,p)=>{const m=this.services.backendConnector.state[`${g}|${p}`];return m===-1||m===0||m===2};if(r.precheck){const g=r.precheck(this,h);if(g!==void 0)return g}return!!(this.hasResourceBundle(o,l)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(o,l)&&(!c||h(f,l)))}loadNamespaces(l,r){const o=ei();return this.options.ns?(ae(l)&&(l=[l]),l.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),r&&r(c)}),o):(r&&r(),Promise.resolve())}loadLanguages(l,r){const o=ei();ae(l)&&(l=[l]);const c=this.options.preload||[],f=l.filter(h=>c.indexOf(h)<0&&this.services.languageUtils.isSupportedCode(h));return f.length?(this.options.preload=c.concat(f),this.loadResources(h=>{o.resolve(),r&&r(h)}),o):(r&&r(),Promise.resolve())}dir(l){var c,f;if(l||(l=this.resolvedLanguage||(((c=this.languages)==null?void 0:c.length)>0?this.languages[0]:this.language)),!l)return"rtl";try{const h=new Intl.Locale(l);if(h&&h.getTextInfo){const g=h.getTextInfo();if(g&&g.direction)return g.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=((f=this.services)==null?void 0:f.languageUtils)||new Mm(Co());return l.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(o.getLanguagePartFromCode(l))>-1||l.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(l={},r){const o=new ai(l,r);return o.createInstance=ai.createInstance,o}cloneInstance(l={},r=wu){const o=l.forkResourceStore;o&&delete l.forkResourceStore;const c={...this.options,...l,isClone:!0},f=new ai(c);if((l.debug!==void 0||l.prefix!==void 0)&&(f.logger=f.logger.clone(l)),["store","services","language"].forEach(g=>{f[g]=this[g]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const g=Object.keys(this.store.data).reduce((p,m)=>(p[m]={...this.store.data[m]},p[m]=Object.keys(p[m]).reduce((b,v)=>(b[v]={...p[m][v]},b),p[m]),p),{});f.store=new wm(g,c),f.services.resourceStore=f.store}if(l.interpolation){const p={...Co().interpolation,...this.options.interpolation,...l.interpolation},m={...c,interpolation:p};f.services.interpolator=new km(m)}return f.translator=new Bu(f.services,c),f.translator.on("*",(g,...p)=>{f.emit(g,...p)}),f.init(c,r),f.translator.options=c,f.translator.backendConnector.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},f}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const $e=ai.createInstance();$e.createInstance;$e.dir;$e.init;$e.loadResources;$e.reloadResources;$e.use;$e.changeLanguage;$e.getFixedT;$e.t;$e.exists;$e.setDefaultNamespace;$e.hasLoadedNamespace;$e.loadNamespaces;$e.loadLanguages;const ni="en",Ag={en:()=>Pe(()=>import("./en-CKhCF6St.js"),[],import.meta.url),zh:()=>Pe(()=>import("./zh-Dz5FLTBV.js"),[],import.meta.url),"zh-TW":()=>Pe(()=>import("./zh-TW-BtRwreY_.js"),[],import.meta.url),ja:()=>Pe(()=>import("./ja-ChF4vbBL.js"),[],import.meta.url),es:()=>Pe(()=>import("./es-C8UBPhxM.js"),[],import.meta.url)},Lu={};function qm(i){return i in Ag}function zg(i){if(qm(i))return i;const l=i.split("-")[0];return qm(l)?l:ni}function eS(){const i=localStorage.getItem("cc_lang");return zg(i||navigator.language||ni)}async function Uo(i){if(Lu[i])return;const l=await Ag[i]();Lu[i]=l.default,$e.isInitialized&&$e.addResourceBundle(i,"translation",Lu[i],!0,!0)}async function tS(){const i=eS();await Promise.all([Uo(ni),i===ni?Promise.resolve():Uo(i)]),$e.isInitialized||await $e.use(P1).init({lng:i,fallbackLng:ni,resources:Object.fromEntries(Object.entries(Lu).map(([l,r])=>[l,{translation:r}])),interpolation:{escapeValue:!1}})}async function Ng(i){const l=zg(i);await Uo(l),await $e.changeLanguage(l),localStorage.setItem("cc_lang",l)}const Ym=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"zh-TW",label:"繁體中文"},{code:"ja",label:"日本語"},{code:"es",label:"Español"}],aS=[{label:"Core",ids:["dashboard","chat","workspace","projects","sessions"]},{label:"Knowledge",ids:["knowledge","cron"]},{label:"System",ids:["system"]}];function nS(){var J;const{pathname:i}=zt(),{t:l,i18n:r}=xg(),{theme:o,setTheme:c}=Fo(),f=Ct(V=>V.logout),h=Ct(V=>V.desktopManaged),g=Jo(),p=dn(),[m,b]=T.useState(!1),[v,N]=T.useState(!1),L=V=>{Ng(V),N(!1)},z={light:Wm,dark:Jm,system:$m},H={light:"dark",dark:"system",system:"light"},B=z[o],q=Qu.listNavItems().filter(V=>{var ue;return((ue=V.visible)==null?void 0:ue.call(V,{desktopManaged:h,features:g}))??!0}),X=q.map(V=>{var te;const ue=V.icon,K=((te=V.resolveLabelKey)==null?void 0:te.call(V,{desktopManaged:h,features:g,runtimeProvider:p}))||V.labelKey;return{...V,Icon:ue,labelKey:K}}),Q=i.startsWith("/chat");return _.jsxs(_.Fragment,{children:[_.jsxs("aside",{className:He("relative hidden h-[100dvh] flex-col overflow-hidden border-r transition-all duration-300 ease-out md:flex","border-white/55 bg-white/24 shadow-[inset_-1px_0_0_rgba(255,255,255,0.36)] backdrop-blur-[34px] supports-[backdrop-filter]:bg-white/18","dark:border-white/[0.10] dark:bg-[#1c1c1e]/34 dark:shadow-[inset_-1px_0_0_rgba(255,255,255,0.08)] dark:supports-[backdrop-filter]:bg-[#1c1c1e]/26",m?"w-16":"w-56"),children:[_.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(180deg,rgba(255,255,255,0.55),rgba(255,255,255,0.18)_48%,rgba(255,255,255,0.08))] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.025)_52%,rgba(255,255,255,0.015))]","aria-hidden":"true"}),_.jsx("div",{className:He("relative flex h-[5.25rem] items-center gap-3 px-4 pt-7 transition-colors"),children:_.jsx(Tg,{showWordmark:!m})}),_.jsx("nav",{className:"relative flex-1 py-3 space-y-4 px-2 overflow-y-auto",children:aS.map(V=>{const ue=q.filter(K=>V.ids.includes(K.id));return ue.length===0?null:_.jsxs("div",{className:"space-y-1",children:[!m&&_.jsx("p",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/80",children:V.label}),ue.map(K=>{var se;const te=K.icon,le=((se=K.resolveLabelKey)==null?void 0:se.call(K,{desktopManaged:h,features:g,runtimeProvider:p}))||K.labelKey;return _.jsxs(wo,{to:K.path,end:K.end,className:({isActive:Ae})=>He("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",Ae?"bg-black/[0.07] text-foreground dark:bg-white/[0.10]":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[_.jsx(te,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l(le)})]},K.id)})]},V.label)})}),_.jsxs("div",{className:He("relative border-t p-2 space-y-1","border-black/10 dark:border-white/[0.08]"),children:[!m&&_.jsxs("div",{className:"px-3 pb-1 pt-0.5 text-[11px] font-medium text-muted-foreground/75",children:["AgentDock v","0.1.21"]}),_.jsxs("div",{className:"relative",children:[_.jsxs("button",{type:"button",onClick:()=>N(!v),className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(C0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:((J=Ym.find(V=>V.code===r.language))==null?void 0:J.label)||"English"})]}),v&&_.jsx("div",{className:He("absolute bottom-full left-0 mb-1 w-48 rounded-xl py-1 z-50 overflow-hidden","border border-black/10 bg-white/90 text-popover-foreground shadow-[0_18px_40px_rgba(0,0,0,0.12)] backdrop-blur-2xl","dark:border-white/[0.08] dark:bg-[#2c2c2e]/90"),children:Ym.map(V=>_.jsx("button",{type:"button",onClick:()=>L(V.code),className:He("w-full text-left px-3 py-2 text-sm transition-colors duration-150",r.language===V.code?"text-primary font-medium bg-primary/10":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:V.label},V.code))})]}),_.jsxs("button",{type:"button",onClick:()=>c(H[o]),className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(B,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l(`theme.${o}`)})]}),!h&&_.jsxs("button",{type:"button",onClick:f,className:He("flex items-center gap-3 w-full px-3 py-2 rounded-lg text-sm transition-colors duration-200","text-muted-foreground hover:bg-destructive/10 hover:text-destructive","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:[_.jsx(M0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:l("login.logout")})]}),_.jsx("button",{type:"button",onClick:()=>b(!m),className:He("flex items-center justify-center w-full px-3 py-2 rounded-lg transition-colors duration-200","text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:m?_.jsx(b0,{size:18}):_.jsx(y0,{size:18})})]})]}),Q?null:_.jsx("nav",{className:He("fixed inset-x-0 bottom-0 z-50 border-t px-2 pb-[max(env(safe-area-inset-bottom),0.5rem)] pt-2 md:hidden","border-black/10 bg-white/88 shadow-[0_-12px_32px_rgba(15,23,42,0.10)] backdrop-blur-2xl","dark:border-white/[0.08] dark:bg-[#111113]/88 dark:shadow-[0_-16px_42px_rgba(0,0,0,0.34)]"),"aria-label":"Primary navigation",children:_.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:X.map(({id:V,path:ue,end:K,Icon:te,labelKey:le})=>_.jsxs(wo,{to:ue,end:K,className:({isActive:se})=>He("flex min-w-[4.5rem] flex-1 flex-col items-center justify-center gap-1 rounded-xl px-2 py-2 text-[11px] font-medium transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",se?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[_.jsx(te,{size:18,className:"shrink-0"}),_.jsx("span",{className:"max-w-[4.25rem] truncate",children:l(le)})]},V))})})]})}function lS(){const{pathname:i}=zt(),{desktopChat:l}=Jo(),r=i.startsWith("/chat"),o=i.startsWith("/chat")&&l,c=o&&dn()==="electron";return _.jsxs("div",{className:He("flex h-[100dvh] overflow-hidden","bg-background/60 backdrop-blur-2xl"),children:[_.jsx("div",{className:"fixed left-0 right-0 top-0 z-50 hidden h-8 [-webkit-app-region:drag] md:block","aria-hidden":"true"}),_.jsx(nS,{}),_.jsx("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0 bg-background/45 backdrop-blur-2xl",children:_.jsx("main",{className:He("flex-1 min-h-0",o?"overflow-hidden":"overflow-y-auto",c?"p-0":r?"p-4 pb-4 sm:p-6 sm:pb-6":"p-4 pb-24 sm:p-6 sm:pb-6"),children:_.jsx("div",{className:He(o&&"h-full min-h-0",!c&&"mx-auto w-full max-w-7xl"),children:_.jsx(t1,{})})})})]})}const iS=()=>Qe.get("/status"),e2=i=>Qe.post("/restart",i),t2=()=>Qe.post("/reload"),a2=i=>Qe.get("/logs",i);function uS({children:i,className:l,hover:r}){return _.jsx("div",{className:He("rounded-lg p-5 text-card-foreground transition-colors duration-200 animate-float-in","border border-black/[0.08] bg-white/62 shadow-[0_1px_1px_rgba(0,0,0,0.04)] backdrop-blur-2xl","dark:border-white/[0.07] dark:bg-white/[0.06] dark:shadow-none",r&&"cursor-pointer hover:border-black/[0.12] hover:bg-white/76 hover:shadow-[0_10px_26px_rgba(0,0,0,0.07)] dark:hover:border-white/[0.10] dark:hover:bg-white/[0.09] dark:hover:shadow-none",l),children:i})}function Gm(i,l){if(typeof i=="function")return i(l);i!=null&&(i.current=l)}function wg(...i){return l=>{let r=!1;const o=i.map(c=>{const f=Gm(c,l);return!r&&typeof f=="function"&&(r=!0),f});if(r)return()=>{for(let c=0;c<o.length;c++){const f=o[c];typeof f=="function"?f():Gm(i[c],null)}}}}function n2(...i){return T.useCallback(wg(...i),i)}var rS=Symbol.for("react.lazy"),qu=f0[" use ".trim().toString()];function sS(i){return typeof i=="object"&&i!==null&&"then"in i}function jg(i){return i!=null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===rS&&"_payload"in i&&sS(i._payload)}function oS(i){const l=fS(i),r=T.forwardRef((o,c)=>{let{children:f,...h}=o;jg(f)&&typeof qu=="function"&&(f=qu(f._payload));const g=T.Children.toArray(f),p=g.find(hS);if(p){const m=p.props.children,b=g.map(v=>v===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:v);return _.jsx(l,{...h,ref:c,children:T.isValidElement(m)?T.cloneElement(m,void 0,b):null})}return _.jsx(l,{...h,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}var cS=oS("Slot");function fS(i){const l=T.forwardRef((r,o)=>{let{children:c,...f}=r;if(jg(c)&&typeof qu=="function"&&(c=qu(c._payload)),T.isValidElement(c)){const h=gS(c),g=mS(f,c.props);return c.type!==T.Fragment&&(g.ref=o?wg(o,h):h),T.cloneElement(c,g)}return T.Children.count(c)>1?T.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var dS=Symbol("radix.slottable");function hS(i){return T.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===dS}function mS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...g)=>{const p=f(...g);return c(...g),p}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function gS(i){var o,c;let l=(o=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:o.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=(c=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:c.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}const pS={default:"bg-primary text-primary-foreground hover:bg-accent-dim",primary:"bg-primary text-primary-foreground hover:bg-accent-dim",secondary:"bg-black/[0.05] text-secondary-foreground hover:bg-black/[0.08] dark:bg-white/[0.08] dark:hover:bg-white/[0.12]",outline:"border border-input bg-background hover:bg-black/[0.04] hover:text-foreground dark:hover:bg-white/[0.06]",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]",link:"text-primary underline-offset-4 hover:underline"},yS={default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",md:"h-9 rounded-md px-4 py-2 text-sm",lg:"h-10 rounded-md px-6 text-sm",icon:"h-9 w-9"};function Yu({variant:i="primary",size:l="md",className:r,children:o,loading:c,asChild:f,disabled:h,type:g="button",...p}){const m=l==="default"?"md":l,b=f?cS:"button";return _.jsxs(b,{...f?{}:{type:g},className:He("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors duration-200","cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:pointer-events-none disabled:opacity-50",pS[i],yS[m],r),disabled:h||c,...p,children:[c&&_.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24","aria-hidden":!0,children:[_.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),_.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o]})}function Vm({label:i,className:l,...r}){return _.jsxs("div",{className:"space-y-1.5",children:[i&&_.jsx("label",{className:"block text-sm font-medium text-foreground",children:i}),_.jsx("input",{className:He("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors","file:border-0 file:bg-transparent file:text-sm file:font-medium","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l),...r})]})}function l2({label:i,className:l,...r}){return _.jsxs("div",{className:"space-y-1.5",children:[i&&_.jsx("label",{className:"block text-sm font-medium text-foreground",children:i}),_.jsx("textarea",{className:He("flex min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors resize-none","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l),...r})]})}const ko="http://127.0.0.1:9831",vS=`${ko}/api/local/v1`;function bS(i){const l=i.trim();return l?l.replace(/\/+$/,""):vS}const ri=bS("/api/local/v1");ri.endsWith("/api/local/v1")&&ri.slice(0,-13);const si=new Set;let _t=null;async function W(i,l,r){const o=await fetch(`${ri}${l}`,{method:i,headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core request failed: ${o.status}`);return c.data}function Mg(){if(_t||typeof window>"u")return;_t=new EventSource(`${ri}/events`);const i=l=>{try{const r=JSON.parse(l.data);si.forEach(o=>o(r))}catch{}};["runtime.updated","runtime.detect.started","runtime.detect.completed","runtime.detect.failed","runtime.status.changed","thread.updated","message.created","message.updated","run.updated","scheduler.job.updated","scheduler.run.updated","presence.updated","stream.updated"].forEach(l=>{_t==null||_t.addEventListener(l,i)}),_t.onerror=()=>{_t==null||_t.close(),_t=null,si.size>0&&window.setTimeout(()=>Mg(),1e3)}}function SS(){si.size===0&&_t&&(_t.close(),_t=null)}function Lg(i){return si.add(i),Mg(),()=>{si.delete(i),SS()}}async function i2(){return W("GET","/runtime")}async function u2(){return W("POST","/runtime/service/start")}async function r2(){return W("POST","/runtime/service/stop")}async function s2(){return W("POST","/runtime/service/restart")}async function o2(i){const l=typeof i=="number"?`?limit=${encodeURIComponent(String(i))}`:"";return W("GET",`/runtime/logs${l}`)}async function c2(){return W("GET","/runtime/agent-runtimes")}async function f2(){return W("POST","/runtimes/refresh")}async function d2(){return W("GET","/runtime/config")}async function h2(i){return W("POST","/runtime/config/raw",{raw:i})}async function m2(i){return W("POST","/runtime/config/structured",{config:i})}async function g2(i){return W("POST","/runtime/settings",i)}async function xS(i){return W("GET",`/platforms/${encodeURIComponent(i)}`)}async function ES(i,l){return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}`)}async function TS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/test`)}async function RS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/enable`)}async function _S(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/disable`)}async function OS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/pairings${r}`)}async function CS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/approve`,{code:l})}async function AS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/reject`,{code:l})}async function zS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/users${r}`)}async function p2(){return xS("lark")}async function y2(i){return ES("lark",i)}async function v2(i){return TS("lark",i)}async function b2(i){return RS("lark",i)}async function S2(i){return _S("lark",i)}async function x2(i){return OS("lark",i)}async function E2(i){return CS("lark",i)}async function T2(i){return AS("lark",i)}async function R2(i){return zS("lark",i)}async function _2(i){return W("POST",`/platforms/weixin/${encodeURIComponent(i)}/qrcode`)}async function O2(i,l){return W("GET",`/platforms/weixin/${encodeURIComponent(i)}/qrcode/status?ticket=${encodeURIComponent(l)}`)}async function C2(){return W("GET","/workspaces")}async function A2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.runtimeId&&l.set("runtime_id",i.runtimeId),i.status&&l.set("status",Array.isArray(i.status)?i.status.join(","):i.status),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/tasks${r}`)}async function z2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.taskId&&l.set("task_id",i.taskId),i.status&&l.set("status",Array.isArray(i.status)?i.status.join(","):i.status),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/approvals${r}`)}async function N2(i={}){const l=new URLSearchParams;i.workspaceId&&l.set("workspace_id",i.workspaceId),i.taskId&&l.set("task_id",i.taskId),i.approvalId&&l.set("approval_id",i.approvalId),i.type&&l.set("type",Array.isArray(i.type)?i.type.join(","):i.type),i.limit&&l.set("limit",String(i.limit));const r=l.toString()?`?${l.toString()}`:"";return W("GET",`/audit-events${r}`)}async function w2(i){return W("GET","/scheduler/jobs")}async function j2(i){return W("POST","/scheduler/jobs",i)}async function M2(i,l){return W("PATCH",`/scheduler/jobs/${encodeURIComponent(i)}`,l)}async function L2(i){return W("DELETE",`/scheduler/jobs/${encodeURIComponent(i)}`)}async function D2(i){return W("POST",`/scheduler/jobs/${encodeURIComponent(i)}/run`)}async function U2(i){return W("GET",`/threads?workspace_id=${encodeURIComponent(i)}`)}async function k2(i,l){return W("POST","/threads",{workspaceId:i,title:l})}async function H2(i){return W("GET",`/threads/${encodeURIComponent(i)}`)}async function B2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}`,{title:l})}async function q2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}/knowledge-bases`,{knowledgeBaseIds:l})}async function Y2(i){return W("DELETE",`/threads/${encodeURIComponent(i)}`)}async function G2(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/messages`,{content:l})}async function V2(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/actions`,{content:l})}async function K2(i){return W("POST",`/runs/${encodeURIComponent(i)}/interrupt`)}async function X2(){return W("GET","/knowledge/config")}async function Q2(){return W("GET","/knowledge/folders")}async function Z2(i){return W("POST","/knowledge/folders",i)}async function $2(i,l){return W("PATCH",`/knowledge/folders/${encodeURIComponent(i)}`,l)}async function J2(i){return W("DELETE",`/knowledge/folders/${encodeURIComponent(i)}`)}async function F2(){return W("GET","/knowledge/bases")}async function W2(i){return W("POST","/knowledge/bases",i)}async function I2(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}`)}async function P2(i,l){return W("PATCH",`/knowledge/bases/${encodeURIComponent(i)}`,l)}async function ex(i){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}`)}async function tx(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}/files`)}async function ax(i,l){const r=new FormData;r.append("collection",l.collection),r.append("knowledgebase_id",i),l.folder&&r.append("folder",l.folder),l.files.forEach(f=>{r.append("files",f,f.name)});const o=await fetch(`${ri}/knowledge/bases/${encodeURIComponent(i)}/files`,{method:"POST",body:r}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core upload failed: ${o.status}`);return c.data}async function nx(i,l){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}/files/${encodeURIComponent(l)}`)}async function lx(i,l){return W("POST",`/knowledge/bases/${encodeURIComponent(i)}/search`,l)}async function ix(){return W("GET","/capabilities/snapshot")}async function ux(){return W("GET","/plugins/diagnostics")}async function rx(i){return W("POST",`/workspaces/${encodeURIComponent(i)}/streaming-probe`)}function sx(i){return Lg(l=>{l.type==="runtime.updated"&&i(l.runtime)})}function ox(i){return Lg(l=>{l.type==="stream.updated"&&i(l.stream),(l.type==="message.created"||l.type==="message.updated"||l.type==="run.updated")&&"stream"in l&&l.stream&&i(l.stream)})}const NS=[{code:"en",label:"EN"},{code:"zh",label:"中"},{code:"zh-TW",label:"繁"},{code:"ja",label:"日"},{code:"es",label:"ES"}];function wS(){const{t:i,i18n:l}=xg(),r=Ku(),o=Ct(J=>J.login),{theme:c,setTheme:f}=Fo(),[h,g]=T.useState(""),[p,m]=T.useState(""),[b,v]=T.useState(""),[N,L]=T.useState(!1),z=ib(),H=ub(),B=async J=>{if(J.preventDefault(),!(!h.trim()||H)){L(!0),v("");try{p.trim()&&Qe.setBaseUrl(p.trim()),Qe.setToken(h.trim()),await iS(),o(h.trim(),p.trim()),z?window.location.hash="#/":r("/",{replace:!0})}catch{v(i("login.invalidToken")),Qe.setToken(""),Qe.setBaseUrl("")}finally{L(!1)}}},q={light:Wm,dark:Jm,system:$m},X={light:"dark",dark:"system",system:"light"},Q=q[c];return _.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-[radial-gradient(circle_at_top,hsl(var(--secondary))_0,hsl(var(--background))_42%,hsl(var(--background))_78%)] p-4",children:[_.jsxs("div",{className:"fixed top-4 right-4 flex items-center gap-2",children:[_.jsx("div",{className:"flex overflow-hidden rounded-md border bg-card/80 backdrop-blur",children:NS.map(J=>_.jsx("button",{onClick:()=>void Ng(J.code),className:He("px-2.5 py-1.5 text-xs font-medium transition-colors",l.language===J.code?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent/10 hover:text-foreground"),children:J.label},J.code))}),_.jsx(Yu,{variant:"outline",size:"icon",onClick:()=>f(X[c]),"aria-label":i(`theme.${c}`),children:_.jsx(Q,{size:16})})]}),_.jsx("div",{className:"w-full max-w-md animate-fade-in",children:_.jsxs(uS,{className:"p-8 shadow-2xl shadow-primary/10",children:[_.jsx("div",{className:"flex justify-center mb-6",children:_.jsx(Tg,{markClassName:"h-14 w-14 drop-shadow-[0_14px_28px_rgba(0,122,255,0.22)]"})}),_.jsx("h1",{className:"text-2xl font-bold text-center text-foreground mb-1",children:i("login.title")}),_.jsx("p",{className:"text-sm text-center text-muted-foreground mb-3",children:i("login.subtitle")}),_.jsx("div",{className:"mb-8 rounded-lg border bg-muted px-4 py-3 text-xs text-muted-foreground",children:z?"AgentDock 桌面模式会自动连接到本地托管运行时。":"Browser mode requires a reachable API endpoint. Enter the server URL and access token."}),b&&_.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded-lg border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive dark:text-red-200",children:[_.jsx(x0,{size:16}),b]}),_.jsxs("form",{onSubmit:B,className:"space-y-4",children:[_.jsx(Vm,{label:i("login.token"),type:"password",value:h,onChange:J=>g(J.target.value),placeholder:"mgmt-secret-xxx",autoFocus:!0}),_.jsx(Vm,{label:`${i("login.serverUrl")} (${i("common.optional")})`,type:"text",value:p,onChange:J=>m(J.target.value),placeholder:"http://localhost:9820"}),_.jsxs(Yu,{type:"submit",disabled:N||!h.trim()||H,className:"w-full shadow-[0_0_20px_-6px_hsl(var(--primary)/0.55)]",children:[N?_.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[_.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),_.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):_.jsx(J0,{size:16}),i("login.connect")]})]})]})})]})}function jS({children:i}){return Ct(r=>r.isAuthenticated)?_.jsx(_.Fragment,{children:i}):_.jsx(Ya,{to:"/login",replace:!0})}function MS(){return _.jsx("div",{className:"flex min-h-64 items-center justify-center text-sm text-muted-foreground",children:"正在加载…"})}function LS(){const i=Ct(o=>o.isAuthenticated),l=Ct(o=>o.desktopManaged),r=Jo();return _.jsx(T.Suspense,{fallback:_.jsx(MS,{}),children:_.jsxs(n1,{children:[_.jsx(on,{path:"/login",element:i?_.jsx(Ya,{to:"/",replace:!0}):_.jsx(wS,{})}),_.jsxs(on,{element:_.jsx(jS,{children:_.jsx(lS,{})}),children:[Qu.listRoutes().map(o=>o.index?_.jsx(on,{index:!0,element:o.element({desktopManaged:l,features:r})},o.id):_.jsx(on,{path:o.path,element:o.element({desktopManaged:l,features:r})},o.id)),_.jsx(on,{path:"*",element:_.jsx(Ya,{to:"/",replace:!0})})]}),_.jsx(on,{path:"*",element:_.jsx(Ya,{to:i?"/":"/login",replace:!0})})]})})}class DS extends Pn.Component{constructor(){super(...arguments);In(this,"state",{hasError:!1,errorMessage:""})}static getDerivedStateFromError(r){return{hasError:!0,errorMessage:r instanceof Error?r.message:String(r)}}componentDidCatch(r,o){console.error("App render failed",r,o)}render(){return this.state.hasError?_.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"max-w-lg w-full rounded-2xl border border-red-200 dark:border-red-900/40 bg-red-50 dark:bg-red-950/20 px-6 py-5",children:[_.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"页面渲染失败"}),_.jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-400 break-words",children:this.state.errorMessage||"Unknown renderer error"}),_.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700",children:"Reload"})]})}):this.props.children}}const US="http://127.0.0.1:9831",kS=`${US}/api/local/v1`,cn=HS("/api/local/v1"),oi=new Set;let Kt=null;function HS(i){const l=i.trim();return l?l.replace(/\/+$/,""):kS}async function Wo(i,l,r){const o=await fetch(`${cn}${l}`,{method:i,headers:{"Content-Type":"application/json"},body:void 0}),c=await o.json();if(!o.ok||!c.ok)throw new Error(c.error||`Local AI Core request failed: ${o.status}`);return c.data}async function BS(i=350){var o;const l=new AbortController,r=window.setTimeout(()=>l.abort(),i);try{const c=await fetch(`${cn}/health`,{signal:l.signal}),f=await c.json();return c.ok&&f.ok&&((o=f.data)==null?void 0:o.name)==="local-ai-core"}catch{return!1}finally{window.clearTimeout(r)}}function Dg(){Kt||typeof window>"u"||(Kt=new EventSource(`${cn}/events`),Kt.addEventListener("runtime.updated",i=>{try{const l=JSON.parse(i.data);l.type==="runtime.updated"&&oi.forEach(r=>r(l.runtime))}catch{}}),Kt.onerror=()=>{Kt==null||Kt.close(),Kt=null,oi.size>0&&window.setTimeout(()=>Dg(),1e3)})}function qS(){oi.size===0&&Kt&&(Kt.close(),Kt=null)}async function YS(){return window.desktop?(Eo("electron"),!0):(await BS(),Eo("local_core"),!0)}function GS(){return dn()==="electron"&&window.desktop?window.desktop.getRuntimeStatus():Wo("GET","/runtime")}function Km(){return Wo("GET","/capabilities/snapshot")}function VS(i){if(dn()==="electron"&&window.desktop)return window.desktop.getLogs(i);const l=`?limit=${encodeURIComponent(String(i))}`;return Wo("GET",`/runtime/logs${l}`)}function KS(i){return dn()==="electron"&&window.desktop?window.desktop.onRuntimeEvent(i):(oi.add(i),Dg(),()=>{oi.delete(i),qS()})}const Xm=20,XS=500;function QS(i){return new Promise(l=>window.setTimeout(l,i))}function ZS(){return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-gray-200 dark:border-white/[0.08] bg-white dark:bg-gray-900 px-5 py-4 text-sm text-gray-600 dark:text-gray-300 shadow-sm",children:[_.jsx(Fm,{size:16,className:"animate-spin"}),"正在初始化 AgentDock 运行时…"]})})}function $S({message:i,logs:l,onRetry:r}){return _.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:_.jsxs("div",{className:"max-w-2xl w-full rounded-3xl border border-red-200 dark:border-red-900/40 bg-white dark:bg-gray-900 shadow-sm overflow-hidden",children:[_.jsx("div",{className:"px-6 py-5 border-b border-red-100 dark:border-red-900/30 bg-red-50/80 dark:bg-red-950/20",children:_.jsxs("div",{className:"flex items-start gap-3",children:[_.jsx("div",{className:"w-10 h-10 rounded-2xl bg-red-100 dark:bg-red-950/40 text-red-600 dark:text-red-300 flex items-center justify-center shrink-0",children:_.jsx(X0,{size:18})}),_.jsxs("div",{children:[_.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"AgentDock 运行时初始化失败"}),_.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 break-words",children:i})]})]})}),_.jsxs("div",{className:"px-6 py-5 space-y-4",children:[_.jsxs("div",{className:"rounded-2xl border border-gray-200 dark:border-white/[0.08] px-4 py-3 text-sm text-gray-600 dark:text-gray-300",children:[_.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"What we can do next"}),_.jsx("p",{className:"mt-1",children:"请先重试本地运行时初始化。如果仍然失败,请检查下方运行时日志,并确认 Local AI Core 配置文件路径与运行环境是否正确。"})]}),l.length>0&&_.jsxs("div",{className:"rounded-2xl border border-gray-200 dark:border-white/[0.08] bg-gray-50 dark:bg-gray-950/40 px-4 py-3",children:[_.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"最近的桌面日志"}),_.jsx("pre",{className:"mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs text-gray-600 dark:text-gray-300 font-mono",children:l.join(`
|
|
177
177
|
`)})]}),_.jsxs("div",{className:"flex gap-3",children:[_.jsxs(Yu,{onClick:r,children:[_.jsx(Fm,{size:14})," 重试初始化"]}),_.jsx(Yu,{variant:"secondary",onClick:()=>window.location.reload(),children:"重新加载应用"})]})]})]})})}function JS(){const[i,l]=T.useState({status:"loading"}),[r,o]=T.useState(!1),c=T.useCallback(async()=>{l({status:"loading"});const h=!!await YS();if(o(h),h)try{let g=null;for(let p=0;p<Xm;p+=1)try{await GS(),g=null;break}catch(m){g=m,p<Xm-1&&await QS(XS)}if(g)throw g;To(await Km()),Qe.setBaseUrl(cn),Qe.setToken(""),Ct.getState().setManagedSession("",cn,dn()==="local_core"?"local_core":"electron")}catch(g){let p=[];try{p=await VS(80)}catch{p=[]}l({status:"error",message:g instanceof Error?g.message:String(g),logs:p});return}h||To(null),l({status:"ready"})},[]);return T.useEffect(()=>{c()},[c]),T.useEffect(()=>{if(r)return KS(f=>{Qe.setBaseUrl(cn),Qe.setToken(""),Km().then(h=>To(h)).catch(()=>{}),Ct.getState().setManagedSession("",cn,dn()==="local_core"?"local_core":"electron")})},[r]),i.status==="loading"?_.jsx(ZS,{}):i.status==="error"?_.jsx($S,{message:i.message,logs:i.logs,onRetry:()=>void c()}):_.jsx(A1,{children:_.jsx(LS,{})})}async function FS(){await tS(),Ct.getState().init(),Fo.getState().init(),nv.createRoot(document.getElementById("root")).render(_.jsx(DS,{children:_.jsx(JS,{})}))}FS();export{f2 as $,PS as A,Yu as B,uS as C,T0 as D,Qm as E,_0 as F,w2 as G,M2 as H,Vm as I,j2 as J,L2 as K,pg as L,D0 as M,D2 as N,Lg as O,e2 as P,t2 as Q,Fm as R,G0 as S,l2 as T,ox as U,O2 as V,Z0 as W,_2 as X,ux as Y,J0 as Z,ix as _,Jo as a,c2 as a0,sx as a1,rx as a2,R2 as a3,T2 as a4,E2 as a5,x2 as a6,S2 as a7,b2 as a8,v2 as a9,$2 as aA,J2 as aB,P2 as aC,ex as aD,b0 as aE,w0 as aF,P0 as aG,f0 as aH,wg as aI,I2 as aJ,tx as aK,ax as aL,nx as aM,lx as aN,y2 as aa,p2 as ab,zS as ac,AS as ad,CS as ae,OS as af,_S as ag,RS as ah,TS as ai,ES as aj,xS as ak,g2 as al,m2 as am,h2 as an,d2 as ao,o2 as ap,s2 as aq,r2 as ar,u2 as as,i2 as at,a2 as au,n2 as av,X2 as aw,Q2 as ax,Z2 as ay,W2 as az,A2 as b,Je as c,z2 as d,N2 as e,x0 as f,dn as g,U2 as h,H2 as i,_ as j,k2 as k,C2 as l,q2 as m,G2 as n,K2 as o,B2 as p,Y2 as q,T as r,V2 as s,IS as t,xg as u,F2 as v,He as w,Pn as x,Qe as y,cg as z};
|