@kafca/agentdock 0.1.57 → 0.1.61
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/dist/renderer/assets/{Badge-CDTbmw1h.js → Badge-BLI4LHse.js} +1 -1
- package/dist/renderer/assets/{Card-DayUo35w.js → Card-DJeLDdL3.js} +1 -1
- package/dist/renderer/assets/{Config-ByGMQuzR.js → Config-D1awc81A.js} +1 -1
- package/dist/renderer/assets/{CronList-XqHdVlgu.js → CronList-CupZoNwW.js} +1 -1
- package/dist/renderer/assets/{Dashboard-CZj-oANw.js → Dashboard-nLZnOtcs.js} +2 -2
- package/dist/renderer/assets/{EmptyState-EFMkOjZO.js → EmptyState-CkI1RwPX.js} +1 -1
- package/dist/renderer/assets/{HighlightedMarkdown-DyvF3DHK.js → HighlightedMarkdown-BUhDlhgW.js} +1 -1
- package/dist/renderer/assets/{Input-DxoWVc9d.js → Input-DHYrn-Ne.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-CbUb2tG7.js → KnowledgeDetail-Bij-Xo90.js} +1 -1
- package/dist/renderer/assets/{KnowledgeHome-BWV1gz4f.js → KnowledgeHome-DmPZ2IlI.js} +1 -1
- package/dist/renderer/assets/{Logs-DqnanQTc.js → Logs-ISY99heA.js} +1 -1
- package/dist/renderer/assets/{Modal-yY7TzR0x.js → Modal-DAQfz0ot.js} +1 -1
- package/dist/renderer/assets/{MonitorList-CIjGQkFs.js → MonitorList-BlX82rXF.js} +1 -1
- package/dist/renderer/assets/{Page-vwHNUdoj.js → Page-Dw43UYDT.js} +1 -1
- package/dist/renderer/assets/{Select-CmbK36pN.js → Select-DzmN5OGQ.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-4OceMgM4.js → ThreadChat-B5CWqqMK.js} +3 -3
- package/dist/renderer/assets/{Workspace-DplPJOjJ.js → Workspace-C5g9LBj9.js} +1 -1
- package/dist/renderer/assets/{arrow-left-C8HfBt2K.js → arrow-left-BLXh56Ip.js} +1 -1
- package/dist/renderer/assets/{book-open-BCdZWncQ.js → book-open-DhPGbc-7.js} +1 -1
- package/dist/renderer/assets/{channels-hgO3cAIx.js → channels-DfQrmuYO.js} +1 -1
- package/dist/renderer/assets/{chevron-down-BPk77tqY.js → chevron-down-CEFtpPDc.js} +1 -1
- package/dist/renderer/assets/{index-BlA4xPdd.js → index-CYhDUAR_.js} +1 -1
- package/dist/renderer/assets/{index-wYpjqVqC.js → index-Dd00oqgY.js} +2 -2
- package/dist/renderer/assets/{knowledge-7pl06KuH.js → knowledge-uHRQ80sR.js} +1 -1
- package/dist/renderer/assets/{pencil-CB1SWZ9A.js → pencil-BD2Y31YC.js} +1 -1
- package/dist/renderer/assets/{play-BvsoXUrM.js → play-DBJ8wsSy.js} +1 -1
- package/dist/renderer/assets/{plus-CokBDnaL.js → plus-DDcldp_c.js} +1 -1
- package/dist/renderer/assets/{save-D-w4kATO.js → save-CMW_cZI9.js} +1 -1
- package/dist/renderer/assets/{search-Cnsn6i4Q.js → search-BM-0CvJr.js} +1 -1
- package/dist/renderer/assets/{shield-check-Cjja2Gh6.js → shield-check-DaMB0FKG.js} +1 -1
- package/dist/renderer/assets/{threads-BCm6j4eI.js → threads-DZgt9tWj.js} +1 -1
- package/dist/renderer/assets/{trash-2-CIxz9qYY.js → trash-2-DTXVbC5y.js} +1 -1
- package/dist/renderer/index.html +1 -1
- package/dist-electron/services/local-ai-core/src/automation/automation-conversation-executor.js +6 -47
- package/dist-electron/services/local-ai-core/src/automation/automation-monitor-service.js +2 -5
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +6 -53
- package/dist-electron/services/local-ai-core/src/channel/lark/outbound-transport.js +25 -37
- package/dist-electron/services/local-ai-core/src/channel/lark/runtime-state.js +5 -20
- package/dist-electron/services/local-ai-core/src/channel/shared/base-channel-gateway.js +37 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/bridge-event-helpers.js +23 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/channel-keys.js +6 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-poller.js +2 -2
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +6 -44
- package/dist-electron/services/local-ai-core/src/channel/weixin/runtime-state.js +4 -11
- package/dist-electron/services/local-ai-core/src/channel/weixin/text-utils.js +0 -8
- package/dist-electron/services/local-ai-core/src/cli/lac.js +3 -5
- package/dist-electron/services/local-ai-core/src/kernel/local-core-errors.js +8 -0
- package/dist-electron/services/local-ai-core/src/sandbox/opensandbox-client.js +3 -2
- package/dist-electron/services/local-ai-core/src/scheduler/base-channel-schedule-adapter.js +77 -0
- package/dist-electron/services/local-ai-core/src/scheduler/lark-schedule-adapter.js +13 -79
- package/dist-electron/services/local-ai-core/src/scheduler/local-schedule-adapter.js +2 -10
- package/dist-electron/services/local-ai-core/src/scheduler/run-polling.js +19 -0
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-conversation-executor.js +3 -37
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-job-route.js +20 -0
- package/dist-electron/services/local-ai-core/src/scheduler/scheduler-service.js +15 -28
- package/dist-electron/services/local-ai-core/src/scheduler/thread-resolution.js +12 -0
- package/dist-electron/services/local-ai-core/src/scheduler/weixin-schedule-adapter.js +13 -79
- package/dist-electron/tests/integration/local-core-refactor.test.js +15 -8
- package/package.json +2 -4
- package/dist-electron/services/local-ai-core/src/scheduler/lark-execution-policies.js +0 -13
- package/dist-electron/services/local-ai-core/src/scheduler/weixin-execution-policies.js +0 -13
|
@@ -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-nLZnOtcs.js","./Card-DJeLDdL3.js","./Badge-BLI4LHse.js","./EmptyState-CkI1RwPX.js","./Page-Dw43UYDT.js","./threads-DZgt9tWj.js","./book-open-DhPGbc-7.js","./shield-check-DaMB0FKG.js","./ThreadChat-B5CWqqMK.js","./channels-DfQrmuYO.js","./chevron-down-CEFtpPDc.js","./Input-DHYrn-Ne.js","./Modal-DAQfz0ot.js","./index-CYhDUAR_.js","./search-BM-0CvJr.js","./pencil-BD2Y31YC.js","./trash-2-DTXVbC5y.js","./knowledge-uHRQ80sR.js","./Workspace-C5g9LBj9.js","./Select-DzmN5OGQ.js","./plus-DDcldp_c.js","./save-CMW_cZI9.js","./CronList-CupZoNwW.js","./play-DBJ8wsSy.js","./MonitorList-BlX82rXF.js","./Config-D1awc81A.js","./Logs-ISY99heA.js","./arrow-left-BLXh56Ip.js","./KnowledgeHome-DmPZ2IlI.js","./KnowledgeDetail-Bij-Xo90.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var F0=Object.defineProperty;var W0=(l,i,s)=>i in l?F0(l,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):l[i]=s;var Ru=(l,i,s)=>W0(l,typeof i!="symbol"?i+"":i,s);function I0(l,i){for(var s=0;s<i.length;s++){const o=i[s];if(typeof o!="string"&&!Array.isArray(o)){for(const c in o)if(c!=="default"&&!(c in l)){const f=Object.getOwnPropertyDescriptor(o,c);f&&Object.defineProperty(l,c,f.get?f:{enumerable:!0,get:()=>o[c]})}}}return Object.freeze(Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}))}(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.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 s(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=s(c);fetch(c.href,f)}})();function Ym(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var uo={exports:{}},Jl={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -163,5 +163,5 @@ Error generating stack: `+n.message+`
|
|
|
163
163
|
* @license MIT
|
|
164
164
|
*/var am="popstate";function nm(l){return typeof l=="object"&&l!=null&&"pathname"in l&&"search"in l&&"hash"in l&&"state"in l&&"key"in l}function Jy(l={}){function i(c,f){let{pathname:h="/",search:g="",hash:y=""}=sn(c.location.hash.substring(1));return!h.startsWith("/")&&!h.startsWith(".")&&(h="/"+h),So("",{pathname:h,search:g,hash:y},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function s(c,f){let h=c.document.querySelector("base"),g="";if(h&&h.getAttribute("href")){let y=c.location.href,m=y.indexOf("#");g=m===-1?y:y.slice(0,m)}return g+"#"+(typeof f=="string"?f:ai(f))}function o(c,f){At(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(f)})`)}return Fy(i,s,o,l)}function je(l,i){if(l===!1||l===null||typeof l>"u")throw new Error(i)}function At(l,i){if(!l){typeof console<"u"&&console.warn(i);try{throw new Error(i)}catch{}}}function $y(){return Math.random().toString(36).substring(2,10)}function lm(l,i){return{usr:l.state,key:l.key,idx:i,masked:l.unstable_mask?{pathname:l.pathname,search:l.search,hash:l.hash}:void 0}}function So(l,i,s=null,o,c){return{pathname:typeof l=="string"?l:l.pathname,search:"",hash:"",...typeof i=="string"?sn(i):i,state:s,key:i&&i.key||o||$y(),unstable_mask:c}}function ai({pathname:l="/",search:i="",hash:s=""}){return i&&i!=="?"&&(l+=i.charAt(0)==="?"?i:"?"+i),s&&s!=="#"&&(l+=s.charAt(0)==="#"?s:"#"+s),l}function sn(l){let i={};if(l){let s=l.indexOf("#");s>=0&&(i.hash=l.substring(s),l=l.substring(0,s));let o=l.indexOf("?");o>=0&&(i.search=l.substring(o),l=l.substring(0,o)),l&&(i.pathname=l)}return i}function Fy(l,i,s,o={}){let{window:c=document.defaultView,v5Compat:f=!1}=o,h=c.history,g="POP",y=null,m=b();m==null&&(m=0,h.replaceState({...h.state,idx:m},""));function b(){return(h.state||{idx:null}).idx}function v(){g="POP";let k=b(),Y=k==null?null:k-m;m=k,y&&y({action:g,location:H.location,delta:Y})}function O(k,Y){g="PUSH";let q=nm(k)?k:So(H.location,k,Y);s&&s(q,k),m=b()+1;let K=lm(q,m),$=H.createHref(q.unstable_mask||q);try{h.pushState(K,"",$)}catch(ee){if(ee instanceof DOMException&&ee.name==="DataCloneError")throw ee;c.location.assign($)}f&&y&&y({action:g,location:H.location,delta:1})}function N(k,Y){g="REPLACE";let q=nm(k)?k:So(H.location,k,Y);s&&s(q,k),m=b();let K=lm(q,m),$=H.createHref(q.unstable_mask||q);h.replaceState(K,"",$),f&&y&&y({action:g,location:H.location,delta:0})}function A(k){return Wy(k)}let H={get action(){return g},get location(){return l(c,h)},listen(k){if(y)throw new Error("A history only accepts one active listener");return c.addEventListener(am,v),y=k,()=>{c.removeEventListener(am,v),y=null}},createHref(k){return i(c,k)},createURL:A,encodeLocation(k){let Y=A(k);return{pathname:Y.pathname,search:Y.search,hash:Y.hash}},push:O,replace:N,go(k){return h.go(k)}};return H}function Wy(l,i=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),je(s,"No window.location.(origin|href) available to create URL");let o=typeof l=="string"?l:ai(l);return o=o.replace(/ $/,"%20"),!i&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function Gm(l,i,s="/"){return Iy(l,i,s,!1)}function Iy(l,i,s,o){let c=typeof i=="string"?sn(i):i,f=ha(c.pathname||"/",s);if(f==null)return null;let h=Km(l);Py(h);let g=null;for(let y=0;g==null&&y<h.length;++y){let m=cv(f);g=sv(h[y],m,o)}return g}function Km(l,i=[],s=[],o="",c=!1){let f=(h,g,y=c,m)=>{let b={relativePath:m===void 0?h.path||"":m,caseSensitive:h.caseSensitive===!0,childrenIndex:g,route:h};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(o)&&y)return;je(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=Gt([o,b.relativePath]),O=s.concat(b);h.children&&h.children.length>0&&(je(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Km(h.children,i,O,v,y)),!(h.path==null&&!h.index)&&i.push({path:v,score:uv(v,h.index),routesMeta:O})};return l.forEach((h,g)=>{var y;if(h.path===""||!((y=h.path)!=null&&y.includes("?")))f(h,g);else for(let m of Xm(h.path))f(h,g,!0,m)}),i}function Xm(l){let i=l.split("/");if(i.length===0)return[];let[s,...o]=i,c=s.endsWith("?"),f=s.replace(/\?$/,"");if(o.length===0)return c?[f,""]:[f];let h=Xm(o.join("/")),g=[];return g.push(...h.map(y=>y===""?f:[f,y].join("/"))),c&&g.push(...h),g.map(y=>l.startsWith("/")&&y===""?"/":y)}function Py(l){l.sort((i,s)=>i.score!==s.score?s.score-i.score:rv(i.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var ev=/^:[\w-]+$/,tv=3,av=2,nv=1,lv=10,iv=-2,im=l=>l==="*";function uv(l,i){let s=l.split("/"),o=s.length;return s.some(im)&&(o+=iv),i&&(o+=av),s.filter(c=>!im(c)).reduce((c,f)=>c+(ev.test(f)?tv:f===""?nv:lv),o)}function rv(l,i){return l.length===i.length&&l.slice(0,-1).every((o,c)=>o===i[c])?l[l.length-1]-i[i.length-1]:0}function sv(l,i,s=!1){let{routesMeta:o}=l,c={},f="/",h=[];for(let g=0;g<o.length;++g){let y=o[g],m=g===o.length-1,b=f==="/"?i:i.slice(f.length)||"/",v=Mu({path:y.relativePath,caseSensitive:y.caseSensitive,end:m},b),O=y.route;if(!v&&m&&s&&!o[o.length-1].route.index&&(v=Mu({path:y.relativePath,caseSensitive:y.caseSensitive,end:!1},b)),!v)return null;Object.assign(c,v.params),h.push({params:c,pathname:Gt([f,v.pathname]),pathnameBase:mv(Gt([f,v.pathnameBase])),route:O}),v.pathnameBase!=="/"&&(f=Gt([f,v.pathnameBase]))}return h}function Mu(l,i){typeof l=="string"&&(l={path:l,caseSensitive:!1,end:!0});let[s,o]=ov(l.path,l.caseSensitive,l.end),c=i.match(s);if(!c)return null;let f=c[0],h=f.replace(/(.)\/+$/,"$1"),g=c.slice(1);return{params:o.reduce((m,{paramName:b,isOptional:v},O)=>{if(b==="*"){let A=g[O]||"";h=f.slice(0,f.length-A.length).replace(/(.)\/+$/,"$1")}const N=g[O];return v&&!N?m[b]=void 0:m[b]=(N||"").replace(/%2F/g,"/"),m},{}),pathname:f,pathnameBase:h,pattern:l}}function ov(l,i=!1,s=!0){At(l==="*"||!l.endsWith("*")||l.endsWith("/*"),`Route path "${l}" will be treated as if it were "${l.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${l.replace(/\*$/,"/*")}".`);let o=[],c="^"+l.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,g,y,m,b)=>{if(o.push({paramName:g,isOptional:y!=null}),y){let v=b.charAt(m+h.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return l.endsWith("*")?(o.push({paramName:"*"}),c+=l==="*"||l==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?c+="\\/*$":l!==""&&l!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,i?void 0:"i"),o]}function cv(l){try{return l.split("/").map(i=>decodeURIComponent(i).replace(/\//g,"%2F")).join("/")}catch(i){return At(!1,`The URL path "${l}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${i}).`),l}}function ha(l,i){if(i==="/")return l;if(!l.toLowerCase().startsWith(i.toLowerCase()))return null;let s=i.endsWith("/")?i.length-1:i.length,o=l.charAt(s);return o&&o!=="/"?null:l.slice(s)||"/"}var fv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function dv(l,i="/"){let{pathname:s,search:o="",hash:c=""}=typeof l=="string"?sn(l):l,f;return s?(s=Qm(s),s.startsWith("/")?f=um(s.substring(1),"/"):f=um(s,i)):f=i,{pathname:f,search:gv(o),hash:pv(c)}}function um(l,i){let s=Du(i).split("/");return l.split("/").forEach(c=>{c===".."?s.length>1&&s.pop():c!=="."&&s.push(c)}),s.length>1?s.join("/"):"/"}function ho(l,i,s,o){return`Cannot include a '${l}' character in a manually specified \`to.${i}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function hv(l){return l.filter((i,s)=>s===0||i.route.path&&i.route.path.length>0)}function Do(l){let i=hv(l);return i.map((s,o)=>o===i.length-1?s.pathname:s.pathnameBase)}function Hu(l,i,s,o=!1){let c;typeof l=="string"?c=sn(l):(c={...l},je(!c.pathname||!c.pathname.includes("?"),ho("?","pathname","search",c)),je(!c.pathname||!c.pathname.includes("#"),ho("#","pathname","hash",c)),je(!c.search||!c.search.includes("#"),ho("#","search","hash",c)));let f=l===""||c.pathname==="",h=f?"/":c.pathname,g;if(h==null)g=s;else{let v=i.length-1;if(!o&&h.startsWith("..")){let O=h.split("/");for(;O[0]==="..";)O.shift(),v-=1;c.pathname=O.join("/")}g=v>=0?i[v]:"/"}let y=dv(c,g),m=h&&h!=="/"&&h.endsWith("/"),b=(f||h===".")&&s.endsWith("/");return!y.pathname.endsWith("/")&&(m||b)&&(y.pathname+="/"),y}var Qm=l=>l.replace(/\/\/+/g,"/"),Gt=l=>Qm(l.join("/")),Du=l=>l.replace(/\/+$/,""),mv=l=>Du(l).replace(/^\/*/,"/"),gv=l=>!l||l==="?"?"":l.startsWith("?")?l:"?"+l,pv=l=>!l||l==="#"?"":l.startsWith("#")?l:"#"+l,yv=class{constructor(l,i,s,o=!1){this.status=l,this.statusText=i||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function vv(l){return l!=null&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.internal=="boolean"&&"data"in l}function bv(l){let i=l.map(s=>s.route.path).filter(Boolean);return Gt(i)||"/"}var Zm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Jm(l,i){let s=l;if(typeof s!="string"||!fv.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,c=!1;if(Zm)try{let f=new URL(window.location.href),h=s.startsWith("//")?new URL(f.protocol+s):new URL(s),g=ha(h.pathname,i);h.origin===f.origin&&g!=null?s=g+h.search+h.hash:c=!0}catch{At(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var $m=["POST","PUT","PATCH","DELETE"];new Set($m);var Sv=["GET",...$m];new Set(Sv);var In=T.createContext(null);In.displayName="DataRouter";var Bu=T.createContext(null);Bu.displayName="DataRouterState";var Fm=T.createContext(!1);function xv(){return T.useContext(Fm)}var Wm=T.createContext({isTransitioning:!1});Wm.displayName="ViewTransition";var Ev=T.createContext(new Map);Ev.displayName="Fetchers";var Tv=T.createContext(null);Tv.displayName="Await";var _t=T.createContext(null);_t.displayName="Navigation";var li=T.createContext(null);li.displayName="Location";var kt=T.createContext({outlet:null,matches:[],isDataRoute:!1});kt.displayName="Route";var Lo=T.createContext(null);Lo.displayName="RouteError";var Im="REACT_ROUTER_ERROR",Rv="REDIRECT",Ov="ROUTE_ERROR_RESPONSE";function Av(l){if(l.startsWith(`${Im}:${Rv}:{`))try{let i=JSON.parse(l.slice(28));if(typeof i=="object"&&i&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.location=="string"&&typeof i.reloadDocument=="boolean"&&typeof i.replace=="boolean")return i}catch{}}function _v(l){if(l.startsWith(`${Im}:${Ov}:{`))try{let i=JSON.parse(l.slice(40));if(typeof i=="object"&&i&&typeof i.status=="number"&&typeof i.statusText=="string")return new yv(i.status,i.statusText,i.data)}catch{}}function Cv(l,{relative:i}={}){je(Pn(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=T.useContext(_t),{hash:c,pathname:f,search:h}=ii(l,{relative:i}),g=f;return s!=="/"&&(g=f==="/"?s:Gt([s,f])),o.createHref({pathname:g,search:h,hash:c})}function Pn(){return T.useContext(li)!=null}function Ct(){return je(Pn(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(li).location}var Pm="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function eg(l){T.useContext(_t).static||T.useLayoutEffect(l)}function jo(){let{isDataRoute:l}=T.useContext(kt);return l?Gv():zv()}function zv(){je(Pn(),"useNavigate() may be used only in the context of a <Router> component.");let l=T.useContext(In),{basename:i,navigator:s}=T.useContext(_t),{matches:o}=T.useContext(kt),{pathname:c}=Ct(),f=JSON.stringify(Do(o)),h=T.useRef(!1);return eg(()=>{h.current=!0}),T.useCallback((y,m={})=>{if(At(h.current,Pm),!h.current)return;if(typeof y=="number"){s.go(y);return}let b=Hu(y,JSON.parse(f),c,m.relative==="path");l==null&&i!=="/"&&(b.pathname=b.pathname==="/"?i:Gt([i,b.pathname])),(m.replace?s.replace:s.push)(b,m.state,m)},[i,s,f,c,l])}var Nv=T.createContext(null);function Mv(l){let i=T.useContext(kt).outlet;return T.useMemo(()=>i&&T.createElement(Nv.Provider,{value:l},i),[i,l])}function tg(){let{matches:l}=T.useContext(kt),i=l[l.length-1];return(i==null?void 0:i.params)??{}}function ii(l,{relative:i}={}){let{matches:s}=T.useContext(kt),{pathname:o}=Ct(),c=JSON.stringify(Do(s));return T.useMemo(()=>Hu(l,JSON.parse(c),o,i==="path"),[l,c,o,i])}function Dv(l,i){return ag(l,i)}function ag(l,i,s){var k;je(Pn(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=T.useContext(_t),{matches:c}=T.useContext(kt),f=c[c.length-1],h=f?f.params:{},g=f?f.pathname:"/",y=f?f.pathnameBase:"/",m=f&&f.route;{let Y=m&&m.path||"";lg(g,!m||Y.endsWith("*")||Y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${g}" (under <Route path="${Y}">) 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.
|
|
165
165
|
|
|
166
|
-
Please change the parent <Route path="${Y}"> to <Route path="${Y==="/"?"*":`${Y}/*`}">.`)}let b=Ct(),v;if(i){let Y=typeof i=="string"?sn(i):i;je(y==="/"||((k=Y.pathname)==null?void 0:k.startsWith(y)),`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 "${y}" but pathname "${Y.pathname}" was given in the \`location\` prop.`),v=Y}else v=b;let O=v.pathname||"/",N=O;if(y!=="/"){let Y=y.replace(/^\//,"").split("/");N="/"+O.replace(/^\//,"").split("/").slice(Y.length).join("/")}let A=Gm(l,{pathname:N});At(m||A!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),At(A==null||A[A.length-1].route.element!==void 0||A[A.length-1].route.Component!==void 0||A[A.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=Hv(A&&A.map(Y=>Object.assign({},Y,{params:Object.assign({},h,Y.params),pathname:Gt([y,o.encodeLocation?o.encodeLocation(Y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:Y.pathname]),pathnameBase:Y.pathnameBase==="/"?y:Gt([y,o.encodeLocation?o.encodeLocation(Y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:Y.pathnameBase])})),c,s);return i&&H?T.createElement(li.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},H):H}function Lv(){let l=Vv(),i=vv(l)?`${l.status} ${l.statusText}`:l instanceof Error?l.message:JSON.stringify(l),s=l instanceof Error?l.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:",l),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"}},i),s?T.createElement("pre",{style:c},s):null,h)}var jv=T.createElement(Lv,null),ng=class extends T.Component{constructor(l){super(l),this.state={location:l.location,revalidation:l.revalidation,error:l.error}}static getDerivedStateFromError(l){return{error:l}}static getDerivedStateFromProps(l,i){return i.location!==l.location||i.revalidation!=="idle"&&l.revalidation==="idle"?{error:l.error,location:l.location,revalidation:l.revalidation}:{error:l.error!==void 0?l.error:i.error,location:i.location,revalidation:l.revalidation||i.revalidation}}componentDidCatch(l,i){this.props.onError?this.props.onError(l,i):console.error("React Router caught the following error during render",l)}render(){let l=this.state.error;if(this.context&&typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){const s=_v(l.digest);s&&(l=s)}let i=l!==void 0?T.createElement(kt.Provider,{value:this.props.routeContext},T.createElement(Lo.Provider,{value:l,children:this.props.component})):this.props.children;return this.context?T.createElement(wv,{error:l},i):i}};ng.contextType=Fm;var mo=new WeakMap;function wv({children:l,error:i}){let{basename:s}=T.useContext(_t);if(typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){let o=Av(i.digest);if(o){let c=mo.get(i);if(c)throw c;let f=Jm(o.location,s);if(Zm&&!mo.get(i))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 mo.set(i,h),h}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return l}function Uv({routeContext:l,match:i,children:s}){let o=T.useContext(In);return o&&o.static&&o.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=i.route.id),T.createElement(kt.Provider,{value:l},s)}function Hv(l,i=[],s){let o=s==null?void 0:s.state;if(l==null){if(!o)return null;if(o.errors)l=o.matches;else if(i.length===0&&!o.initialized&&o.matches.length>0)l=o.matches;else return null}let c=l,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);je(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),c=c.slice(0,Math.min(c.length,b+1))}let h=!1,g=-1;if(s&&o){h=o.renderFallback;for(let b=0;b<c.length;b++){let v=c[b];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=b),v.route.id){let{loaderData:O,errors:N}=o,A=v.route.loader&&!O.hasOwnProperty(v.route.id)&&(!N||N[v.route.id]===void 0);if(v.route.lazy||A){s.isStatic&&(h=!0),g>=0?c=c.slice(0,g+1):c=[c[0]];break}}}}let y=s==null?void 0:s.onError,m=o&&y?(b,v)=>{var O,N;y(b,{location:o.location,params:((N=(O=o.matches)==null?void 0:O[0])==null?void 0:N.params)??{},unstable_pattern:bv(o.matches),errorInfo:v})}:void 0;return c.reduceRight((b,v,O)=>{let N,A=!1,H=null,k=null;o&&(N=f&&v.route.id?f[v.route.id]:void 0,H=v.route.errorElement||jv,h&&(g<0&&O===0?(lg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),A=!0,k=null):g===O&&(A=!0,k=v.route.hydrateFallbackElement||null)));let Y=i.concat(c.slice(0,O+1)),q=()=>{let K;return N?K=H:A?K=k:v.route.Component?K=T.createElement(v.route.Component,null):v.route.element?K=v.route.element:K=b,T.createElement(Uv,{match:v,routeContext:{outlet:b,matches:Y,isDataRoute:o!=null},children:K})};return o&&(v.route.ErrorBoundary||v.route.errorElement||O===0)?T.createElement(ng,{location:o.location,revalidation:o.revalidation,component:H,error:N,children:q(),routeContext:{outlet:null,matches:Y,isDataRoute:!0},onError:m}):q()},null)}function wo(l){return`${l} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bv(l){let i=T.useContext(In);return je(i,wo(l)),i}function kv(l){let i=T.useContext(Bu);return je(i,wo(l)),i}function Yv(l){let i=T.useContext(kt);return je(i,wo(l)),i}function Uo(l){let i=Yv(l),s=i.matches[i.matches.length-1];return je(s.route.id,`${l} can only be used on routes that contain a unique "id"`),s.route.id}function qv(){return Uo("useRouteId")}function Vv(){var o;let l=T.useContext(Lo),i=kv("useRouteError"),s=Uo("useRouteError");return l!==void 0?l:(o=i.errors)==null?void 0:o[s]}function Gv(){let{router:l}=Bv("useNavigate"),i=Uo("useNavigate"),s=T.useRef(!1);return eg(()=>{s.current=!0}),T.useCallback(async(c,f={})=>{At(s.current,Pm),s.current&&(typeof c=="number"?await l.navigate(c):await l.navigate(c,{fromRouteId:i,...f}))},[l,i])}var rm={};function lg(l,i,s){!i&&!rm[l]&&(rm[l]=!0,At(!1,s))}T.memo(Kv);function Kv({routes:l,future:i,state:s,isStatic:o,onError:c}){return ag(l,void 0,{state:s,isStatic:o,onError:c})}function Wn({to:l,replace:i,state:s,relative:o}){je(Pn(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=T.useContext(_t);At(!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(kt),{pathname:h}=Ct(),g=jo(),y=Hu(l,Do(f),h,o==="path"),m=JSON.stringify(y);return T.useEffect(()=>{g(JSON.parse(m),{replace:i,state:s,relative:o})},[g,m,o,i,s]),null}function Xv(l){return Mv(l.context)}function Jn(l){je(!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 Qv({basename:l="/",children:i=null,location:s,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:h}){je(!Pn(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let g=l.replace(/^\/*/,"/"),y=T.useMemo(()=>({basename:g,navigator:c,static:f,unstable_useTransitions:h,future:{}}),[g,c,f,h]);typeof s=="string"&&(s=sn(s));let{pathname:m="/",search:b="",hash:v="",state:O=null,key:N="default",unstable_mask:A}=s,H=T.useMemo(()=>{let k=ha(m,g);return k==null?null:{location:{pathname:k,search:b,hash:v,state:O,key:N,unstable_mask:A},navigationType:o}},[g,m,b,v,O,N,o,A]);return At(H!=null,`<Router basename="${g}"> is not able to match the URL "${m}${b}${v}" because it does not start with the basename, so the <Router> won't render anything.`),H==null?null:T.createElement(_t.Provider,{value:y},T.createElement(li.Provider,{children:i,value:H}))}function Zv({children:l,location:i}){return Dv(xo(l),i)}function xo(l,i=[]){let s=[];return T.Children.forEach(l,(o,c)=>{if(!T.isValidElement(o))return;let f=[...i,c];if(o.type===T.Fragment){s.push.apply(s,xo(o.props.children,f));return}je(o.type===Jn,`[${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>`),je(!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=xo(o.props.children,f)),s.push(h)}),s}var Cu="get",zu="application/x-www-form-urlencoded";function ku(l){return typeof HTMLElement<"u"&&l instanceof HTMLElement}function Jv(l){return ku(l)&&l.tagName.toLowerCase()==="button"}function $v(l){return ku(l)&&l.tagName.toLowerCase()==="form"}function Fv(l){return ku(l)&&l.tagName.toLowerCase()==="input"}function Wv(l){return!!(l.metaKey||l.altKey||l.ctrlKey||l.shiftKey)}function Iv(l,i){return l.button===0&&(!i||i==="_self")&&!Wv(l)}function Eo(l=""){return new URLSearchParams(typeof l=="string"||Array.isArray(l)||l instanceof URLSearchParams?l:Object.keys(l).reduce((i,s)=>{let o=l[s];return i.concat(Array.isArray(o)?o.map(c=>[s,c]):[[s,o]])},[]))}function Pv(l,i){let s=Eo(l);return i&&i.forEach((o,c)=>{s.has(c)||i.getAll(c).forEach(f=>{s.append(c,f)})}),s}var Ou=null;function e1(){if(Ou===null)try{new FormData(document.createElement("form"),0),Ou=!1}catch{Ou=!0}return Ou}var t1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function go(l){return l!=null&&!t1.has(l)?(At(!1,`"${l}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zu}"`),null):l}function a1(l,i){let s,o,c,f,h;if($v(l)){let g=l.getAttribute("action");o=g?ha(g,i):null,s=l.getAttribute("method")||Cu,c=go(l.getAttribute("enctype"))||zu,f=new FormData(l)}else if(Jv(l)||Fv(l)&&(l.type==="submit"||l.type==="image")){let g=l.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let y=l.getAttribute("formaction")||g.getAttribute("action");if(o=y?ha(y,i):null,s=l.getAttribute("formmethod")||g.getAttribute("method")||Cu,c=go(l.getAttribute("formenctype"))||go(g.getAttribute("enctype"))||zu,f=new FormData(g,l),!e1()){let{name:m,type:b,value:v}=l;if(b==="image"){let O=m?`${m}.`:"";f.append(`${O}x`,"0"),f.append(`${O}y`,"0")}else m&&f.append(m,v)}}else{if(ku(l))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=Cu,o=null,c=zu,h=l}return f&&c==="text/plain"&&(h=f,f=void 0),{action:o,method:s.toLowerCase(),encType:c,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ho(l,i){if(l===!1||l===null||typeof l>"u")throw new Error(i)}function ig(l,i,s,o){let c=typeof l=="string"?new URL(l,typeof window>"u"?"server://singlefetch/":window.location.origin):l;return s?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:i&&ha(c.pathname,i)==="/"?c.pathname=`${Du(i)}/_root.${o}`:c.pathname=`${Du(c.pathname)}.${o}`,c}async function n1(l,i){if(l.id in i)return i[l.id];try{let s=await import(l.module);return i[l.id]=s,s}catch(s){return console.error(`Error loading route module \`${l.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function l1(l){return l==null?!1:l.href==null?l.rel==="preload"&&typeof l.imageSrcSet=="string"&&typeof l.imageSizes=="string":typeof l.rel=="string"&&typeof l.href=="string"}async function i1(l,i,s){let o=await Promise.all(l.map(async c=>{let f=i.routes[c.route.id];if(f){let h=await n1(f,s);return h.links?h.links():[]}return[]}));return o1(o.flat(1).filter(l1).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function sm(l,i,s,o,c,f){let h=(y,m)=>s[m]?y.route.id!==s[m].route.id:!0,g=(y,m)=>{var b;return s[m].pathname!==y.pathname||((b=s[m].route.path)==null?void 0:b.endsWith("*"))&&s[m].params["*"]!==y.params["*"]};return f==="assets"?i.filter((y,m)=>h(y,m)||g(y,m)):f==="data"?i.filter((y,m)=>{var v;let b=o.routes[y.route.id];if(!b||!b.hasLoader)return!1;if(h(y,m)||g(y,m))return!0;if(y.route.shouldRevalidate){let O=y.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=s[0])==null?void 0:v.params)||{},nextUrl:new URL(l,window.origin),nextParams:y.params,defaultShouldRevalidate:!0});if(typeof O=="boolean")return O}return!0}):[]}function u1(l,i,{includeHydrateFallback:s}={}){return r1(l.map(o=>{let c=i.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)),s&&c.hydrateFallbackModule&&(f=f.concat(c.hydrateFallbackModule)),c.imports&&(f=f.concat(c.imports)),f}).flat(1))}function r1(l){return[...new Set(l)]}function s1(l){let i={},s=Object.keys(l).sort();for(let o of s)i[o]=l[o];return i}function o1(l,i){let s=new Set;return new Set(i),l.reduce((o,c)=>{let f=JSON.stringify(s1(c));return s.has(f)||(s.add(f),o.push({key:f,link:c})),o},[])}function Bo(){let l=T.useContext(In);return Ho(l,"You must render this element inside a <DataRouterContext.Provider> element"),l}function c1(){let l=T.useContext(Bu);return Ho(l,"You must render this element inside a <DataRouterStateContext.Provider> element"),l}var ko=T.createContext(void 0);ko.displayName="FrameworkContext";function Yo(){let l=T.useContext(ko);return Ho(l,"You must render this element inside a <HydratedRouter> element"),l}function f1(l,i){let s=T.useContext(ko),[o,c]=T.useState(!1),[f,h]=T.useState(!1),{onFocus:g,onBlur:y,onMouseEnter:m,onMouseLeave:b,onTouchStart:v}=i,O=T.useRef(null);T.useEffect(()=>{if(l==="render"&&h(!0),l==="viewport"){let H=Y=>{Y.forEach(q=>{h(q.isIntersecting)})},k=new IntersectionObserver(H,{threshold:.5});return O.current&&k.observe(O.current),()=>{k.disconnect()}}},[l]),T.useEffect(()=>{if(o){let H=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(H)}}},[o]);let N=()=>{c(!0)},A=()=>{c(!1),h(!1)};return s?l!=="intent"?[f,O,{}]:[f,O,{onFocus:Fl(g,N),onBlur:Fl(y,A),onMouseEnter:Fl(m,N),onMouseLeave:Fl(b,A),onTouchStart:Fl(v,N)}]:[!1,O,{}]}function Fl(l,i){return s=>{l&&l(s),s.defaultPrevented||i(s)}}function d1({page:l,...i}){let s=xv(),{router:o}=Bo(),c=T.useMemo(()=>Gm(o.routes,l,o.basename),[o.routes,l,o.basename]);return c?s?T.createElement(m1,{page:l,matches:c,...i}):T.createElement(g1,{page:l,matches:c,...i}):null}function h1(l){let{manifest:i,routeModules:s}=Yo(),[o,c]=T.useState([]);return T.useEffect(()=>{let f=!1;return i1(l,i,s).then(h=>{f||c(h)}),()=>{f=!0}},[l,i,s]),o}function m1({page:l,matches:i,...s}){let o=Ct(),{future:c}=Yo(),{basename:f}=Bo(),h=T.useMemo(()=>{if(l===o.pathname+o.search+o.hash)return[];let g=ig(l,f,c.unstable_trailingSlashAwareDataRequests,"rsc"),y=!1,m=[];for(let b of i)typeof b.route.shouldRevalidate=="function"?y=!0:m.push(b.route.id);return y&&m.length>0&&g.searchParams.set("_routes",m.join(",")),[g.pathname+g.search]},[f,c.unstable_trailingSlashAwareDataRequests,l,o,i]);return T.createElement(T.Fragment,null,h.map(g=>T.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...s})))}function g1({page:l,matches:i,...s}){let o=Ct(),{future:c,manifest:f,routeModules:h}=Yo(),{basename:g}=Bo(),{loaderData:y,matches:m}=c1(),b=T.useMemo(()=>sm(l,i,m,f,o,"data"),[l,i,m,f,o]),v=T.useMemo(()=>sm(l,i,m,f,o,"assets"),[l,i,m,f,o]),O=T.useMemo(()=>{if(l===o.pathname+o.search+o.hash)return[];let H=new Set,k=!1;if(i.forEach(q=>{var $;let K=f.routes[q.route.id];!K||!K.hasLoader||(!b.some(ee=>ee.route.id===q.route.id)&&q.route.id in y&&(($=h[q.route.id])!=null&&$.shouldRevalidate)||K.hasClientLoader?k=!0:H.add(q.route.id))}),H.size===0)return[];let Y=ig(l,g,c.unstable_trailingSlashAwareDataRequests,"data");return k&&H.size>0&&Y.searchParams.set("_routes",i.filter(q=>H.has(q.route.id)).map(q=>q.route.id).join(",")),[Y.pathname+Y.search]},[g,c.unstable_trailingSlashAwareDataRequests,y,o,f,b,i,l,h]),N=T.useMemo(()=>u1(v,f),[v,f]),A=h1(v);return T.createElement(T.Fragment,null,O.map(H=>T.createElement("link",{key:H,rel:"prefetch",as:"fetch",href:H,...s})),N.map(H=>T.createElement("link",{key:H,rel:"modulepreload",href:H,...s})),A.map(({key:H,link:k})=>T.createElement("link",{key:H,nonce:s.nonce,...k,crossOrigin:k.crossOrigin??s.crossOrigin})))}function p1(...l){return i=>{l.forEach(s=>{typeof s=="function"?s(i):s!=null&&(s.current=i)})}}var y1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{y1&&(window.__reactRouterVersion="7.14.2")}catch{}function v1({basename:l,children:i,unstable_useTransitions:s,window:o}){let c=T.useRef();c.current==null&&(c.current=Jy({window:o,v5Compat:!0}));let f=c.current,[h,g]=T.useState({action:f.action,location:f.location}),y=T.useCallback(m=>{s===!1?g(m):T.startTransition(()=>g(m))},[s]);return T.useLayoutEffect(()=>f.listen(y),[f,y]),T.createElement(Qv,{basename:l,children:i,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:s})}var ug=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,rg=T.forwardRef(function({onClick:i,discover:s="render",prefetch:o="none",relative:c,reloadDocument:f,replace:h,unstable_mask:g,state:y,target:m,to:b,preventScrollReset:v,viewTransition:O,unstable_defaultShouldRevalidate:N,...A},H){let{basename:k,navigator:Y,unstable_useTransitions:q}=T.useContext(_t),K=typeof b=="string"&&ug.test(b),$=Jm(b,k);b=$.to;let ee=Cv(b,{relative:c}),se=Ct(),J=null;if(g){let we=Hu(g,[],se.unstable_mask?se.unstable_mask.pathname:"/",!0);k!=="/"&&(we.pathname=we.pathname==="/"?k:Gt([k,we.pathname])),J=Y.createHref(we)}let[ne,re,de]=f1(o,A),Me=x1(b,{replace:h,unstable_mask:g,state:y,target:m,preventScrollReset:v,relative:c,viewTransition:O,unstable_defaultShouldRevalidate:N,unstable_useTransitions:q});function Je(we){i&&i(we),we.defaultPrevented||Me(we)}let Ce=!($.isExternal||f),De=T.createElement("a",{...A,...de,href:(Ce?J:void 0)||$.absoluteURL||ee,onClick:Ce?Je:i,ref:p1(H,re),target:m,"data-discover":!K&&s==="render"?"true":void 0});return ne&&!K?T.createElement(T.Fragment,null,De,T.createElement(d1,{page:ee})):De});rg.displayName="Link";var To=T.forwardRef(function({"aria-current":i="page",caseSensitive:s=!1,className:o="",end:c=!1,style:f,to:h,viewTransition:g,children:y,...m},b){let v=ii(h,{relative:m.relative}),O=Ct(),N=T.useContext(Bu),{navigator:A,basename:H}=T.useContext(_t),k=N!=null&&A1(v)&&g===!0,Y=A.encodeLocation?A.encodeLocation(v).pathname:v.pathname,q=O.pathname,K=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;s||(q=q.toLowerCase(),K=K?K.toLowerCase():null,Y=Y.toLowerCase()),K&&H&&(K=ha(K,H)||K);const $=Y!=="/"&&Y.endsWith("/")?Y.length-1:Y.length;let ee=q===Y||!c&&q.startsWith(Y)&&q.charAt($)==="/",se=K!=null&&(K===Y||!c&&K.startsWith(Y)&&K.charAt(Y.length)==="/"),J={isActive:ee,isPending:se,isTransitioning:k},ne=ee?i:void 0,re;typeof o=="function"?re=o(J):re=[o,ee?"active":null,se?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let de=typeof f=="function"?f(J):f;return T.createElement(rg,{...m,"aria-current":ne,className:re,ref:b,style:de,to:h,viewTransition:g},typeof y=="function"?y(J):y)});To.displayName="NavLink";var b1=T.forwardRef(({discover:l="render",fetcherKey:i,navigate:s,reloadDocument:o,replace:c,state:f,method:h=Cu,action:g,onSubmit:y,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:O,...N},A)=>{let{unstable_useTransitions:H}=T.useContext(_t),k=R1(),Y=O1(g,{relative:m}),q=h.toLowerCase()==="get"?"get":"post",K=typeof g=="string"&&ug.test(g),$=ee=>{if(y&&y(ee),ee.defaultPrevented)return;ee.preventDefault();let se=ee.nativeEvent.submitter,J=(se==null?void 0:se.getAttribute("formmethod"))||h,ne=()=>k(se||ee.currentTarget,{fetcherKey:i,method:J,navigate:s,replace:c,state:f,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:O});H&&s!==!1?T.startTransition(()=>ne()):ne()};return T.createElement("form",{ref:A,method:q,action:Y,onSubmit:o?y:$,...N,"data-discover":!K&&l==="render"?"true":void 0})});b1.displayName="Form";function S1(l){return`${l} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sg(l){let i=T.useContext(In);return je(i,S1(l)),i}function x1(l,{target:i,replace:s,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:m}={}){let b=jo(),v=Ct(),O=ii(l,{relative:h});return T.useCallback(N=>{if(Iv(N,i)){N.preventDefault();let A=s!==void 0?s:ai(v)===ai(O),H=()=>b(l,{replace:A,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:y});m?T.startTransition(()=>H()):H()}},[v,b,O,s,o,c,i,l,f,h,g,y,m])}function MS(l){At(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 i=T.useRef(Eo(l)),s=T.useRef(!1),o=Ct(),c=T.useMemo(()=>Pv(o.search,s.current?null:i.current),[o.search]),f=jo(),h=T.useCallback((g,y)=>{const m=Eo(typeof g=="function"?g(new URLSearchParams(c)):g);s.current=!0,f("?"+m,y)},[f,c]);return[c,h]}var E1=0,T1=()=>`__${String(++E1)}__`;function R1(){let{router:l}=sg("useSubmit"),{basename:i}=T.useContext(_t),s=qv(),o=l.fetch,c=l.navigate;return T.useCallback(async(f,h={})=>{let{action:g,method:y,encType:m,formData:b,body:v}=a1(f,i);if(h.navigate===!1){let O=h.fetcherKey||T1();await o(O,s,h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||y,formEncType:h.encType||m,flushSync:h.flushSync})}else await c(h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||y,formEncType:h.encType||m,replace:h.replace,state:h.state,fromRouteId:s,flushSync:h.flushSync,viewTransition:h.viewTransition})},[o,c,i,s])}function O1(l,{relative:i}={}){let{basename:s}=T.useContext(_t),o=T.useContext(kt);je(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),f={...ii(l||".",{relative:i})},h=Ct();if(l==null){f.search=h.search;let g=new URLSearchParams(f.search),y=g.getAll("index");if(y.some(b=>b==="")){g.delete("index"),y.filter(v=>v).forEach(v=>g.append("index",v));let b=g.toString();f.search=b?`?${b}`:""}}return(!l||l===".")&&c.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(f.pathname=f.pathname==="/"?s:Gt([s,f.pathname])),ai(f)}function A1(l,{relative:i}={}){let s=T.useContext(Wm);je(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=sg("useViewTransitionState"),c=ii(l,{relative:i});if(!s.isTransitioning)return!1;let f=ha(s.currentLocation.pathname,o)||s.currentLocation.pathname,h=ha(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Mu(c.pathname,h)!=null||Mu(c.pathname,f)!=null}const _1=(l,i,s,o)=>{var f,h,g,y;const c=[s,{code:i,...o||{}}];if((h=(f=l==null?void 0:l.services)==null?void 0:f.logger)!=null&&h.forward)return l.services.logger.forward(c,"warn","react-i18next::",!0);rn(c[0])&&(c[0]=`react-i18next:: ${c[0]}`),(y=(g=l==null?void 0:l.services)==null?void 0:g.logger)!=null&&y.warn?l.services.logger.warn(...c):console!=null&&console.warn&&console.warn(...c)},om={},Ro=(l,i,s,o)=>{rn(s)&&om[s]||(rn(s)&&(om[s]=new Date),_1(l,i,s,o))},og=(l,i)=>()=>{if(l.isInitialized)i();else{const s=()=>{setTimeout(()=>{l.off("initialized",s)},0),i()};l.on("initialized",s)}},Oo=(l,i,s)=>{l.loadNamespaces(i,og(l,s))},cm=(l,i,s,o)=>{if(rn(s)&&(s=[s]),l.options.preload&&l.options.preload.indexOf(i)>-1)return Oo(l,s,o);s.forEach(c=>{l.options.ns.indexOf(c)<0&&l.options.ns.push(c)}),l.loadLanguages(i,og(l,o))},C1=(l,i,s={})=>!i.languages||!i.languages.length?(Ro(i,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:i.languages}),!0):i.hasLoadedNamespace(l,{lng:s.lng,precheck:(o,c)=>{if(s.bindI18n&&s.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!c(o.isLanguageChangingTo,l))return!1}}),rn=l=>typeof l=="string",z1=l=>typeof l=="object"&&l!==null,N1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,M1={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},D1=l=>M1[l],L1=l=>l.replace(N1,D1);let Ao={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:L1};const j1=(l={})=>{Ao={...Ao,...l}},w1=()=>Ao;let cg;const U1=l=>{cg=l},H1=()=>cg,B1={type:"3rdParty",init(l){j1(l.options.react),U1(l)}},k1=T.createContext();class Y1{constructor(){this.usedNamespaces={}}addUsedNamespaces(i){i.forEach(s=>{this.usedNamespaces[s]||(this.usedNamespaces[s]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const q1=(l,i)=>{const s=T.useRef();return T.useEffect(()=>{s.current=l},[l,i]),s.current},fg=(l,i,s,o)=>l.getFixedT(i,s,o),V1=(l,i,s,o)=>T.useCallback(fg(l,i,s,o),[l,i,s,o]),G1=(l,i={})=>{var $,ee,se,J;const{i18n:s}=i,{i18n:o,defaultNS:c}=T.useContext(k1)||{},f=s||o||H1();if(f&&!f.reportNamespaces&&(f.reportNamespaces=new Y1),!f){Ro(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const ne=(de,Me)=>rn(Me)?Me:z1(Me)&&rn(Me.defaultValue)?Me.defaultValue:Array.isArray(de)?de[de.length-1]:de,re=[ne,{},!1];return re.t=ne,re.i18n={},re.ready=!1,re}($=f.options.react)!=null&&$.wait&&Ro(f,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const h={...w1(),...f.options.react,...i},{useSuspense:g,keyPrefix:y}=h;let m=c||((ee=f.options)==null?void 0:ee.defaultNS);m=rn(m)?[m]:m||["translation"],(J=(se=f.reportNamespaces).addUsedNamespaces)==null||J.call(se,m);const b=(f.isInitialized||f.initializedStoreOnce)&&m.every(ne=>C1(ne,f,h)),v=V1(f,i.lng||null,h.nsMode==="fallback"?m:m[0],y),O=()=>v,N=()=>fg(f,i.lng||null,h.nsMode==="fallback"?m:m[0],y),[A,H]=T.useState(O);let k=m.join();i.lng&&(k=`${i.lng}${k}`);const Y=q1(k),q=T.useRef(!0);T.useEffect(()=>{const{bindI18n:ne,bindI18nStore:re}=h;q.current=!0,!b&&!g&&(i.lng?cm(f,i.lng,m,()=>{q.current&&H(N)}):Oo(f,m,()=>{q.current&&H(N)})),b&&Y&&Y!==k&&q.current&&H(N);const de=()=>{q.current&&H(N)};return ne&&(f==null||f.on(ne,de)),re&&(f==null||f.store.on(re,de)),()=>{q.current=!1,f&&ne&&(ne==null||ne.split(" ").forEach(Me=>f.off(Me,de))),re&&f&&re.split(" ").forEach(Me=>f.store.off(Me,de))}},[f,k]),T.useEffect(()=>{q.current&&b&&H(O)},[f,y,b]);const K=[A,f,b];if(K.t=A,K.i18n=f,K.ready=b,b||!b&&!g)return K;throw new Promise(ne=>{i.lng?cm(f,i.lng,m,()=>ne()):Oo(f,m,()=>ne())})};function dg(l){var i,s,o="";if(typeof l=="string"||typeof l=="number")o+=l;else if(typeof l=="object")if(Array.isArray(l)){var c=l.length;for(i=0;i<c;i++)l[i]&&(s=dg(l[i]))&&(o&&(o+=" "),o+=s)}else for(s in l)l[s]&&(o&&(o+=" "),o+=s);return o}function K1(){for(var l,i,s=0,o="",c=arguments.length;s<c;s++)(l=arguments[s])&&(i=dg(l))&&(o&&(o+=" "),o+=i);return o}function at(...l){return K1(l)}function DS(l){return l?new Date(l).toLocaleString():"-"}function LS(l,i="just now"){if(!l)return"";const s=Math.floor((Date.now()-new Date(l).getTime())/6e4);if(s<1)return i;if(s<60)return`${s}m`;const o=Math.floor(s/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}const fm=l=>{let i;const s=new Set,o=(m,b)=>{const v=typeof m=="function"?m(i):m;if(!Object.is(v,i)){const O=i;i=b??(typeof v!="object"||v===null)?v:Object.assign({},i,v),s.forEach(N=>N(i,O))}},c=()=>i,g={setState:o,getState:c,getInitialState:()=>y,subscribe:m=>(s.add(m),()=>s.delete(m))},y=i=l(o,c,g);return g},X1=(l=>l?fm(l):fm),Q1=l=>l;function Z1(l,i=Q1){const s=$n.useSyncExternalStore(l.subscribe,$n.useCallback(()=>i(l.getState()),[l,i]),$n.useCallback(()=>i(l.getInitialState()),[l,i]));return $n.useDebugValue(s),s}const dm=l=>{const i=X1(l),s=o=>Z1(i,o);return Object.assign(s,i),s},hg=(l=>l?dm(l):dm),qo=hg(l=>({snapshot:null,setSnapshot:i=>l({snapshot:i})}));function hm(l){qo.getState().setSnapshot(l)}function J1(){return qo.getState().snapshot}function $1(l){return!!(l!=null&&l.knowledge.some(i=>i.enabled!==!1))}function F1(l){return!!(l!=null&&l.schedulers.some(i=>i.enabled!==!1))}function W1(l){var i;return!!((i=l==null?void 0:l.monitors)!=null&&i.some(s=>s.enabled!==!1))}function mm(l){return!!(l!=null&&l.agents.some(i=>i.agentType))}function I1(l=J1()){const i=!!l,s=i?mm(l):!0;return{desktopRuntime:!0,desktopChat:s,chatRoute:i?s:!0,desktopWorkspace:i?mm(l):!0,knowledgeModule:i?$1(l):!0,schedulerModule:i?F1(l):!0,monitorModule:i?W1(l):!0}}function Vo(){const l=qo(i=>i.snapshot);return I1(l)}function gm(l){return l==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":l}function pm(l){document.documentElement.classList.toggle("dark",l==="dark")}const mg=hg(l=>({theme:"dark",resolved:"dark",setTheme:i=>{const s=gm(i);localStorage.setItem("cc_theme",i),pm(s),l({theme:i,resolved:s})},init:()=>{const i=localStorage.getItem("cc_theme")||"dark",s=gm(i);pm(s),l({theme:i,resolved:s})}})),P1="modulepreload",eb=function(l,i){return new URL(l,i).href},ym={},gt=function(i,s,o){let c=Promise.resolve();if(s&&s.length>0){let h=function(b){return Promise.all(b.map(v=>Promise.resolve(v).then(O=>({status:"fulfilled",value:O}),O=>({status:"rejected",reason:O}))))};const g=document.getElementsByTagName("link"),y=document.querySelector("meta[property=csp-nonce]"),m=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));c=h(s.map(b=>{if(b=eb(b,o),b in ym)return;ym[b]=!0;const v=b.endsWith(".css"),O=v?'[rel="stylesheet"]':"";if(!!o)for(let H=g.length-1;H>=0;H--){const k=g[H];if(k.href===b&&(!v||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${O}`))return;const A=document.createElement("link");if(A.rel=v?"stylesheet":P1,v||(A.as="script"),A.crossOrigin="",A.href=b,m&&A.setAttribute("nonce",m),document.head.appendChild(A),v)return new Promise((H,k)=>{A.addEventListener("load",H),A.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${b}`)))})}))}function f(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return c.then(h=>{for(const g of h||[])g.status==="rejected"&&f(g.reason);return i().catch(f)})},tb=T.lazy(()=>gt(()=>import("./Dashboard-CZj-oANw.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),ab=T.lazy(()=>gt(()=>import("./ThreadChat-4OceMgM4.js").then(l=>l.T),__vite__mapDeps([8,9,10,7,11,12,13,14,15,16,17,5]),import.meta.url)),nb=T.lazy(()=>gt(()=>import("./Workspace-DplPJOjJ.js"),__vite__mapDeps([18,12,13,11,19,10,3,4,1,9,16,20,21]),import.meta.url)),lb=T.lazy(()=>gt(()=>import("./CronList-XqHdVlgu.js"),__vite__mapDeps([22,5,1,2,12,13,11,19,10,3,4,20,23,15,16]),import.meta.url)),ib=T.lazy(()=>gt(()=>import("./MonitorList-CIjGQkFs.js"),__vite__mapDeps([24,5,1,2,12,13,11,19,10,3,4,20,23,15,16]),import.meta.url)),ub=T.lazy(()=>gt(()=>import("./Config-ByGMQuzR.js"),__vite__mapDeps([25,2,11,4,1,7,21]),import.meta.url)),rb=T.lazy(()=>gt(()=>import("./Logs-DqnanQTc.js"),__vite__mapDeps([26,1,2,11,19,13,10,4,27,14]),import.meta.url)),sb=T.lazy(()=>gt(()=>import("./KnowledgeHome-BWV1gz4f.js"),__vite__mapDeps([28,1,12,13,11,3,17,15,16,14,20,6]),import.meta.url)),ob=T.lazy(()=>gt(()=>import("./KnowledgeDetail-CbUb2tG7.js"),__vite__mapDeps([29,1,11,3,17,27,14,16]),import.meta.url));class cb{constructor(){Ru(this,"routes",new Map);Ru(this,"navItems",new Map)}registerRoute(i){this.routes.set(i.id,i)}registerNavItem(i){this.navItems.set(i.id,i)}listRoutes(){return[...this.routes.values()].sort((i,s)=>i.order-s.order)}listNavItems(){return[...this.navItems.values()].sort((i,s)=>i.order-s.order)}}function ln(l,i,s="/"){return l?i:j.jsx(Wn,{to:s,replace:!0})}function fb(){const{name:l}=tg();return j.jsx(Wn,{to:l?`/workspace?project=${encodeURIComponent(l)}`:"/workspace",replace:!0})}function vm(){const{project:l,id:i}=tg(),s=new URLSearchParams;return l&&s.set("project",l),i&&s.set("session",i),j.jsx(Wn,{to:`/chat${s.toString()?`?${s.toString()}`:""}`,replace:!0})}function db(l){[{id:"dashboard",index:!0,titleKey:"nav.dashboard",order:10,element:()=>j.jsx(tb,{})},{id:"chat",path:"chat",titleKey:"nav.chat",order:20,element:({features:s})=>ln(s.chatRoute,j.jsx(ab,{}))},{id:"workspace",path:"workspace",titleKey:"nav.workspace",order:30,element:({features:s})=>ln(s.desktopWorkspace,j.jsx(nb,{}))},{id:"knowledge",path:"knowledge",titleKey:"nav.knowledge",order:40,element:({features:s})=>ln(s.knowledgeModule,j.jsx(sb,{}))},{id:"knowledge-detail",path:"knowledge/:knowledgebaseId",titleKey:"nav.knowledge",order:41,element:({features:s})=>ln(s.knowledgeModule,j.jsx(ob,{}))},{id:"projects",path:"projects",titleKey:"nav.projects",order:50,element:({features:s})=>ln(s.desktopWorkspace,j.jsx(Wn,{to:"/workspace",replace:!0}))},{id:"project-detail",path:"projects/:name",titleKey:"nav.projects",order:51,element:()=>j.jsx(fb,{})},{id:"sessions",path:"sessions",titleKey:"nav.sessions",order:60,element:()=>j.jsx(vm,{})},{id:"session-detail",path:"sessions/:project/:id",titleKey:"nav.sessions",order:61,element:()=>j.jsx(vm,{})},{id:"cron",path:"cron",titleKey:"nav.cron",order:70,element:({features:s})=>ln(s.schedulerModule,j.jsx(lb,{}))},{id:"monitors",path:"monitors",titleKey:"nav.monitors",order:71,element:({features:s})=>ln(s.monitorModule,j.jsx(ib,{}))},{id:"system",path:"system",titleKey:"nav.system",order:80,element:()=>j.jsx(ub,{})},{id:"system-logs",path:"system/logs",titleKey:"nav.system",order:81,element:()=>j.jsx(rb,{})}].forEach(s=>l.registerRoute(s))}function hb(l){[{id:"dashboard",path:"/",labelKey:"nav.dashboard",icon:Sy,order:10,end:!0},{id:"chat",path:"/chat",labelKey:"nav.chat",icon:Ay,order:20,visible:({features:s})=>s.chatRoute,resolveLabelKey:({features:s})=>s.desktopChat?"nav.chat":"nav.chatWeb"},{id:"workspace",path:"/workspace",labelKey:"nav.workspace",icon:ky,order:30,visible:({features:s})=>s.desktopWorkspace},{id:"knowledge",path:"/knowledge",labelKey:"nav.knowledge",icon:Ey,order:40,visible:({features:s})=>s.knowledgeModule},{id:"projects",path:"/projects",labelKey:"nav.projects",icon:py,order:50,visible:()=>!1},{id:"sessions",path:"/sessions",labelKey:"nav.sessions",icon:Ry,order:60,visible:()=>!1},{id:"cron",path:"/cron",labelKey:"nav.cron",icon:my,order:70,visible:({features:s})=>s.schedulerModule},{id:"monitors",path:"/monitors",labelKey:"nav.monitors",icon:sy,order:71,visible:({features:s})=>s.monitorModule},{id:"system",path:"/system",labelKey:"nav.system",icon:Ly,order:80}].forEach(s=>l.registerNavItem(s))}const Yu=new cb;db(Yu);hb(Yu);function mb({className:l,markClassName:i,showWordmark:s=!1}){const o=T.useId(),c=`${o}-bg`,f=`${o}-stroke`;return j.jsxs("div",{className:at("inline-flex items-center gap-3",l),children:[j.jsxs("svg",{className:at("h-8 w-8 shrink-0",i),viewBox:"0 0 64 64",role:"img","aria-label":"AgentDock",fill:"none",children:[j.jsxs("defs",{children:[j.jsxs("linearGradient",{id:c,x1:"7",y1:"5",x2:"57",y2:"59",gradientUnits:"userSpaceOnUse",children:[j.jsx("stop",{className:"[stop-color:#FFFFFF] dark:[stop-color:#3A3A3C]"}),j.jsx("stop",{offset:"0.52",className:"[stop-color:#F5F5F7] dark:[stop-color:#2C2C2E]"}),j.jsx("stop",{offset:"1",className:"[stop-color:#E5E5EA] dark:[stop-color:#1C1C1E]"})]}),j.jsxs("linearGradient",{id:f,x1:"18",y1:"16",x2:"47",y2:"48",gradientUnits:"userSpaceOnUse",children:[j.jsx("stop",{stopColor:"#5AC8FA"}),j.jsx("stop",{offset:"0.44",stopColor:"#0A84FF"}),j.jsx("stop",{offset:"1",stopColor:"#007AFF"})]})]}),j.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"}),j.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"}),j.jsx("path",{d:"M20.8 37.5H34.7",className:"stroke-white dark:stroke-white",strokeWidth:"5.25",strokeLinecap:"round"}),j.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"}),j.jsx("path",{d:"M34 25.5V39.5",className:"stroke-black/70 dark:stroke-black/80",strokeWidth:"3",strokeLinecap:"round",opacity:"0.18"})]}),s&&j.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"AgentDock"})]})}var po={};const te=l=>typeof l=="string",Wl=()=>{let l,i;const s=new Promise((o,c)=>{l=o,i=c});return s.resolve=l,s.reject=i,s},bm=l=>l==null?"":""+l,gb=(l,i,s)=>{l.forEach(o=>{i[o]&&(s[o]=i[o])})},pb=/###/g,Sm=l=>l&&l.indexOf("###")>-1?l.replace(pb,"."):l,xm=l=>!l||te(l),Pl=(l,i,s)=>{const o=te(i)?i.split("."):i;let c=0;for(;c<o.length-1;){if(xm(l))return{};const f=Sm(o[c]);!l[f]&&s&&(l[f]=new s),Object.prototype.hasOwnProperty.call(l,f)?l=l[f]:l={},++c}return xm(l)?{}:{obj:l,k:Sm(o[c])}},Em=(l,i,s)=>{const{obj:o,k:c}=Pl(l,i,Object);if(o!==void 0||i.length===1){o[c]=s;return}let f=i[i.length-1],h=i.slice(0,i.length-1),g=Pl(l,h,Object);for(;g.obj===void 0&&h.length;)f=`${h[h.length-1]}.${f}`,h=h.slice(0,h.length-1),g=Pl(l,h,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${f}`]<"u"&&(g.obj=void 0);g.obj[`${g.k}.${f}`]=s},yb=(l,i,s,o)=>{const{obj:c,k:f}=Pl(l,i,Object);c[f]=c[f]||[],c[f].push(s)},Lu=(l,i)=>{const{obj:s,k:o}=Pl(l,i);if(s&&Object.prototype.hasOwnProperty.call(s,o))return s[o]},vb=(l,i,s)=>{const o=Lu(l,s);return o!==void 0?o:Lu(i,s)},gg=(l,i,s)=>{for(const o in i)o!=="__proto__"&&o!=="constructor"&&(o in l?te(l[o])||l[o]instanceof String||te(i[o])||i[o]instanceof String?s&&(l[o]=i[o]):gg(l[o],i[o],s):l[o]=i[o]);return l},un=l=>l.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var bb={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Sb=l=>te(l)?l.replace(/[&<>"'\/]/g,i=>bb[i]):l;class xb{constructor(i){this.capacity=i,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(i){const s=this.regExpMap.get(i);if(s!==void 0)return s;const o=new RegExp(i);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(i,o),this.regExpQueue.push(i),o}}const Eb=[" ",",","?","!",";"],Tb=new xb(20),Rb=(l,i,s)=>{i=i||"",s=s||"";const o=Eb.filter(h=>i.indexOf(h)<0&&s.indexOf(h)<0);if(o.length===0)return!0;const c=Tb.getRegExp(`(${o.map(h=>h==="?"?"\\?":h).join("|")})`);let f=!c.test(l);if(!f){const h=l.indexOf(s);h>0&&!c.test(l.substring(0,h))&&(f=!0)}return f},_o=(l,i,s=".")=>{if(!l)return;if(l[i])return Object.prototype.hasOwnProperty.call(l,i)?l[i]:void 0;const o=i.split(s);let c=l;for(let f=0;f<o.length;){if(!c||typeof c!="object")return;let h,g="";for(let y=f;y<o.length;++y)if(y!==f&&(g+=s),g+=o[y],h=c[g],h!==void 0){if(["string","number","boolean"].indexOf(typeof h)>-1&&y<o.length-1)continue;f+=y-f+1;break}c=h}return c},ni=l=>l==null?void 0:l.replace(/_/g,"-"),Ob={type:"logger",log(l){this.output("log",l)},warn(l){this.output("warn",l)},error(l){this.output("error",l)},output(l,i){var s,o;(o=(s=console==null?void 0:console[l])==null?void 0:s.apply)==null||o.call(s,console,i)}};class ju{constructor(i,s={}){this.init(i,s)}init(i,s={}){this.prefix=s.prefix||"i18next:",this.logger=i||Ob,this.options=s,this.debug=s.debug}log(...i){return this.forward(i,"log","",!0)}warn(...i){return this.forward(i,"warn","",!0)}error(...i){return this.forward(i,"error","")}deprecate(...i){return this.forward(i,"warn","WARNING DEPRECATED: ",!0)}forward(i,s,o,c){return c&&!this.debug?null:(te(i[0])&&(i[0]=`${o}${this.prefix} ${i[0]}`),this.logger[s](i))}create(i){return new ju(this.logger,{prefix:`${this.prefix}:${i}:`,...this.options})}clone(i){return i=i||this.options,i.prefix=i.prefix||this.prefix,new ju(this.logger,i)}}var Jt=new ju;class qu{constructor(){this.observers={}}on(i,s){return i.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(s)||0;this.observers[o].set(s,c+1)}),this}off(i,s){if(this.observers[i]){if(!s){delete this.observers[i];return}this.observers[i].delete(s)}}emit(i,...s){this.observers[i]&&Array.from(this.observers[i].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c.apply(c,[i,...s])})}}class Tm extends qu{constructor(i,s={ns:["translation"],defaultNS:"translation"}){super(),this.data=i||{},this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}removeNamespaces(i){const s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}getResource(i,s,o,c={}){var m,b;const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,h=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;i.indexOf(".")>-1?g=i.split("."):(g=[i,s],o&&(Array.isArray(o)?g.push(...o):te(o)&&f?g.push(...o.split(f)):g.push(o)));const y=Lu(this.data,g);return!y&&!s&&!o&&i.indexOf(".")>-1&&(i=g[0],s=g[1],o=g.slice(2).join(".")),y||!h||!te(o)?y:_o((b=(m=this.data)==null?void 0:m[i])==null?void 0:b[s],o,f)}addResource(i,s,o,c,f={silent:!1}){const h=f.keySeparator!==void 0?f.keySeparator:this.options.keySeparator;let g=[i,s];o&&(g=g.concat(h?o.split(h):o)),i.indexOf(".")>-1&&(g=i.split("."),c=s,s=g[1]),this.addNamespaces(s),Em(this.data,g,c),f.silent||this.emit("added",i,s,o,c)}addResources(i,s,o,c={silent:!1}){for(const f in o)(te(o[f])||Array.isArray(o[f]))&&this.addResource(i,s,f,o[f],{silent:!0});c.silent||this.emit("added",i,s,o)}addResourceBundle(i,s,o,c,f,h={silent:!1,skipCopy:!1}){let g=[i,s];i.indexOf(".")>-1&&(g=i.split("."),c=o,o=s,s=g[1]),this.addNamespaces(s);let y=Lu(this.data,g)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?gg(y,o,f):y={...y,...o},Em(this.data,g,y),h.silent||this.emit("added",i,s,o)}removeResourceBundle(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}hasResourceBundle(i,s){return this.getResource(i,s)!==void 0}getResourceBundle(i,s){return s||(s=this.options.defaultNS),this.getResource(i,s)}getDataByLanguage(i){return this.data[i]}hasLanguageSomeTranslations(i){const s=this.getDataByLanguage(i);return!!(s&&Object.keys(s)||[]).find(c=>s[c]&&Object.keys(s[c]).length>0)}toJSON(){return this.data}}var pg={processors:{},addPostProcessor(l){this.processors[l.name]=l},handle(l,i,s,o,c){return l.forEach(f=>{var h;i=((h=this.processors[f])==null?void 0:h.process(i,s,o,c))??i}),i}};const yg=Symbol("i18next/PATH_KEY");function Ab(){const l=[],i=Object.create(null);let s;return i.get=(o,c)=>{var f;return(f=s==null?void 0:s.revoke)==null||f.call(s),c===yg?l:(l.push(c),s=Proxy.revocable(o,i),s.proxy)},Proxy.revocable(Object.create(null),i).proxy}function Fn(l,i){const{[yg]:s}=l(Ab()),o=(i==null?void 0:i.keySeparator)??".",c=(i==null?void 0:i.nsSeparator)??":";if(s.length>1&&c){const f=i==null?void 0:i.ns,h=Array.isArray(f)?f:null;if(h&&h.length>1&&h.slice(1).includes(s[0]))return`${s[0]}${c}${s.slice(1).join(o)}`}return s.join(o)}const Rm={},yo=l=>!te(l)&&typeof l!="boolean"&&typeof l!="number";class wu extends qu{constructor(i,s={}){super(),gb(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],i,this),this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Jt.create("translator")}changeLanguage(i){i&&(this.language=i)}exists(i,s={interpolation:{}}){const o={...s};if(i==null)return!1;const c=this.resolve(i,o);if((c==null?void 0:c.res)===void 0)return!1;const f=yo(c.res);return!(o.returnObjects===!1&&f)}extractFromKey(i,s){let o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let f=s.ns||this.options.defaultNS||[];const h=o&&i.indexOf(o)>-1,g=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!Rb(i,o,c);if(h&&!g){const y=i.match(this.interpolator.nestingRegexp);if(y&&y.length>0)return{key:i,namespaces:te(f)?[f]:f};const m=i.split(o);(o!==c||o===c&&this.options.ns.indexOf(m[0])>-1)&&(f=m.shift()),i=m.join(c)}return{key:i,namespaces:te(f)?[f]:f}}translate(i,s,o){let c=typeof s=="object"?{...s}:s;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),i==null)return"";typeof i=="function"&&(i=Fn(i,{...this.options,...c})),Array.isArray(i)||(i=[String(i)]),i=i.map(Ce=>typeof Ce=="function"?Fn(Ce,{...this.options,...c}):String(Ce));const f=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,h=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:g,namespaces:y}=this.extractFromKey(i[i.length-1],c),m=y[y.length-1];let b=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;b===void 0&&(b=":");const v=c.lng||this.language,O=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((v==null?void 0:v.toLowerCase())==="cimode")return O?f?{res:`${m}${b}${g}`,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:`${m}${b}${g}`:f?{res:g,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:g;const N=this.resolve(i,c);let A=N==null?void 0:N.res;const H=(N==null?void 0:N.usedKey)||g,k=(N==null?void 0:N.exactUsedKey)||g,Y=["[object Number]","[object Function]","[object RegExp]"],q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,K=!this.i18nFormat||this.i18nFormat.handleAsObject,$=c.count!==void 0&&!te(c.count),ee=wu.hasDefaultValue(c),se=$?this.pluralResolver.getSuffix(v,c.count,c):"",J=c.ordinal&&$?this.pluralResolver.getSuffix(v,c.count,{ordinal:!1}):"",ne=$&&!c.ordinal&&c.count===0,re=ne&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${se}`]||c[`defaultValue${J}`]||c.defaultValue;let de=A;K&&!A&&ee&&(de=re);const Me=yo(de),Je=Object.prototype.toString.apply(de);if(K&&de&&Me&&Y.indexOf(Je)<0&&!(te(q)&&Array.isArray(de))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Ce=this.options.returnedObjectHandler?this.options.returnedObjectHandler(H,de,{...c,ns:y}):`key '${g} (${this.language})' returned an object instead of string.`;return f?(N.res=Ce,N.usedParams=this.getUsedParamsDetails(c),N):Ce}if(h){const Ce=Array.isArray(de),De=Ce?[]:{},we=Ce?k:H;for(const D in de)if(Object.prototype.hasOwnProperty.call(de,D)){const V=`${we}${h}${D}`;ee&&!A?De[D]=this.translate(V,{...c,defaultValue:yo(re)?re[D]:void 0,joinArrays:!1,ns:y}):De[D]=this.translate(V,{...c,joinArrays:!1,ns:y}),De[D]===V&&(De[D]=de[D])}A=De}}else if(K&&te(q)&&Array.isArray(A))A=A.join(q),A&&(A=this.extendTranslation(A,i,c,o));else{let Ce=!1,De=!1;!this.isValidLookup(A)&&ee&&(Ce=!0,A=re),this.isValidLookup(A)||(De=!0,A=g);const D=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&De?void 0:A,V=ee&&re!==A&&this.options.updateMissing;if(De||Ce||V){if(this.logger.log(V?"updateKey":"missingKey",v,m,g,V?re:A),h){const x=this.resolve(g,{...c,keySeparator:!1});x&&x.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let I=[];const pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(let x=0;x<pe.length;x++)I.push(pe[x]);else this.options.saveMissingTo==="all"?I=this.languageUtils.toResolveHierarchy(c.lng||this.language):I.push(c.lng||this.language);const Se=(x,w,G)=>{var ae;const Q=ee&&G!==A?G:D;this.options.missingKeyHandler?this.options.missingKeyHandler(x,m,w,Q,V,c):(ae=this.backendConnector)!=null&&ae.saveMissing&&this.backendConnector.saveMissing(x,m,w,Q,V,c),this.emit("missingKey",x,m,w,A)};this.options.saveMissing&&(this.options.saveMissingPlurals&&$?I.forEach(x=>{const w=this.pluralResolver.getSuffixes(x,c);ne&&c[`defaultValue${this.options.pluralSeparator}zero`]&&w.indexOf(`${this.options.pluralSeparator}zero`)<0&&w.push(`${this.options.pluralSeparator}zero`),w.forEach(G=>{Se([x],g+G,c[`defaultValue${G}`]||re)})}):Se(I,g,re))}A=this.extendTranslation(A,i,c,N,o),De&&A===g&&this.options.appendNamespaceToMissingKey&&(A=`${m}${b}${g}`),(De||Ce)&&this.options.parseMissingKeyHandler&&(A=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}${b}${g}`:g,Ce?A:void 0,c))}return f?(N.res=A,N.usedParams=this.getUsedParamsDetails(c),N):A}extendTranslation(i,s,o,c,f){var y,m;if((y=this.i18nFormat)!=null&&y.parse)i=this.i18nFormat.parse(i,{...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=te(i)&&(((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 N=i.match(this.interpolator.nestingRegexp);v=N&&N.length}let O=o.replace&&!te(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(O={...this.options.interpolation.defaultVariables,...O}),i=this.interpolator.interpolate(i,O,o.lng||this.language||c.usedLng,o),b){const N=i.match(this.interpolator.nestingRegexp),A=N&&N.length;v<A&&(o.nest=!1)}!o.lng&&c&&c.res&&(o.lng=this.language||c.usedLng),o.nest!==!1&&(i=this.interpolator.nest(i,(...N)=>(f==null?void 0:f[0])===N[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${N[0]} in key: ${s[0]}`),null):this.translate(...N,s),o)),o.interpolation&&this.interpolator.reset()}const h=o.postProcess||this.options.postProcess,g=te(h)?[h]:h;return i!=null&&(g!=null&&g.length)&&o.applyPostProcessor!==!1&&(i=pg.handle(g,i,s,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),i}resolve(i,s={}){let o,c,f,h,g;return te(i)&&(i=[i]),Array.isArray(i)&&(i=i.map(y=>typeof y=="function"?Fn(y,{...this.options,...s}):y)),i.forEach(y=>{if(this.isValidLookup(o))return;const m=this.extractFromKey(y,s),b=m.key;c=b;let v=m.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const O=s.count!==void 0&&!te(s.count),N=O&&!s.ordinal&&s.count===0,A=s.context!==void 0&&(te(s.context)||typeof s.context=="number")&&s.context!=="",H=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);v.forEach(k=>{var Y,q;this.isValidLookup(o)||(g=k,!Rm[`${H[0]}-${k}`]&&((Y=this.utils)!=null&&Y.hasLoadedNamespace)&&!((q=this.utils)!=null&&q.hasLoadedNamespace(g))&&(Rm[`${H[0]}-${k}`]=!0,this.logger.warn(`key "${c}" for languages "${H.join(", ")}" won't get resolved as namespace "${g}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),H.forEach(K=>{var se;if(this.isValidLookup(o))return;h=K;const $=[b];if((se=this.i18nFormat)!=null&&se.addLookupKeys)this.i18nFormat.addLookupKeys($,b,K,k,s);else{let J;O&&(J=this.pluralResolver.getSuffix(K,s.count,s));const ne=`${this.options.pluralSeparator}zero`,re=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(O&&(s.ordinal&&J.indexOf(re)===0&&$.push(b+J.replace(re,this.options.pluralSeparator)),$.push(b+J),N&&$.push(b+ne)),A){const de=`${b}${this.options.contextSeparator||"_"}${s.context}`;$.push(de),O&&(s.ordinal&&J.indexOf(re)===0&&$.push(de+J.replace(re,this.options.pluralSeparator)),$.push(de+J),N&&$.push(de+ne))}}let ee;for(;ee=$.pop();)this.isValidLookup(o)||(f=ee,o=this.getResource(K,k,ee,s))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:g}}isValidLookup(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}getResource(i,s,o,c={}){var f;return(f=this.i18nFormat)!=null&&f.getResource?this.i18nFormat.getResource(i,s,o,c):this.resourceStore.getResource(i,s,o,c)}getUsedParamsDetails(i={}){const s=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=i.replace&&!te(i.replace);let c=o?i.replace:i;if(o&&typeof i.count<"u"&&(c.count=i.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const f of s)delete c[f]}return c}static hasDefaultValue(i){const s="defaultValue";for(const o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}class Om{constructor(i){this.options=i,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Jt.create("languageUtils")}getScriptPartFromCode(i){if(i=ni(i),!i||i.indexOf("-")<0)return null;const s=i.split("-");return s.length===2||(s.pop(),s[s.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(s.join("-"))}getLanguagePartFromCode(i){if(i=ni(i),!i||i.indexOf("-")<0)return i;const s=i.split("-");return this.formatLanguageCode(s[0])}formatLanguageCode(i){if(te(i)&&i.indexOf("-")>-1){let s;try{s=Intl.getCanonicalLocales(i)[0]}catch{}return s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s||(this.options.lowerCaseLng?i.toLowerCase():i)}return this.options.cleanCode||this.options.lowerCaseLng?i.toLowerCase():i}isSupportedCode(i){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(i=this.getLanguagePartFromCode(i)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(i)>-1}getBestMatchFromCodes(i){if(!i)return null;let s;return i.forEach(o=>{if(s)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(s=c)}),!s&&this.options.supportedLngs&&i.forEach(o=>{if(s)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return s=c;const f=this.getLanguagePartFromCode(o);if(this.isSupportedCode(f))return s=f;s=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})}),s||(s=this.getFallbackCodes(this.options.fallbackLng)[0]),s}getFallbackCodes(i,s){if(!i)return[];if(typeof i=="function"&&(i=i(s)),te(i)&&(i=[i]),Array.isArray(i))return i;if(!s)return i.default||[];let o=i[s];return o||(o=i[this.getScriptPartFromCode(s)]),o||(o=i[this.formatLanguageCode(s)]),o||(o=i[this.getLanguagePartFromCode(s)]),o||(o=i.default),o||[]}toResolveHierarchy(i,s){const o=this.getFallbackCodes((s===!1?[]:s)||this.options.fallbackLng||[],i),c=[],f=h=>{h&&(this.isSupportedCode(h)?c.push(h):this.logger.warn(`rejecting language code not found in supportedLngs: ${h}`))};return te(i)&&(i.indexOf("-")>-1||i.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&f(this.formatLanguageCode(i)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&f(this.getScriptPartFromCode(i)),this.options.load!=="currentOnly"&&f(this.getLanguagePartFromCode(i))):te(i)&&f(this.formatLanguageCode(i)),o.forEach(h=>{c.indexOf(h)<0&&f(this.formatLanguageCode(h))}),c}}const Am={zero:0,one:1,two:2,few:3,many:4,other:5},_m={select:l=>l===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class _b{constructor(i,s={}){this.languageUtils=i,this.options=s,this.logger=Jt.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(i,s={}){const o=ni(i==="dev"?"en":i),c=s.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!"),_m;if(!i.match(/-|_/))return _m;const y=this.languageUtils.getLanguagePartFromCode(i);h=this.getRule(y,s)}return this.pluralRulesCache[f]=h,h}needsPlural(i,s={}){let o=this.getRule(i,s);return o||(o=this.getRule("dev",s)),(o==null?void 0:o.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(i,s,o={}){return this.getSuffixes(i,o).map(c=>`${s}${c}`)}getSuffixes(i,s={}){let o=this.getRule(i,s);return o||(o=this.getRule("dev",s)),o?o.resolvedOptions().pluralCategories.sort((c,f)=>Am[c]-Am[f]).map(c=>`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(i,s,o={}){const c=this.getRule(i,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(s)}`:(this.logger.warn(`no plural rule found for: ${i}`),this.getSuffix("dev",s,o))}}const Cm=(l,i,s,o=".",c=!0)=>{let f=vb(l,i,s);return!f&&c&&te(s)&&(f=_o(l,s,o),f===void 0&&(f=_o(i,s,o))),f},vo=l=>l.replace(/\$/g,"$$$$");class zm{constructor(i={}){var s;this.logger=Jt.create("interpolator"),this.options=i,this.format=((s=i==null?void 0:i.interpolation)==null?void 0:s.format)||(o=>o),this.init(i)}init(i={}){i.interpolation||(i.interpolation={escapeValue:!0});const{escape:s,escapeValue:o,useRawValueToEscape:c,prefix:f,prefixEscaped:h,suffix:g,suffixEscaped:y,formatSeparator:m,unescapeSuffix:b,unescapePrefix:v,nestingPrefix:O,nestingPrefixEscaped:N,nestingSuffix:A,nestingSuffixEscaped:H,nestingOptionsSeparator:k,maxReplaces:Y,alwaysFormat:q}=i.interpolation;this.escape=s!==void 0?s:Sb,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=f?un(f):h||"{{",this.suffix=g?un(g):y||"}}",this.formatSeparator=m||",",this.unescapePrefix=b?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=O?un(O):N||un("$t("),this.nestingSuffix=A?un(A):H||un(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=Y||1e3,this.alwaysFormat=q!==void 0?q:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const i=(s,o)=>(s==null?void 0:s.source)===o?(s.lastIndex=0,s):new RegExp(o,"g");this.regexp=i(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=i(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=i(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(i,s,o,c){var N;let f,h,g;const y=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=A=>{if(A.indexOf(this.formatSeparator)<0){const q=Cm(s,y,A,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(q,void 0,o,{...c,...s,interpolationkey:A}):q}const H=A.split(this.formatSeparator),k=H.shift().trim(),Y=H.join(this.formatSeparator).trim();return this.format(Cm(s,y,k,this.options.keySeparator,this.options.ignoreJSONStructure),Y,o,{...c,...s,interpolationkey:k})};this.resetRegExp();const b=(c==null?void 0:c.missingInterpolationHandler)||this.options.missingInterpolationHandler,v=((N=c==null?void 0:c.interpolation)==null?void 0:N.skipOnVariables)!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:A=>vo(A)},{regex:this.regexp,safeValue:A=>this.escapeValue?vo(this.escape(A)):vo(A)}].forEach(A=>{for(g=0;f=A.regex.exec(i);){const H=f[1].trim();if(h=m(H),h===void 0)if(typeof b=="function"){const Y=b(i,f,c);h=te(Y)?Y:""}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 ${i}`),h="";else!te(h)&&!this.useRawValueToEscape&&(h=bm(h));const k=A.safeValue(h);if(i=i.replace(f[0],k),v?(A.regex.lastIndex+=h.length,A.regex.lastIndex-=f[0].length):A.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),i}nest(i,s,o={}){let c,f,h;const g=(y,m)=>{const b=this.nestingOptionsSeparator;if(y.indexOf(b)<0)return y;const v=y.split(new RegExp(`${un(b)}[ ]*{`));let O=`{${v[1]}`;y=v[0],O=this.interpolate(O,h);const N=O.match(/'/g),A=O.match(/"/g);(((N==null?void 0:N.length)??0)%2===0&&!A||((A==null?void 0:A.length)??0)%2!==0)&&(O=O.replace(/'/g,'"'));try{h=JSON.parse(O),m&&(h={...m,...h})}catch(H){return this.logger.warn(`failed parsing options string in nesting for key ${y}`,H),`${y}${b}${O}`}return h.defaultValue&&h.defaultValue.indexOf(this.prefix)>-1&&delete h.defaultValue,y};for(;c=this.nestingRegexp.exec(i);){let y=[];h={...o},h=h.replace&&!te(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&&(y=c[1].slice(m).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,m)),f=s(g.call(this,c[1].trim(),h),h),f&&c[0]===i&&!te(f))return f;te(f)||(f=bm(f)),f||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${i}`),f=""),y.length&&(f=y.reduce((b,v)=>this.format(b,v,o.lng,{...o,interpolationkey:c[1].trim()}),f.trim())),i=i.replace(c[0],f),this.regexp.lastIndex=0}return i}}const Cb=l=>{let i=l.toLowerCase().trim();const s={};if(l.indexOf("(")>-1){const o=l.split("(");i=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);i==="currency"&&c.indexOf(":")<0?s.currency||(s.currency=c.trim()):i==="relativetime"&&c.indexOf(":")<0?s.range||(s.range=c.trim()):c.split(";").forEach(h=>{if(h){const[g,...y]=h.split(":"),m=y.join(":").trim().replace(/^'+|'+$/g,""),b=g.trim();s[b]||(s[b]=m),m==="false"&&(s[b]=!1),m==="true"&&(s[b]=!0),isNaN(m)||(s[b]=parseInt(m,10))}})}return{formatName:i,formatOptions:s}},Nm=l=>{const i={};return(s,o,c)=>{let f=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(f={...f,[c.interpolationkey]:void 0});const h=o+JSON.stringify(f);let g=i[h];return g||(g=l(ni(o),c),i[h]=g),g(s)}},zb=l=>(i,s,o)=>l(ni(s),o)(i);class Nb{constructor(i={}){this.logger=Jt.create("formatter"),this.options=i,this.init(i)}init(i,s={interpolation:{}}){this.formatSeparator=s.interpolation.formatSeparator||",";const o=s.cacheInBuiltFormats?Nm:zb;this.formats={number:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f});return g=>h.format(g)}),currency:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f,style:"currency"});return g=>h.format(g)}),datetime:o((c,f)=>{const h=new Intl.DateTimeFormat(c,{...f});return g=>h.format(g)}),relativetime:o((c,f)=>{const h=new Intl.RelativeTimeFormat(c,{...f});return g=>h.format(g,f.range||"day")}),list:o((c,f)=>{const h=new Intl.ListFormat(c,{...f});return g=>h.format(g)})}}add(i,s){this.formats[i.toLowerCase().trim()]=s}addCached(i,s){this.formats[i.toLowerCase().trim()]=Nm(s)}format(i,s,o,c={}){const f=s.split(this.formatSeparator);if(f.length>1&&f[0].indexOf("(")>1&&f[0].indexOf(")")<0&&f.find(g=>g.indexOf(")")>-1)){const g=f.findIndex(y=>y.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,g)].join(this.formatSeparator)}return f.reduce((g,y)=>{var v;const{formatName:m,formatOptions:b}=Cb(y);if(this.formats[m]){let O=g;try{const N=((v=c==null?void 0:c.formatParams)==null?void 0:v[c.interpolationkey])||{},A=N.locale||N.lng||c.locale||c.lng||o;O=this.formats[m](g,A,{...b,...c,...N})}catch(N){this.logger.warn(N)}return O}else this.logger.warn(`there was no format function for ${m}`);return g},i)}}const Mb=(l,i)=>{l.pending[i]!==void 0&&(delete l.pending[i],l.pendingCount--)};class Db extends qu{constructor(i,s,o,c={}){var f,h;super(),this.backend=i,this.store=s,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=Jt.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(i,s,o,c){const f={},h={},g={},y={};return i.forEach(m=>{let b=!0;s.forEach(v=>{const O=`${m}|${v}`;!o.reload&&this.store.hasResourceBundle(m,v)?this.state[O]=2:this.state[O]<0||(this.state[O]===1?h[O]===void 0&&(h[O]=!0):(this.state[O]=1,b=!1,h[O]===void 0&&(h[O]=!0),f[O]===void 0&&(f[O]=!0),y[v]===void 0&&(y[v]=!0)))}),b||(g[m]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(y)}}loaded(i,s,o){const c=i.split("|"),f=c[0],h=c[1];s&&this.emit("failedLoading",f,h,s),!s&&o&&this.store.addResourceBundle(f,h,o,void 0,void 0,{skipCopy:!0}),this.state[i]=s?-1:2,s&&o&&(this.state[i]=0);const g={};this.queue.forEach(y=>{yb(y.loaded,[f],h),Mb(y,i),s&&y.errors.push(s),y.pendingCount===0&&!y.done&&(Object.keys(y.loaded).forEach(m=>{g[m]||(g[m]={});const b=y.loaded[m];b.length&&b.forEach(v=>{g[m][v]===void 0&&(g[m][v]=!0)})}),y.done=!0,y.errors.length?y.callback(y.errors):y.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(y=>!y.done)}read(i,s,o,c=0,f=this.retryTimeout,h){if(!i.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:c,wait:f,callback:h});return}this.readingCalls++;const g=(m,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(m&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,i,s,o,c+1,f*2,h)},f);return}h(m,b)},y=this.backend[o].bind(this.backend);if(y.length===2){try{const m=y(i,s);m&&typeof m.then=="function"?m.then(b=>g(null,b)).catch(g):g(null,m)}catch(m){g(m)}return}return y(i,s,g)}prepareLoading(i,s,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();te(i)&&(i=this.languageUtils.toResolveHierarchy(i)),te(s)&&(s=[s]);const f=this.queueLoad(i,s,o,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(h=>{this.loadOne(h)})}load(i,s,o){this.prepareLoading(i,s,{},o)}reload(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}loadOne(i,s=""){const o=i.split("|"),c=o[0],f=o[1];this.read(c,f,"read",void 0,void 0,(h,g)=>{h&&this.logger.warn(`${s}loading namespace ${f} for language ${c} failed`,h),!h&&g&&this.logger.log(`${s}loaded namespace ${f} for language ${c}`,g),this.loaded(i,h,g)})}saveMissing(i,s,o,c,f,h={},g=()=>{}){var y,m,b,v,O;if((m=(y=this.services)==null?void 0:y.utils)!=null&&m.hasLoadedNamespace&&!((v=(b=this.services)==null?void 0:b.utils)!=null&&v.hasLoadedNamespace(s))){this.logger.warn(`did not save key "${o}" as the namespace "${s}" 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((O=this.backend)!=null&&O.create){const N={...h,isUpdate:f},A=this.backend.create.bind(this.backend);if(A.length<6)try{let H;A.length===5?H=A(i,s,o,c,N):H=A(i,s,o,c),H&&typeof H.then=="function"?H.then(k=>g(null,k)).catch(g):g(null,H)}catch(H){g(H)}else A(i,s,o,c,g,N)}!i||!i[0]||this.store.addResource(i[0],s,o,c)}}}const bo=()=>({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:l=>{let i={};if(typeof l[1]=="object"&&(i=l[1]),te(l[1])&&(i.defaultValue=l[1]),te(l[2])&&(i.tDescription=l[2]),typeof l[2]=="object"||typeof l[3]=="object"){const s=l[3]||l[2];Object.keys(s).forEach(o=>{i[o]=s[o]})}return i},interpolation:{escapeValue:!0,format:l=>l,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Mm=l=>{var i,s;return te(l.ns)&&(l.ns=[l.ns]),te(l.fallbackLng)&&(l.fallbackLng=[l.fallbackLng]),te(l.fallbackNS)&&(l.fallbackNS=[l.fallbackNS]),((s=(i=l.supportedLngs)==null?void 0:i.indexOf)==null?void 0:s.call(i,"cimode"))<0&&(l.supportedLngs=l.supportedLngs.concat(["cimode"])),typeof l.initImmediate=="boolean"&&(l.initAsync=l.initImmediate),l},Au=()=>{},Lb=l=>{Object.getOwnPropertyNames(Object.getPrototypeOf(l)).forEach(s=>{typeof l[s]=="function"&&(l[s]=l[s].bind(l))})},vg="__i18next_supportNoticeShown",jb=()=>!!(typeof globalThis<"u"&&globalThis[vg]||typeof process<"u"&&po&&po.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&po),wb=()=>{typeof globalThis<"u"&&(globalThis[vg]=!0)},Ub=l=>{var i,s,o,c,f,h,g,y,m,b,v,O,N;return!!(((o=(s=(i=l==null?void 0:l.modules)==null?void 0:i.backend)==null?void 0:s.name)==null?void 0:o.indexOf("Locize"))>0||((g=(h=(f=(c=l==null?void 0:l.modules)==null?void 0:c.backend)==null?void 0:f.constructor)==null?void 0:h.name)==null?void 0:g.indexOf("Locize"))>0||(m=(y=l==null?void 0:l.options)==null?void 0:y.backend)!=null&&m.backends&&l.options.backend.backends.some(A=>{var H,k,Y;return((H=A==null?void 0:A.name)==null?void 0:H.indexOf("Locize"))>0||((Y=(k=A==null?void 0:A.constructor)==null?void 0:k.name)==null?void 0:Y.indexOf("Locize"))>0})||(v=(b=l==null?void 0:l.options)==null?void 0:b.backend)!=null&&v.projectId||(N=(O=l==null?void 0:l.options)==null?void 0:O.backend)!=null&&N.backendOptions&&l.options.backend.backendOptions.some(A=>A==null?void 0:A.projectId))};class ei extends qu{constructor(i={},s){if(super(),this.options=Mm(i),this.services={},this.logger=Jt,this.modules={external:[]},Lb(this),s&&!this.isInitialized&&!i.isClone){if(!this.options.initAsync)return this.init(i,s),this;setTimeout(()=>{this.init(i,s)},0)}}init(i={},s){this.isInitializing=!0,typeof i=="function"&&(s=i,i={}),i.defaultNS==null&&i.ns&&(te(i.ns)?i.defaultNS=i.ns:i.ns.indexOf("translation")<0&&(i.defaultNS=i.ns[0]));const o=bo();this.options={...o,...this.options,...Mm(i)},this.options.interpolation={...o.interpolation,...this.options.interpolation},i.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=i.keySeparator),i.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=i.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Ub(this)&&!jb()&&(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 💙"),wb());const c=m=>m?typeof m=="function"?new m:m:null;if(!this.options.isClone){this.modules.logger?Jt.init(c(this.modules.logger),this.options):Jt.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:m=Nb;const b=new Om(this.options);this.store=new Tm(this.options.resources,this.options);const v=this.services;v.logger=Jt,v.resourceStore=this.store,v.languageUtils=b,v.pluralResolver=new _b(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 zm(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new Db(c(this.modules.backend),v.resourceStore,v,this.options),v.backendConnector.on("*",(N,...A)=>{this.emit(N,...A)}),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 wu(this.services,this.options),this.translator.on("*",(N,...A)=>{this.emit(N,...A)}),this.modules.external.forEach(N=>{N.init&&N.init(this)})}if(this.format=this.options.interpolation.format,s||(s=Au),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const m=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);m.length>0&&m[0]!=="dev"&&(this.options.lng=m[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(m=>{this[m]=(...b)=>this.store[m](...b)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(m=>{this[m]=(...b)=>(this.store[m](...b),this)});const g=Wl(),y=()=>{const m=(b,v)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(v),s(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?y():setTimeout(y,0),g}loadResources(i,s=Au){var f,h;let o=s;const c=te(i)?i:this.language;if(typeof i=="function"&&(o=i),!this.options.resources||this.options.partialBundledLanguages){if((c==null?void 0:c.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const g=[],y=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(v=>{v!=="cimode"&&g.indexOf(v)<0&&g.push(v)})};c?y(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>y(b)),(h=(f=this.options.preload)==null?void 0:f.forEach)==null||h.call(f,m=>y(m)),this.services.backendConnector.load(g,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(m)})}else o(null)}reloadResources(i,s,o){const c=Wl();return typeof i=="function"&&(o=i,i=void 0),typeof s=="function"&&(o=s,s=void 0),i||(i=this.languages),s||(s=this.options.ns),o||(o=Au),this.services.backendConnector.reload(i,s,f=>{c.resolve(),o(f)}),c}use(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&pg.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}setResolvedLanguage(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1)){for(let s=0;s<this.languages.length;s++){const o=this.languages[s];if(!(["cimode","dev"].indexOf(o)>-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(i)<0&&this.store.hasLanguageSomeTranslations(i)&&(this.resolvedLanguage=i,this.languages.unshift(i))}}changeLanguage(i,s){this.isLanguageChangingTo=i;const o=Wl();this.emit("languageChanging",i);const c=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},f=(g,y)=>{y?this.isLanguageChangingTo===i&&(c(y),this.translator.changeLanguage(y),this.isLanguageChangingTo=void 0,this.emit("languageChanged",y),this.logger.log("languageChanged",y)):this.isLanguageChangingTo=void 0,o.resolve((...m)=>this.t(...m)),s&&s(g,(...m)=>this.t(...m))},h=g=>{var b,v;!i&&!g&&this.services.languageDetector&&(g=[]);const y=te(g)?g:g&&g[0],m=this.store.hasLanguageSomeTranslations(y)?y:this.services.languageUtils.getBestMatchFromCodes(te(g)?[g]:g);m&&(this.language||c(m),this.translator.language||this.translator.changeLanguage(m),(v=(b=this.services.languageDetector)==null?void 0:b.cacheUserLanguage)==null||v.call(b,m)),this.loadResources(m,O=>{f(O,m)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!i&&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(i),o}getFixedT(i,s,o){const c=(f,h,...g)=>{let y;typeof h!="object"?y=this.options.overloadTranslationOptionHandler([f,h].concat(g)):y={...h},y.lng=y.lng||c.lng,y.lngs=y.lngs||c.lngs,y.ns=y.ns||c.ns,y.keyPrefix!==""&&(y.keyPrefix=y.keyPrefix||o||c.keyPrefix);const m={...this.options,...y};typeof y.keyPrefix=="function"&&(y.keyPrefix=Fn(y.keyPrefix,m));const b=this.options.keySeparator||".";let v;return y.keyPrefix&&Array.isArray(f)?v=f.map(O=>(typeof O=="function"&&(O=Fn(O,m)),`${y.keyPrefix}${b}${O}`)):(typeof f=="function"&&(f=Fn(f,m)),v=y.keyPrefix?`${y.keyPrefix}${b}${f}`:f),this.t(v,y)};return te(i)?c.lng=i:c.lngs=i,c.ns=s,c.keyPrefix=o,c}t(...i){var s;return(s=this.translator)==null?void 0:s.translate(...i)}exists(...i){var s;return(s=this.translator)==null?void 0:s.exists(...i)}setDefaultNamespace(i){this.options.defaultNS=i}hasLoadedNamespace(i,s={}){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=s.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const h=(g,y)=>{const m=this.services.backendConnector.state[`${g}|${y}`];return m===-1||m===0||m===2};if(s.precheck){const g=s.precheck(this,h);if(g!==void 0)return g}return!!(this.hasResourceBundle(o,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(o,i)&&(!c||h(f,i)))}loadNamespaces(i,s){const o=Wl();return this.options.ns?(te(i)&&(i=[i]),i.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),s&&s(c)}),o):(s&&s(),Promise.resolve())}loadLanguages(i,s){const o=Wl();te(i)&&(i=[i]);const c=this.options.preload||[],f=i.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(),s&&s(h)}),o):(s&&s(),Promise.resolve())}dir(i){var c,f;if(i||(i=this.resolvedLanguage||(((c=this.languages)==null?void 0:c.length)>0?this.languages[0]:this.language)),!i)return"rtl";try{const h=new Intl.Locale(i);if(h&&h.getTextInfo){const g=h.getTextInfo();if(g&&g.direction)return g.direction}}catch{}const s=["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 Om(bo());return i.toLowerCase().indexOf("-latn")>1?"ltr":s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(i={},s){const o=new ei(i,s);return o.createInstance=ei.createInstance,o}cloneInstance(i={},s=Au){const o=i.forkResourceStore;o&&delete i.forkResourceStore;const c={...this.options,...i,isClone:!0},f=new ei(c);if((i.debug!==void 0||i.prefix!==void 0)&&(f.logger=f.logger.clone(i)),["store","services","language"].forEach(g=>{f[g]=this[g]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const g=Object.keys(this.store.data).reduce((y,m)=>(y[m]={...this.store.data[m]},y[m]=Object.keys(y[m]).reduce((b,v)=>(b[v]={...y[m][v]},b),y[m]),y),{});f.store=new Tm(g,c),f.services.resourceStore=f.store}if(i.interpolation){const y={...bo().interpolation,...this.options.interpolation,...i.interpolation},m={...c,interpolation:y};f.services.interpolator=new zm(m)}return f.translator=new wu(f.services,c),f.translator.on("*",(g,...y)=>{f.emit(g,...y)}),f.init(c,s),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 Ze=ei.createInstance();Ze.createInstance;Ze.dir;Ze.init;Ze.loadResources;Ze.reloadResources;Ze.use;Ze.changeLanguage;Ze.getFixedT;Ze.t;Ze.exists;Ze.setDefaultNamespace;Ze.hasLoadedNamespace;Ze.loadNamespaces;Ze.loadLanguages;const ti="en",bg={en:()=>gt(()=>import("./en-CmAr_0e6.js"),[],import.meta.url),zh:()=>gt(()=>import("./zh-CcJ9vBZj.js"),[],import.meta.url),"zh-TW":()=>gt(()=>import("./zh-TW-elI72AC1.js"),[],import.meta.url),ja:()=>gt(()=>import("./ja-DtvtBRTW.js"),[],import.meta.url),es:()=>gt(()=>import("./es-Cs9x52ca.js"),[],import.meta.url)},Nu={};function Dm(l){return l in bg}function Sg(l){if(Dm(l))return l;const i=l.split("-")[0];return Dm(i)?i:ti}function Hb(){const l=localStorage.getItem("cc_lang");return Sg(l||navigator.language||ti)}async function Co(l){if(Nu[l])return;const i=await bg[l]();Nu[l]=i.default,Ze.isInitialized&&Ze.addResourceBundle(l,"translation",Nu[l],!0,!0)}async function Bb(){const l=Hb();await Promise.all([Co(ti),l===ti?Promise.resolve():Co(l)]),Ze.isInitialized||await Ze.use(B1).init({lng:l,fallbackLng:ti,resources:Object.fromEntries(Object.entries(Nu).map(([i,s])=>[i,{translation:s}])),interpolation:{escapeValue:!1}})}async function kb(l){const i=Sg(l);await Co(i),await Ze.changeLanguage(i),localStorage.setItem("cc_lang",i)}const Lm=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"zh-TW",label:"繁體中文"},{code:"ja",label:"日本語"},{code:"es",label:"Español"}],Yb=[{label:"Core",ids:["dashboard","chat","workspace","projects","sessions"]},{label:"Knowledge",ids:["knowledge","cron","monitors"]},{label:"System",ids:["system"]}];function qb(){var Y;const{pathname:l}=Ct(),{t:i,i18n:s}=G1(),{theme:o,setTheme:c}=mg(),f=Vo(),[h,g]=T.useState(!1),[y,m]=T.useState(!1),b=q=>{kb(q),m(!1)},v={light:wy,dark:Ny,system:Cy},O={light:"dark",dark:"system",system:"light"},N=v[o],A=Yu.listNavItems().filter(q=>{var K;return((K=q.visible)==null?void 0:K.call(q,{features:f}))??!0}),H=A.map(q=>{var ee;const K=q.icon,$=((ee=q.resolveLabelKey)==null?void 0:ee.call(q,{features:f}))||q.labelKey;return{...q,Icon:K,labelKey:$}}),k=l.startsWith("/chat");return j.jsxs(j.Fragment,{children:[j.jsxs("aside",{className:at("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",h?"w-16":"w-56"),children:[j.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"}),j.jsx("div",{className:at("relative flex h-[5.25rem] items-center gap-3 px-4 pt-7 transition-colors"),children:j.jsx(mb,{showWordmark:!h})}),j.jsx("nav",{className:"relative flex-1 py-3 space-y-4 px-2 overflow-y-auto",children:Yb.map(q=>{const K=A.filter($=>q.ids.includes($.id));return K.length===0?null:j.jsxs("div",{className:"space-y-1",children:[!h&&j.jsx("p",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/80",children:q.label}),K.map($=>{var J;const ee=$.icon,se=((J=$.resolveLabelKey)==null?void 0:J.call($,{features:f}))||$.labelKey;return j.jsxs(To,{to:$.path,end:$.end,className:({isActive:ne})=>at("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",ne?"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:[j.jsx(ee,{size:18,className:"shrink-0"}),!h&&j.jsx("span",{children:i(se)})]},$.id)})]},q.label)})}),j.jsxs("div",{className:at("relative border-t p-2 space-y-1","border-black/10 dark:border-white/[0.08]"),children:[!h&&j.jsxs("div",{className:"px-3 pb-1 pt-0.5 text-[11px] font-medium text-muted-foreground/75",children:["AgentDock v","0.1.57"]}),j.jsxs("div",{className:"relative",children:[j.jsxs("button",{type:"button",onClick:()=>m(!y),className:at("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:[j.jsx(vy,{size:18,className:"shrink-0"}),!h&&j.jsx("span",{children:((Y=Lm.find(q=>q.code===s.language))==null?void 0:Y.label)||"English"})]}),y&&j.jsx("div",{className:at("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:Lm.map(q=>j.jsx("button",{type:"button",onClick:()=>b(q.code),className:at("w-full text-left px-3 py-2 text-sm transition-colors duration-150",s.language===q.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:q.label},q.code))})]}),j.jsxs("button",{type:"button",onClick:()=>c(O[o]),className:at("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:[j.jsx(N,{size:18,className:"shrink-0"}),!h&&j.jsx("span",{children:i(`theme.${o}`)})]}),j.jsx("button",{type:"button",onClick:()=>g(!h),className:at("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:h?j.jsx(dy,{size:18}):j.jsx(cy,{size:18})})]})]}),k?null:j.jsx("nav",{className:at("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:j.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:H.map(({id:q,path:K,end:$,Icon:ee,labelKey:se})=>j.jsxs(To,{to:K,end:$,className:({isActive:J})=>at("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",J?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[j.jsx(ee,{size:18,className:"shrink-0"}),j.jsx("span",{className:"max-w-[4.25rem] truncate",children:i(se)})]},q))})})]})}function Vb(){const{pathname:l}=Ct(),{desktopChat:i}=Vo(),s=l.startsWith("/chat"),o=l.startsWith("/chat")&&i;return j.jsxs("div",{className:at("flex h-[100dvh] overflow-hidden","bg-background/60 backdrop-blur-2xl"),children:[j.jsx("div",{className:"fixed left-0 right-0 top-0 z-50 hidden h-8 [-webkit-app-region:drag] md:block","aria-hidden":"true"}),j.jsx(qb,{}),j.jsx("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0 bg-background/45 backdrop-blur-2xl",children:j.jsx("main",{className:at("flex-1 min-h-0",o?"overflow-hidden":"overflow-y-auto",s?"p-4 pb-4 sm:p-6 sm:pb-6":"p-4 pb-24 sm:p-6 sm:pb-6"),children:j.jsx("div",{className:at(o&&"h-full min-h-0","mx-auto w-full max-w-7xl"),children:j.jsx(Xv,{})})})})]})}function Gb(){return j.jsx("div",{className:"flex min-h-64 items-center justify-center text-sm text-muted-foreground",children:"正在加载…"})}function Kb(){const l=Vo();return j.jsx(T.Suspense,{fallback:j.jsx(Gb,{}),children:j.jsxs(Zv,{children:[j.jsxs(Jn,{element:j.jsx(Vb,{}),children:[Yu.listRoutes().map(i=>i.index?j.jsx(Jn,{index:!0,element:i.element({features:l})},i.id):j.jsx(Jn,{path:i.path,element:i.element({features:l})},i.id)),j.jsx(Jn,{path:"*",element:j.jsx(Wn,{to:"/",replace:!0})})]}),j.jsx(Jn,{path:"*",element:j.jsx(Wn,{to:"/",replace:!0})})]})})}class Xb extends $n.Component{constructor(){super(...arguments);Ru(this,"state",{hasError:!1,errorMessage:""})}static getDerivedStateFromError(s){return{hasError:!0,errorMessage:s instanceof Error?s.message:String(s)}}componentDidCatch(s,o){console.error("App render failed",s,o)}render(){return this.state.hasError?j.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:j.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:[j.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"页面渲染失败"}),j.jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-400 break-words",children:this.state.errorMessage||"Unknown renderer error"}),j.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}}function jm(l,i){if(typeof l=="function")return l(i);l!=null&&(l.current=i)}function xg(...l){return i=>{let s=!1;const o=l.map(c=>{const f=jm(c,i);return!s&&typeof f=="function"&&(s=!0),f});if(s)return()=>{for(let c=0;c<o.length;c++){const f=o[c];typeof f=="function"?f():jm(l[c],null)}}}}function jS(...l){return T.useCallback(xg(...l),l)}var Qb=Symbol.for("react.lazy"),Uu=ay[" use ".trim().toString()];function Zb(l){return typeof l=="object"&&l!==null&&"then"in l}function Eg(l){return l!=null&&typeof l=="object"&&"$$typeof"in l&&l.$$typeof===Qb&&"_payload"in l&&Zb(l._payload)}function Jb(l){const i=Fb(l),s=T.forwardRef((o,c)=>{let{children:f,...h}=o;Eg(f)&&typeof Uu=="function"&&(f=Uu(f._payload));const g=T.Children.toArray(f),y=g.find(Ib);if(y){const m=y.props.children,b=g.map(v=>v===y?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:v);return j.jsx(i,{...h,ref:c,children:T.isValidElement(m)?T.cloneElement(m,void 0,b):null})}return j.jsx(i,{...h,ref:c,children:f})});return s.displayName=`${l}.Slot`,s}var $b=Jb("Slot");function Fb(l){const i=T.forwardRef((s,o)=>{let{children:c,...f}=s;if(Eg(c)&&typeof Uu=="function"&&(c=Uu(c._payload)),T.isValidElement(c)){const h=eS(c),g=Pb(f,c.props);return c.type!==T.Fragment&&(g.ref=o?xg(o,h):h),T.cloneElement(c,g)}return T.Children.count(c)>1?T.Children.only(null):null});return i.displayName=`${l}.SlotClone`,i}var Wb=Symbol("radix.slottable");function Ib(l){return T.isValidElement(l)&&typeof l.type=="function"&&"__radixId"in l.type&&l.type.__radixId===Wb}function Pb(l,i){const s={...i};for(const o in i){const c=l[o],f=i[o];/^on[A-Z]/.test(o)?c&&f?s[o]=(...g)=>{const y=f(...g);return c(...g),y}:c&&(s[o]=c):o==="style"?s[o]={...c,...f}:o==="className"&&(s[o]=[c,f].filter(Boolean).join(" "))}return{...l,...s}}function eS(l){var o,c;let i=(o=Object.getOwnPropertyDescriptor(l.props,"ref"))==null?void 0:o.get,s=i&&"isReactWarning"in i&&i.isReactWarning;return s?l.ref:(i=(c=Object.getOwnPropertyDescriptor(l,"ref"))==null?void 0:c.get,s=i&&"isReactWarning"in i&&i.isReactWarning,s?l.props.ref:l.props.ref||l.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"},aS={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 wm({variant:l="primary",size:i="md",className:s,children:o,loading:c,asChild:f,disabled:h,type:g="button",...y}){const m=i==="default"?"md":i,b=f?$b:"button";return j.jsxs(b,{...f?{}:{type:g},className:at("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[l],aS[m],s),disabled:h||c,...y,children:[c&&j.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24","aria-hidden":!0,children:[j.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),j.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o]})}const zo="http://127.0.0.1:9831",nS=`${zo}/api/local/v1`,lS=["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"];function Tg(l){return(l.trim()||nS).replace(/\/+$/,"")}function it(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function X(l,i){return typeof l[i]=="string"}function el(l,i){return typeof l[i]=="boolean"}function Il(l,i){return it(l[i])}function Rg(l){return it(l)&&X(l,"type")&&X(l,"channelId")}function iS(l){if(!it(l))return!1;const i=l.value;return X(l,"metric")&&X(l,"operator")&&(typeof i=="number"||typeof i=="string"||typeof i=="boolean")}function uS(l){return it(l)&&X(l,"id")&&X(l,"workspaceId")&&X(l,"title")&&el(l,"live")&&X(l,"updatedAt")&&X(l,"createdAt")&&typeof l.historyCount=="number"&&X(l,"excerpt")}function rS(l){return it(l)&&X(l,"id")&&X(l,"role")&&X(l,"content")&&X(l,"timestamp")}function sS(l){return it(l)?(l.id===void 0||typeof l.id=="string")&&(l.role===void 0||["user","assistant","system"].includes(l.role))&&(l.content===void 0||typeof l.content=="string")&&(l.timestamp===void 0||typeof l.timestamp=="string"):!1}function oS(l){return it(l)&&X(l,"id")&&X(l,"threadId")&&X(l,"status")&&X(l,"startedAt")&&X(l,"updatedAt")}function cS(l){return it(l)&&X(l,"id")&&X(l,"workspaceId")&&X(l,"platform")&&Rg(l.route)&&X(l,"executionMode")&&X(l,"triggerType")&&X(l,"promptTemplate")&&X(l,"description")&&el(l,"enabled")&&X(l,"concurrencyPolicy")&&X(l,"createdAt")&&X(l,"updatedAt")}function fS(l){return it(l)&&X(l,"id")&&X(l,"jobId")&&X(l,"status")&&X(l,"triggeredAt")}function dS(l){return it(l)&&X(l,"id")&&X(l,"workspaceId")&&X(l,"title")&&X(l,"sourceType")&&Il(l,"sourceConfig")&&iS(l.condition)&&X(l,"promptTemplate")&&X(l,"platform")&&Rg(l.route)&&X(l,"executionMode")&&el(l,"enabled")&&typeof l.cooldownMs=="number"&&X(l,"concurrencyPolicy")&&X(l,"createdAt")&&X(l,"updatedAt")}function hS(l){return it(l)&&X(l,"id")&&X(l,"monitorId")&&X(l,"status")&&X(l,"triggeredAt")}function Um(l){return it(l)&&X(l,"agentType")&&X(l,"runtimeId")&&X(l,"displayName")&&X(l,"status")&&el(l,"installed")&&X(l,"detectedAt")&&X(l,"summary")&&Array.isArray(l.issues)&&Array.isArray(l.recommendedActions)&&X(l,"source")}function mS(l){return it(l)&&l.mode==="desktop"&&X(l,"phase")&&el(l,"pendingRestart")&&Il(l,"service")&&Il(l,"roles")&&Il(l,"settings")&&Il(l,"runtimeConfig")&&Array.isArray(l.logs)&&l.logs.every(i=>typeof i=="string")}function Zn(l){return it(l)&&X(l,"type")}function gS(l){if(!it(l)||!X(l,"type"))return!1;switch(l.type){case"runtime.updated":return mS(l.runtime);case"runtime.detect.started":return X(l,"detectedAt");case"runtime.detect.completed":return X(l,"detectedAt")&&Array.isArray(l.runtimes)&&l.runtimes.every(Um);case"runtime.detect.failed":return X(l,"detectedAt")&&X(l,"error");case"runtime.status.changed":return Um(l.runtime);case"thread.updated":return uS(l.thread);case"thread.session.activated":return X(l,"workspaceId")&&X(l,"threadId")&&X(l,"reason");case"message.created":return X(l,"threadId")&&rS(l.message)&&(l.stream===void 0||Zn(l.stream));case"message.updated":return X(l,"threadId")&&sS(l.message)&&(l.stream===void 0||Zn(l.stream));case"run.updated":return oS(l.run)&&(l.stream===void 0||Zn(l.stream));case"scheduler.job.updated":return cS(l.job);case"scheduler.run.updated":return fS(l.run);case"automation.monitor.updated":return dS(l.monitor);case"automation.monitor.run.updated":return hS(l.run);case"presence.updated":return el(l,"live")&&(l.stream===void 0||Zn(l.stream));case"stream.updated":return Zn(l.stream);case"external.run.snapshot":return it(l.snapshot)&&X(l.snapshot,"runId");case"external.run.stream":return X(l,"runId")&&Zn(l.stream);default:return!1}}function pS(l){return l.type==="stream.updated"||(l.type==="message.created"||l.type==="message.updated"||l.type==="run.updated")&&l.stream?l.stream:null}const _u=new Map;function yS(l,i,s){const o=new Set,c=new Set;let f=null,h=null,g="disconnected";const y=N=>{g=N,c.forEach(A=>{try{A(N)}catch{}})},m=()=>{h!==null&&(i.cancelReconnect(h),h=null)},b=()=>{f==null||f.close(),f=null},v=()=>{m(),b(),s()},O=()=>{if(f||o.size===0&&c.size===0)return;const N=i.eventSourceFactory(`${l}/events`);f=N,N.onopen=()=>{f===N&&y("connected")};const A=H=>{try{const k=JSON.parse(H.data);gS(k)&&o.forEach(Y=>{try{Y(k)}catch{}})}catch{}};lS.forEach(H=>N.addEventListener(H,A)),N.onerror=()=>{f===N&&(b(),y("disconnected"),(o.size>0||c.size>0)&&h===null&&(h=i.scheduleReconnect(()=>{h=null,O()},1e3)))}};return{subscribe(N){const A=H=>N(H);return o.add(A),O(),()=>{o.delete(A)&&o.size===0&&c.size===0&&v()}},subscribeConnectionState(N){if(c.add(N),O(),g==="connected")try{N("connected")}catch{}return()=>{c.delete(N)&&o.size===0&&c.size===0&&v()}}}}function Hm(l,i){const s=_u.get(l);if(s)return s;let o;return o=yS(l,i,()=>{_u.get(l)===o&&_u.delete(l)}),_u.set(l,o),o}function vS(l){const i=Tg(l.baseUrl),s=l.fetchImpl||globalThis.fetch.bind(globalThis),o=l.eventSourceFactory||(b=>new EventSource(b)),c=l.scheduleReconnect||((b,v)=>setTimeout(b,v)),f=l.cancelReconnect||(b=>clearTimeout(b)),h=new Set,g=b=>{const O=Hm(i,{eventSourceFactory:o,scheduleReconnect:c,cancelReconnect:f}).subscribe(b);return h.add(O),()=>{h.delete(O),O()}};return{baseUrl:i,request:async(b,v,O)=>{const N=await s(`${i}${v}`,{method:b,headers:{"Content-Type":"application/json"},body:O===void 0?void 0:JSON.stringify(O)}),A=await N.json();if(!N.ok||!A.ok)throw new Error(A.error||`Local AI Core request failed: ${N.status}`);return A.data},async detect(b=350){var N;const v=new AbortController,O=setTimeout(()=>v.abort(),b);try{const A=await s(`${i}/health`,{signal:v.signal}),H=await A.json();return A.ok&&H.ok&&((N=H.data)==null?void 0:N.name)==="local-ai-core"}catch{return!1}finally{clearTimeout(O)}},events:{subscribe:g,subscribeConnectionState:b=>{const O=Hm(i,{eventSourceFactory:o,scheduleReconnect:c,cancelReconnect:f}).subscribeConnectionState(b);return h.add(O),()=>{h.delete(O),O()}},subscribeRuntime(b){return g(v=>{v.type==="runtime.updated"&&b(v.runtime)})},subscribeBridge(b){return g(v=>{const O=pS(v);O&&b(O)})},close(){const b=Array.from(h);h.clear(),b.forEach(v=>v())}}}}const No=Tg("/api/local/v1");No.endsWith("/api/local/v1")&&No.slice(0,-13);const Og=vS({baseUrl:No});function qe(l,i,s){return Og.request(l,i,s)}function Ag(l){const i=Object.entries(l).filter(([,o])=>o!==void 0&&o!=="");if(i.length===0)return"";const s=new URLSearchParams;for(const[o,c]of i)s.set(o,String(c));return`?${s.toString()}`}function bS(l){return Og.events.subscribe(l)}function SS(){return qe("GET","/runtime")}function wS(){return qe("POST","/runtime/service/start")}function US(){return qe("POST","/runtime/service/restart")}function xS(l){const i=Ag({limit:l});return qe("GET",`/runtime/logs${i}`)}function HS(l="sys",i=200){const s=Ag({level:l,limit:i});return qe("GET",`/logs${s}`)}function BS(){return qe("GET","/runtime/agent-runtimes")}function kS(){return qe("POST","/runtimes/refresh")}function YS(){return qe("GET","/diagnostics/errors")}function qS(){return qe("POST","/diagnostics/doctor")}function VS(){return qe("GET","/runtime/runtime-config")}function GS(l){return qe("POST","/runtime/runtime-config",{config:l})}function KS(l){return qe("POST","/runtime/settings",l)}function XS(){return qe("GET","/providers")}function QS(l){return qe("POST","/providers",l)}function ZS(l,i){return qe("PUT",`/providers/${encodeURIComponent(l)}`,i)}function JS(l){return qe("DELETE",`/providers/${encodeURIComponent(l)}`)}function $S(l={}){const i=new URLSearchParams;l.workspaceId&&i.set("workspace_id",l.workspaceId),l.runtimeId&&i.set("runtime_id",l.runtimeId),l.status&&i.set("status",Array.isArray(l.status)?l.status.join(","):l.status),l.limit&&i.set("limit",String(l.limit));const s=i.toString()?`?${i.toString()}`:"";return qe("GET",`/tasks${s}`)}function FS(l={}){const i=new URLSearchParams;l.workspaceId&&i.set("workspace_id",l.workspaceId),l.taskId&&i.set("task_id",l.taskId),l.status&&i.set("status",Array.isArray(l.status)?l.status.join(","):l.status),l.limit&&i.set("limit",String(l.limit));const s=i.toString()?`?${i.toString()}`:"";return qe("GET",`/approvals${s}`)}function WS(l={}){const i=new URLSearchParams;l.workspaceId&&i.set("workspace_id",l.workspaceId),l.taskId&&i.set("task_id",l.taskId),l.approvalId&&i.set("approval_id",l.approvalId),l.type&&i.set("type",Array.isArray(l.type)?l.type.join(","):l.type),l.limit&&i.set("limit",String(l.limit));const s=i.toString()?`?${i.toString()}`:"";return qe("GET",`/audit-events${s}`)}function Bm(){return qe("GET","/capabilities/snapshot")}function IS(){return qe("GET","/plugins/diagnostics")}function ES(l){return bS(i=>{i.type==="runtime.updated"&&l(i.runtime)})}const km=20,TS=500;function RS(l){return new Promise(i=>window.setTimeout(i,l))}function OS(){const l=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-${l}`)}function AS(){return j.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:j.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:[j.jsx(Vm,{size:16,className:"animate-spin"}),"正在初始化 AgentDock 运行时…"]})})}function _S({message:l,logs:i,onRetry:s}){return j.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:j.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:[j.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:j.jsxs("div",{className:"flex items-start gap-3",children:[j.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:j.jsx(Hy,{size:18})}),j.jsxs("div",{children:[j.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"AgentDock 运行时初始化失败"}),j.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 break-words",children:l})]})]})}),j.jsxs("div",{className:"px-6 py-5 space-y-4",children:[j.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:[j.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"What we can do next"}),j.jsx("p",{className:"mt-1",children:"请先重试本地运行时初始化。如果仍然失败,请检查下方运行时日志,并确认 Local AI Core 配置文件路径与运行环境是否正确。"})]}),i.length>0&&j.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:[j.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"最近的桌面日志"}),j.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:i.join(`
|
|
166
|
+
Please change the parent <Route path="${Y}"> to <Route path="${Y==="/"?"*":`${Y}/*`}">.`)}let b=Ct(),v;if(i){let Y=typeof i=="string"?sn(i):i;je(y==="/"||((k=Y.pathname)==null?void 0:k.startsWith(y)),`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 "${y}" but pathname "${Y.pathname}" was given in the \`location\` prop.`),v=Y}else v=b;let O=v.pathname||"/",N=O;if(y!=="/"){let Y=y.replace(/^\//,"").split("/");N="/"+O.replace(/^\//,"").split("/").slice(Y.length).join("/")}let A=Gm(l,{pathname:N});At(m||A!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),At(A==null||A[A.length-1].route.element!==void 0||A[A.length-1].route.Component!==void 0||A[A.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=Hv(A&&A.map(Y=>Object.assign({},Y,{params:Object.assign({},h,Y.params),pathname:Gt([y,o.encodeLocation?o.encodeLocation(Y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:Y.pathname]),pathnameBase:Y.pathnameBase==="/"?y:Gt([y,o.encodeLocation?o.encodeLocation(Y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:Y.pathnameBase])})),c,s);return i&&H?T.createElement(li.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},H):H}function Lv(){let l=Vv(),i=vv(l)?`${l.status} ${l.statusText}`:l instanceof Error?l.message:JSON.stringify(l),s=l instanceof Error?l.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:",l),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"}},i),s?T.createElement("pre",{style:c},s):null,h)}var jv=T.createElement(Lv,null),ng=class extends T.Component{constructor(l){super(l),this.state={location:l.location,revalidation:l.revalidation,error:l.error}}static getDerivedStateFromError(l){return{error:l}}static getDerivedStateFromProps(l,i){return i.location!==l.location||i.revalidation!=="idle"&&l.revalidation==="idle"?{error:l.error,location:l.location,revalidation:l.revalidation}:{error:l.error!==void 0?l.error:i.error,location:i.location,revalidation:l.revalidation||i.revalidation}}componentDidCatch(l,i){this.props.onError?this.props.onError(l,i):console.error("React Router caught the following error during render",l)}render(){let l=this.state.error;if(this.context&&typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){const s=_v(l.digest);s&&(l=s)}let i=l!==void 0?T.createElement(kt.Provider,{value:this.props.routeContext},T.createElement(Lo.Provider,{value:l,children:this.props.component})):this.props.children;return this.context?T.createElement(wv,{error:l},i):i}};ng.contextType=Fm;var mo=new WeakMap;function wv({children:l,error:i}){let{basename:s}=T.useContext(_t);if(typeof i=="object"&&i&&"digest"in i&&typeof i.digest=="string"){let o=Av(i.digest);if(o){let c=mo.get(i);if(c)throw c;let f=Jm(o.location,s);if(Zm&&!mo.get(i))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 mo.set(i,h),h}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return l}function Uv({routeContext:l,match:i,children:s}){let o=T.useContext(In);return o&&o.static&&o.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=i.route.id),T.createElement(kt.Provider,{value:l},s)}function Hv(l,i=[],s){let o=s==null?void 0:s.state;if(l==null){if(!o)return null;if(o.errors)l=o.matches;else if(i.length===0&&!o.initialized&&o.matches.length>0)l=o.matches;else return null}let c=l,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);je(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),c=c.slice(0,Math.min(c.length,b+1))}let h=!1,g=-1;if(s&&o){h=o.renderFallback;for(let b=0;b<c.length;b++){let v=c[b];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=b),v.route.id){let{loaderData:O,errors:N}=o,A=v.route.loader&&!O.hasOwnProperty(v.route.id)&&(!N||N[v.route.id]===void 0);if(v.route.lazy||A){s.isStatic&&(h=!0),g>=0?c=c.slice(0,g+1):c=[c[0]];break}}}}let y=s==null?void 0:s.onError,m=o&&y?(b,v)=>{var O,N;y(b,{location:o.location,params:((N=(O=o.matches)==null?void 0:O[0])==null?void 0:N.params)??{},unstable_pattern:bv(o.matches),errorInfo:v})}:void 0;return c.reduceRight((b,v,O)=>{let N,A=!1,H=null,k=null;o&&(N=f&&v.route.id?f[v.route.id]:void 0,H=v.route.errorElement||jv,h&&(g<0&&O===0?(lg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),A=!0,k=null):g===O&&(A=!0,k=v.route.hydrateFallbackElement||null)));let Y=i.concat(c.slice(0,O+1)),q=()=>{let K;return N?K=H:A?K=k:v.route.Component?K=T.createElement(v.route.Component,null):v.route.element?K=v.route.element:K=b,T.createElement(Uv,{match:v,routeContext:{outlet:b,matches:Y,isDataRoute:o!=null},children:K})};return o&&(v.route.ErrorBoundary||v.route.errorElement||O===0)?T.createElement(ng,{location:o.location,revalidation:o.revalidation,component:H,error:N,children:q(),routeContext:{outlet:null,matches:Y,isDataRoute:!0},onError:m}):q()},null)}function wo(l){return`${l} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bv(l){let i=T.useContext(In);return je(i,wo(l)),i}function kv(l){let i=T.useContext(Bu);return je(i,wo(l)),i}function Yv(l){let i=T.useContext(kt);return je(i,wo(l)),i}function Uo(l){let i=Yv(l),s=i.matches[i.matches.length-1];return je(s.route.id,`${l} can only be used on routes that contain a unique "id"`),s.route.id}function qv(){return Uo("useRouteId")}function Vv(){var o;let l=T.useContext(Lo),i=kv("useRouteError"),s=Uo("useRouteError");return l!==void 0?l:(o=i.errors)==null?void 0:o[s]}function Gv(){let{router:l}=Bv("useNavigate"),i=Uo("useNavigate"),s=T.useRef(!1);return eg(()=>{s.current=!0}),T.useCallback(async(c,f={})=>{At(s.current,Pm),s.current&&(typeof c=="number"?await l.navigate(c):await l.navigate(c,{fromRouteId:i,...f}))},[l,i])}var rm={};function lg(l,i,s){!i&&!rm[l]&&(rm[l]=!0,At(!1,s))}T.memo(Kv);function Kv({routes:l,future:i,state:s,isStatic:o,onError:c}){return ag(l,void 0,{state:s,isStatic:o,onError:c})}function Wn({to:l,replace:i,state:s,relative:o}){je(Pn(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=T.useContext(_t);At(!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(kt),{pathname:h}=Ct(),g=jo(),y=Hu(l,Do(f),h,o==="path"),m=JSON.stringify(y);return T.useEffect(()=>{g(JSON.parse(m),{replace:i,state:s,relative:o})},[g,m,o,i,s]),null}function Xv(l){return Mv(l.context)}function Jn(l){je(!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 Qv({basename:l="/",children:i=null,location:s,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:h}){je(!Pn(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let g=l.replace(/^\/*/,"/"),y=T.useMemo(()=>({basename:g,navigator:c,static:f,unstable_useTransitions:h,future:{}}),[g,c,f,h]);typeof s=="string"&&(s=sn(s));let{pathname:m="/",search:b="",hash:v="",state:O=null,key:N="default",unstable_mask:A}=s,H=T.useMemo(()=>{let k=ha(m,g);return k==null?null:{location:{pathname:k,search:b,hash:v,state:O,key:N,unstable_mask:A},navigationType:o}},[g,m,b,v,O,N,o,A]);return At(H!=null,`<Router basename="${g}"> is not able to match the URL "${m}${b}${v}" because it does not start with the basename, so the <Router> won't render anything.`),H==null?null:T.createElement(_t.Provider,{value:y},T.createElement(li.Provider,{children:i,value:H}))}function Zv({children:l,location:i}){return Dv(xo(l),i)}function xo(l,i=[]){let s=[];return T.Children.forEach(l,(o,c)=>{if(!T.isValidElement(o))return;let f=[...i,c];if(o.type===T.Fragment){s.push.apply(s,xo(o.props.children,f));return}je(o.type===Jn,`[${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>`),je(!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=xo(o.props.children,f)),s.push(h)}),s}var Cu="get",zu="application/x-www-form-urlencoded";function ku(l){return typeof HTMLElement<"u"&&l instanceof HTMLElement}function Jv(l){return ku(l)&&l.tagName.toLowerCase()==="button"}function $v(l){return ku(l)&&l.tagName.toLowerCase()==="form"}function Fv(l){return ku(l)&&l.tagName.toLowerCase()==="input"}function Wv(l){return!!(l.metaKey||l.altKey||l.ctrlKey||l.shiftKey)}function Iv(l,i){return l.button===0&&(!i||i==="_self")&&!Wv(l)}function Eo(l=""){return new URLSearchParams(typeof l=="string"||Array.isArray(l)||l instanceof URLSearchParams?l:Object.keys(l).reduce((i,s)=>{let o=l[s];return i.concat(Array.isArray(o)?o.map(c=>[s,c]):[[s,o]])},[]))}function Pv(l,i){let s=Eo(l);return i&&i.forEach((o,c)=>{s.has(c)||i.getAll(c).forEach(f=>{s.append(c,f)})}),s}var Ou=null;function e1(){if(Ou===null)try{new FormData(document.createElement("form"),0),Ou=!1}catch{Ou=!0}return Ou}var t1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function go(l){return l!=null&&!t1.has(l)?(At(!1,`"${l}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zu}"`),null):l}function a1(l,i){let s,o,c,f,h;if($v(l)){let g=l.getAttribute("action");o=g?ha(g,i):null,s=l.getAttribute("method")||Cu,c=go(l.getAttribute("enctype"))||zu,f=new FormData(l)}else if(Jv(l)||Fv(l)&&(l.type==="submit"||l.type==="image")){let g=l.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let y=l.getAttribute("formaction")||g.getAttribute("action");if(o=y?ha(y,i):null,s=l.getAttribute("formmethod")||g.getAttribute("method")||Cu,c=go(l.getAttribute("formenctype"))||go(g.getAttribute("enctype"))||zu,f=new FormData(g,l),!e1()){let{name:m,type:b,value:v}=l;if(b==="image"){let O=m?`${m}.`:"";f.append(`${O}x`,"0"),f.append(`${O}y`,"0")}else m&&f.append(m,v)}}else{if(ku(l))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=Cu,o=null,c=zu,h=l}return f&&c==="text/plain"&&(h=f,f=void 0),{action:o,method:s.toLowerCase(),encType:c,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ho(l,i){if(l===!1||l===null||typeof l>"u")throw new Error(i)}function ig(l,i,s,o){let c=typeof l=="string"?new URL(l,typeof window>"u"?"server://singlefetch/":window.location.origin):l;return s?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:i&&ha(c.pathname,i)==="/"?c.pathname=`${Du(i)}/_root.${o}`:c.pathname=`${Du(c.pathname)}.${o}`,c}async function n1(l,i){if(l.id in i)return i[l.id];try{let s=await import(l.module);return i[l.id]=s,s}catch(s){return console.error(`Error loading route module \`${l.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function l1(l){return l==null?!1:l.href==null?l.rel==="preload"&&typeof l.imageSrcSet=="string"&&typeof l.imageSizes=="string":typeof l.rel=="string"&&typeof l.href=="string"}async function i1(l,i,s){let o=await Promise.all(l.map(async c=>{let f=i.routes[c.route.id];if(f){let h=await n1(f,s);return h.links?h.links():[]}return[]}));return o1(o.flat(1).filter(l1).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function sm(l,i,s,o,c,f){let h=(y,m)=>s[m]?y.route.id!==s[m].route.id:!0,g=(y,m)=>{var b;return s[m].pathname!==y.pathname||((b=s[m].route.path)==null?void 0:b.endsWith("*"))&&s[m].params["*"]!==y.params["*"]};return f==="assets"?i.filter((y,m)=>h(y,m)||g(y,m)):f==="data"?i.filter((y,m)=>{var v;let b=o.routes[y.route.id];if(!b||!b.hasLoader)return!1;if(h(y,m)||g(y,m))return!0;if(y.route.shouldRevalidate){let O=y.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=s[0])==null?void 0:v.params)||{},nextUrl:new URL(l,window.origin),nextParams:y.params,defaultShouldRevalidate:!0});if(typeof O=="boolean")return O}return!0}):[]}function u1(l,i,{includeHydrateFallback:s}={}){return r1(l.map(o=>{let c=i.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)),s&&c.hydrateFallbackModule&&(f=f.concat(c.hydrateFallbackModule)),c.imports&&(f=f.concat(c.imports)),f}).flat(1))}function r1(l){return[...new Set(l)]}function s1(l){let i={},s=Object.keys(l).sort();for(let o of s)i[o]=l[o];return i}function o1(l,i){let s=new Set;return new Set(i),l.reduce((o,c)=>{let f=JSON.stringify(s1(c));return s.has(f)||(s.add(f),o.push({key:f,link:c})),o},[])}function Bo(){let l=T.useContext(In);return Ho(l,"You must render this element inside a <DataRouterContext.Provider> element"),l}function c1(){let l=T.useContext(Bu);return Ho(l,"You must render this element inside a <DataRouterStateContext.Provider> element"),l}var ko=T.createContext(void 0);ko.displayName="FrameworkContext";function Yo(){let l=T.useContext(ko);return Ho(l,"You must render this element inside a <HydratedRouter> element"),l}function f1(l,i){let s=T.useContext(ko),[o,c]=T.useState(!1),[f,h]=T.useState(!1),{onFocus:g,onBlur:y,onMouseEnter:m,onMouseLeave:b,onTouchStart:v}=i,O=T.useRef(null);T.useEffect(()=>{if(l==="render"&&h(!0),l==="viewport"){let H=Y=>{Y.forEach(q=>{h(q.isIntersecting)})},k=new IntersectionObserver(H,{threshold:.5});return O.current&&k.observe(O.current),()=>{k.disconnect()}}},[l]),T.useEffect(()=>{if(o){let H=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(H)}}},[o]);let N=()=>{c(!0)},A=()=>{c(!1),h(!1)};return s?l!=="intent"?[f,O,{}]:[f,O,{onFocus:Fl(g,N),onBlur:Fl(y,A),onMouseEnter:Fl(m,N),onMouseLeave:Fl(b,A),onTouchStart:Fl(v,N)}]:[!1,O,{}]}function Fl(l,i){return s=>{l&&l(s),s.defaultPrevented||i(s)}}function d1({page:l,...i}){let s=xv(),{router:o}=Bo(),c=T.useMemo(()=>Gm(o.routes,l,o.basename),[o.routes,l,o.basename]);return c?s?T.createElement(m1,{page:l,matches:c,...i}):T.createElement(g1,{page:l,matches:c,...i}):null}function h1(l){let{manifest:i,routeModules:s}=Yo(),[o,c]=T.useState([]);return T.useEffect(()=>{let f=!1;return i1(l,i,s).then(h=>{f||c(h)}),()=>{f=!0}},[l,i,s]),o}function m1({page:l,matches:i,...s}){let o=Ct(),{future:c}=Yo(),{basename:f}=Bo(),h=T.useMemo(()=>{if(l===o.pathname+o.search+o.hash)return[];let g=ig(l,f,c.unstable_trailingSlashAwareDataRequests,"rsc"),y=!1,m=[];for(let b of i)typeof b.route.shouldRevalidate=="function"?y=!0:m.push(b.route.id);return y&&m.length>0&&g.searchParams.set("_routes",m.join(",")),[g.pathname+g.search]},[f,c.unstable_trailingSlashAwareDataRequests,l,o,i]);return T.createElement(T.Fragment,null,h.map(g=>T.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...s})))}function g1({page:l,matches:i,...s}){let o=Ct(),{future:c,manifest:f,routeModules:h}=Yo(),{basename:g}=Bo(),{loaderData:y,matches:m}=c1(),b=T.useMemo(()=>sm(l,i,m,f,o,"data"),[l,i,m,f,o]),v=T.useMemo(()=>sm(l,i,m,f,o,"assets"),[l,i,m,f,o]),O=T.useMemo(()=>{if(l===o.pathname+o.search+o.hash)return[];let H=new Set,k=!1;if(i.forEach(q=>{var $;let K=f.routes[q.route.id];!K||!K.hasLoader||(!b.some(ee=>ee.route.id===q.route.id)&&q.route.id in y&&(($=h[q.route.id])!=null&&$.shouldRevalidate)||K.hasClientLoader?k=!0:H.add(q.route.id))}),H.size===0)return[];let Y=ig(l,g,c.unstable_trailingSlashAwareDataRequests,"data");return k&&H.size>0&&Y.searchParams.set("_routes",i.filter(q=>H.has(q.route.id)).map(q=>q.route.id).join(",")),[Y.pathname+Y.search]},[g,c.unstable_trailingSlashAwareDataRequests,y,o,f,b,i,l,h]),N=T.useMemo(()=>u1(v,f),[v,f]),A=h1(v);return T.createElement(T.Fragment,null,O.map(H=>T.createElement("link",{key:H,rel:"prefetch",as:"fetch",href:H,...s})),N.map(H=>T.createElement("link",{key:H,rel:"modulepreload",href:H,...s})),A.map(({key:H,link:k})=>T.createElement("link",{key:H,nonce:s.nonce,...k,crossOrigin:k.crossOrigin??s.crossOrigin})))}function p1(...l){return i=>{l.forEach(s=>{typeof s=="function"?s(i):s!=null&&(s.current=i)})}}var y1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{y1&&(window.__reactRouterVersion="7.14.2")}catch{}function v1({basename:l,children:i,unstable_useTransitions:s,window:o}){let c=T.useRef();c.current==null&&(c.current=Jy({window:o,v5Compat:!0}));let f=c.current,[h,g]=T.useState({action:f.action,location:f.location}),y=T.useCallback(m=>{s===!1?g(m):T.startTransition(()=>g(m))},[s]);return T.useLayoutEffect(()=>f.listen(y),[f,y]),T.createElement(Qv,{basename:l,children:i,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:s})}var ug=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,rg=T.forwardRef(function({onClick:i,discover:s="render",prefetch:o="none",relative:c,reloadDocument:f,replace:h,unstable_mask:g,state:y,target:m,to:b,preventScrollReset:v,viewTransition:O,unstable_defaultShouldRevalidate:N,...A},H){let{basename:k,navigator:Y,unstable_useTransitions:q}=T.useContext(_t),K=typeof b=="string"&&ug.test(b),$=Jm(b,k);b=$.to;let ee=Cv(b,{relative:c}),se=Ct(),J=null;if(g){let we=Hu(g,[],se.unstable_mask?se.unstable_mask.pathname:"/",!0);k!=="/"&&(we.pathname=we.pathname==="/"?k:Gt([k,we.pathname])),J=Y.createHref(we)}let[ne,re,de]=f1(o,A),Me=x1(b,{replace:h,unstable_mask:g,state:y,target:m,preventScrollReset:v,relative:c,viewTransition:O,unstable_defaultShouldRevalidate:N,unstable_useTransitions:q});function Je(we){i&&i(we),we.defaultPrevented||Me(we)}let Ce=!($.isExternal||f),De=T.createElement("a",{...A,...de,href:(Ce?J:void 0)||$.absoluteURL||ee,onClick:Ce?Je:i,ref:p1(H,re),target:m,"data-discover":!K&&s==="render"?"true":void 0});return ne&&!K?T.createElement(T.Fragment,null,De,T.createElement(d1,{page:ee})):De});rg.displayName="Link";var To=T.forwardRef(function({"aria-current":i="page",caseSensitive:s=!1,className:o="",end:c=!1,style:f,to:h,viewTransition:g,children:y,...m},b){let v=ii(h,{relative:m.relative}),O=Ct(),N=T.useContext(Bu),{navigator:A,basename:H}=T.useContext(_t),k=N!=null&&A1(v)&&g===!0,Y=A.encodeLocation?A.encodeLocation(v).pathname:v.pathname,q=O.pathname,K=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;s||(q=q.toLowerCase(),K=K?K.toLowerCase():null,Y=Y.toLowerCase()),K&&H&&(K=ha(K,H)||K);const $=Y!=="/"&&Y.endsWith("/")?Y.length-1:Y.length;let ee=q===Y||!c&&q.startsWith(Y)&&q.charAt($)==="/",se=K!=null&&(K===Y||!c&&K.startsWith(Y)&&K.charAt(Y.length)==="/"),J={isActive:ee,isPending:se,isTransitioning:k},ne=ee?i:void 0,re;typeof o=="function"?re=o(J):re=[o,ee?"active":null,se?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let de=typeof f=="function"?f(J):f;return T.createElement(rg,{...m,"aria-current":ne,className:re,ref:b,style:de,to:h,viewTransition:g},typeof y=="function"?y(J):y)});To.displayName="NavLink";var b1=T.forwardRef(({discover:l="render",fetcherKey:i,navigate:s,reloadDocument:o,replace:c,state:f,method:h=Cu,action:g,onSubmit:y,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:O,...N},A)=>{let{unstable_useTransitions:H}=T.useContext(_t),k=R1(),Y=O1(g,{relative:m}),q=h.toLowerCase()==="get"?"get":"post",K=typeof g=="string"&&ug.test(g),$=ee=>{if(y&&y(ee),ee.defaultPrevented)return;ee.preventDefault();let se=ee.nativeEvent.submitter,J=(se==null?void 0:se.getAttribute("formmethod"))||h,ne=()=>k(se||ee.currentTarget,{fetcherKey:i,method:J,navigate:s,replace:c,state:f,relative:m,preventScrollReset:b,viewTransition:v,unstable_defaultShouldRevalidate:O});H&&s!==!1?T.startTransition(()=>ne()):ne()};return T.createElement("form",{ref:A,method:q,action:Y,onSubmit:o?y:$,...N,"data-discover":!K&&l==="render"?"true":void 0})});b1.displayName="Form";function S1(l){return`${l} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sg(l){let i=T.useContext(In);return je(i,S1(l)),i}function x1(l,{target:i,replace:s,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:m}={}){let b=jo(),v=Ct(),O=ii(l,{relative:h});return T.useCallback(N=>{if(Iv(N,i)){N.preventDefault();let A=s!==void 0?s:ai(v)===ai(O),H=()=>b(l,{replace:A,unstable_mask:o,state:c,preventScrollReset:f,relative:h,viewTransition:g,unstable_defaultShouldRevalidate:y});m?T.startTransition(()=>H()):H()}},[v,b,O,s,o,c,i,l,f,h,g,y,m])}function MS(l){At(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 i=T.useRef(Eo(l)),s=T.useRef(!1),o=Ct(),c=T.useMemo(()=>Pv(o.search,s.current?null:i.current),[o.search]),f=jo(),h=T.useCallback((g,y)=>{const m=Eo(typeof g=="function"?g(new URLSearchParams(c)):g);s.current=!0,f("?"+m,y)},[f,c]);return[c,h]}var E1=0,T1=()=>`__${String(++E1)}__`;function R1(){let{router:l}=sg("useSubmit"),{basename:i}=T.useContext(_t),s=qv(),o=l.fetch,c=l.navigate;return T.useCallback(async(f,h={})=>{let{action:g,method:y,encType:m,formData:b,body:v}=a1(f,i);if(h.navigate===!1){let O=h.fetcherKey||T1();await o(O,s,h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||y,formEncType:h.encType||m,flushSync:h.flushSync})}else await c(h.action||g,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:b,body:v,formMethod:h.method||y,formEncType:h.encType||m,replace:h.replace,state:h.state,fromRouteId:s,flushSync:h.flushSync,viewTransition:h.viewTransition})},[o,c,i,s])}function O1(l,{relative:i}={}){let{basename:s}=T.useContext(_t),o=T.useContext(kt);je(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),f={...ii(l||".",{relative:i})},h=Ct();if(l==null){f.search=h.search;let g=new URLSearchParams(f.search),y=g.getAll("index");if(y.some(b=>b==="")){g.delete("index"),y.filter(v=>v).forEach(v=>g.append("index",v));let b=g.toString();f.search=b?`?${b}`:""}}return(!l||l===".")&&c.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(f.pathname=f.pathname==="/"?s:Gt([s,f.pathname])),ai(f)}function A1(l,{relative:i}={}){let s=T.useContext(Wm);je(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=sg("useViewTransitionState"),c=ii(l,{relative:i});if(!s.isTransitioning)return!1;let f=ha(s.currentLocation.pathname,o)||s.currentLocation.pathname,h=ha(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Mu(c.pathname,h)!=null||Mu(c.pathname,f)!=null}const _1=(l,i,s,o)=>{var f,h,g,y;const c=[s,{code:i,...o||{}}];if((h=(f=l==null?void 0:l.services)==null?void 0:f.logger)!=null&&h.forward)return l.services.logger.forward(c,"warn","react-i18next::",!0);rn(c[0])&&(c[0]=`react-i18next:: ${c[0]}`),(y=(g=l==null?void 0:l.services)==null?void 0:g.logger)!=null&&y.warn?l.services.logger.warn(...c):console!=null&&console.warn&&console.warn(...c)},om={},Ro=(l,i,s,o)=>{rn(s)&&om[s]||(rn(s)&&(om[s]=new Date),_1(l,i,s,o))},og=(l,i)=>()=>{if(l.isInitialized)i();else{const s=()=>{setTimeout(()=>{l.off("initialized",s)},0),i()};l.on("initialized",s)}},Oo=(l,i,s)=>{l.loadNamespaces(i,og(l,s))},cm=(l,i,s,o)=>{if(rn(s)&&(s=[s]),l.options.preload&&l.options.preload.indexOf(i)>-1)return Oo(l,s,o);s.forEach(c=>{l.options.ns.indexOf(c)<0&&l.options.ns.push(c)}),l.loadLanguages(i,og(l,o))},C1=(l,i,s={})=>!i.languages||!i.languages.length?(Ro(i,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:i.languages}),!0):i.hasLoadedNamespace(l,{lng:s.lng,precheck:(o,c)=>{if(s.bindI18n&&s.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!c(o.isLanguageChangingTo,l))return!1}}),rn=l=>typeof l=="string",z1=l=>typeof l=="object"&&l!==null,N1=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,M1={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},D1=l=>M1[l],L1=l=>l.replace(N1,D1);let Ao={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:L1};const j1=(l={})=>{Ao={...Ao,...l}},w1=()=>Ao;let cg;const U1=l=>{cg=l},H1=()=>cg,B1={type:"3rdParty",init(l){j1(l.options.react),U1(l)}},k1=T.createContext();class Y1{constructor(){this.usedNamespaces={}}addUsedNamespaces(i){i.forEach(s=>{this.usedNamespaces[s]||(this.usedNamespaces[s]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const q1=(l,i)=>{const s=T.useRef();return T.useEffect(()=>{s.current=l},[l,i]),s.current},fg=(l,i,s,o)=>l.getFixedT(i,s,o),V1=(l,i,s,o)=>T.useCallback(fg(l,i,s,o),[l,i,s,o]),G1=(l,i={})=>{var $,ee,se,J;const{i18n:s}=i,{i18n:o,defaultNS:c}=T.useContext(k1)||{},f=s||o||H1();if(f&&!f.reportNamespaces&&(f.reportNamespaces=new Y1),!f){Ro(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const ne=(de,Me)=>rn(Me)?Me:z1(Me)&&rn(Me.defaultValue)?Me.defaultValue:Array.isArray(de)?de[de.length-1]:de,re=[ne,{},!1];return re.t=ne,re.i18n={},re.ready=!1,re}($=f.options.react)!=null&&$.wait&&Ro(f,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const h={...w1(),...f.options.react,...i},{useSuspense:g,keyPrefix:y}=h;let m=c||((ee=f.options)==null?void 0:ee.defaultNS);m=rn(m)?[m]:m||["translation"],(J=(se=f.reportNamespaces).addUsedNamespaces)==null||J.call(se,m);const b=(f.isInitialized||f.initializedStoreOnce)&&m.every(ne=>C1(ne,f,h)),v=V1(f,i.lng||null,h.nsMode==="fallback"?m:m[0],y),O=()=>v,N=()=>fg(f,i.lng||null,h.nsMode==="fallback"?m:m[0],y),[A,H]=T.useState(O);let k=m.join();i.lng&&(k=`${i.lng}${k}`);const Y=q1(k),q=T.useRef(!0);T.useEffect(()=>{const{bindI18n:ne,bindI18nStore:re}=h;q.current=!0,!b&&!g&&(i.lng?cm(f,i.lng,m,()=>{q.current&&H(N)}):Oo(f,m,()=>{q.current&&H(N)})),b&&Y&&Y!==k&&q.current&&H(N);const de=()=>{q.current&&H(N)};return ne&&(f==null||f.on(ne,de)),re&&(f==null||f.store.on(re,de)),()=>{q.current=!1,f&&ne&&(ne==null||ne.split(" ").forEach(Me=>f.off(Me,de))),re&&f&&re.split(" ").forEach(Me=>f.store.off(Me,de))}},[f,k]),T.useEffect(()=>{q.current&&b&&H(O)},[f,y,b]);const K=[A,f,b];if(K.t=A,K.i18n=f,K.ready=b,b||!b&&!g)return K;throw new Promise(ne=>{i.lng?cm(f,i.lng,m,()=>ne()):Oo(f,m,()=>ne())})};function dg(l){var i,s,o="";if(typeof l=="string"||typeof l=="number")o+=l;else if(typeof l=="object")if(Array.isArray(l)){var c=l.length;for(i=0;i<c;i++)l[i]&&(s=dg(l[i]))&&(o&&(o+=" "),o+=s)}else for(s in l)l[s]&&(o&&(o+=" "),o+=s);return o}function K1(){for(var l,i,s=0,o="",c=arguments.length;s<c;s++)(l=arguments[s])&&(i=dg(l))&&(o&&(o+=" "),o+=i);return o}function at(...l){return K1(l)}function DS(l){return l?new Date(l).toLocaleString():"-"}function LS(l,i="just now"){if(!l)return"";const s=Math.floor((Date.now()-new Date(l).getTime())/6e4);if(s<1)return i;if(s<60)return`${s}m`;const o=Math.floor(s/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}const fm=l=>{let i;const s=new Set,o=(m,b)=>{const v=typeof m=="function"?m(i):m;if(!Object.is(v,i)){const O=i;i=b??(typeof v!="object"||v===null)?v:Object.assign({},i,v),s.forEach(N=>N(i,O))}},c=()=>i,g={setState:o,getState:c,getInitialState:()=>y,subscribe:m=>(s.add(m),()=>s.delete(m))},y=i=l(o,c,g);return g},X1=(l=>l?fm(l):fm),Q1=l=>l;function Z1(l,i=Q1){const s=$n.useSyncExternalStore(l.subscribe,$n.useCallback(()=>i(l.getState()),[l,i]),$n.useCallback(()=>i(l.getInitialState()),[l,i]));return $n.useDebugValue(s),s}const dm=l=>{const i=X1(l),s=o=>Z1(i,o);return Object.assign(s,i),s},hg=(l=>l?dm(l):dm),qo=hg(l=>({snapshot:null,setSnapshot:i=>l({snapshot:i})}));function hm(l){qo.getState().setSnapshot(l)}function J1(){return qo.getState().snapshot}function $1(l){return!!(l!=null&&l.knowledge.some(i=>i.enabled!==!1))}function F1(l){return!!(l!=null&&l.schedulers.some(i=>i.enabled!==!1))}function W1(l){var i;return!!((i=l==null?void 0:l.monitors)!=null&&i.some(s=>s.enabled!==!1))}function mm(l){return!!(l!=null&&l.agents.some(i=>i.agentType))}function I1(l=J1()){const i=!!l,s=i?mm(l):!0;return{desktopRuntime:!0,desktopChat:s,chatRoute:i?s:!0,desktopWorkspace:i?mm(l):!0,knowledgeModule:i?$1(l):!0,schedulerModule:i?F1(l):!0,monitorModule:i?W1(l):!0}}function Vo(){const l=qo(i=>i.snapshot);return I1(l)}function gm(l){return l==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":l}function pm(l){document.documentElement.classList.toggle("dark",l==="dark")}const mg=hg(l=>({theme:"dark",resolved:"dark",setTheme:i=>{const s=gm(i);localStorage.setItem("cc_theme",i),pm(s),l({theme:i,resolved:s})},init:()=>{const i=localStorage.getItem("cc_theme")||"dark",s=gm(i);pm(s),l({theme:i,resolved:s})}})),P1="modulepreload",eb=function(l,i){return new URL(l,i).href},ym={},gt=function(i,s,o){let c=Promise.resolve();if(s&&s.length>0){let h=function(b){return Promise.all(b.map(v=>Promise.resolve(v).then(O=>({status:"fulfilled",value:O}),O=>({status:"rejected",reason:O}))))};const g=document.getElementsByTagName("link"),y=document.querySelector("meta[property=csp-nonce]"),m=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));c=h(s.map(b=>{if(b=eb(b,o),b in ym)return;ym[b]=!0;const v=b.endsWith(".css"),O=v?'[rel="stylesheet"]':"";if(!!o)for(let H=g.length-1;H>=0;H--){const k=g[H];if(k.href===b&&(!v||k.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${O}`))return;const A=document.createElement("link");if(A.rel=v?"stylesheet":P1,v||(A.as="script"),A.crossOrigin="",A.href=b,m&&A.setAttribute("nonce",m),document.head.appendChild(A),v)return new Promise((H,k)=>{A.addEventListener("load",H),A.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${b}`)))})}))}function f(h){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=h,window.dispatchEvent(g),!g.defaultPrevented)throw h}return c.then(h=>{for(const g of h||[])g.status==="rejected"&&f(g.reason);return i().catch(f)})},tb=T.lazy(()=>gt(()=>import("./Dashboard-nLZnOtcs.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),ab=T.lazy(()=>gt(()=>import("./ThreadChat-B5CWqqMK.js").then(l=>l.T),__vite__mapDeps([8,9,10,7,11,12,13,14,15,16,17,5]),import.meta.url)),nb=T.lazy(()=>gt(()=>import("./Workspace-C5g9LBj9.js"),__vite__mapDeps([18,12,13,11,19,10,3,4,1,9,16,20,21]),import.meta.url)),lb=T.lazy(()=>gt(()=>import("./CronList-CupZoNwW.js"),__vite__mapDeps([22,5,1,2,12,13,11,19,10,3,4,20,23,15,16]),import.meta.url)),ib=T.lazy(()=>gt(()=>import("./MonitorList-BlX82rXF.js"),__vite__mapDeps([24,5,1,2,12,13,11,19,10,3,4,20,23,15,16]),import.meta.url)),ub=T.lazy(()=>gt(()=>import("./Config-D1awc81A.js"),__vite__mapDeps([25,2,11,4,1,7,21]),import.meta.url)),rb=T.lazy(()=>gt(()=>import("./Logs-ISY99heA.js"),__vite__mapDeps([26,1,2,11,19,13,10,4,27,14]),import.meta.url)),sb=T.lazy(()=>gt(()=>import("./KnowledgeHome-DmPZ2IlI.js"),__vite__mapDeps([28,1,12,13,11,3,17,15,16,14,20,6]),import.meta.url)),ob=T.lazy(()=>gt(()=>import("./KnowledgeDetail-Bij-Xo90.js"),__vite__mapDeps([29,1,11,3,17,27,14,16]),import.meta.url));class cb{constructor(){Ru(this,"routes",new Map);Ru(this,"navItems",new Map)}registerRoute(i){this.routes.set(i.id,i)}registerNavItem(i){this.navItems.set(i.id,i)}listRoutes(){return[...this.routes.values()].sort((i,s)=>i.order-s.order)}listNavItems(){return[...this.navItems.values()].sort((i,s)=>i.order-s.order)}}function ln(l,i,s="/"){return l?i:j.jsx(Wn,{to:s,replace:!0})}function fb(){const{name:l}=tg();return j.jsx(Wn,{to:l?`/workspace?project=${encodeURIComponent(l)}`:"/workspace",replace:!0})}function vm(){const{project:l,id:i}=tg(),s=new URLSearchParams;return l&&s.set("project",l),i&&s.set("session",i),j.jsx(Wn,{to:`/chat${s.toString()?`?${s.toString()}`:""}`,replace:!0})}function db(l){[{id:"dashboard",index:!0,titleKey:"nav.dashboard",order:10,element:()=>j.jsx(tb,{})},{id:"chat",path:"chat",titleKey:"nav.chat",order:20,element:({features:s})=>ln(s.chatRoute,j.jsx(ab,{}))},{id:"workspace",path:"workspace",titleKey:"nav.workspace",order:30,element:({features:s})=>ln(s.desktopWorkspace,j.jsx(nb,{}))},{id:"knowledge",path:"knowledge",titleKey:"nav.knowledge",order:40,element:({features:s})=>ln(s.knowledgeModule,j.jsx(sb,{}))},{id:"knowledge-detail",path:"knowledge/:knowledgebaseId",titleKey:"nav.knowledge",order:41,element:({features:s})=>ln(s.knowledgeModule,j.jsx(ob,{}))},{id:"projects",path:"projects",titleKey:"nav.projects",order:50,element:({features:s})=>ln(s.desktopWorkspace,j.jsx(Wn,{to:"/workspace",replace:!0}))},{id:"project-detail",path:"projects/:name",titleKey:"nav.projects",order:51,element:()=>j.jsx(fb,{})},{id:"sessions",path:"sessions",titleKey:"nav.sessions",order:60,element:()=>j.jsx(vm,{})},{id:"session-detail",path:"sessions/:project/:id",titleKey:"nav.sessions",order:61,element:()=>j.jsx(vm,{})},{id:"cron",path:"cron",titleKey:"nav.cron",order:70,element:({features:s})=>ln(s.schedulerModule,j.jsx(lb,{}))},{id:"monitors",path:"monitors",titleKey:"nav.monitors",order:71,element:({features:s})=>ln(s.monitorModule,j.jsx(ib,{}))},{id:"system",path:"system",titleKey:"nav.system",order:80,element:()=>j.jsx(ub,{})},{id:"system-logs",path:"system/logs",titleKey:"nav.system",order:81,element:()=>j.jsx(rb,{})}].forEach(s=>l.registerRoute(s))}function hb(l){[{id:"dashboard",path:"/",labelKey:"nav.dashboard",icon:Sy,order:10,end:!0},{id:"chat",path:"/chat",labelKey:"nav.chat",icon:Ay,order:20,visible:({features:s})=>s.chatRoute,resolveLabelKey:({features:s})=>s.desktopChat?"nav.chat":"nav.chatWeb"},{id:"workspace",path:"/workspace",labelKey:"nav.workspace",icon:ky,order:30,visible:({features:s})=>s.desktopWorkspace},{id:"knowledge",path:"/knowledge",labelKey:"nav.knowledge",icon:Ey,order:40,visible:({features:s})=>s.knowledgeModule},{id:"projects",path:"/projects",labelKey:"nav.projects",icon:py,order:50,visible:()=>!1},{id:"sessions",path:"/sessions",labelKey:"nav.sessions",icon:Ry,order:60,visible:()=>!1},{id:"cron",path:"/cron",labelKey:"nav.cron",icon:my,order:70,visible:({features:s})=>s.schedulerModule},{id:"monitors",path:"/monitors",labelKey:"nav.monitors",icon:sy,order:71,visible:({features:s})=>s.monitorModule},{id:"system",path:"/system",labelKey:"nav.system",icon:Ly,order:80}].forEach(s=>l.registerNavItem(s))}const Yu=new cb;db(Yu);hb(Yu);function mb({className:l,markClassName:i,showWordmark:s=!1}){const o=T.useId(),c=`${o}-bg`,f=`${o}-stroke`;return j.jsxs("div",{className:at("inline-flex items-center gap-3",l),children:[j.jsxs("svg",{className:at("h-8 w-8 shrink-0",i),viewBox:"0 0 64 64",role:"img","aria-label":"AgentDock",fill:"none",children:[j.jsxs("defs",{children:[j.jsxs("linearGradient",{id:c,x1:"7",y1:"5",x2:"57",y2:"59",gradientUnits:"userSpaceOnUse",children:[j.jsx("stop",{className:"[stop-color:#FFFFFF] dark:[stop-color:#3A3A3C]"}),j.jsx("stop",{offset:"0.52",className:"[stop-color:#F5F5F7] dark:[stop-color:#2C2C2E]"}),j.jsx("stop",{offset:"1",className:"[stop-color:#E5E5EA] dark:[stop-color:#1C1C1E]"})]}),j.jsxs("linearGradient",{id:f,x1:"18",y1:"16",x2:"47",y2:"48",gradientUnits:"userSpaceOnUse",children:[j.jsx("stop",{stopColor:"#5AC8FA"}),j.jsx("stop",{offset:"0.44",stopColor:"#0A84FF"}),j.jsx("stop",{offset:"1",stopColor:"#007AFF"})]})]}),j.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"}),j.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"}),j.jsx("path",{d:"M20.8 37.5H34.7",className:"stroke-white dark:stroke-white",strokeWidth:"5.25",strokeLinecap:"round"}),j.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"}),j.jsx("path",{d:"M34 25.5V39.5",className:"stroke-black/70 dark:stroke-black/80",strokeWidth:"3",strokeLinecap:"round",opacity:"0.18"})]}),s&&j.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"AgentDock"})]})}var po={};const te=l=>typeof l=="string",Wl=()=>{let l,i;const s=new Promise((o,c)=>{l=o,i=c});return s.resolve=l,s.reject=i,s},bm=l=>l==null?"":""+l,gb=(l,i,s)=>{l.forEach(o=>{i[o]&&(s[o]=i[o])})},pb=/###/g,Sm=l=>l&&l.indexOf("###")>-1?l.replace(pb,"."):l,xm=l=>!l||te(l),Pl=(l,i,s)=>{const o=te(i)?i.split("."):i;let c=0;for(;c<o.length-1;){if(xm(l))return{};const f=Sm(o[c]);!l[f]&&s&&(l[f]=new s),Object.prototype.hasOwnProperty.call(l,f)?l=l[f]:l={},++c}return xm(l)?{}:{obj:l,k:Sm(o[c])}},Em=(l,i,s)=>{const{obj:o,k:c}=Pl(l,i,Object);if(o!==void 0||i.length===1){o[c]=s;return}let f=i[i.length-1],h=i.slice(0,i.length-1),g=Pl(l,h,Object);for(;g.obj===void 0&&h.length;)f=`${h[h.length-1]}.${f}`,h=h.slice(0,h.length-1),g=Pl(l,h,Object),g!=null&&g.obj&&typeof g.obj[`${g.k}.${f}`]<"u"&&(g.obj=void 0);g.obj[`${g.k}.${f}`]=s},yb=(l,i,s,o)=>{const{obj:c,k:f}=Pl(l,i,Object);c[f]=c[f]||[],c[f].push(s)},Lu=(l,i)=>{const{obj:s,k:o}=Pl(l,i);if(s&&Object.prototype.hasOwnProperty.call(s,o))return s[o]},vb=(l,i,s)=>{const o=Lu(l,s);return o!==void 0?o:Lu(i,s)},gg=(l,i,s)=>{for(const o in i)o!=="__proto__"&&o!=="constructor"&&(o in l?te(l[o])||l[o]instanceof String||te(i[o])||i[o]instanceof String?s&&(l[o]=i[o]):gg(l[o],i[o],s):l[o]=i[o]);return l},un=l=>l.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var bb={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Sb=l=>te(l)?l.replace(/[&<>"'\/]/g,i=>bb[i]):l;class xb{constructor(i){this.capacity=i,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(i){const s=this.regExpMap.get(i);if(s!==void 0)return s;const o=new RegExp(i);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(i,o),this.regExpQueue.push(i),o}}const Eb=[" ",",","?","!",";"],Tb=new xb(20),Rb=(l,i,s)=>{i=i||"",s=s||"";const o=Eb.filter(h=>i.indexOf(h)<0&&s.indexOf(h)<0);if(o.length===0)return!0;const c=Tb.getRegExp(`(${o.map(h=>h==="?"?"\\?":h).join("|")})`);let f=!c.test(l);if(!f){const h=l.indexOf(s);h>0&&!c.test(l.substring(0,h))&&(f=!0)}return f},_o=(l,i,s=".")=>{if(!l)return;if(l[i])return Object.prototype.hasOwnProperty.call(l,i)?l[i]:void 0;const o=i.split(s);let c=l;for(let f=0;f<o.length;){if(!c||typeof c!="object")return;let h,g="";for(let y=f;y<o.length;++y)if(y!==f&&(g+=s),g+=o[y],h=c[g],h!==void 0){if(["string","number","boolean"].indexOf(typeof h)>-1&&y<o.length-1)continue;f+=y-f+1;break}c=h}return c},ni=l=>l==null?void 0:l.replace(/_/g,"-"),Ob={type:"logger",log(l){this.output("log",l)},warn(l){this.output("warn",l)},error(l){this.output("error",l)},output(l,i){var s,o;(o=(s=console==null?void 0:console[l])==null?void 0:s.apply)==null||o.call(s,console,i)}};class ju{constructor(i,s={}){this.init(i,s)}init(i,s={}){this.prefix=s.prefix||"i18next:",this.logger=i||Ob,this.options=s,this.debug=s.debug}log(...i){return this.forward(i,"log","",!0)}warn(...i){return this.forward(i,"warn","",!0)}error(...i){return this.forward(i,"error","")}deprecate(...i){return this.forward(i,"warn","WARNING DEPRECATED: ",!0)}forward(i,s,o,c){return c&&!this.debug?null:(te(i[0])&&(i[0]=`${o}${this.prefix} ${i[0]}`),this.logger[s](i))}create(i){return new ju(this.logger,{prefix:`${this.prefix}:${i}:`,...this.options})}clone(i){return i=i||this.options,i.prefix=i.prefix||this.prefix,new ju(this.logger,i)}}var Jt=new ju;class qu{constructor(){this.observers={}}on(i,s){return i.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(s)||0;this.observers[o].set(s,c+1)}),this}off(i,s){if(this.observers[i]){if(!s){delete this.observers[i];return}this.observers[i].delete(s)}}emit(i,...s){this.observers[i]&&Array.from(this.observers[i].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([c,f])=>{for(let h=0;h<f;h++)c.apply(c,[i,...s])})}}class Tm extends qu{constructor(i,s={ns:["translation"],defaultNS:"translation"}){super(),this.data=i||{},this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}removeNamespaces(i){const s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}getResource(i,s,o,c={}){var m,b;const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,h=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let g;i.indexOf(".")>-1?g=i.split("."):(g=[i,s],o&&(Array.isArray(o)?g.push(...o):te(o)&&f?g.push(...o.split(f)):g.push(o)));const y=Lu(this.data,g);return!y&&!s&&!o&&i.indexOf(".")>-1&&(i=g[0],s=g[1],o=g.slice(2).join(".")),y||!h||!te(o)?y:_o((b=(m=this.data)==null?void 0:m[i])==null?void 0:b[s],o,f)}addResource(i,s,o,c,f={silent:!1}){const h=f.keySeparator!==void 0?f.keySeparator:this.options.keySeparator;let g=[i,s];o&&(g=g.concat(h?o.split(h):o)),i.indexOf(".")>-1&&(g=i.split("."),c=s,s=g[1]),this.addNamespaces(s),Em(this.data,g,c),f.silent||this.emit("added",i,s,o,c)}addResources(i,s,o,c={silent:!1}){for(const f in o)(te(o[f])||Array.isArray(o[f]))&&this.addResource(i,s,f,o[f],{silent:!0});c.silent||this.emit("added",i,s,o)}addResourceBundle(i,s,o,c,f,h={silent:!1,skipCopy:!1}){let g=[i,s];i.indexOf(".")>-1&&(g=i.split("."),c=o,o=s,s=g[1]),this.addNamespaces(s);let y=Lu(this.data,g)||{};h.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?gg(y,o,f):y={...y,...o},Em(this.data,g,y),h.silent||this.emit("added",i,s,o)}removeResourceBundle(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}hasResourceBundle(i,s){return this.getResource(i,s)!==void 0}getResourceBundle(i,s){return s||(s=this.options.defaultNS),this.getResource(i,s)}getDataByLanguage(i){return this.data[i]}hasLanguageSomeTranslations(i){const s=this.getDataByLanguage(i);return!!(s&&Object.keys(s)||[]).find(c=>s[c]&&Object.keys(s[c]).length>0)}toJSON(){return this.data}}var pg={processors:{},addPostProcessor(l){this.processors[l.name]=l},handle(l,i,s,o,c){return l.forEach(f=>{var h;i=((h=this.processors[f])==null?void 0:h.process(i,s,o,c))??i}),i}};const yg=Symbol("i18next/PATH_KEY");function Ab(){const l=[],i=Object.create(null);let s;return i.get=(o,c)=>{var f;return(f=s==null?void 0:s.revoke)==null||f.call(s),c===yg?l:(l.push(c),s=Proxy.revocable(o,i),s.proxy)},Proxy.revocable(Object.create(null),i).proxy}function Fn(l,i){const{[yg]:s}=l(Ab()),o=(i==null?void 0:i.keySeparator)??".",c=(i==null?void 0:i.nsSeparator)??":";if(s.length>1&&c){const f=i==null?void 0:i.ns,h=Array.isArray(f)?f:null;if(h&&h.length>1&&h.slice(1).includes(s[0]))return`${s[0]}${c}${s.slice(1).join(o)}`}return s.join(o)}const Rm={},yo=l=>!te(l)&&typeof l!="boolean"&&typeof l!="number";class wu extends qu{constructor(i,s={}){super(),gb(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],i,this),this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Jt.create("translator")}changeLanguage(i){i&&(this.language=i)}exists(i,s={interpolation:{}}){const o={...s};if(i==null)return!1;const c=this.resolve(i,o);if((c==null?void 0:c.res)===void 0)return!1;const f=yo(c.res);return!(o.returnObjects===!1&&f)}extractFromKey(i,s){let o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let f=s.ns||this.options.defaultNS||[];const h=o&&i.indexOf(o)>-1,g=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!Rb(i,o,c);if(h&&!g){const y=i.match(this.interpolator.nestingRegexp);if(y&&y.length>0)return{key:i,namespaces:te(f)?[f]:f};const m=i.split(o);(o!==c||o===c&&this.options.ns.indexOf(m[0])>-1)&&(f=m.shift()),i=m.join(c)}return{key:i,namespaces:te(f)?[f]:f}}translate(i,s,o){let c=typeof s=="object"?{...s}:s;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),i==null)return"";typeof i=="function"&&(i=Fn(i,{...this.options,...c})),Array.isArray(i)||(i=[String(i)]),i=i.map(Ce=>typeof Ce=="function"?Fn(Ce,{...this.options,...c}):String(Ce));const f=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,h=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:g,namespaces:y}=this.extractFromKey(i[i.length-1],c),m=y[y.length-1];let b=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;b===void 0&&(b=":");const v=c.lng||this.language,O=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((v==null?void 0:v.toLowerCase())==="cimode")return O?f?{res:`${m}${b}${g}`,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:`${m}${b}${g}`:f?{res:g,usedKey:g,exactUsedKey:g,usedLng:v,usedNS:m,usedParams:this.getUsedParamsDetails(c)}:g;const N=this.resolve(i,c);let A=N==null?void 0:N.res;const H=(N==null?void 0:N.usedKey)||g,k=(N==null?void 0:N.exactUsedKey)||g,Y=["[object Number]","[object Function]","[object RegExp]"],q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,K=!this.i18nFormat||this.i18nFormat.handleAsObject,$=c.count!==void 0&&!te(c.count),ee=wu.hasDefaultValue(c),se=$?this.pluralResolver.getSuffix(v,c.count,c):"",J=c.ordinal&&$?this.pluralResolver.getSuffix(v,c.count,{ordinal:!1}):"",ne=$&&!c.ordinal&&c.count===0,re=ne&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${se}`]||c[`defaultValue${J}`]||c.defaultValue;let de=A;K&&!A&&ee&&(de=re);const Me=yo(de),Je=Object.prototype.toString.apply(de);if(K&&de&&Me&&Y.indexOf(Je)<0&&!(te(q)&&Array.isArray(de))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Ce=this.options.returnedObjectHandler?this.options.returnedObjectHandler(H,de,{...c,ns:y}):`key '${g} (${this.language})' returned an object instead of string.`;return f?(N.res=Ce,N.usedParams=this.getUsedParamsDetails(c),N):Ce}if(h){const Ce=Array.isArray(de),De=Ce?[]:{},we=Ce?k:H;for(const D in de)if(Object.prototype.hasOwnProperty.call(de,D)){const V=`${we}${h}${D}`;ee&&!A?De[D]=this.translate(V,{...c,defaultValue:yo(re)?re[D]:void 0,joinArrays:!1,ns:y}):De[D]=this.translate(V,{...c,joinArrays:!1,ns:y}),De[D]===V&&(De[D]=de[D])}A=De}}else if(K&&te(q)&&Array.isArray(A))A=A.join(q),A&&(A=this.extendTranslation(A,i,c,o));else{let Ce=!1,De=!1;!this.isValidLookup(A)&&ee&&(Ce=!0,A=re),this.isValidLookup(A)||(De=!0,A=g);const D=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&De?void 0:A,V=ee&&re!==A&&this.options.updateMissing;if(De||Ce||V){if(this.logger.log(V?"updateKey":"missingKey",v,m,g,V?re:A),h){const x=this.resolve(g,{...c,keySeparator:!1});x&&x.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let I=[];const pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(let x=0;x<pe.length;x++)I.push(pe[x]);else this.options.saveMissingTo==="all"?I=this.languageUtils.toResolveHierarchy(c.lng||this.language):I.push(c.lng||this.language);const Se=(x,w,G)=>{var ae;const Q=ee&&G!==A?G:D;this.options.missingKeyHandler?this.options.missingKeyHandler(x,m,w,Q,V,c):(ae=this.backendConnector)!=null&&ae.saveMissing&&this.backendConnector.saveMissing(x,m,w,Q,V,c),this.emit("missingKey",x,m,w,A)};this.options.saveMissing&&(this.options.saveMissingPlurals&&$?I.forEach(x=>{const w=this.pluralResolver.getSuffixes(x,c);ne&&c[`defaultValue${this.options.pluralSeparator}zero`]&&w.indexOf(`${this.options.pluralSeparator}zero`)<0&&w.push(`${this.options.pluralSeparator}zero`),w.forEach(G=>{Se([x],g+G,c[`defaultValue${G}`]||re)})}):Se(I,g,re))}A=this.extendTranslation(A,i,c,N,o),De&&A===g&&this.options.appendNamespaceToMissingKey&&(A=`${m}${b}${g}`),(De||Ce)&&this.options.parseMissingKeyHandler&&(A=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${m}${b}${g}`:g,Ce?A:void 0,c))}return f?(N.res=A,N.usedParams=this.getUsedParamsDetails(c),N):A}extendTranslation(i,s,o,c,f){var y,m;if((y=this.i18nFormat)!=null&&y.parse)i=this.i18nFormat.parse(i,{...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=te(i)&&(((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 N=i.match(this.interpolator.nestingRegexp);v=N&&N.length}let O=o.replace&&!te(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(O={...this.options.interpolation.defaultVariables,...O}),i=this.interpolator.interpolate(i,O,o.lng||this.language||c.usedLng,o),b){const N=i.match(this.interpolator.nestingRegexp),A=N&&N.length;v<A&&(o.nest=!1)}!o.lng&&c&&c.res&&(o.lng=this.language||c.usedLng),o.nest!==!1&&(i=this.interpolator.nest(i,(...N)=>(f==null?void 0:f[0])===N[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${N[0]} in key: ${s[0]}`),null):this.translate(...N,s),o)),o.interpolation&&this.interpolator.reset()}const h=o.postProcess||this.options.postProcess,g=te(h)?[h]:h;return i!=null&&(g!=null&&g.length)&&o.applyPostProcessor!==!1&&(i=pg.handle(g,i,s,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),i}resolve(i,s={}){let o,c,f,h,g;return te(i)&&(i=[i]),Array.isArray(i)&&(i=i.map(y=>typeof y=="function"?Fn(y,{...this.options,...s}):y)),i.forEach(y=>{if(this.isValidLookup(o))return;const m=this.extractFromKey(y,s),b=m.key;c=b;let v=m.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const O=s.count!==void 0&&!te(s.count),N=O&&!s.ordinal&&s.count===0,A=s.context!==void 0&&(te(s.context)||typeof s.context=="number")&&s.context!=="",H=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);v.forEach(k=>{var Y,q;this.isValidLookup(o)||(g=k,!Rm[`${H[0]}-${k}`]&&((Y=this.utils)!=null&&Y.hasLoadedNamespace)&&!((q=this.utils)!=null&&q.hasLoadedNamespace(g))&&(Rm[`${H[0]}-${k}`]=!0,this.logger.warn(`key "${c}" for languages "${H.join(", ")}" won't get resolved as namespace "${g}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),H.forEach(K=>{var se;if(this.isValidLookup(o))return;h=K;const $=[b];if((se=this.i18nFormat)!=null&&se.addLookupKeys)this.i18nFormat.addLookupKeys($,b,K,k,s);else{let J;O&&(J=this.pluralResolver.getSuffix(K,s.count,s));const ne=`${this.options.pluralSeparator}zero`,re=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(O&&(s.ordinal&&J.indexOf(re)===0&&$.push(b+J.replace(re,this.options.pluralSeparator)),$.push(b+J),N&&$.push(b+ne)),A){const de=`${b}${this.options.contextSeparator||"_"}${s.context}`;$.push(de),O&&(s.ordinal&&J.indexOf(re)===0&&$.push(de+J.replace(re,this.options.pluralSeparator)),$.push(de+J),N&&$.push(de+ne))}}let ee;for(;ee=$.pop();)this.isValidLookup(o)||(f=ee,o=this.getResource(K,k,ee,s))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:g}}isValidLookup(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}getResource(i,s,o,c={}){var f;return(f=this.i18nFormat)!=null&&f.getResource?this.i18nFormat.getResource(i,s,o,c):this.resourceStore.getResource(i,s,o,c)}getUsedParamsDetails(i={}){const s=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=i.replace&&!te(i.replace);let c=o?i.replace:i;if(o&&typeof i.count<"u"&&(c.count=i.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const f of s)delete c[f]}return c}static hasDefaultValue(i){const s="defaultValue";for(const o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}class Om{constructor(i){this.options=i,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Jt.create("languageUtils")}getScriptPartFromCode(i){if(i=ni(i),!i||i.indexOf("-")<0)return null;const s=i.split("-");return s.length===2||(s.pop(),s[s.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(s.join("-"))}getLanguagePartFromCode(i){if(i=ni(i),!i||i.indexOf("-")<0)return i;const s=i.split("-");return this.formatLanguageCode(s[0])}formatLanguageCode(i){if(te(i)&&i.indexOf("-")>-1){let s;try{s=Intl.getCanonicalLocales(i)[0]}catch{}return s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s||(this.options.lowerCaseLng?i.toLowerCase():i)}return this.options.cleanCode||this.options.lowerCaseLng?i.toLowerCase():i}isSupportedCode(i){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(i=this.getLanguagePartFromCode(i)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(i)>-1}getBestMatchFromCodes(i){if(!i)return null;let s;return i.forEach(o=>{if(s)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(s=c)}),!s&&this.options.supportedLngs&&i.forEach(o=>{if(s)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return s=c;const f=this.getLanguagePartFromCode(o);if(this.isSupportedCode(f))return s=f;s=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})}),s||(s=this.getFallbackCodes(this.options.fallbackLng)[0]),s}getFallbackCodes(i,s){if(!i)return[];if(typeof i=="function"&&(i=i(s)),te(i)&&(i=[i]),Array.isArray(i))return i;if(!s)return i.default||[];let o=i[s];return o||(o=i[this.getScriptPartFromCode(s)]),o||(o=i[this.formatLanguageCode(s)]),o||(o=i[this.getLanguagePartFromCode(s)]),o||(o=i.default),o||[]}toResolveHierarchy(i,s){const o=this.getFallbackCodes((s===!1?[]:s)||this.options.fallbackLng||[],i),c=[],f=h=>{h&&(this.isSupportedCode(h)?c.push(h):this.logger.warn(`rejecting language code not found in supportedLngs: ${h}`))};return te(i)&&(i.indexOf("-")>-1||i.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&f(this.formatLanguageCode(i)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&f(this.getScriptPartFromCode(i)),this.options.load!=="currentOnly"&&f(this.getLanguagePartFromCode(i))):te(i)&&f(this.formatLanguageCode(i)),o.forEach(h=>{c.indexOf(h)<0&&f(this.formatLanguageCode(h))}),c}}const Am={zero:0,one:1,two:2,few:3,many:4,other:5},_m={select:l=>l===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class _b{constructor(i,s={}){this.languageUtils=i,this.options=s,this.logger=Jt.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(i,s={}){const o=ni(i==="dev"?"en":i),c=s.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!"),_m;if(!i.match(/-|_/))return _m;const y=this.languageUtils.getLanguagePartFromCode(i);h=this.getRule(y,s)}return this.pluralRulesCache[f]=h,h}needsPlural(i,s={}){let o=this.getRule(i,s);return o||(o=this.getRule("dev",s)),(o==null?void 0:o.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(i,s,o={}){return this.getSuffixes(i,o).map(c=>`${s}${c}`)}getSuffixes(i,s={}){let o=this.getRule(i,s);return o||(o=this.getRule("dev",s)),o?o.resolvedOptions().pluralCategories.sort((c,f)=>Am[c]-Am[f]).map(c=>`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(i,s,o={}){const c=this.getRule(i,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(s)}`:(this.logger.warn(`no plural rule found for: ${i}`),this.getSuffix("dev",s,o))}}const Cm=(l,i,s,o=".",c=!0)=>{let f=vb(l,i,s);return!f&&c&&te(s)&&(f=_o(l,s,o),f===void 0&&(f=_o(i,s,o))),f},vo=l=>l.replace(/\$/g,"$$$$");class zm{constructor(i={}){var s;this.logger=Jt.create("interpolator"),this.options=i,this.format=((s=i==null?void 0:i.interpolation)==null?void 0:s.format)||(o=>o),this.init(i)}init(i={}){i.interpolation||(i.interpolation={escapeValue:!0});const{escape:s,escapeValue:o,useRawValueToEscape:c,prefix:f,prefixEscaped:h,suffix:g,suffixEscaped:y,formatSeparator:m,unescapeSuffix:b,unescapePrefix:v,nestingPrefix:O,nestingPrefixEscaped:N,nestingSuffix:A,nestingSuffixEscaped:H,nestingOptionsSeparator:k,maxReplaces:Y,alwaysFormat:q}=i.interpolation;this.escape=s!==void 0?s:Sb,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=f?un(f):h||"{{",this.suffix=g?un(g):y||"}}",this.formatSeparator=m||",",this.unescapePrefix=b?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=O?un(O):N||un("$t("),this.nestingSuffix=A?un(A):H||un(")"),this.nestingOptionsSeparator=k||",",this.maxReplaces=Y||1e3,this.alwaysFormat=q!==void 0?q:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const i=(s,o)=>(s==null?void 0:s.source)===o?(s.lastIndex=0,s):new RegExp(o,"g");this.regexp=i(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=i(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=i(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(i,s,o,c){var N;let f,h,g;const y=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=A=>{if(A.indexOf(this.formatSeparator)<0){const q=Cm(s,y,A,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(q,void 0,o,{...c,...s,interpolationkey:A}):q}const H=A.split(this.formatSeparator),k=H.shift().trim(),Y=H.join(this.formatSeparator).trim();return this.format(Cm(s,y,k,this.options.keySeparator,this.options.ignoreJSONStructure),Y,o,{...c,...s,interpolationkey:k})};this.resetRegExp();const b=(c==null?void 0:c.missingInterpolationHandler)||this.options.missingInterpolationHandler,v=((N=c==null?void 0:c.interpolation)==null?void 0:N.skipOnVariables)!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:A=>vo(A)},{regex:this.regexp,safeValue:A=>this.escapeValue?vo(this.escape(A)):vo(A)}].forEach(A=>{for(g=0;f=A.regex.exec(i);){const H=f[1].trim();if(h=m(H),h===void 0)if(typeof b=="function"){const Y=b(i,f,c);h=te(Y)?Y:""}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 ${i}`),h="";else!te(h)&&!this.useRawValueToEscape&&(h=bm(h));const k=A.safeValue(h);if(i=i.replace(f[0],k),v?(A.regex.lastIndex+=h.length,A.regex.lastIndex-=f[0].length):A.regex.lastIndex=0,g++,g>=this.maxReplaces)break}}),i}nest(i,s,o={}){let c,f,h;const g=(y,m)=>{const b=this.nestingOptionsSeparator;if(y.indexOf(b)<0)return y;const v=y.split(new RegExp(`${un(b)}[ ]*{`));let O=`{${v[1]}`;y=v[0],O=this.interpolate(O,h);const N=O.match(/'/g),A=O.match(/"/g);(((N==null?void 0:N.length)??0)%2===0&&!A||((A==null?void 0:A.length)??0)%2!==0)&&(O=O.replace(/'/g,'"'));try{h=JSON.parse(O),m&&(h={...m,...h})}catch(H){return this.logger.warn(`failed parsing options string in nesting for key ${y}`,H),`${y}${b}${O}`}return h.defaultValue&&h.defaultValue.indexOf(this.prefix)>-1&&delete h.defaultValue,y};for(;c=this.nestingRegexp.exec(i);){let y=[];h={...o},h=h.replace&&!te(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&&(y=c[1].slice(m).split(this.formatSeparator).map(b=>b.trim()).filter(Boolean),c[1]=c[1].slice(0,m)),f=s(g.call(this,c[1].trim(),h),h),f&&c[0]===i&&!te(f))return f;te(f)||(f=bm(f)),f||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${i}`),f=""),y.length&&(f=y.reduce((b,v)=>this.format(b,v,o.lng,{...o,interpolationkey:c[1].trim()}),f.trim())),i=i.replace(c[0],f),this.regexp.lastIndex=0}return i}}const Cb=l=>{let i=l.toLowerCase().trim();const s={};if(l.indexOf("(")>-1){const o=l.split("(");i=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);i==="currency"&&c.indexOf(":")<0?s.currency||(s.currency=c.trim()):i==="relativetime"&&c.indexOf(":")<0?s.range||(s.range=c.trim()):c.split(";").forEach(h=>{if(h){const[g,...y]=h.split(":"),m=y.join(":").trim().replace(/^'+|'+$/g,""),b=g.trim();s[b]||(s[b]=m),m==="false"&&(s[b]=!1),m==="true"&&(s[b]=!0),isNaN(m)||(s[b]=parseInt(m,10))}})}return{formatName:i,formatOptions:s}},Nm=l=>{const i={};return(s,o,c)=>{let f=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(f={...f,[c.interpolationkey]:void 0});const h=o+JSON.stringify(f);let g=i[h];return g||(g=l(ni(o),c),i[h]=g),g(s)}},zb=l=>(i,s,o)=>l(ni(s),o)(i);class Nb{constructor(i={}){this.logger=Jt.create("formatter"),this.options=i,this.init(i)}init(i,s={interpolation:{}}){this.formatSeparator=s.interpolation.formatSeparator||",";const o=s.cacheInBuiltFormats?Nm:zb;this.formats={number:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f});return g=>h.format(g)}),currency:o((c,f)=>{const h=new Intl.NumberFormat(c,{...f,style:"currency"});return g=>h.format(g)}),datetime:o((c,f)=>{const h=new Intl.DateTimeFormat(c,{...f});return g=>h.format(g)}),relativetime:o((c,f)=>{const h=new Intl.RelativeTimeFormat(c,{...f});return g=>h.format(g,f.range||"day")}),list:o((c,f)=>{const h=new Intl.ListFormat(c,{...f});return g=>h.format(g)})}}add(i,s){this.formats[i.toLowerCase().trim()]=s}addCached(i,s){this.formats[i.toLowerCase().trim()]=Nm(s)}format(i,s,o,c={}){const f=s.split(this.formatSeparator);if(f.length>1&&f[0].indexOf("(")>1&&f[0].indexOf(")")<0&&f.find(g=>g.indexOf(")")>-1)){const g=f.findIndex(y=>y.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,g)].join(this.formatSeparator)}return f.reduce((g,y)=>{var v;const{formatName:m,formatOptions:b}=Cb(y);if(this.formats[m]){let O=g;try{const N=((v=c==null?void 0:c.formatParams)==null?void 0:v[c.interpolationkey])||{},A=N.locale||N.lng||c.locale||c.lng||o;O=this.formats[m](g,A,{...b,...c,...N})}catch(N){this.logger.warn(N)}return O}else this.logger.warn(`there was no format function for ${m}`);return g},i)}}const Mb=(l,i)=>{l.pending[i]!==void 0&&(delete l.pending[i],l.pendingCount--)};class Db extends qu{constructor(i,s,o,c={}){var f,h;super(),this.backend=i,this.store=s,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=Jt.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(i,s,o,c){const f={},h={},g={},y={};return i.forEach(m=>{let b=!0;s.forEach(v=>{const O=`${m}|${v}`;!o.reload&&this.store.hasResourceBundle(m,v)?this.state[O]=2:this.state[O]<0||(this.state[O]===1?h[O]===void 0&&(h[O]=!0):(this.state[O]=1,b=!1,h[O]===void 0&&(h[O]=!0),f[O]===void 0&&(f[O]=!0),y[v]===void 0&&(y[v]=!0)))}),b||(g[m]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(g),toLoadNamespaces:Object.keys(y)}}loaded(i,s,o){const c=i.split("|"),f=c[0],h=c[1];s&&this.emit("failedLoading",f,h,s),!s&&o&&this.store.addResourceBundle(f,h,o,void 0,void 0,{skipCopy:!0}),this.state[i]=s?-1:2,s&&o&&(this.state[i]=0);const g={};this.queue.forEach(y=>{yb(y.loaded,[f],h),Mb(y,i),s&&y.errors.push(s),y.pendingCount===0&&!y.done&&(Object.keys(y.loaded).forEach(m=>{g[m]||(g[m]={});const b=y.loaded[m];b.length&&b.forEach(v=>{g[m][v]===void 0&&(g[m][v]=!0)})}),y.done=!0,y.errors.length?y.callback(y.errors):y.callback())}),this.emit("loaded",g),this.queue=this.queue.filter(y=>!y.done)}read(i,s,o,c=0,f=this.retryTimeout,h){if(!i.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:c,wait:f,callback:h});return}this.readingCalls++;const g=(m,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(m&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,i,s,o,c+1,f*2,h)},f);return}h(m,b)},y=this.backend[o].bind(this.backend);if(y.length===2){try{const m=y(i,s);m&&typeof m.then=="function"?m.then(b=>g(null,b)).catch(g):g(null,m)}catch(m){g(m)}return}return y(i,s,g)}prepareLoading(i,s,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();te(i)&&(i=this.languageUtils.toResolveHierarchy(i)),te(s)&&(s=[s]);const f=this.queueLoad(i,s,o,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(h=>{this.loadOne(h)})}load(i,s,o){this.prepareLoading(i,s,{},o)}reload(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}loadOne(i,s=""){const o=i.split("|"),c=o[0],f=o[1];this.read(c,f,"read",void 0,void 0,(h,g)=>{h&&this.logger.warn(`${s}loading namespace ${f} for language ${c} failed`,h),!h&&g&&this.logger.log(`${s}loaded namespace ${f} for language ${c}`,g),this.loaded(i,h,g)})}saveMissing(i,s,o,c,f,h={},g=()=>{}){var y,m,b,v,O;if((m=(y=this.services)==null?void 0:y.utils)!=null&&m.hasLoadedNamespace&&!((v=(b=this.services)==null?void 0:b.utils)!=null&&v.hasLoadedNamespace(s))){this.logger.warn(`did not save key "${o}" as the namespace "${s}" 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((O=this.backend)!=null&&O.create){const N={...h,isUpdate:f},A=this.backend.create.bind(this.backend);if(A.length<6)try{let H;A.length===5?H=A(i,s,o,c,N):H=A(i,s,o,c),H&&typeof H.then=="function"?H.then(k=>g(null,k)).catch(g):g(null,H)}catch(H){g(H)}else A(i,s,o,c,g,N)}!i||!i[0]||this.store.addResource(i[0],s,o,c)}}}const bo=()=>({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:l=>{let i={};if(typeof l[1]=="object"&&(i=l[1]),te(l[1])&&(i.defaultValue=l[1]),te(l[2])&&(i.tDescription=l[2]),typeof l[2]=="object"||typeof l[3]=="object"){const s=l[3]||l[2];Object.keys(s).forEach(o=>{i[o]=s[o]})}return i},interpolation:{escapeValue:!0,format:l=>l,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Mm=l=>{var i,s;return te(l.ns)&&(l.ns=[l.ns]),te(l.fallbackLng)&&(l.fallbackLng=[l.fallbackLng]),te(l.fallbackNS)&&(l.fallbackNS=[l.fallbackNS]),((s=(i=l.supportedLngs)==null?void 0:i.indexOf)==null?void 0:s.call(i,"cimode"))<0&&(l.supportedLngs=l.supportedLngs.concat(["cimode"])),typeof l.initImmediate=="boolean"&&(l.initAsync=l.initImmediate),l},Au=()=>{},Lb=l=>{Object.getOwnPropertyNames(Object.getPrototypeOf(l)).forEach(s=>{typeof l[s]=="function"&&(l[s]=l[s].bind(l))})},vg="__i18next_supportNoticeShown",jb=()=>!!(typeof globalThis<"u"&&globalThis[vg]||typeof process<"u"&&po&&po.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&po),wb=()=>{typeof globalThis<"u"&&(globalThis[vg]=!0)},Ub=l=>{var i,s,o,c,f,h,g,y,m,b,v,O,N;return!!(((o=(s=(i=l==null?void 0:l.modules)==null?void 0:i.backend)==null?void 0:s.name)==null?void 0:o.indexOf("Locize"))>0||((g=(h=(f=(c=l==null?void 0:l.modules)==null?void 0:c.backend)==null?void 0:f.constructor)==null?void 0:h.name)==null?void 0:g.indexOf("Locize"))>0||(m=(y=l==null?void 0:l.options)==null?void 0:y.backend)!=null&&m.backends&&l.options.backend.backends.some(A=>{var H,k,Y;return((H=A==null?void 0:A.name)==null?void 0:H.indexOf("Locize"))>0||((Y=(k=A==null?void 0:A.constructor)==null?void 0:k.name)==null?void 0:Y.indexOf("Locize"))>0})||(v=(b=l==null?void 0:l.options)==null?void 0:b.backend)!=null&&v.projectId||(N=(O=l==null?void 0:l.options)==null?void 0:O.backend)!=null&&N.backendOptions&&l.options.backend.backendOptions.some(A=>A==null?void 0:A.projectId))};class ei extends qu{constructor(i={},s){if(super(),this.options=Mm(i),this.services={},this.logger=Jt,this.modules={external:[]},Lb(this),s&&!this.isInitialized&&!i.isClone){if(!this.options.initAsync)return this.init(i,s),this;setTimeout(()=>{this.init(i,s)},0)}}init(i={},s){this.isInitializing=!0,typeof i=="function"&&(s=i,i={}),i.defaultNS==null&&i.ns&&(te(i.ns)?i.defaultNS=i.ns:i.ns.indexOf("translation")<0&&(i.defaultNS=i.ns[0]));const o=bo();this.options={...o,...this.options,...Mm(i)},this.options.interpolation={...o.interpolation,...this.options.interpolation},i.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=i.keySeparator),i.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=i.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!Ub(this)&&!jb()&&(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 💙"),wb());const c=m=>m?typeof m=="function"?new m:m:null;if(!this.options.isClone){this.modules.logger?Jt.init(c(this.modules.logger),this.options):Jt.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:m=Nb;const b=new Om(this.options);this.store=new Tm(this.options.resources,this.options);const v=this.services;v.logger=Jt,v.resourceStore=this.store,v.languageUtils=b,v.pluralResolver=new _b(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 zm(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new Db(c(this.modules.backend),v.resourceStore,v,this.options),v.backendConnector.on("*",(N,...A)=>{this.emit(N,...A)}),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 wu(this.services,this.options),this.translator.on("*",(N,...A)=>{this.emit(N,...A)}),this.modules.external.forEach(N=>{N.init&&N.init(this)})}if(this.format=this.options.interpolation.format,s||(s=Au),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const m=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);m.length>0&&m[0]!=="dev"&&(this.options.lng=m[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(m=>{this[m]=(...b)=>this.store[m](...b)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(m=>{this[m]=(...b)=>(this.store[m](...b),this)});const g=Wl(),y=()=>{const m=(b,v)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(v),s(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?y():setTimeout(y,0),g}loadResources(i,s=Au){var f,h;let o=s;const c=te(i)?i:this.language;if(typeof i=="function"&&(o=i),!this.options.resources||this.options.partialBundledLanguages){if((c==null?void 0:c.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const g=[],y=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(v=>{v!=="cimode"&&g.indexOf(v)<0&&g.push(v)})};c?y(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>y(b)),(h=(f=this.options.preload)==null?void 0:f.forEach)==null||h.call(f,m=>y(m)),this.services.backendConnector.load(g,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(m)})}else o(null)}reloadResources(i,s,o){const c=Wl();return typeof i=="function"&&(o=i,i=void 0),typeof s=="function"&&(o=s,s=void 0),i||(i=this.languages),s||(s=this.options.ns),o||(o=Au),this.services.backendConnector.reload(i,s,f=>{c.resolve(),o(f)}),c}use(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&pg.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}setResolvedLanguage(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1)){for(let s=0;s<this.languages.length;s++){const o=this.languages[s];if(!(["cimode","dev"].indexOf(o)>-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(i)<0&&this.store.hasLanguageSomeTranslations(i)&&(this.resolvedLanguage=i,this.languages.unshift(i))}}changeLanguage(i,s){this.isLanguageChangingTo=i;const o=Wl();this.emit("languageChanging",i);const c=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},f=(g,y)=>{y?this.isLanguageChangingTo===i&&(c(y),this.translator.changeLanguage(y),this.isLanguageChangingTo=void 0,this.emit("languageChanged",y),this.logger.log("languageChanged",y)):this.isLanguageChangingTo=void 0,o.resolve((...m)=>this.t(...m)),s&&s(g,(...m)=>this.t(...m))},h=g=>{var b,v;!i&&!g&&this.services.languageDetector&&(g=[]);const y=te(g)?g:g&&g[0],m=this.store.hasLanguageSomeTranslations(y)?y:this.services.languageUtils.getBestMatchFromCodes(te(g)?[g]:g);m&&(this.language||c(m),this.translator.language||this.translator.changeLanguage(m),(v=(b=this.services.languageDetector)==null?void 0:b.cacheUserLanguage)==null||v.call(b,m)),this.loadResources(m,O=>{f(O,m)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!i&&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(i),o}getFixedT(i,s,o){const c=(f,h,...g)=>{let y;typeof h!="object"?y=this.options.overloadTranslationOptionHandler([f,h].concat(g)):y={...h},y.lng=y.lng||c.lng,y.lngs=y.lngs||c.lngs,y.ns=y.ns||c.ns,y.keyPrefix!==""&&(y.keyPrefix=y.keyPrefix||o||c.keyPrefix);const m={...this.options,...y};typeof y.keyPrefix=="function"&&(y.keyPrefix=Fn(y.keyPrefix,m));const b=this.options.keySeparator||".";let v;return y.keyPrefix&&Array.isArray(f)?v=f.map(O=>(typeof O=="function"&&(O=Fn(O,m)),`${y.keyPrefix}${b}${O}`)):(typeof f=="function"&&(f=Fn(f,m)),v=y.keyPrefix?`${y.keyPrefix}${b}${f}`:f),this.t(v,y)};return te(i)?c.lng=i:c.lngs=i,c.ns=s,c.keyPrefix=o,c}t(...i){var s;return(s=this.translator)==null?void 0:s.translate(...i)}exists(...i){var s;return(s=this.translator)==null?void 0:s.exists(...i)}setDefaultNamespace(i){this.options.defaultNS=i}hasLoadedNamespace(i,s={}){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=s.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const h=(g,y)=>{const m=this.services.backendConnector.state[`${g}|${y}`];return m===-1||m===0||m===2};if(s.precheck){const g=s.precheck(this,h);if(g!==void 0)return g}return!!(this.hasResourceBundle(o,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(o,i)&&(!c||h(f,i)))}loadNamespaces(i,s){const o=Wl();return this.options.ns?(te(i)&&(i=[i]),i.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),s&&s(c)}),o):(s&&s(),Promise.resolve())}loadLanguages(i,s){const o=Wl();te(i)&&(i=[i]);const c=this.options.preload||[],f=i.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(),s&&s(h)}),o):(s&&s(),Promise.resolve())}dir(i){var c,f;if(i||(i=this.resolvedLanguage||(((c=this.languages)==null?void 0:c.length)>0?this.languages[0]:this.language)),!i)return"rtl";try{const h=new Intl.Locale(i);if(h&&h.getTextInfo){const g=h.getTextInfo();if(g&&g.direction)return g.direction}}catch{}const s=["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 Om(bo());return i.toLowerCase().indexOf("-latn")>1?"ltr":s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(i={},s){const o=new ei(i,s);return o.createInstance=ei.createInstance,o}cloneInstance(i={},s=Au){const o=i.forkResourceStore;o&&delete i.forkResourceStore;const c={...this.options,...i,isClone:!0},f=new ei(c);if((i.debug!==void 0||i.prefix!==void 0)&&(f.logger=f.logger.clone(i)),["store","services","language"].forEach(g=>{f[g]=this[g]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const g=Object.keys(this.store.data).reduce((y,m)=>(y[m]={...this.store.data[m]},y[m]=Object.keys(y[m]).reduce((b,v)=>(b[v]={...y[m][v]},b),y[m]),y),{});f.store=new Tm(g,c),f.services.resourceStore=f.store}if(i.interpolation){const y={...bo().interpolation,...this.options.interpolation,...i.interpolation},m={...c,interpolation:y};f.services.interpolator=new zm(m)}return f.translator=new wu(f.services,c),f.translator.on("*",(g,...y)=>{f.emit(g,...y)}),f.init(c,s),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 Ze=ei.createInstance();Ze.createInstance;Ze.dir;Ze.init;Ze.loadResources;Ze.reloadResources;Ze.use;Ze.changeLanguage;Ze.getFixedT;Ze.t;Ze.exists;Ze.setDefaultNamespace;Ze.hasLoadedNamespace;Ze.loadNamespaces;Ze.loadLanguages;const ti="en",bg={en:()=>gt(()=>import("./en-CmAr_0e6.js"),[],import.meta.url),zh:()=>gt(()=>import("./zh-CcJ9vBZj.js"),[],import.meta.url),"zh-TW":()=>gt(()=>import("./zh-TW-elI72AC1.js"),[],import.meta.url),ja:()=>gt(()=>import("./ja-DtvtBRTW.js"),[],import.meta.url),es:()=>gt(()=>import("./es-Cs9x52ca.js"),[],import.meta.url)},Nu={};function Dm(l){return l in bg}function Sg(l){if(Dm(l))return l;const i=l.split("-")[0];return Dm(i)?i:ti}function Hb(){const l=localStorage.getItem("cc_lang");return Sg(l||navigator.language||ti)}async function Co(l){if(Nu[l])return;const i=await bg[l]();Nu[l]=i.default,Ze.isInitialized&&Ze.addResourceBundle(l,"translation",Nu[l],!0,!0)}async function Bb(){const l=Hb();await Promise.all([Co(ti),l===ti?Promise.resolve():Co(l)]),Ze.isInitialized||await Ze.use(B1).init({lng:l,fallbackLng:ti,resources:Object.fromEntries(Object.entries(Nu).map(([i,s])=>[i,{translation:s}])),interpolation:{escapeValue:!1}})}async function kb(l){const i=Sg(l);await Co(i),await Ze.changeLanguage(i),localStorage.setItem("cc_lang",i)}const Lm=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"zh-TW",label:"繁體中文"},{code:"ja",label:"日本語"},{code:"es",label:"Español"}],Yb=[{label:"Core",ids:["dashboard","chat","workspace","projects","sessions"]},{label:"Knowledge",ids:["knowledge","cron","monitors"]},{label:"System",ids:["system"]}];function qb(){var Y;const{pathname:l}=Ct(),{t:i,i18n:s}=G1(),{theme:o,setTheme:c}=mg(),f=Vo(),[h,g]=T.useState(!1),[y,m]=T.useState(!1),b=q=>{kb(q),m(!1)},v={light:wy,dark:Ny,system:Cy},O={light:"dark",dark:"system",system:"light"},N=v[o],A=Yu.listNavItems().filter(q=>{var K;return((K=q.visible)==null?void 0:K.call(q,{features:f}))??!0}),H=A.map(q=>{var ee;const K=q.icon,$=((ee=q.resolveLabelKey)==null?void 0:ee.call(q,{features:f}))||q.labelKey;return{...q,Icon:K,labelKey:$}}),k=l.startsWith("/chat");return j.jsxs(j.Fragment,{children:[j.jsxs("aside",{className:at("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",h?"w-16":"w-56"),children:[j.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"}),j.jsx("div",{className:at("relative flex h-[5.25rem] items-center gap-3 px-4 pt-7 transition-colors"),children:j.jsx(mb,{showWordmark:!h})}),j.jsx("nav",{className:"relative flex-1 py-3 space-y-4 px-2 overflow-y-auto",children:Yb.map(q=>{const K=A.filter($=>q.ids.includes($.id));return K.length===0?null:j.jsxs("div",{className:"space-y-1",children:[!h&&j.jsx("p",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/80",children:q.label}),K.map($=>{var J;const ee=$.icon,se=((J=$.resolveLabelKey)==null?void 0:J.call($,{features:f}))||$.labelKey;return j.jsxs(To,{to:$.path,end:$.end,className:({isActive:ne})=>at("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",ne?"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:[j.jsx(ee,{size:18,className:"shrink-0"}),!h&&j.jsx("span",{children:i(se)})]},$.id)})]},q.label)})}),j.jsxs("div",{className:at("relative border-t p-2 space-y-1","border-black/10 dark:border-white/[0.08]"),children:[!h&&j.jsxs("div",{className:"px-3 pb-1 pt-0.5 text-[11px] font-medium text-muted-foreground/75",children:["AgentDock v","0.1.61"]}),j.jsxs("div",{className:"relative",children:[j.jsxs("button",{type:"button",onClick:()=>m(!y),className:at("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:[j.jsx(vy,{size:18,className:"shrink-0"}),!h&&j.jsx("span",{children:((Y=Lm.find(q=>q.code===s.language))==null?void 0:Y.label)||"English"})]}),y&&j.jsx("div",{className:at("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:Lm.map(q=>j.jsx("button",{type:"button",onClick:()=>b(q.code),className:at("w-full text-left px-3 py-2 text-sm transition-colors duration-150",s.language===q.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:q.label},q.code))})]}),j.jsxs("button",{type:"button",onClick:()=>c(O[o]),className:at("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:[j.jsx(N,{size:18,className:"shrink-0"}),!h&&j.jsx("span",{children:i(`theme.${o}`)})]}),j.jsx("button",{type:"button",onClick:()=>g(!h),className:at("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:h?j.jsx(dy,{size:18}):j.jsx(cy,{size:18})})]})]}),k?null:j.jsx("nav",{className:at("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:j.jsx("div",{className:"flex items-stretch gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:H.map(({id:q,path:K,end:$,Icon:ee,labelKey:se})=>j.jsxs(To,{to:K,end:$,className:({isActive:J})=>at("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",J?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-black/[0.05] hover:text-foreground dark:hover:bg-white/[0.07]"),children:[j.jsx(ee,{size:18,className:"shrink-0"}),j.jsx("span",{className:"max-w-[4.25rem] truncate",children:i(se)})]},q))})})]})}function Vb(){const{pathname:l}=Ct(),{desktopChat:i}=Vo(),s=l.startsWith("/chat"),o=l.startsWith("/chat")&&i;return j.jsxs("div",{className:at("flex h-[100dvh] overflow-hidden","bg-background/60 backdrop-blur-2xl"),children:[j.jsx("div",{className:"fixed left-0 right-0 top-0 z-50 hidden h-8 [-webkit-app-region:drag] md:block","aria-hidden":"true"}),j.jsx(qb,{}),j.jsx("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0 bg-background/45 backdrop-blur-2xl",children:j.jsx("main",{className:at("flex-1 min-h-0",o?"overflow-hidden":"overflow-y-auto",s?"p-4 pb-4 sm:p-6 sm:pb-6":"p-4 pb-24 sm:p-6 sm:pb-6"),children:j.jsx("div",{className:at(o&&"h-full min-h-0","mx-auto w-full max-w-7xl"),children:j.jsx(Xv,{})})})})]})}function Gb(){return j.jsx("div",{className:"flex min-h-64 items-center justify-center text-sm text-muted-foreground",children:"正在加载…"})}function Kb(){const l=Vo();return j.jsx(T.Suspense,{fallback:j.jsx(Gb,{}),children:j.jsxs(Zv,{children:[j.jsxs(Jn,{element:j.jsx(Vb,{}),children:[Yu.listRoutes().map(i=>i.index?j.jsx(Jn,{index:!0,element:i.element({features:l})},i.id):j.jsx(Jn,{path:i.path,element:i.element({features:l})},i.id)),j.jsx(Jn,{path:"*",element:j.jsx(Wn,{to:"/",replace:!0})})]}),j.jsx(Jn,{path:"*",element:j.jsx(Wn,{to:"/",replace:!0})})]})})}class Xb extends $n.Component{constructor(){super(...arguments);Ru(this,"state",{hasError:!1,errorMessage:""})}static getDerivedStateFromError(s){return{hasError:!0,errorMessage:s instanceof Error?s.message:String(s)}}componentDidCatch(s,o){console.error("App render failed",s,o)}render(){return this.state.hasError?j.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:j.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:[j.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"页面渲染失败"}),j.jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-400 break-words",children:this.state.errorMessage||"Unknown renderer error"}),j.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}}function jm(l,i){if(typeof l=="function")return l(i);l!=null&&(l.current=i)}function xg(...l){return i=>{let s=!1;const o=l.map(c=>{const f=jm(c,i);return!s&&typeof f=="function"&&(s=!0),f});if(s)return()=>{for(let c=0;c<o.length;c++){const f=o[c];typeof f=="function"?f():jm(l[c],null)}}}}function jS(...l){return T.useCallback(xg(...l),l)}var Qb=Symbol.for("react.lazy"),Uu=ay[" use ".trim().toString()];function Zb(l){return typeof l=="object"&&l!==null&&"then"in l}function Eg(l){return l!=null&&typeof l=="object"&&"$$typeof"in l&&l.$$typeof===Qb&&"_payload"in l&&Zb(l._payload)}function Jb(l){const i=Fb(l),s=T.forwardRef((o,c)=>{let{children:f,...h}=o;Eg(f)&&typeof Uu=="function"&&(f=Uu(f._payload));const g=T.Children.toArray(f),y=g.find(Ib);if(y){const m=y.props.children,b=g.map(v=>v===y?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:v);return j.jsx(i,{...h,ref:c,children:T.isValidElement(m)?T.cloneElement(m,void 0,b):null})}return j.jsx(i,{...h,ref:c,children:f})});return s.displayName=`${l}.Slot`,s}var $b=Jb("Slot");function Fb(l){const i=T.forwardRef((s,o)=>{let{children:c,...f}=s;if(Eg(c)&&typeof Uu=="function"&&(c=Uu(c._payload)),T.isValidElement(c)){const h=eS(c),g=Pb(f,c.props);return c.type!==T.Fragment&&(g.ref=o?xg(o,h):h),T.cloneElement(c,g)}return T.Children.count(c)>1?T.Children.only(null):null});return i.displayName=`${l}.SlotClone`,i}var Wb=Symbol("radix.slottable");function Ib(l){return T.isValidElement(l)&&typeof l.type=="function"&&"__radixId"in l.type&&l.type.__radixId===Wb}function Pb(l,i){const s={...i};for(const o in i){const c=l[o],f=i[o];/^on[A-Z]/.test(o)?c&&f?s[o]=(...g)=>{const y=f(...g);return c(...g),y}:c&&(s[o]=c):o==="style"?s[o]={...c,...f}:o==="className"&&(s[o]=[c,f].filter(Boolean).join(" "))}return{...l,...s}}function eS(l){var o,c;let i=(o=Object.getOwnPropertyDescriptor(l.props,"ref"))==null?void 0:o.get,s=i&&"isReactWarning"in i&&i.isReactWarning;return s?l.ref:(i=(c=Object.getOwnPropertyDescriptor(l,"ref"))==null?void 0:c.get,s=i&&"isReactWarning"in i&&i.isReactWarning,s?l.props.ref:l.props.ref||l.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"},aS={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 wm({variant:l="primary",size:i="md",className:s,children:o,loading:c,asChild:f,disabled:h,type:g="button",...y}){const m=i==="default"?"md":i,b=f?$b:"button";return j.jsxs(b,{...f?{}:{type:g},className:at("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[l],aS[m],s),disabled:h||c,...y,children:[c&&j.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24","aria-hidden":!0,children:[j.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),j.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),o]})}const zo="http://127.0.0.1:9831",nS=`${zo}/api/local/v1`,lS=["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"];function Tg(l){return(l.trim()||nS).replace(/\/+$/,"")}function it(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function X(l,i){return typeof l[i]=="string"}function el(l,i){return typeof l[i]=="boolean"}function Il(l,i){return it(l[i])}function Rg(l){return it(l)&&X(l,"type")&&X(l,"channelId")}function iS(l){if(!it(l))return!1;const i=l.value;return X(l,"metric")&&X(l,"operator")&&(typeof i=="number"||typeof i=="string"||typeof i=="boolean")}function uS(l){return it(l)&&X(l,"id")&&X(l,"workspaceId")&&X(l,"title")&&el(l,"live")&&X(l,"updatedAt")&&X(l,"createdAt")&&typeof l.historyCount=="number"&&X(l,"excerpt")}function rS(l){return it(l)&&X(l,"id")&&X(l,"role")&&X(l,"content")&&X(l,"timestamp")}function sS(l){return it(l)?(l.id===void 0||typeof l.id=="string")&&(l.role===void 0||["user","assistant","system"].includes(l.role))&&(l.content===void 0||typeof l.content=="string")&&(l.timestamp===void 0||typeof l.timestamp=="string"):!1}function oS(l){return it(l)&&X(l,"id")&&X(l,"threadId")&&X(l,"status")&&X(l,"startedAt")&&X(l,"updatedAt")}function cS(l){return it(l)&&X(l,"id")&&X(l,"workspaceId")&&X(l,"platform")&&Rg(l.route)&&X(l,"executionMode")&&X(l,"triggerType")&&X(l,"promptTemplate")&&X(l,"description")&&el(l,"enabled")&&X(l,"concurrencyPolicy")&&X(l,"createdAt")&&X(l,"updatedAt")}function fS(l){return it(l)&&X(l,"id")&&X(l,"jobId")&&X(l,"status")&&X(l,"triggeredAt")}function dS(l){return it(l)&&X(l,"id")&&X(l,"workspaceId")&&X(l,"title")&&X(l,"sourceType")&&Il(l,"sourceConfig")&&iS(l.condition)&&X(l,"promptTemplate")&&X(l,"platform")&&Rg(l.route)&&X(l,"executionMode")&&el(l,"enabled")&&typeof l.cooldownMs=="number"&&X(l,"concurrencyPolicy")&&X(l,"createdAt")&&X(l,"updatedAt")}function hS(l){return it(l)&&X(l,"id")&&X(l,"monitorId")&&X(l,"status")&&X(l,"triggeredAt")}function Um(l){return it(l)&&X(l,"agentType")&&X(l,"runtimeId")&&X(l,"displayName")&&X(l,"status")&&el(l,"installed")&&X(l,"detectedAt")&&X(l,"summary")&&Array.isArray(l.issues)&&Array.isArray(l.recommendedActions)&&X(l,"source")}function mS(l){return it(l)&&l.mode==="desktop"&&X(l,"phase")&&el(l,"pendingRestart")&&Il(l,"service")&&Il(l,"roles")&&Il(l,"settings")&&Il(l,"runtimeConfig")&&Array.isArray(l.logs)&&l.logs.every(i=>typeof i=="string")}function Zn(l){return it(l)&&X(l,"type")}function gS(l){if(!it(l)||!X(l,"type"))return!1;switch(l.type){case"runtime.updated":return mS(l.runtime);case"runtime.detect.started":return X(l,"detectedAt");case"runtime.detect.completed":return X(l,"detectedAt")&&Array.isArray(l.runtimes)&&l.runtimes.every(Um);case"runtime.detect.failed":return X(l,"detectedAt")&&X(l,"error");case"runtime.status.changed":return Um(l.runtime);case"thread.updated":return uS(l.thread);case"thread.session.activated":return X(l,"workspaceId")&&X(l,"threadId")&&X(l,"reason");case"message.created":return X(l,"threadId")&&rS(l.message)&&(l.stream===void 0||Zn(l.stream));case"message.updated":return X(l,"threadId")&&sS(l.message)&&(l.stream===void 0||Zn(l.stream));case"run.updated":return oS(l.run)&&(l.stream===void 0||Zn(l.stream));case"scheduler.job.updated":return cS(l.job);case"scheduler.run.updated":return fS(l.run);case"automation.monitor.updated":return dS(l.monitor);case"automation.monitor.run.updated":return hS(l.run);case"presence.updated":return el(l,"live")&&(l.stream===void 0||Zn(l.stream));case"stream.updated":return Zn(l.stream);case"external.run.snapshot":return it(l.snapshot)&&X(l.snapshot,"runId");case"external.run.stream":return X(l,"runId")&&Zn(l.stream);default:return!1}}function pS(l){return l.type==="stream.updated"||(l.type==="message.created"||l.type==="message.updated"||l.type==="run.updated")&&l.stream?l.stream:null}const _u=new Map;function yS(l,i,s){const o=new Set,c=new Set;let f=null,h=null,g="disconnected";const y=N=>{g=N,c.forEach(A=>{try{A(N)}catch{}})},m=()=>{h!==null&&(i.cancelReconnect(h),h=null)},b=()=>{f==null||f.close(),f=null},v=()=>{m(),b(),s()},O=()=>{if(f||o.size===0&&c.size===0)return;const N=i.eventSourceFactory(`${l}/events`);f=N,N.onopen=()=>{f===N&&y("connected")};const A=H=>{try{const k=JSON.parse(H.data);gS(k)&&o.forEach(Y=>{try{Y(k)}catch{}})}catch{}};lS.forEach(H=>N.addEventListener(H,A)),N.onerror=()=>{f===N&&(b(),y("disconnected"),(o.size>0||c.size>0)&&h===null&&(h=i.scheduleReconnect(()=>{h=null,O()},1e3)))}};return{subscribe(N){const A=H=>N(H);return o.add(A),O(),()=>{o.delete(A)&&o.size===0&&c.size===0&&v()}},subscribeConnectionState(N){if(c.add(N),O(),g==="connected")try{N("connected")}catch{}return()=>{c.delete(N)&&o.size===0&&c.size===0&&v()}}}}function Hm(l,i){const s=_u.get(l);if(s)return s;let o;return o=yS(l,i,()=>{_u.get(l)===o&&_u.delete(l)}),_u.set(l,o),o}function vS(l){const i=Tg(l.baseUrl),s=l.fetchImpl||globalThis.fetch.bind(globalThis),o=l.eventSourceFactory||(b=>new EventSource(b)),c=l.scheduleReconnect||((b,v)=>setTimeout(b,v)),f=l.cancelReconnect||(b=>clearTimeout(b)),h=new Set,g=b=>{const O=Hm(i,{eventSourceFactory:o,scheduleReconnect:c,cancelReconnect:f}).subscribe(b);return h.add(O),()=>{h.delete(O),O()}};return{baseUrl:i,request:async(b,v,O)=>{const N=await s(`${i}${v}`,{method:b,headers:{"Content-Type":"application/json"},body:O===void 0?void 0:JSON.stringify(O)}),A=await N.json();if(!N.ok||!A.ok)throw new Error(A.error||`Local AI Core request failed: ${N.status}`);return A.data},async detect(b=350){var N;const v=new AbortController,O=setTimeout(()=>v.abort(),b);try{const A=await s(`${i}/health`,{signal:v.signal}),H=await A.json();return A.ok&&H.ok&&((N=H.data)==null?void 0:N.name)==="local-ai-core"}catch{return!1}finally{clearTimeout(O)}},events:{subscribe:g,subscribeConnectionState:b=>{const O=Hm(i,{eventSourceFactory:o,scheduleReconnect:c,cancelReconnect:f}).subscribeConnectionState(b);return h.add(O),()=>{h.delete(O),O()}},subscribeRuntime(b){return g(v=>{v.type==="runtime.updated"&&b(v.runtime)})},subscribeBridge(b){return g(v=>{const O=pS(v);O&&b(O)})},close(){const b=Array.from(h);h.clear(),b.forEach(v=>v())}}}}const No=Tg("/api/local/v1");No.endsWith("/api/local/v1")&&No.slice(0,-13);const Og=vS({baseUrl:No});function qe(l,i,s){return Og.request(l,i,s)}function Ag(l){const i=Object.entries(l).filter(([,o])=>o!==void 0&&o!=="");if(i.length===0)return"";const s=new URLSearchParams;for(const[o,c]of i)s.set(o,String(c));return`?${s.toString()}`}function bS(l){return Og.events.subscribe(l)}function SS(){return qe("GET","/runtime")}function wS(){return qe("POST","/runtime/service/start")}function US(){return qe("POST","/runtime/service/restart")}function xS(l){const i=Ag({limit:l});return qe("GET",`/runtime/logs${i}`)}function HS(l="sys",i=200){const s=Ag({level:l,limit:i});return qe("GET",`/logs${s}`)}function BS(){return qe("GET","/runtime/agent-runtimes")}function kS(){return qe("POST","/runtimes/refresh")}function YS(){return qe("GET","/diagnostics/errors")}function qS(){return qe("POST","/diagnostics/doctor")}function VS(){return qe("GET","/runtime/runtime-config")}function GS(l){return qe("POST","/runtime/runtime-config",{config:l})}function KS(l){return qe("POST","/runtime/settings",l)}function XS(){return qe("GET","/providers")}function QS(l){return qe("POST","/providers",l)}function ZS(l,i){return qe("PUT",`/providers/${encodeURIComponent(l)}`,i)}function JS(l){return qe("DELETE",`/providers/${encodeURIComponent(l)}`)}function $S(l={}){const i=new URLSearchParams;l.workspaceId&&i.set("workspace_id",l.workspaceId),l.runtimeId&&i.set("runtime_id",l.runtimeId),l.status&&i.set("status",Array.isArray(l.status)?l.status.join(","):l.status),l.limit&&i.set("limit",String(l.limit));const s=i.toString()?`?${i.toString()}`:"";return qe("GET",`/tasks${s}`)}function FS(l={}){const i=new URLSearchParams;l.workspaceId&&i.set("workspace_id",l.workspaceId),l.taskId&&i.set("task_id",l.taskId),l.status&&i.set("status",Array.isArray(l.status)?l.status.join(","):l.status),l.limit&&i.set("limit",String(l.limit));const s=i.toString()?`?${i.toString()}`:"";return qe("GET",`/approvals${s}`)}function WS(l={}){const i=new URLSearchParams;l.workspaceId&&i.set("workspace_id",l.workspaceId),l.taskId&&i.set("task_id",l.taskId),l.approvalId&&i.set("approval_id",l.approvalId),l.type&&i.set("type",Array.isArray(l.type)?l.type.join(","):l.type),l.limit&&i.set("limit",String(l.limit));const s=i.toString()?`?${i.toString()}`:"";return qe("GET",`/audit-events${s}`)}function Bm(){return qe("GET","/capabilities/snapshot")}function IS(){return qe("GET","/plugins/diagnostics")}function ES(l){return bS(i=>{i.type==="runtime.updated"&&l(i.runtime)})}const km=20,TS=500;function RS(l){return new Promise(i=>window.setTimeout(i,l))}function OS(){const l=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-${l}`)}function AS(){return j.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:j.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:[j.jsx(Vm,{size:16,className:"animate-spin"}),"正在初始化 AgentDock 运行时…"]})})}function _S({message:l,logs:i,onRetry:s}){return j.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-gray-950 p-6",children:j.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:[j.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:j.jsxs("div",{className:"flex items-start gap-3",children:[j.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:j.jsx(Hy,{size:18})}),j.jsxs("div",{children:[j.jsx("h1",{className:"text-lg font-semibold text-red-700 dark:text-red-300",children:"AgentDock 运行时初始化失败"}),j.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400 break-words",children:l})]})]})}),j.jsxs("div",{className:"px-6 py-5 space-y-4",children:[j.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:[j.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:"What we can do next"}),j.jsx("p",{className:"mt-1",children:"请先重试本地运行时初始化。如果仍然失败,请检查下方运行时日志,并确认 Local AI Core 配置文件路径与运行环境是否正确。"})]}),i.length>0&&j.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:[j.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"最近的桌面日志"}),j.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:i.join(`
|
|
167
167
|
`)})]}),j.jsxs("div",{className:"flex gap-3",children:[j.jsxs(wm,{onClick:s,children:[j.jsx(Vm,{size:14})," 重试初始化"]}),j.jsx(wm,{variant:"secondary",onClick:()=>window.location.reload(),children:"重新加载应用"})]})]})]})})}function CS(){const[l,i]=T.useState({status:"loading"}),s=T.useCallback(async()=>{i({status:"loading"});try{let o=null;for(let c=0;c<km;c+=1)try{await SS(),o=null;break}catch(f){o=f,c<km-1&&await RS(TS)}if(o)throw o;hm(await Bm())}catch(o){let c=[];try{c=await xS(80)}catch{c=[]}i({status:"error",message:o instanceof Error?o.message:String(o),logs:c});return}i({status:"ready"})},[]);return T.useEffect(()=>{s()},[s]),T.useEffect(()=>ES(()=>{Bm().then(o=>hm(o)).catch(()=>{})}),[]),l.status==="loading"?j.jsx(AS,{}):l.status==="error"?j.jsx(_S,{message:l.message,logs:l.logs,onRetry:()=>void s()}):j.jsx(v1,{children:j.jsx(Kb,{})})}async function zS(){OS(),await Bb(),mg.getState().init(),Zy.createRoot(document.getElementById("root")).render(j.jsx(Xb,{children:j.jsx(CS,{})}))}zS();export{Ag as A,wm as B,dy as C,my as D,DS as E,py as F,sy as G,IS as H,YS as I,US as J,KS as K,rg as L,Ry as M,qS as N,HS as O,jS as P,Ey as Q,Vm as R,Ly as S,Hy as T,Gy as U,ay as V,ky as W,xg as X,tg as Y,No as Z,gt as _,Vo as a,$S as b,nt as c,FS as d,WS as e,kS as f,at as g,Ym as h,wS as i,j,SS as k,BS as l,MS as m,$n as n,ES as o,VS as p,XS as q,T as r,bS as s,LS as t,G1 as u,GS as v,QS as w,ZS as x,JS as y,qe as z};
|