memory-eternal 0.10.46 → 0.10.47

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 ra=Object.create;var Tt=Object.defineProperty;var la=Object.getOwnPropertyDescriptor;var sa=Object.getOwnPropertyNames;var da=Object.getPrototypeOf,ca=Object.prototype.hasOwnProperty;var pa=(t,o)=>{for(var s in o)Tt(t,s,{get:o[s],enumerable:!0})},$t=(t,o,s,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of sa(o))!ca.call(t,p)&&p!==s&&Tt(t,p,{get:()=>o[p],enumerable:!(m=la(o,p))||m.enumerable});return t};var ua=(t,o,s)=>(s=t!=null?ra(da(t)):{},$t(o||!t||!t.__esModule?Tt(s,"default",{value:t,enumerable:!0}):s,t)),ma=t=>$t(Tt({},"__esModule",{value:!0}),t);var Va={};pa(Va,{EN:()=>ta,MemoryLibrary:()=>Aa,ZH:()=>ea,apply:()=>Ta,inject:()=>Ca});module.exports=ma(Va);var n=ua(require("react"),1);var ga={"&":"&amp;","<":"&lt;",">":"&gt;"},At=t=>String(t).replace(/[&<>]/g,o=>ga[o]),fa=[[/结论|总结|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"]],ya=["\u2728","info"],ba=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],ha=t=>{let o=String(t);for(let[s,m,p]of fa)if(s.test(o))return[m,p];return ya},va=t=>{let o=t.join(" ");for(let[s,m,p]of ba)if(s.test(o))return[m,p];return["\u{1F4CC}","info"]};function ct(t){let o=String(t),s=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(o);if(s&&!/[是为有了吗呢着过把被和与或于]/.test(s[1]))return'<span class="md-kv"><span class="md-k">'+At(s[1])+'</span><span class="md-v">'+ct(s[2])+"</span></span>";let m=At(o);return m=m.replace(/^\[([ xX])\](?=\s|$)\s*/,(p,i)=>'<span class="md-task">'+(i.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),m=m.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),m=m.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),m=m.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),m=m.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(p,i,h)=>/^(https?:|\/|#)/i.test(h)?'<a class="md-link" href="'+h+'" target="_blank" rel="noopener noreferrer">'+i+"</a>":i),m}function Rt(t){let o=String(t||"").replace(/\r\n?/g,`
7
- `),s=/^---\n([\s\S]*?)\n---\n?/.exec(o);if(!s)return{meta:[],body:o};let m=[];for(let p of s[1].split(`
8
- `)){let i=p.indexOf(":");if(i<=0)continue;let h=p.slice(0,i).trim(),T=p.slice(i+1).trim().replace(/^["']|["']$/g,"");h&&m.push([h,T])}return{meta:m,body:o.slice(s[0].length)}}function _t(t){let o=String(t||"").trim().replace(/^\[|\]$/g,"");return o?o.split(",").map(s=>s.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Bt(t){let o=Rt(String(t||"").replace(/\r\n?/g,`
9
- `)).body;if(!o.trim())return"";let s=[],m=o.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(f,z,I)=>(s.push('<pre class="md-pre"><code>'+At(I.replace(/\n$/,""))+"</code></pre>"),"\0F"+(s.length-1)+"\0")),p=[],i=[],h=null,T=null,N=()=>{i.length&&(p.push('<p class="md-p">'+i.join("<br/>")+"</p>"),i=[])},O=()=>{if(!h)return;let f=h.type;p.push("<"+f+' class="md-'+f+'">'+h.items.map(z=>"<li>"+z+"</li>").join("")+"</"+f+">"),h=null},S=()=>{if(!T)return;let[f,z]=va(T);p.push('<div class="md-callout md-c-'+z+'"><span class="md-ico">'+f+"</span>"+T.join("<br/>")+"</div>"),T=null},x=()=>{N(),O(),S()};for(let f of m.split(`
10
- `)){let z=f.trim();if(!z){x();continue}let I=/^\u0000F(\d+)\u0000$/.exec(z);if(I){x(),p.push(s[Number(I[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(z)){x();let[X,F]=ha(w[2]);p.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+F+'"><span class="md-ico">'+X+'</span><span class="md-hx">'+ct(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(z)){x(),p.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(z)){N(),O(),T=T||[],T.push(ct(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(z)){N(),S(),(!h||h.type!=="ul")&&(O(),h={type:"ul",items:[]}),h.items.push(ct(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(z)){N(),S(),(!h||h.type!=="ol")&&(O(),h={type:"ol",items:[]}),h.items.push(ct(w[1]));continue}O(),S(),i.push(ct(z))}return x(),p.join(`
11
- `)}function Ut(t,o,s=48){if(!o||!t)return"";let m=String(t),p=m.toLowerCase(),i=String(o).toLowerCase();if(!i)return"";let h=p.indexOf(i);if(h<0)return"";let T=Math.max(0,h-s),N=Math.min(m.length,h+i.length+s),O=m.slice(T,N).replace(/\s+/g," ").trim();return(T>0?"\u2026":"")+O+(N<m.length?"\u2026":"")}function Kt(t={}){let o=t.repo||"EternalNight996/memory-eternal",s=String(t.title||"[Bug] ").slice(0,120),m=Array.isArray(t.labels)?t.labels:["bug"],p=Number(t.maxLength)>500?Number(t.maxLength):7e3,i=N=>{let O=new URLSearchParams;return O.set("title",s),O.set("body",N),m.length&&O.set("labels",m.join(",")),"https://github.com/"+o+"/issues/new?"+O.toString()},h=String(t.body||""),T=i(h);if(T.length>p){let N=`
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`,O=S=>i(h.slice(0,S)+N);if(O(0).length>p)h=N;else{let S=0,x=h.length;for(;S<x;){let f=Math.ceil((S+x)/2);O(f).length<=p?S=f:x=f-1}h=h.slice(0,S)+N}T=i(h)}return T}function Vt(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(`
6
+ var ra=Object.create;var Rt=Object.defineProperty;var sa=Object.getOwnPropertyDescriptor;var la=Object.getOwnPropertyNames;var da=Object.getPrototypeOf,ca=Object.prototype.hasOwnProperty;var pa=(t,o)=>{for(var l in o)Rt(t,l,{get:o[l],enumerable:!0})},$t=(t,o,l,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of la(o))!ca.call(t,p)&&p!==l&&Rt(t,p,{get:()=>o[p],enumerable:!(m=sa(o,p))||m.enumerable});return t};var ua=(t,o,l)=>(l=t!=null?ra(da(t)):{},$t(o||!t||!t.__esModule?Rt(l,"default",{value:t,enumerable:!0}):l,t)),ma=t=>$t(Rt({},"__esModule",{value:!0}),t);var Va={};pa(Va,{EN:()=>ta,MemoryLibrary:()=>Aa,ZH:()=>ea,apply:()=>Ra,inject:()=>Ca});module.exports=ma(Va);var n=ua(require("react"),1);var ga={"&":"&amp;","<":"&lt;",">":"&gt;"},At=t=>String(t).replace(/[&<>]/g,o=>ga[o]),fa=[[/结论|总结|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"]],ya=["\u2728","info"],ba=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],ha=t=>{let o=String(t);for(let[l,m,p]of fa)if(l.test(o))return[m,p];return ya},va=t=>{let o=t.join(" ");for(let[l,m,p]of ba)if(l.test(o))return[m,p];return["\u{1F4CC}","info"]};function ct(t){let o=String(t),l=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(o);if(l&&!/[是为有了吗呢着过把被和与或于]/.test(l[1]))return'<span class="md-kv"><span class="md-k">'+At(l[1])+'</span><span class="md-v">'+ct(l[2])+"</span></span>";let m=At(o);return m=m.replace(/^\[([ xX])\](?=\s|$)\s*/,(p,r)=>'<span class="md-task">'+(r.toLowerCase()==="x"?"\u2611":"\u2610")+"</span> "),m=m.replace(/`([^`\n]+)`/g,'<code class="md-code">$1</code>'),m=m.replace(/\*\*([^*]+)\*\*/g,'<strong class="md-b">$1</strong>'),m=m.replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>"),m=m.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(p,r,v)=>/^(https?:|\/|#)/i.test(v)?'<a class="md-link" href="'+v+'" target="_blank" rel="noopener noreferrer">'+r+"</a>":r),m}function Tt(t){let o=String(t||"").replace(/\r\n?/g,`
7
+ `),l=/^---\n([\s\S]*?)\n---\n?/.exec(o);if(!l)return{meta:[],body:o};let m=[];for(let p of l[1].split(`
8
+ `)){let r=p.indexOf(":");if(r<=0)continue;let v=p.slice(0,r).trim(),R=p.slice(r+1).trim().replace(/^["']|["']$/g,"");v&&m.push([v,R])}return{meta:m,body:o.slice(l[0].length)}}function _t(t){let o=String(t||"").trim().replace(/^\[|\]$/g,"");return o?o.split(",").map(l=>l.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Bt(t){let o=Tt(String(t||"").replace(/\r\n?/g,`
9
+ `)).body;if(!o.trim())return"";let l=[],m=o.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(f,z,I)=>(l.push('<pre class="md-pre"><code>'+At(I.replace(/\n$/,""))+"</code></pre>"),"\0F"+(l.length-1)+"\0")),p=[],r=[],v=null,R=null,N=()=>{r.length&&(p.push('<p class="md-p">'+r.join("<br/>")+"</p>"),r=[])},O=()=>{if(!v)return;let f=v.type;p.push("<"+f+' class="md-'+f+'">'+v.items.map(z=>"<li>"+z+"</li>").join("")+"</"+f+">"),v=null},S=()=>{if(!R)return;let[f,z]=va(R);p.push('<div class="md-callout md-c-'+z+'"><span class="md-ico">'+f+"</span>"+R.join("<br/>")+"</div>"),R=null},k=()=>{N(),O(),S()};for(let f of m.split(`
10
+ `)){let z=f.trim();if(!z){k();continue}let I=/^\u0000F(\d+)\u0000$/.exec(z);if(I){k(),p.push(l[Number(I[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(z)){k();let[X,F]=ha(w[2]);p.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+F+'"><span class="md-ico">'+X+'</span><span class="md-hx">'+ct(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(z)){k(),p.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(z)){N(),O(),R=R||[],R.push(ct(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(z)){N(),S(),(!v||v.type!=="ul")&&(O(),v={type:"ul",items:[]}),v.items.push(ct(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(z)){N(),S(),(!v||v.type!=="ol")&&(O(),v={type:"ol",items:[]}),v.items.push(ct(w[1]));continue}O(),S(),r.push(ct(z))}return k(),p.join(`
11
+ `)}function Ut(t,o,l=48){if(!o||!t)return"";let m=String(t),p=m.toLowerCase(),r=String(o).toLowerCase();if(!r)return"";let v=p.indexOf(r);if(v<0)return"";let R=Math.max(0,v-l),N=Math.min(m.length,v+r.length+l),O=m.slice(R,N).replace(/\s+/g," ").trim();return(R>0?"\u2026":"")+O+(N<m.length?"\u2026":"")}function Kt(t={}){let o=t.repo||"EternalNight996/memory-eternal",l=String(t.title||"[Bug] ").slice(0,120),m=Array.isArray(t.labels)?t.labels:["bug"],p=Number(t.maxLength)>500?Number(t.maxLength):7e3,r=N=>{let O=new URLSearchParams;return O.set("title",l),O.set("body",N),m.length&&O.set("labels",m.join(",")),"https://github.com/"+o+"/issues/new?"+O.toString()},v=String(t.body||""),R=r(v);if(R.length>p){let N=`
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`,O=S=>r(v.slice(0,S)+N);if(O(0).length>p)v=N;else{let S=0,k=v.length;for(;S<k;){let f=Math.ceil((S+k)/2);O(f).length<=p?S=f:k=f-1}v=v.slice(0,S)+N}R=r(v)}return R}function Vt(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
14
  `)}var Lt="https://github.com/EternalNight996/memory-eternal",xa=["\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"+Lt,"","\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
  `),ka=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+Lt,"","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 qt(t={}){let o=t.lang==="en"?"en":"zh",s=o==="en"?ka:xa,m=t.repo||"EternalNight996/memory-eternal";return s=s.split(Lt).join("https://github.com/"+m),t.description&&(s=s.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(s=s.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())),s}function Yt({panX:t=0,panY:o=0,zoom:s=1,w:m=0,h:p=0,margin:i=60}={}){let h=s||1;return{x0:(0-t)/h-i,y0:(0-o)/h-i,x1:(m-t)/h+i,y1:(p-o)/h+i}}function Dt(t,o,s,m){return m?t+s>=m.x0&&t-s<=m.x1&&o+s>=m.y0&&o-s<=m.y1:!0}function Gt(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Xt(t,o={}){let s=Number.isFinite(o.limit)?o.limit:1/0,m=new Set,p=N=>{N&&m.size<s&&m.add(N)};if(p(o.focusId),p(o.hoverId),o.searchHits)for(let N of o.searchHits){if(m.size>=s)break;m.add(N)}let i=o.degree||{},h=N=>Number(i[N])||0,T=[];for(let N of Array.isArray(t)?t:[])N&&N.id&&!m.has(N.id)&&T.push(N);T.sort((N,O)=>h(O.id)-h(N.id));for(let N of T){if(m.size>=s)break;m.add(N.id)}return m}function wa(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 Jt(t,o){let s={...t||{}},m={};for(let[p,i]of Object.entries(o||{}))wa(t?t[p]:void 0,i)||(s[p]=i,m[p]=i);return{values:s,overlay:m}}var e=require("react/jsx-runtime"),pt="memory-eternal",_="/memory-eternal/api",Sa=100,Ca=["slots","locale"],ea={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",copyBody:"\u590D\u5236\u6B63\u6587",clearFilter:"\u6E05\u9664\u6807\u7B7E\u7B5B\u9009",copyPath:"\u590D\u5236\u8DEF\u5F84",copied:"\u5DF2\u590D\u5236",copyFail:"\u590D\u5236\u5931\u8D25",readWidth:"\u9605\u8BFB\u5BBD\u5EA6",widthNarrow:"\u7A84",widthMid:"\u4E2D",widthWide:"\u5BBD",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",vcRestartAnyway:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F v{ver}\uFF1B\u901A\u5E38\u65E0\u9700\u91CD\u542F\uFF0C\u5361\u4F4F/\u884C\u4E3A\u5F02\u5E38\u65F6\u53EF\u5F3A\u5236\u91CD\u542F",vcHostProcessStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 v{disk}\uFF0C\u4F46**\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B**\uFF08DSH \u5BBF\u4E3B\uFF09\u52A0\u8F7D\u7684\u4ECD\u662F v{loaded} \u2014\u2014 \u5B83\u6765\u81EA\u5BBF\u4E3B\u542F\u52A8\u65F6\u7684\u90A3\u4EFD\u4EE3\u7801\uFF1A**\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u4E0D\u4F1A\u6539\u53D8\u672C\u9875**\uFF0C\u9700\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u5F00 DSH\u3002",vcRestartFixes:"\u70B9\u51FB\u4F1A\u628A\u5E38\u9A7B\u5B9E\u4F8B\uFF08\u7AEF\u53E3\u4E0A\u90A3\u4E2A\uFF09\u6362\u6210 v{disk}\uFF08\u5F53\u524D v{served}\uFF09\uFF0C\u4E0D\u7528\u91CD\u542F DSH",vcRestartHostOnly:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F v{disk}\uFF1B\u672C\u9875\u663E\u793A v{loaded} \u6765\u81EA DSH \u5BBF\u4E3B \u2014\u2014 \u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u4E0D\u5F71\u54CD\u672C\u9875\uFF0C\u8BF7\u91CD\u542F DSH",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]
16
+ `);function qt(t={}){let o=t.lang==="en"?"en":"zh",l=o==="en"?ka:xa,m=t.repo||"EternalNight996/memory-eternal";return l=l.split(Lt).join("https://github.com/"+m),t.description&&(l=l.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(l=l.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())),l}function Yt({panX:t=0,panY:o=0,zoom:l=1,w:m=0,h:p=0,margin:r=60}={}){let v=l||1;return{x0:(0-t)/v-r,y0:(0-o)/v-r,x1:(m-t)/v+r,y1:(p-o)/v+r}}function Dt(t,o,l,m){return m?t+l>=m.x0&&t-l<=m.x1&&o+l>=m.y0&&o-l<=m.y1:!0}function Gt(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Xt(t,o={}){let l=Number.isFinite(o.limit)?o.limit:1/0,m=new Set,p=N=>{N&&m.size<l&&m.add(N)};if(p(o.focusId),p(o.hoverId),o.searchHits)for(let N of o.searchHits){if(m.size>=l)break;m.add(N)}let r=o.degree||{},v=N=>Number(r[N])||0,R=[];for(let N of Array.isArray(t)?t:[])N&&N.id&&!m.has(N.id)&&R.push(N);R.sort((N,O)=>v(O.id)-v(N.id));for(let N of R){if(m.size>=l)break;m.add(N.id)}return m}function wa(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 Jt(t,o){let l={...t||{}},m={};for(let[p,r]of Object.entries(o||{}))wa(t?t[p]:void 0,r)||(l[p]=r,m[p]=r);return{values:l,overlay:m}}var e=require("react/jsx-runtime"),pt="memory-eternal",_="/memory-eternal/api",Sa=100,Ca=["slots","locale"],ea={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",copyBody:"\u590D\u5236\u6B63\u6587",clearFilter:"\u6E05\u9664\u6807\u7B7E\u7B5B\u9009",copyPath:"\u590D\u5236\u8DEF\u5F84",copied:"\u5DF2\u590D\u5236",copyFail:"\u590D\u5236\u5931\u8D25",readWidth:"\u9605\u8BFB\u5BBD\u5EA6",widthNarrow:"\u7A84",widthMid:"\u4E2D",widthWide:"\u5BBD",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",vcRestartAnyway:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F v{ver}\uFF1B\u901A\u5E38\u65E0\u9700\u91CD\u542F\uFF0C\u5361\u4F4F/\u884C\u4E3A\u5F02\u5E38\u65F6\u53EF\u5F3A\u5236\u91CD\u542F",vcHostProcessStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 v{disk}\uFF0C\u4F46**\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B**\uFF08DSH \u5BBF\u4E3B\uFF09\u52A0\u8F7D\u7684\u4ECD\u662F v{loaded} \u2014\u2014 \u5B83\u6765\u81EA\u5BBF\u4E3B\u542F\u52A8\u65F6\u7684\u90A3\u4EFD\u4EE3\u7801\uFF1A**\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u4E0D\u4F1A\u6539\u53D8\u672C\u9875**\uFF0C\u9700\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u5F00 DSH\u3002",vcRestartFixes:"\u70B9\u51FB\u4F1A\u628A\u5E38\u9A7B\u5B9E\u4F8B\uFF08\u7AEF\u53E3\u4E0A\u90A3\u4E2A\uFF09\u6362\u6210 v{disk}\uFF08\u5F53\u524D v{served}\uFF09\uFF0C\u4E0D\u7528\u91CD\u542F DSH",vcRestartStart:"\u70B9\u51FB\u4F1A\u7528\u5F53\u524D\u78C1\u76D8\u7248\u672C v{disk} \u628A\u5E38\u9A7B\u5B9E\u4F8B\u62C9\u8D77\u6765\uFF08\u4E0D\u7528\u91CD\u542F DSH\uFF09",vcRestartHostOnly:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F v{disk}\uFF1B\u672C\u9875\u663E\u793A v{loaded} \u6765\u81EA DSH \u5BBF\u4E3B \u2014\u2014 \u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u4E0D\u5F71\u54CD\u672C\u9875\uFF0C\u8BF7\u91CD\u542F DSH",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 ra=Object.create;var Tt=Object.defineProperty;var la=Object.getOwnPropertyDe
58
58
  -
59
59
 
60
60
  ## \u98CE\u9669/\u963B\u585E
61
- - `},ta={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",copyBody:"Copy body",clearFilter:"Clear tag filter",copyPath:"Copy path",copied:"Copied",copyFail:"Copy failed",readWidth:"Reading width",widthNarrow:"Narrow",widthMid:"Medium",widthWide:"Wide",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",vcRestartAnyway:"Resident is already v{ver}; usually no restart needed \u2014 use this if it looks stuck",vcHostProcessStale:"Disk has v{disk}, but **the process serving this page** (the DSH host) still loads v{loaded} \u2014 that code was loaded when the host started, so **restarting the resident instance does not change this page**: fully quit and reopen DSH.",vcRestartFixes:"Restarts the resident instance (the process on the port) onto v{disk} (currently v{served}) without restarting DSH",vcRestartHostOnly:"The resident instance is already v{disk}; this page shows v{loaded} from the DSH host \u2014 restarting the resident does not affect it, please restart DSH",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]
61
+ - `},ta={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",copyBody:"Copy body",clearFilter:"Clear tag filter",copyPath:"Copy path",copied:"Copied",copyFail:"Copy failed",readWidth:"Reading width",widthNarrow:"Narrow",widthMid:"Medium",widthWide:"Wide",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",vcRestartAnyway:"Resident is already v{ver}; usually no restart needed \u2014 use this if it looks stuck",vcHostProcessStale:"Disk has v{disk}, but **the process serving this page** (the DSH host) still loads v{loaded} \u2014 that code was loaded when the host started, so **restarting the resident instance does not change this page**: fully quit and reopen DSH.",vcRestartFixes:"Restarts the resident instance (the process on the port) onto v{disk} (currently v{served}) without restarting DSH",vcRestartStart:"Starts the resident instance on the current disk version v{disk} (no DSH restart needed)",vcRestartHostOnly:"The resident instance is already v{disk}; this page shows v{loaded} from the DSH host \u2014 restarting the resident does not affect it, please restart DSH",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
- - `},Ht=["all","project","knowledge","content","prompt","business","tool","mistake"],Ke={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},Zt=t=>Array.isArray(t&&t.tags)?t.tags:[],kt={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},Ue={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},xt="deepseek-harness",ft=t=>{let o=String(t||""),s=o.toLowerCase();return!o||o==="agent"||o==="unknown"||o.startsWith("session:")||s.startsWith("claude-code")?s.startsWith("claude-code")?"claude":xt:s==="deepseek harness"?xt:o.split(":")[0]||xt},Na=[xt,"claude","codex","cursor","codex-desktop"],aa=(t=[])=>[...new Set([...Na,...(t||[]).map(ft)])],Ma={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],warn:["\u26A0\uFE0F","#f59e0b"],fail:["\u274C","#ef4444"]},Oe=`
106
+ - `},Ht=["all","project","knowledge","content","prompt","business","tool","mistake"],Ke={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},Zt=t=>Array.isArray(t&&t.tags)?t.tags:[],kt={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},Ue={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},xt="deepseek-harness",ft=t=>{let o=String(t||""),l=o.toLowerCase();return!o||o==="agent"||o==="unknown"||o.startsWith("session:")||l.startsWith("claude-code")?l.startsWith("claude-code")?"claude":xt:l==="deepseek harness"?xt:o.split(":")[0]||xt},Na=[xt,"claude","codex","cursor","codex-desktop"],aa=(t=[])=>[...new Set([...Na,...(t||[]).map(ft)])],Ma={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],warn:["\u26A0\uFE0F","#f59e0b"],fail:["\u274C","#ef4444"]},Oe=`
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; }
@@ -345,13 +345,13 @@ Option A, because:
345
345
  height: calc(100vh - var(--dsh-frame-overlay-top, 68px));
346
346
  max-height: calc(100vh - var(--dsh-frame-overlay-top, 68px));
347
347
  }
348
- `;function Ta(t){t.effect(()=>t.locale.register(pt,{zh:ea,en:ta}),"memory-eternal: locale");let o=t.locale.bind(pt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:pt,order:25,label:()=>o("nav"),locale:pt,inject:()=>({})},()=>n.default.createElement(Da,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${pt}:footer`,order:100,label:()=>o("nav"),locale:pt,inject:()=>({})},s=>n.default.createElement(za,{t:o,locale:t.locale,wide:!(s&&s.wide===!1)}))),"memory-eternal: sidebar footer action")}function Ra(){let[t,o]=(0,n.useState)(_+"/ui/app");return(0,n.useEffect)(()=>{let s=!0,m=()=>fetch("/memory-eternal/api/web-info").then(p=>p.json()).then(p=>{s&&p&&p.ok&&p.alive!==!1&&p.url&&o(p.url.endsWith("/")?p.url:p.url+"/")}).catch(()=>{});return fetch(_+"/ui/app",{method:"HEAD"}).then(p=>{if(s&&!p.ok)return m()}).catch(()=>s?m():void 0),()=>{s=!1}},[]),t}function Da({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsx)(ia,{t,onReload:()=>{},version:0})]})}function za({t,locale:o,wide:s}){let[m,p]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${s?"":" rail"}`,children:[(0,e.jsx)("style",{children:Oe}),(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)(na,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),m&&(0,e.jsx)(Ia,{t,locale:o,onClose:()=>p(!1)})]})}function Ia({t,locale:o,onClose:s,tab:m}){let[p,i]=(0,n.useState)(!1),h=(0,n.useRef)(null),T=Ra(),N=(0,n.useCallback)(I=>o&&typeof o.subscribe=="function"?o.subscribe(I):()=>{},[o]),O=(0,n.useCallback)(()=>o&&typeof o.getSnapshot=="function"?o.getSnapshot():null,[o]),S=(0,n.useSyncExternalStore)(N,O),x=S&&(S.active==="zh"||S.active==="en")?S.active:null,f=(0,n.useRef)(null);f.current===null&&x&&(f.current=x);let z=(0,n.useMemo)(()=>{let I=f.current?`lang=${f.current}`:"";if(m==="config")return`${_}/ui/config?tab=config${I?`&${I}`:""}`;let w=T.replace(/\/$/,""),X=w.endsWith("/ui/app")?"?":"/?";return m?`${w}${X}tab=${m}${I?`&${I}`:""}`:I?`${w}${X}${I}`:T},[T,m]);return(0,n.useEffect)(()=>{let I=h.current&&h.current.contentWindow;I&&x&&I.postMessage({source:"memory-eternal",type:"locale",lang:x},"*")},[x]),(0,n.useEffect)(()=>{let I=w=>{w.key==="Escape"&&s()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[s]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:s,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsx)("div",{className:"me-modal"+(p?" me-modal-full":""),onClick:I=>I.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(I=>!I),"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:s,"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:h,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 na(){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 vt="0.10.46";function Aa({t,inModal:o,onClose:s,onFull:m,full:p}){let[i,h]=(0,n.useState)(null),[T,N]=(0,n.useState)([]),[O,S]=(0,n.useState)(!0),[x,f]=(0,n.useState)(null),[z,I]=(0,n.useState)(""),[w,X]=(0,n.useState)("all"),[F,U]=(0,n.useState)(""),[ee,V]=(0,n.useState)("all"),[A,Re]=(0,n.useState)("all"),[me,se]=(0,n.useState)(""),[P,C]=(0,n.useState)(()=>{try{let c=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),k={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(c&&k[c])return k[c]}catch{}return"cards"}),[W,pe]=(0,n.useState)(()=>new Set([P])),Me=(0,n.useCallback)(c=>{pe(k=>k.has(c)?k:new Set(k).add(c)),C(c)},[]),[be,v]=(0,n.useState)("recent"),[De,de]=(0,n.useState)(null),y=(0,n.useRef)(null),q=(0,n.useRef)(null),[ae,he]=(0,n.useState)(!1),[Q,G]=(0,n.useState)(null),[Le,Ce]=(0,n.useState)(!1),[tt,Ne]=(0,n.useState)(!1),[l,M]=(0,n.useState)(!0),[j,Z]=(0,n.useState)(null),[ve,ce]=(0,n.useState)(0),ne=(0,n.useCallback)(()=>ce(c=>c+1),[]),J=i?.quarantine?.pending??0,Ve=i?.quarantine?.deleted??0,ze=(0,n.useRef)(null),[u,d]=(0,n.useState)(0),[K,le]=(0,n.useState)(!1),fe=(0,n.useRef)(null),Ie=(0,n.useRef)(null),a=(0,n.useCallback)(async(c=w,k=F,B=A,D={})=>{let $=D.append===!0;try{$?le(!0):(S(!0),I(""));let te=new URLSearchParams;c&&c!=="all"&&te.set("kind",c),k.trim()&&te.set("q",k.trim());let ye=D.tag!==void 0?D.tag:me;ye&&te.set("tag",ye),te.set("status",B||"all"),te.set("limit",String(Sa)),te.set("offset",String(D.offset||0)),be==="title"&&te.set("sort","title");let qe=await(await fetch(`${_}/cards?${te.toString()}`)).json();if(qe.ok){let Ye=qe.cards||[];N(Ee=>$?[...Ee,...Ye.filter(wt=>!Ee.some(St=>St.path===wt.path))]:Ye),d(Number(qe.total)||Ye.length)}}catch(te){I(String(te&&te.message?te.message:te))}finally{$?le(!1):S(!1)}},[w,F,A,be,me]),we=(0,n.useCallback)(async()=>{try{let[c,k]=await Promise.all([fetch(`${_}/overview`).then(B=>B.json()),fetch(`${_}/capture-log`).then(B=>B.json()).catch(()=>null)]);c.ok&&h(c),f(k&&k.ok&&k.available&&k.health||null)}catch(c){I(String(c&&c.message?c.message:c))}finally{S(!1)}},[]),Xe=async c=>{try{let B=await(await fetch(`${_}/delete?path=${encodeURIComponent(c)}`)).json();B.ok?(de({ok:!0,msg:t("deleted")}),await we(),ne()):de({ok:!1,msg:B.error||t("deleteFail")})}catch{de({ok:!1,msg:t("deleteFail")})}y.current&&clearTimeout(y.current),y.current=setTimeout(()=>de(null),2e3)};(0,n.useEffect)(()=>(we(),()=>{ze.current&&clearTimeout(ze.current)}),[we]);let rt=c=>{U(c),ze.current&&clearTimeout(ze.current),ze.current=setTimeout(()=>a(w,c,A),280)},st=c=>{X(c),a(c,F,A)},at=c=>{let k=String(c||"");se(k),G(null),a(w,F,A,{tag:k})};(0,n.useEffect)(()=>{P==="cards"&&a(w,F,A)},[A,P,ve,be,me]),(0,n.useEffect)(()=>{if(P!=="cards"||O||K||T.length>=u)return;let c=fe.current,k=Ie.current;if(!c)return;let B=new IntersectionObserver(D=>{D[0]&&D[0].isIntersecting&&a(w,F,A,{append:!0,offset:T.length})},{root:k||null,rootMargin:"400px"});return B.observe(c),()=>B.disconnect()},[P,T,u,O,K,w,F,A,a]);let Se=async c=>{try{let k=c.status;if(!k&&c.path)try{let ye=((await fetch(`${_}/cards?status=all&q=${encodeURIComponent(c.title||"")}&limit=50`).then(Fe=>Fe.json())).cards||[]).find(Fe=>Fe.path===c.path);ye&&(k=ye.status)}catch{}let B=k&&k!=="approved"?`&status=${encodeURIComponent(k)}`:"",D=await fetch(`${_}/card?path=${encodeURIComponent(c.path||c.id)}${B}`),$=await D.json();$.ok?G({path:$.path,title:c.title,text:$.text}):I($.error||`HTTP ${D.status}`)}catch(k){I(String(k&&k.message?k.message:k))}},Je=async(c,k)=>{he(!0);try{let B=await fetch(`${_}/export`);if(!B.ok)throw new Error("HTTP "+B.status);let D=await B.json();if(!D.ok)throw new Error(D.error||"export failed");let $,te,ye;if(c==="json"){te="memory-vault.json",ye="application/json";let Ye=D.cards.map(Ee=>({path:Ee.path,title:Ee.title,kind:Ee.kind,status:Ee.status,store:Ee.store,text:Ee.text}));$=JSON.stringify({format:D.format||"memory-eternal-vault",formatVersion:D.formatVersion||1,exportedAt:D.exportedAt||new Date().toISOString(),count:Ye.length,cards:Ye},null,2)}else te="memory-vault.md",ye="text/markdown;charset=utf-8",$=D.cards.map(Ye=>Ye.text.trim()).filter(Boolean).join(`
348
+ `;function Ra(t){t.effect(()=>t.locale.register(pt,{zh:ea,en:ta}),"memory-eternal: locale");let o=t.locale.bind(pt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:pt,order:25,label:()=>o("nav"),locale:pt,inject:()=>({})},()=>n.default.createElement(Da,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${pt}:footer`,order:100,label:()=>o("nav"),locale:pt,inject:()=>({})},l=>n.default.createElement(za,{t:o,locale:t.locale,wide:!(l&&l.wide===!1)}))),"memory-eternal: sidebar footer action")}function Ta(){let[t,o]=(0,n.useState)(_+"/ui/app");return(0,n.useEffect)(()=>{let l=!0,m=()=>fetch("/memory-eternal/api/web-info").then(p=>p.json()).then(p=>{l&&p&&p.ok&&p.alive!==!1&&p.url&&o(p.url.endsWith("/")?p.url:p.url+"/")}).catch(()=>{});return fetch(_+"/ui/app",{method:"HEAD"}).then(p=>{if(l&&!p.ok)return m()}).catch(()=>l?m():void 0),()=>{l=!1}},[]),t}function Da({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsx)(ia,{t,onReload:()=>{},version:0})]})}function za({t,locale:o,wide:l}){let[m,p]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${l?"":" rail"}`,children:[(0,e.jsx)("style",{children:Oe}),(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)(na,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),m&&(0,e.jsx)(Ia,{t,locale:o,onClose:()=>p(!1)})]})}function Ia({t,locale:o,onClose:l,tab:m}){let[p,r]=(0,n.useState)(!1),v=(0,n.useRef)(null),R=Ta(),N=(0,n.useCallback)(I=>o&&typeof o.subscribe=="function"?o.subscribe(I):()=>{},[o]),O=(0,n.useCallback)(()=>o&&typeof o.getSnapshot=="function"?o.getSnapshot():null,[o]),S=(0,n.useSyncExternalStore)(N,O),k=S&&(S.active==="zh"||S.active==="en")?S.active:null,f=(0,n.useRef)(null);f.current===null&&k&&(f.current=k);let z=(0,n.useMemo)(()=>{let I=f.current?`lang=${f.current}`:"";if(m==="config")return`${_}/ui/config?tab=config${I?`&${I}`:""}`;let w=R.replace(/\/$/,""),X=w.endsWith("/ui/app")?"?":"/?";return m?`${w}${X}tab=${m}${I?`&${I}`:""}`:I?`${w}${X}${I}`:R},[R,m]);return(0,n.useEffect)(()=>{let I=v.current&&v.current.contentWindow;I&&k&&I.postMessage({source:"memory-eternal",type:"locale",lang:k},"*")},[k]),(0,n.useEffect)(()=>{let I=w=>{w.key==="Escape"&&l()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[l]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:l,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsx)("div",{className:"me-modal"+(p?" me-modal-full":""),onClick:I=>I.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:()=>r(I=>!I),"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:l,"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:v,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 na(){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 vt="0.10.47";function Aa({t,inModal:o,onClose:l,onFull:m,full:p}){let[r,v]=(0,n.useState)(null),[R,N]=(0,n.useState)([]),[O,S]=(0,n.useState)(!0),[k,f]=(0,n.useState)(null),[z,I]=(0,n.useState)(""),[w,X]=(0,n.useState)("all"),[F,U]=(0,n.useState)(""),[ee,V]=(0,n.useState)("all"),[A,Te]=(0,n.useState)("all"),[me,de]=(0,n.useState)(""),[P,C]=(0,n.useState)(()=>{try{let d=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),x={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(d&&x[d])return x[d]}catch{}return"cards"}),[W,pe]=(0,n.useState)(()=>new Set([P])),Me=(0,n.useCallback)(d=>{pe(x=>x.has(d)?x:new Set(x).add(d)),C(d)},[]),[be,h]=(0,n.useState)("recent"),[De,se]=(0,n.useState)(null),y=(0,n.useRef)(null),q=(0,n.useRef)(null),[ae,he]=(0,n.useState)(!1),[Q,G]=(0,n.useState)(null),[Le,Ce]=(0,n.useState)(!1),[tt,Ne]=(0,n.useState)(!1),[s,M]=(0,n.useState)(!0),[j,Z]=(0,n.useState)(null),[ve,ce]=(0,n.useState)(0),ne=(0,n.useCallback)(()=>ce(d=>d+1),[]),J=r?.quarantine?.pending??0,Ve=r?.quarantine?.deleted??0,ze=(0,n.useRef)(null),[u,c]=(0,n.useState)(0),[K,le]=(0,n.useState)(!1),fe=(0,n.useRef)(null),Ie=(0,n.useRef)(null),a=(0,n.useCallback)(async(d=w,x=F,B=A,D={})=>{let $=D.append===!0;try{$?le(!0):(S(!0),I(""));let te=new URLSearchParams;d&&d!=="all"&&te.set("kind",d),x.trim()&&te.set("q",x.trim());let ye=D.tag!==void 0?D.tag:me;ye&&te.set("tag",ye),te.set("status",B||"all"),te.set("limit",String(Sa)),te.set("offset",String(D.offset||0)),be==="title"&&te.set("sort","title");let qe=await(await fetch(`${_}/cards?${te.toString()}`)).json();if(qe.ok){let Ye=qe.cards||[];N(Ee=>$?[...Ee,...Ye.filter(wt=>!Ee.some(St=>St.path===wt.path))]:Ye),c(Number(qe.total)||Ye.length)}}catch(te){I(String(te&&te.message?te.message:te))}finally{$?le(!1):S(!1)}},[w,F,A,be,me]),we=(0,n.useCallback)(async()=>{try{let[d,x]=await Promise.all([fetch(`${_}/overview`).then(B=>B.json()),fetch(`${_}/capture-log`).then(B=>B.json()).catch(()=>null)]);d.ok&&v(d),f(x&&x.ok&&x.available&&x.health||null)}catch(d){I(String(d&&d.message?d.message:d))}finally{S(!1)}},[]),Xe=async d=>{try{let B=await(await fetch(`${_}/delete?path=${encodeURIComponent(d)}`)).json();B.ok?(se({ok:!0,msg:t("deleted")}),await we(),ne()):se({ok:!1,msg:B.error||t("deleteFail")})}catch{se({ok:!1,msg:t("deleteFail")})}y.current&&clearTimeout(y.current),y.current=setTimeout(()=>se(null),2e3)};(0,n.useEffect)(()=>(we(),()=>{ze.current&&clearTimeout(ze.current)}),[we]);let rt=d=>{U(d),ze.current&&clearTimeout(ze.current),ze.current=setTimeout(()=>a(w,d,A),280)},lt=d=>{X(d),a(d,F,A)},at=d=>{let x=String(d||"");de(x),G(null),a(w,F,A,{tag:x})};(0,n.useEffect)(()=>{P==="cards"&&a(w,F,A)},[A,P,ve,be,me]),(0,n.useEffect)(()=>{if(P!=="cards"||O||K||R.length>=u)return;let d=fe.current,x=Ie.current;if(!d)return;let B=new IntersectionObserver(D=>{D[0]&&D[0].isIntersecting&&a(w,F,A,{append:!0,offset:R.length})},{root:x||null,rootMargin:"400px"});return B.observe(d),()=>B.disconnect()},[P,R,u,O,K,w,F,A,a]);let Se=async d=>{try{let x=d.status;if(!x&&d.path)try{let ye=((await fetch(`${_}/cards?status=all&q=${encodeURIComponent(d.title||"")}&limit=50`).then(Fe=>Fe.json())).cards||[]).find(Fe=>Fe.path===d.path);ye&&(x=ye.status)}catch{}let B=x&&x!=="approved"?`&status=${encodeURIComponent(x)}`:"",D=await fetch(`${_}/card?path=${encodeURIComponent(d.path||d.id)}${B}`),$=await D.json();$.ok?G({path:$.path,title:d.title,text:$.text}):I($.error||`HTTP ${D.status}`)}catch(x){I(String(x&&x.message?x.message:x))}},Je=async(d,x)=>{he(!0);try{let B=await fetch(`${_}/export`);if(!B.ok)throw new Error("HTTP "+B.status);let D=await B.json();if(!D.ok)throw new Error(D.error||"export failed");let $,te,ye;if(d==="json"){te="memory-vault.json",ye="application/json";let Ye=D.cards.map(Ee=>({path:Ee.path,title:Ee.title,kind:Ee.kind,status:Ee.status,store:Ee.store,text:Ee.text}));$=JSON.stringify({format:D.format||"memory-eternal-vault",formatVersion:D.formatVersion||1,exportedAt:D.exportedAt||new Date().toISOString(),count:Ye.length,cards:Ye},null,2)}else te="memory-vault.md",ye="text/markdown;charset=utf-8",$=D.cards.map(Ye=>Ye.text.trim()).filter(Boolean).join(`
349
349
 
350
350
  ---
351
351
 
352
- `);let Fe=new Blob([$],{type:ye}),qe=await Ka(Fe,te,!1);if(!qe.ok){de({ok:!1,msg:t("exportFail")}),he(!1);return}de({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+qe.name})}catch(B){de({ok:!1,msg:t("exportFail")+" \xB7 "+(B.message||"")})}finally{he(!1)}y.current&&clearTimeout(y.current),y.current=setTimeout(()=>de(null),2600)},Ae=async c=>{let k=c.target.files&&c.target.files[0];if(c.target.value="",!!k){try{let B=await k.text(),$=await(await fetch(`${_}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:B})).json();if($.ok){await we();let te=$.imported||0,ye=t("importedVault")+"\uFF1A"+te;$.total&&(ye+=t("importedTotal")+$.total+t("importedTotalTail")),$.quarantined&&(ye+=t("importedQuarantine")+$.quarantined+t("importedQuarantineTail")),$.skipped&&(ye+=t("importedSkipped")+$.skipped+t("importedSkippedTail")),$.warning&&(ye+=" \xB7 "+$.warning),de({ok:te>0||!$.total,msg:ye})}else de({ok:!1,msg:$.error||t("importFail")})}catch{de({ok:!1,msg:t("importFail")})}y.current&&clearTimeout(y.current),y.current=setTimeout(()=>de(null),2400)}},r=(0,n.useMemo)(()=>{let c=T.slice();return ee!=="all"&&(c=c.filter(k=>ft(k.submittedBy)===ee)),A!=="all"&&(c=c.filter(k=>(k.status||"approved")===A)),be==="title"?c.sort((k,B)=>String(k.title||"").localeCompare(String(B.title||""))):be==="hot"?c.sort((k,B)=>(B.weight||B.links||0)-(k.weight||k.links||0)):c.sort((k,B)=>new Date(B.updated||0).getTime()-new Date(k.updated||0).getTime()),c},[T,be,ee,A]),H=(0,n.useMemo)(()=>[...new Set(T.map(c=>ft(c.submittedBy)))],[T]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Oe}),De&&(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 "+(De.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:De.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:De.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:De.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)(na,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),m&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:m,"aria-label":t(p?"exitFull":"fullscreen"),children:p?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:s,"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?gt(new Date(x.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${l?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>M(c=>!c),"aria-label":t(l?"collapse":"expand"),title:t(l?"collapse":"expand"),children:l?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="cards"?" active":""}`,onClick:()=>Me("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),l&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="graph"?" active":""}`,onClick:()=>Me("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),l&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="stats"?" active":""}`,onClick:()=>Me("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),l&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="audit"?" active":""}`,onClick:()=>Me("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),l&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),J>0&&(0,e.jsx)("span",{className:"mc-dot",children:J>99?"99+":J})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="optimize"?" active":""}`,onClick:()=>Me("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),l&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),Ve>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:Ve>99?"99+":Ve})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="config"?" active":""}`,onClick:()=>Me("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),l&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Ne(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),l&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:Ie,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,P==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(ut,{label:t("total"),value:i?i.total:"\u2014"}),(0,e.jsx)(ut,{label:t("recent"),value:i?i.recent:"\u2014"}),(0,e.jsx)(ut,{label:t("tags"),value:i?i.tags:"\u2014"}),(0,e.jsx)(ut,{label:t("pending"),value:i?.quarantine?.pending??i?.status?.pending??0}),(0,e.jsx)(ut,{label:t("rejected"),value:i?.quarantine?.rejected??i?.status?.rejected??0}),(0,e.jsx)(ut,{label:t("cardCount"),value:i?i.byKind?.knowledge??0:"\u2014"})]}),P==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:F,onChange:c=>rt(c.target.value)}),me&&(0,e.jsxs)("button",{type:"button",className:"mc-chip active",title:t("clearFilter"),onClick:()=>at(""),children:["\u{1F3F7} ",me," ",(0,e.jsx)("span",{style:{opacity:.7},children:"\u2715"})]}),(0,e.jsx)("input",{ref:q,type:"file",accept:".json,application/json",style:{display:"none"},onChange:Ae}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>q.current&&q.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>Z({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:ae,onClick:()=>Je("md"),children:t(ae?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:ae,onClick:()=>Je("json"),children:t(ae?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>we(),children:t("refresh")})]}),P==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Ht.map(c=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===c?" active":""}`,onClick:()=>st(c),children:t(c==="all"?"all":Ue[c])},c)),(0,e.jsxs)("select",{value:ee,onChange:c=>V(c.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")]}),aa(H).map(c=>(0,e.jsx)("option",{value:c,children:c},c))]}),(0,e.jsxs)("select",{value:A,onChange:c=>Re(c.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(c=>(0,e.jsx)("button",{type:"button",className:`mc-chip${be===c.key?" active":""}`,onClick:()=>v(c.key),children:c.label},c.key))]}),z&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z]}),(0,e.jsx)("div",{style:{display:P==="cards"?"contents":"none"},children:O?(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:()=>we(),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:r.map(c=>(0,e.jsx)(Pa,{card:c,t,query:F.trim(),onOpen:Se,onDelete:Xe,onTagClick:at},c.path))}),T.length<u&&(0,e.jsx)("div",{ref:fe,style:{height:1}}),K&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",T.length," / ",u,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:P==="graph"?"flex":"none",flex:1,minHeight:0},children:W.has("graph")&&(0,e.jsx)(Ea,{t,onOpen:Se,all:Le,onAllChange:Ce,onMutate:ne,active:P==="graph",visible:P==="graph"})}),(0,e.jsx)("div",{style:{display:P==="config"?"contents":"none"},children:W.has("config")&&(0,e.jsx)(ia,{t,onReload:()=>we(),version:ve})}),(0,e.jsx)("div",{style:{display:P==="stats"?"contents":"none"},children:W.has("stats")&&(0,e.jsx)(Fa,{t,tab:"stats",onReload:()=>we(),version:ve})}),(0,e.jsx)("div",{style:{display:P==="audit"?"contents":"none"},children:W.has("audit")&&(0,e.jsx)(Ba,{t,onReload:()=>we(),version:ve})}),(0,e.jsx)("div",{style:{display:P==="optimize"?"contents":"none"},children:W.has("optimize")&&(0,e.jsx)(La,{t,onReload:()=>we(),version:ve})}),tt&&(0,e.jsx)(Ha,{t,onClose:()=>Ne(!1)}),Q&&(0,e.jsx)(Oa,{t,card:Q,query:F.trim(),onNavigate:c=>{let k=r.findIndex(D=>D.path===Q.path),B=r[k+c];B&&G(B)},onTagClick:at,onClose:()=>G(null),onDelete:c=>{G(null),Xe(c)},onFeedback:c=>{let k=Q.path;fetch(`${_}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:F.trim(),path:k,useful:c})}).then(()=>de({ok:!0,msg:t(c?"fbUseful":"fbIrr")})).catch(()=>{}),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>de(null),2e3)}}),(0,e.jsx)(ja,{t,newCard:j,setNewCard:Z,onCreated:()=>{we(),ne(),de({ok:!0,msg:t("created")}),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>de(null),2e3)}})]})]})]})}var oa=({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,ut=({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 ia({t,onReload:o,version:s,compact:m}){let[p,i]=(0,n.useState)(null),[h,T]=(0,n.useState)(0),[N,O]=(0,n.useState)(null),[S,x]=(0,n.useState)(null),[f,z]=(0,n.useState)(!1),[I,w]=(0,n.useState)(!1),X=(0,n.useRef)(!1),F=(0,n.useRef)(null),U=(0,n.useRef)({}),[ee,V]=(0,n.useState)(null),[A,Re]=(0,n.useState)(null),[me,se]=(0,n.useState)(""),[P,C]=(0,n.useState)(""),[W,pe]=(0,n.useState)(""),[Me,be]=(0,n.useState)(null),[v,De]=(0,n.useState)(null),de=(0,n.useCallback)(async r=>{C("version");try{let H=await fetch(_+"/version-check"+(r?"?force=1":"")).then(c=>c.json());H&&H.ok?(De(H),r&&G(H.updateAvailable?t("vcLatest")+" v"+H.latest:t("vcUpToDate"))):r&&G(t("vcCheckFail"),!1)}catch{r&&G(t("vcCheckFail"),!1)}finally{C("")}},[t]);(0,n.useEffect)(()=>{de(!1)},[s,de]);let[y,q]=(0,n.useState)(""),[ae,he]=(0,n.useState)(null),Q=(0,n.useRef)(null),G=(r,H=!0)=>{Q.current&&clearTimeout(Q.current),he({msg:r,ok:H}),Q.current=setTimeout(()=>he(null),1900)},Le=async()=>{if(!P){C("restart");try{let r=await fetch(_+"/restart-self",{method:"POST"});if(r.status===404||r.status===405){G(ce("vcRestartNoRoute",{cmd:v&&v.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let H=await r.json().catch(()=>null);if(!H){G(t("vcRestartFail")+"\uFF08HTTP "+r.status+"\uFF09",!1);return}if(!H.ok){G(H.error||t("vcRestartFail"),!1);return}if(H.alreadyCurrent){G(H.note||t("vcRestartCurrent"));return}G(H.note||t("vcRestartSent")),H.alreadyRunning||setTimeout(()=>{de(!0)},6e3)}catch(r){G(t("vcRestartFail")+"\uFF1A"+String(r&&r.message||r),!1)}finally{C("")}}},Ce=v&&v.resident?String(v.resident.served||""):"",tt=!!(v&&v.onDisk&&Ce&&Ce!==v.onDisk),Ne=!!(v&&v.resident&&v.resident.managed===!1&&v.resident.managedKnown===!1),l=v&&v.resident&&v.resident.replaceBlocked&&v.resident.replaceBlocked.fresh||null,M=!!(v&&v.resident&&v.resident.managedBy==="host"),j=!!(v&&v.resident&&v.resident.managed===!1&&!Ne&&!M),Z=!!(v&&v.resident&&!Ce),ve=tt||Z||j||Ne,ce=(r,H)=>Object.keys(H).reduce((c,k)=>c.split("{"+k+"}").join(H[k]),t(r)),ne=(0,n.useCallback)(async()=>{try{let[r,H,c,k]=await Promise.all([fetch(`${_}/config`).then(B=>B.json()).catch(()=>null),fetch(`${_}/setup-status`).then(B=>B.json()).catch(()=>null),fetch(`${_}/budget`).then(B=>B.json()).catch(()=>null),fetch(`${_}/llm-routes`).then(B=>B.json()).catch(()=>null)]);if(k&&k.ok&&be(k),r&&r.ok){i(r),T(r.revision??0),O(r.schema??null);let B=Jt(r.config??{},U.current);U.current=B.overlay,x({...B.values}),V(r.dsh??null),z(r.writable===!1),w(r.viaPending===!0),se(""),X.current=!1}else c&&c.ok?(x({...c}),z(!0),se(t("configNeedsDsh"))):se(t("adminLoadFail"));H&&H.ok&&Re(H),pe("")}catch{se(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{ne()},[s,ne]);let J=(r,H)=>{X.current=!0,x(c=>({...c??{},[r]:H}))};(0,n.useEffect)(()=>{F.current=ne},[ne]),(0,n.useEffect)(()=>{if(typeof EventSource>"u")return;let r=null;try{r=new EventSource(_+"/events")}catch{return}let H=()=>{!X.current&&typeof F.current=="function"&&F.current()};try{r.addEventListener("config",H)}catch{}return()=>{try{r.close()}catch{}}},[]);let Ve=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),ze=r=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[r]||r,u=async()=>{if(!S)return;if(f){G(t("editInSetting"),!1);return}let r={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]},H=[];for(let[c,[k,B]]of Object.entries(r)){if(!(c in S))continue;let D=S[c],$=typeof D=="number"?D:Number(D);(D===""||D===null||D===void 0||!Number.isFinite($)||$<k||$>B)&&H.push(t("invalidField",{field:c,min:k,max:B,value:String(D===""?"\u7A7A":D)}))}if(H.length){let c=t("saveInvalid")+"\uFF1A"+H.join("\uFF1B");se(c),G(c,!1);return}C("save");try{let c={...S};for(let $ of Object.keys(S))$ in c&&typeof c[$]=="string"&&c[$].trim()!==""&&Ve.has($)&&(c[$]=Number(c[$]));Array.isArray(c.vaultProfiles)&&(c.vaultProfiles=c.vaultProfiles.filter($=>$&&(String($.name||"").trim()||String($.path||"").trim())));let k=await fetch(`${_}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:c,expectedRevision:h})}),B=await k.text(),D=null;try{D=B?JSON.parse(B):null}catch{D=null}if(D||(D={error:"HTTP "+k.status+(B?"\uFF1A"+B.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")}),D&&D.ok){let $=typeof D.pendingOutcome=="string"?D.pendingOutcome:"",te,ye=!0;if($==="applied")te=t("savedApplied")+(Array.isArray(D.applied)&&D.applied.length?" \xB7 "+D.applied.join("\u3001"):"");else if($==="queued")ye=!1,te=t("saveQueued");else if($==="failed")ye=!1,te=t("saveFail")+" \xB7 "+(D.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if($==="applied-direct")te=t("savedOk")+" \xB7 "+t("savedDirect");else{let Fe=Array.isArray(D.pending)&&D.pending.length?" \xB7 "+t("savePending"):D.note?" \xB7 "+t("restartHint"):"";te=(D.retried?"\u267B ":"")+t("savedOk")+Fe}U.current={...U.current,...c},ye?pe(te):se(te),G(te,ye),await ne()}else{let $=k.status===409?t("conflictRefresh"):D?.error||t("saveFail");se($),G($,!1)}}catch{se(t("saveFail")),G(t("saveFail"),!1)}finally{C("")}},d=()=>{U.current={},x({...p?.config??{}}),pe("")},K={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},le=r=>Array.isArray(r?.vaultProfiles)?r.vaultProfiles:[],fe=(r,H,c)=>x(k=>{let B=le(k).map($=>({...$||{}})),D={...B[r]||{}};return H==="match"?String(c).trim()?D.match={...D.match||{},workspace:c}:delete D.match:D[H]=c,B[r]=D,{...k??{},vaultProfiles:B}}),Ie=()=>x(r=>({...r??{},vaultProfiles:[...le(r),{name:"",path:""}]})),a=r=>x(H=>({...H??{},vaultProfiles:le(H).filter((c,k)=>k!==r)})),we={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},Xe={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},rt={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}},st=async r=>{let H=rt[r];H&&x(c=>({...c??{},...H}))},at=async(r,H)=>{C(r+H);try{let k=await(await fetch(`${_}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:r,action:H})})).json();k&&k.ok?G(ce(H==="install"?"mcpInstalled":"mcpUninstalled",{agent:r})):G(ce("mcpActionFail",{agent:r,error:k?.error||""}),!1);try{let B=await fetch(`${_}/setup-status`).then(D=>D.json());B&&B.ok&&Re(B)}catch{}}catch{G(t("mergeFail"),!1)}finally{C("")}},Se=({k:r,label:H,type:c="text",step:k,min:B,max:D})=>(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:H||r}),(0,e.jsx)("input",{type:c,step:k,min:B,max:D,value:S?S[r]??"":"",onChange:$=>{let te=$.target.value;J(r,c==="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}})]}),Je=new Set(["autoRestartOnDrift"]),Ae=({k:r,label:H})=>{let c=S?S[r]:void 0,k=c===void 0?Je.has(r):!!c;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:k,onChange:B=>J(r,B.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:H||r})]})};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:m?"0 0 auto":1,minHeight:0,maxHeight:m?"52vh":void 0},children:[(0,e.jsx)("style",{children:Oe}),ae&&(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 "+(ae.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ae.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ae.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:ae.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[me&&(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 ",me]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:ne,children:["\u21BB ",t("retry")]})]}),I&&(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")]}),f&&(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")]}),W&&(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 ",W]}),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:we,children:[t("vcLoaded")," v",p.version]}),v&&v.resident&&v.resident.served&&v.resident.served!==p.version&&(0,e.jsxs)("code",{style:we,children:[t("vcResident")," v",v.resident.served]}),v&&v.resident&&!v.resident.served&&(0,e.jsxs)("code",{style:{...we,color:"#b45309",fontWeight:600},children:[t("vcResident")," ",t("vcResidentDownShort")]}),v&&v.resident&&v.resident.served&&v.resident.managed===!1&&(0,e.jsxs)("code",{style:{...we,color:"#b45309",fontWeight:600},children:[t("vcResident")," v",v.resident.served," \xB7 ",t(l?"vcResidentReplaceBlockedShort":M?"vcResidentHostManagedShort":Ne?"vcResidentLockUnknownShort":"vcResidentUnmanagedShort")]}),vt&&(0,e.jsxs)("code",{style:we,children:[t("vcPage")," v",vt]}),v&&v.onDisk&&(0,e.jsxs)("code",{style:we,children:[t("vcOnDisk")," v",v.onDisk]}),v&&v.latest&&(0,e.jsxs)("code",{style:we,children:[t("vcLatest")," v",v.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:P==="version",onClick:()=>de(!0),children:P==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),v&&(v.stale||Z||j||Ne||l)&&(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"},children:(0,e.jsxs)("div",{children:["\u26A0\uFE0F ",v.stale?ce("vcHostProcessStale",{disk:v.onDisk,loaded:v.loaded}):Z?ce("vcResidentDown",{port:v.resident&&v.resident.port||"",cmd:v.restartCommand||"dsh-memory restart --port 7999"}):l?ce("vcResidentReplaceBlocked",{served:Ce,err:l.error||"",path:l.lockPath||"",cmd:v.restartCommand||"dsh-memory restart --port "+(v.resident&&v.resident.port||7999)}):Ne?ce("vcResidentLockUnknown",{served:Ce,path:v.resident&&v.resident.lock&&v.resident.lock.path||"",err:v.resident&&v.resident.lock&&v.resident.lock.error||""}):ce("vcResidentUnmanaged",{served:Ce,cmd:v.restartCommand||"dsh-memory restart --port 7999"})]})}),v&&(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"+(ve?" me-on":""),disabled:!!P,onClick:Le,children:P==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),v.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:v.restartCommand}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.65},children:ve?ce("vcRestartFixes",{served:Ce||"",disk:v.onDisk||""}):v.stale?ce("vcRestartHostOnly",{loaded:v.loaded||"",disk:v.onDisk||""}):ce("vcRestartAnyway",{ver:v.onDisk||""})})]}),vt&&v&&v.onDisk&&vt!==v.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:vt,disk:v.onDisk})}),v&&v.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:v.updateCommand})]}),v&&v.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",v.checkError]})]}),A&&A.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:A.agents.map(r=>(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:r.isDsh?t("dshHostLabel"):r.name}),r.isDsh&&r.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",r.version]}),!r.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),r.installed&&r.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),r.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),r.mcpConfigured===!0&&r.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),r.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",r.recallTool?t("enabled"):t("disabled"),")"]})]}),r.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",r.hook]}),!r.isDsh&&r.installed&&r.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!P,onClick:()=>at(r.name,"install"),children:t("installMcp")}),!r.isDsh&&r.installed&&r.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!P,onClick:()=>{window.confirm(t("uninstallConfirm"))&&at(r.name,"uninstall")},children:t("uninstallMcp")})]},r.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),y&&(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:y})})]}),S?(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(r=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>st(r),disabled:!!P,children:[r==="A"?"\u{1F7E2} ":r==="B"?"\u{1F4B0} ":"\u2B50 ",rt[r].label]},r))})]}),(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)(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)(Ae,{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:ee?.vaultDir||"\u2014"}),ee?.vaultName?`\uFF08${ee.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(K[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]}),le(S).map((r,H)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:r.name||"",placeholder:t("vaultNamePh"),onChange:c=>fe(H,"name",c.target.value),style:Xe,disabled:f}),(0,e.jsx)("input",{value:r.path||"",placeholder:t("vaultPathPh"),onChange:c=>fe(H,"path",c.target.value),style:Xe,disabled:f}),(0,e.jsx)("input",{value:r.match&&r.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:c=>fe(H,"match",c.target.value),style:Xe,disabled:f}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>a(H),disabled:f,title:t("delete"),children:"\u2715"})]},H)),(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:Ie,disabled:f,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:S.activeVault||"",onChange:r=>J("activeVault",r.target.value),disabled:f,style:Xe,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),le(S).filter(r=>r&&r.name).map(r=>(0,e.jsx)("option",{value:r.name,children:r.name},r.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)(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)(Ae,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(Ae,{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"}),Me&&Me.providers&&Me.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:S.captureProvider||"",onChange:r=>{J("captureProvider",r.target.value),J("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")}),Me.providers.map(r=>(0,e.jsx)("option",{value:r.id,children:r.label},r.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:S.captureModel||"",onChange:r=>J("captureModel",r.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")}),((Me.providers.find(r=>r.id===S.captureProvider)||{}).models||[]).map(r=>(0,e.jsx)("option",{value:r.id,children:r.label||r.id},r.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)(Ae,{k:"captureFollowSession",label:t("captureFollowSession")}),(0,e.jsx)(Ae,{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:!!P,onClick:async()=>{C("llmtest");try{let r=await fetch(_+"/llm-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:S.captureProvider||"",model:S.captureModel||"",firstOnly:S.captureFirstOnly===!0})}).then(H=>H.json());r&&r.ok?G(t("llmTestOk")+"\uFF1A"+r.route.provider+(r.route.model?"/"+r.route.model:"")+" \xB7 "+r.ms+"ms \xB7 "+t("llmCandidates")+" "+r.candidates):G(t("llmTestFail")+"\uFF1A"+(r&&(r.failure?r.failure.code+" "+r.failure.message:r.error)||"?"),!1)}catch(r){G(t("llmTestFail")+"\uFF1A"+String(r&&r.message||r),!1)}finally{C("")}},children:P==="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:S.auditMode??"all",onChange:r=>J("auditMode",r.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)(Qt,{label:t("auditExemptAgents"),value:S.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(A?.agents||[]).filter(r=>!r.isDsh).map(r=>({value:r.name,label:r.name}))],onChange:r=>J("auditExemptAgents",r)}),(0,e.jsx)(Qt,{label:t("auditExemptKinds"),value:S.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Ht.filter(r=>r!=="all").map(r=>({value:r,label:t(Ue[r])}))],onChange:r=>J("auditExemptKinds",r)}),(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)(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:S.autoWebMode??"init",onChange:r=>J("autoWebMode",r.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)(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:[P==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),W&&P!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",W]}),me&&P!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",me]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:d,disabled:!!P,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:f?()=>G(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):u,disabled:P==="save",title:t(f?"readonlyBody":"saveConfig"),children:P==="save"?"\u23F3 "+t("saving"):f?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function Ba({t,onReload:o,version:s}){let[m,p]=(0,n.useState)([]),[i,h]=(0,n.useState)([]),[T,N]=(0,n.useState)("all"),[O,S]=(0,n.useState)("all"),[x,f]=(0,n.useState)(""),[z,I]=(0,n.useState)(new Set),[w,X]=(0,n.useState)(""),[F,U]=(0,n.useState)(null),[ee,V]=(0,n.useState)("pending"),A=(y,q=!0)=>{U({msg:y,ok:q}),setTimeout(()=>U(null),3e3)},Re=[...new Set([...m,...i].map(y=>y.submittedBy).filter(Boolean))],me=(0,n.useCallback)(async()=>{try{let y=await fetch(`${_}/audit/list`).then(q=>q.json());y.ok&&(p(y.pending||[]),h(y.rejected||[]),I(new Set),pe(new Set),be({}))}catch{}},[]);(0,n.useEffect)(()=>{me()},[s,me]);let se=(ee==="pending"?m:i).filter(y=>{if(T!=="all"&&y.kind!==T||O!=="all"&&ft(y.submittedBy)!==O)return!1;if(x){let q=(y.created||"").slice(0,10);if(q&&q!==x)return!1}return!0}),P=y=>I(q=>{let ae=new Set(q);return ae.has(y)?ae.delete(y):ae.add(y),ae}),C=async(y,q)=>{let ae=q||[...z];if(!ae.length){A(t("noSelection"),!1);return}X("apply");let he=t(y==="approved"?"toastApproved":y==="rejected"?"toastRejected":"toastCardDeleted");try{let Q=0;for(let G of ae){let Le=y==="approved"?"audit/approve":y==="rejected"?"audit/reject":"delete";try{(await fetch(_+"/"+Le+"?path="+encodeURIComponent(G)+(y==="delete"?"&permanent=0":""))).ok||Q++}catch{Q++}}await me(),o&&o(),Q?A(t("toastFailed")+"\uFF08"+Q+"/"+ae.length+"\uFF09",!1):A(he+" "+ae.length+" \u5F20")}catch(Q){A(t("toastFailed")+": "+String(Q&&Q.message||Q),!1)}finally{X("")}},[W,pe]=(0,n.useState)(new Set),[Me,be]=(0,n.useState)({}),v=y=>Me[y]||{},De=async y=>{let q=y.path,ae=!W.has(q);if(pe(he=>{let Q=new Set(he);return ae?Q.add(q):Q.delete(q),Q}),!(!ae||Me[q])){be(he=>({...he,[q]:{loading:!0}}));try{let he=y.status||(ee==="pending"?"pending":"rejected"),Q=await fetch(`${_}/card?path=${encodeURIComponent(q)}&status=${he}`).then(G=>G.json());Q&&Q.ok?be(G=>({...G,[q]:{text:Q.text||""}})):be(G=>({...G,[q]:{error:Q&&Q.error||"HTTP"}}))}catch(he){be(Q=>({...Q,[q]:{error:String(he&&he.message||he)}}))}}},de=[...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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(oa,{toast:F}),(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:y=>N(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")}),Ht.filter(y=>y!=="all").map(y=>(0,e.jsx)("option",{value:y,children:t(Ue[y])},y))]}),(0,e.jsxs)("select",{value:O,onChange:y=>S(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")}),aa(Re).map(y=>(0,e.jsx)("option",{value:y,children:y},y))]}),(0,e.jsx)("input",{type:"date",value:x,onChange:y=>f(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",m.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:se.length>0&&de.length===se.length,onChange:y=>{y.target.checked?I(new Set(se.map(q=>q.path))):I(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!de.length||!!w,onClick:()=>C("approved"),children:["\u2713 ",t(ee==="rejected"?"restore":"approve")]}),ee==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!de.length||!!w,onClick:()=>C("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!de.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&C("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),se.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:se.map(y=>{let q=v(y.path),ae=W.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:()=>P(y.path)}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"0 6px"},title:t(ae?"collapse":"expand"),"aria-expanded":ae,onClick:()=>De(y),children:ae?"\u25BE":"\u25B8"}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Ke[y.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},title:t(ae?"collapse":"expand"),onClick:()=>De(y),children:y.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ft(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:()=>C("approved",[y.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>C("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:()=>C("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"))&&C("delete",[y.path])},children:"\u{1F5D1}"})]})]}),ae&&(0,e.jsxs)("div",{style:{padding:"2px 10px 12px 34px"},children:[q.loading&&(0,e.jsxs)("div",{style:{fontSize:12,opacity:.6},children:["\u23F3 ",t("loading")]}),q.error&&(0,e.jsxs)("div",{style:{fontSize:12,color:"#f87171"},children:["\u26A0 ",t("auditBodyFail"),"\uFF1A",q.error]}),q.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:Ke[y.kind]||"#6B7280",borderColor:(Ke[y.kind]||"#6B7280")+"59",background:(Ke[y.kind]||"#6B7280")+"1a"},children:[kt[y.kind]||"\u{1F4CE}"," ",t(Ue[y.kind]||"kindKnowledge")]}),(Array.isArray(y.tags)?y.tags:[]).slice(0,8).map(he=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",he]},he)),!!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:Bt(Rt(q.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:!!w,onClick:()=>C("approved",[y.path]),children:["\u2713 ",t("approve")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!w,onClick:()=>C("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 La({t,onReload:o,version:s}){let[m,p]=(0,n.useState)([]),[i,h]=(0,n.useState)(""),[T,N]=(0,n.useState)(null),O=(f,z=!0)=>{N({msg:f,ok:z}),setTimeout(()=>N(null),3200)},S=(0,n.useCallback)(async()=>{try{let f=await fetch(`${_}/recycle/list`).then(z=>z.json());f.ok&&p(f.items||[])}catch{}},[]);(0,n.useEffect)(()=>{S()},[s,S]);let x=async(f,z)=>{let I=(m.find(w=>w.path===z)||{}).title||z;h(f+z);try{let X=await fetch(_+(f==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(z)),F=await X.json().catch(()=>null);await S(),o&&o(),X.ok&&(!F||F.ok!==!1)?O(t(f==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+I):O(t("toastFailed")+"\uFF1A"+(F&&F.error||"HTTP "+X.status),!1)}catch(w){O(t("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{h("")}};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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(oa,{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:!!i||m.length===0,title:m.length?"":t("emptyRecycle"),onClick:async()=>{h("purgeAll");try{let f=await fetch(_+"/recycle/purge-expired?days=0"),z=await f.json().catch(()=>null);await S(),O(f.ok?t("toastPurgedExpired")+(z&&z.purged!=null?"\uFF08"+z.purged+"\uFF09":""):t("toastFailed"),f.ok)}catch(f){O(t("toastFailed")+"\uFF1A"+String(f&&f.message||f),!1)}finally{h("")}},children:t("emptyRecycle")})]}),m.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:m.map(f=>(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:Ke[f.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(f.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!i,onClick:()=>x("restore",f.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"))&&x("purge",f.path)},children:t("purge")})]},f.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 Pa=({card:t,t:o,onOpen:s,query:m,onDelete:p,onTagClick:i})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>s(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ke[t.kind]||Ke.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:kt[t.kind]||"\u{1F4CE}"}),m?Ft(t.title,m):t.title,Ua(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:m?Ft(t.summary||"",m):t.summary||""}),m&&(()=>{let h=Ut(t.body||"",m);return h?(0,e.jsx)("p",{className:"mc-snippet",children:Ft(h,m)}):null})(),Zt(t).length>0&&(0,e.jsx)("div",{className:"mc-tags",children:Zt(t).slice(0,4).map(h=>(0,e.jsxs)("button",{type:"button",className:"mc-tag mc-tag-click",title:h,onClick:T=>{T.stopPropagation(),i&&i(h)},children:["\u{1F3F7} ",h]},h))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[kt[t.kind]||"\u{1F4CE}"," ",o(Ue[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ft(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",gt(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:h=>{h.stopPropagation(),window.confirm(o("deleteConfirm"))&&p&&p(t.path)},children:"\u{1F5D1}"})]})]});function Fa({t,tab:o,onReload:s,version:m}){let[p,i]=(0,n.useState)(null),[h,T]=(0,n.useState)(""),[N,O]=(0,n.useState)(null),[S,x]=(0,n.useState)(null),[f,z]=(0,n.useState)(null),[I,w]=(0,n.useState)(null),X=(0,n.useCallback)(async()=>{A("align");try{let l=await fetch(_+"/align").then(M=>M.json());l&&l.findings?w(l):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{A("")}},[t]),F=async()=>{if(window.confirm(t("alignFixConfirm"))){A("alignfix");try{let l=await fetch(_+"/setup-run",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(M=>M.json());l&&l.ok?(notify(t("alignFixed")),await X()):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{A("")}}},[U,ee]=(0,n.useState)([]),[V,A]=(0,n.useState)(""),[Re,me]=(0,n.useState)(!1),se=(0,n.useCallback)(async()=>{if(!(!N||!N.merge||!N.merge.length)&&window.confirm(t("mergeAllConfirm"))){A("merge");try{let l={},M=ne=>l[ne]===void 0?ne:l[ne]=M(l[ne]),j=(ne,J)=>{l[M(ne)]=M(J)},Z=new Set;for(let ne of N.merge)Z.add(ne.a.path),Z.add(ne.b.path),j(ne.a.path,ne.b.path);let ve={};for(let ne of Z){let J=M(ne);(ve[J]=ve[J]||[]).push(ne)}let ce=0;for(let ne of Object.values(ve)){if(ne.length<2)continue;(await fetch(`${_}/merge?paths=${encodeURIComponent(ne.join(","))}`).then(Ve=>Ve.json())).ok&&ce++}await P(),s&&s()}catch{}A("")}},[N,P,s,t]);async function P(){try{let l=await Promise.all([fetch(`${_}/stats`),fetch(`${_}/budget`),fetch(`${_}/capture-log`),fetch(`${_}/cards?status=all&limit=30&agent=${xt}`)]),[M,j,Z,ve]=await Promise.all(l.map(ce=>ce.json()));M&&M.ok&&i(M),j&&j.ok&&x(j),Z&&Z.ok&&z(Z),ve&&ve.ok&&ee(ve.cards||[]),T(!M||!M.ok?t("adminLoadFail"):"")}catch{T(t("adminLoadFail"))}}let C=(0,n.useCallback)(async()=>{A("scan");try{let l=await fetch(`${_}/optimize`).then(M=>M.json());l.ok&&O(l)}catch{T(t("adminLoadFail"))}finally{A("")}},[t]),[W,pe]=(0,n.useState)(null),Me=(0,n.useCallback)(async()=>{A("refine");try{let l=await fetch(`${_}/refine-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:8})}).then(M=>M.json());l&&l.ok?pe(l):notify(l&&l.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{A("")}},[t]),be=async(l,M)=>{if(!(M==="merge"&&!window.confirm(t("mergeConfirm")))){A("refineapply");try{let j=await fetch(`${_}/refine-apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({a:l.a.path,b:l.b.path,action:M,relation:l.relation})}).then(Z=>Z.json());j&&j.ok?(notify(t("refineApplied")),pe(Z=>Z&&{...Z,findings:(Z.findings||[]).filter(ve=>!(ve.a.path===l.a.path&&ve.b.path===l.b.path))}),await P(),s&&s()):notify(j&&j.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{A("")}}},[v,De]=(0,n.useState)(null),de=(0,n.useCallback)(async()=>{A("junk");try{let l=await fetch(`${_}/refine-junk`).then(M=>M.json());l&&l.ok?De(l.items||[]):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{A("")}},[t]),y=async l=>{if(l.length&&window.confirm(t("junkRecycleAllConfirm"))){A("junkpurge");try{let M=await fetch(`${_}/refine-junk-purge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:l})}).then(j=>j.json());M&&M.removed?(notify(t("junkDone")+"\uFF1A"+M.removed.length+(M.failed?.length?"\uFF08\u5931\u8D25 "+M.failed.length+"\uFF09":"")),De(j=>j&&j.filter(Z=>!M.removed.includes(Z.path))),await P(),s&&s()):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{A("")}}},[q,ae]=(0,n.useState)(null),he=(0,n.useCallback)(async()=>{A("goals");try{let l=await fetch(_+"/refine-goals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:30})}).then(M=>M.json());l&&l.ok?ae(l):notify(l&&l.error||t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{A("")}},[t]),Q=async l=>{A("goalskeep");try{let M=await fetch(_+"/refine-goals-keep",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:l.members.map(j=>j.path)})}).then(j=>j.json());M&&M.ok?(notify(t("goalDone")),ae(j=>j&&{...j,clusters:(j.clusters||[]).filter(Z=>Z.goal!==l.goal)})):notify(t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{A("")}},G=async l=>{if(window.confirm(t("mergeConfirm"))){A("goalsmerge");try{let M=await fetch(_+"/merge?paths="+encodeURIComponent(l.members.map(j=>j.path).join(","))).then(j=>j.json());M&&M.ok?(notify(t("goalMerged")),ae(j=>j&&{...j,clusters:(j.clusters||[]).filter(Z=>Z.goal!==l.goal)}),await P(),s&&s()):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{A("")}}};(0,n.useEffect)(()=>{P()},[m]);let Le=async(l,M)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${_}/merge?paths=${encodeURIComponent(l+","+M)}`).then(Z=>Z.json())).ok&&(await P(),s&&s())}catch{}},Ce=async l=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${_}/delete?path=${encodeURIComponent(l)}`).then(j=>j.json())).ok&&(await P(),s&&s())}catch{}},tt=["project","knowledge","content","prompt","business","tool","mistake"],Ne=({title:l,kind:M,updated:j,path:Z})=>(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:mt.colors[M]||"#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:gt(j)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Ce(Z),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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[h&&(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 ",h]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:P,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:X,children:t(V==="align"?"exporting":"alignRun")}),I&&I.counts&&I.counts.fix>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:F,children:t(V==="alignfix"?"exporting":"alignFix")}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("alignHint")})]}),I&&I.findings?(0,e.jsxs)("div",{style:{marginTop:6},children:[(0,e.jsxs)("div",{style:{fontSize:12,opacity:.75,marginBottom:4},children:[t("alignDisk")," v",I.onDisk||"?",I.residentServed?" \xB7 "+t("alignResident")+" v"+I.residentServed:"",I.hostVersion?" \xB7 "+t("alignHost")+" v"+I.hostVersion:""]}),(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:I.findings.map((l,M)=>(0,e.jsxs)("li",{style:{padding:"4px 2px",borderTop:M?"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]},M))})]}):(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:()=>P(),children:["\u21BB ",t("refresh")]})]}),f?f.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(f.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:(f.entries||[]).map((l,M)=>{let j=Ma[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:gt(l.time?new Date(l.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:j[1],fontWeight:600},children:[j[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||""})]},M)})})})}):(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",U.length,"\uFF09"]}),U.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:U.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:Ke[l.kind]||Ke.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:gt(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,M=Math.max(...l.map(ce=>ce.count),1),j=260,Z=50,ve=j/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:j,height:Z,style:{display:"block",width:"100%",height:50},children:l.map((ce,ne)=>{let J=Math.round(ce.count/M*(Z-4));return(0,e.jsx)("rect",{x:ne*ve+1,y:Z-J,width:Math.max(ve-2,2),height:J,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:tt.map(l=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:mt.colors[l]||"#666"}}),t(Ue[l]),": ",p.byKind?.[l]||0]},l))})]}),S&&(S.budgetChars||S.recallLimit||S.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:S.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:S.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",S.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)(Ne,{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:C,children:V==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),N&&N.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){A("oneclick");try{let l=JSON.stringify({cleanupStale:Re}),j=await(await fetch(`${_}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:l})).json();j&&j.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${j.plan.merged} ${t("optimizedMerged")}${Re?` \xB7 ${j.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await P(),s&&s(),O(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{A("")}}},children:V==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),N&&N.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:Re,onChange:l=>me(l.target.checked)}),t("oneClickAlsoStale")]})]}),!N&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),N&&(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}}),N.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:se,children:t(V==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),N.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:N.merge.map((l,M)=>(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:()=>Le(l.a.path,l.b.path),children:t("mergeNow")})]},M))}):(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",N.stale?.length||0,"\uFF09"]}),N.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;A("clean");let l=0;for(let M of N.stale)try{await fetch(`${_}/delete?path=${encodeURIComponent(M.path)}`),l++}catch{}A(""),notify(`${l} ${t("deletedStale")}`),await P(),s&&s()},children:t("cleanStale")})}),N.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:N.stale.map(l=>(0,e.jsx)(Ne,{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:Me,children:t(V==="refine"?"exporting":"refineScan")}),(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("refineHint")})]}),W?.findings?.length?W.findings.map((l,M)=>(0,e.jsxs)("div",{style:{borderTop:M?"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:()=>be(l,"keepA"),children:t("refineKeepA")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>be(l,"keepB"),children:t("refineKeepB")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>be(l,"keepBoth"),children:t("refineKeepBoth")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>be(l,"merge"),children:t("refineMerge")})]})]},M)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(W?"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:de,children:t(V==="junk"?"exporting":"junkScan")}),v?.length?(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:()=>y(v.map(l=>l.path)),children:t(V==="junkpurge"?"exporting":"junkRecycleAll")}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("junkHint")})]}),v?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:v.map((l,M)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 2px",borderTop:M?"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")})]},M))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(v?"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:he,children:t(V==="goals"?"exporting":"goalScan")}),q?(0,e.jsxs)("span",{style:{opacity:.6,fontSize:11},children:[t("goalStats"),"\uFF1A",q.cached," / ",q.calls]}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("goalHint")})]}),q?.clusters?.length?q.clusters.map((l,M)=>(0,e.jsxs)("div",{style:{borderTop:M?"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((j,Z)=>(0,e.jsx)("li",{children:j.title},Z))}),(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:()=>Q(l),children:t("goalKeep")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>G(l),children:t("goalMerge")})]})]},M)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(q?"goalNone":"goalIdle")})]})]})]})]})}var Pt=[{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 ja({t,newCard:o,setNewCard:s,onCreated:m}){if(!o)return null;let p=Pt.find(x=>x.key===o.template),i=o.body||(p?t(p.bodyKey):""),h=o.kind||(p?p.kind:"knowledge"),T=o.tags||(p?t(p.tagKey):""),N=o._creating,O=x=>{let f=Pt.find(z=>z.key===x);s(z=>({...z,template:x,kind:f?f.kind:z.kind,body:f?t(f.bodyKey):z.body,tags:f?t(f.tagKey):z.tags}))},S=async()=>{if(!(!o.title&&!i)){s(x=>({...x,_creating:!0}));try{(await fetch(`${_}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:h,tags:T.split(",").map(f=>f.trim()).filter(Boolean),body:i,source:"manual"})}).then(f=>f.json())).ok?(s(null),m&&m()):s(f=>({...f,_creating:!1}))}catch{s(f=>({...f,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>s(null),children:[(0,e.jsx)("style",{children:Oe}),(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:()=>s(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:[Pt.map(x=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===x.key?" me-on":""}`,onClick:()=>O(x.key),children:t(x.label)},x.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>s(x=>({...x,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:h,onChange:x=>s(f=>({...f,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:o.title||"",onChange:x=>s(f=>({...f,title:x.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:T,onChange:x=>s(f=>({...f,tags:x.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:i,onChange:x=>s(f=>({...f,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:N,onClick:S,children:t(N?"exporting":"createCard")})})]})]})]})}async function jt(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 s=document.createElement("textarea");s.value=o,s.setAttribute("readonly",""),s.style.position="fixed",s.style.left="-9999px",s.style.top="0",document.body.appendChild(s),s.focus(),s.select();let m=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(s),m}catch{return!1}}function Ha({t,onClose:o}){let[s,m]=(0,n.useState)(""),[p,i]=(0,n.useState)(""),[h,T]=(0,n.useState)(""),[N,O]=(0,n.useState)(!0),[S,x]=(0,n.useState)(!1),[f,z]=(0,n.useState)(""),[I,w]=(0,n.useState)(""),X=(0,n.useRef)(null),F=(0,n.useRef)(null),U=()=>{let C=X.current;if(C)try{C.focus(),C.select()}catch{}},ee=C=>{z(C),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>z(""),2400)};(0,n.useEffect)(()=>{let C=!0;return fetch(_+"/diagnostics").then(W=>W.json()).then(W=>{C&&(W&&W.ok?(i(String(W.diagnostics||"")),T(String(W.version||""))):x(!0))}).catch(()=>{C&&x(!0)}).finally(()=>{C&&O(!1)}),()=>{C=!1}},[]),(0,n.useEffect)(()=>{let C=W=>{W.key==="Escape"&&o()};return window.addEventListener("keydown",C),()=>{window.removeEventListener("keydown",C),F.current&&clearTimeout(F.current)}},[o]);let V=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),A=()=>{let C=s.trim().split(`
353
- `)[0]||"",W=Kt({title:"[Bug] "+(C.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Vt({description:s,diagnostics:p,version:h})});try{window.open(W,"_blank","noopener")}catch{ee(t("fbCopyFail"))}},Re=async()=>{await jt(p)?(w(""),ee(t("fbCopiedDiag"))):(w(p),ee(t("fbCopyManual")))},me=async()=>{let C=qt({lang:V,description:s,diagnostics:p});await jt(C)?(w(""),ee(t("fbCopiedPrompt"))):(w(C),ee(t("fbCopyManual")))},se={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},P={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",wordBreak:"break-word",overflowX:"hidden"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:C=>C.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:s,onChange:C=>m(C.target.value),placeholder:t("fbDesc"),rows:5,style:se}),(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:Re,disabled:!p,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:P,children:N?t("fbLoading"):S?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(!s.trim()){ee(t("fbNeedDesc"));return}A()},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:me,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),f&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:f}),I&&(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:U,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:X,readOnly:!0,value:I,rows:7,style:se})]})]})]})]})}function Oa({t,card:o,query:s,onClose:m,onDelete:p,onFeedback:i,onNavigate:h,onTagClick:T}){let[N,O]=(0,n.useState)(0),[S,x]=(0,n.useState)(""),[f,z]=(0,n.useState)(()=>{try{let C=localStorage.getItem("me-read-width");return["narrow","mid","wide"].includes(C)?C:"mid"}catch{return"mid"}}),I={narrow:720,mid:900,wide:1180};(0,n.useEffect)(()=>{let C=W=>{if(W.key==="Escape"){m();return}let pe=String(W.target&&W.target.tagName||"").toLowerCase();pe==="input"||pe==="textarea"||pe==="select"||W.target&&W.target.isContentEditable||(W.key==="j"&&h?(W.preventDefault(),h(1)):W.key==="k"&&h&&(W.preventDefault(),h(-1)))};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[m,h]);let w=async(C,W)=>{let pe=await jt(String(C||""));x(pe?t("copied")+" \xB7 "+W:t("copyFail")),setTimeout(()=>x(""),1500)},{meta:X,body:F}=(0,n.useMemo)(()=>Rt(o.text||""),[o.text]),U=C=>{let W=X.find(([pe])=>String(pe).toLowerCase()===C);return W?W[1]:""},ee=_t(U("tags")),V=U("kind")||"knowledge",A=(U("status")||"approved").toLowerCase(),Re=Ke[V]||"#6B7280",me=(F||"").length>460,[se,P]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:m,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",onClick:C=>C.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{title:o.title,children:[(0,e.jsx)("span",{style:{marginRight:6,flex:"none"},children:kt[V]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{className:"me-head-actions",children:[S&&(0,e.jsx)("span",{style:{fontSize:11.5,color:"#10b981",whiteSpace:"nowrap"},children:S}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",title:t("copyBody"),onClick:()=>w(F,t("copyBody")),children:["\u{1F4CB} ",t("copyBody")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",title:t("copyPath"),onClick:()=>w(o.path,t("copyPath")),children:["\u{1F517} ",t("copyPath")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",title:t("readWidth"),onClick:()=>{let C=["narrow","mid","wide"],W=C[(C.indexOf(f)+1)%C.length];z(W);try{localStorage.setItem("me-read-width",W)}catch{}},children:[t("readWidth")," \xB7 ",t(f==="narrow"?"widthNarrow":f==="wide"?"widthWide":"widthMid")]}),s&&(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")]})]}),me&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":se,onClick:()=>P(C=>!C),children:t(se?"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:m,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:Re,borderColor:Re+"59",background:Re+"1a"},children:[kt[V]||"\u{1F4CE}"," ",t(Ue[V]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(A==="approved"?"md-chip-st-ok":A==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[A==="approved"?"\u2705":A==="pending"?"\u23F3":"\u26D4"," ",t(A==="approved"?"statusApproved":A==="pending"?"statusPending":"statusRejected")]}),(Array.isArray(ee)?ee:[]).slice(0,8).map(C=>(0,e.jsxs)("button",{type:"button",className:"md-chip md-chip-tag mc-tag-click",title:C,onClick:()=>T&&T(C),children:["\u{1F3F7} ",C]},C)),!!U("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",gt(U("updated"))]}),!!U("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",U("source")]})]}),(0,e.jsx)("div",{className:"me-read-progress","aria-hidden":"true",children:(0,e.jsx)("i",{style:{width:N+"%"}})}),(0,e.jsx)("div",{className:"me-dialog-body",style:{maxWidth:I[f],margin:"0 auto",width:"100%",boxSizing:"border-box",...se?{}:{maxHeight:300,overflow:"hidden"}},onScroll:C=>{let W=C.currentTarget,pe=W.scrollHeight-W.clientHeight;O(pe<=0?100:Math.min(100,Math.max(0,W.scrollTop/pe*100)))},onClick:se?void 0:C=>{C.stopPropagation(),P(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Bt(F)}})}),!se&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:C=>{C.stopPropagation(),P(!0)},children:[t("expand")," \u2304"]})]})]})}function Ea({t,onOpen:o,all:s,onAllChange:m,onMutate:p,active:i,visible:h}){let[T,N]=(0,n.useState)(null),[O,S]=(0,n.useState)(""),x=(0,n.useRef)(!1),f=(0,n.useRef)(0),z=(0,n.useRef)(t);z.current=t;let I=(0,n.useCallback)(async()=>{try{x.current=!1;let U=await(await fetch(`${_}/graph${s?"?all=1":""}`)).json();U.ok?(N(U),S(""),x.current=!0):(N(null),S(U.error||t("error")))}catch(F){S(String(F&&F.message?F.message:F))}},[s,t]);(0,n.useEffect)(()=>{if(!i||x.current)return;let F=!0;return fetch(`${_}/graph${s?"?all=1":""}`).then(U=>U.json()).then(U=>{F&&(U.ok?(N(U),S(""),x.current=!0):(N(null),S(U.error||t("error"))))}).catch(U=>{F&&S(String(U&&U.message?U.message:U))}),()=>{F=!1}},[s,t,i]),(0,n.useEffect)(()=>{h&&T&&f.current++},[h,T]);let w=(0,n.useCallback)(async F=>{try{let ee=await(await fetch(`${_}/delete?path=${encodeURIComponent(F)}`)).json();return ee&&ee.ok?(await I(),p&&p(),!0):!1}catch{return!1}},[I]),X=(0,n.useCallback)(async F=>{if(!F||F.length<2)return!1;try{let U=await fetch(`${_}/merge?paths=${encodeURIComponent(F.join(","))}`).then(ee=>ee.json());return U&&U.ok?(await I(),p&&p(),!0):!1}catch{return!1}},[I,p]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Oe}),O&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",O]}),!T&&!O&&(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)($a,{nodes:T.nodes,edges:T.edges,onOpen:o,onDelete:w,onMerge:X,t,all:s,onAllChange:m,countLabel:`${T.nodes.length} ${t("nodes")} \xB7 ${Wa(T.edges)} ${t("edges")}`,fitTrigger:f.current})]})}function Wa(t){let o=new Set;for(let s of t||[])o.add([s.source,s.target].sort().join("|"));return o.size}var mt={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 $a({nodes:t,edges:o,onOpen:s,onDelete:m,onMerge:p,t:i,countLabel:h,all:T,onAllChange:N,fitTrigger:O}){let S=(0,n.useRef)(null),x=(0,n.useRef)(null),f=(0,n.useRef)(null),z=(0,n.useRef)(null),I=(0,n.useRef)(null),w=(0,n.useRef)(s);(0,n.useEffect)(()=>{w.current=s},[s]);let X=(0,n.useRef)(m);(0,n.useEffect)(()=>{X.current=m},[m]);let F=(0,n.useRef)(p);(0,n.useEffect)(()=>{F.current=p},[p]);let[U,ee]=(0,n.useState)(""),[V,A]=(0,n.useState)(null),Re=(0,n.useRef)("");(0,n.useEffect)(()=>{Re.current=U.trim().toLowerCase()},[U]),(0,n.useEffect)(()=>{let u=f.current;if(!u)return;let d=U.trim().toLowerCase();if(!d)return;let K=u.nodes.find(le=>(le.name||"").toLowerCase().includes(d));K&&(f.current.selectedId=K.id,A(K.id),u.panX=u.w/2-K.x*u.zoom,u.panY=u.h/2-K.y*u.zoom,u.render&&u.render())},[U]);let[me,se]=(0,n.useState)("all"),[P,C]=(0,n.useState)(!1),W=(0,n.useRef)("all"),[pe,Me]=(0,n.useState)(""),be=(0,n.useRef)(""),[v,De]=(0,n.useState)(!1),de=(0,n.useRef)(!1),[y,q]=(0,n.useState)(null);(0,n.useEffect)(()=>{W.current=me},[me]),(0,n.useEffect)(()=>{be.current=pe},[pe]),(0,n.useEffect)(()=>{de.current=v},[v]);let ae=(0,n.useMemo)(()=>{let u=new Map;for(let d of t)for(let K of d.tags||[]){let le=String(K).trim();le&&u.set(le,(u.get(le)||0)+1)}return[...u.entries()].sort((d,K)=>K[1]-d[1]).slice(0,24).map(([d,K])=>({tag:d,n:K}))},[t]),he=(()=>{let u=U.trim().toLowerCase();return!!u&&!t.some(d=>(d.title||d.name||"").toLowerCase().includes(u)||String(d.kind||"").toLowerCase().includes(u)||String(Ue[d.kind]||"").toLowerCase().includes(u))})();(0,n.useEffect)(()=>{let u=f.current;u&&u.wake&&u.wake()},[U]),(0,n.useEffect)(()=>{let u=f.current;u&&u.render&&u.render()},[me,pe,v]);let Q=(0,n.useRef)(null),[G,Le]=(0,n.useState)([]),[Ce,tt]=(0,n.useState)(null),[Ne,l]=(0,n.useState)(!1),[M,j]=(0,n.useState)(null),[Z,ve]=(0,n.useState)(""),ce=(0,n.useRef)(null),ne=(0,n.useRef)(null),J=(u,d=!0)=>{ce.current&&clearTimeout(ce.current),j({msg:u,ok:d}),ce.current=setTimeout(()=>j(null),1900)},Ve=u=>{ve(u),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>ve(""),1600)};(0,n.useEffect)(()=>()=>{ce.current&&clearTimeout(ce.current),ne.current&&clearTimeout(ne.current)},[]);let ze=(0,n.useMemo)(()=>t.reduce((u,d)=>(u[d.id]=d,u),{}),[t]);return(0,n.useEffect)(()=>{let u=S.current;if(!u||t.length===0)return;let d=u.getContext("2d");if(!d)return;let K=Math.max(1,window.devicePixelRatio||1),le=()=>document.documentElement.getAttribute("data-theme")==="dark",fe={};o.forEach(g=>{fe[g.source]=(fe[g.source]||0)+1,fe[g.target]=(fe[g.target]||0)+1});let Ie=Math.max(1,...Object.values(fe)),a={nodes:t.map(g=>({id:g.id,name:g.title||"",type:g.kind||"other",r:9+Math.min(10,(fe[g.id]||0)/Ie*8),x:0,y:0,vx:0,vy:0})),edges:o.map(g=>({sourceNodeId:g.source,targetNodeId:g.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:K,ctx:d,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((g,L)=>(g[L.id]=L,g),{}),a.nodes.forEach((g,L)=>{let R=L/a.nodes.length*Math.PI*2-Math.PI/2;g.x=Math.cos(R)*60,g.y=Math.sin(R)*60});let we=[...new Set(a.nodes.map(g=>g.type))];a.clustered=we.length>1,a.typeCenters={},we.forEach((g,L)=>{let R=L/we.length*Math.PI*2-Math.PI/2;a.typeCenters[g]={x:Math.cos(R)*160,y:Math.sin(R)*160}}),f.current=a;let Xe=0,rt=0,st=()=>{let g=u.clientWidth,L=u.clientHeight;a.w=g,a.h=L,u.width=g*K,u.height=L*K,d.setTransform(K,0,0,K,0,0),(Xe===0||rt===0)&&g>0&&L>0&&a.tickCount>0&&requestAnimationFrame(()=>k()),Xe=g,rt=L};st();let at=new ResizeObserver(st);at.observe(u.parentElement);let Se=(g,L)=>g&&g.length>L?g.slice(0,L)+"\u2026":g,Je=(g,L,R,E)=>{if(d.beginPath(),E==="rect")d.rect(g-R,L-R*.75,R*2,R*1.5);else if(E==="diamond")d.moveTo(g,L-R),d.lineTo(g+R,L),d.lineTo(g,L+R),d.lineTo(g-R,L),d.closePath();else if(E==="hexagon"){for(let Y=0;Y<6;Y++){let ue=Math.PI/3*Y-Math.PI/2,oe=g+R*Math.cos(ue),Be=L+R*Math.sin(ue);Y===0?d.moveTo(oe,Be):d.lineTo(oe,Be)}d.closePath()}else d.arc(g,L,R,0,Math.PI*2)},Ae=new Map,r=(g,L)=>{let R=g+"|"+Math.round(L),E=Ae.get(R);if(!E){let Y=parseInt(g.slice(1,3),16),ue=parseInt(g.slice(3,5),16),oe=parseInt(g.slice(5,7),16);E=d.createRadialGradient(-L*.3,-L*.3,0,0,0,L*1.2),E.addColorStop(0,"rgba("+Math.min(255,Y+70)+","+Math.min(255,ue+70)+","+Math.min(255,oe+70)+",0.95)"),E.addColorStop(1,g),Ae.set(R,E)}return E},H=1.1,c=2,k=()=>{if(!a.nodes.length)return;let g=1/0,L=-1/0,R=1/0,E=-1/0;a.nodes.forEach(We=>{g=Math.min(g,We.x),L=Math.max(L,We.x),R=Math.min(R,We.y),E=Math.max(E,We.y)});let Y=20,ue=L-g+Y*2,oe=E-R+Y*2,Be=Math.min(a.w/ue,a.h/oe),nt=Math.pow(1/H,c);a.zoom=Math.max(.35,Math.min(1.8,Be*nt)),a.panX=a.w/2-(g+L)/2*a.zoom,a.panY=a.h/2-(R+E)/2*a.zoom};z.current=k;let B=()=>{d.clearRect(0,0,a.w,a.h),a.searchTerm=Re.current,a.kindFilter=W.current,a.timeMode=de.current,a.tagFilter=be.current;let g=a.tagFilter,L=a.kindFilter,R=b=>String(b||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");d.save(),d.strokeStyle=le()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",d.lineWidth=.5;for(let b=0;b<a.w;b+=24)d.beginPath(),d.moveTo(b,0),d.lineTo(b,a.h),d.stroke();for(let b=0;b<a.h;b+=24)d.beginPath(),d.moveTo(0,b),d.lineTo(a.w,b),d.stroke();d.restore(),d.save(),d.translate(a.panX,a.panY),d.scale(a.zoom,a.zoom);let E={};a.nodes.forEach(b=>E[b.id]=b);let Y=a.nodes.length>40,ue=Y?1.5:.55,oe=a.selectedId||a.hoverId,Be=Yt({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),nt=(()=>{let b=(a.searchTerm||"").toLowerCase();if(!b)return null;let ie=[];for(let re of a.nodes){let Te=(a.domainById[re.id]||{}).kind||"other";if(((re.name||"").toLowerCase().includes(b)||String(Ue[Te]||"").toLowerCase().includes(b)||String(Te).toLowerCase().includes(b))&&ie.push(re.id),ie.length>200)break}return ie})(),We=Xt(a.nodes,{limit:Gt(a.nodes.length),focusId:oe,hoverId:a.hoverId,searchHits:nt,degree:fe}),ge=new Map,ke=(b,ie)=>{let re=b+"|"+ie,xe=ge.get(re);return xe===void 0&&(d.font=b,xe=d.measureText(ie).width,ge.set(re,xe)),xe},je=a.nodes.length<=250,$e=new Map;a.edges.forEach(b=>{let ie=E[b.sourceNodeId],re=E[b.targetNodeId];if(!ie||!re||!Dt(ie.x,ie.y,10,Be)&&!Dt(re.x,re.y,10,Be))return;if(L!=="all"){let dt=a.domainById[b.sourceNodeId]&&a.domainById[b.sourceNodeId].kind,et=a.domainById[b.targetNodeId]&&a.domainById[b.targetNodeId].kind;if(dt!==L&&et!==L)return}if(g){let dt=a.domainById[b.sourceNodeId]&&(a.domainById[b.sourceNodeId].tags||[]).includes(g),et=a.domainById[b.targetNodeId]&&(a.domainById[b.targetNodeId].tags||[]).includes(g);if(!dt&&!et)return}let xe=re.x-ie.x,Te=re.y-ie.y,Pe=Math.sqrt(xe*xe+Te*Te)||1,ot=Y?12:18,it=-Te/Pe*ot,Ct=xe/Pe*ot,Nt=(ie.x+re.x)/2+it,Mt=(ie.y+re.y)/2+Ct,yt=mt.colors[a.domainById[ie.id]&&a.domainById[ie.id].kind||"other"],bt=oe&&(b.sourceNodeId===oe||b.targetNodeId===oe),zt=oe?bt?.6:.08:Y?.14:.24,Qe=parseInt(yt.slice(1,3),16),ht=parseInt(yt.slice(3,5),16),It=parseInt(yt.slice(5,7),16),Ge=bt?1.6+(b.weight||1):.8+(b.weight||1)*.5,lt=Qe+","+ht+","+It+","+zt+","+Ge,_e=$e.get(lt);_e||(_e={path:new Path2D,stroke:"rgba("+Qe+","+ht+","+It+","+zt+")",width:Ge},$e.set(lt,_e)),_e.path.moveTo(ie.x,ie.y),_e.path.quadraticCurveTo(Nt,Mt,re.x,re.y)}),$e.forEach(b=>{d.strokeStyle=b.stroke,d.lineWidth=b.width,d.stroke(b.path)});let He=null;oe&&(He=new Set,a.edges.forEach(b=>{b.sourceNodeId===oe?He.add(b.targetNodeId):b.targetNodeId===oe&&He.add(b.sourceNodeId)}));let Ze=[];if(a.nodes.forEach(b=>{if(!Dt(b.x,b.y,b.r+2,Be))return;let ie=a.domainById[b.id]||{},re=ie.kind||"other",xe=a.timeMode?_a(ie.updated):mt.colors[re],Te=mt.shapes[re],Pe=a.selectedId===b.id,ot=a.hoverId===b.id,it=a.searchTerm||"",Ct=!it||(b.name||"").toLowerCase().includes(it)||String(Ue[re]||"").toLowerCase().includes(it)||String(re).toLowerCase().includes(it),Nt=L==="all"||re===L,Mt=!g||(ie.tags||[]).includes(g),yt=oe&&b.id!==oe&&!(He&&He.has(b.id))||it&&!Ct||!Nt||!Mt;d.save(),d.globalAlpha=yt?.08:1,(Pe||ot)&&je&&(d.shadowColor=xe,d.shadowBlur=Pe?20:14),d.translate(b.x,b.y),Je(0,0,b.r,Te),d.fillStyle=r(xe,b.r),d.fill(),d.restore(),Pe?(d.save(),Je(b.x,b.y,b.r+3,Te),d.strokeStyle=xe,d.lineWidth=3,d.shadowColor=xe,d.shadowBlur=12,d.stroke(),d.restore()):ot?(d.save(),Je(b.x,b.y,b.r+2,Te),d.strokeStyle=xe,d.lineWidth=2,d.stroke(),d.restore()):it&&Ct?(d.save(),Je(b.x,b.y,b.r+2,Te),d.strokeStyle="#e11d48",d.lineWidth=2,d.stroke(),d.restore()):a.multi.indexOf(b.id)>=0&&(d.save(),Je(b.x,b.y,b.r+2,Te),d.strokeStyle="#60a5fa",d.lineWidth=2,d.shadowColor="#60a5fa",d.shadowBlur=8,d.stroke(),d.restore());let bt=Se(b.name,16);if((Pe||ot||We.has(b.id)&&a.zoom>ue||!Y&&a.zoom>.6)&&Nt&&Mt){let Qe=1/a.zoom,ht="500 "+(12*Qe).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";d.font=ht;let Ge=ke(ht,bt)+16*Qe,lt=18*Qe,_e=b.y+b.r+8*Qe,dt=!0;for(let et of Ze)if(b.x-Ge/2<et.x+et.w&&b.x+Ge/2>et.x&&_e<et.y+et.h&&_e+lt>et.y){dt=!1;break}if(!dt&&!Pe&&!ot)return;Ze.push({x:b.x-Ge/2,y:_e,w:Ge,h:lt}),d.fillStyle=le()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",d.beginPath(),d.roundRect?d.roundRect(b.x-Ge/2,_e,Ge,lt,4*Qe):d.rect(b.x-Ge/2,_e,Ge,lt),d.fill(),d.strokeStyle=le()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",d.lineWidth=1*Qe,d.stroke(),d.fillStyle=le()?Pe||ot?"#eee":"#bbb":Pe||ot?"#111":"#444",d.textAlign="center",d.fillText(bt,b.x,_e+13*Qe)}}),d.restore(),a.marquee){let b=a.marquee,ie=Math.min(b.sx,b.ex),re=Math.min(b.sy,b.ey),xe=Math.abs(b.ex-b.sx),Te=Math.abs(b.ey-b.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(ie,re,xe,Te),d.strokeRect(ie,re,xe,Te),d.restore()}if(a.hoverId&&Q.current){let b=a.domainById[a.hoverId],ie=a.nodes.find(function(re){return re.id===a.hoverId});if(b&&ie){let re=a.edges.filter(function(Pe){return Pe.sourceNodeId===b.id||Pe.targetNodeId===b.id}).length,xe=ie.x*a.zoom+a.panX,Te=ie.y*a.zoom+a.panY;Q.current.style.display="block",Q.current.style.left=xe+14+"px",Q.current.style.top=Te-6+"px",Q.current.innerHTML="<b>"+R(b.title||b.name||"")+'</b><br/><span style="opacity:.8">'+R(b.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",re)+"</span>"}}else Q.current&&(Q.current.style.display="none")},D=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(te))};a.wake=D,a.render=B;let $=()=>{let g=a.nodes.length;a.tickCount++;let R=.9-Math.min(.4,a.tickCount/1500),E=g>1e3?3e3:g>100?2e3:g>50?1200:800,Y=g>100?.002:.005,ue=g>1e3?.012:g>100?.005:.01,oe=g>1e3?6:g>200?12:24,Be={};a.nodes.forEach(ge=>Be[ge.id]=ge);for(let ge=0;ge<g;ge++){if(a.dragNode===a.nodes[ge])continue;let ke=a.nodes[ge],je=0,$e=0;for(let b=0;b<g;b++){if(ge===b)continue;let ie=ke.x-a.nodes[b].x,re=ke.y-a.nodes[b].y,xe=Math.sqrt(ie*ie+re*re)||1,Te=E/(xe*xe);je+=ie/xe*Te,$e+=re/xe*Te}if(a.clustered&&a.typeCenters[ke.type]){let b=a.typeCenters[ke.type];je+=(b.x-ke.x)*.006,$e+=(b.y-ke.y)*.006}else je-=ke.x*ue,$e-=ke.y*ue;let He=(ke.vx+je)*R,Ze=(ke.vy+$e)*R;He=Math.max(-oe,Math.min(oe,He)),Ze=Math.max(-oe,Math.min(oe,Ze)),ke.vx=He,ke.vy=Ze}a.edges.forEach(ge=>{let ke=Be[ge.sourceNodeId],je=Be[ge.targetNodeId];if(!ke||!je)return;let $e=je.x-ke.x,He=je.y-ke.y,Ze=Math.sqrt($e*$e+He*He)||1,b=(Ze-100)*Y,ie=$e/Ze*b,re=He/Ze*b;a.dragNode!==ke&&(ke.vx+=ie,ke.vy+=re),a.dragNode!==je&&(je.vx-=ie,je.vy-=re)});let nt=0;a.nodes.forEach(ge=>{a.dragNode!==ge&&(ge.x+=ge.vx,ge.y+=ge.vy,nt+=ge.vx*ge.vx+ge.vy*ge.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,k()),(g?Math.sqrt(nt/g):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},te=()=>{if(a.running){try{$(),B()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(te)}},ye=(g,L)=>{let R=u.getBoundingClientRect();return{x:(g-R.left-a.panX)/a.zoom,y:(L-R.top-a.panY)/a.zoom}},Fe=g=>{let L=a.domainById[g];return!(!L||W.current!=="all"&&L.kind!==W.current||be.current&&!(L.tags||[]).includes(be.current))},qe=(g,L,R)=>Math.max(L,Math.min(R,g)),Ye=g=>{a.mouseX=g.clientX,a.mouseY=g.clientY;let L=ye(g.clientX,g.clientY),R=null;for(let E=a.nodes.length-1;E>=0;E--){let Y=a.nodes[E];if(!Fe(Y.id))continue;let ue=Y.x-L.x,oe=Y.y-L.y;if(ue*ue+oe*oe<Y.r*Y.r+36){R=Y.id;break}}R!==a.hoverId&&(a.hoverId=R,D())},Ee=g=>{if(g.button!==0)return;let L=ye(g.clientX,g.clientY),R=null;for(let E=a.nodes.length-1;E>=0;E--){let Y=a.nodes[E];if(!Fe(Y.id))continue;let ue=Y.x-L.x,oe=Y.y-L.y;if(ue*ue+oe*oe<Y.r*Y.r+25){R=Y;break}}if(g.shiftKey){if(R){a.shiftClick=R.id;return}a.marquee={sx:g.clientX,sy:g.clientY,ex:g.clientX,ey:g.clientY};return}a.dragStart={x:g.clientX,y:g.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=R||null,R&&(a.dragOffset={dx:R.x-L.x,dy:R.y-L.y})},wt=g=>{if(a.marquee){a.marquee.ex=g.clientX,a.marquee.ey=g.clientY,D();return}if(!a.dragStart)return;let L=g.clientX-a.dragStart.x,R=g.clientY-a.dragStart.y;if(Math.abs(L)+Math.abs(R)>3&&(a.dragging=!0),a.dragNode){let E=ye(g.clientX,g.clientY);a.dragNode.x=E.x+a.dragOffset.dx,a.dragNode.y=E.y+a.dragOffset.dy,D()}else a.dragging&&(a.panX=qe(a.dragStart.px+L,-1e5,1e5),a.panY=qe(a.dragStart.py+R,-1e5,1e5),D())},St=g=>{if(a.marquee){let R=a.marquee;a.marquee=null;let E=u.getBoundingClientRect(),Y=Math.min(R.sx,R.ex)-E.left,ue=Math.max(R.sx,R.ex)-E.left,oe=Math.min(R.sy,R.ey)-E.top,Be=Math.max(R.sy,R.ey)-E.top,nt=a.nodes.filter(We=>{let ge=We.x*a.zoom+a.panX,ke=We.y*a.zoom+a.panY;return ge>=Y&&ge<=ue&&ke>=oe&&ke<=Be}).map(We=>We.id);a.multi=nt,Le(nt),D();return}let L=a.dragStart&&!a.dragging;if(a.shiftClick){let R=a.shiftClick;a.shiftClick=null;let E=Array.isArray(a.multi)?a.multi.slice():[];E.includes(R)||E.push(R),a.multi=E,Le(E),D();return}if(L){let R=ye(g.clientX,g.clientY),E=null;for(let Y=a.nodes.length-1;Y>=0;Y--){let ue=a.nodes[Y];if(!Fe(ue.id))continue;let oe=ue.x-R.x,Be=ue.y-R.y;if(oe*oe+Be*Be<ue.r*ue.r+20){E=ue;break}}E?(a.selectedId=E.id,A(E.id),D()):(a.selectedId=null,a.hoverId=null,g.shiftKey||(a.multi=[],Le([])),A(null),D())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Ot=g=>{g.preventDefault();let L=ye(g.clientX,g.clientY),R=null;for(let E=a.nodes.length-1;E>=0;E--){let Y=a.nodes[E];if(!Fe(Y.id))continue;let ue=Y.x-L.x,oe=Y.y-L.y;if(ue*ue+oe*oe<Y.r*Y.r+25){R=Y;break}}if(R){let E=a.domainById[R.id];E&&q({x:g.clientX,y:g.clientY,id:R.id,path:E.id,title:E.title})}else q(null)},Et=g=>{g.preventDefault();let L=u.getBoundingClientRect(),R=(g.clientX-L.left-a.panX)/a.zoom,E=(g.clientY-L.top-a.panY)/a.zoom,Y=Math.max(.3,Math.min(3,a.zoom*(g.deltaY<0?H:1/H)));a.panX=qe(a.panX+R*(a.zoom-Y),-1e5,1e5),a.panY=qe(a.panY+E*(a.zoom-Y),-1e5,1e5),a.zoom=Y,D()};u.addEventListener("mousemove",Ye),u.addEventListener("mousedown",Ee),window.addEventListener("mousemove",wt),window.addEventListener("mouseup",St),u.addEventListener("wheel",Et,{passive:!1}),u.addEventListener("contextmenu",Ot),I.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Le([]),k(),D()};for(let g=0;g<200;g++)$();k(),D();let Wt=()=>C(!1);return window.addEventListener("mousedown",Wt),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),at.disconnect(),u.removeEventListener("mousemove",Ye),u.removeEventListener("mousedown",Ee),window.removeEventListener("mousemove",wt),window.removeEventListener("mouseup",St),u.removeEventListener("wheel",Et),u.removeEventListener("contextmenu",Ot),window.removeEventListener("mousedown",Wt)}},[t,o]),(0,n.useEffect)(()=>{O!==void 0&&z.current&&requestAnimationFrame(()=>z.current())},[O]),(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," ",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:U,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:()=>C(u=>!u),"aria-expanded":P,title:i("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",i("filterLabel")," ",me!=="all"||v||pe?"\u25CF":"\u25BE"]}),P&&(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${me==="all"&&!v?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{se("all"),De(!1)},children:i("all")}),Object.keys(Ke).map(u=>(0,e.jsxs)("button",{type:"button",className:`lg${me===u?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>se(d=>d===u?"all":u),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:mt.colors[u]||Ke[u]}}),i(Ue[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${v?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>De(u=>!u),children:["\u23F1 ",i("timeDim")]}),ae.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:ae.map(u=>(0,e.jsxs)("button",{type:"button",className:`lg${pe===u.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>Me(d=>d===u.tag?"":u.tag),title:u.tag,children:["#",u.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:u.n})]},u.tag))})]}),(me!=="all"||v||pe)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{se("all"),De(!1),Me("")},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:!!T,onChange:u=>N&&N(u.target.checked)}),i("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${v?" me-on":""}`,onClick:()=>De(u=>!u),children:i("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=S.current;if(u)try{u.toBlob(d=>{d&&tt({url:URL.createObjectURL(d),blob:d})},"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:()=>{A(null),se("all"),I.current&&I.current()},children:i("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:S,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:Q,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)"}}),he&&(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:()=>q(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:()=>{w.current({path:y.path,title:y.title}),q(null)},children:i("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{y.id&&(f.current.selectedId=y.id,A(y.id)),q(null);let u=f.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{}q(null),J(i("copied"))},children:i("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let u=f.current,d=u&&Array.isArray(u.multi)?u.multi.slice():[],K=y.id;if(K&&!d.includes(K)&&d.push(K),q(null),d.length<2){J(i("mergeNeed"),!1);return}if(!window.confirm(i("mergeConfirm")))return;let le=F.current&&F.current(d);le&&le.then?le.then(fe=>fe?J(i("merged")):J(i("mergeFail"),!1)).catch(()=>J(i("mergeFail"),!1)):le&&J(i("merged"))},children:i("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let u=y.path;q(null),window.confirm(i("deleteConfirm"))&&(async()=>{try{(X.current?await X.current(u):!1)?J(i("deleted")):J(i("deleteFail"),!1)}catch{J(i("deleteFail"),!1)}})()},children:i("delete")})]}),G.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:[G.length," ",i("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let d=G.map(Ie=>ze[Ie]).filter(Boolean).map(Ie=>Ie.title||Ie.name).join(`
354
- `),K=new Blob([d],{type:"text/plain;charset=utf-8"}),le=URL.createObjectURL(K),fe=document.createElement("a");fe.href=le,fe.download="memory-selected.txt",document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),setTimeout(()=>URL.revokeObjectURL(le),1e3),J(G.length+i("exportedSel"))},children:i("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(G.length<2){J(i("mergeNeed"),!1);return}let u=G.map(K=>ze[K]?ze[K].id:K);if(!window.confirm(i("mergeConfirm")))return;Le([]);let d=f.current;d&&(d.multi=[]),fetch(`${_}/merge?paths=${encodeURIComponent(u.join(","))}`).then(K=>K.json()).then(K=>{K&&K.ok?J(i("merged")):J(i("mergeFail"),!1)}).catch(()=>J(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=G.map(K=>ze[K]?ze[K].id:K);Le([]);let d=f.current;d&&(d.multi=[]),(async()=>{let K=0;for(let le of u)try{(X.current?await X.current(le):!1)&&K++}catch{}J(K+i("deletedSelected"),K>0)})()},children:i("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=f.current;u&&(u.multi=[]),Le([]);let d=f.current;d&&d.render&&d.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:ze[V]?ze[V].title||ze[V].name:V}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:ze[V]?i(Ue[ze[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,d)=>{let K=u.source===V?u.target:u.source,le=ze[K];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:fe=>{fe.preventDefault();let Ie=f.current;Ie&&(Ie.selectedId=K,Ie.hoverId=K,Ie.wake&&Ie.wake()),A(K)},children:le?(le.title||le.name).slice(0,28):K},d)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:i("graphTip")}),M&&(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 "+(M.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:M.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:M.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:M.msg})]}),Ce&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{Ce.url&&URL.revokeObjectURL(Ce.url),tt(null),l(!1)},children:[(0,e.jsx)("style",{children:Oe}),(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:u=>u.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:i("exportGraph")}),(0,e.jsxs)("div",{className:"me-head-actions",children:[(0,e.jsx)("a",{className:"mc-btn",href:Ce.url,download:"memory-graph.png",onClick:()=>{Ve("download"),J(i("downloaded")+" \xB7 "+i("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:i(Z==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ve("full"),l(u=>!u),J(i("fullscreen"))},children:i(Z==="full"?"done":Ne?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=Ce.blob;u&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":u})]).then(()=>{Ve("copy"),J(i("copied"))}).catch(()=>{J(i("copyFail"),!1)}):J(i("copyFail"),!1)},children:i(Z==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ce.url&&URL.revokeObjectURL(Ce.url),tt(null),l(!1)},children:i("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:i("exportGraph"),style:{maxWidth:"100%",maxHeight:Ne?"calc(100% - 64px)":"70vh",borderRadius:Ne?0:8,cursor:"zoom-in"},onClick:()=>l(u=>!u)})})]})]})]})}function _a(t){let o=new Date(t||0).getTime();if(!o)return"#94a3b8";let s=(Date.now()-o)/864e5;return s<3?"#10b981":s<14?"#f59e0b":s<30?"#f97316":"#94a3b8"}function Qt({label:t,value:o=[],options:s,onChange:m,placeholder:p,z:i=20}){let[h,T]=(0,n.useState)(!1),N=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!h)return;let w=X=>{N.current&&!N.current.contains(X.target)&&T(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[h]);let O=Array.isArray(o)?o:[],S=O.includes("__all__"),x=S?s.find(w=>w.value==="__all__")?.label||"":O.length?O.map(w=>s.find(X=>X.value===w)?.label||w).join("\u3001"):"",f=(w,X)=>{if(w.value==="__all__"){m(X?["__all__"]:[]);return}let F=new Set(O);F.has("__all__")&&F.delete("__all__"),X?F.add(w.value):F.delete(w.value),m([...F])},z=s.find(w=>w.value==="__all__"),I=s.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:N,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||p||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),h&&(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: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:S,onChange:w=>f(z,w.target.checked)}),(0,e.jsx)("span",{children:z.label})]}),I.map(w=>(0,e.jsxs)("label",{onClick:X=>X.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:O.includes(w.value),onChange:X=>f(w,X.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Ua(t){let o=new Date(t||0).getTime();return!!o&&(Date.now()-o)/864e5<3}async function Ka(t,o,s){if(s&&typeof window.showSaveFilePicker=="function")try{let i=await window.showSaveFilePicker({suggestedName:o}),h=await i.createWritable();return await h.write(t),await h.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 m=URL.createObjectURL(t),p=document.createElement("a");return p.href=m,p.download=o,document.body.appendChild(p),p.click(),document.body.removeChild(p),setTimeout(()=>URL.revokeObjectURL(m),1e3),{ok:!0,picked:!1,name:o}}function Ft(t,o){if(!o||!t)return t;let s=t.toLowerCase(),m=o.toLowerCase(),p=[],i=0;for(;i<t.length;){let h=s.indexOf(m,i);if(h<0){p.push(t.slice(i));break}h>i&&p.push(t.slice(i,h)),p.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(h,h+m.length)},h)),i=h+m.length}return p}function gt(t){if(!t)return"";let o=new Date(t);if(Number.isNaN(o.getTime()))return"";let s=new Date,m=o.toDateString()===s.toDateString(),p=h=>String(h).padStart(2,"0"),i=`${p(o.getHours())}:${p(o.getMinutes())}`;return m?i:`${o.getMonth()+1}-${o.getDate()} ${i}`}
352
+ `);let Fe=new Blob([$],{type:ye}),qe=await Ka(Fe,te,!1);if(!qe.ok){se({ok:!1,msg:t("exportFail")}),he(!1);return}se({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+qe.name})}catch(B){se({ok:!1,msg:t("exportFail")+" \xB7 "+(B.message||"")})}finally{he(!1)}y.current&&clearTimeout(y.current),y.current=setTimeout(()=>se(null),2600)},Ae=async d=>{let x=d.target.files&&d.target.files[0];if(d.target.value="",!!x){try{let B=await x.text(),$=await(await fetch(`${_}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:B})).json();if($.ok){await we();let te=$.imported||0,ye=t("importedVault")+"\uFF1A"+te;$.total&&(ye+=t("importedTotal")+$.total+t("importedTotalTail")),$.quarantined&&(ye+=t("importedQuarantine")+$.quarantined+t("importedQuarantineTail")),$.skipped&&(ye+=t("importedSkipped")+$.skipped+t("importedSkippedTail")),$.warning&&(ye+=" \xB7 "+$.warning),se({ok:te>0||!$.total,msg:ye})}else se({ok:!1,msg:$.error||t("importFail")})}catch{se({ok:!1,msg:t("importFail")})}y.current&&clearTimeout(y.current),y.current=setTimeout(()=>se(null),2400)}},i=(0,n.useMemo)(()=>{let d=R.slice();return ee!=="all"&&(d=d.filter(x=>ft(x.submittedBy)===ee)),A!=="all"&&(d=d.filter(x=>(x.status||"approved")===A)),be==="title"?d.sort((x,B)=>String(x.title||"").localeCompare(String(B.title||""))):be==="hot"?d.sort((x,B)=>(B.weight||B.links||0)-(x.weight||x.links||0)):d.sort((x,B)=>new Date(B.updated||0).getTime()-new Date(x.updated||0).getTime()),d},[R,be,ee,A]),H=(0,n.useMemo)(()=>[...new Set(R.map(d=>ft(d.submittedBy)))],[R]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Oe}),De&&(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 "+(De.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:De.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:De.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:De.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)(na,{})}),(0,e.jsx)("h2",{children:t("memoryTitle")}),(0,e.jsx)("span",{children:t("memoryHint")})]}),(0,e.jsx)("div",{className:"spacer"}),m&&(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:m,"aria-label":t(p?"exitFull":"fullscreen"),children:p?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:l,"aria-label":t("close"),children:"\u2715"})]}),k&&k.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:[k.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:k.since?gt(new Date(k.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${s?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>M(d=>!d),"aria-label":t(s?"collapse":"expand"),title:t(s?"collapse":"expand"),children:s?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="cards"?" active":""}`,onClick:()=>Me("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),s&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="graph"?" active":""}`,onClick:()=>Me("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),s&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="stats"?" active":""}`,onClick:()=>Me("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),s&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="audit"?" active":""}`,onClick:()=>Me("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),s&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),J>0&&(0,e.jsx)("span",{className:"mc-dot",children:J>99?"99+":J})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="optimize"?" active":""}`,onClick:()=>Me("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),s&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),Ve>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:Ve>99?"99+":Ve})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${P==="config"?" active":""}`,onClick:()=>Me("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),s&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Ne(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),s&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:Ie,children:[r&&r.db&&r.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",r.db.error||"\u2014"," \u2014\u2014 ",t("dbReadonlyBody"),(0,e.jsx)("div",{style:{opacity:.85,marginTop:2},children:t("dbReadonlyFix")})]}):null,P==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(ut,{label:t("total"),value:r?r.total:"\u2014"}),(0,e.jsx)(ut,{label:t("recent"),value:r?r.recent:"\u2014"}),(0,e.jsx)(ut,{label:t("tags"),value:r?r.tags:"\u2014"}),(0,e.jsx)(ut,{label:t("pending"),value:r?.quarantine?.pending??r?.status?.pending??0}),(0,e.jsx)(ut,{label:t("rejected"),value:r?.quarantine?.rejected??r?.status?.rejected??0}),(0,e.jsx)(ut,{label:t("cardCount"),value:r?r.byKind?.knowledge??0:"\u2014"})]}),P==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:F,onChange:d=>rt(d.target.value)}),me&&(0,e.jsxs)("button",{type:"button",className:"mc-chip active",title:t("clearFilter"),onClick:()=>at(""),children:["\u{1F3F7} ",me," ",(0,e.jsx)("span",{style:{opacity:.7},children:"\u2715"})]}),(0,e.jsx)("input",{ref:q,type:"file",accept:".json,application/json",style:{display:"none"},onChange:Ae}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>q.current&&q.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>Z({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:ae,onClick:()=>Je("md"),children:t(ae?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:ae,onClick:()=>Je("json"),children:t(ae?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>we(),children:t("refresh")})]}),P==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Ht.map(d=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===d?" active":""}`,onClick:()=>lt(d),children:t(d==="all"?"all":Ue[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")]}),aa(H).map(d=>(0,e.jsx)("option",{value:d,children:d},d))]}),(0,e.jsxs)("select",{value:A,onChange:d=>Te(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${be===d.key?" active":""}`,onClick:()=>h(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:P==="cards"?"contents":"none"},children:O?(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:()=>we(),children:t("retry")})]}):R.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:i.map(d=>(0,e.jsx)(Pa,{card:d,t,query:F.trim(),onOpen:Se,onDelete:Xe,onTagClick:at},d.path))}),R.length<u&&(0,e.jsx)("div",{ref:fe,style:{height:1}}),K&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",R.length," / ",u,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:P==="graph"?"flex":"none",flex:1,minHeight:0},children:W.has("graph")&&(0,e.jsx)(Ea,{t,onOpen:Se,all:Le,onAllChange:Ce,onMutate:ne,active:P==="graph",visible:P==="graph"})}),(0,e.jsx)("div",{style:{display:P==="config"?"contents":"none"},children:W.has("config")&&(0,e.jsx)(ia,{t,onReload:()=>we(),version:ve})}),(0,e.jsx)("div",{style:{display:P==="stats"?"contents":"none"},children:W.has("stats")&&(0,e.jsx)(Fa,{t,tab:"stats",onReload:()=>we(),version:ve})}),(0,e.jsx)("div",{style:{display:P==="audit"?"contents":"none"},children:W.has("audit")&&(0,e.jsx)(Ba,{t,onReload:()=>we(),version:ve})}),(0,e.jsx)("div",{style:{display:P==="optimize"?"contents":"none"},children:W.has("optimize")&&(0,e.jsx)(La,{t,onReload:()=>we(),version:ve})}),tt&&(0,e.jsx)(Ha,{t,onClose:()=>Ne(!1)}),Q&&(0,e.jsx)(Oa,{t,card:Q,query:F.trim(),onNavigate:d=>{let x=i.findIndex(D=>D.path===Q.path),B=i[x+d];B&&G(B)},onTagClick:at,onClose:()=>G(null),onDelete:d=>{G(null),Xe(d)},onFeedback:d=>{let x=Q.path;fetch(`${_}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:F.trim(),path:x,useful:d})}).then(()=>se({ok:!0,msg:t(d?"fbUseful":"fbIrr")})).catch(()=>{}),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>se(null),2e3)}}),(0,e.jsx)(ja,{t,newCard:j,setNewCard:Z,onCreated:()=>{we(),ne(),se({ok:!0,msg:t("created")}),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>se(null),2e3)}})]})]})]})}var oa=({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,ut=({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 ia({t,onReload:o,version:l,compact:m}){let[p,r]=(0,n.useState)(null),[v,R]=(0,n.useState)(0),[N,O]=(0,n.useState)(null),[S,k]=(0,n.useState)(null),[f,z]=(0,n.useState)(!1),[I,w]=(0,n.useState)(!1),X=(0,n.useRef)(!1),F=(0,n.useRef)(null),U=(0,n.useRef)({}),[ee,V]=(0,n.useState)(null),[A,Te]=(0,n.useState)(null),[me,de]=(0,n.useState)(""),[P,C]=(0,n.useState)(""),[W,pe]=(0,n.useState)(""),[Me,be]=(0,n.useState)(null),[h,De]=(0,n.useState)(null),se=(0,n.useCallback)(async(i,H=!1)=>{H||C("version");try{let d=await fetch(_+"/version-check"+(i?"?force=1":"")).then(x=>x.json());d&&d.ok?(De(d),i&&G(d.updateAvailable?t("vcLatest")+" v"+d.latest:t("vcUpToDate"))):i&&G(t("vcCheckFail"),!1)}catch{i&&G(t("vcCheckFail"),!1)}finally{H||C("")}},[t]);(0,n.useEffect)(()=>{se(!1);let i=setInterval(()=>{se(!1,!0)},6e4),H=()=>{typeof document<"u"&&!document.hidden&&se(!1,!0)};return document.addEventListener("visibilitychange",H),()=>{clearInterval(i),document.removeEventListener("visibilitychange",H)}},[l,se]);let[y,q]=(0,n.useState)(""),[ae,he]=(0,n.useState)(null),Q=(0,n.useRef)(null),G=(i,H=!0)=>{Q.current&&clearTimeout(Q.current),he({msg:i,ok:H}),Q.current=setTimeout(()=>he(null),1900)},Le=async()=>{if(!P){C("restart");try{let i=await fetch(_+"/restart-self",{method:"POST"});if(i.status===404||i.status===405){G(ce("vcRestartNoRoute",{cmd:h&&h.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let H=await i.json().catch(()=>null);if(!H){G(t("vcRestartFail")+"\uFF08HTTP "+i.status+"\uFF09",!1);return}if(!H.ok){G(H.error||t("vcRestartFail"),!1);return}if(H.alreadyCurrent){G(H.note||t("vcRestartCurrent"));return}G(H.note||t("vcRestartSent")),H.alreadyRunning||setTimeout(()=>{se(!0)},6e3)}catch(i){G(t("vcRestartFail")+"\uFF1A"+String(i&&i.message||i),!1)}finally{C("")}}},Ce=h&&h.resident?String(h.resident.served||""):"",tt=!!(h&&h.onDisk&&Ce&&Ce!==h.onDisk),Ne=!!(h&&h.resident&&h.resident.managed===!1&&h.resident.managedKnown===!1),s=h&&h.resident&&h.resident.replaceBlocked&&h.resident.replaceBlocked.fresh||null,M=!!(h&&h.resident&&h.resident.managedBy==="host"),j=!!(h&&h.resident&&h.resident.managed===!1&&!Ne&&!M),Z=!!(h&&h.resident&&!Ce),ve=tt||Z||j||Ne,ce=(i,H)=>Object.keys(H).reduce((d,x)=>d.split("{"+x+"}").join(H[x]),t(i)),ne=(0,n.useCallback)(async()=>{try{let[i,H,d,x]=await Promise.all([fetch(`${_}/config`).then(B=>B.json()).catch(()=>null),fetch(`${_}/setup-status`).then(B=>B.json()).catch(()=>null),fetch(`${_}/budget`).then(B=>B.json()).catch(()=>null),fetch(`${_}/llm-routes`).then(B=>B.json()).catch(()=>null)]);if(x&&x.ok&&be(x),i&&i.ok){r(i),R(i.revision??0),O(i.schema??null);let B=Jt(i.config??{},U.current);U.current=B.overlay,k({...B.values}),V(i.dsh??null),z(i.writable===!1),w(i.viaPending===!0),de(""),X.current=!1}else d&&d.ok?(k({...d}),z(!0),de(t("configNeedsDsh"))):de(t("adminLoadFail"));H&&H.ok&&Te(H),pe("")}catch{de(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{ne()},[l,ne]);let J=(i,H)=>{X.current=!0,k(d=>({...d??{},[i]:H}))};(0,n.useEffect)(()=>{F.current=ne},[ne]),(0,n.useEffect)(()=>{if(typeof EventSource>"u")return;let i=null;try{i=new EventSource(_+"/events")}catch{return}let H=()=>{!X.current&&typeof F.current=="function"&&F.current()};try{i.addEventListener("config",H)}catch{}return()=>{try{i.close()}catch{}}},[]);let Ve=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),ze=i=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[i]||i,u=async()=>{if(!S)return;if(f){G(t("editInSetting"),!1);return}let i={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]},H=[];for(let[d,[x,B]]of Object.entries(i)){if(!(d in S))continue;let D=S[d],$=typeof D=="number"?D:Number(D);(D===""||D===null||D===void 0||!Number.isFinite($)||$<x||$>B)&&H.push(t("invalidField",{field:d,min:x,max:B,value:String(D===""?"\u7A7A":D)}))}if(H.length){let d=t("saveInvalid")+"\uFF1A"+H.join("\uFF1B");de(d),G(d,!1);return}C("save");try{let d={...S};for(let $ of Object.keys(S))$ in d&&typeof d[$]=="string"&&d[$].trim()!==""&&Ve.has($)&&(d[$]=Number(d[$]));Array.isArray(d.vaultProfiles)&&(d.vaultProfiles=d.vaultProfiles.filter($=>$&&(String($.name||"").trim()||String($.path||"").trim())));let x=await fetch(`${_}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:d,expectedRevision:v})}),B=await x.text(),D=null;try{D=B?JSON.parse(B):null}catch{D=null}if(D||(D={error:"HTTP "+x.status+(B?"\uFF1A"+B.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")}),D&&D.ok){let $=typeof D.pendingOutcome=="string"?D.pendingOutcome:"",te,ye=!0;if($==="applied")te=t("savedApplied")+(Array.isArray(D.applied)&&D.applied.length?" \xB7 "+D.applied.join("\u3001"):"");else if($==="queued")ye=!1,te=t("saveQueued");else if($==="failed")ye=!1,te=t("saveFail")+" \xB7 "+(D.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if($==="applied-direct")te=t("savedOk")+" \xB7 "+t("savedDirect");else{let Fe=Array.isArray(D.pending)&&D.pending.length?" \xB7 "+t("savePending"):D.note?" \xB7 "+t("restartHint"):"";te=(D.retried?"\u267B ":"")+t("savedOk")+Fe}U.current={...U.current,...d},ye?pe(te):de(te),G(te,ye),await ne()}else{let $=x.status===409?t("conflictRefresh"):D?.error||t("saveFail");de($),G($,!1)}}catch{de(t("saveFail")),G(t("saveFail"),!1)}finally{C("")}},c=()=>{U.current={},k({...p?.config??{}}),pe("")},K={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},le=i=>Array.isArray(i?.vaultProfiles)?i.vaultProfiles:[],fe=(i,H,d)=>k(x=>{let B=le(x).map($=>({...$||{}})),D={...B[i]||{}};return H==="match"?String(d).trim()?D.match={...D.match||{},workspace:d}:delete D.match:D[H]=d,B[i]=D,{...x??{},vaultProfiles:B}}),Ie=()=>k(i=>({...i??{},vaultProfiles:[...le(i),{name:"",path:""}]})),a=i=>k(H=>({...H??{},vaultProfiles:le(H).filter((d,x)=>x!==i)})),we={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},Xe={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},rt={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}},lt=async i=>{let H=rt[i];H&&k(d=>({...d??{},...H}))},at=async(i,H)=>{C(i+H);try{let x=await(await fetch(`${_}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:i,action:H})})).json();x&&x.ok?G(ce(H==="install"?"mcpInstalled":"mcpUninstalled",{agent:i})):G(ce("mcpActionFail",{agent:i,error:x?.error||""}),!1);try{let B=await fetch(`${_}/setup-status`).then(D=>D.json());B&&B.ok&&Te(B)}catch{}}catch{G(t("mergeFail"),!1)}finally{C("")}},Se=({k:i,label:H,type:d="text",step:x,min:B,max:D})=>(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:H||i}),(0,e.jsx)("input",{type:d,step:x,min:B,max:D,value:S?S[i]??"":"",onChange:$=>{let te=$.target.value;J(i,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}})]}),Je=new Set(["autoRestartOnDrift"]),Ae=({k:i,label:H})=>{let d=S?S[i]:void 0,x=d===void 0?Je.has(i):!!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:x,onChange:B=>J(i,B.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:H||i})]})};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:m?"0 0 auto":1,minHeight:0,maxHeight:m?"52vh":void 0},children:[(0,e.jsx)("style",{children:Oe}),ae&&(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 "+(ae.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ae.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ae.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:ae.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[me&&(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 ",me]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:ne,children:["\u21BB ",t("retry")]})]}),I&&(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")]}),f&&(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")]}),W&&(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 ",W]}),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:we,children:[t("vcLoaded")," v",p.version]}),h&&h.resident&&h.resident.served&&h.resident.served!==p.version&&(0,e.jsxs)("code",{style:we,children:[t("vcResident")," v",h.resident.served]}),h&&h.resident&&!h.resident.served&&(0,e.jsxs)("code",{style:{...we,color:"#b45309",fontWeight:600},children:[t("vcResident")," ",t("vcResidentDownShort")]}),h&&h.resident&&h.resident.served&&h.resident.managed===!1&&(0,e.jsxs)("code",{style:{...we,color:"#b45309",fontWeight:600},children:[t("vcResident")," v",h.resident.served," \xB7 ",t(s?"vcResidentReplaceBlockedShort":M?"vcResidentHostManagedShort":Ne?"vcResidentLockUnknownShort":"vcResidentUnmanagedShort")]}),vt&&(0,e.jsxs)("code",{style:we,children:[t("vcPage")," v",vt]}),h&&h.onDisk&&(0,e.jsxs)("code",{style:we,children:[t("vcOnDisk")," v",h.onDisk]}),h&&h.latest&&(0,e.jsxs)("code",{style:we,children:[t("vcLatest")," v",h.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:P==="version",onClick:()=>se(!0),children:P==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),h&&(h.stale||Z||j||Ne||s)&&(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"},children:(0,e.jsxs)("div",{children:["\u26A0\uFE0F ",h.stale?ce("vcHostProcessStale",{disk:h.onDisk,loaded:h.loaded}):Z?ce("vcResidentDown",{port:h.resident&&h.resident.port||"",cmd:h.restartCommand||"dsh-memory restart --port 7999"}):s?ce("vcResidentReplaceBlocked",{served:Ce,err:s.error||"",path:s.lockPath||"",cmd:h.restartCommand||"dsh-memory restart --port "+(h.resident&&h.resident.port||7999)}):Ne?ce("vcResidentLockUnknown",{served:Ce,path:h.resident&&h.resident.lock&&h.resident.lock.path||"",err:h.resident&&h.resident.lock&&h.resident.lock.error||""}):ce("vcResidentUnmanaged",{served:Ce,cmd:h.restartCommand||"dsh-memory restart --port 7999"})]})}),h&&(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"+(ve?" me-on":""),disabled:!!P,onClick:Le,children:P==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),h.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:h.restartCommand}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.65},children:ve?Z?ce("vcRestartStart",{disk:h.onDisk||""}):ce("vcRestartFixes",{served:Ce||"",disk:h.onDisk||""}):h.stale?ce("vcRestartHostOnly",{loaded:h.loaded||"",disk:h.onDisk||""}):ce("vcRestartAnyway",{ver:h.onDisk||""})})]}),vt&&h&&h.onDisk&&vt!==h.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:vt,disk:h.onDisk})}),h&&h.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:h.updateCommand})]}),h&&h.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",h.checkError]})]}),A&&A.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:A.agents.map(i=>(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:i.isDsh?t("dshHostLabel"):i.name}),i.isDsh&&i.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",i.version]}),!i.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),i.installed&&i.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),i.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),i.mcpConfigured===!0&&i.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),i.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",i.recallTool?t("enabled"):t("disabled"),")"]})]}),i.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",i.hook]}),!i.isDsh&&i.installed&&i.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!P,onClick:()=>at(i.name,"install"),children:t("installMcp")}),!i.isDsh&&i.installed&&i.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!P,onClick:()=>{window.confirm(t("uninstallConfirm"))&&at(i.name,"uninstall")},children:t("uninstallMcp")})]},i.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),y&&(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:y})})]}),S?(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(i=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>lt(i),disabled:!!P,children:[i==="A"?"\u{1F7E2} ":i==="B"?"\u{1F4B0} ":"\u2B50 ",rt[i].label]},i))})]}),(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)(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)(Ae,{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:ee?.vaultDir||"\u2014"}),ee?.vaultName?`\uFF08${ee.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(K[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]}),le(S).map((i,H)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:i.name||"",placeholder:t("vaultNamePh"),onChange:d=>fe(H,"name",d.target.value),style:Xe,disabled:f}),(0,e.jsx)("input",{value:i.path||"",placeholder:t("vaultPathPh"),onChange:d=>fe(H,"path",d.target.value),style:Xe,disabled:f}),(0,e.jsx)("input",{value:i.match&&i.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:d=>fe(H,"match",d.target.value),style:Xe,disabled:f}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>a(H),disabled:f,title:t("delete"),children:"\u2715"})]},H)),(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:Ie,disabled:f,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:S.activeVault||"",onChange:i=>J("activeVault",i.target.value),disabled:f,style:Xe,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),le(S).filter(i=>i&&i.name).map(i=>(0,e.jsx)("option",{value:i.name,children:i.name},i.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)(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)(Ae,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(Ae,{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"}),Me&&Me.providers&&Me.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:S.captureProvider||"",onChange:i=>{J("captureProvider",i.target.value),J("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")}),Me.providers.map(i=>(0,e.jsx)("option",{value:i.id,children:i.label},i.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:S.captureModel||"",onChange:i=>J("captureModel",i.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")}),((Me.providers.find(i=>i.id===S.captureProvider)||{}).models||[]).map(i=>(0,e.jsx)("option",{value:i.id,children:i.label||i.id},i.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)(Ae,{k:"captureFollowSession",label:t("captureFollowSession")}),(0,e.jsx)(Ae,{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:!!P,onClick:async()=>{C("llmtest");try{let i=await fetch(_+"/llm-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:S.captureProvider||"",model:S.captureModel||"",firstOnly:S.captureFirstOnly===!0})}).then(H=>H.json());i&&i.ok?G(t("llmTestOk")+"\uFF1A"+i.route.provider+(i.route.model?"/"+i.route.model:"")+" \xB7 "+i.ms+"ms \xB7 "+t("llmCandidates")+" "+i.candidates):G(t("llmTestFail")+"\uFF1A"+(i&&(i.failure?i.failure.code+" "+i.failure.message:i.error)||"?"),!1)}catch(i){G(t("llmTestFail")+"\uFF1A"+String(i&&i.message||i),!1)}finally{C("")}},children:P==="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:S.auditMode??"all",onChange:i=>J("auditMode",i.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)(Qt,{label:t("auditExemptAgents"),value:S.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(A?.agents||[]).filter(i=>!i.isDsh).map(i=>({value:i.name,label:i.name}))],onChange:i=>J("auditExemptAgents",i)}),(0,e.jsx)(Qt,{label:t("auditExemptKinds"),value:S.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Ht.filter(i=>i!=="all").map(i=>({value:i,label:t(Ue[i])}))],onChange:i=>J("auditExemptKinds",i)}),(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)(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:S.autoWebMode??"init",onChange:i=>J("autoWebMode",i.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)(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:[P==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),W&&P!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",W]}),me&&P!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",me]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:c,disabled:!!P,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:f?()=>G(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):u,disabled:P==="save",title:t(f?"readonlyBody":"saveConfig"),children:P==="save"?"\u23F3 "+t("saving"):f?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function Ba({t,onReload:o,version:l}){let[m,p]=(0,n.useState)([]),[r,v]=(0,n.useState)([]),[R,N]=(0,n.useState)("all"),[O,S]=(0,n.useState)("all"),[k,f]=(0,n.useState)(""),[z,I]=(0,n.useState)(new Set),[w,X]=(0,n.useState)(""),[F,U]=(0,n.useState)(null),[ee,V]=(0,n.useState)("pending"),A=(y,q=!0)=>{U({msg:y,ok:q}),setTimeout(()=>U(null),3e3)},Te=[...new Set([...m,...r].map(y=>y.submittedBy).filter(Boolean))],me=(0,n.useCallback)(async()=>{try{let y=await fetch(`${_}/audit/list`).then(q=>q.json());y.ok&&(p(y.pending||[]),v(y.rejected||[]),I(new Set),pe(new Set),be({}))}catch{}},[]);(0,n.useEffect)(()=>{me()},[l,me]);let de=(ee==="pending"?m:r).filter(y=>{if(R!=="all"&&y.kind!==R||O!=="all"&&ft(y.submittedBy)!==O)return!1;if(k){let q=(y.created||"").slice(0,10);if(q&&q!==k)return!1}return!0}),P=y=>I(q=>{let ae=new Set(q);return ae.has(y)?ae.delete(y):ae.add(y),ae}),C=async(y,q)=>{let ae=q||[...z];if(!ae.length){A(t("noSelection"),!1);return}X("apply");let he=t(y==="approved"?"toastApproved":y==="rejected"?"toastRejected":"toastCardDeleted");try{let Q=0;for(let G of ae){let Le=y==="approved"?"audit/approve":y==="rejected"?"audit/reject":"delete";try{(await fetch(_+"/"+Le+"?path="+encodeURIComponent(G)+(y==="delete"?"&permanent=0":""))).ok||Q++}catch{Q++}}await me(),o&&o(),Q?A(t("toastFailed")+"\uFF08"+Q+"/"+ae.length+"\uFF09",!1):A(he+" "+ae.length+" \u5F20")}catch(Q){A(t("toastFailed")+": "+String(Q&&Q.message||Q),!1)}finally{X("")}},[W,pe]=(0,n.useState)(new Set),[Me,be]=(0,n.useState)({}),h=y=>Me[y]||{},De=async y=>{let q=y.path,ae=!W.has(q);if(pe(he=>{let Q=new Set(he);return ae?Q.add(q):Q.delete(q),Q}),!(!ae||Me[q])){be(he=>({...he,[q]:{loading:!0}}));try{let he=y.status||(ee==="pending"?"pending":"rejected"),Q=await fetch(`${_}/card?path=${encodeURIComponent(q)}&status=${he}`).then(G=>G.json());Q&&Q.ok?be(G=>({...G,[q]:{text:Q.text||""}})):be(G=>({...G,[q]:{error:Q&&Q.error||"HTTP"}}))}catch(he){be(Q=>({...Q,[q]:{error:String(he&&he.message||he)}}))}}},se=[...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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(oa,{toast:F}),(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:R,onChange:y=>N(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")}),Ht.filter(y=>y!=="all").map(y=>(0,e.jsx)("option",{value:y,children:t(Ue[y])},y))]}),(0,e.jsxs)("select",{value:O,onChange:y=>S(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")}),aa(Te).map(y=>(0,e.jsx)("option",{value:y,children:y},y))]}),(0,e.jsx)("input",{type:"date",value:k,onChange:y=>f(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",m.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${ee==="rejected"?" me-on":""}`,onClick:()=>V("rejected"),children:[t("rejected"),"\uFF08",r.length,"\uFF09"]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("label",{style:{fontSize:12},children:[(0,e.jsx)("input",{type:"checkbox",checked:de.length>0&&se.length===de.length,onChange:y=>{y.target.checked?I(new Set(de.map(q=>q.path))):I(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!se.length||!!w,onClick:()=>C("approved"),children:["\u2713 ",t(ee==="rejected"?"restore":"approve")]}),ee==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!se.length||!!w,onClick:()=>C("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!se.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&C("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),de.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:de.map(y=>{let q=h(y.path),ae=W.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:()=>P(y.path)}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"0 6px"},title:t(ae?"collapse":"expand"),"aria-expanded":ae,onClick:()=>De(y),children:ae?"\u25BE":"\u25B8"}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Ke[y.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},title:t(ae?"collapse":"expand"),onClick:()=>De(y),children:y.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ft(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:()=>C("approved",[y.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>C("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:()=>C("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"))&&C("delete",[y.path])},children:"\u{1F5D1}"})]})]}),ae&&(0,e.jsxs)("div",{style:{padding:"2px 10px 12px 34px"},children:[q.loading&&(0,e.jsxs)("div",{style:{fontSize:12,opacity:.6},children:["\u23F3 ",t("loading")]}),q.error&&(0,e.jsxs)("div",{style:{fontSize:12,color:"#f87171"},children:["\u26A0 ",t("auditBodyFail"),"\uFF1A",q.error]}),q.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:Ke[y.kind]||"#6B7280",borderColor:(Ke[y.kind]||"#6B7280")+"59",background:(Ke[y.kind]||"#6B7280")+"1a"},children:[kt[y.kind]||"\u{1F4CE}"," ",t(Ue[y.kind]||"kindKnowledge")]}),(Array.isArray(y.tags)?y.tags:[]).slice(0,8).map(he=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",he]},he)),!!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:Bt(Tt(q.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:!!w,onClick:()=>C("approved",[y.path]),children:["\u2713 ",t("approve")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!w,onClick:()=>C("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 La({t,onReload:o,version:l}){let[m,p]=(0,n.useState)([]),[r,v]=(0,n.useState)(""),[R,N]=(0,n.useState)(null),O=(f,z=!0)=>{N({msg:f,ok:z}),setTimeout(()=>N(null),3200)},S=(0,n.useCallback)(async()=>{try{let f=await fetch(`${_}/recycle/list`).then(z=>z.json());f.ok&&p(f.items||[])}catch{}},[]);(0,n.useEffect)(()=>{S()},[l,S]);let k=async(f,z)=>{let I=(m.find(w=>w.path===z)||{}).title||z;v(f+z);try{let X=await fetch(_+(f==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(z)),F=await X.json().catch(()=>null);await S(),o&&o(),X.ok&&(!F||F.ok!==!1)?O(t(f==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+I):O(t("toastFailed")+"\uFF1A"+(F&&F.error||"HTTP "+X.status),!1)}catch(w){O(t("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{v("")}};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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(oa,{toast:R}),(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:!!r||m.length===0,title:m.length?"":t("emptyRecycle"),onClick:async()=>{v("purgeAll");try{let f=await fetch(_+"/recycle/purge-expired?days=0"),z=await f.json().catch(()=>null);await S(),O(f.ok?t("toastPurgedExpired")+(z&&z.purged!=null?"\uFF08"+z.purged+"\uFF09":""):t("toastFailed"),f.ok)}catch(f){O(t("toastFailed")+"\uFF1A"+String(f&&f.message||f),!1)}finally{v("")}},children:t("emptyRecycle")})]}),m.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:m.map(f=>(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:Ke[f.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(f.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!r,onClick:()=>k("restore",f.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!r,onClick:()=>{window.confirm(t("purgeConfirm"))&&k("purge",f.path)},children:t("purge")})]},f.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 Pa=({card:t,t:o,onOpen:l,query:m,onDelete:p,onTagClick:r})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>l(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ke[t.kind]||Ke.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:kt[t.kind]||"\u{1F4CE}"}),m?Ft(t.title,m):t.title,Ua(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:m?Ft(t.summary||"",m):t.summary||""}),m&&(()=>{let v=Ut(t.body||"",m);return v?(0,e.jsx)("p",{className:"mc-snippet",children:Ft(v,m)}):null})(),Zt(t).length>0&&(0,e.jsx)("div",{className:"mc-tags",children:Zt(t).slice(0,4).map(v=>(0,e.jsxs)("button",{type:"button",className:"mc-tag mc-tag-click",title:v,onClick:R=>{R.stopPropagation(),r&&r(v)},children:["\u{1F3F7} ",v]},v))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[kt[t.kind]||"\u{1F4CE}"," ",o(Ue[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ft(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",gt(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:v=>{v.stopPropagation(),window.confirm(o("deleteConfirm"))&&p&&p(t.path)},children:"\u{1F5D1}"})]})]});function Fa({t,tab:o,onReload:l,version:m}){let[p,r]=(0,n.useState)(null),[v,R]=(0,n.useState)(""),[N,O]=(0,n.useState)(null),[S,k]=(0,n.useState)(null),[f,z]=(0,n.useState)(null),[I,w]=(0,n.useState)(null),X=(0,n.useCallback)(async()=>{A("align");try{let s=await fetch(_+"/align").then(M=>M.json());s&&s.findings?w(s):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{A("")}},[t]),F=async()=>{if(window.confirm(t("alignFixConfirm"))){A("alignfix");try{let s=await fetch(_+"/setup-run",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(M=>M.json());s&&s.ok?(notify(t("alignFixed")),await X()):notify(t("alignFail"),!1)}catch{notify(t("alignFail"),!1)}finally{A("")}}},[U,ee]=(0,n.useState)([]),[V,A]=(0,n.useState)(""),[Te,me]=(0,n.useState)(!1),de=(0,n.useCallback)(async()=>{if(!(!N||!N.merge||!N.merge.length)&&window.confirm(t("mergeAllConfirm"))){A("merge");try{let s={},M=ne=>s[ne]===void 0?ne:s[ne]=M(s[ne]),j=(ne,J)=>{s[M(ne)]=M(J)},Z=new Set;for(let ne of N.merge)Z.add(ne.a.path),Z.add(ne.b.path),j(ne.a.path,ne.b.path);let ve={};for(let ne of Z){let J=M(ne);(ve[J]=ve[J]||[]).push(ne)}let ce=0;for(let ne of Object.values(ve)){if(ne.length<2)continue;(await fetch(`${_}/merge?paths=${encodeURIComponent(ne.join(","))}`).then(Ve=>Ve.json())).ok&&ce++}await P(),l&&l()}catch{}A("")}},[N,P,l,t]);async function P(){try{let s=await Promise.all([fetch(`${_}/stats`),fetch(`${_}/budget`),fetch(`${_}/capture-log`),fetch(`${_}/cards?status=all&limit=30&agent=${xt}`)]),[M,j,Z,ve]=await Promise.all(s.map(ce=>ce.json()));M&&M.ok&&r(M),j&&j.ok&&k(j),Z&&Z.ok&&z(Z),ve&&ve.ok&&ee(ve.cards||[]),R(!M||!M.ok?t("adminLoadFail"):"")}catch{R(t("adminLoadFail"))}}let C=(0,n.useCallback)(async()=>{A("scan");try{let s=await fetch(`${_}/optimize`).then(M=>M.json());s.ok&&O(s)}catch{R(t("adminLoadFail"))}finally{A("")}},[t]),[W,pe]=(0,n.useState)(null),Me=(0,n.useCallback)(async()=>{A("refine");try{let s=await fetch(`${_}/refine-scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:8})}).then(M=>M.json());s&&s.ok?pe(s):notify(s&&s.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{A("")}},[t]),be=async(s,M)=>{if(!(M==="merge"&&!window.confirm(t("mergeConfirm")))){A("refineapply");try{let j=await fetch(`${_}/refine-apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({a:s.a.path,b:s.b.path,action:M,relation:s.relation})}).then(Z=>Z.json());j&&j.ok?(notify(t("refineApplied")),pe(Z=>Z&&{...Z,findings:(Z.findings||[]).filter(ve=>!(ve.a.path===s.a.path&&ve.b.path===s.b.path))}),await P(),l&&l()):notify(j&&j.error||t("refineFail"),!1)}catch{notify(t("refineFail"),!1)}finally{A("")}}},[h,De]=(0,n.useState)(null),se=(0,n.useCallback)(async()=>{A("junk");try{let s=await fetch(`${_}/refine-junk`).then(M=>M.json());s&&s.ok?De(s.items||[]):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{A("")}},[t]),y=async s=>{if(s.length&&window.confirm(t("junkRecycleAllConfirm"))){A("junkpurge");try{let M=await fetch(`${_}/refine-junk-purge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:s})}).then(j=>j.json());M&&M.removed?(notify(t("junkDone")+"\uFF1A"+M.removed.length+(M.failed?.length?"\uFF08\u5931\u8D25 "+M.failed.length+"\uFF09":"")),De(j=>j&&j.filter(Z=>!M.removed.includes(Z.path))),await P(),l&&l()):notify(t("junkFail"),!1)}catch{notify(t("junkFail"),!1)}finally{A("")}}},[q,ae]=(0,n.useState)(null),he=(0,n.useCallback)(async()=>{A("goals");try{let s=await fetch(_+"/refine-goals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({limit:30})}).then(M=>M.json());s&&s.ok?ae(s):notify(s&&s.error||t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{A("")}},[t]),Q=async s=>{A("goalskeep");try{let M=await fetch(_+"/refine-goals-keep",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:s.members.map(j=>j.path)})}).then(j=>j.json());M&&M.ok?(notify(t("goalDone")),ae(j=>j&&{...j,clusters:(j.clusters||[]).filter(Z=>Z.goal!==s.goal)})):notify(t("goalFail"),!1)}catch{notify(t("goalFail"),!1)}finally{A("")}},G=async s=>{if(window.confirm(t("mergeConfirm"))){A("goalsmerge");try{let M=await fetch(_+"/merge?paths="+encodeURIComponent(s.members.map(j=>j.path).join(","))).then(j=>j.json());M&&M.ok?(notify(t("goalMerged")),ae(j=>j&&{...j,clusters:(j.clusters||[]).filter(Z=>Z.goal!==s.goal)}),await P(),l&&l()):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{A("")}}};(0,n.useEffect)(()=>{P()},[m]);let Le=async(s,M)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${_}/merge?paths=${encodeURIComponent(s+","+M)}`).then(Z=>Z.json())).ok&&(await P(),l&&l())}catch{}},Ce=async s=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${_}/delete?path=${encodeURIComponent(s)}`).then(j=>j.json())).ok&&(await P(),l&&l())}catch{}},tt=["project","knowledge","content","prompt","business","tool","mistake"],Ne=({title:s,kind:M,updated:j,path:Z})=>(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:mt.colors[M]||"#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:gt(j)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>Ce(Z),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:Oe}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[v&&(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 ",v]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:P,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:X,children:t(V==="align"?"exporting":"alignRun")}),I&&I.counts&&I.counts.fix>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:F,children:t(V==="alignfix"?"exporting":"alignFix")}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("alignHint")})]}),I&&I.findings?(0,e.jsxs)("div",{style:{marginTop:6},children:[(0,e.jsxs)("div",{style:{fontSize:12,opacity:.75,marginBottom:4},children:[t("alignDisk")," v",I.onDisk||"?",I.residentServed?" \xB7 "+t("alignResident")+" v"+I.residentServed:"",I.hostVersion?" \xB7 "+t("alignHost")+" v"+I.hostVersion:""]}),(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:I.findings.map((s,M)=>(0,e.jsxs)("li",{style:{padding:"4px 2px",borderTop:M?"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]},M))})]}):(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:()=>P(),children:["\u21BB ",t("refresh")]})]}),f?f.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(f.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:(f.entries||[]).map((s,M)=>{let j=Ma[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:gt(s.time?new Date(s.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:j[1],fontWeight:600},children:[j[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||""})]},M)})})})}):(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",U.length,"\uFF09"]}),U.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:U.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:Ke[s.kind]||Ke.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:gt(s.updated)})]},s.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 s=p.trend,M=Math.max(...s.map(ce=>ce.count),1),j=260,Z=50,ve=j/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:j,height:Z,style:{display:"block",width:"100%",height:50},children:s.map((ce,ne)=>{let J=Math.round(ce.count/M*(Z-4));return(0,e.jsx)("rect",{x:ne*ve+1,y:Z-J,width:Math.max(ve-2,2),height:J,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:tt.map(s=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:mt.colors[s]||"#666"}}),t(Ue[s]),": ",p.byKind?.[s]||0]},s))})]}),S&&(S.budgetChars||S.recallLimit||S.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:S.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:S.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",S.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(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")})]})]})]}),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:C,children:V==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),N&&N.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){A("oneclick");try{let s=JSON.stringify({cleanupStale:Te}),j=await(await fetch(`${_}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:s})).json();j&&j.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${j.plan.merged} ${t("optimizedMerged")}${Te?` \xB7 ${j.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await P(),l&&l(),O(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{A("")}}},children:V==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),N&&N.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:Te,onChange:s=>me(s.target.checked)}),t("oneClickAlsoStale")]})]}),!N&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),N&&(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}}),N.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!V,onClick:de,children:t(V==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),N.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:N.merge.map((s,M)=>(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:()=>Le(s.a.path,s.b.path),children:t("mergeNow")})]},M))}):(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",N.stale?.length||0,"\uFF09"]}),N.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;A("clean");let s=0;for(let M of N.stale)try{await fetch(`${_}/delete?path=${encodeURIComponent(M.path)}`),s++}catch{}A(""),notify(`${s} ${t("deletedStale")}`),await P(),l&&l()},children:t("cleanStale")})}),N.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:N.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:Me,children:t(V==="refine"?"exporting":"refineScan")}),(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("refineHint")})]}),W?.findings?.length?W.findings.map((s,M)=>(0,e.jsxs)("div",{style:{borderTop:M?"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:()=>be(s,"keepA"),children:t("refineKeepA")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>be(s,"keepB"),children:t("refineKeepB")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>be(s,"keepBoth"),children:t("refineKeepBoth")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>be(s,"merge"),children:t("refineMerge")})]})]},M)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(W?"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:se,children:t(V==="junk"?"exporting":"junkScan")}),h?.length?(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:!!V,onClick:()=>y(h.map(s=>s.path)),children:t(V==="junkpurge"?"exporting":"junkRecycleAll")}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("junkHint")})]}),h?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:h.map((s,M)=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 2px",borderTop:M?"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:()=>y([s.path]),children:t("junkRecycle")})]},M))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(h?"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:he,children:t(V==="goals"?"exporting":"goalScan")}),q?(0,e.jsxs)("span",{style:{opacity:.6,fontSize:11},children:[t("goalStats"),"\uFF1A",q.cached," / ",q.calls]}):null,(0,e.jsx)("span",{style:{opacity:.6,fontSize:11},children:t("goalHint")})]}),q?.clusters?.length?q.clusters.map((s,M)=>(0,e.jsxs)("div",{style:{borderTop:M?"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((j,Z)=>(0,e.jsx)("li",{children:j.title},Z))}),(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:()=>Q(s),children:t("goalKeep")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!V,onClick:()=>G(s),children:t("goalMerge")})]})]},M)):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t(q?"goalNone":"goalIdle")})]})]})]})]})}var Pt=[{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 ja({t,newCard:o,setNewCard:l,onCreated:m}){if(!o)return null;let p=Pt.find(k=>k.key===o.template),r=o.body||(p?t(p.bodyKey):""),v=o.kind||(p?p.kind:"knowledge"),R=o.tags||(p?t(p.tagKey):""),N=o._creating,O=k=>{let f=Pt.find(z=>z.key===k);l(z=>({...z,template:k,kind:f?f.kind:z.kind,body:f?t(f.bodyKey):z.body,tags:f?t(f.tagKey):z.tags}))},S=async()=>{if(!(!o.title&&!r)){l(k=>({...k,_creating:!0}));try{(await fetch(`${_}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:v,tags:R.split(",").map(f=>f.trim()).filter(Boolean),body:r,source:"manual"})}).then(f=>f.json())).ok?(l(null),m&&m()):l(f=>({...f,_creating:!1}))}catch{l(f=>({...f,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>l(null),children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:k=>k.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:()=>l(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:[Pt.map(k=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===k.key?" me-on":""}`,onClick:()=>O(k.key),children:t(k.label)},k.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>l(k=>({...k,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:v,onChange:k=>l(f=>({...f,kind:k.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(k=>(0,e.jsx)("option",{value:k,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:k},k))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:o.title||"",onChange:k=>l(f=>({...f,title:k.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:R,onChange:k=>l(f=>({...f,tags:k.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:r,onChange:k=>l(f=>({...f,body:k.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:N,onClick:S,children:t(N?"exporting":"createCard")})})]})]})]})}async function jt(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 l=document.createElement("textarea");l.value=o,l.setAttribute("readonly",""),l.style.position="fixed",l.style.left="-9999px",l.style.top="0",document.body.appendChild(l),l.focus(),l.select();let m=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(l),m}catch{return!1}}function Ha({t,onClose:o}){let[l,m]=(0,n.useState)(""),[p,r]=(0,n.useState)(""),[v,R]=(0,n.useState)(""),[N,O]=(0,n.useState)(!0),[S,k]=(0,n.useState)(!1),[f,z]=(0,n.useState)(""),[I,w]=(0,n.useState)(""),X=(0,n.useRef)(null),F=(0,n.useRef)(null),U=()=>{let C=X.current;if(C)try{C.focus(),C.select()}catch{}},ee=C=>{z(C),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>z(""),2400)};(0,n.useEffect)(()=>{let C=!0;return fetch(_+"/diagnostics").then(W=>W.json()).then(W=>{C&&(W&&W.ok?(r(String(W.diagnostics||"")),R(String(W.version||""))):k(!0))}).catch(()=>{C&&k(!0)}).finally(()=>{C&&O(!1)}),()=>{C=!1}},[]),(0,n.useEffect)(()=>{let C=W=>{W.key==="Escape"&&o()};return window.addEventListener("keydown",C),()=>{window.removeEventListener("keydown",C),F.current&&clearTimeout(F.current)}},[o]);let V=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),A=()=>{let C=l.trim().split(`
353
+ `)[0]||"",W=Kt({title:"[Bug] "+(C.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Vt({description:l,diagnostics:p,version:v})});try{window.open(W,"_blank","noopener")}catch{ee(t("fbCopyFail"))}},Te=async()=>{await jt(p)?(w(""),ee(t("fbCopiedDiag"))):(w(p),ee(t("fbCopyManual")))},me=async()=>{let C=qt({lang:V,description:l,diagnostics:p});await jt(C)?(w(""),ee(t("fbCopiedPrompt"))):(w(C),ee(t("fbCopyManual")))},de={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},P={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",wordBreak:"break-word",overflowX:"hidden"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:C=>C.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:l,onChange:C=>m(C.target.value),placeholder:t("fbDesc"),rows:5,style:de}),(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:Te,disabled:!p,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:P,children:N?t("fbLoading"):S?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(!l.trim()){ee(t("fbNeedDesc"));return}A()},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:me,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),f&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:f}),I&&(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:U,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:X,readOnly:!0,value:I,rows:7,style:de})]})]})]})]})}function Oa({t,card:o,query:l,onClose:m,onDelete:p,onFeedback:r,onNavigate:v,onTagClick:R}){let[N,O]=(0,n.useState)(0),[S,k]=(0,n.useState)(""),[f,z]=(0,n.useState)(()=>{try{let C=localStorage.getItem("me-read-width");return["narrow","mid","wide"].includes(C)?C:"mid"}catch{return"mid"}}),I={narrow:720,mid:900,wide:1180};(0,n.useEffect)(()=>{let C=W=>{if(W.key==="Escape"){m();return}let pe=String(W.target&&W.target.tagName||"").toLowerCase();pe==="input"||pe==="textarea"||pe==="select"||W.target&&W.target.isContentEditable||(W.key==="j"&&v?(W.preventDefault(),v(1)):W.key==="k"&&v&&(W.preventDefault(),v(-1)))};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[m,v]);let w=async(C,W)=>{let pe=await jt(String(C||""));k(pe?t("copied")+" \xB7 "+W:t("copyFail")),setTimeout(()=>k(""),1500)},{meta:X,body:F}=(0,n.useMemo)(()=>Tt(o.text||""),[o.text]),U=C=>{let W=X.find(([pe])=>String(pe).toLowerCase()===C);return W?W[1]:""},ee=_t(U("tags")),V=U("kind")||"knowledge",A=(U("status")||"approved").toLowerCase(),Te=Ke[V]||"#6B7280",me=(F||"").length>460,[de,P]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:m,children:[(0,e.jsx)("style",{children:Oe}),(0,e.jsxs)("div",{className:"me-dialog",onClick:C=>C.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{title:o.title,children:[(0,e.jsx)("span",{style:{marginRight:6,flex:"none"},children:kt[V]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{className:"me-head-actions",children:[S&&(0,e.jsx)("span",{style:{fontSize:11.5,color:"#10b981",whiteSpace:"nowrap"},children:S}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",title:t("copyBody"),onClick:()=>w(F,t("copyBody")),children:["\u{1F4CB} ",t("copyBody")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",title:t("copyPath"),onClick:()=>w(o.path,t("copyPath")),children:["\u{1F517} ",t("copyPath")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",title:t("readWidth"),onClick:()=>{let C=["narrow","mid","wide"],W=C[(C.indexOf(f)+1)%C.length];z(W);try{localStorage.setItem("me-read-width",W)}catch{}},children:[t("readWidth")," \xB7 ",t(f==="narrow"?"widthNarrow":f==="wide"?"widthWide":"widthMid")]}),l&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>r&&r(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>r&&r(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),me&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":de,onClick:()=>P(C=>!C),children:t(de?"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:m,children:t("close")})]})]}),(0,e.jsxs)("div",{className:"md-meta",children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:Te,borderColor:Te+"59",background:Te+"1a"},children:[kt[V]||"\u{1F4CE}"," ",t(Ue[V]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(A==="approved"?"md-chip-st-ok":A==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[A==="approved"?"\u2705":A==="pending"?"\u23F3":"\u26D4"," ",t(A==="approved"?"statusApproved":A==="pending"?"statusPending":"statusRejected")]}),(Array.isArray(ee)?ee:[]).slice(0,8).map(C=>(0,e.jsxs)("button",{type:"button",className:"md-chip md-chip-tag mc-tag-click",title:C,onClick:()=>R&&R(C),children:["\u{1F3F7} ",C]},C)),!!U("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",gt(U("updated"))]}),!!U("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",U("source")]})]}),(0,e.jsx)("div",{className:"me-read-progress","aria-hidden":"true",children:(0,e.jsx)("i",{style:{width:N+"%"}})}),(0,e.jsx)("div",{className:"me-dialog-body",style:{maxWidth:I[f],margin:"0 auto",width:"100%",boxSizing:"border-box",...de?{}:{maxHeight:300,overflow:"hidden"}},onScroll:C=>{let W=C.currentTarget,pe=W.scrollHeight-W.clientHeight;O(pe<=0?100:Math.min(100,Math.max(0,W.scrollTop/pe*100)))},onClick:de?void 0:C=>{C.stopPropagation(),P(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Bt(F)}})}),!de&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:C=>{C.stopPropagation(),P(!0)},children:[t("expand")," \u2304"]})]})]})}function Ea({t,onOpen:o,all:l,onAllChange:m,onMutate:p,active:r,visible:v}){let[R,N]=(0,n.useState)(null),[O,S]=(0,n.useState)(""),k=(0,n.useRef)(!1),f=(0,n.useRef)(0),z=(0,n.useRef)(t);z.current=t;let I=(0,n.useCallback)(async()=>{try{k.current=!1;let U=await(await fetch(`${_}/graph${l?"?all=1":""}`)).json();U.ok?(N(U),S(""),k.current=!0):(N(null),S(U.error||t("error")))}catch(F){S(String(F&&F.message?F.message:F))}},[l,t]);(0,n.useEffect)(()=>{if(!r||k.current)return;let F=!0;return fetch(`${_}/graph${l?"?all=1":""}`).then(U=>U.json()).then(U=>{F&&(U.ok?(N(U),S(""),k.current=!0):(N(null),S(U.error||t("error"))))}).catch(U=>{F&&S(String(U&&U.message?U.message:U))}),()=>{F=!1}},[l,t,r]),(0,n.useEffect)(()=>{v&&R&&f.current++},[v,R]);let w=(0,n.useCallback)(async F=>{try{let ee=await(await fetch(`${_}/delete?path=${encodeURIComponent(F)}`)).json();return ee&&ee.ok?(await I(),p&&p(),!0):!1}catch{return!1}},[I]),X=(0,n.useCallback)(async F=>{if(!F||F.length<2)return!1;try{let U=await fetch(`${_}/merge?paths=${encodeURIComponent(F.join(","))}`).then(ee=>ee.json());return U&&U.ok?(await I(),p&&p(),!0):!1}catch{return!1}},[I,p]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Oe}),O&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",O]}),!R&&!O&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),R&&R.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),R&&R.nodes.length>0&&(0,e.jsx)($a,{nodes:R.nodes,edges:R.edges,onOpen:o,onDelete:w,onMerge:X,t,all:l,onAllChange:m,countLabel:`${R.nodes.length} ${t("nodes")} \xB7 ${Wa(R.edges)} ${t("edges")}`,fitTrigger:f.current})]})}function Wa(t){let o=new Set;for(let l of t||[])o.add([l.source,l.target].sort().join("|"));return o.size}var mt={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 $a({nodes:t,edges:o,onOpen:l,onDelete:m,onMerge:p,t:r,countLabel:v,all:R,onAllChange:N,fitTrigger:O}){let S=(0,n.useRef)(null),k=(0,n.useRef)(null),f=(0,n.useRef)(null),z=(0,n.useRef)(null),I=(0,n.useRef)(null),w=(0,n.useRef)(l);(0,n.useEffect)(()=>{w.current=l},[l]);let X=(0,n.useRef)(m);(0,n.useEffect)(()=>{X.current=m},[m]);let F=(0,n.useRef)(p);(0,n.useEffect)(()=>{F.current=p},[p]);let[U,ee]=(0,n.useState)(""),[V,A]=(0,n.useState)(null),Te=(0,n.useRef)("");(0,n.useEffect)(()=>{Te.current=U.trim().toLowerCase()},[U]),(0,n.useEffect)(()=>{let u=f.current;if(!u)return;let c=U.trim().toLowerCase();if(!c)return;let K=u.nodes.find(le=>(le.name||"").toLowerCase().includes(c));K&&(f.current.selectedId=K.id,A(K.id),u.panX=u.w/2-K.x*u.zoom,u.panY=u.h/2-K.y*u.zoom,u.render&&u.render())},[U]);let[me,de]=(0,n.useState)("all"),[P,C]=(0,n.useState)(!1),W=(0,n.useRef)("all"),[pe,Me]=(0,n.useState)(""),be=(0,n.useRef)(""),[h,De]=(0,n.useState)(!1),se=(0,n.useRef)(!1),[y,q]=(0,n.useState)(null);(0,n.useEffect)(()=>{W.current=me},[me]),(0,n.useEffect)(()=>{be.current=pe},[pe]),(0,n.useEffect)(()=>{se.current=h},[h]);let ae=(0,n.useMemo)(()=>{let u=new Map;for(let c of t)for(let K of c.tags||[]){let le=String(K).trim();le&&u.set(le,(u.get(le)||0)+1)}return[...u.entries()].sort((c,K)=>K[1]-c[1]).slice(0,24).map(([c,K])=>({tag:c,n:K}))},[t]),he=(()=>{let u=U.trim().toLowerCase();return!!u&&!t.some(c=>(c.title||c.name||"").toLowerCase().includes(u)||String(c.kind||"").toLowerCase().includes(u)||String(Ue[c.kind]||"").toLowerCase().includes(u))})();(0,n.useEffect)(()=>{let u=f.current;u&&u.wake&&u.wake()},[U]),(0,n.useEffect)(()=>{let u=f.current;u&&u.render&&u.render()},[me,pe,h]);let Q=(0,n.useRef)(null),[G,Le]=(0,n.useState)([]),[Ce,tt]=(0,n.useState)(null),[Ne,s]=(0,n.useState)(!1),[M,j]=(0,n.useState)(null),[Z,ve]=(0,n.useState)(""),ce=(0,n.useRef)(null),ne=(0,n.useRef)(null),J=(u,c=!0)=>{ce.current&&clearTimeout(ce.current),j({msg:u,ok:c}),ce.current=setTimeout(()=>j(null),1900)},Ve=u=>{ve(u),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>ve(""),1600)};(0,n.useEffect)(()=>()=>{ce.current&&clearTimeout(ce.current),ne.current&&clearTimeout(ne.current)},[]);let ze=(0,n.useMemo)(()=>t.reduce((u,c)=>(u[c.id]=c,u),{}),[t]);return(0,n.useEffect)(()=>{let u=S.current;if(!u||t.length===0)return;let c=u.getContext("2d");if(!c)return;let K=Math.max(1,window.devicePixelRatio||1),le=()=>document.documentElement.getAttribute("data-theme")==="dark",fe={};o.forEach(g=>{fe[g.source]=(fe[g.source]||0)+1,fe[g.target]=(fe[g.target]||0)+1});let Ie=Math.max(1,...Object.values(fe)),a={nodes:t.map(g=>({id:g.id,name:g.title||"",type:g.kind||"other",r:9+Math.min(10,(fe[g.id]||0)/Ie*8),x:0,y:0,vx:0,vy:0})),edges:o.map(g=>({sourceNodeId:g.source,targetNodeId:g.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:K,ctx:c,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((g,L)=>(g[L.id]=L,g),{}),a.nodes.forEach((g,L)=>{let T=L/a.nodes.length*Math.PI*2-Math.PI/2;g.x=Math.cos(T)*60,g.y=Math.sin(T)*60});let we=[...new Set(a.nodes.map(g=>g.type))];a.clustered=we.length>1,a.typeCenters={},we.forEach((g,L)=>{let T=L/we.length*Math.PI*2-Math.PI/2;a.typeCenters[g]={x:Math.cos(T)*160,y:Math.sin(T)*160}}),f.current=a;let Xe=0,rt=0,lt=()=>{let g=u.clientWidth,L=u.clientHeight;a.w=g,a.h=L,u.width=g*K,u.height=L*K,c.setTransform(K,0,0,K,0,0),(Xe===0||rt===0)&&g>0&&L>0&&a.tickCount>0&&requestAnimationFrame(()=>x()),Xe=g,rt=L};lt();let at=new ResizeObserver(lt);at.observe(u.parentElement);let Se=(g,L)=>g&&g.length>L?g.slice(0,L)+"\u2026":g,Je=(g,L,T,E)=>{if(c.beginPath(),E==="rect")c.rect(g-T,L-T*.75,T*2,T*1.5);else if(E==="diamond")c.moveTo(g,L-T),c.lineTo(g+T,L),c.lineTo(g,L+T),c.lineTo(g-T,L),c.closePath();else if(E==="hexagon"){for(let Y=0;Y<6;Y++){let ue=Math.PI/3*Y-Math.PI/2,oe=g+T*Math.cos(ue),Be=L+T*Math.sin(ue);Y===0?c.moveTo(oe,Be):c.lineTo(oe,Be)}c.closePath()}else c.arc(g,L,T,0,Math.PI*2)},Ae=new Map,i=(g,L)=>{let T=g+"|"+Math.round(L),E=Ae.get(T);if(!E){let Y=parseInt(g.slice(1,3),16),ue=parseInt(g.slice(3,5),16),oe=parseInt(g.slice(5,7),16);E=c.createRadialGradient(-L*.3,-L*.3,0,0,0,L*1.2),E.addColorStop(0,"rgba("+Math.min(255,Y+70)+","+Math.min(255,ue+70)+","+Math.min(255,oe+70)+",0.95)"),E.addColorStop(1,g),Ae.set(T,E)}return E},H=1.1,d=2,x=()=>{if(!a.nodes.length)return;let g=1/0,L=-1/0,T=1/0,E=-1/0;a.nodes.forEach(We=>{g=Math.min(g,We.x),L=Math.max(L,We.x),T=Math.min(T,We.y),E=Math.max(E,We.y)});let Y=20,ue=L-g+Y*2,oe=E-T+Y*2,Be=Math.min(a.w/ue,a.h/oe),nt=Math.pow(1/H,d);a.zoom=Math.max(.35,Math.min(1.8,Be*nt)),a.panX=a.w/2-(g+L)/2*a.zoom,a.panY=a.h/2-(T+E)/2*a.zoom};z.current=x;let B=()=>{c.clearRect(0,0,a.w,a.h),a.searchTerm=Te.current,a.kindFilter=W.current,a.timeMode=se.current,a.tagFilter=be.current;let g=a.tagFilter,L=a.kindFilter,T=b=>String(b||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");c.save(),c.strokeStyle=le()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",c.lineWidth=.5;for(let b=0;b<a.w;b+=24)c.beginPath(),c.moveTo(b,0),c.lineTo(b,a.h),c.stroke();for(let b=0;b<a.h;b+=24)c.beginPath(),c.moveTo(0,b),c.lineTo(a.w,b),c.stroke();c.restore(),c.save(),c.translate(a.panX,a.panY),c.scale(a.zoom,a.zoom);let E={};a.nodes.forEach(b=>E[b.id]=b);let Y=a.nodes.length>40,ue=Y?1.5:.55,oe=a.selectedId||a.hoverId,Be=Yt({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),nt=(()=>{let b=(a.searchTerm||"").toLowerCase();if(!b)return null;let ie=[];for(let re of a.nodes){let Re=(a.domainById[re.id]||{}).kind||"other";if(((re.name||"").toLowerCase().includes(b)||String(Ue[Re]||"").toLowerCase().includes(b)||String(Re).toLowerCase().includes(b))&&ie.push(re.id),ie.length>200)break}return ie})(),We=Xt(a.nodes,{limit:Gt(a.nodes.length),focusId:oe,hoverId:a.hoverId,searchHits:nt,degree:fe}),ge=new Map,ke=(b,ie)=>{let re=b+"|"+ie,xe=ge.get(re);return xe===void 0&&(c.font=b,xe=c.measureText(ie).width,ge.set(re,xe)),xe},je=a.nodes.length<=250,$e=new Map;a.edges.forEach(b=>{let ie=E[b.sourceNodeId],re=E[b.targetNodeId];if(!ie||!re||!Dt(ie.x,ie.y,10,Be)&&!Dt(re.x,re.y,10,Be))return;if(L!=="all"){let dt=a.domainById[b.sourceNodeId]&&a.domainById[b.sourceNodeId].kind,et=a.domainById[b.targetNodeId]&&a.domainById[b.targetNodeId].kind;if(dt!==L&&et!==L)return}if(g){let dt=a.domainById[b.sourceNodeId]&&(a.domainById[b.sourceNodeId].tags||[]).includes(g),et=a.domainById[b.targetNodeId]&&(a.domainById[b.targetNodeId].tags||[]).includes(g);if(!dt&&!et)return}let xe=re.x-ie.x,Re=re.y-ie.y,Pe=Math.sqrt(xe*xe+Re*Re)||1,ot=Y?12:18,it=-Re/Pe*ot,Ct=xe/Pe*ot,Nt=(ie.x+re.x)/2+it,Mt=(ie.y+re.y)/2+Ct,yt=mt.colors[a.domainById[ie.id]&&a.domainById[ie.id].kind||"other"],bt=oe&&(b.sourceNodeId===oe||b.targetNodeId===oe),zt=oe?bt?.6:.08:Y?.14:.24,Qe=parseInt(yt.slice(1,3),16),ht=parseInt(yt.slice(3,5),16),It=parseInt(yt.slice(5,7),16),Ge=bt?1.6+(b.weight||1):.8+(b.weight||1)*.5,st=Qe+","+ht+","+It+","+zt+","+Ge,_e=$e.get(st);_e||(_e={path:new Path2D,stroke:"rgba("+Qe+","+ht+","+It+","+zt+")",width:Ge},$e.set(st,_e)),_e.path.moveTo(ie.x,ie.y),_e.path.quadraticCurveTo(Nt,Mt,re.x,re.y)}),$e.forEach(b=>{c.strokeStyle=b.stroke,c.lineWidth=b.width,c.stroke(b.path)});let He=null;oe&&(He=new Set,a.edges.forEach(b=>{b.sourceNodeId===oe?He.add(b.targetNodeId):b.targetNodeId===oe&&He.add(b.sourceNodeId)}));let Ze=[];if(a.nodes.forEach(b=>{if(!Dt(b.x,b.y,b.r+2,Be))return;let ie=a.domainById[b.id]||{},re=ie.kind||"other",xe=a.timeMode?_a(ie.updated):mt.colors[re],Re=mt.shapes[re],Pe=a.selectedId===b.id,ot=a.hoverId===b.id,it=a.searchTerm||"",Ct=!it||(b.name||"").toLowerCase().includes(it)||String(Ue[re]||"").toLowerCase().includes(it)||String(re).toLowerCase().includes(it),Nt=L==="all"||re===L,Mt=!g||(ie.tags||[]).includes(g),yt=oe&&b.id!==oe&&!(He&&He.has(b.id))||it&&!Ct||!Nt||!Mt;c.save(),c.globalAlpha=yt?.08:1,(Pe||ot)&&je&&(c.shadowColor=xe,c.shadowBlur=Pe?20:14),c.translate(b.x,b.y),Je(0,0,b.r,Re),c.fillStyle=i(xe,b.r),c.fill(),c.restore(),Pe?(c.save(),Je(b.x,b.y,b.r+3,Re),c.strokeStyle=xe,c.lineWidth=3,c.shadowColor=xe,c.shadowBlur=12,c.stroke(),c.restore()):ot?(c.save(),Je(b.x,b.y,b.r+2,Re),c.strokeStyle=xe,c.lineWidth=2,c.stroke(),c.restore()):it&&Ct?(c.save(),Je(b.x,b.y,b.r+2,Re),c.strokeStyle="#e11d48",c.lineWidth=2,c.stroke(),c.restore()):a.multi.indexOf(b.id)>=0&&(c.save(),Je(b.x,b.y,b.r+2,Re),c.strokeStyle="#60a5fa",c.lineWidth=2,c.shadowColor="#60a5fa",c.shadowBlur=8,c.stroke(),c.restore());let bt=Se(b.name,16);if((Pe||ot||We.has(b.id)&&a.zoom>ue||!Y&&a.zoom>.6)&&Nt&&Mt){let Qe=1/a.zoom,ht="500 "+(12*Qe).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";c.font=ht;let Ge=ke(ht,bt)+16*Qe,st=18*Qe,_e=b.y+b.r+8*Qe,dt=!0;for(let et of Ze)if(b.x-Ge/2<et.x+et.w&&b.x+Ge/2>et.x&&_e<et.y+et.h&&_e+st>et.y){dt=!1;break}if(!dt&&!Pe&&!ot)return;Ze.push({x:b.x-Ge/2,y:_e,w:Ge,h:st}),c.fillStyle=le()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",c.beginPath(),c.roundRect?c.roundRect(b.x-Ge/2,_e,Ge,st,4*Qe):c.rect(b.x-Ge/2,_e,Ge,st),c.fill(),c.strokeStyle=le()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",c.lineWidth=1*Qe,c.stroke(),c.fillStyle=le()?Pe||ot?"#eee":"#bbb":Pe||ot?"#111":"#444",c.textAlign="center",c.fillText(bt,b.x,_e+13*Qe)}}),c.restore(),a.marquee){let b=a.marquee,ie=Math.min(b.sx,b.ex),re=Math.min(b.sy,b.ey),xe=Math.abs(b.ex-b.sx),Re=Math.abs(b.ey-b.sy);c.save(),c.setLineDash([4,4]),c.strokeStyle="rgba(96,165,250,0.9)",c.lineWidth=1,c.fillStyle="rgba(96,165,250,0.12)",c.fillRect(ie,re,xe,Re),c.strokeRect(ie,re,xe,Re),c.restore()}if(a.hoverId&&Q.current){let b=a.domainById[a.hoverId],ie=a.nodes.find(function(re){return re.id===a.hoverId});if(b&&ie){let re=a.edges.filter(function(Pe){return Pe.sourceNodeId===b.id||Pe.targetNodeId===b.id}).length,xe=ie.x*a.zoom+a.panX,Re=ie.y*a.zoom+a.panY;Q.current.style.display="block",Q.current.style.left=xe+14+"px",Q.current.style.top=Re-6+"px",Q.current.innerHTML="<b>"+T(b.title||b.name||"")+'</b><br/><span style="opacity:.8">'+T(b.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",re)+"</span>"}}else Q.current&&(Q.current.style.display="none")},D=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(te))};a.wake=D,a.render=B;let $=()=>{let g=a.nodes.length;a.tickCount++;let T=.9-Math.min(.4,a.tickCount/1500),E=g>1e3?3e3:g>100?2e3:g>50?1200:800,Y=g>100?.002:.005,ue=g>1e3?.012:g>100?.005:.01,oe=g>1e3?6:g>200?12:24,Be={};a.nodes.forEach(ge=>Be[ge.id]=ge);for(let ge=0;ge<g;ge++){if(a.dragNode===a.nodes[ge])continue;let ke=a.nodes[ge],je=0,$e=0;for(let b=0;b<g;b++){if(ge===b)continue;let ie=ke.x-a.nodes[b].x,re=ke.y-a.nodes[b].y,xe=Math.sqrt(ie*ie+re*re)||1,Re=E/(xe*xe);je+=ie/xe*Re,$e+=re/xe*Re}if(a.clustered&&a.typeCenters[ke.type]){let b=a.typeCenters[ke.type];je+=(b.x-ke.x)*.006,$e+=(b.y-ke.y)*.006}else je-=ke.x*ue,$e-=ke.y*ue;let He=(ke.vx+je)*T,Ze=(ke.vy+$e)*T;He=Math.max(-oe,Math.min(oe,He)),Ze=Math.max(-oe,Math.min(oe,Ze)),ke.vx=He,ke.vy=Ze}a.edges.forEach(ge=>{let ke=Be[ge.sourceNodeId],je=Be[ge.targetNodeId];if(!ke||!je)return;let $e=je.x-ke.x,He=je.y-ke.y,Ze=Math.sqrt($e*$e+He*He)||1,b=(Ze-100)*Y,ie=$e/Ze*b,re=He/Ze*b;a.dragNode!==ke&&(ke.vx+=ie,ke.vy+=re),a.dragNode!==je&&(je.vx-=ie,je.vy-=re)});let nt=0;a.nodes.forEach(ge=>{a.dragNode!==ge&&(ge.x+=ge.vx,ge.y+=ge.vy,nt+=ge.vx*ge.vx+ge.vy*ge.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,x()),(g?Math.sqrt(nt/g):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},te=()=>{if(a.running){try{$(),B()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(te)}},ye=(g,L)=>{let T=u.getBoundingClientRect();return{x:(g-T.left-a.panX)/a.zoom,y:(L-T.top-a.panY)/a.zoom}},Fe=g=>{let L=a.domainById[g];return!(!L||W.current!=="all"&&L.kind!==W.current||be.current&&!(L.tags||[]).includes(be.current))},qe=(g,L,T)=>Math.max(L,Math.min(T,g)),Ye=g=>{a.mouseX=g.clientX,a.mouseY=g.clientY;let L=ye(g.clientX,g.clientY),T=null;for(let E=a.nodes.length-1;E>=0;E--){let Y=a.nodes[E];if(!Fe(Y.id))continue;let ue=Y.x-L.x,oe=Y.y-L.y;if(ue*ue+oe*oe<Y.r*Y.r+36){T=Y.id;break}}T!==a.hoverId&&(a.hoverId=T,D())},Ee=g=>{if(g.button!==0)return;let L=ye(g.clientX,g.clientY),T=null;for(let E=a.nodes.length-1;E>=0;E--){let Y=a.nodes[E];if(!Fe(Y.id))continue;let ue=Y.x-L.x,oe=Y.y-L.y;if(ue*ue+oe*oe<Y.r*Y.r+25){T=Y;break}}if(g.shiftKey){if(T){a.shiftClick=T.id;return}a.marquee={sx:g.clientX,sy:g.clientY,ex:g.clientX,ey:g.clientY};return}a.dragStart={x:g.clientX,y:g.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=T||null,T&&(a.dragOffset={dx:T.x-L.x,dy:T.y-L.y})},wt=g=>{if(a.marquee){a.marquee.ex=g.clientX,a.marquee.ey=g.clientY,D();return}if(!a.dragStart)return;let L=g.clientX-a.dragStart.x,T=g.clientY-a.dragStart.y;if(Math.abs(L)+Math.abs(T)>3&&(a.dragging=!0),a.dragNode){let E=ye(g.clientX,g.clientY);a.dragNode.x=E.x+a.dragOffset.dx,a.dragNode.y=E.y+a.dragOffset.dy,D()}else a.dragging&&(a.panX=qe(a.dragStart.px+L,-1e5,1e5),a.panY=qe(a.dragStart.py+T,-1e5,1e5),D())},St=g=>{if(a.marquee){let T=a.marquee;a.marquee=null;let E=u.getBoundingClientRect(),Y=Math.min(T.sx,T.ex)-E.left,ue=Math.max(T.sx,T.ex)-E.left,oe=Math.min(T.sy,T.ey)-E.top,Be=Math.max(T.sy,T.ey)-E.top,nt=a.nodes.filter(We=>{let ge=We.x*a.zoom+a.panX,ke=We.y*a.zoom+a.panY;return ge>=Y&&ge<=ue&&ke>=oe&&ke<=Be}).map(We=>We.id);a.multi=nt,Le(nt),D();return}let L=a.dragStart&&!a.dragging;if(a.shiftClick){let T=a.shiftClick;a.shiftClick=null;let E=Array.isArray(a.multi)?a.multi.slice():[];E.includes(T)||E.push(T),a.multi=E,Le(E),D();return}if(L){let T=ye(g.clientX,g.clientY),E=null;for(let Y=a.nodes.length-1;Y>=0;Y--){let ue=a.nodes[Y];if(!Fe(ue.id))continue;let oe=ue.x-T.x,Be=ue.y-T.y;if(oe*oe+Be*Be<ue.r*ue.r+20){E=ue;break}}E?(a.selectedId=E.id,A(E.id),D()):(a.selectedId=null,a.hoverId=null,g.shiftKey||(a.multi=[],Le([])),A(null),D())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Ot=g=>{g.preventDefault();let L=ye(g.clientX,g.clientY),T=null;for(let E=a.nodes.length-1;E>=0;E--){let Y=a.nodes[E];if(!Fe(Y.id))continue;let ue=Y.x-L.x,oe=Y.y-L.y;if(ue*ue+oe*oe<Y.r*Y.r+25){T=Y;break}}if(T){let E=a.domainById[T.id];E&&q({x:g.clientX,y:g.clientY,id:T.id,path:E.id,title:E.title})}else q(null)},Et=g=>{g.preventDefault();let L=u.getBoundingClientRect(),T=(g.clientX-L.left-a.panX)/a.zoom,E=(g.clientY-L.top-a.panY)/a.zoom,Y=Math.max(.3,Math.min(3,a.zoom*(g.deltaY<0?H:1/H)));a.panX=qe(a.panX+T*(a.zoom-Y),-1e5,1e5),a.panY=qe(a.panY+E*(a.zoom-Y),-1e5,1e5),a.zoom=Y,D()};u.addEventListener("mousemove",Ye),u.addEventListener("mousedown",Ee),window.addEventListener("mousemove",wt),window.addEventListener("mouseup",St),u.addEventListener("wheel",Et,{passive:!1}),u.addEventListener("contextmenu",Ot),I.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Le([]),x(),D()};for(let g=0;g<200;g++)$();x(),D();let Wt=()=>C(!1);return window.addEventListener("mousedown",Wt),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),at.disconnect(),u.removeEventListener("mousemove",Ye),u.removeEventListener("mousedown",Ee),window.removeEventListener("mousemove",wt),window.removeEventListener("mouseup",St),u.removeEventListener("wheel",Et),u.removeEventListener("contextmenu",Ot),window.removeEventListener("mousedown",Wt)}},[t,o]),(0,n.useEffect)(()=>{O!==void 0&&z.current&&requestAnimationFrame(()=>z.current())},[O]),(0,e.jsxs)("div",{className:"me-graph",ref:k,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",r("nodes")," \xB7 ",o.length," ",r("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:r("search"),value:U,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:()=>C(u=>!u),"aria-expanded":P,title:r("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",r("filterLabel")," ",me!=="all"||h||pe?"\u25CF":"\u25BE"]}),P&&(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${me==="all"&&!h?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{de("all"),De(!1)},children:r("all")}),Object.keys(Ke).map(u=>(0,e.jsxs)("button",{type:"button",className:`lg${me===u?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>de(c=>c===u?"all":u),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:mt.colors[u]||Ke[u]}}),r(Ue[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${h?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>De(u=>!u),children:["\u23F1 ",r("timeDim")]}),ae.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:ae.map(u=>(0,e.jsxs)("button",{type:"button",className:`lg${pe===u.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>Me(c=>c===u.tag?"":u.tag),title:u.tag,children:["#",u.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:u.n})]},u.tag))})]}),(me!=="all"||h||pe)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{de("all"),De(!1),Me("")},children:[r("clearFilter")," \u2715"]})]})})]}),(0,e.jsxs)("label",{className:"mc-btn",style:{display:"inline-flex",alignItems:"center",gap:5,cursor:"pointer"},title:r("crossVault"),children:[(0,e.jsx)("input",{type:"checkbox",checked:!!R,onChange:u=>N&&N(u.target.checked)}),r("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${h?" me-on":""}`,onClick:()=>De(u=>!u),children:r("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=S.current;if(u)try{u.toBlob(c=>{c&&tt({url:URL.createObjectURL(c),blob:c})},"image/png")}catch{}},children:r("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>z.current&&z.current(),children:r("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{A(null),de("all"),I.current&&I.current()},children:r("reset")})]}),(0,e.jsxs)("div",{className:"me-graph-canvas",style:{position:"relative",overflow:"hidden"},children:[(0,e.jsx)("canvas",{ref:S,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:Q,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)"}}),he&&(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:r("noMatch")}),y&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>q(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:()=>{w.current({path:y.path,title:y.title}),q(null)},children:r("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{y.id&&(f.current.selectedId=y.id,A(y.id)),q(null);let u=f.current;u&&u.wake&&u.wake()},children:r("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(y.title||"")}catch{}q(null),J(r("copied"))},children:r("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let u=f.current,c=u&&Array.isArray(u.multi)?u.multi.slice():[],K=y.id;if(K&&!c.includes(K)&&c.push(K),q(null),c.length<2){J(r("mergeNeed"),!1);return}if(!window.confirm(r("mergeConfirm")))return;let le=F.current&&F.current(c);le&&le.then?le.then(fe=>fe?J(r("merged")):J(r("mergeFail"),!1)).catch(()=>J(r("mergeFail"),!1)):le&&J(r("merged"))},children:r("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let u=y.path;q(null),window.confirm(r("deleteConfirm"))&&(async()=>{try{(X.current?await X.current(u):!1)?J(r("deleted")):J(r("deleteFail"),!1)}catch{J(r("deleteFail"),!1)}})()},children:r("delete")})]}),G.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:[G.length," ",r("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=G.map(Ie=>ze[Ie]).filter(Boolean).map(Ie=>Ie.title||Ie.name).join(`
354
+ `),K=new Blob([c],{type:"text/plain;charset=utf-8"}),le=URL.createObjectURL(K),fe=document.createElement("a");fe.href=le,fe.download="memory-selected.txt",document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),setTimeout(()=>URL.revokeObjectURL(le),1e3),J(G.length+r("exportedSel"))},children:r("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(G.length<2){J(r("mergeNeed"),!1);return}let u=G.map(K=>ze[K]?ze[K].id:K);if(!window.confirm(r("mergeConfirm")))return;Le([]);let c=f.current;c&&(c.multi=[]),fetch(`${_}/merge?paths=${encodeURIComponent(u.join(","))}`).then(K=>K.json()).then(K=>{K&&K.ok?J(r("merged")):J(r("mergeFail"),!1)}).catch(()=>J(r("mergeFail"),!1))},children:r("merge")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{if(!window.confirm(r("deleteConfirm")))return;let u=G.map(K=>ze[K]?ze[K].id:K);Le([]);let c=f.current;c&&(c.multi=[]),(async()=>{let K=0;for(let le of u)try{(X.current?await X.current(le):!1)&&K++}catch{}J(K+r("deletedSelected"),K>0)})()},children:r("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=f.current;u&&(u.multi=[]),Le([]);let c=f.current;c&&c.render&&c.render()},children:r("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:ze[V]?ze[V].title||ze[V].name:V}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:ze[V]?r(Ue[ze[V].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:r("graphHint")}),(o.filter(u=>u.source===V||u.target===V)||[]).slice(0,8).map((u,c)=>{let K=u.source===V?u.target:u.source,le=ze[K];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:fe=>{fe.preventDefault();let Ie=f.current;Ie&&(Ie.selectedId=K,Ie.hoverId=K,Ie.wake&&Ie.wake()),A(K)},children:le?(le.title||le.name).slice(0,28):K},c)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:r("graphTip")}),M&&(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 "+(M.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:M.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:M.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:M.msg})]}),Ce&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{Ce.url&&URL.revokeObjectURL(Ce.url),tt(null),s(!1)},children:[(0,e.jsx)("style",{children:Oe}),(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:u=>u.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:r("exportGraph")}),(0,e.jsxs)("div",{className:"me-head-actions",children:[(0,e.jsx)("a",{className:"mc-btn",href:Ce.url,download:"memory-graph.png",onClick:()=>{Ve("download"),J(r("downloaded")+" \xB7 "+r("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:r(Z==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ve("full"),s(u=>!u),J(r("fullscreen"))},children:r(Z==="full"?"done":Ne?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let u=Ce.blob;u&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":u})]).then(()=>{Ve("copy"),J(r("copied"))}).catch(()=>{J(r("copyFail"),!1)}):J(r("copyFail"),!1)},children:r(Z==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ce.url&&URL.revokeObjectURL(Ce.url),tt(null),s(!1)},children:r("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:r("exportGraph"),style:{maxWidth:"100%",maxHeight:Ne?"calc(100% - 64px)":"70vh",borderRadius:Ne?0:8,cursor:"zoom-in"},onClick:()=>s(u=>!u)})})]})]})]})}function _a(t){let o=new Date(t||0).getTime();if(!o)return"#94a3b8";let l=(Date.now()-o)/864e5;return l<3?"#10b981":l<14?"#f59e0b":l<30?"#f97316":"#94a3b8"}function Qt({label:t,value:o=[],options:l,onChange:m,placeholder:p,z:r=20}){let[v,R]=(0,n.useState)(!1),N=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!v)return;let w=X=>{N.current&&!N.current.contains(X.target)&&R(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[v]);let O=Array.isArray(o)?o:[],S=O.includes("__all__"),k=S?l.find(w=>w.value==="__all__")?.label||"":O.length?O.map(w=>l.find(X=>X.value===w)?.label||w).join("\u3001"):"",f=(w,X)=>{if(w.value==="__all__"){m(X?["__all__"]:[]);return}let F=new Set(O);F.has("__all__")&&F.delete("__all__"),X?F.add(w.value):F.delete(w.value),m([...F])},z=l.find(w=>w.value==="__all__"),I=l.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:N,style:{position:"relative",minWidth:0},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>R(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:k||p||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),v&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:r,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:S,onChange:w=>f(z,w.target.checked)}),(0,e.jsx)("span",{children:z.label})]}),I.map(w=>(0,e.jsxs)("label",{onClick:X=>X.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:O.includes(w.value),onChange:X=>f(w,X.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Ua(t){let o=new Date(t||0).getTime();return!!o&&(Date.now()-o)/864e5<3}async function Ka(t,o,l){if(l&&typeof window.showSaveFilePicker=="function")try{let r=await window.showSaveFilePicker({suggestedName:o}),v=await r.createWritable();return await v.write(t),await v.close(),{ok:!0,picked:!0,name:r.name}}catch(r){return r&&r.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(r.message||r)}}let m=URL.createObjectURL(t),p=document.createElement("a");return p.href=m,p.download=o,document.body.appendChild(p),p.click(),document.body.removeChild(p),setTimeout(()=>URL.revokeObjectURL(m),1e3),{ok:!0,picked:!1,name:o}}function Ft(t,o){if(!o||!t)return t;let l=t.toLowerCase(),m=o.toLowerCase(),p=[],r=0;for(;r<t.length;){let v=l.indexOf(m,r);if(v<0){p.push(t.slice(r));break}v>r&&p.push(t.slice(r,v)),p.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(v,v+m.length)},v)),r=v+m.length}return p}function gt(t){if(!t)return"";let o=new Date(t);if(Number.isNaN(o.getTime()))return"";let l=new Date,m=o.toDateString()===l.toDateString(),p=v=>String(v).padStart(2,"0"),r=`${p(o.getHours())}:${p(o.getMinutes())}`;return m?r:`${o.getMonth()+1}-${o.getDate()} ${r}`}
355
355
 
356
356
  return module.exports;
357
357
  },