@kafca/agentdock 0.1.43 → 0.1.44
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 +6 -0
- package/dist/renderer/assets/{Badge-CbG6yRSm.js → Badge-Qk9qHovH.js} +1 -1
- package/dist/renderer/assets/{Chat-BvNNWGGX.js → Chat-BK-fm0Xr.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-Ct-PvJB8.js → ChatMarkdown-BKdW8OON.js} +1 -1
- package/dist/renderer/assets/{Config-lQX2qVVV.js → Config-B93CQGvY.js} +1 -1
- package/dist/renderer/assets/{CronList-Dj_3muVG.js → CronList-Z3TvSRKP.js} +1 -1
- package/dist/renderer/assets/{Dashboard-eh_RhGYb.js → Dashboard-Ch3QkWwf.js} +2 -2
- package/dist/renderer/assets/{EmptyState-Bn2Qh14U.js → EmptyState-kD9yAwtw.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-Bsz6Ou41.js → KnowledgeDetail-BAMCLrjz.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-Cgj4XFXn.js → KnowledgeHome-ChvjOfrc.js} +1 -1
- package/dist/renderer/assets/{Logs-Dp-NF6GN.js → Logs-Cv0nth3j.js} +1 -1
- package/dist/renderer/assets/{Modal-B6YPPBN6.js → Modal-DwY4lecS.js} +1 -1
- package/dist/renderer/assets/{MonitorList-xEZWg460.js → MonitorList-JEvMoWUm.js} +1 -1
- package/dist/renderer/assets/{Page-Bn7RjGOS.js → Page-CnB9ePsb.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-Cv_jIE61.js → ProjectDetail-DJa3sMmU.js} +1 -1
- package/dist/renderer/assets/{ProjectList-BDk5_gqY.js → ProjectList-D6CXumR_.js} +1 -1
- package/dist/renderer/assets/{Select-xshfMIEQ.js → Select-zfoksLGB.js} +1 -1
- package/dist/renderer/assets/{SessionChat-BkHy90z3.js → SessionChat-DUTh4WoM.js} +1 -1
- package/dist/renderer/assets/{SessionList-BZyXT92L.js → SessionList-D9o-lUst.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-DUOIyXrS.js → ThreadChat-BYXlT-Kc.js} +1 -1
- package/dist/renderer/assets/{Workspace-Dl80fNEC.js → Workspace-BrhSwRQ-.js} +1 -1
- package/dist/renderer/assets/{arrow-left-C54ZI-AS.js → arrow-left-CNEAuElg.js} +1 -1
- package/dist/renderer/assets/{book-open-Dl7GO0zn.js → book-open-BNJMhNI-.js} +1 -1
- package/dist/renderer/assets/{check-CiqgtrOL.js → check-BnclClRU.js} +1 -1
- package/dist/renderer/assets/{chevron-down-DTL2OuVh.js → chevron-down-Bh53e0O-.js} +1 -1
- package/dist/renderer/assets/{circle-DaVKfa3P.js → circle-ClZTWCWO.js} +1 -1
- package/dist/renderer/assets/{desktop-jaAiayNB.js → desktop-C5vBT0yM.js} +1 -1
- package/dist/renderer/assets/{funnel-CrmnLMJI.js → funnel-_5hsz0xI.js} +1 -1
- package/dist/renderer/assets/{heart-BMfQI7y_.js → heart-u4Q1aOqj.js} +1 -1
- package/dist/renderer/assets/{index-HPNb1zfx.js → index-B36eowj-.js} +2 -2
- package/dist/renderer/assets/{index-nreiKY1f.js → index-BNFx4uYv.js} +1 -1
- package/dist/renderer/assets/{pencil-wTQ4l465.js → pencil-DLh9QNmT.js} +1 -1
- package/dist/renderer/assets/{play-BK--MXmw.js → play-BDTk9Scm.js} +1 -1
- package/dist/renderer/assets/{plug-BIx9fjip.js → plug-BG0JHW6B.js} +1 -1
- package/dist/renderer/assets/{plus-Dn7JFWQ8.js → plus-BSc8POsz.js} +1 -1
- package/dist/renderer/assets/projects-DwfZwxDW.js +1 -0
- package/dist/renderer/assets/{save-CC3zOSWb.js → save-D5AO_G6a.js} +1 -1
- package/dist/renderer/assets/{search-CDTy9Czu.js → search-CniPk7Ey.js} +1 -1
- package/dist/renderer/assets/{server-DtQk3t2a.js → server-GsXyQAZm.js} +1 -1
- package/dist/renderer/assets/{session-utils-4ep5D66T.js → session-utils-BDxzgTBC.js} +1 -1
- package/dist/renderer/assets/{sessions-Dor1LteH.js → sessions-CLcKA1Tt.js} +1 -1
- package/dist/renderer/assets/{shield-check-Cz2LpU6r.js → shield-check-4i0E3hmf.js} +1 -1
- package/dist/renderer/assets/{trash-2-C2EmWFZV.js → trash-2-DhtOCsO5.js} +1 -1
- package/dist/renderer/assets/{user-I8B-cs5A.js → user-BtC_pVXV.js} +1 -1
- package/dist/renderer/assets/{wifi-off-CPevTQJn.js → wifi-off-BHPzPY_B.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/services/local-ai-core/src/channel/lark/config.js +2 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/inbound.js +114 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +52 -65
- package/dist-electron/services/local-ai-core/src/channel/shared/thread-routing.js +34 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +12 -18
- package/dist-electron/tests/integration/channel-gateways.test.js +32 -0
- package/dist-electron/tests/integration/lark-gateway.test.js +1918 -0
- package/dist-electron/tests/integration/local-core-acp-progress.test.js +1772 -0
- package/dist-electron/tests/integration/local-core-refactor.test.js +0 -4544
- package/dist-electron/tests/integration/local-core-routes.test.js +204 -0
- package/dist-electron/tests/integration/weixin-gateway.test.js +927 -0
- package/package.json +1 -1
- package/dist/renderer/assets/projects-brJZgwEJ.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-Ch3QkWwf.js","./Badge-Qk9qHovH.js","./EmptyState-kD9yAwtw.js","./Page-CnB9ePsb.js","./projects-DwfZwxDW.js","./desktop-C5vBT0yM.js","./server-GsXyQAZm.js","./book-open-BNJMhNI-.js","./shield-check-4i0E3hmf.js","./ThreadChat-BYXlT-Kc.js","./Modal-DwY4lecS.js","./index-BNFx4uYv.js","./session-utils-BDxzgTBC.js","./desktop-C6q6wBae.js","./ChatMarkdown-BKdW8OON.js","./check-BnclClRU.js","./circle-ClZTWCWO.js","./user-BtC_pVXV.js","./chevron-down-Bh53e0O-.js","./wifi-off-BHPzPY_B.js","./search-CniPk7Ey.js","./pencil-DLh9QNmT.js","./trash-2-DhtOCsO5.js","./Chat-BK-fm0Xr.js","./sessions-CLcKA1Tt.js","./Workspace-BrhSwRQ-.js","./Select-zfoksLGB.js","./plus-BSc8POsz.js","./save-D5AO_G6a.js","./ProjectList-D6CXumR_.js","./heart-u4Q1aOqj.js","./ProjectDetail-DJa3sMmU.js","./arrow-left-CNEAuElg.js","./plug-BG0JHW6B.js","./play-BDTk9Scm.js","./SessionList-D9o-lUst.js","./funnel-_5hsz0xI.js","./SessionChat-DUTh4WoM.js","./CronList-Z3TvSRKP.js","./MonitorList-JEvMoWUm.js","./Config-B93CQGvY.js","./Logs-Cv0nth3j.js","./KnowledgeHome-ChvjOfrc.js","./KnowledgeDetail-BAMCLrjz.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var s0=Object.defineProperty;var o0=(i,l,r)=>l in i?s0(i,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[l]=r;var In=(i,l,r)=>o0(i,typeof l!="symbol"?l+"":l,r);function c0(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 Zm(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var mo={exports:{}},Wl={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -178,5 +178,5 @@ Error generating stack: `+n.message+`
|
|
|
178
178
|
* @license MIT
|
|
179
179
|
*/var dm="popstate";function hm(i){return typeof i=="object"&&i!=null&&"pathname"in i&&"search"in i&&"hash"in i&&"state"in i&&"key"in i}function ov(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),zo("",{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){Ct(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(f)})`)}return fv(l,r,o,i)}function Le(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function Ct(i,l){if(!i){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function cv(){return Math.random().toString(36).substring(2,10)}function mm(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 zo(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||cv(),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 fv(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 Q=hm(B)?B:zo(H.location,B,q);r&&r(Q,B),m=b()+1;let X=mm(Q,m),J=H.createHref(Q.unstable_mask||Q);try{h.pushState(X,"",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 Q=hm(B)?B:zo(H.location,B,q);r&&r(Q,B),m=b();let X=mm(Q,m),J=H.createHref(Q.unstable_mask||Q);h.replaceState(X,"",J),f&&p&&p({action:g,location:H.location,delta:0})}function z(B){return dv(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(dm,v),p=B,()=>{c.removeEventListener(dm,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 dv(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 Pm(i,l,r="/"){return hv(i,l,r,!1)}function hv(i,l,r,o){let c=typeof l=="string"?hn(l):l,f=ga(c.pathname||"/",r);if(f==null)return null;let h=eg(i);mv(h);let g=null;for(let p=0;g==null&&p<h.length;++p){let m=_v(f);g=Tv(h[p],m,o)}return g}function eg(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=Qt([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}".`),eg(h.children,l,N,v,p)),!(h.path==null&&!h.index)&&l.push({path:v,score:xv(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 tg(h.path))f(h,g,!0,m)}),l}function tg(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=tg(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 mv(i){i.sort((l,r)=>l.score!==r.score?r.score-l.score:Ev(l.routesMeta.map(o=>o.childrenIndex),r.routesMeta.map(o=>o.childrenIndex)))}var gv=/^:[\w-]+$/,pv=3,yv=2,vv=1,bv=10,Sv=-2,gm=i=>i==="*";function xv(i,l){let r=i.split("/"),o=r.length;return r.some(gm)&&(o+=Sv),l&&(o+=yv),r.filter(c=>!gm(c)).reduce((c,f)=>c+(gv.test(f)?pv:f===""?vv:bv),o)}function Ev(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 Tv(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=Uu({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},b),N=p.route;if(!v&&m&&r&&!o[o.length-1].route.index&&(v=Uu({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},b)),!v)return null;Object.assign(c,v.params),h.push({params:c,pathname:Qt([f,v.pathname]),pathnameBase:zv(Qt([f,v.pathnameBase])),route:N}),v.pathnameBase!=="/"&&(f=Qt([f,v.pathnameBase]))}return h}function Uu(i,l){typeof i=="string"&&(i={path:i,caseSensitive:!1,end:!0});let[r,o]=Rv(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 Rv(i,l=!1,r=!0){Ct(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 _v(i){try{return i.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Ct(!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 Cv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Ov(i,l="/"){let{pathname:r,search:o="",hash:c=""}=typeof i=="string"?hn(i):i,f;return r?(r=ag(r),r.startsWith("/")?f=pm(r.substring(1),"/"):f=pm(r,l)):f=l,{pathname:f,search:Nv(o),hash:wv(c)}}function pm(i,l){let r=ku(l).split("/");return i.split("/").forEach(c=>{c===".."?r.length>1&&r.pop():c!=="."&&r.push(c)}),r.length>1?r.join("/"):"/"}function So(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 Av(i){return i.filter((l,r)=>r===0||l.route.path&&l.route.path.length>0)}function qo(i){let l=Av(i);return l.map((r,o)=>o===l.length-1?r.pathname:r.pathnameBase)}function Vu(i,l,r,o=!1){let c;typeof i=="string"?c=hn(i):(c={...i},Le(!c.pathname||!c.pathname.includes("?"),So("?","pathname","search",c)),Le(!c.pathname||!c.pathname.includes("#"),So("#","pathname","hash",c)),Le(!c.search||!c.search.includes("#"),So("#","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=Ov(c,g),m=h&&h!=="/"&&h.endsWith("/"),b=(f||h===".")&&r.endsWith("/");return!p.pathname.endsWith("/")&&(m||b)&&(p.pathname+="/"),p}var ag=i=>i.replace(/\/\/+/g,"/"),Qt=i=>ag(i.join("/")),ku=i=>i.replace(/\/+$/,""),zv=i=>ku(i).replace(/^\/*/,"/"),Nv=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,wv=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i,Mv=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 jv(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}function Lv(i){let l=i.map(r=>r.route.path).filter(Boolean);return Qt(l)||"/"}var ng=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lg(i,l){let r=i;if(typeof r!="string"||!Cv.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let o=r,c=!1;if(ng)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{Ct(!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 ig=["POST","PUT","PATCH","DELETE"];new Set(ig);var Dv=["GET",...ig];new Set(Dv);var al=T.createContext(null);al.displayName="DataRouter";var Ku=T.createContext(null);Ku.displayName="DataRouterState";var ug=T.createContext(!1);function Uv(){return T.useContext(ug)}var rg=T.createContext({isTransitioning:!1});rg.displayName="ViewTransition";var kv=T.createContext(new Map);kv.displayName="Fetchers";var Hv=T.createContext(null);Hv.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 Yo=T.createContext(null);Yo.displayName="RouteError";var sg="REACT_ROUTER_ERROR",Bv="REDIRECT",qv="ROUTE_ERROR_RESPONSE";function Yv(i){if(i.startsWith(`${sg}:${Bv}:{`))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 Gv(i){if(i.startsWith(`${sg}:${qv}:{`))try{let l=JSON.parse(i.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new Mv(l.status,l.statusText,l.data)}catch{}}function Vv(i,{relative:l}={}){Le(nl(),"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:Qt([r,f])),o.createHref({pathname:g,search:h,hash:c})}function nl(){return T.useContext(ci)!=null}function zt(){return Le(nl(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(ci).location}var og="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cg(i){T.useContext(At).static||T.useLayoutEffect(i)}function Qu(){let{isDataRoute:i}=T.useContext(qt);return i?l1():Kv()}function Kv(){Le(nl(),"useNavigate() may be used only in the context of a <Router> component.");let i=T.useContext(al),{basename:l,navigator:r}=T.useContext(At),{matches:o}=T.useContext(qt),{pathname:c}=zt(),f=JSON.stringify(qo(o)),h=T.useRef(!1);return cg(()=>{h.current=!0}),T.useCallback((p,m={})=>{if(Ct(h.current,og),!h.current)return;if(typeof p=="number"){r.go(p);return}let b=Vu(p,JSON.parse(f),c,m.relative==="path");i==null&&l!=="/"&&(b.pathname=b.pathname==="/"?l:Qt([l,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[l,r,f,c,i])}var Qv=T.createContext(null);function Xv(i){let l=T.useContext(qt).outlet;return T.useMemo(()=>l&&T.createElement(Qv.Provider,{value:i},l),[l,i])}function fg(){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(qo(r));return T.useMemo(()=>Vu(i,JSON.parse(c),o,l==="path"),[i,c,o,l])}function Zv(i,l){return dg(i,l)}function dg(i,l,r){var B;Le(nl(),"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||"";mg(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.
|
|
180
180
|
|
|
181
|
-
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=Pm(i,{pathname:L});Ct(m||z!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Ct(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=Iv(z&&z.map(q=>Object.assign({},q,{params:Object.assign({},h,q.params),pathname:Qt([p,o.encodeLocation?o.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?p:Qt([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 $v(){let i=n1(),l=jv(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 Jv=T.createElement($v,null),hg=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=Gv(i.digest);r&&(i=r)}let l=i!==void 0?T.createElement(qt.Provider,{value:this.props.routeContext},T.createElement(Yo.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?T.createElement(Fv,{error:i},l):l}};hg.contextType=ug;var xo=new WeakMap;function Fv({children:i,error:l}){let{basename:r}=T.useContext(At);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let o=Yv(l.digest);if(o){let c=xo.get(l);if(c)throw c;let f=lg(o.location,r);if(ng&&!xo.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 xo.set(l,h),h}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return i}function Wv({routeContext:i,match:l,children:r}){let o=T.useContext(al);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 Iv(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:Lv(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||Jv,h&&(g<0&&N===0?(mg("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)),Q=()=>{let X;return L?X=H:z?X=B:v.route.Component?X=T.createElement(v.route.Component,null):v.route.element?X=v.route.element:X=b,T.createElement(Wv,{match:v,routeContext:{outlet:b,matches:q,isDataRoute:o!=null},children:X})};return o&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?T.createElement(hg,{location:o.location,revalidation:o.revalidation,component:H,error:L,children:Q(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:m}):Q()},null)}function Go(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pv(i){let l=T.useContext(al);return Le(l,Go(i)),l}function e1(i){let l=T.useContext(Ku);return Le(l,Go(i)),l}function t1(i){let l=T.useContext(qt);return Le(l,Go(i)),l}function Vo(i){let l=t1(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 a1(){return Vo("useRouteId")}function n1(){var o;let i=T.useContext(Yo),l=e1("useRouteError"),r=Vo("useRouteError");return i!==void 0?i:(o=l.errors)==null?void 0:o[r]}function l1(){let{router:i}=Pv("useNavigate"),l=Vo("useNavigate"),r=T.useRef(!1);return cg(()=>{r.current=!0}),T.useCallback(async(c,f={})=>{Ct(r.current,og),r.current&&(typeof c=="number"?await i.navigate(c):await i.navigate(c,{fromRouteId:l,...f}))},[i,l])}var ym={};function mg(i,l,r){!l&&!ym[i]&&(ym[i]=!0,Ct(!1,r))}T.memo(i1);function i1({routes:i,future:l,state:r,isStatic:o,onError:c}){return dg(i,void 0,{state:r,isStatic:o,onError:c})}function Ya({to:i,replace:l,state:r,relative:o}){Le(nl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=T.useContext(At);Ct(!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=Qu(),p=Vu(i,qo(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 u1(i){return Xv(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 r1({basename:i="/",children:l=null,location:r,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:h}){Le(!nl(),"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 Ct(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 s1({children:i,location:l}){return Zv(No(i),l)}function No(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,No(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=No(o.props.children,f)),r.push(h)}),r}var ju="get",Lu="application/x-www-form-urlencoded";function Xu(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function o1(i){return Xu(i)&&i.tagName.toLowerCase()==="button"}function c1(i){return Xu(i)&&i.tagName.toLowerCase()==="form"}function f1(i){return Xu(i)&&i.tagName.toLowerCase()==="input"}function d1(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function h1(i,l){return i.button===0&&(!l||l==="_self")&&!d1(i)}function wo(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 m1(i,l){let r=wo(i);return l&&l.forEach((o,c)=>{r.has(c)||l.getAll(c).forEach(f=>{r.append(c,f)})}),r}var wu=null;function g1(){if(wu===null)try{new FormData(document.createElement("form"),0),wu=!1}catch{wu=!0}return wu}var p1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Eo(i){return i!=null&&!p1.has(i)?(Ct(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lu}"`),null):i}function y1(i,l){let r,o,c,f,h;if(c1(i)){let g=i.getAttribute("action");o=g?ga(g,l):null,r=i.getAttribute("method")||ju,c=Eo(i.getAttribute("enctype"))||Lu,f=new FormData(i)}else if(o1(i)||f1(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=Eo(i.getAttribute("formenctype"))||Eo(g.getAttribute("enctype"))||Lu,f=new FormData(g,i),!g1()){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=Lu,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 Ko(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function gg(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=`${ku(l)}/_root.${o}`:c.pathname=`${ku(c.pathname)}.${o}`,c}async function v1(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 b1(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 S1(i,l,r){let o=await Promise.all(i.map(async c=>{let f=l.routes[c.route.id];if(f){let h=await v1(f,r);return h.links?h.links():[]}return[]}));return R1(o.flat(1).filter(b1).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function vm(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 x1(i,l,{includeHydrateFallback:r}={}){return E1(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 E1(i){return[...new Set(i)]}function T1(i){let l={},r=Object.keys(i).sort();for(let o of r)l[o]=i[o];return l}function R1(i,l){let r=new Set;return new Set(l),i.reduce((o,c)=>{let f=JSON.stringify(T1(c));return r.has(f)||(r.add(f),o.push({key:f,link:c})),o},[])}function Qo(){let i=T.useContext(al);return Ko(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function _1(){let i=T.useContext(Ku);return Ko(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Xo=T.createContext(void 0);Xo.displayName="FrameworkContext";function Zo(){let i=T.useContext(Xo);return Ko(i,"You must render this element inside a <HydratedRouter> element"),i}function C1(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(Q=>{h(Q.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:Pl(g,L),onBlur:Pl(p,z),onMouseEnter:Pl(m,L),onMouseLeave:Pl(b,z),onTouchStart:Pl(v,L)}]:[!1,N,{}]}function Pl(i,l){return r=>{i&&i(r),r.defaultPrevented||l(r)}}function O1({page:i,...l}){let r=Uv(),{router:o}=Qo(),c=T.useMemo(()=>Pm(o.routes,i,o.basename),[o.routes,i,o.basename]);return c?r?T.createElement(z1,{page:i,matches:c,...l}):T.createElement(N1,{page:i,matches:c,...l}):null}function A1(i){let{manifest:l,routeModules:r}=Zo(),[o,c]=T.useState([]);return T.useEffect(()=>{let f=!1;return S1(i,l,r).then(h=>{f||c(h)}),()=>{f=!0}},[i,l,r]),o}function z1({page:i,matches:l,...r}){let o=zt(),{future:c}=Zo(),{basename:f}=Qo(),h=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let g=gg(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 N1({page:i,matches:l,...r}){let o=zt(),{future:c,manifest:f,routeModules:h}=Zo(),{basename:g}=Qo(),{loaderData:p,matches:m}=_1(),b=T.useMemo(()=>vm(i,l,m,f,o,"data"),[i,l,m,f,o]),v=T.useMemo(()=>vm(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(Q=>{var J;let X=f.routes[Q.route.id];!X||!X.hasLoader||(!b.some(V=>V.route.id===Q.route.id)&&Q.route.id in p&&((J=h[Q.route.id])!=null&&J.shouldRevalidate)||X.hasClientLoader?B=!0:H.add(Q.route.id))}),H.size===0)return[];let q=gg(i,g,c.unstable_trailingSlashAwareDataRequests,"data");return B&&H.size>0&&q.searchParams.set("_routes",l.filter(Q=>H.has(Q.route.id)).map(Q=>Q.route.id).join(",")),[q.pathname+q.search]},[g,c.unstable_trailingSlashAwareDataRequests,p,o,f,b,l,i,h]),L=T.useMemo(()=>x1(v,f),[v,f]),z=A1(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 w1(...i){return l=>{i.forEach(r=>{typeof r=="function"?r(l):r!=null&&(r.current=l)})}}var M1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{M1&&(window.__reactRouterVersion="7.14.2")}catch{}function j1({basename:i,children:l,unstable_useTransitions:r,window:o}){let c=T.useRef();c.current==null&&(c.current=ov({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(r1,{basename:i,children:l,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:r})}var pg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yg=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:Q}=T.useContext(At),X=typeof b=="string"&&pg.test(b),J=lg(b,B);b=J.to;let V=Vv(b,{relative:c}),ue=zt(),K=null;if(g){let De=Vu(g,[],ue.unstable_mask?ue.unstable_mask.pathname:"/",!0);B!=="/"&&(De.pathname=De.pathname==="/"?B:Qt([B,De.pathname])),K=q.createHref(De)}let[te,le,se]=C1(o,z),Ae=U1(b,{replace:h,unstable_mask:g,state:p,target:m,preventScrollReset:v,relative:c,viewTransition:N,unstable_defaultShouldRevalidate:L,unstable_useTransitions:Q});function We(De){l&&l(De),De.defaultPrevented||Ae(De)}let ze=!(J.isExternal||f),Me=T.createElement("a",{...z,...se,href:(ze?K:void 0)||J.absoluteURL||V,onClick:ze?We:l,ref:w1(H,le),target:m,"data-discover":!X&&r==="render"?"true":void 0});return te&&!X?T.createElement(T.Fragment,null,Me,T.createElement(O1,{page:V})):Me});yg.displayName="Link";var Mo=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(Ku),{navigator:z,basename:H}=T.useContext(At),B=L!=null&&Y1(v)&&g===!0,q=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,Q=N.pathname,X=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(Q=Q.toLowerCase(),X=X?X.toLowerCase():null,q=q.toLowerCase()),X&&H&&(X=ga(X,H)||X);const J=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let V=Q===q||!c&&Q.startsWith(q)&&Q.charAt(J)==="/",ue=X!=null&&(X===q||!c&&X.startsWith(q)&&X.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(yg,{...m,"aria-current":te,className:le,ref:b,style:se,to:h,viewTransition:g},typeof p=="function"?p(K):p)});Mo.displayName="NavLink";var L1=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=B1(),q=q1(g,{relative:m}),Q=h.toLowerCase()==="get"?"get":"post",X=typeof g=="string"&&pg.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:Q,action:q,onSubmit:o?p:J,...L,"data-discover":!X&&i==="render"?"true":void 0})});L1.displayName="Form";function D1(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vg(i){let l=T.useContext(al);return Le(l,D1(i)),l}function U1(i,{target:l,replace:r,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let b=Qu(),v=zt(),N=fi(i,{relative:h});return T.useCallback(L=>{if(h1(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 i2(i){Ct(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(wo(i)),r=T.useRef(!1),o=zt(),c=T.useMemo(()=>m1(o.search,r.current?null:l.current),[o.search]),f=Qu(),h=T.useCallback((g,p)=>{const m=wo(typeof g=="function"?g(new URLSearchParams(c)):g);r.current=!0,f("?"+m,p)},[f,c]);return[c,h]}var k1=0,H1=()=>`__${String(++k1)}__`;function B1(){let{router:i}=vg("useSubmit"),{basename:l}=T.useContext(At),r=a1(),o=i.fetch,c=i.navigate;return T.useCallback(async(f,h={})=>{let{action:g,method:p,encType:m,formData:b,body:v}=y1(f,l);if(h.navigate===!1){let N=h.fetcherKey||H1();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 q1(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:Qt([r,f.pathname])),li(f)}function Y1(i,{relative:l}={}){let r=T.useContext(rg);Le(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=vg("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 Uu(c.pathname,h)!=null||Uu(c.pathname,f)!=null}const bm=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},G1=(i=>i?bm(i):bm),V1=i=>i;function K1(i,l=V1){const r=el.useSyncExternalStore(i.subscribe,el.useCallback(()=>l(i.getState()),[i,l]),el.useCallback(()=>l(i.getInitialState()),[i,l]));return el.useDebugValue(r),r}const Sm=i=>{const l=G1(i),r=o=>K1(l,o);return Object.assign(r,l),r},$o=(i=>i?Sm(i):Sm),xm="/api/v1";class Q1{constructor(){In(this,"token","");In(this,"baseUrl",xm)}setToken(l){this.token=l}setBaseUrl(l){const r=l.trim();if(!r){this.baseUrl=xm;return}this.baseUrl=r.endsWith("/api/v1")||r.endsWith("/api/local/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 X1(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 X1 extends Error{constructor(l,r){super(l),this.status=r,this.name="ApiError"}}const Xe=new Q1,Ot=$o(i=>({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none",login:(l,r)=>{Xe.setToken(l),r&&Xe.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)=>{Xe.setToken(l),Xe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!0,managedBy:o})},setDesktopSession:(l,r)=>{Ot.getState().setManagedSession(l,r,"electron")},logout:()=>{Ot.getState().desktopManaged||(Xe.setToken(""),Xe.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&&(Xe.setToken(l),r&&Xe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"}))}})),Z1=(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)},Em={},jo=(i,l,r,o)=>{fn(r)&&Em[r]||(fn(r)&&(Em[r]=new Date),Z1(i,l,r,o))},bg=(i,l)=>()=>{if(i.isInitialized)l();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),l()};i.on("initialized",r)}},Lo=(i,l,r)=>{i.loadNamespaces(l,bg(i,r))},Tm=(i,l,r,o)=>{if(fn(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(l)>-1)return Lo(i,r,o);r.forEach(c=>{i.options.ns.indexOf(c)<0&&i.options.ns.push(c)}),i.loadLanguages(l,bg(i,o))},$1=(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",J1=i=>typeof i=="object"&&i!==null,F1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,W1={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},I1=i=>W1[i],P1=i=>i.replace(F1,I1);let Do={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:P1};const eb=(i={})=>{Do={...Do,...i}},tb=()=>Do;let Sg;const ab=i=>{Sg=i},nb=()=>Sg,lb={type:"3rdParty",init(i){eb(i.options.react),ab(i)}},ib=T.createContext();class ub{constructor(){this.usedNamespaces={}}addUsedNamespaces(l){l.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const rb=(i,l)=>{const r=T.useRef();return T.useEffect(()=>{r.current=i},[i,l]),r.current},xg=(i,l,r,o)=>i.getFixedT(l,r,o),sb=(i,l,r,o)=>T.useCallback(xg(i,l,r,o),[i,l,r,o]),Eg=(i,l={})=>{var J,V,ue,K;const{i18n:r}=l,{i18n:o,defaultNS:c}=T.useContext(ib)||{},f=r||o||nb();if(f&&!f.reportNamespaces&&(f.reportNamespaces=new ub),!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:J1(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={...tb(),...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=>$1(te,f,h)),v=sb(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),N=()=>v,L=()=>xg(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=rb(B),Q=T.useRef(!0);T.useEffect(()=>{const{bindI18n:te,bindI18nStore:le}=h;Q.current=!0,!b&&!g&&(l.lng?Tm(f,l.lng,m,()=>{Q.current&&H(L)}):Lo(f,m,()=>{Q.current&&H(L)})),b&&q&&q!==B&&Q.current&&H(L);const se=()=>{Q.current&&H(L)};return te&&(f==null||f.on(te,se)),le&&(f==null||f.store.on(le,se)),()=>{Q.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(()=>{Q.current&&b&&H(N)},[f,p,b]);const X=[z,f,b];if(X.t=z,X.i18n=f,X.ready=b,b||!b&&!g)return X;throw new Promise(te=>{l.lng?Tm(f,l.lng,m,()=>te()):Lo(f,m,()=>te())})};function Tg(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=Tg(i[l]))&&(o&&(o+=" "),o+=r)}else for(r in i)i[r]&&(o&&(o+=" "),o+=r);return o}function ob(){for(var i,l,r=0,o="",c=arguments.length;r<c;r++)(i=arguments[r])&&(l=Tg(i))&&(o&&(o+=" "),o+=l);return o}function He(...i){return ob(i)}function u2(i){return i?new Date(i).toLocaleString():"-"}let ii=typeof window<"u"&&window.desktop?"electron":"local_core";const Jo=$o(i=>({snapshot:null,setSnapshot:l=>i({snapshot:l})}));function dn(){return ii}function To(i){ii=i}function cb(){return ii==="electron"}function fb(){return!1}function Ro(i){Jo.getState().setSnapshot(i)}function db(){return Jo.getState().snapshot}function hb(i){return!!(i!=null&&i.knowledge.some(l=>l.enabled!==!1))}function mb(i){return!!(i!=null&&i.schedulers.some(l=>l.enabled!==!1))}function gb(i){var l;return!!((l=i==null?void 0:i.monitors)!=null&&l.some(r=>r.enabled!==!1))}function pb(i,l){return!!(i!=null&&i.agents.some(r=>r.agentType===l))}function yb(i){return!!(i!=null&&i.agents.some(l=>l.agentType))}function vb(i=db()){const l=!!i,r=pb(i,"localcore-acp");return{desktopRuntime:l||ii==="electron"||ii==="local_core",desktopChat:r,chatRoute:l?r:!0,desktopWorkspace:l?yb(i):!0,knowledgeModule:l?hb(i):!0,schedulerModule:l?mb(i):!0,monitorModule:l?gb(i):!0}}function Fo(){const i=Jo(l=>l.snapshot);return vb(i)}function Rm(i){return i==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":i}function _m(i){document.documentElement.classList.toggle("dark",i==="dark")}const Wo=$o(i=>({theme:"dark",resolved:"dark",setTheme:l=>{const r=Rm(l);localStorage.setItem("cc_theme",l),_m(r),i({theme:l,resolved:r})},init:()=>{const l=localStorage.getItem("cc_theme")||"dark",r=Rm(l);_m(r),i({theme:l,resolved:r})}})),bb="modulepreload",Sb=function(i,l){return new URL(i,l).href},Cm={},Je=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=Sb(b,o),b in Cm)return;Cm[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":bb,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)})},xb=T.lazy(()=>Je(()=>import("./Dashboard-eh_RhGYb.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),Eb=T.lazy(()=>Je(()=>import("./ThreadChat-DUOIyXrS.js"),__vite__mapDeps([9,10,11,5,12,13,14,15,16,17,8,18,19,20,21,22]),import.meta.url)),Tb=T.lazy(()=>Je(()=>import("./Chat-BvNNWGGX.js"),__vite__mapDeps([23,10,11,2,14,15,4,24,12,20,21,22,17]),import.meta.url)),Rb=T.lazy(()=>Je(()=>import("./Workspace-Dl80fNEC.js"),__vite__mapDeps([25,10,11,26,18,15,2,3,5,13,22,27,28]),import.meta.url)),_b=T.lazy(()=>Je(()=>import("./ProjectList-BDk5_gqY.js"),__vite__mapDeps([29,1,2,3,4,6,30]),import.meta.url)),Cb=T.lazy(()=>Je(()=>import("./ProjectDetail-Cv_jIE61.js"),__vite__mapDeps([31,1,10,11,2,3,4,32,30,33,27,15,22,34]),import.meta.url)),Ob=T.lazy(()=>Je(()=>import("./SessionList-BZyXT92L.js"),__vite__mapDeps([35,1,26,11,18,15,2,4,24,36,16,17]),import.meta.url)),Ab=T.lazy(()=>Je(()=>import("./SessionChat-BkHy90z3.js"),__vite__mapDeps([37,1,24,14,15,32,16,19,17]),import.meta.url)),zb=T.lazy(()=>Je(()=>import("./CronList-Dj_3muVG.js"),__vite__mapDeps([38,1,10,11,26,18,15,2,3,27,34,21,22]),import.meta.url)),Nb=T.lazy(()=>Je(()=>import("./MonitorList-xEZWg460.js"),__vite__mapDeps([39,1,10,11,26,18,15,2,3,27,34,21,22]),import.meta.url)),wb=T.lazy(()=>Je(()=>import("./Config-lQX2qVVV.js"),__vite__mapDeps([40,5,1,3,28,33]),import.meta.url)),Mb=T.lazy(()=>Je(()=>import("./Logs-Dp-NF6GN.js"),__vite__mapDeps([41,1,26,11,18,15,3,32,36]),import.meta.url)),jb=T.lazy(()=>Je(()=>import("./KnowledgeHome-Cgj4XFXn.js"),__vite__mapDeps([42,10,11,2,21,22,20,27,7]),import.meta.url)),Lb=T.lazy(()=>Je(()=>import("./KnowledgeDetail-Bsz6Ou41.js"),__vite__mapDeps([43,2,32,20,22]),import.meta.url));class Db{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 Pn(i,l,r="/"){return i?l:_.jsx(Ya,{to:r,replace:!0})}function Ub(){const{name:i}=fg();return Ot(r=>r.desktopManaged)?_.jsx(Ya,{to:i?`/workspace?project=${encodeURIComponent(i)}`:"/workspace",replace:!0}):_.jsx(Cb,{})}function Om(){const{project:i,id:l}=fg();if(!Ot(c=>c.desktopManaged))return l&&i?_.jsx(Ab,{}):_.jsx(Ob,{});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 kb(i){[{id:"dashboard",index:!0,titleKey:"nav.dashboard",order:10,element:()=>_.jsx(xb,{})},{id:"chat",path:"chat",titleKey:"nav.chat",order:20,element:({features:r})=>Pn(r.chatRoute,r.desktopChat?_.jsx(Eb,{}):_.jsx(Tb,{}))},{id:"workspace",path:"workspace",titleKey:"nav.workspace",order:30,element:({features:r})=>Pn(r.desktopWorkspace,_.jsx(Rb,{}))},{id:"knowledge",path:"knowledge",titleKey:"nav.knowledge",order:40,element:({features:r})=>Pn(r.knowledgeModule,_.jsx(jb,{}))},{id:"knowledge-detail",path:"knowledge/:knowledgebaseId",titleKey:"nav.knowledge",order:41,element:({features:r})=>Pn(r.knowledgeModule,_.jsx(Lb,{}))},{id:"projects",path:"projects",titleKey:"nav.projects",order:50,element:({desktopManaged:r,features:o})=>r&&o.desktopWorkspace?_.jsx(Ya,{to:"/workspace",replace:!0}):_.jsx(_b,{})},{id:"project-detail",path:"projects/:name",titleKey:"nav.projects",order:51,element:()=>_.jsx(Ub,{})},{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})=>Pn(r.schedulerModule,_.jsx(zb,{}))},{id:"monitors",path:"monitors",titleKey:"nav.monitors",order:71,element:({features:r})=>Pn(r.monitorModule,_.jsx(Nb,{}))},{id:"system",path:"system",titleKey:"nav.system",order:80,element:()=>_.jsx(wb,{})},{id:"system-logs",path:"system/logs",titleKey:"nav.system",order:81,element:()=>_.jsx(Mb,{})}].forEach(r=>i.registerRoute(r))}function Hb(i){[{id:"dashboard",path:"/",labelKey:"nav.dashboard",icon:L0,order:10,end:!0},{id:"chat",path:"/chat",labelKey:"nav.chat",icon:G0,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:I0,order:30,visible:({features:r})=>r.desktopWorkspace},{id:"knowledge",path:"/knowledge",labelKey:"nav.knowledge",icon:U0,order:40,visible:({features:r})=>r.knowledgeModule},{id:"projects",path:"/projects",labelKey:"nav.projects",icon:N0,order:50,visible:({desktopManaged:r})=>!r},{id:"sessions",path:"/sessions",labelKey:"nav.sessions",icon:q0,order:60,visible:({desktopManaged:r})=>!r},{id:"cron",path:"/cron",labelKey:"nav.cron",icon:A0,order:70,visible:({features:r})=>r.schedulerModule},{id:"monitors",path:"/monitors",labelKey:"nav.monitors",icon:S0,order:71,visible:({features:r})=>r.monitorModule},{id:"system",path:"/system",labelKey:"nav.system",icon:Z0,order:80}].forEach(r=>i.registerNavItem(r))}const Zu=new Db;kb(Zu);Hb(Zu);function Rg({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 _o={};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},Am=i=>i==null?"":""+i,Bb=(i,l,r)=>{i.forEach(o=>{l[o]&&(r[o]=l[o])})},qb=/###/g,zm=i=>i&&i.indexOf("###")>-1?i.replace(qb,"."):i,Nm=i=>!i||ae(i),ti=(i,l,r)=>{const o=ae(l)?l.split("."):l;let c=0;for(;c<o.length-1;){if(Nm(i))return{};const f=zm(o[c]);!i[f]&&r&&(i[f]=new r),Object.prototype.hasOwnProperty.call(i,f)?i=i[f]:i={},++c}return Nm(i)?{}:{obj:i,k:zm(o[c])}},wm=(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},Yb=(i,l,r,o)=>{const{obj:c,k:f}=ti(i,l,Object);c[f]=c[f]||[],c[f].push(r)},Hu=(i,l)=>{const{obj:r,k:o}=ti(i,l);if(r&&Object.prototype.hasOwnProperty.call(r,o))return r[o]},Gb=(i,l,r)=>{const o=Hu(i,r);return o!==void 0?o:Hu(l,r)},_g=(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]):_g(i[o],l[o],r):i[o]=l[o]);return i},sn=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Vb={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Kb=i=>ae(i)?i.replace(/[&<>"'\/]/g,l=>Vb[l]):i;class Qb{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 Xb=[" ",",","?","!",";"],Zb=new Qb(20),$b=(i,l,r)=>{l=l||"",r=r||"";const o=Xb.filter(h=>l.indexOf(h)<0&&r.indexOf(h)<0);if(o.length===0)return!0;const c=Zb.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},Uo=(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,"-"),Jb={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 Bu{constructor(l,r={}){this.init(l,r)}init(l,r={}){this.prefix=r.prefix||"i18next:",this.logger=l||Jb,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 Bu(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new Bu(this.logger,l)}}var Ft=new Bu;class $u{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 Mm extends $u{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=Hu(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:Uo((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),wm(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=Hu(this.data,g)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?_g(p,o,f):p={...p,...o},wm(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 Cg={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 Fb(){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 tl(i,l){const{[Og]:r}=i(Fb()),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={},Co=i=>!ae(i)&&typeof i!="boolean"&&typeof i!="number";class qu extends $u{constructor(l,r={}){super(),Bb(["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=Co(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&&!$b(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=tl(l,{...this.options,...c})),Array.isArray(l)||(l=[String(l)]),l=l.map(ze=>typeof ze=="function"?tl(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]"],Q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,X=!this.i18nFormat||this.i18nFormat.handleAsObject,J=c.count!==void 0&&!ae(c.count),V=qu.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;X&&!z&&V&&(se=le);const Ae=Co(se),We=Object.prototype.toString.apply(se);if(X&&se&&Ae&&q.indexOf(We)<0&&!(ae(Q)&&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),Me=ze?[]:{},De=ze?B:H;for(const M in se)if(Object.prototype.hasOwnProperty.call(se,M)){const Y=`${De}${h}${M}`;V&&!z?Me[M]=this.translate(Y,{...c,defaultValue:Co(le)?le[M]:void 0,joinArrays:!1,ns:p}):Me[M]=this.translate(Y,{...c,joinArrays:!1,ns:p}),Me[M]===Y&&(Me[M]=se[M])}z=Me}}else if(X&&ae(Q)&&Array.isArray(z))z=z.join(Q),z&&(z=this.extendTranslation(z,l,c,o));else{let ze=!1,Me=!1;!this.isValidLookup(z)&&V&&(ze=!0,z=le),this.isValidLookup(z)||(Me=!0,z=g);const M=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Me?void 0:z,Y=V&&le!==z&&this.options.updateMissing;if(Me||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:M;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),Me&&z===g&&this.options.appendNamespaceToMissingKey&&(z=`${m}${b}${g}`),(Me||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=Cg.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"?tl(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,Q;this.isValidLookup(o)||(g=B,!jm[`${H[0]}-${B}`]&&((q=this.utils)!=null&&q.hasLoadedNamespace)&&!((Q=this.utils)!=null&&Q.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(X=>{var ue;if(this.isValidLookup(o))return;h=X;const J=[b];if((ue=this.i18nFormat)!=null&&ue.addLookupKeys)this.i18nFormat.addLookupKeys(J,b,X,B,r);else{let K;N&&(K=this.pluralResolver.getSuffix(X,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(X,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 Lm{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 Dm={zero:0,one:1,two:2,few:3,many:4,other:5},Um={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Wb{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!"),Um;if(!l.match(/-|_/))return Um;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)=>Dm[c]-Dm[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 km=(i,l,r,o=".",c=!0)=>{let f=Gb(i,l,r);return!f&&c&&ae(r)&&(f=Uo(i,r,o),f===void 0&&(f=Uo(l,r,o))),f},Oo=i=>i.replace(/\$/g,"$$$$");class Hm{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:Q}=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=Q!==void 0?Q:!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 Q=km(r,p,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(Q,void 0,o,{...c,...r,interpolationkey:z}):Q}const H=z.split(this.formatSeparator),B=H.shift().trim(),q=H.join(this.formatSeparator).trim();return this.format(km(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=Am(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=Am(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 Ib=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}},Bm=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)}},Pb=i=>(l,r,o)=>i(ui(r),o)(l);class eS{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?Bm:Pb;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()]=Bm(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}=Ib(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 tS=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class aS extends $u{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=>{Yb(p.loaded,[f],h),tS(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 Ao=()=>({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}),qm=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},Mu=()=>{},nS=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})},Ag="__i18next_supportNoticeShown",lS=()=>!!(typeof globalThis<"u"&&globalThis[Ag]||typeof process<"u"&&_o&&_o.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&_o),iS=()=>{typeof globalThis<"u"&&(globalThis[Ag]=!0)},uS=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 $u{constructor(l={},r){if(super(),this.options=qm(l),this.services={},this.logger=Ft,this.modules={external:[]},nS(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=Ao();this.options={...o,...this.options,...qm(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&&!uS(this)&&!lS()&&(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 💙"),iS());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=eS;const b=new Lm(this.options);this.store=new Mm(this.options.resources,this.options);const v=this.services;v.logger=Ft,v.resourceStore=this.store,v.languageUtils=b,v.pluralResolver=new Wb(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 Hm(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new aS(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 qu(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=Mu),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=Mu){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=Mu),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"&&Cg.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=tl(p.keyPrefix,m));const b=this.options.keySeparator||".";let v;return p.keyPrefix&&Array.isArray(f)?v=f.map(N=>(typeof N=="function"&&(N=tl(N,m)),`${p.keyPrefix}${b}${N}`)):(typeof f=="function"&&(f=tl(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 Lm(Ao());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=Mu){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 Mm(g,c),f.services.resourceStore=f.store}if(l.interpolation){const p={...Ao().interpolation,...this.options.interpolation,...l.interpolation},m={...c,interpolation:p};f.services.interpolator=new Hm(m)}return f.translator=new qu(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 Fe=ai.createInstance();Fe.createInstance;Fe.dir;Fe.init;Fe.loadResources;Fe.reloadResources;Fe.use;Fe.changeLanguage;Fe.getFixedT;Fe.t;Fe.exists;Fe.setDefaultNamespace;Fe.hasLoadedNamespace;Fe.loadNamespaces;Fe.loadLanguages;const ni="en",zg={en:()=>Je(()=>import("./en-D2SkCrhG.js"),[],import.meta.url),zh:()=>Je(()=>import("./zh-DIcdHycM.js"),[],import.meta.url),"zh-TW":()=>Je(()=>import("./zh-TW-BtRwreY_.js"),[],import.meta.url),ja:()=>Je(()=>import("./ja-ChF4vbBL.js"),[],import.meta.url),es:()=>Je(()=>import("./es-C8UBPhxM.js"),[],import.meta.url)},Du={};function Ym(i){return i in zg}function Ng(i){if(Ym(i))return i;const l=i.split("-")[0];return Ym(l)?l:ni}function rS(){const i=localStorage.getItem("cc_lang");return Ng(i||navigator.language||ni)}async function ko(i){if(Du[i])return;const l=await zg[i]();Du[i]=l.default,Fe.isInitialized&&Fe.addResourceBundle(i,"translation",Du[i],!0,!0)}async function sS(){const i=rS();await Promise.all([ko(ni),i===ni?Promise.resolve():ko(i)]),Fe.isInitialized||await Fe.use(lb).init({lng:i,fallbackLng:ni,resources:Object.fromEntries(Object.entries(Du).map(([l,r])=>[l,{translation:r}])),interpolation:{escapeValue:!1}})}async function wg(i){const l=Ng(i);await ko(l),await Fe.changeLanguage(l),localStorage.setItem("cc_lang",l)}const Gm=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"zh-TW",label:"繁體中文"},{code:"ja",label:"日本語"},{code:"es",label:"Español"}],oS=[{label:"Core",ids:["dashboard","chat","workspace","projects","sessions"]},{label:"Knowledge",ids:["knowledge","cron","monitors"]},{label:"System",ids:["system"]}];function cS(){var J;const{pathname:i}=zt(),{t:l,i18n:r}=Eg(),{theme:o,setTheme:c}=Wo(),f=Ot(V=>V.logout),h=Ot(V=>V.desktopManaged),g=Fo(),p=dn(),[m,b]=T.useState(!1),[v,N]=T.useState(!1),L=V=>{wg(V),N(!1)},z={light:Im,dark:Fm,system:Jm},H={light:"dark",dark:"system",system:"light"},B=z[o],q=Zu.listNavItems().filter(V=>{var ue;return((ue=V.visible)==null?void 0:ue.call(V,{desktopManaged:h,features:g}))??!0}),Q=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}}),X=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(Rg,{showWordmark:!m})}),_.jsx("nav",{className:"relative flex-1 py-3 space-y-4 px-2 overflow-y-auto",children:oS.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(Mo,{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.43"]}),_.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(M0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:((J=Gm.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:Gm.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(H0,{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(R0,{size:18}):_.jsx(E0,{size:18})})]})]}),X?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:Q.map(({id:V,path:ue,end:K,Icon:te,labelKey:le})=>_.jsxs(Mo,{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 fS(){const{pathname:i}=zt(),{desktopChat:l}=Fo(),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(cS,{}),_.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(u1,{})})})})]})}const dS=()=>Xe.get("/status"),r2=i=>Xe.post("/restart",i),s2=()=>Xe.post("/reload"),o2=i=>Xe.get("/logs",i);function hS({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 Vm(i,l){if(typeof i=="function")return i(l);i!=null&&(i.current=l)}function Mg(...i){return l=>{let r=!1;const o=i.map(c=>{const f=Vm(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():Vm(i[c],null)}}}}function c2(...i){return T.useCallback(Mg(...i),i)}var mS=Symbol.for("react.lazy"),Yu=m0[" use ".trim().toString()];function gS(i){return typeof i=="object"&&i!==null&&"then"in i}function jg(i){return i!=null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===mS&&"_payload"in i&&gS(i._payload)}function pS(i){const l=vS(i),r=T.forwardRef((o,c)=>{let{children:f,...h}=o;jg(f)&&typeof Yu=="function"&&(f=Yu(f._payload));const g=T.Children.toArray(f),p=g.find(SS);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 yS=pS("Slot");function vS(i){const l=T.forwardRef((r,o)=>{let{children:c,...f}=r;if(jg(c)&&typeof Yu=="function"&&(c=Yu(c._payload)),T.isValidElement(c)){const h=ES(c),g=xS(f,c.props);return c.type!==T.Fragment&&(g.ref=o?Mg(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 bS=Symbol("radix.slottable");function SS(i){return T.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===bS}function xS(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 ES(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 TS={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"},RS={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 Gu({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?yS:"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",TS[i],RS[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 Km({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 f2({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 Ho="http://127.0.0.1:9831",_S=`${Ho}/api/local/v1`;function CS(i){const l=i.trim();return l?l.replace(/\/+$/,""):_S}const ri=CS("/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 Lg(){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","thread.session.activated","message.created","message.updated","run.updated","scheduler.job.updated","scheduler.run.updated","automation.monitor.updated","automation.monitor.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(()=>Lg(),1e3)}}function OS(){si.size===0&&_t&&(_t.close(),_t=null)}function Dg(i){return si.add(i),Lg(),()=>{si.delete(i),OS()}}async function d2(){return W("GET","/runtime")}async function h2(){return W("POST","/runtime/service/start")}async function m2(){return W("POST","/runtime/service/stop")}async function g2(){return W("POST","/runtime/service/restart")}async function p2(i){const l=typeof i=="number"?`?limit=${encodeURIComponent(String(i))}`:"";return W("GET",`/runtime/logs${l}`)}async function y2(){return W("GET","/runtime/agent-runtimes")}async function v2(){return W("POST","/runtimes/refresh")}async function b2(){return W("GET","/runtime/config")}async function S2(i){return W("POST","/runtime/config/raw",{raw:i})}async function x2(i){return W("POST","/runtime/config/structured",{config:i})}async function E2(i){return W("POST","/runtime/settings",i)}async function AS(i){return W("GET",`/platforms/${encodeURIComponent(i)}`)}function di(i){return i?`?instance_id=${encodeURIComponent(i)}`:""}async function zS(i,l,r){return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}${di(r)}`)}async function NS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/test${di(r)}`)}async function wS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/enable${di(r)}`)}async function MS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/disable${di(r)}`)}async function jS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/pairings${r}`)}async function LS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/approve`,{code:l})}async function DS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/reject`,{code:l})}async function US(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/users${r}`)}async function Ug(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode${di(r)}`)}async function kg(i,l,r,o){const c=`?ticket=${encodeURIComponent(r)}${o?`&instance_id=${encodeURIComponent(o)}`:""}`;return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode/status${c}`)}async function T2(){return AS("lark")}async function R2(i,l){return zS("lark",i,l)}async function _2(i,l){return NS("lark",i,l)}async function C2(i,l){return wS("lark",i,l)}async function O2(i,l){return MS("lark",i,l)}async function A2(i){return jS("lark",i)}async function z2(i){return LS("lark",i)}async function N2(i){return DS("lark",i)}async function w2(i){return US("lark",i)}async function M2(i,l){return Ug("lark",i,l)}async function j2(i,l,r){return kg("lark",i,l,r)}async function L2(i,l){return Ug("weixin",i,l)}async function D2(i,l,r){return kg("weixin",i,l,r)}async function U2(){return W("GET","/workspaces")}async function k2(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 H2(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 B2(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 q2(i){return W("GET","/scheduler/jobs")}async function Y2(i){return W("POST","/scheduler/jobs",i)}async function G2(i,l){return W("PATCH",`/scheduler/jobs/${encodeURIComponent(i)}`,l)}async function V2(i){return W("DELETE",`/scheduler/jobs/${encodeURIComponent(i)}`)}async function K2(i){return W("POST",`/scheduler/jobs/${encodeURIComponent(i)}/run`)}async function Q2(i){return W("GET","/automation/monitors")}async function X2(i){return W("POST","/automation/monitors",i)}async function Z2(i,l){return W("PATCH",`/automation/monitors/${encodeURIComponent(i)}`,l)}async function $2(i){return W("DELETE",`/automation/monitors/${encodeURIComponent(i)}`)}async function J2(i){return W("POST",`/automation/monitors/${encodeURIComponent(i)}/run`)}async function F2(i){return W("GET",`/threads?workspace_id=${encodeURIComponent(i)}`)}async function W2(i,l){return W("POST","/threads",{workspaceId:i,title:l})}async function I2(i){return W("GET",`/threads/${encodeURIComponent(i)}`)}async function P2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}`,{title:l})}async function ex(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}/knowledge-bases`,{knowledgeBaseIds:l})}async function tx(i){return W("DELETE",`/threads/${encodeURIComponent(i)}`)}async function ax(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/messages`,{content:l})}async function nx(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/actions`,{content:l})}async function lx(i){return W("POST",`/runs/${encodeURIComponent(i)}/interrupt`)}async function ix(){return W("GET","/knowledge/config")}async function ux(){return W("GET","/knowledge/folders")}async function rx(i){return W("POST","/knowledge/folders",i)}async function sx(i,l){return W("PATCH",`/knowledge/folders/${encodeURIComponent(i)}`,l)}async function ox(i){return W("DELETE",`/knowledge/folders/${encodeURIComponent(i)}`)}async function cx(){return W("GET","/knowledge/bases")}async function fx(i){return W("POST","/knowledge/bases",i)}async function dx(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}`)}async function hx(i,l){return W("PATCH",`/knowledge/bases/${encodeURIComponent(i)}`,l)}async function mx(i){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}`)}async function gx(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}/files`)}async function px(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 yx(i,l){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}/files/${encodeURIComponent(l)}`)}async function vx(i,l){return W("POST",`/knowledge/bases/${encodeURIComponent(i)}/search`,l)}async function bx(){return W("GET","/capabilities/snapshot")}async function Sx(){return W("GET","/plugins/diagnostics")}async function xx(i){return W("POST",`/workspaces/${encodeURIComponent(i)}/streaming-probe`)}function Ex(i){return Dg(l=>{l.type==="runtime.updated"&&i(l.runtime)})}function Tx(i){return Dg(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 kS=[{code:"en",label:"EN"},{code:"zh",label:"中"},{code:"zh-TW",label:"繁"},{code:"ja",label:"日"},{code:"es",label:"ES"}];function HS(){const{t:i,i18n:l}=Eg(),r=Qu(),o=Ot(J=>J.login),{theme:c,setTheme:f}=Wo(),[h,g]=T.useState(""),[p,m]=T.useState(""),[b,v]=T.useState(""),[N,L]=T.useState(!1),z=cb(),H=fb(),B=async J=>{if(J.preventDefault(),!(!h.trim()||H)){L(!0),v("");try{p.trim()&&Xe.setBaseUrl(p.trim()),Xe.setToken(h.trim()),await dS(),o(h.trim(),p.trim()),z?window.location.hash="#/":r("/",{replace:!0})}catch{v(i("login.invalidToken")),Xe.setToken(""),Xe.setBaseUrl("")}finally{L(!1)}}},q={light:Im,dark:Fm,system:Jm},Q={light:"dark",dark:"system",system:"light"},X=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:kS.map(J=>_.jsx("button",{onClick:()=>void wg(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(Gu,{variant:"outline",size:"icon",onClick:()=>f(Q[c]),"aria-label":i(`theme.${c}`),children:_.jsx(X,{size:16})})]}),_.jsx("div",{className:"w-full max-w-md animate-fade-in",children:_.jsxs(hS,{className:"p-8 shadow-2xl shadow-primary/10",children:[_.jsx("div",{className:"flex justify-center mb-6",children:_.jsx(Rg,{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(C0,{size:16}),b]}),_.jsxs("form",{onSubmit:B,className:"space-y-4",children:[_.jsx(Km,{label:i("login.token"),type:"password",value:h,onChange:J=>g(J.target.value),placeholder:"mgmt-secret-xxx",autoFocus:!0}),_.jsx(Km,{label:`${i("login.serverUrl")} (${i("common.optional")})`,type:"text",value:p,onChange:J=>m(J.target.value),placeholder:"http://localhost:9820"}),_.jsxs(Gu,{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(ev,{size:16}),i("login.connect")]})]})]})})]})}function BS({children:i}){return Ot(r=>r.isAuthenticated)?_.jsx(_.Fragment,{children:i}):_.jsx(Ya,{to:"/login",replace:!0})}function qS(){return _.jsx("div",{className:"flex min-h-64 items-center justify-center text-sm text-muted-foreground",children:"正在加载…"})}function YS(){const i=Ot(o=>o.isAuthenticated),l=Ot(o=>o.desktopManaged),r=Fo();return _.jsx(T.Suspense,{fallback:_.jsx(qS,{}),children:_.jsxs(s1,{children:[_.jsx(on,{path:"/login",element:i?_.jsx(Ya,{to:"/",replace:!0}):_.jsx(HS,{})}),_.jsxs(on,{element:_.jsx(BS,{children:_.jsx(fS,{})}),children:[Zu.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 GS extends el.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 VS="http://127.0.0.1:9831",KS=`${VS}/api/local/v1`,cn=QS("/api/local/v1"),oi=new Set;let Kt=null;function QS(i){const l=i.trim();return l?l.replace(/\/+$/,""):KS}async function Io(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 XS(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 Hg(){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(()=>Hg(),1e3)})}function ZS(){oi.size===0&&Kt&&(Kt.close(),Kt=null)}async function $S(){return window.desktop?(To("electron"),!0):(await XS(),To("local_core"),!0)}function JS(){return dn()==="electron"&&window.desktop?window.desktop.getRuntimeStatus():Io("GET","/runtime")}function Qm(){return Io("GET","/capabilities/snapshot")}function FS(i){if(dn()==="electron"&&window.desktop)return window.desktop.getLogs(i);const l=`?limit=${encodeURIComponent(String(i))}`;return Io("GET",`/runtime/logs${l}`)}function WS(i){return dn()==="electron"&&window.desktop?window.desktop.onRuntimeEvent(i):(oi.add(i),Hg(),()=>{oi.delete(i),ZS()})}const Xm=20,IS=500;function PS(i){return new Promise(l=>window.setTimeout(l,i))}function e2(){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(Wm,{size:16,className:"animate-spin"}),"正在初始化 AgentDock 运行时…"]})})}function t2({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(F0,{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(`
|
|
181
|
+
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=Pm(i,{pathname:L});Ct(m||z!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Ct(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=Iv(z&&z.map(q=>Object.assign({},q,{params:Object.assign({},h,q.params),pathname:Qt([p,o.encodeLocation?o.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?p:Qt([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 $v(){let i=n1(),l=jv(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 Jv=T.createElement($v,null),hg=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=Gv(i.digest);r&&(i=r)}let l=i!==void 0?T.createElement(qt.Provider,{value:this.props.routeContext},T.createElement(Yo.Provider,{value:i,children:this.props.component})):this.props.children;return this.context?T.createElement(Fv,{error:i},l):l}};hg.contextType=ug;var xo=new WeakMap;function Fv({children:i,error:l}){let{basename:r}=T.useContext(At);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let o=Yv(l.digest);if(o){let c=xo.get(l);if(c)throw c;let f=lg(o.location,r);if(ng&&!xo.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 xo.set(l,h),h}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return i}function Wv({routeContext:i,match:l,children:r}){let o=T.useContext(al);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 Iv(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:Lv(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||Jv,h&&(g<0&&N===0?(mg("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)),Q=()=>{let X;return L?X=H:z?X=B:v.route.Component?X=T.createElement(v.route.Component,null):v.route.element?X=v.route.element:X=b,T.createElement(Wv,{match:v,routeContext:{outlet:b,matches:q,isDataRoute:o!=null},children:X})};return o&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?T.createElement(hg,{location:o.location,revalidation:o.revalidation,component:H,error:L,children:Q(),routeContext:{outlet:null,matches:q,isDataRoute:!0},onError:m}):Q()},null)}function Go(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pv(i){let l=T.useContext(al);return Le(l,Go(i)),l}function e1(i){let l=T.useContext(Ku);return Le(l,Go(i)),l}function t1(i){let l=T.useContext(qt);return Le(l,Go(i)),l}function Vo(i){let l=t1(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 a1(){return Vo("useRouteId")}function n1(){var o;let i=T.useContext(Yo),l=e1("useRouteError"),r=Vo("useRouteError");return i!==void 0?i:(o=l.errors)==null?void 0:o[r]}function l1(){let{router:i}=Pv("useNavigate"),l=Vo("useNavigate"),r=T.useRef(!1);return cg(()=>{r.current=!0}),T.useCallback(async(c,f={})=>{Ct(r.current,og),r.current&&(typeof c=="number"?await i.navigate(c):await i.navigate(c,{fromRouteId:l,...f}))},[i,l])}var ym={};function mg(i,l,r){!l&&!ym[i]&&(ym[i]=!0,Ct(!1,r))}T.memo(i1);function i1({routes:i,future:l,state:r,isStatic:o,onError:c}){return dg(i,void 0,{state:r,isStatic:o,onError:c})}function Ya({to:i,replace:l,state:r,relative:o}){Le(nl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=T.useContext(At);Ct(!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=Qu(),p=Vu(i,qo(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 u1(i){return Xv(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 r1({basename:i="/",children:l=null,location:r,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:h}){Le(!nl(),"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 Ct(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 s1({children:i,location:l}){return Zv(No(i),l)}function No(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,No(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=No(o.props.children,f)),r.push(h)}),r}var ju="get",Lu="application/x-www-form-urlencoded";function Xu(i){return typeof HTMLElement<"u"&&i instanceof HTMLElement}function o1(i){return Xu(i)&&i.tagName.toLowerCase()==="button"}function c1(i){return Xu(i)&&i.tagName.toLowerCase()==="form"}function f1(i){return Xu(i)&&i.tagName.toLowerCase()==="input"}function d1(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function h1(i,l){return i.button===0&&(!l||l==="_self")&&!d1(i)}function wo(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 m1(i,l){let r=wo(i);return l&&l.forEach((o,c)=>{r.has(c)||l.getAll(c).forEach(f=>{r.append(c,f)})}),r}var wu=null;function g1(){if(wu===null)try{new FormData(document.createElement("form"),0),wu=!1}catch{wu=!0}return wu}var p1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Eo(i){return i!=null&&!p1.has(i)?(Ct(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lu}"`),null):i}function y1(i,l){let r,o,c,f,h;if(c1(i)){let g=i.getAttribute("action");o=g?ga(g,l):null,r=i.getAttribute("method")||ju,c=Eo(i.getAttribute("enctype"))||Lu,f=new FormData(i)}else if(o1(i)||f1(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=Eo(i.getAttribute("formenctype"))||Eo(g.getAttribute("enctype"))||Lu,f=new FormData(g,i),!g1()){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=Lu,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 Ko(i,l){if(i===!1||i===null||typeof i>"u")throw new Error(l)}function gg(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=`${ku(l)}/_root.${o}`:c.pathname=`${ku(c.pathname)}.${o}`,c}async function v1(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 b1(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 S1(i,l,r){let o=await Promise.all(i.map(async c=>{let f=l.routes[c.route.id];if(f){let h=await v1(f,r);return h.links?h.links():[]}return[]}));return R1(o.flat(1).filter(b1).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function vm(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 x1(i,l,{includeHydrateFallback:r}={}){return E1(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 E1(i){return[...new Set(i)]}function T1(i){let l={},r=Object.keys(i).sort();for(let o of r)l[o]=i[o];return l}function R1(i,l){let r=new Set;return new Set(l),i.reduce((o,c)=>{let f=JSON.stringify(T1(c));return r.has(f)||(r.add(f),o.push({key:f,link:c})),o},[])}function Qo(){let i=T.useContext(al);return Ko(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function _1(){let i=T.useContext(Ku);return Ko(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Xo=T.createContext(void 0);Xo.displayName="FrameworkContext";function Zo(){let i=T.useContext(Xo);return Ko(i,"You must render this element inside a <HydratedRouter> element"),i}function C1(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(Q=>{h(Q.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:Pl(g,L),onBlur:Pl(p,z),onMouseEnter:Pl(m,L),onMouseLeave:Pl(b,z),onTouchStart:Pl(v,L)}]:[!1,N,{}]}function Pl(i,l){return r=>{i&&i(r),r.defaultPrevented||l(r)}}function O1({page:i,...l}){let r=Uv(),{router:o}=Qo(),c=T.useMemo(()=>Pm(o.routes,i,o.basename),[o.routes,i,o.basename]);return c?r?T.createElement(z1,{page:i,matches:c,...l}):T.createElement(N1,{page:i,matches:c,...l}):null}function A1(i){let{manifest:l,routeModules:r}=Zo(),[o,c]=T.useState([]);return T.useEffect(()=>{let f=!1;return S1(i,l,r).then(h=>{f||c(h)}),()=>{f=!0}},[i,l,r]),o}function z1({page:i,matches:l,...r}){let o=zt(),{future:c}=Zo(),{basename:f}=Qo(),h=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let g=gg(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 N1({page:i,matches:l,...r}){let o=zt(),{future:c,manifest:f,routeModules:h}=Zo(),{basename:g}=Qo(),{loaderData:p,matches:m}=_1(),b=T.useMemo(()=>vm(i,l,m,f,o,"data"),[i,l,m,f,o]),v=T.useMemo(()=>vm(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(Q=>{var J;let X=f.routes[Q.route.id];!X||!X.hasLoader||(!b.some(V=>V.route.id===Q.route.id)&&Q.route.id in p&&((J=h[Q.route.id])!=null&&J.shouldRevalidate)||X.hasClientLoader?B=!0:H.add(Q.route.id))}),H.size===0)return[];let q=gg(i,g,c.unstable_trailingSlashAwareDataRequests,"data");return B&&H.size>0&&q.searchParams.set("_routes",l.filter(Q=>H.has(Q.route.id)).map(Q=>Q.route.id).join(",")),[q.pathname+q.search]},[g,c.unstable_trailingSlashAwareDataRequests,p,o,f,b,l,i,h]),L=T.useMemo(()=>x1(v,f),[v,f]),z=A1(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 w1(...i){return l=>{i.forEach(r=>{typeof r=="function"?r(l):r!=null&&(r.current=l)})}}var M1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{M1&&(window.__reactRouterVersion="7.14.2")}catch{}function j1({basename:i,children:l,unstable_useTransitions:r,window:o}){let c=T.useRef();c.current==null&&(c.current=ov({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(r1,{basename:i,children:l,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:r})}var pg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yg=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:Q}=T.useContext(At),X=typeof b=="string"&&pg.test(b),J=lg(b,B);b=J.to;let V=Vv(b,{relative:c}),ue=zt(),K=null;if(g){let De=Vu(g,[],ue.unstable_mask?ue.unstable_mask.pathname:"/",!0);B!=="/"&&(De.pathname=De.pathname==="/"?B:Qt([B,De.pathname])),K=q.createHref(De)}let[te,le,se]=C1(o,z),Ae=U1(b,{replace:h,unstable_mask:g,state:p,target:m,preventScrollReset:v,relative:c,viewTransition:N,unstable_defaultShouldRevalidate:L,unstable_useTransitions:Q});function We(De){l&&l(De),De.defaultPrevented||Ae(De)}let ze=!(J.isExternal||f),Me=T.createElement("a",{...z,...se,href:(ze?K:void 0)||J.absoluteURL||V,onClick:ze?We:l,ref:w1(H,le),target:m,"data-discover":!X&&r==="render"?"true":void 0});return te&&!X?T.createElement(T.Fragment,null,Me,T.createElement(O1,{page:V})):Me});yg.displayName="Link";var Mo=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(Ku),{navigator:z,basename:H}=T.useContext(At),B=L!=null&&Y1(v)&&g===!0,q=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,Q=N.pathname,X=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(Q=Q.toLowerCase(),X=X?X.toLowerCase():null,q=q.toLowerCase()),X&&H&&(X=ga(X,H)||X);const J=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let V=Q===q||!c&&Q.startsWith(q)&&Q.charAt(J)==="/",ue=X!=null&&(X===q||!c&&X.startsWith(q)&&X.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(yg,{...m,"aria-current":te,className:le,ref:b,style:se,to:h,viewTransition:g},typeof p=="function"?p(K):p)});Mo.displayName="NavLink";var L1=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=B1(),q=q1(g,{relative:m}),Q=h.toLowerCase()==="get"?"get":"post",X=typeof g=="string"&&pg.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:Q,action:q,onSubmit:o?p:J,...L,"data-discover":!X&&i==="render"?"true":void 0})});L1.displayName="Form";function D1(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vg(i){let l=T.useContext(al);return Le(l,D1(i)),l}function U1(i,{target:l,replace:r,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let b=Qu(),v=zt(),N=fi(i,{relative:h});return T.useCallback(L=>{if(h1(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 i2(i){Ct(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(wo(i)),r=T.useRef(!1),o=zt(),c=T.useMemo(()=>m1(o.search,r.current?null:l.current),[o.search]),f=Qu(),h=T.useCallback((g,p)=>{const m=wo(typeof g=="function"?g(new URLSearchParams(c)):g);r.current=!0,f("?"+m,p)},[f,c]);return[c,h]}var k1=0,H1=()=>`__${String(++k1)}__`;function B1(){let{router:i}=vg("useSubmit"),{basename:l}=T.useContext(At),r=a1(),o=i.fetch,c=i.navigate;return T.useCallback(async(f,h={})=>{let{action:g,method:p,encType:m,formData:b,body:v}=y1(f,l);if(h.navigate===!1){let N=h.fetcherKey||H1();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 q1(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:Qt([r,f.pathname])),li(f)}function Y1(i,{relative:l}={}){let r=T.useContext(rg);Le(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=vg("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 Uu(c.pathname,h)!=null||Uu(c.pathname,f)!=null}const bm=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},G1=(i=>i?bm(i):bm),V1=i=>i;function K1(i,l=V1){const r=el.useSyncExternalStore(i.subscribe,el.useCallback(()=>l(i.getState()),[i,l]),el.useCallback(()=>l(i.getInitialState()),[i,l]));return el.useDebugValue(r),r}const Sm=i=>{const l=G1(i),r=o=>K1(l,o);return Object.assign(r,l),r},$o=(i=>i?Sm(i):Sm),xm="/api/v1";class Q1{constructor(){In(this,"token","");In(this,"baseUrl",xm)}setToken(l){this.token=l}setBaseUrl(l){const r=l.trim();if(!r){this.baseUrl=xm;return}this.baseUrl=r.endsWith("/api/v1")||r.endsWith("/api/local/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 X1(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 X1 extends Error{constructor(l,r){super(l),this.status=r,this.name="ApiError"}}const Xe=new Q1,Ot=$o(i=>({token:"",serverUrl:"",isAuthenticated:!1,desktopManaged:!1,managedBy:"none",login:(l,r)=>{Xe.setToken(l),r&&Xe.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)=>{Xe.setToken(l),Xe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!0,managedBy:o})},setDesktopSession:(l,r)=>{Ot.getState().setManagedSession(l,r,"electron")},logout:()=>{Ot.getState().desktopManaged||(Xe.setToken(""),Xe.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&&(Xe.setToken(l),r&&Xe.setBaseUrl(r),i({token:l,serverUrl:r,isAuthenticated:!0,desktopManaged:!1,managedBy:"remote"}))}})),Z1=(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)},Em={},jo=(i,l,r,o)=>{fn(r)&&Em[r]||(fn(r)&&(Em[r]=new Date),Z1(i,l,r,o))},bg=(i,l)=>()=>{if(i.isInitialized)l();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),l()};i.on("initialized",r)}},Lo=(i,l,r)=>{i.loadNamespaces(l,bg(i,r))},Tm=(i,l,r,o)=>{if(fn(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(l)>-1)return Lo(i,r,o);r.forEach(c=>{i.options.ns.indexOf(c)<0&&i.options.ns.push(c)}),i.loadLanguages(l,bg(i,o))},$1=(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",J1=i=>typeof i=="object"&&i!==null,F1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,W1={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},I1=i=>W1[i],P1=i=>i.replace(F1,I1);let Do={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:P1};const eb=(i={})=>{Do={...Do,...i}},tb=()=>Do;let Sg;const ab=i=>{Sg=i},nb=()=>Sg,lb={type:"3rdParty",init(i){eb(i.options.react),ab(i)}},ib=T.createContext();class ub{constructor(){this.usedNamespaces={}}addUsedNamespaces(l){l.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const rb=(i,l)=>{const r=T.useRef();return T.useEffect(()=>{r.current=i},[i,l]),r.current},xg=(i,l,r,o)=>i.getFixedT(l,r,o),sb=(i,l,r,o)=>T.useCallback(xg(i,l,r,o),[i,l,r,o]),Eg=(i,l={})=>{var J,V,ue,K;const{i18n:r}=l,{i18n:o,defaultNS:c}=T.useContext(ib)||{},f=r||o||nb();if(f&&!f.reportNamespaces&&(f.reportNamespaces=new ub),!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:J1(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={...tb(),...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=>$1(te,f,h)),v=sb(f,l.lng||null,h.nsMode==="fallback"?m:m[0],p),N=()=>v,L=()=>xg(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=rb(B),Q=T.useRef(!0);T.useEffect(()=>{const{bindI18n:te,bindI18nStore:le}=h;Q.current=!0,!b&&!g&&(l.lng?Tm(f,l.lng,m,()=>{Q.current&&H(L)}):Lo(f,m,()=>{Q.current&&H(L)})),b&&q&&q!==B&&Q.current&&H(L);const se=()=>{Q.current&&H(L)};return te&&(f==null||f.on(te,se)),le&&(f==null||f.store.on(le,se)),()=>{Q.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(()=>{Q.current&&b&&H(N)},[f,p,b]);const X=[z,f,b];if(X.t=z,X.i18n=f,X.ready=b,b||!b&&!g)return X;throw new Promise(te=>{l.lng?Tm(f,l.lng,m,()=>te()):Lo(f,m,()=>te())})};function Tg(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=Tg(i[l]))&&(o&&(o+=" "),o+=r)}else for(r in i)i[r]&&(o&&(o+=" "),o+=r);return o}function ob(){for(var i,l,r=0,o="",c=arguments.length;r<c;r++)(i=arguments[r])&&(l=Tg(i))&&(o&&(o+=" "),o+=l);return o}function He(...i){return ob(i)}function u2(i){return i?new Date(i).toLocaleString():"-"}let ii=typeof window<"u"&&window.desktop?"electron":"local_core";const Jo=$o(i=>({snapshot:null,setSnapshot:l=>i({snapshot:l})}));function dn(){return ii}function To(i){ii=i}function cb(){return ii==="electron"}function fb(){return!1}function Ro(i){Jo.getState().setSnapshot(i)}function db(){return Jo.getState().snapshot}function hb(i){return!!(i!=null&&i.knowledge.some(l=>l.enabled!==!1))}function mb(i){return!!(i!=null&&i.schedulers.some(l=>l.enabled!==!1))}function gb(i){var l;return!!((l=i==null?void 0:i.monitors)!=null&&l.some(r=>r.enabled!==!1))}function pb(i,l){return!!(i!=null&&i.agents.some(r=>r.agentType===l))}function yb(i){return!!(i!=null&&i.agents.some(l=>l.agentType))}function vb(i=db()){const l=!!i,r=pb(i,"localcore-acp");return{desktopRuntime:l||ii==="electron"||ii==="local_core",desktopChat:r,chatRoute:l?r:!0,desktopWorkspace:l?yb(i):!0,knowledgeModule:l?hb(i):!0,schedulerModule:l?mb(i):!0,monitorModule:l?gb(i):!0}}function Fo(){const i=Jo(l=>l.snapshot);return vb(i)}function Rm(i){return i==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":i}function _m(i){document.documentElement.classList.toggle("dark",i==="dark")}const Wo=$o(i=>({theme:"dark",resolved:"dark",setTheme:l=>{const r=Rm(l);localStorage.setItem("cc_theme",l),_m(r),i({theme:l,resolved:r})},init:()=>{const l=localStorage.getItem("cc_theme")||"dark",r=Rm(l);_m(r),i({theme:l,resolved:r})}})),bb="modulepreload",Sb=function(i,l){return new URL(i,l).href},Cm={},Je=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=Sb(b,o),b in Cm)return;Cm[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":bb,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)})},xb=T.lazy(()=>Je(()=>import("./Dashboard-Ch3QkWwf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),Eb=T.lazy(()=>Je(()=>import("./ThreadChat-BYXlT-Kc.js"),__vite__mapDeps([9,10,11,5,12,13,14,15,16,17,8,18,19,20,21,22]),import.meta.url)),Tb=T.lazy(()=>Je(()=>import("./Chat-BK-fm0Xr.js"),__vite__mapDeps([23,10,11,2,14,15,4,24,12,20,21,22,17]),import.meta.url)),Rb=T.lazy(()=>Je(()=>import("./Workspace-BrhSwRQ-.js"),__vite__mapDeps([25,10,11,26,18,15,2,3,5,13,22,27,28]),import.meta.url)),_b=T.lazy(()=>Je(()=>import("./ProjectList-D6CXumR_.js"),__vite__mapDeps([29,1,2,3,4,6,30]),import.meta.url)),Cb=T.lazy(()=>Je(()=>import("./ProjectDetail-DJa3sMmU.js"),__vite__mapDeps([31,1,10,11,2,3,4,32,30,33,27,15,22,34]),import.meta.url)),Ob=T.lazy(()=>Je(()=>import("./SessionList-D9o-lUst.js"),__vite__mapDeps([35,1,26,11,18,15,2,4,24,36,16,17]),import.meta.url)),Ab=T.lazy(()=>Je(()=>import("./SessionChat-DUTh4WoM.js"),__vite__mapDeps([37,1,24,14,15,32,16,19,17]),import.meta.url)),zb=T.lazy(()=>Je(()=>import("./CronList-Z3TvSRKP.js"),__vite__mapDeps([38,1,10,11,26,18,15,2,3,27,34,21,22]),import.meta.url)),Nb=T.lazy(()=>Je(()=>import("./MonitorList-JEvMoWUm.js"),__vite__mapDeps([39,1,10,11,26,18,15,2,3,27,34,21,22]),import.meta.url)),wb=T.lazy(()=>Je(()=>import("./Config-B93CQGvY.js"),__vite__mapDeps([40,5,1,3,28,33]),import.meta.url)),Mb=T.lazy(()=>Je(()=>import("./Logs-Cv0nth3j.js"),__vite__mapDeps([41,1,26,11,18,15,3,32,36]),import.meta.url)),jb=T.lazy(()=>Je(()=>import("./KnowledgeHome-ChvjOfrc.js"),__vite__mapDeps([42,10,11,2,21,22,20,27,7]),import.meta.url)),Lb=T.lazy(()=>Je(()=>import("./KnowledgeDetail-BAMCLrjz.js"),__vite__mapDeps([43,2,32,20,22]),import.meta.url));class Db{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 Pn(i,l,r="/"){return i?l:_.jsx(Ya,{to:r,replace:!0})}function Ub(){const{name:i}=fg();return Ot(r=>r.desktopManaged)?_.jsx(Ya,{to:i?`/workspace?project=${encodeURIComponent(i)}`:"/workspace",replace:!0}):_.jsx(Cb,{})}function Om(){const{project:i,id:l}=fg();if(!Ot(c=>c.desktopManaged))return l&&i?_.jsx(Ab,{}):_.jsx(Ob,{});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 kb(i){[{id:"dashboard",index:!0,titleKey:"nav.dashboard",order:10,element:()=>_.jsx(xb,{})},{id:"chat",path:"chat",titleKey:"nav.chat",order:20,element:({features:r})=>Pn(r.chatRoute,r.desktopChat?_.jsx(Eb,{}):_.jsx(Tb,{}))},{id:"workspace",path:"workspace",titleKey:"nav.workspace",order:30,element:({features:r})=>Pn(r.desktopWorkspace,_.jsx(Rb,{}))},{id:"knowledge",path:"knowledge",titleKey:"nav.knowledge",order:40,element:({features:r})=>Pn(r.knowledgeModule,_.jsx(jb,{}))},{id:"knowledge-detail",path:"knowledge/:knowledgebaseId",titleKey:"nav.knowledge",order:41,element:({features:r})=>Pn(r.knowledgeModule,_.jsx(Lb,{}))},{id:"projects",path:"projects",titleKey:"nav.projects",order:50,element:({desktopManaged:r,features:o})=>r&&o.desktopWorkspace?_.jsx(Ya,{to:"/workspace",replace:!0}):_.jsx(_b,{})},{id:"project-detail",path:"projects/:name",titleKey:"nav.projects",order:51,element:()=>_.jsx(Ub,{})},{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})=>Pn(r.schedulerModule,_.jsx(zb,{}))},{id:"monitors",path:"monitors",titleKey:"nav.monitors",order:71,element:({features:r})=>Pn(r.monitorModule,_.jsx(Nb,{}))},{id:"system",path:"system",titleKey:"nav.system",order:80,element:()=>_.jsx(wb,{})},{id:"system-logs",path:"system/logs",titleKey:"nav.system",order:81,element:()=>_.jsx(Mb,{})}].forEach(r=>i.registerRoute(r))}function Hb(i){[{id:"dashboard",path:"/",labelKey:"nav.dashboard",icon:L0,order:10,end:!0},{id:"chat",path:"/chat",labelKey:"nav.chat",icon:G0,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:I0,order:30,visible:({features:r})=>r.desktopWorkspace},{id:"knowledge",path:"/knowledge",labelKey:"nav.knowledge",icon:U0,order:40,visible:({features:r})=>r.knowledgeModule},{id:"projects",path:"/projects",labelKey:"nav.projects",icon:N0,order:50,visible:({desktopManaged:r})=>!r},{id:"sessions",path:"/sessions",labelKey:"nav.sessions",icon:q0,order:60,visible:({desktopManaged:r})=>!r},{id:"cron",path:"/cron",labelKey:"nav.cron",icon:A0,order:70,visible:({features:r})=>r.schedulerModule},{id:"monitors",path:"/monitors",labelKey:"nav.monitors",icon:S0,order:71,visible:({features:r})=>r.monitorModule},{id:"system",path:"/system",labelKey:"nav.system",icon:Z0,order:80}].forEach(r=>i.registerNavItem(r))}const Zu=new Db;kb(Zu);Hb(Zu);function Rg({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 _o={};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},Am=i=>i==null?"":""+i,Bb=(i,l,r)=>{i.forEach(o=>{l[o]&&(r[o]=l[o])})},qb=/###/g,zm=i=>i&&i.indexOf("###")>-1?i.replace(qb,"."):i,Nm=i=>!i||ae(i),ti=(i,l,r)=>{const o=ae(l)?l.split("."):l;let c=0;for(;c<o.length-1;){if(Nm(i))return{};const f=zm(o[c]);!i[f]&&r&&(i[f]=new r),Object.prototype.hasOwnProperty.call(i,f)?i=i[f]:i={},++c}return Nm(i)?{}:{obj:i,k:zm(o[c])}},wm=(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},Yb=(i,l,r,o)=>{const{obj:c,k:f}=ti(i,l,Object);c[f]=c[f]||[],c[f].push(r)},Hu=(i,l)=>{const{obj:r,k:o}=ti(i,l);if(r&&Object.prototype.hasOwnProperty.call(r,o))return r[o]},Gb=(i,l,r)=>{const o=Hu(i,r);return o!==void 0?o:Hu(l,r)},_g=(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]):_g(i[o],l[o],r):i[o]=l[o]);return i},sn=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Vb={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Kb=i=>ae(i)?i.replace(/[&<>"'\/]/g,l=>Vb[l]):i;class Qb{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 Xb=[" ",",","?","!",";"],Zb=new Qb(20),$b=(i,l,r)=>{l=l||"",r=r||"";const o=Xb.filter(h=>l.indexOf(h)<0&&r.indexOf(h)<0);if(o.length===0)return!0;const c=Zb.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},Uo=(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,"-"),Jb={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 Bu{constructor(l,r={}){this.init(l,r)}init(l,r={}){this.prefix=r.prefix||"i18next:",this.logger=l||Jb,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 Bu(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new Bu(this.logger,l)}}var Ft=new Bu;class $u{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 Mm extends $u{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=Hu(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:Uo((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),wm(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=Hu(this.data,g)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?_g(p,o,f):p={...p,...o},wm(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 Cg={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 Fb(){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 tl(i,l){const{[Og]:r}=i(Fb()),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={},Co=i=>!ae(i)&&typeof i!="boolean"&&typeof i!="number";class qu extends $u{constructor(l,r={}){super(),Bb(["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=Co(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&&!$b(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=tl(l,{...this.options,...c})),Array.isArray(l)||(l=[String(l)]),l=l.map(ze=>typeof ze=="function"?tl(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]"],Q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,X=!this.i18nFormat||this.i18nFormat.handleAsObject,J=c.count!==void 0&&!ae(c.count),V=qu.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;X&&!z&&V&&(se=le);const Ae=Co(se),We=Object.prototype.toString.apply(se);if(X&&se&&Ae&&q.indexOf(We)<0&&!(ae(Q)&&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),Me=ze?[]:{},De=ze?B:H;for(const M in se)if(Object.prototype.hasOwnProperty.call(se,M)){const Y=`${De}${h}${M}`;V&&!z?Me[M]=this.translate(Y,{...c,defaultValue:Co(le)?le[M]:void 0,joinArrays:!1,ns:p}):Me[M]=this.translate(Y,{...c,joinArrays:!1,ns:p}),Me[M]===Y&&(Me[M]=se[M])}z=Me}}else if(X&&ae(Q)&&Array.isArray(z))z=z.join(Q),z&&(z=this.extendTranslation(z,l,c,o));else{let ze=!1,Me=!1;!this.isValidLookup(z)&&V&&(ze=!0,z=le),this.isValidLookup(z)||(Me=!0,z=g);const M=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Me?void 0:z,Y=V&&le!==z&&this.options.updateMissing;if(Me||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:M;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),Me&&z===g&&this.options.appendNamespaceToMissingKey&&(z=`${m}${b}${g}`),(Me||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=Cg.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"?tl(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,Q;this.isValidLookup(o)||(g=B,!jm[`${H[0]}-${B}`]&&((q=this.utils)!=null&&q.hasLoadedNamespace)&&!((Q=this.utils)!=null&&Q.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(X=>{var ue;if(this.isValidLookup(o))return;h=X;const J=[b];if((ue=this.i18nFormat)!=null&&ue.addLookupKeys)this.i18nFormat.addLookupKeys(J,b,X,B,r);else{let K;N&&(K=this.pluralResolver.getSuffix(X,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(X,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 Lm{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 Dm={zero:0,one:1,two:2,few:3,many:4,other:5},Um={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Wb{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!"),Um;if(!l.match(/-|_/))return Um;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)=>Dm[c]-Dm[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 km=(i,l,r,o=".",c=!0)=>{let f=Gb(i,l,r);return!f&&c&&ae(r)&&(f=Uo(i,r,o),f===void 0&&(f=Uo(l,r,o))),f},Oo=i=>i.replace(/\$/g,"$$$$");class Hm{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:Q}=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=Q!==void 0?Q:!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 Q=km(r,p,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(Q,void 0,o,{...c,...r,interpolationkey:z}):Q}const H=z.split(this.formatSeparator),B=H.shift().trim(),q=H.join(this.formatSeparator).trim();return this.format(km(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=Am(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=Am(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 Ib=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}},Bm=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)}},Pb=i=>(l,r,o)=>i(ui(r),o)(l);class eS{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?Bm:Pb;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()]=Bm(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}=Ib(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 tS=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class aS extends $u{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=>{Yb(p.loaded,[f],h),tS(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 Ao=()=>({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}),qm=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},Mu=()=>{},nS=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})},Ag="__i18next_supportNoticeShown",lS=()=>!!(typeof globalThis<"u"&&globalThis[Ag]||typeof process<"u"&&_o&&_o.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&_o),iS=()=>{typeof globalThis<"u"&&(globalThis[Ag]=!0)},uS=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 $u{constructor(l={},r){if(super(),this.options=qm(l),this.services={},this.logger=Ft,this.modules={external:[]},nS(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=Ao();this.options={...o,...this.options,...qm(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&&!uS(this)&&!lS()&&(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 💙"),iS());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=eS;const b=new Lm(this.options);this.store=new Mm(this.options.resources,this.options);const v=this.services;v.logger=Ft,v.resourceStore=this.store,v.languageUtils=b,v.pluralResolver=new Wb(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 Hm(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new aS(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 qu(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=Mu),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=Mu){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=Mu),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"&&Cg.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=tl(p.keyPrefix,m));const b=this.options.keySeparator||".";let v;return p.keyPrefix&&Array.isArray(f)?v=f.map(N=>(typeof N=="function"&&(N=tl(N,m)),`${p.keyPrefix}${b}${N}`)):(typeof f=="function"&&(f=tl(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 Lm(Ao());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=Mu){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 Mm(g,c),f.services.resourceStore=f.store}if(l.interpolation){const p={...Ao().interpolation,...this.options.interpolation,...l.interpolation},m={...c,interpolation:p};f.services.interpolator=new Hm(m)}return f.translator=new qu(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 Fe=ai.createInstance();Fe.createInstance;Fe.dir;Fe.init;Fe.loadResources;Fe.reloadResources;Fe.use;Fe.changeLanguage;Fe.getFixedT;Fe.t;Fe.exists;Fe.setDefaultNamespace;Fe.hasLoadedNamespace;Fe.loadNamespaces;Fe.loadLanguages;const ni="en",zg={en:()=>Je(()=>import("./en-D2SkCrhG.js"),[],import.meta.url),zh:()=>Je(()=>import("./zh-DIcdHycM.js"),[],import.meta.url),"zh-TW":()=>Je(()=>import("./zh-TW-BtRwreY_.js"),[],import.meta.url),ja:()=>Je(()=>import("./ja-ChF4vbBL.js"),[],import.meta.url),es:()=>Je(()=>import("./es-C8UBPhxM.js"),[],import.meta.url)},Du={};function Ym(i){return i in zg}function Ng(i){if(Ym(i))return i;const l=i.split("-")[0];return Ym(l)?l:ni}function rS(){const i=localStorage.getItem("cc_lang");return Ng(i||navigator.language||ni)}async function ko(i){if(Du[i])return;const l=await zg[i]();Du[i]=l.default,Fe.isInitialized&&Fe.addResourceBundle(i,"translation",Du[i],!0,!0)}async function sS(){const i=rS();await Promise.all([ko(ni),i===ni?Promise.resolve():ko(i)]),Fe.isInitialized||await Fe.use(lb).init({lng:i,fallbackLng:ni,resources:Object.fromEntries(Object.entries(Du).map(([l,r])=>[l,{translation:r}])),interpolation:{escapeValue:!1}})}async function wg(i){const l=Ng(i);await ko(l),await Fe.changeLanguage(l),localStorage.setItem("cc_lang",l)}const Gm=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"zh-TW",label:"繁體中文"},{code:"ja",label:"日本語"},{code:"es",label:"Español"}],oS=[{label:"Core",ids:["dashboard","chat","workspace","projects","sessions"]},{label:"Knowledge",ids:["knowledge","cron","monitors"]},{label:"System",ids:["system"]}];function cS(){var J;const{pathname:i}=zt(),{t:l,i18n:r}=Eg(),{theme:o,setTheme:c}=Wo(),f=Ot(V=>V.logout),h=Ot(V=>V.desktopManaged),g=Fo(),p=dn(),[m,b]=T.useState(!1),[v,N]=T.useState(!1),L=V=>{wg(V),N(!1)},z={light:Im,dark:Fm,system:Jm},H={light:"dark",dark:"system",system:"light"},B=z[o],q=Zu.listNavItems().filter(V=>{var ue;return((ue=V.visible)==null?void 0:ue.call(V,{desktopManaged:h,features:g}))??!0}),Q=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}}),X=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(Rg,{showWordmark:!m})}),_.jsx("nav",{className:"relative flex-1 py-3 space-y-4 px-2 overflow-y-auto",children:oS.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(Mo,{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.44"]}),_.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(M0,{size:18,className:"shrink-0"}),!m&&_.jsx("span",{children:((J=Gm.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:Gm.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(H0,{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(R0,{size:18}):_.jsx(E0,{size:18})})]})]}),X?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:Q.map(({id:V,path:ue,end:K,Icon:te,labelKey:le})=>_.jsxs(Mo,{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 fS(){const{pathname:i}=zt(),{desktopChat:l}=Fo(),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(cS,{}),_.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(u1,{})})})})]})}const dS=()=>Xe.get("/status"),r2=i=>Xe.post("/restart",i),s2=()=>Xe.post("/reload"),o2=i=>Xe.get("/logs",i);function hS({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 Vm(i,l){if(typeof i=="function")return i(l);i!=null&&(i.current=l)}function Mg(...i){return l=>{let r=!1;const o=i.map(c=>{const f=Vm(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():Vm(i[c],null)}}}}function c2(...i){return T.useCallback(Mg(...i),i)}var mS=Symbol.for("react.lazy"),Yu=m0[" use ".trim().toString()];function gS(i){return typeof i=="object"&&i!==null&&"then"in i}function jg(i){return i!=null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===mS&&"_payload"in i&&gS(i._payload)}function pS(i){const l=vS(i),r=T.forwardRef((o,c)=>{let{children:f,...h}=o;jg(f)&&typeof Yu=="function"&&(f=Yu(f._payload));const g=T.Children.toArray(f),p=g.find(SS);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 yS=pS("Slot");function vS(i){const l=T.forwardRef((r,o)=>{let{children:c,...f}=r;if(jg(c)&&typeof Yu=="function"&&(c=Yu(c._payload)),T.isValidElement(c)){const h=ES(c),g=xS(f,c.props);return c.type!==T.Fragment&&(g.ref=o?Mg(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 bS=Symbol("radix.slottable");function SS(i){return T.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===bS}function xS(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 ES(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 TS={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"},RS={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 Gu({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?yS:"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",TS[i],RS[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 Km({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 f2({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 Ho="http://127.0.0.1:9831",_S=`${Ho}/api/local/v1`;function CS(i){const l=i.trim();return l?l.replace(/\/+$/,""):_S}const ri=CS("/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 Lg(){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","thread.session.activated","message.created","message.updated","run.updated","scheduler.job.updated","scheduler.run.updated","automation.monitor.updated","automation.monitor.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(()=>Lg(),1e3)}}function OS(){si.size===0&&_t&&(_t.close(),_t=null)}function Dg(i){return si.add(i),Lg(),()=>{si.delete(i),OS()}}async function d2(){return W("GET","/runtime")}async function h2(){return W("POST","/runtime/service/start")}async function m2(){return W("POST","/runtime/service/stop")}async function g2(){return W("POST","/runtime/service/restart")}async function p2(i){const l=typeof i=="number"?`?limit=${encodeURIComponent(String(i))}`:"";return W("GET",`/runtime/logs${l}`)}async function y2(){return W("GET","/runtime/agent-runtimes")}async function v2(){return W("POST","/runtimes/refresh")}async function b2(){return W("GET","/runtime/config")}async function S2(i){return W("POST","/runtime/config/raw",{raw:i})}async function x2(i){return W("POST","/runtime/config/structured",{config:i})}async function E2(i){return W("POST","/runtime/settings",i)}async function AS(i){return W("GET",`/platforms/${encodeURIComponent(i)}`)}function di(i){return i?`?instance_id=${encodeURIComponent(i)}`:""}async function zS(i,l,r){return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}${di(r)}`)}async function NS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/test${di(r)}`)}async function wS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/enable${di(r)}`)}async function MS(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/disable${di(r)}`)}async function jS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/pairings${r}`)}async function LS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/approve`,{code:l})}async function DS(i,l){return W("POST",`/platforms/${encodeURIComponent(i)}/pairings/reject`,{code:l})}async function US(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return W("GET",`/platforms/${encodeURIComponent(i)}/users${r}`)}async function Ug(i,l,r){return W("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode${di(r)}`)}async function kg(i,l,r,o){const c=`?ticket=${encodeURIComponent(r)}${o?`&instance_id=${encodeURIComponent(o)}`:""}`;return W("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode/status${c}`)}async function T2(){return AS("lark")}async function R2(i,l){return zS("lark",i,l)}async function _2(i,l){return NS("lark",i,l)}async function C2(i,l){return wS("lark",i,l)}async function O2(i,l){return MS("lark",i,l)}async function A2(i){return jS("lark",i)}async function z2(i){return LS("lark",i)}async function N2(i){return DS("lark",i)}async function w2(i){return US("lark",i)}async function M2(i,l){return Ug("lark",i,l)}async function j2(i,l,r){return kg("lark",i,l,r)}async function L2(i,l){return Ug("weixin",i,l)}async function D2(i,l,r){return kg("weixin",i,l,r)}async function U2(){return W("GET","/workspaces")}async function k2(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 H2(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 B2(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 q2(i){return W("GET","/scheduler/jobs")}async function Y2(i){return W("POST","/scheduler/jobs",i)}async function G2(i,l){return W("PATCH",`/scheduler/jobs/${encodeURIComponent(i)}`,l)}async function V2(i){return W("DELETE",`/scheduler/jobs/${encodeURIComponent(i)}`)}async function K2(i){return W("POST",`/scheduler/jobs/${encodeURIComponent(i)}/run`)}async function Q2(i){return W("GET","/automation/monitors")}async function X2(i){return W("POST","/automation/monitors",i)}async function Z2(i,l){return W("PATCH",`/automation/monitors/${encodeURIComponent(i)}`,l)}async function $2(i){return W("DELETE",`/automation/monitors/${encodeURIComponent(i)}`)}async function J2(i){return W("POST",`/automation/monitors/${encodeURIComponent(i)}/run`)}async function F2(i){return W("GET",`/threads?workspace_id=${encodeURIComponent(i)}`)}async function W2(i,l){return W("POST","/threads",{workspaceId:i,title:l})}async function I2(i){return W("GET",`/threads/${encodeURIComponent(i)}`)}async function P2(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}`,{title:l})}async function ex(i,l){return W("PATCH",`/threads/${encodeURIComponent(i)}/knowledge-bases`,{knowledgeBaseIds:l})}async function tx(i){return W("DELETE",`/threads/${encodeURIComponent(i)}`)}async function ax(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/messages`,{content:l})}async function nx(i,l){return W("POST",`/threads/${encodeURIComponent(i)}/actions`,{content:l})}async function lx(i){return W("POST",`/runs/${encodeURIComponent(i)}/interrupt`)}async function ix(){return W("GET","/knowledge/config")}async function ux(){return W("GET","/knowledge/folders")}async function rx(i){return W("POST","/knowledge/folders",i)}async function sx(i,l){return W("PATCH",`/knowledge/folders/${encodeURIComponent(i)}`,l)}async function ox(i){return W("DELETE",`/knowledge/folders/${encodeURIComponent(i)}`)}async function cx(){return W("GET","/knowledge/bases")}async function fx(i){return W("POST","/knowledge/bases",i)}async function dx(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}`)}async function hx(i,l){return W("PATCH",`/knowledge/bases/${encodeURIComponent(i)}`,l)}async function mx(i){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}`)}async function gx(i){return W("GET",`/knowledge/bases/${encodeURIComponent(i)}/files`)}async function px(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 yx(i,l){return W("DELETE",`/knowledge/bases/${encodeURIComponent(i)}/files/${encodeURIComponent(l)}`)}async function vx(i,l){return W("POST",`/knowledge/bases/${encodeURIComponent(i)}/search`,l)}async function bx(){return W("GET","/capabilities/snapshot")}async function Sx(){return W("GET","/plugins/diagnostics")}async function xx(i){return W("POST",`/workspaces/${encodeURIComponent(i)}/streaming-probe`)}function Ex(i){return Dg(l=>{l.type==="runtime.updated"&&i(l.runtime)})}function Tx(i){return Dg(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 kS=[{code:"en",label:"EN"},{code:"zh",label:"中"},{code:"zh-TW",label:"繁"},{code:"ja",label:"日"},{code:"es",label:"ES"}];function HS(){const{t:i,i18n:l}=Eg(),r=Qu(),o=Ot(J=>J.login),{theme:c,setTheme:f}=Wo(),[h,g]=T.useState(""),[p,m]=T.useState(""),[b,v]=T.useState(""),[N,L]=T.useState(!1),z=cb(),H=fb(),B=async J=>{if(J.preventDefault(),!(!h.trim()||H)){L(!0),v("");try{p.trim()&&Xe.setBaseUrl(p.trim()),Xe.setToken(h.trim()),await dS(),o(h.trim(),p.trim()),z?window.location.hash="#/":r("/",{replace:!0})}catch{v(i("login.invalidToken")),Xe.setToken(""),Xe.setBaseUrl("")}finally{L(!1)}}},q={light:Im,dark:Fm,system:Jm},Q={light:"dark",dark:"system",system:"light"},X=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:kS.map(J=>_.jsx("button",{onClick:()=>void wg(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(Gu,{variant:"outline",size:"icon",onClick:()=>f(Q[c]),"aria-label":i(`theme.${c}`),children:_.jsx(X,{size:16})})]}),_.jsx("div",{className:"w-full max-w-md animate-fade-in",children:_.jsxs(hS,{className:"p-8 shadow-2xl shadow-primary/10",children:[_.jsx("div",{className:"flex justify-center mb-6",children:_.jsx(Rg,{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(C0,{size:16}),b]}),_.jsxs("form",{onSubmit:B,className:"space-y-4",children:[_.jsx(Km,{label:i("login.token"),type:"password",value:h,onChange:J=>g(J.target.value),placeholder:"mgmt-secret-xxx",autoFocus:!0}),_.jsx(Km,{label:`${i("login.serverUrl")} (${i("common.optional")})`,type:"text",value:p,onChange:J=>m(J.target.value),placeholder:"http://localhost:9820"}),_.jsxs(Gu,{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(ev,{size:16}),i("login.connect")]})]})]})})]})}function BS({children:i}){return Ot(r=>r.isAuthenticated)?_.jsx(_.Fragment,{children:i}):_.jsx(Ya,{to:"/login",replace:!0})}function qS(){return _.jsx("div",{className:"flex min-h-64 items-center justify-center text-sm text-muted-foreground",children:"正在加载…"})}function YS(){const i=Ot(o=>o.isAuthenticated),l=Ot(o=>o.desktopManaged),r=Fo();return _.jsx(T.Suspense,{fallback:_.jsx(qS,{}),children:_.jsxs(s1,{children:[_.jsx(on,{path:"/login",element:i?_.jsx(Ya,{to:"/",replace:!0}):_.jsx(HS,{})}),_.jsxs(on,{element:_.jsx(BS,{children:_.jsx(fS,{})}),children:[Zu.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 GS extends el.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 VS="http://127.0.0.1:9831",KS=`${VS}/api/local/v1`,cn=QS("/api/local/v1"),oi=new Set;let Kt=null;function QS(i){const l=i.trim();return l?l.replace(/\/+$/,""):KS}async function Io(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 XS(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 Hg(){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(()=>Hg(),1e3)})}function ZS(){oi.size===0&&Kt&&(Kt.close(),Kt=null)}async function $S(){return window.desktop?(To("electron"),!0):(await XS(),To("local_core"),!0)}function JS(){return dn()==="electron"&&window.desktop?window.desktop.getRuntimeStatus():Io("GET","/runtime")}function Qm(){return Io("GET","/capabilities/snapshot")}function FS(i){if(dn()==="electron"&&window.desktop)return window.desktop.getLogs(i);const l=`?limit=${encodeURIComponent(String(i))}`;return Io("GET",`/runtime/logs${l}`)}function WS(i){return dn()==="electron"&&window.desktop?window.desktop.onRuntimeEvent(i):(oi.add(i),Hg(),()=>{oi.delete(i),ZS()})}const Xm=20,IS=500;function PS(i){return new Promise(l=>window.setTimeout(l,i))}function e2(){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(Wm,{size:16,className:"animate-spin"}),"正在初始化 AgentDock 运行时…"]})})}function t2({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(F0,{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(`
|
|
182
182
|
`)})]}),_.jsxs("div",{className:"flex gap-3",children:[_.jsxs(Gu,{onClick:r,children:[_.jsx(Wm,{size:14})," 重试初始化"]}),_.jsx(Gu,{variant:"secondary",onClick:()=>window.location.reload(),children:"重新加载应用"})]})]})]})})}function a2(){const[i,l]=T.useState({status:"loading"}),[r,o]=T.useState(!1),c=T.useCallback(async()=>{l({status:"loading"});const h=!!await $S();if(o(h),h)try{let g=null;for(let p=0;p<Xm;p+=1)try{await JS(),g=null;break}catch(m){g=m,p<Xm-1&&await PS(IS)}if(g)throw g;Ro(await Qm()),Xe.setBaseUrl(cn),Xe.setToken(""),Ot.getState().setManagedSession("",cn,dn()==="local_core"?"local_core":"electron")}catch(g){let p=[];try{p=await FS(80)}catch{p=[]}l({status:"error",message:g instanceof Error?g.message:String(g),logs:p});return}h||Ro(null),l({status:"ready"})},[]);return T.useEffect(()=>{c()},[c]),T.useEffect(()=>{if(r)return WS(f=>{Xe.setBaseUrl(cn),Xe.setToken(""),Qm().then(h=>Ro(h)).catch(()=>{}),Ot.getState().setManagedSession("",cn,dn()==="local_core"?"local_core":"electron")})},[r]),i.status==="loading"?_.jsx(e2,{}):i.status==="error"?_.jsx(t2,{message:i.message,logs:i.logs,onRetry:()=>void c()}):_.jsx(j1,{children:_.jsx(YS,{})})}async function n2(){await sS(),Ot.getState().init(),Wo.getState().init(),sv.createRoot(document.getElementById("root")).render(_.jsx(GS,{children:_.jsx(a2,{})}))}n2();export{r2 as $,Xe as A,Gu as B,hS as C,fg as D,u2 as E,N0 as F,A0 as G,Zm as H,Km as I,q2 as J,G2 as K,yg as L,q0 as M,Y2 as N,V2 as O,K2 as P,Q2 as Q,Wm as R,Z0 as S,f2 as T,Z2 as U,X2 as V,I0 as W,$2 as X,J2 as Y,ev as Z,S0 as _,Fo as a,s2 as a0,Tx as a1,w2 as a2,N2 as a3,z2 as a4,A2 as a5,O2 as a6,C2 as a7,_2 as a8,R2 as a9,p2 as aA,g2 as aB,m2 as aC,h2 as aD,d2 as aE,o2 as aF,c2 as aG,ix as aH,ux as aI,rx as aJ,fx as aK,sx as aL,ox as aM,hx as aN,mx as aO,U0 as aP,lv as aQ,m0 as aR,Mg as aS,dx as aT,gx as aU,px as aV,yx as aW,vx as aX,T2 as aa,j2 as ab,M2 as ac,D2 as ad,L2 as ae,kg as af,Ug as ag,US as ah,DS as ai,LS as aj,jS as ak,MS as al,wS as am,NS as an,zS as ao,AS as ap,Sx as aq,bx as ar,v2 as as,y2 as at,Ex as au,xx as av,E2 as aw,x2 as ax,S2 as ay,b2 as az,k2 as b,Ze as c,H2 as d,B2 as e,C0 as f,He as g,R0 as h,dn as i,_ as j,F2 as k,U2 as l,I2 as m,W2 as n,ex as o,nx as p,ax as q,T as r,Dg as s,lx as t,Eg as u,P2 as v,tx as w,i2 as x,cx as y,el as z};
|