memory-eternal 0.10.32 → 0.10.34

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/lib/client.js CHANGED
@@ -3,17 +3,17 @@ window.__ModuleLoader__.load({
3
3
  factory: (require) => {
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
- var na=Object.create;var St=Object.defineProperty;var oa=Object.getOwnPropertyDescriptor;var ia=Object.getOwnPropertyNames;var ra=Object.getPrototypeOf,la=Object.prototype.hasOwnProperty;var sa=(t,o)=>{for(var r in o)St(t,r,{get:o[r],enumerable:!0})},Ht=(t,o,r,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of ia(o))!la.call(t,p)&&p!==r&&St(t,p,{get:()=>o[p],enumerable:!(f=oa(o,p))||f.enumerable});return t};var da=(t,o,r)=>(r=t!=null?na(ra(t)):{},Ht(o||!t||!t.__esModule?St(r,"default",{value:t,enumerable:!0}):r,t)),ca=t=>Ht(St({},"__esModule",{value:!0}),t);var _a={};sa(_a,{EN:()=>Zt,MemoryLibrary:()=>Da,ZH:()=>Jt,apply:()=>Ca,inject:()=>ka});module.exports=ca(_a);var n=da(require("react"),1);var pa={"&":"&amp;","<":"&lt;",">":"&gt;"},Tt=t=>String(t).replace(/[&<>]/g,o=>pa[o]),ua=[[/结论|总结|tl;?dr|summary|takeaway/i,"\u2705","ok"],[/风险|注意|警告|禁止|坑|踩坑|务必/i,"\u26A0\uFE0F","warn"],[/根因|原因|为什么|定位|复现/i,"\u{1F50D}","info"],[/修复|解决|变更|fix/i,"\u{1F527}","ok"],[/验证|测试|实测|回归/i,"\u{1F9EA}","ok"],[/方案|做法|实现|设计|思路|架构/i,"\u{1F6E0}\uFE0F","plan"],[/步骤|流程|操作|用法|命令/i,"\u{1F9E9}","plan"],[/背景|由来|context/i,"\u{1F9ED}","info"],[/目标|需求|要解决/i,"\u{1F3AF}","plan"],[/环境|依赖|前置|安装/i,"\u{1F4E6}","info"],[/收益|效果|性能|指标|数据|统计/i,"\u{1F4C8}","ok"],[/示例|例子|样例|demo/i,"\u{1F4A1}","idea"],[/参考|链接|相关/i,"\u{1F517}","info"]],ma=["\u2728","info"],ga=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],fa=t=>{let o=String(t);for(let[r,f,p]of ua)if(r.test(o))return[f,p];return ma},ba=t=>{let o=t.join(" ");for(let[r,f,p]of ga)if(r.test(o))return[f,p];return["\u{1F4CC}","info"]};function lt(t){let o=String(t),r=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(o);if(r&&!/[是为有了吗呢着过把被和与或于]/.test(r[1]))return'<span class="md-kv"><span class="md-k">'+Tt(r[1])+'</span><span class="md-v">'+lt(r[2])+"</span></span>";let f=Tt(o);return f=f.replace(/^\[([ xX])\](?=\s|$)\s*/,(p,i)=>'<span class="md-task">'+(i.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),f=f.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),f=f.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),f=f.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),f=f.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(p,i,w)=>/^(https?:|\/|#)/i.test(w)?'<a class="md-link" href="'+w+'" target="_blank" rel="noopener noreferrer">'+i+"</a>":i),f}function Ct(t){let o=String(t||"").replace(/\r\n?/g,`
7
- `),r=/^---\n([\s\S]*?)\n---\n?/.exec(o);if(!r)return{meta:[],body:o};let f=[];for(let p of r[1].split(`
8
- `)){let i=p.indexOf(":");if(i<=0)continue;let w=p.slice(0,i).trim(),D=p.slice(i+1).trim().replace(/^["']|["']$/g,"");w&&f.push([w,D])}return{meta:f,body:o.slice(r[0].length)}}function Et(t){let o=String(t||"").trim().replace(/^\[|\]$/g,"");return o?o.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Dt(t){let o=Ct(String(t||"").replace(/\r\n?/g,`
9
- `)).body;if(!o.trim())return"";let r=[],f=o.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(g,z,T)=>(r.push('<pre class="md-pre"><code>'+Tt(T.replace(/\n$/,""))+"</code></pre>"),"\0F"+(r.length-1)+"\0")),p=[],i=[],w=null,D=null,k=()=>{i.length&&(p.push('<p class="md-p">'+i.join("<br/>")+"</p>"),i=[])},E=()=>{if(!w)return;let g=w.type;p.push("<"+g+' class="md-'+g+'">'+w.items.map(z=>"<li>"+z+"</li>").join("")+"</"+g+">"),w=null},C=()=>{if(!D)return;let[g,z]=ba(D);p.push('<div class="md-callout md-c-'+z+'"><span class="md-ico">'+g+"</span>"+D.join("<br/>")+"</div>"),D=null},h=()=>{k(),E(),C()};for(let g of f.split(`
10
- `)){let z=g.trim();if(!z){h();continue}let T=/^\u0000F(\d+)\u0000$/.exec(z);if(T){h(),p.push(r[Number(T[1])]);continue}let v;if(v=/^(#{1,6})\s+(.+)$/.exec(z)){h();let[j,L]=fa(v[2]);p.push('<div class="md-h md-h-'+(v[1].length<=2?"h1":"h2")+" md-c-"+L+'"><span class="md-ico">'+j+'</span><span class="md-hx">'+lt(v[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(z)){h(),p.push('<hr class="md-hr"/>');continue}if(v=/^>\s?(.*)$/.exec(z)){k(),E(),D=D||[],D.push(lt(v[1]));continue}if(v=/^[-*+]\s+(.+)$/.exec(z)){k(),C(),(!w||w.type!=="ul")&&(E(),w={type:"ul",items:[]}),w.items.push(lt(v[1]));continue}if(v=/^\d+[.)]\s+(.+)$/.exec(z)){k(),C(),(!w||w.type!=="ol")&&(E(),w={type:"ol",items:[]}),w.items.push(lt(v[1]));continue}E(),C(),i.push(lt(z))}return h(),p.join(`
11
- `)}function Ot(t={}){let o=t.repo||"EternalNight996/memory-eternal",r=String(t.title||"[Bug] ").slice(0,120),f=Array.isArray(t.labels)?t.labels:["bug"],p=Number(t.maxLength)>500?Number(t.maxLength):7e3,i=k=>{let E=new URLSearchParams;return E.set("title",r),E.set("body",k),f.length&&E.set("labels",f.join(",")),"https://github.com/"+o+"/issues/new?"+E.toString()},w=String(t.body||""),D=i(w);if(D.length>p){let k=`
12
-
13
- > \u5185\u5BB9\u8FC7\u957F\u5DF2\u622A\u65AD\uFF1A\u5B8C\u6574\u8BCA\u65AD\u8BF7\u5728\u63D2\u4EF6\u91CC\u70B9\u300C\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u300D\uFF0C\u518D\u8865\u5230 issue \u8BC4\u8BBA\u91CC\u3002`,E=C=>i(w.slice(0,C)+k);if(E(0).length>p)w=k;else{let C=0,h=w.length;for(;C<h;){let g=Math.ceil((C+h)/2);E(g).length<=p?C=g:h=g-1}w=w.slice(0,C)+k}D=i(w)}return D}function Wt(t={}){return["## \u73B0\u8C61",String(t.description||"").trim()||"\uFF08\u8BF7\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF09","","## \u590D\u73B0\u6B65\u9AA4","1. ","2. ","","## \u671F\u671B\u884C\u4E3A","","## \u5B9E\u9645\u884C\u4E3A","","## \u73AF\u5883","- \u63D2\u4EF6\u7248\u672C: "+(t.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",t.diagnostics||"","","---","> \u7531 memory-eternal \u63D2\u4EF6\u5185\u300C\u53CD\u9988\u5F02\u5E38\u300D\u751F\u6210\uFF08\u8BCA\u65AD\u4FE1\u606F\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E\u5404\u7C7B key/token \u5DF2\u66FF\u6362\uFF09\u3002"].join(`
14
- `)}var zt="https://github.com/EternalNight996/memory-eternal",ya=["\u6211\u5728\u4F7F\u7528 memory-eternal\uFF08DeepSeek Harness \u7684\u8BB0\u5FC6\u63D2\u4EF6\uFF09\u65F6\u9047\u5230\u4E86\u95EE\u9898\uFF0C\u8BF7\u4F60\u5E2E\u6211\u628A\u8FD9\u4E2A\u95EE\u9898\u63D0\u4EA4\u5230 GitHub\u3002","","\u4ED3\u5E93\uFF1A"+zt,"","\u8BF7\u6309\u8FD9\u4E2A\u6D41\u7A0B\u505A\uFF1A","","1. \u5148\u8DD1 `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50`\uFF0C\u770B\u662F\u5426\u5DF2\u6709\u76F8\u540C\u95EE\u9898\uFF1A"," - \u5DF2\u6709 \u2192 \u7528 `gh issue comment <\u7F16\u53F7> --body-file <\u6587\u4EF6>` \u8865\u5145\u73B0\u8C61\uFF0C\u4E0D\u8981\u91CD\u590D\u5F00\u65B0 issue\uFF1B"," - \u6CA1\u6709 \u2192 \u7EE7\u7EED\u7B2C 2 \u6B65\u3002",'2. \u628A\u6B63\u6587\u5199\u6210\u6587\u4EF6\uFF0C\u7136\u540E `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <\u4E00\u53E5\u8BDD\u6982\u62EC>" --body-file <\u6587\u4EF6>`\uFF1B\u6B63\u6587\u7528\u8FD9\u4E2A\u7ED3\u6784\uFF1A'," \u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A / \u5B9E\u9645\u884C\u4E3A / \u73AF\u5883\uFF08\u63D2\u4EF6\u7248\u672C / DSH \u7248\u672C / \u64CD\u4F5C\u7CFB\u7EDF / Node\uFF09/ \u8BCA\u65AD\u4FE1\u606F\u3002","3. \u5982\u679C `gh` \u6CA1\u767B\u5F55\u6216\u4E0D\u53EF\u7528\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u63D0\u4EA4\uFF0C\u6539\u4E3A\u8F93\u51FA\u4E00\u6761\u300C\u6807\u9898\u4E0E\u6B63\u6587\u90FD\u5DF2\u9884\u586B\u300D\u7684 GitHub \u65B0\u5EFA issue \u94FE\u63A5\u7ED9\u6211\uFF0C\u6211\u81EA\u5DF1\u70B9\u63D0\u4EA4\u3002","4. \u63D0\u4EA4\u6210\u529F\u540E\uFF0C\u628A issue \u94FE\u63A5\u53D1\u7ED9\u6211\u3002","","\u6CE8\u610F\uFF1A\u6211\u7684\u95EE\u9898\u63CF\u8FF0\u8BF7\u539F\u6837\u7167\u5F55\uFF0C\u4E0D\u8981\u66FF\u6211\u7F8E\u5316\u6216\u7701\u7565\u7EC6\u8282\uFF1B\u8BCA\u65AD\u4FE1\u606F\u539F\u6837\u653E\u8FDB\u300C\u8BCA\u65AD\u4FE1\u606F\u300D\u4E00\u8282\u3002","","\u6211\u7684\u95EE\u9898\u63CF\u8FF0\uFF1A","<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>","","\u8BCA\u65AD\u4FE1\u606F\uFF1A","<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>"].join(`
6
+ var na=Object.create;var St=Object.defineProperty;var oa=Object.getOwnPropertyDescriptor;var ia=Object.getOwnPropertyNames;var la=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var sa=(t,i)=>{for(var r in i)St(t,r,{get:i[r],enumerable:!0})},Ht=(t,i,r,g)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of ia(i))!ra.call(t,c)&&c!==r&&St(t,c,{get:()=>i[c],enumerable:!(g=oa(i,c))||g.enumerable});return t};var da=(t,i,r)=>(r=t!=null?na(la(t)):{},Ht(i||!t||!t.__esModule?St(r,"default",{value:t,enumerable:!0}):r,t)),ca=t=>Ht(St({},"__esModule",{value:!0}),t);var _a={};sa(_a,{EN:()=>Zt,MemoryLibrary:()=>Da,ZH:()=>Jt,apply:()=>Ca,inject:()=>ka});module.exports=ca(_a);var o=da(require("react"),1);var pa={"&":"&amp;","<":"&lt;",">":"&gt;"},Tt=t=>String(t).replace(/[&<>]/g,i=>pa[i]),ua=[[/结论|总结|tl;?dr|summary|takeaway/i,"\u2705","ok"],[/风险|注意|警告|禁止|坑|踩坑|务必/i,"\u26A0\uFE0F","warn"],[/根因|原因|为什么|定位|复现/i,"\u{1F50D}","info"],[/修复|解决|变更|fix/i,"\u{1F527}","ok"],[/验证|测试|实测|回归/i,"\u{1F9EA}","ok"],[/方案|做法|实现|设计|思路|架构/i,"\u{1F6E0}\uFE0F","plan"],[/步骤|流程|操作|用法|命令/i,"\u{1F9E9}","plan"],[/背景|由来|context/i,"\u{1F9ED}","info"],[/目标|需求|要解决/i,"\u{1F3AF}","plan"],[/环境|依赖|前置|安装/i,"\u{1F4E6}","info"],[/收益|效果|性能|指标|数据|统计/i,"\u{1F4C8}","ok"],[/示例|例子|样例|demo/i,"\u{1F4A1}","idea"],[/参考|链接|相关/i,"\u{1F517}","info"]],ma=["\u2728","info"],ga=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],fa=t=>{let i=String(t);for(let[r,g,c]of ua)if(r.test(i))return[g,c];return ma},ya=t=>{let i=t.join(" ");for(let[r,g,c]of ga)if(r.test(i))return[g,c];return["\u{1F4CC}","info"]};function rt(t){let i=String(t),r=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(i);if(r&&!/[是为有了吗呢着过把被和与或于]/.test(r[1]))return'<span class="md-kv"><span class="md-k">'+Tt(r[1])+'</span><span class="md-v">'+rt(r[2])+"</span></span>";let g=Tt(i);return g=g.replace(/^\[([ xX])\](?=\s|$)\s*/,(c,l)=>'<span class="md-task">'+(l.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),g=g.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),g=g.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),g=g.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),g=g.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(c,l,C)=>/^(https?:|\/|#)/i.test(C)?'<a class="md-link" href="'+C+'" target="_blank" rel="noopener noreferrer">'+l+"</a>":l),g}function Ct(t){let i=String(t||"").replace(/\r\n?/g,`
7
+ `),r=/^---\n([\s\S]*?)\n---\n?/.exec(i);if(!r)return{meta:[],body:i};let g=[];for(let c of r[1].split(`
8
+ `)){let l=c.indexOf(":");if(l<=0)continue;let C=c.slice(0,l).trim(),T=c.slice(l+1).trim().replace(/^["']|["']$/g,"");C&&g.push([C,T])}return{meta:g,body:i.slice(r[0].length)}}function Ot(t){let i=String(t||"").trim().replace(/^\[|\]$/g,"");return i?i.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Dt(t){let i=Ct(String(t||"").replace(/\r\n?/g,`
9
+ `)).body;if(!i.trim())return"";let r=[],g=i.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(m,z,R)=>(r.push('<pre class="md-pre"><code>'+Tt(R.replace(/\n$/,""))+"</code></pre>"),"\0F"+(r.length-1)+"\0")),c=[],l=[],C=null,T=null,S=()=>{l.length&&(c.push('<p class="md-p">'+l.join("<br/>")+"</p>"),l=[])},H=()=>{if(!C)return;let m=C.type;c.push("<"+m+' class="md-'+m+'">'+C.items.map(z=>"<li>"+z+"</li>").join("")+"</"+m+">"),C=null},k=()=>{if(!T)return;let[m,z]=ya(T);c.push('<div class="md-callout md-c-'+z+'"><span class="md-ico">'+m+"</span>"+T.join("<br/>")+"</div>"),T=null},x=()=>{S(),H(),k()};for(let m of g.split(`
10
+ `)){let z=m.trim();if(!z){x();continue}let R=/^\u0000F(\d+)\u0000$/.exec(z);if(R){x(),c.push(r[Number(R[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(z)){x();let[j,L]=fa(w[2]);c.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+L+'"><span class="md-ico">'+j+'</span><span class="md-hx">'+rt(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(z)){x(),c.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(z)){S(),H(),T=T||[],T.push(rt(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(z)){S(),k(),(!C||C.type!=="ul")&&(H(),C={type:"ul",items:[]}),C.items.push(rt(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(z)){S(),k(),(!C||C.type!=="ol")&&(H(),C={type:"ol",items:[]}),C.items.push(rt(w[1]));continue}H(),k(),l.push(rt(z))}return x(),c.join(`
11
+ `)}function Et(t={}){let i=t.repo||"EternalNight996/memory-eternal",r=String(t.title||"[Bug] ").slice(0,120),g=Array.isArray(t.labels)?t.labels:["bug"],c=Number(t.maxLength)>500?Number(t.maxLength):7e3,l=S=>{let H=new URLSearchParams;return H.set("title",r),H.set("body",S),g.length&&H.set("labels",g.join(",")),"https://github.com/"+i+"/issues/new?"+H.toString()},C=String(t.body||""),T=l(C);if(T.length>c){let S=`
12
+
13
+ > \u5185\u5BB9\u8FC7\u957F\u5DF2\u622A\u65AD\uFF1A\u5B8C\u6574\u8BCA\u65AD\u8BF7\u5728\u63D2\u4EF6\u91CC\u70B9\u300C\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u300D\uFF0C\u518D\u8865\u5230 issue \u8BC4\u8BBA\u91CC\u3002`,H=k=>l(C.slice(0,k)+S);if(H(0).length>c)C=S;else{let k=0,x=C.length;for(;k<x;){let m=Math.ceil((k+x)/2);H(m).length<=c?k=m:x=m-1}C=C.slice(0,k)+S}T=l(C)}return T}function Wt(t={}){return["## \u73B0\u8C61",String(t.description||"").trim()||"\uFF08\u8BF7\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF09","","## \u590D\u73B0\u6B65\u9AA4","1. ","2. ","","## \u671F\u671B\u884C\u4E3A","","## \u5B9E\u9645\u884C\u4E3A","","## \u73AF\u5883","- \u63D2\u4EF6\u7248\u672C: "+(t.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",t.diagnostics||"","","---","> \u7531 memory-eternal \u63D2\u4EF6\u5185\u300C\u53CD\u9988\u5F02\u5E38\u300D\u751F\u6210\uFF08\u8BCA\u65AD\u4FE1\u606F\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E\u5404\u7C7B key/token \u5DF2\u66FF\u6362\uFF09\u3002"].join(`
14
+ `)}var zt="https://github.com/EternalNight996/memory-eternal",ba=["\u6211\u5728\u4F7F\u7528 memory-eternal\uFF08DeepSeek Harness \u7684\u8BB0\u5FC6\u63D2\u4EF6\uFF09\u65F6\u9047\u5230\u4E86\u95EE\u9898\uFF0C\u8BF7\u4F60\u5E2E\u6211\u628A\u8FD9\u4E2A\u95EE\u9898\u63D0\u4EA4\u5230 GitHub\u3002","","\u4ED3\u5E93\uFF1A"+zt,"","\u8BF7\u6309\u8FD9\u4E2A\u6D41\u7A0B\u505A\uFF1A","","1. \u5148\u8DD1 `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50`\uFF0C\u770B\u662F\u5426\u5DF2\u6709\u76F8\u540C\u95EE\u9898\uFF1A"," - \u5DF2\u6709 \u2192 \u7528 `gh issue comment <\u7F16\u53F7> --body-file <\u6587\u4EF6>` \u8865\u5145\u73B0\u8C61\uFF0C\u4E0D\u8981\u91CD\u590D\u5F00\u65B0 issue\uFF1B"," - \u6CA1\u6709 \u2192 \u7EE7\u7EED\u7B2C 2 \u6B65\u3002",'2. \u628A\u6B63\u6587\u5199\u6210\u6587\u4EF6\uFF0C\u7136\u540E `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <\u4E00\u53E5\u8BDD\u6982\u62EC>" --body-file <\u6587\u4EF6>`\uFF1B\u6B63\u6587\u7528\u8FD9\u4E2A\u7ED3\u6784\uFF1A'," \u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A / \u5B9E\u9645\u884C\u4E3A / \u73AF\u5883\uFF08\u63D2\u4EF6\u7248\u672C / DSH \u7248\u672C / \u64CD\u4F5C\u7CFB\u7EDF / Node\uFF09/ \u8BCA\u65AD\u4FE1\u606F\u3002","3. \u5982\u679C `gh` \u6CA1\u767B\u5F55\u6216\u4E0D\u53EF\u7528\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u63D0\u4EA4\uFF0C\u6539\u4E3A\u8F93\u51FA\u4E00\u6761\u300C\u6807\u9898\u4E0E\u6B63\u6587\u90FD\u5DF2\u9884\u586B\u300D\u7684 GitHub \u65B0\u5EFA issue \u94FE\u63A5\u7ED9\u6211\uFF0C\u6211\u81EA\u5DF1\u70B9\u63D0\u4EA4\u3002","4. \u63D0\u4EA4\u6210\u529F\u540E\uFF0C\u628A issue \u94FE\u63A5\u53D1\u7ED9\u6211\u3002","","\u6CE8\u610F\uFF1A\u6211\u7684\u95EE\u9898\u63CF\u8FF0\u8BF7\u539F\u6837\u7167\u5F55\uFF0C\u4E0D\u8981\u66FF\u6211\u7F8E\u5316\u6216\u7701\u7565\u7EC6\u8282\uFF1B\u8BCA\u65AD\u4FE1\u606F\u539F\u6837\u653E\u8FDB\u300C\u8BCA\u65AD\u4FE1\u606F\u300D\u4E00\u8282\u3002","","\u6211\u7684\u95EE\u9898\u63CF\u8FF0\uFF1A","<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>","","\u8BCA\u65AD\u4FE1\u606F\uFF1A","<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>"].join(`
15
15
  `),ha=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+zt,"","Workflow:","","1. Run `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50` first: if a matching issue exists, add a comment with `gh issue comment <n> --body-file <file>` instead of opening a duplicate.",'2. Otherwise create it with `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <one-line summary>" --body-file <file>`, using sections: Symptoms / Steps to reproduce / Expected / Actual / Environment (plugin, DSH, OS, Node) / Diagnostics.',"3. If `gh` is not authenticated or unavailable, do NOT try to submit: output a GitHub new-issue link with the title and body pre-filled instead, and I will click submit myself.","4. Report the resulting issue URL back to me.","","Keep my description verbatim - do not rewrite or summarise it. Put the diagnostics under the Diagnostics section as-is.","","My description:","<write your problem here>","","Diagnostics:","<paste the diagnostics copied from the in-app Report-a-bug dialog>"].join(`
16
- `);function $t(t={}){let o=t.lang==="en"?"en":"zh",r=o==="en"?ha:ya,f=t.repo||"EternalNight996/memory-eternal";return r=r.split(zt).join("https://github.com/"+f),t.description&&(r=r.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(r=r.replace(o==="en"?"<paste the diagnostics copied from the in-app Report-a-bug dialog>":"<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>",String(t.diagnostics).trim())),r}function _t({panX:t=0,panY:o=0,zoom:r=1,w:f=0,h:p=0,margin:i=60}={}){let w=r||1;return{x0:(0-t)/w-i,y0:(0-o)/w-i,x1:(f-t)/w+i,y1:(p-o)/w+i}}function Nt(t,o,r,f){return f?t+r>=f.x0&&t-r<=f.x1&&o+r>=f.y0&&o-r<=f.y1:!0}function Ut(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Kt(t,o={}){let r=Number.isFinite(o.limit)?o.limit:1/0,f=new Set,p=k=>{k&&f.size<r&&f.add(k)};if(p(o.focusId),p(o.hoverId),o.searchHits)for(let k of o.searchHits){if(f.size>=r)break;f.add(k)}let i=o.degree||{},w=k=>Number(i[k])||0,D=[];for(let k of Array.isArray(t)?t:[])k&&k.id&&!f.has(k.id)&&D.push(k);D.sort((k,E)=>w(E.id)-w(k.id));for(let k of D){if(f.size>=r)break;f.add(k.id)}return f}function va(t,o){if(t===o)return!0;if(t===null||o===null||t===void 0||o===void 0||typeof t!="object"&&typeof o!="object")return t===o;try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}function qt(t,o){let r={...t||{}},f={};for(let[p,i]of Object.entries(o||{}))va(t?t[p]:void 0,i)||(r[p]=i,f[p]=i);return{values:r,overlay:f}}var e=require("react/jsx-runtime"),st="memory-eternal",W="/memory-eternal/api",xa=100,ka=["slots","locale"],Jt={nav:"\u8BB0\u5FC6",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",overview:"\u8BB0\u5FC6\u5E93\u6982\u89C8",total:"\u77E5\u8BC6\u5361",recent:"\u8FD1 7 \u5929\u65B0\u589E",tags:"\u6807\u7B7E",searchPlaceholder:"\u641C\u7D22\u8BB0\u5FC6\uFF08\u652F\u6301\u4E2D\u6587\u7247\u6BB5\uFF09\u2026",search:"\u641C\u7D22",all:"\u5168\u90E8",kindProject:"\u9879\u76EE",kindKnowledge:"\u77E5\u8BC6",kindContent:"\u5185\u5BB9",kindPrompt:"\u63D0\u793A\u8BCD",kindBusiness:"\u4E1A\u52A1",kindTool:"\u5DE5\u5177",kindMistake:"\u6559\u8BAD",cardsTab:"\u77E5\u8BC6\u5361",graphTab:"\u77E5\u8BC6\u56FE\u8C31",graph:"\u77E5\u8BC6\u56FE\u8C31",graphHint:"\u8282\u70B9=\u77E5\u8BC6\u5361\uFF1B\u8FDE\u7EBF=[[\u94FE\u63A5]] \u6216\u5171\u4EAB\u6807\u7B7E\u3002\u70B9\u51FB\u8282\u70B9\u9605\u8BFB\u5361\u7247\u3002",graphTip:"\u5DE6\u952E\u51F8\u663E \xB7 Shift+\u62D6\u62FD\u6846\u9009 \xB7 \u53F3\u952E\u83DC\u5355 \xB7 \u6EDA\u8F6E\u7F29\u653E \xB7 \u62D6\u62FD\u5E73\u79FB",rebuild:"\u91CD\u5EFA",reset:"\u91CD\u7F6E",expandAll:"\u5168\u90E8\u5C55\u5F00",capped:"\u5DF2\u5C55\u793A\u6700\u6838\u5FC3\u7684",clearFocus:"\u53D6\u6D88\u9AD8\u4EAE",empty:"\u8BB0\u5FC6\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u591A\u804A\u51E0\u8F6E\u540E\uFF0C\u503C\u5F97\u4FDD\u5B58\u7684\u5185\u5BB9\u4F1A\u81EA\u52A8\u6C89\u6DC0\u6210\u77E5\u8BC6\u5361\u3002",emptyGraph:"\u56FE\u8C31\u6682\u65E0\u6570\u636E\u3002",open:"\u9605\u8BFB",updated:"\u66F4\u65B0\u4E8E",created:"\u521B\u5EFA\u4E8E",source:"\u6765\u6E90",close:"\u5173\u95ED",vaultDir:"\u8BB0\u5FC6\u5E93\u76EE\u5F55",capture:"\u81EA\u52A8\u6C89\u6DC0",recall:"\u81EA\u52A8\u53EC\u56DE",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u7981\u7528",error:"\u52A0\u8F7D\u5931\u8D25",back:"\u8FD4\u56DE\u5217\u8868",cardCount:"\u5F20\u5361",nodes:"\u8282\u70B9",edges:"\u8FDE\u7EBF",memoryTitle:"\u8BB0\u5FC6\u5E93",memoryHint:"\u4F60\u7684\u672C\u5730\u7B2C\u4E8C\u5927\u8111",zoomIn:"\u653E\u5927",zoomOut:"\u7F29\u5C0F",fit:"\u9002\u5E94",enterFullscreen:"\u5168\u5C4F",exitFullscreen:"\u9000\u51FA\u5168\u5C4F",exportGraph:"\u5BFC\u51FA",openCard:"\u6253\u5F00\u5361\u7247",focusNeighbors:"\u51F8\u663E\u5173\u8054",copyName:"\u590D\u5236\u540D\u79F0",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u8BB0\u5FC6",clearFilter:"\u6E05\u9664\u8FC7\u6EE4",filterLabel:"\u7B5B\u9009",sortRecent:"\u6700\u8FD1",sortTitle:"\u6807\u9898",sortHot:"\u70ED\u70B9",exportSel:"\u5BFC\u51FA\u9009\u4E2D",clearSelection:"\u6E05\u7A7A\u9009\u62E9",download:"\u4E0B\u8F7D",openNewTab:"\u65B0\u6807\u7B7E\u6253\u5F00",copyImage:"\u590D\u5236\u56FE\u7247",done:"\u5B8C\u6210",downloaded:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D",openedTab:"\u5DF2\u5728\u65B0\u6807\u7B7E\u6253\u5F00",copied:"\u5DF2\u590D\u5236",exportedSel:"\u4E2A\u8282\u70B9\u5DF2\u5BFC\u51FA",fullscreen:"\u5168\u5C4F",exitFull:"\u9000\u51FA\u5168\u5C4F",copyFail:"\u590D\u5236\u5931\u8D25",timeDim:"\u65F6\u95F4\u7EF4",timeNew:"3 \u5929\u5185",timeRecent:"2 \u5468\u5185",timeMonth:"1 \u6708\u5185",timeOld:"\u66F4\u65E9",newBadge:"\u65B0",expand:"\u5C55\u5F00\u5168\u90E8",collapse:"\u6536\u8D77",exportVault:"\u5BFC\u51FAMD",exportJson:"\u5BFC\u51FAJSON",exporting:"\u5BFC\u51FA\u4E2D\u2026",exportedVault:"\u8BB0\u5FC6\u5E93\u5DF2\u5BFC\u51FA",exportFail:"\u5BFC\u51FA\u5931\u8D25",importVault:"\u5BFC\u5165",importedVault:"\u5BFC\u5165\u5B8C\u6210",importedTotal:" \u5F20 / \u6587\u4EF6\u5171 ",importedTotalTail:" \u5F20",importedQuarantine:" \xB7 \u5F85\u5BA1\u6838 ",importedQuarantineTail:" \u5F20\uFF08\u9694\u79BB\u533A\uFF0C\u6279\u51C6\u540E\u624D\u53C2\u4E0E\u53EC\u56DE\uFF09",importedSkipped:" \xB7 \u8DF3\u8FC7 ",importedSkippedTail:" \u5F20\uFF08\u91CD\u590D\u6216\u7A7A\uFF09",importFail:"\u5BFC\u5165\u5931\u8D25",location:"\u81EA\u9009\u4F4D\u7F6E",saveAs:"\u53E6\u5B58\u4E3A",saveAsUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9009\u62E9\u4FDD\u5B58\u4F4D\u7F6E",exportedTo:"\u5DF2\u5BFC\u51FA\u5230",defaultDownloads:"\u9ED8\u8BA4\u4E0B\u8F7D\u6587\u4EF6\u5939",exportCancel:"\u5DF2\u53D6\u6D88\u5BFC\u51FA",manage:"\u7BA1\u7406",tabUsage:"\u7528\u91CF/\u4ECA\u65E5",tabOptimize:"\u6574\u7406\u5EFA\u8BAE",adminLoadFail:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF1A\u8BF7\u5F7B\u5E95\u91CD\u542F dsh-desktop\uFF08host \u9700\u52A0\u8F7D\u65B0\u7248 /memory-eternal \u8DEF\u7531\uFF09",retry:"\u91CD\u8BD5",mergeSimilar:"\u4E00\u952E\u5408\u5E76\u76F8\u4F3C",trendLabel:"\u8FD1 30 \u5929\u8D8B\u52BF",cleanStale:"\u{1F5D1}\uFE0F \u4E00\u952E\u6E05\u7406\u9648\u65E7",deletedStale:"\u4E2A\u9648\u65E7\u5361\u5DF2\u6E05\u7406",newCard:"\u65B0\u5EFA",tplDecision:"\u{1F4DD} \u6280\u672F\u51B3\u7B56",tplBug:"\u{1F41B} \u8E29\u5751",tplMeeting:"\u{1F4CB} \u4F1A\u8BAE\u7EAA\u8981",tplWeekly:"\u{1F4CA} \u5468\u62A5",createCard:"\u521B\u5EFA",cardTitle:"\u6807\u9898",cardBody:"\u6B63\u6587",fbUseful:"\u6709\u7528",fbIrr:"\u65E0\u5173",todayAdd:"\u4ECA\u65E5\u65B0\u589E",weekAdd:"\u8FD1 7 \u5929",byKind:"\u5206\u7C7B\u7EDF\u8BA1",todayList:"\u4ECA\u65E5\u6C89\u6DC0",budgetLabel:"\u4F1A\u8BDD\u9884\u7B97",budgetChars:"\u9884\u7B97\u5B57\u7B26",recallLimitLabel:"\u53EC\u56DE\u6761\u6570",embeddingLabel:"\u8BED\u4E49\u53EC\u56DE",mergePairs:"\u76F8\u4F3C\u5361\u5BF9\uFF08\u53EF\u5408\u5E76\uFF09",staleCards:"\u9648\u65E7\u5361\uFF08>90 \u5929\u672A\u66F4\u65B0\uFF09",noOptimize:"\u6682\u65E0\u53EF\u6574\u7406\u9879\uFF0C\u5F88\u5065\u5EB7 \u{1F389}",refineTitle:"\u77DB\u76FE\u626B\u63CF",refineScan:"\u5F00\u59CB\u626B\u63CF",refineHint:"\u76F8\u4F3C\u53EF\u4EE5\u5408\u5E76\uFF0C\u77DB\u76FE\u5FC5\u987B\u4EBA\u5224\u65AD \u2014\u2014 \u626B\u63CF\u53EA\u8BFB\uFF0C\u9009\u62E9\u540E\u624D\u52A8\u6570\u636E\uFF08\u4FDD\u7559\u4E00\u5F20\u4F1A\u628A\u53E6\u4E00\u5F20\u653E\u8FDB\u56DE\u6536\u7AD9\uFF0C\u53EF\u8FD8\u539F\uFF09",refineIdle:"\u70B9\u300C\u5F00\u59CB\u626B\u63CF\u300D\uFF1A\u5148\u5BBD\u53EC\u56DE\u53EF\u80FD\u6709\u5173\u7CFB\u7684\u5361\u7247\u5BF9\uFF0C\u518D\u8BA9\u6A21\u578B\u5224\u65AD\u662F\u91CD\u590D / \u8865\u5145 / \u77DB\u76FE / \u65E0\u5173",refineNone:"\u8FD9\u4E00\u8F6E\u6CA1\u6709\u53D1\u73B0\u9700\u8981\u4F60\u88C1\u51B3\u7684\u5361\u7247\u5BF9 \u{1F389}",refineFail:"\u77DB\u76FE\u626B\u63CF\u5931\u8D25",refineApplied:"\u5DF2\u8BB0\u5F55\u4F60\u7684\u88C1\u51B3\uFF08\u4E0D\u4F1A\u91CD\u590D\u6253\u6270\uFF09",refineRel_duplicate:"\u91CD\u590D\uFF08\u53EF\u5408\u5E76\uFF09",refineRel_complement:"\u8865\u5145\uFF08\u90FD\u7559\u7740\uFF09",refineRel_conflict:"\u77DB\u76FE\uFF08\u9700\u4F60\u88C1\u51B3\uFF09",refineRel_unrelated:"\u65E0\u5173",refineKeepA:"\u4FDD\u7559 A",refineKeepB:"\u4FDD\u7559 B",refineKeepBoth:"\u90FD\u4FDD\u7559",refineMerge:"\u5408\u5E76",junkTitle:"\u6CE8\u5165\u5783\u573E\u5361",junkScan:"\u626B\u63CF\u5B58\u91CF",junkHint:"\u6000\u7591\u662F\u8FD0\u884C\u65F6\u6CE8\u5165\u6587\u672C\uFF08\u6280\u80FD\u76EE\u5F55 / system-reminder\uFF09\u6C89\u6DC0\u6210\u7684\u5361 \u2014\u2014 \u626B\u63CF\u53EA\u8BFB\uFF0C\u56DE\u6536\u8D70\u56DE\u6536\u7AD9\u53EF\u8FD8\u539F",junkIdle:"\u70B9\u300C\u626B\u63CF\u5B58\u91CF\u300D\uFF1A\u627E\u51FA\u6B63\u6587\u5176\u5B9E\u662F\u88AB\u6CE8\u5165\u7684\u8FD0\u884C\u65F6\u6587\u672C\u3001\u5265\u6389\u540E\u51E0\u4E4E\u4E0D\u5269\u4EBA\u8BDD\u7684\u5361",junkNone:"\u6CA1\u53D1\u73B0\u8FD9\u7C7B\u5361 \u{1F389}",junkRecycle:"\u56DE\u6536",junkRecycleAll:"\u5168\u90E8\u56DE\u6536",junkRecycleAllConfirm:"\u786E\u8BA4\u628A\u8FD9\u4E9B\u5361\u9001\u8FDB\u56DE\u6536\u7AD9\uFF1F\uFF08\u4E0D\u662F\u6C38\u4E45\u5220\u9664\uFF0C\u53EF\u5728\u56DE\u6536\u4E2D\u5FC3\u8FD8\u539F\uFF09",junkDone:"\u5DF2\u9001\u56DE\u6536\u7AD9",junkFail:"\u626B\u63CF / \u56DE\u6536\u5931\u8D25",dbReadonlyTitle:"\u8BB0\u5FC6\u5E93\u5F53\u524D\u4E0D\u53EF\u5199",dbReadonlyBody:"\u5361\u7247\u8BFB\u5199 / \u5BA1\u6838 / \u56FE\u8C31\u4F1A\u5931\u8D25\uFF0C\u4F46**\u914D\u7F6E\u4ECD\u53EF\u4FDD\u5B58**\uFF08\u914D\u7F6E\u4E0D\u7ECF\u8FC7\u6570\u636E\u5E93\uFF09",dbReadonlyFix:"\u6392\u67E5\uFF1Adsh-memory doctor\uFF08\u770B journal \u6A21\u5F0F\u3001\u5199\u63A2\u9488\u3001\u5907\u4EFD\u6E05\u5355\u4E0E\u6062\u590D\u6B65\u9AA4\uFF09",goalTitle:"\u540C\u76EE\u6807\u4E0D\u540C\u505A\u6CD5",goalScan:"\u626B\u63CF\u76EE\u6807",goalHint:"\u6309\u300C\u8FD9\u5F20\u5361\u89E3\u51B3\u4EC0\u4E48\u95EE\u9898\u300D\u805A\u7C7B \u2014\u2014 \u6B63\u6587\u76F8\u4F3C\u5EA6\u6293\u4E0D\u5230\u7684\u505A\u6CD5\u5DEE\u5F02\uFF087z \u538B\u7F29 / tar \u5206\u53D1 / npm \u7626\u8EAB\uFF09\u4E5F\u80FD\u5F52\u5230\u4E00\u8D77",goalIdle:"\u70B9\u300C\u626B\u63CF\u76EE\u6807\u300D\uFF1A\u6A21\u578B\u5148\u7ED9\u6BCF\u5F20\u5361\u62BD\u4E00\u53E5\u76EE\u6807\uFF08\u9996\u6B21\u4F1A\u8C03\u6A21\u578B\uFF0C\u4E4B\u540E\u8D70\u7F13\u5B58\uFF09\uFF0C\u518D\u6309\u76EE\u6807\u805A\u7C7B",goalNone:"\u6CA1\u6709\u53D1\u73B0\u300C\u540C\u4E00\u76EE\u6807\u3001\u591A\u5F20\u5361\u300D\u7684\u7C07 \u{1F389}",goalStats:"\u5DF2\u7D22\u5F15 / \u672C\u6B21\u8C03\u7528",goalCards:"\u5F20\u5361",goalKeep:"\u90FD\u4FDD\u7559",goalMerge:"\u5408\u5E76\u8FD9\u4E00\u7EC4",goalMerged:"\u5DF2\u63D0\u4EA4\u5408\u5E76\uFF08\u65B0\u5361\u8FDB\u5BA1\u6838\u961F\u5217\uFF09",goalDone:"\u5DF2\u8BB0\u5F55\u300C\u90FD\u4FDD\u7559\u300D",goalFail:"\u76EE\u6807\u805A\u7C7B\u5931\u8D25",oneClickOptimize:"\u4E00\u952E\u4F18\u5316",oneClickOptimizeConfirm:"\u786E\u8BA4\u4E00\u952E\u4F18\u5316\uFF1F\u5C06\u5408\u5E76\u6240\u6709\u76F8\u4F3C\u5361\u5BF9\uFF08\u9ED8\u8BA4\u4E0D\u6E05\u7406\u9648\u65E7\u5361\uFF09\u3002",oneClickAlsoStale:"\u540C\u65F6\u6E05\u7406\u9648\u65E7\u5361",oneClickOptimizeDone:"\u4E00\u952E\u4F18\u5316\u5B8C\u6210",optimizedMerged:"\u5BF9\u5DF2\u5408\u5E76",optimizedStaleDeleted:"\u5F20\u9648\u65E7\u5361\u5DF2\u6E05\u7406",mcpSetupStatus:"Agent MCP \u6302\u8F7D\u72B6\u6001",rerunSetup:"\u8865\u5168 MCP",notInstalled:"\u672A\u5B89\u88C5",noMcpEntry:"\u914D\u7F6E\u7F3A\u5931",nodePathMismatch:"node \u8DEF\u5F84\u4E0D\u4E00\u81F4\uFF0C\u5EFA\u8BAE\u91CD\u8DD1 setup",nodePathNote:"node \u73AF\u5883\u4E0D\u540C\uFF08\u53EF\u7528\uFF09",healthy:"\u914D\u7F6E\u6B63\u5E38",mcpSetupHint:"\u300C\u81EA\u52A8\u6302\u8F7D MCP\u300D= \u8BA9 Claude Code / Codex / Cursor \u8FD9\u4E9B\u5DE5\u5177\u80FD\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002\u5F00\u542F\u540E\u81EA\u52A8\u628A\u5B83\u4EEC\u914D\u7F6E\u597D\uFF1B\u5173\u6389\u5C31\u4E0D\u52A8\u4F60\u7535\u8111\u4E0A\u4EFB\u4F55\u914D\u7F6E\u6587\u4EF6\uFF0C\u9700\u8981\u65F6\u624B\u52A8\u8DD1 dsh-memory setup\u3002",mcpManageHint:"\u6BCF\u4E2A agent \u7528\u4E0B\u65B9\u6309\u94AE\u5355\u72EC\u5B89\u88C5/\u5378\u8F7D MCP",tabConfig:"\u8BB0\u5FC6\u914D\u7F6E",tabAudit:"\u5BA1\u6838\u4E2D\u5FC3",statusApproved:"\u5DF2\u5BA1\u6838",statusPending:"\u5F85\u5BA1\u6838",statusRejected:"\u5DF2\u9A73\u56DE",allStatus:"\u5168\u90E8\u72B6\u6001",tabRecycle:"\u56DE\u6536\u4E2D\u5FC3",pending:"\u5F85\u5BA1\u6838",rejected:"\u5DF2\u9A73\u56DE",selectAll:"\u5168\u9009",approve:"\u6279\u51C6",reject:"\u9A73\u56DE",allAgents:"\u5168\u90E8\u667A\u80FD\u4F53",noAuditItems:"\u6682\u65E0\u5BA1\u6838\u9879\u76EE",auditBodyFail:"\u6B63\u6587\u8BFB\u53D6\u5931\u8D25",deletedAt:"\u5220\u9664\u4E8E",restore:"\u6062\u590D",restoreDelete:"\u5220\u9664\u8FDB\u56DE\u6536\u7AD9",purge:"\u6C38\u4E45\u5220\u9664",emptyRecycle:"\u56DE\u6536\u7AD9\u4E3A\u7A7A",recycleHint:"\u5220\u9664\u7684\u5361\u7247\u5148\u8FDB\u56DE\u6536\u7AD9\uFF0C30 \u5929\u5185\u53EF\u6062\u590D\uFF0C\u8D85\u671F\u81EA\u52A8\u6C38\u4E45\u5220\u9664",purgeConfirm:"\u786E\u5B9A\u6C38\u4E45\u5220\u9664\uFF1F\u4E0D\u53EF\u6062\u590D\u3002",recycleDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u8FDB\u56DE\u6536\u7AD9\uFF1F30 \u5929\u5185\u53EF\u6062\u590D\u3002",modeInit:"\u542F\u52A8\u65F6\u62C9\u4E00\u6B21",modeInterval:"\u5468\u671F\u4FDD\u6D3B",modeManual:"\u4EC5\u624B\u52A8",serviceConfig:"\u670D\u52A1\u81EA\u7BA1\u7406\u914D\u7F6E",auditConfig:"\u81EA\u52A8\u5BA1\u6838\u914D\u7F6E",auditHint:"\u547D\u4E2D\u514D\u5BA1\u7684\u65B0\u5361\u76F4\u63A5\u5165\u5E93\uFF0C\u5176\u4F59\u8FDB\u5F85\u5BA1\u6838",auditMode:"\u5BA1\u6838\u6A21\u5F0F",auditAll:"\u5168\u90E8\u8981\u5BA1\u6838",auditNone:"\u5168\u90E8\u514D\u5BA1",auditExemptAgents:"\u514D\u5BA1\u667A\u80FD\u4F53",auditExemptKinds:"\u514D\u5BA1\u7C7B\u578B",allExempt:"\u5168\u90E8\u514D\u5BA1",recycleDays:"\u56DE\u6536\u4FDD\u7559\u5929\u6570",editInSetting:"\u7F16\u8F91\u8BF7\u5230 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6",pendingSyncNote:"\u6B64\u9875\u662F\u72EC\u7ACB Web \u9875\uFF1A\u4FDD\u5B58\u540E\u7531 DSH \u5BBF\u4E3B\u5E94\u7528\uFF08\u65B0\u7248\u5BBF\u4E3B\u4F1A\u88AB\u76F4\u63A5\u53EB\u9192\u3001\u5728\u8BF7\u6C42\u4E0A\u4E0B\u6587\u91CC\u5E94\u7528\uFF0C\u70B9\u4FDD\u5B58\u5373\u751F\u6548\uFF09\uFF1B\u82E5\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5219\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\u3001\u7ACB\u5373\u751F\u6548\u3002\u53EA\u6709\u5728\u5BF9\u63A5\u65E7\u7248\u5BBF\u4E3B\u65F6\u624D\u4F1A\u9000\u56DE\u300C\u6392\u961F\u7B49\u5B83\u81EA\u5DF1\u540C\u6B65\u300D\uFF0C\u90A3\u65F6\u53EF\u5728 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u91CC\u6539\u540C\u4E00\u9879\u3002",readonlyTitle:"\u5F53\u524D\u9875\u9762\u53EA\u8BFB\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u914D\u7F6E",readonlyBody:"\u8FD9\u4E2A\u8FDB\u7A0B\u6CA1\u6709 DSH \u7684\u8BBE\u7F6E\u670D\u52A1\uFF08settings.update \u4E0D\u5B58\u5728\uFF09\uFF0C\u914D\u7F6E\u53EA\u80FD\u5728\u672C\u673A DSH \u91CC\u4FEE\u6539\uFF1A\u684C\u9762\u7248 \u2192 \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u3002",readonlyBtn:"\u53EA\u8BFB",setupRunInTerminal:"\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5230\u7EC8\u7AEF\u6267\u884C\uFF1A",dshMemoryConfig:"DSH \u8BB0\u5FC6\u914D\u7F6E",autoCapture:"\u81EA\u52A8\u6C89\u6DC0",autoRecall:"\u81EA\u52A8\u53EC\u56DE",captureMinChars:"\u6355\u83B7\u6700\u5C0F\u957F\u5EA6",maxCardsPerDay:"\u65E5\u914D\u989D",dedupThreshold:"\u53BB\u91CD\u9608\u503C",recallLimit:"\u53EC\u56DE\u6761\u6570",vaultMulti:"\u591A\u5E93\uFF08\u6309\u9879\u76EE\u9694\u79BB\uFF09",vaultMultiHint:"\u7559\u7A7A\u5373\u5355\u5E93\uFF0C\u8001\u914D\u7F6E\u4E0D\u53D7\u5F71\u54CD",vaultNow:"\u5F53\u524D\u751F\u6548",vaultSource:"\u6765\u6E90",vaultWorkspace:"\u5F53\u524D workspace",vaultNamePh:"\u5E93\u540D\uFF0C\u5982 work",vaultPathPh:"\u76EE\u5F55\uFF0C\u5982 D:/vaults/work",vaultMatchPh:"\u9879\u76EE\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u6309 workspace \u81EA\u52A8\u9009\u5E93\uFF09",vaultAdd:"\u6DFB\u52A0\u4E00\u4E2A\u5E93",vaultActive:"\u6FC0\u6D3B\u5E93",vaultActiveNone:"\u9ED8\u8BA4\u5E93\uFF08\u4E0D\u6307\u5B9A\uFF09",vaultSrcEnv:"\u73AF\u5883\u53D8\u91CF MEMORY_VAULT_DIR",vaultSrcProfile:"\u6FC0\u6D3B\u5E93\u914D\u7F6E",vaultSrcWorkspace:"\u6309\u9879\u76EE\u76EE\u5F55\u81EA\u52A8\u547D\u4E2D",vaultSrcVaultDir:"\u5355\u5E93\u914D\u7F6E vaultDir",vaultSrcDefault:"\u9ED8\u8BA4\u76EE\u5F55",fbNav:"\u53CD\u9988\u5F02\u5E38",fbTitle:"\u53CD\u9988\u5F02\u5E38\uFF08\u63D0\u4EA4\u5230 GitHub\uFF09",fbDesc:"\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF08\u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A\uFF09",fbDiag:"\u8BCA\u65AD\u4FE1\u606F\uFF08\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E key/token \u5DF2\u66FF\u6362\uFF09",fbCopyDiag:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",fbOpenIssue:"\u5728 GitHub \u63D0\u4EA4\uFF08\u5DF2\u9884\u586B\uFF09",fbCopyPrompt:"\u590D\u5236\u7ED9 AI \u7684\u63D0\u793A\u8BCD",fbCopiedDiag:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",fbCopiedPrompt:"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\uFF0C\u7C98\u8FDB AI \u5BF9\u8BDD\u6846\u5373\u53EF",fbCopyFail:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u590D\u5236",fbWhy:"GitHub \u4E0D\u5141\u8BB8\u533F\u540D\u521B\u5EFA issue\uFF0C\u63D2\u4EF6\u91CC\u4E5F\u4E0D\u5E94\u5185\u7F6E token\uFF1A\u6240\u4EE5\u8FD9\u91CC\u628A\u6807\u9898 / \u6B63\u6587 / \u8BCA\u65AD\u90FD\u9884\u586B\u597D\uFF0C\u4F60\u53EA\u9700\u518D\u70B9\u4E00\u6B21 Submit\u3002",fbNeedDesc:"\u8BF7\u5148\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898",fbLoading:"\u6B63\u5728\u6536\u96C6\u8BCA\u65AD\u4FE1\u606F\u2026",fbDiagFail:"\u8BCA\u65AD\u63A5\u53E3\u4E0D\u53EF\u7528\uFF08\u72EC\u7ACB web \u6216\u65E7\u7248\u5BBF\u4E3B\uFF09\uFF0C\u8BF7\u624B\u52A8\u8865\u5145\u73AF\u5883\u4FE1\u606F",fbOr:"\u6216\u8005",fbSelectAll:"\u5168\u9009",toastApproved:"\u5DF2\u6279\u51C6",toastRejected:"\u5DF2\u9A73\u56DE",toastCardDeleted:"\u5DF2\u5220\u9664",toastRestored:"\u5DF2\u6062\u590D",toastPurged:"\u5DF2\u5F7B\u5E95\u5220\u9664",toastPurgedExpired:"\u5DF2\u6E05\u7406\u8FC7\u671F\u56DE\u6536\u7AD9",toastFailed:"\u64CD\u4F5C\u5931\u8D25",noSelection:"\u8BF7\u5148\u9009\u62E9\u8981\u5904\u7406\u7684\u5361\u7247",enabledLabel:"\u542F\u7528\u8BB0\u5FC6\u6838\u5FC3",vaultDirLabel:"\u8BB0\u5FC6\u5E93\u76EE\u5F55\uFF08\u5355\u5E93\uFF09",captureCooldownMs:"\u6C89\u6DC0\u51B7\u5374 (ms)",captureProvider:"\u84B8\u998F provider\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",captureModel:"\u84B8\u998F model\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",recallEmbedding:"\u8BED\u4E49\u53EC\u56DE provider\uFF08\u53EF\u9009\uFF09",sessionBudgetChars:"\u4F1A\u8BDD\u9884\u7B97 (\u5B57\u7B26)",saving:"\u4FDD\u5B58\u4E2D\u2026",savePending:"\u5DF2\u5199\u5165\u914D\u7F6E\u6587\u4EF6\uFF1B\u5BBF\u4E3B\u4ECD\u662F\u65E7\u7248\uFF0C\u91CD\u542F DSH \u540E\u5373\u4EE5\u65B0\u503C\u4E3A\u51C6\uFF08\u672C\u9762\u677F\u5DF2\u751F\u6548\uFF09",actionRunning:"\u5904\u7406\u4E2D\u2026",recycleEmptyHint:"\u56DE\u6536\u7AD9\u4E3A\u7A7A\uFF1A\u5220\u6389\u7684\u5361\u7247\u4F1A\u5148\u653E\u5230\u8FD9\u91CC\uFF0C\u4FDD\u7559 {days} \u5929\u540E\u81EA\u52A8\u6E05\u7406\u3002",recyclePurgeAll:"\u6E05\u7A7A\u56DE\u6536\u7AD9",fbCopyManual:"\u81EA\u52A8\u590D\u5236\u88AB\u6D4F\u89C8\u5668\u62E6\u622A\uFF0C\u5DF2\u628A\u5185\u5BB9\u653E\u5728\u4E0B\u9762\uFF1A\u70B9\u300C\u5168\u9009\u300D\u518D\u6309 Ctrl+C",vcPage:"\u9875\u9762\u811A\u672C",vcPageStale:"\u26A0 \u5F53\u524D\u9875\u9762\u4ECD\u5728\u8FD0\u884C\u65E7\u7248\u811A\u672C\uFF08\u9875\u9762 v{page} / \u78C1\u76D8 v{disk}\uFF09\uFF1A\u6309 Ctrl+F5 \u5237\u65B0\u9875\u9762\u5373\u751F\u6548\uFF1B\u82E5\u300C\u8FD0\u884C\u4E2D\u300D\u4ECD\u662F\u65E7\u7248\u53F7\uFF0C\u5219\u8FD8\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcLoaded:"\u8FD0\u884C\u4E2D\uFF08\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF09",vcResident:"\u5E38\u9A7B\u5B9E\u4F8B",vcOnDisk:"\u78C1\u76D8\u5B89\u88C5",vcLatest:"npm \u6700\u65B0",vcStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 v{disk}\uFF0C\u4F46\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\u4ECD\u52A0\u8F7D v{loaded} \u2014\u2014 \u70B9\u300C\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u300D\u5373\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u542F\u5B83\uFF08\u4E0D\u7528\u91CD\u542F DSH\uFF09",vcRestart:"\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",vcRestarting:"\u91CD\u542F\u4E2D\u2026",vcRestartSent:"\u5DF2\u8C03\u5EA6\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\uFF1A\u7EA6 3-8 \u79D2\u540E\u65B0\u8FDB\u7A0B\u63A5\u7BA1\uFF0C\u8BF7\u7A0D\u7B49\u518D\u5237\u65B0\u9875\u9762\uFF08Ctrl+F5\uFF09",vcRestartCurrent:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u7ECF\u662F\u6700\u65B0\u7248\uFF0C\u65E0\u9700\u91CD\u542F",vcRestartFail:"\u91CD\u542F\u8BF7\u6C42\u5931\u8D25",vcRestartNoRoute:"\u5F53\u524D\u9875\u9762\u5BF9\u63A5\u7684\u8FDB\u7A0B\u8FD8\u662F\u65E7\u7248\uFF08\u6CA1\u6709\u8FD9\u4E2A\u63A5\u53E3\uFF09\uFF1A\u8BF7\u91CD\u542F\u684C\u9762\u7248 / DSH \u540E\u518D\u8BD5\uFF0C\u6216\u6267\u884C {cmd}",vcHostStale:"\u4E0A\u65B9\u7684\u300C\u8FD0\u884C\u4E2D\u300D\u6765\u81EA\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF1B\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F\u65B0\u7248 \u2014\u2014 \u8981\u8BA9\u5B83\u4E5F\u53D8\u6210\u65B0\u7248\u53F7\uFF0C\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcResidentDownShort:"\u672A\u8FD0\u884C",vcResidentDown:"\u5E38\u9A7B\u5B9E\u4F8B\u6CA1\u5728\u8FD0\u884C\uFF08\u7AEF\u53E3 {port} \u65E0\u54CD\u5E94\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u7528\u65B0\u4EE3\u7801\u628A\u5B83\u62C9\u8D77\u6765\uFF1B\u62C9\u4E0D\u8D77\u6765\u65F6\u6267\u884C {cmd}\uFF0C\u5E76\u8D34\u4E00\u4E0B dsh-memory status \u7684\u8F93\u51FA",vcResidentUnmanagedShort:"\u672A\u6258\u7BA1",vcResidentUnmanaged:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u6CA1\u6709\u770B\u95E8\u72D7\u4FDD\u6D3B**\uFF08\u505C\u6B62 / \u786C\u6740\u540E\u6B8B\u7559\u7684\u5B64\u513F\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u628A\u5B83\u91CD\u65B0\u6258\u7BA1\uFF08\u91CD\u65B0\u62C9\u4E00\u4E2A\u770B\u95E8\u72D7 + \u65B0\u5B9E\u4F8B\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u6267\u884C {cmd}",vcResidentLockUnknownShort:"\u6258\u7BA1\u72B6\u6001\u672A\u77E5",vcResidentReplaceBlockedShort:"\u4E0D\u53EF\u66FF\u6362",vcResidentReplaceBlocked:"\u5E38\u9A7B\u5B9E\u4F8B**\u4E0D\u53EF\u66FF\u6362**\uFF08\u73AF\u5883\u9650\u5236\uFF09\uFF1A\u770B\u95E8\u72D7\u9501\u76EE\u5F55\u4E0D\u53EF\u5199\uFF08{err}\uFF1B{path}\uFF09\u2192 \u7AEF\u53E3\u4E0A\u4F1A**\u957F\u671F**\u505C\u5728 v{served}\u3002\u8FD9\u4E0D\u662F\u300C\u6682\u65F6\u843D\u540E\u300D\uFF1A\u81EA\u52A8\u66FF\u6362\u88AB\u6B63\u786E\u5730\u62D2\u7EDD\uFF08\u907F\u514D\u7559\u4E0B\u5B64\u513F\uFF09\u3002\u51FA\u8DEF\uFF1A\u4FEE\u590D\u8BE5\u76EE\u5F55\u6743\u9650\u540E\u6267\u884C {cmd}\uFF0C\u6216\u524D\u53F0\u89C2\u5BDF dsh-memory watchdog --port 7999",vcResidentLockUnknown:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u770B\u95E8\u72D7\u9501\u6587\u4EF6\u5199\u4E0D\u8FDB\u53BB**\uFF08\u53D7\u9650\u73AF\u5883\uFF1A\u6C99\u7BB1\u7981\u5199 / ACL / \u975E\u7CFB\u7EDF\u76D8\uFF09\u2192 \u65E0\u6CD5\u5224\u65AD\u5B83\u6709\u6CA1\u6709\u88AB\u6258\u7BA1\uFF08\u4E0D\u662F\u300C\u672A\u6258\u7BA1\u300D\uFF09\u3002\u539F\u56E0\uFF1A{err}\uFF08{path}\uFF09\u3002\u4FDD\u6D3B\u901A\u5E38\u4ECD\u7136\u6709\u6548\uFF1B\u70B9\u4E0B\u9762\u7684\u6309\u94AE\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u65B0\u6258\u7BA1\u4E00\u6B21\u3002",vcOutdated:"\u6709\u65B0\u7248\u672C",vcUpToDate:"\u5DF2\u662F\u6700\u65B0",vcCheck:"\u68C0\u67E5\u66F4\u65B0",checking:"\u68C0\u67E5\u4E2D\u2026",vcCheckFail:"\u68C0\u67E5\u66F4\u65B0\u5931\u8D25",recallSummaryLen:"\u53EC\u56DE\u6458\u8981\u957F\u5EA6",recallBody:"\u53EC\u56DE\u542B\u6B63\u6587",secretHint:"\u51ED\u8BC1\u53D6\u7528\u63D0\u793A\uFF08\u6CE8\u5165\u6BCF\u4E2A\u4F1A\u8BDD\uFF09",autoWeb:"Web server",autoWebMode:"\u4FDD\u6D3B\u6A21\u5F0F",webPort:"Web \u7AEF\u53E3",webCheckIntervalMs:"\u63A2\u6D3B\u95F4\u9694(ms)",webMaxRestart:"\u6700\u5927\u91CD\u542F\u6B21\u6570",watchdogAutoSpawn:"\u770B\u95E8\u72D7\u8FDB\u7A0B",autoRestartOnDrift:"\u7248\u672C\u6F02\u79FB\u81EA\u52A8\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",autoMcpSetup:"\u81EA\u52A8\u6302\u8F7D MCP",saveConfig:"\u4FDD\u5B58\u914D\u7F6E",saveFail:"\u4FDD\u5B58\u5931\u8D25",savedOk:"\u5DF2\u4FDD\u5B58",savedDirect:"\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5DF2\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\uFF08hooks / MCP / \u72EC\u7ACB\u9875\u7ACB\u5373\u751F\u6548\uFF09",savedApplied:"\u5DF2\u4FDD\u5B58\u5E76\u751F\u6548\uFF08\u5BBF\u4E3B\u5DF2\u5728\u8BF7\u6C42\u4E0A\u4E0B\u6587\u91CC\u5E94\u7528\uFF09",saveQueued:"\u5DF2\u4EA4\u7ED9 DSH \u5BBF\u4E3B\u540C\u6B65\uFF0C\u5C1A\u672A\u786E\u8BA4\u751F\u6548",saveHostGuard:"\u8BE5\u5BBF\u4E3B\u4E0D\u5141\u8BB8\u63D2\u4EF6\u4ECE\u81EA\u5DF1\u7684\u56DE\u8C03\u4E0A\u4E0B\u6587\u91CC\u5199\u914D\u7F6E\uFF1B\u8BF7\u5728\u300CDSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u300D\u91CC\u6539\u540C\u4E00\u9879\uFF0C\u6216\u7F16\u8F91 profile \u7684\u914D\u7F6E\u8865\u4E01\u5C42",saveFailHint:"\u5BBF\u4E3B\u4FA7\u672A\u5E94\u7528\uFF0C\u8BE6\u89C1\u300C\u53CD\u9988\u5F02\u5E38\u300D\u91CC\u7684\u8BCA\u65AD\u4FE1\u606F",recallTool:"recall \u5DE5\u5177",costControl:"\u6210\u672C\u63A7\u5236",costHint:"\u7701 token\u3001\u63A7 LLM \u6D88\u8017",distillEnabled:"\u84B8\u998F\u77E5\u8BC6\u5361(\u5F00=LLM \u538B\u7F29, \u5173=\u539F\u6587\u5361\u96F6 LLM)",dedupByLLM:"\u8BED\u4E49\u53BB\u91CD\u5582 LLM(\u5173=\u7EAF\u8BCD\u6CD5\u66F4\u7701)",captureMaxTokens:"\u84B8\u998F\u8F93\u51FA\u4E0A\u9650(token)",recallMinScore:"\u53EC\u56DE\u76F8\u5173\u6027\u9608\u503C(\u8D8A\u9AD8\u8D8A\u7701)",configNeedsDsh:"\u914D\u7F6E\u7F16\u8F91\u9700\u5728 DSH \u5185\u6253\u5F00\uFF08\u672C\u9875\u53EF\u80FD\u53EA\u8BFB\u6216\u6709\u90E8\u5206\u7F3A\u5931\uFF09",installMcp:"\u5B89\u88C5 MCP",uninstallMcp:"\u5378\u8F7D MCP",uninstallConfirm:"\u786E\u8BA4\u5378\u8F7D\u8BE5\u667A\u80FD\u4F53\u7684 MCP\uFF1FClaude Code/Codex \u5C06\u65E0\u6CD5\u518D\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002",presetConfig:"\u4E00\u952E\u63A8\u8350\u914D\u7F6E",presetHint:"\u70B9\u51FB\u586B\u5145\u5BF9\u5E94\u65B9\u6848\uFF0C\u70B9\u4FDD\u5B58\u751F\u6548",planA:"A \u8F7B\u91CF\u7701\u5FC3",planB:"B \u6781\u81F4\u7701\u94B1",planC:"C \u9AD8\u8D28\u91CF",pluginInfo:"\u63D2\u4EF6\u4FE1\u606F",organizeTitle:"\u6574\u7406\u5EFA\u8BAE",scanAndOrganize:"\u4E00\u952E\u641C\u7D22\u548C\u6574\u7406",scanHint:"\u70B9\u300C\u{1F50D} \u4E00\u952E\u641C\u7D22\u548C\u6574\u7406\u300D\u626B\u63CF\u76F8\u4F3C\u5361/\u9648\u65E7\u5361\uFF0C\u518D\u7528\u300C\u26A1 \u4E00\u952E\u4F18\u5316\u300D\u6267\u884C\u3002",mergeNow:"\u5408\u5E76",delete:"\u5220\u9664",captureAlert:"\u81EA\u52A8\u6C89\u6DC0\u5F02\u5E38",captureAlertHint:"\u6253\u5F00\u5DE6\u680F\u300C\u7528\u91CF/\u4ECA\u65E5\u300D\u770B\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7\uFF1B\u82E5\u662F\u63A5\u53E3/\u7248\u672C\u4E0D\u5339\u914D\uFF0C\u9700\u66F4\u65B0 memory-eternal \u63D2\u4EF6\u3002",captureLog:"\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7",captureLogHint:"\u6BCF\u8F6E\u5BF9\u8BDD\u7ED3\u675F\u540E\u81EA\u52A8\u8DD1\uFF1A\u76D1\u542C \u2192 \u5224\u5B9A \u2192 \u5199\u5361\u3002\u8FD9\u91CC\u663E\u793A\u6700\u8FD1 100 \u6761\uFF0C\u7528\u6765\u6392\u67E5\u300C\u4E3A\u4EC0\u4E48\u6CA1\u5199\u5361\u300D\u3002",captureLogEmpty:"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002\u8DDF Agent \u804A\u4E00\u8F6E\uFF08> \u6355\u83B7\u6700\u5C0F\u957F\u5EA6\uFF09\u540E\u518D\u56DE\u6765\u770B\u3002",alignTitle:"\u7248\u672C\u5BF9\u9F50\u68C0\u67E5",alignRun:"\u5F00\u59CB\u68C0\u67E5",alignFix:"\u91CD\u5199\u63A5\u7EBF",alignFixConfirm:"\u91CD\u5199 MCP / hooks \u63A5\u7EBF\uFF1F\uFF08\u53EA\u78B0\u63D2\u4EF6\u81EA\u5DF1\u7684\u952E\uFF0C\u4E0D\u52A8\u4F60\u7684\u6570\u636E\u4E0E\u914D\u7F6E\uFF09",alignFixed:"\u63A5\u7EBF\u5DF2\u91CD\u5199\uFF1B\u82E5\u4E0A\u9762\u63D0\u793A\u300C\u5BBF\u4E3B\u8FDB\u7A0B\u65E7\u300D\uFF0C\u4ECD\u9700\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u5F00 DSH",alignFail:"\u5BF9\u9F50\u68C0\u67E5\u5931\u8D25",alignHint:"\u63D2\u4EF6\u5347\u7EA7\u53EA\u6362\u78C1\u76D8\u6587\u4EF6 \u2014\u2014 \u5BBF\u4E3B\u5185\u5B58\u91CC\u7684\u4E8B\u4EF6\u8BA2\u9605\u4E0E MCP / hooks \u91CC\u7684\u65E7\u8DEF\u5F84\u4E0D\u4F1A\u81EA\u5DF1\u66F4\u65B0\uFF0C\u8FD9\u91CC\u4E00\u6B21\u67E5\u6E05",alignIdle:"\u70B9\u300C\u5F00\u59CB\u68C0\u67E5\u300D\uFF1A\u5BF9\u6BD4\u5BBF\u4E3B / \u5E38\u9A7B\u5B9E\u4F8B / npm \u7684\u7248\u672C\uFF0C\u5E76\u68C0\u67E5 MCP\u3001hooks \u91CC\u662F\u5426\u6709\u65E7\u8DEF\u5F84\u4E0E\u65E7\u53C2\u6570",alignDisk:"\u78C1\u76D8",alignResident:"\u5E38\u9A7B\u5B9E\u4F8B",alignHost:"\u5BBF\u4E3B\u8FDB\u7A0B",captureLogUnavailable:"\u65E5\u5FD7\u4EC5\u5728 DSH \u5BBF\u4E3B\u5185\u53EF\u7528\uFF08\u72EC\u7ACB Web \u9875\u6CA1\u6709 host \u8FD0\u884C\u65F6\uFF09\u3002",captureAgentCards:"Agent \u81EA\u52A8\u6C89\u6DC0\u7684\u5361",noCards:"\u6682\u65E0",loadMore:"\u52A0\u8F7D\u66F4\u591A",batchMerge:"\u4E00\u952E\u667A\u80FD\u5408\u5E76",mergeAllConfirm:"\u5C06\u6309\u76F8\u4F3C\u5EA6\u5206\u7EC4\u7684\u5361\u7247\u5404\u5408\u5E76\u4E3A\u4E00\u5F20\uFF08\u4FDD\u7559\u5404\u81EA kind\uFF09\uFF0C\u539F\u5361\u5220\u9664\uFF1F",crossVault:"\u8DE8\u5E93\u805A\u5408",deleteConfirm:"\u786E\u5B9A\u5220\u9664\u8BE5\u8BB0\u5FC6\u5361\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002",deleted:"\u5DF2\u5220\u9664",deleteFail:"\u5220\u9664\u5931\u8D25",deleteSelected:"\u5220\u9664\u9009\u4E2D",deletedSelected:"\u5F20\u5361\u5DF2\u5220\u9664",merge:"\u5408\u5E76",mergeNeed:"\u81F3\u5C11\u9009 2 \u5F20\u5361",mergeConfirm:"\u5C06\u6240\u9009\u5361\u7247\u5408\u5E76\u4E3A\u4E00\u5F20\u5E76\u5220\u9664\u539F\u5361\uFF1F",merged:"\u5DF2\u5408\u5E76",mergeFail:"\u5408\u5E76\u5931\u8D25",mcpInstalled:"\u2705 {agent} MCP \u5DF2\u5B89\u88C5",mcpUninstalled:"\u2705 {agent} MCP \u5DF2\u5378\u8F7D",mcpActionFail:"\u274C {agent} MCP \u64CD\u4F5C\u5931\u8D25\uFF1A{error}",dshHostLabel:"DeepSeek Harness\uFF08\u5F53\u524D\u5BBF\u4E3B\uFF09",restartHint:"\u5DF2\u4FDD\u5B58\u3002autoWebMode/watchdogAutoSpawn \u7B49\u9700\u91CD\u542F DSH \u751F\u6548\uFF1B\u5DF2\u6709\u5E38\u9A7B watchdog \u4E0D\u4F1A\u88AB\u81EA\u52A8\u505C\u6389\uFF0C\u9700 dsh-memory stop / restart\uFF08#19\uFF09",conflictRefresh:"\u914D\u7F6E\u5DF2\u88AB\u5916\u90E8\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5",untitled:"\u65E0\u6807\u9898",tplBlank:"\u{1F4C4} \u7A7A\u767D",tagsHint:"\u6807\u7B7E\uFF08\u9017\u53F7\u5206\u9694\uFF09",connCount:"{n} \u8FDE\u63A5",tplDecisionTags:"\u51B3\u7B56, \u65B9\u6848",tplBugTags:"\u8E29\u5751, \u6559\u8BAD",tplMeetingTags:"\u4F1A\u8BAE, \u7EAA\u8981",tplWeeklyTags:"\u5468\u62A5",tplDecisionBody:`# \u6280\u672F\u51B3\u7B56\uFF1A[\u6807\u9898]
16
+ `);function $t(t={}){let i=t.lang==="en"?"en":"zh",r=i==="en"?ha:ba,g=t.repo||"EternalNight996/memory-eternal";return r=r.split(zt).join("https://github.com/"+g),t.description&&(r=r.replace(i==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(r=r.replace(i==="en"?"<paste the diagnostics copied from the in-app Report-a-bug dialog>":"<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>",String(t.diagnostics).trim())),r}function _t({panX:t=0,panY:i=0,zoom:r=1,w:g=0,h:c=0,margin:l=60}={}){let C=r||1;return{x0:(0-t)/C-l,y0:(0-i)/C-l,x1:(g-t)/C+l,y1:(c-i)/C+l}}function Nt(t,i,r,g){return g?t+r>=g.x0&&t-r<=g.x1&&i+r>=g.y0&&i-r<=g.y1:!0}function Ut(t){let i=Number(t)||0;return i<=120?1/0:i<=300?160:i<=600?90:60}function Kt(t,i={}){let r=Number.isFinite(i.limit)?i.limit:1/0,g=new Set,c=S=>{S&&g.size<r&&g.add(S)};if(c(i.focusId),c(i.hoverId),i.searchHits)for(let S of i.searchHits){if(g.size>=r)break;g.add(S)}let l=i.degree||{},C=S=>Number(l[S])||0,T=[];for(let S of Array.isArray(t)?t:[])S&&S.id&&!g.has(S.id)&&T.push(S);T.sort((S,H)=>C(H.id)-C(S.id));for(let S of T){if(g.size>=r)break;g.add(S.id)}return g}function va(t,i){if(t===i)return!0;if(t===null||i===null||t===void 0||i===void 0||typeof t!="object"&&typeof i!="object")return t===i;try{return JSON.stringify(t)===JSON.stringify(i)}catch{return!1}}function qt(t,i){let r={...t||{}},g={};for(let[c,l]of Object.entries(i||{}))va(t?t[c]:void 0,l)||(r[c]=l,g[c]=l);return{values:r,overlay:g}}var e=require("react/jsx-runtime"),st="memory-eternal",O="/memory-eternal/api",xa=100,ka=["slots","locale"],Jt={nav:"\u8BB0\u5FC6",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",overview:"\u8BB0\u5FC6\u5E93\u6982\u89C8",total:"\u77E5\u8BC6\u5361",recent:"\u8FD1 7 \u5929\u65B0\u589E",tags:"\u6807\u7B7E",searchPlaceholder:"\u641C\u7D22\u8BB0\u5FC6\uFF08\u652F\u6301\u4E2D\u6587\u7247\u6BB5\uFF09\u2026",search:"\u641C\u7D22",all:"\u5168\u90E8",kindProject:"\u9879\u76EE",kindKnowledge:"\u77E5\u8BC6",kindContent:"\u5185\u5BB9",kindPrompt:"\u63D0\u793A\u8BCD",kindBusiness:"\u4E1A\u52A1",kindTool:"\u5DE5\u5177",kindMistake:"\u6559\u8BAD",cardsTab:"\u77E5\u8BC6\u5361",graphTab:"\u77E5\u8BC6\u56FE\u8C31",graph:"\u77E5\u8BC6\u56FE\u8C31",graphHint:"\u8282\u70B9=\u77E5\u8BC6\u5361\uFF1B\u8FDE\u7EBF=[[\u94FE\u63A5]] \u6216\u5171\u4EAB\u6807\u7B7E\u3002\u70B9\u51FB\u8282\u70B9\u9605\u8BFB\u5361\u7247\u3002",graphTip:"\u5DE6\u952E\u51F8\u663E \xB7 Shift+\u62D6\u62FD\u6846\u9009 \xB7 \u53F3\u952E\u83DC\u5355 \xB7 \u6EDA\u8F6E\u7F29\u653E \xB7 \u62D6\u62FD\u5E73\u79FB",rebuild:"\u91CD\u5EFA",reset:"\u91CD\u7F6E",expandAll:"\u5168\u90E8\u5C55\u5F00",capped:"\u5DF2\u5C55\u793A\u6700\u6838\u5FC3\u7684",clearFocus:"\u53D6\u6D88\u9AD8\u4EAE",empty:"\u8BB0\u5FC6\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u591A\u804A\u51E0\u8F6E\u540E\uFF0C\u503C\u5F97\u4FDD\u5B58\u7684\u5185\u5BB9\u4F1A\u81EA\u52A8\u6C89\u6DC0\u6210\u77E5\u8BC6\u5361\u3002",emptyGraph:"\u56FE\u8C31\u6682\u65E0\u6570\u636E\u3002",open:"\u9605\u8BFB",updated:"\u66F4\u65B0\u4E8E",created:"\u521B\u5EFA\u4E8E",source:"\u6765\u6E90",close:"\u5173\u95ED",vaultDir:"\u8BB0\u5FC6\u5E93\u76EE\u5F55",capture:"\u81EA\u52A8\u6C89\u6DC0",recall:"\u81EA\u52A8\u53EC\u56DE",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u7981\u7528",error:"\u52A0\u8F7D\u5931\u8D25",back:"\u8FD4\u56DE\u5217\u8868",cardCount:"\u5F20\u5361",nodes:"\u8282\u70B9",edges:"\u8FDE\u7EBF",memoryTitle:"\u8BB0\u5FC6\u5E93",memoryHint:"\u4F60\u7684\u672C\u5730\u7B2C\u4E8C\u5927\u8111",zoomIn:"\u653E\u5927",zoomOut:"\u7F29\u5C0F",fit:"\u9002\u5E94",enterFullscreen:"\u5168\u5C4F",exitFullscreen:"\u9000\u51FA\u5168\u5C4F",exportGraph:"\u5BFC\u51FA",openCard:"\u6253\u5F00\u5361\u7247",focusNeighbors:"\u51F8\u663E\u5173\u8054",copyName:"\u590D\u5236\u540D\u79F0",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u8BB0\u5FC6",clearFilter:"\u6E05\u9664\u8FC7\u6EE4",filterLabel:"\u7B5B\u9009",sortRecent:"\u6700\u8FD1",sortTitle:"\u6807\u9898",sortHot:"\u70ED\u70B9",exportSel:"\u5BFC\u51FA\u9009\u4E2D",clearSelection:"\u6E05\u7A7A\u9009\u62E9",download:"\u4E0B\u8F7D",openNewTab:"\u65B0\u6807\u7B7E\u6253\u5F00",copyImage:"\u590D\u5236\u56FE\u7247",done:"\u5B8C\u6210",downloaded:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D",openedTab:"\u5DF2\u5728\u65B0\u6807\u7B7E\u6253\u5F00",copied:"\u5DF2\u590D\u5236",exportedSel:"\u4E2A\u8282\u70B9\u5DF2\u5BFC\u51FA",fullscreen:"\u5168\u5C4F",exitFull:"\u9000\u51FA\u5168\u5C4F",copyFail:"\u590D\u5236\u5931\u8D25",timeDim:"\u65F6\u95F4\u7EF4",timeNew:"3 \u5929\u5185",timeRecent:"2 \u5468\u5185",timeMonth:"1 \u6708\u5185",timeOld:"\u66F4\u65E9",newBadge:"\u65B0",expand:"\u5C55\u5F00\u5168\u90E8",collapse:"\u6536\u8D77",exportVault:"\u5BFC\u51FAMD",exportJson:"\u5BFC\u51FAJSON",exporting:"\u5BFC\u51FA\u4E2D\u2026",exportedVault:"\u8BB0\u5FC6\u5E93\u5DF2\u5BFC\u51FA",exportFail:"\u5BFC\u51FA\u5931\u8D25",importVault:"\u5BFC\u5165",importedVault:"\u5BFC\u5165\u5B8C\u6210",importedTotal:" \u5F20 / \u6587\u4EF6\u5171 ",importedTotalTail:" \u5F20",importedQuarantine:" \xB7 \u5F85\u5BA1\u6838 ",importedQuarantineTail:" \u5F20\uFF08\u9694\u79BB\u533A\uFF0C\u6279\u51C6\u540E\u624D\u53C2\u4E0E\u53EC\u56DE\uFF09",importedSkipped:" \xB7 \u8DF3\u8FC7 ",importedSkippedTail:" \u5F20\uFF08\u91CD\u590D\u6216\u7A7A\uFF09",importFail:"\u5BFC\u5165\u5931\u8D25",location:"\u81EA\u9009\u4F4D\u7F6E",saveAs:"\u53E6\u5B58\u4E3A",saveAsUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9009\u62E9\u4FDD\u5B58\u4F4D\u7F6E",exportedTo:"\u5DF2\u5BFC\u51FA\u5230",defaultDownloads:"\u9ED8\u8BA4\u4E0B\u8F7D\u6587\u4EF6\u5939",exportCancel:"\u5DF2\u53D6\u6D88\u5BFC\u51FA",manage:"\u7BA1\u7406",tabUsage:"\u7528\u91CF/\u4ECA\u65E5",tabOptimize:"\u6574\u7406\u5EFA\u8BAE",adminLoadFail:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF1A\u8BF7\u5F7B\u5E95\u91CD\u542F dsh-desktop\uFF08host \u9700\u52A0\u8F7D\u65B0\u7248 /memory-eternal \u8DEF\u7531\uFF09",retry:"\u91CD\u8BD5",mergeSimilar:"\u4E00\u952E\u5408\u5E76\u76F8\u4F3C",trendLabel:"\u8FD1 30 \u5929\u8D8B\u52BF",cleanStale:"\u{1F5D1}\uFE0F \u4E00\u952E\u6E05\u7406\u9648\u65E7",deletedStale:"\u4E2A\u9648\u65E7\u5361\u5DF2\u6E05\u7406",newCard:"\u65B0\u5EFA",tplDecision:"\u{1F4DD} \u6280\u672F\u51B3\u7B56",tplBug:"\u{1F41B} \u8E29\u5751",tplMeeting:"\u{1F4CB} \u4F1A\u8BAE\u7EAA\u8981",tplWeekly:"\u{1F4CA} \u5468\u62A5",createCard:"\u521B\u5EFA",cardTitle:"\u6807\u9898",cardBody:"\u6B63\u6587",fbUseful:"\u6709\u7528",fbIrr:"\u65E0\u5173",todayAdd:"\u4ECA\u65E5\u65B0\u589E",weekAdd:"\u8FD1 7 \u5929",byKind:"\u5206\u7C7B\u7EDF\u8BA1",todayList:"\u4ECA\u65E5\u6C89\u6DC0",budgetLabel:"\u4F1A\u8BDD\u9884\u7B97",budgetChars:"\u9884\u7B97\u5B57\u7B26",recallLimitLabel:"\u53EC\u56DE\u6761\u6570",embeddingLabel:"\u8BED\u4E49\u53EC\u56DE",mergePairs:"\u76F8\u4F3C\u5361\u5BF9\uFF08\u53EF\u5408\u5E76\uFF09",staleCards:"\u9648\u65E7\u5361\uFF08>90 \u5929\u672A\u66F4\u65B0\uFF09",noOptimize:"\u6682\u65E0\u53EF\u6574\u7406\u9879\uFF0C\u5F88\u5065\u5EB7 \u{1F389}",refineTitle:"\u77DB\u76FE\u626B\u63CF",refineScan:"\u5F00\u59CB\u626B\u63CF",refineHint:"\u76F8\u4F3C\u53EF\u4EE5\u5408\u5E76\uFF0C\u77DB\u76FE\u5FC5\u987B\u4EBA\u5224\u65AD \u2014\u2014 \u626B\u63CF\u53EA\u8BFB\uFF0C\u9009\u62E9\u540E\u624D\u52A8\u6570\u636E\uFF08\u4FDD\u7559\u4E00\u5F20\u4F1A\u628A\u53E6\u4E00\u5F20\u653E\u8FDB\u56DE\u6536\u7AD9\uFF0C\u53EF\u8FD8\u539F\uFF09",refineIdle:"\u70B9\u300C\u5F00\u59CB\u626B\u63CF\u300D\uFF1A\u5148\u5BBD\u53EC\u56DE\u53EF\u80FD\u6709\u5173\u7CFB\u7684\u5361\u7247\u5BF9\uFF0C\u518D\u8BA9\u6A21\u578B\u5224\u65AD\u662F\u91CD\u590D / \u8865\u5145 / \u77DB\u76FE / \u65E0\u5173",refineNone:"\u8FD9\u4E00\u8F6E\u6CA1\u6709\u53D1\u73B0\u9700\u8981\u4F60\u88C1\u51B3\u7684\u5361\u7247\u5BF9 \u{1F389}",refineFail:"\u77DB\u76FE\u626B\u63CF\u5931\u8D25",refineApplied:"\u5DF2\u8BB0\u5F55\u4F60\u7684\u88C1\u51B3\uFF08\u4E0D\u4F1A\u91CD\u590D\u6253\u6270\uFF09",refineRel_duplicate:"\u91CD\u590D\uFF08\u53EF\u5408\u5E76\uFF09",refineRel_complement:"\u8865\u5145\uFF08\u90FD\u7559\u7740\uFF09",refineRel_conflict:"\u77DB\u76FE\uFF08\u9700\u4F60\u88C1\u51B3\uFF09",refineRel_unrelated:"\u65E0\u5173",refineKeepA:"\u4FDD\u7559 A",refineKeepB:"\u4FDD\u7559 B",refineKeepBoth:"\u90FD\u4FDD\u7559",refineMerge:"\u5408\u5E76",junkTitle:"\u6CE8\u5165\u5783\u573E\u5361",junkScan:"\u626B\u63CF\u5B58\u91CF",junkHint:"\u6000\u7591\u662F\u8FD0\u884C\u65F6\u6CE8\u5165\u6587\u672C\uFF08\u6280\u80FD\u76EE\u5F55 / system-reminder\uFF09\u6C89\u6DC0\u6210\u7684\u5361 \u2014\u2014 \u626B\u63CF\u53EA\u8BFB\uFF0C\u56DE\u6536\u8D70\u56DE\u6536\u7AD9\u53EF\u8FD8\u539F",junkIdle:"\u70B9\u300C\u626B\u63CF\u5B58\u91CF\u300D\uFF1A\u627E\u51FA\u6B63\u6587\u5176\u5B9E\u662F\u88AB\u6CE8\u5165\u7684\u8FD0\u884C\u65F6\u6587\u672C\u3001\u5265\u6389\u540E\u51E0\u4E4E\u4E0D\u5269\u4EBA\u8BDD\u7684\u5361",junkNone:"\u6CA1\u53D1\u73B0\u8FD9\u7C7B\u5361 \u{1F389}",junkRecycle:"\u56DE\u6536",junkRecycleAll:"\u5168\u90E8\u56DE\u6536",junkRecycleAllConfirm:"\u786E\u8BA4\u628A\u8FD9\u4E9B\u5361\u9001\u8FDB\u56DE\u6536\u7AD9\uFF1F\uFF08\u4E0D\u662F\u6C38\u4E45\u5220\u9664\uFF0C\u53EF\u5728\u56DE\u6536\u4E2D\u5FC3\u8FD8\u539F\uFF09",junkDone:"\u5DF2\u9001\u56DE\u6536\u7AD9",junkFail:"\u626B\u63CF / \u56DE\u6536\u5931\u8D25",dbReadonlyTitle:"\u8BB0\u5FC6\u5E93\u5F53\u524D\u4E0D\u53EF\u5199",dbReadonlyBody:"\u5361\u7247\u8BFB\u5199 / \u5BA1\u6838 / \u56FE\u8C31\u4F1A\u5931\u8D25\uFF0C\u4F46**\u914D\u7F6E\u4ECD\u53EF\u4FDD\u5B58**\uFF08\u914D\u7F6E\u4E0D\u7ECF\u8FC7\u6570\u636E\u5E93\uFF09",dbReadonlyFix:"\u6392\u67E5\uFF1Adsh-memory doctor\uFF08\u770B journal \u6A21\u5F0F\u3001\u5199\u63A2\u9488\u3001\u5907\u4EFD\u6E05\u5355\u4E0E\u6062\u590D\u6B65\u9AA4\uFF09",goalTitle:"\u540C\u76EE\u6807\u4E0D\u540C\u505A\u6CD5",goalScan:"\u626B\u63CF\u76EE\u6807",goalHint:"\u6309\u300C\u8FD9\u5F20\u5361\u89E3\u51B3\u4EC0\u4E48\u95EE\u9898\u300D\u805A\u7C7B \u2014\u2014 \u6B63\u6587\u76F8\u4F3C\u5EA6\u6293\u4E0D\u5230\u7684\u505A\u6CD5\u5DEE\u5F02\uFF087z \u538B\u7F29 / tar \u5206\u53D1 / npm \u7626\u8EAB\uFF09\u4E5F\u80FD\u5F52\u5230\u4E00\u8D77",goalIdle:"\u70B9\u300C\u626B\u63CF\u76EE\u6807\u300D\uFF1A\u6A21\u578B\u5148\u7ED9\u6BCF\u5F20\u5361\u62BD\u4E00\u53E5\u76EE\u6807\uFF08\u9996\u6B21\u4F1A\u8C03\u6A21\u578B\uFF0C\u4E4B\u540E\u8D70\u7F13\u5B58\uFF09\uFF0C\u518D\u6309\u76EE\u6807\u805A\u7C7B",goalNone:"\u6CA1\u6709\u53D1\u73B0\u300C\u540C\u4E00\u76EE\u6807\u3001\u591A\u5F20\u5361\u300D\u7684\u7C07 \u{1F389}",goalStats:"\u5DF2\u7D22\u5F15 / \u672C\u6B21\u8C03\u7528",goalCards:"\u5F20\u5361",goalKeep:"\u90FD\u4FDD\u7559",goalMerge:"\u5408\u5E76\u8FD9\u4E00\u7EC4",goalMerged:"\u5DF2\u63D0\u4EA4\u5408\u5E76\uFF08\u65B0\u5361\u8FDB\u5BA1\u6838\u961F\u5217\uFF09",goalDone:"\u5DF2\u8BB0\u5F55\u300C\u90FD\u4FDD\u7559\u300D",goalFail:"\u76EE\u6807\u805A\u7C7B\u5931\u8D25",oneClickOptimize:"\u4E00\u952E\u4F18\u5316",oneClickOptimizeConfirm:"\u786E\u8BA4\u4E00\u952E\u4F18\u5316\uFF1F\u5C06\u5408\u5E76\u6240\u6709\u76F8\u4F3C\u5361\u5BF9\uFF08\u9ED8\u8BA4\u4E0D\u6E05\u7406\u9648\u65E7\u5361\uFF09\u3002",oneClickAlsoStale:"\u540C\u65F6\u6E05\u7406\u9648\u65E7\u5361",oneClickOptimizeDone:"\u4E00\u952E\u4F18\u5316\u5B8C\u6210",optimizedMerged:"\u5BF9\u5DF2\u5408\u5E76",optimizedStaleDeleted:"\u5F20\u9648\u65E7\u5361\u5DF2\u6E05\u7406",mcpSetupStatus:"Agent MCP \u6302\u8F7D\u72B6\u6001",rerunSetup:"\u8865\u5168 MCP",notInstalled:"\u672A\u5B89\u88C5",noMcpEntry:"\u914D\u7F6E\u7F3A\u5931",nodePathMismatch:"node \u8DEF\u5F84\u4E0D\u4E00\u81F4\uFF0C\u5EFA\u8BAE\u91CD\u8DD1 setup",nodePathNote:"node \u73AF\u5883\u4E0D\u540C\uFF08\u53EF\u7528\uFF09",healthy:"\u914D\u7F6E\u6B63\u5E38",mcpSetupHint:"\u300C\u81EA\u52A8\u6302\u8F7D MCP\u300D= \u8BA9 Claude Code / Codex / Cursor \u8FD9\u4E9B\u5DE5\u5177\u80FD\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002\u5F00\u542F\u540E\u81EA\u52A8\u628A\u5B83\u4EEC\u914D\u7F6E\u597D\uFF1B\u5173\u6389\u5C31\u4E0D\u52A8\u4F60\u7535\u8111\u4E0A\u4EFB\u4F55\u914D\u7F6E\u6587\u4EF6\uFF0C\u9700\u8981\u65F6\u624B\u52A8\u8DD1 dsh-memory setup\u3002",mcpManageHint:"\u6BCF\u4E2A agent \u7528\u4E0B\u65B9\u6309\u94AE\u5355\u72EC\u5B89\u88C5/\u5378\u8F7D MCP",tabConfig:"\u8BB0\u5FC6\u914D\u7F6E",tabAudit:"\u5BA1\u6838\u4E2D\u5FC3",statusApproved:"\u5DF2\u5BA1\u6838",statusPending:"\u5F85\u5BA1\u6838",statusRejected:"\u5DF2\u9A73\u56DE",allStatus:"\u5168\u90E8\u72B6\u6001",tabRecycle:"\u56DE\u6536\u4E2D\u5FC3",pending:"\u5F85\u5BA1\u6838",rejected:"\u5DF2\u9A73\u56DE",selectAll:"\u5168\u9009",approve:"\u6279\u51C6",reject:"\u9A73\u56DE",allAgents:"\u5168\u90E8\u667A\u80FD\u4F53",noAuditItems:"\u6682\u65E0\u5BA1\u6838\u9879\u76EE",auditBodyFail:"\u6B63\u6587\u8BFB\u53D6\u5931\u8D25",deletedAt:"\u5220\u9664\u4E8E",restore:"\u6062\u590D",restoreDelete:"\u5220\u9664\u8FDB\u56DE\u6536\u7AD9",purge:"\u6C38\u4E45\u5220\u9664",emptyRecycle:"\u56DE\u6536\u7AD9\u4E3A\u7A7A",recycleHint:"\u5220\u9664\u7684\u5361\u7247\u5148\u8FDB\u56DE\u6536\u7AD9\uFF0C30 \u5929\u5185\u53EF\u6062\u590D\uFF0C\u8D85\u671F\u81EA\u52A8\u6C38\u4E45\u5220\u9664",purgeConfirm:"\u786E\u5B9A\u6C38\u4E45\u5220\u9664\uFF1F\u4E0D\u53EF\u6062\u590D\u3002",recycleDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u8FDB\u56DE\u6536\u7AD9\uFF1F30 \u5929\u5185\u53EF\u6062\u590D\u3002",modeInit:"\u542F\u52A8\u65F6\u62C9\u4E00\u6B21",modeInterval:"\u5468\u671F\u4FDD\u6D3B",modeManual:"\u4EC5\u624B\u52A8",serviceConfig:"\u670D\u52A1\u81EA\u7BA1\u7406\u914D\u7F6E",auditConfig:"\u81EA\u52A8\u5BA1\u6838\u914D\u7F6E",auditHint:"\u547D\u4E2D\u514D\u5BA1\u7684\u65B0\u5361\u76F4\u63A5\u5165\u5E93\uFF0C\u5176\u4F59\u8FDB\u5F85\u5BA1\u6838",auditMode:"\u5BA1\u6838\u6A21\u5F0F",auditAll:"\u5168\u90E8\u8981\u5BA1\u6838",auditNone:"\u5168\u90E8\u514D\u5BA1",auditExemptAgents:"\u514D\u5BA1\u667A\u80FD\u4F53",auditExemptKinds:"\u514D\u5BA1\u7C7B\u578B",allExempt:"\u5168\u90E8\u514D\u5BA1",recycleDays:"\u56DE\u6536\u4FDD\u7559\u5929\u6570",editInSetting:"\u7F16\u8F91\u8BF7\u5230 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6",pendingSyncNote:"\u6B64\u9875\u662F\u72EC\u7ACB Web \u9875\uFF1A\u4FDD\u5B58\u540E\u7531 DSH \u5BBF\u4E3B\u5E94\u7528\uFF08\u65B0\u7248\u5BBF\u4E3B\u4F1A\u88AB\u76F4\u63A5\u53EB\u9192\u3001\u5728\u8BF7\u6C42\u4E0A\u4E0B\u6587\u91CC\u5E94\u7528\uFF0C\u70B9\u4FDD\u5B58\u5373\u751F\u6548\uFF09\uFF1B\u82E5\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5219\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\u3001\u7ACB\u5373\u751F\u6548\u3002\u53EA\u6709\u5728\u5BF9\u63A5\u65E7\u7248\u5BBF\u4E3B\u65F6\u624D\u4F1A\u9000\u56DE\u300C\u6392\u961F\u7B49\u5B83\u81EA\u5DF1\u540C\u6B65\u300D\uFF0C\u90A3\u65F6\u53EF\u5728 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u91CC\u6539\u540C\u4E00\u9879\u3002",readonlyTitle:"\u5F53\u524D\u9875\u9762\u53EA\u8BFB\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u914D\u7F6E",readonlyBody:"\u8FD9\u4E2A\u8FDB\u7A0B\u6CA1\u6709 DSH \u7684\u8BBE\u7F6E\u670D\u52A1\uFF08settings.update \u4E0D\u5B58\u5728\uFF09\uFF0C\u914D\u7F6E\u53EA\u80FD\u5728\u672C\u673A DSH \u91CC\u4FEE\u6539\uFF1A\u684C\u9762\u7248 \u2192 \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u3002",readonlyBtn:"\u53EA\u8BFB",setupRunInTerminal:"\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5230\u7EC8\u7AEF\u6267\u884C\uFF1A",dshMemoryConfig:"DSH \u8BB0\u5FC6\u914D\u7F6E",autoCapture:"\u81EA\u52A8\u6C89\u6DC0",autoRecall:"\u81EA\u52A8\u53EC\u56DE",captureMinChars:"\u6355\u83B7\u6700\u5C0F\u957F\u5EA6",maxCardsPerDay:"\u65E5\u914D\u989D",dedupThreshold:"\u53BB\u91CD\u9608\u503C",recallLimit:"\u53EC\u56DE\u6761\u6570",vaultMulti:"\u591A\u5E93\uFF08\u6309\u9879\u76EE\u9694\u79BB\uFF09",vaultMultiHint:"\u7559\u7A7A\u5373\u5355\u5E93\uFF0C\u8001\u914D\u7F6E\u4E0D\u53D7\u5F71\u54CD",vaultNow:"\u5F53\u524D\u751F\u6548",vaultSource:"\u6765\u6E90",vaultWorkspace:"\u5F53\u524D workspace",vaultNamePh:"\u5E93\u540D\uFF0C\u5982 work",vaultPathPh:"\u76EE\u5F55\uFF0C\u5982 D:/vaults/work",vaultMatchPh:"\u9879\u76EE\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u6309 workspace \u81EA\u52A8\u9009\u5E93\uFF09",vaultAdd:"\u6DFB\u52A0\u4E00\u4E2A\u5E93",vaultActive:"\u6FC0\u6D3B\u5E93",vaultActiveNone:"\u9ED8\u8BA4\u5E93\uFF08\u4E0D\u6307\u5B9A\uFF09",vaultSrcEnv:"\u73AF\u5883\u53D8\u91CF MEMORY_VAULT_DIR",vaultSrcProfile:"\u6FC0\u6D3B\u5E93\u914D\u7F6E",vaultSrcWorkspace:"\u6309\u9879\u76EE\u76EE\u5F55\u81EA\u52A8\u547D\u4E2D",vaultSrcVaultDir:"\u5355\u5E93\u914D\u7F6E vaultDir",vaultSrcDefault:"\u9ED8\u8BA4\u76EE\u5F55",fbNav:"\u53CD\u9988\u5F02\u5E38",fbTitle:"\u53CD\u9988\u5F02\u5E38\uFF08\u63D0\u4EA4\u5230 GitHub\uFF09",fbDesc:"\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF08\u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A\uFF09",fbDiag:"\u8BCA\u65AD\u4FE1\u606F\uFF08\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E key/token \u5DF2\u66FF\u6362\uFF09",fbCopyDiag:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",fbOpenIssue:"\u5728 GitHub \u63D0\u4EA4\uFF08\u5DF2\u9884\u586B\uFF09",fbCopyPrompt:"\u590D\u5236\u7ED9 AI \u7684\u63D0\u793A\u8BCD",fbCopiedDiag:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",fbCopiedPrompt:"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\uFF0C\u7C98\u8FDB AI \u5BF9\u8BDD\u6846\u5373\u53EF",fbCopyFail:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u590D\u5236",fbWhy:"GitHub \u4E0D\u5141\u8BB8\u533F\u540D\u521B\u5EFA issue\uFF0C\u63D2\u4EF6\u91CC\u4E5F\u4E0D\u5E94\u5185\u7F6E token\uFF1A\u6240\u4EE5\u8FD9\u91CC\u628A\u6807\u9898 / \u6B63\u6587 / \u8BCA\u65AD\u90FD\u9884\u586B\u597D\uFF0C\u4F60\u53EA\u9700\u518D\u70B9\u4E00\u6B21 Submit\u3002",fbNeedDesc:"\u8BF7\u5148\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898",fbLoading:"\u6B63\u5728\u6536\u96C6\u8BCA\u65AD\u4FE1\u606F\u2026",fbDiagFail:"\u8BCA\u65AD\u63A5\u53E3\u4E0D\u53EF\u7528\uFF08\u72EC\u7ACB web \u6216\u65E7\u7248\u5BBF\u4E3B\uFF09\uFF0C\u8BF7\u624B\u52A8\u8865\u5145\u73AF\u5883\u4FE1\u606F",fbOr:"\u6216\u8005",fbSelectAll:"\u5168\u9009",toastApproved:"\u5DF2\u6279\u51C6",toastRejected:"\u5DF2\u9A73\u56DE",toastCardDeleted:"\u5DF2\u5220\u9664",toastRestored:"\u5DF2\u6062\u590D",toastPurged:"\u5DF2\u5F7B\u5E95\u5220\u9664",toastPurgedExpired:"\u5DF2\u6E05\u7406\u8FC7\u671F\u56DE\u6536\u7AD9",toastFailed:"\u64CD\u4F5C\u5931\u8D25",noSelection:"\u8BF7\u5148\u9009\u62E9\u8981\u5904\u7406\u7684\u5361\u7247",enabledLabel:"\u542F\u7528\u8BB0\u5FC6\u6838\u5FC3",vaultDirLabel:"\u8BB0\u5FC6\u5E93\u76EE\u5F55\uFF08\u5355\u5E93\uFF09",captureCooldownMs:"\u6C89\u6DC0\u51B7\u5374 (ms)",captureProvider:"\u84B8\u998F provider\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",routeAuto:"\u81EA\u52A8\uFF08\u6309\u6CE8\u518C\u987A\u5E8F\uFF09",captureFollowSession:"\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\uFF08\u84B8\u998F\u7528\u4F1A\u8BDD\u7684 provider/model\uFF09",captureFirstOnly:"\u4EC5\u8BD5\u9996\u9009\uFF08\u5931\u8D25\u5373\u505C\uFF0C\u4E0D\u8F6E\u6362\u515C\u5E95\uFF09",llmTest:"\u6D4B\u8BD5\u84B8\u998F\u8DEF\u7531",llmTestOk:"\u2713 \u8C03\u7528\u6210\u529F",llmTestFail:"\u2717 \u8C03\u7528\u5931\u8D25",llmCandidates:"\u5019\u9009\u6570",captureModel:"\u84B8\u998F model\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",recallEmbedding:"\u8BED\u4E49\u53EC\u56DE provider\uFF08\u53EF\u9009\uFF09",sessionBudgetChars:"\u4F1A\u8BDD\u9884\u7B97 (\u5B57\u7B26)",saving:"\u4FDD\u5B58\u4E2D\u2026",savePending:"\u5DF2\u5199\u5165\u914D\u7F6E\u6587\u4EF6\uFF1B\u5BBF\u4E3B\u4ECD\u662F\u65E7\u7248\uFF0C\u91CD\u542F DSH \u540E\u5373\u4EE5\u65B0\u503C\u4E3A\u51C6\uFF08\u672C\u9762\u677F\u5DF2\u751F\u6548\uFF09",actionRunning:"\u5904\u7406\u4E2D\u2026",recycleEmptyHint:"\u56DE\u6536\u7AD9\u4E3A\u7A7A\uFF1A\u5220\u6389\u7684\u5361\u7247\u4F1A\u5148\u653E\u5230\u8FD9\u91CC\uFF0C\u4FDD\u7559 {days} \u5929\u540E\u81EA\u52A8\u6E05\u7406\u3002",recyclePurgeAll:"\u6E05\u7A7A\u56DE\u6536\u7AD9",fbCopyManual:"\u81EA\u52A8\u590D\u5236\u88AB\u6D4F\u89C8\u5668\u62E6\u622A\uFF0C\u5DF2\u628A\u5185\u5BB9\u653E\u5728\u4E0B\u9762\uFF1A\u70B9\u300C\u5168\u9009\u300D\u518D\u6309 Ctrl+C",vcPage:"\u9875\u9762\u811A\u672C",vcPageStale:"\u26A0 \u5F53\u524D\u9875\u9762\u4ECD\u5728\u8FD0\u884C\u65E7\u7248\u811A\u672C\uFF08\u9875\u9762 v{page} / \u78C1\u76D8 v{disk}\uFF09\uFF1A\u6309 Ctrl+F5 \u5237\u65B0\u9875\u9762\u5373\u751F\u6548\uFF1B\u82E5\u300C\u8FD0\u884C\u4E2D\u300D\u4ECD\u662F\u65E7\u7248\u53F7\uFF0C\u5219\u8FD8\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcLoaded:"\u8FD0\u884C\u4E2D\uFF08\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF09",vcResident:"\u5E38\u9A7B\u5B9E\u4F8B",vcOnDisk:"\u78C1\u76D8\u5B89\u88C5",vcLatest:"npm \u6700\u65B0",vcStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 v{disk}\uFF0C\u4F46\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\u4ECD\u52A0\u8F7D v{loaded} \u2014\u2014 \u70B9\u300C\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u300D\u5373\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u542F\u5B83\uFF08\u4E0D\u7528\u91CD\u542F DSH\uFF09",vcRestart:"\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",vcRestarting:"\u91CD\u542F\u4E2D\u2026",vcRestartSent:"\u5DF2\u8C03\u5EA6\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\uFF1A\u7EA6 3-8 \u79D2\u540E\u65B0\u8FDB\u7A0B\u63A5\u7BA1\uFF0C\u8BF7\u7A0D\u7B49\u518D\u5237\u65B0\u9875\u9762\uFF08Ctrl+F5\uFF09",vcRestartCurrent:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u7ECF\u662F\u6700\u65B0\u7248\uFF0C\u65E0\u9700\u91CD\u542F",vcRestartFail:"\u91CD\u542F\u8BF7\u6C42\u5931\u8D25",vcRestartNoRoute:"\u5F53\u524D\u9875\u9762\u5BF9\u63A5\u7684\u8FDB\u7A0B\u8FD8\u662F\u65E7\u7248\uFF08\u6CA1\u6709\u8FD9\u4E2A\u63A5\u53E3\uFF09\uFF1A\u8BF7\u91CD\u542F\u684C\u9762\u7248 / DSH \u540E\u518D\u8BD5\uFF0C\u6216\u6267\u884C {cmd}",vcHostStale:"\u4E0A\u65B9\u7684\u300C\u8FD0\u884C\u4E2D\u300D\u6765\u81EA\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF1B\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F\u65B0\u7248 \u2014\u2014 \u8981\u8BA9\u5B83\u4E5F\u53D8\u6210\u65B0\u7248\u53F7\uFF0C\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcResidentDownShort:"\u672A\u8FD0\u884C",vcResidentDown:"\u5E38\u9A7B\u5B9E\u4F8B\u6CA1\u5728\u8FD0\u884C\uFF08\u7AEF\u53E3 {port} \u65E0\u54CD\u5E94\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u7528\u65B0\u4EE3\u7801\u628A\u5B83\u62C9\u8D77\u6765\uFF1B\u62C9\u4E0D\u8D77\u6765\u65F6\u6267\u884C {cmd}\uFF0C\u5E76\u8D34\u4E00\u4E0B dsh-memory status \u7684\u8F93\u51FA",vcResidentUnmanagedShort:"\u672A\u6258\u7BA1",vcResidentUnmanaged:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u6CA1\u6709\u770B\u95E8\u72D7\u4FDD\u6D3B**\uFF08\u505C\u6B62 / \u786C\u6740\u540E\u6B8B\u7559\u7684\u5B64\u513F\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u628A\u5B83\u91CD\u65B0\u6258\u7BA1\uFF08\u91CD\u65B0\u62C9\u4E00\u4E2A\u770B\u95E8\u72D7 + \u65B0\u5B9E\u4F8B\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u6267\u884C {cmd}",vcResidentLockUnknownShort:"\u6258\u7BA1\u72B6\u6001\u672A\u77E5",vcResidentReplaceBlockedShort:"\u4E0D\u53EF\u66FF\u6362",vcResidentHostManagedShort:"\u5BBF\u4E3B\u6258\u7BA1",vcResidentReplaceBlocked:"\u5E38\u9A7B\u5B9E\u4F8B**\u4E0D\u53EF\u66FF\u6362**\uFF08\u73AF\u5883\u9650\u5236\uFF09\uFF1A\u770B\u95E8\u72D7\u9501\u76EE\u5F55\u4E0D\u53EF\u5199\uFF08{err}\uFF1B{path}\uFF09\u2192 \u7AEF\u53E3\u4E0A\u4F1A**\u957F\u671F**\u505C\u5728 v{served}\u3002\u8FD9\u4E0D\u662F\u300C\u6682\u65F6\u843D\u540E\u300D\uFF1A\u81EA\u52A8\u66FF\u6362\u88AB\u6B63\u786E\u5730\u62D2\u7EDD\uFF08\u907F\u514D\u7559\u4E0B\u5B64\u513F\uFF09\u3002\u51FA\u8DEF\uFF1A\u4FEE\u590D\u8BE5\u76EE\u5F55\u6743\u9650\u540E\u6267\u884C {cmd}\uFF0C\u6216\u524D\u53F0\u89C2\u5BDF dsh-memory watchdog --port 7999",vcResidentLockUnknown:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u770B\u95E8\u72D7\u9501\u6587\u4EF6\u5199\u4E0D\u8FDB\u53BB**\uFF08\u53D7\u9650\u73AF\u5883\uFF1A\u6C99\u7BB1\u7981\u5199 / ACL / \u975E\u7CFB\u7EDF\u76D8\uFF09\u2192 \u65E0\u6CD5\u5224\u65AD\u5B83\u6709\u6CA1\u6709\u88AB\u6258\u7BA1\uFF08\u4E0D\u662F\u300C\u672A\u6258\u7BA1\u300D\uFF09\u3002\u539F\u56E0\uFF1A{err}\uFF08{path}\uFF09\u3002\u4FDD\u6D3B\u901A\u5E38\u4ECD\u7136\u6709\u6548\uFF1B\u70B9\u4E0B\u9762\u7684\u6309\u94AE\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u65B0\u6258\u7BA1\u4E00\u6B21\u3002",vcOutdated:"\u6709\u65B0\u7248\u672C",vcUpToDate:"\u5DF2\u662F\u6700\u65B0",vcCheck:"\u68C0\u67E5\u66F4\u65B0",checking:"\u68C0\u67E5\u4E2D\u2026",vcCheckFail:"\u68C0\u67E5\u66F4\u65B0\u5931\u8D25",recallSummaryLen:"\u53EC\u56DE\u6458\u8981\u957F\u5EA6",recallBody:"\u53EC\u56DE\u542B\u6B63\u6587",secretHint:"\u51ED\u8BC1\u53D6\u7528\u63D0\u793A\uFF08\u6CE8\u5165\u6BCF\u4E2A\u4F1A\u8BDD\uFF09",autoWeb:"Web server",autoWebMode:"\u4FDD\u6D3B\u6A21\u5F0F",webPort:"Web \u7AEF\u53E3",webCheckIntervalMs:"\u63A2\u6D3B\u95F4\u9694(ms)",webMaxRestart:"\u6700\u5927\u91CD\u542F\u6B21\u6570",watchdogAutoSpawn:"\u770B\u95E8\u72D7\u8FDB\u7A0B",autoRestartOnDrift:"\u7248\u672C\u6F02\u79FB\u81EA\u52A8\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",autoMcpSetup:"\u81EA\u52A8\u6302\u8F7D MCP",saveConfig:"\u4FDD\u5B58\u914D\u7F6E",saveFail:"\u4FDD\u5B58\u5931\u8D25",savedOk:"\u5DF2\u4FDD\u5B58",savedDirect:"\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5DF2\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\uFF08hooks / MCP / \u72EC\u7ACB\u9875\u7ACB\u5373\u751F\u6548\uFF09",savedApplied:"\u5DF2\u4FDD\u5B58\u5E76\u751F\u6548\uFF08\u5BBF\u4E3B\u5DF2\u5728\u8BF7\u6C42\u4E0A\u4E0B\u6587\u91CC\u5E94\u7528\uFF09",saveQueued:"\u5DF2\u4EA4\u7ED9 DSH \u5BBF\u4E3B\u540C\u6B65\uFF0C\u5C1A\u672A\u786E\u8BA4\u751F\u6548",saveHostGuard:"\u8BE5\u5BBF\u4E3B\u4E0D\u5141\u8BB8\u63D2\u4EF6\u4ECE\u81EA\u5DF1\u7684\u56DE\u8C03\u4E0A\u4E0B\u6587\u91CC\u5199\u914D\u7F6E\uFF1B\u8BF7\u5728\u300CDSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u300D\u91CC\u6539\u540C\u4E00\u9879\uFF0C\u6216\u7F16\u8F91 profile \u7684\u914D\u7F6E\u8865\u4E01\u5C42",saveFailHint:"\u5BBF\u4E3B\u4FA7\u672A\u5E94\u7528\uFF0C\u8BE6\u89C1\u300C\u53CD\u9988\u5F02\u5E38\u300D\u91CC\u7684\u8BCA\u65AD\u4FE1\u606F",recallTool:"recall \u5DE5\u5177",costControl:"\u6210\u672C\u63A7\u5236",costHint:"\u7701 token\u3001\u63A7 LLM \u6D88\u8017",distillEnabled:"\u84B8\u998F\u77E5\u8BC6\u5361(\u5F00=LLM \u538B\u7F29, \u5173=\u539F\u6587\u5361\u96F6 LLM)",dedupByLLM:"\u8BED\u4E49\u53BB\u91CD\u5582 LLM(\u5173=\u7EAF\u8BCD\u6CD5\u66F4\u7701)",captureMaxTokens:"\u84B8\u998F\u8F93\u51FA\u4E0A\u9650(token)",recallMinScore:"\u53EC\u56DE\u76F8\u5173\u6027\u9608\u503C(\u8D8A\u9AD8\u8D8A\u7701)",configNeedsDsh:"\u914D\u7F6E\u7F16\u8F91\u9700\u5728 DSH \u5185\u6253\u5F00\uFF08\u672C\u9875\u53EF\u80FD\u53EA\u8BFB\u6216\u6709\u90E8\u5206\u7F3A\u5931\uFF09",installMcp:"\u5B89\u88C5 MCP",uninstallMcp:"\u5378\u8F7D MCP",uninstallConfirm:"\u786E\u8BA4\u5378\u8F7D\u8BE5\u667A\u80FD\u4F53\u7684 MCP\uFF1FClaude Code/Codex \u5C06\u65E0\u6CD5\u518D\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002",presetConfig:"\u4E00\u952E\u63A8\u8350\u914D\u7F6E",presetHint:"\u70B9\u51FB\u586B\u5145\u5BF9\u5E94\u65B9\u6848\uFF0C\u70B9\u4FDD\u5B58\u751F\u6548",planA:"A \u8F7B\u91CF\u7701\u5FC3",planB:"B \u6781\u81F4\u7701\u94B1",planC:"C \u9AD8\u8D28\u91CF",pluginInfo:"\u63D2\u4EF6\u4FE1\u606F",organizeTitle:"\u6574\u7406\u5EFA\u8BAE",scanAndOrganize:"\u4E00\u952E\u641C\u7D22\u548C\u6574\u7406",scanHint:"\u70B9\u300C\u{1F50D} \u4E00\u952E\u641C\u7D22\u548C\u6574\u7406\u300D\u626B\u63CF\u76F8\u4F3C\u5361/\u9648\u65E7\u5361\uFF0C\u518D\u7528\u300C\u26A1 \u4E00\u952E\u4F18\u5316\u300D\u6267\u884C\u3002",mergeNow:"\u5408\u5E76",delete:"\u5220\u9664",captureAlert:"\u81EA\u52A8\u6C89\u6DC0\u5F02\u5E38",captureAlertHint:"\u6253\u5F00\u5DE6\u680F\u300C\u7528\u91CF/\u4ECA\u65E5\u300D\u770B\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7\uFF1B\u82E5\u662F\u63A5\u53E3/\u7248\u672C\u4E0D\u5339\u914D\uFF0C\u9700\u66F4\u65B0 memory-eternal \u63D2\u4EF6\u3002",captureLog:"\u81EA\u52A8\u6C89\u6DC0\u65E5\u5FD7",captureLogHint:"\u6BCF\u8F6E\u5BF9\u8BDD\u7ED3\u675F\u540E\u81EA\u52A8\u8DD1\uFF1A\u76D1\u542C \u2192 \u5224\u5B9A \u2192 \u5199\u5361\u3002\u8FD9\u91CC\u663E\u793A\u6700\u8FD1 100 \u6761\uFF0C\u7528\u6765\u6392\u67E5\u300C\u4E3A\u4EC0\u4E48\u6CA1\u5199\u5361\u300D\u3002",captureLogEmpty:"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002\u8DDF Agent \u804A\u4E00\u8F6E\uFF08> \u6355\u83B7\u6700\u5C0F\u957F\u5EA6\uFF09\u540E\u518D\u56DE\u6765\u770B\u3002",alignTitle:"\u7248\u672C\u5BF9\u9F50\u68C0\u67E5",alignRun:"\u5F00\u59CB\u68C0\u67E5",alignFix:"\u91CD\u5199\u63A5\u7EBF",alignFixConfirm:"\u91CD\u5199 MCP / hooks \u63A5\u7EBF\uFF1F\uFF08\u53EA\u78B0\u63D2\u4EF6\u81EA\u5DF1\u7684\u952E\uFF0C\u4E0D\u52A8\u4F60\u7684\u6570\u636E\u4E0E\u914D\u7F6E\uFF09",alignFixed:"\u63A5\u7EBF\u5DF2\u91CD\u5199\uFF1B\u82E5\u4E0A\u9762\u63D0\u793A\u300C\u5BBF\u4E3B\u8FDB\u7A0B\u65E7\u300D\uFF0C\u4ECD\u9700\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u5F00 DSH",alignFail:"\u5BF9\u9F50\u68C0\u67E5\u5931\u8D25",alignHint:"\u63D2\u4EF6\u5347\u7EA7\u53EA\u6362\u78C1\u76D8\u6587\u4EF6 \u2014\u2014 \u5BBF\u4E3B\u5185\u5B58\u91CC\u7684\u4E8B\u4EF6\u8BA2\u9605\u4E0E MCP / hooks \u91CC\u7684\u65E7\u8DEF\u5F84\u4E0D\u4F1A\u81EA\u5DF1\u66F4\u65B0\uFF0C\u8FD9\u91CC\u4E00\u6B21\u67E5\u6E05",alignIdle:"\u70B9\u300C\u5F00\u59CB\u68C0\u67E5\u300D\uFF1A\u5BF9\u6BD4\u5BBF\u4E3B / \u5E38\u9A7B\u5B9E\u4F8B / npm \u7684\u7248\u672C\uFF0C\u5E76\u68C0\u67E5 MCP\u3001hooks \u91CC\u662F\u5426\u6709\u65E7\u8DEF\u5F84\u4E0E\u65E7\u53C2\u6570",alignDisk:"\u78C1\u76D8",alignResident:"\u5E38\u9A7B\u5B9E\u4F8B",alignHost:"\u5BBF\u4E3B\u8FDB\u7A0B",captureLogUnavailable:"\u65E5\u5FD7\u4EC5\u5728 DSH \u5BBF\u4E3B\u5185\u53EF\u7528\uFF08\u72EC\u7ACB Web \u9875\u6CA1\u6709 host \u8FD0\u884C\u65F6\uFF09\u3002",captureAgentCards:"Agent \u81EA\u52A8\u6C89\u6DC0\u7684\u5361",noCards:"\u6682\u65E0",loadMore:"\u52A0\u8F7D\u66F4\u591A",batchMerge:"\u4E00\u952E\u667A\u80FD\u5408\u5E76",mergeAllConfirm:"\u5C06\u6309\u76F8\u4F3C\u5EA6\u5206\u7EC4\u7684\u5361\u7247\u5404\u5408\u5E76\u4E3A\u4E00\u5F20\uFF08\u4FDD\u7559\u5404\u81EA kind\uFF09\uFF0C\u539F\u5361\u5220\u9664\uFF1F",crossVault:"\u8DE8\u5E93\u805A\u5408",deleteConfirm:"\u786E\u5B9A\u5220\u9664\u8BE5\u8BB0\u5FC6\u5361\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002",deleted:"\u5DF2\u5220\u9664",deleteFail:"\u5220\u9664\u5931\u8D25",deleteSelected:"\u5220\u9664\u9009\u4E2D",deletedSelected:"\u5F20\u5361\u5DF2\u5220\u9664",merge:"\u5408\u5E76",mergeNeed:"\u81F3\u5C11\u9009 2 \u5F20\u5361",mergeConfirm:"\u5C06\u6240\u9009\u5361\u7247\u5408\u5E76\u4E3A\u4E00\u5F20\u5E76\u5220\u9664\u539F\u5361\uFF1F",merged:"\u5DF2\u5408\u5E76",mergeFail:"\u5408\u5E76\u5931\u8D25",mcpInstalled:"\u2705 {agent} MCP \u5DF2\u5B89\u88C5",mcpUninstalled:"\u2705 {agent} MCP \u5DF2\u5378\u8F7D",mcpActionFail:"\u274C {agent} MCP \u64CD\u4F5C\u5931\u8D25\uFF1A{error}",dshHostLabel:"DeepSeek Harness\uFF08\u5F53\u524D\u5BBF\u4E3B\uFF09",restartHint:"\u5DF2\u4FDD\u5B58\u3002autoWebMode/watchdogAutoSpawn \u7B49\u9700\u91CD\u542F DSH \u751F\u6548\uFF1B\u5DF2\u6709\u5E38\u9A7B watchdog \u4E0D\u4F1A\u88AB\u81EA\u52A8\u505C\u6389\uFF0C\u9700 dsh-memory stop / restart\uFF08#19\uFF09",conflictRefresh:"\u914D\u7F6E\u5DF2\u88AB\u5916\u90E8\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5",untitled:"\u65E0\u6807\u9898",tplBlank:"\u{1F4C4} \u7A7A\u767D",tagsHint:"\u6807\u7B7E\uFF08\u9017\u53F7\u5206\u9694\uFF09",connCount:"{n} \u8FDE\u63A5",tplDecisionTags:"\u51B3\u7B56, \u65B9\u6848",tplBugTags:"\u8E29\u5751, \u6559\u8BAD",tplMeetingTags:"\u4F1A\u8BAE, \u7EAA\u8981",tplWeeklyTags:"\u5468\u62A5",tplDecisionBody:`# \u6280\u672F\u51B3\u7B56\uFF1A[\u6807\u9898]
17
17
 
18
18
  ## \u80CC\u666F
19
19
  - \u95EE\u9898\u63CF\u8FF0
@@ -58,7 +58,7 @@ var na=Object.create;var St=Object.defineProperty;var oa=Object.getOwnPropertyDe
58
58
  -
59
59
 
60
60
  ## \u98CE\u9669/\u963B\u585E
61
- - `},Zt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedTotal:" / of ",importedTotalTail:"",importedQuarantine:" \xB7 pending review ",importedQuarantineTail:" (quarantined until approved)",importedSkipped:" \xB7 skipped ",importedSkippedTail:" (duplicate or empty)",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",refineTitle:"Conflict scan",refineScan:"Scan now",refineHint:"Similar cards can be merged; conflicts must be judged by a human \u2014 the scan is read-only, and data only moves after you choose (keeping one moves the other to the recycle bin, recoverable)",refineIdle:'Hit "Scan now": recall possibly-related card pairs, then let the model classify each as duplicate / complement / conflict / unrelated',refineNone:"No card pairs need your ruling this round \u{1F389}",refineFail:"Conflict scan failed",refineApplied:"Your ruling was recorded (it will not ask again)",refineRel_duplicate:"Duplicate (mergeable)",refineRel_complement:"Complement (keep both)",refineRel_conflict:"Conflict (needs your ruling)",refineRel_unrelated:"Unrelated",refineKeepA:"Keep A",refineKeepB:"Keep B",refineKeepBoth:"Keep both",refineMerge:"Merge",junkTitle:"Injected junk cards",junkScan:"Scan existing",junkHint:"Cards suspected to be captured runtime injections (skill catalogs / system-reminders) \u2014 the scan is read-only and recycling goes to the recycle bin (recoverable)",junkIdle:'Hit "Scan existing": find cards whose body is really injected runtime text with almost no human content left after stripping',junkNone:"No such cards found \u{1F389}",junkRecycle:"Recycle",junkRecycleAll:"Recycle all",junkRecycleAllConfirm:"Send these cards to the recycle bin? (Not a permanent delete \u2014 recoverable from the recycle center)",junkDone:"Sent to recycle bin",junkFail:"Scan / recycle failed",dbReadonlyTitle:"The memory database is currently not writable",dbReadonlyBody:"Card reads/writes, auditing and the graph will fail, but **settings can still be saved** (they do not go through the database)",dbReadonlyFix:"Diagnose with: dsh-memory doctor (journal mode, write probe, backups and recovery steps)",goalTitle:"Same goal, different approach",goalScan:"Scan goals",goalHint:'Clusters by "what problem does this card solve" \u2014 approaches that differ in wording (7z vs tar vs npm slimming) still land together',goalIdle:'Hit "Scan goals": the model first writes a one-line goal per card (first run calls the model, later runs use the cache), then clusters by goal',goalNone:'No clusters of "one goal, several cards" found \u{1F389}',goalStats:"indexed / calls this run",goalCards:"cards",goalKeep:"Keep all",goalMerge:"Merge this group",goalMerged:"Merge submitted (the new card goes to the audit queue)",goalDone:'Recorded as "keep all"',goalFail:"Goal clustering failed",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",auditBodyFail:"Failed to load the card body",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",pendingSyncNote:'This is the standalone web page: the DSH host applies a save (a current host is woken up and applies it in a request context, so saving takes effect immediately); when no DSH host is running here the change goes straight into the shared config. Only an older host falls back to "queued until it syncs on its own" \u2014 in that case change the same option under DSH Settings \u2192 Memory.',readonlyTitle:"This page is read-only; config cannot be saved here",readonlyBody:"This process has no DSH settings service (settings.update is unavailable). Edit the config in DSH: desktop app \u2192 Settings \u2192 Memory.",readonlyBtn:"Read-only",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",fbSelectAll:"Select all",toastApproved:"approved",toastRejected:"rejected",toastCardDeleted:"deleted",toastRestored:"restored",toastPurged:"permanently deleted",toastPurgedExpired:"expired recycle entries purged",toastFailed:"Action failed",noSelection:"Select the cards to act on first",enabledLabel:"Enable memory core",vaultDirLabel:"Vault directory (single)",captureCooldownMs:"Capture cooldown (ms)",captureProvider:"Distill provider (auto if empty)",captureModel:"Distill model (auto if empty)",recallEmbedding:"Semantic recall provider (optional)",sessionBudgetChars:"Session budget (chars)",saving:"Saving\u2026",savePending:"Saved to the config file; the host half is still the old build, so restart DSH to make it effective (already applied in this panel)",saveInvalid:"Some field values are invalid; nothing was submitted",invalidField:'"{field}" must be a number between {min} and {max} (now: {value})',actionRunning:"Working\u2026",recycleEmptyHint:"Recycle bin is empty: deleted cards land here first and are purged automatically after {days} days.",recyclePurgeAll:"Empty recycle bin",fbCopyManual:"Auto-copy was blocked by the browser \u2014 the text is below: click Select all, then Ctrl+C",vcLoaded:"running (process serving this page)",vcResident:"resident instance",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:'v{disk} is installed on disk but the process serving this page still has v{loaded} loaded \u2014 click "Restart resident instance" to restart it on the new code (no DSH restart needed)',vcRestart:"Restart resident instance",vcRestarting:"Restarting\u2026",vcRestartSent:"Resident restart scheduled: the new process takes over in ~3-8s \u2014 refresh the page (Ctrl+F5) shortly",vcRestartCurrent:"The resident instance is already up to date \u2014 no restart needed",vcRestartFail:"Restart request failed",vcRestartNoRoute:"The process serving this page is still the old build (no such endpoint): restart the desktop app / DSH and retry, or run {cmd}",vcHostStale:'The "running" chip above comes from the process serving this page; the resident instance is already current \u2014 restart the desktop app / DSH to refresh that chip',vcResidentDownShort:"not running",vcResidentDown:"The resident instance is not running (no response on port {port}) \u2014 use the button below to bring it up on the new code; if that fails run {cmd} and share the output of dsh-memory status",vcResidentUnmanagedShort:"unmanaged",vcResidentUnmanaged:"The resident instance serves v{served} but has **no watchdog keeping it alive** (an orphan left by a stop or a hard kill) \u2014 use the button below to put it back under management (a fresh watchdog plus a new instance), or run {cmd}",vcResidentLockUnknownShort:"management unknown",vcResidentReplaceBlockedShort:"cannot replace",vcResidentReplaceBlocked:'The resident instance **cannot be replaced** (environment limit): the watchdog lock directory is not writable ({err}; {path}) \u2192 the port will stay on v{served} **long-term**. This is not "temporarily behind": automatic replacement is refused on purpose to avoid leaving an orphan. Way out: fix that directory permissions and run {cmd}, or run dsh-memory watchdog --port 7999 in the foreground',vcResidentLockUnknown:'The resident instance serves v{served}, but the **watchdog lock file cannot be written** (restricted environment: sandbox, ACLs, non-system drive) \u2192 whether it is managed cannot be determined (this is not "unmanaged"). Cause: {err} ({path}). Keep-alive usually still works; the button below can put it back under management on the new code.',vcPage:"Page script",vcPageStale:"\u26A0 This page is still running an older script (page v{page} / disk v{disk}): press Ctrl+F5 to refresh. If the running version is still old, restart the desktop app / DSH as well",vcOutdated:"update available",vcUpToDate:"up to date",vcCheck:"Check for updates",checking:"Checking\u2026",vcCheckFail:"Update check failed",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",secretHint:"Credential hint (injected into every session)",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoRestartOnDrift:"Auto-restart resident on version drift",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",savedDirect:"No DSH host is running here, so the change went straight into the shared config (hooks / MCP / the standalone page pick it up immediately)",savedApplied:"Saved and applied (the host applied it in a request context)",saveQueued:"Handed to the DSH host for sync \u2014 not confirmed applied yet",saveHostGuard:"This host does not let a plugin write config from its own callback context; change the same option under DSH Settings \u2192 Memory, or edit the profile patch layer",saveFailHint:"the host did not apply it \u2014 see Diagnostics under Report a bug",recallTool:"recall tool",costControl:"Cost control",costHint:"save tokens, control LLM usage",distillEnabled:"Distill cards (on=LLM compress, off=raw cards zero LLM)",dedupByLLM:"Dedup feeds LLM (off=pure lexical, cheaper)",captureMaxTokens:"Distill output cap (tokens)",recallMinScore:"Recall min score (higher = cheaper)",configNeedsDsh:"Edit config inside DSH (this page may be read-only or partially missing)",installMcp:"Install MCP",uninstallMcp:"Uninstall MCP",uninstallConfirm:"Confirm uninstall MCP for this agent? Claude Code/Codex will lose access to the memory vault.",presetConfig:"One-click preset config",presetHint:"Click to fill a plan, then hit Save",planA:"A Light",planB:"B Budget",planC:"C Premium",pluginInfo:"Plugin info",organizeTitle:"Organize",scanAndOrganize:"Scan & organize",scanHint:'Click "\u{1F50D} Scan & organize" to find similar/stale cards, then "\u26A1 One-click optimize" to run.',mergeNow:"Merge",delete:"Delete",captureAlert:"Auto-capture failed",captureAlertHint:'Open "Usage / Today" for the capture log; if the cause is an API/version mismatch, update the memory-eternal plugin.',captureLog:"Auto-capture log",captureLogHint:"Runs after every turn: listen \u2192 judge \u2192 write. Last 100 entries, so you can see why a card was not written.",captureLogEmpty:"No entries yet. Chat one turn (> min capture chars) and come back.",alignTitle:"Version alignment check",alignRun:"Check now",alignFix:"Rewrite wiring",alignFixConfirm:"Rewrite the MCP / hooks wiring? (Only the plugin's own keys are touched; your data and config stay as they are)",alignFixed:"Wiring rewritten; if it still reports an old host process, you must fully quit and reopen DSH",alignFail:"Alignment check failed",alignHint:"Upgrading the plugin only replaces files on disk \u2014 the host's in-memory event subscriptions and stale paths inside MCP / hooks do not update themselves; this checks all of it at once",alignIdle:'Hit "Check now": compare the host / resident / npm versions and look for stale paths and arguments in MCP and hooks',alignDisk:"disk",alignResident:"resident",alignHost:"host process",captureLogUnavailable:"Log is available only inside the DSH host (the standalone web page has no host runtime).",captureAgentCards:"Cards auto-captured by the agent",noCards:"none",loadMore:"Load more",batchMerge:"Smart batch merge",mergeAllConfirm:"Merge similar-grouped cards into one each (keep kind), delete originals?",crossVault:"All vaults",deleteConfirm:"Delete this memory card? This cannot be undone.",deleted:"Deleted",deleteFail:"Delete failed",deleteSelected:"Delete selected",deletedSelected:" cards deleted",merge:"Merge",mergeNeed:"Select at least 2 cards",mergeConfirm:"Merge the selected cards into one and delete the originals?",merged:"Merged",mergeFail:"Merge failed",mcpInstalled:"\u2705 {agent} MCP installed",mcpUninstalled:"\u2705 {agent} MCP uninstalled",mcpActionFail:"\u274C {agent} MCP action failed: {error}",dshHostLabel:"DeepSeek Harness (current host)",restartHint:"Saved. autoWebMode/watchdogAutoSpawn take effect after restarting DSH; a resident watchdog is never stopped automatically \u2014 use dsh-memory stop / restart (#19)",conflictRefresh:"Config changed elsewhere \u2014 refresh and retry",untitled:"Untitled",tplBlank:"\u{1F4C4} Blank",tagsHint:"Tags (comma-separated)",connCount:"{n} connections",tplDecisionTags:"decision, plan",tplBugTags:"pitfall, lesson",tplMeetingTags:"meeting, minutes",tplWeeklyTags:"weekly report",tplDecisionBody:`# Tech decision: [title]
61
+ - `},Zt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedTotal:" / of ",importedTotalTail:"",importedQuarantine:" \xB7 pending review ",importedQuarantineTail:" (quarantined until approved)",importedSkipped:" \xB7 skipped ",importedSkippedTail:" (duplicate or empty)",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",refineTitle:"Conflict scan",refineScan:"Scan now",refineHint:"Similar cards can be merged; conflicts must be judged by a human \u2014 the scan is read-only, and data only moves after you choose (keeping one moves the other to the recycle bin, recoverable)",refineIdle:'Hit "Scan now": recall possibly-related card pairs, then let the model classify each as duplicate / complement / conflict / unrelated',refineNone:"No card pairs need your ruling this round \u{1F389}",refineFail:"Conflict scan failed",refineApplied:"Your ruling was recorded (it will not ask again)",refineRel_duplicate:"Duplicate (mergeable)",refineRel_complement:"Complement (keep both)",refineRel_conflict:"Conflict (needs your ruling)",refineRel_unrelated:"Unrelated",refineKeepA:"Keep A",refineKeepB:"Keep B",refineKeepBoth:"Keep both",refineMerge:"Merge",junkTitle:"Injected junk cards",junkScan:"Scan existing",junkHint:"Cards suspected to be captured runtime injections (skill catalogs / system-reminders) \u2014 the scan is read-only and recycling goes to the recycle bin (recoverable)",junkIdle:'Hit "Scan existing": find cards whose body is really injected runtime text with almost no human content left after stripping',junkNone:"No such cards found \u{1F389}",junkRecycle:"Recycle",junkRecycleAll:"Recycle all",junkRecycleAllConfirm:"Send these cards to the recycle bin? (Not a permanent delete \u2014 recoverable from the recycle center)",junkDone:"Sent to recycle bin",junkFail:"Scan / recycle failed",dbReadonlyTitle:"The memory database is currently not writable",dbReadonlyBody:"Card reads/writes, auditing and the graph will fail, but **settings can still be saved** (they do not go through the database)",dbReadonlyFix:"Diagnose with: dsh-memory doctor (journal mode, write probe, backups and recovery steps)",goalTitle:"Same goal, different approach",goalScan:"Scan goals",goalHint:'Clusters by "what problem does this card solve" \u2014 approaches that differ in wording (7z vs tar vs npm slimming) still land together',goalIdle:'Hit "Scan goals": the model first writes a one-line goal per card (first run calls the model, later runs use the cache), then clusters by goal',goalNone:'No clusters of "one goal, several cards" found \u{1F389}',goalStats:"indexed / calls this run",goalCards:"cards",goalKeep:"Keep all",goalMerge:"Merge this group",goalMerged:"Merge submitted (the new card goes to the audit queue)",goalDone:'Recorded as "keep all"',goalFail:"Goal clustering failed",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",auditBodyFail:"Failed to load the card body",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",pendingSyncNote:'This is the standalone web page: the DSH host applies a save (a current host is woken up and applies it in a request context, so saving takes effect immediately); when no DSH host is running here the change goes straight into the shared config. Only an older host falls back to "queued until it syncs on its own" \u2014 in that case change the same option under DSH Settings \u2192 Memory.',readonlyTitle:"This page is read-only; config cannot be saved here",readonlyBody:"This process has no DSH settings service (settings.update is unavailable). Edit the config in DSH: desktop app \u2192 Settings \u2192 Memory.",readonlyBtn:"Read-only",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",fbSelectAll:"Select all",toastApproved:"approved",toastRejected:"rejected",toastCardDeleted:"deleted",toastRestored:"restored",toastPurged:"permanently deleted",toastPurgedExpired:"expired recycle entries purged",toastFailed:"Action failed",noSelection:"Select the cards to act on first",enabledLabel:"Enable memory core",vaultDirLabel:"Vault directory (single)",captureCooldownMs:"Capture cooldown (ms)",captureProvider:"Distill provider (auto if empty)",routeAuto:"Auto (registration order)",captureFollowSession:"Follow current session (distill with the session provider/model)",captureFirstOnly:"First candidate only (stop on failure, no fallback)",llmTest:"Test distill route",llmTestOk:"\u2713 Call succeeded",llmTestFail:"\u2717 Call failed",llmCandidates:"candidates",captureModel:"Distill model (auto if empty)",recallEmbedding:"Semantic recall provider (optional)",sessionBudgetChars:"Session budget (chars)",saving:"Saving\u2026",savePending:"Saved to the config file; the host half is still the old build, so restart DSH to make it effective (already applied in this panel)",saveInvalid:"Some field values are invalid; nothing was submitted",invalidField:'"{field}" must be a number between {min} and {max} (now: {value})',actionRunning:"Working\u2026",recycleEmptyHint:"Recycle bin is empty: deleted cards land here first and are purged automatically after {days} days.",recyclePurgeAll:"Empty recycle bin",fbCopyManual:"Auto-copy was blocked by the browser \u2014 the text is below: click Select all, then Ctrl+C",vcLoaded:"running (process serving this page)",vcResident:"resident instance",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:'v{disk} is installed on disk but the process serving this page still has v{loaded} loaded \u2014 click "Restart resident instance" to restart it on the new code (no DSH restart needed)',vcRestart:"Restart resident instance",vcRestarting:"Restarting\u2026",vcRestartSent:"Resident restart scheduled: the new process takes over in ~3-8s \u2014 refresh the page (Ctrl+F5) shortly",vcRestartCurrent:"The resident instance is already up to date \u2014 no restart needed",vcRestartFail:"Restart request failed",vcRestartNoRoute:"The process serving this page is still the old build (no such endpoint): restart the desktop app / DSH and retry, or run {cmd}",vcHostStale:'The "running" chip above comes from the process serving this page; the resident instance is already current \u2014 restart the desktop app / DSH to refresh that chip',vcResidentDownShort:"not running",vcResidentDown:"The resident instance is not running (no response on port {port}) \u2014 use the button below to bring it up on the new code; if that fails run {cmd} and share the output of dsh-memory status",vcResidentUnmanagedShort:"unmanaged",vcResidentUnmanaged:"The resident instance serves v{served} but has **no watchdog keeping it alive** (an orphan left by a stop or a hard kill) \u2014 use the button below to put it back under management (a fresh watchdog plus a new instance), or run {cmd}",vcResidentLockUnknownShort:"management unknown",vcResidentReplaceBlockedShort:"cannot replace",vcResidentHostManagedShort:"host-managed",vcResidentReplaceBlocked:'The resident instance **cannot be replaced** (environment limit): the watchdog lock directory is not writable ({err}; {path}) \u2192 the port will stay on v{served} **long-term**. This is not "temporarily behind": automatic replacement is refused on purpose to avoid leaving an orphan. Way out: fix that directory permissions and run {cmd}, or run dsh-memory watchdog --port 7999 in the foreground',vcResidentLockUnknown:'The resident instance serves v{served}, but the **watchdog lock file cannot be written** (restricted environment: sandbox, ACLs, non-system drive) \u2192 whether it is managed cannot be determined (this is not "unmanaged"). Cause: {err} ({path}). Keep-alive usually still works; the button below can put it back under management on the new code.',vcPage:"Page script",vcPageStale:"\u26A0 This page is still running an older script (page v{page} / disk v{disk}): press Ctrl+F5 to refresh. If the running version is still old, restart the desktop app / DSH as well",vcOutdated:"update available",vcUpToDate:"up to date",vcCheck:"Check for updates",checking:"Checking\u2026",vcCheckFail:"Update check failed",recallSummaryLen:"Recall summary len",recallBody:"Recall with body",secretHint:"Credential hint (injected into every session)",autoWeb:"Web server",autoWebMode:"Keep-alive mode",webPort:"Web port",webCheckIntervalMs:"Probe interval (ms)",webMaxRestart:"Max restart",watchdogAutoSpawn:"Watchdog process",autoRestartOnDrift:"Auto-restart resident on version drift",autoMcpSetup:"Auto-mount MCP",saveConfig:"Save config",saveFail:"Save failed",savedOk:"Saved",savedDirect:"No DSH host is running here, so the change went straight into the shared config (hooks / MCP / the standalone page pick it up immediately)",savedApplied:"Saved and applied (the host applied it in a request context)",saveQueued:"Handed to the DSH host for sync \u2014 not confirmed applied yet",saveHostGuard:"This host does not let a plugin write config from its own callback context; change the same option under DSH Settings \u2192 Memory, or edit the profile patch layer",saveFailHint:"the host did not apply it \u2014 see Diagnostics under Report a bug",recallTool:"recall tool",costControl:"Cost control",costHint:"save tokens, control LLM usage",distillEnabled:"Distill cards (on=LLM compress, off=raw cards zero LLM)",dedupByLLM:"Dedup feeds LLM (off=pure lexical, cheaper)",captureMaxTokens:"Distill output cap (tokens)",recallMinScore:"Recall min score (higher = cheaper)",configNeedsDsh:"Edit config inside DSH (this page may be read-only or partially missing)",installMcp:"Install MCP",uninstallMcp:"Uninstall MCP",uninstallConfirm:"Confirm uninstall MCP for this agent? Claude Code/Codex will lose access to the memory vault.",presetConfig:"One-click preset config",presetHint:"Click to fill a plan, then hit Save",planA:"A Light",planB:"B Budget",planC:"C Premium",pluginInfo:"Plugin info",organizeTitle:"Organize",scanAndOrganize:"Scan & organize",scanHint:'Click "\u{1F50D} Scan & organize" to find similar/stale cards, then "\u26A1 One-click optimize" to run.',mergeNow:"Merge",delete:"Delete",captureAlert:"Auto-capture failed",captureAlertHint:'Open "Usage / Today" for the capture log; if the cause is an API/version mismatch, update the memory-eternal plugin.',captureLog:"Auto-capture log",captureLogHint:"Runs after every turn: listen \u2192 judge \u2192 write. Last 100 entries, so you can see why a card was not written.",captureLogEmpty:"No entries yet. Chat one turn (> min capture chars) and come back.",alignTitle:"Version alignment check",alignRun:"Check now",alignFix:"Rewrite wiring",alignFixConfirm:"Rewrite the MCP / hooks wiring? (Only the plugin's own keys are touched; your data and config stay as they are)",alignFixed:"Wiring rewritten; if it still reports an old host process, you must fully quit and reopen DSH",alignFail:"Alignment check failed",alignHint:"Upgrading the plugin only replaces files on disk \u2014 the host's in-memory event subscriptions and stale paths inside MCP / hooks do not update themselves; this checks all of it at once",alignIdle:'Hit "Check now": compare the host / resident / npm versions and look for stale paths and arguments in MCP and hooks',alignDisk:"disk",alignResident:"resident",alignHost:"host process",captureLogUnavailable:"Log is available only inside the DSH host (the standalone web page has no host runtime).",captureAgentCards:"Cards auto-captured by the agent",noCards:"none",loadMore:"Load more",batchMerge:"Smart batch merge",mergeAllConfirm:"Merge similar-grouped cards into one each (keep kind), delete originals?",crossVault:"All vaults",deleteConfirm:"Delete this memory card? This cannot be undone.",deleted:"Deleted",deleteFail:"Delete failed",deleteSelected:"Delete selected",deletedSelected:" cards deleted",merge:"Merge",mergeNeed:"Select at least 2 cards",mergeConfirm:"Merge the selected cards into one and delete the originals?",merged:"Merged",mergeFail:"Merge failed",mcpInstalled:"\u2705 {agent} MCP installed",mcpUninstalled:"\u2705 {agent} MCP uninstalled",mcpActionFail:"\u274C {agent} MCP action failed: {error}",dshHostLabel:"DeepSeek Harness (current host)",restartHint:"Saved. autoWebMode/watchdogAutoSpawn take effect after restarting DSH; a resident watchdog is never stopped automatically \u2014 use dsh-memory stop / restart (#19)",conflictRefresh:"Config changed elsewhere \u2014 refresh and retry",untitled:"Untitled",tplBlank:"\u{1F4C4} Blank",tagsHint:"Tags (comma-separated)",connCount:"{n} connections",tplDecisionTags:"decision, plan",tplBugTags:"pitfall, lesson",tplMeetingTags:"meeting, minutes",tplWeeklyTags:"weekly report",tplDecisionBody:`# Tech decision: [title]
62
62
 
63
63
  ## Background
64
64
  - Problem
@@ -103,7 +103,7 @@ Option A, because:
103
103
  -
104
104
 
105
105
  ## Risks/blockers
106
- - `},Bt=["all","project","knowledge","content","prompt","business","tool","mistake"],qe={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},Vt=t=>Array.isArray(t&&t.tags)?t.tags:[],ht={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},Ke={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},yt="deepseek-harness",ut=t=>{let o=String(t||""),r=o.toLowerCase();return!o||o==="agent"||o==="unknown"||o.startsWith("session:")||r.startsWith("claude-code")?r.startsWith("claude-code")?"claude":yt:r==="deepseek harness"?yt:o.split(":")[0]||yt},wa=[yt,"claude","codex","cursor","codex-desktop"],Qt=(t=[])=>[...new Set([...wa,...(t||[]).map(ut)])],Sa={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],warn:["\u26A0\uFE0F","#f59e0b"],fail:["\u274C","#ef4444"]},Ee=`
106
+ - `},At=["all","project","knowledge","content","prompt","business","tool","mistake"],qe={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},Vt=t=>Array.isArray(t&&t.tags)?t.tags:[],ht={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},Ke={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},bt="deepseek-harness",ut=t=>{let i=String(t||""),r=i.toLowerCase();return!i||i==="agent"||i==="unknown"||i.startsWith("session:")||r.startsWith("claude-code")?r.startsWith("claude-code")?"claude":bt:r==="deepseek harness"?bt:i.split(":")[0]||bt},wa=[bt,"claude","codex","cursor","codex-desktop"],Qt=(t=[])=>[...new Set([...wa,...(t||[]).map(ut)])],Sa={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],warn:["\u26A0\uFE0F","#f59e0b"],fail:["\u274C","#ef4444"]},Ee=`
107
107
  .memory-eternal-root { font-family: inherit; color: var(--dsw-alias-label-primary, #1f2937); }
108
108
  .mc-card { background: var(--dsw-alias-bg-layer-1, #fff); border: 1px solid var(--dsw-alias-border-l1, #e5e7eb); border-radius: 12px; padding: 14px 16px; }
109
109
  .mc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
@@ -298,13 +298,13 @@ Option A, because:
298
298
  height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
299
299
  max-height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
300
300
  }
301
- `;function Ca(t){t.effect(()=>t.locale.register(st,{zh:Jt,en:Zt}),"memory-eternal: locale");let o=t.locale.bind(st);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:st,order:25,label:()=>o("nav"),locale:st,inject:()=>({})},()=>n.default.createElement(Ma,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${st}:footer`,order:100,label:()=>o("nav"),locale:st,inject:()=>({})},r=>n.default.createElement(Ra,{t:o,locale:t.locale,wide:!(r&&r.wide===!1)}))),"memory-eternal: sidebar footer action")}function Na(){let[t,o]=(0,n.useState)(W+"/ui/app");return(0,n.useEffect)(()=>{let r=!0,f=()=>fetch("/memory-eternal/api/web-info").then(p=>p.json()).then(p=>{r&&p&&p.ok&&p.alive!==!1&&p.url&&o(p.url.endsWith("/")?p.url:p.url+"/")}).catch(()=>{});return fetch(W+"/ui/app",{method:"HEAD"}).then(p=>{if(r&&!p.ok)return f()}).catch(()=>r?f():void 0),()=>{r=!1}},[]),t}function Ma({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsx)(aa,{t,onReload:()=>{},version:0})]})}function Ra({t,locale:o,wide:r}){let[f,p]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${r?"":" rail"}`,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>p(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)(ea,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),f&&(0,e.jsx)(Ta,{t,locale:o,onClose:()=>p(!1)})]})}function Ta({t,locale:o,onClose:r,tab:f}){let[p,i]=(0,n.useState)(!1),w=(0,n.useRef)(null),D=Na(),k=(0,n.useCallback)(T=>o&&typeof o.subscribe=="function"?o.subscribe(T):()=>{},[o]),E=(0,n.useCallback)(()=>o&&typeof o.getSnapshot=="function"?o.getSnapshot():null,[o]),C=(0,n.useSyncExternalStore)(k,E),h=C&&(C.active==="zh"||C.active==="en")?C.active:null,g=(0,n.useRef)(null);g.current===null&&h&&(g.current=h);let z=(0,n.useMemo)(()=>{let T=g.current?`lang=${g.current}`:"";if(f==="config")return`${W}/ui/config?tab=config${T?`&${T}`:""}`;let v=D.replace(/\/$/,""),j=v.endsWith("/ui/app")?"?":"/?";return f?`${v}${j}tab=${f}${T?`&${T}`:""}`:T?`${v}${j}${T}`:D},[D,f]);return(0,n.useEffect)(()=>{let T=w.current&&w.current.contentWindow;T&&h&&T.postMessage({source:"memory-eternal",type:"locale",lang:h},"*")},[h]),(0,n.useEffect)(()=>{let T=v=>{v.key==="Escape"&&r()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:r,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsx)("div",{className:"me-modal"+(p?" me-modal-full":""),onClick:T=>T.stopPropagation(),children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,position:"relative"},children:[(0,e.jsxs)("div",{style:{position:"absolute",top:8,right:8,zIndex:10,display:"flex",gap:4,padding:"4px 6px",background:"var(--dsw-alias-bg-overlay, rgba(17,24,39,0.45))",borderRadius:8,backdropFilter:"blur(4px)"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>i(T=>!T),"aria-label":t(p?"exitFullscreen":"enterFullscreen"),title:t(p?"exitFullscreen":"enterFullscreen"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:14,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:p?"\u2921":"\u2922"}),(0,e.jsx)("button",{type:"button",onClick:r,"aria-label":t("close"),title:t("close"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,e.jsx)("iframe",{ref:w,src:z,title:"memory-eternal",allow:"clipboard-write; clipboard-read",style:{width:"100%",flex:1,border:0,borderRadius:"inherit",background:"var(--dsw-alias-bg-base, #fff)"}})]})})]})}function ea(){return(0,e.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,e.jsx)("defs",{children:(0,e.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,e.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,e.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 0-6.4.1 4.1 4.1 0 0 0-2.7 5.9 4.1 4.1 0 0 0 .6 6.7A4.2 4.2 0 0 0 12 18.2Z"}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 1 6.4.1 4.1 4.1 0 0 1 2.7 5.9 4.1 4.1 0 0 1-.6 6.7A4.2 4.2 0 0 1 12 18.2Z"}),(0,e.jsx)("path",{d:"M12 9.2c-.8-1.4-1.7-2-3.1-2.2M12 9.2c.8-1.4 1.7-2 3.1-2.2M12 12.4c-1.2 1-3.2 1.6-5 1.4M12 12.4c1.2 1 3.2 1.6 5 1.4M12 13.2v4",fill:"none",stroke:"rgba(255,255,255,0.62)",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}var bt="0.10.32";function Da({t,inModal:o,onClose:r,onFull:f,full:p}){let[i,w]=(0,n.useState)(null),[D,k]=(0,n.useState)([]),[E,C]=(0,n.useState)(!0),[h,g]=(0,n.useState)(null),[z,T]=(0,n.useState)(""),[v,j]=(0,n.useState)("all"),[L,K]=(0,n.useState)(""),[ee,V]=(0,n.useState)("all"),[P,Ie]=(0,n.useState)("all"),[Y,be]=(0,n.useState)(()=>{try{let d=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),S={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(d&&S[d])return S[d]}catch{}return"cards"}),[J,U]=(0,n.useState)(()=>new Set([Y])),ie=(0,n.useCallback)(d=>{U(S=>S.has(d)?S:new Set(S).add(d)),be(d)},[]),[ve,x]=(0,n.useState)("recent"),[we,Z]=(0,n.useState)(null),ce=(0,n.useRef)(null),je=(0,n.useRef)(null),[y,$]=(0,n.useState)(!1),[le,X]=(0,n.useState)(null),[re,ye]=(0,n.useState)(!1),[Be,Me]=(0,n.useState)(!1),[Se,Te]=(0,n.useState)(!0),[l,N]=(0,n.useState)(null),[R,G]=(0,n.useState)(0),ge=(0,n.useCallback)(()=>G(d=>d+1),[]),Ce=i?.quarantine?.pending??0,de=i?.quarantine?.deleted??0,Q=(0,n.useRef)(null),[Oe,Le]=(0,n.useState)(0),[u,s]=(0,n.useState)(!1),_=(0,n.useRef)(null),pe=(0,n.useRef)(null),se=(0,n.useCallback)(async(d=v,S=L,O=P,F={})=>{let B=F.append===!0;try{B?s(!0):(C(!0),T(""));let te=new URLSearchParams;d&&d!=="all"&&te.set("kind",d),S.trim()&&te.set("q",S.trim()),te.set("status",O||"all"),te.set("limit",String(xa)),te.set("offset",String(F.offset||0)),ve==="title"&&te.set("sort","title");let De=await(await fetch(`${W}/cards?${te.toString()}`)).json();if(De.ok){let Ve=De.cards||[];k(We=>B?[...We,...Ve.filter(Ye=>!We.some(vt=>vt.path===Ye.path))]:Ve),Le(Number(De.total)||Ve.length)}}catch(te){T(String(te&&te.message?te.message:te))}finally{B?s(!1):C(!1)}},[v,L,P,ve]),ue=(0,n.useCallback)(async()=>{try{let[d,S]=await Promise.all([fetch(`${W}/overview`).then(O=>O.json()),fetch(`${W}/capture-log`).then(O=>O.json()).catch(()=>null)]);d.ok&&w(d),g(S&&S.ok&&S.available&&S.health||null)}catch(d){T(String(d&&d.message?d.message:d))}finally{C(!1)}},[]),a=async d=>{try{let O=await(await fetch(`${W}/delete?path=${encodeURIComponent(d)}`)).json();O.ok?(Z({ok:!0,msg:t("deleted")}),await ue(),ge()):Z({ok:!1,msg:O.error||t("deleteFail")})}catch{Z({ok:!1,msg:t("deleteFail")})}ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2e3)};(0,n.useEffect)(()=>(ue(),()=>{Q.current&&clearTimeout(Q.current)}),[ue]);let tt=d=>{K(d),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>se(v,d,P),280)},at=d=>{j(d),se(d,L,P)};(0,n.useEffect)(()=>{Y==="cards"&&se(v,L,P)},[P,Y,R,ve]),(0,n.useEffect)(()=>{if(Y!=="cards"||E||u||D.length>=Oe)return;let d=_.current,S=pe.current;if(!d)return;let O=new IntersectionObserver(F=>{F[0]&&F[0].isIntersecting&&se(v,L,P,{append:!0,offset:D.length})},{root:S||null,rootMargin:"400px"});return O.observe(d),()=>O.disconnect()},[Y,D,Oe,E,u,v,L,P,se]);let xe=async d=>{try{let S=d.status;if(!S&&d.path)try{let Ne=((await fetch(`${W}/cards?status=all&q=${encodeURIComponent(d.title||"")}&limit=50`).then(De=>De.json())).cards||[]).find(De=>De.path===d.path);Ne&&(S=Ne.status)}catch{}let O=S&&S!=="approved"?`&status=${encodeURIComponent(S)}`:"",F=await fetch(`${W}/card?path=${encodeURIComponent(d.path||d.id)}${O}`),B=await F.json();B.ok?X({path:B.path,title:d.title,text:B.text}):T(B.error||`HTTP ${F.status}`)}catch(S){T(String(S&&S.message?S.message:S))}},nt=async(d,S)=>{$(!0);try{let O=await fetch(`${W}/export`);if(!O.ok)throw new Error("HTTP "+O.status);let F=await O.json();if(!F.ok)throw new Error(F.error||"export failed");let B,te,Ne;if(d==="json"){te="memory-vault.json",Ne="application/json";let We=F.cards.map(Ye=>({path:Ye.path,title:Ye.title,kind:Ye.kind,status:Ye.status,store:Ye.store,text:Ye.text}));B=JSON.stringify({format:F.format||"memory-eternal-vault",formatVersion:F.formatVersion||1,exportedAt:F.exportedAt||new Date().toISOString(),count:We.length,cards:We},null,2)}else te="memory-vault.md",Ne="text/markdown;charset=utf-8",B=F.cards.map(We=>We.text.trim()).filter(Boolean).join(`
301
+ `;function Ca(t){t.effect(()=>t.locale.register(st,{zh:Jt,en:Zt}),"memory-eternal: locale");let i=t.locale.bind(st);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:st,order:25,label:()=>i("nav"),locale:st,inject:()=>({})},()=>o.default.createElement(Ma,{t:i}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${st}:footer`,order:100,label:()=>i("nav"),locale:st,inject:()=>({})},r=>o.default.createElement(Ra,{t:i,locale:t.locale,wide:!(r&&r.wide===!1)}))),"memory-eternal: sidebar footer action")}function Na(){let[t,i]=(0,o.useState)(O+"/ui/app");return(0,o.useEffect)(()=>{let r=!0,g=()=>fetch("/memory-eternal/api/web-info").then(c=>c.json()).then(c=>{r&&c&&c.ok&&c.alive!==!1&&c.url&&i(c.url.endsWith("/")?c.url:c.url+"/")}).catch(()=>{});return fetch(O+"/ui/app",{method:"HEAD"}).then(c=>{if(r&&!c.ok)return g()}).catch(()=>r?g():void 0),()=>{r=!1}},[]),t}function Ma({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsx)(aa,{t,onReload:()=>{},version:0})]})}function Ra({t,locale:i,wide:r}){let[g,c]=(0,o.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${r?"":" rail"}`,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>c(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)(ea,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),g&&(0,e.jsx)(Ta,{t,locale:i,onClose:()=>c(!1)})]})}function Ta({t,locale:i,onClose:r,tab:g}){let[c,l]=(0,o.useState)(!1),C=(0,o.useRef)(null),T=Na(),S=(0,o.useCallback)(R=>i&&typeof i.subscribe=="function"?i.subscribe(R):()=>{},[i]),H=(0,o.useCallback)(()=>i&&typeof i.getSnapshot=="function"?i.getSnapshot():null,[i]),k=(0,o.useSyncExternalStore)(S,H),x=k&&(k.active==="zh"||k.active==="en")?k.active:null,m=(0,o.useRef)(null);m.current===null&&x&&(m.current=x);let z=(0,o.useMemo)(()=>{let R=m.current?`lang=${m.current}`:"";if(g==="config")return`${O}/ui/config?tab=config${R?`&${R}`:""}`;let w=T.replace(/\/$/,""),j=w.endsWith("/ui/app")?"?":"/?";return g?`${w}${j}tab=${g}${R?`&${R}`:""}`:R?`${w}${j}${R}`:T},[T,g]);return(0,o.useEffect)(()=>{let R=C.current&&C.current.contentWindow;R&&x&&R.postMessage({source:"memory-eternal",type:"locale",lang:x},"*")},[x]),(0,o.useEffect)(()=>{let R=w=>{w.key==="Escape"&&r()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[r]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:r,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsx)("div",{className:"me-modal"+(c?" me-modal-full":""),onClick:R=>R.stopPropagation(),children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,position:"relative"},children:[(0,e.jsxs)("div",{style:{position:"absolute",top:8,right:8,zIndex:10,display:"flex",gap:4,padding:"4px 6px",background:"var(--dsw-alias-bg-overlay, rgba(17,24,39,0.45))",borderRadius:8,backdropFilter:"blur(4px)"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>l(R=>!R),"aria-label":t(c?"exitFullscreen":"enterFullscreen"),title:t(c?"exitFullscreen":"enterFullscreen"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:14,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:c?"\u2921":"\u2922"}),(0,e.jsx)("button",{type:"button",onClick:r,"aria-label":t("close"),title:t("close"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,e.jsx)("iframe",{ref:C,src:z,title:"memory-eternal",allow:"clipboard-write; clipboard-read",style:{width:"100%",flex:1,border:0,borderRadius:"inherit",background:"var(--dsw-alias-bg-base, #fff)"}})]})})]})}function ea(){return(0,e.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,e.jsx)("defs",{children:(0,e.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,e.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,e.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 0-6.4.1 4.1 4.1 0 0 0-2.7 5.9 4.1 4.1 0 0 0 .6 6.7A4.2 4.2 0 0 0 12 18.2Z"}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 1 6.4.1 4.1 4.1 0 0 1 2.7 5.9 4.1 4.1 0 0 1-.6 6.7A4.2 4.2 0 0 1 12 18.2Z"}),(0,e.jsx)("path",{d:"M12 9.2c-.8-1.4-1.7-2-3.1-2.2M12 9.2c.8-1.4 1.7-2 3.1-2.2M12 12.4c-1.2 1-3.2 1.6-5 1.4M12 12.4c1.2 1 3.2 1.6 5 1.4M12 13.2v4",fill:"none",stroke:"rgba(255,255,255,0.62)",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}var yt="0.10.34";function Da({t,inModal:i,onClose:r,onFull:g,full:c}){let[l,C]=(0,o.useState)(null),[T,S]=(0,o.useState)([]),[H,k]=(0,o.useState)(!0),[x,m]=(0,o.useState)(null),[z,R]=(0,o.useState)(""),[w,j]=(0,o.useState)("all"),[L,K]=(0,o.useState)(""),[te,V]=(0,o.useState)("all"),[F,Ie]=(0,o.useState)("all"),[G,ge]=(0,o.useState)(()=>{try{let b=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),n={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(b&&n[b])return n[b]}catch{}return"cards"}),[X,$]=(0,o.useState)(()=>new Set([G])),le=(0,o.useCallback)(b=>{$(n=>n.has(b)?n:new Set(n).add(b)),ge(b)},[]),[he,Ae]=(0,o.useState)("recent"),[ke,y]=(0,o.useState)(null),ue=(0,o.useRef)(null),Te=(0,o.useRef)(null),[h,U]=(0,o.useState)(!1),[re,ye]=(0,o.useState)(null),[ee,Z]=(0,o.useState)(!1),[Be,Ce]=(0,o.useState)(!1),[Re,Ne]=(0,o.useState)(!0),[s,N]=(0,o.useState)(null),[I,Q]=(0,o.useState)(0),we=(0,o.useCallback)(()=>Q(b=>b+1),[]),de=l?.quarantine?.pending??0,ae=l?.quarantine?.deleted??0,Y=(0,o.useRef)(null),[We,Le]=(0,o.useState)(0),[p,d]=(0,o.useState)(!1),_=(0,o.useRef)(null),se=(0,o.useRef)(null),ce=(0,o.useCallback)(async(b=w,n=L,v=F,D={})=>{let B=D.append===!0;try{B?d(!0):(k(!0),R(""));let E=new URLSearchParams;b&&b!=="all"&&E.set("kind",b),n.trim()&&E.set("q",n.trim()),E.set("status",v||"all"),E.set("limit",String(xa)),E.set("offset",String(D.offset||0)),he==="title"&&E.set("sort","title");let J=await(await fetch(`${O}/cards?${E.toString()}`)).json();if(J.ok){let ve=J.cards||[];S(De=>B?[...De,...ve.filter(Pe=>!De.some(vt=>vt.path===Pe.path))]:ve),Le(Number(J.total)||ve.length)}}catch(E){R(String(E&&E.message?E.message:E))}finally{B?d(!1):k(!1)}},[w,L,F,he]),fe=(0,o.useCallback)(async()=>{try{let[b,n]=await Promise.all([fetch(`${O}/overview`).then(v=>v.json()),fetch(`${O}/capture-log`).then(v=>v.json()).catch(()=>null)]);b.ok&&C(b),m(n&&n.ok&&n.available&&n.health||null)}catch(b){R(String(b&&b.message?b.message:b))}finally{k(!1)}},[]),a=async b=>{try{let v=await(await fetch(`${O}/delete?path=${encodeURIComponent(b)}`)).json();v.ok?(y({ok:!0,msg:t("deleted")}),await fe(),we()):y({ok:!1,msg:v.error||t("deleteFail")})}catch{y({ok:!1,msg:t("deleteFail")})}ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>y(null),2e3)};(0,o.useEffect)(()=>(fe(),()=>{Y.current&&clearTimeout(Y.current)}),[fe]);let Fe=b=>{K(b),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>ce(w,b,F),280)},Je=b=>{j(b),ce(b,L,F)};(0,o.useEffect)(()=>{G==="cards"&&ce(w,L,F)},[F,G,I,he]),(0,o.useEffect)(()=>{if(G!=="cards"||H||p||T.length>=We)return;let b=_.current,n=se.current;if(!b)return;let v=new IntersectionObserver(D=>{D[0]&&D[0].isIntersecting&&ce(w,L,F,{append:!0,offset:T.length})},{root:n||null,rootMargin:"400px"});return v.observe(b),()=>v.disconnect()},[G,T,We,H,p,w,L,F,ce]);let et=async b=>{try{let n=b.status;if(!n&&b.path)try{let W=((await fetch(`${O}/cards?status=all&q=${encodeURIComponent(b.title||"")}&limit=50`).then(J=>J.json())).cards||[]).find(J=>J.path===b.path);W&&(n=W.status)}catch{}let v=n&&n!=="approved"?`&status=${encodeURIComponent(n)}`:"",D=await fetch(`${O}/card?path=${encodeURIComponent(b.path||b.id)}${v}`),B=await D.json();B.ok?ye({path:B.path,title:b.title,text:B.text}):R(B.error||`HTTP ${D.status}`)}catch(n){R(String(n&&n.message?n.message:n))}},at=async(b,n)=>{U(!0);try{let v=await fetch(`${O}/export`);if(!v.ok)throw new Error("HTTP "+v.status);let D=await v.json();if(!D.ok)throw new Error(D.error||"export failed");let B,E,W;if(b==="json"){E="memory-vault.json",W="application/json";let De=D.cards.map(Pe=>({path:Pe.path,title:Pe.title,kind:Pe.kind,status:Pe.status,store:Pe.store,text:Pe.text}));B=JSON.stringify({format:D.format||"memory-eternal-vault",formatVersion:D.formatVersion||1,exportedAt:D.exportedAt||new Date().toISOString(),count:De.length,cards:De},null,2)}else E="memory-vault.md",W="text/markdown;charset=utf-8",B=D.cards.map(De=>De.text.trim()).filter(Boolean).join(`
302
302
 
303
303
  ---
304
304
 
305
- `);let De=new Blob([B],{type:Ne}),Ve=await $a(De,te,!1);if(!Ve.ok){Z({ok:!1,msg:t("exportFail")}),$(!1);return}Z({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+Ve.name})}catch(O){Z({ok:!1,msg:t("exportFail")+" \xB7 "+(O.message||"")})}finally{$(!1)}ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2600)},Ae=async d=>{let S=d.target.files&&d.target.files[0];if(d.target.value="",!!S){try{let O=await S.text(),B=await(await fetch(`${W}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:O})).json();if(B.ok){await ue();let te=B.imported||0,Ne=t("importedVault")+"\uFF1A"+te;B.total&&(Ne+=t("importedTotal")+B.total+t("importedTotalTail")),B.quarantined&&(Ne+=t("importedQuarantine")+B.quarantined+t("importedQuarantineTail")),B.skipped&&(Ne+=t("importedSkipped")+B.skipped+t("importedSkippedTail")),B.warning&&(Ne+=" \xB7 "+B.warning),Z({ok:te>0||!B.total,msg:Ne})}else Z({ok:!1,msg:B.error||t("importFail")})}catch{Z({ok:!1,msg:t("importFail")})}ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2400)}},c=(0,n.useMemo)(()=>{let d=D.slice();return ee!=="all"&&(d=d.filter(S=>ut(S.submittedBy)===ee)),P!=="all"&&(d=d.filter(S=>(S.status||"approved")===P)),ve==="title"?d.sort((S,O)=>String(S.title||"").localeCompare(String(O.title||""))):ve==="hot"?d.sort((S,O)=>(O.weight||O.links||0)-(S.weight||S.links||0)):d.sort((S,O)=>new Date(O.updated||0).getTime()-new Date(S.updated||0).getTime()),d},[D,ve,ee,P]),A=(0,n.useMemo)(()=>[...new Set(D.map(d=>ut(d.submittedBy)))],[D]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Ee}),we&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(we.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:we.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:we.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:we.msg})]}),o&&(0,e.jsxs)("div",{className:"me-modal-head",children:[(0,e.jsxs)("div",{className:"me-modal-title",children:[(0,e.jsx)("span",{className:"me-wicon",children:(0,e.jsx)(ea,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),f&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:f,"aria-label":t(p?"exitFull":"fullscreen"),children:p?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":t("close"),children:"\u2715"})]}),h&&h.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[h.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:h.since?pt(new Date(h.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${Se?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Te(d=>!d),"aria-label":t(Se?"collapse":"expand"),title:t(Se?"collapse":"expand"),children:Se?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="cards"?" active":""}`,onClick:()=>ie("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="graph"?" active":""}`,onClick:()=>ie("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="stats"?" active":""}`,onClick:()=>ie("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="audit"?" active":""}`,onClick:()=>ie("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),Ce>0&&(0,e.jsx)("span",{className:"mc-dot",children:Ce>99?"99+":Ce})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="optimize"?" active":""}`,onClick:()=>ie("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),de>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:de>99?"99+":de})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${Y==="config"?" active":""}`,onClick:()=>ie("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Me(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),Se&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:pe,children:[i&&i.db&&i.db.writable===!1?(0,e.jsxs)("div",{style:{margin:"8px 10px 0",padding:"8px 12px",borderRadius:8,fontSize:12,lineHeight:1.7,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.35)",color:"#b91c1c"},children:["\u26A0\uFE0F ",t("dbReadonlyTitle"),"\uFF1A",i.db.error||"\u2014"," \u2014\u2014 ",t("dbReadonlyBody"),(0,e.jsx)("div",{style:{opacity:.85,marginTop:2},children:t("dbReadonlyFix")})]}):null,Y==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(dt,{label:t("total"),value:i?i.total:"\u2014"}),(0,e.jsx)(dt,{label:t("recent"),value:i?i.recent:"\u2014"}),(0,e.jsx)(dt,{label:t("tags"),value:i?i.tags:"\u2014"}),(0,e.jsx)(dt,{label:t("pending"),value:i?.quarantine?.pending??i?.status?.pending??0}),(0,e.jsx)(dt,{label:t("rejected"),value:i?.quarantine?.rejected??i?.status?.rejected??0}),(0,e.jsx)(dt,{label:t("cardCount"),value:i?i.byKind?.knowledge??0:"\u2014"})]}),Y==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:L,onChange:d=>tt(d.target.value)}),(0,e.jsx)("input",{ref:je,type:"file",accept:".json,application/json",style:{display:"none"},onChange:Ae}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>je.current&&je.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>N({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:y,onClick:()=>nt("md"),children:t(y?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:y,onClick:()=>nt("json"),children:t(y?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ue(),children:t("refresh")})]}),Y==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Bt.map(d=>(0,e.jsx)("button",{type:"button",className:`mc-chip${v===d?" active":""}`,onClick:()=>at(d),children:t(d==="all"?"all":Ke[d])},d)),(0,e.jsxs)("select",{value:ee,onChange:d=>V(d.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Qt(A).map(d=>(0,e.jsx)("option",{value:d,children:d},d))]}),(0,e.jsxs)("select",{value:P,onChange:d=>Ie(d.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(d=>(0,e.jsx)("button",{type:"button",className:`mc-chip${ve===d.key?" active":""}`,onClick:()=>x(d.key),children:d.label},d.key))]}),z&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z]}),(0,e.jsx)("div",{style:{display:Y==="cards"?"contents":"none"},children:E?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):z?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ue(),children:t("retry")})]}):D.length===0?(0,e.jsx)("div",{className:"mc-empty",children:t("empty")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mc-grid",children:c.map(d=>(0,e.jsx)(Ba,{card:d,t,query:L.trim(),onOpen:xe,onDelete:a},d.path))}),D.length<Oe&&(0,e.jsx)("div",{ref:_,style:{height:1}}),u&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",D.length," / ",Oe,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:Y==="graph"?"flex":"none",flex:1,minHeight:0},children:J.has("graph")&&(0,e.jsx)(Fa,{t,onOpen:xe,all:re,onAllChange:ye,onMutate:ge,active:Y==="graph",visible:Y==="graph"})}),(0,e.jsx)("div",{style:{display:Y==="config"?"contents":"none"},children:J.has("config")&&(0,e.jsx)(aa,{t,onReload:()=>ue(),version:R})}),(0,e.jsx)("div",{style:{display:Y==="stats"?"contents":"none"},children:J.has("stats")&&(0,e.jsx)(La,{t,tab:"stats",onReload:()=>ue(),version:R})}),(0,e.jsx)("div",{style:{display:Y==="audit"?"contents":"none"},children:J.has("audit")&&(0,e.jsx)(za,{t,onReload:()=>ue(),version:R})}),(0,e.jsx)("div",{style:{display:Y==="optimize"?"contents":"none"},children:J.has("optimize")&&(0,e.jsx)(Ia,{t,onReload:()=>ue(),version:R})}),Be&&(0,e.jsx)(ja,{t,onClose:()=>Me(!1)}),le&&(0,e.jsx)(Pa,{t,card:le,query:L.trim(),onClose:()=>X(null),onDelete:d=>{X(null),a(d)},onFeedback:d=>{let S=le.path;fetch(`${W}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:L.trim(),path:S,useful:d})}).then(()=>Z({ok:!0,msg:t(d?"fbUseful":"fbIrr")})).catch(()=>{}),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2e3)}}),(0,e.jsx)(Aa,{t,newCard:l,setNewCard:N,onCreated:()=>{ue(),ge(),Z({ok:!0,msg:t("created")}),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>Z(null),2e3)}})]})]})]})}var ta=({toast:t})=>t?(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(t.ok?"#10b981":"#ef4444"),background:t.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[t.ok?"\u2705":"\u26A0"," ",t.msg]}):null,dt=({label:t,value:o})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:o}),(0,e.jsx)("span",{children:t})]});function aa({t,onReload:o,version:r,compact:f}){let[p,i]=(0,n.useState)(null),[w,D]=(0,n.useState)(0),[k,E]=(0,n.useState)(null),[C,h]=(0,n.useState)(null),[g,z]=(0,n.useState)(!1),[T,v]=(0,n.useState)(!1),j=(0,n.useRef)(!1),L=(0,n.useRef)(null),K=(0,n.useRef)({}),[ee,V]=(0,n.useState)(null),[P,Ie]=(0,n.useState)(null),[Y,be]=(0,n.useState)(""),[J,U]=(0,n.useState)(""),[ie,ve]=(0,n.useState)(""),[x,we]=(0,n.useState)(null),Z=(0,n.useCallback)(async c=>{U("version");try{let A=await fetch(W+"/version-check"+(c?"?force=1":"")).then(d=>d.json());A&&A.ok?(we(A),c&&X(A.updateAvailable?t("vcLatest")+" v"+A.latest:t("vcUpToDate"))):c&&X(t("vcCheckFail"),!1)}catch{c&&X(t("vcCheckFail"),!1)}finally{U("")}},[t]);(0,n.useEffect)(()=>{Z(!1)},[r,Z]);let[ce,je]=(0,n.useState)(""),[y,$]=(0,n.useState)(null),le=(0,n.useRef)(null),X=(c,A=!0)=>{le.current&&clearTimeout(le.current),$({msg:c,ok:A}),le.current=setTimeout(()=>$(null),1900)},re=async()=>{if(!J){U("restart");try{let c=await fetch(W+"/restart-self",{method:"POST"});if(c.status===404||c.status===405){X(R("vcRestartNoRoute",{cmd:x&&x.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let A=await c.json().catch(()=>null);if(!A){X(t("vcRestartFail")+"\uFF08HTTP "+c.status+"\uFF09",!1);return}if(!A.ok){X(A.error||t("vcRestartFail"),!1);return}if(A.alreadyCurrent){X(A.note||t("vcRestartCurrent"));return}X(A.note||t("vcRestartSent")),A.alreadyRunning||setTimeout(()=>{Z(!0)},6e3)}catch(c){X(t("vcRestartFail")+"\uFF1A"+String(c&&c.message||c),!1)}finally{U("")}}},ye=x&&x.resident?String(x.resident.served||""):"",Be=!!(x&&x.onDisk&&ye&&ye!==x.onDisk),Me=!!(x&&x.resident&&x.resident.managed===!1&&x.resident.managedKnown===!1),Se=x&&x.resident&&x.resident.replaceBlocked&&x.resident.replaceBlocked.fresh||null,Te=!!(x&&x.resident&&x.resident.managed===!1&&!Me),l=!!(x&&x.resident&&!ye),N=Be||l||Te||Me,R=(c,A)=>Object.keys(A).reduce((d,S)=>d.split("{"+S+"}").join(A[S]),t(c)),G=(0,n.useCallback)(async()=>{try{let[c,A,d]=await Promise.all([fetch(`${W}/config`).then(S=>S.json()).catch(()=>null),fetch(`${W}/setup-status`).then(S=>S.json()).catch(()=>null),fetch(`${W}/budget`).then(S=>S.json()).catch(()=>null)]);if(c&&c.ok){i(c),D(c.revision??0),E(c.schema??null);let S=qt(c.config??{},K.current);K.current=S.overlay,h({...S.values}),V(c.dsh??null),z(c.writable===!1),v(c.viaPending===!0),be(""),j.current=!1}else d&&d.ok?(h({...d}),z(!0),be(t("configNeedsDsh"))):be(t("adminLoadFail"));A&&A.ok&&Ie(A),ve("")}catch{be(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{G()},[r,G]);let ge=(c,A)=>{j.current=!0,h(d=>({...d??{},[c]:A}))};(0,n.useEffect)(()=>{L.current=G},[G]),(0,n.useEffect)(()=>{if(typeof EventSource>"u")return;let c=null;try{c=new EventSource(W+"/events")}catch{return}let A=()=>{!j.current&&typeof L.current=="function"&&L.current()};try{c.addEventListener("config",A)}catch{}return()=>{try{c.close()}catch{}}},[]);let Ce=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),de=c=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[c]||c,Q=async()=>{if(!C)return;if(g){X(t("editInSetting"),!1);return}let c={dedupThreshold:[0,1],captureMinChars:[0,1e6],captureCooldownMs:[0,1e9],maxCardsPerDay:[0,1e6],captureMaxTokens:[100,4e3],recallMinScore:[0,50],recallLimit:[1,20],recallSummaryLen:[40,400],recycleRetentionDays:[1,3650],webPort:[1,65535],webCheckIntervalMs:[1e3,6e5],webMaxRestart:[1,1e3],sessionBudgetChars:[0,1e9]},A=[];for(let[d,[S,O]]of Object.entries(c)){if(!(d in C))continue;let F=C[d],B=typeof F=="number"?F:Number(F);(F===""||F===null||F===void 0||!Number.isFinite(B)||B<S||B>O)&&A.push(t("invalidField",{field:d,min:S,max:O,value:String(F===""?"\u7A7A":F)}))}if(A.length){let d=t("saveInvalid")+"\uFF1A"+A.join("\uFF1B");be(d),X(d,!1);return}U("save");try{let d={...C};for(let B of Object.keys(C))B in d&&typeof d[B]=="string"&&d[B].trim()!==""&&Ce.has(B)&&(d[B]=Number(d[B]));Array.isArray(d.vaultProfiles)&&(d.vaultProfiles=d.vaultProfiles.filter(B=>B&&(String(B.name||"").trim()||String(B.path||"").trim())));let S=await fetch(`${W}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:d,expectedRevision:w})}),O=await S.text(),F=null;try{F=O?JSON.parse(O):null}catch{F=null}if(F||(F={error:"HTTP "+S.status+(O?"\uFF1A"+O.slice(0,200):"\uFF08\u5BBF\u4E3B\u672A\u8FD4\u56DE\u539F\u56E0\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6709\u6570\u5B57\u5B57\u6BB5\u4E3A\u7A7A\u6216\u8D85\u51FA\u8303\u56F4\uFF09")}),F&&F.ok){let B=typeof F.pendingOutcome=="string"?F.pendingOutcome:"",te,Ne=!0;if(B==="applied")te=t("savedApplied")+(Array.isArray(F.applied)&&F.applied.length?" \xB7 "+F.applied.join("\u3001"):"");else if(B==="queued")Ne=!1,te=t("saveQueued");else if(B==="failed")Ne=!1,te=t("saveFail")+" \xB7 "+(F.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if(B==="applied-direct")te=t("savedOk")+" \xB7 "+t("savedDirect");else{let De=Array.isArray(F.pending)&&F.pending.length?" \xB7 "+t("savePending"):F.note?" \xB7 "+t("restartHint"):"";te=(F.retried?"\u267B ":"")+t("savedOk")+De}K.current={...K.current,...d},Ne?ve(te):be(te),X(te,Ne),await G()}else{let B=S.status===409?t("conflictRefresh"):F?.error||t("saveFail");be(B),X(B,!1)}}catch{be(t("saveFail")),X(t("saveFail"),!1)}finally{U("")}},Oe=()=>{K.current={},h({...p?.config??{}}),ve("")},Le={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},u=c=>Array.isArray(c?.vaultProfiles)?c.vaultProfiles:[],s=(c,A,d)=>h(S=>{let O=u(S).map(B=>({...B||{}})),F={...O[c]||{}};return A==="match"?String(d).trim()?F.match={...F.match||{},workspace:d}:delete F.match:F[A]=d,O[c]=F,{...S??{},vaultProfiles:O}}),_=()=>h(c=>({...c??{},vaultProfiles:[...u(c),{name:"",path:""}]})),pe=c=>h(A=>({...A??{},vaultProfiles:u(A).filter((d,S)=>S!==c)})),se={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},ue={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},a={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:4e3,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:t("planB"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!1,dedupByLLM:!1,captureMaxTokens:500,recallMinScore:3,recallLimit:3,recallSummaryLen:80,recallIncludeBody:!1,captureMinChars:300,maxCardsPerDay:40,captureCooldownMs:3e5},C:{label:t("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},tt=async c=>{let A=a[c];A&&h(d=>({...d??{},...A}))},at=async(c,A)=>{U(c+A);try{let S=await(await fetch(`${W}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:c,action:A})})).json();S&&S.ok?X(R(A==="install"?"mcpInstalled":"mcpUninstalled",{agent:c})):X(R("mcpActionFail",{agent:c,error:S?.error||""}),!1);try{let O=await fetch(`${W}/setup-status`).then(F=>F.json());O&&O.ok&&Ie(O)}catch{}}catch{X(t("mergeFail"),!1)}finally{U("")}},xe=({k:c,label:A,type:d="text",step:S,min:O,max:F})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:A||c}),(0,e.jsx)("input",{type:d,step:S,min:O,max:F,value:C?C[c]??"":"",onChange:B=>{let te=B.target.value;ge(c,d==="number"?te===""?"":Number(te):te)},style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12}})]}),nt=new Set(["autoRestartOnDrift"]),Ae=({k:c,label:A})=>{let d=C?C[c]:void 0,S=d===void 0?nt.has(c):!!d;return(0,e.jsxs)("label",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:12,minWidth:0,lineHeight:1.5},children:[(0,e.jsx)("input",{type:"checkbox",checked:S,onChange:O=>ge(c,O.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:A||c})]})};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:f?"0 0 auto":1,minHeight:0,maxHeight:f?"52vh":void 0},children:[(0,e.jsx)("style",{children:Ee}),y&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(y.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:y.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:y.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:y.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[Y&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",Y]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:G,children:["\u21BB ",t("retry")]})]}),T&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #3b82f6",background:"rgba(59,130,246,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#1d4ed8",lineHeight:1.7},children:["\u2139 ",t("pendingSyncNote")]}),g&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),ie&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #10b981",background:"rgba(16,185,129,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#059669"},children:["\u2713 ",ie]}),p&&(p.version||p.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),p.version&&(0,e.jsxs)("code",{style:se,children:[t("vcLoaded")," v",p.version]}),x&&x.resident&&x.resident.served&&x.resident.served!==p.version&&(0,e.jsxs)("code",{style:se,children:[t("vcResident")," v",x.resident.served]}),x&&x.resident&&!x.resident.served&&(0,e.jsxs)("code",{style:{...se,color:"#b45309",fontWeight:600},children:[t("vcResident")," ",t("vcResidentDownShort")]}),x&&x.resident&&x.resident.served&&x.resident.managed===!1&&(0,e.jsxs)("code",{style:{...se,color:"#b45309",fontWeight:600},children:[t("vcResident")," v",x.resident.served," \xB7 ",t(Se?"vcResidentReplaceBlockedShort":Me?"vcResidentLockUnknownShort":"vcResidentUnmanagedShort")]}),bt&&(0,e.jsxs)("code",{style:se,children:[t("vcPage")," v",bt]}),x&&x.onDisk&&(0,e.jsxs)("code",{style:se,children:[t("vcOnDisk")," v",x.onDisk]}),x&&x.latest&&(0,e.jsxs)("code",{style:se,children:[t("vcLatest")," v",x.latest]}),p.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",p.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:J==="version",onClick:()=>Z(!0),children:J==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),x&&(x.stale||l||Te||Me||Se)&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px"},children:[(0,e.jsxs)("div",{children:["\u26A0\uFE0F ",x.stale?R("vcStale",{disk:x.onDisk,loaded:x.loaded}):l?R("vcResidentDown",{port:x.resident&&x.resident.port||"",cmd:x.restartCommand||"dsh-memory restart --port 7999"}):Se?R("vcResidentReplaceBlocked",{served:ye,err:Se.error||"",path:Se.lockPath||"",cmd:x.restartCommand||"dsh-memory restart --port "+(x.resident&&x.resident.port||7999)}):Me?R("vcResidentLockUnknown",{served:ye,path:x.resident&&x.resident.lock&&x.resident.lock.path||"",err:x.resident&&x.resident.lock&&x.resident.lock.error||""}):R("vcResidentUnmanaged",{served:ye,cmd:x.restartCommand||"dsh-memory restart --port 7999"})]}),N?(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!J,onClick:re,children:J==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),x.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:x.restartCommand})]}):(0,e.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",t("vcHostStale"),x.restartCommand&&(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:x.restartCommand})]})]})]}),bt&&x&&x.onDisk&&bt!==x.onDisk&&(0,e.jsx)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px",lineHeight:1.7},children:t("vcPageStale",{page:bt,disk:x.onDisk})}),x&&x.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:x.updateCommand})]}),x&&x.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",x.checkError]})]}),P&&P.agents&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",t("mcpSetupStatus")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("mcpManageHint")})]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:P.agents.map(c=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1},children:[(0,e.jsx)("b",{children:c.isDsh?t("dshHostLabel"):c.name}),c.isDsh&&c.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",c.version]}),!c.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),c.installed&&c.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),c.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),c.mcpConfigured===!0&&c.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),c.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",c.recallTool?t("enabled"):t("disabled"),")"]})]}),c.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",c.hook]}),!c.isDsh&&c.installed&&c.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!J,onClick:()=>at(c.name,"install"),children:t("installMcp")}),!c.isDsh&&c.installed&&c.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!J,onClick:()=>{window.confirm(t("uninstallConfirm"))&&at(c.name,"uninstall")},children:t("uninstallMcp")})]},c.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),ce&&(0,e.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,e.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:ce})})]}),C?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(c=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>tt(c),disabled:!!J,children:[c==="A"?"\u{1F7E2} ":c==="B"?"\u{1F4B0} ":"\u2B50 ",a[c].label]},c))})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",t("dshMemoryConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,e.jsx)(Ae,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(Ae,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(xe,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(xe,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(xe,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(xe,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(xe,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(Ae,{k:"recallIncludeBody",label:t("recallBody")}),(0,e.jsx)(xe,{k:"secretHint",label:t("secretHint")}),(0,e.jsx)(xe,{k:"recallEmbedding",label:t("recallEmbedding")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",t("vaultMulti")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("vaultMultiHint")})]}),(0,e.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[t("vaultNow"),"\uFF1A",(0,e.jsx)("code",{children:ee?.vaultDir||"\u2014"}),ee?.vaultName?`\uFF08${ee.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(Le[ee?.vaultSource]||"vaultSrcDefault"),ee?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:ee.workspace})]}):null]}),u(C).map((c,A)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:c.name||"",placeholder:t("vaultNamePh"),onChange:d=>s(A,"name",d.target.value),style:ue,disabled:g}),(0,e.jsx)("input",{value:c.path||"",placeholder:t("vaultPathPh"),onChange:d=>s(A,"path",d.target.value),style:ue,disabled:g}),(0,e.jsx)("input",{value:c.match&&c.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:d=>s(A,"match",d.target.value),style:ue,disabled:g}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>pe(A),disabled:g,title:t("delete"),children:"\u2715"})]},A)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:_,disabled:g,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:C.activeVault||"",onChange:c=>ge("activeVault",c.target.value),disabled:g,style:ue,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),u(C).filter(c=>c&&c.name).map(c=>(0,e.jsx)("option",{value:c.name,children:c.name},c.name))]})]})]})]}),(0,e.jsx)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsx)(Ae,{k:"enabled",label:t("enabledLabel")}),(0,e.jsx)(xe,{k:"vaultDir",label:t("vaultDirLabel")})]})}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",t("costControl")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("costHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8,marginTop:6},children:[(0,e.jsx)(Ae,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(Ae,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(xe,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(xe,{k:"recallMinScore",label:t("recallMinScore"),type:"number"}),(0,e.jsx)(xe,{k:"captureCooldownMs",label:t("captureCooldownMs"),type:"number"}),(0,e.jsx)(xe,{k:"captureProvider",label:t("captureProvider")}),(0,e.jsx)(xe,{k:"captureModel",label:t("captureModel")}),(0,e.jsx)(xe,{k:"sessionBudgetChars",label:t("sessionBudgetChars"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t("auditMode")}),(0,e.jsxs)("select",{value:C.auditMode??"all",onChange:c=>ge("auditMode",c.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"all",children:t("auditAll")}),(0,e.jsx)("option",{value:"none",children:t("auditNone")})]})]}),(0,e.jsx)(Gt,{label:t("auditExemptAgents"),value:C.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(P?.agents||[]).filter(c=>!c.isDsh).map(c=>({value:c.name,label:c.name}))],onChange:c=>ge("auditExemptAgents",c)}),(0,e.jsx)(Gt,{label:t("auditExemptKinds"),value:C.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Bt.filter(c=>c!=="all").map(c=>({value:c,label:t(Ke[c])}))],onChange:c=>ge("auditExemptKinds",c)}),(0,e.jsx)(xe,{k:"recycleRetentionDays",label:t("recycleDays"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",t("serviceConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,e.jsx)(Ae,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:C.autoWebMode??"init",onChange:c=>ge("autoWebMode",c.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"init",children:t("modeInit")}),(0,e.jsx)("option",{value:"interval",children:t("modeInterval")}),(0,e.jsx)("option",{value:"manual",children:t("modeManual")})]})]}),(0,e.jsx)(xe,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(xe,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(xe,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(Ae,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(Ae,{k:"autoRestartOnDrift",label:t("autoRestartOnDrift")}),(0,e.jsx)(Ae,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[J==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),ie&&J!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",ie]}),Y&&J!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",Y]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:Oe,disabled:!!J,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:g?()=>X(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):Q,disabled:J==="save",title:t(g?"readonlyBody":"saveConfig"),children:J==="save"?"\u23F3 "+t("saving"):g?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function za({t,onReload:o,version:r}){let[f,p]=(0,n.useState)([]),[i,w]=(0,n.useState)([]),[D,k]=(0,n.useState)("all"),[E,C]=(0,n.useState)("all"),[h,g]=(0,n.useState)(""),[z,T]=(0,n.useState)(new Set),[v,j]=(0,n.useState)(""),[L,K]=(0,n.useState)(null),[ee,V]=(0,n.useState)("pending"),P=(y,$=!0)=>{K({msg:y,ok:$}),setTimeout(()=>K(null),3e3)},Ie=[...new Set([...f,...i].map(y=>y.submittedBy).filter(Boolean))],Y=(0,n.useCallback)(async()=>{try{let y=await fetch(`${W}/audit/list`).then($=>$.json());y.ok&&(p(y.pending||[]),w(y.rejected||[]),T(new Set),ve(new Set),we({}))}catch{}},[]);(0,n.useEffect)(()=>{Y()},[r,Y]);let be=(ee==="pending"?f:i).filter(y=>{if(D!=="all"&&y.kind!==D||E!=="all"&&ut(y.submittedBy)!==E)return!1;if(h){let $=(y.created||"").slice(0,10);if($&&$!==h)return!1}return!0}),J=y=>T($=>{let le=new Set($);return le.has(y)?le.delete(y):le.add(y),le}),U=async(y,$)=>{let le=$||[...z];if(!le.length){P(t("noSelection"),!1);return}j("apply");let X=t(y==="approved"?"toastApproved":y==="rejected"?"toastRejected":"toastCardDeleted");try{let re=0;for(let ye of le){let Be=y==="approved"?"audit/approve":y==="rejected"?"audit/reject":"delete";try{(await fetch(W+"/"+Be+"?path="+encodeURIComponent(ye)+(y==="delete"?"&permanent=0":""))).ok||re++}catch{re++}}await Y(),o&&o(),re?P(t("toastFailed")+"\uFF08"+re+"/"+le.length+"\uFF09",!1):P(X+" "+le.length+" \u5F20")}catch(re){P(t("toastFailed")+": "+String(re&&re.message||re),!1)}finally{j("")}},[ie,ve]=(0,n.useState)(new Set),[x,we]=(0,n.useState)({}),Z=y=>x[y]||{},ce=async y=>{let $=y.path,le=!ie.has($);if(ve(X=>{let re=new Set(X);return le?re.add($):re.delete($),re}),!(!le||x[$])){we(X=>({...X,[$]:{loading:!0}}));try{let X=y.status||(ee==="pending"?"pending":"rejected"),re=await fetch(`${W}/card?path=${encodeURIComponent($)}&status=${X}`).then(ye=>ye.json());re&&re.ok?we(ye=>({...ye,[$]:{text:re.text||""}})):we(ye=>({...ye,[$]:{error:re&&re.error||"HTTP"}}))}catch(X){we(re=>({...re,[$]:{error:String(X&&X.message||X)}}))}}},je=[...z];return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ta,{toast:L}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:D,onChange:y=>k(y.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),Bt.filter(y=>y!=="all").map(y=>(0,e.jsx)("option",{value:y,children:t(Ke[y])},y))]}),(0,e.jsxs)("select",{value:E,onChange:y=>C(y.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Qt(Ie).map(y=>(0,e.jsx)("option",{value:y,children:y},y))]}),(0,e.jsx)("input",{type:"date",value:h,onChange:y=>g(y.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("button",{type:"button",className:`mc-btn${ee==="pending"?" me-on":""}`,onClick:()=>V("pending"),children:[t("pending"),"\uFF08",f.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${ee==="rejected"?" me-on":""}`,onClick:()=>V("rejected"),children:[t("rejected"),"\uFF08",i.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:be.length>0&&je.length===be.length,onChange:y=>{y.target.checked?T(new Set(be.map($=>$.path))):T(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!je.length||!!v,onClick:()=>U("approved"),children:["\u2713 ",t(ee==="rejected"?"restore":"approve")]}),ee==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!je.length||!!v,onClick:()=>U("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!je.length||!!v,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&U("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),be.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:be.map(y=>{let $=Z(y.path),le=ie.has(y.path);return(0,e.jsxs)("div",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:z.has(y.path),onChange:()=>J(y.path)}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"0 6px"},title:t(le?"collapse":"expand"),"aria-expanded":le,onClick:()=>ce(y),children:le?"\u25BE":"\u25B8"}),(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[y.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},title:t(le?"collapse":"expand"),onClick:()=>ce(y),children:y.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ut(y.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:y.created?y.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:y.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:y.severity==="high"?"#f87171":"#9ca3af"},children:y.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.reason||"-"}),ee==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>U("approved",[y.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>U("rejected",[y.path]),children:"\u2715"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:t("restore"),onClick:()=>U("approved",[y.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:t("restoreDelete"),onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&U("delete",[y.path])},children:"\u{1F5D1}"})]})]}),le&&(0,e.jsxs)("div",{style:{padding:"2px 10px 12px 34px"},children:[$.loading&&(0,e.jsxs)("div",{style:{fontSize:12,opacity:.6},children:["\u23F3 ",t("loading")]}),$.error&&(0,e.jsxs)("div",{style:{fontSize:12,color:"#f87171"},children:["\u26A0 ",t("auditBodyFail"),"\uFF1A",$.error]}),$.text!=null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"md-meta",style:{marginBottom:6},children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:qe[y.kind]||"#6B7280",borderColor:(qe[y.kind]||"#6B7280")+"59",background:(qe[y.kind]||"#6B7280")+"1a"},children:[ht[y.kind]||"\u{1F4CE}"," ",t(Ke[y.kind]||"kindKnowledge")]}),(Array.isArray(y.tags)?y.tags:[]).slice(0,8).map(X=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",X]},X)),!!y.reason&&(0,e.jsxs)("span",{className:"md-chip md-chip-st-warn",children:["\u2691 ",y.reason]})]}),(0,e.jsx)("div",{className:"md-doc",style:{maxHeight:340,overflow:"auto"},dangerouslySetInnerHTML:{__html:Dt(Ct($.text).body)}}),ee==="pending"&&(0,e.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!!v,onClick:()=>U("approved",[y.path]),children:["\u2713 ",t("approve")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!v,onClick:()=>U("rejected",[y.path]),children:["\u2715 ",t("reject")]})]})]})]})]},y.path)})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function Ia({t,onReload:o,version:r}){let[f,p]=(0,n.useState)([]),[i,w]=(0,n.useState)(""),[D,k]=(0,n.useState)(null),E=(g,z=!0)=>{k({msg:g,ok:z}),setTimeout(()=>k(null),3200)},C=(0,n.useCallback)(async()=>{try{let g=await fetch(`${W}/recycle/list`).then(z=>z.json());g.ok&&p(g.items||[])}catch{}},[]);(0,n.useEffect)(()=>{C()},[r,C]);let h=async(g,z)=>{let T=(f.find(v=>v.path===z)||{}).title||z;w(g+z);try{let j=await fetch(W+(g==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(z)),L=await j.json().catch(()=>null);await C(),o&&o(),j.ok&&(!L||L.ok!==!1)?E(t(g==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+T):E(t("toastFailed")+"\uFF1A"+(L&&L.error||"HTTP "+j.status),!1)}catch(v){E(t("toastFailed")+"\uFF1A"+String(v&&v.message||v),!1)}finally{w("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ta,{toast:D}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!i||f.length===0,title:f.length?"":t("emptyRecycle"),onClick:async()=>{w("purgeAll");try{let g=await fetch(W+"/recycle/purge-expired?days=0"),z=await g.json().catch(()=>null);await C(),E(g.ok?t("toastPurgedExpired")+(z&&z.purged!=null?"\uFF08"+z.purged+"\uFF09":""):t("toastFailed"),g.ok)}catch(g){E(t("toastFailed")+"\uFF1A"+String(g&&g.message||g),!1)}finally{w("")}},children:t("emptyRecycle")})]}),f.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:f.map(g=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[g.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(g.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!i,onClick:()=>h("restore",g.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!i,onClick:()=>{window.confirm(t("purgeConfirm"))&&h("purge",g.path)},children:t("purge")})]},g.path))}):(0,e.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",t("emptyRecycle"),(0,e.jsx)("br",{}),(0,e.jsx)("span",{style:{fontSize:11.5},children:t("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var Ba=({card:t,t:o,onOpen:r,query:f,onDelete:p})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>r(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[t.kind]||qe.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:ht[t.kind]||"\u{1F4CE}"}),f?Xt(t.title,f):t.title,Wa(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:o("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",o("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",o("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",o("statusApproved")]})]}),(0,e.jsx)("p",{children:f?Xt(t.summary||"",f):t.summary||""}),Vt(t).length>0&&(0,e.jsx)("div",{className:"mc-tags",children:Vt(t).slice(0,4).map(i=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",i]},i))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[ht[t.kind]||"\u{1F4CE}"," ",o(Ke[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ut(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",pt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:o("delete"),onClick:i=>{i.stopPropagation(),window.confirm(o("deleteConfirm"))&&p&&p(t.path)},children:"\u{1F5D1}"})]})]});function La({t,tab:o,onReload:r,version:f}){let[p,i]=(0,n.useState)(null),[w,D]=(0,n.useState)(""),[k,E]=(0,n.useState)(null),[C,h]=(0,n.useState)(null),[g,z]=(0,n.useState)(null),[T,v]=(0,n.useState)(null),j=(0,n.useCallback)(async()=>{P("align");try{let l=await fetch(W+"/align").then(N=>N.json());l&&l.findings?v(l):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{P("")}},[t]),L=async()=>{if(window.confirm(t("alignFixConfirm"))){P("alignfix");try{let l=await fetch(W+"/setup-run",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(N=>N.json());l&&l.ok?(notify(t("alignFixed")),await j()):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{P("")}}},[K,ee]=(0,n.useState)([]),[V,P]=(0,n.useState)(""),[Ie,Y]=(0,n.useState)(!1),be=(0,n.useCallback)(async()=>{if(!(!k||!k.merge||!k.merge.length)&&window.confirm(t("mergeAllConfirm"))){P("merge");try{let l={},N=de=>l[de]===void 0?de:l[de]=N(l[de]),R=(de,Q)=>{l[N(de)]=N(Q)},G=new Set;for(let de of k.merge)G.add(de.a.path),G.add(de.b.path),R(de.a.path,de.b.path);let ge={};for(let de of G){let Q=N(de);(ge[Q]=ge[Q]||[]).push(de)}let Ce=0;for(let de of Object.values(ge)){if(de.length<2)continue;(await fetch(`${W}/merge?paths=${encodeURIComponent(de.join(","))}`).then(Oe=>Oe.json())).ok&&Ce++}await J(),r&&r()}catch{}P("")}},[k,J,r,t]);async function J(){try{let l=await Promise.all([fetch(`${W}/stats`),fetch(`${W}/budget`),fetch(`${W}/capture-log`),fetch(`${W}/cards?status=all&limit=30&agent=${yt}`)]),[N,R,G,ge]=await Promise.all(l.map(Ce=>Ce.json()));N&&N.ok&&i(N),R&&R.ok&&h(R),G&&G.ok&&z(G),ge&&ge.ok&&ee(ge.cards||[]),D(!N||!N.ok?t("adminLoadFail"):"")}catch{D(t("adminLoadFail"))}}let U=(0,n.useCallback)(async()=>{P("scan");try{let l=await fetch(`${W}/optimize`).then(N=>N.json());l.ok&&E(l)}catch{D(t("adminLoadFail"))}finally{P("")}},[t]),[ie,ve]=(0,n.useState)(null),x=(0,n.useCallback)(async()=>{P("refine");try{let l=await fetch(`${W}/refine-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:8})}).then(N=>N.json());l&&l.ok?ve(l):notify(l&&l.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{P("")}},[t]),we=async(l,N)=>{if(!(N==="merge"&&!window.confirm(t("mergeConfirm")))){P("refineapply");try{let R=await fetch(`${W}/refine-apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({a:l.a.path,b:l.b.path,action:N,relation:l.relation})}).then(G=>G.json());R&&R.ok?(notify(t("refineApplied")),ve(G=>G&&{...G,findings:(G.findings||[]).filter(ge=>!(ge.a.path===l.a.path&&ge.b.path===l.b.path))}),await J(),r&&r()):notify(R&&R.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{P("")}}},[Z,ce]=(0,n.useState)(null),je=(0,n.useCallback)(async()=>{P("junk");try{let l=await fetch(`${W}/refine-junk`).then(N=>N.json());l&&l.ok?ce(l.items||[]):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{P("")}},[t]),y=async l=>{if(l.length&&window.confirm(t("junkRecycleAllConfirm"))){P("junkpurge");try{let N=await fetch(`${W}/refine-junk-purge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:l})}).then(R=>R.json());N&&N.removed?(notify(t("junkDone")+"\uFF1A"+N.removed.length+(N.failed?.length?"\uFF08\u5931\u8D25 "+N.failed.length+"\uFF09":"")),ce(R=>R&&R.filter(G=>!N.removed.includes(G.path))),await J(),r&&r()):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{P("")}}},[$,le]=(0,n.useState)(null),X=(0,n.useCallback)(async()=>{P("goals");try{let l=await fetch(W+"/refine-goals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:30})}).then(N=>N.json());l&&l.ok?le(l):notify(l&&l.error||t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{P("")}},[t]),re=async l=>{P("goalskeep");try{let N=await fetch(W+"/refine-goals-keep",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:l.members.map(R=>R.path)})}).then(R=>R.json());N&&N.ok?(notify(t("goalDone")),le(R=>R&&{...R,clusters:(R.clusters||[]).filter(G=>G.goal!==l.goal)})):notify(t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{P("")}},ye=async l=>{if(window.confirm(t("mergeConfirm"))){P("goalsmerge");try{let N=await fetch(W+"/merge?paths="+encodeURIComponent(l.members.map(R=>R.path).join(","))).then(R=>R.json());N&&N.ok?(notify(t("goalMerged")),le(R=>R&&{...R,clusters:(R.clusters||[]).filter(G=>G.goal!==l.goal)}),await J(),r&&r()):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{P("")}}};(0,n.useEffect)(()=>{J()},[f]);let Be=async(l,N)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${W}/merge?paths=${encodeURIComponent(l+","+N)}`).then(G=>G.json())).ok&&(await J(),r&&r())}catch{}},Me=async l=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${W}/delete?path=${encodeURIComponent(l)}`).then(R=>R.json())).ok&&(await J(),r&&r())}catch{}},Se=["project","knowledge","content","prompt","business","tool","mistake"],Te=({title:l,kind:N,updated:R,path:G})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[N]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(R)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Me(G),children:[t("delete")," \u2715"]})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[w&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",w]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:J,children:["\u21BB ",t("retry")]})]}),o==="stats"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F527} ",t("alignTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:j,children:t(V==="align"?"exporting":"alignRun")}),T&&T.counts&&T.counts.fix>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:L,children:t(V==="alignfix"?"exporting":"alignFix")}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("alignHint")})]}),T&&T.findings?(0,e.jsxs)("div",{style:{marginTop:6},children:[(0,e.jsxs)("div",{style:{fontSize:12,opacity:.75,marginBottom:4},children:[t("alignDisk")," v",T.onDisk||"?",T.residentServed?" \xB7 "+t("alignResident")+" v"+T.residentServed:"",T.hostVersion?" \xB7 "+t("alignHost")+" v"+T.hostVersion:""]}),(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:T.findings.map((l,N)=>(0,e.jsxs)("li",{style:{padding:"4px 2px",borderTop:N?"1px solid rgba(127,127,127,0.12)":"none",fontSize:12},children:[(0,e.jsx)("span",{style:{fontWeight:700,color:l.level==="fix"?"#ef4444":l.level==="warn"?"#f59e0b":"#10b981"},children:l.level==="fix"?"\u2717":l.level==="warn"?"\u26A0":"\u2713"})," ",(0,e.jsx)("span",{children:l.title}),l.detail?(0,e.jsx)("div",{style:{opacity:.75,marginLeft:14},children:l.detail}):null,l.command?(0,e.jsxs)("div",{style:{marginLeft:14,opacity:.9},children:["\u2192 ",(0,e.jsx)("code",{children:l.command})]}):null]},N))})]}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginTop:4},children:t("alignIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",t("captureLog")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("captureLogHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>J(),children:["\u21BB ",t("refresh")]})]}),g?g.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(g.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(g.entries||[]).map((l,N)=>{let R=Sa[l.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:pt(l.time?new Date(l.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:R[1],fontWeight:600},children:[R[0]," ",l.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:l.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:l.preview||"",children:l.preview||""})]},N)})})})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("loading")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",t("captureAgentCards"),"\uFF08",K.length,"\uFF09"]}),K.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:K.map(l=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[l.kind]||qe.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.title}),l.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(l.updated)})]},l.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),p&&(0,e.jsxs)(e.Fragment,{children:[p.trend&&p.trend.length>0&&(()=>{let l=p.trend,N=Math.max(...l.map(Ce=>Ce.count),1),R=260,G=50,ge=R/l.length;return(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",t("trendLabel")]}),(0,e.jsx)("svg",{width:R,height:G,style:{display:"block",width:"100%",height:50},children:l.map((Ce,de)=>{let Q=Math.round(Ce.count/N*(G-4));return(0,e.jsx)("rect",{x:de*ge+1,y:G-Q,width:Math.max(ge-2,2),height:Q,rx:1.5,fill:Ce.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:Ce.count>0?.85:.35},Ce.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:p.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:Se.map(l=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[l]||"#666"}}),t(Ke[l]),": ",p.byKind?.[l]||0]},l))})]}),C&&(C.budgetChars||C.recallLimit||C.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:C.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:C.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",C.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",p.todayCards?.length||0,"\uFF09"]}),p.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:p.todayCards.map(l=>(0,e.jsx)(Te,{title:l.title,kind:l.kind,updated:l.updated,path:l.path},l.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),o==="optimize"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("organizeTitle")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:U,children:V==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),k&&k.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){P("oneclick");try{let l=JSON.stringify({cleanupStale:Ie}),R=await(await fetch(`${W}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:l})).json();R&&R.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${R.plan.merged} ${t("optimizedMerged")}${Ie?` \xB7 ${R.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await J(),r&&r(),E(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{P("")}}},children:V==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),k&&k.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:Ie,onChange:l=>Y(l.target.checked)}),t("oneClickAlsoStale")]})]}),!k&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),k&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("mergePairs")}),(0,e.jsx)("div",{className:"spacer",style:{flex:1}}),k.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:be,children:t(V==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),k.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:k.merge.map((l,N)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[l.a.title," \u21C4 ",l.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(l.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Be(l.a.path,l.b.path),children:t("mergeNow")})]},N))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:t("noOptimize")}),(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("staleCards"),"\uFF08",k.stale?.length||0,"\uFF09"]}),k.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!V,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;P("clean");let l=0;for(let N of k.stale)try{await fetch(`${W}/delete?path=${encodeURIComponent(N.path)}`),l++}catch{}P(""),notify(`${l} ${t("deletedStale")}`),await J(),r&&r()},children:t("cleanStale")})}),k.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:k.stale.map(l=>(0,e.jsx)(Te,{title:l.title,kind:"other",updated:l.updated,path:l.path},l.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9ED} ",t("refineTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:x,children:t(V==="refine"?"exporting":"refineScan")}),(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("refineHint")})]}),ie?.findings?.length?ie.findings.map((l,N)=>(0,e.jsxs)("div",{style:{borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",padding:"7px 2px"},children:[(0,e.jsxs)("div",{style:{fontSize:12,marginBottom:3},children:[(0,e.jsx)("span",{style:{fontWeight:700,color:l.relation==="conflict"?"#ef4444":l.relation==="duplicate"?"#f59e0b":"#10b981"},children:t("refineRel_"+l.relation)}),(0,e.jsxs)("span",{style:{opacity:.55},children:[" \xB7 sim ",l.sim," \xB7 ",l.useModel||""]}),l.conflict?(0,e.jsx)("span",{style:{marginLeft:6},children:l.conflict}):null]}),(0,e.jsxs)("div",{style:{fontSize:12,opacity:.85,marginBottom:5},children:["A\uFF1A",l.a.title,(0,e.jsx)("br",{}),"B\uFF1A",l.b.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>we(l,"keepA"),children:t("refineKeepA")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>we(l,"keepB"),children:t("refineKeepB")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>we(l,"keepBoth"),children:t("refineKeepBoth")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>we(l,"merge"),children:t("refineMerge")})]})]},N)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(ie?"refineNone":"refineIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9F9} ",t("junkTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:je,children:t(V==="junk"?"exporting":"junkScan")}),Z?.length?(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:()=>y(Z.map(l=>l.path)),children:t(V==="junkpurge"?"exporting":"junkRecycleAll")}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("junkHint")})]}),Z?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:Z.map((l,N)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 2px",borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",fontSize:12},children:[(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:l.reasons.join("\uFF1B"),children:l.title||l.path}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:l.reasons[0]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>y([l.path]),children:t("junkRecycle")})]},N))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(Z?"junkNone":"junkIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("goalTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:X,children:t(V==="goals"?"exporting":"goalScan")}),$?(0,e.jsxs)("span",{style:{opacity:.6,fontSize:11},children:[t("goalStats"),"\uFF1A",$.cached," / ",$.calls]}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("goalHint")})]}),$?.clusters?.length?$.clusters.map((l,N)=>(0,e.jsxs)("div",{style:{borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",padding:"7px 2px"},children:[(0,e.jsxs)("div",{style:{fontSize:12,marginBottom:4},children:[(0,e.jsx)("b",{children:l.goal})," ",(0,e.jsxs)("span",{style:{opacity:.55},children:["\xB7 ",l.members.length," ",t("goalCards")]})]}),(0,e.jsx)("ul",{style:{margin:"0 0 5px",padding:"0 0 0 16px",fontSize:12,opacity:.85},children:l.members.map((R,G)=>(0,e.jsx)("li",{children:R.title},G))}),(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>re(l),children:t("goalKeep")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>ye(l),children:t("goalMerge")})]})]},N)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t($?"goalNone":"goalIdle")})]})]})]})]})}var It=[{key:"decision",label:"tplDecision",kind:"knowledge",tagKey:"tplDecisionTags",bodyKey:"tplDecisionBody"},{key:"bug",label:"tplBug",kind:"mistake",tagKey:"tplBugTags",bodyKey:"tplBugBody"},{key:"meeting",label:"tplMeeting",kind:"content",tagKey:"tplMeetingTags",bodyKey:"tplMeetingBody"},{key:"weekly",label:"tplWeekly",kind:"content",tagKey:"tplWeeklyTags",bodyKey:"tplWeeklyBody"}];function Aa({t,newCard:o,setNewCard:r,onCreated:f}){if(!o)return null;let p=It.find(h=>h.key===o.template),i=o.body||(p?t(p.bodyKey):""),w=o.kind||(p?p.kind:"knowledge"),D=o.tags||(p?t(p.tagKey):""),k=o._creating,E=h=>{let g=It.find(z=>z.key===h);r(z=>({...z,template:h,kind:g?g.kind:z.kind,body:g?t(g.bodyKey):z.body,tags:g?t(g.tagKey):z.tags}))},C=async()=>{if(!(!o.title&&!i)){r(h=>({...h,_creating:!0}));try{(await fetch(`${W}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:w,tags:D.split(",").map(g=>g.trim()).filter(Boolean),body:i,source:"manual"})}).then(g=>g.json())).ok?(r(null),f&&f()):r(g=>({...g,_creating:!1}))}catch{r(g=>({...g,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>r(null),children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:h=>h.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>r(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[It.map(h=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===h.key?" me-on":""}`,onClick:()=>E(h.key),children:t(h.label)},h.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>r(h=>({...h,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:w,onChange:h=>r(g=>({...g,kind:h.target.value})),style:{maxWidth:180,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:["project","knowledge","content","prompt","business","tool","mistake"].map(h=>(0,e.jsx)("option",{value:h,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:h},h))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:o.title||"",onChange:h=>r(g=>({...g,title:h.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:D,onChange:h=>r(g=>({...g,tags:h.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:i,onChange:h=>r(g=>({...g,body:h.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:k,onClick:C,children:t(k?"exporting":"createCard")})})]})]})]})}async function Yt(t){let o=String(t||"");if(!o)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(o),!0}catch{}try{let r=document.createElement("textarea");r.value=o,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();let f=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(r),f}catch{return!1}}function ja({t,onClose:o}){let[r,f]=(0,n.useState)(""),[p,i]=(0,n.useState)(""),[w,D]=(0,n.useState)(""),[k,E]=(0,n.useState)(!0),[C,h]=(0,n.useState)(!1),[g,z]=(0,n.useState)(""),[T,v]=(0,n.useState)(""),j=(0,n.useRef)(null),L=(0,n.useRef)(null),K=()=>{let U=j.current;if(U)try{U.focus(),U.select()}catch{}},ee=U=>{z(U),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>z(""),2400)};(0,n.useEffect)(()=>{let U=!0;return fetch(W+"/diagnostics").then(ie=>ie.json()).then(ie=>{U&&(ie&&ie.ok?(i(String(ie.diagnostics||"")),D(String(ie.version||""))):h(!0))}).catch(()=>{U&&h(!0)}).finally(()=>{U&&E(!1)}),()=>{U=!1}},[]),(0,n.useEffect)(()=>{let U=ie=>{ie.key==="Escape"&&o()};return window.addEventListener("keydown",U),()=>{window.removeEventListener("keydown",U),L.current&&clearTimeout(L.current)}},[o]);let V=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),P=()=>{let U=r.trim().split(`
306
- `)[0]||"",ie=Ot({title:"[Bug] "+(U.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Wt({description:r,diagnostics:p,version:w})});try{window.open(ie,"_blank","noopener")}catch{ee(t("fbCopyFail"))}},Ie=async()=>{await Yt(p)?(v(""),ee(t("fbCopiedDiag"))):(v(p),ee(t("fbCopyManual")))},Y=async()=>{let U=$t({lang:V,description:r,diagnostics:p});await Yt(U)?(v(""),ee(t("fbCopiedPrompt"))):(v(U),ee(t("fbCopyManual")))},be={width:"100%",resize:"vertical",padding:"8px 10px",borderRadius:10,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:13},J={margin:0,maxHeight:170,overflow:"auto",fontSize:11.5,lineHeight:1.55,padding:"8px 10px",borderRadius:10,background:"var(--dsw-alias-bg-layer-1, rgba(127,127,127,0.08))",whiteSpace:"pre-wrap"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:U=>U.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:o,children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,e.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:t("fbWhy")}),(0,e.jsx)("textarea",{value:r,onChange:U=>f(U.target.value),placeholder:t("fbDesc"),rows:5,style:be}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("fbDiag")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:Ie,disabled:!p,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:J,children:k?t("fbLoading"):C?t("fbDiagFail"):p})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!r.trim()){ee(t("fbNeedDesc"));return}P()},style:{borderColor:"var(--dsw-alias-brand-primary, #3b82f6)",color:"var(--dsw-alias-brand-primary, #3b82f6)",fontWeight:600},children:["\u{1F680} ",t("fbOpenIssue")]}),(0,e.jsx)("span",{style:{opacity:.5,fontSize:12},children:t("fbOr")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:Y,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),g&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:g}),T&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",t("fbCopyFail")]}),(0,e.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:t("fbCopyManual")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:K,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:j,readOnly:!0,value:T,rows:7,style:be})]})]})]})]})}function Pa({t,card:o,query:r,onClose:f,onDelete:p,onFeedback:i}){(0,n.useEffect)(()=>{let j=L=>{L.key==="Escape"&&f()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[f]);let{meta:w,body:D}=(0,n.useMemo)(()=>Ct(o.text||""),[o.text]),k=j=>{let L=w.find(([K])=>String(K).toLowerCase()===j);return L?L[1]:""},E=Et(k("tags")),C=k("kind")||"knowledge",h=(k("status")||"approved").toLowerCase(),g=qe[C]||"#6B7280",z=(D||"").length>460,[T,v]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:f,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",onClick:j=>j.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:ht[C]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),z&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":T,onClick:()=>v(j=>!j),children:t(T?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&p&&p(o.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:f,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:g,borderColor:g+"59",background:g+"1a"},children:[ht[C]||"\u{1F4CE}"," ",t(Ke[C]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(h==="approved"?"md-chip-st-ok":h==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[h==="approved"?"\u2705":h==="pending"?"\u23F3":"\u26D4"," ",t(h==="approved"?"statusApproved":h==="pending"?"statusPending":"statusRejected")]}),(Array.isArray(E)?E:[]).slice(0,8).map(j=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",j]},j)),!!k("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",pt(k("updated"))]}),!!k("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",k("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:T?{}:{maxHeight:300,overflow:"hidden"},onClick:T?void 0:j=>{j.stopPropagation(),v(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Dt(D)}})}),!T&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:j=>{j.stopPropagation(),v(!0)},children:[t("expand")," \u2304"]})]})]})}function Fa({t,onOpen:o,all:r,onAllChange:f,onMutate:p,active:i,visible:w}){let[D,k]=(0,n.useState)(null),[E,C]=(0,n.useState)(""),h=(0,n.useRef)(!1),g=(0,n.useRef)(0),z=(0,n.useRef)(t);z.current=t;let T=(0,n.useCallback)(async()=>{try{h.current=!1;let K=await(await fetch(`${W}/graph${r?"?all=1":""}`)).json();K.ok?(k(K),C(""),h.current=!0):(k(null),C(K.error||t("error")))}catch(L){C(String(L&&L.message?L.message:L))}},[r,t]);(0,n.useEffect)(()=>{if(!i||h.current)return;let L=!0;return fetch(`${W}/graph${r?"?all=1":""}`).then(K=>K.json()).then(K=>{L&&(K.ok?(k(K),C(""),h.current=!0):(k(null),C(K.error||t("error"))))}).catch(K=>{L&&C(String(K&&K.message?K.message:K))}),()=>{L=!1}},[r,t,i]),(0,n.useEffect)(()=>{w&&D&&g.current++},[w,D]);let v=(0,n.useCallback)(async L=>{try{let ee=await(await fetch(`${W}/delete?path=${encodeURIComponent(L)}`)).json();return ee&&ee.ok?(await T(),p&&p(),!0):!1}catch{return!1}},[T]),j=(0,n.useCallback)(async L=>{if(!L||L.length<2)return!1;try{let K=await fetch(`${W}/merge?paths=${encodeURIComponent(L.join(","))}`).then(ee=>ee.json());return K&&K.ok?(await T(),p&&p(),!0):!1}catch{return!1}},[T,p]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Ee}),E&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",E]}),!D&&!E&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),D&&D.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),D&&D.nodes.length>0&&(0,e.jsx)(Ea,{nodes:D.nodes,edges:D.edges,onOpen:o,onDelete:v,onMerge:j,t,all:r,onAllChange:f,countLabel:`${D.nodes.length} ${t("nodes")} \xB7 ${Ha(D.edges)} ${t("edges")}`,fitTrigger:g.current})]})}function Ha(t){let o=new Set;for(let r of t||[])o.add([r.source,r.target].sort().join("|"));return o.size}var ct={colors:{project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},shapes:{project:"circle",knowledge:"circle",content:"rect",prompt:"diamond",business:"hexagon",tool:"circle",mistake:"diamond",other:"circle"}};function Ea({nodes:t,edges:o,onOpen:r,onDelete:f,onMerge:p,t:i,countLabel:w,all:D,onAllChange:k,fitTrigger:E}){let C=(0,n.useRef)(null),h=(0,n.useRef)(null),g=(0,n.useRef)(null),z=(0,n.useRef)(null),T=(0,n.useRef)(null),v=(0,n.useRef)(r);(0,n.useEffect)(()=>{v.current=r},[r]);let j=(0,n.useRef)(f);(0,n.useEffect)(()=>{j.current=f},[f]);let L=(0,n.useRef)(p);(0,n.useEffect)(()=>{L.current=p},[p]);let[K,ee]=(0,n.useState)(""),[V,P]=(0,n.useState)(null),Ie=(0,n.useRef)("");(0,n.useEffect)(()=>{Ie.current=K.trim().toLowerCase()},[K]),(0,n.useEffect)(()=>{let u=g.current;if(!u)return;let s=K.trim().toLowerCase();if(!s)return;let _=u.nodes.find(pe=>(pe.name||"").toLowerCase().includes(s));_&&(g.current.selectedId=_.id,P(_.id),u.panX=u.w/2-_.x*u.zoom,u.panY=u.h/2-_.y*u.zoom,u.render&&u.render())},[K]);let[Y,be]=(0,n.useState)("all"),[J,U]=(0,n.useState)(!1),ie=(0,n.useRef)("all"),[ve,x]=(0,n.useState)(""),we=(0,n.useRef)(""),[Z,ce]=(0,n.useState)(!1),je=(0,n.useRef)(!1),[y,$]=(0,n.useState)(null);(0,n.useEffect)(()=>{ie.current=Y},[Y]),(0,n.useEffect)(()=>{we.current=ve},[ve]),(0,n.useEffect)(()=>{je.current=Z},[Z]);let le=(0,n.useMemo)(()=>{let u=new Map;for(let s of t)for(let _ of s.tags||[]){let pe=String(_).trim();pe&&u.set(pe,(u.get(pe)||0)+1)}return[...u.entries()].sort((s,_)=>_[1]-s[1]).slice(0,24).map(([s,_])=>({tag:s,n:_}))},[t]),X=(()=>{let u=K.trim().toLowerCase();return!!u&&!t.some(s=>(s.title||s.name||"").toLowerCase().includes(u)||String(s.kind||"").toLowerCase().includes(u)||String(Ke[s.kind]||"").toLowerCase().includes(u))})();(0,n.useEffect)(()=>{let u=g.current;u&&u.wake&&u.wake()},[K]),(0,n.useEffect)(()=>{let u=g.current;u&&u.render&&u.render()},[Y,ve,Z]);let re=(0,n.useRef)(null),[ye,Be]=(0,n.useState)([]),[Me,Se]=(0,n.useState)(null),[Te,l]=(0,n.useState)(!1),[N,R]=(0,n.useState)(null),[G,ge]=(0,n.useState)(""),Ce=(0,n.useRef)(null),de=(0,n.useRef)(null),Q=(u,s=!0)=>{Ce.current&&clearTimeout(Ce.current),R({msg:u,ok:s}),Ce.current=setTimeout(()=>R(null),1900)},Oe=u=>{ge(u),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>ge(""),1600)};(0,n.useEffect)(()=>()=>{Ce.current&&clearTimeout(Ce.current),de.current&&clearTimeout(de.current)},[]);let Le=(0,n.useMemo)(()=>t.reduce((u,s)=>(u[s.id]=s,u),{}),[t]);return(0,n.useEffect)(()=>{let u=C.current;if(!u||t.length===0)return;let s=u.getContext("2d");if(!s)return;let _=Math.max(1,window.devicePixelRatio||1),pe=()=>document.documentElement.getAttribute("data-theme")==="dark",se={};o.forEach(m=>{se[m.source]=(se[m.source]||0)+1,se[m.target]=(se[m.target]||0)+1});let ue=Math.max(1,...Object.values(se)),a={nodes:t.map(m=>({id:m.id,name:m.title||"",type:m.kind||"other",r:9+Math.min(10,(se[m.id]||0)/ue*8),x:0,y:0,vx:0,vy:0})),edges:o.map(m=>({sourceNodeId:m.source,targetNodeId:m.target,weight:1})),panX:0,panY:0,zoom:1,running:!0,raf:0,tickCount:0,quietTicks:0,dragNode:null,selectedId:null,mouseX:0,mouseY:0,w:0,h:0,dpr:_,ctx:s,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((m,I)=>(m[I.id]=I,m),{}),a.nodes.forEach((m,I)=>{let M=I/a.nodes.length*Math.PI*2-Math.PI/2;m.x=Math.cos(M)*60,m.y=Math.sin(M)*60});let tt=[...new Set(a.nodes.map(m=>m.type))];a.clustered=tt.length>1,a.typeCenters={},tt.forEach((m,I)=>{let M=I/tt.length*Math.PI*2-Math.PI/2;a.typeCenters[m]={x:Math.cos(M)*160,y:Math.sin(M)*160}}),g.current=a;let at=0,xe=0,nt=()=>{let m=u.clientWidth,I=u.clientHeight;a.w=m,a.h=I,u.width=m*_,u.height=I*_,s.setTransform(_,0,0,_,0,0),(at===0||xe===0)&&m>0&&I>0&&a.tickCount>0&&requestAnimationFrame(()=>O()),at=m,xe=I};nt();let Ae=new ResizeObserver(nt);Ae.observe(u.parentElement);let c=(m,I)=>m&&m.length>I?m.slice(0,I)+"\u2026":m,A=(m,I,M,H)=>{if(s.beginPath(),H==="rect")s.rect(m-M,I-M*.75,M*2,M*1.5);else if(H==="diamond")s.moveTo(m,I-M),s.lineTo(m+M,I),s.lineTo(m,I+M),s.lineTo(m-M,I),s.closePath();else if(H==="hexagon"){for(let q=0;q<6;q++){let me=Math.PI/3*q-Math.PI/2,ae=m+M*Math.cos(me),ze=I+M*Math.sin(me);q===0?s.moveTo(ae,ze):s.lineTo(ae,ze)}s.closePath()}else s.arc(m,I,M,0,Math.PI*2)},d=new Map,S=(m,I)=>{let M=m+"|"+Math.round(I),H=d.get(M);if(!H){let q=parseInt(m.slice(1,3),16),me=parseInt(m.slice(3,5),16),ae=parseInt(m.slice(5,7),16);H=s.createRadialGradient(-I*.3,-I*.3,0,0,0,I*1.2),H.addColorStop(0,"rgba("+Math.min(255,q+70)+","+Math.min(255,me+70)+","+Math.min(255,ae+70)+",0.95)"),H.addColorStop(1,m),d.set(M,H)}return H},O=()=>{if(!a.nodes.length)return;let m=1/0,I=-1/0,M=1/0,H=-1/0;a.nodes.forEach($e=>{m=Math.min(m,$e.x),I=Math.max(I,$e.x),M=Math.min(M,$e.y),H=Math.max(H,$e.y)});let q=20,me=I-m+q*2,ae=H-M+q*2,ze=Math.min(a.w/me,a.h/ae);a.zoom=Math.max(.35,Math.min(1.8,ze)),a.panX=a.w/2-(m+I)/2*a.zoom,a.panY=a.h/2-(M+H)/2*a.zoom};z.current=O;let F=()=>{s.clearRect(0,0,a.w,a.h),a.searchTerm=Ie.current,a.kindFilter=ie.current,a.timeMode=je.current,a.tagFilter=we.current;let m=a.tagFilter,I=a.kindFilter,M=b=>String(b||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");s.save(),s.strokeStyle=pe()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",s.lineWidth=.5;for(let b=0;b<a.w;b+=24)s.beginPath(),s.moveTo(b,0),s.lineTo(b,a.h),s.stroke();for(let b=0;b<a.h;b+=24)s.beginPath(),s.moveTo(0,b),s.lineTo(a.w,b),s.stroke();s.restore(),s.save(),s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom);let H={};a.nodes.forEach(b=>H[b.id]=b);let q=a.nodes.length>40,me=q?1.5:.55,ae=a.selectedId||a.hoverId,ze=_t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),$e=(()=>{let b=(a.searchTerm||"").toLowerCase();if(!b)return null;let ne=[];for(let oe of a.nodes){let Re=(a.domainById[oe.id]||{}).kind||"other";if(((oe.name||"").toLowerCase().includes(b)||String(Ke[Re]||"").toLowerCase().includes(b)||String(Re).toLowerCase().includes(b))&&ne.push(oe.id),ne.length>200)break}return ne})(),ot=Kt(a.nodes,{limit:Ut(a.nodes.length),focusId:ae,hoverId:a.hoverId,searchHits:$e,degree:se}),fe=new Map,ke=(b,ne)=>{let oe=b+"|"+ne,he=fe.get(oe);return he===void 0&&(s.font=b,he=s.measureText(ne).width,fe.set(oe,he)),he},Fe=a.nodes.length<=250,_e=new Map;a.edges.forEach(b=>{let ne=H[b.sourceNodeId],oe=H[b.targetNodeId];if(!ne||!oe||!Nt(ne.x,ne.y,10,ze)&&!Nt(oe.x,oe.y,10,ze))return;if(I!=="all"){let rt=a.domainById[b.sourceNodeId]&&a.domainById[b.sourceNodeId].kind,Ze=a.domainById[b.targetNodeId]&&a.domainById[b.targetNodeId].kind;if(rt!==I&&Ze!==I)return}if(m){let rt=a.domainById[b.sourceNodeId]&&(a.domainById[b.sourceNodeId].tags||[]).includes(m),Ze=a.domainById[b.targetNodeId]&&(a.domainById[b.targetNodeId].tags||[]).includes(m);if(!rt&&!Ze)return}let he=oe.x-ne.x,Re=oe.y-ne.y,Pe=Math.sqrt(he*he+Re*Re)||1,Qe=q?12:18,et=-Re/Pe*Qe,xt=he/Pe*Qe,kt=(ne.x+oe.x)/2+et,wt=(ne.y+oe.y)/2+xt,mt=ct.colors[a.domainById[ne.id]&&a.domainById[ne.id].kind||"other"],gt=ae&&(b.sourceNodeId===ae||b.targetNodeId===ae),Mt=ae?gt?.6:.08:q?.14:.24,Je=parseInt(mt.slice(1,3),16),ft=parseInt(mt.slice(3,5),16),Rt=parseInt(mt.slice(5,7),16),Ge=gt?1.6+(b.weight||1):.8+(b.weight||1)*.5,it=Je+","+ft+","+Rt+","+Mt+","+Ge,Ue=_e.get(it);Ue||(Ue={path:new Path2D,stroke:"rgba("+Je+","+ft+","+Rt+","+Mt+")",width:Ge},_e.set(it,Ue)),Ue.path.moveTo(ne.x,ne.y),Ue.path.quadraticCurveTo(kt,wt,oe.x,oe.y)}),_e.forEach(b=>{s.strokeStyle=b.stroke,s.lineWidth=b.width,s.stroke(b.path)});let He=null;ae&&(He=new Set,a.edges.forEach(b=>{b.sourceNodeId===ae?He.add(b.targetNodeId):b.targetNodeId===ae&&He.add(b.sourceNodeId)}));let Xe=[];if(a.nodes.forEach(b=>{if(!Nt(b.x,b.y,b.r+2,ze))return;let ne=a.domainById[b.id]||{},oe=ne.kind||"other",he=a.timeMode?Oa(ne.updated):ct.colors[oe],Re=ct.shapes[oe],Pe=a.selectedId===b.id,Qe=a.hoverId===b.id,et=a.searchTerm||"",xt=!et||(b.name||"").toLowerCase().includes(et)||String(Ke[oe]||"").toLowerCase().includes(et)||String(oe).toLowerCase().includes(et),kt=I==="all"||oe===I,wt=!m||(ne.tags||[]).includes(m),mt=ae&&b.id!==ae&&!(He&&He.has(b.id))||et&&!xt||!kt||!wt;s.save(),s.globalAlpha=mt?.08:1,(Pe||Qe)&&Fe&&(s.shadowColor=he,s.shadowBlur=Pe?20:14),s.translate(b.x,b.y),A(0,0,b.r,Re),s.fillStyle=S(he,b.r),s.fill(),s.restore(),Pe?(s.save(),A(b.x,b.y,b.r+3,Re),s.strokeStyle=he,s.lineWidth=3,s.shadowColor=he,s.shadowBlur=12,s.stroke(),s.restore()):Qe?(s.save(),A(b.x,b.y,b.r+2,Re),s.strokeStyle=he,s.lineWidth=2,s.stroke(),s.restore()):et&&xt?(s.save(),A(b.x,b.y,b.r+2,Re),s.strokeStyle="#e11d48",s.lineWidth=2,s.stroke(),s.restore()):a.multi.indexOf(b.id)>=0&&(s.save(),A(b.x,b.y,b.r+2,Re),s.strokeStyle="#60a5fa",s.lineWidth=2,s.shadowColor="#60a5fa",s.shadowBlur=8,s.stroke(),s.restore());let gt=c(b.name,16);if((Pe||Qe||ot.has(b.id)&&a.zoom>me||!q&&a.zoom>.6)&&kt&&wt){let Je=1/a.zoom,ft="500 "+(12*Je).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";s.font=ft;let Ge=ke(ft,gt)+16*Je,it=18*Je,Ue=b.y+b.r+8*Je,rt=!0;for(let Ze of Xe)if(b.x-Ge/2<Ze.x+Ze.w&&b.x+Ge/2>Ze.x&&Ue<Ze.y+Ze.h&&Ue+it>Ze.y){rt=!1;break}if(!rt&&!Pe&&!Qe)return;Xe.push({x:b.x-Ge/2,y:Ue,w:Ge,h:it}),s.fillStyle=pe()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",s.beginPath(),s.roundRect?s.roundRect(b.x-Ge/2,Ue,Ge,it,4*Je):s.rect(b.x-Ge/2,Ue,Ge,it),s.fill(),s.strokeStyle=pe()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",s.lineWidth=1*Je,s.stroke(),s.fillStyle=pe()?Pe||Qe?"#eee":"#bbb":Pe||Qe?"#111":"#444",s.textAlign="center",s.fillText(gt,b.x,Ue+13*Je)}}),s.restore(),a.marquee){let b=a.marquee,ne=Math.min(b.sx,b.ex),oe=Math.min(b.sy,b.ey),he=Math.abs(b.ex-b.sx),Re=Math.abs(b.ey-b.sy);s.save(),s.setLineDash([4,4]),s.strokeStyle="rgba(96,165,250,0.9)",s.lineWidth=1,s.fillStyle="rgba(96,165,250,0.12)",s.fillRect(ne,oe,he,Re),s.strokeRect(ne,oe,he,Re),s.restore()}if(a.hoverId&&re.current){let b=a.domainById[a.hoverId],ne=a.nodes.find(function(oe){return oe.id===a.hoverId});if(b&&ne){let oe=a.edges.filter(function(Pe){return Pe.sourceNodeId===b.id||Pe.targetNodeId===b.id}).length,he=ne.x*a.zoom+a.panX,Re=ne.y*a.zoom+a.panY;re.current.style.display="block",re.current.style.left=he+14+"px",re.current.style.top=Re-6+"px",re.current.innerHTML="<b>"+M(b.title||b.name||"")+'</b><br/><span style="opacity:.8">'+M(b.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",oe)+"</span>"}}else re.current&&(re.current.style.display="none")},B=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(Ne))};a.wake=B,a.render=F;let te=()=>{let m=a.nodes.length;a.tickCount++;let M=.9-Math.min(.4,a.tickCount/1500),H=m>1e3?3e3:m>100?2e3:m>50?1200:800,q=m>100?.002:.005,me=m>1e3?.012:m>100?.005:.01,ae=m>1e3?6:m>200?12:24,ze={};a.nodes.forEach(fe=>ze[fe.id]=fe);for(let fe=0;fe<m;fe++){if(a.dragNode===a.nodes[fe])continue;let ke=a.nodes[fe],Fe=0,_e=0;for(let b=0;b<m;b++){if(fe===b)continue;let ne=ke.x-a.nodes[b].x,oe=ke.y-a.nodes[b].y,he=Math.sqrt(ne*ne+oe*oe)||1,Re=H/(he*he);Fe+=ne/he*Re,_e+=oe/he*Re}if(a.clustered&&a.typeCenters[ke.type]){let b=a.typeCenters[ke.type];Fe+=(b.x-ke.x)*.006,_e+=(b.y-ke.y)*.006}else Fe-=ke.x*me,_e-=ke.y*me;let He=(ke.vx+Fe)*M,Xe=(ke.vy+_e)*M;He=Math.max(-ae,Math.min(ae,He)),Xe=Math.max(-ae,Math.min(ae,Xe)),ke.vx=He,ke.vy=Xe}a.edges.forEach(fe=>{let ke=ze[fe.sourceNodeId],Fe=ze[fe.targetNodeId];if(!ke||!Fe)return;let _e=Fe.x-ke.x,He=Fe.y-ke.y,Xe=Math.sqrt(_e*_e+He*He)||1,b=(Xe-100)*q,ne=_e/Xe*b,oe=He/Xe*b;a.dragNode!==ke&&(ke.vx+=ne,ke.vy+=oe),a.dragNode!==Fe&&(Fe.vx-=ne,Fe.vy-=oe)});let $e=0;a.nodes.forEach(fe=>{a.dragNode!==fe&&(fe.x+=fe.vx,fe.y+=fe.vy,$e+=fe.vx*fe.vx+fe.vy*fe.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,O()),(m?Math.sqrt($e/m):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},Ne=()=>{if(a.running){try{te(),F()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(Ne)}},De=(m,I)=>{let M=u.getBoundingClientRect();return{x:(m-M.left-a.panX)/a.zoom,y:(I-M.top-a.panY)/a.zoom}},Ve=m=>{let I=a.domainById[m];return!(!I||ie.current!=="all"&&I.kind!==ie.current||we.current&&!(I.tags||[]).includes(we.current))},We=(m,I,M)=>Math.max(I,Math.min(M,m)),Ye=m=>{a.mouseX=m.clientX,a.mouseY=m.clientY;let I=De(m.clientX,m.clientY),M=null;for(let H=a.nodes.length-1;H>=0;H--){let q=a.nodes[H];if(!Ve(q.id))continue;let me=q.x-I.x,ae=q.y-I.y;if(me*me+ae*ae<q.r*q.r+36){M=q.id;break}}M!==a.hoverId&&(a.hoverId=M,B())},vt=m=>{if(m.button!==0)return;let I=De(m.clientX,m.clientY),M=null;for(let H=a.nodes.length-1;H>=0;H--){let q=a.nodes[H];if(!Ve(q.id))continue;let me=q.x-I.x,ae=q.y-I.y;if(me*me+ae*ae<q.r*q.r+25){M=q;break}}if(m.shiftKey){if(M){a.shiftClick=M.id;return}a.marquee={sx:m.clientX,sy:m.clientY,ex:m.clientX,ey:m.clientY};return}a.dragStart={x:m.clientX,y:m.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=M||null,M&&(a.dragOffset={dx:M.x-I.x,dy:M.y-I.y})},Lt=m=>{if(a.marquee){a.marquee.ex=m.clientX,a.marquee.ey=m.clientY,B();return}if(!a.dragStart)return;let I=m.clientX-a.dragStart.x,M=m.clientY-a.dragStart.y;if(Math.abs(I)+Math.abs(M)>3&&(a.dragging=!0),a.dragNode){let H=De(m.clientX,m.clientY);a.dragNode.x=H.x+a.dragOffset.dx,a.dragNode.y=H.y+a.dragOffset.dy,B()}else a.dragging&&(a.panX=We(a.dragStart.px+I,-1e5,1e5),a.panY=We(a.dragStart.py+M,-1e5,1e5),B())},At=m=>{if(a.marquee){let M=a.marquee;a.marquee=null;let H=u.getBoundingClientRect(),q=Math.min(M.sx,M.ex)-H.left,me=Math.max(M.sx,M.ex)-H.left,ae=Math.min(M.sy,M.ey)-H.top,ze=Math.max(M.sy,M.ey)-H.top,$e=a.nodes.filter(ot=>{let fe=ot.x*a.zoom+a.panX,ke=ot.y*a.zoom+a.panY;return fe>=q&&fe<=me&&ke>=ae&&ke<=ze}).map(ot=>ot.id);a.multi=$e,Be($e),B();return}let I=a.dragStart&&!a.dragging;if(a.shiftClick){let M=a.shiftClick;a.shiftClick=null;let H=Array.isArray(a.multi)?a.multi.slice():[];H.includes(M)||H.push(M),a.multi=H,Be(H),B();return}if(I){let M=De(m.clientX,m.clientY),H=null;for(let q=a.nodes.length-1;q>=0;q--){let me=a.nodes[q];if(!Ve(me.id))continue;let ae=me.x-M.x,ze=me.y-M.y;if(ae*ae+ze*ze<me.r*me.r+20){H=me;break}}H?(a.selectedId=H.id,P(H.id),B()):(a.selectedId=null,a.hoverId=null,m.shiftKey||(a.multi=[],Be([])),P(null),B())}a.dragStart=null,a.dragging=!1,a.dragNode=null},jt=m=>{m.preventDefault();let I=De(m.clientX,m.clientY),M=null;for(let H=a.nodes.length-1;H>=0;H--){let q=a.nodes[H];if(!Ve(q.id))continue;let me=q.x-I.x,ae=q.y-I.y;if(me*me+ae*ae<q.r*q.r+25){M=q;break}}if(M){let H=a.domainById[M.id];H&&$({x:m.clientX,y:m.clientY,id:M.id,path:H.id,title:H.title})}else $(null)},Pt=m=>{m.preventDefault();let I=u.getBoundingClientRect(),M=(m.clientX-I.left-a.panX)/a.zoom,H=(m.clientY-I.top-a.panY)/a.zoom,q=Math.max(.3,Math.min(3,a.zoom*(m.deltaY<0?1.1:1/1.1)));a.panX=We(a.panX+M*(a.zoom-q),-1e5,1e5),a.panY=We(a.panY+H*(a.zoom-q),-1e5,1e5),a.zoom=q,B()};u.addEventListener("mousemove",Ye),u.addEventListener("mousedown",vt),window.addEventListener("mousemove",Lt),window.addEventListener("mouseup",At),u.addEventListener("wheel",Pt,{passive:!1}),u.addEventListener("contextmenu",jt),T.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Be([]),O(),B()};for(let m=0;m<200;m++)te();O(),B();let Ft=()=>U(!1);return window.addEventListener("mousedown",Ft),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),Ae.disconnect(),u.removeEventListener("mousemove",Ye),u.removeEventListener("mousedown",vt),window.removeEventListener("mousemove",Lt),window.removeEventListener("mouseup",At),u.removeEventListener("wheel",Pt),u.removeEventListener("contextmenu",jt),window.removeEventListener("mousedown",Ft)}},[t,o]),(0,n.useEffect)(()=>{E!==void 0&&z.current&&requestAnimationFrame(()=>z.current())},[E]),(0,e.jsxs)("div",{className:"me-graph",ref:h,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",i("nodes")," \xB7 ",o.length," ",i("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:i("search"),value:K,onChange:u=>ee(u.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>U(u=>!u),"aria-expanded":J,title:i("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",i("filterLabel")," ",Y!=="all"||Z||ve?"\u25CF":"\u25BE"]}),J&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:u=>u.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:50,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:8,minWidth:240,boxShadow:"0 12px 34px rgba(0,0,0,.35)"},children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,e.jsx)("button",{type:"button",className:`lg${Y==="all"&&!Z?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{be("all"),ce(!1)},children:i("all")}),Object.keys(qe).map(u=>(0,e.jsxs)("button",{type:"button",className:`lg${Y===u?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>be(s=>s===u?"all":u),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[u]||qe[u]}}),i(Ke[u])]},u)),(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsxs)("button",{type:"button",className:`lg${Z?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>ce(u=>!u),children:["\u23F1 ",i("timeDim")]}),le.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:le.map(u=>(0,e.jsxs)("button",{type:"button",className:`lg${ve===u.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>x(s=>s===u.tag?"":u.tag),title:u.tag,children:["#",u.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:u.n})]},u.tag))})]}),(Y!=="all"||Z||ve)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{be("all"),ce(!1),x("")},children:[i("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:i("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!D,onChange:u=>k&&k(u.target.checked)}),i("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${Z?" me-on":""}`,onClick:()=>ce(u=>!u),children:i("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=C.current;if(u)try{u.toBlob(s=>{s&&Se({url:URL.createObjectURL(s),blob:s})},"image/png")}catch{}},children:i("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>z.current&&z.current(),children:i("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{P(null),be("all"),T.current&&T.current()},children:i("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:C,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:re,style:{display:"none",position:"absolute",zIndex:4,pointerEvents:"none",background:"rgba(28,28,32,0.88)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:8,padding:"7px 10px",fontSize:12,maxWidth:220,boxShadow:"0 8px 24px rgba(0,0,0,.2)"}}),X&&(0,e.jsx)("div",{className:"mc-empty",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)"},children:i("noMatch")}),y&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>$(null)}),y&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:y.x,top:y.y,zIndex:31},onMouseDown:u=>u.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{v.current({path:y.path,title:y.title}),$(null)},children:i("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{y.id&&(g.current.selectedId=y.id,P(y.id)),$(null);let u=g.current;u&&u.wake&&u.wake()},children:i("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(y.title||"")}catch{}$(null),Q(i("copied"))},children:i("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let u=g.current,s=u&&Array.isArray(u.multi)?u.multi.slice():[],_=y.id;if(_&&!s.includes(_)&&s.push(_),$(null),s.length<2){Q(i("mergeNeed"),!1);return}if(!window.confirm(i("mergeConfirm")))return;let pe=L.current&&L.current(s);pe&&pe.then?pe.then(se=>se?Q(i("merged")):Q(i("mergeFail"),!1)).catch(()=>Q(i("mergeFail"),!1)):pe&&Q(i("merged"))},children:i("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let u=y.path;$(null),window.confirm(i("deleteConfirm"))&&(async()=>{try{(j.current?await j.current(u):!1)?Q(i("deleted")):Q(i("deleteFail"),!1)}catch{Q(i("deleteFail"),!1)}})()},children:i("delete")})]}),ye.length>0&&(0,e.jsxs)("div",{style:{position:"absolute",left:10,top:10,zIndex:3,display:"flex",gap:8,alignItems:"center",background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:"6px 10px",fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsxs)("span",{style:{fontWeight:700},children:[ye.length," ",i("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=ye.map(ue=>Le[ue]).filter(Boolean).map(ue=>ue.title||ue.name).join(`
307
- `),_=new Blob([s],{type:"text/plain;charset=utf-8"}),pe=URL.createObjectURL(_),se=document.createElement("a");se.href=pe,se.download="memory-selected.txt",document.body.appendChild(se),se.click(),document.body.removeChild(se),setTimeout(()=>URL.revokeObjectURL(pe),1e3),Q(ye.length+i("exportedSel"))},children:i("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(ye.length<2){Q(i("mergeNeed"),!1);return}let u=ye.map(_=>Le[_]?Le[_].id:_);if(!window.confirm(i("mergeConfirm")))return;Be([]);let s=g.current;s&&(s.multi=[]),fetch(`${W}/merge?paths=${encodeURIComponent(u.join(","))}`).then(_=>_.json()).then(_=>{_&&_.ok?Q(i("merged")):Q(i("mergeFail"),!1)}).catch(()=>Q(i("mergeFail"),!1))},children:i("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(i("deleteConfirm")))return;let u=ye.map(_=>Le[_]?Le[_].id:_);Be([]);let s=g.current;s&&(s.multi=[]),(async()=>{let _=0;for(let pe of u)try{(j.current?await j.current(pe):!1)&&_++}catch{}Q(_+i("deletedSelected"),_>0)})()},children:i("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=g.current;u&&(u.multi=[]),Be([]);let s=g.current;s&&s.render&&s.render()},children:i("clearSelection")})]}),V&&(0,e.jsxs)("div",{className:"me-graph-sidebar",style:{position:"absolute",right:10,top:10,zIndex:3,maxWidth:240,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:12,fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:Le[V]?Le[V].title||Le[V].name:V}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:Le[V]?i(Ke[Le[V].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:i("graphHint")}),(o.filter(u=>u.source===V||u.target===V)||[]).slice(0,8).map((u,s)=>{let _=u.source===V?u.target:u.source,pe=Le[_];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:se=>{se.preventDefault();let ue=g.current;ue&&(ue.selectedId=_,ue.hoverId=_,ue.wake&&ue.wake()),P(_)},children:pe?(pe.title||pe.name).slice(0,28):_},s)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:i("graphTip")}),N&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(N.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:N.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:N.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:N.msg})]}),Me&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{Me.url&&URL.revokeObjectURL(Me.url),Se(null),l(!1)},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Te?"100vw":900,width:Te?"100vw":"92vw",maxHeight:Te?"100%":"90vh",height:Te?"100%":void 0,borderRadius:Te?0:14},onClick:u=>u.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:i("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:Me.url,download:"memory-graph.png",onClick:()=>{Oe("download"),Q(i("downloaded")+" \xB7 "+i("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:i(G==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Oe("full"),l(u=>!u),Q(i("fullscreen"))},children:i(G==="full"?"done":Te?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=Me.blob;u&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":u})]).then(()=>{Oe("copy"),Q(i("copied"))}).catch(()=>{Q(i("copyFail"),!1)}):Q(i("copyFail"),!1)},children:i(G==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Me.url&&URL.revokeObjectURL(Me.url),Se(null),l(!1)},children:i("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Te?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:Me.url,alt:i("exportGraph"),style:{maxWidth:"100%",maxHeight:Te?"calc(100% - 64px)":"70vh",borderRadius:Te?0:8,cursor:"zoom-in"},onClick:()=>l(u=>!u)})})]})]})]})}function Oa(t){let o=new Date(t||0).getTime();if(!o)return"#94a3b8";let r=(Date.now()-o)/864e5;return r<3?"#10b981":r<14?"#f59e0b":r<30?"#f97316":"#94a3b8"}function Gt({label:t,value:o=[],options:r,onChange:f,placeholder:p,z:i=20}){let[w,D]=(0,n.useState)(!1),k=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!w)return;let v=j=>{k.current&&!k.current.contains(j.target)&&D(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[w]);let E=Array.isArray(o)?o:[],C=E.includes("__all__"),h=C?r.find(v=>v.value==="__all__")?.label||"":E.length?E.map(v=>r.find(j=>j.value===v)?.label||v).join("\u3001"):"",g=(v,j)=>{if(v.value==="__all__"){f(j?["__all__"]:[]);return}let L=new Set(E);L.has("__all__")&&L.delete("__all__"),j?L.add(v.value):L.delete(v.value),f([...L])},z=r.find(v=>v.value==="__all__"),T=r.filter(v=>v.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t}),(0,e.jsxs)("div",{ref:k,style:{position:"relative",minWidth:0},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>D(v=>!v),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,e.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h||p||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),w&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:i,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[z&&(0,e.jsxs)("label",{onClick:v=>v.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("input",{type:"checkbox",checked:C,onChange:v=>g(z,v.target.checked)}),(0,e.jsx)("span",{children:z.label})]}),T.map(v=>(0,e.jsxs)("label",{onClick:j=>j.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:E.includes(v.value),onChange:j=>g(v,j.target.checked)}),(0,e.jsx)("span",{children:v.label})]},v.value))]})]})]})}function Wa(t){let o=new Date(t||0).getTime();return!!o&&(Date.now()-o)/864e5<3}async function $a(t,o,r){if(r&&typeof window.showSaveFilePicker=="function")try{let i=await window.showSaveFilePicker({suggestedName:o}),w=await i.createWritable();return await w.write(t),await w.close(),{ok:!0,picked:!0,name:i.name}}catch(i){return i&&i.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(i.message||i)}}let f=URL.createObjectURL(t),p=document.createElement("a");return p.href=f,p.download=o,document.body.appendChild(p),p.click(),document.body.removeChild(p),setTimeout(()=>URL.revokeObjectURL(f),1e3),{ok:!0,picked:!1,name:o}}function Xt(t,o){if(!o||!t)return t;let r=t.toLowerCase(),f=o.toLowerCase(),p=[],i=0;for(;i<t.length;){let w=r.indexOf(f,i);if(w<0){p.push(t.slice(i));break}w>i&&p.push(t.slice(i,w)),p.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(w,w+f.length)},w)),i=w+f.length}return p}function pt(t){if(!t)return"";let o=new Date(t);if(Number.isNaN(o.getTime()))return"";let r=new Date,f=o.toDateString()===r.toDateString(),p=w=>String(w).padStart(2,"0"),i=`${p(o.getHours())}:${p(o.getMinutes())}`;return f?i:`${o.getMonth()+1}-${o.getDate()} ${i}`}
305
+ `);let J=new Blob([B],{type:W}),ve=await $a(J,E,!1);if(!ve.ok){y({ok:!1,msg:t("exportFail")}),U(!1);return}y({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+ve.name})}catch(v){y({ok:!1,msg:t("exportFail")+" \xB7 "+(v.message||"")})}finally{U(!1)}ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>y(null),2600)},nt=async b=>{let n=b.target.files&&b.target.files[0];if(b.target.value="",!!n){try{let v=await n.text(),B=await(await fetch(`${O}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:v})).json();if(B.ok){await fe();let E=B.imported||0,W=t("importedVault")+"\uFF1A"+E;B.total&&(W+=t("importedTotal")+B.total+t("importedTotalTail")),B.quarantined&&(W+=t("importedQuarantine")+B.quarantined+t("importedQuarantineTail")),B.skipped&&(W+=t("importedSkipped")+B.skipped+t("importedSkippedTail")),B.warning&&(W+=" \xB7 "+B.warning),y({ok:E>0||!B.total,msg:W})}else y({ok:!1,msg:B.error||t("importFail")})}catch{y({ok:!1,msg:t("importFail")})}ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>y(null),2400)}},Se=(0,o.useMemo)(()=>{let b=T.slice();return te!=="all"&&(b=b.filter(n=>ut(n.submittedBy)===te)),F!=="all"&&(b=b.filter(n=>(n.status||"approved")===F)),he==="title"?b.sort((n,v)=>String(n.title||"").localeCompare(String(v.title||""))):he==="hot"?b.sort((n,v)=>(v.weight||v.links||0)-(n.weight||n.links||0)):b.sort((n,v)=>new Date(v.updated||0).getTime()-new Date(n.updated||0).getTime()),b},[T,he,te,F]),Ze=(0,o.useMemo)(()=>[...new Set(T.map(b=>ut(b.submittedBy)))],[T]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Ee}),ke&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(ke.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ke.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ke.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:ke.msg})]}),i&&(0,e.jsxs)("div",{className:"me-modal-head",children:[(0,e.jsxs)("div",{className:"me-modal-title",children:[(0,e.jsx)("span",{className:"me-wicon",children:(0,e.jsx)(ea,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),g&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:g,"aria-label":t(c?"exitFull":"fullscreen"),children:c?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":t("close"),children:"\u2715"})]}),x&&x.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[x.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:x.since?pt(new Date(x.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${Re?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Ne(b=>!b),"aria-label":t(Re?"collapse":"expand"),title:t(Re?"collapse":"expand"),children:Re?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${G==="cards"?" active":""}`,onClick:()=>le("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),Re&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${G==="graph"?" active":""}`,onClick:()=>le("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),Re&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${G==="stats"?" active":""}`,onClick:()=>le("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),Re&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${G==="audit"?" active":""}`,onClick:()=>le("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),Re&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),de>0&&(0,e.jsx)("span",{className:"mc-dot",children:de>99?"99+":de})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${G==="optimize"?" active":""}`,onClick:()=>le("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),Re&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),ae>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:ae>99?"99+":ae})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${G==="config"?" active":""}`,onClick:()=>le("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),Re&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Ce(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),Re&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:se,children:[l&&l.db&&l.db.writable===!1?(0,e.jsxs)("div",{style:{margin:"8px 10px 0",padding:"8px 12px",borderRadius:8,fontSize:12,lineHeight:1.7,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.35)",color:"#b91c1c"},children:["\u26A0\uFE0F ",t("dbReadonlyTitle"),"\uFF1A",l.db.error||"\u2014"," \u2014\u2014 ",t("dbReadonlyBody"),(0,e.jsx)("div",{style:{opacity:.85,marginTop:2},children:t("dbReadonlyFix")})]}):null,G==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(dt,{label:t("total"),value:l?l.total:"\u2014"}),(0,e.jsx)(dt,{label:t("recent"),value:l?l.recent:"\u2014"}),(0,e.jsx)(dt,{label:t("tags"),value:l?l.tags:"\u2014"}),(0,e.jsx)(dt,{label:t("pending"),value:l?.quarantine?.pending??l?.status?.pending??0}),(0,e.jsx)(dt,{label:t("rejected"),value:l?.quarantine?.rejected??l?.status?.rejected??0}),(0,e.jsx)(dt,{label:t("cardCount"),value:l?l.byKind?.knowledge??0:"\u2014"})]}),G==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:L,onChange:b=>Fe(b.target.value)}),(0,e.jsx)("input",{ref:Te,type:"file",accept:".json,application/json",style:{display:"none"},onChange:nt}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Te.current&&Te.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>N({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:h,onClick:()=>at("md"),children:t(h?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:h,onClick:()=>at("json"),children:t(h?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>fe(),children:t("refresh")})]}),G==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[At.map(b=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===b?" active":""}`,onClick:()=>Je(b),children:t(b==="all"?"all":Ke[b])},b)),(0,e.jsxs)("select",{value:te,onChange:b=>V(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Qt(Ze).map(b=>(0,e.jsx)("option",{value:b,children:b},b))]}),(0,e.jsxs)("select",{value:F,onChange:b=>Ie(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(b=>(0,e.jsx)("button",{type:"button",className:`mc-chip${he===b.key?" active":""}`,onClick:()=>Ae(b.key),children:b.label},b.key))]}),z&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z]}),(0,e.jsx)("div",{style:{display:G==="cards"?"contents":"none"},children:H?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):z?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>fe(),children:t("retry")})]}):T.length===0?(0,e.jsx)("div",{className:"mc-empty",children:t("empty")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mc-grid",children:Se.map(b=>(0,e.jsx)(Aa,{card:b,t,query:L.trim(),onOpen:et,onDelete:a},b.path))}),T.length<We&&(0,e.jsx)("div",{ref:_,style:{height:1}}),p&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",T.length," / ",We,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:G==="graph"?"flex":"none",flex:1,minHeight:0},children:X.has("graph")&&(0,e.jsx)(Pa,{t,onOpen:et,all:ee,onAllChange:Z,onMutate:we,active:G==="graph",visible:G==="graph"})}),(0,e.jsx)("div",{style:{display:G==="config"?"contents":"none"},children:X.has("config")&&(0,e.jsx)(aa,{t,onReload:()=>fe(),version:I})}),(0,e.jsx)("div",{style:{display:G==="stats"?"contents":"none"},children:X.has("stats")&&(0,e.jsx)(Ba,{t,tab:"stats",onReload:()=>fe(),version:I})}),(0,e.jsx)("div",{style:{display:G==="audit"?"contents":"none"},children:X.has("audit")&&(0,e.jsx)(za,{t,onReload:()=>fe(),version:I})}),(0,e.jsx)("div",{style:{display:G==="optimize"?"contents":"none"},children:X.has("optimize")&&(0,e.jsx)(Ia,{t,onReload:()=>fe(),version:I})}),Be&&(0,e.jsx)(ja,{t,onClose:()=>Ce(!1)}),re&&(0,e.jsx)(Fa,{t,card:re,query:L.trim(),onClose:()=>ye(null),onDelete:b=>{ye(null),a(b)},onFeedback:b=>{let n=re.path;fetch(`${O}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:L.trim(),path:n,useful:b})}).then(()=>y({ok:!0,msg:t(b?"fbUseful":"fbIrr")})).catch(()=>{}),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>y(null),2e3)}}),(0,e.jsx)(La,{t,newCard:s,setNewCard:N,onCreated:()=>{fe(),we(),y({ok:!0,msg:t("created")}),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>y(null),2e3)}})]})]})]})}var ta=({toast:t})=>t?(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(t.ok?"#10b981":"#ef4444"),background:t.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[t.ok?"\u2705":"\u26A0"," ",t.msg]}):null,dt=({label:t,value:i})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:i}),(0,e.jsx)("span",{children:t})]});function aa({t,onReload:i,version:r,compact:g}){let[c,l]=(0,o.useState)(null),[C,T]=(0,o.useState)(0),[S,H]=(0,o.useState)(null),[k,x]=(0,o.useState)(null),[m,z]=(0,o.useState)(!1),[R,w]=(0,o.useState)(!1),j=(0,o.useRef)(!1),L=(0,o.useRef)(null),K=(0,o.useRef)({}),[te,V]=(0,o.useState)(null),[F,Ie]=(0,o.useState)(null),[G,ge]=(0,o.useState)(""),[X,$]=(0,o.useState)(""),[le,he]=(0,o.useState)(""),[Ae,ke]=(0,o.useState)(null),[y,ue]=(0,o.useState)(null),Te=(0,o.useCallback)(async n=>{$("version");try{let v=await fetch(O+"/version-check"+(n?"?force=1":"")).then(D=>D.json());v&&v.ok?(ue(v),n&&Z(v.updateAvailable?t("vcLatest")+" v"+v.latest:t("vcUpToDate"))):n&&Z(t("vcCheckFail"),!1)}catch{n&&Z(t("vcCheckFail"),!1)}finally{$("")}},[t]);(0,o.useEffect)(()=>{Te(!1)},[r,Te]);let[h,U]=(0,o.useState)(""),[re,ye]=(0,o.useState)(null),ee=(0,o.useRef)(null),Z=(n,v=!0)=>{ee.current&&clearTimeout(ee.current),ye({msg:n,ok:v}),ee.current=setTimeout(()=>ye(null),1900)},Be=async()=>{if(!X){$("restart");try{let n=await fetch(O+"/restart-self",{method:"POST"});if(n.status===404||n.status===405){Z(de("vcRestartNoRoute",{cmd:y&&y.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let v=await n.json().catch(()=>null);if(!v){Z(t("vcRestartFail")+"\uFF08HTTP "+n.status+"\uFF09",!1);return}if(!v.ok){Z(v.error||t("vcRestartFail"),!1);return}if(v.alreadyCurrent){Z(v.note||t("vcRestartCurrent"));return}Z(v.note||t("vcRestartSent")),v.alreadyRunning||setTimeout(()=>{Te(!0)},6e3)}catch(n){Z(t("vcRestartFail")+"\uFF1A"+String(n&&n.message||n),!1)}finally{$("")}}},Ce=y&&y.resident?String(y.resident.served||""):"",Re=!!(y&&y.onDisk&&Ce&&Ce!==y.onDisk),Ne=!!(y&&y.resident&&y.resident.managed===!1&&y.resident.managedKnown===!1),s=y&&y.resident&&y.resident.replaceBlocked&&y.resident.replaceBlocked.fresh||null,N=!!(y&&y.resident&&y.resident.managedBy==="host"),I=!!(y&&y.resident&&y.resident.managed===!1&&!Ne&&!N),Q=!!(y&&y.resident&&!Ce),we=Re||Q||I||Ne,de=(n,v)=>Object.keys(v).reduce((D,B)=>D.split("{"+B+"}").join(v[B]),t(n)),ae=(0,o.useCallback)(async()=>{try{let[n,v,D,B]=await Promise.all([fetch(`${O}/config`).then(E=>E.json()).catch(()=>null),fetch(`${O}/setup-status`).then(E=>E.json()).catch(()=>null),fetch(`${O}/budget`).then(E=>E.json()).catch(()=>null),fetch(`${O}/llm-routes`).then(E=>E.json()).catch(()=>null)]);if(B&&B.ok&&ke(B),n&&n.ok){l(n),T(n.revision??0),H(n.schema??null);let E=qt(n.config??{},K.current);K.current=E.overlay,x({...E.values}),V(n.dsh??null),z(n.writable===!1),w(n.viaPending===!0),ge(""),j.current=!1}else D&&D.ok?(x({...D}),z(!0),ge(t("configNeedsDsh"))):ge(t("adminLoadFail"));v&&v.ok&&Ie(v),he("")}catch{ge(t("adminLoadFail"))}},[t]);(0,o.useEffect)(()=>{ae()},[r,ae]);let Y=(n,v)=>{j.current=!0,x(D=>({...D??{},[n]:v}))};(0,o.useEffect)(()=>{L.current=ae},[ae]),(0,o.useEffect)(()=>{if(typeof EventSource>"u")return;let n=null;try{n=new EventSource(O+"/events")}catch{return}let v=()=>{!j.current&&typeof L.current=="function"&&L.current()};try{n.addEventListener("config",v)}catch{}return()=>{try{n.close()}catch{}}},[]);let We=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),Le=n=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[n]||n,p=async()=>{if(!k)return;if(m){Z(t("editInSetting"),!1);return}let n={dedupThreshold:[0,1],captureMinChars:[0,1e6],captureCooldownMs:[0,1e9],maxCardsPerDay:[0,1e6],captureMaxTokens:[100,4e3],recallMinScore:[0,50],recallLimit:[1,20],recallSummaryLen:[40,400],recycleRetentionDays:[1,3650],webPort:[1,65535],webCheckIntervalMs:[1e3,6e5],webMaxRestart:[1,1e3],sessionBudgetChars:[0,1e9]},v=[];for(let[D,[B,E]]of Object.entries(n)){if(!(D in k))continue;let W=k[D],J=typeof W=="number"?W:Number(W);(W===""||W===null||W===void 0||!Number.isFinite(J)||J<B||J>E)&&v.push(t("invalidField",{field:D,min:B,max:E,value:String(W===""?"\u7A7A":W)}))}if(v.length){let D=t("saveInvalid")+"\uFF1A"+v.join("\uFF1B");ge(D),Z(D,!1);return}$("save");try{let D={...k};for(let J of Object.keys(k))J in D&&typeof D[J]=="string"&&D[J].trim()!==""&&We.has(J)&&(D[J]=Number(D[J]));Array.isArray(D.vaultProfiles)&&(D.vaultProfiles=D.vaultProfiles.filter(J=>J&&(String(J.name||"").trim()||String(J.path||"").trim())));let B=await fetch(`${O}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:D,expectedRevision:C})}),E=await B.text(),W=null;try{W=E?JSON.parse(E):null}catch{W=null}if(W||(W={error:"HTTP "+B.status+(E?"\uFF1A"+E.slice(0,200):"\uFF08\u5BBF\u4E3B\u672A\u8FD4\u56DE\u539F\u56E0\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6709\u6570\u5B57\u5B57\u6BB5\u4E3A\u7A7A\u6216\u8D85\u51FA\u8303\u56F4\uFF09")}),W&&W.ok){let J=typeof W.pendingOutcome=="string"?W.pendingOutcome:"",ve,De=!0;if(J==="applied")ve=t("savedApplied")+(Array.isArray(W.applied)&&W.applied.length?" \xB7 "+W.applied.join("\u3001"):"");else if(J==="queued")De=!1,ve=t("saveQueued");else if(J==="failed")De=!1,ve=t("saveFail")+" \xB7 "+(W.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if(J==="applied-direct")ve=t("savedOk")+" \xB7 "+t("savedDirect");else{let Pe=Array.isArray(W.pending)&&W.pending.length?" \xB7 "+t("savePending"):W.note?" \xB7 "+t("restartHint"):"";ve=(W.retried?"\u267B ":"")+t("savedOk")+Pe}K.current={...K.current,...D},De?he(ve):ge(ve),Z(ve,De),await ae()}else{let J=B.status===409?t("conflictRefresh"):W?.error||t("saveFail");ge(J),Z(J,!1)}}catch{ge(t("saveFail")),Z(t("saveFail"),!1)}finally{$("")}},d=()=>{K.current={},x({...c?.config??{}}),he("")},_={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},se=n=>Array.isArray(n?.vaultProfiles)?n.vaultProfiles:[],ce=(n,v,D)=>x(B=>{let E=se(B).map(J=>({...J||{}})),W={...E[n]||{}};return v==="match"?String(D).trim()?W.match={...W.match||{},workspace:D}:delete W.match:W[v]=D,E[n]=W,{...B??{},vaultProfiles:E}}),fe=()=>x(n=>({...n??{},vaultProfiles:[...se(n),{name:"",path:""}]})),a=n=>x(v=>({...v??{},vaultProfiles:se(v).filter((D,B)=>B!==n)})),Fe={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},Je={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},et={A:{label:t("planA"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:4e3,recallMinScore:2,recallLimit:5,recallSummaryLen:130,recallIncludeBody:!1,captureCooldownMs:3e5},B:{label:t("planB"),autoWebMode:"init",watchdogAutoSpawn:!1,distillEnabled:!1,dedupByLLM:!1,captureMaxTokens:500,recallMinScore:3,recallLimit:3,recallSummaryLen:80,recallIncludeBody:!1,captureMinChars:300,maxCardsPerDay:40,captureCooldownMs:3e5},C:{label:t("planC"),autoWebMode:"interval",watchdogAutoSpawn:!0,distillEnabled:!0,dedupByLLM:!0,captureMaxTokens:1200,recallMinScore:1,recallLimit:8,recallSummaryLen:200,recallIncludeBody:!0,captureCooldownMs:12e4}},at=async n=>{let v=et[n];v&&x(D=>({...D??{},...v}))},nt=async(n,v)=>{$(n+v);try{let B=await(await fetch(`${O}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:n,action:v})})).json();B&&B.ok?Z(de(v==="install"?"mcpInstalled":"mcpUninstalled",{agent:n})):Z(de("mcpActionFail",{agent:n,error:B?.error||""}),!1);try{let E=await fetch(`${O}/setup-status`).then(W=>W.json());E&&E.ok&&Ie(E)}catch{}}catch{Z(t("mergeFail"),!1)}finally{$("")}},Se=({k:n,label:v,type:D="text",step:B,min:E,max:W})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:v||n}),(0,e.jsx)("input",{type:D,step:B,min:E,max:W,value:k?k[n]??"":"",onChange:J=>{let ve=J.target.value;Y(n,D==="number"?ve===""?"":Number(ve):ve)},style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12}})]}),Ze=new Set(["autoRestartOnDrift"]),b=({k:n,label:v})=>{let D=k?k[n]:void 0,B=D===void 0?Ze.has(n):!!D;return(0,e.jsxs)("label",{style:{display:"flex",alignItems:"flex-start",gap:6,fontSize:12,minWidth:0,lineHeight:1.5},children:[(0,e.jsx)("input",{type:"checkbox",checked:B,onChange:E=>Y(n,E.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:v||n})]})};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:g?"0 0 auto":1,minHeight:0,maxHeight:g?"52vh":void 0},children:[(0,e.jsx)("style",{children:Ee}),re&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(re.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:re.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:re.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:re.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[G&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",G]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:ae,children:["\u21BB ",t("retry")]})]}),R&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #3b82f6",background:"rgba(59,130,246,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#1d4ed8",lineHeight:1.7},children:["\u2139 ",t("pendingSyncNote")]}),m&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #f59e0b",background:"rgba(245,158,11,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#b45309"},children:["\u2139\uFE0F ",t("configNeedsDsh")," \u2014\u2014 ",t("editInSetting")]}),le&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #10b981",background:"rgba(16,185,129,0.08)",padding:"10px 14px",marginBottom:10,fontSize:12,color:"#059669"},children:["\u2713 ",le]}),c&&(c.version||c.dsh?.vaultDir)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4E6} ",t("pluginInfo")]}),(0,e.jsx)("span",{style:{fontSize:12,opacity:.7},children:t("dshHostLabel")}),c.version&&(0,e.jsxs)("code",{style:Fe,children:[t("vcLoaded")," v",c.version]}),y&&y.resident&&y.resident.served&&y.resident.served!==c.version&&(0,e.jsxs)("code",{style:Fe,children:[t("vcResident")," v",y.resident.served]}),y&&y.resident&&!y.resident.served&&(0,e.jsxs)("code",{style:{...Fe,color:"#b45309",fontWeight:600},children:[t("vcResident")," ",t("vcResidentDownShort")]}),y&&y.resident&&y.resident.served&&y.resident.managed===!1&&(0,e.jsxs)("code",{style:{...Fe,color:"#b45309",fontWeight:600},children:[t("vcResident")," v",y.resident.served," \xB7 ",t(s?"vcResidentReplaceBlockedShort":N?"vcResidentHostManagedShort":Ne?"vcResidentLockUnknownShort":"vcResidentUnmanagedShort")]}),yt&&(0,e.jsxs)("code",{style:Fe,children:[t("vcPage")," v",yt]}),y&&y.onDisk&&(0,e.jsxs)("code",{style:Fe,children:[t("vcOnDisk")," v",y.onDisk]}),y&&y.latest&&(0,e.jsxs)("code",{style:Fe,children:[t("vcLatest")," v",y.latest]}),c.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",c.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:X==="version",onClick:()=>Te(!0),children:X==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),y&&(y.stale||Q||I||Ne||s)&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px"},children:[(0,e.jsxs)("div",{children:["\u26A0\uFE0F ",y.stale?de("vcStale",{disk:y.onDisk,loaded:y.loaded}):Q?de("vcResidentDown",{port:y.resident&&y.resident.port||"",cmd:y.restartCommand||"dsh-memory restart --port 7999"}):s?de("vcResidentReplaceBlocked",{served:Ce,err:s.error||"",path:s.lockPath||"",cmd:y.restartCommand||"dsh-memory restart --port "+(y.resident&&y.resident.port||7999)}):Ne?de("vcResidentLockUnknown",{served:Ce,path:y.resident&&y.resident.lock&&y.resident.lock.path||"",err:y.resident&&y.resident.lock&&y.resident.lock.error||""}):de("vcResidentUnmanaged",{served:Ce,cmd:y.restartCommand||"dsh-memory restart --port 7999"})]}),we?(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!X,onClick:Be,children:X==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),y.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:y.restartCommand})]}):(0,e.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",t("vcHostStale"),y.restartCommand&&(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:y.restartCommand})]})]})]}),yt&&y&&y.onDisk&&yt!==y.onDisk&&(0,e.jsx)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px",lineHeight:1.7},children:t("vcPageStale",{page:yt,disk:y.onDisk})}),y&&y.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:y.updateCommand})]}),y&&y.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",y.checkError]})]}),F&&F.agents&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F50C} ",t("mcpSetupStatus")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("mcpManageHint")})]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:F.agents.map(n=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1},children:[(0,e.jsx)("b",{children:n.isDsh?t("dshHostLabel"):n.name}),n.isDsh&&n.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",n.version]}),!n.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),n.installed&&n.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),n.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),n.mcpConfigured===!0&&n.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),n.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",n.recallTool?t("enabled"):t("disabled"),")"]})]}),n.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",n.hook]}),!n.isDsh&&n.installed&&n.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!X,onClick:()=>nt(n.name,"install"),children:t("installMcp")}),!n.isDsh&&n.installed&&n.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!X,onClick:()=>{window.confirm(t("uninstallConfirm"))&&nt(n.name,"uninstall")},children:t("uninstallMcp")})]},n.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),h&&(0,e.jsx)("div",{style:{fontSize:11,marginTop:6},children:(0,e.jsx)("code",{style:{padding:"2px 6px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:4},children:h})})]}),k?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(n=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>at(n),disabled:!!X,children:[n==="A"?"\u{1F7E2} ":n==="B"?"\u{1F4B0} ":"\u2B50 ",et[n].label]},n))})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9E0} ",t("dshMemoryConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,e.jsx)(b,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(b,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(Se,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(Se,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(Se,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(Se,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(Se,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(b,{k:"recallIncludeBody",label:t("recallBody")}),(0,e.jsx)(Se,{k:"secretHint",label:t("secretHint")}),(0,e.jsx)(Se,{k:"recallEmbedding",label:t("recallEmbedding")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #06b6d4"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5C2}\uFE0F ",t("vaultMulti")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("vaultMultiHint")})]}),(0,e.jsxs)("div",{style:{fontSize:11.5,opacity:.85,marginBottom:8,lineHeight:1.7},children:[t("vaultNow"),"\uFF1A",(0,e.jsx)("code",{children:te?.vaultDir||"\u2014"}),te?.vaultName?`\uFF08${te.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(_[te?.vaultSource]||"vaultSrcDefault"),te?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:te.workspace})]}):null]}),se(k).map((n,v)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:n.name||"",placeholder:t("vaultNamePh"),onChange:D=>ce(v,"name",D.target.value),style:Je,disabled:m}),(0,e.jsx)("input",{value:n.path||"",placeholder:t("vaultPathPh"),onChange:D=>ce(v,"path",D.target.value),style:Je,disabled:m}),(0,e.jsx)("input",{value:n.match&&n.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:D=>ce(v,"match",D.target.value),style:Je,disabled:m}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>a(v),disabled:m,title:t("delete"),children:"\u2715"})]},v)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:fe,disabled:m,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:k.activeVault||"",onChange:n=>Y("activeVault",n.target.value),disabled:m,style:Je,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),se(k).filter(n=>n&&n.name).map(n=>(0,e.jsx)("option",{value:n.name,children:n.name},n.name))]})]})]})]}),(0,e.jsx)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsx)(b,{k:"enabled",label:t("enabledLabel")}),(0,e.jsx)(Se,{k:"vaultDir",label:t("vaultDirLabel")})]})}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #f59e0b"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F4B0} ",t("costControl")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("costHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8,marginTop:6},children:[(0,e.jsx)(b,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(b,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(Se,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(Se,{k:"recallMinScore",label:t("recallMinScore"),type:"number"}),(0,e.jsx)(Se,{k:"captureCooldownMs",label:t("captureCooldownMs"),type:"number"}),Ae&&Ae.providers&&Ae.providers.length?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("captureProvider")}),(0,e.jsxs)("select",{value:k.captureProvider||"",onChange:n=>{Y("captureProvider",n.target.value),Y("captureModel","")},style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"",children:t("routeAuto")}),Ae.providers.map(n=>(0,e.jsx)("option",{value:n.id,children:n.label},n.id))]})]}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("captureModel")}),(0,e.jsxs)("select",{value:k.captureModel||"",onChange:n=>Y("captureModel",n.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"",children:t("routeAuto")}),((Ae.providers.find(n=>n.id===k.captureProvider)||{}).models||[]).map(n=>(0,e.jsx)("option",{value:n.id,children:n.label||n.id},n.id))]})]})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Se,{k:"captureProvider",label:t("captureProvider")}),(0,e.jsx)(Se,{k:"captureModel",label:t("captureModel")})]}),(0,e.jsx)(b,{k:"captureFollowSession",label:t("captureFollowSession")}),(0,e.jsx)(b,{k:"captureFirstOnly",label:t("captureFirstOnly")}),(0,e.jsx)(Se,{k:"sessionBudgetChars",label:t("sessionBudgetChars"),type:"number"}),(0,e.jsx)("div",{style:{display:"flex",alignItems:"flex-end"},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!X,onClick:async()=>{$("llmtest");try{let n=await fetch(O+"/llm-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:k.captureProvider||"",model:k.captureModel||"",firstOnly:k.captureFirstOnly===!0})}).then(v=>v.json());n&&n.ok?Z(t("llmTestOk")+"\uFF1A"+n.route.provider+(n.route.model?"/"+n.route.model:"")+" \xB7 "+n.ms+"ms \xB7 "+t("llmCandidates")+" "+n.candidates):Z(t("llmTestFail")+"\uFF1A"+(n&&(n.failure?n.failure.code+" "+n.failure.message:n.error)||"?"),!1)}catch(n){Z(t("llmTestFail")+"\uFF1A"+String(n&&n.message||n),!1)}finally{$("")}},children:X==="llmtest"?t("exporting"):"\u{1F50C} "+t("llmTest")})})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t("auditMode")}),(0,e.jsxs)("select",{value:k.auditMode??"all",onChange:n=>Y("auditMode",n.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"all",children:t("auditAll")}),(0,e.jsx)("option",{value:"none",children:t("auditNone")})]})]}),(0,e.jsx)(Gt,{label:t("auditExemptAgents"),value:k.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(F?.agents||[]).filter(n=>!n.isDsh).map(n=>({value:n.name,label:n.name}))],onChange:n=>Y("auditExemptAgents",n)}),(0,e.jsx)(Gt,{label:t("auditExemptKinds"),value:k.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...At.filter(n=>n!=="all").map(n=>({value:n,label:t(Ke[n])}))],onChange:n=>Y("auditExemptKinds",n)}),(0,e.jsx)(Se,{k:"recycleRetentionDays",label:t("recycleDays"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px"},children:[(0,e.jsx)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E0} ",t("serviceConfig")]})}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8},children:[(0,e.jsx)(b,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:k.autoWebMode??"init",onChange:n=>Y("autoWebMode",n.target.value),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12},children:[(0,e.jsx)("option",{value:"init",children:t("modeInit")}),(0,e.jsx)("option",{value:"interval",children:t("modeInterval")}),(0,e.jsx)("option",{value:"manual",children:t("modeManual")})]})]}),(0,e.jsx)(Se,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(Se,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(Se,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(b,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(b,{k:"autoRestartOnDrift",label:t("autoRestartOnDrift")}),(0,e.jsx)(b,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[X==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),le&&X!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",le]}),G&&X!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",G]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:d,disabled:!!X,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:m?()=>Z(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):p,disabled:X==="save",title:t(m?"readonlyBody":"saveConfig"),children:X==="save"?"\u23F3 "+t("saving"):m?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function za({t,onReload:i,version:r}){let[g,c]=(0,o.useState)([]),[l,C]=(0,o.useState)([]),[T,S]=(0,o.useState)("all"),[H,k]=(0,o.useState)("all"),[x,m]=(0,o.useState)(""),[z,R]=(0,o.useState)(new Set),[w,j]=(0,o.useState)(""),[L,K]=(0,o.useState)(null),[te,V]=(0,o.useState)("pending"),F=(h,U=!0)=>{K({msg:h,ok:U}),setTimeout(()=>K(null),3e3)},Ie=[...new Set([...g,...l].map(h=>h.submittedBy).filter(Boolean))],G=(0,o.useCallback)(async()=>{try{let h=await fetch(`${O}/audit/list`).then(U=>U.json());h.ok&&(c(h.pending||[]),C(h.rejected||[]),R(new Set),he(new Set),ke({}))}catch{}},[]);(0,o.useEffect)(()=>{G()},[r,G]);let ge=(te==="pending"?g:l).filter(h=>{if(T!=="all"&&h.kind!==T||H!=="all"&&ut(h.submittedBy)!==H)return!1;if(x){let U=(h.created||"").slice(0,10);if(U&&U!==x)return!1}return!0}),X=h=>R(U=>{let re=new Set(U);return re.has(h)?re.delete(h):re.add(h),re}),$=async(h,U)=>{let re=U||[...z];if(!re.length){F(t("noSelection"),!1);return}j("apply");let ye=t(h==="approved"?"toastApproved":h==="rejected"?"toastRejected":"toastCardDeleted");try{let ee=0;for(let Z of re){let Be=h==="approved"?"audit/approve":h==="rejected"?"audit/reject":"delete";try{(await fetch(O+"/"+Be+"?path="+encodeURIComponent(Z)+(h==="delete"?"&permanent=0":""))).ok||ee++}catch{ee++}}await G(),i&&i(),ee?F(t("toastFailed")+"\uFF08"+ee+"/"+re.length+"\uFF09",!1):F(ye+" "+re.length+" \u5F20")}catch(ee){F(t("toastFailed")+": "+String(ee&&ee.message||ee),!1)}finally{j("")}},[le,he]=(0,o.useState)(new Set),[Ae,ke]=(0,o.useState)({}),y=h=>Ae[h]||{},ue=async h=>{let U=h.path,re=!le.has(U);if(he(ye=>{let ee=new Set(ye);return re?ee.add(U):ee.delete(U),ee}),!(!re||Ae[U])){ke(ye=>({...ye,[U]:{loading:!0}}));try{let ye=h.status||(te==="pending"?"pending":"rejected"),ee=await fetch(`${O}/card?path=${encodeURIComponent(U)}&status=${ye}`).then(Z=>Z.json());ee&&ee.ok?ke(Z=>({...Z,[U]:{text:ee.text||""}})):ke(Z=>({...Z,[U]:{error:ee&&ee.error||"HTTP"}}))}catch(ye){ke(ee=>({...ee,[U]:{error:String(ye&&ye.message||ye)}}))}}},Te=[...z];return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ta,{toast:L}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:T,onChange:h=>S(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),At.filter(h=>h!=="all").map(h=>(0,e.jsx)("option",{value:h,children:t(Ke[h])},h))]}),(0,e.jsxs)("select",{value:H,onChange:h=>k(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Qt(Ie).map(h=>(0,e.jsx)("option",{value:h,children:h},h))]}),(0,e.jsx)("input",{type:"date",value:x,onChange:h=>m(h.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("button",{type:"button",className:`mc-btn${te==="pending"?" me-on":""}`,onClick:()=>V("pending"),children:[t("pending"),"\uFF08",g.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${te==="rejected"?" me-on":""}`,onClick:()=>V("rejected"),children:[t("rejected"),"\uFF08",l.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:ge.length>0&&Te.length===ge.length,onChange:h=>{h.target.checked?R(new Set(ge.map(U=>U.path))):R(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!Te.length||!!w,onClick:()=>$("approved"),children:["\u2713 ",t(te==="rejected"?"restore":"approve")]}),te==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!Te.length||!!w,onClick:()=>$("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!Te.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&$("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),ge.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:ge.map(h=>{let U=y(h.path),re=le.has(h.path);return(0,e.jsxs)("div",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:z.has(h.path),onChange:()=>X(h.path)}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"0 6px"},title:t(re?"collapse":"expand"),"aria-expanded":re,onClick:()=>ue(h),children:re?"\u25BE":"\u25B8"}),(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[h.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},title:t(re?"collapse":"expand"),onClick:()=>ue(h),children:h.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ut(h.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:h.created?h.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:h.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:h.severity==="high"?"#f87171":"#9ca3af"},children:h.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.reason||"-"}),te==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>$("approved",[h.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>$("rejected",[h.path]),children:"\u2715"})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},title:t("restore"),onClick:()=>$("approved",[h.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},title:t("restoreDelete"),onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&$("delete",[h.path])},children:"\u{1F5D1}"})]})]}),re&&(0,e.jsxs)("div",{style:{padding:"2px 10px 12px 34px"},children:[U.loading&&(0,e.jsxs)("div",{style:{fontSize:12,opacity:.6},children:["\u23F3 ",t("loading")]}),U.error&&(0,e.jsxs)("div",{style:{fontSize:12,color:"#f87171"},children:["\u26A0 ",t("auditBodyFail"),"\uFF1A",U.error]}),U.text!=null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"md-meta",style:{marginBottom:6},children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:qe[h.kind]||"#6B7280",borderColor:(qe[h.kind]||"#6B7280")+"59",background:(qe[h.kind]||"#6B7280")+"1a"},children:[ht[h.kind]||"\u{1F4CE}"," ",t(Ke[h.kind]||"kindKnowledge")]}),(Array.isArray(h.tags)?h.tags:[]).slice(0,8).map(ye=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",ye]},ye)),!!h.reason&&(0,e.jsxs)("span",{className:"md-chip md-chip-st-warn",children:["\u2691 ",h.reason]})]}),(0,e.jsx)("div",{className:"md-doc",style:{maxHeight:340,overflow:"auto"},dangerouslySetInnerHTML:{__html:Dt(Ct(U.text).body)}}),te==="pending"&&(0,e.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!!w,onClick:()=>$("approved",[h.path]),children:["\u2713 ",t("approve")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!w,onClick:()=>$("rejected",[h.path]),children:["\u2715 ",t("reject")]})]})]})]})]},h.path)})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function Ia({t,onReload:i,version:r}){let[g,c]=(0,o.useState)([]),[l,C]=(0,o.useState)(""),[T,S]=(0,o.useState)(null),H=(m,z=!0)=>{S({msg:m,ok:z}),setTimeout(()=>S(null),3200)},k=(0,o.useCallback)(async()=>{try{let m=await fetch(`${O}/recycle/list`).then(z=>z.json());m.ok&&c(m.items||[])}catch{}},[]);(0,o.useEffect)(()=>{k()},[r,k]);let x=async(m,z)=>{let R=(g.find(w=>w.path===z)||{}).title||z;C(m+z);try{let j=await fetch(O+(m==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(z)),L=await j.json().catch(()=>null);await k(),i&&i(),j.ok&&(!L||L.ok!==!1)?H(t(m==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+R):H(t("toastFailed")+"\uFF1A"+(L&&L.error||"HTTP "+j.status),!1)}catch(w){H(t("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{C("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ta,{toast:T}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F5D1}\uFE0F ",t("tabRecycle")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("recycleHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!l||g.length===0,title:g.length?"":t("emptyRecycle"),onClick:async()=>{C("purgeAll");try{let m=await fetch(O+"/recycle/purge-expired?days=0"),z=await m.json().catch(()=>null);await k(),H(m.ok?t("toastPurgedExpired")+(z&&z.purged!=null?"\uFF08"+z.purged+"\uFF09":""):t("toastFailed"),m.ok)}catch(m){H(t("toastFailed")+"\uFF1A"+String(m&&m.message||m),!1)}finally{C("")}},children:t("emptyRecycle")})]}),g.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:g.map(m=>(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[m.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(m.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!l,onClick:()=>x("restore",m.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!l,onClick:()=>{window.confirm(t("purgeConfirm"))&&x("purge",m.path)},children:t("purge")})]},m.path))}):(0,e.jsxs)("div",{className:"mc-card",style:{padding:18,fontSize:12.5,opacity:.78,textAlign:"center",lineHeight:1.9},children:["\u{1F5D1}\uFE0F ",t("emptyRecycle"),(0,e.jsx)("br",{}),(0,e.jsx)("span",{style:{fontSize:11.5},children:t("recycleEmptyHint").split("{days}").join("30")})]})]})]})}var Aa=({card:t,t:i,onOpen:r,query:g,onDelete:c})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>r(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[t.kind]||qe.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:ht[t.kind]||"\u{1F4CE}"}),g?Xt(t.title,g):t.title,Wa(t.updated)&&(0,e.jsx)("span",{className:"mc-new",children:i("newBadge")}),t.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",i("statusPending")]}),t.status==="rejected"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#ef4444"},children:["\u274C ",i("statusRejected")]}),(!t.status||t.status==="approved")&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#10b981"},children:["\u2705 ",i("statusApproved")]})]}),(0,e.jsx)("p",{children:g?Xt(t.summary||"",g):t.summary||""}),Vt(t).length>0&&(0,e.jsx)("div",{className:"mc-tags",children:Vt(t).slice(0,4).map(l=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",l]},l))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[ht[t.kind]||"\u{1F4CE}"," ",i(Ke[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ut(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",pt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:i("delete"),onClick:l=>{l.stopPropagation(),window.confirm(i("deleteConfirm"))&&c&&c(t.path)},children:"\u{1F5D1}"})]})]});function Ba({t,tab:i,onReload:r,version:g}){let[c,l]=(0,o.useState)(null),[C,T]=(0,o.useState)(""),[S,H]=(0,o.useState)(null),[k,x]=(0,o.useState)(null),[m,z]=(0,o.useState)(null),[R,w]=(0,o.useState)(null),j=(0,o.useCallback)(async()=>{F("align");try{let s=await fetch(O+"/align").then(N=>N.json());s&&s.findings?w(s):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{F("")}},[t]),L=async()=>{if(window.confirm(t("alignFixConfirm"))){F("alignfix");try{let s=await fetch(O+"/setup-run",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(N=>N.json());s&&s.ok?(notify(t("alignFixed")),await j()):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{F("")}}},[K,te]=(0,o.useState)([]),[V,F]=(0,o.useState)(""),[Ie,G]=(0,o.useState)(!1),ge=(0,o.useCallback)(async()=>{if(!(!S||!S.merge||!S.merge.length)&&window.confirm(t("mergeAllConfirm"))){F("merge");try{let s={},N=ae=>s[ae]===void 0?ae:s[ae]=N(s[ae]),I=(ae,Y)=>{s[N(ae)]=N(Y)},Q=new Set;for(let ae of S.merge)Q.add(ae.a.path),Q.add(ae.b.path),I(ae.a.path,ae.b.path);let we={};for(let ae of Q){let Y=N(ae);(we[Y]=we[Y]||[]).push(ae)}let de=0;for(let ae of Object.values(we)){if(ae.length<2)continue;(await fetch(`${O}/merge?paths=${encodeURIComponent(ae.join(","))}`).then(We=>We.json())).ok&&de++}await X(),r&&r()}catch{}F("")}},[S,X,r,t]);async function X(){try{let s=await Promise.all([fetch(`${O}/stats`),fetch(`${O}/budget`),fetch(`${O}/capture-log`),fetch(`${O}/cards?status=all&limit=30&agent=${bt}`)]),[N,I,Q,we]=await Promise.all(s.map(de=>de.json()));N&&N.ok&&l(N),I&&I.ok&&x(I),Q&&Q.ok&&z(Q),we&&we.ok&&te(we.cards||[]),T(!N||!N.ok?t("adminLoadFail"):"")}catch{T(t("adminLoadFail"))}}let $=(0,o.useCallback)(async()=>{F("scan");try{let s=await fetch(`${O}/optimize`).then(N=>N.json());s.ok&&H(s)}catch{T(t("adminLoadFail"))}finally{F("")}},[t]),[le,he]=(0,o.useState)(null),Ae=(0,o.useCallback)(async()=>{F("refine");try{let s=await fetch(`${O}/refine-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:8})}).then(N=>N.json());s&&s.ok?he(s):notify(s&&s.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{F("")}},[t]),ke=async(s,N)=>{if(!(N==="merge"&&!window.confirm(t("mergeConfirm")))){F("refineapply");try{let I=await fetch(`${O}/refine-apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({a:s.a.path,b:s.b.path,action:N,relation:s.relation})}).then(Q=>Q.json());I&&I.ok?(notify(t("refineApplied")),he(Q=>Q&&{...Q,findings:(Q.findings||[]).filter(we=>!(we.a.path===s.a.path&&we.b.path===s.b.path))}),await X(),r&&r()):notify(I&&I.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{F("")}}},[y,ue]=(0,o.useState)(null),Te=(0,o.useCallback)(async()=>{F("junk");try{let s=await fetch(`${O}/refine-junk`).then(N=>N.json());s&&s.ok?ue(s.items||[]):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{F("")}},[t]),h=async s=>{if(s.length&&window.confirm(t("junkRecycleAllConfirm"))){F("junkpurge");try{let N=await fetch(`${O}/refine-junk-purge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:s})}).then(I=>I.json());N&&N.removed?(notify(t("junkDone")+"\uFF1A"+N.removed.length+(N.failed?.length?"\uFF08\u5931\u8D25 "+N.failed.length+"\uFF09":"")),ue(I=>I&&I.filter(Q=>!N.removed.includes(Q.path))),await X(),r&&r()):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{F("")}}},[U,re]=(0,o.useState)(null),ye=(0,o.useCallback)(async()=>{F("goals");try{let s=await fetch(O+"/refine-goals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:30})}).then(N=>N.json());s&&s.ok?re(s):notify(s&&s.error||t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{F("")}},[t]),ee=async s=>{F("goalskeep");try{let N=await fetch(O+"/refine-goals-keep",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:s.members.map(I=>I.path)})}).then(I=>I.json());N&&N.ok?(notify(t("goalDone")),re(I=>I&&{...I,clusters:(I.clusters||[]).filter(Q=>Q.goal!==s.goal)})):notify(t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{F("")}},Z=async s=>{if(window.confirm(t("mergeConfirm"))){F("goalsmerge");try{let N=await fetch(O+"/merge?paths="+encodeURIComponent(s.members.map(I=>I.path).join(","))).then(I=>I.json());N&&N.ok?(notify(t("goalMerged")),re(I=>I&&{...I,clusters:(I.clusters||[]).filter(Q=>Q.goal!==s.goal)}),await X(),r&&r()):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{F("")}}};(0,o.useEffect)(()=>{X()},[g]);let Be=async(s,N)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${O}/merge?paths=${encodeURIComponent(s+","+N)}`).then(Q=>Q.json())).ok&&(await X(),r&&r())}catch{}},Ce=async s=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${O}/delete?path=${encodeURIComponent(s)}`).then(I=>I.json())).ok&&(await X(),r&&r())}catch{}},Re=["project","knowledge","content","prompt","business","tool","mistake"],Ne=({title:s,kind:N,updated:I,path:Q})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[N]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(I)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Ce(Q),children:[t("delete")," \u2715"]})]});return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[C&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",C]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:X,children:["\u21BB ",t("retry")]})]}),i==="stats"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F527} ",t("alignTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:j,children:t(V==="align"?"exporting":"alignRun")}),R&&R.counts&&R.counts.fix>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:L,children:t(V==="alignfix"?"exporting":"alignFix")}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("alignHint")})]}),R&&R.findings?(0,e.jsxs)("div",{style:{marginTop:6},children:[(0,e.jsxs)("div",{style:{fontSize:12,opacity:.75,marginBottom:4},children:[t("alignDisk")," v",R.onDisk||"?",R.residentServed?" \xB7 "+t("alignResident")+" v"+R.residentServed:"",R.hostVersion?" \xB7 "+t("alignHost")+" v"+R.hostVersion:""]}),(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:R.findings.map((s,N)=>(0,e.jsxs)("li",{style:{padding:"4px 2px",borderTop:N?"1px solid rgba(127,127,127,0.12)":"none",fontSize:12},children:[(0,e.jsx)("span",{style:{fontWeight:700,color:s.level==="fix"?"#ef4444":s.level==="warn"?"#f59e0b":"#10b981"},children:s.level==="fix"?"\u2717":s.level==="warn"?"\u26A0":"\u2713"})," ",(0,e.jsx)("span",{children:s.title}),s.detail?(0,e.jsx)("div",{style:{opacity:.75,marginLeft:14},children:s.detail}):null,s.command?(0,e.jsxs)("div",{style:{marginLeft:14,opacity:.9},children:["\u2192 ",(0,e.jsx)("code",{children:s.command})]}):null]},N))})]}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginTop:4},children:t("alignIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1FAB5} ",t("captureLog")]}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("captureLogHint")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>X(),children:["\u21BB ",t("refresh")]})]}),m?m.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(m.entries||[]).length===0?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogEmpty")}):(0,e.jsx)("div",{style:{maxHeight:260,overflow:"auto",marginTop:8},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:(0,e.jsx)("tbody",{children:(m.entries||[]).map((s,N)=>{let I=Sa[s.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:pt(s.time?new Date(s.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:I[1],fontWeight:600},children:[I[0]," ",s.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:s.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.preview||"",children:s.preview||""})]},N)})})})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("loading")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:["\u{1F916} ",t("captureAgentCards"),"\uFF08",K.length,"\uFF09"]}),K.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:K.map(s=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:qe[s.kind]||qe.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.title}),s.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(s.updated)})]},s.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),c&&(0,e.jsxs)(e.Fragment,{children:[c.trend&&c.trend.length>0&&(()=>{let s=c.trend,N=Math.max(...s.map(de=>de.count),1),I=260,Q=50,we=I/s.length;return(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"10px 14px"},children:[(0,e.jsxs)("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["\u{1F4C8} ",t("trendLabel")]}),(0,e.jsx)("svg",{width:I,height:Q,style:{display:"block",width:"100%",height:50},children:s.map((de,ae)=>{let Y=Math.round(de.count/N*(Q-4));return(0,e.jsx)("rect",{x:ae*we+1,y:Q-Y,width:Math.max(we-2,2),height:Y,rx:1.5,fill:de.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:de.count>0?.85:.35},de.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:c.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:c.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:c.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:c.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:Re.map(s=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[s]||"#666"}}),t(Ke[s]),": ",c.byKind?.[s]||0]},s))})]}),k&&(k.budgetChars||k.recallLimit||k.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:k.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:k.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",k.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",c.todayCards?.length||0,"\uFF09"]}),c.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:c.todayCards.map(s=>(0,e.jsx)(Ne,{title:s.title,kind:s.kind,updated:s.updated,path:s.path},s.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})]})]}),i==="optimize"&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("organizeTitle")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:$,children:V==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),S&&S.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){F("oneclick");try{let s=JSON.stringify({cleanupStale:Ie}),I=await(await fetch(`${O}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:s})).json();I&&I.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${I.plan.merged} ${t("optimizedMerged")}${Ie?` \xB7 ${I.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await X(),r&&r(),H(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{F("")}}},children:V==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),S&&S.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:Ie,onChange:s=>G(s.target.checked)}),t("oneClickAlsoStale")]})]}),!S&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),S&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("mergePairs")}),(0,e.jsx)("div",{className:"spacer",style:{flex:1}}),S.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:ge,children:t(V==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),S.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:S.merge.map((s,N)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)",fontSize:12},children:[(0,e.jsxs)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[s.a.title," \u21C4 ",s.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(s.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Be(s.a.path,s.b.path),children:t("mergeNow")})]},N))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:t("noOptimize")}),(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("staleCards"),"\uFF08",S.stale?.length||0,"\uFF09"]}),S.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!V,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;F("clean");let s=0;for(let N of S.stale)try{await fetch(`${O}/delete?path=${encodeURIComponent(N.path)}`),s++}catch{}F(""),notify(`${s} ${t("deletedStale")}`),await X(),r&&r()},children:t("cleanStale")})}),S.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:S.stale.map(s=>(0,e.jsx)(Ne,{title:s.title,kind:"other",updated:s.updated,path:s.path},s.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9ED} ",t("refineTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:Ae,children:t(V==="refine"?"exporting":"refineScan")}),(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("refineHint")})]}),le?.findings?.length?le.findings.map((s,N)=>(0,e.jsxs)("div",{style:{borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",padding:"7px 2px"},children:[(0,e.jsxs)("div",{style:{fontSize:12,marginBottom:3},children:[(0,e.jsx)("span",{style:{fontWeight:700,color:s.relation==="conflict"?"#ef4444":s.relation==="duplicate"?"#f59e0b":"#10b981"},children:t("refineRel_"+s.relation)}),(0,e.jsxs)("span",{style:{opacity:.55},children:[" \xB7 sim ",s.sim," \xB7 ",s.useModel||""]}),s.conflict?(0,e.jsx)("span",{style:{marginLeft:6},children:s.conflict}):null]}),(0,e.jsxs)("div",{style:{fontSize:12,opacity:.85,marginBottom:5},children:["A\uFF1A",s.a.title,(0,e.jsx)("br",{}),"B\uFF1A",s.b.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>ke(s,"keepA"),children:t("refineKeepA")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>ke(s,"keepB"),children:t("refineKeepB")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>ke(s,"keepBoth"),children:t("refineKeepBoth")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>ke(s,"merge"),children:t("refineMerge")})]})]},N)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(le?"refineNone":"refineIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F9F9} ",t("junkTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:Te,children:t(V==="junk"?"exporting":"junkScan")}),y?.length?(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:()=>h(y.map(s=>s.path)),children:t(V==="junkpurge"?"exporting":"junkRecycleAll")}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("junkHint")})]}),y?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:y.map((s,N)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 2px",borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",fontSize:12},children:[(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.reasons.join("\uFF1B"),children:s.title||s.path}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:s.reasons[0]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>h([s.path]),children:t("junkRecycle")})]},N))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(y?"junkNone":"junkIdle")})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginBottom:6},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("goalTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:ye,children:t(V==="goals"?"exporting":"goalScan")}),U?(0,e.jsxs)("span",{style:{opacity:.6,fontSize:11},children:[t("goalStats"),"\uFF1A",U.cached," / ",U.calls]}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("goalHint")})]}),U?.clusters?.length?U.clusters.map((s,N)=>(0,e.jsxs)("div",{style:{borderTop:N?"1px solid rgba(127,127,127,0.14)":"none",padding:"7px 2px"},children:[(0,e.jsxs)("div",{style:{fontSize:12,marginBottom:4},children:[(0,e.jsx)("b",{children:s.goal})," ",(0,e.jsxs)("span",{style:{opacity:.55},children:["\xB7 ",s.members.length," ",t("goalCards")]})]}),(0,e.jsx)("ul",{style:{margin:"0 0 5px",padding:"0 0 0 16px",fontSize:12,opacity:.85},children:s.members.map((I,Q)=>(0,e.jsx)("li",{children:I.title},Q))}),(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>ee(s),children:t("goalKeep")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>Z(s),children:t("goalMerge")})]})]},N)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(U?"goalNone":"goalIdle")})]})]})]})]})}var It=[{key:"decision",label:"tplDecision",kind:"knowledge",tagKey:"tplDecisionTags",bodyKey:"tplDecisionBody"},{key:"bug",label:"tplBug",kind:"mistake",tagKey:"tplBugTags",bodyKey:"tplBugBody"},{key:"meeting",label:"tplMeeting",kind:"content",tagKey:"tplMeetingTags",bodyKey:"tplMeetingBody"},{key:"weekly",label:"tplWeekly",kind:"content",tagKey:"tplWeeklyTags",bodyKey:"tplWeeklyBody"}];function La({t,newCard:i,setNewCard:r,onCreated:g}){if(!i)return null;let c=It.find(x=>x.key===i.template),l=i.body||(c?t(c.bodyKey):""),C=i.kind||(c?c.kind:"knowledge"),T=i.tags||(c?t(c.tagKey):""),S=i._creating,H=x=>{let m=It.find(z=>z.key===x);r(z=>({...z,template:x,kind:m?m.kind:z.kind,body:m?t(m.bodyKey):z.body,tags:m?t(m.tagKey):z.tags}))},k=async()=>{if(!(!i.title&&!l)){r(x=>({...x,_creating:!0}));try{(await fetch(`${O}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i.title||t("untitled"),kind:C,tags:T.split(",").map(m=>m.trim()).filter(Boolean),body:l,source:"manual"})}).then(m=>m.json())).ok?(r(null),g&&g()):r(m=>({...m,_creating:!1}))}catch{r(m=>({...m,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>r(null),children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:x=>x.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>r(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[It.map(x=>(0,e.jsx)("button",{type:"button",className:`mc-btn${i.template===x.key?" me-on":""}`,onClick:()=>H(x.key),children:t(x.label)},x.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${i.template===""?" me-on":""}`,onClick:()=>r(x=>({...x,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:C,onChange:x=>r(m=>({...m,kind:x.target.value})),style:{maxWidth:180,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:["project","knowledge","content","prompt","business","tool","mistake"].map(x=>(0,e.jsx)("option",{value:x,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:x},x))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:i.title||"",onChange:x=>r(m=>({...m,title:x.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:T,onChange:x=>r(m=>({...m,tags:x.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:l,onChange:x=>r(m=>({...m,body:x.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:S,onClick:k,children:t(S?"exporting":"createCard")})})]})]})]})}async function Yt(t){let i=String(t||"");if(!i)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(i),!0}catch{}try{let r=document.createElement("textarea");r.value=i,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();let g=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(r),g}catch{return!1}}function ja({t,onClose:i}){let[r,g]=(0,o.useState)(""),[c,l]=(0,o.useState)(""),[C,T]=(0,o.useState)(""),[S,H]=(0,o.useState)(!0),[k,x]=(0,o.useState)(!1),[m,z]=(0,o.useState)(""),[R,w]=(0,o.useState)(""),j=(0,o.useRef)(null),L=(0,o.useRef)(null),K=()=>{let $=j.current;if($)try{$.focus(),$.select()}catch{}},te=$=>{z($),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>z(""),2400)};(0,o.useEffect)(()=>{let $=!0;return fetch(O+"/diagnostics").then(le=>le.json()).then(le=>{$&&(le&&le.ok?(l(String(le.diagnostics||"")),T(String(le.version||""))):x(!0))}).catch(()=>{$&&x(!0)}).finally(()=>{$&&H(!1)}),()=>{$=!1}},[]),(0,o.useEffect)(()=>{let $=le=>{le.key==="Escape"&&i()};return window.addEventListener("keydown",$),()=>{window.removeEventListener("keydown",$),L.current&&clearTimeout(L.current)}},[i]);let V=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),F=()=>{let $=r.trim().split(`
306
+ `)[0]||"",le=Et({title:"[Bug] "+($.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Wt({description:r,diagnostics:c,version:C})});try{window.open(le,"_blank","noopener")}catch{te(t("fbCopyFail"))}},Ie=async()=>{await Yt(c)?(w(""),te(t("fbCopiedDiag"))):(w(c),te(t("fbCopyManual")))},G=async()=>{let $=$t({lang:V,description:r,diagnostics:c});await Yt($)?(w(""),te(t("fbCopiedPrompt"))):(w($),te(t("fbCopyManual")))},ge={width:"100%",resize:"vertical",padding:"8px 10px",borderRadius:10,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:13},X={margin:0,maxHeight:170,overflow:"auto",fontSize:11.5,lineHeight:1.55,padding:"8px 10px",borderRadius:10,background:"var(--dsw-alias-bg-layer-1, rgba(127,127,127,0.08))",whiteSpace:"pre-wrap"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:i,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:$=>$.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:i,children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,e.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:t("fbWhy")}),(0,e.jsx)("textarea",{value:r,onChange:$=>g($.target.value),placeholder:t("fbDesc"),rows:5,style:ge}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("fbDiag")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:Ie,disabled:!c,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:X,children:S?t("fbLoading"):k?t("fbDiagFail"):c})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!r.trim()){te(t("fbNeedDesc"));return}F()},style:{borderColor:"var(--dsw-alias-brand-primary, #3b82f6)",color:"var(--dsw-alias-brand-primary, #3b82f6)",fontWeight:600},children:["\u{1F680} ",t("fbOpenIssue")]}),(0,e.jsx)("span",{style:{opacity:.5,fontSize:12},children:t("fbOr")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:G,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),m&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:m}),R&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[(0,e.jsxs)("b",{style:{fontSize:12,color:"#b45309"},children:["\u26A0 ",t("fbCopyFail")]}),(0,e.jsx)("span",{style:{fontSize:11.5,opacity:.75},children:t("fbCopyManual")}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:K,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:j,readOnly:!0,value:R,rows:7,style:ge})]})]})]})]})}function Fa({t,card:i,query:r,onClose:g,onDelete:c,onFeedback:l}){(0,o.useEffect)(()=>{let j=L=>{L.key==="Escape"&&g()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[g]);let{meta:C,body:T}=(0,o.useMemo)(()=>Ct(i.text||""),[i.text]),S=j=>{let L=C.find(([K])=>String(K).toLowerCase()===j);return L?L[1]:""},H=Ot(S("tags")),k=S("kind")||"knowledge",x=(S("status")||"approved").toLowerCase(),m=qe[k]||"#6B7280",z=(T||"").length>460,[R,w]=(0,o.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:g,children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",onClick:j=>j.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:ht[k]||"\u{1F4CE}"}),i.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>l&&l(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>l&&l(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),z&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":R,onClick:()=>w(j=>!j),children:t(R?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&c&&c(i.path)},children:t("delete")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:g,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:m,borderColor:m+"59",background:m+"1a"},children:[ht[k]||"\u{1F4CE}"," ",t(Ke[k]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(x==="approved"?"md-chip-st-ok":x==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[x==="approved"?"\u2705":x==="pending"?"\u23F3":"\u26D4"," ",t(x==="approved"?"statusApproved":x==="pending"?"statusPending":"statusRejected")]}),(Array.isArray(H)?H:[]).slice(0,8).map(j=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",j]},j)),!!S("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",pt(S("updated"))]}),!!S("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",S("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:R?{}:{maxHeight:300,overflow:"hidden"},onClick:R?void 0:j=>{j.stopPropagation(),w(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Dt(T)}})}),!R&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:j=>{j.stopPropagation(),w(!0)},children:[t("expand")," \u2304"]})]})]})}function Pa({t,onOpen:i,all:r,onAllChange:g,onMutate:c,active:l,visible:C}){let[T,S]=(0,o.useState)(null),[H,k]=(0,o.useState)(""),x=(0,o.useRef)(!1),m=(0,o.useRef)(0),z=(0,o.useRef)(t);z.current=t;let R=(0,o.useCallback)(async()=>{try{x.current=!1;let K=await(await fetch(`${O}/graph${r?"?all=1":""}`)).json();K.ok?(S(K),k(""),x.current=!0):(S(null),k(K.error||t("error")))}catch(L){k(String(L&&L.message?L.message:L))}},[r,t]);(0,o.useEffect)(()=>{if(!l||x.current)return;let L=!0;return fetch(`${O}/graph${r?"?all=1":""}`).then(K=>K.json()).then(K=>{L&&(K.ok?(S(K),k(""),x.current=!0):(S(null),k(K.error||t("error"))))}).catch(K=>{L&&k(String(K&&K.message?K.message:K))}),()=>{L=!1}},[r,t,l]),(0,o.useEffect)(()=>{C&&T&&m.current++},[C,T]);let w=(0,o.useCallback)(async L=>{try{let te=await(await fetch(`${O}/delete?path=${encodeURIComponent(L)}`)).json();return te&&te.ok?(await R(),c&&c(),!0):!1}catch{return!1}},[R]),j=(0,o.useCallback)(async L=>{if(!L||L.length<2)return!1;try{let K=await fetch(`${O}/merge?paths=${encodeURIComponent(L.join(","))}`).then(te=>te.json());return K&&K.ok?(await R(),c&&c(),!0):!1}catch{return!1}},[R,c]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Ee}),H&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",H]}),!T&&!H&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),T&&T.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),T&&T.nodes.length>0&&(0,e.jsx)(Oa,{nodes:T.nodes,edges:T.edges,onOpen:i,onDelete:w,onMerge:j,t,all:r,onAllChange:g,countLabel:`${T.nodes.length} ${t("nodes")} \xB7 ${Ha(T.edges)} ${t("edges")}`,fitTrigger:m.current})]})}function Ha(t){let i=new Set;for(let r of t||[])i.add([r.source,r.target].sort().join("|"));return i.size}var ct={colors:{project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},shapes:{project:"circle",knowledge:"circle",content:"rect",prompt:"diamond",business:"hexagon",tool:"circle",mistake:"diamond",other:"circle"}};function Oa({nodes:t,edges:i,onOpen:r,onDelete:g,onMerge:c,t:l,countLabel:C,all:T,onAllChange:S,fitTrigger:H}){let k=(0,o.useRef)(null),x=(0,o.useRef)(null),m=(0,o.useRef)(null),z=(0,o.useRef)(null),R=(0,o.useRef)(null),w=(0,o.useRef)(r);(0,o.useEffect)(()=>{w.current=r},[r]);let j=(0,o.useRef)(g);(0,o.useEffect)(()=>{j.current=g},[g]);let L=(0,o.useRef)(c);(0,o.useEffect)(()=>{L.current=c},[c]);let[K,te]=(0,o.useState)(""),[V,F]=(0,o.useState)(null),Ie=(0,o.useRef)("");(0,o.useEffect)(()=>{Ie.current=K.trim().toLowerCase()},[K]),(0,o.useEffect)(()=>{let p=m.current;if(!p)return;let d=K.trim().toLowerCase();if(!d)return;let _=p.nodes.find(se=>(se.name||"").toLowerCase().includes(d));_&&(m.current.selectedId=_.id,F(_.id),p.panX=p.w/2-_.x*p.zoom,p.panY=p.h/2-_.y*p.zoom,p.render&&p.render())},[K]);let[G,ge]=(0,o.useState)("all"),[X,$]=(0,o.useState)(!1),le=(0,o.useRef)("all"),[he,Ae]=(0,o.useState)(""),ke=(0,o.useRef)(""),[y,ue]=(0,o.useState)(!1),Te=(0,o.useRef)(!1),[h,U]=(0,o.useState)(null);(0,o.useEffect)(()=>{le.current=G},[G]),(0,o.useEffect)(()=>{ke.current=he},[he]),(0,o.useEffect)(()=>{Te.current=y},[y]);let re=(0,o.useMemo)(()=>{let p=new Map;for(let d of t)for(let _ of d.tags||[]){let se=String(_).trim();se&&p.set(se,(p.get(se)||0)+1)}return[...p.entries()].sort((d,_)=>_[1]-d[1]).slice(0,24).map(([d,_])=>({tag:d,n:_}))},[t]),ye=(()=>{let p=K.trim().toLowerCase();return!!p&&!t.some(d=>(d.title||d.name||"").toLowerCase().includes(p)||String(d.kind||"").toLowerCase().includes(p)||String(Ke[d.kind]||"").toLowerCase().includes(p))})();(0,o.useEffect)(()=>{let p=m.current;p&&p.wake&&p.wake()},[K]),(0,o.useEffect)(()=>{let p=m.current;p&&p.render&&p.render()},[G,he,y]);let ee=(0,o.useRef)(null),[Z,Be]=(0,o.useState)([]),[Ce,Re]=(0,o.useState)(null),[Ne,s]=(0,o.useState)(!1),[N,I]=(0,o.useState)(null),[Q,we]=(0,o.useState)(""),de=(0,o.useRef)(null),ae=(0,o.useRef)(null),Y=(p,d=!0)=>{de.current&&clearTimeout(de.current),I({msg:p,ok:d}),de.current=setTimeout(()=>I(null),1900)},We=p=>{we(p),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>we(""),1600)};(0,o.useEffect)(()=>()=>{de.current&&clearTimeout(de.current),ae.current&&clearTimeout(ae.current)},[]);let Le=(0,o.useMemo)(()=>t.reduce((p,d)=>(p[d.id]=d,p),{}),[t]);return(0,o.useEffect)(()=>{let p=k.current;if(!p||t.length===0)return;let d=p.getContext("2d");if(!d)return;let _=Math.max(1,window.devicePixelRatio||1),se=()=>document.documentElement.getAttribute("data-theme")==="dark",ce={};i.forEach(u=>{ce[u.source]=(ce[u.source]||0)+1,ce[u.target]=(ce[u.target]||0)+1});let fe=Math.max(1,...Object.values(ce)),a={nodes:t.map(u=>({id:u.id,name:u.title||"",type:u.kind||"other",r:9+Math.min(10,(ce[u.id]||0)/fe*8),x:0,y:0,vx:0,vy:0})),edges:i.map(u=>({sourceNodeId:u.source,targetNodeId:u.target,weight:1})),panX:0,panY:0,zoom:1,running:!0,raf:0,tickCount:0,quietTicks:0,dragNode:null,selectedId:null,mouseX:0,mouseY:0,w:0,h:0,dpr:_,ctx:d,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((u,A)=>(u[A.id]=A,u),{}),a.nodes.forEach((u,A)=>{let M=A/a.nodes.length*Math.PI*2-Math.PI/2;u.x=Math.cos(M)*60,u.y=Math.sin(M)*60});let Fe=[...new Set(a.nodes.map(u=>u.type))];a.clustered=Fe.length>1,a.typeCenters={},Fe.forEach((u,A)=>{let M=A/Fe.length*Math.PI*2-Math.PI/2;a.typeCenters[u]={x:Math.cos(M)*160,y:Math.sin(M)*160}}),m.current=a;let Je=0,et=0,at=()=>{let u=p.clientWidth,A=p.clientHeight;a.w=u,a.h=A,p.width=u*_,p.height=A*_,d.setTransform(_,0,0,_,0,0),(Je===0||et===0)&&u>0&&A>0&&a.tickCount>0&&requestAnimationFrame(()=>v()),Je=u,et=A};at();let nt=new ResizeObserver(at);nt.observe(p.parentElement);let Se=(u,A)=>u&&u.length>A?u.slice(0,A)+"\u2026":u,Ze=(u,A,M,P)=>{if(d.beginPath(),P==="rect")d.rect(u-M,A-M*.75,M*2,M*1.5);else if(P==="diamond")d.moveTo(u,A-M),d.lineTo(u+M,A),d.lineTo(u,A+M),d.lineTo(u-M,A),d.closePath();else if(P==="hexagon"){for(let q=0;q<6;q++){let pe=Math.PI/3*q-Math.PI/2,ne=u+M*Math.cos(pe),ze=A+M*Math.sin(pe);q===0?d.moveTo(ne,ze):d.lineTo(ne,ze)}d.closePath()}else d.arc(u,A,M,0,Math.PI*2)},b=new Map,n=(u,A)=>{let M=u+"|"+Math.round(A),P=b.get(M);if(!P){let q=parseInt(u.slice(1,3),16),pe=parseInt(u.slice(3,5),16),ne=parseInt(u.slice(5,7),16);P=d.createRadialGradient(-A*.3,-A*.3,0,0,0,A*1.2),P.addColorStop(0,"rgba("+Math.min(255,q+70)+","+Math.min(255,pe+70)+","+Math.min(255,ne+70)+",0.95)"),P.addColorStop(1,u),b.set(M,P)}return P},v=()=>{if(!a.nodes.length)return;let u=1/0,A=-1/0,M=1/0,P=-1/0;a.nodes.forEach($e=>{u=Math.min(u,$e.x),A=Math.max(A,$e.x),M=Math.min(M,$e.y),P=Math.max(P,$e.y)});let q=20,pe=A-u+q*2,ne=P-M+q*2,ze=Math.min(a.w/pe,a.h/ne);a.zoom=Math.max(.35,Math.min(1.8,ze)),a.panX=a.w/2-(u+A)/2*a.zoom,a.panY=a.h/2-(M+P)/2*a.zoom};z.current=v;let D=()=>{d.clearRect(0,0,a.w,a.h),a.searchTerm=Ie.current,a.kindFilter=le.current,a.timeMode=Te.current,a.tagFilter=ke.current;let u=a.tagFilter,A=a.kindFilter,M=f=>String(f||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");d.save(),d.strokeStyle=se()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",d.lineWidth=.5;for(let f=0;f<a.w;f+=24)d.beginPath(),d.moveTo(f,0),d.lineTo(f,a.h),d.stroke();for(let f=0;f<a.h;f+=24)d.beginPath(),d.moveTo(0,f),d.lineTo(a.w,f),d.stroke();d.restore(),d.save(),d.translate(a.panX,a.panY),d.scale(a.zoom,a.zoom);let P={};a.nodes.forEach(f=>P[f.id]=f);let q=a.nodes.length>40,pe=q?1.5:.55,ne=a.selectedId||a.hoverId,ze=_t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),$e=(()=>{let f=(a.searchTerm||"").toLowerCase();if(!f)return null;let oe=[];for(let ie of a.nodes){let Me=(a.domainById[ie.id]||{}).kind||"other";if(((ie.name||"").toLowerCase().includes(f)||String(Ke[Me]||"").toLowerCase().includes(f)||String(Me).toLowerCase().includes(f))&&oe.push(ie.id),oe.length>200)break}return oe})(),ot=Kt(a.nodes,{limit:Ut(a.nodes.length),focusId:ne,hoverId:a.hoverId,searchHits:$e,degree:ce}),me=new Map,xe=(f,oe)=>{let ie=f+"|"+oe,be=me.get(ie);return be===void 0&&(d.font=f,be=d.measureText(oe).width,me.set(ie,be)),be},He=a.nodes.length<=250,_e=new Map;a.edges.forEach(f=>{let oe=P[f.sourceNodeId],ie=P[f.targetNodeId];if(!oe||!ie||!Nt(oe.x,oe.y,10,ze)&&!Nt(ie.x,ie.y,10,ze))return;if(A!=="all"){let lt=a.domainById[f.sourceNodeId]&&a.domainById[f.sourceNodeId].kind,Xe=a.domainById[f.targetNodeId]&&a.domainById[f.targetNodeId].kind;if(lt!==A&&Xe!==A)return}if(u){let lt=a.domainById[f.sourceNodeId]&&(a.domainById[f.sourceNodeId].tags||[]).includes(u),Xe=a.domainById[f.targetNodeId]&&(a.domainById[f.targetNodeId].tags||[]).includes(u);if(!lt&&!Xe)return}let be=ie.x-oe.x,Me=ie.y-oe.y,je=Math.sqrt(be*be+Me*Me)||1,Qe=q?12:18,tt=-Me/je*Qe,xt=be/je*Qe,kt=(oe.x+ie.x)/2+tt,wt=(oe.y+ie.y)/2+xt,mt=ct.colors[a.domainById[oe.id]&&a.domainById[oe.id].kind||"other"],gt=ne&&(f.sourceNodeId===ne||f.targetNodeId===ne),Mt=ne?gt?.6:.08:q?.14:.24,Ge=parseInt(mt.slice(1,3),16),ft=parseInt(mt.slice(3,5),16),Rt=parseInt(mt.slice(5,7),16),Ve=gt?1.6+(f.weight||1):.8+(f.weight||1)*.5,it=Ge+","+ft+","+Rt+","+Mt+","+Ve,Ue=_e.get(it);Ue||(Ue={path:new Path2D,stroke:"rgba("+Ge+","+ft+","+Rt+","+Mt+")",width:Ve},_e.set(it,Ue)),Ue.path.moveTo(oe.x,oe.y),Ue.path.quadraticCurveTo(kt,wt,ie.x,ie.y)}),_e.forEach(f=>{d.strokeStyle=f.stroke,d.lineWidth=f.width,d.stroke(f.path)});let Oe=null;ne&&(Oe=new Set,a.edges.forEach(f=>{f.sourceNodeId===ne?Oe.add(f.targetNodeId):f.targetNodeId===ne&&Oe.add(f.sourceNodeId)}));let Ye=[];if(a.nodes.forEach(f=>{if(!Nt(f.x,f.y,f.r+2,ze))return;let oe=a.domainById[f.id]||{},ie=oe.kind||"other",be=a.timeMode?Ea(oe.updated):ct.colors[ie],Me=ct.shapes[ie],je=a.selectedId===f.id,Qe=a.hoverId===f.id,tt=a.searchTerm||"",xt=!tt||(f.name||"").toLowerCase().includes(tt)||String(Ke[ie]||"").toLowerCase().includes(tt)||String(ie).toLowerCase().includes(tt),kt=A==="all"||ie===A,wt=!u||(oe.tags||[]).includes(u),mt=ne&&f.id!==ne&&!(Oe&&Oe.has(f.id))||tt&&!xt||!kt||!wt;d.save(),d.globalAlpha=mt?.08:1,(je||Qe)&&He&&(d.shadowColor=be,d.shadowBlur=je?20:14),d.translate(f.x,f.y),Ze(0,0,f.r,Me),d.fillStyle=n(be,f.r),d.fill(),d.restore(),je?(d.save(),Ze(f.x,f.y,f.r+3,Me),d.strokeStyle=be,d.lineWidth=3,d.shadowColor=be,d.shadowBlur=12,d.stroke(),d.restore()):Qe?(d.save(),Ze(f.x,f.y,f.r+2,Me),d.strokeStyle=be,d.lineWidth=2,d.stroke(),d.restore()):tt&&xt?(d.save(),Ze(f.x,f.y,f.r+2,Me),d.strokeStyle="#e11d48",d.lineWidth=2,d.stroke(),d.restore()):a.multi.indexOf(f.id)>=0&&(d.save(),Ze(f.x,f.y,f.r+2,Me),d.strokeStyle="#60a5fa",d.lineWidth=2,d.shadowColor="#60a5fa",d.shadowBlur=8,d.stroke(),d.restore());let gt=Se(f.name,16);if((je||Qe||ot.has(f.id)&&a.zoom>pe||!q&&a.zoom>.6)&&kt&&wt){let Ge=1/a.zoom,ft="500 "+(12*Ge).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";d.font=ft;let Ve=xe(ft,gt)+16*Ge,it=18*Ge,Ue=f.y+f.r+8*Ge,lt=!0;for(let Xe of Ye)if(f.x-Ve/2<Xe.x+Xe.w&&f.x+Ve/2>Xe.x&&Ue<Xe.y+Xe.h&&Ue+it>Xe.y){lt=!1;break}if(!lt&&!je&&!Qe)return;Ye.push({x:f.x-Ve/2,y:Ue,w:Ve,h:it}),d.fillStyle=se()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",d.beginPath(),d.roundRect?d.roundRect(f.x-Ve/2,Ue,Ve,it,4*Ge):d.rect(f.x-Ve/2,Ue,Ve,it),d.fill(),d.strokeStyle=se()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",d.lineWidth=1*Ge,d.stroke(),d.fillStyle=se()?je||Qe?"#eee":"#bbb":je||Qe?"#111":"#444",d.textAlign="center",d.fillText(gt,f.x,Ue+13*Ge)}}),d.restore(),a.marquee){let f=a.marquee,oe=Math.min(f.sx,f.ex),ie=Math.min(f.sy,f.ey),be=Math.abs(f.ex-f.sx),Me=Math.abs(f.ey-f.sy);d.save(),d.setLineDash([4,4]),d.strokeStyle="rgba(96,165,250,0.9)",d.lineWidth=1,d.fillStyle="rgba(96,165,250,0.12)",d.fillRect(oe,ie,be,Me),d.strokeRect(oe,ie,be,Me),d.restore()}if(a.hoverId&&ee.current){let f=a.domainById[a.hoverId],oe=a.nodes.find(function(ie){return ie.id===a.hoverId});if(f&&oe){let ie=a.edges.filter(function(je){return je.sourceNodeId===f.id||je.targetNodeId===f.id}).length,be=oe.x*a.zoom+a.panX,Me=oe.y*a.zoom+a.panY;ee.current.style.display="block",ee.current.style.left=be+14+"px",ee.current.style.top=Me-6+"px",ee.current.innerHTML="<b>"+M(f.title||f.name||"")+'</b><br/><span style="opacity:.8">'+M(f.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",ie)+"</span>"}}else ee.current&&(ee.current.style.display="none")},B=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(W))};a.wake=B,a.render=D;let E=()=>{let u=a.nodes.length;a.tickCount++;let M=.9-Math.min(.4,a.tickCount/1500),P=u>1e3?3e3:u>100?2e3:u>50?1200:800,q=u>100?.002:.005,pe=u>1e3?.012:u>100?.005:.01,ne=u>1e3?6:u>200?12:24,ze={};a.nodes.forEach(me=>ze[me.id]=me);for(let me=0;me<u;me++){if(a.dragNode===a.nodes[me])continue;let xe=a.nodes[me],He=0,_e=0;for(let f=0;f<u;f++){if(me===f)continue;let oe=xe.x-a.nodes[f].x,ie=xe.y-a.nodes[f].y,be=Math.sqrt(oe*oe+ie*ie)||1,Me=P/(be*be);He+=oe/be*Me,_e+=ie/be*Me}if(a.clustered&&a.typeCenters[xe.type]){let f=a.typeCenters[xe.type];He+=(f.x-xe.x)*.006,_e+=(f.y-xe.y)*.006}else He-=xe.x*pe,_e-=xe.y*pe;let Oe=(xe.vx+He)*M,Ye=(xe.vy+_e)*M;Oe=Math.max(-ne,Math.min(ne,Oe)),Ye=Math.max(-ne,Math.min(ne,Ye)),xe.vx=Oe,xe.vy=Ye}a.edges.forEach(me=>{let xe=ze[me.sourceNodeId],He=ze[me.targetNodeId];if(!xe||!He)return;let _e=He.x-xe.x,Oe=He.y-xe.y,Ye=Math.sqrt(_e*_e+Oe*Oe)||1,f=(Ye-100)*q,oe=_e/Ye*f,ie=Oe/Ye*f;a.dragNode!==xe&&(xe.vx+=oe,xe.vy+=ie),a.dragNode!==He&&(He.vx-=oe,He.vy-=ie)});let $e=0;a.nodes.forEach(me=>{a.dragNode!==me&&(me.x+=me.vx,me.y+=me.vy,$e+=me.vx*me.vx+me.vy*me.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,v()),(u?Math.sqrt($e/u):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},W=()=>{if(a.running){try{E(),D()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(W)}},J=(u,A)=>{let M=p.getBoundingClientRect();return{x:(u-M.left-a.panX)/a.zoom,y:(A-M.top-a.panY)/a.zoom}},ve=u=>{let A=a.domainById[u];return!(!A||le.current!=="all"&&A.kind!==le.current||ke.current&&!(A.tags||[]).includes(ke.current))},De=(u,A,M)=>Math.max(A,Math.min(M,u)),Pe=u=>{a.mouseX=u.clientX,a.mouseY=u.clientY;let A=J(u.clientX,u.clientY),M=null;for(let P=a.nodes.length-1;P>=0;P--){let q=a.nodes[P];if(!ve(q.id))continue;let pe=q.x-A.x,ne=q.y-A.y;if(pe*pe+ne*ne<q.r*q.r+36){M=q.id;break}}M!==a.hoverId&&(a.hoverId=M,B())},vt=u=>{if(u.button!==0)return;let A=J(u.clientX,u.clientY),M=null;for(let P=a.nodes.length-1;P>=0;P--){let q=a.nodes[P];if(!ve(q.id))continue;let pe=q.x-A.x,ne=q.y-A.y;if(pe*pe+ne*ne<q.r*q.r+25){M=q;break}}if(u.shiftKey){if(M){a.shiftClick=M.id;return}a.marquee={sx:u.clientX,sy:u.clientY,ex:u.clientX,ey:u.clientY};return}a.dragStart={x:u.clientX,y:u.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=M||null,M&&(a.dragOffset={dx:M.x-A.x,dy:M.y-A.y})},Bt=u=>{if(a.marquee){a.marquee.ex=u.clientX,a.marquee.ey=u.clientY,B();return}if(!a.dragStart)return;let A=u.clientX-a.dragStart.x,M=u.clientY-a.dragStart.y;if(Math.abs(A)+Math.abs(M)>3&&(a.dragging=!0),a.dragNode){let P=J(u.clientX,u.clientY);a.dragNode.x=P.x+a.dragOffset.dx,a.dragNode.y=P.y+a.dragOffset.dy,B()}else a.dragging&&(a.panX=De(a.dragStart.px+A,-1e5,1e5),a.panY=De(a.dragStart.py+M,-1e5,1e5),B())},Lt=u=>{if(a.marquee){let M=a.marquee;a.marquee=null;let P=p.getBoundingClientRect(),q=Math.min(M.sx,M.ex)-P.left,pe=Math.max(M.sx,M.ex)-P.left,ne=Math.min(M.sy,M.ey)-P.top,ze=Math.max(M.sy,M.ey)-P.top,$e=a.nodes.filter(ot=>{let me=ot.x*a.zoom+a.panX,xe=ot.y*a.zoom+a.panY;return me>=q&&me<=pe&&xe>=ne&&xe<=ze}).map(ot=>ot.id);a.multi=$e,Be($e),B();return}let A=a.dragStart&&!a.dragging;if(a.shiftClick){let M=a.shiftClick;a.shiftClick=null;let P=Array.isArray(a.multi)?a.multi.slice():[];P.includes(M)||P.push(M),a.multi=P,Be(P),B();return}if(A){let M=J(u.clientX,u.clientY),P=null;for(let q=a.nodes.length-1;q>=0;q--){let pe=a.nodes[q];if(!ve(pe.id))continue;let ne=pe.x-M.x,ze=pe.y-M.y;if(ne*ne+ze*ze<pe.r*pe.r+20){P=pe;break}}P?(a.selectedId=P.id,F(P.id),B()):(a.selectedId=null,a.hoverId=null,u.shiftKey||(a.multi=[],Be([])),F(null),B())}a.dragStart=null,a.dragging=!1,a.dragNode=null},jt=u=>{u.preventDefault();let A=J(u.clientX,u.clientY),M=null;for(let P=a.nodes.length-1;P>=0;P--){let q=a.nodes[P];if(!ve(q.id))continue;let pe=q.x-A.x,ne=q.y-A.y;if(pe*pe+ne*ne<q.r*q.r+25){M=q;break}}if(M){let P=a.domainById[M.id];P&&U({x:u.clientX,y:u.clientY,id:M.id,path:P.id,title:P.title})}else U(null)},Ft=u=>{u.preventDefault();let A=p.getBoundingClientRect(),M=(u.clientX-A.left-a.panX)/a.zoom,P=(u.clientY-A.top-a.panY)/a.zoom,q=Math.max(.3,Math.min(3,a.zoom*(u.deltaY<0?1.1:1/1.1)));a.panX=De(a.panX+M*(a.zoom-q),-1e5,1e5),a.panY=De(a.panY+P*(a.zoom-q),-1e5,1e5),a.zoom=q,B()};p.addEventListener("mousemove",Pe),p.addEventListener("mousedown",vt),window.addEventListener("mousemove",Bt),window.addEventListener("mouseup",Lt),p.addEventListener("wheel",Ft,{passive:!1}),p.addEventListener("contextmenu",jt),R.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Be([]),v(),B()};for(let u=0;u<200;u++)E();v(),B();let Pt=()=>$(!1);return window.addEventListener("mousedown",Pt),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),nt.disconnect(),p.removeEventListener("mousemove",Pe),p.removeEventListener("mousedown",vt),window.removeEventListener("mousemove",Bt),window.removeEventListener("mouseup",Lt),p.removeEventListener("wheel",Ft),p.removeEventListener("contextmenu",jt),window.removeEventListener("mousedown",Pt)}},[t,i]),(0,o.useEffect)(()=>{H!==void 0&&z.current&&requestAnimationFrame(()=>z.current())},[H]),(0,e.jsxs)("div",{className:"me-graph",ref:x,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",l("nodes")," \xB7 ",i.length," ",l("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:l("search"),value:K,onChange:p=>te(p.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>$(p=>!p),"aria-expanded":X,title:l("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",l("filterLabel")," ",G!=="all"||y||he?"\u25CF":"\u25BE"]}),X&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:p=>p.stopPropagation(),style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:50,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,padding:8,minWidth:240,boxShadow:"0 12px 34px rgba(0,0,0,.35)"},children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,e.jsx)("button",{type:"button",className:`lg${G==="all"&&!y?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{ge("all"),ue(!1)},children:l("all")}),Object.keys(qe).map(p=>(0,e.jsxs)("button",{type:"button",className:`lg${G===p?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>ge(d=>d===p?"all":p),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[p]||qe[p]}}),l(Ke[p])]},p)),(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsxs)("button",{type:"button",className:`lg${y?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>ue(p=>!p),children:["\u23F1 ",l("timeDim")]}),re.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:{height:1,background:"rgba(255,255,255,0.1)",margin:"4px 0"}}),(0,e.jsx)("div",{style:{maxHeight:130,overflow:"auto",display:"flex",flexWrap:"wrap",gap:4},children:re.map(p=>(0,e.jsxs)("button",{type:"button",className:`lg${he===p.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>Ae(d=>d===p.tag?"":p.tag),title:p.tag,children:["#",p.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:p.n})]},p.tag))})]}),(G!=="all"||y||he)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{ge("all"),ue(!1),Ae("")},children:[l("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:l("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!T,onChange:p=>S&&S(p.target.checked)}),l("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${y?" me-on":""}`,onClick:()=>ue(p=>!p),children:l("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let p=k.current;if(p)try{p.toBlob(d=>{d&&Re({url:URL.createObjectURL(d),blob:d})},"image/png")}catch{}},children:l("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>z.current&&z.current(),children:l("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{F(null),ge("all"),R.current&&R.current()},children:l("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:k,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:ee,style:{display:"none",position:"absolute",zIndex:4,pointerEvents:"none",background:"rgba(28,28,32,0.88)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:8,padding:"7px 10px",fontSize:12,maxWidth:220,boxShadow:"0 8px 24px rgba(0,0,0,.2)"}}),ye&&(0,e.jsx)("div",{className:"mc-empty",style:{position:"absolute",inset:0,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)"},children:l("noMatch")}),h&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>U(null)}),h&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:h.x,top:h.y,zIndex:31},onMouseDown:p=>p.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{w.current({path:h.path,title:h.title}),U(null)},children:l("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{h.id&&(m.current.selectedId=h.id,F(h.id)),U(null);let p=m.current;p&&p.wake&&p.wake()},children:l("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(h.title||"")}catch{}U(null),Y(l("copied"))},children:l("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let p=m.current,d=p&&Array.isArray(p.multi)?p.multi.slice():[],_=h.id;if(_&&!d.includes(_)&&d.push(_),U(null),d.length<2){Y(l("mergeNeed"),!1);return}if(!window.confirm(l("mergeConfirm")))return;let se=L.current&&L.current(d);se&&se.then?se.then(ce=>ce?Y(l("merged")):Y(l("mergeFail"),!1)).catch(()=>Y(l("mergeFail"),!1)):se&&Y(l("merged"))},children:l("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let p=h.path;U(null),window.confirm(l("deleteConfirm"))&&(async()=>{try{(j.current?await j.current(p):!1)?Y(l("deleted")):Y(l("deleteFail"),!1)}catch{Y(l("deleteFail"),!1)}})()},children:l("delete")})]}),Z.length>0&&(0,e.jsxs)("div",{style:{position:"absolute",left:10,top:10,zIndex:3,display:"flex",gap:8,alignItems:"center",background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:"6px 10px",fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsxs)("span",{style:{fontWeight:700},children:[Z.length," ",l("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let d=Z.map(fe=>Le[fe]).filter(Boolean).map(fe=>fe.title||fe.name).join(`
307
+ `),_=new Blob([d],{type:"text/plain;charset=utf-8"}),se=URL.createObjectURL(_),ce=document.createElement("a");ce.href=se,ce.download="memory-selected.txt",document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),setTimeout(()=>URL.revokeObjectURL(se),1e3),Y(Z.length+l("exportedSel"))},children:l("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(Z.length<2){Y(l("mergeNeed"),!1);return}let p=Z.map(_=>Le[_]?Le[_].id:_);if(!window.confirm(l("mergeConfirm")))return;Be([]);let d=m.current;d&&(d.multi=[]),fetch(`${O}/merge?paths=${encodeURIComponent(p.join(","))}`).then(_=>_.json()).then(_=>{_&&_.ok?Y(l("merged")):Y(l("mergeFail"),!1)}).catch(()=>Y(l("mergeFail"),!1))},children:l("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(l("deleteConfirm")))return;let p=Z.map(_=>Le[_]?Le[_].id:_);Be([]);let d=m.current;d&&(d.multi=[]),(async()=>{let _=0;for(let se of p)try{(j.current?await j.current(se):!1)&&_++}catch{}Y(_+l("deletedSelected"),_>0)})()},children:l("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let p=m.current;p&&(p.multi=[]),Be([]);let d=m.current;d&&d.render&&d.render()},children:l("clearSelection")})]}),V&&(0,e.jsxs)("div",{className:"me-graph-sidebar",style:{position:"absolute",right:10,top:10,zIndex:3,maxWidth:240,background:"rgba(28,28,32,0.92)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",color:"#eee",borderRadius:10,padding:12,fontSize:12,boxShadow:"0 10px 30px rgba(0,0,0,.25)"},children:[(0,e.jsx)("div",{style:{fontWeight:700,fontSize:13,marginBottom:4},children:Le[V]?Le[V].title||Le[V].name:V}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:Le[V]?l(Ke[Le[V].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:l("graphHint")}),(i.filter(p=>p.source===V||p.target===V)||[]).slice(0,8).map((p,d)=>{let _=p.source===V?p.target:p.source,se=Le[_];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:ce=>{ce.preventDefault();let fe=m.current;fe&&(fe.selectedId=_,fe.hoverId=_,fe.wake&&fe.wake()),F(_)},children:se?(se.title||se.name).slice(0,28):_},d)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:l("graphTip")}),N&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,position:"fixed",left:"50%",transform:"translateX(-50%)",top:22,zIndex:70,background:"rgba(20,22,26,0.97)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#f5f5f5",borderRadius:12,padding:"10px 20px",fontSize:13.5,fontWeight:600,boxShadow:"0 14px 44px rgba(0,0,0,.5)",pointerEvents:"none",animation:"me-pop .22s ease",borderLeft:"4px solid "+(N.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:N.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:N.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:N.msg})]}),Ce&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{Ce.url&&URL.revokeObjectURL(Ce.url),Re(null),s(!1)},children:[(0,e.jsx)("style",{children:Ee}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Ne?"100vw":900,width:Ne?"100vw":"92vw",maxHeight:Ne?"100%":"90vh",height:Ne?"100%":void 0,borderRadius:Ne?0:14},onClick:p=>p.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:l("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:Ce.url,download:"memory-graph.png",onClick:()=>{We("download"),Y(l("downloaded")+" \xB7 "+l("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:l(Q==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{We("full"),s(p=>!p),Y(l("fullscreen"))},children:l(Q==="full"?"done":Ne?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let p=Ce.blob;p&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":p})]).then(()=>{We("copy"),Y(l("copied"))}).catch(()=>{Y(l("copyFail"),!1)}):Y(l("copyFail"),!1)},children:l(Q==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ce.url&&URL.revokeObjectURL(Ce.url),Re(null),s(!1)},children:l("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Ne?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:Ce.url,alt:l("exportGraph"),style:{maxWidth:"100%",maxHeight:Ne?"calc(100% - 64px)":"70vh",borderRadius:Ne?0:8,cursor:"zoom-in"},onClick:()=>s(p=>!p)})})]})]})]})}function Ea(t){let i=new Date(t||0).getTime();if(!i)return"#94a3b8";let r=(Date.now()-i)/864e5;return r<3?"#10b981":r<14?"#f59e0b":r<30?"#f97316":"#94a3b8"}function Gt({label:t,value:i=[],options:r,onChange:g,placeholder:c,z:l=20}){let[C,T]=(0,o.useState)(!1),S=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!C)return;let w=j=>{S.current&&!S.current.contains(j.target)&&T(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[C]);let H=Array.isArray(i)?i:[],k=H.includes("__all__"),x=k?r.find(w=>w.value==="__all__")?.label||"":H.length?H.map(w=>r.find(j=>j.value===w)?.label||w).join("\u3001"):"",m=(w,j)=>{if(w.value==="__all__"){g(j?["__all__"]:[]);return}let L=new Set(H);L.has("__all__")&&L.delete("__all__"),j?L.add(w.value):L.delete(w.value),g([...L])},z=r.find(w=>w.value==="__all__"),R=r.filter(w=>w.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t}),(0,e.jsxs)("div",{ref:S,style:{position:"relative",minWidth:0},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>T(w=>!w),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,e.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x||c||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),C&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:l,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[z&&(0,e.jsxs)("label",{onClick:w=>w.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("input",{type:"checkbox",checked:k,onChange:w=>m(z,w.target.checked)}),(0,e.jsx)("span",{children:z.label})]}),R.map(w=>(0,e.jsxs)("label",{onClick:j=>j.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:H.includes(w.value),onChange:j=>m(w,j.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Wa(t){let i=new Date(t||0).getTime();return!!i&&(Date.now()-i)/864e5<3}async function $a(t,i,r){if(r&&typeof window.showSaveFilePicker=="function")try{let l=await window.showSaveFilePicker({suggestedName:i}),C=await l.createWritable();return await C.write(t),await C.close(),{ok:!0,picked:!0,name:l.name}}catch(l){return l&&l.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(l.message||l)}}let g=URL.createObjectURL(t),c=document.createElement("a");return c.href=g,c.download=i,document.body.appendChild(c),c.click(),document.body.removeChild(c),setTimeout(()=>URL.revokeObjectURL(g),1e3),{ok:!0,picked:!1,name:i}}function Xt(t,i){if(!i||!t)return t;let r=t.toLowerCase(),g=i.toLowerCase(),c=[],l=0;for(;l<t.length;){let C=r.indexOf(g,l);if(C<0){c.push(t.slice(l));break}C>l&&c.push(t.slice(l,C)),c.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(C,C+g.length)},C)),l=C+g.length}return c}function pt(t){if(!t)return"";let i=new Date(t);if(Number.isNaN(i.getTime()))return"";let r=new Date,g=i.toDateString()===r.toDateString(),c=C=>String(C).padStart(2,"0"),l=`${c(i.getHours())}:${c(i.getMinutes())}`;return g?l:`${i.getMonth()+1}-${i.getDate()} ${l}`}
308
308
 
309
309
  return module.exports;
310
310
  },