memory-eternal 0.10.16 → 0.10.18

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 aa=Object.create;var St=Object.defineProperty;var na=Object.getOwnPropertyDescriptor;var oa=Object.getOwnPropertyNames;var ia=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var sa=(t,o)=>{for(var r in o)St(t,r,{get:o[r],enumerable:!0})},Ht=(t,o,r,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of oa(o))!ra.call(t,d)&&d!==r&&St(t,d,{get:()=>o[d],enumerable:!(m=na(o,d))||m.enumerable});return t};var la=(t,o,r)=>(r=t!=null?aa(ia(t)):{},Ht(o||!t||!t.__esModule?St(r,"default",{value:t,enumerable:!0}):r,t)),da=t=>Ht(St({},"__esModule",{value:!0}),t);var $a={};sa($a,{EN:()=>Jt,MemoryLibrary:()=>za,ZH:()=>Xt,apply:()=>Sa,inject:()=>xa});module.exports=da($a);var n=la(require("react"),1);var ca={"&":"&amp;","<":"&lt;",">":"&gt;"},zt=t=>String(t).replace(/[&<>]/g,o=>ca[o]),pa=[[/结论|总结|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"]],ua=["\u2728","info"],ma=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],ga=t=>{let o=String(t);for(let[r,m,d]of pa)if(r.test(o))return[m,d];return ua},fa=t=>{let o=t.join(" ");for(let[r,m,d]of ma)if(r.test(o))return[m,d];return["\u{1F4CC}","info"]};function st(t){let o=String(t),r=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(o);if(r&&!/[是为有了吗呢着过把被和与或于]/.test(r[1]))return'<span class="md-kv"><span class="md-k">'+zt(r[1])+'</span><span class="md-v">'+st(r[2])+"</span></span>";let m=zt(o);return m=m.replace(/^\[([ xX])\](?=\s|$)\s*/,(d,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,(d,i,w)=>/^(https?:|\/|#)/i.test(w)?'<a class="md-link" href="'+w+'" target="_blank" rel="noopener noreferrer">'+i+"</a>":i),m}function Ct(t){let o=String(t||"").replace(/\r\n?/g,`
6
+ var aa=Object.create;var St=Object.defineProperty;var na=Object.getOwnPropertyDescriptor;var oa=Object.getOwnPropertyNames;var ia=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var sa=(t,o)=>{for(var r in o)St(t,r,{get:o[r],enumerable:!0})},Ht=(t,o,r,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of oa(o))!ra.call(t,d)&&d!==r&&St(t,d,{get:()=>o[d],enumerable:!(m=na(o,d))||m.enumerable});return t};var la=(t,o,r)=>(r=t!=null?aa(ia(t)):{},Ht(o||!t||!t.__esModule?St(r,"default",{value:t,enumerable:!0}):r,t)),da=t=>Ht(St({},"__esModule",{value:!0}),t);var $a={};sa($a,{EN:()=>Jt,MemoryLibrary:()=>za,ZH:()=>Xt,apply:()=>Sa,inject:()=>xa});module.exports=da($a);var n=la(require("react"),1);var ca={"&":"&amp;","<":"&lt;",">":"&gt;"},zt=t=>String(t).replace(/[&<>]/g,o=>ca[o]),pa=[[/结论|总结|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"]],ua=["\u2728","info"],ma=[[/风险|注意|警告|禁止|坑|务必/i,"\u26A0\uFE0F","warn"],[/提示|建议|tip|best practice/i,"\u{1F4A1}","idea"],[/结论|总结/i,"\u2705","ok"],[/错误|失败|报错/i,"\u2757","bad"]],ga=t=>{let o=String(t);for(let[r,m,d]of pa)if(r.test(o))return[m,d];return ua},fa=t=>{let o=t.join(" ");for(let[r,m,d]of ma)if(r.test(o))return[m,d];return["\u{1F4CC}","info"]};function st(t){let o=String(t),r=/^([^::\s]{1,8})[::]\s*(.+)$/.exec(o);if(r&&!/[是为有了吗呢着过把被和与或于]/.test(r[1]))return'<span class="md-kv"><span class="md-k">'+zt(r[1])+'</span><span class="md-v">'+st(r[2])+"</span></span>";let m=zt(o);return m=m.replace(/^\[([ xX])\](?=\s|$)\s*/,(d,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,(d,i,S)=>/^(https?:|\/|#)/i.test(S)?'<a class="md-link" href="'+S+'" target="_blank" rel="noopener noreferrer">'+i+"</a>":i),m}function Ct(t){let o=String(t||"").replace(/\r\n?/g,`
7
7
  `),r=/^---\n([\s\S]*?)\n---\n?/.exec(o);if(!r)return{meta:[],body:o};let m=[];for(let d of r[1].split(`
8
- `)){let i=d.indexOf(":");if(i<=0)continue;let w=d.slice(0,i).trim(),C=d.slice(i+1).trim().replace(/^["']|["']$/g,"");w&&m.push([w,C])}return{meta:m,body:o.slice(r[0].length)}}function jt(t){let o=String(t||"").trim().replace(/^\[|\]$/g,"");return o?o.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Tt(t){let o=Ct(String(t||"").replace(/\r\n?/g,`
9
- `)).body;if(!o.trim())return"";let r=[],m=o.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(u,D,I)=>(r.push('<pre class="md-pre"><code>'+zt(I.replace(/\n$/,""))+"</code></pre>"),"\0F"+(r.length-1)+"\0")),d=[],i=[],w=null,C=null,x=()=>{i.length&&(d.push('<p class="md-p">'+i.join("<br/>")+"</p>"),i=[])},A=()=>{if(!w)return;let u=w.type;d.push("<"+u+' class="md-'+u+'">'+w.items.map(D=>"<li>"+D+"</li>").join("")+"</"+u+">"),w=null},k=()=>{if(!C)return;let[u,D]=fa(C);d.push('<div class="md-callout md-c-'+D+'"><span class="md-ico">'+u+"</span>"+C.join("<br/>")+"</div>"),C=null},h=()=>{x(),A(),k()};for(let u of m.split(`
10
- `)){let D=u.trim();if(!D){h();continue}let I=/^\u0000F(\d+)\u0000$/.exec(D);if(I){h(),d.push(r[Number(I[1])]);continue}let v;if(v=/^(#{1,6})\s+(.+)$/.exec(D)){h();let[T,N]=ga(v[2]);d.push('<div class="md-h md-h-'+(v[1].length<=2?"h1":"h2")+" md-c-"+N+'"><span class="md-ico">'+T+'</span><span class="md-hx">'+st(v[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(D)){h(),d.push('<hr class="md-hr"/>');continue}if(v=/^>\s?(.*)$/.exec(D)){x(),A(),C=C||[],C.push(st(v[1]));continue}if(v=/^[-*+]\s+(.+)$/.exec(D)){x(),k(),(!w||w.type!=="ul")&&(A(),w={type:"ul",items:[]}),w.items.push(st(v[1]));continue}if(v=/^\d+[.)]\s+(.+)$/.exec(D)){x(),k(),(!w||w.type!=="ol")&&(A(),w={type:"ol",items:[]}),w.items.push(st(v[1]));continue}A(),k(),i.push(st(D))}return h(),d.join(`
11
- `)}function Ot(t={}){let o=t.repo||"EternalNight996/memory-eternal",r=String(t.title||"[Bug] ").slice(0,120),m=Array.isArray(t.labels)?t.labels:["bug"],d=Number(t.maxLength)>500?Number(t.maxLength):7e3,i=x=>{let A=new URLSearchParams;return A.set("title",r),A.set("body",x),m.length&&A.set("labels",m.join(",")),"https://github.com/"+o+"/issues/new?"+A.toString()},w=String(t.body||""),C=i(w);if(C.length>d){let x=`
8
+ `)){let i=d.indexOf(":");if(i<=0)continue;let S=d.slice(0,i).trim(),M=d.slice(i+1).trim().replace(/^["']|["']$/g,"");S&&m.push([S,M])}return{meta:m,body:o.slice(r[0].length)}}function jt(t){let o=String(t||"").trim().replace(/^\[|\]$/g,"");return o?o.split(",").map(r=>r.trim().replace(/^["']|["']$/g,"")).filter(Boolean):[]}function Tt(t){let o=Ct(String(t||"").replace(/\r\n?/g,`
9
+ `)).body;if(!o.trim())return"";let r=[],m=o.replace(/```([\w+#.-]*)\n([\s\S]*?)```/g,(u,z,I)=>(r.push('<pre class="md-pre"><code>'+zt(I.replace(/\n$/,""))+"</code></pre>"),"\0F"+(r.length-1)+"\0")),d=[],i=[],S=null,M=null,k=()=>{i.length&&(d.push('<p class="md-p">'+i.join("<br/>")+"</p>"),i=[])},E=()=>{if(!S)return;let u=S.type;d.push("<"+u+' class="md-'+u+'">'+S.items.map(z=>"<li>"+z+"</li>").join("")+"</"+u+">"),S=null},C=()=>{if(!M)return;let[u,z]=fa(M);d.push('<div class="md-callout md-c-'+z+'"><span class="md-ico">'+u+"</span>"+M.join("<br/>")+"</div>"),M=null},h=()=>{k(),E(),C()};for(let u of m.split(`
10
+ `)){let z=u.trim();if(!z){h();continue}let I=/^\u0000F(\d+)\u0000$/.exec(z);if(I){h(),d.push(r[Number(I[1])]);continue}let w;if(w=/^(#{1,6})\s+(.+)$/.exec(z)){h();let[R,D]=ga(w[2]);d.push('<div class="md-h md-h-'+(w[1].length<=2?"h1":"h2")+" md-c-"+D+'"><span class="md-ico">'+R+'</span><span class="md-hx">'+st(w[2])+"</span></div>");continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(z)){h(),d.push('<hr class="md-hr"/>');continue}if(w=/^>\s?(.*)$/.exec(z)){k(),E(),M=M||[],M.push(st(w[1]));continue}if(w=/^[-*+]\s+(.+)$/.exec(z)){k(),C(),(!S||S.type!=="ul")&&(E(),S={type:"ul",items:[]}),S.items.push(st(w[1]));continue}if(w=/^\d+[.)]\s+(.+)$/.exec(z)){k(),C(),(!S||S.type!=="ol")&&(E(),S={type:"ol",items:[]}),S.items.push(st(w[1]));continue}E(),C(),i.push(st(z))}return h(),d.join(`
11
+ `)}function Ot(t={}){let o=t.repo||"EternalNight996/memory-eternal",r=String(t.title||"[Bug] ").slice(0,120),m=Array.isArray(t.labels)?t.labels:["bug"],d=Number(t.maxLength)>500?Number(t.maxLength):7e3,i=k=>{let E=new URLSearchParams;return E.set("title",r),E.set("body",k),m.length&&E.set("labels",m.join(",")),"https://github.com/"+o+"/issues/new?"+E.toString()},S=String(t.body||""),M=i(S);if(M.length>d){let k=`
12
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`,A=k=>i(w.slice(0,k)+x);if(A(0).length>d)w=x;else{let k=0,h=w.length;for(;k<h;){let u=Math.ceil((k+h)/2);A(u).length<=d?k=u:h=u-1}w=w.slice(0,k)+x}C=i(w)}return C}function Wt(t={}){return["## \u73B0\u8C61",String(t.description||"").trim()||"\uFF08\u8BF7\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF09","","## \u590D\u73B0\u6B65\u9AA4","1. ","2. ","","## \u671F\u671B\u884C\u4E3A","","## \u5B9E\u9645\u884C\u4E3A","","## \u73AF\u5883","- \u63D2\u4EF6\u7248\u672C: "+(t.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",t.diagnostics||"","","---","> \u7531 memory-eternal \u63D2\u4EF6\u5185\u300C\u53CD\u9988\u5F02\u5E38\u300D\u751F\u6210\uFF08\u8BCA\u65AD\u4FE1\u606F\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E\u5404\u7C7B key/token \u5DF2\u66FF\u6362\uFF09\u3002"].join(`
14
- `)}var It="https://github.com/EternalNight996/memory-eternal",ba=["\u6211\u5728\u4F7F\u7528 memory-eternal\uFF08DeepSeek Harness \u7684\u8BB0\u5FC6\u63D2\u4EF6\uFF09\u65F6\u9047\u5230\u4E86\u95EE\u9898\uFF0C\u8BF7\u4F60\u5E2E\u6211\u628A\u8FD9\u4E2A\u95EE\u9898\u63D0\u4EA4\u5230 GitHub\u3002","","\u4ED3\u5E93\uFF1A"+It,"","\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
- `),ya=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+It,"","Workflow:","","1. Run `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50` first: if a matching issue exists, add a comment with `gh issue comment <n> --body-file <file>` instead of opening a duplicate.",'2. Otherwise create it with `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <one-line summary>" --body-file <file>`, using sections: Symptoms / Steps to reproduce / Expected / Actual / Environment (plugin, DSH, OS, Node) / Diagnostics.',"3. If `gh` is not authenticated or unavailable, do NOT try to submit: output a GitHub new-issue link with the title and body pre-filled instead, and I will click submit myself.","4. Report the resulting issue URL back to me.","","Keep my description verbatim - do not rewrite or summarise it. Put the diagnostics under the Diagnostics section as-is.","","My description:","<write your problem here>","","Diagnostics:","<paste the diagnostics copied from the in-app Report-a-bug dialog>"].join(`
16
- `);function $t(t={}){let o=t.lang==="en"?"en":"zh",r=o==="en"?ya:ba,m=t.repo||"EternalNight996/memory-eternal";return r=r.split(It).join("https://github.com/"+m),t.description&&(r=r.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(r=r.replace(o==="en"?"<paste the diagnostics copied from the in-app Report-a-bug dialog>":"<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>",String(t.diagnostics).trim())),r}function _t({panX:t=0,panY:o=0,zoom:r=1,w:m=0,h:d=0,margin:i=60}={}){let w=r||1;return{x0:(0-t)/w-i,y0:(0-o)/w-i,x1:(m-t)/w+i,y1:(d-o)/w+i}}function Nt(t,o,r,m){return m?t+r>=m.x0&&t-r<=m.x1&&o+r>=m.y0&&o-r<=m.y1:!0}function Ut(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Kt(t,o={}){let r=Number.isFinite(o.limit)?o.limit:1/0,m=new Set,d=x=>{x&&m.size<r&&m.add(x)};if(d(o.focusId),d(o.hoverId),o.searchHits)for(let x of o.searchHits){if(m.size>=r)break;m.add(x)}let i=o.degree||{},w=x=>Number(i[x])||0,C=[];for(let x of Array.isArray(t)?t:[])x&&x.id&&!m.has(x.id)&&C.push(x);C.sort((x,A)=>w(A.id)-w(x.id));for(let x of C){if(m.size>=r)break;m.add(x.id)}return m}function ha(t,o){if(t===o)return!0;if(t===null||o===null||t===void 0||o===void 0||typeof t!="object"&&typeof o!="object")return t===o;try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}function qt(t,o){let r={...t||{}},m={};for(let[d,i]of Object.entries(o||{}))ha(t?t[d]:void 0,i)||(r[d]=i,m[d]=i);return{values:r,overlay:m}}var e=require("react/jsx-runtime"),lt="memory-eternal",_="/memory-eternal/api",va=100,xa=["slots","locale"],Xt={nav:"\u8BB0\u5FC6",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",overview:"\u8BB0\u5FC6\u5E93\u6982\u89C8",total:"\u77E5\u8BC6\u5361",recent:"\u8FD1 7 \u5929\u65B0\u589E",tags:"\u6807\u7B7E",searchPlaceholder:"\u641C\u7D22\u8BB0\u5FC6\uFF08\u652F\u6301\u4E2D\u6587\u7247\u6BB5\uFF09\u2026",search:"\u641C\u7D22",all:"\u5168\u90E8",kindProject:"\u9879\u76EE",kindKnowledge:"\u77E5\u8BC6",kindContent:"\u5185\u5BB9",kindPrompt:"\u63D0\u793A\u8BCD",kindBusiness:"\u4E1A\u52A1",kindTool:"\u5DE5\u5177",kindMistake:"\u6559\u8BAD",cardsTab:"\u77E5\u8BC6\u5361",graphTab:"\u77E5\u8BC6\u56FE\u8C31",graph:"\u77E5\u8BC6\u56FE\u8C31",graphHint:"\u8282\u70B9=\u77E5\u8BC6\u5361\uFF1B\u8FDE\u7EBF=[[\u94FE\u63A5]] \u6216\u5171\u4EAB\u6807\u7B7E\u3002\u70B9\u51FB\u8282\u70B9\u9605\u8BFB\u5361\u7247\u3002",graphTip:"\u5DE6\u952E\u51F8\u663E \xB7 Shift+\u62D6\u62FD\u6846\u9009 \xB7 \u53F3\u952E\u83DC\u5355 \xB7 \u6EDA\u8F6E\u7F29\u653E \xB7 \u62D6\u62FD\u5E73\u79FB",rebuild:"\u91CD\u5EFA",reset:"\u91CD\u7F6E",expandAll:"\u5168\u90E8\u5C55\u5F00",capped:"\u5DF2\u5C55\u793A\u6700\u6838\u5FC3\u7684",clearFocus:"\u53D6\u6D88\u9AD8\u4EAE",empty:"\u8BB0\u5FC6\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u591A\u804A\u51E0\u8F6E\u540E\uFF0C\u503C\u5F97\u4FDD\u5B58\u7684\u5185\u5BB9\u4F1A\u81EA\u52A8\u6C89\u6DC0\u6210\u77E5\u8BC6\u5361\u3002",emptyGraph:"\u56FE\u8C31\u6682\u65E0\u6570\u636E\u3002",open:"\u9605\u8BFB",updated:"\u66F4\u65B0\u4E8E",created:"\u521B\u5EFA\u4E8E",source:"\u6765\u6E90",close:"\u5173\u95ED",vaultDir:"\u8BB0\u5FC6\u5E93\u76EE\u5F55",capture:"\u81EA\u52A8\u6C89\u6DC0",recall:"\u81EA\u52A8\u53EC\u56DE",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u7981\u7528",error:"\u52A0\u8F7D\u5931\u8D25",back:"\u8FD4\u56DE\u5217\u8868",cardCount:"\u5F20\u5361",nodes:"\u8282\u70B9",edges:"\u8FDE\u7EBF",memoryTitle:"\u8BB0\u5FC6\u5E93",memoryHint:"\u4F60\u7684\u672C\u5730\u7B2C\u4E8C\u5927\u8111",zoomIn:"\u653E\u5927",zoomOut:"\u7F29\u5C0F",fit:"\u9002\u5E94",enterFullscreen:"\u5168\u5C4F",exitFullscreen:"\u9000\u51FA\u5168\u5C4F",exportGraph:"\u5BFC\u51FA",openCard:"\u6253\u5F00\u5361\u7247",focusNeighbors:"\u51F8\u663E\u5173\u8054",copyName:"\u590D\u5236\u540D\u79F0",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u8BB0\u5FC6",clearFilter:"\u6E05\u9664\u8FC7\u6EE4",filterLabel:"\u7B5B\u9009",sortRecent:"\u6700\u8FD1",sortTitle:"\u6807\u9898",sortHot:"\u70ED\u70B9",exportSel:"\u5BFC\u51FA\u9009\u4E2D",clearSelection:"\u6E05\u7A7A\u9009\u62E9",download:"\u4E0B\u8F7D",openNewTab:"\u65B0\u6807\u7B7E\u6253\u5F00",copyImage:"\u590D\u5236\u56FE\u7247",done:"\u5B8C\u6210",downloaded:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D",openedTab:"\u5DF2\u5728\u65B0\u6807\u7B7E\u6253\u5F00",copied:"\u5DF2\u590D\u5236",exportedSel:"\u4E2A\u8282\u70B9\u5DF2\u5BFC\u51FA",fullscreen:"\u5168\u5C4F",exitFull:"\u9000\u51FA\u5168\u5C4F",copyFail:"\u590D\u5236\u5931\u8D25",timeDim:"\u65F6\u95F4\u7EF4",timeNew:"3 \u5929\u5185",timeRecent:"2 \u5468\u5185",timeMonth:"1 \u6708\u5185",timeOld:"\u66F4\u65E9",newBadge:"\u65B0",expand:"\u5C55\u5F00\u5168\u90E8",collapse:"\u6536\u8D77",exportVault:"\u5BFC\u51FAMD",exportJson:"\u5BFC\u51FAJSON",exporting:"\u5BFC\u51FA\u4E2D\u2026",exportedVault:"\u8BB0\u5FC6\u5E93\u5DF2\u5BFC\u51FA",exportFail:"\u5BFC\u51FA\u5931\u8D25",importVault:"\u5BFC\u5165",importedVault:"\u5BFC\u5165\u5B8C\u6210",importedTotal:" \u5F20 / \u6587\u4EF6\u5171 ",importedTotalTail:" \u5F20",importedQuarantine:" \xB7 \u5F85\u5BA1\u6838 ",importedQuarantineTail:" \u5F20\uFF08\u9694\u79BB\u533A\uFF0C\u6279\u51C6\u540E\u624D\u53C2\u4E0E\u53EC\u56DE\uFF09",importedSkipped:" \xB7 \u8DF3\u8FC7 ",importedSkippedTail:" \u5F20\uFF08\u91CD\u590D\u6216\u7A7A\uFF09",importFail:"\u5BFC\u5165\u5931\u8D25",location:"\u81EA\u9009\u4F4D\u7F6E",saveAs:"\u53E6\u5B58\u4E3A",saveAsUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9009\u62E9\u4FDD\u5B58\u4F4D\u7F6E",exportedTo:"\u5DF2\u5BFC\u51FA\u5230",defaultDownloads:"\u9ED8\u8BA4\u4E0B\u8F7D\u6587\u4EF6\u5939",exportCancel:"\u5DF2\u53D6\u6D88\u5BFC\u51FA",manage:"\u7BA1\u7406",tabUsage:"\u7528\u91CF/\u4ECA\u65E5",tabOptimize:"\u6574\u7406\u5EFA\u8BAE",adminLoadFail:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF1A\u8BF7\u5F7B\u5E95\u91CD\u542F dsh-desktop\uFF08host \u9700\u52A0\u8F7D\u65B0\u7248 /memory-eternal \u8DEF\u7531\uFF09",retry:"\u91CD\u8BD5",mergeSimilar:"\u4E00\u952E\u5408\u5E76\u76F8\u4F3C",trendLabel:"\u8FD1 30 \u5929\u8D8B\u52BF",cleanStale:"\u{1F5D1}\uFE0F \u4E00\u952E\u6E05\u7406\u9648\u65E7",deletedStale:"\u4E2A\u9648\u65E7\u5361\u5DF2\u6E05\u7406",newCard:"\u65B0\u5EFA",tplDecision:"\u{1F4DD} \u6280\u672F\u51B3\u7B56",tplBug:"\u{1F41B} \u8E29\u5751",tplMeeting:"\u{1F4CB} \u4F1A\u8BAE\u7EAA\u8981",tplWeekly:"\u{1F4CA} \u5468\u62A5",createCard:"\u521B\u5EFA",cardTitle:"\u6807\u9898",cardBody:"\u6B63\u6587",fbUseful:"\u6709\u7528",fbIrr:"\u65E0\u5173",todayAdd:"\u4ECA\u65E5\u65B0\u589E",weekAdd:"\u8FD1 7 \u5929",byKind:"\u5206\u7C7B\u7EDF\u8BA1",todayList:"\u4ECA\u65E5\u6C89\u6DC0",budgetLabel:"\u4F1A\u8BDD\u9884\u7B97",budgetChars:"\u9884\u7B97\u5B57\u7B26",recallLimitLabel:"\u53EC\u56DE\u6761\u6570",embeddingLabel:"\u8BED\u4E49\u53EC\u56DE",mergePairs:"\u76F8\u4F3C\u5361\u5BF9\uFF08\u53EF\u5408\u5E76\uFF09",staleCards:"\u9648\u65E7\u5361\uFF08>90 \u5929\u672A\u66F4\u65B0\uFF09",noOptimize:"\u6682\u65E0\u53EF\u6574\u7406\u9879\uFF0C\u5F88\u5065\u5EB7 \u{1F389}",oneClickOptimize:"\u4E00\u952E\u4F18\u5316",oneClickOptimizeConfirm:"\u786E\u8BA4\u4E00\u952E\u4F18\u5316\uFF1F\u5C06\u5408\u5E76\u6240\u6709\u76F8\u4F3C\u5361\u5BF9\uFF08\u9ED8\u8BA4\u4E0D\u6E05\u7406\u9648\u65E7\u5361\uFF09\u3002",oneClickAlsoStale:"\u540C\u65F6\u6E05\u7406\u9648\u65E7\u5361",oneClickOptimizeDone:"\u4E00\u952E\u4F18\u5316\u5B8C\u6210",optimizedMerged:"\u5BF9\u5DF2\u5408\u5E76",optimizedStaleDeleted:"\u5F20\u9648\u65E7\u5361\u5DF2\u6E05\u7406",mcpSetupStatus:"Agent MCP \u6302\u8F7D\u72B6\u6001",rerunSetup:"\u8865\u5168 MCP",notInstalled:"\u672A\u5B89\u88C5",noMcpEntry:"\u914D\u7F6E\u7F3A\u5931",nodePathMismatch:"node \u8DEF\u5F84\u4E0D\u4E00\u81F4\uFF0C\u5EFA\u8BAE\u91CD\u8DD1 setup",nodePathNote:"node \u73AF\u5883\u4E0D\u540C\uFF08\u53EF\u7528\uFF09",healthy:"\u914D\u7F6E\u6B63\u5E38",mcpSetupHint:"\u300C\u81EA\u52A8\u6302\u8F7D MCP\u300D= \u8BA9 Claude Code / Codex / Cursor \u8FD9\u4E9B\u5DE5\u5177\u80FD\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002\u5F00\u542F\u540E\u81EA\u52A8\u628A\u5B83\u4EEC\u914D\u7F6E\u597D\uFF1B\u5173\u6389\u5C31\u4E0D\u52A8\u4F60\u7535\u8111\u4E0A\u4EFB\u4F55\u914D\u7F6E\u6587\u4EF6\uFF0C\u9700\u8981\u65F6\u624B\u52A8\u8DD1 dsh-memory setup\u3002",mcpManageHint:"\u6BCF\u4E2A agent \u7528\u4E0B\u65B9\u6309\u94AE\u5355\u72EC\u5B89\u88C5/\u5378\u8F7D MCP",tabConfig:"\u8BB0\u5FC6\u914D\u7F6E",tabAudit:"\u5BA1\u6838\u4E2D\u5FC3",statusApproved:"\u5DF2\u5BA1\u6838",statusPending:"\u5F85\u5BA1\u6838",statusRejected:"\u5DF2\u9A73\u56DE",allStatus:"\u5168\u90E8\u72B6\u6001",tabRecycle:"\u56DE\u6536\u4E2D\u5FC3",pending:"\u5F85\u5BA1\u6838",rejected:"\u5DF2\u9A73\u56DE",selectAll:"\u5168\u9009",approve:"\u6279\u51C6",reject:"\u9A73\u56DE",allAgents:"\u5168\u90E8\u667A\u80FD\u4F53",noAuditItems:"\u6682\u65E0\u5BA1\u6838\u9879\u76EE",auditBodyFail:"\u6B63\u6587\u8BFB\u53D6\u5931\u8D25",deletedAt:"\u5220\u9664\u4E8E",restore:"\u6062\u590D",restoreDelete:"\u5220\u9664\u8FDB\u56DE\u6536\u7AD9",purge:"\u6C38\u4E45\u5220\u9664",emptyRecycle:"\u56DE\u6536\u7AD9\u4E3A\u7A7A",recycleHint:"\u5220\u9664\u7684\u5361\u7247\u5148\u8FDB\u56DE\u6536\u7AD9\uFF0C30 \u5929\u5185\u53EF\u6062\u590D\uFF0C\u8D85\u671F\u81EA\u52A8\u6C38\u4E45\u5220\u9664",purgeConfirm:"\u786E\u5B9A\u6C38\u4E45\u5220\u9664\uFF1F\u4E0D\u53EF\u6062\u590D\u3002",recycleDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u8FDB\u56DE\u6536\u7AD9\uFF1F30 \u5929\u5185\u53EF\u6062\u590D\u3002",modeInit:"\u542F\u52A8\u65F6\u62C9\u4E00\u6B21",modeInterval:"\u5468\u671F\u4FDD\u6D3B",modeManual:"\u4EC5\u624B\u52A8",serviceConfig:"\u670D\u52A1\u81EA\u7BA1\u7406\u914D\u7F6E",auditConfig:"\u81EA\u52A8\u5BA1\u6838\u914D\u7F6E",auditHint:"\u547D\u4E2D\u514D\u5BA1\u7684\u65B0\u5361\u76F4\u63A5\u5165\u5E93\uFF0C\u5176\u4F59\u8FDB\u5F85\u5BA1\u6838",auditMode:"\u5BA1\u6838\u6A21\u5F0F",auditAll:"\u5168\u90E8\u8981\u5BA1\u6838",auditNone:"\u5168\u90E8\u514D\u5BA1",auditExemptAgents:"\u514D\u5BA1\u667A\u80FD\u4F53",auditExemptKinds:"\u514D\u5BA1\u7C7B\u578B",allExempt:"\u5168\u90E8\u514D\u5BA1",recycleDays:"\u56DE\u6536\u4FDD\u7559\u5929\u6570",editInSetting:"\u7F16\u8F91\u8BF7\u5230 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6",pendingSyncNote:"\u6B64\u9875\u662F\u72EC\u7ACB Web \u9875\uFF1A\u4FDD\u5B58\u540E\u7531 DSH \u5BBF\u4E3B\u5E94\u7528\uFF08\u65B0\u7248\u5BBF\u4E3B\u4F1A\u88AB\u76F4\u63A5\u53EB\u9192\u3001\u5728\u8BF7\u6C42\u4E0A\u4E0B\u6587\u91CC\u5E94\u7528\uFF0C\u70B9\u4FDD\u5B58\u5373\u751F\u6548\uFF09\uFF1B\u82E5\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5219\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\u3001\u7ACB\u5373\u751F\u6548\u3002\u53EA\u6709\u5728\u5BF9\u63A5\u65E7\u7248\u5BBF\u4E3B\u65F6\u624D\u4F1A\u9000\u56DE\u300C\u6392\u961F\u7B49\u5B83\u81EA\u5DF1\u540C\u6B65\u300D\uFF0C\u90A3\u65F6\u53EF\u5728 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u91CC\u6539\u540C\u4E00\u9879\u3002",readonlyTitle:"\u5F53\u524D\u9875\u9762\u53EA\u8BFB\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u914D\u7F6E",readonlyBody:"\u8FD9\u4E2A\u8FDB\u7A0B\u6CA1\u6709 DSH \u7684\u8BBE\u7F6E\u670D\u52A1\uFF08settings.update \u4E0D\u5B58\u5728\uFF09\uFF0C\u914D\u7F6E\u53EA\u80FD\u5728\u672C\u673A DSH \u91CC\u4FEE\u6539\uFF1A\u684C\u9762\u7248 \u2192 \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u3002",readonlyBtn:"\u53EA\u8BFB",setupRunInTerminal:"\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5230\u7EC8\u7AEF\u6267\u884C\uFF1A",dshMemoryConfig:"DSH \u8BB0\u5FC6\u914D\u7F6E",autoCapture:"\u81EA\u52A8\u6C89\u6DC0",autoRecall:"\u81EA\u52A8\u53EC\u56DE",captureMinChars:"\u6355\u83B7\u6700\u5C0F\u957F\u5EA6",maxCardsPerDay:"\u65E5\u914D\u989D",dedupThreshold:"\u53BB\u91CD\u9608\u503C",recallLimit:"\u53EC\u56DE\u6761\u6570",vaultMulti:"\u591A\u5E93\uFF08\u6309\u9879\u76EE\u9694\u79BB\uFF09",vaultMultiHint:"\u7559\u7A7A\u5373\u5355\u5E93\uFF0C\u8001\u914D\u7F6E\u4E0D\u53D7\u5F71\u54CD",vaultNow:"\u5F53\u524D\u751F\u6548",vaultSource:"\u6765\u6E90",vaultWorkspace:"\u5F53\u524D workspace",vaultNamePh:"\u5E93\u540D\uFF0C\u5982 work",vaultPathPh:"\u76EE\u5F55\uFF0C\u5982 D:/vaults/work",vaultMatchPh:"\u9879\u76EE\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u6309 workspace \u81EA\u52A8\u9009\u5E93\uFF09",vaultAdd:"\u6DFB\u52A0\u4E00\u4E2A\u5E93",vaultActive:"\u6FC0\u6D3B\u5E93",vaultActiveNone:"\u9ED8\u8BA4\u5E93\uFF08\u4E0D\u6307\u5B9A\uFF09",vaultSrcEnv:"\u73AF\u5883\u53D8\u91CF MEMORY_VAULT_DIR",vaultSrcProfile:"\u6FC0\u6D3B\u5E93\u914D\u7F6E",vaultSrcWorkspace:"\u6309\u9879\u76EE\u76EE\u5F55\u81EA\u52A8\u547D\u4E2D",vaultSrcVaultDir:"\u5355\u5E93\u914D\u7F6E vaultDir",vaultSrcDefault:"\u9ED8\u8BA4\u76EE\u5F55",fbNav:"\u53CD\u9988\u5F02\u5E38",fbTitle:"\u53CD\u9988\u5F02\u5E38\uFF08\u63D0\u4EA4\u5230 GitHub\uFF09",fbDesc:"\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF08\u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A\uFF09",fbDiag:"\u8BCA\u65AD\u4FE1\u606F\uFF08\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E key/token \u5DF2\u66FF\u6362\uFF09",fbCopyDiag:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",fbOpenIssue:"\u5728 GitHub \u63D0\u4EA4\uFF08\u5DF2\u9884\u586B\uFF09",fbCopyPrompt:"\u590D\u5236\u7ED9 AI \u7684\u63D0\u793A\u8BCD",fbCopiedDiag:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",fbCopiedPrompt:"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\uFF0C\u7C98\u8FDB AI \u5BF9\u8BDD\u6846\u5373\u53EF",fbCopyFail:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u590D\u5236",fbWhy:"GitHub \u4E0D\u5141\u8BB8\u533F\u540D\u521B\u5EFA issue\uFF0C\u63D2\u4EF6\u91CC\u4E5F\u4E0D\u5E94\u5185\u7F6E token\uFF1A\u6240\u4EE5\u8FD9\u91CC\u628A\u6807\u9898 / \u6B63\u6587 / \u8BCA\u65AD\u90FD\u9884\u586B\u597D\uFF0C\u4F60\u53EA\u9700\u518D\u70B9\u4E00\u6B21 Submit\u3002",fbNeedDesc:"\u8BF7\u5148\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898",fbLoading:"\u6B63\u5728\u6536\u96C6\u8BCA\u65AD\u4FE1\u606F\u2026",fbDiagFail:"\u8BCA\u65AD\u63A5\u53E3\u4E0D\u53EF\u7528\uFF08\u72EC\u7ACB web \u6216\u65E7\u7248\u5BBF\u4E3B\uFF09\uFF0C\u8BF7\u624B\u52A8\u8865\u5145\u73AF\u5883\u4FE1\u606F",fbOr:"\u6216\u8005",fbSelectAll:"\u5168\u9009",toastApproved:"\u5DF2\u6279\u51C6",toastRejected:"\u5DF2\u9A73\u56DE",toastCardDeleted:"\u5DF2\u5220\u9664",toastRestored:"\u5DF2\u6062\u590D",toastPurged:"\u5DF2\u5F7B\u5E95\u5220\u9664",toastPurgedExpired:"\u5DF2\u6E05\u7406\u8FC7\u671F\u56DE\u6536\u7AD9",toastFailed:"\u64CD\u4F5C\u5931\u8D25",noSelection:"\u8BF7\u5148\u9009\u62E9\u8981\u5904\u7406\u7684\u5361\u7247",enabledLabel:"\u542F\u7528\u8BB0\u5FC6\u6838\u5FC3",vaultDirLabel:"\u8BB0\u5FC6\u5E93\u76EE\u5F55\uFF08\u5355\u5E93\uFF09",captureCooldownMs:"\u6C89\u6DC0\u51B7\u5374 (ms)",captureProvider:"\u84B8\u998F provider\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",captureModel:"\u84B8\u998F model\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",recallEmbedding:"\u8BED\u4E49\u53EC\u56DE provider\uFF08\u53EF\u9009\uFF09",sessionBudgetChars:"\u4F1A\u8BDD\u9884\u7B97 (\u5B57\u7B26)",saving:"\u4FDD\u5B58\u4E2D\u2026",savePending:"\u5DF2\u5199\u5165\u914D\u7F6E\u6587\u4EF6\uFF1B\u5BBF\u4E3B\u4ECD\u662F\u65E7\u7248\uFF0C\u91CD\u542F DSH \u540E\u5373\u4EE5\u65B0\u503C\u4E3A\u51C6\uFF08\u672C\u9762\u677F\u5DF2\u751F\u6548\uFF09",actionRunning:"\u5904\u7406\u4E2D\u2026",recycleEmptyHint:"\u56DE\u6536\u7AD9\u4E3A\u7A7A\uFF1A\u5220\u6389\u7684\u5361\u7247\u4F1A\u5148\u653E\u5230\u8FD9\u91CC\uFF0C\u4FDD\u7559 {days} \u5929\u540E\u81EA\u52A8\u6E05\u7406\u3002",recyclePurgeAll:"\u6E05\u7A7A\u56DE\u6536\u7AD9",fbCopyManual:"\u81EA\u52A8\u590D\u5236\u88AB\u6D4F\u89C8\u5668\u62E6\u622A\uFF0C\u5DF2\u628A\u5185\u5BB9\u653E\u5728\u4E0B\u9762\uFF1A\u70B9\u300C\u5168\u9009\u300D\u518D\u6309 Ctrl+C",vcPage:"\u9875\u9762\u811A\u672C",vcPageStale:"\u26A0 \u5F53\u524D\u9875\u9762\u4ECD\u5728\u8FD0\u884C\u65E7\u7248\u811A\u672C\uFF08\u9875\u9762 v{page} / \u78C1\u76D8 v{disk}\uFF09\uFF1A\u6309 Ctrl+F5 \u5237\u65B0\u9875\u9762\u5373\u751F\u6548\uFF1B\u82E5\u300C\u8FD0\u884C\u4E2D\u300D\u4ECD\u662F\u65E7\u7248\u53F7\uFF0C\u5219\u8FD8\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcLoaded:"\u8FD0\u884C\u4E2D\uFF08\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF09",vcResident:"\u5E38\u9A7B\u5B9E\u4F8B",vcOnDisk:"\u78C1\u76D8\u5B89\u88C5",vcLatest:"npm \u6700\u65B0",vcStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 v{disk}\uFF0C\u4F46\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\u4ECD\u52A0\u8F7D v{loaded} \u2014\u2014 \u70B9\u300C\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u300D\u5373\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u542F\u5B83\uFF08\u4E0D\u7528\u91CD\u542F DSH\uFF09",vcRestart:"\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",vcRestarting:"\u91CD\u542F\u4E2D\u2026",vcRestartSent:"\u5DF2\u8C03\u5EA6\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\uFF1A\u7EA6 3-8 \u79D2\u540E\u65B0\u8FDB\u7A0B\u63A5\u7BA1\uFF0C\u8BF7\u7A0D\u7B49\u518D\u5237\u65B0\u9875\u9762\uFF08Ctrl+F5\uFF09",vcRestartCurrent:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u7ECF\u662F\u6700\u65B0\u7248\uFF0C\u65E0\u9700\u91CD\u542F",vcRestartFail:"\u91CD\u542F\u8BF7\u6C42\u5931\u8D25",vcRestartNoRoute:"\u5F53\u524D\u9875\u9762\u5BF9\u63A5\u7684\u8FDB\u7A0B\u8FD8\u662F\u65E7\u7248\uFF08\u6CA1\u6709\u8FD9\u4E2A\u63A5\u53E3\uFF09\uFF1A\u8BF7\u91CD\u542F\u684C\u9762\u7248 / DSH \u540E\u518D\u8BD5\uFF0C\u6216\u6267\u884C {cmd}",vcHostStale:"\u4E0A\u65B9\u7684\u300C\u8FD0\u884C\u4E2D\u300D\u6765\u81EA\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF1B\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F\u65B0\u7248 \u2014\u2014 \u8981\u8BA9\u5B83\u4E5F\u53D8\u6210\u65B0\u7248\u53F7\uFF0C\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",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",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]
13
+ > \u5185\u5BB9\u8FC7\u957F\u5DF2\u622A\u65AD\uFF1A\u5B8C\u6574\u8BCA\u65AD\u8BF7\u5728\u63D2\u4EF6\u91CC\u70B9\u300C\u590D\u5236\u8BCA\u65AD\u4FE1\u606F\u300D\uFF0C\u518D\u8865\u5230 issue \u8BC4\u8BBA\u91CC\u3002`,E=C=>i(S.slice(0,C)+k);if(E(0).length>d)S=k;else{let C=0,h=S.length;for(;C<h;){let u=Math.ceil((C+h)/2);E(u).length<=d?C=u:h=u-1}S=S.slice(0,C)+k}M=i(S)}return M}function Wt(t={}){return["## \u73B0\u8C61",String(t.description||"").trim()||"\uFF08\u8BF7\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF09","","## \u590D\u73B0\u6B65\u9AA4","1. ","2. ","","## \u671F\u671B\u884C\u4E3A","","## \u5B9E\u9645\u884C\u4E3A","","## \u73AF\u5883","- \u63D2\u4EF6\u7248\u672C: "+(t.version||"\uFF08\u89C1\u8BCA\u65AD\u4FE1\u606F\uFF09"),"",t.diagnostics||"","","---","> \u7531 memory-eternal \u63D2\u4EF6\u5185\u300C\u53CD\u9988\u5F02\u5E38\u300D\u751F\u6210\uFF08\u8BCA\u65AD\u4FE1\u606F\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E\u5404\u7C7B key/token \u5DF2\u66FF\u6362\uFF09\u3002"].join(`
14
+ `)}var Rt="https://github.com/EternalNight996/memory-eternal",ba=["\u6211\u5728\u4F7F\u7528 memory-eternal\uFF08DeepSeek Harness \u7684\u8BB0\u5FC6\u63D2\u4EF6\uFF09\u65F6\u9047\u5230\u4E86\u95EE\u9898\uFF0C\u8BF7\u4F60\u5E2E\u6211\u628A\u8FD9\u4E2A\u95EE\u9898\u63D0\u4EA4\u5230 GitHub\u3002","","\u4ED3\u5E93\uFF1A"+Rt,"","\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
+ `),ya=["I hit a problem while using memory-eternal (a DeepSeek Harness memory plugin). Please file it on GitHub for me.","","Repo: "+Rt,"","Workflow:","","1. Run `gh issue list --repo EternalNight996/memory-eternal --state open --limit 50` first: if a matching issue exists, add a comment with `gh issue comment <n> --body-file <file>` instead of opening a duplicate.",'2. Otherwise create it with `gh issue create --repo EternalNight996/memory-eternal --title "[Bug] <one-line summary>" --body-file <file>`, using sections: Symptoms / Steps to reproduce / Expected / Actual / Environment (plugin, DSH, OS, Node) / Diagnostics.',"3. If `gh` is not authenticated or unavailable, do NOT try to submit: output a GitHub new-issue link with the title and body pre-filled instead, and I will click submit myself.","4. Report the resulting issue URL back to me.","","Keep my description verbatim - do not rewrite or summarise it. Put the diagnostics under the Diagnostics section as-is.","","My description:","<write your problem here>","","Diagnostics:","<paste the diagnostics copied from the in-app Report-a-bug dialog>"].join(`
16
+ `);function $t(t={}){let o=t.lang==="en"?"en":"zh",r=o==="en"?ya:ba,m=t.repo||"EternalNight996/memory-eternal";return r=r.split(Rt).join("https://github.com/"+m),t.description&&(r=r.replace(o==="en"?"<write your problem here>":"<\u5728\u8FD9\u91CC\u5199\u4F60\u7684\u95EE\u9898>",String(t.description).trim())),t.diagnostics&&(r=r.replace(o==="en"?"<paste the diagnostics copied from the in-app Report-a-bug dialog>":"<\u628A\u300C\u53CD\u9988\u5F02\u5E38\u300D\u5F39\u7A97\u91CC\u590D\u5236\u7684\u8BCA\u65AD\u4FE1\u606F\u7C98\u5230\u8FD9\u91CC>",String(t.diagnostics).trim())),r}function _t({panX:t=0,panY:o=0,zoom:r=1,w:m=0,h:d=0,margin:i=60}={}){let S=r||1;return{x0:(0-t)/S-i,y0:(0-o)/S-i,x1:(m-t)/S+i,y1:(d-o)/S+i}}function Nt(t,o,r,m){return m?t+r>=m.x0&&t-r<=m.x1&&o+r>=m.y0&&o-r<=m.y1:!0}function Ut(t){let o=Number(t)||0;return o<=120?1/0:o<=300?160:o<=600?90:60}function Kt(t,o={}){let r=Number.isFinite(o.limit)?o.limit:1/0,m=new Set,d=k=>{k&&m.size<r&&m.add(k)};if(d(o.focusId),d(o.hoverId),o.searchHits)for(let k of o.searchHits){if(m.size>=r)break;m.add(k)}let i=o.degree||{},S=k=>Number(i[k])||0,M=[];for(let k of Array.isArray(t)?t:[])k&&k.id&&!m.has(k.id)&&M.push(k);M.sort((k,E)=>S(E.id)-S(k.id));for(let k of M){if(m.size>=r)break;m.add(k.id)}return m}function ha(t,o){if(t===o)return!0;if(t===null||o===null||t===void 0||o===void 0||typeof t!="object"&&typeof o!="object")return t===o;try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}function qt(t,o){let r={...t||{}},m={};for(let[d,i]of Object.entries(o||{}))ha(t?t[d]:void 0,i)||(r[d]=i,m[d]=i);return{values:r,overlay:m}}var e=require("react/jsx-runtime"),lt="memory-eternal",_="/memory-eternal/api",va=100,xa=["slots","locale"],Xt={nav:"\u8BB0\u5FC6",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",overview:"\u8BB0\u5FC6\u5E93\u6982\u89C8",total:"\u77E5\u8BC6\u5361",recent:"\u8FD1 7 \u5929\u65B0\u589E",tags:"\u6807\u7B7E",searchPlaceholder:"\u641C\u7D22\u8BB0\u5FC6\uFF08\u652F\u6301\u4E2D\u6587\u7247\u6BB5\uFF09\u2026",search:"\u641C\u7D22",all:"\u5168\u90E8",kindProject:"\u9879\u76EE",kindKnowledge:"\u77E5\u8BC6",kindContent:"\u5185\u5BB9",kindPrompt:"\u63D0\u793A\u8BCD",kindBusiness:"\u4E1A\u52A1",kindTool:"\u5DE5\u5177",kindMistake:"\u6559\u8BAD",cardsTab:"\u77E5\u8BC6\u5361",graphTab:"\u77E5\u8BC6\u56FE\u8C31",graph:"\u77E5\u8BC6\u56FE\u8C31",graphHint:"\u8282\u70B9=\u77E5\u8BC6\u5361\uFF1B\u8FDE\u7EBF=[[\u94FE\u63A5]] \u6216\u5171\u4EAB\u6807\u7B7E\u3002\u70B9\u51FB\u8282\u70B9\u9605\u8BFB\u5361\u7247\u3002",graphTip:"\u5DE6\u952E\u51F8\u663E \xB7 Shift+\u62D6\u62FD\u6846\u9009 \xB7 \u53F3\u952E\u83DC\u5355 \xB7 \u6EDA\u8F6E\u7F29\u653E \xB7 \u62D6\u62FD\u5E73\u79FB",rebuild:"\u91CD\u5EFA",reset:"\u91CD\u7F6E",expandAll:"\u5168\u90E8\u5C55\u5F00",capped:"\u5DF2\u5C55\u793A\u6700\u6838\u5FC3\u7684",clearFocus:"\u53D6\u6D88\u9AD8\u4EAE",empty:"\u8BB0\u5FC6\u5E93\u8FD8\u662F\u7A7A\u7684\u3002\u591A\u804A\u51E0\u8F6E\u540E\uFF0C\u503C\u5F97\u4FDD\u5B58\u7684\u5185\u5BB9\u4F1A\u81EA\u52A8\u6C89\u6DC0\u6210\u77E5\u8BC6\u5361\u3002",emptyGraph:"\u56FE\u8C31\u6682\u65E0\u6570\u636E\u3002",open:"\u9605\u8BFB",updated:"\u66F4\u65B0\u4E8E",created:"\u521B\u5EFA\u4E8E",source:"\u6765\u6E90",close:"\u5173\u95ED",vaultDir:"\u8BB0\u5FC6\u5E93\u76EE\u5F55",capture:"\u81EA\u52A8\u6C89\u6DC0",recall:"\u81EA\u52A8\u53EC\u56DE",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u7981\u7528",error:"\u52A0\u8F7D\u5931\u8D25",back:"\u8FD4\u56DE\u5217\u8868",cardCount:"\u5F20\u5361",nodes:"\u8282\u70B9",edges:"\u8FDE\u7EBF",memoryTitle:"\u8BB0\u5FC6\u5E93",memoryHint:"\u4F60\u7684\u672C\u5730\u7B2C\u4E8C\u5927\u8111",zoomIn:"\u653E\u5927",zoomOut:"\u7F29\u5C0F",fit:"\u9002\u5E94",enterFullscreen:"\u5168\u5C4F",exitFullscreen:"\u9000\u51FA\u5168\u5C4F",exportGraph:"\u5BFC\u51FA",openCard:"\u6253\u5F00\u5361\u7247",focusNeighbors:"\u51F8\u663E\u5173\u8054",copyName:"\u590D\u5236\u540D\u79F0",noMatch:"\u6CA1\u6709\u5339\u914D\u7684\u8BB0\u5FC6",clearFilter:"\u6E05\u9664\u8FC7\u6EE4",filterLabel:"\u7B5B\u9009",sortRecent:"\u6700\u8FD1",sortTitle:"\u6807\u9898",sortHot:"\u70ED\u70B9",exportSel:"\u5BFC\u51FA\u9009\u4E2D",clearSelection:"\u6E05\u7A7A\u9009\u62E9",download:"\u4E0B\u8F7D",openNewTab:"\u65B0\u6807\u7B7E\u6253\u5F00",copyImage:"\u590D\u5236\u56FE\u7247",done:"\u5B8C\u6210",downloaded:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D",openedTab:"\u5DF2\u5728\u65B0\u6807\u7B7E\u6253\u5F00",copied:"\u5DF2\u590D\u5236",exportedSel:"\u4E2A\u8282\u70B9\u5DF2\u5BFC\u51FA",fullscreen:"\u5168\u5C4F",exitFull:"\u9000\u51FA\u5168\u5C4F",copyFail:"\u590D\u5236\u5931\u8D25",timeDim:"\u65F6\u95F4\u7EF4",timeNew:"3 \u5929\u5185",timeRecent:"2 \u5468\u5185",timeMonth:"1 \u6708\u5185",timeOld:"\u66F4\u65E9",newBadge:"\u65B0",expand:"\u5C55\u5F00\u5168\u90E8",collapse:"\u6536\u8D77",exportVault:"\u5BFC\u51FAMD",exportJson:"\u5BFC\u51FAJSON",exporting:"\u5BFC\u51FA\u4E2D\u2026",exportedVault:"\u8BB0\u5FC6\u5E93\u5DF2\u5BFC\u51FA",exportFail:"\u5BFC\u51FA\u5931\u8D25",importVault:"\u5BFC\u5165",importedVault:"\u5BFC\u5165\u5B8C\u6210",importedTotal:" \u5F20 / \u6587\u4EF6\u5171 ",importedTotalTail:" \u5F20",importedQuarantine:" \xB7 \u5F85\u5BA1\u6838 ",importedQuarantineTail:" \u5F20\uFF08\u9694\u79BB\u533A\uFF0C\u6279\u51C6\u540E\u624D\u53C2\u4E0E\u53EC\u56DE\uFF09",importedSkipped:" \xB7 \u8DF3\u8FC7 ",importedSkippedTail:" \u5F20\uFF08\u91CD\u590D\u6216\u7A7A\uFF09",importFail:"\u5BFC\u5165\u5931\u8D25",location:"\u81EA\u9009\u4F4D\u7F6E",saveAs:"\u53E6\u5B58\u4E3A",saveAsUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9009\u62E9\u4FDD\u5B58\u4F4D\u7F6E",exportedTo:"\u5DF2\u5BFC\u51FA\u5230",defaultDownloads:"\u9ED8\u8BA4\u4E0B\u8F7D\u6587\u4EF6\u5939",exportCancel:"\u5DF2\u53D6\u6D88\u5BFC\u51FA",manage:"\u7BA1\u7406",tabUsage:"\u7528\u91CF/\u4ECA\u65E5",tabOptimize:"\u6574\u7406\u5EFA\u8BAE",adminLoadFail:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF1A\u8BF7\u5F7B\u5E95\u91CD\u542F dsh-desktop\uFF08host \u9700\u52A0\u8F7D\u65B0\u7248 /memory-eternal \u8DEF\u7531\uFF09",retry:"\u91CD\u8BD5",mergeSimilar:"\u4E00\u952E\u5408\u5E76\u76F8\u4F3C",trendLabel:"\u8FD1 30 \u5929\u8D8B\u52BF",cleanStale:"\u{1F5D1}\uFE0F \u4E00\u952E\u6E05\u7406\u9648\u65E7",deletedStale:"\u4E2A\u9648\u65E7\u5361\u5DF2\u6E05\u7406",newCard:"\u65B0\u5EFA",tplDecision:"\u{1F4DD} \u6280\u672F\u51B3\u7B56",tplBug:"\u{1F41B} \u8E29\u5751",tplMeeting:"\u{1F4CB} \u4F1A\u8BAE\u7EAA\u8981",tplWeekly:"\u{1F4CA} \u5468\u62A5",createCard:"\u521B\u5EFA",cardTitle:"\u6807\u9898",cardBody:"\u6B63\u6587",fbUseful:"\u6709\u7528",fbIrr:"\u65E0\u5173",todayAdd:"\u4ECA\u65E5\u65B0\u589E",weekAdd:"\u8FD1 7 \u5929",byKind:"\u5206\u7C7B\u7EDF\u8BA1",todayList:"\u4ECA\u65E5\u6C89\u6DC0",budgetLabel:"\u4F1A\u8BDD\u9884\u7B97",budgetChars:"\u9884\u7B97\u5B57\u7B26",recallLimitLabel:"\u53EC\u56DE\u6761\u6570",embeddingLabel:"\u8BED\u4E49\u53EC\u56DE",mergePairs:"\u76F8\u4F3C\u5361\u5BF9\uFF08\u53EF\u5408\u5E76\uFF09",staleCards:"\u9648\u65E7\u5361\uFF08>90 \u5929\u672A\u66F4\u65B0\uFF09",noOptimize:"\u6682\u65E0\u53EF\u6574\u7406\u9879\uFF0C\u5F88\u5065\u5EB7 \u{1F389}",oneClickOptimize:"\u4E00\u952E\u4F18\u5316",oneClickOptimizeConfirm:"\u786E\u8BA4\u4E00\u952E\u4F18\u5316\uFF1F\u5C06\u5408\u5E76\u6240\u6709\u76F8\u4F3C\u5361\u5BF9\uFF08\u9ED8\u8BA4\u4E0D\u6E05\u7406\u9648\u65E7\u5361\uFF09\u3002",oneClickAlsoStale:"\u540C\u65F6\u6E05\u7406\u9648\u65E7\u5361",oneClickOptimizeDone:"\u4E00\u952E\u4F18\u5316\u5B8C\u6210",optimizedMerged:"\u5BF9\u5DF2\u5408\u5E76",optimizedStaleDeleted:"\u5F20\u9648\u65E7\u5361\u5DF2\u6E05\u7406",mcpSetupStatus:"Agent MCP \u6302\u8F7D\u72B6\u6001",rerunSetup:"\u8865\u5168 MCP",notInstalled:"\u672A\u5B89\u88C5",noMcpEntry:"\u914D\u7F6E\u7F3A\u5931",nodePathMismatch:"node \u8DEF\u5F84\u4E0D\u4E00\u81F4\uFF0C\u5EFA\u8BAE\u91CD\u8DD1 setup",nodePathNote:"node \u73AF\u5883\u4E0D\u540C\uFF08\u53EF\u7528\uFF09",healthy:"\u914D\u7F6E\u6B63\u5E38",mcpSetupHint:"\u300C\u81EA\u52A8\u6302\u8F7D MCP\u300D= \u8BA9 Claude Code / Codex / Cursor \u8FD9\u4E9B\u5DE5\u5177\u80FD\u8C03\u7528\u8BB0\u5FC6\u5E93\u3002\u5F00\u542F\u540E\u81EA\u52A8\u628A\u5B83\u4EEC\u914D\u7F6E\u597D\uFF1B\u5173\u6389\u5C31\u4E0D\u52A8\u4F60\u7535\u8111\u4E0A\u4EFB\u4F55\u914D\u7F6E\u6587\u4EF6\uFF0C\u9700\u8981\u65F6\u624B\u52A8\u8DD1 dsh-memory setup\u3002",mcpManageHint:"\u6BCF\u4E2A agent \u7528\u4E0B\u65B9\u6309\u94AE\u5355\u72EC\u5B89\u88C5/\u5378\u8F7D MCP",tabConfig:"\u8BB0\u5FC6\u914D\u7F6E",tabAudit:"\u5BA1\u6838\u4E2D\u5FC3",statusApproved:"\u5DF2\u5BA1\u6838",statusPending:"\u5F85\u5BA1\u6838",statusRejected:"\u5DF2\u9A73\u56DE",allStatus:"\u5168\u90E8\u72B6\u6001",tabRecycle:"\u56DE\u6536\u4E2D\u5FC3",pending:"\u5F85\u5BA1\u6838",rejected:"\u5DF2\u9A73\u56DE",selectAll:"\u5168\u9009",approve:"\u6279\u51C6",reject:"\u9A73\u56DE",allAgents:"\u5168\u90E8\u667A\u80FD\u4F53",noAuditItems:"\u6682\u65E0\u5BA1\u6838\u9879\u76EE",auditBodyFail:"\u6B63\u6587\u8BFB\u53D6\u5931\u8D25",deletedAt:"\u5220\u9664\u4E8E",restore:"\u6062\u590D",restoreDelete:"\u5220\u9664\u8FDB\u56DE\u6536\u7AD9",purge:"\u6C38\u4E45\u5220\u9664",emptyRecycle:"\u56DE\u6536\u7AD9\u4E3A\u7A7A",recycleHint:"\u5220\u9664\u7684\u5361\u7247\u5148\u8FDB\u56DE\u6536\u7AD9\uFF0C30 \u5929\u5185\u53EF\u6062\u590D\uFF0C\u8D85\u671F\u81EA\u52A8\u6C38\u4E45\u5220\u9664",purgeConfirm:"\u786E\u5B9A\u6C38\u4E45\u5220\u9664\uFF1F\u4E0D\u53EF\u6062\u590D\u3002",recycleDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u8FDB\u56DE\u6536\u7AD9\uFF1F30 \u5929\u5185\u53EF\u6062\u590D\u3002",modeInit:"\u542F\u52A8\u65F6\u62C9\u4E00\u6B21",modeInterval:"\u5468\u671F\u4FDD\u6D3B",modeManual:"\u4EC5\u624B\u52A8",serviceConfig:"\u670D\u52A1\u81EA\u7BA1\u7406\u914D\u7F6E",auditConfig:"\u81EA\u52A8\u5BA1\u6838\u914D\u7F6E",auditHint:"\u547D\u4E2D\u514D\u5BA1\u7684\u65B0\u5361\u76F4\u63A5\u5165\u5E93\uFF0C\u5176\u4F59\u8FDB\u5F85\u5BA1\u6838",auditMode:"\u5BA1\u6838\u6A21\u5F0F",auditAll:"\u5168\u90E8\u8981\u5BA1\u6838",auditNone:"\u5168\u90E8\u514D\u5BA1",auditExemptAgents:"\u514D\u5BA1\u667A\u80FD\u4F53",auditExemptKinds:"\u514D\u5BA1\u7C7B\u578B",allExempt:"\u5168\u90E8\u514D\u5BA1",recycleDays:"\u56DE\u6536\u4FDD\u7559\u5929\u6570",editInSetting:"\u7F16\u8F91\u8BF7\u5230 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6",pendingSyncNote:"\u6B64\u9875\u662F\u72EC\u7ACB Web \u9875\uFF1A\u4FDD\u5B58\u540E\u7531 DSH \u5BBF\u4E3B\u5E94\u7528\uFF08\u65B0\u7248\u5BBF\u4E3B\u4F1A\u88AB\u76F4\u63A5\u53EB\u9192\u3001\u5728\u8BF7\u6C42\u4E0A\u4E0B\u6587\u91CC\u5E94\u7528\uFF0C\u70B9\u4FDD\u5B58\u5373\u751F\u6548\uFF09\uFF1B\u82E5\u672C\u673A\u6CA1\u6709 DSH \u5BBF\u4E3B\u5728\u8FD0\u884C\uFF0C\u5219\u76F4\u63A5\u5199\u5165\u5171\u4EAB\u914D\u7F6E\u3001\u7ACB\u5373\u751F\u6548\u3002\u53EA\u6709\u5728\u5BF9\u63A5\u65E7\u7248\u5BBF\u4E3B\u65F6\u624D\u4F1A\u9000\u56DE\u300C\u6392\u961F\u7B49\u5B83\u81EA\u5DF1\u540C\u6B65\u300D\uFF0C\u90A3\u65F6\u53EF\u5728 DSH \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u91CC\u6539\u540C\u4E00\u9879\u3002",readonlyTitle:"\u5F53\u524D\u9875\u9762\u53EA\u8BFB\uFF0C\u65E0\u6CD5\u4FDD\u5B58\u914D\u7F6E",readonlyBody:"\u8FD9\u4E2A\u8FDB\u7A0B\u6CA1\u6709 DSH \u7684\u8BBE\u7F6E\u670D\u52A1\uFF08settings.update \u4E0D\u5B58\u5728\uFF09\uFF0C\u914D\u7F6E\u53EA\u80FD\u5728\u672C\u673A DSH \u91CC\u4FEE\u6539\uFF1A\u684C\u9762\u7248 \u2192 \u8BBE\u7F6E \u2192 \u8BB0\u5FC6\u3002",readonlyBtn:"\u53EA\u8BFB",setupRunInTerminal:"\u8BF7\u590D\u5236\u4EE5\u4E0B\u547D\u4EE4\u5230\u7EC8\u7AEF\u6267\u884C\uFF1A",dshMemoryConfig:"DSH \u8BB0\u5FC6\u914D\u7F6E",autoCapture:"\u81EA\u52A8\u6C89\u6DC0",autoRecall:"\u81EA\u52A8\u53EC\u56DE",captureMinChars:"\u6355\u83B7\u6700\u5C0F\u957F\u5EA6",maxCardsPerDay:"\u65E5\u914D\u989D",dedupThreshold:"\u53BB\u91CD\u9608\u503C",recallLimit:"\u53EC\u56DE\u6761\u6570",vaultMulti:"\u591A\u5E93\uFF08\u6309\u9879\u76EE\u9694\u79BB\uFF09",vaultMultiHint:"\u7559\u7A7A\u5373\u5355\u5E93\uFF0C\u8001\u914D\u7F6E\u4E0D\u53D7\u5F71\u54CD",vaultNow:"\u5F53\u524D\u751F\u6548",vaultSource:"\u6765\u6E90",vaultWorkspace:"\u5F53\u524D workspace",vaultNamePh:"\u5E93\u540D\uFF0C\u5982 work",vaultPathPh:"\u76EE\u5F55\uFF0C\u5982 D:/vaults/work",vaultMatchPh:"\u9879\u76EE\u76EE\u5F55\uFF08\u53EF\u9009\uFF0C\u6309 workspace \u81EA\u52A8\u9009\u5E93\uFF09",vaultAdd:"\u6DFB\u52A0\u4E00\u4E2A\u5E93",vaultActive:"\u6FC0\u6D3B\u5E93",vaultActiveNone:"\u9ED8\u8BA4\u5E93\uFF08\u4E0D\u6307\u5B9A\uFF09",vaultSrcEnv:"\u73AF\u5883\u53D8\u91CF MEMORY_VAULT_DIR",vaultSrcProfile:"\u6FC0\u6D3B\u5E93\u914D\u7F6E",vaultSrcWorkspace:"\u6309\u9879\u76EE\u76EE\u5F55\u81EA\u52A8\u547D\u4E2D",vaultSrcVaultDir:"\u5355\u5E93\u914D\u7F6E vaultDir",vaultSrcDefault:"\u9ED8\u8BA4\u76EE\u5F55",fbNav:"\u53CD\u9988\u5F02\u5E38",fbTitle:"\u53CD\u9988\u5F02\u5E38\uFF08\u63D0\u4EA4\u5230 GitHub\uFF09",fbDesc:"\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898\uFF08\u73B0\u8C61 / \u590D\u73B0\u6B65\u9AA4 / \u671F\u671B\u884C\u4E3A\uFF09",fbDiag:"\u8BCA\u65AD\u4FE1\u606F\uFF08\u5DF2\u81EA\u52A8\u8131\u654F\uFF1Ahome \u76EE\u5F55\u4E0E key/token \u5DF2\u66FF\u6362\uFF09",fbCopyDiag:"\u590D\u5236\u8BCA\u65AD\u4FE1\u606F",fbOpenIssue:"\u5728 GitHub \u63D0\u4EA4\uFF08\u5DF2\u9884\u586B\uFF09",fbCopyPrompt:"\u590D\u5236\u7ED9 AI \u7684\u63D0\u793A\u8BCD",fbCopiedDiag:"\u8BCA\u65AD\u4FE1\u606F\u5DF2\u590D\u5236",fbCopiedPrompt:"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\uFF0C\u7C98\u8FDB AI \u5BF9\u8BDD\u6846\u5373\u53EF",fbCopyFail:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u590D\u5236",fbWhy:"GitHub \u4E0D\u5141\u8BB8\u533F\u540D\u521B\u5EFA issue\uFF0C\u63D2\u4EF6\u91CC\u4E5F\u4E0D\u5E94\u5185\u7F6E token\uFF1A\u6240\u4EE5\u8FD9\u91CC\u628A\u6807\u9898 / \u6B63\u6587 / \u8BCA\u65AD\u90FD\u9884\u586B\u597D\uFF0C\u4F60\u53EA\u9700\u518D\u70B9\u4E00\u6B21 Submit\u3002",fbNeedDesc:"\u8BF7\u5148\u63CF\u8FF0\u4F60\u9047\u5230\u7684\u95EE\u9898",fbLoading:"\u6B63\u5728\u6536\u96C6\u8BCA\u65AD\u4FE1\u606F\u2026",fbDiagFail:"\u8BCA\u65AD\u63A5\u53E3\u4E0D\u53EF\u7528\uFF08\u72EC\u7ACB web \u6216\u65E7\u7248\u5BBF\u4E3B\uFF09\uFF0C\u8BF7\u624B\u52A8\u8865\u5145\u73AF\u5883\u4FE1\u606F",fbOr:"\u6216\u8005",fbSelectAll:"\u5168\u9009",toastApproved:"\u5DF2\u6279\u51C6",toastRejected:"\u5DF2\u9A73\u56DE",toastCardDeleted:"\u5DF2\u5220\u9664",toastRestored:"\u5DF2\u6062\u590D",toastPurged:"\u5DF2\u5F7B\u5E95\u5220\u9664",toastPurgedExpired:"\u5DF2\u6E05\u7406\u8FC7\u671F\u56DE\u6536\u7AD9",toastFailed:"\u64CD\u4F5C\u5931\u8D25",noSelection:"\u8BF7\u5148\u9009\u62E9\u8981\u5904\u7406\u7684\u5361\u7247",enabledLabel:"\u542F\u7528\u8BB0\u5FC6\u6838\u5FC3",vaultDirLabel:"\u8BB0\u5FC6\u5E93\u76EE\u5F55\uFF08\u5355\u5E93\uFF09",captureCooldownMs:"\u6C89\u6DC0\u51B7\u5374 (ms)",captureProvider:"\u84B8\u998F provider\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",captureModel:"\u84B8\u998F model\uFF08\u7559\u7A7A\u81EA\u52A8\uFF09",recallEmbedding:"\u8BED\u4E49\u53EC\u56DE provider\uFF08\u53EF\u9009\uFF09",sessionBudgetChars:"\u4F1A\u8BDD\u9884\u7B97 (\u5B57\u7B26)",saving:"\u4FDD\u5B58\u4E2D\u2026",savePending:"\u5DF2\u5199\u5165\u914D\u7F6E\u6587\u4EF6\uFF1B\u5BBF\u4E3B\u4ECD\u662F\u65E7\u7248\uFF0C\u91CD\u542F DSH \u540E\u5373\u4EE5\u65B0\u503C\u4E3A\u51C6\uFF08\u672C\u9762\u677F\u5DF2\u751F\u6548\uFF09",actionRunning:"\u5904\u7406\u4E2D\u2026",recycleEmptyHint:"\u56DE\u6536\u7AD9\u4E3A\u7A7A\uFF1A\u5220\u6389\u7684\u5361\u7247\u4F1A\u5148\u653E\u5230\u8FD9\u91CC\uFF0C\u4FDD\u7559 {days} \u5929\u540E\u81EA\u52A8\u6E05\u7406\u3002",recyclePurgeAll:"\u6E05\u7A7A\u56DE\u6536\u7AD9",fbCopyManual:"\u81EA\u52A8\u590D\u5236\u88AB\u6D4F\u89C8\u5668\u62E6\u622A\uFF0C\u5DF2\u628A\u5185\u5BB9\u653E\u5728\u4E0B\u9762\uFF1A\u70B9\u300C\u5168\u9009\u300D\u518D\u6309 Ctrl+C",vcPage:"\u9875\u9762\u811A\u672C",vcPageStale:"\u26A0 \u5F53\u524D\u9875\u9762\u4ECD\u5728\u8FD0\u884C\u65E7\u7248\u811A\u672C\uFF08\u9875\u9762 v{page} / \u78C1\u76D8 v{disk}\uFF09\uFF1A\u6309 Ctrl+F5 \u5237\u65B0\u9875\u9762\u5373\u751F\u6548\uFF1B\u82E5\u300C\u8FD0\u884C\u4E2D\u300D\u4ECD\u662F\u65E7\u7248\u53F7\uFF0C\u5219\u8FD8\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcLoaded:"\u8FD0\u884C\u4E2D\uFF08\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF09",vcResident:"\u5E38\u9A7B\u5B9E\u4F8B",vcOnDisk:"\u78C1\u76D8\u5B89\u88C5",vcLatest:"npm \u6700\u65B0",vcStale:"\u78C1\u76D8\u5DF2\u5B89\u88C5 v{disk}\uFF0C\u4F46\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\u4ECD\u52A0\u8F7D v{loaded} \u2014\u2014 \u70B9\u300C\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\u300D\u5373\u53EF\u7528\u65B0\u4EE3\u7801\u91CD\u542F\u5B83\uFF08\u4E0D\u7528\u91CD\u542F DSH\uFF09",vcRestart:"\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B",vcRestarting:"\u91CD\u542F\u4E2D\u2026",vcRestartSent:"\u5DF2\u8C03\u5EA6\u91CD\u542F\u5E38\u9A7B\u5B9E\u4F8B\uFF1A\u7EA6 3-8 \u79D2\u540E\u65B0\u8FDB\u7A0B\u63A5\u7BA1\uFF0C\u8BF7\u7A0D\u7B49\u518D\u5237\u65B0\u9875\u9762\uFF08Ctrl+F5\uFF09",vcRestartCurrent:"\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u7ECF\u662F\u6700\u65B0\u7248\uFF0C\u65E0\u9700\u91CD\u542F",vcRestartFail:"\u91CD\u542F\u8BF7\u6C42\u5931\u8D25",vcRestartNoRoute:"\u5F53\u524D\u9875\u9762\u5BF9\u63A5\u7684\u8FDB\u7A0B\u8FD8\u662F\u65E7\u7248\uFF08\u6CA1\u6709\u8FD9\u4E2A\u63A5\u53E3\uFF09\uFF1A\u8BF7\u91CD\u542F\u684C\u9762\u7248 / DSH \u540E\u518D\u8BD5\uFF0C\u6216\u6267\u884C {cmd}",vcHostStale:"\u4E0A\u65B9\u7684\u300C\u8FD0\u884C\u4E2D\u300D\u6765\u81EA\u670D\u52A1\u672C\u9875\u7684\u8FDB\u7A0B\uFF1B\u5E38\u9A7B\u5B9E\u4F8B\u5DF2\u662F\u65B0\u7248 \u2014\u2014 \u8981\u8BA9\u5B83\u4E5F\u53D8\u6210\u65B0\u7248\u53F7\uFF0C\u9700\u91CD\u542F\u684C\u9762\u7248 / DSH",vcResidentDownShort:"\u672A\u8FD0\u884C",vcResidentDown:"\u5E38\u9A7B\u5B9E\u4F8B\u6CA1\u5728\u8FD0\u884C\uFF08\u7AEF\u53E3 {port} \u65E0\u54CD\u5E94\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u7528\u65B0\u4EE3\u7801\u628A\u5B83\u62C9\u8D77\u6765\uFF1B\u62C9\u4E0D\u8D77\u6765\u65F6\u6267\u884C {cmd}\uFF0C\u5E76\u8D34\u4E00\u4E0B dsh-memory status \u7684\u8F93\u51FA",vcResidentUnmanagedShort:"\u672A\u6258\u7BA1",vcResidentUnmanaged:"\u5E38\u9A7B\u5B9E\u4F8B\u5728\u670D\u52A1 v{served}\uFF0C\u4F46**\u6CA1\u6709\u770B\u95E8\u72D7\u4FDD\u6D3B**\uFF08\u505C\u6B62 / \u786C\u6740\u540E\u6B8B\u7559\u7684\u5B64\u513F\uFF09\u2014\u2014 \u70B9\u4E0B\u9762\u7684\u6309\u94AE\u628A\u5B83\u91CD\u65B0\u6258\u7BA1\uFF08\u91CD\u65B0\u62C9\u4E00\u4E2A\u770B\u95E8\u72D7 + \u65B0\u5B9E\u4F8B\uFF09\uFF1B\u4E5F\u53EF\u4EE5\u6267\u884C {cmd}",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",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 aa=Object.create;var St=Object.defineProperty;var na=Object.getOwnPropertyDe
58
58
  -
59
59
 
60
60
  ## \u98CE\u9669/\u963B\u585E
61
- - `},Jt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedTotal:" / of ",importedTotalTail:"",importedQuarantine:" \xB7 pending review ",importedQuarantineTail:" (quarantined until approved)",importedSkipped:" \xB7 skipped ",importedSkippedTail:" (duplicate or empty)",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",auditBodyFail:"Failed to load the card body",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",pendingSyncNote:'This is the standalone web page: the DSH host applies a save (a current host is woken up and applies it in a request context, so saving takes effect immediately); when no DSH host is running here the change goes straight into the shared config. Only an older host falls back to "queued until it syncs on its own" \u2014 in that case change the same option under DSH Settings \u2192 Memory.',readonlyTitle:"This page is read-only; config cannot be saved here",readonlyBody:"This process has no DSH settings service (settings.update is unavailable). Edit the config in DSH: desktop app \u2192 Settings \u2192 Memory.",readonlyBtn:"Read-only",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",fbSelectAll:"Select all",toastApproved:"approved",toastRejected:"rejected",toastCardDeleted:"deleted",toastRestored:"restored",toastPurged:"permanently deleted",toastPurgedExpired:"expired recycle entries purged",toastFailed:"Action failed",noSelection:"Select the cards to act on first",enabledLabel:"Enable memory core",vaultDirLabel:"Vault directory (single)",captureCooldownMs:"Capture cooldown (ms)",captureProvider:"Distill provider (auto if empty)",captureModel:"Distill model (auto if empty)",recallEmbedding:"Semantic recall provider (optional)",sessionBudgetChars:"Session budget (chars)",saving:"Saving\u2026",savePending:"Saved to the config file; the host half is still the old build, so restart DSH to make it effective (already applied in this panel)",saveInvalid:"Some field values are invalid; nothing was submitted",invalidField:'"{field}" must be a number between {min} and {max} (now: {value})',actionRunning:"Working\u2026",recycleEmptyHint:"Recycle bin is empty: deleted cards land here first and are purged automatically after {days} days.",recyclePurgeAll:"Empty recycle bin",fbCopyManual:"Auto-copy was blocked by the browser \u2014 the text is below: click Select all, then Ctrl+C",vcLoaded:"running (process serving this page)",vcResident:"resident instance",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:'v{disk} is installed on disk but the process serving this page still has v{loaded} loaded \u2014 click "Restart resident instance" to restart it on the new code (no DSH restart needed)',vcRestart:"Restart resident instance",vcRestarting:"Restarting\u2026",vcRestartSent:"Resident restart scheduled: the new process takes over in ~3-8s \u2014 refresh the page (Ctrl+F5) shortly",vcRestartCurrent:"The resident instance is already up to date \u2014 no restart needed",vcRestartFail:"Restart request failed",vcRestartNoRoute:"The process serving this page is still the old build (no such endpoint): restart the desktop app / DSH and retry, or run {cmd}",vcHostStale:'The "running" chip above comes from the process serving this page; the resident instance is already current \u2014 restart the desktop app / DSH to refresh that chip',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.",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
+ - `},Jt={nav:"Memory",loading:"Loading\u2026",refresh:"Refresh",overview:"Memory Overview",total:"Cards",recent:"Added (7d)",tags:"Tags",searchPlaceholder:"Search memory\u2026",search:"Search",all:"All",kindProject:"Projects",kindKnowledge:"Knowledge",kindContent:"Content",kindPrompt:"Prompts",kindBusiness:"Business",kindTool:"Tools",kindMistake:"Mistakes",cardsTab:"Cards",graphTab:"Graph",graph:"Knowledge Graph",graphHint:"Nodes = cards; edges = [[links]] or shared tags. Click a node to read.",graphTip:"Left-click highlights \xB7 Shift+drag box-select \xB7 right-click menu \xB7 scroll zoom \xB7 drag to pan",rebuild:"Rebuild",reset:"Reset",expandAll:"Expand all",capped:"Showing the",clearFocus:"Clear highlight",empty:"Memory is empty. After a few conversations, valuable content is auto-captured.",emptyGraph:"No graph data yet.",open:"Read",updated:"Updated",created:"Created",source:"Source",close:"Close",vaultDir:"Vault directory",capture:"Auto capture",recall:"Auto recall",enabled:"on",disabled:"off",error:"Load failed",back:"Back to list",cardCount:"cards",nodes:"nodes",edges:"edges",memoryTitle:"Memory Library",memoryHint:"Your local second brain",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",enterFullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",exportGraph:"Export",openCard:"Open card",focusNeighbors:"Highlight links",copyName:"Copy name",noMatch:"No matching memory",clearFilter:"Clear filter",filterLabel:"Filter",sortRecent:"Recent",sortTitle:"Title",sortHot:"Hot",exportSel:"Export selected",clearSelection:"Clear selection",download:"Download",openNewTab:"Open in new tab",copyImage:"Copy image",done:"Done",downloaded:"Download started",openedTab:"Opened in new tab",copied:"Copied",exportedSel:" nodes exported",fullscreen:"Fullscreen",exitFull:"Exit fullscreen",copyFail:"Copy failed",timeDim:"Time",timeNew:"\u22643 days",timeRecent:"\u22642 weeks",timeMonth:"\u22641 month",timeOld:"Older",newBadge:"NEW",expand:"Expand",collapse:"Collapse",exportVault:"Export MD",exportJson:"Export JSON",exporting:"Exporting\u2026",exportedVault:"Vault exported",exportFail:"Export failed",importVault:"Import",importedVault:"Import complete",importedTotal:" / of ",importedTotalTail:"",importedQuarantine:" \xB7 pending review ",importedQuarantineTail:" (quarantined until approved)",importedSkipped:" \xB7 skipped ",importedSkippedTail:" (duplicate or empty)",importFail:"Import failed",location:"Choose location",saveAs:"Save as",saveAsUnsupported:"Choose-save-location not supported here",exportedTo:"Exported to",defaultDownloads:"default Downloads folder",exportCancel:"Export cancelled",manage:"Manage",tabUsage:"Usage / Today",tabOptimize:"Optimize",adminLoadFail:"Load failed: fully restart dsh-desktop so the host picks up the new /memory-eternal routes",retry:"Retry",mergeSimilar:"Merge similar",trendLabel:"Last 30 days trend",cleanStale:"\u{1F5D1}\uFE0F Clean stale",deletedStale:" stale cards cleaned",newCard:"New",tplDecision:"\u{1F4DD} Decision",tplBug:"\u{1F41B} Bug",tplMeeting:"\u{1F4CB} Meeting",tplWeekly:"\u{1F4CA} Weekly",createCard:"Create",cardTitle:"Title",cardBody:"Body",fbUseful:"Useful",fbIrr:"Irrelevant",todayAdd:"Added today",weekAdd:"Last 7d",byKind:"By kind",todayList:"Captured today",budgetLabel:"Session budget",budgetChars:"Budget chars",recallLimitLabel:"Recall limit",embeddingLabel:"Semantic recall",mergePairs:"Similar pairs (mergeable)",staleCards:"Stale (>90d)",noOptimize:"Nothing to organize, healthy \u{1F389}",oneClickOptimize:"One-click optimize",oneClickOptimizeConfirm:"Confirm one-click optimize? This will merge all similar pairs (stale cards are NOT deleted by default).",oneClickAlsoStale:"Also clean stale cards",oneClickOptimizeDone:"One-click optimize done",optimizedMerged:"pairs merged",optimizedStaleDeleted:"stale cards cleaned",mcpSetupStatus:"Agent MCP mount status",rerunSetup:"Re-run setup",notInstalled:"not installed",noMcpEntry:"no MCP entry",nodePathMismatch:"node path mismatch, consider re-running setup",nodePathNote:"different node env (usable)",healthy:"healthy",mcpSetupHint:'"Auto-mount MCP" = lets Claude Code / Codex / Cursor use the memory vault. On = auto-configures them; Off = never touches your machine config, run dsh-memory setup manually when needed.',mcpManageHint:"Use each agent row to install/uninstall MCP individually",tabConfig:"Memory Config",tabAudit:"Audit Center",statusApproved:"Approved",statusPending:"Pending",statusRejected:"Rejected",allStatus:"All statuses",tabRecycle:"Recycle Bin",pending:"Pending",rejected:"Rejected",selectAll:"Select all",approve:"Approve",reject:"Reject",allAgents:"All agents",noAuditItems:"No items to review",auditBodyFail:"Failed to load the card body",deletedAt:"deleted",restore:"Restore",restoreDelete:"Delete to recycle",purge:"Purge",emptyRecycle:"Recycle bin is empty",recycleHint:"Deleted cards go to the recycle bin \u2014 recover within 30 days, else auto-purged",purgeConfirm:"Permanently delete? This cannot be undone.",recycleDeleteConfirm:"Delete to recycle? Recoverable within 30 days.",modeInit:"Init once",modeInterval:"Interval keep-alive",modeManual:"Manual only",serviceConfig:"Service self-hosting config",auditConfig:"Auto-audit config",auditHint:"Cards matching an exemption go straight in; others await audit",auditMode:"Audit mode",auditAll:"Audit all",auditNone:"Skip all",auditExemptAgents:"Exempt agents",auditExemptKinds:"Exempt kinds",allExempt:"Exempt all",recycleDays:"Recycle retention days",editInSetting:"Edit in DSH Settings \u2192 Memory",pendingSyncNote:'This is the standalone web page: the DSH host applies a save (a current host is woken up and applies it in a request context, so saving takes effect immediately); when no DSH host is running here the change goes straight into the shared config. Only an older host falls back to "queued until it syncs on its own" \u2014 in that case change the same option under DSH Settings \u2192 Memory.',readonlyTitle:"This page is read-only; config cannot be saved here",readonlyBody:"This process has no DSH settings service (settings.update is unavailable). Edit the config in DSH: desktop app \u2192 Settings \u2192 Memory.",readonlyBtn:"Read-only",setupRunInTerminal:"Copy this command to your terminal:",dshMemoryConfig:"DSH Memory Config",autoCapture:"Auto capture",autoRecall:"Auto recall",captureMinChars:"Min capture chars",maxCardsPerDay:"Daily quota",dedupThreshold:"Dedup threshold",recallLimit:"Recall limit",vaultMulti:"Multiple vaults (per project)",vaultMultiHint:"Empty = single vault; existing setups unaffected",vaultNow:"Active now",vaultSource:"Source",vaultWorkspace:"Current workspace",vaultNamePh:"Name, e.g. work",vaultPathPh:"Directory, e.g. D:/vaults/work",vaultMatchPh:"Project dir (optional, auto-select by workspace)",vaultAdd:"Add a vault",vaultActive:"Active vault",vaultActiveNone:"Default vault (unset)",vaultSrcEnv:"env MEMORY_VAULT_DIR",vaultSrcProfile:"activeVault profile",vaultSrcWorkspace:"matched by project dir",vaultSrcVaultDir:"vaultDir setting",vaultSrcDefault:"default directory",fbNav:"Report a bug",fbTitle:"Report a bug (files on GitHub)",fbDesc:"Describe the problem (symptoms / steps / expected)",fbDiag:"Diagnostics (auto-redacted: home dir and keys/tokens replaced)",fbCopyDiag:"Copy diagnostics",fbOpenIssue:"Open prefilled issue on GitHub",fbCopyPrompt:"Copy AI prompt",fbCopiedDiag:"Diagnostics copied",fbCopiedPrompt:"Prompt copied \u2014 paste it into your AI chat",fbCopyFail:"Copy failed; please select and copy manually",fbWhy:"GitHub does not allow anonymous issue creation and the plugin must not ship a token: so the title, body and diagnostics are pre-filled \u2014 you just click Submit.",fbNeedDesc:"Please describe the problem first",fbLoading:"Collecting diagnostics\u2026",fbDiagFail:"Diagnostics endpoint unavailable (standalone web or older host); please add environment info manually",fbOr:"or",fbSelectAll:"Select all",toastApproved:"approved",toastRejected:"rejected",toastCardDeleted:"deleted",toastRestored:"restored",toastPurged:"permanently deleted",toastPurgedExpired:"expired recycle entries purged",toastFailed:"Action failed",noSelection:"Select the cards to act on first",enabledLabel:"Enable memory core",vaultDirLabel:"Vault directory (single)",captureCooldownMs:"Capture cooldown (ms)",captureProvider:"Distill provider (auto if empty)",captureModel:"Distill model (auto if empty)",recallEmbedding:"Semantic recall provider (optional)",sessionBudgetChars:"Session budget (chars)",saving:"Saving\u2026",savePending:"Saved to the config file; the host half is still the old build, so restart DSH to make it effective (already applied in this panel)",saveInvalid:"Some field values are invalid; nothing was submitted",invalidField:'"{field}" must be a number between {min} and {max} (now: {value})',actionRunning:"Working\u2026",recycleEmptyHint:"Recycle bin is empty: deleted cards land here first and are purged automatically after {days} days.",recyclePurgeAll:"Empty recycle bin",fbCopyManual:"Auto-copy was blocked by the browser \u2014 the text is below: click Select all, then Ctrl+C",vcLoaded:"running (process serving this page)",vcResident:"resident instance",vcOnDisk:"on disk",vcLatest:"npm latest",vcStale:'v{disk} is installed on disk but the process serving this page still has v{loaded} loaded \u2014 click "Restart resident instance" to restart it on the new code (no DSH restart needed)',vcRestart:"Restart resident instance",vcRestarting:"Restarting\u2026",vcRestartSent:"Resident restart scheduled: the new process takes over in ~3-8s \u2014 refresh the page (Ctrl+F5) shortly",vcRestartCurrent:"The resident instance is already up to date \u2014 no restart needed",vcRestartFail:"Restart request failed",vcRestartNoRoute:"The process serving this page is still the old build (no such endpoint): restart the desktop app / DSH and retry, or run {cmd}",vcHostStale:'The "running" chip above comes from the process serving this page; the resident instance is already current \u2014 restart the desktop app / DSH to refresh that chip',vcResidentDownShort:"not running",vcResidentDown:"The resident instance is not running (no response on port {port}) \u2014 use the button below to bring it up on the new code; if that fails run {cmd} and share the output of dsh-memory status",vcResidentUnmanagedShort:"unmanaged",vcResidentUnmanaged:"The resident instance serves v{served} but has **no watchdog keeping it alive** (an orphan left by a stop or a hard kill) \u2014 use the button below to put it back under management (a fresh watchdog plus a new instance), or run {cmd}",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.",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
- - `},Rt=["all","project","knowledge","content","prompt","business","tool","mistake"],_e={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},ht={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},$e={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},yt="deepseek-harness",ut=t=>{let o=String(t||""),r=o.toLowerCase();return!o||o==="agent"||o==="unknown"||o.startsWith("session:")||r.startsWith("claude-code")?r.startsWith("claude-code")?"claude":yt:r==="deepseek harness"?yt:o.split(":")[0]||yt},wa=[yt,"claude","codex","cursor","codex-desktop"],Zt=(t=[])=>[...new Set([...wa,...(t||[]).map(ut)])],ka={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],warn:["\u26A0\uFE0F","#f59e0b"],fail:["\u274C","#ef4444"]},Fe=`
106
+ - `},Lt=["all","project","knowledge","content","prompt","business","tool","mistake"],Ue={project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},ht={project:"\u{1F4C1}",knowledge:"\u{1F4DA}",content:"\u{1F4DD}",prompt:"\u{1F4AC}",business:"\u{1F4BC}",tool:"\u{1F527}",mistake:"\u26A0\uFE0F",other:"\u{1F4CE}"},_e={project:"kindProject",knowledge:"kindKnowledge",content:"kindContent",prompt:"kindPrompt",business:"kindBusiness",tool:"kindTool",mistake:"kindMistake",other:"kindKnowledge"},yt="deepseek-harness",ut=t=>{let o=String(t||""),r=o.toLowerCase();return!o||o==="agent"||o==="unknown"||o.startsWith("session:")||r.startsWith("claude-code")?r.startsWith("claude-code")?"claude":yt:r==="deepseek harness"?yt:o.split(":")[0]||yt},wa=[yt,"claude","codex","cursor","codex-desktop"],Zt=(t=[])=>[...new Set([...wa,...(t||[]).map(ut)])],ka={boot:["\u{1F680}","#8b5cf6"],listen:["\u{1F442}","inherit"],created:["\u2705","#10b981"],appended:["\u2795","#3b82f6"],skip:["\u23ED","#f59e0b"],warn:["\u26A0\uFE0F","#f59e0b"],fail:["\u274C","#ef4444"]},He=`
107
107
  .memory-eternal-root { font-family: inherit; color: var(--dsw-alias-label-primary, #1f2937); }
108
108
  .mc-card { background: var(--dsw-alias-bg-layer-1, #fff); border: 1px solid var(--dsw-alias-border-l1, #e5e7eb); border-radius: 12px; padding: 14px 16px; }
109
109
  .mc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
@@ -298,13 +298,13 @@ Option A, because:
298
298
  height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
299
299
  max-height: calc(100vh - var(--dsh-windows-titlebar-height, 0px));
300
300
  }
301
- `;function Sa(t){t.effect(()=>t.locale.register(lt,{zh:Xt,en:Jt}),"memory-eternal: locale");let o=t.locale.bind(lt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:lt,order:25,label:()=>o("nav"),locale:lt,inject:()=>({})},()=>n.default.createElement(Na,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${lt}:footer`,order:100,label:()=>o("nav"),locale:lt,inject:()=>({})},r=>n.default.createElement(Ma,{t:o,locale:t.locale,wide:!(r&&r.wide===!1)}))),"memory-eternal: sidebar footer action")}function Ca(){let[t,o]=(0,n.useState)(_+"/ui/app");return(0,n.useEffect)(()=>{let r=!0,m=()=>fetch("/memory-eternal/api/web-info").then(d=>d.json()).then(d=>{r&&d&&d.ok&&d.alive!==!1&&d.url&&o(d.url.endsWith("/")?d.url:d.url+"/")}).catch(()=>{});return fetch(_+"/ui/app",{method:"HEAD"}).then(d=>{if(r&&!d.ok)return m()}).catch(()=>r?m():void 0),()=>{r=!1}},[]),t}function Na({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:Fe}),(0,e.jsx)(ta,{t,onReload:()=>{},version:0})]})}function Ma({t,locale:o,wide:r}){let[m,d]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${r?"":" rail"}`,children:[(0,e.jsx)("style",{children:Fe}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>d(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)(Qt,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),m&&(0,e.jsx)(Da,{t,locale:o,onClose:()=>d(!1)})]})}function Da({t,locale:o,onClose:r,tab:m}){let[d,i]=(0,n.useState)(!1),w=(0,n.useRef)(null),C=Ca(),x=(0,n.useCallback)(I=>o&&typeof o.subscribe=="function"?o.subscribe(I):()=>{},[o]),A=(0,n.useCallback)(()=>o&&typeof o.getSnapshot=="function"?o.getSnapshot():null,[o]),k=(0,n.useSyncExternalStore)(x,A),h=k&&(k.active==="zh"||k.active==="en")?k.active:null,u=(0,n.useRef)(null);u.current===null&&h&&(u.current=h);let D=(0,n.useMemo)(()=>{let I=u.current?`lang=${u.current}`:"";if(m==="config")return`${_}/ui/config?tab=config${I?`&${I}`:""}`;let v=C.replace(/\/$/,""),T=v.endsWith("/ui/app")?"?":"/?";return m?`${v}${T}tab=${m}${I?`&${I}`:""}`:I?`${v}${T}${I}`:C},[C,m]);return(0,n.useEffect)(()=>{let I=w.current&&w.current.contentWindow;I&&h&&I.postMessage({source:"memory-eternal",type:"locale",lang:h},"*")},[h]),(0,n.useEffect)(()=>{let I=v=>{v.key==="Escape"&&r()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[r]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:r,children:[(0,e.jsx)("style",{children:Fe}),(0,e.jsx)("div",{className:"me-modal"+(d?" 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(d?"exitFullscreen":"enterFullscreen"),title:t(d?"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:d?"\u2921":"\u2922"}),(0,e.jsx)("button",{type:"button",onClick:r,"aria-label":t("close"),title:t("close"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,e.jsx)("iframe",{ref:w,src:D,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 Qt(){return(0,e.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,e.jsx)("defs",{children:(0,e.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,e.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,e.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 0-6.4.1 4.1 4.1 0 0 0-2.7 5.9 4.1 4.1 0 0 0 .6 6.7A4.2 4.2 0 0 0 12 18.2Z"}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 1 6.4.1 4.1 4.1 0 0 1 2.7 5.9 4.1 4.1 0 0 1-.6 6.7A4.2 4.2 0 0 1 12 18.2Z"}),(0,e.jsx)("path",{d:"M12 9.2c-.8-1.4-1.7-2-3.1-2.2M12 9.2c.8-1.4 1.7-2 3.1-2.2M12 12.4c-1.2 1-3.2 1.6-5 1.4M12 12.4c1.2 1 3.2 1.6 5 1.4M12 13.2v4",fill:"none",stroke:"rgba(255,255,255,0.62)",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}var bt="0.10.16";function za({t,inModal:o,onClose:r,onFull:m,full:d}){let[i,w]=(0,n.useState)(null),[C,x]=(0,n.useState)([]),[A,k]=(0,n.useState)(!0),[h,u]=(0,n.useState)(null),[D,I]=(0,n.useState)(""),[v,T]=(0,n.useState)("all"),[N,j]=(0,n.useState)(""),[Q,xe]=(0,n.useState)("all"),[q,Re]=(0,n.useState)("all"),[U,me]=(0,n.useState)(()=>{try{let b=new URLSearchParams(typeof location<"u"?location.search:"").get("tab"),P={cards:"cards",graph:"graph",usage:"stats",stats:"stats",audit:"audit",recycle:"optimize",optimize:"optimize",config:"config"};if(b&&P[b])return P[b]}catch{}return"cards"}),[le,F]=(0,n.useState)(()=>new Set([U])),y=(0,n.useCallback)(b=>{F(P=>P.has(b)?P:new Set(P).add(b)),me(b)},[]),[H,M]=(0,n.useState)("recent"),[ne,K]=(0,n.useState)(null),X=(0,n.useRef)(null),re=(0,n.useRef)(null),[f,W]=(0,n.useState)(!1),[de,Y]=(0,n.useState)(null),[ie,we]=(0,n.useState)(!1),[Ae,Me]=(0,n.useState)(!1),[ve,Ce]=(0,n.useState)(!0),[et,Ze]=(0,n.useState)(null),[Ve,nt]=(0,n.useState)(0),tt=(0,n.useCallback)(()=>nt(b=>b+1),[]),Te=i?.quarantine?.pending??0,Be=i?.quarantine?.deleted??0,pe=(0,n.useRef)(null),[Ye,Ne]=(0,n.useState)(0),[c,s]=(0,n.useState)(!1),E=(0,n.useRef)(null),se=(0,n.useRef)(null),$=(0,n.useCallback)(async(b=v,P=N,Z=q,ke={})=>{let G=ke.append===!0;try{G?s(!0):(k(!0),I(""));let he=new URLSearchParams;b&&b!=="all"&&he.set("kind",b),P.trim()&&he.set("q",P.trim()),he.set("status",Z||"all"),he.set("limit",String(va)),he.set("offset",String(ke.offset||0)),H==="title"&&he.set("sort","title");let Ie=await(await fetch(`${_}/cards?${he.toString()}`)).json();if(Ie.ok){let Ue=Ie.cards||[];x(He=>G?[...He,...Ue.filter(Ke=>!He.some(vt=>vt.path===Ke.path))]:Ue),Ne(Number(Ie.total)||Ue.length)}}catch(he){I(String(he&&he.message?he.message:he))}finally{G?s(!1):k(!1)}},[v,N,q,H]),ge=(0,n.useCallback)(async()=>{try{let[b,P]=await Promise.all([fetch(`${_}/overview`).then(Z=>Z.json()),fetch(`${_}/capture-log`).then(Z=>Z.json()).catch(()=>null)]);b.ok&&w(b),u(P&&P.ok&&P.available&&P.health||null)}catch(b){I(String(b&&b.message?b.message:b))}finally{k(!1)}},[]),a=async b=>{try{let Z=await(await fetch(`${_}/delete?path=${encodeURIComponent(b)}`)).json();Z.ok?(K({ok:!0,msg:t("deleted")}),await ge(),tt()):K({ok:!1,msg:Z.error||t("deleteFail")})}catch{K({ok:!1,msg:t("deleteFail")})}X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2e3)};(0,n.useEffect)(()=>(ge(),()=>{pe.current&&clearTimeout(pe.current)}),[ge]);let l=b=>{j(b),pe.current&&clearTimeout(pe.current),pe.current=setTimeout(()=>$(v,b,q),280)},L=b=>{T(b),$(b,N,q)};(0,n.useEffect)(()=>{U==="cards"&&$(v,N,q)},[q,U,Ve,H]),(0,n.useEffect)(()=>{if(U!=="cards"||A||c||C.length>=Ye)return;let b=E.current,P=se.current;if(!b)return;let Z=new IntersectionObserver(ke=>{ke[0]&&ke[0].isIntersecting&&$(v,N,q,{append:!0,offset:C.length})},{root:P||null,rootMargin:"400px"});return Z.observe(b),()=>Z.disconnect()},[U,C,Ye,A,c,v,N,q,$]);let B=async b=>{try{let P=b.status;if(!P&&b.path)try{let ze=((await fetch(`${_}/cards?status=all&q=${encodeURIComponent(b.title||"")}&limit=50`).then(Ie=>Ie.json())).cards||[]).find(Ie=>Ie.path===b.path);ze&&(P=ze.status)}catch{}let Z=P&&P!=="approved"?`&status=${encodeURIComponent(P)}`:"",ke=await fetch(`${_}/card?path=${encodeURIComponent(b.path||b.id)}${Z}`),G=await ke.json();G.ok?Y({path:G.path,title:b.title,text:G.text}):I(G.error||`HTTP ${ke.status}`)}catch(P){I(String(P&&P.message?P.message:P))}},J=async(b,P)=>{W(!0);try{let Z=await fetch(`${_}/export`);if(!Z.ok)throw new Error("HTTP "+Z.status);let ke=await Z.json();if(!ke.ok)throw new Error(ke.error||"export failed");let G,he,ze;if(b==="json"){he="memory-vault.json",ze="application/json";let He=ke.cards.map(Ke=>({path:Ke.path,title:Ke.title,kind:Ke.kind,status:Ke.status,store:Ke.store,text:Ke.text}));G=JSON.stringify({format:ke.format||"memory-eternal-vault",formatVersion:ke.formatVersion||1,exportedAt:ke.exportedAt||new Date().toISOString(),count:He.length,cards:He},null,2)}else he="memory-vault.md",ze="text/markdown;charset=utf-8",G=ke.cards.map(He=>He.text.trim()).filter(Boolean).join(`
301
+ `;function Sa(t){t.effect(()=>t.locale.register(lt,{zh:Xt,en:Jt}),"memory-eternal: locale");let o=t.locale.bind(lt);t.effect(()=>t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:lt,order:25,label:()=>o("nav"),locale:lt,inject:()=>({})},()=>n.default.createElement(Na,{t:o}))),"memory-eternal: settings section"),t.effect(()=>t.slots.inject("sidebar.footer.action",()=>t.slots.register({name:"sidebar.footer.action",id:`${lt}:footer`,order:100,label:()=>o("nav"),locale:lt,inject:()=>({})},r=>n.default.createElement(Ma,{t:o,locale:t.locale,wide:!(r&&r.wide===!1)}))),"memory-eternal: sidebar footer action")}function Ca(){let[t,o]=(0,n.useState)(_+"/ui/app");return(0,n.useEffect)(()=>{let r=!0,m=()=>fetch("/memory-eternal/api/web-info").then(d=>d.json()).then(d=>{r&&d&&d.ok&&d.alive!==!1&&d.url&&o(d.url.endsWith("/")?d.url:d.url+"/")}).catch(()=>{});return fetch(_+"/ui/app",{method:"HEAD"}).then(d=>{if(r&&!d.ok)return m()}).catch(()=>r?m():void 0),()=>{r=!1}},[]),t}function Na({t}){return(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[(0,e.jsx)("style",{children:He}),(0,e.jsx)(ta,{t,onReload:()=>{},version:0})]})}function Ma({t,locale:o,wide:r}){let[m,d]=(0,n.useState)(!1);return(0,e.jsxs)("div",{className:`me-footer${r?"":" rail"}`,children:[(0,e.jsx)("style",{children:He}),(0,e.jsxs)("button",{type:"button",className:"me-footer-btn",onClick:()=>d(!0),"aria-label":t("nav"),title:t("nav"),children:[(0,e.jsx)("span",{className:"me-footer-ico","aria-hidden":"true",children:(0,e.jsx)(Qt,{})}),(0,e.jsx)("span",{className:"me-footer-label",children:t("nav")})]}),m&&(0,e.jsx)(Da,{t,locale:o,onClose:()=>d(!1)})]})}function Da({t,locale:o,onClose:r,tab:m}){let[d,i]=(0,n.useState)(!1),S=(0,n.useRef)(null),M=Ca(),k=(0,n.useCallback)(I=>o&&typeof o.subscribe=="function"?o.subscribe(I):()=>{},[o]),E=(0,n.useCallback)(()=>o&&typeof o.getSnapshot=="function"?o.getSnapshot():null,[o]),C=(0,n.useSyncExternalStore)(k,E),h=C&&(C.active==="zh"||C.active==="en")?C.active:null,u=(0,n.useRef)(null);u.current===null&&h&&(u.current=h);let z=(0,n.useMemo)(()=>{let I=u.current?`lang=${u.current}`:"";if(m==="config")return`${_}/ui/config?tab=config${I?`&${I}`:""}`;let w=M.replace(/\/$/,""),R=w.endsWith("/ui/app")?"?":"/?";return m?`${w}${R}tab=${m}${I?`&${I}`:""}`:I?`${w}${R}${I}`:M},[M,m]);return(0,n.useEffect)(()=>{let I=S.current&&S.current.contentWindow;I&&h&&I.postMessage({source:"memory-eternal",type:"locale",lang:h},"*")},[h]),(0,n.useEffect)(()=>{let I=w=>{w.key==="Escape"&&r()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[r]),(0,e.jsxs)("div",{className:"me-overlay-top",onClick:r,children:[(0,e.jsx)("style",{children:He}),(0,e.jsx)("div",{className:"me-modal"+(d?" 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(d?"exitFullscreen":"enterFullscreen"),title:t(d?"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:d?"\u2921":"\u2922"}),(0,e.jsx)("button",{type:"button",onClick:r,"aria-label":t("close"),title:t("close"),style:{width:26,height:26,borderRadius:6,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),(0,e.jsx)("iframe",{ref:S,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 Qt(){return(0,e.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,e.jsx)("defs",{children:(0,e.jsxs)("linearGradient",{id:"mg-brain",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,e.jsx)("stop",{offset:"0%",stopColor:"#FFC46B"}),(0,e.jsx)("stop",{offset:"50%",stopColor:"#F97316"}),(0,e.jsx)("stop",{offset:"100%",stopColor:"#EA580C"})]})}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 0-6.4.1 4.1 4.1 0 0 0-2.7 5.9 4.1 4.1 0 0 0 .6 6.7A4.2 4.2 0 0 0 12 18.2Z"}),(0,e.jsx)("path",{fill:"url(#mg-brain)",d:"M12 4.5a3.2 3.2 0 0 1 6.4.1 4.1 4.1 0 0 1 2.7 5.9 4.1 4.1 0 0 1-.6 6.7A4.2 4.2 0 0 1 12 18.2Z"}),(0,e.jsx)("path",{d:"M12 9.2c-.8-1.4-1.7-2-3.1-2.2M12 9.2c.8-1.4 1.7-2 3.1-2.2M12 12.4c-1.2 1-3.2 1.6-5 1.4M12 12.4c1.2 1 3.2 1.6 5 1.4M12 13.2v4",fill:"none",stroke:"rgba(255,255,255,0.62)",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"8.6",r:"1.1",fill:"rgba(255,255,255,0.85)"})]})}var bt="0.10.18";function za({t,inModal:o,onClose:r,onFull:m,full:d}){let[i,S]=(0,n.useState)(null),[M,k]=(0,n.useState)([]),[E,C]=(0,n.useState)(!0),[h,u]=(0,n.useState)(null),[z,I]=(0,n.useState)(""),[w,R]=(0,n.useState)("all"),[D,O]=(0,n.useState)(""),[J,ve]=(0,n.useState)("all"),[V,Le]=(0,n.useState)("all"),[U,ue]=(0,n.useState)(()=>{try{let g=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(g&&x[g])return x[g]}catch{}return"cards"}),[re,H]=(0,n.useState)(()=>new Set([U])),y=(0,n.useCallback)(g=>{H(x=>x.has(g)?x:new Set(x).add(g)),ue(g)},[]),[j,v]=(0,n.useState)("recent"),[te,K]=(0,n.useState)(null),X=(0,n.useRef)(null),oe=(0,n.useRef)(null),[b,$]=(0,n.useState)(!1),[se,Y]=(0,n.useState)(null),[ae,he]=(0,n.useState)(!1),[Ae,De]=(0,n.useState)(!1),[we,Be]=(0,n.useState)(!0),[Pe,ze]=(0,n.useState)(null),[Ce,tt]=(0,n.useState)(0),at=(0,n.useCallback)(()=>tt(g=>g+1),[]),Ke=i?.quarantine?.pending??0,qe=i?.quarantine?.deleted??0,de=(0,n.useRef)(null),[Re,ke]=(0,n.useState)(0),[c,s]=(0,n.useState)(!1),B=(0,n.useRef)(null),ie=(0,n.useRef)(null),ce=(0,n.useCallback)(async(g=w,x=D,L=V,ne={})=>{let q=ne.append===!0;try{q?s(!0):(C(!0),I(""));let ge=new URLSearchParams;g&&g!=="all"&&ge.set("kind",g),x.trim()&&ge.set("q",x.trim()),ge.set("status",L||"all"),ge.set("limit",String(va)),ge.set("offset",String(ne.offset||0)),j==="title"&&ge.set("sort","title");let Te=await(await fetch(`${_}/cards?${ge.toString()}`)).json();if(Te.ok){let Ve=Te.cards||[];k(je=>q?[...je,...Ve.filter(Ye=>!je.some(vt=>vt.path===Ye.path))]:Ve),ke(Number(Te.total)||Ve.length)}}catch(ge){I(String(ge&&ge.message?ge.message:ge))}finally{q?s(!1):C(!1)}},[w,D,V,j]),me=(0,n.useCallback)(async()=>{try{let[g,x]=await Promise.all([fetch(`${_}/overview`).then(L=>L.json()),fetch(`${_}/capture-log`).then(L=>L.json()).catch(()=>null)]);g.ok&&S(g),u(x&&x.ok&&x.available&&x.health||null)}catch(g){I(String(g&&g.message?g.message:g))}finally{C(!1)}},[]),a=async g=>{try{let L=await(await fetch(`${_}/delete?path=${encodeURIComponent(g)}`)).json();L.ok?(K({ok:!0,msg:t("deleted")}),await me(),at()):K({ok:!1,msg:L.error||t("deleteFail")})}catch{K({ok:!1,msg:t("deleteFail")})}X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2e3)};(0,n.useEffect)(()=>(me(),()=>{de.current&&clearTimeout(de.current)}),[me]);let be=g=>{O(g),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>ce(w,g,V),280)},it=g=>{R(g),ce(g,D,V)};(0,n.useEffect)(()=>{U==="cards"&&ce(w,D,V)},[V,U,Ce,j]),(0,n.useEffect)(()=>{if(U!=="cards"||E||c||M.length>=Re)return;let g=B.current,x=ie.current;if(!g)return;let L=new IntersectionObserver(ne=>{ne[0]&&ne[0].isIntersecting&&ce(w,D,V,{append:!0,offset:M.length})},{root:x||null,rootMargin:"400px"});return L.observe(g),()=>L.disconnect()},[U,M,Re,E,c,w,D,V,ce]);let Ne=async g=>{try{let x=g.status;if(!x&&g.path)try{let Me=((await fetch(`${_}/cards?status=all&q=${encodeURIComponent(g.title||"")}&limit=50`).then(Te=>Te.json())).cards||[]).find(Te=>Te.path===g.path);Me&&(x=Me.status)}catch{}let L=x&&x!=="approved"?`&status=${encodeURIComponent(x)}`:"",ne=await fetch(`${_}/card?path=${encodeURIComponent(g.path||g.id)}${L}`),q=await ne.json();q.ok?Y({path:q.path,title:g.title,text:q.text}):I(q.error||`HTTP ${ne.status}`)}catch(x){I(String(x&&x.message?x.message:x))}},l=async(g,x)=>{$(!0);try{let L=await fetch(`${_}/export`);if(!L.ok)throw new Error("HTTP "+L.status);let ne=await L.json();if(!ne.ok)throw new Error(ne.error||"export failed");let q,ge,Me;if(g==="json"){ge="memory-vault.json",Me="application/json";let je=ne.cards.map(Ye=>({path:Ye.path,title:Ye.title,kind:Ye.kind,status:Ye.status,store:Ye.store,text:Ye.text}));q=JSON.stringify({format:ne.format||"memory-eternal-vault",formatVersion:ne.formatVersion||1,exportedAt:ne.exportedAt||new Date().toISOString(),count:je.length,cards:je},null,2)}else ge="memory-vault.md",Me="text/markdown;charset=utf-8",q=ne.cards.map(je=>je.text.trim()).filter(Boolean).join(`
302
302
 
303
303
  ---
304
304
 
305
- `);let Ie=new Blob([G],{type:ze}),Ue=await Wa(Ie,he,!1);if(!Ue.ok){K({ok:!1,msg:t("exportFail")}),W(!1);return}K({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+Ue.name})}catch(Z){K({ok:!1,msg:t("exportFail")+" \xB7 "+(Z.message||"")})}finally{W(!1)}X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2600)},be=async b=>{let P=b.target.files&&b.target.files[0];if(b.target.value="",!!P){try{let Z=await P.text(),G=await(await fetch(`${_}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:Z})).json();if(G.ok){await ge();let he=G.imported||0,ze=t("importedVault")+"\uFF1A"+he;G.total&&(ze+=t("importedTotal")+G.total+t("importedTotalTail")),G.quarantined&&(ze+=t("importedQuarantine")+G.quarantined+t("importedQuarantineTail")),G.skipped&&(ze+=t("importedSkipped")+G.skipped+t("importedSkippedTail")),G.warning&&(ze+=" \xB7 "+G.warning),K({ok:he>0||!G.total,msg:ze})}else K({ok:!1,msg:G.error||t("importFail")})}catch{K({ok:!1,msg:t("importFail")})}X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2400)}},V=(0,n.useMemo)(()=>{let b=C.slice();return Q!=="all"&&(b=b.filter(P=>ut(P.submittedBy)===Q)),q!=="all"&&(b=b.filter(P=>(P.status||"approved")===q)),H==="title"?b.sort((P,Z)=>String(P.title||"").localeCompare(String(Z.title||""))):H==="hot"?b.sort((P,Z)=>(Z.weight||Z.links||0)-(P.weight||P.links||0)):b.sort((P,Z)=>new Date(Z.updated||0).getTime()-new Date(P.updated||0).getTime()),b},[C,H,Q,q]),oe=(0,n.useMemo)(()=>[...new Set(C.map(b=>ut(b.submittedBy)))],[C]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:Fe}),ne&&(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 "+(ne.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ne.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ne.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:ne.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)(Qt,{})}),(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(d?"exitFull":"fullscreen"),children:d?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":t("close"),children:"\u2715"})]}),h&&h.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[h.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:h.since?pt(new Date(h.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${ve?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Ce(b=>!b),"aria-label":t(ve?"collapse":"expand"),title:t(ve?"collapse":"expand"),children:ve?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="cards"?" active":""}`,onClick:()=>y("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),ve&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="graph"?" active":""}`,onClick:()=>y("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),ve&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="stats"?" active":""}`,onClick:()=>y("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),ve&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="audit"?" active":""}`,onClick:()=>y("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),ve&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),Te>0&&(0,e.jsx)("span",{className:"mc-dot",children:Te>99?"99+":Te})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="optimize"?" active":""}`,onClick:()=>y("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),ve&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),Be>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:Be>99?"99+":Be})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="config"?" active":""}`,onClick:()=>y("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),ve&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>Me(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),ve&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:se,children:[U==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(dt,{label:t("total"),value:i?i.total:"\u2014"}),(0,e.jsx)(dt,{label:t("recent"),value:i?i.recent:"\u2014"}),(0,e.jsx)(dt,{label:t("tags"),value:i?i.tags:"\u2014"}),(0,e.jsx)(dt,{label:t("pending"),value:i?.quarantine?.pending??i?.status?.pending??0}),(0,e.jsx)(dt,{label:t("rejected"),value:i?.quarantine?.rejected??i?.status?.rejected??0}),(0,e.jsx)(dt,{label:t("cardCount"),value:i?i.byKind?.knowledge??0:"\u2014"})]}),U==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:N,onChange:b=>l(b.target.value)}),(0,e.jsx)("input",{ref:re,type:"file",accept:".json,application/json",style:{display:"none"},onChange:be}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>re.current&&re.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>Ze({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:f,onClick:()=>J("md"),children:t(f?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:f,onClick:()=>J("json"),children:t(f?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ge(),children:t("refresh")})]}),U==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Rt.map(b=>(0,e.jsx)("button",{type:"button",className:`mc-chip${v===b?" active":""}`,onClick:()=>L(b),children:t(b==="all"?"all":$e[b])},b)),(0,e.jsxs)("select",{value:Q,onChange:b=>xe(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsxs)("option",{value:"all",children:["\u{1F916} ",t("allAgents")]}),Zt(oe).map(b=>(0,e.jsx)("option",{value:b,children:b},b))]}),(0,e.jsxs)("select",{value:q,onChange:b=>Re(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allStatus")}),(0,e.jsx)("option",{value:"approved",children:t("statusApproved")}),(0,e.jsx)("option",{value:"pending",children:t("statusPending")}),(0,e.jsx)("option",{value:"rejected",children:t("statusRejected")})]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),[{key:"recent",label:t("sortRecent")},{key:"title",label:t("sortTitle")},{key:"hot",label:t("sortHot")}].map(b=>(0,e.jsx)("button",{type:"button",className:`mc-chip${H===b.key?" active":""}`,onClick:()=>M(b.key),children:b.label},b.key))]}),D&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",D]}),(0,e.jsx)("div",{style:{display:U==="cards"?"contents":"none"},children:A?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):D?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",D," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>ge(),children:t("retry")})]}):C.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:V.map(b=>(0,e.jsx)(La,{card:b,t,query:N.trim(),onOpen:B,onDelete:a},b.path))}),C.length<Ye&&(0,e.jsx)("div",{ref:E,style:{height:1}}),c&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",C.length," / ",Ye,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:U==="graph"?"flex":"none",flex:1,minHeight:0},children:le.has("graph")&&(0,e.jsx)(Ea,{t,onOpen:B,all:ie,onAllChange:we,onMutate:tt,active:U==="graph",visible:U==="graph"})}),(0,e.jsx)("div",{style:{display:U==="config"?"contents":"none"},children:le.has("config")&&(0,e.jsx)(ta,{t,onReload:()=>ge(),version:Ve})}),(0,e.jsx)("div",{style:{display:U==="stats"?"contents":"none"},children:le.has("stats")&&(0,e.jsx)(Ra,{t,tab:"stats",onReload:()=>ge(),version:Ve})}),(0,e.jsx)("div",{style:{display:U==="audit"?"contents":"none"},children:le.has("audit")&&(0,e.jsx)(Ta,{t,onReload:()=>ge(),version:Ve})}),(0,e.jsx)("div",{style:{display:U==="optimize"?"contents":"none"},children:le.has("optimize")&&(0,e.jsx)(Ia,{t,onReload:()=>ge(),version:Ve})}),Ae&&(0,e.jsx)(Ba,{t,onClose:()=>Me(!1)}),de&&(0,e.jsx)(Pa,{t,card:de,query:N.trim(),onClose:()=>Y(null),onDelete:b=>{Y(null),a(b)},onFeedback:b=>{let P=de.path;fetch(`${_}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:N.trim(),path:P,useful:b})}).then(()=>K({ok:!0,msg:t(b?"fbUseful":"fbIrr")})).catch(()=>{}),X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2e3)}}),(0,e.jsx)(Aa,{t,newCard:et,setNewCard:Ze,onCreated:()=>{ge(),tt(),K({ok:!0,msg:t("created")}),X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2e3)}})]})]})]})}var ea=({toast:t})=>t?(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(t.ok?"#10b981":"#ef4444"),background:t.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[t.ok?"\u2705":"\u26A0"," ",t.msg]}):null,dt=({label:t,value:o})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:o}),(0,e.jsx)("span",{children:t})]});function ta({t,onReload:o,version:r,compact:m}){let[d,i]=(0,n.useState)(null),[w,C]=(0,n.useState)(0),[x,A]=(0,n.useState)(null),[k,h]=(0,n.useState)(null),[u,D]=(0,n.useState)(!1),[I,v]=(0,n.useState)(!1),T=(0,n.useRef)(!1),N=(0,n.useRef)(null),j=(0,n.useRef)({}),[Q,xe]=(0,n.useState)(null),[q,Re]=(0,n.useState)(null),[U,me]=(0,n.useState)(""),[le,F]=(0,n.useState)(""),[y,H]=(0,n.useState)(""),[M,ne]=(0,n.useState)(null),K=(0,n.useCallback)(async l=>{F("version");try{let L=await fetch(_+"/version-check"+(l?"?force=1":"")).then(B=>B.json());L&&L.ok?(ne(L),l&&Y(L.updateAvailable?t("vcLatest")+" v"+L.latest:t("vcUpToDate"))):l&&Y(t("vcCheckFail"),!1)}catch{l&&Y(t("vcCheckFail"),!1)}finally{F("")}},[t]);(0,n.useEffect)(()=>{K(!1)},[r,K]);let[X,re]=(0,n.useState)(""),[f,W]=(0,n.useState)(null),de=(0,n.useRef)(null),Y=(l,L=!0)=>{de.current&&clearTimeout(de.current),W({msg:l,ok:L}),de.current=setTimeout(()=>W(null),1900)},ie=async()=>{if(!le){F("restart");try{let l=await fetch(_+"/restart-self",{method:"POST"});if(l.status===404||l.status===405){Y(Me("vcRestartNoRoute",{cmd:M&&M.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let L=await l.json().catch(()=>null);if(!L){Y(t("vcRestartFail")+"\uFF08HTTP "+l.status+"\uFF09",!1);return}if(!L.ok){Y(L.error||t("vcRestartFail"),!1);return}if(L.alreadyCurrent){Y(L.note||t("vcRestartCurrent"));return}Y(L.note||t("vcRestartSent")),L.alreadyRunning||setTimeout(()=>{K(!0)},6e3)}catch(l){Y(t("vcRestartFail")+"\uFF1A"+String(l&&l.message||l),!1)}finally{F("")}}},we=M&&M.resident?String(M.resident.served||""):"",Ae=!!(M&&M.onDisk&&we&&we!==M.onDisk),Me=(l,L)=>Object.keys(L).reduce((B,J)=>B.split("{"+J+"}").join(L[J]),t(l)),ve=(0,n.useCallback)(async()=>{try{let[l,L,B]=await Promise.all([fetch(`${_}/config`).then(J=>J.json()).catch(()=>null),fetch(`${_}/setup-status`).then(J=>J.json()).catch(()=>null),fetch(`${_}/budget`).then(J=>J.json()).catch(()=>null)]);if(l&&l.ok){i(l),C(l.revision??0),A(l.schema??null);let J=qt(l.config??{},j.current);j.current=J.overlay,h({...J.values}),xe(l.dsh??null),D(l.writable===!1),v(l.viaPending===!0),me(""),T.current=!1}else B&&B.ok?(h({...B}),D(!0),me(t("configNeedsDsh"))):me(t("adminLoadFail"));L&&L.ok&&Re(L),H("")}catch{me(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{ve()},[r,ve]);let Ce=(l,L)=>{T.current=!0,h(B=>({...B??{},[l]:L}))};(0,n.useEffect)(()=>{N.current=ve},[ve]),(0,n.useEffect)(()=>{if(typeof EventSource>"u")return;let l=null;try{l=new EventSource(_+"/events")}catch{return}let L=()=>{!T.current&&typeof N.current=="function"&&N.current()};try{l.addEventListener("config",L)}catch{}return()=>{try{l.close()}catch{}}},[]);let et=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),Ze=l=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[l]||l,Ve=async()=>{if(!k)return;if(u){Y(t("editInSetting"),!1);return}let l={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]},L=[];for(let[B,[J,be]]of Object.entries(l)){if(!(B in k))continue;let V=k[B],oe=typeof V=="number"?V:Number(V);(V===""||V===null||V===void 0||!Number.isFinite(oe)||oe<J||oe>be)&&L.push(t("invalidField",{field:B,min:J,max:be,value:String(V===""?"\u7A7A":V)}))}if(L.length){let B=t("saveInvalid")+"\uFF1A"+L.join("\uFF1B");me(B),Y(B,!1);return}F("save");try{let B={...k};for(let oe of Object.keys(k))oe in B&&typeof B[oe]=="string"&&B[oe].trim()!==""&&et.has(oe)&&(B[oe]=Number(B[oe]));Array.isArray(B.vaultProfiles)&&(B.vaultProfiles=B.vaultProfiles.filter(oe=>oe&&(String(oe.name||"").trim()||String(oe.path||"").trim())));let J=await fetch(`${_}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:B,expectedRevision:w})}),be=await J.text(),V=null;try{V=be?JSON.parse(be):null}catch{V=null}if(V||(V={error:"HTTP "+J.status+(be?"\uFF1A"+be.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")}),V&&V.ok){let oe=typeof V.pendingOutcome=="string"?V.pendingOutcome:"",b,P=!0;if(oe==="applied")b=t("savedApplied")+(Array.isArray(V.applied)&&V.applied.length?" \xB7 "+V.applied.join("\u3001"):"");else if(oe==="queued")P=!1,b=t("saveQueued");else if(oe==="failed")P=!1,b=t("saveFail")+" \xB7 "+(V.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if(oe==="applied-direct")b=t("savedOk")+" \xB7 "+t("savedDirect");else{let Z=Array.isArray(V.pending)&&V.pending.length?" \xB7 "+t("savePending"):V.note?" \xB7 "+t("restartHint"):"";b=(V.retried?"\u267B ":"")+t("savedOk")+Z}j.current={...j.current,...B},P?H(b):me(b),Y(b,P),await ve()}else{let oe=J.status===409?t("conflictRefresh"):V?.error||t("saveFail");me(oe),Y(oe,!1)}}catch{me(t("saveFail")),Y(t("saveFail"),!1)}finally{F("")}},nt=()=>{j.current={},h({...d?.config??{}}),H("")},tt={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},Te=l=>Array.isArray(l?.vaultProfiles)?l.vaultProfiles:[],Be=(l,L,B)=>h(J=>{let be=Te(J).map(oe=>({...oe||{}})),V={...be[l]||{}};return L==="match"?String(B).trim()?V.match={...V.match||{},workspace:B}:delete V.match:V[L]=B,be[l]=V,{...J??{},vaultProfiles:be}}),pe=()=>h(l=>({...l??{},vaultProfiles:[...Te(l),{name:"",path:""}]})),Ye=l=>h(L=>({...L??{},vaultProfiles:Te(L).filter((B,J)=>J!==l)})),Ne={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},c={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},s={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}},E=async l=>{let L=s[l];L&&h(B=>({...B??{},...L}))},se=async(l,L)=>{F(l+L);try{let J=await(await fetch(`${_}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:l,action:L})})).json();J&&J.ok?Y(Me(L==="install"?"mcpInstalled":"mcpUninstalled",{agent:l})):Y(Me("mcpActionFail",{agent:l,error:J?.error||""}),!1);try{let be=await fetch(`${_}/setup-status`).then(V=>V.json());be&&be.ok&&Re(be)}catch{}}catch{Y(t("mergeFail"),!1)}finally{F("")}},$=({k:l,label:L,type:B="text",step:J,min:be,max:V})=>(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:L||l}),(0,e.jsx)("input",{type:B,step:J,min:be,max:V,value:k?k[l]??"":"",onChange:oe=>{let b=oe.target.value;Ce(l,B==="number"?b===""?"":Number(b):b)},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}})]}),ge=new Set(["autoRestartOnDrift"]),a=({k:l,label:L})=>{let B=k?k[l]:void 0,J=B===void 0?ge.has(l):!!B;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:J,onChange:be=>Ce(l,be.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:L||l})]})};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:Fe}),f&&(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 "+(f.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:f.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:f.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:f.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[U&&(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 ",U]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:ve,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")]}),u&&(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")]}),y&&(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 ",y]}),d&&(d.version||d.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")}),d.version&&(0,e.jsxs)("code",{style:Ne,children:[t("vcLoaded")," v",d.version]}),M&&M.resident&&M.resident.served&&M.resident.served!==d.version&&(0,e.jsxs)("code",{style:Ne,children:[t("vcResident")," v",M.resident.served]}),bt&&(0,e.jsxs)("code",{style:Ne,children:[t("vcPage")," v",bt]}),M&&M.onDisk&&(0,e.jsxs)("code",{style:Ne,children:[t("vcOnDisk")," v",M.onDisk]}),M&&M.latest&&(0,e.jsxs)("code",{style:Ne,children:[t("vcLatest")," v",M.latest]}),d.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",d.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:le==="version",onClick:()=>K(!0),children:le==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),M&&M.stale&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px"},children:[(0,e.jsxs)("div",{children:["\u26A0\uFE0F ",Me("vcStale",{disk:M.onDisk,loaded:M.loaded})]}),Ae?(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!le,onClick:ie,children:le==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),M.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:M.restartCommand})]}):(0,e.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",t("vcHostStale"),M.restartCommand&&(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:M.restartCommand})]})]})]}),bt&&M&&M.onDisk&&bt!==M.onDisk&&(0,e.jsx)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px",lineHeight:1.7},children:t("vcPageStale",{page:bt,disk:M.onDisk})}),M&&M.updateAvailable&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,opacity:.88},children:["\u2B06 ",t("vcOutdated")," \u2192 ",(0,e.jsx)("code",{children:M.updateCommand})]}),M&&M.checkError&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b91c1c"},children:[t("vcCheckFail"),"\uFF1A",M.checkError]})]}),q&&q.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:q.agents.map(l=>(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:l.isDsh?t("dshHostLabel"):l.name}),l.isDsh&&l.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",l.version]}),!l.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),l.installed&&l.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),l.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),l.mcpConfigured===!0&&l.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),l.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",l.recallTool?t("enabled"):t("disabled"),")"]})]}),l.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",l.hook]}),!l.isDsh&&l.installed&&l.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!le,onClick:()=>se(l.name,"install"),children:t("installMcp")}),!l.isDsh&&l.installed&&l.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!le,onClick:()=>{window.confirm(t("uninstallConfirm"))&&se(l.name,"uninstall")},children:t("uninstallMcp")})]},l.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),X&&(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:X})})]}),k?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(l=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>E(l),disabled:!!le,children:[l==="A"?"\u{1F7E2} ":l==="B"?"\u{1F4B0} ":"\u2B50 ",s[l].label]},l))})]}),(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)(a,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(a,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)($,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)($,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)($,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)($,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)($,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(a,{k:"recallIncludeBody",label:t("recallBody")}),(0,e.jsx)($,{k:"secretHint",label:t("secretHint")}),(0,e.jsx)($,{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:Q?.vaultDir||"\u2014"}),Q?.vaultName?`\uFF08${Q.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(tt[Q?.vaultSource]||"vaultSrcDefault"),Q?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:Q.workspace})]}):null]}),Te(k).map((l,L)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:l.name||"",placeholder:t("vaultNamePh"),onChange:B=>Be(L,"name",B.target.value),style:c,disabled:u}),(0,e.jsx)("input",{value:l.path||"",placeholder:t("vaultPathPh"),onChange:B=>Be(L,"path",B.target.value),style:c,disabled:u}),(0,e.jsx)("input",{value:l.match&&l.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:B=>Be(L,"match",B.target.value),style:c,disabled:u}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>Ye(L),disabled:u,title:t("delete"),children:"\u2715"})]},L)),(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:pe,disabled:u,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:k.activeVault||"",onChange:l=>Ce("activeVault",l.target.value),disabled:u,style:c,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),Te(k).filter(l=>l&&l.name).map(l=>(0,e.jsx)("option",{value:l.name,children:l.name},l.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)(a,{k:"enabled",label:t("enabledLabel")}),(0,e.jsx)($,{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)(a,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(a,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)($,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)($,{k:"recallMinScore",label:t("recallMinScore"),type:"number"}),(0,e.jsx)($,{k:"captureCooldownMs",label:t("captureCooldownMs"),type:"number"}),(0,e.jsx)($,{k:"captureProvider",label:t("captureProvider")}),(0,e.jsx)($,{k:"captureModel",label:t("captureModel")}),(0,e.jsx)($,{k:"sessionBudgetChars",label:t("sessionBudgetChars"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t("auditMode")}),(0,e.jsxs)("select",{value:k.auditMode??"all",onChange:l=>Ce("auditMode",l.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)(Yt,{label:t("auditExemptAgents"),value:k.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(q?.agents||[]).filter(l=>!l.isDsh).map(l=>({value:l.name,label:l.name}))],onChange:l=>Ce("auditExemptAgents",l)}),(0,e.jsx)(Yt,{label:t("auditExemptKinds"),value:k.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Rt.filter(l=>l!=="all").map(l=>({value:l,label:t($e[l])}))],onChange:l=>Ce("auditExemptKinds",l)}),(0,e.jsx)($,{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)(a,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:k.autoWebMode??"init",onChange:l=>Ce("autoWebMode",l.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)($,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)($,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)($,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(a,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(a,{k:"autoRestartOnDrift",label:t("autoRestartOnDrift")}),(0,e.jsx)(a,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[le==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),y&&le!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",y]}),U&&le!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",U]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:nt,disabled:!!le,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:u?()=>Y(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):Ve,disabled:le==="save",title:t(u?"readonlyBody":"saveConfig"),children:le==="save"?"\u23F3 "+t("saving"):u?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function Ta({t,onReload:o,version:r}){let[m,d]=(0,n.useState)([]),[i,w]=(0,n.useState)([]),[C,x]=(0,n.useState)("all"),[A,k]=(0,n.useState)("all"),[h,u]=(0,n.useState)(""),[D,I]=(0,n.useState)(new Set),[v,T]=(0,n.useState)(""),[N,j]=(0,n.useState)(null),[Q,xe]=(0,n.useState)("pending"),q=(f,W=!0)=>{j({msg:f,ok:W}),setTimeout(()=>j(null),3e3)},Re=[...new Set([...m,...i].map(f=>f.submittedBy).filter(Boolean))],U=(0,n.useCallback)(async()=>{try{let f=await fetch(`${_}/audit/list`).then(W=>W.json());f.ok&&(d(f.pending||[]),w(f.rejected||[]),I(new Set),H(new Set),ne({}))}catch{}},[]);(0,n.useEffect)(()=>{U()},[r,U]);let me=(Q==="pending"?m:i).filter(f=>{if(C!=="all"&&f.kind!==C||A!=="all"&&ut(f.submittedBy)!==A)return!1;if(h){let W=(f.created||"").slice(0,10);if(W&&W!==h)return!1}return!0}),le=f=>I(W=>{let de=new Set(W);return de.has(f)?de.delete(f):de.add(f),de}),F=async(f,W)=>{let de=W||[...D];if(!de.length){q(t("noSelection"),!1);return}T("apply");let Y=t(f==="approved"?"toastApproved":f==="rejected"?"toastRejected":"toastCardDeleted");try{let ie=0;for(let we of de){let Ae=f==="approved"?"audit/approve":f==="rejected"?"audit/reject":"delete";try{(await fetch(_+"/"+Ae+"?path="+encodeURIComponent(we)+(f==="delete"?"&permanent=0":""))).ok||ie++}catch{ie++}}await U(),o&&o(),ie?q(t("toastFailed")+"\uFF08"+ie+"/"+de.length+"\uFF09",!1):q(Y+" "+de.length+" \u5F20")}catch(ie){q(t("toastFailed")+": "+String(ie&&ie.message||ie),!1)}finally{T("")}},[y,H]=(0,n.useState)(new Set),[M,ne]=(0,n.useState)({}),K=f=>M[f]||{},X=async f=>{let W=f.path,de=!y.has(W);if(H(Y=>{let ie=new Set(Y);return de?ie.add(W):ie.delete(W),ie}),!(!de||M[W])){ne(Y=>({...Y,[W]:{loading:!0}}));try{let Y=f.status||(Q==="pending"?"pending":"rejected"),ie=await fetch(`${_}/card?path=${encodeURIComponent(W)}&status=${Y}`).then(we=>we.json());ie&&ie.ok?ne(we=>({...we,[W]:{text:ie.text||""}})):ne(we=>({...we,[W]:{error:ie&&ie.error||"HTTP"}}))}catch(Y){ne(ie=>({...ie,[W]:{error:String(Y&&Y.message||Y)}}))}}},re=[...D];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:Fe}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ea,{toast:N}),(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:C,onChange:f=>x(f.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")}),Rt.filter(f=>f!=="all").map(f=>(0,e.jsx)("option",{value:f,children:t($e[f])},f))]}),(0,e.jsxs)("select",{value:A,onChange:f=>k(f.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")}),Zt(Re).map(f=>(0,e.jsx)("option",{value:f,children:f},f))]}),(0,e.jsx)("input",{type:"date",value:h,onChange:f=>u(f.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${Q==="pending"?" me-on":""}`,onClick:()=>xe("pending"),children:[t("pending"),"\uFF08",m.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${Q==="rejected"?" me-on":""}`,onClick:()=>xe("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:me.length>0&&re.length===me.length,onChange:f=>{f.target.checked?I(new Set(me.map(W=>W.path))):I(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!re.length||!!v,onClick:()=>F("approved"),children:["\u2713 ",t(Q==="rejected"?"restore":"approve")]}),Q==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!re.length||!!v,onClick:()=>F("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!re.length||!!v,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&F("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),me.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:me.map(f=>{let W=K(f.path),de=y.has(f.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:D.has(f.path),onChange:()=>le(f.path)}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"0 6px"},title:t(de?"collapse":"expand"),"aria-expanded":de,onClick:()=>X(f),children:de?"\u25BE":"\u25B8"}),(0,e.jsx)("span",{className:"mc-kind",style:{background:_e[f.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},title:t(de?"collapse":"expand"),onClick:()=>X(f),children:f.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ut(f.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:f.created?f.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:f.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:f.severity==="high"?"#f87171":"#9ca3af"},children:f.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.reason||"-"}),Q==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>F("approved",[f.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>F("rejected",[f.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:()=>F("approved",[f.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"))&&F("delete",[f.path])},children:"\u{1F5D1}"})]})]}),de&&(0,e.jsxs)("div",{style:{padding:"2px 10px 12px 34px"},children:[W.loading&&(0,e.jsxs)("div",{style:{fontSize:12,opacity:.6},children:["\u23F3 ",t("loading")]}),W.error&&(0,e.jsxs)("div",{style:{fontSize:12,color:"#f87171"},children:["\u26A0 ",t("auditBodyFail"),"\uFF1A",W.error]}),W.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:_e[f.kind]||"#6B7280",borderColor:(_e[f.kind]||"#6B7280")+"59",background:(_e[f.kind]||"#6B7280")+"1a"},children:[ht[f.kind]||"\u{1F4CE}"," ",t($e[f.kind]||"kindKnowledge")]}),(Array.isArray(f.tags)?f.tags:[]).slice(0,8).map(Y=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",Y]},Y)),!!f.reason&&(0,e.jsxs)("span",{className:"md-chip md-chip-st-warn",children:["\u2691 ",f.reason]})]}),(0,e.jsx)("div",{className:"md-doc",style:{maxHeight:340,overflow:"auto"},dangerouslySetInnerHTML:{__html:Tt(Ct(W.text).body)}}),Q==="pending"&&(0,e.jsxs)("div",{style:{display:"flex",gap:8,marginTop:8},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!!v,onClick:()=>F("approved",[f.path]),children:["\u2713 ",t("approve")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!v,onClick:()=>F("rejected",[f.path]),children:["\u2715 ",t("reject")]})]})]})]})]},f.path)})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function Ia({t,onReload:o,version:r}){let[m,d]=(0,n.useState)([]),[i,w]=(0,n.useState)(""),[C,x]=(0,n.useState)(null),A=(u,D=!0)=>{x({msg:u,ok:D}),setTimeout(()=>x(null),3200)},k=(0,n.useCallback)(async()=>{try{let u=await fetch(`${_}/recycle/list`).then(D=>D.json());u.ok&&d(u.items||[])}catch{}},[]);(0,n.useEffect)(()=>{k()},[r,k]);let h=async(u,D)=>{let I=(m.find(v=>v.path===D)||{}).title||D;w(u+D);try{let T=await fetch(_+(u==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(D)),N=await T.json().catch(()=>null);await k(),o&&o(),T.ok&&(!N||N.ok!==!1)?A(t(u==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+I):A(t("toastFailed")+"\uFF1A"+(N&&N.error||"HTTP "+T.status),!1)}catch(v){A(t("toastFailed")+"\uFF1A"+String(v&&v.message||v),!1)}finally{w("")}};return(0,e.jsxs)("div",{className:"mc-admin",style:{display:"flex",flexDirection:"column",overflow:"auto",flex:1,minHeight:0},children:[(0,e.jsx)("style",{children:Fe}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ea,{toast:C}),(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()=>{w("purgeAll");try{let u=await fetch(_+"/recycle/purge-expired?days=0"),D=await u.json().catch(()=>null);await k(),A(u.ok?t("toastPurgedExpired")+(D&&D.purged!=null?"\uFF08"+D.purged+"\uFF09":""):t("toastFailed"),u.ok)}catch(u){A(t("toastFailed")+"\uFF1A"+String(u&&u.message||u),!1)}finally{w("")}},children:t("emptyRecycle")})]}),m.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:m.map(u=>(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:_e[u.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(u.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!i,onClick:()=>h("restore",u.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!i,onClick:()=>{window.confirm(t("purgeConfirm"))&&h("purge",u.path)},children:t("purge")})]},u.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 La=({card:t,t:o,onOpen:r,query:m,onDelete:d})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>r(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:_e[t.kind]||_e.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:ht[t.kind]||"\u{1F4CE}"}),m?Gt(t.title,m):t.title,Oa(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?Gt(t.summary||"",m):t.summary||""}),t.tags.length>0&&(0,e.jsx)("div",{className:"mc-tags",children:t.tags.slice(0,4).map(i=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",i]},i))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[ht[t.kind]||"\u{1F4CE}"," ",o($e[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ut(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",pt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:o("delete"),onClick:i=>{i.stopPropagation(),window.confirm(o("deleteConfirm"))&&d&&d(t.path)},children:"\u{1F5D1}"})]})]});function Ra({t,tab:o,onReload:r,version:m}){let[d,i]=(0,n.useState)(null),[w,C]=(0,n.useState)(""),[x,A]=(0,n.useState)(null),[k,h]=(0,n.useState)(null),[u,D]=(0,n.useState)(null),[I,v]=(0,n.useState)([]),[T,N]=(0,n.useState)(""),[j,Q]=(0,n.useState)(!1),xe=(0,n.useCallback)(async()=>{if(!(!x||!x.merge||!x.merge.length)&&window.confirm(t("mergeAllConfirm"))){N("merge");try{let y={},H=re=>y[re]===void 0?re:y[re]=H(y[re]),M=(re,f)=>{y[H(re)]=H(f)},ne=new Set;for(let re of x.merge)ne.add(re.a.path),ne.add(re.b.path),M(re.a.path,re.b.path);let K={};for(let re of ne){let f=H(re);(K[f]=K[f]||[]).push(re)}let X=0;for(let re of Object.values(K)){if(re.length<2)continue;(await fetch(`${_}/merge?paths=${encodeURIComponent(re.join(","))}`).then(W=>W.json())).ok&&X++}await q(),r&&r()}catch{}N("")}},[x,q,r,t]);async function q(){try{let y=await Promise.all([fetch(`${_}/stats`),fetch(`${_}/budget`),fetch(`${_}/capture-log`),fetch(`${_}/cards?status=all&limit=30&agent=${yt}`)]),[H,M,ne,K]=await Promise.all(y.map(X=>X.json()));H&&H.ok&&i(H),M&&M.ok&&h(M),ne&&ne.ok&&D(ne),K&&K.ok&&v(K.cards||[]),C(!H||!H.ok?t("adminLoadFail"):"")}catch{C(t("adminLoadFail"))}}let Re=(0,n.useCallback)(async()=>{N("scan");try{let y=await fetch(`${_}/optimize`).then(H=>H.json());y.ok&&A(y)}catch{C(t("adminLoadFail"))}finally{N("")}},[t]);(0,n.useEffect)(()=>{q()},[m]);let U=async(y,H)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${_}/merge?paths=${encodeURIComponent(y+","+H)}`).then(ne=>ne.json())).ok&&(await q(),r&&r())}catch{}},me=async y=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${_}/delete?path=${encodeURIComponent(y)}`).then(M=>M.json())).ok&&(await q(),r&&r())}catch{}},le=["project","knowledge","content","prompt","business","tool","mistake"],F=({title:y,kind:H,updated:M,path:ne})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[H]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(M)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>me(ne),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:Fe}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[w&&(0,e.jsxs)("div",{className:"mc-card",style:{borderLeft:"4px solid #ef4444",background:"rgba(239,68,68,0.08)",padding:"12px 14px",marginBottom:10},children:[(0,e.jsxs)("div",{style:{fontSize:13,color:"#b91c1c",fontWeight:600,marginBottom:6},children:["\u26A0 ",w]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:q,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{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:()=>q(),children:["\u21BB ",t("refresh")]})]}),u?u.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(u.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:(u.entries||[]).map((y,H)=>{let M=ka[y.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:pt(y.time?new Date(y.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:M[1],fontWeight:600},children:[M[0]," ",y.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:y.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y.preview||"",children:y.preview||""})]},H)})})})}):(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",I.length,"\uFF09"]}),I.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:I.map(y=>(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:_e[y.kind]||_e.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.title}),y.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(y.updated)})]},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),d&&(0,e.jsxs)(e.Fragment,{children:[d.trend&&d.trend.length>0&&(()=>{let y=d.trend,H=Math.max(...y.map(X=>X.count),1),M=260,ne=50,K=M/y.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:M,height:ne,style:{display:"block",width:"100%",height:50},children:y.map((X,re)=>{let f=Math.round(X.count/H*(ne-4));return(0,e.jsx)("rect",{x:re*K+1,y:ne-f,width:Math.max(K-2,2),height:f,rx:1.5,fill:X.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:X.count>0?.85:.35},X.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.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:le.map(y=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[y]||"#666"}}),t($e[y]),": ",d.byKind?.[y]||0]},y))})]}),k&&(k.budgetChars||k.recallLimit||k.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:k.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:k.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",k.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",d.todayCards?.length||0,"\uFF09"]}),d.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:d.todayCards.map(y=>(0,e.jsx)(F,{title:y.title,kind:y.kind,updated:y.updated,path:y.path},y.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:!!T,onClick:Re,children:T==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),x&&x.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!T,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){N("oneclick");try{let y=JSON.stringify({cleanupStale:j}),M=await(await fetch(`${_}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:y})).json();M&&M.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${M.plan.merged} ${t("optimizedMerged")}${j?` \xB7 ${M.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await q(),r&&r(),A(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{N("")}}},children:T==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),x&&x.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:j,onChange:y=>Q(y.target.checked)}),t("oneClickAlsoStale")]})]}),!x&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),x&&(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}}),x.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!T,onClick:xe,children:t(T==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),x.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:x.merge.map((y,H)=>(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:[y.a.title," \u21C4 ",y.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(y.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>U(y.a.path,y.b.path),children:t("mergeNow")})]},H))}):(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",x.stale?.length||0,"\uFF09"]}),x.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!T,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;N("clean");let y=0;for(let H of x.stale)try{await fetch(`${_}/delete?path=${encodeURIComponent(H.path)}`),y++}catch{}N(""),notify(`${y} ${t("deletedStale")}`),await q(),r&&r()},children:t("cleanStale")})}),x.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:x.stale.map(y=>(0,e.jsx)(F,{title:y.title,kind:"other",updated:y.updated,path:y.path},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})})]})]})]})}var Lt=[{key:"decision",label:"tplDecision",kind:"knowledge",tagKey:"tplDecisionTags",bodyKey:"tplDecisionBody"},{key:"bug",label:"tplBug",kind:"mistake",tagKey:"tplBugTags",bodyKey:"tplBugBody"},{key:"meeting",label:"tplMeeting",kind:"content",tagKey:"tplMeetingTags",bodyKey:"tplMeetingBody"},{key:"weekly",label:"tplWeekly",kind:"content",tagKey:"tplWeeklyTags",bodyKey:"tplWeeklyBody"}];function Aa({t,newCard:o,setNewCard:r,onCreated:m}){if(!o)return null;let d=Lt.find(h=>h.key===o.template),i=o.body||(d?t(d.bodyKey):""),w=o.kind||(d?d.kind:"knowledge"),C=o.tags||(d?t(d.tagKey):""),x=o._creating,A=h=>{let u=Lt.find(D=>D.key===h);r(D=>({...D,template:h,kind:u?u.kind:D.kind,body:u?t(u.bodyKey):D.body,tags:u?t(u.tagKey):D.tags}))},k=async()=>{if(!(!o.title&&!i)){r(h=>({...h,_creating:!0}));try{(await fetch(`${_}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:w,tags:C.split(",").map(u=>u.trim()).filter(Boolean),body:i,source:"manual"})}).then(u=>u.json())).ok?(r(null),m&&m()):r(u=>({...u,_creating:!1}))}catch{r(u=>({...u,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>r(null),children:[(0,e.jsx)("style",{children:Fe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:h=>h.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>r(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[Lt.map(h=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===h.key?" me-on":""}`,onClick:()=>A(h.key),children:t(h.label)},h.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>r(h=>({...h,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:w,onChange:h=>r(u=>({...u,kind:h.target.value})),style:{maxWidth:180,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:["project","knowledge","content","prompt","business","tool","mistake"].map(h=>(0,e.jsx)("option",{value:h,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:h},h))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:o.title||"",onChange:h=>r(u=>({...u,title:h.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:C,onChange:h=>r(u=>({...u,tags:h.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:i,onChange:h=>r(u=>({...u,body:h.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:x,onClick:k,children:t(x?"exporting":"createCard")})})]})]})]})}async function Vt(t){let o=String(t||"");if(!o)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(o),!0}catch{}try{let r=document.createElement("textarea");r.value=o,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();let m=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(r),m}catch{return!1}}function Ba({t,onClose:o}){let[r,m]=(0,n.useState)(""),[d,i]=(0,n.useState)(""),[w,C]=(0,n.useState)(""),[x,A]=(0,n.useState)(!0),[k,h]=(0,n.useState)(!1),[u,D]=(0,n.useState)(""),[I,v]=(0,n.useState)(""),T=(0,n.useRef)(null),N=(0,n.useRef)(null),j=()=>{let F=T.current;if(F)try{F.focus(),F.select()}catch{}},Q=F=>{D(F),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>D(""),2400)};(0,n.useEffect)(()=>{let F=!0;return fetch(_+"/diagnostics").then(y=>y.json()).then(y=>{F&&(y&&y.ok?(i(String(y.diagnostics||"")),C(String(y.version||""))):h(!0))}).catch(()=>{F&&h(!0)}).finally(()=>{F&&A(!1)}),()=>{F=!1}},[]),(0,n.useEffect)(()=>{let F=y=>{y.key==="Escape"&&o()};return window.addEventListener("keydown",F),()=>{window.removeEventListener("keydown",F),N.current&&clearTimeout(N.current)}},[o]);let xe=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),q=()=>{let F=r.trim().split(`
306
- `)[0]||"",y=Ot({title:"[Bug] "+(F.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Wt({description:r,diagnostics:d,version:w})});try{window.open(y,"_blank","noopener")}catch{Q(t("fbCopyFail"))}},Re=async()=>{await Vt(d)?(v(""),Q(t("fbCopiedDiag"))):(v(d),Q(t("fbCopyManual")))},U=async()=>{let F=$t({lang:xe,description:r,diagnostics:d});await Vt(F)?(v(""),Q(t("fbCopiedPrompt"))):(v(F),Q(t("fbCopyManual")))},me={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},le={margin:0,maxHeight:170,overflow:"auto",fontSize:11.5,lineHeight:1.55,padding:"8px 10px",borderRadius:10,background:"var(--dsw-alias-bg-layer-1, rgba(127,127,127,0.08))",whiteSpace:"pre-wrap"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:Fe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:F=>F.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:o,children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,e.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:t("fbWhy")}),(0,e.jsx)("textarea",{value:r,onChange:F=>m(F.target.value),placeholder:t("fbDesc"),rows:5,style:me}),(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:!d,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:le,children:x?t("fbLoading"):k?t("fbDiagFail"):d})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!r.trim()){Q(t("fbNeedDesc"));return}q()},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:U,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),u&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:u}),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:j,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:T,readOnly:!0,value:I,rows:7,style:me})]})]})]})]})}function Pa({t,card:o,query:r,onClose:m,onDelete:d,onFeedback:i}){(0,n.useEffect)(()=>{let T=N=>{N.key==="Escape"&&m()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[m]);let{meta:w,body:C}=(0,n.useMemo)(()=>Ct(o.text||""),[o.text]),x=T=>{let N=w.find(([j])=>String(j).toLowerCase()===T);return N?N[1]:""},A=jt(x("tags")),k=x("kind")||"knowledge",h=(x("status")||"approved").toLowerCase(),u=_e[k]||"#6B7280",D=(C||"").length>460,[I,v]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:m,children:[(0,e.jsx)("style",{children:Fe}),(0,e.jsxs)("div",{className:"me-dialog",onClick:T=>T.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:ht[k]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),D&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":I,onClick:()=>v(T=>!T),children:t(I?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&d&&d(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:u,borderColor:u+"59",background:u+"1a"},children:[ht[k]||"\u{1F4CE}"," ",t($e[k]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(h==="approved"?"md-chip-st-ok":h==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[h==="approved"?"\u2705":h==="pending"?"\u23F3":"\u26D4"," ",t(h==="approved"?"statusApproved":h==="pending"?"statusPending":"statusRejected")]}),A.slice(0,8).map(T=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",T]},T)),!!x("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",pt(x("updated"))]}),!!x("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",x("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:I?{}:{maxHeight:300,overflow:"hidden"},onClick:I?void 0:T=>{T.stopPropagation(),v(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Tt(C)}})}),!I&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:T=>{T.stopPropagation(),v(!0)},children:[t("expand")," \u2304"]})]})]})}function Ea({t,onOpen:o,all:r,onAllChange:m,onMutate:d,active:i,visible:w}){let[C,x]=(0,n.useState)(null),[A,k]=(0,n.useState)(""),h=(0,n.useRef)(!1),u=(0,n.useRef)(0),D=(0,n.useRef)(t);D.current=t;let I=(0,n.useCallback)(async()=>{try{h.current=!1;let j=await(await fetch(`${_}/graph${r?"?all=1":""}`)).json();j.ok?(x(j),k(""),h.current=!0):(x(null),k(j.error||t("error")))}catch(N){k(String(N&&N.message?N.message:N))}},[r,t]);(0,n.useEffect)(()=>{if(!i||h.current)return;let N=!0;return fetch(`${_}/graph${r?"?all=1":""}`).then(j=>j.json()).then(j=>{N&&(j.ok?(x(j),k(""),h.current=!0):(x(null),k(j.error||t("error"))))}).catch(j=>{N&&k(String(j&&j.message?j.message:j))}),()=>{N=!1}},[r,t,i]),(0,n.useEffect)(()=>{w&&C&&u.current++},[w,C]);let v=(0,n.useCallback)(async N=>{try{let Q=await(await fetch(`${_}/delete?path=${encodeURIComponent(N)}`)).json();return Q&&Q.ok?(await I(),d&&d(),!0):!1}catch{return!1}},[I]),T=(0,n.useCallback)(async N=>{if(!N||N.length<2)return!1;try{let j=await fetch(`${_}/merge?paths=${encodeURIComponent(N.join(","))}`).then(Q=>Q.json());return j&&j.ok?(await I(),d&&d(),!0):!1}catch{return!1}},[I,d]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:Fe}),A&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",A]}),!C&&!A&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),C&&C.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),C&&C.nodes.length>0&&(0,e.jsx)(Ha,{nodes:C.nodes,edges:C.edges,onOpen:o,onDelete:v,onMerge:T,t,all:r,onAllChange:m,countLabel:`${C.nodes.length} ${t("nodes")} \xB7 ${Fa(C.edges)} ${t("edges")}`,fitTrigger:u.current})]})}function Fa(t){let o=new Set;for(let r of t||[])o.add([r.source,r.target].sort().join("|"));return o.size}var ct={colors:{project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},shapes:{project:"circle",knowledge:"circle",content:"rect",prompt:"diamond",business:"hexagon",tool:"circle",mistake:"diamond",other:"circle"}};function Ha({nodes:t,edges:o,onOpen:r,onDelete:m,onMerge:d,t:i,countLabel:w,all:C,onAllChange:x,fitTrigger:A}){let k=(0,n.useRef)(null),h=(0,n.useRef)(null),u=(0,n.useRef)(null),D=(0,n.useRef)(null),I=(0,n.useRef)(null),v=(0,n.useRef)(r);(0,n.useEffect)(()=>{v.current=r},[r]);let T=(0,n.useRef)(m);(0,n.useEffect)(()=>{T.current=m},[m]);let N=(0,n.useRef)(d);(0,n.useEffect)(()=>{N.current=d},[d]);let[j,Q]=(0,n.useState)(""),[xe,q]=(0,n.useState)(null),Re=(0,n.useRef)("");(0,n.useEffect)(()=>{Re.current=j.trim().toLowerCase()},[j]),(0,n.useEffect)(()=>{let c=u.current;if(!c)return;let s=j.trim().toLowerCase();if(!s)return;let E=c.nodes.find(se=>(se.name||"").toLowerCase().includes(s));E&&(u.current.selectedId=E.id,q(E.id),c.panX=c.w/2-E.x*c.zoom,c.panY=c.h/2-E.y*c.zoom,c.render&&c.render())},[j]);let[U,me]=(0,n.useState)("all"),[le,F]=(0,n.useState)(!1),y=(0,n.useRef)("all"),[H,M]=(0,n.useState)(""),ne=(0,n.useRef)(""),[K,X]=(0,n.useState)(!1),re=(0,n.useRef)(!1),[f,W]=(0,n.useState)(null);(0,n.useEffect)(()=>{y.current=U},[U]),(0,n.useEffect)(()=>{ne.current=H},[H]),(0,n.useEffect)(()=>{re.current=K},[K]);let de=(0,n.useMemo)(()=>{let c=new Map;for(let s of t)for(let E of s.tags||[]){let se=String(E).trim();se&&c.set(se,(c.get(se)||0)+1)}return[...c.entries()].sort((s,E)=>E[1]-s[1]).slice(0,24).map(([s,E])=>({tag:s,n:E}))},[t]),Y=(()=>{let c=j.trim().toLowerCase();return!!c&&!t.some(s=>(s.title||s.name||"").toLowerCase().includes(c)||String(s.kind||"").toLowerCase().includes(c)||String($e[s.kind]||"").toLowerCase().includes(c))})();(0,n.useEffect)(()=>{let c=u.current;c&&c.wake&&c.wake()},[j]),(0,n.useEffect)(()=>{let c=u.current;c&&c.render&&c.render()},[U,H,K]);let ie=(0,n.useRef)(null),[we,Ae]=(0,n.useState)([]),[Me,ve]=(0,n.useState)(null),[Ce,et]=(0,n.useState)(!1),[Ze,Ve]=(0,n.useState)(null),[nt,tt]=(0,n.useState)(""),Te=(0,n.useRef)(null),Be=(0,n.useRef)(null),pe=(c,s=!0)=>{Te.current&&clearTimeout(Te.current),Ve({msg:c,ok:s}),Te.current=setTimeout(()=>Ve(null),1900)},Ye=c=>{tt(c),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>tt(""),1600)};(0,n.useEffect)(()=>()=>{Te.current&&clearTimeout(Te.current),Be.current&&clearTimeout(Be.current)},[]);let Ne=(0,n.useMemo)(()=>t.reduce((c,s)=>(c[s.id]=s,c),{}),[t]);return(0,n.useEffect)(()=>{let c=k.current;if(!c||t.length===0)return;let s=c.getContext("2d");if(!s)return;let E=Math.max(1,window.devicePixelRatio||1),se=()=>document.documentElement.getAttribute("data-theme")==="dark",$={};o.forEach(p=>{$[p.source]=($[p.source]||0)+1,$[p.target]=($[p.target]||0)+1});let ge=Math.max(1,...Object.values($)),a={nodes:t.map(p=>({id:p.id,name:p.title||"",type:p.kind||"other",r:9+Math.min(10,($[p.id]||0)/ge*8),x:0,y:0,vx:0,vy:0})),edges:o.map(p=>({sourceNodeId:p.source,targetNodeId:p.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:E,ctx:s,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((p,z)=>(p[z.id]=z,p),{}),a.nodes.forEach((p,z)=>{let S=z/a.nodes.length*Math.PI*2-Math.PI/2;p.x=Math.cos(S)*60,p.y=Math.sin(S)*60});let l=[...new Set(a.nodes.map(p=>p.type))];a.clustered=l.length>1,a.typeCenters={},l.forEach((p,z)=>{let S=z/l.length*Math.PI*2-Math.PI/2;a.typeCenters[p]={x:Math.cos(S)*160,y:Math.sin(S)*160}}),u.current=a;let L=0,B=0,J=()=>{let p=c.clientWidth,z=c.clientHeight;a.w=p,a.h=z,c.width=p*E,c.height=z*E,s.setTransform(E,0,0,E,0,0),(L===0||B===0)&&p>0&&z>0&&a.tickCount>0&&requestAnimationFrame(()=>Z()),L=p,B=z};J();let be=new ResizeObserver(J);be.observe(c.parentElement);let V=(p,z)=>p&&p.length>z?p.slice(0,z)+"\u2026":p,oe=(p,z,S,R)=>{if(s.beginPath(),R==="rect")s.rect(p-S,z-S*.75,S*2,S*1.5);else if(R==="diamond")s.moveTo(p,z-S),s.lineTo(p+S,z),s.lineTo(p,z+S),s.lineTo(p-S,z),s.closePath();else if(R==="hexagon"){for(let O=0;O<6;O++){let ce=Math.PI/3*O-Math.PI/2,ee=p+S*Math.cos(ce),De=z+S*Math.sin(ce);O===0?s.moveTo(ee,De):s.lineTo(ee,De)}s.closePath()}else s.arc(p,z,S,0,Math.PI*2)},b=new Map,P=(p,z)=>{let S=p+"|"+Math.round(z),R=b.get(S);if(!R){let O=parseInt(p.slice(1,3),16),ce=parseInt(p.slice(3,5),16),ee=parseInt(p.slice(5,7),16);R=s.createRadialGradient(-z*.3,-z*.3,0,0,0,z*1.2),R.addColorStop(0,"rgba("+Math.min(255,O+70)+","+Math.min(255,ce+70)+","+Math.min(255,ee+70)+",0.95)"),R.addColorStop(1,p),b.set(S,R)}return R},Z=()=>{if(!a.nodes.length)return;let p=1/0,z=-1/0,S=1/0,R=-1/0;a.nodes.forEach(je=>{p=Math.min(p,je.x),z=Math.max(z,je.x),S=Math.min(S,je.y),R=Math.max(R,je.y)});let O=20,ce=z-p+O*2,ee=R-S+O*2,De=Math.min(a.w/ce,a.h/ee);a.zoom=Math.max(.35,Math.min(1.8,De)),a.panX=a.w/2-(p+z)/2*a.zoom,a.panY=a.h/2-(S+R)/2*a.zoom};D.current=Z;let ke=()=>{s.clearRect(0,0,a.w,a.h),a.searchTerm=Re.current,a.kindFilter=y.current,a.timeMode=re.current,a.tagFilter=ne.current;let p=a.tagFilter,z=a.kindFilter,S=g=>String(g||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");s.save(),s.strokeStyle=se()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",s.lineWidth=.5;for(let g=0;g<a.w;g+=24)s.beginPath(),s.moveTo(g,0),s.lineTo(g,a.h),s.stroke();for(let g=0;g<a.h;g+=24)s.beginPath(),s.moveTo(0,g),s.lineTo(a.w,g),s.stroke();s.restore(),s.save(),s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom);let R={};a.nodes.forEach(g=>R[g.id]=g);let O=a.nodes.length>40,ce=O?1.5:.55,ee=a.selectedId||a.hoverId,De=_t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),je=(()=>{let g=(a.searchTerm||"").toLowerCase();if(!g)return null;let te=[];for(let ae of a.nodes){let Se=(a.domainById[ae.id]||{}).kind||"other";if(((ae.name||"").toLowerCase().includes(g)||String($e[Se]||"").toLowerCase().includes(g)||String(Se).toLowerCase().includes(g))&&te.push(ae.id),te.length>200)break}return te})(),ot=Kt(a.nodes,{limit:Ut(a.nodes.length),focusId:ee,hoverId:a.hoverId,searchHits:je,degree:$}),ue=new Map,ye=(g,te)=>{let ae=g+"|"+te,fe=ue.get(ae);return fe===void 0&&(s.font=g,fe=s.measureText(te).width,ue.set(ae,fe)),fe},Pe=a.nodes.length<=250,Oe=new Map;a.edges.forEach(g=>{let te=R[g.sourceNodeId],ae=R[g.targetNodeId];if(!te||!ae||!Nt(te.x,te.y,10,De)&&!Nt(ae.x,ae.y,10,De))return;if(z!=="all"){let rt=a.domainById[g.sourceNodeId]&&a.domainById[g.sourceNodeId].kind,Je=a.domainById[g.targetNodeId]&&a.domainById[g.targetNodeId].kind;if(rt!==z&&Je!==z)return}if(p){let rt=a.domainById[g.sourceNodeId]&&(a.domainById[g.sourceNodeId].tags||[]).includes(p),Je=a.domainById[g.targetNodeId]&&(a.domainById[g.targetNodeId].tags||[]).includes(p);if(!rt&&!Je)return}let fe=ae.x-te.x,Se=ae.y-te.y,Le=Math.sqrt(fe*fe+Se*Se)||1,Qe=O?12:18,at=-Se/Le*Qe,xt=fe/Le*Qe,wt=(te.x+ae.x)/2+at,kt=(te.y+ae.y)/2+xt,mt=ct.colors[a.domainById[te.id]&&a.domainById[te.id].kind||"other"],gt=ee&&(g.sourceNodeId===ee||g.targetNodeId===ee),Mt=ee?gt?.6:.08:O?.14:.24,Xe=parseInt(mt.slice(1,3),16),ft=parseInt(mt.slice(3,5),16),Dt=parseInt(mt.slice(5,7),16),qe=gt?1.6+(g.weight||1):.8+(g.weight||1)*.5,it=Xe+","+ft+","+Dt+","+Mt+","+qe,We=Oe.get(it);We||(We={path:new Path2D,stroke:"rgba("+Xe+","+ft+","+Dt+","+Mt+")",width:qe},Oe.set(it,We)),We.path.moveTo(te.x,te.y),We.path.quadraticCurveTo(wt,kt,ae.x,ae.y)}),Oe.forEach(g=>{s.strokeStyle=g.stroke,s.lineWidth=g.width,s.stroke(g.path)});let Ee=null;ee&&(Ee=new Set,a.edges.forEach(g=>{g.sourceNodeId===ee?Ee.add(g.targetNodeId):g.targetNodeId===ee&&Ee.add(g.sourceNodeId)}));let Ge=[];if(a.nodes.forEach(g=>{if(!Nt(g.x,g.y,g.r+2,De))return;let te=a.domainById[g.id]||{},ae=te.kind||"other",fe=a.timeMode?ja(te.updated):ct.colors[ae],Se=ct.shapes[ae],Le=a.selectedId===g.id,Qe=a.hoverId===g.id,at=a.searchTerm||"",xt=!at||(g.name||"").toLowerCase().includes(at)||String($e[ae]||"").toLowerCase().includes(at)||String(ae).toLowerCase().includes(at),wt=z==="all"||ae===z,kt=!p||(te.tags||[]).includes(p),mt=ee&&g.id!==ee&&!(Ee&&Ee.has(g.id))||at&&!xt||!wt||!kt;s.save(),s.globalAlpha=mt?.08:1,(Le||Qe)&&Pe&&(s.shadowColor=fe,s.shadowBlur=Le?20:14),s.translate(g.x,g.y),oe(0,0,g.r,Se),s.fillStyle=P(fe,g.r),s.fill(),s.restore(),Le?(s.save(),oe(g.x,g.y,g.r+3,Se),s.strokeStyle=fe,s.lineWidth=3,s.shadowColor=fe,s.shadowBlur=12,s.stroke(),s.restore()):Qe?(s.save(),oe(g.x,g.y,g.r+2,Se),s.strokeStyle=fe,s.lineWidth=2,s.stroke(),s.restore()):at&&xt?(s.save(),oe(g.x,g.y,g.r+2,Se),s.strokeStyle="#e11d48",s.lineWidth=2,s.stroke(),s.restore()):a.multi.indexOf(g.id)>=0&&(s.save(),oe(g.x,g.y,g.r+2,Se),s.strokeStyle="#60a5fa",s.lineWidth=2,s.shadowColor="#60a5fa",s.shadowBlur=8,s.stroke(),s.restore());let gt=V(g.name,16);if((Le||Qe||ot.has(g.id)&&a.zoom>ce||!O&&a.zoom>.6)&&wt&&kt){let Xe=1/a.zoom,ft="500 "+(12*Xe).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";s.font=ft;let qe=ye(ft,gt)+16*Xe,it=18*Xe,We=g.y+g.r+8*Xe,rt=!0;for(let Je of Ge)if(g.x-qe/2<Je.x+Je.w&&g.x+qe/2>Je.x&&We<Je.y+Je.h&&We+it>Je.y){rt=!1;break}if(!rt&&!Le&&!Qe)return;Ge.push({x:g.x-qe/2,y:We,w:qe,h:it}),s.fillStyle=se()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",s.beginPath(),s.roundRect?s.roundRect(g.x-qe/2,We,qe,it,4*Xe):s.rect(g.x-qe/2,We,qe,it),s.fill(),s.strokeStyle=se()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",s.lineWidth=1*Xe,s.stroke(),s.fillStyle=se()?Le||Qe?"#eee":"#bbb":Le||Qe?"#111":"#444",s.textAlign="center",s.fillText(gt,g.x,We+13*Xe)}}),s.restore(),a.marquee){let g=a.marquee,te=Math.min(g.sx,g.ex),ae=Math.min(g.sy,g.ey),fe=Math.abs(g.ex-g.sx),Se=Math.abs(g.ey-g.sy);s.save(),s.setLineDash([4,4]),s.strokeStyle="rgba(96,165,250,0.9)",s.lineWidth=1,s.fillStyle="rgba(96,165,250,0.12)",s.fillRect(te,ae,fe,Se),s.strokeRect(te,ae,fe,Se),s.restore()}if(a.hoverId&&ie.current){let g=a.domainById[a.hoverId],te=a.nodes.find(function(ae){return ae.id===a.hoverId});if(g&&te){let ae=a.edges.filter(function(Le){return Le.sourceNodeId===g.id||Le.targetNodeId===g.id}).length,fe=te.x*a.zoom+a.panX,Se=te.y*a.zoom+a.panY;ie.current.style.display="block",ie.current.style.left=fe+14+"px",ie.current.style.top=Se-6+"px",ie.current.innerHTML="<b>"+S(g.title||g.name||"")+'</b><br/><span style="opacity:.8">'+S(g.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",ae)+"</span>"}}else ie.current&&(ie.current.style.display="none")},G=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(ze))};a.wake=G,a.render=ke;let he=()=>{let p=a.nodes.length;a.tickCount++;let S=.9-Math.min(.4,a.tickCount/1500),R=p>1e3?3e3:p>100?2e3:p>50?1200:800,O=p>100?.002:.005,ce=p>1e3?.012:p>100?.005:.01,ee=p>1e3?6:p>200?12:24,De={};a.nodes.forEach(ue=>De[ue.id]=ue);for(let ue=0;ue<p;ue++){if(a.dragNode===a.nodes[ue])continue;let ye=a.nodes[ue],Pe=0,Oe=0;for(let g=0;g<p;g++){if(ue===g)continue;let te=ye.x-a.nodes[g].x,ae=ye.y-a.nodes[g].y,fe=Math.sqrt(te*te+ae*ae)||1,Se=R/(fe*fe);Pe+=te/fe*Se,Oe+=ae/fe*Se}if(a.clustered&&a.typeCenters[ye.type]){let g=a.typeCenters[ye.type];Pe+=(g.x-ye.x)*.006,Oe+=(g.y-ye.y)*.006}else Pe-=ye.x*ce,Oe-=ye.y*ce;let Ee=(ye.vx+Pe)*S,Ge=(ye.vy+Oe)*S;Ee=Math.max(-ee,Math.min(ee,Ee)),Ge=Math.max(-ee,Math.min(ee,Ge)),ye.vx=Ee,ye.vy=Ge}a.edges.forEach(ue=>{let ye=De[ue.sourceNodeId],Pe=De[ue.targetNodeId];if(!ye||!Pe)return;let Oe=Pe.x-ye.x,Ee=Pe.y-ye.y,Ge=Math.sqrt(Oe*Oe+Ee*Ee)||1,g=(Ge-100)*O,te=Oe/Ge*g,ae=Ee/Ge*g;a.dragNode!==ye&&(ye.vx+=te,ye.vy+=ae),a.dragNode!==Pe&&(Pe.vx-=te,Pe.vy-=ae)});let je=0;a.nodes.forEach(ue=>{a.dragNode!==ue&&(ue.x+=ue.vx,ue.y+=ue.vy,je+=ue.vx*ue.vx+ue.vy*ue.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,Z()),(p?Math.sqrt(je/p):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},ze=()=>{if(a.running){try{he(),ke()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(ze)}},Ie=(p,z)=>{let S=c.getBoundingClientRect();return{x:(p-S.left-a.panX)/a.zoom,y:(z-S.top-a.panY)/a.zoom}},Ue=p=>{let z=a.domainById[p];return!(!z||y.current!=="all"&&z.kind!==y.current||ne.current&&!(z.tags||[]).includes(ne.current))},He=(p,z,S)=>Math.max(z,Math.min(S,p)),Ke=p=>{a.mouseX=p.clientX,a.mouseY=p.clientY;let z=Ie(p.clientX,p.clientY),S=null;for(let R=a.nodes.length-1;R>=0;R--){let O=a.nodes[R];if(!Ue(O.id))continue;let ce=O.x-z.x,ee=O.y-z.y;if(ce*ce+ee*ee<O.r*O.r+36){S=O.id;break}}S!==a.hoverId&&(a.hoverId=S,G())},vt=p=>{if(p.button!==0)return;let z=Ie(p.clientX,p.clientY),S=null;for(let R=a.nodes.length-1;R>=0;R--){let O=a.nodes[R];if(!Ue(O.id))continue;let ce=O.x-z.x,ee=O.y-z.y;if(ce*ce+ee*ee<O.r*O.r+25){S=O;break}}if(p.shiftKey){if(S){a.shiftClick=S.id;return}a.marquee={sx:p.clientX,sy:p.clientY,ex:p.clientX,ey:p.clientY};return}a.dragStart={x:p.clientX,y:p.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=S||null,S&&(a.dragOffset={dx:S.x-z.x,dy:S.y-z.y})},At=p=>{if(a.marquee){a.marquee.ex=p.clientX,a.marquee.ey=p.clientY,G();return}if(!a.dragStart)return;let z=p.clientX-a.dragStart.x,S=p.clientY-a.dragStart.y;if(Math.abs(z)+Math.abs(S)>3&&(a.dragging=!0),a.dragNode){let R=Ie(p.clientX,p.clientY);a.dragNode.x=R.x+a.dragOffset.dx,a.dragNode.y=R.y+a.dragOffset.dy,G()}else a.dragging&&(a.panX=He(a.dragStart.px+z,-1e5,1e5),a.panY=He(a.dragStart.py+S,-1e5,1e5),G())},Bt=p=>{if(a.marquee){let S=a.marquee;a.marquee=null;let R=c.getBoundingClientRect(),O=Math.min(S.sx,S.ex)-R.left,ce=Math.max(S.sx,S.ex)-R.left,ee=Math.min(S.sy,S.ey)-R.top,De=Math.max(S.sy,S.ey)-R.top,je=a.nodes.filter(ot=>{let ue=ot.x*a.zoom+a.panX,ye=ot.y*a.zoom+a.panY;return ue>=O&&ue<=ce&&ye>=ee&&ye<=De}).map(ot=>ot.id);a.multi=je,Ae(je),G();return}let z=a.dragStart&&!a.dragging;if(a.shiftClick){let S=a.shiftClick;a.shiftClick=null;let R=Array.isArray(a.multi)?a.multi.slice():[];R.includes(S)||R.push(S),a.multi=R,Ae(R),G();return}if(z){let S=Ie(p.clientX,p.clientY),R=null;for(let O=a.nodes.length-1;O>=0;O--){let ce=a.nodes[O];if(!Ue(ce.id))continue;let ee=ce.x-S.x,De=ce.y-S.y;if(ee*ee+De*De<ce.r*ce.r+20){R=ce;break}}R?(a.selectedId=R.id,q(R.id),G()):(a.selectedId=null,a.hoverId=null,p.shiftKey||(a.multi=[],Ae([])),q(null),G())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Pt=p=>{p.preventDefault();let z=Ie(p.clientX,p.clientY),S=null;for(let R=a.nodes.length-1;R>=0;R--){let O=a.nodes[R];if(!Ue(O.id))continue;let ce=O.x-z.x,ee=O.y-z.y;if(ce*ce+ee*ee<O.r*O.r+25){S=O;break}}if(S){let R=a.domainById[S.id];R&&W({x:p.clientX,y:p.clientY,id:S.id,path:R.id,title:R.title})}else W(null)},Et=p=>{p.preventDefault();let z=c.getBoundingClientRect(),S=(p.clientX-z.left-a.panX)/a.zoom,R=(p.clientY-z.top-a.panY)/a.zoom,O=Math.max(.3,Math.min(3,a.zoom*(p.deltaY<0?1.1:1/1.1)));a.panX=He(a.panX+S*(a.zoom-O),-1e5,1e5),a.panY=He(a.panY+R*(a.zoom-O),-1e5,1e5),a.zoom=O,G()};c.addEventListener("mousemove",Ke),c.addEventListener("mousedown",vt),window.addEventListener("mousemove",At),window.addEventListener("mouseup",Bt),c.addEventListener("wheel",Et,{passive:!1}),c.addEventListener("contextmenu",Pt),I.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Ae([]),Z(),G()};for(let p=0;p<200;p++)he();Z(),G();let Ft=()=>F(!1);return window.addEventListener("mousedown",Ft),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),be.disconnect(),c.removeEventListener("mousemove",Ke),c.removeEventListener("mousedown",vt),window.removeEventListener("mousemove",At),window.removeEventListener("mouseup",Bt),c.removeEventListener("wheel",Et),c.removeEventListener("contextmenu",Pt),window.removeEventListener("mousedown",Ft)}},[t,o]),(0,n.useEffect)(()=>{A!==void 0&&D.current&&requestAnimationFrame(()=>D.current())},[A]),(0,e.jsxs)("div",{className:"me-graph",ref:h,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",i("nodes")," \xB7 ",o.length," ",i("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:i("search"),value:j,onChange:c=>Q(c.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>F(c=>!c),"aria-expanded":le,title:i("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",i("filterLabel")," ",U!=="all"||K||H?"\u25CF":"\u25BE"]}),le&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:c=>c.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${U==="all"&&!K?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{me("all"),X(!1)},children:i("all")}),Object.keys(_e).map(c=>(0,e.jsxs)("button",{type:"button",className:`lg${U===c?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>me(s=>s===c?"all":c),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[c]||_e[c]}}),i($e[c])]},c)),(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${K?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>X(c=>!c),children:["\u23F1 ",i("timeDim")]}),de.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:de.map(c=>(0,e.jsxs)("button",{type:"button",className:`lg${H===c.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>M(s=>s===c.tag?"":c.tag),title:c.tag,children:["#",c.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:c.n})]},c.tag))})]}),(U!=="all"||K||H)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{me("all"),X(!1),M("")},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:!!C,onChange:c=>x&&x(c.target.checked)}),i("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${K?" me-on":""}`,onClick:()=>X(c=>!c),children:i("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=k.current;if(c)try{c.toBlob(s=>{s&&ve({url:URL.createObjectURL(s),blob:s})},"image/png")}catch{}},children:i("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>D.current&&D.current(),children:i("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{q(null),me("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:k,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:ie,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)"}}),Y&&(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")}),f&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>W(null)}),f&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:f.x,top:f.y,zIndex:31},onMouseDown:c=>c.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{v.current({path:f.path,title:f.title}),W(null)},children:i("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{f.id&&(u.current.selectedId=f.id,q(f.id)),W(null);let c=u.current;c&&c.wake&&c.wake()},children:i("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(f.title||"")}catch{}W(null),pe(i("copied"))},children:i("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let c=u.current,s=c&&Array.isArray(c.multi)?c.multi.slice():[],E=f.id;if(E&&!s.includes(E)&&s.push(E),W(null),s.length<2){pe(i("mergeNeed"),!1);return}if(!window.confirm(i("mergeConfirm")))return;let se=N.current&&N.current(s);se&&se.then?se.then($=>$?pe(i("merged")):pe(i("mergeFail"),!1)).catch(()=>pe(i("mergeFail"),!1)):se&&pe(i("merged"))},children:i("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let c=f.path;W(null),window.confirm(i("deleteConfirm"))&&(async()=>{try{(T.current?await T.current(c):!1)?pe(i("deleted")):pe(i("deleteFail"),!1)}catch{pe(i("deleteFail"),!1)}})()},children:i("delete")})]}),we.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:[we.length," ",i("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=we.map(ge=>Ne[ge]).filter(Boolean).map(ge=>ge.title||ge.name).join(`
307
- `),E=new Blob([s],{type:"text/plain;charset=utf-8"}),se=URL.createObjectURL(E),$=document.createElement("a");$.href=se,$.download="memory-selected.txt",document.body.appendChild($),$.click(),document.body.removeChild($),setTimeout(()=>URL.revokeObjectURL(se),1e3),pe(we.length+i("exportedSel"))},children:i("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(we.length<2){pe(i("mergeNeed"),!1);return}let c=we.map(E=>Ne[E]?Ne[E].id:E);if(!window.confirm(i("mergeConfirm")))return;Ae([]);let s=u.current;s&&(s.multi=[]),fetch(`${_}/merge?paths=${encodeURIComponent(c.join(","))}`).then(E=>E.json()).then(E=>{E&&E.ok?pe(i("merged")):pe(i("mergeFail"),!1)}).catch(()=>pe(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 c=we.map(E=>Ne[E]?Ne[E].id:E);Ae([]);let s=u.current;s&&(s.multi=[]),(async()=>{let E=0;for(let se of c)try{(T.current?await T.current(se):!1)&&E++}catch{}pe(E+i("deletedSelected"),E>0)})()},children:i("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=u.current;c&&(c.multi=[]),Ae([]);let s=u.current;s&&s.render&&s.render()},children:i("clearSelection")})]}),xe&&(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:Ne[xe]?Ne[xe].title||Ne[xe].name:xe}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:Ne[xe]?i($e[Ne[xe].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:i("graphHint")}),(o.filter(c=>c.source===xe||c.target===xe)||[]).slice(0,8).map((c,s)=>{let E=c.source===xe?c.target:c.source,se=Ne[E];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:$=>{$.preventDefault();let ge=u.current;ge&&(ge.selectedId=E,ge.hoverId=E,ge.wake&&ge.wake()),q(E)},children:se?(se.title||se.name).slice(0,28):E},s)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:i("graphTip")}),Ze&&(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 "+(Ze.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:Ze.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:Ze.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:Ze.msg})]}),Me&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{Me.url&&URL.revokeObjectURL(Me.url),ve(null),et(!1)},children:[(0,e.jsx)("style",{children:Fe}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Ce?"100vw":900,width:Ce?"100vw":"92vw",maxHeight:Ce?"100%":"90vh",height:Ce?"100%":void 0,borderRadius:Ce?0:14},onClick:c=>c.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:i("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:Me.url,download:"memory-graph.png",onClick:()=>{Ye("download"),pe(i("downloaded")+" \xB7 "+i("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:i(nt==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Ye("full"),et(c=>!c),pe(i("fullscreen"))},children:i(nt==="full"?"done":Ce?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=Me.blob;c&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":c})]).then(()=>{Ye("copy"),pe(i("copied"))}).catch(()=>{pe(i("copyFail"),!1)}):pe(i("copyFail"),!1)},children:i(nt==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Me.url&&URL.revokeObjectURL(Me.url),ve(null),et(!1)},children:i("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Ce?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:Me.url,alt:i("exportGraph"),style:{maxWidth:"100%",maxHeight:Ce?"calc(100% - 64px)":"70vh",borderRadius:Ce?0:8,cursor:"zoom-in"},onClick:()=>et(c=>!c)})})]})]})]})}function ja(t){let o=new Date(t||0).getTime();if(!o)return"#94a3b8";let r=(Date.now()-o)/864e5;return r<3?"#10b981":r<14?"#f59e0b":r<30?"#f97316":"#94a3b8"}function Yt({label:t,value:o=[],options:r,onChange:m,placeholder:d,z:i=20}){let[w,C]=(0,n.useState)(!1),x=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!w)return;let v=T=>{x.current&&!x.current.contains(T.target)&&C(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[w]);let A=Array.isArray(o)?o:[],k=A.includes("__all__"),h=k?r.find(v=>v.value==="__all__")?.label||"":A.length?A.map(v=>r.find(T=>T.value===v)?.label||v).join("\u3001"):"",u=(v,T)=>{if(v.value==="__all__"){m(T?["__all__"]:[]);return}let N=new Set(A);N.has("__all__")&&N.delete("__all__"),T?N.add(v.value):N.delete(v.value),m([...N])},D=r.find(v=>v.value==="__all__"),I=r.filter(v=>v.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t}),(0,e.jsxs)("div",{ref:x,style:{position:"relative",minWidth:0},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>C(v=>!v),style:{width:"100%",textAlign:"left",padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6},children:[(0,e.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h||d||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),w&&(0,e.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:i,marginTop:2,borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",boxShadow:"0 6px 20px rgba(0,0,0,0.14)",maxHeight:180,overflow:"auto"},children:[D&&(0,e.jsxs)("label",{onClick:v=>v.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("input",{type:"checkbox",checked:k,onChange:v=>u(D,v.target.checked)}),(0,e.jsx)("span",{children:D.label})]}),I.map(v=>(0,e.jsxs)("label",{onClick:T=>T.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:A.includes(v.value),onChange:T=>u(v,T.target.checked)}),(0,e.jsx)("span",{children:v.label})]},v.value))]})]})]})}function Oa(t){let o=new Date(t||0).getTime();return!!o&&(Date.now()-o)/864e5<3}async function Wa(t,o,r){if(r&&typeof window.showSaveFilePicker=="function")try{let i=await window.showSaveFilePicker({suggestedName:o}),w=await i.createWritable();return await w.write(t),await w.close(),{ok:!0,picked:!0,name:i.name}}catch(i){return i&&i.name==="AbortError"?{ok:!1,aborted:!0}:{ok:!1,err:String(i.message||i)}}let m=URL.createObjectURL(t),d=document.createElement("a");return d.href=m,d.download=o,document.body.appendChild(d),d.click(),document.body.removeChild(d),setTimeout(()=>URL.revokeObjectURL(m),1e3),{ok:!0,picked:!1,name:o}}function Gt(t,o){if(!o||!t)return t;let r=t.toLowerCase(),m=o.toLowerCase(),d=[],i=0;for(;i<t.length;){let w=r.indexOf(m,i);if(w<0){d.push(t.slice(i));break}w>i&&d.push(t.slice(i,w)),d.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(w,w+m.length)},w)),i=w+m.length}return d}function pt(t){if(!t)return"";let o=new Date(t);if(Number.isNaN(o.getTime()))return"";let r=new Date,m=o.toDateString()===r.toDateString(),d=w=>String(w).padStart(2,"0"),i=`${d(o.getHours())}:${d(o.getMinutes())}`;return m?i:`${o.getMonth()+1}-${o.getDate()} ${i}`}
305
+ `);let Te=new Blob([q],{type:Me}),Ve=await Wa(Te,ge,!1);if(!Ve.ok){K({ok:!1,msg:t("exportFail")}),$(!1);return}K({ok:!0,msg:t("exportedTo")+"\uFF1A"+t("defaultDownloads")+" \xB7 "+Ve.name})}catch(L){K({ok:!1,msg:t("exportFail")+" \xB7 "+(L.message||"")})}finally{$(!1)}X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2600)},A=async g=>{let x=g.target.files&&g.target.files[0];if(g.target.value="",!!x){try{let L=await x.text(),q=await(await fetch(`${_}/import`,{method:"POST",headers:{"Content-Type":"application/json"},body:L})).json();if(q.ok){await me();let ge=q.imported||0,Me=t("importedVault")+"\uFF1A"+ge;q.total&&(Me+=t("importedTotal")+q.total+t("importedTotalTail")),q.quarantined&&(Me+=t("importedQuarantine")+q.quarantined+t("importedQuarantineTail")),q.skipped&&(Me+=t("importedSkipped")+q.skipped+t("importedSkippedTail")),q.warning&&(Me+=" \xB7 "+q.warning),K({ok:ge>0||!q.total,msg:Me})}else K({ok:!1,msg:q.error||t("importFail")})}catch{K({ok:!1,msg:t("importFail")})}X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2400)}},F=(0,n.useMemo)(()=>{let g=M.slice();return J!=="all"&&(g=g.filter(x=>ut(x.submittedBy)===J)),V!=="all"&&(g=g.filter(x=>(x.status||"approved")===V)),j==="title"?g.sort((x,L)=>String(x.title||"").localeCompare(String(L.title||""))):j==="hot"?g.sort((x,L)=>(L.weight||L.links||0)-(x.weight||x.links||0)):g.sort((x,L)=>new Date(L.updated||0).getTime()-new Date(x.updated||0).getTime()),g},[M,j,J,V]),G=(0,n.useMemo)(()=>[...new Set(M.map(g=>ut(g.submittedBy)))],[M]);return(0,e.jsxs)("div",{className:"memory-eternal-root",style:{height:"100%",display:"flex",flexDirection:"column"},children:[(0,e.jsx)("style",{children:He}),te&&(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 "+(te.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:te.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:te.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{children:te.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)(Qt,{})}),(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(d?"exitFull":"fullscreen"),children:d?"\u2750":"\u26F6"}),(0,e.jsx)("button",{type:"button",className:"me-modal-close",onClick:r,"aria-label":t("close"),children:"\u2715"})]}),h&&h.ok===!1&&(0,e.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,margin:"0 0 8px",padding:"9px 14px",borderRadius:10,background:"rgba(239,68,68,0.10)",border:"1px solid rgba(239,68,68,0.45)",borderLeft:"4px solid #ef4444",color:"var(--dsw-alias-label-primary, #e5e7eb)",fontSize:12.5,lineHeight:1.6},children:[(0,e.jsxs)("span",{style:{fontWeight:800},children:["\u26A0 ",t("captureAlert")]}),(0,e.jsxs)("span",{style:{flex:1},children:[h.reason,(0,e.jsx)("div",{style:{opacity:.68,fontSize:11.5,marginTop:2},children:t("captureAlertHint")})]}),(0,e.jsx)("span",{style:{opacity:.7},children:h.since?pt(new Date(h.since).toISOString()):""})]}),(0,e.jsxs)("div",{className:"me-modal-body",children:[(0,e.jsxs)("div",{className:`mc-rail${we?" open":""}`,children:[(0,e.jsx)("button",{type:"button",className:"mc-rail-collapse",onClick:()=>Be(g=>!g),"aria-label":t(we?"collapse":"expand"),title:t(we?"collapse":"expand"),children:we?"\xAB":"\xBB"}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="cards"?" active":""}`,onClick:()=>y("cards"),title:t("cardsTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F9E0}"}),we&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("cardsTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="graph"?" active":""}`,onClick:()=>y("graph"),title:t("graphTab"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F52E}"}),we&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("graphTab")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="stats"?" active":""}`,onClick:()=>y("stats"),title:t("tabUsage"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F4C8}"}),we&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabUsage")})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="audit"?" active":""}`,onClick:()=>y("audit"),title:t("tabAudit"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F50D}"}),we&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabAudit")}),Ke>0&&(0,e.jsx)("span",{className:"mc-dot",children:Ke>99?"99+":Ke})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="optimize"?" active":""}`,onClick:()=>y("optimize"),title:t("tabRecycle"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u267B\uFE0F"}),we&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabRecycle")}),qe>0&&(0,e.jsx)("span",{className:"mc-dot",style:{background:"#6b7280"},children:qe>99?"99+":qe})]}),(0,e.jsxs)("button",{type:"button",className:`mc-railbtn${U==="config"?" active":""}`,onClick:()=>y("config"),title:t("tabConfig"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u2699\uFE0F"}),we&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("tabConfig")})]}),(0,e.jsxs)("button",{type:"button",className:"mc-railbtn",onClick:()=>De(!0),title:t("fbNav"),children:[(0,e.jsx)("span",{className:"mc-rail-ico",children:"\u{1F41E}"}),we&&(0,e.jsx)("span",{className:"mc-rail-label",children:t("fbNav")})]})]}),(0,e.jsxs)("div",{className:"mc-main",ref:ie,children:[U==="cards"&&(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsx)(dt,{label:t("total"),value:i?i.total:"\u2014"}),(0,e.jsx)(dt,{label:t("recent"),value:i?i.recent:"\u2014"}),(0,e.jsx)(dt,{label:t("tags"),value:i?i.tags:"\u2014"}),(0,e.jsx)(dt,{label:t("pending"),value:i?.quarantine?.pending??i?.status?.pending??0}),(0,e.jsx)(dt,{label:t("rejected"),value:i?.quarantine?.rejected??i?.status?.rejected??0}),(0,e.jsx)(dt,{label:t("cardCount"),value:i?i.byKind?.knowledge??0:"\u2014"})]}),U==="cards"&&(0,e.jsxs)("div",{className:"mc-toolbar",children:[(0,e.jsx)("input",{type:"text",placeholder:t("searchPlaceholder"),value:D,onChange:g=>be(g.target.value)}),(0,e.jsx)("input",{ref:oe,type:"file",accept:".json,application/json",style:{display:"none"},onChange:A}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>oe.current&&oe.current.click(),children:t("importVault")}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",onClick:()=>ze({kind:"knowledge",title:"",body:"",tags:"",template:""}),children:["+ ",t("newCard")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:b,onClick:()=>l("md"),children:t(b?"exporting":"exportVault")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:b,onClick:()=>l("json"),children:t(b?"exporting":"exportJson")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>me(),children:t("refresh")})]}),U==="cards"&&(0,e.jsxs)("div",{className:"mc-chips",children:[Lt.map(g=>(0,e.jsx)("button",{type:"button",className:`mc-chip${w===g?" active":""}`,onClick:()=>it(g),children:t(g==="all"?"all":_e[g])},g)),(0,e.jsxs)("select",{value:J,onChange:g=>ve(g.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")]}),Zt(G).map(g=>(0,e.jsx)("option",{value:g,children:g},g))]}),(0,e.jsxs)("select",{value:V,onChange:g=>Le(g.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(g=>(0,e.jsx)("button",{type:"button",className:`mc-chip${j===g.key?" active":""}`,onClick:()=>v(g.key),children:g.label},g.key))]}),z&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z]}),(0,e.jsx)("div",{style:{display:U==="cards"?"contents":"none"},children:E?(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}):z?(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",z," ",(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>me(),children:t("retry")})]}):M.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:F.map(g=>(0,e.jsx)(Ia,{card:g,t,query:D.trim(),onOpen:Ne,onDelete:a},g.path))}),M.length<Re&&(0,e.jsx)("div",{ref:B,style:{height:1}}),c&&(0,e.jsxs)("div",{className:"mc-empty",style:{padding:"10px 0"},children:[t("loading"),"\uFF08",M.length," / ",Re,"\uFF09"]})]})}),(0,e.jsx)("div",{style:{display:U==="graph"?"flex":"none",flex:1,minHeight:0},children:re.has("graph")&&(0,e.jsx)(Ea,{t,onOpen:Ne,all:ae,onAllChange:he,onMutate:at,active:U==="graph",visible:U==="graph"})}),(0,e.jsx)("div",{style:{display:U==="config"?"contents":"none"},children:re.has("config")&&(0,e.jsx)(ta,{t,onReload:()=>me(),version:Ce})}),(0,e.jsx)("div",{style:{display:U==="stats"?"contents":"none"},children:re.has("stats")&&(0,e.jsx)(La,{t,tab:"stats",onReload:()=>me(),version:Ce})}),(0,e.jsx)("div",{style:{display:U==="audit"?"contents":"none"},children:re.has("audit")&&(0,e.jsx)(Ta,{t,onReload:()=>me(),version:Ce})}),(0,e.jsx)("div",{style:{display:U==="optimize"?"contents":"none"},children:re.has("optimize")&&(0,e.jsx)(Ra,{t,onReload:()=>me(),version:Ce})}),Ae&&(0,e.jsx)(Ba,{t,onClose:()=>De(!1)}),se&&(0,e.jsx)(Pa,{t,card:se,query:D.trim(),onClose:()=>Y(null),onDelete:g=>{Y(null),a(g)},onFeedback:g=>{let x=se.path;fetch(`${_}/feedback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:D.trim(),path:x,useful:g})}).then(()=>K({ok:!0,msg:t(g?"fbUseful":"fbIrr")})).catch(()=>{}),X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2e3)}}),(0,e.jsx)(Aa,{t,newCard:Pe,setNewCard:ze,onCreated:()=>{me(),at(),K({ok:!0,msg:t("created")}),X.current&&clearTimeout(X.current),X.current=setTimeout(()=>K(null),2e3)}})]})]})]})}var ea=({toast:t})=>t?(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"8px 12px",fontSize:12,borderLeft:"4px solid "+(t.ok?"#10b981":"#ef4444"),background:t.ok?"rgba(16,185,129,0.08)":"rgba(239,68,68,0.08)"},children:[t.ok?"\u2705":"\u26A0"," ",t.msg]}):null,dt=({label:t,value:o})=>(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:o}),(0,e.jsx)("span",{children:t})]});function ta({t,onReload:o,version:r,compact:m}){let[d,i]=(0,n.useState)(null),[S,M]=(0,n.useState)(0),[k,E]=(0,n.useState)(null),[C,h]=(0,n.useState)(null),[u,z]=(0,n.useState)(!1),[I,w]=(0,n.useState)(!1),R=(0,n.useRef)(!1),D=(0,n.useRef)(null),O=(0,n.useRef)({}),[J,ve]=(0,n.useState)(null),[V,Le]=(0,n.useState)(null),[U,ue]=(0,n.useState)(""),[re,H]=(0,n.useState)(""),[y,j]=(0,n.useState)(""),[v,te]=(0,n.useState)(null),K=(0,n.useCallback)(async l=>{H("version");try{let A=await fetch(_+"/version-check"+(l?"?force=1":"")).then(F=>F.json());A&&A.ok?(te(A),l&&Y(A.updateAvailable?t("vcLatest")+" v"+A.latest:t("vcUpToDate"))):l&&Y(t("vcCheckFail"),!1)}catch{l&&Y(t("vcCheckFail"),!1)}finally{H("")}},[t]);(0,n.useEffect)(()=>{K(!1)},[r,K]);let[X,oe]=(0,n.useState)(""),[b,$]=(0,n.useState)(null),se=(0,n.useRef)(null),Y=(l,A=!0)=>{se.current&&clearTimeout(se.current),$({msg:l,ok:A}),se.current=setTimeout(()=>$(null),1900)},ae=async()=>{if(!re){H("restart");try{let l=await fetch(_+"/restart-self",{method:"POST"});if(l.status===404||l.status===405){Y(Pe("vcRestartNoRoute",{cmd:v&&v.restartCommand||"dsh-memory restart --port 7999"}),!1);return}let A=await l.json().catch(()=>null);if(!A){Y(t("vcRestartFail")+"\uFF08HTTP "+l.status+"\uFF09",!1);return}if(!A.ok){Y(A.error||t("vcRestartFail"),!1);return}if(A.alreadyCurrent){Y(A.note||t("vcRestartCurrent"));return}Y(A.note||t("vcRestartSent")),A.alreadyRunning||setTimeout(()=>{K(!0)},6e3)}catch(l){Y(t("vcRestartFail")+"\uFF1A"+String(l&&l.message||l),!1)}finally{H("")}}},he=v&&v.resident?String(v.resident.served||""):"",Ae=!!(v&&v.onDisk&&he&&he!==v.onDisk),De=!!(v&&v.resident&&v.resident.managed===!1),we=!!(v&&v.resident&&!he),Be=Ae||we||De,Pe=(l,A)=>Object.keys(A).reduce((F,G)=>F.split("{"+G+"}").join(A[G]),t(l)),ze=(0,n.useCallback)(async()=>{try{let[l,A,F]=await Promise.all([fetch(`${_}/config`).then(G=>G.json()).catch(()=>null),fetch(`${_}/setup-status`).then(G=>G.json()).catch(()=>null),fetch(`${_}/budget`).then(G=>G.json()).catch(()=>null)]);if(l&&l.ok){i(l),M(l.revision??0),E(l.schema??null);let G=qt(l.config??{},O.current);O.current=G.overlay,h({...G.values}),ve(l.dsh??null),z(l.writable===!1),w(l.viaPending===!0),ue(""),R.current=!1}else F&&F.ok?(h({...F}),z(!0),ue(t("configNeedsDsh"))):ue(t("adminLoadFail"));A&&A.ok&&Le(A),j("")}catch{ue(t("adminLoadFail"))}},[t]);(0,n.useEffect)(()=>{ze()},[r,ze]);let Ce=(l,A)=>{R.current=!0,h(F=>({...F??{},[l]:A}))};(0,n.useEffect)(()=>{D.current=ze},[ze]),(0,n.useEffect)(()=>{if(typeof EventSource>"u")return;let l=null;try{l=new EventSource(_+"/events")}catch{return}let A=()=>{!R.current&&typeof D.current=="function"&&D.current()};try{l.addEventListener("config",A)}catch{}return()=>{try{l.close()}catch{}}},[]);let tt=new Set(["dedupThreshold","captureMinChars","captureCooldownMs","maxCardsPerDay","captureMaxTokens","recallMinScore","recallLimit","recallSummaryLen","recycleRetentionDays","webPort","webCheckIntervalMs","webMaxRestart","sessionBudgetChars"]),at=l=>({init:t("modeInit"),interval:t("modeInterval"),manual:t("modeManual")})[l]||l,Ke=async()=>{if(!C)return;if(u){Y(t("editInSetting"),!1);return}let l={dedupThreshold:[0,1],captureMinChars:[0,1e6],captureCooldownMs:[0,1e9],maxCardsPerDay:[0,1e6],captureMaxTokens:[100,4e3],recallMinScore:[0,50],recallLimit:[1,20],recallSummaryLen:[40,400],recycleRetentionDays:[1,3650],webPort:[1,65535],webCheckIntervalMs:[1e3,6e5],webMaxRestart:[1,1e3],sessionBudgetChars:[0,1e9]},A=[];for(let[F,[G,g]]of Object.entries(l)){if(!(F in C))continue;let x=C[F],L=typeof x=="number"?x:Number(x);(x===""||x===null||x===void 0||!Number.isFinite(L)||L<G||L>g)&&A.push(t("invalidField",{field:F,min:G,max:g,value:String(x===""?"\u7A7A":x)}))}if(A.length){let F=t("saveInvalid")+"\uFF1A"+A.join("\uFF1B");ue(F),Y(F,!1);return}H("save");try{let F={...C};for(let L of Object.keys(C))L in F&&typeof F[L]=="string"&&F[L].trim()!==""&&tt.has(L)&&(F[L]=Number(F[L]));Array.isArray(F.vaultProfiles)&&(F.vaultProfiles=F.vaultProfiles.filter(L=>L&&(String(L.name||"").trim()||String(L.path||"").trim())));let G=await fetch(`${_}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:F,expectedRevision:S})}),g=await G.text(),x=null;try{x=g?JSON.parse(g):null}catch{x=null}if(x||(x={error:"HTTP "+G.status+(g?"\uFF1A"+g.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")}),x&&x.ok){let L=typeof x.pendingOutcome=="string"?x.pendingOutcome:"",ne,q=!0;if(L==="applied")ne=t("savedApplied")+(Array.isArray(x.applied)&&x.applied.length?" \xB7 "+x.applied.join("\u3001"):"");else if(L==="queued")q=!1,ne=t("saveQueued");else if(L==="failed")q=!1,ne=t("saveFail")+" \xB7 "+(x.hostGuard?t("saveHostGuard"):t("saveFailHint"));else if(L==="applied-direct")ne=t("savedOk")+" \xB7 "+t("savedDirect");else{let ge=Array.isArray(x.pending)&&x.pending.length?" \xB7 "+t("savePending"):x.note?" \xB7 "+t("restartHint"):"";ne=(x.retried?"\u267B ":"")+t("savedOk")+ge}O.current={...O.current,...F},q?j(ne):ue(ne),Y(ne,q),await ze()}else{let L=G.status===409?t("conflictRefresh"):x?.error||t("saveFail");ue(L),Y(L,!1)}}catch{ue(t("saveFail")),Y(t("saveFail"),!1)}finally{H("")}},qe=()=>{O.current={},h({...d?.config??{}}),j("")},de={env:"vaultSrcEnv",profile:"vaultSrcProfile",workspace:"vaultSrcWorkspace",vaultDir:"vaultSrcVaultDir",default:"vaultSrcDefault"},Re=l=>Array.isArray(l?.vaultProfiles)?l.vaultProfiles:[],ke=(l,A,F)=>h(G=>{let g=Re(G).map(L=>({...L||{}})),x={...g[l]||{}};return A==="match"?String(F).trim()?x.match={...x.match||{},workspace:F}:delete x.match:x[A]=F,g[l]=x,{...G??{},vaultProfiles:g}}),c=()=>h(l=>({...l??{},vaultProfiles:[...Re(l),{name:"",path:""}]})),s=l=>h(A=>({...A??{},vaultProfiles:Re(A).filter((F,G)=>G!==l)})),B={fontSize:11,padding:"2px 8px",background:"var(--dsw-alias-bg-layer-2, #f3f4f6)",borderRadius:6},ie={padding:"6px 8px",borderRadius:8,border:"1px solid var(--dsw-alias-border-l2, #d1d5db)",background:"transparent",color:"inherit",font:"inherit",fontSize:12,minWidth:0},ce={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}},me=async l=>{let A=ce[l];A&&h(F=>({...F??{},...A}))},a=async(l,A)=>{H(l+A);try{let G=await(await fetch(`${_}/mcp/action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:l,action:A})})).json();G&&G.ok?Y(Pe(A==="install"?"mcpInstalled":"mcpUninstalled",{agent:l})):Y(Pe("mcpActionFail",{agent:l,error:G?.error||""}),!1);try{let g=await fetch(`${_}/setup-status`).then(x=>x.json());g&&g.ok&&Le(g)}catch{}}catch{Y(t("mergeFail"),!1)}finally{H("")}},be=({k:l,label:A,type:F="text",step:G,min:g,max:x})=>(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:A||l}),(0,e.jsx)("input",{type:F,step:G,min:g,max:x,value:C?C[l]??"":"",onChange:L=>{let ne=L.target.value;Ce(l,F==="number"?ne===""?"":Number(ne):ne)},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}})]}),it=new Set(["autoRestartOnDrift"]),Ne=({k:l,label:A})=>{let F=C?C[l]:void 0,G=F===void 0?it.has(l):!!F;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:G,onChange:g=>Ce(l,g.target.checked),style:{marginTop:2,flex:"0 0 auto"}}),(0,e.jsx)("span",{style:{whiteSpace:"normal",overflowWrap:"anywhere"},children:A||l})]})};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:He}),b&&(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 "+(b.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:b.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:b.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:b.msg})]}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[U&&(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 ",U]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:ze,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")]}),u&&(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")]}),y&&(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 ",y]}),d&&(d.version||d.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")}),d.version&&(0,e.jsxs)("code",{style:B,children:[t("vcLoaded")," v",d.version]}),v&&v.resident&&v.resident.served&&v.resident.served!==d.version&&(0,e.jsxs)("code",{style:B,children:[t("vcResident")," v",v.resident.served]}),v&&v.resident&&!v.resident.served&&(0,e.jsxs)("code",{style:{...B,color:"#b45309",fontWeight:600},children:[t("vcResident")," ",t("vcResidentDownShort")]}),v&&v.resident&&v.resident.served&&v.resident.managed===!1&&(0,e.jsxs)("code",{style:{...B,color:"#b45309",fontWeight:600},children:[t("vcResident")," v",v.resident.served," \xB7 ",t("vcResidentUnmanagedShort")]}),bt&&(0,e.jsxs)("code",{style:B,children:[t("vcPage")," v",bt]}),v&&v.onDisk&&(0,e.jsxs)("code",{style:B,children:[t("vcOnDisk")," v",v.onDisk]}),v&&v.latest&&(0,e.jsxs)("code",{style:B,children:[t("vcLatest")," v",v.latest]}),d.dsh?.vaultDir&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.6},children:["\u{1F4C1} ",d.dsh.vaultDir]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-btn",disabled:re==="version",onClick:()=>K(!0),children:re==="version"?t("checking"):"\u{1F504} "+t("vcCheck")})]}),v&&(v.stale||we||De)&&(0,e.jsxs)("div",{style:{marginTop:8,fontSize:11.5,color:"#b45309",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)",borderRadius:8,padding:"6px 10px"},children:[(0,e.jsxs)("div",{children:["\u26A0\uFE0F ",v.stale?Pe("vcStale",{disk:v.onDisk,loaded:v.loaded}):we?Pe("vcResidentDown",{port:v.resident&&v.resident.port||"",cmd:v.restartCommand||"dsh-memory restart --port 7999"}):Pe("vcResidentUnmanaged",{served:he,cmd:v.restartCommand||"dsh-memory restart --port 7999"})]}),Be?(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:6,flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!re,onClick:ae,children:re==="restart"?"\u23F3 "+t("vcRestarting"):"\u{1F504} "+t("vcRestart")}),v.restartCommand&&(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:v.restartCommand})]}):(0,e.jsxs)("div",{style:{marginTop:6,lineHeight:1.7},children:["\u2139\uFE0F ",t("vcHostStale"),v.restartCommand&&(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("code",{style:{fontSize:11,opacity:.75},children:v.restartCommand})]})]})]}),bt&&v&&v.onDisk&&bt!==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:bt,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]})]}),V&&V.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:V.agents.map(l=>(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:l.isDsh?t("dshHostLabel"):l.name}),l.isDsh&&l.version&&(0,e.jsxs)("span",{style:{marginLeft:6,fontSize:11,opacity:.5},children:["v",l.version]}),!l.installed&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6},children:["(",t("notInstalled"),")"]}),l.installed&&l.mcpConfigured===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#f59e0b"},children:["(",t("noMcpEntry"),")"]}),l.mcpConfigured===!0&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#10b981"},children:["\u2713 ",t("healthy")]}),l.mcpConfigured===!0&&l.mcpMatchesCurrentNode===!1&&(0,e.jsxs)("span",{style:{marginLeft:6,color:"#9ca3af",fontSize:10},children:["(",t("nodePathNote"),")"]}),l.isDsh&&(0,e.jsxs)("span",{style:{marginLeft:6,opacity:.6,fontSize:11},children:["(",t("recallTool"),": ",l.recallTool?t("enabled"):t("disabled"),")"]})]}),l.hook&&(0,e.jsxs)("span",{style:{fontSize:11,opacity:.7},children:["hook: ",l.hook]}),!l.isDsh&&l.installed&&l.mcpConfigured===!1&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!re,onClick:()=>a(l.name,"install"),children:t("installMcp")}),!l.isDsh&&l.installed&&l.mcpConfigured===!0&&(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!re,onClick:()=>{window.confirm(t("uninstallConfirm"))&&a(l.name,"uninstall")},children:t("uninstallMcp")})]},l.name))}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.55,marginTop:6},children:t("mcpSetupHint")}),X&&(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:X})})]}),C?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #3b82f6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8,flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F3AF} ",t("presetConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("presetHint")})]}),(0,e.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["A","B","C"].map(l=>(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>me(l),disabled:!!re,children:[l==="A"?"\u{1F7E2} ":l==="B"?"\u{1F4B0} ":"\u2B50 ",ce[l].label]},l))})]}),(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)(Ne,{k:"autoCapture",label:t("autoCapture")}),(0,e.jsx)(Ne,{k:"autoRecall",label:t("autoRecall")}),(0,e.jsx)(be,{k:"captureMinChars",label:t("captureMinChars"),type:"number"}),(0,e.jsx)(be,{k:"maxCardsPerDay",label:t("maxCardsPerDay"),type:"number"}),(0,e.jsx)(be,{k:"dedupThreshold",label:t("dedupThreshold"),type:"number",step:"0.01",min:"0",max:"1"}),(0,e.jsx)(be,{k:"recallLimit",label:t("recallLimit"),type:"number"}),(0,e.jsx)(be,{k:"recallSummaryLen",label:t("recallSummaryLen"),type:"number"}),(0,e.jsx)(Ne,{k:"recallIncludeBody",label:t("recallBody")}),(0,e.jsx)(be,{k:"secretHint",label:t("secretHint")}),(0,e.jsx)(be,{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:J?.vaultDir||"\u2014"}),J?.vaultName?`\uFF08${J.vaultName}\uFF09`:""," \xB7 ",t("vaultSource"),"\uFF1A",t(de[J?.vaultSource]||"vaultSrcDefault"),J?.workspace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("br",{}),t("vaultWorkspace"),"\uFF1A",(0,e.jsx)("code",{children:J.workspace})]}):null]}),Re(C).map((l,A)=>(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 1.5fr auto",gap:6,marginBottom:6},children:[(0,e.jsx)("input",{value:l.name||"",placeholder:t("vaultNamePh"),onChange:F=>ke(A,"name",F.target.value),style:ie,disabled:u}),(0,e.jsx)("input",{value:l.path||"",placeholder:t("vaultPathPh"),onChange:F=>ke(A,"path",F.target.value),style:ie,disabled:u}),(0,e.jsx)("input",{value:l.match&&l.match.workspace||"",placeholder:t("vaultMatchPh"),onChange:F=>ke(A,"match",F.target.value),style:ie,disabled:u}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>s(A),disabled:u,title:t("delete"),children:"\u2715"})]},A)),(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",flexWrap:"wrap",marginTop:4},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:c,disabled:u,children:["\uFF0B ",t("vaultAdd")]}),(0,e.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("vaultActive")}),(0,e.jsxs)("select",{value:C.activeVault||"",onChange:l=>Ce("activeVault",l.target.value),disabled:u,style:ie,children:[(0,e.jsx)("option",{value:"",children:t("vaultActiveNone")}),Re(C).filter(l=>l&&l.name).map(l=>(0,e.jsx)("option",{value:l.name,children:l.name},l.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)(Ne,{k:"enabled",label:t("enabledLabel")}),(0,e.jsx)(be,{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)(Ne,{k:"distillEnabled",label:t("distillEnabled")}),(0,e.jsx)(Ne,{k:"dedupByLLM",label:t("dedupByLLM")}),(0,e.jsx)(be,{k:"captureMaxTokens",label:t("captureMaxTokens"),type:"number"}),(0,e.jsx)(be,{k:"recallMinScore",label:t("recallMinScore"),type:"number"}),(0,e.jsx)(be,{k:"captureCooldownMs",label:t("captureCooldownMs"),type:"number"}),(0,e.jsx)(be,{k:"captureProvider",label:t("captureProvider")}),(0,e.jsx)(be,{k:"captureModel",label:t("captureModel")}),(0,e.jsx)(be,{k:"sessionBudgetChars",label:t("sessionBudgetChars"),type:"number"})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,padding:"12px 14px",borderLeft:"3px solid #8b5cf6"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("auditConfig")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsx)("span",{style:{fontSize:11,opacity:.6},children:t("auditHint")})]}),(0,e.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:8},children:[(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t("auditMode")}),(0,e.jsxs)("select",{value:C.auditMode??"all",onChange:l=>Ce("auditMode",l.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)(Yt,{label:t("auditExemptAgents"),value:C.auditExemptAgents||[],options:[{value:"__all__",label:t("allExempt")},...(V?.agents||[]).filter(l=>!l.isDsh).map(l=>({value:l.name,label:l.name}))],onChange:l=>Ce("auditExemptAgents",l)}),(0,e.jsx)(Yt,{label:t("auditExemptKinds"),value:C.auditExemptKinds||[],options:[{value:"__all__",label:t("allExempt")},...Lt.filter(l=>l!=="all").map(l=>({value:l,label:t(_e[l])}))],onChange:l=>Ce("auditExemptKinds",l)}),(0,e.jsx)(be,{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)(Ne,{k:"autoWeb",label:t("autoWeb")}),(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:3,fontSize:12},children:[(0,e.jsx)("span",{style:{opacity:.6},children:t("autoWebMode")}),(0,e.jsxs)("select",{value:C.autoWebMode??"init",onChange:l=>Ce("autoWebMode",l.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)(be,{k:"webPort",label:t("webPort"),type:"number"}),(0,e.jsx)(be,{k:"webCheckIntervalMs",label:t("webCheckIntervalMs"),type:"number"}),(0,e.jsx)(be,{k:"webMaxRestart",label:t("webMaxRestart"),type:"number"}),(0,e.jsx)(Ne,{k:"watchdogAutoSpawn",label:t("watchdogAutoSpawn")}),(0,e.jsx)(Ne,{k:"autoRestartOnDrift",label:t("autoRestartOnDrift")}),(0,e.jsx)(Ne,{k:"autoMcpSetup",label:t("autoMcpSetup")})]})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[re==="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,opacity:.75},children:["\u23F3 ",t("saving")]}),y&&re!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#10b981"},children:["\u2705 ",y]}),U&&re!=="save"&&(0,e.jsxs)("span",{style:{fontSize:11.5,color:"#b91c1c"},children:["\u26A0 ",U]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:qe,disabled:!!re,children:t("reset")}),(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",onClick:u?()=>Y(t("readonlyTitle")+"\uFF1A"+t("readonlyBody"),!1):Ke,disabled:re==="save",title:t(u?"readonlyBody":"saveConfig"),children:re==="save"?"\u23F3 "+t("saving"):u?"\u{1F512} "+t("readonlyBtn"):"\u{1F4BE} "+t("saveConfig")})]})]}):(0,e.jsx)("div",{style:{fontSize:12,opacity:.6},children:t("loading")})]})]})}function Ta({t,onReload:o,version:r}){let[m,d]=(0,n.useState)([]),[i,S]=(0,n.useState)([]),[M,k]=(0,n.useState)("all"),[E,C]=(0,n.useState)("all"),[h,u]=(0,n.useState)(""),[z,I]=(0,n.useState)(new Set),[w,R]=(0,n.useState)(""),[D,O]=(0,n.useState)(null),[J,ve]=(0,n.useState)("pending"),V=(b,$=!0)=>{O({msg:b,ok:$}),setTimeout(()=>O(null),3e3)},Le=[...new Set([...m,...i].map(b=>b.submittedBy).filter(Boolean))],U=(0,n.useCallback)(async()=>{try{let b=await fetch(`${_}/audit/list`).then($=>$.json());b.ok&&(d(b.pending||[]),S(b.rejected||[]),I(new Set),j(new Set),te({}))}catch{}},[]);(0,n.useEffect)(()=>{U()},[r,U]);let ue=(J==="pending"?m:i).filter(b=>{if(M!=="all"&&b.kind!==M||E!=="all"&&ut(b.submittedBy)!==E)return!1;if(h){let $=(b.created||"").slice(0,10);if($&&$!==h)return!1}return!0}),re=b=>I($=>{let se=new Set($);return se.has(b)?se.delete(b):se.add(b),se}),H=async(b,$)=>{let se=$||[...z];if(!se.length){V(t("noSelection"),!1);return}R("apply");let Y=t(b==="approved"?"toastApproved":b==="rejected"?"toastRejected":"toastCardDeleted");try{let ae=0;for(let he of se){let Ae=b==="approved"?"audit/approve":b==="rejected"?"audit/reject":"delete";try{(await fetch(_+"/"+Ae+"?path="+encodeURIComponent(he)+(b==="delete"?"&permanent=0":""))).ok||ae++}catch{ae++}}await U(),o&&o(),ae?V(t("toastFailed")+"\uFF08"+ae+"/"+se.length+"\uFF09",!1):V(Y+" "+se.length+" \u5F20")}catch(ae){V(t("toastFailed")+": "+String(ae&&ae.message||ae),!1)}finally{R("")}},[y,j]=(0,n.useState)(new Set),[v,te]=(0,n.useState)({}),K=b=>v[b]||{},X=async b=>{let $=b.path,se=!y.has($);if(j(Y=>{let ae=new Set(Y);return se?ae.add($):ae.delete($),ae}),!(!se||v[$])){te(Y=>({...Y,[$]:{loading:!0}}));try{let Y=b.status||(J==="pending"?"pending":"rejected"),ae=await fetch(`${_}/card?path=${encodeURIComponent($)}&status=${Y}`).then(he=>he.json());ae&&ae.ok?te(he=>({...he,[$]:{text:ae.text||""}})):te(he=>({...he,[$]:{error:ae&&ae.error||"HTTP"}}))}catch(Y){te(ae=>({...ae,[$]:{error:String(Y&&Y.message||Y)}}))}}},oe=[...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:He}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ea,{toast:D}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[(0,e.jsxs)("b",{style:{fontSize:12},children:["\u{1F6E1}\uFE0F ",t("tabAudit")]}),(0,e.jsx)("div",{style:{flex:1}}),(0,e.jsxs)("select",{value:M,onChange:b=>k(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("all")}),Lt.filter(b=>b!=="all").map(b=>(0,e.jsx)("option",{value:b,children:t(_e[b])},b))]}),(0,e.jsxs)("select",{value:E,onChange:b=>C(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"},children:[(0,e.jsx)("option",{value:"all",children:t("allAgents")}),Zt(Le).map(b=>(0,e.jsx)("option",{value:b,children:b},b))]}),(0,e.jsx)("input",{type:"date",value:h,onChange:b=>u(b.target.value),style:{fontSize:12,padding:"4px 8px",borderRadius:8,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"inherit",border:"1px solid var(--dsw-alias-border-l2, #d1d5db)"}})]}),(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${J==="pending"?" me-on":""}`,onClick:()=>ve("pending"),children:[t("pending"),"\uFF08",m.length,"\uFF09"]}),(0,e.jsxs)("button",{type:"button",className:`mc-btn${J==="rejected"?" me-on":""}`,onClick:()=>ve("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:ue.length>0&&oe.length===ue.length,onChange:b=>{b.target.checked?I(new Set(ue.map($=>$.path))):I(new Set)}})," ",t("selectAll")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn me-on",disabled:!oe.length||!!w,onClick:()=>H("approved"),children:["\u2713 ",t(J==="rejected"?"restore":"approve")]}),J==="pending"?(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!oe.length||!!w,onClick:()=>H("rejected"),children:["\u2715 ",t("reject")]}):(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!oe.length||!!w,onClick:()=>{window.confirm(t("recycleDeleteConfirm"))&&H("delete")},children:["\u{1F5D1} ",t("restoreDelete")]})]}),ue.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:ue.map(b=>{let $=K(b.path),se=y.has(b.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(b.path),onChange:()=>re(b.path)}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"0 6px"},title:t(se?"collapse":"expand"),"aria-expanded":se,onClick:()=>X(b),children:se?"\u25BE":"\u25B8"}),(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[b.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},title:t(se?"collapse":"expand"),onClick:()=>X(b),children:b.title}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:ut(b.submittedBy)}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:b.created?b.created.slice(0,16).replace("T"," "):"-"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6},children:b.kind}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,color:b.severity==="high"?"#f87171":"#9ca3af"},children:b.severity}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.6,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.reason||"-"}),J==="pending"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>H("approved",[b.path]),children:"\u2713"}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},onClick:()=>H("rejected",[b.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:()=>H("approved",[b.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"))&&H("delete",[b.path])},children:"\u{1F5D1}"})]})]}),se&&(0,e.jsxs)("div",{style:{padding:"2px 10px 12px 34px"},children:[$.loading&&(0,e.jsxs)("div",{style:{fontSize:12,opacity:.6},children:["\u23F3 ",t("loading")]}),$.error&&(0,e.jsxs)("div",{style:{fontSize:12,color:"#f87171"},children:["\u26A0 ",t("auditBodyFail"),"\uFF1A",$.error]}),$.text!=null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"md-meta",style:{marginBottom:6},children:[(0,e.jsxs)("span",{className:"md-chip md-chip-kind",style:{color:Ue[b.kind]||"#6B7280",borderColor:(Ue[b.kind]||"#6B7280")+"59",background:(Ue[b.kind]||"#6B7280")+"1a"},children:[ht[b.kind]||"\u{1F4CE}"," ",t(_e[b.kind]||"kindKnowledge")]}),(Array.isArray(b.tags)?b.tags:[]).slice(0,8).map(Y=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",Y]},Y)),!!b.reason&&(0,e.jsxs)("span",{className:"md-chip md-chip-st-warn",children:["\u2691 ",b.reason]})]}),(0,e.jsx)("div",{className:"md-doc",style:{maxHeight:340,overflow:"auto"},dangerouslySetInnerHTML:{__html:Tt(Ct($.text).body)}}),J==="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:()=>H("approved",[b.path]),children:["\u2713 ",t("approve")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!w,onClick:()=>H("rejected",[b.path]),children:["\u2715 ",t("reject")]})]})]})]})]},b.path)})}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:20,textAlign:"center"},children:t("noAuditItems")})]})]})}function Ra({t,onReload:o,version:r}){let[m,d]=(0,n.useState)([]),[i,S]=(0,n.useState)(""),[M,k]=(0,n.useState)(null),E=(u,z=!0)=>{k({msg:u,ok:z}),setTimeout(()=>k(null),3200)},C=(0,n.useCallback)(async()=>{try{let u=await fetch(`${_}/recycle/list`).then(z=>z.json());u.ok&&d(u.items||[])}catch{}},[]);(0,n.useEffect)(()=>{C()},[r,C]);let h=async(u,z)=>{let I=(m.find(w=>w.path===z)||{}).title||z;S(u+z);try{let R=await fetch(_+(u==="restore"?"/recycle/restore":"/recycle/purge")+"?path="+encodeURIComponent(z)),D=await R.json().catch(()=>null);await C(),o&&o(),R.ok&&(!D||D.ok!==!1)?E(t(u==="restore"?"toastRestored":"toastPurged")+"\uFF1A"+I):E(t("toastFailed")+"\uFF1A"+(D&&D.error||"HTTP "+R.status),!1)}catch(w){E(t("toastFailed")+"\uFF1A"+String(w&&w.message||w),!1)}finally{S("")}};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:He}),(0,e.jsxs)("div",{style:{overflow:"auto",padding:4},children:[(0,e.jsx)(ea,{toast:M}),(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()=>{S("purgeAll");try{let u=await fetch(_+"/recycle/purge-expired?days=0"),z=await u.json().catch(()=>null);await C(),E(u.ok?t("toastPurgedExpired")+(z&&z.purged!=null?"\uFF08"+z.purged+"\uFF09":""):t("toastFailed"),u.ok)}catch(u){E(t("toastFailed")+"\uFF1A"+String(u&&u.message||u),!1)}finally{S("")}},children:t("emptyRecycle")})]}),m.length?(0,e.jsx)("div",{className:"mc-card",style:{display:"flex",flexDirection:"column"},children:m.map(u=>(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:Ue[u.kind]||"#999"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.title}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:[t("deletedAt")," ",(u.deletedAt||"").slice(0,10)]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},disabled:!!i,onClick:()=>h("restore",u.path),children:t("restore")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px",color:"#f87171"},disabled:!!i,onClick:()=>{window.confirm(t("purgeConfirm"))&&h("purge",u.path)},children:t("purge")})]},u.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 Ia=({card:t,t:o,onOpen:r,query:m,onDelete:d})=>(0,e.jsxs)("article",{className:"mc-cardrow mc-card",onClick:()=>r(t),children:[(0,e.jsxs)("h4",{children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:Ue[t.kind]||Ue.other}}),(0,e.jsx)("span",{style:{marginRight:4},children:ht[t.kind]||"\u{1F4CE}"}),m?Gt(t.title,m):t.title,Oa(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?Gt(t.summary||"",m):t.summary||""}),t.tags.length>0&&(0,e.jsx)("div",{className:"mc-tags",children:t.tags.slice(0,4).map(i=>(0,e.jsxs)("span",{className:"mc-tag",children:["\u{1F3F7} ",i]},i))}),(0,e.jsxs)("footer",{children:[(0,e.jsxs)("span",{children:[ht[t.kind]||"\u{1F4CE}"," ",o(_e[t.kind])]}),(0,e.jsxs)("span",{style:{fontSize:10,opacity:.6},children:["\u{1F916} ",ut(t.submittedBy)]}),(0,e.jsxs)("span",{children:["\u{1F4C5} ",pt(t.updated)]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("button",{type:"button",className:"mc-card-del",title:o("delete"),onClick:i=>{i.stopPropagation(),window.confirm(o("deleteConfirm"))&&d&&d(t.path)},children:"\u{1F5D1}"})]})]});function La({t,tab:o,onReload:r,version:m}){let[d,i]=(0,n.useState)(null),[S,M]=(0,n.useState)(""),[k,E]=(0,n.useState)(null),[C,h]=(0,n.useState)(null),[u,z]=(0,n.useState)(null),[I,w]=(0,n.useState)([]),[R,D]=(0,n.useState)(""),[O,J]=(0,n.useState)(!1),ve=(0,n.useCallback)(async()=>{if(!(!k||!k.merge||!k.merge.length)&&window.confirm(t("mergeAllConfirm"))){D("merge");try{let y={},j=oe=>y[oe]===void 0?oe:y[oe]=j(y[oe]),v=(oe,b)=>{y[j(oe)]=j(b)},te=new Set;for(let oe of k.merge)te.add(oe.a.path),te.add(oe.b.path),v(oe.a.path,oe.b.path);let K={};for(let oe of te){let b=j(oe);(K[b]=K[b]||[]).push(oe)}let X=0;for(let oe of Object.values(K)){if(oe.length<2)continue;(await fetch(`${_}/merge?paths=${encodeURIComponent(oe.join(","))}`).then($=>$.json())).ok&&X++}await V(),r&&r()}catch{}D("")}},[k,V,r,t]);async function V(){try{let y=await Promise.all([fetch(`${_}/stats`),fetch(`${_}/budget`),fetch(`${_}/capture-log`),fetch(`${_}/cards?status=all&limit=30&agent=${yt}`)]),[j,v,te,K]=await Promise.all(y.map(X=>X.json()));j&&j.ok&&i(j),v&&v.ok&&h(v),te&&te.ok&&z(te),K&&K.ok&&w(K.cards||[]),M(!j||!j.ok?t("adminLoadFail"):"")}catch{M(t("adminLoadFail"))}}let Le=(0,n.useCallback)(async()=>{D("scan");try{let y=await fetch(`${_}/optimize`).then(j=>j.json());y.ok&&E(y)}catch{M(t("adminLoadFail"))}finally{D("")}},[t]);(0,n.useEffect)(()=>{V()},[m]);let U=async(y,j)=>{if(window.confirm(t("mergeConfirm")))try{(await fetch(`${_}/merge?paths=${encodeURIComponent(y+","+j)}`).then(te=>te.json())).ok&&(await V(),r&&r())}catch{}},ue=async y=>{if(window.confirm(t("deleteConfirm")))try{(await fetch(`${_}/delete?path=${encodeURIComponent(y)}`).then(v=>v.json())).ok&&(await V(),r&&r())}catch{}},re=["project","knowledge","content","prompt","business","tool","mistake"],H=({title:y,kind:j,updated:v,path:te})=>(0,e.jsxs)("li",{style:{display:"flex",alignItems:"center",gap:8,padding:"3px 4px",borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[j]||"#666"}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(v)}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>ue(te),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:He}),(0,e.jsxs)("div",{style:{overflow:"auto"},children:[S&&(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 ",S]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:V,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{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:()=>V(),children:["\u21BB ",t("refresh")]})]}),u?u.available===!1?(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,padding:"8px 0"},children:t("captureLogUnavailable")}):(u.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:(u.entries||[]).map((y,j)=>{let v=ka[y.action]||["\u2022","inherit"];return(0,e.jsxs)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.12)"},children:[(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:pt(y.time?new Date(y.time).toISOString():"")}),(0,e.jsxs)("td",{style:{padding:"4px 6px",whiteSpace:"nowrap",color:v[1],fontWeight:600},children:[v[0]," ",y.action]}),(0,e.jsx)("td",{style:{padding:"4px 6px"},children:y.reason||""}),(0,e.jsx)("td",{style:{padding:"4px 6px",opacity:.55,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y.preview||"",children:y.preview||""})]},j)})})})}):(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",I.length,"\uFF09"]}),I.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:I.map(y=>(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:Ue[y.kind]||Ue.other}}),(0,e.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.title}),y.status==="pending"&&(0,e.jsxs)("span",{className:"mc-status",style:{background:"#f59e0b"},children:["\u23F3 ",t("statusPending")]}),(0,e.jsx)("span",{style:{opacity:.55,fontSize:11},children:pt(y.updated)})]},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noCards")})]}),d&&(0,e.jsxs)(e.Fragment,{children:[d.trend&&d.trend.length>0&&(()=>{let y=d.trend,j=Math.max(...y.map(X=>X.count),1),v=260,te=50,K=v/y.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:v,height:te,style:{display:"block",width:"100%",height:50},children:y.map((X,oe)=>{let b=Math.round(X.count/j*(te-4));return(0,e.jsx)("rect",{x:oe*K+1,y:te-b,width:Math.max(K-2,2),height:b,rx:1.5,fill:X.count>0?"var(--dsw-alias-accent, #3b82f6)":"var(--dsw-alias-border-l1, #e5e7eb)",opacity:X.count>0?.85:.35},X.date)})})]})})(),(0,e.jsxs)("div",{className:"mc-stats",children:[(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.total}),(0,e.jsx)("span",{children:t("total")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.today}),(0,e.jsx)("span",{children:t("todayAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.week}),(0,e.jsx)("span",{children:t("weekAdd")})]}),(0,e.jsxs)("div",{className:"mc-stat mc-card",children:[(0,e.jsx)("b",{children:d.tags}),(0,e.jsx)("span",{children:t("tags")})]})]}),(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10},children:[(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("byKind")}),(0,e.jsx)("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:re.map(y=>(0,e.jsxs)("span",{style:{fontSize:12},children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[y]||"#666"}}),t(_e[y]),": ",d.byKind?.[y]||0]},y))})]}),C&&(C.budgetChars||C.recallLimit||C.embedding)&&(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,fontSize:12},children:[(0,e.jsx)("b",{children:t("budgetLabel")}),"\uFF1A",t("budgetChars")," ",(0,e.jsx)("b",{children:C.budgetChars||8e4})," \xB7 ",t("recallLimitLabel")," ",(0,e.jsx)("b",{children:C.recallLimit||5})," \xB7 ",t("embeddingLabel")," ",C.embedding?"ON":"OFF"]}),(0,e.jsxs)("div",{className:"mc-card",children:[(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("todayList"),"\uFF08",d.todayCards?.length||0,"\uFF09"]}),d.todayCards?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:d.todayCards.map(y=>(0,e.jsx)(H,{title:y.title,kind:y.kind,updated:y.updated,path:y.path},y.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:!!R,onClick:Le,children:R==="scan"?t("exporting"):"\u{1F50D} "+t("scanAndOrganize")}),k&&k.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!R,onClick:async()=>{if(window.confirm(t("oneClickOptimizeConfirm"))){D("oneclick");try{let y=JSON.stringify({cleanupStale:O}),v=await(await fetch(`${_}/optimize-execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:y})).json();v&&v.ok?(notify(`${t("oneClickOptimizeDone")}\uFF1A${v.plan.merged} ${t("optimizedMerged")}${O?` \xB7 ${v.plan.staleDeleted} ${t("optimizedStaleDeleted")}`:""}`),await V(),r&&r(),E(null)):notify(t("mergeFail"),!1)}catch{notify(t("mergeFail"),!1)}finally{D("")}}},children:R==="oneclick"?t("exporting"):"\u26A1 "+t("oneClickOptimize")}),k&&k.merge?.length>0&&(0,e.jsxs)("label",{style:{fontSize:11,opacity:.7,display:"flex",alignItems:"center",gap:4},children:[(0,e.jsx)("input",{type:"checkbox",checked:O,onChange:y=>J(y.target.checked)}),t("oneClickAlsoStale")]})]}),!k&&(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:10},children:t("scanHint")}),k&&(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"mc-card",style:{marginBottom:10,display:"flex",flexDirection:"column",gap:8},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(0,e.jsx)("b",{style:{fontSize:12},children:t("mergePairs")}),(0,e.jsx)("div",{className:"spacer",style:{flex:1}}),k.merge?.length>0&&(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:!!R,onClick:ve,children:t(R==="merge"?"exporting":"batchMerge")})]}),(0,e.jsx)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:t("mergePairs")}),k.merge?.length?(0,e.jsx)("ul",{style:{margin:"0 0 12px",padding:0,listStyle:"none"},children:k.merge.map((y,j)=>(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:[y.a.title," \u21C4 ",y.b.title]}),(0,e.jsxs)("span",{style:{opacity:.6},children:[Math.round(y.sim*100),"%"]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{padding:"2px 8px"},onClick:()=>U(y.a.path,y.b.path),children:t("mergeNow")})]},j))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12,marginBottom:12},children:t("noOptimize")}),(0,e.jsxs)("div",{style:{fontSize:12,fontWeight:700,marginBottom:6},children:[t("staleCards"),"\uFF08",k.stale?.length||0,"\uFF09"]}),k.stale?.length>0&&(0,e.jsx)("div",{style:{marginBottom:6},children:(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},disabled:!!R,onClick:async()=>{if(!window.confirm(t("deleteConfirm")))return;D("clean");let y=0;for(let j of k.stale)try{await fetch(`${_}/delete?path=${encodeURIComponent(j.path)}`),y++}catch{}D(""),notify(`${y} ${t("deletedStale")}`),await V(),r&&r()},children:t("cleanStale")})}),k.stale?.length?(0,e.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:k.stale.map(y=>(0,e.jsx)(H,{title:y.title,kind:"other",updated:y.updated,path:y.path},y.path))}):(0,e.jsx)("div",{style:{opacity:.6,fontSize:12},children:t("noOptimize")})]})})]})]})]})}var It=[{key:"decision",label:"tplDecision",kind:"knowledge",tagKey:"tplDecisionTags",bodyKey:"tplDecisionBody"},{key:"bug",label:"tplBug",kind:"mistake",tagKey:"tplBugTags",bodyKey:"tplBugBody"},{key:"meeting",label:"tplMeeting",kind:"content",tagKey:"tplMeetingTags",bodyKey:"tplMeetingBody"},{key:"weekly",label:"tplWeekly",kind:"content",tagKey:"tplWeeklyTags",bodyKey:"tplWeeklyBody"}];function Aa({t,newCard:o,setNewCard:r,onCreated:m}){if(!o)return null;let d=It.find(h=>h.key===o.template),i=o.body||(d?t(d.bodyKey):""),S=o.kind||(d?d.kind:"knowledge"),M=o.tags||(d?t(d.tagKey):""),k=o._creating,E=h=>{let u=It.find(z=>z.key===h);r(z=>({...z,template:h,kind:u?u.kind:z.kind,body:u?t(u.bodyKey):z.body,tags:u?t(u.tagKey):z.tags}))},C=async()=>{if(!(!o.title&&!i)){r(h=>({...h,_creating:!0}));try{(await fetch(`${_}/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o.title||t("untitled"),kind:S,tags:M.split(",").map(u=>u.trim()).filter(Boolean),body:i,source:"manual"})}).then(u=>u.json())).ok?(r(null),m&&m()):r(u=>({...u,_creating:!1}))}catch{r(u=>({...u,_creating:!1}))}}};return(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>r(null),children:[(0,e.jsx)("style",{children:He}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:600,width:"92vw",maxHeight:"85vh"},onClick:h=>h.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:t("newCard")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>r(null),children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10,overflow:"auto"},children:[(0,e.jsxs)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[It.map(h=>(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===h.key?" me-on":""}`,onClick:()=>E(h.key),children:t(h.label)},h.key)),(0,e.jsx)("button",{type:"button",className:`mc-btn${o.template===""?" me-on":""}`,onClick:()=>r(h=>({...h,template:"",body:"",tags:"",kind:"knowledge"})),children:t("tplBlank")})]}),(0,e.jsx)("select",{className:"mc-btn",value:S,onChange:h=>r(u=>({...u,kind:h.target.value})),style:{maxWidth:180,background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:["project","knowledge","content","prompt","business","tool","mistake"].map(h=>(0,e.jsx)("option",{value:h,style:{background:"var(--dsw-alias-bg-layer-1, #fff)",color:"var(--dsw-alias-label-primary, #111)"},children:h},h))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("cardTitle"),value:o.title||"",onChange:h=>r(u=>({...u,title:h.target.value}))}),(0,e.jsx)("input",{type:"text",className:"mc-btn",placeholder:t("tagsHint"),value:M,onChange:h=>r(u=>({...u,tags:h.target.value}))}),(0,e.jsx)("textarea",{className:"mc-btn",placeholder:t("cardBody"),value:i,onChange:h=>r(u=>({...u,body:h.target.value})),style:{minHeight:180,resize:"vertical",fontFamily:"inherit"}}),(0,e.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,e.jsx)("button",{type:"button",className:"mc-btn me-on",disabled:k,onClick:C,children:t(k?"exporting":"createCard")})})]})]})]})}async function Vt(t){let o=String(t||"");if(!o)return!1;try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(o),!0}catch{}try{let r=document.createElement("textarea");r.value=o,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();let m=!!(document.execCommand&&document.execCommand("copy"));return document.body.removeChild(r),m}catch{return!1}}function Ba({t,onClose:o}){let[r,m]=(0,n.useState)(""),[d,i]=(0,n.useState)(""),[S,M]=(0,n.useState)(""),[k,E]=(0,n.useState)(!0),[C,h]=(0,n.useState)(!1),[u,z]=(0,n.useState)(""),[I,w]=(0,n.useState)(""),R=(0,n.useRef)(null),D=(0,n.useRef)(null),O=()=>{let H=R.current;if(H)try{H.focus(),H.select()}catch{}},J=H=>{z(H),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>z(""),2400)};(0,n.useEffect)(()=>{let H=!0;return fetch(_+"/diagnostics").then(y=>y.json()).then(y=>{H&&(y&&y.ok?(i(String(y.diagnostics||"")),M(String(y.version||""))):h(!0))}).catch(()=>{H&&h(!0)}).finally(()=>{H&&E(!1)}),()=>{H=!1}},[]),(0,n.useEffect)(()=>{let H=y=>{y.key==="Escape"&&o()};return window.addEventListener("keydown",H),()=>{window.removeEventListener("keydown",H),D.current&&clearTimeout(D.current)}},[o]);let ve=(()=>{try{return String(navigator.language||"").toLowerCase().startsWith("en")?"en":"zh"}catch{return"zh"}})(),V=()=>{let H=r.trim().split(`
306
+ `)[0]||"",y=Ot({title:"[Bug] "+(H.slice(0,60)||"memory-eternal \u95EE\u9898"),body:Wt({description:r,diagnostics:d,version:S})});try{window.open(y,"_blank","noopener")}catch{J(t("fbCopyFail"))}},Le=async()=>{await Vt(d)?(w(""),J(t("fbCopiedDiag"))):(w(d),J(t("fbCopyManual")))},U=async()=>{let H=$t({lang:ve,description:r,diagnostics:d});await Vt(H)?(w(""),J(t("fbCopiedPrompt"))):(w(H),J(t("fbCopyManual")))},ue={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},re={margin:0,maxHeight:170,overflow:"auto",fontSize:11.5,lineHeight:1.55,padding:"8px 10px",borderRadius:10,background:"var(--dsw-alias-bg-layer-1, rgba(127,127,127,0.08))",whiteSpace:"pre-wrap"};return(0,e.jsxs)("div",{className:"me-overlay",onClick:o,children:[(0,e.jsx)("style",{children:He}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:720},onClick:H=>H.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:["\u{1F41E} ",t("fbTitle")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:o,children:t("close")})]}),(0,e.jsxs)("div",{className:"me-dialog-body",style:{display:"flex",flexDirection:"column",gap:10},children:[(0,e.jsx)("div",{style:{fontSize:12,opacity:.72,lineHeight:1.6},children:t("fbWhy")}),(0,e.jsx)("textarea",{value:r,onChange:H=>m(H.target.value),placeholder:t("fbDesc"),rows:5,style:ue}),(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:Le,disabled:!d,children:t("fbCopyDiag")})]}),(0,e.jsx)("pre",{style:re,children:k?t("fbLoading"):C?t("fbDiagFail"):d})]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>{if(!r.trim()){J(t("fbNeedDesc"));return}V()},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:U,children:["\u{1F916} ",t("fbCopyPrompt")]})]}),u&&(0,e.jsx)("div",{style:{fontSize:12,color:"var(--dsw-alias-brand-primary, #3b82f6)"},children:u}),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:O,children:t("fbSelectAll")})]}),(0,e.jsx)("textarea",{ref:R,readOnly:!0,value:I,rows:7,style:ue})]})]})]})]})}function Pa({t,card:o,query:r,onClose:m,onDelete:d,onFeedback:i}){(0,n.useEffect)(()=>{let R=D=>{D.key==="Escape"&&m()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[m]);let{meta:S,body:M}=(0,n.useMemo)(()=>Ct(o.text||""),[o.text]),k=R=>{let D=S.find(([O])=>String(O).toLowerCase()===R);return D?D[1]:""},E=jt(k("tags")),C=k("kind")||"knowledge",h=(k("status")||"approved").toLowerCase(),u=Ue[C]||"#6B7280",z=(M||"").length>460,[I,w]=(0,n.useState)(!0);return(0,e.jsxs)("div",{className:"me-overlay",onClick:m,children:[(0,e.jsx)("style",{children:He}),(0,e.jsxs)("div",{className:"me-dialog",onClick:R=>R.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsxs)("h3",{children:[(0,e.jsx)("span",{style:{marginRight:6},children:ht[C]||"\u{1F4CE}"}),o.title]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!0),children:["\u{1F44D} ",t("fbUseful")]}),(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>i&&i(!1),children:["\u{1F44E} ",t("fbNotUseful")]})]}),z&&(0,e.jsx)("button",{type:"button",className:"mc-btn","aria-expanded":I,onClick:()=>w(R=>!R),children:t(I?"collapse":"expand")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",style:{color:"#f87171"},onClick:()=>{window.confirm(t("deleteConfirm"))&&d&&d(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:u,borderColor:u+"59",background:u+"1a"},children:[ht[C]||"\u{1F4CE}"," ",t(_e[C]||"kindKnowledge")]}),(0,e.jsxs)("span",{className:"md-chip "+(h==="approved"?"md-chip-st-ok":h==="pending"?"md-chip-st-warn":"md-chip-st-bad"),children:[h==="approved"?"\u2705":h==="pending"?"\u23F3":"\u26D4"," ",t(h==="approved"?"statusApproved":h==="pending"?"statusPending":"statusRejected")]}),E.slice(0,8).map(R=>(0,e.jsxs)("span",{className:"md-chip md-chip-tag",children:["\u{1F3F7} ",R]},R)),!!k("updated")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F552} ",t("updated")," ",pt(k("updated"))]}),!!k("source")&&(0,e.jsxs)("span",{className:"md-chip md-date",children:["\u{1F4E5} ",k("source")]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:I?{}:{maxHeight:300,overflow:"hidden"},onClick:I?void 0:R=>{R.stopPropagation(),w(!0)},children:(0,e.jsx)("div",{className:"md-doc",dangerouslySetInnerHTML:{__html:Tt(M)}})}),!I&&(0,e.jsxs)("div",{className:"md-collapsed-hint",onClick:R=>{R.stopPropagation(),w(!0)},children:[t("expand")," \u2304"]})]})]})}function Ea({t,onOpen:o,all:r,onAllChange:m,onMutate:d,active:i,visible:S}){let[M,k]=(0,n.useState)(null),[E,C]=(0,n.useState)(""),h=(0,n.useRef)(!1),u=(0,n.useRef)(0),z=(0,n.useRef)(t);z.current=t;let I=(0,n.useCallback)(async()=>{try{h.current=!1;let O=await(await fetch(`${_}/graph${r?"?all=1":""}`)).json();O.ok?(k(O),C(""),h.current=!0):(k(null),C(O.error||t("error")))}catch(D){C(String(D&&D.message?D.message:D))}},[r,t]);(0,n.useEffect)(()=>{if(!i||h.current)return;let D=!0;return fetch(`${_}/graph${r?"?all=1":""}`).then(O=>O.json()).then(O=>{D&&(O.ok?(k(O),C(""),h.current=!0):(k(null),C(O.error||t("error"))))}).catch(O=>{D&&C(String(O&&O.message?O.message:O))}),()=>{D=!1}},[r,t,i]),(0,n.useEffect)(()=>{S&&M&&u.current++},[S,M]);let w=(0,n.useCallback)(async D=>{try{let J=await(await fetch(`${_}/delete?path=${encodeURIComponent(D)}`)).json();return J&&J.ok?(await I(),d&&d(),!0):!1}catch{return!1}},[I]),R=(0,n.useCallback)(async D=>{if(!D||D.length<2)return!1;try{let O=await fetch(`${_}/merge?paths=${encodeURIComponent(D.join(","))}`).then(J=>J.json());return O&&O.ok?(await I(),d&&d(),!0):!1}catch{return!1}},[I,d]);return(0,e.jsxs)("div",{className:"me-graph",children:[(0,e.jsx)("style",{children:He}),E&&(0,e.jsxs)("div",{className:"mc-empty",children:[t("error"),"\uFF1A",E]}),!M&&!E&&(0,e.jsx)("div",{className:"mc-empty",children:t("loading")}),M&&M.nodes.length===0&&(0,e.jsx)("div",{className:"mc-empty",children:t("emptyGraph")}),M&&M.nodes.length>0&&(0,e.jsx)(Ha,{nodes:M.nodes,edges:M.edges,onOpen:o,onDelete:w,onMerge:R,t,all:r,onAllChange:m,countLabel:`${M.nodes.length} ${t("nodes")} \xB7 ${Fa(M.edges)} ${t("edges")}`,fitTrigger:u.current})]})}function Fa(t){let o=new Set;for(let r of t||[])o.add([r.source,r.target].sort().join("|"));return o.size}var ct={colors:{project:"#3B82F6",knowledge:"#10B981",content:"#F59E0B",prompt:"#A855F7",business:"#EC4899",tool:"#06B6D4",mistake:"#EF4444",other:"#6B7280"},shapes:{project:"circle",knowledge:"circle",content:"rect",prompt:"diamond",business:"hexagon",tool:"circle",mistake:"diamond",other:"circle"}};function Ha({nodes:t,edges:o,onOpen:r,onDelete:m,onMerge:d,t:i,countLabel:S,all:M,onAllChange:k,fitTrigger:E}){let C=(0,n.useRef)(null),h=(0,n.useRef)(null),u=(0,n.useRef)(null),z=(0,n.useRef)(null),I=(0,n.useRef)(null),w=(0,n.useRef)(r);(0,n.useEffect)(()=>{w.current=r},[r]);let R=(0,n.useRef)(m);(0,n.useEffect)(()=>{R.current=m},[m]);let D=(0,n.useRef)(d);(0,n.useEffect)(()=>{D.current=d},[d]);let[O,J]=(0,n.useState)(""),[ve,V]=(0,n.useState)(null),Le=(0,n.useRef)("");(0,n.useEffect)(()=>{Le.current=O.trim().toLowerCase()},[O]),(0,n.useEffect)(()=>{let c=u.current;if(!c)return;let s=O.trim().toLowerCase();if(!s)return;let B=c.nodes.find(ie=>(ie.name||"").toLowerCase().includes(s));B&&(u.current.selectedId=B.id,V(B.id),c.panX=c.w/2-B.x*c.zoom,c.panY=c.h/2-B.y*c.zoom,c.render&&c.render())},[O]);let[U,ue]=(0,n.useState)("all"),[re,H]=(0,n.useState)(!1),y=(0,n.useRef)("all"),[j,v]=(0,n.useState)(""),te=(0,n.useRef)(""),[K,X]=(0,n.useState)(!1),oe=(0,n.useRef)(!1),[b,$]=(0,n.useState)(null);(0,n.useEffect)(()=>{y.current=U},[U]),(0,n.useEffect)(()=>{te.current=j},[j]),(0,n.useEffect)(()=>{oe.current=K},[K]);let se=(0,n.useMemo)(()=>{let c=new Map;for(let s of t)for(let B of s.tags||[]){let ie=String(B).trim();ie&&c.set(ie,(c.get(ie)||0)+1)}return[...c.entries()].sort((s,B)=>B[1]-s[1]).slice(0,24).map(([s,B])=>({tag:s,n:B}))},[t]),Y=(()=>{let c=O.trim().toLowerCase();return!!c&&!t.some(s=>(s.title||s.name||"").toLowerCase().includes(c)||String(s.kind||"").toLowerCase().includes(c)||String(_e[s.kind]||"").toLowerCase().includes(c))})();(0,n.useEffect)(()=>{let c=u.current;c&&c.wake&&c.wake()},[O]),(0,n.useEffect)(()=>{let c=u.current;c&&c.render&&c.render()},[U,j,K]);let ae=(0,n.useRef)(null),[he,Ae]=(0,n.useState)([]),[De,we]=(0,n.useState)(null),[Be,Pe]=(0,n.useState)(!1),[ze,Ce]=(0,n.useState)(null),[tt,at]=(0,n.useState)(""),Ke=(0,n.useRef)(null),qe=(0,n.useRef)(null),de=(c,s=!0)=>{Ke.current&&clearTimeout(Ke.current),Ce({msg:c,ok:s}),Ke.current=setTimeout(()=>Ce(null),1900)},Re=c=>{at(c),qe.current&&clearTimeout(qe.current),qe.current=setTimeout(()=>at(""),1600)};(0,n.useEffect)(()=>()=>{Ke.current&&clearTimeout(Ke.current),qe.current&&clearTimeout(qe.current)},[]);let ke=(0,n.useMemo)(()=>t.reduce((c,s)=>(c[s.id]=s,c),{}),[t]);return(0,n.useEffect)(()=>{let c=C.current;if(!c||t.length===0)return;let s=c.getContext("2d");if(!s)return;let B=Math.max(1,window.devicePixelRatio||1),ie=()=>document.documentElement.getAttribute("data-theme")==="dark",ce={};o.forEach(p=>{ce[p.source]=(ce[p.source]||0)+1,ce[p.target]=(ce[p.target]||0)+1});let me=Math.max(1,...Object.values(ce)),a={nodes:t.map(p=>({id:p.id,name:p.title||"",type:p.kind||"other",r:9+Math.min(10,(ce[p.id]||0)/me*8),x:0,y:0,vx:0,vy:0})),edges:o.map(p=>({sourceNodeId:p.source,targetNodeId:p.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:B,ctx:s,multi:[],marquee:null};a.domain=t,a.domainById=t.reduce((p,T)=>(p[T.id]=T,p),{}),a.nodes.forEach((p,T)=>{let N=T/a.nodes.length*Math.PI*2-Math.PI/2;p.x=Math.cos(N)*60,p.y=Math.sin(N)*60});let be=[...new Set(a.nodes.map(p=>p.type))];a.clustered=be.length>1,a.typeCenters={},be.forEach((p,T)=>{let N=T/be.length*Math.PI*2-Math.PI/2;a.typeCenters[p]={x:Math.cos(N)*160,y:Math.sin(N)*160}}),u.current=a;let it=0,Ne=0,l=()=>{let p=c.clientWidth,T=c.clientHeight;a.w=p,a.h=T,c.width=p*B,c.height=T*B,s.setTransform(B,0,0,B,0,0),(it===0||Ne===0)&&p>0&&T>0&&a.tickCount>0&&requestAnimationFrame(()=>L()),it=p,Ne=T};l();let A=new ResizeObserver(l);A.observe(c.parentElement);let F=(p,T)=>p&&p.length>T?p.slice(0,T)+"\u2026":p,G=(p,T,N,P)=>{if(s.beginPath(),P==="rect")s.rect(p-N,T-N*.75,N*2,N*1.5);else if(P==="diamond")s.moveTo(p,T-N),s.lineTo(p+N,T),s.lineTo(p,T+N),s.lineTo(p-N,T),s.closePath();else if(P==="hexagon"){for(let W=0;W<6;W++){let le=Math.PI/3*W-Math.PI/2,Z=p+N*Math.cos(le),Se=T+N*Math.sin(le);W===0?s.moveTo(Z,Se):s.lineTo(Z,Se)}s.closePath()}else s.arc(p,T,N,0,Math.PI*2)},g=new Map,x=(p,T)=>{let N=p+"|"+Math.round(T),P=g.get(N);if(!P){let W=parseInt(p.slice(1,3),16),le=parseInt(p.slice(3,5),16),Z=parseInt(p.slice(5,7),16);P=s.createRadialGradient(-T*.3,-T*.3,0,0,0,T*1.2),P.addColorStop(0,"rgba("+Math.min(255,W+70)+","+Math.min(255,le+70)+","+Math.min(255,Z+70)+",0.95)"),P.addColorStop(1,p),g.set(N,P)}return P},L=()=>{if(!a.nodes.length)return;let p=1/0,T=-1/0,N=1/0,P=-1/0;a.nodes.forEach(Oe=>{p=Math.min(p,Oe.x),T=Math.max(T,Oe.x),N=Math.min(N,Oe.y),P=Math.max(P,Oe.y)});let W=20,le=T-p+W*2,Z=P-N+W*2,Se=Math.min(a.w/le,a.h/Z);a.zoom=Math.max(.35,Math.min(1.8,Se)),a.panX=a.w/2-(p+T)/2*a.zoom,a.panY=a.h/2-(N+P)/2*a.zoom};z.current=L;let ne=()=>{s.clearRect(0,0,a.w,a.h),a.searchTerm=Le.current,a.kindFilter=y.current,a.timeMode=oe.current,a.tagFilter=te.current;let p=a.tagFilter,T=a.kindFilter,N=f=>String(f||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");s.save(),s.strokeStyle=ie()?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)",s.lineWidth=.5;for(let f=0;f<a.w;f+=24)s.beginPath(),s.moveTo(f,0),s.lineTo(f,a.h),s.stroke();for(let f=0;f<a.h;f+=24)s.beginPath(),s.moveTo(0,f),s.lineTo(a.w,f),s.stroke();s.restore(),s.save(),s.translate(a.panX,a.panY),s.scale(a.zoom,a.zoom);let P={};a.nodes.forEach(f=>P[f.id]=f);let W=a.nodes.length>40,le=W?1.5:.55,Z=a.selectedId||a.hoverId,Se=_t({panX:a.panX,panY:a.panY,zoom:a.zoom,w:a.w,h:a.h,margin:80}),Oe=(()=>{let f=(a.searchTerm||"").toLowerCase();if(!f)return null;let Q=[];for(let ee of a.nodes){let xe=(a.domainById[ee.id]||{}).kind||"other";if(((ee.name||"").toLowerCase().includes(f)||String(_e[xe]||"").toLowerCase().includes(f)||String(xe).toLowerCase().includes(f))&&Q.push(ee.id),Q.length>200)break}return Q})(),nt=Kt(a.nodes,{limit:Ut(a.nodes.length),focusId:Z,hoverId:a.hoverId,searchHits:Oe,degree:ce}),pe=new Map,ye=(f,Q)=>{let ee=f+"|"+Q,fe=pe.get(ee);return fe===void 0&&(s.font=f,fe=s.measureText(Q).width,pe.set(ee,fe)),fe},Ee=a.nodes.length<=250,We=new Map;a.edges.forEach(f=>{let Q=P[f.sourceNodeId],ee=P[f.targetNodeId];if(!Q||!ee||!Nt(Q.x,Q.y,10,Se)&&!Nt(ee.x,ee.y,10,Se))return;if(T!=="all"){let rt=a.domainById[f.sourceNodeId]&&a.domainById[f.sourceNodeId].kind,Ze=a.domainById[f.targetNodeId]&&a.domainById[f.targetNodeId].kind;if(rt!==T&&Ze!==T)return}if(p){let rt=a.domainById[f.sourceNodeId]&&(a.domainById[f.sourceNodeId].tags||[]).includes(p),Ze=a.domainById[f.targetNodeId]&&(a.domainById[f.targetNodeId].tags||[]).includes(p);if(!rt&&!Ze)return}let fe=ee.x-Q.x,xe=ee.y-Q.y,Ie=Math.sqrt(fe*fe+xe*xe)||1,Qe=W?12:18,et=-xe/Ie*Qe,xt=fe/Ie*Qe,wt=(Q.x+ee.x)/2+et,kt=(Q.y+ee.y)/2+xt,mt=ct.colors[a.domainById[Q.id]&&a.domainById[Q.id].kind||"other"],gt=Z&&(f.sourceNodeId===Z||f.targetNodeId===Z),Mt=Z?gt?.6:.08:W?.14:.24,Je=parseInt(mt.slice(1,3),16),ft=parseInt(mt.slice(3,5),16),Dt=parseInt(mt.slice(5,7),16),Ge=gt?1.6+(f.weight||1):.8+(f.weight||1)*.5,ot=Je+","+ft+","+Dt+","+Mt+","+Ge,$e=We.get(ot);$e||($e={path:new Path2D,stroke:"rgba("+Je+","+ft+","+Dt+","+Mt+")",width:Ge},We.set(ot,$e)),$e.path.moveTo(Q.x,Q.y),$e.path.quadraticCurveTo(wt,kt,ee.x,ee.y)}),We.forEach(f=>{s.strokeStyle=f.stroke,s.lineWidth=f.width,s.stroke(f.path)});let Fe=null;Z&&(Fe=new Set,a.edges.forEach(f=>{f.sourceNodeId===Z?Fe.add(f.targetNodeId):f.targetNodeId===Z&&Fe.add(f.sourceNodeId)}));let Xe=[];if(a.nodes.forEach(f=>{if(!Nt(f.x,f.y,f.r+2,Se))return;let Q=a.domainById[f.id]||{},ee=Q.kind||"other",fe=a.timeMode?ja(Q.updated):ct.colors[ee],xe=ct.shapes[ee],Ie=a.selectedId===f.id,Qe=a.hoverId===f.id,et=a.searchTerm||"",xt=!et||(f.name||"").toLowerCase().includes(et)||String(_e[ee]||"").toLowerCase().includes(et)||String(ee).toLowerCase().includes(et),wt=T==="all"||ee===T,kt=!p||(Q.tags||[]).includes(p),mt=Z&&f.id!==Z&&!(Fe&&Fe.has(f.id))||et&&!xt||!wt||!kt;s.save(),s.globalAlpha=mt?.08:1,(Ie||Qe)&&Ee&&(s.shadowColor=fe,s.shadowBlur=Ie?20:14),s.translate(f.x,f.y),G(0,0,f.r,xe),s.fillStyle=x(fe,f.r),s.fill(),s.restore(),Ie?(s.save(),G(f.x,f.y,f.r+3,xe),s.strokeStyle=fe,s.lineWidth=3,s.shadowColor=fe,s.shadowBlur=12,s.stroke(),s.restore()):Qe?(s.save(),G(f.x,f.y,f.r+2,xe),s.strokeStyle=fe,s.lineWidth=2,s.stroke(),s.restore()):et&&xt?(s.save(),G(f.x,f.y,f.r+2,xe),s.strokeStyle="#e11d48",s.lineWidth=2,s.stroke(),s.restore()):a.multi.indexOf(f.id)>=0&&(s.save(),G(f.x,f.y,f.r+2,xe),s.strokeStyle="#60a5fa",s.lineWidth=2,s.shadowColor="#60a5fa",s.shadowBlur=8,s.stroke(),s.restore());let gt=F(f.name,16);if((Ie||Qe||nt.has(f.id)&&a.zoom>le||!W&&a.zoom>.6)&&wt&&kt){let Je=1/a.zoom,ft="500 "+(12*Je).toFixed(1)+"px -apple-system,Segoe UI,sans-serif";s.font=ft;let Ge=ye(ft,gt)+16*Je,ot=18*Je,$e=f.y+f.r+8*Je,rt=!0;for(let Ze of Xe)if(f.x-Ge/2<Ze.x+Ze.w&&f.x+Ge/2>Ze.x&&$e<Ze.y+Ze.h&&$e+ot>Ze.y){rt=!1;break}if(!rt&&!Ie&&!Qe)return;Xe.push({x:f.x-Ge/2,y:$e,w:Ge,h:ot}),s.fillStyle=ie()?"rgba(30,30,35,0.92)":"rgba(255,255,255,0.92)",s.beginPath(),s.roundRect?s.roundRect(f.x-Ge/2,$e,Ge,ot,4*Je):s.rect(f.x-Ge/2,$e,Ge,ot),s.fill(),s.strokeStyle=ie()?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.08)",s.lineWidth=1*Je,s.stroke(),s.fillStyle=ie()?Ie||Qe?"#eee":"#bbb":Ie||Qe?"#111":"#444",s.textAlign="center",s.fillText(gt,f.x,$e+13*Je)}}),s.restore(),a.marquee){let f=a.marquee,Q=Math.min(f.sx,f.ex),ee=Math.min(f.sy,f.ey),fe=Math.abs(f.ex-f.sx),xe=Math.abs(f.ey-f.sy);s.save(),s.setLineDash([4,4]),s.strokeStyle="rgba(96,165,250,0.9)",s.lineWidth=1,s.fillStyle="rgba(96,165,250,0.12)",s.fillRect(Q,ee,fe,xe),s.strokeRect(Q,ee,fe,xe),s.restore()}if(a.hoverId&&ae.current){let f=a.domainById[a.hoverId],Q=a.nodes.find(function(ee){return ee.id===a.hoverId});if(f&&Q){let ee=a.edges.filter(function(Ie){return Ie.sourceNodeId===f.id||Ie.targetNodeId===f.id}).length,fe=Q.x*a.zoom+a.panX,xe=Q.y*a.zoom+a.panY;ae.current.style.display="block",ae.current.style.left=fe+14+"px",ae.current.style.top=xe-6+"px",ae.current.innerHTML="<b>"+N(f.title||f.name||"")+'</b><br/><span style="opacity:.8">'+N(f.kind||"")+" \xB7 "+tRef.current("connCount").replace("{n}",ee)+"</span>"}}else ae.current&&(ae.current.style.display="none")},q=()=>{a.running=!0,a.raf||(a.raf=requestAnimationFrame(Me))};a.wake=q,a.render=ne;let ge=()=>{let p=a.nodes.length;a.tickCount++;let N=.9-Math.min(.4,a.tickCount/1500),P=p>1e3?3e3:p>100?2e3:p>50?1200:800,W=p>100?.002:.005,le=p>1e3?.012:p>100?.005:.01,Z=p>1e3?6:p>200?12:24,Se={};a.nodes.forEach(pe=>Se[pe.id]=pe);for(let pe=0;pe<p;pe++){if(a.dragNode===a.nodes[pe])continue;let ye=a.nodes[pe],Ee=0,We=0;for(let f=0;f<p;f++){if(pe===f)continue;let Q=ye.x-a.nodes[f].x,ee=ye.y-a.nodes[f].y,fe=Math.sqrt(Q*Q+ee*ee)||1,xe=P/(fe*fe);Ee+=Q/fe*xe,We+=ee/fe*xe}if(a.clustered&&a.typeCenters[ye.type]){let f=a.typeCenters[ye.type];Ee+=(f.x-ye.x)*.006,We+=(f.y-ye.y)*.006}else Ee-=ye.x*le,We-=ye.y*le;let Fe=(ye.vx+Ee)*N,Xe=(ye.vy+We)*N;Fe=Math.max(-Z,Math.min(Z,Fe)),Xe=Math.max(-Z,Math.min(Z,Xe)),ye.vx=Fe,ye.vy=Xe}a.edges.forEach(pe=>{let ye=Se[pe.sourceNodeId],Ee=Se[pe.targetNodeId];if(!ye||!Ee)return;let We=Ee.x-ye.x,Fe=Ee.y-ye.y,Xe=Math.sqrt(We*We+Fe*Fe)||1,f=(Xe-100)*W,Q=We/Xe*f,ee=Fe/Xe*f;a.dragNode!==ye&&(ye.vx+=Q,ye.vy+=ee),a.dragNode!==Ee&&(Ee.vx-=Q,Ee.vy-=ee)});let Oe=0;a.nodes.forEach(pe=>{a.dragNode!==pe&&(pe.x+=pe.vx,pe.y+=pe.vy,Oe+=pe.vx*pe.vx+pe.vy*pe.vy)}),a.autoFitPending&&a.tickCount>45&&(a.autoFitPending=!1,L()),(p?Math.sqrt(Oe/p):0)<.05&&a.tickCount>60&&!a.dragNode?a.quietTicks=(a.quietTicks|0)+1:a.quietTicks=0},Me=()=>{if(a.running){try{ge(),ne()}catch{}if(a.quietTicks>30){a.raf=0;return}a.raf=requestAnimationFrame(Me)}},Te=(p,T)=>{let N=c.getBoundingClientRect();return{x:(p-N.left-a.panX)/a.zoom,y:(T-N.top-a.panY)/a.zoom}},Ve=p=>{let T=a.domainById[p];return!(!T||y.current!=="all"&&T.kind!==y.current||te.current&&!(T.tags||[]).includes(te.current))},je=(p,T,N)=>Math.max(T,Math.min(N,p)),Ye=p=>{a.mouseX=p.clientX,a.mouseY=p.clientY;let T=Te(p.clientX,p.clientY),N=null;for(let P=a.nodes.length-1;P>=0;P--){let W=a.nodes[P];if(!Ve(W.id))continue;let le=W.x-T.x,Z=W.y-T.y;if(le*le+Z*Z<W.r*W.r+36){N=W.id;break}}N!==a.hoverId&&(a.hoverId=N,q())},vt=p=>{if(p.button!==0)return;let T=Te(p.clientX,p.clientY),N=null;for(let P=a.nodes.length-1;P>=0;P--){let W=a.nodes[P];if(!Ve(W.id))continue;let le=W.x-T.x,Z=W.y-T.y;if(le*le+Z*Z<W.r*W.r+25){N=W;break}}if(p.shiftKey){if(N){a.shiftClick=N.id;return}a.marquee={sx:p.clientX,sy:p.clientY,ex:p.clientX,ey:p.clientY};return}a.dragStart={x:p.clientX,y:p.clientY,px:a.panX,py:a.panY},a.dragging=!1,a.dragNode=N||null,N&&(a.dragOffset={dx:N.x-T.x,dy:N.y-T.y})},At=p=>{if(a.marquee){a.marquee.ex=p.clientX,a.marquee.ey=p.clientY,q();return}if(!a.dragStart)return;let T=p.clientX-a.dragStart.x,N=p.clientY-a.dragStart.y;if(Math.abs(T)+Math.abs(N)>3&&(a.dragging=!0),a.dragNode){let P=Te(p.clientX,p.clientY);a.dragNode.x=P.x+a.dragOffset.dx,a.dragNode.y=P.y+a.dragOffset.dy,q()}else a.dragging&&(a.panX=je(a.dragStart.px+T,-1e5,1e5),a.panY=je(a.dragStart.py+N,-1e5,1e5),q())},Bt=p=>{if(a.marquee){let N=a.marquee;a.marquee=null;let P=c.getBoundingClientRect(),W=Math.min(N.sx,N.ex)-P.left,le=Math.max(N.sx,N.ex)-P.left,Z=Math.min(N.sy,N.ey)-P.top,Se=Math.max(N.sy,N.ey)-P.top,Oe=a.nodes.filter(nt=>{let pe=nt.x*a.zoom+a.panX,ye=nt.y*a.zoom+a.panY;return pe>=W&&pe<=le&&ye>=Z&&ye<=Se}).map(nt=>nt.id);a.multi=Oe,Ae(Oe),q();return}let T=a.dragStart&&!a.dragging;if(a.shiftClick){let N=a.shiftClick;a.shiftClick=null;let P=Array.isArray(a.multi)?a.multi.slice():[];P.includes(N)||P.push(N),a.multi=P,Ae(P),q();return}if(T){let N=Te(p.clientX,p.clientY),P=null;for(let W=a.nodes.length-1;W>=0;W--){let le=a.nodes[W];if(!Ve(le.id))continue;let Z=le.x-N.x,Se=le.y-N.y;if(Z*Z+Se*Se<le.r*le.r+20){P=le;break}}P?(a.selectedId=P.id,V(P.id),q()):(a.selectedId=null,a.hoverId=null,p.shiftKey||(a.multi=[],Ae([])),V(null),q())}a.dragStart=null,a.dragging=!1,a.dragNode=null},Pt=p=>{p.preventDefault();let T=Te(p.clientX,p.clientY),N=null;for(let P=a.nodes.length-1;P>=0;P--){let W=a.nodes[P];if(!Ve(W.id))continue;let le=W.x-T.x,Z=W.y-T.y;if(le*le+Z*Z<W.r*W.r+25){N=W;break}}if(N){let P=a.domainById[N.id];P&&$({x:p.clientX,y:p.clientY,id:N.id,path:P.id,title:P.title})}else $(null)},Et=p=>{p.preventDefault();let T=c.getBoundingClientRect(),N=(p.clientX-T.left-a.panX)/a.zoom,P=(p.clientY-T.top-a.panY)/a.zoom,W=Math.max(.3,Math.min(3,a.zoom*(p.deltaY<0?1.1:1/1.1)));a.panX=je(a.panX+N*(a.zoom-W),-1e5,1e5),a.panY=je(a.panY+P*(a.zoom-W),-1e5,1e5),a.zoom=W,q()};c.addEventListener("mousemove",Ye),c.addEventListener("mousedown",vt),window.addEventListener("mousemove",At),window.addEventListener("mouseup",Bt),c.addEventListener("wheel",Et,{passive:!1}),c.addEventListener("contextmenu",Pt),I.current=()=>{a.selectedId=null,a.hoverId=null,a.multi=[],Ae([]),L(),q()};for(let p=0;p<200;p++)ge();L(),q();let Ft=()=>H(!1);return window.addEventListener("mousedown",Ft),()=>{a.running=!1,a.raf&&cancelAnimationFrame(a.raf),A.disconnect(),c.removeEventListener("mousemove",Ye),c.removeEventListener("mousedown",vt),window.removeEventListener("mousemove",At),window.removeEventListener("mouseup",Bt),c.removeEventListener("wheel",Et),c.removeEventListener("contextmenu",Pt),window.removeEventListener("mousedown",Ft)}},[t,o]),(0,n.useEffect)(()=>{E!==void 0&&z.current&&requestAnimationFrame(()=>z.current())},[E]),(0,e.jsxs)("div",{className:"me-graph",ref:h,children:[(0,e.jsxs)("div",{className:"me-graph-toolbar",children:[(0,e.jsxs)("span",{className:"me-graph-count",children:[t.length," ",i("nodes")," \xB7 ",o.length," ",i("edges")]}),(0,e.jsx)("span",{className:"spacer",style:{flex:1}}),(0,e.jsx)("input",{type:"text",placeholder:i("search"),value:O,onChange:c=>J(c.target.value)}),(0,e.jsxs)("span",{style:{position:"relative",display:"inline-flex"},children:[(0,e.jsxs)("button",{type:"button",className:"mc-btn",onClick:()=>H(c=>!c),"aria-expanded":re,title:i("filterLabel"),style:{borderRadius:8},children:["\u{1F50D} ",i("filterLabel")," ",U!=="all"||K||j?"\u25CF":"\u25BE"]}),re&&(0,e.jsx)("div",{className:"me-graph-legend-pop",onMouseDown:c=>c.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${U==="all"&&!K?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>{ue("all"),X(!1)},children:i("all")}),Object.keys(Ue).map(c=>(0,e.jsxs)("button",{type:"button",className:`lg${U===c?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>ue(s=>s===c?"all":c),children:[(0,e.jsx)("span",{className:"mc-kind",style:{background:ct.colors[c]||Ue[c]}}),i(_e[c])]},c)),(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${K?" active":""}`,style:{justifyContent:"flex-start"},onClick:()=>X(c=>!c),children:["\u23F1 ",i("timeDim")]}),se.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:se.map(c=>(0,e.jsxs)("button",{type:"button",className:`lg${j===c.tag?" active":""}`,style:{color:"#ddd",padding:"2px 7px",fontSize:11},onClick:()=>v(s=>s===c.tag?"":c.tag),title:c.tag,children:["#",c.tag," ",(0,e.jsx)("span",{style:{opacity:.55},children:c.n})]},c.tag))})]}),(U!=="all"||K||j)&&(0,e.jsxs)("button",{type:"button",className:"lg lg-clear",style:{justifyContent:"flex-start",color:"#f87171"},onClick:()=>{ue("all"),X(!1),v("")},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:!!M,onChange:c=>k&&k(c.target.checked)}),i("crossVault")]}),(0,e.jsx)("button",{type:"button",className:`mc-btn${K?" me-on":""}`,onClick:()=>X(c=>!c),children:i("timeDim")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=C.current;if(c)try{c.toBlob(s=>{s&&we({url:URL.createObjectURL(s),blob:s})},"image/png")}catch{}},children:i("exportGraph")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>z.current&&z.current(),children:i("fit")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{V(null),ue("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:C,style:{width:"100%",height:"100%",display:"block",cursor:"grab"}}),(0,e.jsx)("div",{className:"me-graph-tooltip",ref:ae,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)"}}),Y&&(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")}),b&&(0,e.jsx)("div",{className:"me-graph-ctx-back",style:{position:"fixed",inset:0,zIndex:30},onMouseDown:()=>$(null)}),b&&(0,e.jsxs)("div",{className:"me-graph-ctxmenu",style:{position:"fixed",left:b.x,top:b.y,zIndex:31},onMouseDown:c=>c.stopPropagation(),children:[(0,e.jsx)("button",{type:"button",onClick:()=>{w.current({path:b.path,title:b.title}),$(null)},children:i("openCard")}),(0,e.jsx)("button",{type:"button",onClick:()=>{b.id&&(u.current.selectedId=b.id,V(b.id)),$(null);let c=u.current;c&&c.wake&&c.wake()},children:i("focusNeighbors")}),(0,e.jsx)("button",{type:"button",onClick:()=>{try{navigator.clipboard&&navigator.clipboard.writeText(b.title||"")}catch{}$(null),de(i("copied"))},children:i("copyName")}),(0,e.jsx)("button",{type:"button",onClick:()=>{let c=u.current,s=c&&Array.isArray(c.multi)?c.multi.slice():[],B=b.id;if(B&&!s.includes(B)&&s.push(B),$(null),s.length<2){de(i("mergeNeed"),!1);return}if(!window.confirm(i("mergeConfirm")))return;let ie=D.current&&D.current(s);ie&&ie.then?ie.then(ce=>ce?de(i("merged")):de(i("mergeFail"),!1)).catch(()=>de(i("mergeFail"),!1)):ie&&de(i("merged"))},children:i("merge")}),(0,e.jsx)("button",{type:"button",style:{color:"#f87171"},onClick:()=>{let c=b.path;$(null),window.confirm(i("deleteConfirm"))&&(async()=>{try{(R.current?await R.current(c):!1)?de(i("deleted")):de(i("deleteFail"),!1)}catch{de(i("deleteFail"),!1)}})()},children:i("delete")})]}),he.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:[he.length," ",i("nodes")]}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let s=he.map(me=>ke[me]).filter(Boolean).map(me=>me.title||me.name).join(`
307
+ `),B=new Blob([s],{type:"text/plain;charset=utf-8"}),ie=URL.createObjectURL(B),ce=document.createElement("a");ce.href=ie,ce.download="memory-selected.txt",document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),setTimeout(()=>URL.revokeObjectURL(ie),1e3),de(he.length+i("exportedSel"))},children:i("exportSel")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{if(he.length<2){de(i("mergeNeed"),!1);return}let c=he.map(B=>ke[B]?ke[B].id:B);if(!window.confirm(i("mergeConfirm")))return;Ae([]);let s=u.current;s&&(s.multi=[]),fetch(`${_}/merge?paths=${encodeURIComponent(c.join(","))}`).then(B=>B.json()).then(B=>{B&&B.ok?de(i("merged")):de(i("mergeFail"),!1)}).catch(()=>de(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 c=he.map(B=>ke[B]?ke[B].id:B);Ae([]);let s=u.current;s&&(s.multi=[]),(async()=>{let B=0;for(let ie of c)try{(R.current?await R.current(ie):!1)&&B++}catch{}de(B+i("deletedSelected"),B>0)})()},children:i("deleteSelected")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=u.current;c&&(c.multi=[]),Ae([]);let s=u.current;s&&s.render&&s.render()},children:i("clearSelection")})]}),ve&&(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:ke[ve]?ke[ve].title||ke[ve].name:ve}),(0,e.jsx)("div",{style:{opacity:.8,marginBottom:8},children:ke[ve]?i(_e[ke[ve].kind]||"kindKnowledge"):"\u2014"}),(0,e.jsx)("div",{style:{fontSize:11,opacity:.65,letterSpacing:".04em",marginBottom:6},children:i("graphHint")}),(o.filter(c=>c.source===ve||c.target===ve)||[]).slice(0,8).map((c,s)=>{let B=c.source===ve?c.target:c.source,ie=ke[B];return(0,e.jsx)("div",{style:{padding:"4px 6px",cursor:"pointer",borderRadius:6},onMouseDown:ce=>{ce.preventDefault();let me=u.current;me&&(me.selectedId=B,me.hoverId=B,me.wake&&me.wake()),V(B)},children:ie?(ie.title||ie.name).slice(0,28):B},s)})]})]}),(0,e.jsx)("div",{className:"me-graph-tip",children:i("graphTip")}),ze&&(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 "+(ze.ok?"#22c55e":"#ef4444"),maxWidth:"90vw"},children:[(0,e.jsx)("span",{style:{color:ze.ok?"#34d399":"#f87171",fontWeight:800,fontSize:15},children:ze.ok?"\u2713":"\u2715"}),(0,e.jsx)("span",{style:{wordBreak:"break-all"},children:ze.msg})]}),De&&(0,e.jsxs)("div",{className:"me-overlay",onClick:()=>{De.url&&URL.revokeObjectURL(De.url),we(null),Pe(!1)},children:[(0,e.jsx)("style",{children:He}),(0,e.jsxs)("div",{className:"me-dialog",style:{maxWidth:Be?"100vw":900,width:Be?"100vw":"92vw",maxHeight:Be?"100%":"90vh",height:Be?"100%":void 0,borderRadius:Be?0:14},onClick:c=>c.stopPropagation(),children:[(0,e.jsxs)("div",{className:"me-dialog-head",children:[(0,e.jsx)("h3",{children:i("exportGraph")}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("a",{className:"mc-btn",href:De.url,download:"memory-graph.png",onClick:()=>{Re("download"),de(i("downloaded")+" \xB7 "+i("defaultDownloads"))},style:{textDecoration:"none",display:"inline-flex",alignItems:"center"},children:i(tt==="download"?"done":"download")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{Re("full"),Pe(c=>!c),de(i("fullscreen"))},children:i(tt==="full"?"done":Be?"exitFull":"fullscreen")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{let c=De.blob;c&&window.ClipboardItem&&navigator.clipboard?navigator.clipboard.write([new window.ClipboardItem({"image/png":c})]).then(()=>{Re("copy"),de(i("copied"))}).catch(()=>{de(i("copyFail"),!1)}):de(i("copyFail"),!1)},children:i(tt==="copy"?"done":"copyImage")}),(0,e.jsx)("button",{type:"button",className:"mc-btn",onClick:()=>{De.url&&URL.revokeObjectURL(De.url),we(null),Pe(!1)},children:i("close")})]})]}),(0,e.jsx)("div",{className:"me-dialog-body",style:{display:"flex",justifyContent:"center",background:Be?"var(--dsw-alias-bg-base, #0b0d10)":"var(--dsw-alias-bg-base, #f3f4f6)"},children:(0,e.jsx)("img",{src:De.url,alt:i("exportGraph"),style:{maxWidth:"100%",maxHeight:Be?"calc(100% - 64px)":"70vh",borderRadius:Be?0:8,cursor:"zoom-in"},onClick:()=>Pe(c=>!c)})})]})]})]})}function ja(t){let o=new Date(t||0).getTime();if(!o)return"#94a3b8";let r=(Date.now()-o)/864e5;return r<3?"#10b981":r<14?"#f59e0b":r<30?"#f97316":"#94a3b8"}function Yt({label:t,value:o=[],options:r,onChange:m,placeholder:d,z:i=20}){let[S,M]=(0,n.useState)(!1),k=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!S)return;let w=R=>{k.current&&!k.current.contains(R.target)&&M(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[S]);let E=Array.isArray(o)?o:[],C=E.includes("__all__"),h=C?r.find(w=>w.value==="__all__")?.label||"":E.length?E.map(w=>r.find(R=>R.value===w)?.label||w).join("\u3001"):"",u=(w,R)=>{if(w.value==="__all__"){m(R?["__all__"]:[]);return}let D=new Set(E);D.has("__all__")&&D.delete("__all__"),R?D.add(w.value):D.delete(w.value),m([...D])},z=r.find(w=>w.value==="__all__"),I=r.filter(w=>w.value!=="__all__");return(0,e.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:12,minWidth:0},children:[(0,e.jsx)("span",{style:{opacity:.6,whiteSpace:"normal",overflowWrap:"anywhere",lineHeight:1.5},children:t}),(0,e.jsxs)("div",{ref:k,style:{position:"relative",minWidth:0},children:[(0,e.jsxs)("button",{type:"button",onClick:()=>M(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:h||d||"\u2014"}),(0,e.jsx)("span",{style:{fontSize:10,opacity:.7},children:"\u25BE"})]}),S&&(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:C,onChange:w=>u(z,w.target.checked)}),(0,e.jsx)("span",{children:z.label})]}),I.map(w=>(0,e.jsxs)("label",{onClick:R=>R.stopPropagation(),style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",cursor:"pointer"},children:[(0,e.jsx)("input",{type:"checkbox",checked:E.includes(w.value),onChange:R=>u(w,R.target.checked)}),(0,e.jsx)("span",{children:w.label})]},w.value))]})]})]})}function Oa(t){let o=new Date(t||0).getTime();return!!o&&(Date.now()-o)/864e5<3}async function Wa(t,o,r){if(r&&typeof window.showSaveFilePicker=="function")try{let i=await window.showSaveFilePicker({suggestedName:o}),S=await i.createWritable();return await S.write(t),await S.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),d=document.createElement("a");return d.href=m,d.download=o,document.body.appendChild(d),d.click(),document.body.removeChild(d),setTimeout(()=>URL.revokeObjectURL(m),1e3),{ok:!0,picked:!1,name:o}}function Gt(t,o){if(!o||!t)return t;let r=t.toLowerCase(),m=o.toLowerCase(),d=[],i=0;for(;i<t.length;){let S=r.indexOf(m,i);if(S<0){d.push(t.slice(i));break}S>i&&d.push(t.slice(i,S)),d.push((0,e.jsx)("mark",{className:"mc-hl",children:t.slice(S,S+m.length)},S)),i=S+m.length}return d}function pt(t){if(!t)return"";let o=new Date(t);if(Number.isNaN(o.getTime()))return"";let r=new Date,m=o.toDateString()===r.toDateString(),d=S=>String(S).padStart(2,"0"),i=`${d(o.getHours())}:${d(o.getMinutes())}`;return m?i:`${o.getMonth()+1}-${o.getDate()} ${i}`}
308
308
 
309
309
  return module.exports;
310
310
  },