@kafca/agentdock 0.1.54 → 0.1.55
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 +5 -0
- package/dist/renderer/assets/{Badge-Rs12sArE.js → Badge-Bg_nNvBL.js} +1 -1
- package/dist/renderer/assets/{Chat-C9KfsjuN.js → Chat-BJveQQKu.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-C3m7Mxpl.js → ChatMarkdown-Bqn2HJ6f.js} +1 -1
- package/dist/renderer/assets/{Config-BhIq2lQa.js → Config-CMtZDRAE.js} +1 -1
- package/dist/renderer/assets/{CronList-CenDzorW.js → CronList-C-ILB_Ae.js} +1 -1
- package/dist/renderer/assets/{Dashboard-BmeP5ocP.js → Dashboard-CsKBSQIe.js} +2 -2
- package/dist/renderer/assets/{EmptyState-BGONB4VS.js → EmptyState-C60g3RMj.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-Ba3PuI7k.js → KnowledgeDetail-CC5C7JYe.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-DkKXM7Bd.js → KnowledgeHome-3rlvxgWf.js} +1 -1
- package/dist/renderer/assets/{Logs-DTITWY-y.js → Logs-CktemGN0.js} +1 -1
- package/dist/renderer/assets/{Modal-BvFew60s.js → Modal-BQUW9LSf.js} +1 -1
- package/dist/renderer/assets/{MonitorList-DruqInIG.js → MonitorList-B0hxjuOZ.js} +1 -1
- package/dist/renderer/assets/{Page-CLjmm8c6.js → Page-DL_Nv2i5.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-BCFaJig0.js → ProjectDetail-Djr9-MyT.js} +1 -1
- package/dist/renderer/assets/{ProjectList-Btg-mgwA.js → ProjectList-BKl4eW7q.js} +1 -1
- package/dist/renderer/assets/{Select-CAwaG7ol.js → Select-CfRkos3z.js} +1 -1
- package/dist/renderer/assets/{SessionChat-CHPrm0Zs.js → SessionChat-Dxv8D5DW.js} +1 -1
- package/dist/renderer/assets/{SessionList-0aGulton.js → SessionList-BJ2GjXvR.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-BkSc0hKN.js → ThreadChat-CAsIl9qf.js} +1 -1
- package/dist/renderer/assets/Workspace-CaUhiGBX.js +19 -0
- package/dist/renderer/assets/{arrow-left-Co19QKUc.js → arrow-left-D1DbXrLA.js} +1 -1
- package/dist/renderer/assets/{book-open-CtlUo2yw.js → book-open-BxC1z1C1.js} +1 -1
- package/dist/renderer/assets/{bot-D-3jCeDr.js → bot-Fw3IzhJA.js} +1 -1
- package/dist/renderer/assets/{check-Cf5Y5H-1.js → check-5zCTgp3A.js} +1 -1
- package/dist/renderer/assets/{chevron-down-D1tfS-tx.js → chevron-down-N3PxTNxH.js} +1 -1
- package/dist/renderer/assets/{circle-DJOCyk2U.js → circle-C_chUflo.js} +1 -1
- package/dist/renderer/assets/{desktop-CmZMgSXn.js → desktop-DkQTZNhe.js} +1 -1
- package/dist/renderer/assets/{funnel-ZRCc1DCy.js → funnel-B8ZAv6I7.js} +1 -1
- package/dist/renderer/assets/{heart-BuJEvv8x.js → heart-M9A3E4Ed.js} +1 -1
- package/dist/renderer/assets/{index-0gZsyozU.js → index-Bwv855ID.js} +1 -1
- package/dist/renderer/assets/{index-CDWUe2Sw.js → index-DJ8w4e0l.js} +2 -2
- package/dist/renderer/assets/{pencil-sISh8tMs.js → pencil-X44UaxwR.js} +1 -1
- package/dist/renderer/assets/{play-CccQpZit.js → play-ujo-De38.js} +1 -1
- package/dist/renderer/assets/{plus-hxAkcfQ0.js → plus-BHgVdG_A.js} +1 -1
- package/dist/renderer/assets/projects-DB1FLZ3A.js +1 -0
- package/dist/renderer/assets/{save-By5b-_0Q.js → save-Cz6giKrE.js} +1 -1
- package/dist/renderer/assets/{search-CLzr87Rw.js → search-DKWvTqi5.js} +1 -1
- package/dist/renderer/assets/{server-CubB1eW5.js → server-BsuHcYl4.js} +1 -1
- package/dist/renderer/assets/{session-utils-Cz45af_C.js → session-utils-DnAWL3eo.js} +1 -1
- package/dist/renderer/assets/{sessions-C8np5fRp.js → sessions-DptxO_BE.js} +1 -1
- package/dist/renderer/assets/{shield-check-CemAc1Ry.js → shield-check-V82O8AC1.js} +1 -1
- package/dist/renderer/assets/{trash-2-DFKhii8D.js → trash-2-_Fgwk8mc.js} +1 -1
- package/dist/renderer/assets/{user-CaR8Rru_.js → user-DQKTaUcR.js} +1 -1
- package/dist/renderer/assets/{wifi-off-C8miJu8i.js → wifi-off-vjH-MD2w.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +1 -1
- package/dist-electron/services/local-ai-core/src/acp/store/runtime-config-store.js +39 -28
- package/dist-electron/services/local-ai-core/src/channel/lark/config.js +4 -16
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +72 -13
- package/dist-electron/services/local-ai-core/src/channel/shared/channel-keys.js +16 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/config.js +3 -16
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +12 -11
- package/dist-electron/services/local-ai-core/src/runtime/channel-service.js +0 -40
- package/dist-electron/services/local-ai-core/src/runtime/external-service.js +1 -14
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +1 -14
- package/dist-electron/services/local-ai-core/src/runtime/provider-config-migration.js +16 -0
- package/dist-electron/services/local-ai-core/src/scheduler/channel-execution-policy.js +4 -6
- package/dist-electron/tests/electron/sandbox-config.test.js +5 -0
- package/dist-electron/tests/integration/lark-gateway.test.js +27 -1
- package/package.json +1 -1
- package/dist/renderer/assets/Workspace-DXJ3BGia.js +0 -19
- package/dist/renderer/assets/projects-CjdfXQ1l.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-CsKBSQIe.js","./Badge-Bg_nNvBL.js","./EmptyState-C60g3RMj.js","./Page-DL_Nv2i5.js","./projects-DB1FLZ3A.js","./desktop-DkQTZNhe.js","./server-BsuHcYl4.js","./book-open-BxC1z1C1.js","./shield-check-V82O8AC1.js","./ThreadChat-CAsIl9qf.js","./desktop-JQkhNOF4.js","./ChatMarkdown-Bqn2HJ6f.js","./check-5zCTgp3A.js","./circle-C_chUflo.js","./bot-Fw3IzhJA.js","./user-DQKTaUcR.js","./chevron-down-N3PxTNxH.js","./session-utils-DnAWL3eo.js","./wifi-off-vjH-MD2w.js","./Modal-BQUW9LSf.js","./index-Bwv855ID.js","./search-DKWvTqi5.js","./pencil-X44UaxwR.js","./trash-2-_Fgwk8mc.js","./Chat-BJveQQKu.js","./sessions-DptxO_BE.js","./Workspace-CaUhiGBX.js","./Select-CfRkos3z.js","./plus-BHgVdG_A.js","./save-Cz6giKrE.js","./ProjectList-BKl4eW7q.js","./heart-M9A3E4Ed.js","./ProjectDetail-Djr9-MyT.js","./arrow-left-D1DbXrLA.js","./play-ujo-De38.js","./SessionList-BJ2GjXvR.js","./funnel-B8ZAv6I7.js","./SessionChat-Dxv8D5DW.js","./CronList-C-ILB_Ae.js","./MonitorList-B0hxjuOZ.js","./Config-CMtZDRAE.js","./Logs-CktemGN0.js","./KnowledgeHome-3rlvxgWf.js","./KnowledgeDetail-CC5C7JYe.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 $m(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:p="",hash:g=""}=hn(c.location.hash.substring(1));return!h.startsWith("/")&&!h.startsWith(".")&&(h="/"+h),zo("",{pathname:h,search:p,hash:g},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function r(c,f){let h=c.document.querySelector("base"),p="";if(h&&h.getAttribute("href")){let g=c.location.href,m=g.indexOf("#");p=m===-1?g:g.slice(0,m)}return p+"#"+(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,p="POP",g=null,m=b();m==null&&(m=0,h.replaceState({...h.state,idx:m},""));function b(){return(h.state||{idx:null}).idx}function v(){p="POP";let B=b(),q=B==null?null:B-m;m=B,g&&g({action:p,location:H.location,delta:q})}function N(B,q){p="PUSH";let Q=hm(B)?B:zo(H.location,B,q);r&&r(Q,B),m=b()+1;let $=mm(Q,m),F=H.createHref(Q.unstable_mask||Q);try{h.pushState($,"",F)}catch(V){if(V instanceof DOMException&&V.name==="DataCloneError")throw V;c.location.assign(F)}f&&g&&g({action:p,location:H.location,delta:1})}function L(B,q){p="REPLACE";let Q=hm(B)?B:zo(H.location,B,q);r&&r(Q,B),m=b();let $=mm(Q,m),F=H.createHref(Q.unstable_mask||Q);h.replaceState($,"",F),f&&g&&g({action:p,location:H.location,delta:0})}function z(B){return dv(B)}let H={get action(){return p},get location(){return i(c,h)},listen(B){if(g)throw new Error("A history only accepts one active listener");return c.addEventListener(dm,v),g=B,()=>{c.removeEventListener(dm,v),g=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=pa(c.pathname||"/",r);if(f==null)return null;let h=ep(i);mv(h);let p=null;for(let g=0;p==null&&g<h.length;++g){let m=_v(f);p=Tv(h[g],m,o)}return p}function ep(i,l=[],r=[],o="",c=!1){let f=(h,p,g=c,m)=>{let b={relativePath:m===void 0?h.path||"":m,caseSensitive:h.caseSensitive===!0,childrenIndex:p,route:h};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(o)&&g)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}".`),ep(h.children,l,N,v,g)),!(h.path==null&&!h.index)&&l.push({path:v,score:xv(v,h.index),routesMeta:N})};return i.forEach((h,p)=>{var g;if(h.path===""||!((g=h.path)!=null&&g.includes("?")))f(h,p);else for(let m of tp(h.path))f(h,p,!0,m)}),l}function tp(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=tp(o.join("/")),p=[];return p.push(...h.map(g=>g===""?f:[f,g].join("/"))),c&&p.push(...h),p.map(g=>i.startsWith("/")&&g===""?"/":g)}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 pv=/^:[\w-]+$/,gv=3,yv=2,vv=1,bv=10,Sv=-2,pm=i=>i==="*";function xv(i,l){let r=i.split("/"),o=r.length;return r.some(pm)&&(o+=Sv),l&&(o+=yv),r.filter(c=>!pm(c)).reduce((c,f)=>c+(pv.test(f)?gv: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 p=0;p<o.length;++p){let g=o[p],m=p===o.length-1,b=f==="/"?l:l.slice(f.length)||"/",v=Uu({path:g.relativePath,caseSensitive:g.caseSensitive,end:m},b),N=g.route;if(!v&&m&&r&&!o[o.length-1].route.index&&(v=Uu({path:g.relativePath,caseSensitive:g.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"),p=c.slice(1);return{params:o.reduce((m,{paramName:b,isOptional:v},N)=>{if(b==="*"){let z=p[N]||"";h=f.slice(0,f.length-z.length).replace(/(.)\/+$/,"$1")}const L=p[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,p,g,m,b)=>{if(o.push({paramName:p,isOptional:g!=null}),g){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 pa(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=ap(r),r.startsWith("/")?f=gm(r.substring(1),"/"):f=gm(r,l)):f=l,{pathname:f,search:Nv(o),hash:wv(c)}}function gm(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,p;if(h==null)p=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("/")}p=v>=0?l[v]:"/"}let g=Ov(c,p),m=h&&h!=="/"&&h.endsWith("/"),b=(f||h===".")&&r.endsWith("/");return!g.pathname.endsWith("/")&&(m||b)&&(g.pathname+="/"),g}var ap=i=>i.replace(/\/\/+/g,"/"),Qt=i=>ap(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 np=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lp(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(np)try{let f=new URL(window.location.href),h=r.startsWith("//")?new URL(f.protocol+r):new URL(r),p=pa(h.pathname,l);h.origin===f.origin&&p!=null?r=p+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 ip=["POST","PUT","PATCH","DELETE"];new Set(ip);var Dv=["GET",...ip];new Set(Dv);var al=T.createContext(null);al.displayName="DataRouter";var Ku=T.createContext(null);Ku.displayName="DataRouterState";var up=T.createContext(!1);function Uv(){return T.useContext(up)}var rp=T.createContext({isTransitioning:!1});rp.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 sp="REACT_ROUTER_ERROR",Bv="REDIRECT",qv="ROUTE_ERROR_RESPONSE";function Yv(i){if(i.startsWith(`${sp}:${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(`${sp}:${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}),p=f;return r!=="/"&&(p=f==="/"?r:Qt([r,f])),o.createHref({pathname:p,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 op="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function cp(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 cp(()=>{h.current=!0}),T.useCallback((g,m={})=>{if(Ct(h.current,op),!h.current)return;if(typeof g=="number"){r.go(g);return}let b=Vu(g,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 fp(){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 $v(i,l){return dp(i,l)}function dp(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:{},p=f?f.pathname:"/",g=f?f.pathnameBase:"/",m=f&&f.route;{let q=m&&m.path||"";mp(p,!m||q.endsWith("*")||q.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (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(g==="/"||((B=q.pathname)==null?void 0:B.startsWith(g)),`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 "${g}" but pathname "${q.pathname}" was given in the \`location\` prop.`),v=q}else v=b;let N=v.pathname||"/",L=N;if(g!=="/"){let q=g.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([g,o.encodeLocation?o.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?g:Qt([g,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 Zv(){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(Zv,null),hp=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}};hp.contextType=up;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=lp(o.location,r);if(np&&!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,p=-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)&&(p=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),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let g=r==null?void 0:r.onError,m=o&&g?(b,v)=>{var N,L;g(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&&(p<0&&N===0?(mp("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),z=!0,B=null):p===N&&(z=!0,B=v.route.hydrateFallbackElement||null)));let q=l.concat(c.slice(0,N+1)),Q=()=>{let $;return L?$=H:z?$=B:v.route.Component?$=T.createElement(v.route.Component,null):v.route.element?$=v.route.element:$=b,T.createElement(Wv,{match:v,routeContext:{outlet:b,matches:q,isDataRoute:o!=null},children:$})};return o&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?T.createElement(hp,{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 cp(()=>{r.current=!0}),T.useCallback(async(c,f={})=>{Ct(r.current,op),r.current&&(typeof c=="number"?await i.navigate(c):await i.navigate(c,{fromRouteId:l,...f}))},[i,l])}var ym={};function mp(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 dp(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(),p=Qu(),g=Vu(i,qo(f),h,o==="path"),m=JSON.stringify(g);return T.useEffect(()=>{p(JSON.parse(m),{replace:l,state:r,relative:o})},[p,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 p=i.replace(/^\/*/,"/"),g=T.useMemo(()=>({basename:p,navigator:c,static:f,unstable_useTransitions:h,future:{}}),[p,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=pa(m,p);return B==null?null:{location:{pathname:B,search:b,hash:v,state:N,key:L,unstable_mask:z},navigationType:o}},[p,m,b,v,N,L,o,z]);return Ct(H!=null,`<Router basename="${p}"> 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:g},T.createElement(ci.Provider,{children:l,value:H}))}function s1({children:i,location:l}){return $v(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 p1(){if(wu===null)try{new FormData(document.createElement("form"),0),wu=!1}catch{wu=!0}return wu}var g1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Eo(i){return i!=null&&!g1.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 p=i.getAttribute("action");o=p?pa(p,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 p=i.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=i.getAttribute("formaction")||p.getAttribute("action");if(o=g?pa(g,l):null,r=i.getAttribute("formmethod")||p.getAttribute("method")||ju,c=Eo(i.getAttribute("formenctype"))||Eo(p.getAttribute("enctype"))||Lu,f=new FormData(p,i),!p1()){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 pp(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&&pa(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=(g,m)=>r[m]?g.route.id!==r[m].route.id:!0,p=(g,m)=>{var b;return r[m].pathname!==g.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==g.params["*"]};return f==="assets"?l.filter((g,m)=>h(g,m)||p(g,m)):f==="data"?l.filter((g,m)=>{var v;let b=o.routes[g.route.id];if(!b||!b.hasLoader)return!1;if(h(g,m)||p(g,m))return!0;if(g.route.shouldRevalidate){let N=g.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:g.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 $o(){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:p,onBlur:g,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(p,L),onBlur:Pl(g,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}=$o(),[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}=$o(),{basename:f}=Qo(),h=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let p=pp(i,f,c.unstable_trailingSlashAwareDataRequests,"rsc"),g=!1,m=[];for(let b of l)typeof b.route.shouldRevalidate=="function"?g=!0:m.push(b.route.id);return g&&m.length>0&&p.searchParams.set("_routes",m.join(",")),[p.pathname+p.search]},[f,c.unstable_trailingSlashAwareDataRequests,i,o,l]);return T.createElement(T.Fragment,null,h.map(p=>T.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...r})))}function N1({page:i,matches:l,...r}){let o=zt(),{future:c,manifest:f,routeModules:h}=$o(),{basename:p}=Qo(),{loaderData:g,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 F;let $=f.routes[Q.route.id];!$||!$.hasLoader||(!b.some(V=>V.route.id===Q.route.id)&&Q.route.id in g&&((F=h[Q.route.id])!=null&&F.shouldRevalidate)||$.hasClientLoader?B=!0:H.add(Q.route.id))}),H.size===0)return[];let q=pp(i,p,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]},[p,c.unstable_trailingSlashAwareDataRequests,g,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,p]=T.useState({action:f.action,location:f.location}),g=T.useCallback(m=>{r===!1?p(m):T.startTransition(()=>p(m))},[r]);return T.useLayoutEffect(()=>f.listen(g),[f,g]),T.createElement(r1,{basename:i,children:l,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:r})}var gp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yp=T.forwardRef(function({onClick:l,discover:r="render",prefetch:o="none",relative:c,reloadDocument:f,replace:h,unstable_mask:p,state:g,target:m,to:b,preventScrollReset:v,viewTransition:N,unstable_defaultShouldRevalidate:L,...z},H){let{basename:B,navigator:q,unstable_useTransitions:Q}=T.useContext(At),$=typeof b=="string"&&gp.test(b),F=lp(b,B);b=F.to;let V=Vv(b,{relative:c}),ue=zt(),K=null;if(p){let De=Vu(p,[],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:p,state:g,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=!(F.isExternal||f),Me=T.createElement("a",{...z,...se,href:(ze?K:void 0)||F.absoluteURL||V,onClick:ze?We:l,ref:w1(H,le),target:m,"data-discover":!$&&r==="render"?"true":void 0});return te&&!$?T.createElement(T.Fragment,null,Me,T.createElement(O1,{page:V})):Me});yp.displayName="Link";var Mo=T.forwardRef(function({"aria-current":l="page",caseSensitive:r=!1,className:o="",end:c=!1,style:f,to:h,viewTransition:p,children:g,...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)&&p===!0,q=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,Q=N.pathname,$=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(Q=Q.toLowerCase(),$=$?$.toLowerCase():null,q=q.toLowerCase()),$&&H&&($=pa($,H)||$);const F=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let V=Q===q||!c&&Q.startsWith(q)&&Q.charAt(F)==="/",ue=$!=null&&($===q||!c&&$.startsWith(q)&&$.charAt(q.length)==="/"),K={isActive:V,isPending:ue,isTransitioning:B},te=V?l:void 0,le;typeof o=="function"?le=o(K):le=[o,V?"active":null,ue?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let se=typeof f=="function"?f(K):f;return T.createElement(yp,{...m,"aria-current":te,className:le,ref:b,style:se,to:h,viewTransition:p},typeof g=="function"?g(K):g)});Mo.displayName="NavLink";var L1=T.forwardRef(({discover:i="render",fetcherKey:l,navigate:r,reloadDocument:o,replace:c,state:f,method:h=ju,action:p,onSubmit:g,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N,...L},z)=>{let{unstable_useTransitions:H}=T.useContext(At),B=B1(),q=q1(p,{relative:m}),Q=h.toLowerCase()==="get"?"get":"post",$=typeof p=="string"&&gp.test(p),F=V=>{if(g&&g(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?g:F,...L,"data-discover":!$&&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 vp(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:p,unstable_defaultShouldRevalidate:g,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:p,unstable_defaultShouldRevalidate:g});m?T.startTransition(()=>H()):H()}},[v,b,N,r,o,c,l,i,f,h,p,g,m])}function u2(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((p,g)=>{const m=wo(typeof p=="function"?p(new URLSearchParams(c)):p);r.current=!0,f("?"+m,g)},[f,c]);return[c,h]}var k1=0,H1=()=>`__${String(++k1)}__`;function B1(){let{router:i}=vp("useSubmit"),{basename:l}=T.useContext(At),r=a1(),o=i.fetch,c=i.navigate;return T.useCallback(async(f,h={})=>{let{action:p,method:g,encType:m,formData:b,body:v}=y1(f,l);if(h.navigate===!1){let N=h.fetcherKey||H1();await o(N,r,h.action||p,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||g,formEncType:h.encType||m,flushSync:h.flushSync})}else await c(h.action||p,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||g,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 p=new URLSearchParams(f.search),g=p.getAll("index");if(g.some(b=>b==="")){p.delete("index"),g.filter(v=>v).forEach(v=>p.append("index",v));let b=p.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(rp);Le(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=vp("useViewTransitionState"),c=fi(i,{relative:l});if(!r.isTransitioning)return!1;let f=pa(r.currentLocation.pathname,o)||r.currentLocation.pathname,h=pa(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,p={setState:o,getState:c,getInitialState:()=>g,subscribe:m=>(r.add(m),()=>r.delete(m))},g=l=i(o,c,p);return p},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},Zo=(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 g=new URLSearchParams(c).toString();g&&(f+=`?${g}`)}const h=await fetch(f,{method:l,headers:this.headers(),body:o?JSON.stringify(o):void 0}),p=await h.json();if(!p.ok)throw new X1(p.error||"Unknown error",h.status);return p.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=Zo(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"}))}})),$1=(i,l,r,o)=>{var f,h,p,g;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]}`),(g=(p=i==null?void 0:i.services)==null?void 0:p.logger)!=null&&g.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),$1(i,l,r,o))},bp=(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,bp(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,bp(i,o))},Z1=(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 Sp;const ab=i=>{Sp=i},nb=()=>Sp,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},xp=(i,l,r,o)=>i.getFixedT(l,r,o),sb=(i,l,r,o)=>T.useCallback(xp(i,l,r,o),[i,l,r,o]),Ep=(i,l={})=>{var F,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}(F=f.options.react)!=null&&F.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:p,keyPrefix:g}=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=>Z1(te,f,h)),v=sb(f,l.lng||null,h.nsMode==="fallback"?m:m[0],g),N=()=>v,L=()=>xp(f,l.lng||null,h.nsMode==="fallback"?m:m[0],g),[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&&!p&&(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,g,b]);const $=[z,f,b];if($.t=z,$.i18n=f,$.ready=b,b||!b&&!p)return $;throw new Promise(te=>{l.lng?Tm(f,l.lng,m,()=>te()):Lo(f,m,()=>te())})};function Tp(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=Tp(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=Tp(i))&&(o&&(o+=" "),o+=l);return o}function He(...i){return ob(i)}function r2(i){return i?new Date(i).toLocaleString():"-"}let ii=typeof window<"u"&&window.desktop?"electron":"local_core";const Jo=Zo(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 pb(i){var l;return!!((l=i==null?void 0:i.monitors)!=null&&l.some(r=>r.enabled!==!1))}function gb(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=gb(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?pb(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=Zo(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 p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),m=(g==null?void 0:g.nonce)||(g==null?void 0:g.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=p.length-1;H>=0;H--){const B=p[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 p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=h,window.dispatchEvent(p),!p.defaultPrevented)throw h}return c.then(h=>{for(const p of h||[])p.status==="rejected"&&f(p.reason);return l().catch(f)})},xb=T.lazy(()=>Je(()=>import("./Dashboard-BmeP5ocP.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),Eb=T.lazy(()=>Je(()=>import("./ThreadChat-BkSc0hKN.js"),__vite__mapDeps([9,10,11,12,13,14,15,16,8,5,17,18,19,20,21,22,23]),import.meta.url)),Tb=T.lazy(()=>Je(()=>import("./Chat-C9KfsjuN.js"),__vite__mapDeps([24,19,20,2,11,12,4,25,17,21,22,23,14,15]),import.meta.url)),Rb=T.lazy(()=>Je(()=>import("./Workspace-DXJ3BGia.js"),__vite__mapDeps([26,19,20,27,16,12,2,3,5,10,23,28,14,29]),import.meta.url)),_b=T.lazy(()=>Je(()=>import("./ProjectList-Btg-mgwA.js"),__vite__mapDeps([30,1,2,3,4,6,31]),import.meta.url)),Cb=T.lazy(()=>Je(()=>import("./ProjectDetail-BCFaJig0.js"),__vite__mapDeps([32,1,19,20,27,16,12,2,3,4,5,10,33,8,31,29,28,23,34]),import.meta.url)),Ob=T.lazy(()=>Je(()=>import("./SessionList-0aGulton.js"),__vite__mapDeps([35,1,27,20,16,12,2,3,4,25,36,13,15,14]),import.meta.url)),Ab=T.lazy(()=>Je(()=>import("./SessionChat-CHPrm0Zs.js"),__vite__mapDeps([37,1,25,11,12,33,13,18,14,15]),import.meta.url)),zb=T.lazy(()=>Je(()=>import("./CronList-CenDzorW.js"),__vite__mapDeps([38,1,19,20,27,16,12,2,3,28,34,22,23]),import.meta.url)),Nb=T.lazy(()=>Je(()=>import("./MonitorList-DruqInIG.js"),__vite__mapDeps([39,1,19,20,27,16,12,2,3,28,34,22,23]),import.meta.url)),wb=T.lazy(()=>Je(()=>import("./Config-BhIq2lQa.js"),__vite__mapDeps([40,5,1,3,8,29]),import.meta.url)),Mb=T.lazy(()=>Je(()=>import("./Logs-DTITWY-y.js"),__vite__mapDeps([41,1,27,20,16,12,3,33,36,21]),import.meta.url)),jb=T.lazy(()=>Je(()=>import("./KnowledgeHome-DkKXM7Bd.js"),__vite__mapDeps([42,19,20,2,22,23,21,28,7]),import.meta.url)),Lb=T.lazy(()=>Je(()=>import("./KnowledgeDetail-Ba3PuI7k.js"),__vite__mapDeps([43,2,33,21,23]),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}=fp();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}=fp();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:$0,order:80}].forEach(r=>i.registerNavItem(r))}const $u=new Db;kb($u);Hb($u);function Rp({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),p=ti(i,h,Object);for(;p.obj===void 0&&h.length;)f=`${h[h.length-1]}.${f}`,h=h.slice(0,h.length-1),p=ti(i,h,Object),p!=null&&p.obj&&typeof p.obj[`${p.k}.${f}`]<"u"&&(p.obj=void 0);p.obj[`${p.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)},_p=(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]):_p(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=[" ",",","?","!",";"],$b=new Qb(20),Zb=(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=$b.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,p="";for(let g=f;g<o.length;++g)if(g!==f&&(p+=r),p+=o[g],h=c[p],h!==void 0){if(["string","number","boolean"].indexOf(typeof h)>-1&&g<o.length-1)continue;f+=g-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 Zu{constructor(){this.observers={}}on(l,r){return l.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(r)||0;this.observers[o].set(r,c+1)}),this}off(l,r){if(this.observers[l]){if(!r){delete this.observers[l];return}this.observers[l].delete(r)}}emit(l,...r){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c.apply(c,[l,...r])})}}class Mm extends Zu{constructor(l,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=l||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(l){this.options.ns.indexOf(l)<0&&this.options.ns.push(l)}removeNamespaces(l){const r=this.options.ns.indexOf(l);r>-1&&this.options.ns.splice(r,1)}getResource(l,r,o,c={}){var m,b;const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,h=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let p;l.indexOf(".")>-1?p=l.split("."):(p=[l,r],o&&(Array.isArray(o)?p.push(...o):ae(o)&&f?p.push(...o.split(f)):p.push(o)));const g=Hu(this.data,p);return!g&&!r&&!o&&l.indexOf(".")>-1&&(l=p[0],r=p[1],o=p.slice(2).join(".")),g||!h||!ae(o)?g: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 p=[l,r];o&&(p=p.concat(h?o.split(h):o)),l.indexOf(".")>-1&&(p=l.split("."),c=r,r=p[1]),this.addNamespaces(r),wm(this.data,p,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 p=[l,r];l.indexOf(".")>-1&&(p=l.split("."),c=o,o=r,r=p[1]),this.addNamespaces(r);let g=Hu(this.data,p)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?_p(g,o,f):g={...g,...o},wm(this.data,p,g),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 Cp={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 Op=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===Op?i:(i.push(c),r=Proxy.revocable(o,l),r.proxy)},Proxy.revocable(Object.create(null),l).proxy}function tl(i,l){const{[Op]: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 Zu{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,p=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Zb(l,o,c);if(h&&!p){const g=l.match(this.interpolator.nestingRegexp);if(g&&g.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:p,namespaces:g}=this.extractFromKey(l[l.length-1],c),m=g[g.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}${p}`,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:`${m}${b}${p}`:f?{res:p,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:p;const L=this.resolve(l,c);let z=L==null?void 0:L.res;const H=(L==null?void 0:L.usedKey)||p,B=(L==null?void 0:L.exactUsedKey)||p,q=["[object Number]","[object Function]","[object RegExp]"],Q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,$=!this.i18nFormat||this.i18nFormat.handleAsObject,F=c.count!==void 0&&!ae(c.count),V=qu.hasDefaultValue(c),ue=F?this.pluralResolver.getSuffix(v,c.count,c):"",K=c.ordinal&&F?this.pluralResolver.getSuffix(v,c.count,{ordinal:!1}):"",te=F&&!c.ordinal&&c.count===0,le=te&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${ue}`]||c[`defaultValue${K}`]||c.defaultValue;let se=z;$&&!z&&V&&(se=le);const Ae=Co(se),We=Object.prototype.toString.apply(se);if($&&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:g}):`key '${p} (${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:g}):Me[M]=this.translate(Y,{...c,joinArrays:!1,ns:g}),Me[M]===Y&&(Me[M]=se[M])}z=Me}}else if($&&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=p);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,p,Y?le:z),h){const x=this.resolve(p,{...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 ge=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ge&&ge[0])for(let x=0;x<ge.length;x++)P.push(ge[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&&F?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],p+G,c[`defaultValue${G}`]||le)})}):Se(P,p,le))}z=this.extendTranslation(z,l,c,L,o),Me&&z===p&&this.options.appendNamespaceToMissingKey&&(z=`${m}${b}${p}`),(Me||ze)&&this.options.parseMissingKeyHandler&&(z=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}${b}${p}`:p,ze?z:void 0,c))}return f?(L.res=z,L.usedParams=this.getUsedParamsDetails(c),L):z}extendTranslation(l,r,o,c,f){var g,m;if((g=this.i18nFormat)!=null&&g.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,p=ae(h)?[h]:h;return l!=null&&(p!=null&&p.length)&&o.applyPostProcessor!==!1&&(l=Cp.handle(p,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,p;return ae(l)&&(l=[l]),Array.isArray(l)&&(l=l.map(g=>typeof g=="function"?tl(g,{...this.options,...r}):g)),l.forEach(g=>{if(this.isValidLookup(o))return;const m=this.extractFromKey(g,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)||(p=B,!jm[`${H[0]}-${B}`]&&((q=this.utils)!=null&&q.hasLoadedNamespace)&&!((Q=this.utils)!=null&&Q.hasLoadedNamespace(p))&&(jm[`${H[0]}-${B}`]=!0,this.logger.warn(`key "${c}" for languages "${H.join(", ")}" won't get resolved as namespace "${p}" 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($=>{var ue;if(this.isValidLookup(o))return;h=$;const F=[b];if((ue=this.i18nFormat)!=null&&ue.addLookupKeys)this.i18nFormat.addLookupKeys(F,b,$,B,r);else{let K;N&&(K=this.pluralResolver.getSuffix($,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&&F.push(b+K.replace(le,this.options.pluralSeparator)),F.push(b+K),L&&F.push(b+te)),z){const se=`${b}${this.options.contextSeparator||"_"}${r.context}`;F.push(se),N&&(r.ordinal&&K.indexOf(le)===0&&F.push(se+K.replace(le,this.options.pluralSeparator)),F.push(se+K),L&&F.push(se+te))}}let V;for(;V=F.pop();)this.isValidLookup(o)||(f=V,o=this.getResource($,B,V,r))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:p}}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 g=this.languageUtils.getLanguagePartFromCode(l);h=this.getRule(g,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:p,suffixEscaped:g,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=p?sn(p):g||"}}",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,p;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=z=>{if(z.indexOf(this.formatSeparator)<0){const Q=km(r,g,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,g,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(p=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,p++,p>=this.maxReplaces)break}}),l}nest(l,r,o={}){let c,f,h;const p=(g,m)=>{const b=this.nestingOptionsSeparator;if(g.indexOf(b)<0)return g;const v=g.split(new RegExp(`${sn(b)}[ ]*{`));let N=`{${v[1]}`;g=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 ${g}`,H),`${g}${b}${N}`}return h.defaultValue&&h.defaultValue.indexOf(this.prefix)>-1&&delete h.defaultValue,g};for(;c=this.nestingRegexp.exec(l);){let g=[];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&&(g=c[1].slice(m).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,m)),f=r(p.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=""),g.length&&(f=g.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[p,...g]=h.split(":"),m=g.join(":").trim().replace(/^'+|'+$/g,""),b=p.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 p=l[h];return p||(p=i(ui(o),c),l[h]=p),p(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 p=>h.format(p)}),currency:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f,style:"currency"});return p=>h.format(p)}),datetime:o((c,f)=>{const h=new Intl.DateTimeFormat(c,{...f});return p=>h.format(p)}),relativetime:o((c,f)=>{const h=new Intl.RelativeTimeFormat(c,{...f});return p=>h.format(p,f.range||"day")}),list:o((c,f)=>{const h=new Intl.ListFormat(c,{...f});return p=>h.format(p)})}}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(p=>p.indexOf(")")>-1)){const p=f.findIndex(g=>g.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,p)].join(this.formatSeparator)}return f.reduce((p,g)=>{var v;const{formatName:m,formatOptions:b}=Ib(g);if(this.formats[m]){let N=p;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](p,z,{...b,...c,...L})}catch(L){this.logger.warn(L)}return N}else this.logger.warn(`there was no format function for ${m}`);return p},l)}}const tS=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class aS extends Zu{constructor(l,r,o,c={}){var f,h;super(),this.backend=l,this.store=r,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=Ft.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],(h=(f=this.backend)==null?void 0:f.init)==null||h.call(f,o,c.backend,c)}queueLoad(l,r,o,c){const f={},h={},p={},g={};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),g[v]===void 0&&(g[v]=!0)))}),b||(p[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(p),toLoadNamespaces:Object.keys(g)}}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 p={};this.queue.forEach(g=>{Yb(g.loaded,[f],h),tS(g,l),r&&g.errors.push(r),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(m=>{p[m]||(p[m]={});const b=g.loaded[m];b.length&&b.forEach(v=>{p[m][v]===void 0&&(p[m][v]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",p),this.queue=this.queue.filter(g=>!g.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 p=(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)},g=this.backend[o].bind(this.backend);if(g.length===2){try{const m=g(l,r);m&&typeof m.then=="function"?m.then(b=>p(null,b)).catch(p):p(null,m)}catch(m){p(m)}return}return g(l,r,p)}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,p)=>{h&&this.logger.warn(`${r}loading namespace ${f} for language ${c} failed`,h),!h&&p&&this.logger.log(`${r}loaded namespace ${f} for language ${c}`,p),this.loaded(l,h,p)})}saveMissing(l,r,o,c,f,h={},p=()=>{}){var g,m,b,v,N;if((m=(g=this.services)==null?void 0:g.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=>p(null,B)).catch(p):p(null,H)}catch(H){p(H)}else z(l,r,o,c,p,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))})},Ap="__i18next_supportNoticeShown",lS=()=>!!(typeof globalThis<"u"&&globalThis[Ap]||typeof process<"u"&&_o&&_o.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&_o),iS=()=>{typeof globalThis<"u"&&(globalThis[Ap]=!0)},uS=i=>{var l,r,o,c,f,h,p,g,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||((p=(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:p.indexOf("Locize"))>0||(m=(g=i==null?void 0:i.options)==null?void 0:g.backend)!=null&&m.backends&&i.options.backend.backends.some(z=>{var H,B,q;return((H=z==null?void 0:z.name)==null?void 0:H.indexOf("Locize"))>0||((q=(B=z==null?void 0:z.constructor)==null?void 0:B.name)==null?void 0:q.indexOf("Locize"))>0})||(v=(b=i==null?void 0:i.options)==null?void 0:b.backend)!=null&&v.projectId||(L=(N=i==null?void 0:i.options)==null?void 0:N.backend)!=null&&L.backendOptions&&i.options.backend.backendOptions.some(z=>z==null?void 0:z.projectId))};class ai extends Zu{constructor(l={},r){if(super(),this.options=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 p=ei(),g=()=>{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),p.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?g():setTimeout(g,0),p}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 p=[],g=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(v=>{v!=="cimode"&&p.indexOf(v)<0&&p.push(v)})};c?g(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>g(b)),(h=(f=this.options.preload)==null?void 0:f.forEach)==null||h.call(f,m=>g(m)),this.services.backendConnector.load(p,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"&&Cp.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=p=>{this.language=p,this.languages=this.services.languageUtils.toResolveHierarchy(p),this.resolvedLanguage=void 0,this.setResolvedLanguage(p)},f=(p,g)=>{g?this.isLanguageChangingTo===l&&(c(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,o.resolve((...m)=>this.t(...m)),r&&r(p,(...m)=>this.t(...m))},h=p=>{var b,v;!l&&!p&&this.services.languageDetector&&(p=[]);const g=ae(p)?p:p&&p[0],m=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(ae(p)?[p]:p);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,...p)=>{let g;typeof h!="object"?g=this.options.overloadTranslationOptionHandler([f,h].concat(p)):g={...h},g.lng=g.lng||c.lng,g.lngs=g.lngs||c.lngs,g.ns=g.ns||c.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||o||c.keyPrefix);const m={...this.options,...g};typeof g.keyPrefix=="function"&&(g.keyPrefix=tl(g.keyPrefix,m));const b=this.options.keySeparator||".";let v;return g.keyPrefix&&Array.isArray(f)?v=f.map(N=>(typeof N=="function"&&(N=tl(N,m)),`${g.keyPrefix}${b}${N}`)):(typeof f=="function"&&(f=tl(f,m)),v=g.keyPrefix?`${g.keyPrefix}${b}${f}`:f),this.t(v,g)};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=(p,g)=>{const m=this.services.backendConnector.state[`${p}|${g}`];return m===-1||m===0||m===2};if(r.precheck){const p=r.precheck(this,h);if(p!==void 0)return p}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 p=h.getTextInfo();if(p&&p.direction)return p.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(p=>{f[p]=this[p]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const p=Object.keys(this.store.data).reduce((g,m)=>(g[m]={...this.store.data[m]},g[m]=Object.keys(g[m]).reduce((b,v)=>(b[v]={...g[m][v]},b),g[m]),g),{});f.store=new Mm(p,c),f.services.resourceStore=f.store}if(l.interpolation){const g={...Ao().interpolation,...this.options.interpolation,...l.interpolation},m={...c,interpolation:g};f.services.interpolator=new Hm(m)}return f.translator=new qu(f.services,c),f.translator.on("*",(p,...g)=>{f.emit(p,...g)}),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",zp={en:()=>Je(()=>import("./en-CmAr_0e6.js"),[],import.meta.url),zh:()=>Je(()=>import("./zh-CcJ9vBZj.js"),[],import.meta.url),"zh-TW":()=>Je(()=>import("./zh-TW-elI72AC1.js"),[],import.meta.url),ja:()=>Je(()=>import("./ja-DtvtBRTW.js"),[],import.meta.url),es:()=>Je(()=>import("./es-Cs9x52ca.js"),[],import.meta.url)},Du={};function Ym(i){return i in zp}function Np(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 Np(i||navigator.language||ni)}async function ko(i){if(Du[i])return;const l=await zp[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 wp(i){const l=Np(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 F;const{pathname:i}=zt(),{t:l,i18n:r}=Ep(),{theme:o,setTheme:c}=Wo(),f=Ot(V=>V.logout),h=Ot(V=>V.desktopManaged),p=Fo(),g=dn(),[m,b]=T.useState(!1),[v,N]=T.useState(!1),L=V=>{wp(V),N(!1)},z={light:Im,dark:Fm,system:Jm},H={light:"dark",dark:"system",system:"light"},B=z[o],q=$u.listNavItems().filter(V=>{var ue;return((ue=V.visible)==null?void 0:ue.call(V,{desktopManaged:h,features:p}))??!0}),Q=q.map(V=>{var te;const ue=V.icon,K=((te=V.resolveLabelKey)==null?void 0:te.call(V,{desktopManaged:h,features:p,runtimeProvider:g}))||V.labelKey;return{...V,Icon:ue,labelKey:K}}),$=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(Rp,{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:p,runtimeProvider:g}))||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.54"]}),_.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:((F=Gm.find(V=>V.code===r.language))==null?void 0:F.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})})]})]}),$?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"),s2=i=>Xe.post("/restart",i),o2=()=>Xe.post("/reload"),c2=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 Mp(...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 f2(...i){return T.useCallback(Mp(...i),i)}var mS=Symbol.for("react.lazy"),Yu=m0[" use ".trim().toString()];function pS(i){return typeof i=="object"&&i!==null&&"then"in i}function jp(i){return i!=null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===mS&&"_payload"in i&&pS(i._payload)}function gS(i){const l=vS(i),r=T.forwardRef((o,c)=>{let{children:f,...h}=o;jp(f)&&typeof Yu=="function"&&(f=Yu(f._payload));const p=T.Children.toArray(f),g=p.find(SS);if(g){const m=g.props.children,b=p.map(v=>v===g?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=gS("Slot");function vS(i){const l=T.forwardRef((r,o)=>{let{children:c,...f}=r;if(jp(c)&&typeof Yu=="function"&&(c=Yu(c._payload)),T.isValidElement(c)){const h=ES(c),p=xS(f,c.props);return c.type!==T.Fragment&&(p.ref=o?Mp(o,h):h),T.cloneElement(c,p)}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]=(...p)=>{const g=f(...p);return c(...p),g}: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:p="button",...g}){const m=l==="default"?"md":l,b=f?yS:"button";return _.jsxs(b,{...f?{}:{type:p},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,...g,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 d2({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 X(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 Lp(){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(()=>Lp(),1e3)}}function OS(){si.size===0&&_t&&(_t.close(),_t=null)}function Dp(i){return si.add(i),Lp(),()=>{si.delete(i),OS()}}async function h2(){return X("GET","/runtime")}async function m2(){return X("POST","/runtime/service/start")}async function p2(){return X("POST","/runtime/service/stop")}async function g2(){return X("POST","/runtime/service/restart")}async function y2(i){const l=typeof i=="number"?`?limit=${encodeURIComponent(String(i))}`:"";return X("GET",`/runtime/logs${l}`)}async function v2(){return X("GET","/runtime/agent-runtimes")}async function b2(){return X("POST","/runtimes/refresh")}async function S2(){return X("GET","/diagnostics/errors")}async function x2(){return X("POST","/diagnostics/doctor")}async function E2(){return X("POST","/diagnostics/deployment")}async function T2(){return X("GET","/runtime/runtime-config")}async function R2(i){return X("POST","/runtime/runtime-config",{config:i})}async function _2(i){return X("POST","/runtime/settings",i)}async function C2(){return X("GET","/providers")}async function O2(i){return X("POST","/providers",i)}async function A2(i,l){return X("PUT",`/providers/${encodeURIComponent(i)}`,l)}async function z2(i){return X("DELETE",`/providers/${encodeURIComponent(i)}`)}async function AS(i){return X("GET",`/platforms/${encodeURIComponent(i)}`)}function di(i){return i?`?instance_id=${encodeURIComponent(i)}`:""}async function zS(i,l,r){return X("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}${di(r)}`)}async function NS(i,l,r){return X("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/test${di(r)}`)}async function wS(i,l,r){return X("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/enable${di(r)}`)}async function MS(i,l,r){return X("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/disable${di(r)}`)}async function jS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return X("GET",`/platforms/${encodeURIComponent(i)}/pairings${r}`)}async function LS(i,l){return X("POST",`/platforms/${encodeURIComponent(i)}/pairings/approve`,{code:l})}async function DS(i,l){return X("POST",`/platforms/${encodeURIComponent(i)}/pairings/reject`,{code:l})}async function US(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return X("GET",`/platforms/${encodeURIComponent(i)}/users${r}`)}async function Up(i,l,r){return X("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode${di(r)}`)}async function kp(i,l,r,o){const c=`?ticket=${encodeURIComponent(r)}${o?`&instance_id=${encodeURIComponent(o)}`:""}`;return X("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode/status${c}`)}async function N2(){return AS("lark")}async function w2(i,l){return zS("lark",i,l)}async function M2(i,l){return NS("lark",i,l)}async function j2(i,l){return wS("lark",i,l)}async function L2(i,l){return MS("lark",i,l)}async function D2(i){return jS("lark",i)}async function U2(i){return LS("lark",i)}async function k2(i){return DS("lark",i)}async function H2(i){return US("lark",i)}async function B2(i,l){return Up("lark",i,l)}async function q2(i,l,r){return kp("lark",i,l,r)}async function Y2(i,l){return Up("weixin",i,l)}async function G2(i,l,r){return kp("weixin",i,l,r)}async function V2(){return X("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 X("GET",`/tasks${r}`)}async function Q2(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 X("GET",`/approvals${r}`)}async function X2(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 X("GET",`/audit-events${r}`)}async function $2(i){return X("GET","/scheduler/jobs")}async function Z2(i){return X("POST","/scheduler/jobs",i)}async function J2(i,l){return X("PATCH",`/scheduler/jobs/${encodeURIComponent(i)}`,l)}async function F2(i){return X("DELETE",`/scheduler/jobs/${encodeURIComponent(i)}`)}async function W2(i){return X("POST",`/scheduler/jobs/${encodeURIComponent(i)}/run`)}async function I2(i){return X("GET","/automation/monitors")}async function P2(i){return X("POST","/automation/monitors",i)}async function ex(i,l){return X("PATCH",`/automation/monitors/${encodeURIComponent(i)}`,l)}async function tx(i){return X("DELETE",`/automation/monitors/${encodeURIComponent(i)}`)}async function ax(i){return X("POST",`/automation/monitors/${encodeURIComponent(i)}/run`)}async function nx(i){return X("GET",`/threads?workspace_id=${encodeURIComponent(i)}`)}async function lx(i,l){return X("POST","/threads",{workspaceId:i,title:l})}async function ix(i){return X("GET",`/threads/${encodeURIComponent(i)}`)}async function ux(i,l){return X("PATCH",`/threads/${encodeURIComponent(i)}`,{title:l})}async function rx(i,l){return X("PATCH",`/threads/${encodeURIComponent(i)}/knowledge-bases`,{knowledgeBaseIds:l})}async function sx(i,l){return X("PATCH",`/threads/${encodeURIComponent(i)}/mode`,{mode:l})}async function ox(i){return X("DELETE",`/threads/${encodeURIComponent(i)}`)}async function cx(i,l){return X("POST",`/threads/${encodeURIComponent(i)}/messages`,{content:l})}async function fx(i,l){return X("POST",`/threads/${encodeURIComponent(i)}/actions`,{content:l})}async function dx(i){return X("POST",`/runs/${encodeURIComponent(i)}/interrupt`)}async function hx(){return X("GET","/knowledge/config")}async function mx(){return X("GET","/knowledge/folders")}async function px(i){return X("POST","/knowledge/folders",i)}async function gx(i,l){return X("PATCH",`/knowledge/folders/${encodeURIComponent(i)}`,l)}async function yx(i){return X("DELETE",`/knowledge/folders/${encodeURIComponent(i)}`)}async function vx(){return X("GET","/knowledge/bases")}async function bx(i){return X("POST","/knowledge/bases",i)}async function Sx(i){return X("GET",`/knowledge/bases/${encodeURIComponent(i)}`)}async function xx(i,l){return X("PATCH",`/knowledge/bases/${encodeURIComponent(i)}`,l)}async function Ex(i){return X("DELETE",`/knowledge/bases/${encodeURIComponent(i)}`)}async function Tx(i){return X("GET",`/knowledge/bases/${encodeURIComponent(i)}/files`)}async function Rx(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 _x(i,l){return X("DELETE",`/knowledge/bases/${encodeURIComponent(i)}/files/${encodeURIComponent(l)}`)}async function Cx(i,l){return X("POST",`/knowledge/bases/${encodeURIComponent(i)}/search`,l)}async function Ox(){return X("GET","/capabilities/snapshot")}async function Ax(){return X("GET","/plugins/diagnostics")}async function zx(i){return X("POST",`/workspaces/${encodeURIComponent(i)}/streaming-probe`)}function Nx(i){return Dp(l=>{l.type==="runtime.updated"&&i(l.runtime)})}function wx(i){return Dp(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}=Ep(),r=Qu(),o=Ot(F=>F.login),{theme:c,setTheme:f}=Wo(),[h,p]=T.useState(""),[g,m]=T.useState(""),[b,v]=T.useState(""),[N,L]=T.useState(!1),z=cb(),H=fb(),B=async F=>{if(F.preventDefault(),!(!h.trim()||H)){L(!0),v("");try{g.trim()&&Xe.setBaseUrl(g.trim()),Xe.setToken(h.trim()),await dS(),o(h.trim(),g.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"},$=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(F=>_.jsx("button",{onClick:()=>void wp(F.code),className:He("px-2.5 py-1.5 text-xs font-medium transition-colors",l.language===F.code?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent/10 hover:text-foreground"),children:F.label},F.code))}),_.jsx(Gu,{variant:"outline",size:"icon",onClick:()=>f(Q[c]),"aria-label":i(`theme.${c}`),children:_.jsx($,{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(Rp,{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:F=>p(F.target.value),placeholder:"mgmt-secret-xxx",autoFocus:!0}),_.jsx(Km,{label:`${i("login.serverUrl")} (${i("common.optional")})`,type:"text",value:g,onChange:F=>m(F.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:[$u.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 Hp(){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(()=>Hp(),1e3)})}function $S(){oi.size===0&&Kt&&(Kt.close(),Kt=null)}async function ZS(){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),Hp(),()=>{oi.delete(i),$S()})}const Xm=20,IS=500;function PS(i){return new Promise(l=>window.setTimeout(l,i))}function e2(){const i=window.navigator.userAgent.toLowerCase().includes("windows")?"windows":window.navigator.userAgent.toLowerCase().includes("mac os x")?"macos":window.navigator.userAgent.toLowerCase().includes("linux")?"linux":"unknown";document.documentElement.classList.add(`platform-${i}`)}function t2(){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 a2({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(g==="/"||((B=q.pathname)==null?void 0:B.startsWith(g)),`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 "${g}" but pathname "${q.pathname}" was given in the \`location\` prop.`),v=q}else v=b;let N=v.pathname||"/",L=N;if(g!=="/"){let q=g.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([g,o.encodeLocation?o.encodeLocation(q.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:q.pathname]),pathnameBase:q.pathnameBase==="/"?g:Qt([g,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 Zv(){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(Zv,null),hp=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}};hp.contextType=up;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=lp(o.location,r);if(np&&!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,p=-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)&&(p=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),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let g=r==null?void 0:r.onError,m=o&&g?(b,v)=>{var N,L;g(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&&(p<0&&N===0?(mp("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),z=!0,B=null):p===N&&(z=!0,B=v.route.hydrateFallbackElement||null)));let q=l.concat(c.slice(0,N+1)),Q=()=>{let $;return L?$=H:z?$=B:v.route.Component?$=T.createElement(v.route.Component,null):v.route.element?$=v.route.element:$=b,T.createElement(Wv,{match:v,routeContext:{outlet:b,matches:q,isDataRoute:o!=null},children:$})};return o&&(v.route.ErrorBoundary||v.route.errorElement||N===0)?T.createElement(hp,{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 cp(()=>{r.current=!0}),T.useCallback(async(c,f={})=>{Ct(r.current,op),r.current&&(typeof c=="number"?await i.navigate(c):await i.navigate(c,{fromRouteId:l,...f}))},[i,l])}var ym={};function mp(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 dp(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(),p=Qu(),g=Vu(i,qo(f),h,o==="path"),m=JSON.stringify(g);return T.useEffect(()=>{p(JSON.parse(m),{replace:l,state:r,relative:o})},[p,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 p=i.replace(/^\/*/,"/"),g=T.useMemo(()=>({basename:p,navigator:c,static:f,unstable_useTransitions:h,future:{}}),[p,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=pa(m,p);return B==null?null:{location:{pathname:B,search:b,hash:v,state:N,key:L,unstable_mask:z},navigationType:o}},[p,m,b,v,N,L,o,z]);return Ct(H!=null,`<Router basename="${p}"> 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:g},T.createElement(ci.Provider,{children:l,value:H}))}function s1({children:i,location:l}){return $v(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 p1(){if(wu===null)try{new FormData(document.createElement("form"),0),wu=!1}catch{wu=!0}return wu}var g1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Eo(i){return i!=null&&!g1.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 p=i.getAttribute("action");o=p?pa(p,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 p=i.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=i.getAttribute("formaction")||p.getAttribute("action");if(o=g?pa(g,l):null,r=i.getAttribute("formmethod")||p.getAttribute("method")||ju,c=Eo(i.getAttribute("formenctype"))||Eo(p.getAttribute("enctype"))||Lu,f=new FormData(p,i),!p1()){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 pp(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&&pa(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=(g,m)=>r[m]?g.route.id!==r[m].route.id:!0,p=(g,m)=>{var b;return r[m].pathname!==g.pathname||((b=r[m].route.path)==null?void 0:b.endsWith("*"))&&r[m].params["*"]!==g.params["*"]};return f==="assets"?l.filter((g,m)=>h(g,m)||p(g,m)):f==="data"?l.filter((g,m)=>{var v;let b=o.routes[g.route.id];if(!b||!b.hasLoader)return!1;if(h(g,m)||p(g,m))return!0;if(g.route.shouldRevalidate){let N=g.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:g.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 $o(){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:p,onBlur:g,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(p,L),onBlur:Pl(g,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}=$o(),[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}=$o(),{basename:f}=Qo(),h=T.useMemo(()=>{if(i===o.pathname+o.search+o.hash)return[];let p=pp(i,f,c.unstable_trailingSlashAwareDataRequests,"rsc"),g=!1,m=[];for(let b of l)typeof b.route.shouldRevalidate=="function"?g=!0:m.push(b.route.id);return g&&m.length>0&&p.searchParams.set("_routes",m.join(",")),[p.pathname+p.search]},[f,c.unstable_trailingSlashAwareDataRequests,i,o,l]);return T.createElement(T.Fragment,null,h.map(p=>T.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...r})))}function N1({page:i,matches:l,...r}){let o=zt(),{future:c,manifest:f,routeModules:h}=$o(),{basename:p}=Qo(),{loaderData:g,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 F;let $=f.routes[Q.route.id];!$||!$.hasLoader||(!b.some(V=>V.route.id===Q.route.id)&&Q.route.id in g&&((F=h[Q.route.id])!=null&&F.shouldRevalidate)||$.hasClientLoader?B=!0:H.add(Q.route.id))}),H.size===0)return[];let q=pp(i,p,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]},[p,c.unstable_trailingSlashAwareDataRequests,g,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,p]=T.useState({action:f.action,location:f.location}),g=T.useCallback(m=>{r===!1?p(m):T.startTransition(()=>p(m))},[r]);return T.useLayoutEffect(()=>f.listen(g),[f,g]),T.createElement(r1,{basename:i,children:l,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:r})}var gp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yp=T.forwardRef(function({onClick:l,discover:r="render",prefetch:o="none",relative:c,reloadDocument:f,replace:h,unstable_mask:p,state:g,target:m,to:b,preventScrollReset:v,viewTransition:N,unstable_defaultShouldRevalidate:L,...z},H){let{basename:B,navigator:q,unstable_useTransitions:Q}=T.useContext(At),$=typeof b=="string"&&gp.test(b),F=lp(b,B);b=F.to;let V=Vv(b,{relative:c}),ue=zt(),K=null;if(p){let De=Vu(p,[],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:p,state:g,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=!(F.isExternal||f),Me=T.createElement("a",{...z,...se,href:(ze?K:void 0)||F.absoluteURL||V,onClick:ze?We:l,ref:w1(H,le),target:m,"data-discover":!$&&r==="render"?"true":void 0});return te&&!$?T.createElement(T.Fragment,null,Me,T.createElement(O1,{page:V})):Me});yp.displayName="Link";var Mo=T.forwardRef(function({"aria-current":l="page",caseSensitive:r=!1,className:o="",end:c=!1,style:f,to:h,viewTransition:p,children:g,...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)&&p===!0,q=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,Q=N.pathname,$=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(Q=Q.toLowerCase(),$=$?$.toLowerCase():null,q=q.toLowerCase()),$&&H&&($=pa($,H)||$);const F=q!=="/"&&q.endsWith("/")?q.length-1:q.length;let V=Q===q||!c&&Q.startsWith(q)&&Q.charAt(F)==="/",ue=$!=null&&($===q||!c&&$.startsWith(q)&&$.charAt(q.length)==="/"),K={isActive:V,isPending:ue,isTransitioning:B},te=V?l:void 0,le;typeof o=="function"?le=o(K):le=[o,V?"active":null,ue?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let se=typeof f=="function"?f(K):f;return T.createElement(yp,{...m,"aria-current":te,className:le,ref:b,style:se,to:h,viewTransition:p},typeof g=="function"?g(K):g)});Mo.displayName="NavLink";var L1=T.forwardRef(({discover:i="render",fetcherKey:l,navigate:r,reloadDocument:o,replace:c,state:f,method:h=ju,action:p,onSubmit:g,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:N,...L},z)=>{let{unstable_useTransitions:H}=T.useContext(At),B=B1(),q=q1(p,{relative:m}),Q=h.toLowerCase()==="get"?"get":"post",$=typeof p=="string"&&gp.test(p),F=V=>{if(g&&g(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?g:F,...L,"data-discover":!$&&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 vp(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:p,unstable_defaultShouldRevalidate:g,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:p,unstable_defaultShouldRevalidate:g});m?T.startTransition(()=>H()):H()}},[v,b,N,r,o,c,l,i,f,h,p,g,m])}function u2(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((p,g)=>{const m=wo(typeof p=="function"?p(new URLSearchParams(c)):p);r.current=!0,f("?"+m,g)},[f,c]);return[c,h]}var k1=0,H1=()=>`__${String(++k1)}__`;function B1(){let{router:i}=vp("useSubmit"),{basename:l}=T.useContext(At),r=a1(),o=i.fetch,c=i.navigate;return T.useCallback(async(f,h={})=>{let{action:p,method:g,encType:m,formData:b,body:v}=y1(f,l);if(h.navigate===!1){let N=h.fetcherKey||H1();await o(N,r,h.action||p,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||g,formEncType:h.encType||m,flushSync:h.flushSync})}else await c(h.action||p,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||g,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 p=new URLSearchParams(f.search),g=p.getAll("index");if(g.some(b=>b==="")){p.delete("index"),g.filter(v=>v).forEach(v=>p.append("index",v));let b=p.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(rp);Le(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=vp("useViewTransitionState"),c=fi(i,{relative:l});if(!r.isTransitioning)return!1;let f=pa(r.currentLocation.pathname,o)||r.currentLocation.pathname,h=pa(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,p={setState:o,getState:c,getInitialState:()=>g,subscribe:m=>(r.add(m),()=>r.delete(m))},g=l=i(o,c,p);return p},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},Zo=(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 g=new URLSearchParams(c).toString();g&&(f+=`?${g}`)}const h=await fetch(f,{method:l,headers:this.headers(),body:o?JSON.stringify(o):void 0}),p=await h.json();if(!p.ok)throw new X1(p.error||"Unknown error",h.status);return p.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=Zo(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"}))}})),$1=(i,l,r,o)=>{var f,h,p,g;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]}`),(g=(p=i==null?void 0:i.services)==null?void 0:p.logger)!=null&&g.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),$1(i,l,r,o))},bp=(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,bp(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,bp(i,o))},Z1=(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 Sp;const ab=i=>{Sp=i},nb=()=>Sp,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},xp=(i,l,r,o)=>i.getFixedT(l,r,o),sb=(i,l,r,o)=>T.useCallback(xp(i,l,r,o),[i,l,r,o]),Ep=(i,l={})=>{var F,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}(F=f.options.react)!=null&&F.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:p,keyPrefix:g}=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=>Z1(te,f,h)),v=sb(f,l.lng||null,h.nsMode==="fallback"?m:m[0],g),N=()=>v,L=()=>xp(f,l.lng||null,h.nsMode==="fallback"?m:m[0],g),[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&&!p&&(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,g,b]);const $=[z,f,b];if($.t=z,$.i18n=f,$.ready=b,b||!b&&!p)return $;throw new Promise(te=>{l.lng?Tm(f,l.lng,m,()=>te()):Lo(f,m,()=>te())})};function Tp(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=Tp(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=Tp(i))&&(o&&(o+=" "),o+=l);return o}function He(...i){return ob(i)}function r2(i){return i?new Date(i).toLocaleString():"-"}let ii=typeof window<"u"&&window.desktop?"electron":"local_core";const Jo=Zo(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 pb(i){var l;return!!((l=i==null?void 0:i.monitors)!=null&&l.some(r=>r.enabled!==!1))}function gb(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=gb(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?pb(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=Zo(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 p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),m=(g==null?void 0:g.nonce)||(g==null?void 0:g.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=p.length-1;H>=0;H--){const B=p[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 p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=h,window.dispatchEvent(p),!p.defaultPrevented)throw h}return c.then(h=>{for(const p of h||[])p.status==="rejected"&&f(p.reason);return l().catch(f)})},xb=T.lazy(()=>Je(()=>import("./Dashboard-CsKBSQIe.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),Eb=T.lazy(()=>Je(()=>import("./ThreadChat-CAsIl9qf.js"),__vite__mapDeps([9,10,11,12,13,14,15,16,8,5,17,18,19,20,21,22,23]),import.meta.url)),Tb=T.lazy(()=>Je(()=>import("./Chat-BJveQQKu.js"),__vite__mapDeps([24,19,20,2,11,12,4,25,17,21,22,23,14,15]),import.meta.url)),Rb=T.lazy(()=>Je(()=>import("./Workspace-CaUhiGBX.js"),__vite__mapDeps([26,19,20,27,16,12,2,3,5,10,23,28,14,29]),import.meta.url)),_b=T.lazy(()=>Je(()=>import("./ProjectList-BKl4eW7q.js"),__vite__mapDeps([30,1,2,3,4,6,31]),import.meta.url)),Cb=T.lazy(()=>Je(()=>import("./ProjectDetail-Djr9-MyT.js"),__vite__mapDeps([32,1,19,20,27,16,12,2,3,4,5,10,33,8,31,29,28,23,34]),import.meta.url)),Ob=T.lazy(()=>Je(()=>import("./SessionList-BJ2GjXvR.js"),__vite__mapDeps([35,1,27,20,16,12,2,3,4,25,36,13,15,14]),import.meta.url)),Ab=T.lazy(()=>Je(()=>import("./SessionChat-Dxv8D5DW.js"),__vite__mapDeps([37,1,25,11,12,33,13,18,14,15]),import.meta.url)),zb=T.lazy(()=>Je(()=>import("./CronList-C-ILB_Ae.js"),__vite__mapDeps([38,1,19,20,27,16,12,2,3,28,34,22,23]),import.meta.url)),Nb=T.lazy(()=>Je(()=>import("./MonitorList-B0hxjuOZ.js"),__vite__mapDeps([39,1,19,20,27,16,12,2,3,28,34,22,23]),import.meta.url)),wb=T.lazy(()=>Je(()=>import("./Config-CMtZDRAE.js"),__vite__mapDeps([40,5,1,3,8,29]),import.meta.url)),Mb=T.lazy(()=>Je(()=>import("./Logs-CktemGN0.js"),__vite__mapDeps([41,1,27,20,16,12,3,33,36,21]),import.meta.url)),jb=T.lazy(()=>Je(()=>import("./KnowledgeHome-3rlvxgWf.js"),__vite__mapDeps([42,19,20,2,22,23,21,28,7]),import.meta.url)),Lb=T.lazy(()=>Je(()=>import("./KnowledgeDetail-CC5C7JYe.js"),__vite__mapDeps([43,2,33,21,23]),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}=fp();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}=fp();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:$0,order:80}].forEach(r=>i.registerNavItem(r))}const $u=new Db;kb($u);Hb($u);function Rp({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),p=ti(i,h,Object);for(;p.obj===void 0&&h.length;)f=`${h[h.length-1]}.${f}`,h=h.slice(0,h.length-1),p=ti(i,h,Object),p!=null&&p.obj&&typeof p.obj[`${p.k}.${f}`]<"u"&&(p.obj=void 0);p.obj[`${p.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)},_p=(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]):_p(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=[" ",",","?","!",";"],$b=new Qb(20),Zb=(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=$b.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,p="";for(let g=f;g<o.length;++g)if(g!==f&&(p+=r),p+=o[g],h=c[p],h!==void 0){if(["string","number","boolean"].indexOf(typeof h)>-1&&g<o.length-1)continue;f+=g-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 Zu{constructor(){this.observers={}}on(l,r){return l.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(r)||0;this.observers[o].set(r,c+1)}),this}off(l,r){if(this.observers[l]){if(!r){delete this.observers[l];return}this.observers[l].delete(r)}}emit(l,...r){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c.apply(c,[l,...r])})}}class Mm extends Zu{constructor(l,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=l||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(l){this.options.ns.indexOf(l)<0&&this.options.ns.push(l)}removeNamespaces(l){const r=this.options.ns.indexOf(l);r>-1&&this.options.ns.splice(r,1)}getResource(l,r,o,c={}){var m,b;const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,h=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let p;l.indexOf(".")>-1?p=l.split("."):(p=[l,r],o&&(Array.isArray(o)?p.push(...o):ae(o)&&f?p.push(...o.split(f)):p.push(o)));const g=Hu(this.data,p);return!g&&!r&&!o&&l.indexOf(".")>-1&&(l=p[0],r=p[1],o=p.slice(2).join(".")),g||!h||!ae(o)?g: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 p=[l,r];o&&(p=p.concat(h?o.split(h):o)),l.indexOf(".")>-1&&(p=l.split("."),c=r,r=p[1]),this.addNamespaces(r),wm(this.data,p,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 p=[l,r];l.indexOf(".")>-1&&(p=l.split("."),c=o,o=r,r=p[1]),this.addNamespaces(r);let g=Hu(this.data,p)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?_p(g,o,f):g={...g,...o},wm(this.data,p,g),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 Cp={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 Op=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===Op?i:(i.push(c),r=Proxy.revocable(o,l),r.proxy)},Proxy.revocable(Object.create(null),l).proxy}function tl(i,l){const{[Op]: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 Zu{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,p=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!Zb(l,o,c);if(h&&!p){const g=l.match(this.interpolator.nestingRegexp);if(g&&g.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:p,namespaces:g}=this.extractFromKey(l[l.length-1],c),m=g[g.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}${p}`,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:`${m}${b}${p}`:f?{res:p,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:p;const L=this.resolve(l,c);let z=L==null?void 0:L.res;const H=(L==null?void 0:L.usedKey)||p,B=(L==null?void 0:L.exactUsedKey)||p,q=["[object Number]","[object Function]","[object RegExp]"],Q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,$=!this.i18nFormat||this.i18nFormat.handleAsObject,F=c.count!==void 0&&!ae(c.count),V=qu.hasDefaultValue(c),ue=F?this.pluralResolver.getSuffix(v,c.count,c):"",K=c.ordinal&&F?this.pluralResolver.getSuffix(v,c.count,{ordinal:!1}):"",te=F&&!c.ordinal&&c.count===0,le=te&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${ue}`]||c[`defaultValue${K}`]||c.defaultValue;let se=z;$&&!z&&V&&(se=le);const Ae=Co(se),We=Object.prototype.toString.apply(se);if($&&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:g}):`key '${p} (${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:g}):Me[M]=this.translate(Y,{...c,joinArrays:!1,ns:g}),Me[M]===Y&&(Me[M]=se[M])}z=Me}}else if($&&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=p);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,p,Y?le:z),h){const x=this.resolve(p,{...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 ge=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ge&&ge[0])for(let x=0;x<ge.length;x++)P.push(ge[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&&F?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],p+G,c[`defaultValue${G}`]||le)})}):Se(P,p,le))}z=this.extendTranslation(z,l,c,L,o),Me&&z===p&&this.options.appendNamespaceToMissingKey&&(z=`${m}${b}${p}`),(Me||ze)&&this.options.parseMissingKeyHandler&&(z=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}${b}${p}`:p,ze?z:void 0,c))}return f?(L.res=z,L.usedParams=this.getUsedParamsDetails(c),L):z}extendTranslation(l,r,o,c,f){var g,m;if((g=this.i18nFormat)!=null&&g.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,p=ae(h)?[h]:h;return l!=null&&(p!=null&&p.length)&&o.applyPostProcessor!==!1&&(l=Cp.handle(p,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,p;return ae(l)&&(l=[l]),Array.isArray(l)&&(l=l.map(g=>typeof g=="function"?tl(g,{...this.options,...r}):g)),l.forEach(g=>{if(this.isValidLookup(o))return;const m=this.extractFromKey(g,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)||(p=B,!jm[`${H[0]}-${B}`]&&((q=this.utils)!=null&&q.hasLoadedNamespace)&&!((Q=this.utils)!=null&&Q.hasLoadedNamespace(p))&&(jm[`${H[0]}-${B}`]=!0,this.logger.warn(`key "${c}" for languages "${H.join(", ")}" won't get resolved as namespace "${p}" 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($=>{var ue;if(this.isValidLookup(o))return;h=$;const F=[b];if((ue=this.i18nFormat)!=null&&ue.addLookupKeys)this.i18nFormat.addLookupKeys(F,b,$,B,r);else{let K;N&&(K=this.pluralResolver.getSuffix($,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&&F.push(b+K.replace(le,this.options.pluralSeparator)),F.push(b+K),L&&F.push(b+te)),z){const se=`${b}${this.options.contextSeparator||"_"}${r.context}`;F.push(se),N&&(r.ordinal&&K.indexOf(le)===0&&F.push(se+K.replace(le,this.options.pluralSeparator)),F.push(se+K),L&&F.push(se+te))}}let V;for(;V=F.pop();)this.isValidLookup(o)||(f=V,o=this.getResource($,B,V,r))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:p}}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 g=this.languageUtils.getLanguagePartFromCode(l);h=this.getRule(g,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:p,suffixEscaped:g,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=p?sn(p):g||"}}",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,p;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=z=>{if(z.indexOf(this.formatSeparator)<0){const Q=km(r,g,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,g,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(p=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,p++,p>=this.maxReplaces)break}}),l}nest(l,r,o={}){let c,f,h;const p=(g,m)=>{const b=this.nestingOptionsSeparator;if(g.indexOf(b)<0)return g;const v=g.split(new RegExp(`${sn(b)}[ ]*{`));let N=`{${v[1]}`;g=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 ${g}`,H),`${g}${b}${N}`}return h.defaultValue&&h.defaultValue.indexOf(this.prefix)>-1&&delete h.defaultValue,g};for(;c=this.nestingRegexp.exec(l);){let g=[];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&&(g=c[1].slice(m).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,m)),f=r(p.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=""),g.length&&(f=g.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[p,...g]=h.split(":"),m=g.join(":").trim().replace(/^'+|'+$/g,""),b=p.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 p=l[h];return p||(p=i(ui(o),c),l[h]=p),p(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 p=>h.format(p)}),currency:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f,style:"currency"});return p=>h.format(p)}),datetime:o((c,f)=>{const h=new Intl.DateTimeFormat(c,{...f});return p=>h.format(p)}),relativetime:o((c,f)=>{const h=new Intl.RelativeTimeFormat(c,{...f});return p=>h.format(p,f.range||"day")}),list:o((c,f)=>{const h=new Intl.ListFormat(c,{...f});return p=>h.format(p)})}}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(p=>p.indexOf(")")>-1)){const p=f.findIndex(g=>g.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,p)].join(this.formatSeparator)}return f.reduce((p,g)=>{var v;const{formatName:m,formatOptions:b}=Ib(g);if(this.formats[m]){let N=p;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](p,z,{...b,...c,...L})}catch(L){this.logger.warn(L)}return N}else this.logger.warn(`there was no format function for ${m}`);return p},l)}}const tS=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class aS extends Zu{constructor(l,r,o,c={}){var f,h;super(),this.backend=l,this.store=r,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=Ft.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],(h=(f=this.backend)==null?void 0:f.init)==null||h.call(f,o,c.backend,c)}queueLoad(l,r,o,c){const f={},h={},p={},g={};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),g[v]===void 0&&(g[v]=!0)))}),b||(p[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(p),toLoadNamespaces:Object.keys(g)}}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 p={};this.queue.forEach(g=>{Yb(g.loaded,[f],h),tS(g,l),r&&g.errors.push(r),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(m=>{p[m]||(p[m]={});const b=g.loaded[m];b.length&&b.forEach(v=>{p[m][v]===void 0&&(p[m][v]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",p),this.queue=this.queue.filter(g=>!g.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 p=(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)},g=this.backend[o].bind(this.backend);if(g.length===2){try{const m=g(l,r);m&&typeof m.then=="function"?m.then(b=>p(null,b)).catch(p):p(null,m)}catch(m){p(m)}return}return g(l,r,p)}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,p)=>{h&&this.logger.warn(`${r}loading namespace ${f} for language ${c} failed`,h),!h&&p&&this.logger.log(`${r}loaded namespace ${f} for language ${c}`,p),this.loaded(l,h,p)})}saveMissing(l,r,o,c,f,h={},p=()=>{}){var g,m,b,v,N;if((m=(g=this.services)==null?void 0:g.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=>p(null,B)).catch(p):p(null,H)}catch(H){p(H)}else z(l,r,o,c,p,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))})},Ap="__i18next_supportNoticeShown",lS=()=>!!(typeof globalThis<"u"&&globalThis[Ap]||typeof process<"u"&&_o&&_o.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&_o),iS=()=>{typeof globalThis<"u"&&(globalThis[Ap]=!0)},uS=i=>{var l,r,o,c,f,h,p,g,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||((p=(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:p.indexOf("Locize"))>0||(m=(g=i==null?void 0:i.options)==null?void 0:g.backend)!=null&&m.backends&&i.options.backend.backends.some(z=>{var H,B,q;return((H=z==null?void 0:z.name)==null?void 0:H.indexOf("Locize"))>0||((q=(B=z==null?void 0:z.constructor)==null?void 0:B.name)==null?void 0:q.indexOf("Locize"))>0})||(v=(b=i==null?void 0:i.options)==null?void 0:b.backend)!=null&&v.projectId||(L=(N=i==null?void 0:i.options)==null?void 0:N.backend)!=null&&L.backendOptions&&i.options.backend.backendOptions.some(z=>z==null?void 0:z.projectId))};class ai extends Zu{constructor(l={},r){if(super(),this.options=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 p=ei(),g=()=>{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),p.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?g():setTimeout(g,0),p}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 p=[],g=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(v=>{v!=="cimode"&&p.indexOf(v)<0&&p.push(v)})};c?g(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>g(b)),(h=(f=this.options.preload)==null?void 0:f.forEach)==null||h.call(f,m=>g(m)),this.services.backendConnector.load(p,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"&&Cp.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=p=>{this.language=p,this.languages=this.services.languageUtils.toResolveHierarchy(p),this.resolvedLanguage=void 0,this.setResolvedLanguage(p)},f=(p,g)=>{g?this.isLanguageChangingTo===l&&(c(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,o.resolve((...m)=>this.t(...m)),r&&r(p,(...m)=>this.t(...m))},h=p=>{var b,v;!l&&!p&&this.services.languageDetector&&(p=[]);const g=ae(p)?p:p&&p[0],m=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(ae(p)?[p]:p);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,...p)=>{let g;typeof h!="object"?g=this.options.overloadTranslationOptionHandler([f,h].concat(p)):g={...h},g.lng=g.lng||c.lng,g.lngs=g.lngs||c.lngs,g.ns=g.ns||c.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||o||c.keyPrefix);const m={...this.options,...g};typeof g.keyPrefix=="function"&&(g.keyPrefix=tl(g.keyPrefix,m));const b=this.options.keySeparator||".";let v;return g.keyPrefix&&Array.isArray(f)?v=f.map(N=>(typeof N=="function"&&(N=tl(N,m)),`${g.keyPrefix}${b}${N}`)):(typeof f=="function"&&(f=tl(f,m)),v=g.keyPrefix?`${g.keyPrefix}${b}${f}`:f),this.t(v,g)};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=(p,g)=>{const m=this.services.backendConnector.state[`${p}|${g}`];return m===-1||m===0||m===2};if(r.precheck){const p=r.precheck(this,h);if(p!==void 0)return p}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 p=h.getTextInfo();if(p&&p.direction)return p.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(p=>{f[p]=this[p]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const p=Object.keys(this.store.data).reduce((g,m)=>(g[m]={...this.store.data[m]},g[m]=Object.keys(g[m]).reduce((b,v)=>(b[v]={...g[m][v]},b),g[m]),g),{});f.store=new Mm(p,c),f.services.resourceStore=f.store}if(l.interpolation){const g={...Ao().interpolation,...this.options.interpolation,...l.interpolation},m={...c,interpolation:g};f.services.interpolator=new Hm(m)}return f.translator=new qu(f.services,c),f.translator.on("*",(p,...g)=>{f.emit(p,...g)}),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",zp={en:()=>Je(()=>import("./en-CmAr_0e6.js"),[],import.meta.url),zh:()=>Je(()=>import("./zh-CcJ9vBZj.js"),[],import.meta.url),"zh-TW":()=>Je(()=>import("./zh-TW-elI72AC1.js"),[],import.meta.url),ja:()=>Je(()=>import("./ja-DtvtBRTW.js"),[],import.meta.url),es:()=>Je(()=>import("./es-Cs9x52ca.js"),[],import.meta.url)},Du={};function Ym(i){return i in zp}function Np(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 Np(i||navigator.language||ni)}async function ko(i){if(Du[i])return;const l=await zp[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 wp(i){const l=Np(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 F;const{pathname:i}=zt(),{t:l,i18n:r}=Ep(),{theme:o,setTheme:c}=Wo(),f=Ot(V=>V.logout),h=Ot(V=>V.desktopManaged),p=Fo(),g=dn(),[m,b]=T.useState(!1),[v,N]=T.useState(!1),L=V=>{wp(V),N(!1)},z={light:Im,dark:Fm,system:Jm},H={light:"dark",dark:"system",system:"light"},B=z[o],q=$u.listNavItems().filter(V=>{var ue;return((ue=V.visible)==null?void 0:ue.call(V,{desktopManaged:h,features:p}))??!0}),Q=q.map(V=>{var te;const ue=V.icon,K=((te=V.resolveLabelKey)==null?void 0:te.call(V,{desktopManaged:h,features:p,runtimeProvider:g}))||V.labelKey;return{...V,Icon:ue,labelKey:K}}),$=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(Rp,{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:p,runtimeProvider:g}))||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.55"]}),_.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:((F=Gm.find(V=>V.code===r.language))==null?void 0:F.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})})]})]}),$?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"),s2=i=>Xe.post("/restart",i),o2=()=>Xe.post("/reload"),c2=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 Mp(...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 f2(...i){return T.useCallback(Mp(...i),i)}var mS=Symbol.for("react.lazy"),Yu=m0[" use ".trim().toString()];function pS(i){return typeof i=="object"&&i!==null&&"then"in i}function jp(i){return i!=null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===mS&&"_payload"in i&&pS(i._payload)}function gS(i){const l=vS(i),r=T.forwardRef((o,c)=>{let{children:f,...h}=o;jp(f)&&typeof Yu=="function"&&(f=Yu(f._payload));const p=T.Children.toArray(f),g=p.find(SS);if(g){const m=g.props.children,b=p.map(v=>v===g?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=gS("Slot");function vS(i){const l=T.forwardRef((r,o)=>{let{children:c,...f}=r;if(jp(c)&&typeof Yu=="function"&&(c=Yu(c._payload)),T.isValidElement(c)){const h=ES(c),p=xS(f,c.props);return c.type!==T.Fragment&&(p.ref=o?Mp(o,h):h),T.cloneElement(c,p)}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]=(...p)=>{const g=f(...p);return c(...p),g}: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:p="button",...g}){const m=l==="default"?"md":l,b=f?yS:"button";return _.jsxs(b,{...f?{}:{type:p},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,...g,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 d2({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 X(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 Lp(){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(()=>Lp(),1e3)}}function OS(){si.size===0&&_t&&(_t.close(),_t=null)}function Dp(i){return si.add(i),Lp(),()=>{si.delete(i),OS()}}async function h2(){return X("GET","/runtime")}async function m2(){return X("POST","/runtime/service/start")}async function p2(){return X("POST","/runtime/service/stop")}async function g2(){return X("POST","/runtime/service/restart")}async function y2(i){const l=typeof i=="number"?`?limit=${encodeURIComponent(String(i))}`:"";return X("GET",`/runtime/logs${l}`)}async function v2(){return X("GET","/runtime/agent-runtimes")}async function b2(){return X("POST","/runtimes/refresh")}async function S2(){return X("GET","/diagnostics/errors")}async function x2(){return X("POST","/diagnostics/doctor")}async function E2(){return X("POST","/diagnostics/deployment")}async function T2(){return X("GET","/runtime/runtime-config")}async function R2(i){return X("POST","/runtime/runtime-config",{config:i})}async function _2(i){return X("POST","/runtime/settings",i)}async function C2(){return X("GET","/providers")}async function O2(i){return X("POST","/providers",i)}async function A2(i,l){return X("PUT",`/providers/${encodeURIComponent(i)}`,l)}async function z2(i){return X("DELETE",`/providers/${encodeURIComponent(i)}`)}async function AS(i){return X("GET",`/platforms/${encodeURIComponent(i)}`)}function di(i){return i?`?instance_id=${encodeURIComponent(i)}`:""}async function zS(i,l,r){return X("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}${di(r)}`)}async function NS(i,l,r){return X("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/test${di(r)}`)}async function wS(i,l,r){return X("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/enable${di(r)}`)}async function MS(i,l,r){return X("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/disable${di(r)}`)}async function jS(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return X("GET",`/platforms/${encodeURIComponent(i)}/pairings${r}`)}async function LS(i,l){return X("POST",`/platforms/${encodeURIComponent(i)}/pairings/approve`,{code:l})}async function DS(i,l){return X("POST",`/platforms/${encodeURIComponent(i)}/pairings/reject`,{code:l})}async function US(i,l){const r=l?`?workspace_id=${encodeURIComponent(l)}`:"";return X("GET",`/platforms/${encodeURIComponent(i)}/users${r}`)}async function Up(i,l,r){return X("POST",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode${di(r)}`)}async function kp(i,l,r,o){const c=`?ticket=${encodeURIComponent(r)}${o?`&instance_id=${encodeURIComponent(o)}`:""}`;return X("GET",`/platforms/${encodeURIComponent(i)}/${encodeURIComponent(l)}/qrcode/status${c}`)}async function N2(){return AS("lark")}async function w2(i,l){return zS("lark",i,l)}async function M2(i,l){return NS("lark",i,l)}async function j2(i,l){return wS("lark",i,l)}async function L2(i,l){return MS("lark",i,l)}async function D2(i){return jS("lark",i)}async function U2(i){return LS("lark",i)}async function k2(i){return DS("lark",i)}async function H2(i){return US("lark",i)}async function B2(i,l){return Up("lark",i,l)}async function q2(i,l,r){return kp("lark",i,l,r)}async function Y2(i,l){return Up("weixin",i,l)}async function G2(i,l,r){return kp("weixin",i,l,r)}async function V2(){return X("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 X("GET",`/tasks${r}`)}async function Q2(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 X("GET",`/approvals${r}`)}async function X2(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 X("GET",`/audit-events${r}`)}async function $2(i){return X("GET","/scheduler/jobs")}async function Z2(i){return X("POST","/scheduler/jobs",i)}async function J2(i,l){return X("PATCH",`/scheduler/jobs/${encodeURIComponent(i)}`,l)}async function F2(i){return X("DELETE",`/scheduler/jobs/${encodeURIComponent(i)}`)}async function W2(i){return X("POST",`/scheduler/jobs/${encodeURIComponent(i)}/run`)}async function I2(i){return X("GET","/automation/monitors")}async function P2(i){return X("POST","/automation/monitors",i)}async function ex(i,l){return X("PATCH",`/automation/monitors/${encodeURIComponent(i)}`,l)}async function tx(i){return X("DELETE",`/automation/monitors/${encodeURIComponent(i)}`)}async function ax(i){return X("POST",`/automation/monitors/${encodeURIComponent(i)}/run`)}async function nx(i){return X("GET",`/threads?workspace_id=${encodeURIComponent(i)}`)}async function lx(i,l){return X("POST","/threads",{workspaceId:i,title:l})}async function ix(i){return X("GET",`/threads/${encodeURIComponent(i)}`)}async function ux(i,l){return X("PATCH",`/threads/${encodeURIComponent(i)}`,{title:l})}async function rx(i,l){return X("PATCH",`/threads/${encodeURIComponent(i)}/knowledge-bases`,{knowledgeBaseIds:l})}async function sx(i,l){return X("PATCH",`/threads/${encodeURIComponent(i)}/mode`,{mode:l})}async function ox(i){return X("DELETE",`/threads/${encodeURIComponent(i)}`)}async function cx(i,l){return X("POST",`/threads/${encodeURIComponent(i)}/messages`,{content:l})}async function fx(i,l){return X("POST",`/threads/${encodeURIComponent(i)}/actions`,{content:l})}async function dx(i){return X("POST",`/runs/${encodeURIComponent(i)}/interrupt`)}async function hx(){return X("GET","/knowledge/config")}async function mx(){return X("GET","/knowledge/folders")}async function px(i){return X("POST","/knowledge/folders",i)}async function gx(i,l){return X("PATCH",`/knowledge/folders/${encodeURIComponent(i)}`,l)}async function yx(i){return X("DELETE",`/knowledge/folders/${encodeURIComponent(i)}`)}async function vx(){return X("GET","/knowledge/bases")}async function bx(i){return X("POST","/knowledge/bases",i)}async function Sx(i){return X("GET",`/knowledge/bases/${encodeURIComponent(i)}`)}async function xx(i,l){return X("PATCH",`/knowledge/bases/${encodeURIComponent(i)}`,l)}async function Ex(i){return X("DELETE",`/knowledge/bases/${encodeURIComponent(i)}`)}async function Tx(i){return X("GET",`/knowledge/bases/${encodeURIComponent(i)}/files`)}async function Rx(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 _x(i,l){return X("DELETE",`/knowledge/bases/${encodeURIComponent(i)}/files/${encodeURIComponent(l)}`)}async function Cx(i,l){return X("POST",`/knowledge/bases/${encodeURIComponent(i)}/search`,l)}async function Ox(){return X("GET","/capabilities/snapshot")}async function Ax(){return X("GET","/plugins/diagnostics")}async function zx(i){return X("POST",`/workspaces/${encodeURIComponent(i)}/streaming-probe`)}function Nx(i){return Dp(l=>{l.type==="runtime.updated"&&i(l.runtime)})}function wx(i){return Dp(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}=Ep(),r=Qu(),o=Ot(F=>F.login),{theme:c,setTheme:f}=Wo(),[h,p]=T.useState(""),[g,m]=T.useState(""),[b,v]=T.useState(""),[N,L]=T.useState(!1),z=cb(),H=fb(),B=async F=>{if(F.preventDefault(),!(!h.trim()||H)){L(!0),v("");try{g.trim()&&Xe.setBaseUrl(g.trim()),Xe.setToken(h.trim()),await dS(),o(h.trim(),g.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"},$=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(F=>_.jsx("button",{onClick:()=>void wp(F.code),className:He("px-2.5 py-1.5 text-xs font-medium transition-colors",l.language===F.code?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-accent/10 hover:text-foreground"),children:F.label},F.code))}),_.jsx(Gu,{variant:"outline",size:"icon",onClick:()=>f(Q[c]),"aria-label":i(`theme.${c}`),children:_.jsx($,{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(Rp,{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:F=>p(F.target.value),placeholder:"mgmt-secret-xxx",autoFocus:!0}),_.jsx(Km,{label:`${i("login.serverUrl")} (${i("common.optional")})`,type:"text",value:g,onChange:F=>m(F.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:[$u.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 Hp(){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(()=>Hp(),1e3)})}function $S(){oi.size===0&&Kt&&(Kt.close(),Kt=null)}async function ZS(){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),Hp(),()=>{oi.delete(i),$S()})}const Xm=20,IS=500;function PS(i){return new Promise(l=>window.setTimeout(l,i))}function e2(){const i=window.navigator.userAgent.toLowerCase().includes("windows")?"windows":window.navigator.userAgent.toLowerCase().includes("mac os x")?"macos":window.navigator.userAgent.toLowerCase().includes("linux")?"linux":"unknown";document.documentElement.classList.add(`platform-${i}`)}function t2(){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 a2({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 n2(){const[i,l]=T.useState({status:"loading"}),[r,o]=T.useState(!1),c=T.useCallback(async()=>{l({status:"loading"});const h=!!await ZS();if(o(h),h)try{let p=null;for(let g=0;g<Xm;g+=1)try{await JS(),p=null;break}catch(m){p=m,g<Xm-1&&await PS(IS)}if(p)throw p;Ro(await Qm()),Xe.setBaseUrl(cn),Xe.setToken(""),Ot.getState().setManagedSession("",cn,dn()==="local_core"?"local_core":"electron")}catch(p){let g=[];try{g=await FS(80)}catch{g=[]}l({status:"error",message:p instanceof Error?p.message:String(p),logs:g});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(t2,{}):i.status==="error"?_.jsx(a2,{message:i.message,logs:i.logs,onRetry:()=>void c()}):_.jsx(j1,{children:_.jsx(YS,{})})}async function l2(){e2(),await sS(),Ot.getState().init(),Wo.getState().init(),sv.createRoot(document.getElementById("root")).render(_.jsx(GS,{children:_.jsx(n2,{})}))}l2();export{S0 as $,el as A,Gu as B,hS as C,Xe as D,fp as E,N0 as F,r2 as G,A0 as H,Km as I,$m as J,$2 as K,yp as L,q0 as M,J2 as N,Z2 as O,F2 as P,W2 as Q,Wm as R,$0 as S,d2 as T,I2 as U,ex as V,I0 as W,P2 as X,tx as Y,ev as Z,ax as _,Fo as a,Sx as a$,F0 as a0,s2 as a1,o2 as a2,wx as a3,H2 as a4,k2 as a5,U2 as a6,D2 as a7,L2 as a8,j2 as a9,C2 as aA,b2 as aB,v2 as aC,Nx as aD,zx as aE,_2 as aF,R2 as aG,T2 as aH,y2 as aI,g2 as aJ,p2 as aK,m2 as aL,h2 as aM,c2 as aN,f2 as aO,hx as aP,mx as aQ,px as aR,bx as aS,gx as aT,yx as aU,xx as aV,Ex as aW,U0 as aX,lv as aY,m0 as aZ,Mp as a_,M2 as aa,w2 as ab,N2 as ac,q2 as ad,B2 as ae,G2 as af,Y2 as ag,kp as ah,Up as ai,US as aj,DS as ak,LS as al,jS as am,MS as an,wS as ao,NS as ap,zS as aq,AS as ar,E2 as as,x2 as at,S2 as au,Ax as av,Ox as aw,z2 as ax,A2 as ay,O2 as az,K2 as b,Tx as b0,Rx as b1,_x as b2,Cx as b3,$e as c,Q2 as d,X2 as e,C0 as f,He as g,R0 as h,dn as i,_ as j,nx as k,V2 as l,ix as m,lx as n,sx as o,rx as p,fx as q,T as r,Dp as s,cx as t,Ep as u,dx as v,ux as w,ox as x,u2 as y,vx as z};
|