@geminilight/mindos 0.6.49 → 0.6.50

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.
Files changed (128) hide show
  1. package/_standalone/.mindos-build-version +1 -1
  2. package/_standalone/.next/BUILD_ID +1 -1
  3. package/_standalone/.next/app-path-routes-manifest.json +22 -22
  4. package/_standalone/.next/build-manifest.json +2 -2
  5. package/_standalone/.next/cache/.previewinfo +1 -1
  6. package/_standalone/.next/cache/.rscinfo +1 -1
  7. package/_standalone/.next/cache/config.json +3 -3
  8. package/_standalone/.next/prerender-manifest.json +3 -3
  9. package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
  10. package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/_standalone/.next/server/app/_global-error.html +2 -2
  12. package/_standalone/.next/server/app/_global-error.rsc +1 -1
  13. package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  16. package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  17. package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  18. package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  19. package/_standalone/.next/server/app/_not-found/page.js +1 -1
  20. package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  21. package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
  23. package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
  24. package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
  25. package/_standalone/.next/server/app/agents/page.js +1 -1
  26. package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
  27. package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  28. package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
  29. package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
  30. package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
  31. package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
  32. package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
  33. package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
  34. package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
  35. package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
  36. package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
  37. package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
  38. package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
  39. package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
  40. package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
  41. package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
  42. package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
  43. package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
  44. package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
  45. package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
  46. package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
  47. package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
  48. package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  49. package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  50. package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
  51. package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  52. package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
  53. package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  54. package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
  55. package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
  56. package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
  57. package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
  58. package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
  59. package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
  60. package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
  61. package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
  62. package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  63. package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  64. package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
  65. package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
  66. package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  67. package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
  68. package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
  69. package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
  70. package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
  71. package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
  72. package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
  73. package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  74. package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  75. package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
  76. package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
  77. package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  78. package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
  79. package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
  80. package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  81. package/_standalone/.next/server/app/changes/page.js +1 -1
  82. package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
  83. package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
  84. package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
  85. package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
  86. package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
  87. package/_standalone/.next/server/app/echo/page.js +1 -1
  88. package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
  89. package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
  90. package/_standalone/.next/server/app/explore/page.js +1 -1
  91. package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
  92. package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
  93. package/_standalone/.next/server/app/help/page.js +1 -1
  94. package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
  95. package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
  96. package/_standalone/.next/server/app/login/page.js +1 -1
  97. package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
  98. package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  99. package/_standalone/.next/server/app/page.js +1 -1
  100. package/_standalone/.next/server/app/page.js.nft.json +1 -1
  101. package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  102. package/_standalone/.next/server/app/setup/page.js +1 -1
  103. package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
  104. package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  105. package/_standalone/.next/server/app/trash/page.js +3 -3
  106. package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
  107. package/_standalone/.next/server/app/view/[...path]/page.js +1 -1
  108. package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
  109. package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
  110. package/_standalone/.next/server/app-paths-manifest.json +22 -22
  111. package/_standalone/.next/server/chunks/{9986.js → 273.js} +2 -2
  112. package/_standalone/.next/server/chunks/4241.js +28 -28
  113. package/_standalone/.next/server/next-font-manifest.js +1 -1
  114. package/_standalone/.next/server/next-font-manifest.json +1 -1
  115. package/_standalone/.next/server/pages/500.html +2 -2
  116. package/_standalone/.next/server/server-reference-manifest.js +1 -1
  117. package/_standalone/.next/server/server-reference-manifest.json +1 -1
  118. package/_standalone/.next/static/chunks/app/{layout-e49b880ef457bb2c.js → layout-5b51589d4eedab68.js} +9 -9
  119. package/_standalone/.next/static/chunks/app/page-9ba25963d955f3d4.js +7 -0
  120. package/_standalone/.next/static/chunks/app/trash/{page-c8bf8845e81cf112.js → page-20ee39622ea5047a.js} +1 -1
  121. package/_standalone/.next/static/chunks/app/view/[...path]/page-67c4bf985a579c77.js +12 -0
  122. package/_standalone/.next/trace +63 -63
  123. package/package.json +1 -1
  124. package/scripts/build-runtime-archive.sh +4 -1
  125. package/_standalone/.next/static/chunks/app/page-b3a7338f30362edb.js +0 -7
  126. package/_standalone/.next/static/chunks/app/view/[...path]/page-409e1b9baa22c66a.js +0 -12
  127. /package/_standalone/.next/static/{v1Q015tiqW8z0rkxr-Kpt → 2qUKZF7S693ZZWFgkTSUY}/_buildManifest.js +0 -0
  128. /package/_standalone/.next/static/{v1Q015tiqW8z0rkxr-Kpt → 2qUKZF7S693ZZWFgkTSUY}/_ssgManifest.js +0 -0
@@ -39,9 +39,9 @@ Be specific and actionable. Format in Markdown.`}(a,b,g)}],currentFile:c};h&&(i.
39
39
  hover:shadow-lg hover:shadow-amber-800/25
40
40
  active:scale-95 cursor-pointer overflow-hidden font-display
41
41
  ${b?"opacity-0 pointer-events-none translate-y-2":"opacity-100 translate-y-0"}
42
- `,style:{background:"linear-gradient(135deg, var(--amber), color-mix(in srgb, var(--amber) 80%, white))"},title:g,"aria-label":g,children:[(0,d.jsx)(e.A,{size:16,className:"relative z-10 shrink-0"}),(0,d.jsx)("span",{className:" relative z-10 max-w-0 group-hover:max-w-[120px] opacity-0 group-hover:opacity-100 transition-all duration-200 ease-out whitespace-nowrap overflow-hidden ",children:c.ask?.fabLabel??"Ask AI"})]})}},4140:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(48249),e=c(45231),f=c(13481);function g({title:a,children:b,maximized:c,onMaximize:g}){return(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 h-[46px] border-b border-border shrink-0",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider font-display",children:a}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[b,g&&(0,d.jsx)("button",{onClick:g,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":c?"Restore panel":"Maximize panel",children:c?(0,d.jsx)(e.A,{size:13}):(0,d.jsx)(f.A,{size:13})})]})]})}},4299:(a,b,c)=>{"use strict";c.d(b,{m:()=>e});let d=new Set(["write_file","create_file","batch_create_files","update_section","insert_after_heading","delete_file","rename_file","create_space"]);async function e(a,b,c){let e=a.getReader(),f=new TextDecoder,g="",h=[],i=new Map,j=null,k=null,l=Date.now();function m(){let a=h.map(a=>"text"===a.type?{type:"text",text:a.text}:"reasoning"===a.type?{type:"reasoning",text:a.text}:{...a});return{role:"assistant",content:a.filter(a=>"text"===a.type).map(a=>a.text).join(""),parts:a,timestamp:l}}try{for(;!c?.aborted;){let{done:a,value:c}=await e.read();if(a)break;let l=(g+=f.decode(c,{stream:!0})).split("\n");g=l.pop()??"";let n=!1;for(let a of l){let b,c=a.trim(),e=null;if(c.startsWith("data:")&&(e=c.slice(5).trim()),e){try{b=JSON.parse(e)}catch{continue}switch(b.type){case"text_delta":{let a=function(a){if(j===a){let a=h[h.length-1];if(a&&"text"===a.type)return a}let b={type:"text",text:""};return h.push(b),j=a,b}("text");a.text+=b.delta??"",n=!0;break}case"thinking_delta":k||(k={type:"reasoning",text:""},h.push(k),j=null),k.text+=b.delta??"",n=!0;break;case"tool_start":{let a=b.toolCallId,c=b.toolName,d=function(a,b){let c=i.get(a);return c||(c={type:"tool-call",toolCallId:a,toolName:b??"unknown",input:void 0,state:"pending"},i.set(a,c),h.push(c),j=null),c}(a,c);d.input=b.args,d.state="running",n=!0;break}case"tool_end":{let a=b.toolCallId,c=i.get(a);c&&(c.output=b.output??"",c.state=b.isError?"error":"done",n=!0,b.isError||d.has(c.toolName));break}case"error":{let a=b.message;h.push({type:"text",text:`
42
+ `,style:{background:"linear-gradient(135deg, var(--amber), color-mix(in srgb, var(--amber) 80%, white))"},title:g,"aria-label":g,children:[(0,d.jsx)(e.A,{size:16,className:"relative z-10 shrink-0"}),(0,d.jsx)("span",{className:" relative z-10 max-w-0 group-hover:max-w-[120px] opacity-0 group-hover:opacity-100 transition-all duration-200 ease-out whitespace-nowrap overflow-hidden ",children:c.ask?.fabLabel??"Ask AI"})]})}},3691:(a,b,c)=>{"use strict";c.d(b,{A:()=>r});var d=c(48249),e=c(67484),f=c(74429),g=c(46674),h=c(6079),i=c(31675),j=c(65032),k=c(40560),l=c(19099),m=c(33191),n=c(99829);let o=(0,n.createServerReference)("708caf5155e4436405af2923d84d65cee054f7d243",n.callServer,void 0,n.findSourceMapURL,"createSpaceAction");var p=c(93678),q=c(90826);function r({t:a,dirPaths:b}){let c=(0,l.useRouter)(),[n,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(""),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(null),[G,H]=(0,e.useState)(!0),I=(0,e.useRef)(null),J=(0,e.useCallback)(()=>{r(!1),t(""),v(""),x(""),B(""),D(""),F(null)},[]),K=(0,e.useCallback)(b=>b.includes("/")||b.includes("\\")?(D(a.home.spaceNameNoSlash??"Name cannot contain / or \\"),!1):(D(""),!0),[a]),L=(0,e.useMemo)(()=>{let a=s.trim();return a?(w?w+"/":"")+a+"/":""},[s,w]),M=(0,e.useCallback)(async()=>{if(!s.trim()||y||!K(s))return;z(!0),B("");let b=s.trim(),d=await o(b,u,w);if(d.success){let a=d.path??b;G&&E&&(0,p.V)(b,a,u),J(),c.refresh(),window.dispatchEvent(new Event("mindos:files-changed")),c.push(`/view/${(0,m.O0)(a+"/")}`)}else(d.error??"").includes("already exists")?B(a.home.spaceExists??"A space with this name already exists"):B(a.home.spaceCreateFailed??"Failed to create space");z(!1)},[s,u,w,y,J,c,a,K,G,E]),N=(0,e.useCallback)(a=>{"Escape"===a.key&&J(),"Enter"===a.key&&!a.shiftKey&&a.target instanceof HTMLInputElement&&(a.preventDefault(),M())},[J,M]);if(!n)return null;let O=a.home;return(0,f.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onKeyDown:N,children:[(0,d.jsx)("div",{className:"absolute inset-0 overlay-backdrop",onClick:J}),(0,d.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":O.newSpace,className:"relative w-full max-w-md mx-4 rounded-2xl border border-border bg-card shadow-xl",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-3",children:[(0,d.jsx)("h3",{className:"text-base font-semibold font-display text-foreground",children:O.newSpace}),(0,d.jsx)("button",{onClick:J,className:"p-1 rounded-md text-muted-foreground hover:bg-muted transition-colors",children:(0,d.jsx)(g.A,{size:14})})]}),(0,d.jsxs)("div",{className:"px-5 pb-5 flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:O.spaceLocation??"Location"}),(0,d.jsx)(q.A,{dirPaths:b,value:w,onChange:x,rootLabel:O.rootLevel??"Root"})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:O.spaceName}),(0,d.jsx)("input",{ref:I,type:"text",value:s,onChange:a=>{t(a.target.value),B(""),K(a.target.value)},placeholder:"e.g. \uD83D\uDCDD Notes",maxLength:80,"aria-invalid":!!C,"aria-describedby":C?"space-name-hint":void 0,className:`w-full px-3 py-2 text-sm rounded-lg border bg-background outline-none transition-colors ${C?"border-error focus:border-error":"border-border focus-visible:ring-1 focus-visible:ring-ring"}`}),C&&(0,d.jsx)("span",{id:"space-name-hint",className:"text-xs text-error",children:C})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsxs)("label",{className:"text-xs font-medium text-muted-foreground",children:[O.spaceDescription," ",(0,d.jsxs)("span",{className:"opacity-50",children:["(",O.optional??"optional",")"]})]}),(0,d.jsx)("input",{type:"text",value:u,onChange:a=>v(a.target.value),placeholder:O.spaceDescPlaceholder??"Describe the purpose of this space",maxLength:200,className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring transition-colors"})]}),(0,d.jsxs)("div",{className:"flex items-start gap-2.5 px-1 py-1",children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":G,disabled:!E,title:E?void 0:a.hints.configureAiKey,onClick:()=>H(a=>!a),className:`relative mt-0.5 inline-flex shrink-0 h-4 w-7 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 ${G?"bg-[var(--amber)]":"bg-muted"}`,children:(0,d.jsx)("span",{className:`pointer-events-none inline-block h-3 w-3 rounded-full bg-white shadow-sm transition-transform ${G?"translate-x-3":"translate-x-0"}`})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(h.A,{size:12,className:"text-[var(--amber)] shrink-0"}),(0,d.jsx)("span",{className:"text-xs font-medium text-foreground",children:O.aiInit??"AI initialize content"})]}),!1===E&&(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground mt-0.5 flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:10,className:"text-[var(--amber)] shrink-0"}),O.aiInitNoKey??"Configure an API key in Settings → AI to enable"]}),E&&G&&(0,d.jsx)("p",{className:"text-2xs text-muted-foreground mt-0.5",children:O.aiInitHint??"AI will generate README and INSTRUCTION for this space"})]})]}),L&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground font-mono px-1",children:[(0,d.jsx)(j.A,{size:12,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"truncate",children:L})]}),A&&(0,d.jsx)("span",{role:"alert",className:"text-xs text-error px-1",children:A}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-1",children:[(0,d.jsx)("button",{onClick:J,className:"px-4 py-2 rounded-lg text-sm font-medium text-muted-foreground transition-colors hover:bg-muted",children:O.cancelCreate}),(0,d.jsxs)("button",{onClick:M,disabled:!s.trim()||y||!!C,className:"flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",children:[y&&(0,d.jsx)(k.A,{size:14,className:"animate-spin"}),O.createSpace]})]})]})]})]}),document.body)}},4140:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(48249),e=c(45231),f=c(13481);function g({title:a,children:b,maximized:c,onMaximize:g}){return(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 h-[46px] border-b border-border shrink-0",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider font-display",children:a}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[b,g&&(0,d.jsx)("button",{onClick:g,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":c?"Restore panel":"Maximize panel",children:c?(0,d.jsx)(e.A,{size:13}):(0,d.jsx)(f.A,{size:13})})]})]})}},4299:(a,b,c)=>{"use strict";c.d(b,{m:()=>e});let d=new Set(["write_file","create_file","batch_create_files","update_section","insert_after_heading","delete_file","rename_file","create_space"]);async function e(a,b,c){let e=a.getReader(),f=new TextDecoder,g="",h=[],i=new Map,j=null,k=null,l=Date.now();function m(){let a=h.map(a=>"text"===a.type?{type:"text",text:a.text}:"reasoning"===a.type?{type:"reasoning",text:a.text}:{...a});return{role:"assistant",content:a.filter(a=>"text"===a.type).map(a=>a.text).join(""),parts:a,timestamp:l}}try{for(;!c?.aborted;){let{done:a,value:c}=await e.read();if(a)break;let l=(g+=f.decode(c,{stream:!0})).split("\n");g=l.pop()??"";let n=!1;for(let a of l){let b,c=a.trim(),e=null;if(c.startsWith("data:")&&(e=c.slice(5).trim()),e){try{b=JSON.parse(e)}catch{continue}switch(b.type){case"text_delta":{let a=function(a){if(j===a){let a=h[h.length-1];if(a&&"text"===a.type)return a}let b={type:"text",text:""};return h.push(b),j=a,b}("text");a.text+=b.delta??"",n=!0;break}case"thinking_delta":k||(k={type:"reasoning",text:""},h.push(k),j=null),k.text+=b.delta??"",n=!0;break;case"tool_start":{let a=b.toolCallId,c=b.toolName,d=function(a,b){let c=i.get(a);return c||(c={type:"tool-call",toolCallId:a,toolName:b??"unknown",input:void 0,state:"pending"},i.set(a,c),h.push(c),j=null),c}(a,c);d.input=b.args,d.state="running",n=!0;break}case"tool_end":{let a=b.toolCallId,c=i.get(a);c&&(c.output=b.output??"",c.state=b.isError?"error":"done",n=!0,b.isError||d.has(c.toolName));break}case"error":{let a=b.message;h.push({type:"text",text:`
43
43
 
44
- **Stream Error:** ${a}`}),j=null,n=!0}}}}n&&b(m())}}finally{e.releaseLock()}let n=!1;for(let a of i.values())("running"===a.state||"pending"===a.state)&&(a.state="error",a.output=a.output??"Stream ended before tool completed",n=!0);return n&&b(m()),m()}},4399:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});var d=c(99829);let e=(0,d.createServerReference)("40da7e6da869e4e3cf47bee1db443e0162fba48d8f",d.callServer,void 0,d.findSourceMapURL,"undoDeleteAction")},4452:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ay:()=>p,v5:()=>o});var e=c(48249),f=c(67484),g=c(74429),h=c(95581),i=c(42742),j=c(66336),k=c(44218),l=c(30315),m=c(98610),n=a([m]);m=(n.then?(await n)():n)[0];let q="mindos-provider-override";function o(){return null}function p({value:a,onChange:b,disabled:c=!1}){let{t:d,locale:n}=(0,l.Y)(),[o,p]=(0,f.useState)(!1),[r,s]=(0,f.useState)(null),t=(0,f.useRef)(null),u=(0,f.useRef)(null),[v,w]=(0,f.useState)(null),x=v?.ai?.provider&&(0,m.rl)(v.ai.provider)?v.ai.provider:"anthropic",y=(0,f.useMemo)(()=>v?function(a){let b=[],c=a.ai?.providers??{},d=a.envOverrides??{};for(let a of m.jt){let e=m.T_[a],f=c[a]?.apiKey==="***set***",g=(0,m.Ux)(a),h=!!g&&!!d[g];(f||h||e.apiKeyFallback)&&b.push(a)}return b}(v):[],[v]),z=a??x,A=m.T_[z],B=v?.ai?.providers?.[z]?.model||A.defaultModel,C="zh"===n?A.nameZh:A.name;(0,f.useCallback)(()=>{if(!t.current)return;let a=t.current.getBoundingClientRect(),b=a.top,c=window.innerHeight-a.bottom,d=b>c&&b>240?"up":"down";s({left:a.left,top:"up"===d?a.top-6:a.bottom+6,direction:d})},[]);let D=(0,f.useCallback)(a=>{b(a);try{a?localStorage.setItem(q,a):localStorage.removeItem(q)}catch{}p(!1)},[b]);if(!v||0===y.length)return null;let E=B.length>24?B.slice(0,22)+"…":B,F=o&&r?(0,e.jsxs)("div",{ref:u,role:"listbox","aria-label":d.ask.providerCapsule,className:"fixed z-50 min-w-[200px] max-w-[280px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:r.left,..."up"===r.direction?{bottom:window.innerHeight-r.top}:{top:r.top}},children:[(0,e.jsxs)("button",{type:"button",role:"option","aria-selected":null===a,onClick:()=>D(null),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,e.jsx)(h.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"font-medium",children:d.ask.providerDefault}),(0,e.jsxs)("div",{className:"text-2xs text-muted-foreground mt-0.5",children:["zh"===n?m.T_[x].nameZh:m.T_[x].name," \xb7 ",v?.ai?.providers?.[x]?.model||m.T_[x].defaultModel]})]}),null===a&&(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]}),y.length>0&&(0,e.jsx)("div",{className:"mx-2 my-1 border-t border-border/60"}),y.map(b=>{let c=m.T_[b],d="zh"===n?c.nameZh:c.name,f=v?.ai?.providers?.[b]?.model||c.defaultModel,g=a===b;return(0,e.jsxs)("button",{type:"button",role:"option","aria-selected":g,onClick:()=>D(b),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,e.jsx)(j.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"font-medium",children:d}),(0,e.jsx)("div",{className:"text-2xs text-muted-foreground mt-0.5 truncate",children:f})]}),g&&(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]},b)})]}):null;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{ref:t,type:"button",onClick:()=>{c||p(a=>!a)},disabled:c,className:`
44
+ **Stream Error:** ${a}`}),j=null,n=!0}}}}n&&b(m())}}finally{e.releaseLock()}let n=!1;for(let a of i.values())("running"===a.state||"pending"===a.state)&&(a.state="error",a.output=a.output??"Stream ended before tool completed",n=!0);return n&&b(m()),m()}},4452:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ay:()=>p,v5:()=>o});var e=c(48249),f=c(67484),g=c(74429),h=c(95581),i=c(42742),j=c(66336),k=c(44218),l=c(30315),m=c(98610),n=a([m]);m=(n.then?(await n)():n)[0];let q="mindos-provider-override";function o(){return null}function p({value:a,onChange:b,disabled:c=!1}){let{t:d,locale:n}=(0,l.Y)(),[o,p]=(0,f.useState)(!1),[r,s]=(0,f.useState)(null),t=(0,f.useRef)(null),u=(0,f.useRef)(null),[v,w]=(0,f.useState)(null),x=v?.ai?.provider&&(0,m.rl)(v.ai.provider)?v.ai.provider:"anthropic",y=(0,f.useMemo)(()=>v?function(a){let b=[],c=a.ai?.providers??{},d=a.envOverrides??{};for(let a of m.jt){let e=m.T_[a],f=c[a]?.apiKey==="***set***",g=(0,m.Ux)(a),h=!!g&&!!d[g];(f||h||e.apiKeyFallback)&&b.push(a)}return b}(v):[],[v]),z=a??x,A=m.T_[z],B=v?.ai?.providers?.[z]?.model||A.defaultModel,C="zh"===n?A.nameZh:A.name;(0,f.useCallback)(()=>{if(!t.current)return;let a=t.current.getBoundingClientRect(),b=a.top,c=window.innerHeight-a.bottom,d=b>c&&b>240?"up":"down";s({left:a.left,top:"up"===d?a.top-6:a.bottom+6,direction:d})},[]);let D=(0,f.useCallback)(a=>{b(a);try{a?localStorage.setItem(q,a):localStorage.removeItem(q)}catch{}p(!1)},[b]);if(!v||0===y.length)return null;let E=B.length>24?B.slice(0,22)+"…":B,F=o&&r?(0,e.jsxs)("div",{ref:u,role:"listbox","aria-label":d.ask.providerCapsule,className:"fixed z-50 min-w-[200px] max-w-[280px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:r.left,..."up"===r.direction?{bottom:window.innerHeight-r.top}:{top:r.top}},children:[(0,e.jsxs)("button",{type:"button",role:"option","aria-selected":null===a,onClick:()=>D(null),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,e.jsx)(h.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"font-medium",children:d.ask.providerDefault}),(0,e.jsxs)("div",{className:"text-2xs text-muted-foreground mt-0.5",children:["zh"===n?m.T_[x].nameZh:m.T_[x].name," \xb7 ",v?.ai?.providers?.[x]?.model||m.T_[x].defaultModel]})]}),null===a&&(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]}),y.length>0&&(0,e.jsx)("div",{className:"mx-2 my-1 border-t border-border/60"}),y.map(b=>{let c=m.T_[b],d="zh"===n?c.nameZh:c.name,f=v?.ai?.providers?.[b]?.model||c.defaultModel,g=a===b;return(0,e.jsxs)("button",{type:"button",role:"option","aria-selected":g,onClick:()=>D(b),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,e.jsx)(j.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"font-medium",children:d}),(0,e.jsx)("div",{className:"text-2xs text-muted-foreground mt-0.5 truncate",children:f})]}),g&&(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]},b)})]}):null;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{ref:t,type:"button",onClick:()=>{c||p(a=>!a)},disabled:c,className:`
45
45
  inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
46
46
  text-2xs font-medium transition-colors select-none
47
47
  border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
@@ -51,7 +51,16 @@ Be specific and actionable. Format in Markdown.`}(a,b,g)}],currentFile:c};h&&(i.
51
51
  relative flex items-center ${f?"justify-start px-3 w-full":"justify-center w-10"} h-10 rounded-md transition-colors
52
52
  ${e?"text-[var(--amber)] bg-[var(--amber-dim)]":"text-muted-foreground hover:text-foreground hover:bg-muted"}
53
53
  focus-visible:ring-2 focus-visible:ring-ring
54
- `,children:[e&&(0,d.jsx)("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-[2px] h-[18px] rounded-r-full bg-[var(--amber)]"}),(0,d.jsx)("span",{className:"shrink-0 flex items-center justify-center w-[18px]",children:a}),i,f&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"ml-2.5 text-sm whitespace-nowrap",children:b}),c&&(0,d.jsx)("span",{className:"ml-auto text-2xs text-muted-foreground/60 font-mono shrink-0",children:c})]})]})}function x({activePanel:a,onPanelChange:b,onEchoClick:c,onAgentsClick:f,onDiscoverClick:x,onWorkflowsClick:y,syncStatus:z,expanded:A,onExpandedChange:B,onSettingsClick:C,onSyncClick:D}){let E=(0,e.useRef)(0),F=(0,e.useRef)(null),{t:G}=(0,r.Y)(),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(()=>!1),[L,M]=(0,e.useState)(()=>!1),N=(0,e.useCallback)(a=>{let b=Date.now();b-E.current<300||(E.current=b,a())},[]),O=(0,e.useCallback)(c=>{N(()=>b(a===c?null:c))},[a,b,N]),P=(0,s.Bq)(z,!1),Q=A?v:u,R="off"!==P&&"synced"!==P?(0,d.jsx)("span",{className:`absolute ${A?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full ${s.BG[P]} ${"error"===P||"conflicts"===P?"animate-pulse":""}`}):void 0;return(0,d.jsxs)("aside",{className:"group hidden md:flex fixed top-0 left-0 h-screen z-[31] flex-col bg-background border-r border-border transition-[width] duration-200 ease-out",style:{width:`${Q}px`},role:"toolbar","aria-label":"Navigation","aria-orientation":"vertical",children:[(0,d.jsxs)("div",{className:"flex flex-col h-full w-full overflow-hidden",children:[(0,d.jsxs)(g(),{href:"/",className:`flex items-center ${A?"px-3 gap-2":"justify-center"} w-full h-[45px] shrink-0 hover:opacity-80 transition-opacity`,"aria-label":"MindOS Home",children:[(0,d.jsx)(t.A,{id:"rail",className:"w-7 h-3.5 shrink-0"}),A&&(0,d.jsx)("span",{className:"text-sm font-semibold text-foreground font-display whitespace-nowrap",children:"MindOS"})]}),(0,d.jsx)("div",{className:`${A?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsxs)("div",{className:`flex flex-col ${A?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,d.jsx)(w,{icon:(0,d.jsx)(h.A,{size:18}),label:G.sidebar.files,active:"files"===a,expanded:A,onClick:()=>O("files"),walkthroughId:"files-panel"}),J&&(0,d.jsx)(w,{icon:(0,d.jsx)(i.A,{size:18}),label:G.sidebar.echo,active:"echo"===a,expanded:A,onClick:()=>c?N(c):O("echo"),walkthroughId:"echo-panel"}),(0,d.jsx)(w,{icon:(0,d.jsx)(j.A,{size:18}),label:G.sidebar.searchTitle,shortcut:"⌘K",active:"search"===a,expanded:A,onClick:()=>O("search")}),(0,d.jsx)(w,{icon:(0,d.jsx)(k.A,{size:18}),label:G.sidebar.agents,active:"agents"===a,expanded:A,onClick:()=>f?N(f):O("agents"),walkthroughId:"agents-panel"}),L&&(0,d.jsx)(w,{icon:(0,d.jsx)(l.A,{size:18}),label:G.sidebar.workflows??"Flows",active:"workflows"===a,expanded:A,onClick:()=>y?N(y):O("workflows")})]}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsx)("div",{className:`${A?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsx)("div",{className:`flex flex-col ${A?"px-1.5":"items-center"} gap-1 py-2`,children:(0,d.jsx)(w,{icon:(0,d.jsx)(m.A,{size:18}),label:G.sidebar.discover,active:"discover"===a,expanded:A,onClick:()=>x?N(x):O("discover")})}),(0,d.jsx)("div",{className:`${A?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsxs)("div",{className:`flex flex-col ${A?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,d.jsx)(w,{icon:(0,d.jsx)(n.A,{size:18}),label:G.sidebar.settingsTitle,shortcut:"⌘,",expanded:A,onClick:()=>N(C),badge:H?(0,d.jsx)("span",{className:`absolute ${A?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full bg-error`}):void 0}),z?.enabled&&z?.remote&&"(not configured)"!==z.remote&&(0,d.jsx)(w,{icon:(0,d.jsx)(o.A,{size:18}),label:G.sidebar.syncLabel,expanded:A,buttonRef:F,badge:R,onClick:()=>N(()=>{let a=F.current?.getBoundingClientRect();a&&D(a)})})]})]}),(0,d.jsx)("button",{onClick:()=>B(!A),className:" absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-[32] w-5 h-5 rounded-full bg-card border border-border shadow-sm flex items-center justify-center opacity-0 group-hover:opacity-100 hover:!opacity-100 transition-opacity duration-200 text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring ","aria-label":A?"Collapse sidebar":"Expand sidebar",title:A?"Collapse":"Expand",children:A?(0,d.jsx)(p.A,{size:10}):(0,d.jsx)(q.A,{size:10})})]})}},5200:(a,b,c)=>{"use strict";function d({ssrLocale:a}){return null}c.d(b,{default:()=>d}),c(67484),c(30315)},5315:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/components/ShellLayout.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ShellLayout.tsx","default")},6596:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>m});var e=c(48249),f=c(67484),g=c(49681),h=c(44218),i=c(78835),j=c(98610),k=c(30315),l=a([j]);function m({value:a,onChange:b,showSkip:c=!1,compact:d=!1,configuredProviders:l}){let{locale:m}=(0,k.Y)(),[n,o]=(0,f.useState)(!1),p=(0,j.bf)(),q=c=>{let f=j.T_[c],h="zh"===m?f.nameZh:f.name,i=a===c,k=l?.has(c);return d?(0,e.jsxs)("button",{type:"button",onClick:()=>b(c),className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-left transition-all text-sm ${i?"border-[var(--amber)] bg-[var(--amber-subtle)] shadow-sm":"border-border/50 hover:border-border hover:bg-muted/30"}`,children:[(0,e.jsx)("span",{className:`font-medium ${i?"text-foreground":"text-muted-foreground"}`,children:h}),k&&!i&&(0,e.jsx)(g.A,{size:12,className:"text-success ml-auto shrink-0"}),i&&(0,e.jsx)(g.A,{size:14,className:"ml-auto shrink-0",style:{color:"var(--amber)"}})]},c):(0,e.jsxs)("button",{type:"button",onClick:()=>b(c),className:"flex items-start gap-3 p-4 rounded-xl border text-left transition-all duration-150",style:{background:i?"var(--amber-dim)":"var(--card)",borderColor:i?"var(--amber)":"var(--border)"},children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"text-sm font-medium",style:{color:"var(--foreground)"},children:h}),(0,e.jsx)("p",{className:"text-xs mt-0.5",style:{color:"var(--muted-foreground)"},children:f.defaultModel})]}),k&&!i&&(0,e.jsx)(g.A,{size:14,className:"text-success shrink-0 mt-0.5"}),i&&(0,e.jsx)(g.A,{size:16,className:"shrink-0 mt-0.5",style:{color:"var(--amber)"}})]},c)},{primary:r,more:s}=p;return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:d?"flex flex-wrap gap-2":"grid grid-cols-1 gap-2",children:r.map(q)}),s.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",onClick:()=>o(!n),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",children:[(0,e.jsx)(h.A,{size:12,className:`transition-transform ${n?"rotate-180":""}`}),n?"zh"===m?"收起":"Show less":"zh"===m?`更多 (${s.length})`:`More providers (${s.length})`]}),n&&(0,e.jsx)("div",{className:d?"flex flex-wrap gap-2":"grid grid-cols-1 gap-2",children:s.map(q)})]}),c&&(0,e.jsxs)("button",{type:"button",onClick:()=>b("skip"),className:"flex items-center gap-2 px-3 py-2 rounded-lg border text-left transition-all text-sm w-full mt-1",style:{background:"skip"===a?"var(--amber-dim)":"var(--card)",borderColor:"skip"===a?"var(--amber)":"var(--border)"},children:[(0,e.jsx)(i.A,{size:14,className:"shrink-0",style:{color:"skip"===a?"var(--amber)":"var(--muted-foreground)"}}),(0,e.jsx)("span",{className:`font-medium ${"skip"===a?"text-foreground":"text-muted-foreground"}`,children:"zh"===m?"暂时跳过":"Skip for now"}),"skip"===a&&(0,e.jsx)(g.A,{size:14,className:"ml-auto shrink-0",style:{color:"var(--amber)"}})]})]})}j=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},6732:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TimelineRenderer:()=>i});var d=c(48249),e=c(67484);let f=/(\d{4}[-/]\d{1,2}(?:[-/]\d{1,2})?|[A-Za-z]+ \d{4}|\d{4}年\d{1,2}月(?:\d{1,2}日)?)/;function g(a){return a.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="font-display" style="font-size:0.85em;padding:1px 5px;border-radius:4px;background:var(--muted)">$1</code>').replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(a,b,c)=>`<span style="color:var(--amber);cursor:pointer" title="${b}">${c??b}</span>`).replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" style="color:var(--amber)">$1</a>')}let h=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"#8ab4d8"},{bg:"rgba(200,160,216,0.12)",text:"#c8a0d8"}];function i({content:a}){let b=(0,e.useMemo)(()=>(function(a){let b=a.split("\n"),c=[],d=null,e=[],g=()=>{let a,b;if(!d)return;let f=e.join("\n").trim();d.body=f,d.tags=(a=[],(b=f.match(/#([\w\u4e00-\u9fff]+)/g))&&a.push(...b.map(a=>a.slice(1))),[...new Set(a)]),c.push(d),d=null,e=[]};for(let a of b)if(!/^# /.test(a)){if(/^## /.test(a)){g();let b=a.slice(3).trim();d={heading:b,date:function(a){let b=f.exec(a);if(!b)return null;let c=new Date(b[1].replace(/[/年月]/g,"-").replace("日",""));return isNaN(c.getTime())?null:c}(b),body:"",tags:[]};continue}d&&e.push(a)}return g(),c})(a),[a]);return 0===b.length?(0,d.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:["No timeline entries found. Add ",(0,d.jsx)("code",{style:{background:"var(--muted)",padding:"1px 6px",borderRadius:4},children:"## 2025-01-15"})," headings to create entries."]}):(0,d.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,d.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[b.length," ",1===b.length?"entry":"entries"]})}),(0,d.jsxs)("div",{style:{position:"relative",paddingLeft:28},children:[(0,d.jsx)("div",{style:{position:"absolute",left:6,top:8,bottom:8,width:1,background:"var(--border)"}}),b.map((a,b)=>(0,d.jsxs)("div",{style:{position:"relative",marginBottom:"1.5rem"},children:[(0,d.jsx)("div",{style:{position:"absolute",left:-22,top:10,width:9,height:9,borderRadius:"50%",background:a.date?"var(--amber)":"var(--border)",outline:a.date?"2px solid var(--amber-dim)":"none",zIndex:1}}),(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 18px",transition:"border-color .15s"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginBottom:8},children:[(0,d.jsx)("span",{style:{fontWeight:600,fontSize:"0.9rem",color:"var(--foreground)"},children:a.heading}),a.date&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.7rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0},children:a.date.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]}),a.body&&(0,d.jsx)("div",{dangerouslySetInnerHTML:{__html:function(a){let b=a.split("\n"),c=[],d=!1,e=()=>{d&&(c.push("</ul>"),d=!1)};for(let a of b){let b=a.trimEnd();if(!b){e(),c.push("<br/>");continue}if(/^### /.test(b)){e(),c.push(`<h3 style="font-size:0.8rem;font-weight:600;color:var(--muted-foreground);text-transform:uppercase;letter-spacing:.06em;margin:.9em 0 .3em">${g(b.slice(4))}</h3>`);continue}if(/^- /.test(b)||/^\* /.test(b)){d||(c.push('<ul style="margin:.3em 0;padding-left:1.2em;list-style:disc">'),d=!0),c.push(`<li style="margin:.15em 0;font-size:.82rem;color:var(--foreground)">${g(b.slice(2))}</li>`);continue}if(/^\d+\. /.test(b)){d||(c.push('<ol style="margin:.3em 0;padding-left:1.2em">'),d=!0),c.push(`<li style="margin:.15em 0;font-size:.82rem;color:var(--foreground)">${g(b.replace(/^\d+\. /,""))}</li>`);continue}e(),c.push(`<p style="margin:.25em 0;font-size:.82rem;line-height:1.6;color:var(--foreground)">${g(b)}</p>`)}return e(),c.join("")}(a.body)}}),a.tags.length>0&&(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:5,marginTop:10},children:a.tags.map(a=>{let b=function(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)&65535;return h[b%h.length]}(a);return(0,d.jsxs)("span",{className:"font-display",style:{fontSize:"0.68rem",padding:"1px 8px",borderRadius:999,background:b.bg,color:b.text},children:["#",a]},a)})})]})]},b))]})]})}},8278:(a,b,c)=>{Promise.resolve().then(c.bind(c,12978)),Promise.resolve().then(c.bind(c,24387)),Promise.resolve().then(c.bind(c,66913)),Promise.resolve().then(c.bind(c,66874)),Promise.resolve().then(c.bind(c,63112)),Promise.resolve().then(c.bind(c,60442)),Promise.resolve().then(c.bind(c,37718)),Promise.resolve().then(c.bind(c,45862)),Promise.resolve().then(c.bind(c,1394)),Promise.resolve().then(c.bind(c,18776)),Promise.resolve().then(c.bind(c,83539)),Promise.resolve().then(c.bind(c,5315)),Promise.resolve().then(c.bind(c,32248)),Promise.resolve().then(c.bind(c,68533)),Promise.resolve().then(c.bind(c,90598)),Promise.resolve().then(c.bind(c,31442))},10072:(a,b,c)=>{"use strict";c.d(b,{AI:()=>e,RS:()=>d});let d=["about-you","continued","daily","past-you","growth"],e={"about-you":"/echo/about-you",continued:"/echo/continued",daily:"/echo/daily","past-you":"/echo/past-you",growth:"/echo/growth"}},10500:(a,b,c)=>{"use strict";function d(){return null}c.d(b,{default:()=>d}),c(67484)},11197:(a,b,c)=>{"use strict";c.d(b,{A:()=>r});var d=c(48249),e=c(67484),f=c(74429),g=c(46674),h=c(6079),i=c(31675),j=c(65032),k=c(40560),l=c(19099),m=c(33191),n=c(99829);let o=(0,n.createServerReference)("708f81c9665d13ce628558cbad66af3b942dd763ad",n.callServer,void 0,n.findSourceMapURL,"createSpaceAction");var p=c(93678),q=c(90826);function r({t:a,dirPaths:b}){let c=(0,l.useRouter)(),[n,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(""),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(null),[G,H]=(0,e.useState)(!0),I=(0,e.useRef)(null),J=(0,e.useCallback)(()=>{r(!1),t(""),v(""),x(""),B(""),D(""),F(null)},[]),K=(0,e.useCallback)(b=>b.includes("/")||b.includes("\\")?(D(a.home.spaceNameNoSlash??"Name cannot contain / or \\"),!1):(D(""),!0),[a]),L=(0,e.useMemo)(()=>{let a=s.trim();return a?(w?w+"/":"")+a+"/":""},[s,w]),M=(0,e.useCallback)(async()=>{if(!s.trim()||y||!K(s))return;z(!0),B("");let b=s.trim(),d=await o(b,u,w);if(d.success){let a=d.path??b;G&&E&&(0,p.V)(b,a,u),J(),c.refresh(),window.dispatchEvent(new Event("mindos:files-changed")),c.push(`/view/${(0,m.O0)(a+"/")}`)}else(d.error??"").includes("already exists")?B(a.home.spaceExists??"A space with this name already exists"):B(a.home.spaceCreateFailed??"Failed to create space");z(!1)},[s,u,w,y,J,c,a,K,G,E]),N=(0,e.useCallback)(a=>{"Escape"===a.key&&J(),"Enter"===a.key&&!a.shiftKey&&a.target instanceof HTMLInputElement&&(a.preventDefault(),M())},[J,M]);if(!n)return null;let O=a.home;return(0,f.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onKeyDown:N,children:[(0,d.jsx)("div",{className:"absolute inset-0 overlay-backdrop",onClick:J}),(0,d.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":O.newSpace,className:"relative w-full max-w-md mx-4 rounded-2xl border border-border bg-card shadow-xl",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-3",children:[(0,d.jsx)("h3",{className:"text-base font-semibold font-display text-foreground",children:O.newSpace}),(0,d.jsx)("button",{onClick:J,className:"p-1 rounded-md text-muted-foreground hover:bg-muted transition-colors",children:(0,d.jsx)(g.A,{size:14})})]}),(0,d.jsxs)("div",{className:"px-5 pb-5 flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:O.spaceLocation??"Location"}),(0,d.jsx)(q.A,{dirPaths:b,value:w,onChange:x,rootLabel:O.rootLevel??"Root"})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:O.spaceName}),(0,d.jsx)("input",{ref:I,type:"text",value:s,onChange:a=>{t(a.target.value),B(""),K(a.target.value)},placeholder:"e.g. \uD83D\uDCDD Notes",maxLength:80,"aria-invalid":!!C,"aria-describedby":C?"space-name-hint":void 0,className:`w-full px-3 py-2 text-sm rounded-lg border bg-background outline-none transition-colors ${C?"border-error focus:border-error":"border-border focus-visible:ring-1 focus-visible:ring-ring"}`}),C&&(0,d.jsx)("span",{id:"space-name-hint",className:"text-xs text-error",children:C})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsxs)("label",{className:"text-xs font-medium text-muted-foreground",children:[O.spaceDescription," ",(0,d.jsxs)("span",{className:"opacity-50",children:["(",O.optional??"optional",")"]})]}),(0,d.jsx)("input",{type:"text",value:u,onChange:a=>v(a.target.value),placeholder:O.spaceDescPlaceholder??"Describe the purpose of this space",maxLength:200,className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring transition-colors"})]}),(0,d.jsxs)("div",{className:"flex items-start gap-2.5 px-1 py-1",children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":G,disabled:!E,title:E?void 0:a.hints.configureAiKey,onClick:()=>H(a=>!a),className:`relative mt-0.5 inline-flex shrink-0 h-4 w-7 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 ${G?"bg-[var(--amber)]":"bg-muted"}`,children:(0,d.jsx)("span",{className:`pointer-events-none inline-block h-3 w-3 rounded-full bg-white shadow-sm transition-transform ${G?"translate-x-3":"translate-x-0"}`})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(h.A,{size:12,className:"text-[var(--amber)] shrink-0"}),(0,d.jsx)("span",{className:"text-xs font-medium text-foreground",children:O.aiInit??"AI initialize content"})]}),!1===E&&(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground mt-0.5 flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:10,className:"text-[var(--amber)] shrink-0"}),O.aiInitNoKey??"Configure an API key in Settings → AI to enable"]}),E&&G&&(0,d.jsx)("p",{className:"text-2xs text-muted-foreground mt-0.5",children:O.aiInitHint??"AI will generate README and INSTRUCTION for this space"})]})]}),L&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground font-mono px-1",children:[(0,d.jsx)(j.A,{size:12,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"truncate",children:L})]}),A&&(0,d.jsx)("span",{role:"alert",className:"text-xs text-error px-1",children:A}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-1",children:[(0,d.jsx)("button",{onClick:J,className:"px-4 py-2 rounded-lg text-sm font-medium text-muted-foreground transition-colors hover:bg-muted",children:O.cancelCreate}),(0,d.jsxs)("button",{onClick:M,disabled:!s.trim()||y||!!C,className:"flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",children:[y&&(0,d.jsx)(k.A,{size:14,className:"animate-spin"}),O.createSpace]})]})]})]})]}),document.body)}},12978:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/app/register-sw.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/app/register-sw.tsx","default")},13859:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>i});var e=c(67484),f=c(61112),g=c(92464),h=a([f]);function i(){let[a,b]=(0,e.useState)(!1),[c,d]=(0,e.useState)(f.eX),[h,i]=(0,e.useState)("panel"),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)("user"),[r,s]=(0,e.useState)(null),t=(0,e.useRef)(f.eX);(0,g.KT)();let u=(0,e.useCallback)(()=>{"popup"===h?k(a=>(a||(m(""),q("user"),s(null)),!a)):b(a=>(a||(m(""),q("user"),s(null)),!a))},[h]),v=(0,e.useCallback)(()=>{b(!1),n&&(d(t.current),o(!1))},[n]),w=(0,e.useCallback)(()=>{o(a=>(a?d(t.current):t.current=c,!a))},[c]),x=(0,e.useCallback)(()=>k(!1),[]),y=(0,e.useCallback)(a=>d(a),[]),z=(0,e.useCallback)(a=>{try{localStorage.setItem("right-ask-panel-width",String(a))}catch{}},[]),A=(0,e.useCallback)(()=>{i(a=>{let c="panel"===a?"popup":"panel";try{localStorage.setItem("ask-mode",c),window.dispatchEvent(new StorageEvent("storage",{key:"ask-mode",newValue:c}))}catch{}return"popup"===c?(b(!1),k(!0)):(k(!1),b(!0)),c})},[]);return{askPanelOpen:a,askPanelWidth:c,askMaximized:n,askMode:h,desktopAskPopupOpen:j,askInitialMessage:l,askOpenSource:p,askAcpAgent:r,toggleAskPanel:u,closeAskPanel:v,closeDesktopAskPopup:x,handleAskWidthChange:y,handleAskWidthCommit:z,handleAskModeSwitch:A,toggleAskMaximized:w}}f=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},14039:(a,b,c)=>{"use strict";c.d(b,{P:()=>w});var d=c(48249),e=c(67484),f=c(49681),g=c(40560),h=c(8455),i=c(33740),j=c(84248),k=c(69924),l=c(56884),m=c(86588),n=c(95054),o=c(30315);let p="https://github.com/GeminiLight/MindOS/releases",q="mindos_update_in_progress",r={downloading:{en:"Downloading update",zh:"下载更新"},skills:{en:"Updating skills",zh:"更新 Skills"},rebuilding:{en:"Rebuilding app",zh:"重新构建应用"},restarting:{en:"Restarting server",zh:"重启服务"}};function s({status:a}){switch(a){case"done":return(0,d.jsx)(f.A,{size:14,className:"text-success shrink-0"});case"running":return(0,d.jsx)(g.A,{size:14,className:"animate-spin shrink-0 text-[var(--amber)]"});case"failed":return(0,d.jsx)(h.A,{size:14,className:"text-destructive shrink-0"});default:return(0,d.jsx)(i.A,{size:14,className:"text-muted-foreground/40 shrink-0"})}}function t(a){return a<1048576?`${Math.round(a/1024)} KB`:`${(a/1048576).toFixed(1)} MB`}function u(){let{t:a}=(0,o.Y)(),b=a.settings.update,[c,i]=(0,e.useState)("idle"),[l,m]=(0,e.useState)(""),[n,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(null),[s,u]=(0,e.useState)(0),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(""),z=async()=>{if(null.checkCoreUpdate){i("checking"),w("");try{let a=await null.checkCoreUpdate();m(a.currentVersion),a.desktopTooOld?(p(a.latestVersion),y(a.minDesktopVersion),i("desktopTooOld")):a.available?(p(a.latestVersion),r({urls:a.urls,size:a.size,sha256:a.sha256}),i("available")):i("idle")}catch{i("idle")}}},A=async()=>{if(null.downloadCoreUpdate&&q){i("downloading"),u(0);try{await null.downloadCoreUpdate(q.urls,n,q.size,q.sha256),i("ready")}catch(b){let a=b instanceof Error?b.message:String(b);a.includes("aborted")?i("available"):(i("error"),w(a||"Download failed"))}}},B=async()=>{if(null.applyCoreUpdate){i("applying");try{let a=await null.applyCoreUpdate();a?.version&&m(a.version),i("idle")}catch(a){i("error"),w(a instanceof Error?a.message:"Apply failed")}}};return null.checkCoreUpdate?(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:b?.coreTitle??"MindOS Core"}),l&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground",children:["v",l]})]}),"checking"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin"}),b?.checking??"Checking for updates..."]}),"idle"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),b?.coreUpToDate??"Core is up to date"]}),"available"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(j.A,{size:13}),"v",n," ",b?.coreAvailable?b.coreAvailable(t(q?.size??0)):`available (${t(q?.size??0)})`]}),("downloading"===c||"cancelling"===c)&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin text-[var(--amber)]"}),"cancelling"===c?b?.coreCancel??"Cancelling...":(0,d.jsxs)(d.Fragment,{children:[b?.coreDownloading??"Downloading..."," v",n]})]}),"downloading"===c&&(0,d.jsx)("button",{onClick:()=>{null.cancelCoreDownload?.(),i("cancelling")},className:"text-muted-foreground hover:text-foreground transition-colors",children:b?.coreCancel??"Cancel"})]}),(0,d.jsx)("div",{className:"h-1 rounded-full bg-muted overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-[var(--amber)] transition-all duration-300",style:{width:`${Math.max(s,3)}%`}})})]}),"ready"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),"v",n," ",b?.coreReady??"ready — restart services to apply"]}),"applying"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin text-[var(--amber)]"}),b?.coreApplying??"Applying update..."]}),"desktopTooOld"===c&&(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(h.A,{size:13}),b?.coreDesktopTooOld?b.coreDesktopTooOld(n):`v${n} requires a newer Desktop.`]}),(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground",children:[b?.coreDesktopTooOldHint??"Please update MindOS Desktop first."," (Desktop ≥ v",x,")"]})]}),"error"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[(0,d.jsx)(h.A,{size:13}),v||(b?.coreError??"Core update failed.")]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[("idle"===c||"error"===c)&&(0,d.jsxs)("button",{onClick:z,disabled:"idle"!==c&&"error"!==c,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(k.A,{size:14}),b?.checkButton??"Check for Updates"]}),"available"===c&&(0,d.jsxs)("button",{onClick:A,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(j.A,{size:14}),b?.updateButton?b.updateButton(n):`Update to v${n}`]}),"ready"===c&&(0,d.jsxs)("button",{onClick:B,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(k.A,{size:14}),b?.coreRestartServices??"Restart Services"]}),"error"===c&&(0,d.jsxs)("button",{onClick:q?A:z,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(k.A,{size:14}),b?.coreRetry??"Retry"]})]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/60",children:b?.coreHint??"Core updates only restart services — no app restart needed."})]}):null}function v(){let{t:a}=(0,o.Y)(),b=a.settings.update,[c,i]=(0,e.useState)("idle"),[n,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(""),[v,w]=(0,e.useState)(0),[x,y]=(0,e.useState)(""),z=async()=>{i("checking"),y("");try{let a=await null.checkUpdate();q(a.available),a.version&&s(a.version),i("idle")}catch{i("error"),y(b?.error??"Failed to check for updates.")}},A=async()=>{i("downloading"),w(0);try{await null.installUpdate()}catch{i("error"),y("Update failed. Please try again.")}};return(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(l.A,{size:14,className:"text-muted-foreground"}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:b?.shellTitle??"MindOS Desktop"})]}),t&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground",children:["v",t]})]}),"checking"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin"}),b?.checking??"Checking for updates..."]}),"idle"===c&&!n&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),b?.upToDate??"You're up to date"]}),"idle"===c&&n&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(j.A,{size:13}),r?`Update available: v${r}`:"Update available"]}),"downloading"===c&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin text-[var(--amber)]"}),b?.desktopDownloading??"Downloading update..."]}),(0,d.jsx)("div",{className:"h-1 rounded-full bg-muted overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-[var(--amber)] transition-all duration-300",style:{width:`${Math.max(v,3)}%`}})})]}),"ready"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),b?.desktopReady??"Update downloaded. Restart to apply."]}),"error"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[(0,d.jsx)(h.A,{size:13}),x]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,d.jsxs)("button",{onClick:z,disabled:"checking"===c||"downloading"===c,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(k.A,{size:14,className:"checking"===c?"animate-spin":""}),b?.checkButton??"Check for Updates"]}),"idle"===c&&n&&(0,d.jsxs)("button",{onClick:A,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(j.A,{size:14}),r?`Update to v${r}`:"Update"]}),"ready"===c&&(0,d.jsxs)("button",{onClick:async()=>{try{await null.installUpdate()}catch{i("error"),y(b?.error??"Failed to install update.")}},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(k.A,{size:14}),b?.desktopRestart??"Restart Now"]})]}),(0,d.jsxs)("div",{className:"border-t border-border/50 pt-3 space-y-2",children:[(0,d.jsxs)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[(0,d.jsx)(m.A,{size:12}),b?.releaseNotes??"View release notes"]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/60",children:b?.desktopHint??"Updates are delivered through the Desktop app auto-updater."})]})]})}function w(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)(!0);return a?(0,d.jsxs)("div",{className:"space-y-6",children:[c&&(0,d.jsx)(u,{}),(0,d.jsx)(v,{})]}):(0,d.jsx)(x,{})}function x(){let{t:a,locale:b}=(0,o.Y)(),c=a.settings.update,[i,l]=(0,e.useState)(null),[t,u]=(0,e.useState)("idle"),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)([]),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)(!1),D=(0,e.useRef)(void 0),E=(0,e.useRef)(void 0),F=(0,e.useRef)(""),G=(0,e.useCallback)(async()=>{u("checking"),w("");try{let a=await (0,n.n)("/api/update-check");if(l(a),F.current||(F.current=a.current),a.hasUpdate){let b=localStorage.getItem("mindos_update_dismissed");localStorage.setItem("mindos_update_latest",a.latest),window.dispatchEvent(new Event(a.latest===b?"mindos:update-dismissed":"mindos:update-available"))}else localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),window.dispatchEvent(new Event("mindos:update-dismissed"));u("idle")}catch{u("error"),w(c?.error??"Failed to check for updates.")}},[c]),H=(0,e.useCallback)(()=>{clearInterval(D.current),clearTimeout(E.current)},[]),I=(0,e.useCallback)(a=>{H(),l(a),u("updated"),localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),localStorage.removeItem(q),window.dispatchEvent(new Event("mindos:update-dismissed")),setTimeout(()=>window.location.reload(),2e3)},[H]),J=(0,e.useCallback)(()=>{D.current=setInterval(async()=>{try{let a=await (0,n.n)("/api/update-status",{timeout:5e3});if(C(!1),a.stages?.length>0&&y(a.stages),"failed"===a.stage){H(),localStorage.removeItem(q),A(a.error||"Update failed"),u("error");return}if("done"===a.stage)try{let a=await (0,n.n)("/api/update-check");if(a.current!==F.current)return void I(a)}catch{}}catch{C(!0);try{let a=await (0,n.n)("/api/update-check",{timeout:5e3});a.current&&a.current!==F.current&&(y(a=>a.map(a=>({...a,status:"done"}))),I(a))}catch{}}},3e3),E.current=setTimeout(()=>{H(),localStorage.removeItem(q),u("timeout")},9e5)},[H,I]),K=(0,e.useCallback)(async()=>{u("updating"),w(""),A(null),C(!1),y([{id:"downloading",status:"pending"},{id:"skills",status:"pending"},{id:"rebuilding",status:"pending"},{id:"restarting",status:"pending"}]),localStorage.setItem(q,JSON.stringify({originalVer:F.current||i?.current,startedAt:Date.now()})),window.dispatchEvent(new Event("mindos:update-started"));try{await (0,n.n)("/api/update",{method:"POST"})}catch(a){if(a instanceof n.h){localStorage.removeItem(q),A(a.message||"Update failed"),u("error");return}}J()},[J,i]),L=(0,e.useCallback)(()=>{A(null),K()},[K]),M="zh"===b?"zh":"en",N=x.filter(a=>"done"===a.status).length,O=x.length>0?Math.round(N/x.length*100):0;return(0,d.jsx)("div",{className:"space-y-6",children:(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:"MindOS"}),i&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground",children:["v",i.current]})]}),"checking"===t&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin"}),c?.checking??"Checking for updates..."]}),"idle"===t&&i&&!i.hasUpdate&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),c?.upToDate??"You're up to date"]}),"idle"===t&&i?.hasUpdate&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(j.A,{size:13}),c?.available?c.available(i.current,i.latest):`Update available: v${i.current} → v${i.latest}`]}),"updating"===t&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("div",{className:"space-y-1.5",children:x.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,d.jsx)(s,{status:a.status}),(0,d.jsx)("span",{className:"pending"===a.status?"text-muted-foreground/50":"running"===a.status?"text-foreground":"text-muted-foreground",children:r[a.id]?.[M]??a.id})]},a.id))}),(0,d.jsx)("div",{className:"h-1 rounded-full bg-muted overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-[var(--amber)] transition-all duration-500 ease-out",style:{width:`${Math.max(O,5)}%`}})}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:B?c?.serverRestarting??"Server is restarting, please wait...":c?.updatingHint??"This may take 1–3 minutes. Do not close this page."})]}),"updated"===t&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),c?.updated??"Updated successfully! Reloading..."]}),"timeout"===t&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(h.A,{size:13}),c?.timeout??"Update may still be in progress."]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:c?.timeoutHint??"The server may need more time to rebuild. Try refreshing."}),(0,d.jsxs)("button",{onClick:()=>window.location.reload(),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(k.A,{size:12}),c?.refreshButton??"Refresh Page"]})]}),"error"===t&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[(0,d.jsx)(h.A,{size:13}),z||v]}),z&&(0,d.jsxs)("button",{onClick:L,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(k.A,{size:12}),c?.retryButton??"Retry Update"]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,d.jsxs)("button",{onClick:G,disabled:"checking"===t||"updating"===t,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(k.A,{size:14,className:"checking"===t?"animate-spin":""}),c?.checkButton??"Check for Updates"]}),i?.hasUpdate&&"updating"!==t&&"updated"!==t&&(0,d.jsxs)("button",{onClick:K,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(j.A,{size:14}),c?.updateButton?c.updateButton(i.latest):`Update to v${i.latest}`]})]}),(0,d.jsxs)("div",{className:"border-t border-border/50 pt-3 space-y-2",children:[(0,d.jsxs)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[(0,d.jsx)(m.A,{size:12}),c?.releaseNotes??"View release notes"]}),(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground/60",children:[c?.hint??"Updates are installed via npm. Equivalent to running"," ",(0,d.jsx)("code",{className:"font-mono bg-muted px-1 py-0.5 rounded",children:"mindos update"})," ",c?.inTerminal??"in your terminal."]})]})]})})}},15304:(a,b,c)=>{"use strict";c.d(b,{i:()=>e});var d=c(99829);let e=(0,d.createServerReference)("40827a17547e6258e4f73803dd7d54ff36bf6bed15",d.callServer,void 0,d.findSourceMapURL,"deleteFileAction")},15330:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(null),[f,g]=(0,d.useState)([]),[h,i]=(0,d.useState)(0);(0,d.useCallback)(()=>{fetch("/api/files").then(a=>a.ok?a.json():[]).then(a=>Array.isArray(a)?a:[]).catch(()=>[]).then(b)},[]);let j=(0,d.useCallback)((b,c)=>{let d=c??b.length,f=b.slice(0,d),h=f.lastIndexOf("@");if(-1===h||h>0&&" "!==f[h-1]&&"\n"!==f[h-1])return void e(null);let j=f.slice(h+1);if(j.includes(" ")||j.includes("\n")){e(null),g([]),i(0);return}let k=j.toLowerCase();if(!k){e(j),g(a.slice(0,30)),i(0);return}let l=a.map(a=>{let b=(a.split("/").pop()??a).toLowerCase(),c=a.toLowerCase(),d=0;return b.startsWith(k)?d=100:b.includes(k)?d=50:c.includes(k)&&(d=10),{path:a,score:d}}).filter(a=>a.score>0).sort((a,b)=>b.score-a.score).slice(0,30);if(0===l.length){e(null),g([]),i(0);return}e(j),g(l.map(a=>a.path)),i(0)},[a]),k=(0,d.useCallback)(a=>{0!==f.length&&("down"===a?i(a=>Math.min(a+1,f.length-1)):i(a=>Math.max(a-1,0)))},[f.length]);return{mentionQuery:c,mentionResults:f,mentionIndex:h,updateMentionFromInput:j,navigateMention:k,resetMention:(0,d.useCallback)(()=>{e(null),g([]),i(0)},[])}}},17009:(a,b,c)=>{"use strict";c.d(b,{z:()=>f});var d=c(67484);let e="mindos:acp-detection";function f(){let a=(0,d.useRef)(function(){try{let a=sessionStorage.getItem(e);if(!a)return null;let b=JSON.parse(a);if("number"!=typeof b.ts||Date.now()-b.ts>18e5)return null;return b}catch{return null}}()),[b,c]=(0,d.useState)(a.current?.installed??[]),[f,g]=(0,d.useState)(a.current?.notInstalled??[]),[h,i]=(0,d.useState)(!a.current),[j,k]=(0,d.useState)(null),[l,m]=(0,d.useState)(0);(0,d.useRef)(!1);let n=(0,d.useRef)(!1);return{installedAgents:b,notInstalledAgents:f,loading:h,error:j,refresh:(0,d.useCallback)(()=>{try{sessionStorage.removeItem(e)}catch{}a.current=null,n.current=!0,m(a=>a+1)},[])}}},18329:(a,b,c)=>{"use strict";c.d(b,{cd:()=>j,kr:()=>i,zd:()=>h});var d=c(31417),e=c(95054);let f=null;async function g(a){f?.abort();let b=new AbortController;f=b;try{let[c,d,f]=await Promise.all([(0,e.n)("/api/mcp/status",{signal:b.signal}),(0,e.n)("/api/mcp/agents",{signal:b.signal}),(0,e.n)("/api/skills",{signal:b.signal})]);b.signal.aborted||a({status:c,agents:d.agents,skills:f.skills})}catch(a){if(a instanceof DOMException&&"AbortError"===a.name)return}finally{b.signal.aborted||a({loading:!1})}}let h=(0,d.v)((a,b)=>({status:null,agents:[],skills:[],loading:!0,refresh:()=>g(a),toggleSkill:async(c,d)=>{a({skills:b().skills.map(a=>a.name===c?{...a,enabled:d}:a)});try{return await (0,e.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"toggle",name:c,enabled:d})}),!0}catch{return a({skills:b().skills.map(a=>a.name===c?{...a,enabled:!d}:a)}),!1}},installAgent:async(c,d)=>{let f=b().agents.find(a=>a.key===c);if(!f)return!1;try{let b=await (0,e.n)("/api/mcp/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:[{key:c,scope:d?.scope??(f.hasProjectScope?"project":"global"),transport:d?.transport??f.preferredTransport}],transport:"auto"})}),h=b.results?.[0],i=h?.ok===!0||h?.status==="ok";return i&&await g(a),i}catch{return!1}},_init:()=>{let b;g(a);let c=()=>{clearTimeout(b),b=setTimeout(()=>g(a),500)};window.addEventListener("mindos:skills-changed",c);let d=setInterval(()=>{"visible"===document.visibilityState&&g(a)},3e4);return()=>{f?.abort(),clearTimeout(b),clearInterval(d),window.removeEventListener("mindos:skills-changed",c)}}}));function i(){return h()}function j(){return h()}},18776:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TodoRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TodoRenderer() from the server but TodoRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/todo/TodoRenderer.tsx","TodoRenderer")},20892:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(48249);function e({id:a,className:b="w-8 h-4"}){return(0,d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 40",fill:"none",className:`${b} text-[var(--amber)]`,"aria-hidden":"true",children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:`grad-human-${a}`,x1:"35",y1:"20",x2:"5",y2:"20",gradientUnits:"userSpaceOnUse",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.8"}),(0,d.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.3"})]}),(0,d.jsxs)("linearGradient",{id:`grad-agent-${a}`,x1:"35",y1:"20",x2:"75",y2:"20",gradientUnits:"userSpaceOnUse",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.8"}),(0,d.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"1"})]})]}),(0,d.jsx)("path",{d:"M35,20 C25,35 8,35 8,20 C8,5 25,5 35,20",stroke:`url(#grad-human-${a})`,strokeWidth:"3",strokeDasharray:"2 4",strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M35,20 C45,2 75,2 75,20 C75,38 45,38 35,20",stroke:`url(#grad-agent-${a})`,strokeWidth:"4.5",strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M35,17.5 Q35,20 37.5,20 Q35,20 35,22.5 Q35,20 32.5,20 Q35,20 35,17.5 Z",fill:"#FEF3C7"})]})}},21245:(a,b,c)=>{"use strict";c.d(b,{g:()=>d});let d=[{anchor:"files-panel",position:"right"},{anchor:"ask-button",position:"right"},{anchor:"agents-panel",position:"right"}]},23017:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(67484),f=c(46674),g=c(30315);function h(){let[a,b]=(0,e.useState)(!1),{t:c}=(0,g.Y)(),h=c.shortcutPanel,i="u">typeof navigator&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘":"Ctrl",j=(0,e.useMemo)(()=>[{keys:`${i} K`,label:h.toggleSearch,section:h.navigation},{keys:`${i} /`,label:h.toggleAskAI,section:h.navigation},{keys:`${i} ,`,label:h.openSettings,section:h.navigation},{keys:`${i} ?`,label:h.keyboardShortcuts,section:h.navigation},{keys:"Esc",label:h.closePanel,section:h.panelsSection},{keys:`${i} S`,label:h.saveFile,section:h.editor},{keys:`${i} Z`,label:h.undo,section:h.editor},{keys:`${i} Shift Z`,label:h.redo,section:h.editor}],[i,h]);if(!a)return null;let k=[...new Set(j.map(a=>a.section))];return(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center modal-backdrop",onClick:a=>a.target===a.currentTarget&&b(!1),children:(0,d.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":h.title,className:"w-full max-w-md mx-4 bg-card border border-border rounded-xl shadow-2xl overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border",children:[(0,d.jsx)("span",{className:"text-sm font-medium font-display text-foreground",children:h.title}),(0,d.jsx)("button",{onClick:()=>b(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,d.jsx)(f.A,{size:15})})]}),(0,d.jsx)("div",{className:"px-5 py-4 space-y-4 max-h-[60vh] overflow-y-auto",children:k.map(a=>(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-2",children:a}),(0,d.jsx)("div",{className:"space-y-1",children:j.filter(b=>b.section===a).map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between py-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-foreground",children:a.label}),(0,d.jsx)("div",{className:"flex items-center gap-1",children:a.keys.split(" ").map((a,b)=>(0,d.jsx)("kbd",{className:"px-1.5 py-0.5 text-2xs rounded border border-border bg-muted text-muted-foreground font-mono min-w-[24px] text-center",children:a},b))})]},a.keys))})]},a))}),(0,d.jsx)("div",{className:"px-5 py-2.5 border-t border-border",children:(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground/60",children:["Press ",(0,d.jsx)("kbd",{className:"px-1 py-0.5 text-2xs rounded border border-border bg-muted font-mono",children:i}),(0,d.jsx)("kbd",{className:"px-1 py-0.5 text-2xs rounded border border-border bg-muted font-mono ml-0.5",children:"?"})," ",h.toggleHint]})})]})})}},23343:(a,b,c)=>{"use strict";c.d(b,{M:()=>A});var d=c(48249),e=c(67484),f=c(27381),g=c(40560),h=c(59347),i=c(42742),j=c(19236),k=c(15273),l=c(69924),m=c(6079),n=c(89165),o=c(93877),p=c(44218),q=c(19794),r=c(66336),s=c(99101),t=c(81285),u=c(57056),v=c(95054),w=c(39868);function x(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:a<0x40000000?`${(a/1048576).toFixed(1)} MB`:`${(a/0x40000000).toFixed(2)} GB`}var y=c(82298);c(85520);var z=c(80064);function A({data:a,setData:b,t:c}){let p=a.envOverrides??{},q=c.settings.knowledge,r=c.settings.appearance,[x,A]=(0,e.useState)(()=>!1),[D,E]=(0,e.useState)(()=>!1),[F,G]=(0,e.useState)(()=>!1),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(!1),[L,M]=(0,e.useState)(null),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),R=(0,e.useCallback)(()=>{let a=!P;Q(a);let b={dismissed:a};a||(b.active=!0),(0,v.n)("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:b})}).then(()=>window.dispatchEvent(new Event("guide-state-updated"))).catch(b=>{console.error("Failed to update guide state:",b),Q(!a)})},[P]),S=(0,e.useCallback)(()=>{(0,v.n)("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{active:!0,dismissed:!1,walkthroughStep:0,walkthroughDismissed:!1}})}).then(()=>{O(!0),Q(!1),window.dispatchEvent(new Event("guide-state-updated"))}).catch(a=>console.error("Failed to restart walkthrough:",a))},[]),T=(0,e.useSyncExternalStore)(()=>()=>{},()=>`${window.location.protocol}//${window.location.hostname}`,()=>"http://localhost"),[U,V]=(0,e.useState)(!1),W="***set***"===a.webPassword,[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(null),[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)(!1),ad=!!a.authToken,ae=Z??a.authToken??"";async function af(){Y(!0);try{let a=await (0,v.n)("/api/settings/reset-token",{method:"POST"});$(a.token),b(b=>b?{...b,authToken:a.token}:b)}finally{Y(!1)}}async function ag(){b(a=>a?{...a,authToken:""}:a),$(null)}return(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(t.L7,{icon:(0,d.jsx)(f.A,{size:15}),title:q.cardTitle??"Knowledge Base",description:q.mindRootHint,children:[(0,d.jsx)(t.D0,{label:(0,d.jsxs)(d.Fragment,{children:[q.mindRoot," ",(0,d.jsx)(t.Bt,{overridden:p.MIND_ROOT})]}),hint:p.MIND_ROOT?q.envNote:q.mindRootHint,children:(0,d.jsx)(t.pd,{value:a.mindRoot,onChange:a=>b(b=>b?{...b,mindRoot:a.target.value}:b),placeholder:"/path/to/your/notes"})}),(0,d.jsx)(t.pM,{label:q.showHiddenFiles,hint:q.showHiddenFilesHint,children:(0,d.jsx)(t.lM,{checked:F,onChange:()=>{let a=!F;G(a),(0,y.Fo)(a)}})}),null!==H&&H>0&&null===L&&(0,d.jsx)(t.pM,{label:q.cleanupExamples,hint:q.cleanupExamplesHint,children:(0,d.jsxs)("button",{onClick:()=>ac(!0),disabled:J,title:J?c.hints.cleanupInProgress:void 0,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0 disabled:opacity-50",children:[J?(0,d.jsx)(g.A,{size:12,className:"animate-spin"}):(0,d.jsx)(h.A,{size:12}),q.cleanupExamplesButton,(0,d.jsx)("span",{className:"ml-1 tabular-nums text-2xs opacity-70",children:H})]})}),null!==L&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(i.A,{size:14}),q.cleanupExamplesDone(L)]})]}),(0,d.jsxs)(t.L7,{icon:(0,d.jsx)(j.A,{size:15}),title:q.securityTitle??"Security",children:[(0,d.jsx)(t.D0,{label:q.webPassword,hint:q.webPasswordHint,children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(t.pd,{type:U?"text":"password",value:W?"••••••••":a.webPassword??"",onChange:a=>b(b=>b?{...b,webPassword:a.target.value}:b),onFocus:()=>{W&&b(a=>a?{...a,webPassword:""}:a)},placeholder:q.passwordPlaceholder??"Leave empty to disable"}),(0,d.jsx)("button",{type:"button",onClick:()=>V(a=>!a),className:"px-3 py-2 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0",children:U?q.passwordHide??"Hide":q.passwordShow??"Show"})]})}),(0,d.jsx)(t.D0,{label:q.authToken,hint:ad?q.authTokenHint:q.authTokenNone,children:(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-background border border-border rounded-lg min-h-[38px]",children:[(0,d.jsx)("code",{className:"flex-1 text-xs font-mono text-foreground break-all select-all",children:ae||(0,d.jsx)("span",{className:"text-muted-foreground italic",children:q.tokenNotSet??"— not set —"})}),ae&&(0,d.jsx)("button",{type:"button",onClick:function(){let b=Z??a.authToken??"";b&&(0,w.l)(b).then(a=>{a&&s.oR.copy()})},className:"shrink-0 p-1 rounded text-muted-foreground hover:text-foreground transition-colors",title:q.authTokenCopy,children:(0,d.jsx)(k.A,{size:13})})]}),a.mcpPort&&(0,d.jsxs)("p",{className:"text-xs text-muted-foreground",children:[q.authTokenMcpPort,": ",(0,d.jsx)("code",{className:"font-mono",children:a.mcpPort}),ae&&(0,d.jsxs)(d.Fragment,{children:[" \xa0\xb7\xa0 ",q.mcpUrl??"MCP URL",": ",(0,d.jsx)("code",{className:"font-mono select-all",children:`${T}:${a.mcpPort}/mcp`})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:function(){aa(!0)},disabled:X,title:X?c.hints.tokenResetInProgress:void 0,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(l.A,{size:14,className:X?"animate-spin":""}),q.authTokenReset]}),ad&&(0,d.jsxs)("button",{type:"button",onClick:ag,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-destructive hover:border-destructive/50 transition-colors",children:[(0,d.jsx)(h.A,{size:14}),q.authTokenClear]})]}),Z&&(0,d.jsx)("p",{className:"text-xs text-[var(--amber-text)]",children:q.tokenGenerated})]})})]}),null!==N&&(0,d.jsxs)(t.L7,{icon:(0,d.jsx)(m.A,{size:15}),title:c.guide?.title??"Getting Started",children:[(0,d.jsx)(t.pM,{label:c.guide?.showGuide??"Show getting started guide",children:(0,d.jsx)(t.lM,{checked:!P,onChange:()=>R()})}),(0,d.jsxs)("button",{onClick:S,className:"flex items-center gap-1.5 mt-2 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(n.A,{size:14}),q.restartWalkthrough??"Restart walkthrough"]})]}),(0,d.jsx)(t.L7,{icon:(0,d.jsx)(o.A,{size:15}),title:r.labsTitle??"Labs",description:r.labsDesc??"Experimental features that are still in development.",children:(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(B,{label:r.labsEcho??"Echo",description:r.labsEchoDesc??"Reflective journaling powered by your notes.",checked:x,onChange:a=>{A(a),localStorage.setItem("mindos:labs-echo",a?"1":"0"),window.dispatchEvent(new Event("mindos:labs-changed"))}}),(0,d.jsx)(B,{label:r.labsWorkflows??"Flows",description:r.labsWorkflowsDesc??"Visual workflow automation for agents.",checked:D,onChange:a=>{E(a),localStorage.setItem("mindos:labs-workflows",a?"1":"0"),window.dispatchEvent(new Event("mindos:labs-changed"))}})]})}),(0,d.jsx)(C,{k:q}),(0,d.jsx)(u.TM,{open:_,title:q.authTokenReset??"Regenerate Token",message:q.authTokenResetConfirm,confirmLabel:q.authTokenReset??"Regenerate",cancelLabel:q.cancel??"Cancel",onConfirm:()=>{aa(!1),af()},onCancel:()=>aa(!1)}),(0,d.jsx)(u.TM,{open:ab,title:q.cleanupExamples??"Cleanup Examples",message:null!==H?q.cleanupExamplesConfirm(H):"",confirmLabel:q.cleanupExamplesButton??"Clean up",cancelLabel:q.cancel??"Cancel",variant:"destructive",onConfirm:async()=>{ac(!1),K(!0);let a=await (0,z.E)();K(!1),a.success&&(M(a.deleted),I(0))},onCancel:()=>ac(!1)})]})}function B({label:a,description:b,checked:c,onChange:e}){return(0,d.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer group",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground block",children:a}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:b})]}),(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":c,onClick:()=>e(!c),className:`relative w-9 h-5 rounded-full transition-colors shrink-0 ${c?"bg-[var(--amber)]":"bg-muted-foreground/20"}`,children:(0,d.jsx)("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${c?"translate-x-4":"translate-x-0"}`})})]})}function C({k:a}){let[b,c]=(0,e.useState)(!1),[f,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1);return(0,e.useCallback)(async()=>{j(!0);try{let a=await (0,v.n)("/api/monitoring",{timeout:5e3});h(a)}catch{}j(!1)},[]),(0,e.useRef)(!1),(0,d.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,d.jsxs)("button",{onClick:()=>c(a=>!a),className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors w-full",children:[b?(0,d.jsx)(p.A,{size:14}):(0,d.jsx)(q.A,{size:14}),(0,d.jsx)(r.A,{size:12}),a.monitoringTitle??"System Monitoring",i&&(0,d.jsx)(g.A,{size:10,className:"animate-spin ml-1"})]}),b&&f&&(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-x-6 gap-y-2 text-xs",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorHeap??"Heap"}),(0,d.jsxs)("span",{className:"ml-2 tabular-nums",children:[x(f.system.memory.heapUsed)," / ",x(f.system.memory.heapTotal)]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorRss??"RSS"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:x(f.system.memory.rss)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorUptime??"Uptime"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:function(a){let b=Math.floor(a/1e3);if(b<60)return`${b}s`;let c=Math.floor(b/60);if(c<60)return`${c}m ${b%60}s`;let d=Math.floor(c/60);if(d<24)return`${d}h ${c%60}m`;let e=Math.floor(d/24);return`${e}d ${d%24}h`}(f.system.uptimeMs)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorNode??"Node"}),(0,d.jsx)("span",{className:"ml-2",children:f.system.nodeVersion})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorRequests??"Requests"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:f.application.agentRequests})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorToolCalls??"Tool Calls"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:f.application.toolExecutions})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorTokens??"Tokens"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:(f.application.totalTokens.input+f.application.totalTokens.output).toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorFiles??"Files"}),(0,d.jsxs)("span",{className:"ml-2 tabular-nums",children:[f.knowledgeBase.fileCount," (",x(f.knowledgeBase.totalSizeBytes),")"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:"MCP"}),(0,d.jsx)("span",{className:"ml-2",children:f.mcp.running?a.monitorMcpRunning?.(f.mcp.port)??`Running :${f.mcp.port}`:a.monitorMcpStopped??"Stopped"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorErrors??"Errors"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:f.application.errors})]})]}),b&&!f&&!i&&(0,d.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:a.monitoringFailed??"Failed to load monitoring data"})]})}},24387:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/components/ErrorBoundary.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ErrorBoundary.tsx","default")},27608:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(48249),e=c(67484),f=c(74429),g=c(42742),h=c(44218);function i(a){return"options"in a}function j({value:a,onChange:b,options:c,className:j="",size:k="md",placeholder:l}){let[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(-1),[q,r]=(0,e.useState)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(null),u=(0,e.useMemo)(()=>(function(a){let b=[];for(let c of a)i(c)?b.push(...c.options):b.push(c);return b})(c),[c]),v=(0,e.useMemo)(()=>u.find(b=>b.value===a)??null,[u,a]),w=(0,e.useCallback)(()=>{n(!1),p(-1)},[]),x=(0,e.useCallback)(a=>{b(a),w()},[b,w]);(0,e.useCallback)(()=>{if(!s.current)return;let a=s.current.getBoundingClientRect(),b="sm"===k?200:260,c=window.innerHeight-a.bottom,d=a.top;r({top:c<b+8&&d>c?a.top:a.bottom,left:a.left,width:a.width,flipUp:c<b+8&&d>c})},[k]);let y="sm"===k,z=y?`inline-flex items-center gap-1 appearance-none rounded-md border border-border bg-background text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring transition-colors text-2xs px-1.5 py-0.5 pr-5 ${j}`:`w-full flex items-center gap-2 appearance-none rounded-lg border border-border bg-background text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring transition-colors text-sm px-3 py-2 pr-8 ${j}`,A=y?"w-full flex items-center gap-1.5 px-2 py-1 text-2xs text-left transition-colors cursor-pointer":"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left transition-colors cursor-pointer",B=-1;function C(b){let c=++B,e=b.value===a,f=c===o;return(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":e,"data-idx":c,onClick:()=>x(b.value),onMouseEnter:()=>p(c),className:`${A} ${f?"bg-muted text-foreground":"text-foreground"}`,children:[b.icon,(0,d.jsx)("span",{className:"flex-1 truncate",children:b.label}),b.suffix,e&&(0,d.jsx)(g.A,{size:y?10:12,className:"shrink-0 text-[var(--amber)]"})]},b.value)}let D=m&&q&&(0,f.createPortal)((0,d.jsx)("div",{ref:t,className:y?"fixed z-[9999] overflow-y-auto rounded-md border border-border bg-card shadow-lg py-0.5":"fixed z-[9999] overflow-y-auto rounded-lg border border-border bg-card shadow-lg py-1",role:"listbox",style:{left:q.left,minWidth:q.width,maxHeight:y?200:260,...q.flipUp?{bottom:window.innerHeight-q.top+4}:{top:q.top+4}},children:c.map((a,b)=>i(a)?(0,d.jsxs)("div",{children:[b>0&&(0,d.jsx)("div",{className:"my-0.5 border-t border-border/50"}),(0,d.jsx)("div",{className:`py-1 text-2xs font-medium text-muted-foreground uppercase tracking-wider ${y?"px-2":"px-3"}`,children:a.label}),a.options.map(C)]},a.label):C(a))}),document.body);return(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsxs)("button",{ref:s,type:"button",onClick:()=>n(a=>!a),"aria-haspopup":"listbox","aria-expanded":m,className:z,children:[v?.icon,(0,d.jsx)("span",{className:"flex-1 truncate text-left",children:v?.label??l??"—"}),v?.suffix,(0,d.jsx)(h.A,{size:y?12:14,className:`${y?"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none":"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"} transition-transform duration-150 ${m?"rotate-180":""}`})]}),D]})}},28079:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>i});var e=c(48249),f=c(30315),g=c(65965),h=a([g]);function i({open:a,onClose:b,currentFile:c,initialMessage:d,initialAcpAgent:h,onFirstMessage:i,askMode:j,onModeSwitch:k}){let{t:l}=(0,f.Y)();return a?(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-end md:items-start justify-center md:pt-[10vh] modal-backdrop",onClick:a=>a.target===a.currentTarget&&b(),children:(0,e.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":l.ask.title,className:"w-full md:max-w-2xl md:mx-4 bg-card border-t md:border border-border rounded-t-2xl md:rounded-xl shadow-2xl flex flex-col h-[92vh] md:h-auto md:max-h-[75vh]",children:(0,e.jsx)(g.A,{visible:a,variant:"modal",onClose:b,currentFile:c,initialMessage:d,initialAcpAgent:h,onFirstMessage:i,askMode:j,onModeSwitch:k})})}):null}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},28978:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(48249),e=c(67484),f=c(7309),g=c(83654),h=c(80600),i=c(93096);function j({results:a,selectedIndex:b,query:c,onSelect:j}){let k=(0,e.useRef)(null),l=(0,e.useRef)(null),[m,n]=(0,e.useState)(280);return 0===a.length?null:(0,d.jsxs)("div",{ref:l,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,d.jsx)(f.A,{size:11,className:"text-muted-foreground/50"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Files"}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:a.length})]}),(0,d.jsx)("div",{ref:k,className:"overflow-y-auto",style:{maxHeight:m},children:a.map((a,e)=>{let f=a.split("/").pop()??a,k=a.split("/").slice(0,-1).join("/"),l=f.endsWith(".csv");return(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),j(a)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${e===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[l?(0,d.jsx)(g.A,{size:13,className:"text-success shrink-0"}):(0,d.jsx)(h.A,{size:13,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:"truncate font-medium flex-1",title:f,children:(0,d.jsx)(i.A,{text:f,query:c})}),k&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 truncate max-w-[140px] shrink-0",title:k,children:(0,d.jsx)(i.A,{text:k,query:c})})]},a)})}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,d.jsx)("span",{children:"↑↓ navigate"}),(0,d.jsx)("span",{children:"↵ select"}),(0,d.jsx)("span",{children:"ESC dismiss"})]})]})}},29185:(a,b,c)=>{"use strict";c.d(b,{f:()=>r,v:()=>w});var d=c(48249),e=c(67484),f=c(8455),g=c(19794),h=c(40560),i=c(19429),j=c(42742),k=c(1619),l=c(41479),m=c(61075),n=c(49681),o=c(69924),p=c(81285),q=c(95054);function r(a,b){if(!a)return b?.timeNever??"never";let c=Date.now()-new Date(a).getTime();if(c<6e4)return b?.timeJustNow??"just now";let d=Math.floor(c/6e4);if(c<36e5)return b?.timeMinAgo?.(d)??`${d}m ago`;let e=Math.floor(c/36e5);if(c<864e5)return b?.timeHourAgo?.(e)??`${e}h ago`;let f=Math.floor(c/864e5);return b?.timeDayAgo?.(f)??`${f}d ago`}function s(a,b,c){let d=a.toLowerCase();return d.includes("permission denied")||d.includes("publickey")?c?.hintSshAuth??"SSH key may not be configured. Run: ssh-keygen -t ed25519 && ssh -T git@github.com":d.includes("host key")||d.includes("known_hosts")||d.includes("fingerprint")?c?.hintSshHost??"Run: ssh-keyscan github.com >> ~/.ssh/known_hosts":d.includes("authentication failed")||d.includes("invalid credentials")||d.includes("401")||d.includes("403")?c?.hintHttpsAuth??"Access token may be expired or missing. Check Settings → Developer settings → Personal access tokens.":d.includes("timed out")||d.includes("timeout")||d.includes("could not resolve")?c?.hintNetwork??"Check your network connection and try again.":d.includes("not found")||d.includes("does not exist")||d.includes("repository not found")?c?.hintNotFound??"Repository not found. Check the URL and ensure the repo exists.":d.includes("non-fast-forward")||d.includes("rejected")||d.includes("fetch first")?c?.hintPushRejected??'Remote has changes. Click "Sync Now" to pull and retry.':d.includes("conflict")||d.includes("merge")?c?.hintConflict??"Merge conflict detected. Check the Conflicts section below.":""}function t({file:a,time:b,syncT:c,onResolved:i}){let[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),[p,s]=(0,e.useState)(!1),t=async()=>{if(l)return void m(!1);if(!n){s(!0);try{let b=await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"conflict-preview",remote:a})});o(b)}catch{}s(!1)}m(!0)},u=async b=>{k("keep-local"===b?"local":"remote");try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"resolve-conflict",remote:a,branch:b})}),i()}catch{k(null)}};return(0,d.jsxs)("div",{className:"rounded-lg border border-border/50 overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 p-2 text-xs bg-muted/20",children:[(0,d.jsx)(f.A,{size:12,className:"text-error shrink-0"}),(0,d.jsxs)("button",{type:"button",onClick:t,className:"font-mono truncate hover:text-foreground hover:underline transition-colors flex-1 min-w-0 text-left",title:c?.viewDiff??"View differences",children:[(0,d.jsx)(g.A,{size:11,className:`inline mr-1 transition-transform ${l?"rotate-90":""}`}),a]}),(0,d.jsx)("span",{className:"text-muted-foreground shrink-0",children:r(b,c)}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:()=>u("keep-local"),disabled:!!j,className:"px-2 py-0.5 rounded border border-border text-2xs hover:bg-muted transition-colors disabled:opacity-40",title:c?.keepLocalHint??"Keep this device's version",children:"local"===j?(0,d.jsx)(h.A,{size:10,className:"animate-spin"}):c?.keepLocal??"Keep local"}),(0,d.jsx)("button",{type:"button",onClick:()=>u("keep-remote"),disabled:!!j,className:"px-2 py-0.5 rounded border border-border text-2xs hover:bg-muted transition-colors disabled:opacity-40",title:c?.keepRemoteHint??"Replace with remote version",children:"remote"===j?(0,d.jsx)(h.A,{size:10,className:"animate-spin"}):c?.keepRemote??"Keep remote"})]})]}),l&&(0,d.jsx)("div",{className:"border-t border-border/50",children:p?(0,d.jsx)("div",{className:"flex justify-center py-3",children:(0,d.jsx)(h.A,{size:13,className:"animate-spin text-muted-foreground"})}):n?(0,d.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border/50 text-2xs font-mono max-h-60 overflow-auto",children:[(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("div",{className:"text-muted-foreground mb-1 font-sans text-xs font-medium",children:c?.localVersion??"Local (this device)"}),(0,d.jsx)("pre",{className:"whitespace-pre-wrap text-foreground/80 leading-relaxed",children:n.local||(c?.emptyFile??"(empty)")})]}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("div",{className:"text-muted-foreground mb-1 font-sans text-xs font-medium",children:c?.remoteVersion??"Remote"}),(0,d.jsx)("pre",{className:"whitespace-pre-wrap text-foreground/80 leading-relaxed",children:n.remote||(c?.emptyFile??"(empty)")})]})]}):null})]})}function u({syncT:a}){let[b,c]=(0,e.useState)(!1),[f,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(!1),[p,r]=(0,e.useState)(!1);(0,e.useRef)(!1);let s=f!==l,t=async()=>{try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"gitignore-save",content:f})}),m(f),r(!0),setTimeout(()=>r(!1),2e3)}catch{}};return(0,d.jsxs)("div",{className:"pt-2 border-t border-border/50",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>c(!b),className:"flex items-center gap-2 w-full text-left text-sm text-muted-foreground hover:text-foreground transition-colors py-1",children:[(0,d.jsx)(g.A,{size:14,className:`shrink-0 transition-transform ${b?"rotate-90":""}`}),(0,d.jsx)(i.A,{size:13,className:"shrink-0"}),(0,d.jsx)("span",{children:a?.gitignoreTitle??"Excluded files"}),(0,d.jsx)("span",{className:"text-2xs opacity-50",children:".gitignore"})]}),b&&(0,d.jsx)("div",{className:"mt-2 space-y-2",children:n?(0,d.jsx)("div",{className:"flex justify-center py-4",children:(0,d.jsx)(h.A,{size:14,className:"animate-spin text-muted-foreground"})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("textarea",{value:f,onChange:a=>k(a.target.value),rows:8,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-xs font-mono leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-y",placeholder:a?.gitignorePlaceholder??"# Files to exclude from sync\n*.tmp\nsecret/",spellCheck:!1}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,d.jsx)("button",{type:"button",onClick:t,className:"flex items-center gap-1.5 px-3 py-1 text-xs rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity",children:a?.gitignoreSave??"Save"}),p&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs text-success",children:[(0,d.jsx)(j.A,{size:12})," ",a?.gitignoreSaved??"Saved"]})]})]})})]})}function v({t:a,onInitComplete:b}){var c;let g=a.settings?.sync,[i,o]=(0,e.useState)(""),[r,t]=(0,e.useState)(""),[u,v]=(0,e.useState)("main"),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(-1),[A,B]=(0,e.useState)(""),C=(0,e.useRef)(null),D=y>=0&&y<4,E=i.trim()?(c=i.trim(),/^https:\/\/.+/.test(c)?"https":!!/^git@[\w.-]+:.+/.test(c)&&"ssh"):null,F="https"===E||"ssh"===E,G=async()=>{z(0),B("");let a=(a,b)=>setTimeout(()=>z(b=>b>=0&&b<4?a:b),b);C.current=a(1,2e3);let c=a(2,5e3);try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",remote:i.trim(),token:r.trim()||void 0,branch:u.trim()||"main"}),timeout:12e4}),z(4),setTimeout(()=>b(),600)}catch(c){let a=c instanceof Error?c.message:"Connection failed";a.includes("timed out")&&(a=g?.timeoutError??"Connection timed out. The remote repository may be large or the network is slow. Please try again.");let b=s(a,i,g);B(b?`${a}
54
+ `,children:[e&&(0,d.jsx)("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-[2px] h-[18px] rounded-r-full bg-[var(--amber)]"}),(0,d.jsx)("span",{className:"shrink-0 flex items-center justify-center w-[18px]",children:a}),i,f&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"ml-2.5 text-sm whitespace-nowrap",children:b}),c&&(0,d.jsx)("span",{className:"ml-auto text-2xs text-muted-foreground/60 font-mono shrink-0",children:c})]})]})}function x({activePanel:a,onPanelChange:b,onEchoClick:c,onAgentsClick:f,onDiscoverClick:x,onWorkflowsClick:y,syncStatus:z,expanded:A,onExpandedChange:B,onSettingsClick:C,onSyncClick:D}){let E=(0,e.useRef)(0),F=(0,e.useRef)(null),{t:G}=(0,r.Y)(),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(()=>!1),[L,M]=(0,e.useState)(()=>!1),N=(0,e.useCallback)(a=>{let b=Date.now();b-E.current<300||(E.current=b,a())},[]),O=(0,e.useCallback)(c=>{N(()=>b(a===c?null:c))},[a,b,N]),P=(0,s.Bq)(z,!1),Q=A?v:u,R="off"!==P&&"synced"!==P?(0,d.jsx)("span",{className:`absolute ${A?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full ${s.BG[P]} ${"error"===P||"conflicts"===P?"animate-pulse":""}`}):void 0;return(0,d.jsxs)("aside",{className:"group hidden md:flex fixed top-0 left-0 h-screen z-[31] flex-col bg-background border-r border-border transition-[width] duration-200 ease-out",style:{width:`${Q}px`},role:"toolbar","aria-label":"Navigation","aria-orientation":"vertical",children:[(0,d.jsxs)("div",{className:"flex flex-col h-full w-full overflow-hidden",children:[(0,d.jsxs)(g(),{href:"/",className:`flex items-center ${A?"px-3 gap-2":"justify-center"} w-full h-[45px] shrink-0 hover:opacity-80 transition-opacity`,"aria-label":"MindOS Home",children:[(0,d.jsx)(t.A,{id:"rail",className:"w-7 h-3.5 shrink-0"}),A&&(0,d.jsx)("span",{className:"text-sm font-semibold text-foreground font-display whitespace-nowrap",children:"MindOS"})]}),(0,d.jsx)("div",{className:`${A?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsxs)("div",{className:`flex flex-col ${A?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,d.jsx)(w,{icon:(0,d.jsx)(h.A,{size:18}),label:G.sidebar.files,active:"files"===a,expanded:A,onClick:()=>O("files"),walkthroughId:"files-panel"}),J&&(0,d.jsx)(w,{icon:(0,d.jsx)(i.A,{size:18}),label:G.sidebar.echo,active:"echo"===a,expanded:A,onClick:()=>c?N(c):O("echo"),walkthroughId:"echo-panel"}),(0,d.jsx)(w,{icon:(0,d.jsx)(j.A,{size:18}),label:G.sidebar.searchTitle,shortcut:"⌘K",active:"search"===a,expanded:A,onClick:()=>O("search")}),(0,d.jsx)(w,{icon:(0,d.jsx)(k.A,{size:18}),label:G.sidebar.agents,active:"agents"===a,expanded:A,onClick:()=>f?N(f):O("agents"),walkthroughId:"agents-panel"}),L&&(0,d.jsx)(w,{icon:(0,d.jsx)(l.A,{size:18}),label:G.sidebar.workflows??"Flows",active:"workflows"===a,expanded:A,onClick:()=>y?N(y):O("workflows")})]}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsx)("div",{className:`${A?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsx)("div",{className:`flex flex-col ${A?"px-1.5":"items-center"} gap-1 py-2`,children:(0,d.jsx)(w,{icon:(0,d.jsx)(m.A,{size:18}),label:G.sidebar.discover,active:"discover"===a,expanded:A,onClick:()=>x?N(x):O("discover")})}),(0,d.jsx)("div",{className:`${A?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsxs)("div",{className:`flex flex-col ${A?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,d.jsx)(w,{icon:(0,d.jsx)(n.A,{size:18}),label:G.sidebar.settingsTitle,shortcut:"⌘,",expanded:A,onClick:()=>N(C),badge:H?(0,d.jsx)("span",{className:`absolute ${A?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full bg-error`}):void 0}),z?.enabled&&z?.remote&&"(not configured)"!==z.remote&&(0,d.jsx)(w,{icon:(0,d.jsx)(o.A,{size:18}),label:G.sidebar.syncLabel,expanded:A,buttonRef:F,badge:R,onClick:()=>N(()=>{let a=F.current?.getBoundingClientRect();a&&D(a)})})]})]}),(0,d.jsx)("button",{onClick:()=>B(!A),className:" absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-[32] w-5 h-5 rounded-full bg-card border border-border shadow-sm flex items-center justify-center opacity-0 group-hover:opacity-100 hover:!opacity-100 transition-opacity duration-200 text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring ","aria-label":A?"Collapse sidebar":"Expand sidebar",title:A?"Collapse":"Expand",children:A?(0,d.jsx)(p.A,{size:10}):(0,d.jsx)(q.A,{size:10})})]})}},5200:(a,b,c)=>{"use strict";function d({ssrLocale:a}){return null}c.d(b,{default:()=>d}),c(67484),c(30315)},5315:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/components/ShellLayout.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ShellLayout.tsx","default")},6596:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>m});var e=c(48249),f=c(67484),g=c(49681),h=c(44218),i=c(78835),j=c(98610),k=c(30315),l=a([j]);function m({value:a,onChange:b,showSkip:c=!1,compact:d=!1,configuredProviders:l}){let{locale:m}=(0,k.Y)(),[n,o]=(0,f.useState)(!1),p=(0,j.bf)(),q=c=>{let f=j.T_[c],h="zh"===m?f.nameZh:f.name,i=a===c,k=l?.has(c);return d?(0,e.jsxs)("button",{type:"button",onClick:()=>b(c),className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-left transition-all text-sm ${i?"border-[var(--amber)] bg-[var(--amber-subtle)] shadow-sm":"border-border/50 hover:border-border hover:bg-muted/30"}`,children:[(0,e.jsx)("span",{className:`font-medium ${i?"text-foreground":"text-muted-foreground"}`,children:h}),k&&!i&&(0,e.jsx)(g.A,{size:12,className:"text-success ml-auto shrink-0"}),i&&(0,e.jsx)(g.A,{size:14,className:"ml-auto shrink-0",style:{color:"var(--amber)"}})]},c):(0,e.jsxs)("button",{type:"button",onClick:()=>b(c),className:"flex items-start gap-3 p-4 rounded-xl border text-left transition-all duration-150",style:{background:i?"var(--amber-dim)":"var(--card)",borderColor:i?"var(--amber)":"var(--border)"},children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:"text-sm font-medium",style:{color:"var(--foreground)"},children:h}),(0,e.jsx)("p",{className:"text-xs mt-0.5",style:{color:"var(--muted-foreground)"},children:f.defaultModel})]}),k&&!i&&(0,e.jsx)(g.A,{size:14,className:"text-success shrink-0 mt-0.5"}),i&&(0,e.jsx)(g.A,{size:16,className:"shrink-0 mt-0.5",style:{color:"var(--amber)"}})]},c)},{primary:r,more:s}=p;return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:d?"flex flex-wrap gap-2":"grid grid-cols-1 gap-2",children:r.map(q)}),s.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",onClick:()=>o(!n),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",children:[(0,e.jsx)(h.A,{size:12,className:`transition-transform ${n?"rotate-180":""}`}),n?"zh"===m?"收起":"Show less":"zh"===m?`更多 (${s.length})`:`More providers (${s.length})`]}),n&&(0,e.jsx)("div",{className:d?"flex flex-wrap gap-2":"grid grid-cols-1 gap-2",children:s.map(q)})]}),c&&(0,e.jsxs)("button",{type:"button",onClick:()=>b("skip"),className:"flex items-center gap-2 px-3 py-2 rounded-lg border text-left transition-all text-sm w-full mt-1",style:{background:"skip"===a?"var(--amber-dim)":"var(--card)",borderColor:"skip"===a?"var(--amber)":"var(--border)"},children:[(0,e.jsx)(i.A,{size:14,className:"shrink-0",style:{color:"skip"===a?"var(--amber)":"var(--muted-foreground)"}}),(0,e.jsx)("span",{className:`font-medium ${"skip"===a?"text-foreground":"text-muted-foreground"}`,children:"zh"===m?"暂时跳过":"Skip for now"}),"skip"===a&&(0,e.jsx)(g.A,{size:14,className:"ml-auto shrink-0",style:{color:"var(--amber)"}})]})]})}j=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},6732:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TimelineRenderer:()=>i});var d=c(48249),e=c(67484);let f=/(\d{4}[-/]\d{1,2}(?:[-/]\d{1,2})?|[A-Za-z]+ \d{4}|\d{4}年\d{1,2}月(?:\d{1,2}日)?)/;function g(a){return a.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="font-display" style="font-size:0.85em;padding:1px 5px;border-radius:4px;background:var(--muted)">$1</code>').replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(a,b,c)=>`<span style="color:var(--amber);cursor:pointer" title="${b}">${c??b}</span>`).replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" style="color:var(--amber)">$1</a>')}let h=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"#8ab4d8"},{bg:"rgba(200,160,216,0.12)",text:"#c8a0d8"}];function i({content:a}){let b=(0,e.useMemo)(()=>(function(a){let b=a.split("\n"),c=[],d=null,e=[],g=()=>{let a,b;if(!d)return;let f=e.join("\n").trim();d.body=f,d.tags=(a=[],(b=f.match(/#([\w\u4e00-\u9fff]+)/g))&&a.push(...b.map(a=>a.slice(1))),[...new Set(a)]),c.push(d),d=null,e=[]};for(let a of b)if(!/^# /.test(a)){if(/^## /.test(a)){g();let b=a.slice(3).trim();d={heading:b,date:function(a){let b=f.exec(a);if(!b)return null;let c=new Date(b[1].replace(/[/年月]/g,"-").replace("日",""));return isNaN(c.getTime())?null:c}(b),body:"",tags:[]};continue}d&&e.push(a)}return g(),c})(a),[a]);return 0===b.length?(0,d.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:["No timeline entries found. Add ",(0,d.jsx)("code",{style:{background:"var(--muted)",padding:"1px 6px",borderRadius:4},children:"## 2025-01-15"})," headings to create entries."]}):(0,d.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,d.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[b.length," ",1===b.length?"entry":"entries"]})}),(0,d.jsxs)("div",{style:{position:"relative",paddingLeft:28},children:[(0,d.jsx)("div",{style:{position:"absolute",left:6,top:8,bottom:8,width:1,background:"var(--border)"}}),b.map((a,b)=>(0,d.jsxs)("div",{style:{position:"relative",marginBottom:"1.5rem"},children:[(0,d.jsx)("div",{style:{position:"absolute",left:-22,top:10,width:9,height:9,borderRadius:"50%",background:a.date?"var(--amber)":"var(--border)",outline:a.date?"2px solid var(--amber-dim)":"none",zIndex:1}}),(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 18px",transition:"border-color .15s"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginBottom:8},children:[(0,d.jsx)("span",{style:{fontWeight:600,fontSize:"0.9rem",color:"var(--foreground)"},children:a.heading}),a.date&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.7rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0},children:a.date.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]}),a.body&&(0,d.jsx)("div",{dangerouslySetInnerHTML:{__html:function(a){let b=a.split("\n"),c=[],d=!1,e=()=>{d&&(c.push("</ul>"),d=!1)};for(let a of b){let b=a.trimEnd();if(!b){e(),c.push("<br/>");continue}if(/^### /.test(b)){e(),c.push(`<h3 style="font-size:0.8rem;font-weight:600;color:var(--muted-foreground);text-transform:uppercase;letter-spacing:.06em;margin:.9em 0 .3em">${g(b.slice(4))}</h3>`);continue}if(/^- /.test(b)||/^\* /.test(b)){d||(c.push('<ul style="margin:.3em 0;padding-left:1.2em;list-style:disc">'),d=!0),c.push(`<li style="margin:.15em 0;font-size:.82rem;color:var(--foreground)">${g(b.slice(2))}</li>`);continue}if(/^\d+\. /.test(b)){d||(c.push('<ol style="margin:.3em 0;padding-left:1.2em">'),d=!0),c.push(`<li style="margin:.15em 0;font-size:.82rem;color:var(--foreground)">${g(b.replace(/^\d+\. /,""))}</li>`);continue}e(),c.push(`<p style="margin:.25em 0;font-size:.82rem;line-height:1.6;color:var(--foreground)">${g(b)}</p>`)}return e(),c.join("")}(a.body)}}),a.tags.length>0&&(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:5,marginTop:10},children:a.tags.map(a=>{let b=function(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)&65535;return h[b%h.length]}(a);return(0,d.jsxs)("span",{className:"font-display",style:{fontSize:"0.68rem",padding:"1px 8px",borderRadius:999,background:b.bg,color:b.text},children:["#",a]},a)})})]})]},b))]})]})}},8278:(a,b,c)=>{Promise.resolve().then(c.bind(c,12978)),Promise.resolve().then(c.bind(c,24387)),Promise.resolve().then(c.bind(c,66913)),Promise.resolve().then(c.bind(c,66874)),Promise.resolve().then(c.bind(c,63112)),Promise.resolve().then(c.bind(c,60442)),Promise.resolve().then(c.bind(c,37718)),Promise.resolve().then(c.bind(c,45862)),Promise.resolve().then(c.bind(c,1394)),Promise.resolve().then(c.bind(c,18776)),Promise.resolve().then(c.bind(c,83539)),Promise.resolve().then(c.bind(c,5315)),Promise.resolve().then(c.bind(c,32248)),Promise.resolve().then(c.bind(c,68533)),Promise.resolve().then(c.bind(c,90598)),Promise.resolve().then(c.bind(c,31442))},10064:(a,b,c)=>{"use strict";c.d(b,{f:()=>e});var d=c(99829);let e=(0,d.createServerReference)("60dc1ced67756a0567217fc70906cce7aff02e0060",d.callServer,void 0,d.findSourceMapURL,"renameFileAction")},10072:(a,b,c)=>{"use strict";c.d(b,{AI:()=>e,RS:()=>d});let d=["about-you","continued","daily","past-you","growth"],e={"about-you":"/echo/about-you",continued:"/echo/continued",daily:"/echo/daily","past-you":"/echo/past-you",growth:"/echo/growth"}},10500:(a,b,c)=>{"use strict";function d(){return null}c.d(b,{default:()=>d}),c(67484)},12978:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/app/register-sw.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/app/register-sw.tsx","default")},13859:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>i});var e=c(67484),f=c(61112),g=c(92464),h=a([f]);function i(){let[a,b]=(0,e.useState)(!1),[c,d]=(0,e.useState)(f.eX),[h,i]=(0,e.useState)("panel"),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)("user"),[r,s]=(0,e.useState)(null),t=(0,e.useRef)(f.eX);(0,g.KT)();let u=(0,e.useCallback)(()=>{"popup"===h?k(a=>(a||(m(""),q("user"),s(null)),!a)):b(a=>(a||(m(""),q("user"),s(null)),!a))},[h]),v=(0,e.useCallback)(()=>{b(!1),n&&(d(t.current),o(!1))},[n]),w=(0,e.useCallback)(()=>{o(a=>(a?d(t.current):t.current=c,!a))},[c]),x=(0,e.useCallback)(()=>k(!1),[]),y=(0,e.useCallback)(a=>d(a),[]),z=(0,e.useCallback)(a=>{try{localStorage.setItem("right-ask-panel-width",String(a))}catch{}},[]),A=(0,e.useCallback)(()=>{i(a=>{let c="panel"===a?"popup":"panel";try{localStorage.setItem("ask-mode",c),window.dispatchEvent(new StorageEvent("storage",{key:"ask-mode",newValue:c}))}catch{}return"popup"===c?(b(!1),k(!0)):(k(!1),b(!0)),c})},[]);return{askPanelOpen:a,askPanelWidth:c,askMaximized:n,askMode:h,desktopAskPopupOpen:j,askInitialMessage:l,askOpenSource:p,askAcpAgent:r,toggleAskPanel:u,closeAskPanel:v,closeDesktopAskPopup:x,handleAskWidthChange:y,handleAskWidthCommit:z,handleAskModeSwitch:A,toggleAskMaximized:w}}f=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},14039:(a,b,c)=>{"use strict";c.d(b,{P:()=>w});var d=c(48249),e=c(67484),f=c(49681),g=c(40560),h=c(8455),i=c(33740),j=c(84248),k=c(69924),l=c(56884),m=c(86588),n=c(95054),o=c(30315);let p="https://github.com/GeminiLight/MindOS/releases",q="mindos_update_in_progress",r={downloading:{en:"Downloading update",zh:"下载更新"},skills:{en:"Updating skills",zh:"更新 Skills"},rebuilding:{en:"Rebuilding app",zh:"重新构建应用"},restarting:{en:"Restarting server",zh:"重启服务"}};function s({status:a}){switch(a){case"done":return(0,d.jsx)(f.A,{size:14,className:"text-success shrink-0"});case"running":return(0,d.jsx)(g.A,{size:14,className:"animate-spin shrink-0 text-[var(--amber)]"});case"failed":return(0,d.jsx)(h.A,{size:14,className:"text-destructive shrink-0"});default:return(0,d.jsx)(i.A,{size:14,className:"text-muted-foreground/40 shrink-0"})}}function t(a){return a<1048576?`${Math.round(a/1024)} KB`:`${(a/1048576).toFixed(1)} MB`}function u(){let{t:a}=(0,o.Y)(),b=a.settings.update,[c,i]=(0,e.useState)("idle"),[l,m]=(0,e.useState)(""),[n,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(null),[s,u]=(0,e.useState)(0),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(""),z=async()=>{if(null.checkCoreUpdate){i("checking"),w("");try{let a=await null.checkCoreUpdate();m(a.currentVersion),a.desktopTooOld?(p(a.latestVersion),y(a.minDesktopVersion),i("desktopTooOld")):a.available?(p(a.latestVersion),r({urls:a.urls,size:a.size,sha256:a.sha256}),i("available")):i("idle")}catch{i("idle")}}},A=async()=>{if(null.downloadCoreUpdate&&q){i("downloading"),u(0);try{await null.downloadCoreUpdate(q.urls,n,q.size,q.sha256),i("ready")}catch(b){let a=b instanceof Error?b.message:String(b);a.includes("aborted")?i("available"):(i("error"),w(a||"Download failed"))}}},B=async()=>{if(null.applyCoreUpdate){i("applying");try{let a=await null.applyCoreUpdate();a?.version&&m(a.version),i("idle")}catch(a){i("error"),w(a instanceof Error?a.message:"Apply failed")}}};return null.checkCoreUpdate?(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:b?.coreTitle??"MindOS Core"}),l&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground",children:["v",l]})]}),"checking"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin"}),b?.checking??"Checking for updates..."]}),"idle"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),b?.coreUpToDate??"Core is up to date"]}),"available"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(j.A,{size:13}),"v",n," ",b?.coreAvailable?b.coreAvailable(t(q?.size??0)):`available (${t(q?.size??0)})`]}),("downloading"===c||"cancelling"===c)&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin text-[var(--amber)]"}),"cancelling"===c?b?.coreCancel??"Cancelling...":(0,d.jsxs)(d.Fragment,{children:[b?.coreDownloading??"Downloading..."," v",n]})]}),"downloading"===c&&(0,d.jsx)("button",{onClick:()=>{null.cancelCoreDownload?.(),i("cancelling")},className:"text-muted-foreground hover:text-foreground transition-colors",children:b?.coreCancel??"Cancel"})]}),(0,d.jsx)("div",{className:"h-1 rounded-full bg-muted overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-[var(--amber)] transition-all duration-300",style:{width:`${Math.max(s,3)}%`}})})]}),"ready"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),"v",n," ",b?.coreReady??"ready — restart services to apply"]}),"applying"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin text-[var(--amber)]"}),b?.coreApplying??"Applying update..."]}),"desktopTooOld"===c&&(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(h.A,{size:13}),b?.coreDesktopTooOld?b.coreDesktopTooOld(n):`v${n} requires a newer Desktop.`]}),(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground",children:[b?.coreDesktopTooOldHint??"Please update MindOS Desktop first."," (Desktop ≥ v",x,")"]})]}),"error"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[(0,d.jsx)(h.A,{size:13}),v||(b?.coreError??"Core update failed.")]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[("idle"===c||"error"===c)&&(0,d.jsxs)("button",{onClick:z,disabled:"idle"!==c&&"error"!==c,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(k.A,{size:14}),b?.checkButton??"Check for Updates"]}),"available"===c&&(0,d.jsxs)("button",{onClick:A,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(j.A,{size:14}),b?.updateButton?b.updateButton(n):`Update to v${n}`]}),"ready"===c&&(0,d.jsxs)("button",{onClick:B,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(k.A,{size:14}),b?.coreRestartServices??"Restart Services"]}),"error"===c&&(0,d.jsxs)("button",{onClick:q?A:z,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(k.A,{size:14}),b?.coreRetry??"Retry"]})]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/60",children:b?.coreHint??"Core updates only restart services — no app restart needed."})]}):null}function v(){let{t:a}=(0,o.Y)(),b=a.settings.update,[c,i]=(0,e.useState)("idle"),[n,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(""),[v,w]=(0,e.useState)(0),[x,y]=(0,e.useState)(""),z=async()=>{i("checking"),y("");try{let a=await null.checkUpdate();q(a.available),a.version&&s(a.version),i("idle")}catch{i("error"),y(b?.error??"Failed to check for updates.")}},A=async()=>{i("downloading"),w(0);try{await null.installUpdate()}catch{i("error"),y("Update failed. Please try again.")}};return(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(l.A,{size:14,className:"text-muted-foreground"}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:b?.shellTitle??"MindOS Desktop"})]}),t&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground",children:["v",t]})]}),"checking"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin"}),b?.checking??"Checking for updates..."]}),"idle"===c&&!n&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),b?.upToDate??"You're up to date"]}),"idle"===c&&n&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(j.A,{size:13}),r?`Update available: v${r}`:"Update available"]}),"downloading"===c&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin text-[var(--amber)]"}),b?.desktopDownloading??"Downloading update..."]}),(0,d.jsx)("div",{className:"h-1 rounded-full bg-muted overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-[var(--amber)] transition-all duration-300",style:{width:`${Math.max(v,3)}%`}})})]}),"ready"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),b?.desktopReady??"Update downloaded. Restart to apply."]}),"error"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[(0,d.jsx)(h.A,{size:13}),x]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,d.jsxs)("button",{onClick:z,disabled:"checking"===c||"downloading"===c,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(k.A,{size:14,className:"checking"===c?"animate-spin":""}),b?.checkButton??"Check for Updates"]}),"idle"===c&&n&&(0,d.jsxs)("button",{onClick:A,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(j.A,{size:14}),r?`Update to v${r}`:"Update"]}),"ready"===c&&(0,d.jsxs)("button",{onClick:async()=>{try{await null.installUpdate()}catch{i("error"),y(b?.error??"Failed to install update.")}},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(k.A,{size:14}),b?.desktopRestart??"Restart Now"]})]}),(0,d.jsxs)("div",{className:"border-t border-border/50 pt-3 space-y-2",children:[(0,d.jsxs)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[(0,d.jsx)(m.A,{size:12}),b?.releaseNotes??"View release notes"]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/60",children:b?.desktopHint??"Updates are delivered through the Desktop app auto-updater."})]})]})}function w(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)(!0);return a?(0,d.jsxs)("div",{className:"space-y-6",children:[c&&(0,d.jsx)(u,{}),(0,d.jsx)(v,{})]}):(0,d.jsx)(x,{})}function x(){let{t:a,locale:b}=(0,o.Y)(),c=a.settings.update,[i,l]=(0,e.useState)(null),[t,u]=(0,e.useState)("idle"),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)([]),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)(!1),D=(0,e.useRef)(void 0),E=(0,e.useRef)(void 0),F=(0,e.useRef)(""),G=(0,e.useCallback)(async()=>{u("checking"),w("");try{let a=await (0,n.n)("/api/update-check");if(l(a),F.current||(F.current=a.current),a.hasUpdate){let b=localStorage.getItem("mindos_update_dismissed");localStorage.setItem("mindos_update_latest",a.latest),window.dispatchEvent(new Event(a.latest===b?"mindos:update-dismissed":"mindos:update-available"))}else localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),window.dispatchEvent(new Event("mindos:update-dismissed"));u("idle")}catch{u("error"),w(c?.error??"Failed to check for updates.")}},[c]),H=(0,e.useCallback)(()=>{clearInterval(D.current),clearTimeout(E.current)},[]),I=(0,e.useCallback)(a=>{H(),l(a),u("updated"),localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),localStorage.removeItem(q),window.dispatchEvent(new Event("mindos:update-dismissed")),setTimeout(()=>window.location.reload(),2e3)},[H]),J=(0,e.useCallback)(()=>{D.current=setInterval(async()=>{try{let a=await (0,n.n)("/api/update-status",{timeout:5e3});if(C(!1),a.stages?.length>0&&y(a.stages),"failed"===a.stage){H(),localStorage.removeItem(q),A(a.error||"Update failed"),u("error");return}if("done"===a.stage)try{let a=await (0,n.n)("/api/update-check");if(a.current!==F.current)return void I(a)}catch{}}catch{C(!0);try{let a=await (0,n.n)("/api/update-check",{timeout:5e3});a.current&&a.current!==F.current&&(y(a=>a.map(a=>({...a,status:"done"}))),I(a))}catch{}}},3e3),E.current=setTimeout(()=>{H(),localStorage.removeItem(q),u("timeout")},9e5)},[H,I]),K=(0,e.useCallback)(async()=>{u("updating"),w(""),A(null),C(!1),y([{id:"downloading",status:"pending"},{id:"skills",status:"pending"},{id:"rebuilding",status:"pending"},{id:"restarting",status:"pending"}]),localStorage.setItem(q,JSON.stringify({originalVer:F.current||i?.current,startedAt:Date.now()})),window.dispatchEvent(new Event("mindos:update-started"));try{await (0,n.n)("/api/update",{method:"POST"})}catch(a){if(a instanceof n.h){localStorage.removeItem(q),A(a.message||"Update failed"),u("error");return}}J()},[J,i]),L=(0,e.useCallback)(()=>{A(null),K()},[K]),M="zh"===b?"zh":"en",N=x.filter(a=>"done"===a.status).length,O=x.length>0?Math.round(N/x.length*100):0;return(0,d.jsx)("div",{className:"space-y-6",children:(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:"MindOS"}),i&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground",children:["v",i.current]})]}),"checking"===t&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(g.A,{size:13,className:"animate-spin"}),c?.checking??"Checking for updates..."]}),"idle"===t&&i&&!i.hasUpdate&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),c?.upToDate??"You're up to date"]}),"idle"===t&&i?.hasUpdate&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(j.A,{size:13}),c?.available?c.available(i.current,i.latest):`Update available: v${i.current} → v${i.latest}`]}),"updating"===t&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("div",{className:"space-y-1.5",children:x.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,d.jsx)(s,{status:a.status}),(0,d.jsx)("span",{className:"pending"===a.status?"text-muted-foreground/50":"running"===a.status?"text-foreground":"text-muted-foreground",children:r[a.id]?.[M]??a.id})]},a.id))}),(0,d.jsx)("div",{className:"h-1 rounded-full bg-muted overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-[var(--amber)] transition-all duration-500 ease-out",style:{width:`${Math.max(O,5)}%`}})}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:B?c?.serverRestarting??"Server is restarting, please wait...":c?.updatingHint??"This may take 1–3 minutes. Do not close this page."})]}),"updated"===t&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(f.A,{size:13}),c?.updated??"Updated successfully! Reloading..."]}),"timeout"===t&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--amber-text)]",children:[(0,d.jsx)(h.A,{size:13}),c?.timeout??"Update may still be in progress."]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:c?.timeoutHint??"The server may need more time to rebuild. Try refreshing."}),(0,d.jsxs)("button",{onClick:()=>window.location.reload(),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(k.A,{size:12}),c?.refreshButton??"Refresh Page"]})]}),"error"===t&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[(0,d.jsx)(h.A,{size:13}),z||v]}),z&&(0,d.jsxs)("button",{onClick:L,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(k.A,{size:12}),c?.retryButton??"Retry Update"]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,d.jsxs)("button",{onClick:G,disabled:"checking"===t||"updating"===t,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(k.A,{size:14,className:"checking"===t?"animate-spin":""}),c?.checkButton??"Check for Updates"]}),i?.hasUpdate&&"updating"!==t&&"updated"!==t&&(0,d.jsxs)("button",{onClick:K,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg font-medium text-[var(--amber-foreground)] bg-[var(--amber)] transition-colors",children:[(0,d.jsx)(j.A,{size:14}),c?.updateButton?c.updateButton(i.latest):`Update to v${i.latest}`]})]}),(0,d.jsxs)("div",{className:"border-t border-border/50 pt-3 space-y-2",children:[(0,d.jsxs)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[(0,d.jsx)(m.A,{size:12}),c?.releaseNotes??"View release notes"]}),(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground/60",children:[c?.hint??"Updates are installed via npm. Equivalent to running"," ",(0,d.jsx)("code",{className:"font-mono bg-muted px-1 py-0.5 rounded",children:"mindos update"})," ",c?.inTerminal??"in your terminal."]})]})]})})}},15330:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(null),[f,g]=(0,d.useState)([]),[h,i]=(0,d.useState)(0);(0,d.useCallback)(()=>{fetch("/api/files").then(a=>a.ok?a.json():[]).then(a=>Array.isArray(a)?a:[]).catch(()=>[]).then(b)},[]);let j=(0,d.useCallback)((b,c)=>{let d=c??b.length,f=b.slice(0,d),h=f.lastIndexOf("@");if(-1===h||h>0&&" "!==f[h-1]&&"\n"!==f[h-1])return void e(null);let j=f.slice(h+1);if(j.includes(" ")||j.includes("\n")){e(null),g([]),i(0);return}let k=j.toLowerCase();if(!k){e(j),g(a.slice(0,30)),i(0);return}let l=a.map(a=>{let b=(a.split("/").pop()??a).toLowerCase(),c=a.toLowerCase(),d=0;return b.startsWith(k)?d=100:b.includes(k)?d=50:c.includes(k)&&(d=10),{path:a,score:d}}).filter(a=>a.score>0).sort((a,b)=>b.score-a.score).slice(0,30);if(0===l.length){e(null),g([]),i(0);return}e(j),g(l.map(a=>a.path)),i(0)},[a]),k=(0,d.useCallback)(a=>{0!==f.length&&("down"===a?i(a=>Math.min(a+1,f.length-1)):i(a=>Math.max(a-1,0)))},[f.length]);return{mentionQuery:c,mentionResults:f,mentionIndex:h,updateMentionFromInput:j,navigateMention:k,resetMention:(0,d.useCallback)(()=>{e(null),g([]),i(0)},[])}}},16613:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>aa,Fo:()=>R,gL:()=>S});var d=c(48249),e=c(67484),f=c(19099),g=c(93491),h=c(33191),i=c(83654),j=c(80600),k=c(24520),l=c(37917),m=c(801),n=c(16944),o=c(15273),p=c(12625),q=c(59347),r=c(86718),s=c(40560),t=c(44218),u=c(28330),v=c(7309),w=c(65032),x=c(24703),y=c(99829);let z=(0,y.createServerReference)("402f7ce392474d4c4247ba0fa71393a6a1777ac68d",y.callServer,void 0,y.findSourceMapURL,"convertToSpaceAction"),A=(0,y.createServerReference)("601f45dc614facf01eed979138942934e3f2311741",y.callServer,void 0,y.findSourceMapURL,"createFileAction"),B=(0,y.createServerReference)("60fba0025d97160bdef1ab06ef8a3443fe107a5527",y.callServer,void 0,y.findSourceMapURL,"renameSpaceAction");var C=c(10064);let D=(0,y.createServerReference)("40b44893a01ca862cba8f62183dce2e428c2cff3b2",y.callServer,void 0,y.findSourceMapURL,"deleteSpaceAction"),E=(0,y.createServerReference)("40644eb710d62bf567308d16e611d6b80f9d8f05a8",y.callServer,void 0,y.findSourceMapURL,"deleteFolderAction");var F=c(92800),G=c(44791),H=c(99101),I=c(30315),J=c(57056),K=c(29713),L=c(93678);function M(){window.dispatchEvent(new Event("mindos:files-changed"))}async function N(a){try{await navigator.clipboard.writeText(a)}catch{}}let O="show-hidden-files";function P(a){let b=b=>{b.key===O&&a()},c=()=>a();return window.addEventListener("storage",b),window.addEventListener("mindos:hidden-files-changed",c),()=>{window.removeEventListener("storage",b),window.removeEventListener("mindos:hidden-files-changed",c)}}function Q(){return!1}function R(a){localStorage.setItem(O,String(a)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function S(){return(0,e.useSyncExternalStore)(P,Q,()=>!1)}function T({x:a,y:b,onClose:c,menuHeight:f,children:g}){let h=(0,e.useRef)(null),i=Math.min(b,window.innerHeight-(f??160)),j=Math.min(a,window.innerWidth-200);return(0,d.jsx)("div",{ref:h,className:"fixed z-50 min-w-[180px] bg-card border border-border rounded-lg shadow-lg py-1",style:{top:i,left:j},children:g})}let U="w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",V="w-full flex items-center gap-2 px-3 py-2 text-sm text-error hover:bg-error/10 transition-colors text-left",W="my-1 border-t border-border/50";function X({x:a,y:b,node:c,onClose:e,onRename:g,onNewFile:i,onImport:j,onDelete:r}){let s=(0,f.useRouter)(),{t}=(0,I.Y)(),{isPinned:u,togglePin:v}=(0,K.Z)(),w=u(c.path);return(0,d.jsxs)(T,{x:a,y:b,onClose:e,children:[(0,d.jsxs)("button",{className:U,onClick:()=>{i(),e()},children:[(0,d.jsx)(k.A,{size:14,className:"shrink-0"})," ",t.fileTree.newFile]}),(0,d.jsxs)("button",{className:U,onClick:()=>{s.push(`/view/${(0,h.O0)(`${c.path}/INSTRUCTION.md`)}`),e()},children:[(0,d.jsx)(l.A,{size:14,className:"shrink-0"})," ",t.fileTree.viewRules]}),j&&(0,d.jsxs)("button",{className:U,onClick:()=>{j(c.path),e()},children:[(0,d.jsx)(m.A,{size:14,className:"shrink-0"})," ",t.fileTree.importFile]}),(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:U,onClick:()=>{v(c.path),e()},children:[(0,d.jsx)(n.A,{size:14,className:`shrink-0 ${w?"fill-[var(--amber)] text-[var(--amber)]":""}`}),w?t.fileTree.removeFromFavorites:t.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:U,onClick:()=>{N(c.path),e()},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",t.fileTree.copyPath]}),(0,d.jsxs)("button",{className:U,onClick:()=>{g(),e()},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",t.fileTree.renameSpace]}),(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:V,onClick:()=>{e(),r()},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"}),t.fileTree.deleteSpace]})]})}function Y({x:a,y:b,node:c,onClose:g,onRename:h,onNewFile:i,onDelete:j}){let l=(0,f.useRouter)(),{t:m}=(0,I.Y)(),[s,t]=(0,e.useTransition)(),{isPinned:u,togglePin:v}=(0,K.Z)(),w=u(c.path);return(0,d.jsxs)(T,{x:a,y:b,onClose:g,menuHeight:220,children:[(0,d.jsxs)("button",{className:U,onClick:()=>{i(),g()},children:[(0,d.jsx)(k.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:U,onClick:()=>{v(c.path),g()},children:[(0,d.jsx)(n.A,{size:14,className:`shrink-0 ${w?"fill-[var(--amber)] text-[var(--amber)]":""}`}),w?m.fileTree.removeFromFavorites:m.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:U,disabled:s,onClick:()=>{t(async()=>{if((await z(c.path)).success){l.refresh(),M();let a=c.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||c.name;(0,L.w)().then(b=>{b&&(0,L.V)(a,c.path)})}g()})},children:[(0,d.jsx)(r.A,{size:14,className:"shrink-0 text-[var(--amber)]"})," ",m.fileTree.convertToSpace]}),(0,d.jsxs)("button",{className:U,onClick:()=>{N(c.path),g()},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,d.jsxs)("button",{className:U,onClick:()=>{h(),g()},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",m.fileTree.rename]}),(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:V,onClick:()=>{g(),j()},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"}),m.fileTree.deleteFolder]})]})}function Z({dirPath:a,depth:b,onDone:c}){let[g,i]=(0,e.useState)(""),[j,k]=(0,e.useTransition)(),[l,m]=(0,e.useState)(""),n=(0,f.useRouter)(),{t:o}=(0,I.Y)(),p=(0,e.useRef)(null),q=(0,e.useCallback)(()=>{let b=g.trim();b?k(async()=>{let d=await A(a,b);d.success&&d.filePath?(c(),n.push(`/view/${(0,h.O0)(d.filePath)}`),n.refresh(),M()):m(d.error||o.fileTree.failed)}):m(o.fileTree.enterFileName)},[g,a,c,n,o]);return(0,d.jsxs)("div",{ref:p,className:"px-2 pb-1",style:{paddingLeft:`${12*b+20}px`},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("input",{autoFocus:!0,type:"text",value:g,onChange:a=>{i(a.target.value),m("")},onKeyDown:a=>{"Enter"===a.key&&q(),"Escape"===a.key&&c()},placeholder:"filename.md",className:" flex-1 bg-muted border border-border rounded px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring "}),j?(0,d.jsx)(s.A,{size:13,className:"text-muted-foreground animate-spin shrink-0"}):(0,d.jsx)("button",{onClick:q,className:"text-xs text-[var(--amber)] hover:text-foreground shrink-0 px-1",children:o.fileTree.create})]}),l&&(0,d.jsx)("p",{className:"text-xs text-error mt-0.5 px-1",children:l})]})}function $({node:a,depth:b,currentPath:c,onNavigate:i,maxOpenDepth:j,onImport:k}){let l=(0,f.useRouter)(),m=c.startsWith(a.path+"/")||c===a.path,n=!!a.isSpace,[o,p]=(0,e.useState)(0===b||m),[q,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[G,K]=(0,e.useState)(a.name),[L,N]=(0,e.useTransition)(),O=(0,e.useRef)(null),P=(0,e.useRef)(null),[Q,R]=(0,e.useState)(null),{t:S}=(0,I.Y)(),[T,U]=(0,e.useState)(null),[V,W]=(0,e.useTransition)(),$=(0,e.useCallback)(()=>p(a=>!a),[]);(0,e.useRef)(void 0);let _=(0,e.useCallback)(b=>{b?.preventDefault(),b?.stopPropagation(),P.current&&(clearTimeout(P.current),P.current=null),K(a.name),A(!0),setTimeout(()=>O.current?.select(),0)},[a.name]),ab=(0,e.useCallback)(()=>{let b=G.trim();b&&b!==a.name?N(async()=>{let c=n?B:C.f,d=await c(a.path,b);d.success&&d.newPath?(A(!1),l.push(`/view/${(0,h.O0)(d.newPath)}`),l.refresh(),M()):A(!1)}):A(!1)},[G,a.name,a.path,l,n]),ac=(0,e.useCallback)(()=>{z||(P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{l.push(`/view/${(0,h.O0)(a.path)}`),i?.(),P.current=null},180))},[z,l,a.path,i]),ad=(0,e.useCallback)(a=>{a.stopPropagation(),$()},[$]),ae=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),R({x:a.clientX,y:a.clientY})},[]),af=n?function a(b){return"file"===b.type?+!g.C.has(b.name):(b.children??[]).reduce((b,c)=>b+a(c),0)}(a):0;if(z)return(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:O,autoFocus:!0,value:G,onChange:a=>K(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ab(),"Escape"===a.key&&A(!1)},onBlur:ab,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),L&&(0,d.jsx)(s.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let ag=n&&0===b;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"relative group/dir flex items-center",onContextMenu:ae,children:[(0,d.jsx)("button",{onClick:$,className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground transition-colors",style:{marginLeft:`${12*b+4}px`},"aria-label":o?`Collapse ${a.name}`:`Expand ${a.name}`,children:(0,d.jsx)("span",{className:"block transition-transform duration-150",style:{transform:o?"rotate(0deg)":"rotate(-90deg)"},children:(0,d.jsx)(t.A,{size:13})})}),(0,d.jsxs)("button",{type:"button",onClick:ac,onDoubleClick:ad,draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.setData("text/mindos-type","directory"),b.dataTransfer.effectAllowed="copy"},className:`
55
+ flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
56
+ text-sm transition-colors duration-100
57
+ hover:bg-muted
58
+ ${m?"text-foreground":"text-muted-foreground hover:text-foreground"}
59
+ `,children:[n?"Inbox"===a.name?(0,d.jsx)(u.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):(0,d.jsx)(r.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):o?(0,d.jsx)(v.A,{size:14,className:"text-yellow-400 shrink-0"}):(0,d.jsx)(w.A,{size:14,className:"text-yellow-400 shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),n&&!o&&(0,d.jsx)("span",{className:"ml-auto text-xs text-muted-foreground shrink-0 tabular-nums pr-1",children:af})]}),(0,d.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/dir:flex items-center gap-0.5 z-10",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.preventDefault(),a.stopPropagation();let b=a.currentTarget.getBoundingClientRect();R({x:b.left,y:b.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,d.jsx)(x.A,{size:14})})})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${o?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsxs)("div",{className:`overflow-hidden ${ag?"border-l-2 ml-[18px]":""}`,style:ag?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!o&&{inert:!0},children:[a.children&&(0,d.jsx)(aa,{nodes:a.children,depth:ag?1:b+1,onNavigate:i,maxOpenDepth:j,parentIsSpace:n,onImport:k}),q&&(0,d.jsx)(Z,{dirPath:a.path,depth:ag?0:b,onDone:()=>y(!1)})]})}),Q&&(n?(0,d.jsx)(X,{x:Q.x,y:Q.y,node:a,onClose:()=>R(null),onRename:()=>_(),onNewFile:()=>{p(!0),y(!0)},onImport:k,onDelete:()=>U("space")}):(0,d.jsx)(Y,{x:Q.x,y:Q.y,node:a,onClose:()=>R(null),onRename:()=>_(),onNewFile:()=>{p(!0),y(!0)},onDelete:()=>U("folder")})),(0,d.jsx)(J.TM,{open:null!==T,title:"space"===T?S.fileTree.deleteSpace:S.fileTree.deleteFolder,message:"space"===T?S.fileTree.confirmDeleteSpace(a.name):S.fileTree.confirmDeleteFolder(a.name),confirmLabel:"space"===T?S.fileTree.deleteSpace:S.fileTree.deleteFolder,cancelLabel:S.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>U(null),onConfirm:()=>{U(null),W(async()=>{let b="space"===T?await D(a.path):await E(a.path);if(b.success&&b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;H.oR.undo(`${S.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,F.Y)(c);a.success?(l.refresh(),M()):H.oR.error(a.error??"Undo failed")},{label:S.trash?.undo??"Undo"}),l.push("/"),l.refresh(),M()}})}})]})}function _({node:a,depth:b,currentPath:c,onNavigate:k}){let l=(0,f.useRouter)(),m=c===a.path,[r,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(a.name),[w,y]=(0,e.useTransition)(),[,z]=(0,e.useTransition)(),A=(0,e.useRef)(null),{t:B}=(0,I.Y)(),{isPinned:D,togglePin:E}=(0,K.Z)(),L=D(a.path),O=!a.path.includes("/")&&g.A.has(a.name),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(null),X=(0,e.useCallback)(()=>{r||(l.push(`/view/${(0,h.O0)(a.path)}`),k?.())},[l,a.path,k,r]),Y=(0,e.useCallback)(b=>{b.stopPropagation(),v(a.name),t(!0),setTimeout(()=>A.current?.select(),0)},[a.name]),Z=(0,e.useCallback)(()=>{let b=u.trim();b&&b!==a.name?y(async()=>{let c=await (0,C.f)(a.path,b);c.success&&c.newPath?(t(!1),l.push(`/view/${(0,h.O0)(c.newPath)}`),l.refresh(),M()):t(!1)}):t(!1)},[u,a.name,a.path,l]),$=(0,e.useCallback)(a=>{a.stopPropagation(),Q(!0)},[]),_=(0,e.useCallback)(b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.effectAllowed="copy"},[a.path]),aa=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),S({x:a.clientX,y:a.clientY})},[]);return r?(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:A,autoFocus:!0,value:u,onChange:a=>v(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Z(),"Escape"===a.key&&t(!1)},onBlur:Z,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),w&&(0,d.jsx)(s.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]}):(0,d.jsxs)("div",{className:"relative group/file",children:[(0,d.jsxs)("button",{onClick:X,onDoubleClick:O?void 0:Y,onContextMenu:aa,draggable:!0,onDragStart:_,"data-filepath":a.path,className:`
60
+ w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
61
+ text-sm transition-colors duration-100 cursor-pointer pr-16
62
+ ${m?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
63
+ `,style:{paddingLeft:`${12*b+8}px`},children:["directory"===a.type?null:".csv"===a.extension?(0,d.jsx)(i.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(j.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),L&&(0,d.jsx)(n.A,{size:10,className:"shrink-0 fill-[var(--amber)] text-[var(--amber)] opacity-60"})]}),(0,d.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/file:flex items-center gap-0.5",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation();let b=a.currentTarget.getBoundingClientRect();S({x:b.left,y:b.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,d.jsx)(x.A,{size:14})})}),R&&(0,d.jsxs)(T,{x:R.x,y:R.y,onClose:()=>S(null),menuHeight:140,children:[(0,d.jsxs)("button",{className:U,onClick:()=>{N(a.path),S(null)},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",B.fileTree.copyPath]}),(0,d.jsxs)("button",{className:U,onClick:()=>{E(a.path),S(null)},children:[(0,d.jsx)(n.A,{size:14,className:`shrink-0 ${L?"fill-[var(--amber)] text-[var(--amber)]":""}`}),L?B.fileTree.removeFromFavorites:B.fileTree.pinToFavorites]}),!O&&(0,d.jsxs)("button",{className:U,onClick:a=>{S(null),Y(a)},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",B.fileTree.rename]}),!O&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:V,onClick:a=>{S(null),$(a)},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"})," ",B.fileTree.delete]})]})]}),(0,d.jsx)(J.TM,{open:P,title:B.fileTree.delete,message:B.fileTree.confirmDelete(a.name),confirmLabel:B.fileTree.delete,cancelLabel:B.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>Q(!1),onConfirm:()=>{Q(!1),z(async()=>{let b=await (0,G.i)(a.path);if(b.success){if(b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;H.oR.undo(`${B.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,F.Y)(c);a.success?(l.refresh(),M()):H.oR.error(a.error??"Undo failed")},{label:B.trash?.undo??"Undo"})}l.refresh(),M()}})}})]})}function aa({nodes:a,depth:b=0,onNavigate:c,maxOpenDepth:e,parentIsSpace:h,onImport:i}){var j;let k,l=(k="/view/",(j=(0,f.usePathname)()).startsWith(k)?j.slice(k.length).split("/").map(decodeURIComponent).join("/"):""),m=S(),n=0===b,o=m?a:a.filter(a=>!(n&&a.name.startsWith(".")||"file"===a.type&&g.C.has(a.name)||"directory"===a.type&&a.name.startsWith(".")));return(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:o.map(a=>"directory"===a.type?(0,d.jsx)($,{node:a,depth:b,currentPath:l,onNavigate:c,maxOpenDepth:e,onImport:i},a.path):(0,d.jsx)(_,{node:a,depth:b,currentPath:l,onNavigate:c},a.path))})}},17009:(a,b,c)=>{"use strict";c.d(b,{z:()=>f});var d=c(67484);let e="mindos:acp-detection";function f(){let a=(0,d.useRef)(function(){try{let a=sessionStorage.getItem(e);if(!a)return null;let b=JSON.parse(a);if("number"!=typeof b.ts||Date.now()-b.ts>18e5)return null;return b}catch{return null}}()),[b,c]=(0,d.useState)(a.current?.installed??[]),[f,g]=(0,d.useState)(a.current?.notInstalled??[]),[h,i]=(0,d.useState)(!a.current),[j,k]=(0,d.useState)(null),[l,m]=(0,d.useState)(0);(0,d.useRef)(!1);let n=(0,d.useRef)(!1);return{installedAgents:b,notInstalledAgents:f,loading:h,error:j,refresh:(0,d.useCallback)(()=>{try{sessionStorage.removeItem(e)}catch{}a.current=null,n.current=!0,m(a=>a+1)},[])}}},18329:(a,b,c)=>{"use strict";c.d(b,{cd:()=>j,kr:()=>i,zd:()=>h});var d=c(31417),e=c(95054);let f=null;async function g(a){f?.abort();let b=new AbortController;f=b;try{let[c,d,f]=await Promise.all([(0,e.n)("/api/mcp/status",{signal:b.signal}),(0,e.n)("/api/mcp/agents",{signal:b.signal}),(0,e.n)("/api/skills",{signal:b.signal})]);b.signal.aborted||a({status:c,agents:d.agents,skills:f.skills})}catch(a){if(a instanceof DOMException&&"AbortError"===a.name)return}finally{b.signal.aborted||a({loading:!1})}}let h=(0,d.v)((a,b)=>({status:null,agents:[],skills:[],loading:!0,refresh:()=>g(a),toggleSkill:async(c,d)=>{a({skills:b().skills.map(a=>a.name===c?{...a,enabled:d}:a)});try{return await (0,e.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"toggle",name:c,enabled:d})}),!0}catch{return a({skills:b().skills.map(a=>a.name===c?{...a,enabled:!d}:a)}),!1}},installAgent:async(c,d)=>{let f=b().agents.find(a=>a.key===c);if(!f)return!1;try{let b=await (0,e.n)("/api/mcp/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:[{key:c,scope:d?.scope??(f.hasProjectScope?"project":"global"),transport:d?.transport??f.preferredTransport}],transport:"auto"})}),h=b.results?.[0],i=h?.ok===!0||h?.status==="ok";return i&&await g(a),i}catch{return!1}},_init:()=>{let b;g(a);let c=()=>{clearTimeout(b),b=setTimeout(()=>g(a),500)};window.addEventListener("mindos:skills-changed",c);let d=setInterval(()=>{"visible"===document.visibilityState&&g(a)},3e4);return()=>{f?.abort(),clearTimeout(b),clearInterval(d),window.removeEventListener("mindos:skills-changed",c)}}}));function i(){return h()}function j(){return h()}},18776:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TodoRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TodoRenderer() from the server but TodoRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/todo/TodoRenderer.tsx","TodoRenderer")},20892:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(48249);function e({id:a,className:b="w-8 h-4"}){return(0,d.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 40",fill:"none",className:`${b} text-[var(--amber)]`,"aria-hidden":"true",children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:`grad-human-${a}`,x1:"35",y1:"20",x2:"5",y2:"20",gradientUnits:"userSpaceOnUse",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.8"}),(0,d.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.3"})]}),(0,d.jsxs)("linearGradient",{id:`grad-agent-${a}`,x1:"35",y1:"20",x2:"75",y2:"20",gradientUnits:"userSpaceOnUse",children:[(0,d.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.8"}),(0,d.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"1"})]})]}),(0,d.jsx)("path",{d:"M35,20 C25,35 8,35 8,20 C8,5 25,5 35,20",stroke:`url(#grad-human-${a})`,strokeWidth:"3",strokeDasharray:"2 4",strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M35,20 C45,2 75,2 75,20 C75,38 45,38 35,20",stroke:`url(#grad-agent-${a})`,strokeWidth:"4.5",strokeLinecap:"round"}),(0,d.jsx)("path",{d:"M35,17.5 Q35,20 37.5,20 Q35,20 35,22.5 Q35,20 32.5,20 Q35,20 35,17.5 Z",fill:"#FEF3C7"})]})}},21245:(a,b,c)=>{"use strict";c.d(b,{g:()=>d});let d=[{anchor:"files-panel",position:"right"},{anchor:"ask-button",position:"right"},{anchor:"agents-panel",position:"right"}]},23017:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(67484),f=c(46674),g=c(30315);function h(){let[a,b]=(0,e.useState)(!1),{t:c}=(0,g.Y)(),h=c.shortcutPanel,i="u">typeof navigator&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘":"Ctrl",j=(0,e.useMemo)(()=>[{keys:`${i} K`,label:h.toggleSearch,section:h.navigation},{keys:`${i} /`,label:h.toggleAskAI,section:h.navigation},{keys:`${i} ,`,label:h.openSettings,section:h.navigation},{keys:`${i} ?`,label:h.keyboardShortcuts,section:h.navigation},{keys:"Esc",label:h.closePanel,section:h.panelsSection},{keys:`${i} S`,label:h.saveFile,section:h.editor},{keys:`${i} Z`,label:h.undo,section:h.editor},{keys:`${i} Shift Z`,label:h.redo,section:h.editor}],[i,h]);if(!a)return null;let k=[...new Set(j.map(a=>a.section))];return(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center modal-backdrop",onClick:a=>a.target===a.currentTarget&&b(!1),children:(0,d.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":h.title,className:"w-full max-w-md mx-4 bg-card border border-border rounded-xl shadow-2xl overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border",children:[(0,d.jsx)("span",{className:"text-sm font-medium font-display text-foreground",children:h.title}),(0,d.jsx)("button",{onClick:()=>b(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,d.jsx)(f.A,{size:15})})]}),(0,d.jsx)("div",{className:"px-5 py-4 space-y-4 max-h-[60vh] overflow-y-auto",children:k.map(a=>(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-2",children:a}),(0,d.jsx)("div",{className:"space-y-1",children:j.filter(b=>b.section===a).map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between py-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-foreground",children:a.label}),(0,d.jsx)("div",{className:"flex items-center gap-1",children:a.keys.split(" ").map((a,b)=>(0,d.jsx)("kbd",{className:"px-1.5 py-0.5 text-2xs rounded border border-border bg-muted text-muted-foreground font-mono min-w-[24px] text-center",children:a},b))})]},a.keys))})]},a))}),(0,d.jsx)("div",{className:"px-5 py-2.5 border-t border-border",children:(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground/60",children:["Press ",(0,d.jsx)("kbd",{className:"px-1 py-0.5 text-2xs rounded border border-border bg-muted font-mono",children:i}),(0,d.jsx)("kbd",{className:"px-1 py-0.5 text-2xs rounded border border-border bg-muted font-mono ml-0.5",children:"?"})," ",h.toggleHint]})})]})})}},23343:(a,b,c)=>{"use strict";c.d(b,{M:()=>A});var d=c(48249),e=c(67484),f=c(27381),g=c(40560),h=c(59347),i=c(42742),j=c(19236),k=c(15273),l=c(69924),m=c(6079),n=c(89165),o=c(93877),p=c(44218),q=c(19794),r=c(66336),s=c(99101),t=c(81285),u=c(57056),v=c(95054),w=c(39868);function x(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:a<0x40000000?`${(a/1048576).toFixed(1)} MB`:`${(a/0x40000000).toFixed(2)} GB`}var y=c(16613);c(39690);var z=c(63962);function A({data:a,setData:b,t:c}){let p=a.envOverrides??{},q=c.settings.knowledge,r=c.settings.appearance,[x,A]=(0,e.useState)(()=>!1),[D,E]=(0,e.useState)(()=>!1),[F,G]=(0,e.useState)(()=>!1),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(!1),[L,M]=(0,e.useState)(null),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),R=(0,e.useCallback)(()=>{let a=!P;Q(a);let b={dismissed:a};a||(b.active=!0),(0,v.n)("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:b})}).then(()=>window.dispatchEvent(new Event("guide-state-updated"))).catch(b=>{console.error("Failed to update guide state:",b),Q(!a)})},[P]),S=(0,e.useCallback)(()=>{(0,v.n)("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{active:!0,dismissed:!1,walkthroughStep:0,walkthroughDismissed:!1}})}).then(()=>{O(!0),Q(!1),window.dispatchEvent(new Event("guide-state-updated"))}).catch(a=>console.error("Failed to restart walkthrough:",a))},[]),T=(0,e.useSyncExternalStore)(()=>()=>{},()=>`${window.location.protocol}//${window.location.hostname}`,()=>"http://localhost"),[U,V]=(0,e.useState)(!1),W="***set***"===a.webPassword,[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(null),[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)(!1),ad=!!a.authToken,ae=Z??a.authToken??"";async function af(){Y(!0);try{let a=await (0,v.n)("/api/settings/reset-token",{method:"POST"});$(a.token),b(b=>b?{...b,authToken:a.token}:b)}finally{Y(!1)}}async function ag(){b(a=>a?{...a,authToken:""}:a),$(null)}return(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(t.L7,{icon:(0,d.jsx)(f.A,{size:15}),title:q.cardTitle??"Knowledge Base",description:q.mindRootHint,children:[(0,d.jsx)(t.D0,{label:(0,d.jsxs)(d.Fragment,{children:[q.mindRoot," ",(0,d.jsx)(t.Bt,{overridden:p.MIND_ROOT})]}),hint:p.MIND_ROOT?q.envNote:q.mindRootHint,children:(0,d.jsx)(t.pd,{value:a.mindRoot,onChange:a=>b(b=>b?{...b,mindRoot:a.target.value}:b),placeholder:"/path/to/your/notes"})}),(0,d.jsx)(t.pM,{label:q.showHiddenFiles,hint:q.showHiddenFilesHint,children:(0,d.jsx)(t.lM,{checked:F,onChange:()=>{let a=!F;G(a),(0,y.Fo)(a)}})}),null!==H&&H>0&&null===L&&(0,d.jsx)(t.pM,{label:q.cleanupExamples,hint:q.cleanupExamplesHint,children:(0,d.jsxs)("button",{onClick:()=>ac(!0),disabled:J,title:J?c.hints.cleanupInProgress:void 0,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0 disabled:opacity-50",children:[J?(0,d.jsx)(g.A,{size:12,className:"animate-spin"}):(0,d.jsx)(h.A,{size:12}),q.cleanupExamplesButton,(0,d.jsx)("span",{className:"ml-1 tabular-nums text-2xs opacity-70",children:H})]})}),null!==L&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-success",children:[(0,d.jsx)(i.A,{size:14}),q.cleanupExamplesDone(L)]})]}),(0,d.jsxs)(t.L7,{icon:(0,d.jsx)(j.A,{size:15}),title:q.securityTitle??"Security",children:[(0,d.jsx)(t.D0,{label:q.webPassword,hint:q.webPasswordHint,children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(t.pd,{type:U?"text":"password",value:W?"••••••••":a.webPassword??"",onChange:a=>b(b=>b?{...b,webPassword:a.target.value}:b),onFocus:()=>{W&&b(a=>a?{...a,webPassword:""}:a)},placeholder:q.passwordPlaceholder??"Leave empty to disable"}),(0,d.jsx)("button",{type:"button",onClick:()=>V(a=>!a),className:"px-3 py-2 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0",children:U?q.passwordHide??"Hide":q.passwordShow??"Show"})]})}),(0,d.jsx)(t.D0,{label:q.authToken,hint:ad?q.authTokenHint:q.authTokenNone,children:(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-background border border-border rounded-lg min-h-[38px]",children:[(0,d.jsx)("code",{className:"flex-1 text-xs font-mono text-foreground break-all select-all",children:ae||(0,d.jsx)("span",{className:"text-muted-foreground italic",children:q.tokenNotSet??"— not set —"})}),ae&&(0,d.jsx)("button",{type:"button",onClick:function(){let b=Z??a.authToken??"";b&&(0,w.l)(b).then(a=>{a&&s.oR.copy()})},className:"shrink-0 p-1 rounded text-muted-foreground hover:text-foreground transition-colors",title:q.authTokenCopy,children:(0,d.jsx)(k.A,{size:13})})]}),a.mcpPort&&(0,d.jsxs)("p",{className:"text-xs text-muted-foreground",children:[q.authTokenMcpPort,": ",(0,d.jsx)("code",{className:"font-mono",children:a.mcpPort}),ae&&(0,d.jsxs)(d.Fragment,{children:[" \xa0\xb7\xa0 ",q.mcpUrl??"MCP URL",": ",(0,d.jsx)("code",{className:"font-mono select-all",children:`${T}:${a.mcpPort}/mcp`})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:function(){aa(!0)},disabled:X,title:X?c.hints.tokenResetInProgress:void 0,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(l.A,{size:14,className:X?"animate-spin":""}),q.authTokenReset]}),ad&&(0,d.jsxs)("button",{type:"button",onClick:ag,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-destructive hover:border-destructive/50 transition-colors",children:[(0,d.jsx)(h.A,{size:14}),q.authTokenClear]})]}),Z&&(0,d.jsx)("p",{className:"text-xs text-[var(--amber-text)]",children:q.tokenGenerated})]})})]}),null!==N&&(0,d.jsxs)(t.L7,{icon:(0,d.jsx)(m.A,{size:15}),title:c.guide?.title??"Getting Started",children:[(0,d.jsx)(t.pM,{label:c.guide?.showGuide??"Show getting started guide",children:(0,d.jsx)(t.lM,{checked:!P,onChange:()=>R()})}),(0,d.jsxs)("button",{onClick:S,className:"flex items-center gap-1.5 mt-2 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(n.A,{size:14}),q.restartWalkthrough??"Restart walkthrough"]})]}),(0,d.jsx)(t.L7,{icon:(0,d.jsx)(o.A,{size:15}),title:r.labsTitle??"Labs",description:r.labsDesc??"Experimental features that are still in development.",children:(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(B,{label:r.labsEcho??"Echo",description:r.labsEchoDesc??"Reflective journaling powered by your notes.",checked:x,onChange:a=>{A(a),localStorage.setItem("mindos:labs-echo",a?"1":"0"),window.dispatchEvent(new Event("mindos:labs-changed"))}}),(0,d.jsx)(B,{label:r.labsWorkflows??"Flows",description:r.labsWorkflowsDesc??"Visual workflow automation for agents.",checked:D,onChange:a=>{E(a),localStorage.setItem("mindos:labs-workflows",a?"1":"0"),window.dispatchEvent(new Event("mindos:labs-changed"))}})]})}),(0,d.jsx)(C,{k:q}),(0,d.jsx)(u.TM,{open:_,title:q.authTokenReset??"Regenerate Token",message:q.authTokenResetConfirm,confirmLabel:q.authTokenReset??"Regenerate",cancelLabel:q.cancel??"Cancel",onConfirm:()=>{aa(!1),af()},onCancel:()=>aa(!1)}),(0,d.jsx)(u.TM,{open:ab,title:q.cleanupExamples??"Cleanup Examples",message:null!==H?q.cleanupExamplesConfirm(H):"",confirmLabel:q.cleanupExamplesButton??"Clean up",cancelLabel:q.cancel??"Cancel",variant:"destructive",onConfirm:async()=>{ac(!1),K(!0);let a=await (0,z.E)();K(!1),a.success&&(M(a.deleted),I(0))},onCancel:()=>ac(!1)})]})}function B({label:a,description:b,checked:c,onChange:e}){return(0,d.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer group",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground block",children:a}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:b})]}),(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":c,onClick:()=>e(!c),className:`relative w-9 h-5 rounded-full transition-colors shrink-0 ${c?"bg-[var(--amber)]":"bg-muted-foreground/20"}`,children:(0,d.jsx)("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white shadow-sm transition-transform ${c?"translate-x-4":"translate-x-0"}`})})]})}function C({k:a}){let[b,c]=(0,e.useState)(!1),[f,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1);return(0,e.useCallback)(async()=>{j(!0);try{let a=await (0,v.n)("/api/monitoring",{timeout:5e3});h(a)}catch{}j(!1)},[]),(0,e.useRef)(!1),(0,d.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,d.jsxs)("button",{onClick:()=>c(a=>!a),className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors w-full",children:[b?(0,d.jsx)(p.A,{size:14}):(0,d.jsx)(q.A,{size:14}),(0,d.jsx)(r.A,{size:12}),a.monitoringTitle??"System Monitoring",i&&(0,d.jsx)(g.A,{size:10,className:"animate-spin ml-1"})]}),b&&f&&(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-x-6 gap-y-2 text-xs",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorHeap??"Heap"}),(0,d.jsxs)("span",{className:"ml-2 tabular-nums",children:[x(f.system.memory.heapUsed)," / ",x(f.system.memory.heapTotal)]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorRss??"RSS"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:x(f.system.memory.rss)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorUptime??"Uptime"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:function(a){let b=Math.floor(a/1e3);if(b<60)return`${b}s`;let c=Math.floor(b/60);if(c<60)return`${c}m ${b%60}s`;let d=Math.floor(c/60);if(d<24)return`${d}h ${c%60}m`;let e=Math.floor(d/24);return`${e}d ${d%24}h`}(f.system.uptimeMs)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorNode??"Node"}),(0,d.jsx)("span",{className:"ml-2",children:f.system.nodeVersion})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorRequests??"Requests"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:f.application.agentRequests})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorToolCalls??"Tool Calls"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:f.application.toolExecutions})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorTokens??"Tokens"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:(f.application.totalTokens.input+f.application.totalTokens.output).toLocaleString()})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorFiles??"Files"}),(0,d.jsxs)("span",{className:"ml-2 tabular-nums",children:[f.knowledgeBase.fileCount," (",x(f.knowledgeBase.totalSizeBytes),")"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:"MCP"}),(0,d.jsx)("span",{className:"ml-2",children:f.mcp.running?a.monitorMcpRunning?.(f.mcp.port)??`Running :${f.mcp.port}`:a.monitorMcpStopped??"Stopped"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a.monitorErrors??"Errors"}),(0,d.jsx)("span",{className:"ml-2 tabular-nums",children:f.application.errors})]})]}),b&&!f&&!i&&(0,d.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:a.monitoringFailed??"Failed to load monitoring data"})]})}},24387:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/components/ErrorBoundary.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ErrorBoundary.tsx","default")},27608:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(48249),e=c(67484),f=c(74429),g=c(42742),h=c(44218);function i(a){return"options"in a}function j({value:a,onChange:b,options:c,className:j="",size:k="md",placeholder:l}){let[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(-1),[q,r]=(0,e.useState)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(null),u=(0,e.useMemo)(()=>(function(a){let b=[];for(let c of a)i(c)?b.push(...c.options):b.push(c);return b})(c),[c]),v=(0,e.useMemo)(()=>u.find(b=>b.value===a)??null,[u,a]),w=(0,e.useCallback)(()=>{n(!1),p(-1)},[]),x=(0,e.useCallback)(a=>{b(a),w()},[b,w]);(0,e.useCallback)(()=>{if(!s.current)return;let a=s.current.getBoundingClientRect(),b="sm"===k?200:260,c=window.innerHeight-a.bottom,d=a.top;r({top:c<b+8&&d>c?a.top:a.bottom,left:a.left,width:a.width,flipUp:c<b+8&&d>c})},[k]);let y="sm"===k,z=y?`inline-flex items-center gap-1 appearance-none rounded-md border border-border bg-background text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring transition-colors text-2xs px-1.5 py-0.5 pr-5 ${j}`:`w-full flex items-center gap-2 appearance-none rounded-lg border border-border bg-background text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring transition-colors text-sm px-3 py-2 pr-8 ${j}`,A=y?"w-full flex items-center gap-1.5 px-2 py-1 text-2xs text-left transition-colors cursor-pointer":"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left transition-colors cursor-pointer",B=-1;function C(b){let c=++B,e=b.value===a,f=c===o;return(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":e,"data-idx":c,onClick:()=>x(b.value),onMouseEnter:()=>p(c),className:`${A} ${f?"bg-muted text-foreground":"text-foreground"}`,children:[b.icon,(0,d.jsx)("span",{className:"flex-1 truncate",children:b.label}),b.suffix,e&&(0,d.jsx)(g.A,{size:y?10:12,className:"shrink-0 text-[var(--amber)]"})]},b.value)}let D=m&&q&&(0,f.createPortal)((0,d.jsx)("div",{ref:t,className:y?"fixed z-[9999] overflow-y-auto rounded-md border border-border bg-card shadow-lg py-0.5":"fixed z-[9999] overflow-y-auto rounded-lg border border-border bg-card shadow-lg py-1",role:"listbox",style:{left:q.left,minWidth:q.width,maxHeight:y?200:260,...q.flipUp?{bottom:window.innerHeight-q.top+4}:{top:q.top+4}},children:c.map((a,b)=>i(a)?(0,d.jsxs)("div",{children:[b>0&&(0,d.jsx)("div",{className:"my-0.5 border-t border-border/50"}),(0,d.jsx)("div",{className:`py-1 text-2xs font-medium text-muted-foreground uppercase tracking-wider ${y?"px-2":"px-3"}`,children:a.label}),a.options.map(C)]},a.label):C(a))}),document.body);return(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsxs)("button",{ref:s,type:"button",onClick:()=>n(a=>!a),"aria-haspopup":"listbox","aria-expanded":m,className:z,children:[v?.icon,(0,d.jsx)("span",{className:"flex-1 truncate text-left",children:v?.label??l??"—"}),v?.suffix,(0,d.jsx)(h.A,{size:y?12:14,className:`${y?"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none":"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"} transition-transform duration-150 ${m?"rotate-180":""}`})]}),D]})}},28079:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>i});var e=c(48249),f=c(30315),g=c(65965),h=a([g]);function i({open:a,onClose:b,currentFile:c,initialMessage:d,initialAcpAgent:h,onFirstMessage:i,askMode:j,onModeSwitch:k}){let{t:l}=(0,f.Y)();return a?(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-end md:items-start justify-center md:pt-[10vh] modal-backdrop",onClick:a=>a.target===a.currentTarget&&b(),children:(0,e.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":l.ask.title,className:"w-full md:max-w-2xl md:mx-4 bg-card border-t md:border border-border rounded-t-2xl md:rounded-xl shadow-2xl flex flex-col h-[92vh] md:h-auto md:max-h-[75vh]",children:(0,e.jsx)(g.A,{visible:a,variant:"modal",onClose:b,currentFile:c,initialMessage:d,initialAcpAgent:h,onFirstMessage:i,askMode:j,onModeSwitch:k})})}):null}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},28978:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(48249),e=c(67484),f=c(7309),g=c(83654),h=c(80600),i=c(93096);function j({results:a,selectedIndex:b,query:c,onSelect:j}){let k=(0,e.useRef)(null),l=(0,e.useRef)(null),[m,n]=(0,e.useState)(280);return 0===a.length?null:(0,d.jsxs)("div",{ref:l,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,d.jsx)(f.A,{size:11,className:"text-muted-foreground/50"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Files"}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:a.length})]}),(0,d.jsx)("div",{ref:k,className:"overflow-y-auto",style:{maxHeight:m},children:a.map((a,e)=>{let f=a.split("/").pop()??a,k=a.split("/").slice(0,-1).join("/"),l=f.endsWith(".csv");return(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),j(a)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${e===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[l?(0,d.jsx)(g.A,{size:13,className:"text-success shrink-0"}):(0,d.jsx)(h.A,{size:13,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:"truncate font-medium flex-1",title:f,children:(0,d.jsx)(i.A,{text:f,query:c})}),k&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 truncate max-w-[140px] shrink-0",title:k,children:(0,d.jsx)(i.A,{text:k,query:c})})]},a)})}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,d.jsx)("span",{children:"↑↓ navigate"}),(0,d.jsx)("span",{children:"↵ select"}),(0,d.jsx)("span",{children:"ESC dismiss"})]})]})}},29185:(a,b,c)=>{"use strict";c.d(b,{f:()=>r,v:()=>w});var d=c(48249),e=c(67484),f=c(8455),g=c(19794),h=c(40560),i=c(19429),j=c(42742),k=c(1619),l=c(41479),m=c(61075),n=c(49681),o=c(69924),p=c(81285),q=c(95054);function r(a,b){if(!a)return b?.timeNever??"never";let c=Date.now()-new Date(a).getTime();if(c<6e4)return b?.timeJustNow??"just now";let d=Math.floor(c/6e4);if(c<36e5)return b?.timeMinAgo?.(d)??`${d}m ago`;let e=Math.floor(c/36e5);if(c<864e5)return b?.timeHourAgo?.(e)??`${e}h ago`;let f=Math.floor(c/864e5);return b?.timeDayAgo?.(f)??`${f}d ago`}function s(a,b,c){let d=a.toLowerCase();return d.includes("permission denied")||d.includes("publickey")?c?.hintSshAuth??"SSH key may not be configured. Run: ssh-keygen -t ed25519 && ssh -T git@github.com":d.includes("host key")||d.includes("known_hosts")||d.includes("fingerprint")?c?.hintSshHost??"Run: ssh-keyscan github.com >> ~/.ssh/known_hosts":d.includes("authentication failed")||d.includes("invalid credentials")||d.includes("401")||d.includes("403")?c?.hintHttpsAuth??"Access token may be expired or missing. Check Settings → Developer settings → Personal access tokens.":d.includes("timed out")||d.includes("timeout")||d.includes("could not resolve")?c?.hintNetwork??"Check your network connection and try again.":d.includes("not found")||d.includes("does not exist")||d.includes("repository not found")?c?.hintNotFound??"Repository not found. Check the URL and ensure the repo exists.":d.includes("non-fast-forward")||d.includes("rejected")||d.includes("fetch first")?c?.hintPushRejected??'Remote has changes. Click "Sync Now" to pull and retry.':d.includes("conflict")||d.includes("merge")?c?.hintConflict??"Merge conflict detected. Check the Conflicts section below.":""}function t({file:a,time:b,syncT:c,onResolved:i}){let[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),[p,s]=(0,e.useState)(!1),t=async()=>{if(l)return void m(!1);if(!n){s(!0);try{let b=await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"conflict-preview",remote:a})});o(b)}catch{}s(!1)}m(!0)},u=async b=>{k("keep-local"===b?"local":"remote");try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"resolve-conflict",remote:a,branch:b})}),i()}catch{k(null)}};return(0,d.jsxs)("div",{className:"rounded-lg border border-border/50 overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 p-2 text-xs bg-muted/20",children:[(0,d.jsx)(f.A,{size:12,className:"text-error shrink-0"}),(0,d.jsxs)("button",{type:"button",onClick:t,className:"font-mono truncate hover:text-foreground hover:underline transition-colors flex-1 min-w-0 text-left",title:c?.viewDiff??"View differences",children:[(0,d.jsx)(g.A,{size:11,className:`inline mr-1 transition-transform ${l?"rotate-90":""}`}),a]}),(0,d.jsx)("span",{className:"text-muted-foreground shrink-0",children:r(b,c)}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:()=>u("keep-local"),disabled:!!j,className:"px-2 py-0.5 rounded border border-border text-2xs hover:bg-muted transition-colors disabled:opacity-40",title:c?.keepLocalHint??"Keep this device's version",children:"local"===j?(0,d.jsx)(h.A,{size:10,className:"animate-spin"}):c?.keepLocal??"Keep local"}),(0,d.jsx)("button",{type:"button",onClick:()=>u("keep-remote"),disabled:!!j,className:"px-2 py-0.5 rounded border border-border text-2xs hover:bg-muted transition-colors disabled:opacity-40",title:c?.keepRemoteHint??"Replace with remote version",children:"remote"===j?(0,d.jsx)(h.A,{size:10,className:"animate-spin"}):c?.keepRemote??"Keep remote"})]})]}),l&&(0,d.jsx)("div",{className:"border-t border-border/50",children:p?(0,d.jsx)("div",{className:"flex justify-center py-3",children:(0,d.jsx)(h.A,{size:13,className:"animate-spin text-muted-foreground"})}):n?(0,d.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border/50 text-2xs font-mono max-h-60 overflow-auto",children:[(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("div",{className:"text-muted-foreground mb-1 font-sans text-xs font-medium",children:c?.localVersion??"Local (this device)"}),(0,d.jsx)("pre",{className:"whitespace-pre-wrap text-foreground/80 leading-relaxed",children:n.local||(c?.emptyFile??"(empty)")})]}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("div",{className:"text-muted-foreground mb-1 font-sans text-xs font-medium",children:c?.remoteVersion??"Remote"}),(0,d.jsx)("pre",{className:"whitespace-pre-wrap text-foreground/80 leading-relaxed",children:n.remote||(c?.emptyFile??"(empty)")})]})]}):null})]})}function u({syncT:a}){let[b,c]=(0,e.useState)(!1),[f,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(""),[n,o]=(0,e.useState)(!1),[p,r]=(0,e.useState)(!1);(0,e.useRef)(!1);let s=f!==l,t=async()=>{try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"gitignore-save",content:f})}),m(f),r(!0),setTimeout(()=>r(!1),2e3)}catch{}};return(0,d.jsxs)("div",{className:"pt-2 border-t border-border/50",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>c(!b),className:"flex items-center gap-2 w-full text-left text-sm text-muted-foreground hover:text-foreground transition-colors py-1",children:[(0,d.jsx)(g.A,{size:14,className:`shrink-0 transition-transform ${b?"rotate-90":""}`}),(0,d.jsx)(i.A,{size:13,className:"shrink-0"}),(0,d.jsx)("span",{children:a?.gitignoreTitle??"Excluded files"}),(0,d.jsx)("span",{className:"text-2xs opacity-50",children:".gitignore"})]}),b&&(0,d.jsx)("div",{className:"mt-2 space-y-2",children:n?(0,d.jsx)("div",{className:"flex justify-center py-4",children:(0,d.jsx)(h.A,{size:14,className:"animate-spin text-muted-foreground"})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("textarea",{value:f,onChange:a=>k(a.target.value),rows:8,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-xs font-mono leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-y",placeholder:a?.gitignorePlaceholder??"# Files to exclude from sync\n*.tmp\nsecret/",spellCheck:!1}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,d.jsx)("button",{type:"button",onClick:t,className:"flex items-center gap-1.5 px-3 py-1 text-xs rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity",children:a?.gitignoreSave??"Save"}),p&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs text-success",children:[(0,d.jsx)(j.A,{size:12})," ",a?.gitignoreSaved??"Saved"]})]})]})})]})}function v({t:a,onInitComplete:b}){var c;let g=a.settings?.sync,[i,o]=(0,e.useState)(""),[r,t]=(0,e.useState)(""),[u,v]=(0,e.useState)("main"),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(-1),[A,B]=(0,e.useState)(""),C=(0,e.useRef)(null),D=y>=0&&y<4,E=i.trim()?(c=i.trim(),/^https:\/\/.+/.test(c)?"https":!!/^git@[\w.-]+:.+/.test(c)&&"ssh"):null,F="https"===E||"ssh"===E,G=async()=>{z(0),B("");let a=(a,b)=>setTimeout(()=>z(b=>b>=0&&b<4?a:b),b);C.current=a(1,2e3);let c=a(2,5e3);try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",remote:i.trim(),token:r.trim()||void 0,branch:u.trim()||"main"}),timeout:12e4}),z(4),setTimeout(()=>b(),600)}catch(c){let a=c instanceof Error?c.message:"Connection failed";a.includes("timed out")&&(a=g?.timeoutError??"Connection timed out. The remote repository may be large or the network is slow. Please try again.");let b=s(a,i,g);B(b?`${a}
55
64
  ${b}`:a),z(-1)}finally{C.current&&clearTimeout(C.current),clearTimeout(c)}},H=[g?.stepConnecting??"Connecting to remote...",g?.stepAuthenticating??"Authenticating...",g?.stepSyncing??"Syncing data...",g?.stepAlmostDone??"Almost done..."];return(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(p.L7,{icon:(0,d.jsx)(k.A,{size:15}),title:g?.emptyTitle??"Cross-device Sync",description:g?.emptyDesc??"Automatically sync your knowledge base across devices via Git.",children:[(0,d.jsxs)(p.D0,{label:g?.remoteUrl??"Git Remote URL",hint:"ssh"===E?g?.sshHint??"Requires SSH key on this machine. Verify with: ssh -T git@github.com":void 0,children:[(0,d.jsx)(p.pd,{type:"text",value:i,onChange:a=>{o(a.target.value),B("")},placeholder:"git@github.com:user/repo.git",className:`font-mono ${i.trim()&&!F?"border-destructive":""}`}),!i.trim()&&(0,d.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground mt-1.5",children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("code",{className:"text-foreground/60 bg-muted/60 px-1 py-0.5 rounded text-2xs",children:"SSH"})," ",g?.sshBrief??"one-time key setup, no token needed"]}),(0,d.jsxs)("span",{children:[(0,d.jsx)("code",{className:"text-foreground/60 bg-muted/60 px-1 py-0.5 rounded text-2xs",children:"HTTPS"})," ",g?.httpsBrief??"works anywhere, token recommended"]})]}),i.trim()&&!F&&(0,d.jsx)("p",{className:"text-xs text-destructive mt-1",children:g?.invalidUrl??"Invalid Git URL — use HTTPS (https://...) or SSH (git@...)"})]}),"https"===E&&(0,d.jsxs)(p.D0,{label:(0,d.jsxs)(d.Fragment,{children:[g?.accessToken??"Access Token"," ",(0,d.jsx)("span",{className:"text-muted-foreground font-normal",children:g?.optional??"(optional, for private repos)"})]}),hint:void 0,children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(p.pd,{type:w?"text":"password",value:r,onChange:a=>t(a.target.value),placeholder:"ghp_xxxxxxxxxxxx",className:"pr-9 font-mono"}),(0,d.jsx)("button",{type:"button",onClick:()=>x(!w),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground transition-colors",children:w?(0,d.jsx)(l.A,{size:14}):(0,d.jsx)(m.A,{size:14})})]}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:[g?.tokenHint??"GitHub:"," ",(0,d.jsx)("a",{href:"https://github.com/settings/tokens/new?scopes=repo&description=MindOS+Sync",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:g?.tokenLink??"Create a token (repo scope)"})]})]}),(0,d.jsx)(p.D0,{label:g?.branchLabel??"Branch",children:(0,d.jsx)(p.pd,{type:"text",value:u,onChange:a=>v(a.target.value),placeholder:"main",className:"max-w-[200px] font-mono"})}),!D&&4!==y&&(0,d.jsx)(p.jn,{onClick:G,disabled:!F,className:"flex items-center gap-2",children:g?.connectButton??"Connect & Start Sync"}),(D||4===y)&&(0,d.jsxs)("div",{className:"space-y-2 py-1",children:[H.map((a,b)=>{let c=y>b||4===y,e=y===b&&y<4;return y<b&&y<4?null:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[c?(0,d.jsx)(j.A,{size:13,className:"text-success shrink-0"}):(0,d.jsx)(h.A,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:c?"text-success":e?"text-foreground":"text-muted-foreground",children:a})]},b)}),4===y&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,d.jsx)(n.A,{size:13,className:"text-success shrink-0"}),(0,d.jsx)("span",{className:"text-success font-medium",children:g?.stepDone??"Sync configured successfully!"})]})]}),A&&(0,d.jsxs)("div",{className:"flex items-start gap-2 text-xs p-3 rounded-lg bg-destructive/10 text-destructive",role:"alert","aria-live":"polite",children:[(0,d.jsx)(f.A,{size:13,className:"shrink-0 mt-0.5"}),(0,d.jsx)("div",{className:"space-y-1",children:A.split("\n").map((a,b)=>(0,d.jsx)("span",{className:`block ${b>0?"text-destructive/70":""}`,children:a},b))})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 text-xs text-muted-foreground px-5",children:[g?.featureAutoCommit??"Auto-commit on save",g?.featureAutoPull??"Auto-pull from remote",g?.featureConflict??"Conflict detection",g?.featureMultiDevice??"Works across devices"].map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(n.A,{size:11,className:"text-success/60 shrink-0"}),(0,d.jsx)("span",{children:a})]},b))})]})}function w({t:a}){let b=a.settings?.sync,[c,g]=(0,e.useState)(null),[i,j]=(0,e.useState)(!0),[l,m]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(null),A=(0,e.useCallback)(async()=>{try{let a=await (0,q.n)("/api/sync",{timeout:1e4});g(a)}catch{g(a=>a??null)}finally{j(!1)}},[]),B=async()=>{m(!0),z(null);try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"now"}),timeout:12e4}),z({type:"success",text:b?.syncComplete??"Sync complete"}),await A()}catch(d){var a;let c;z({type:"error",text:(c=s(a=d instanceof Error?d.message:"Sync failed",void 0,b))?`${a}
56
65
  ${c}`:a})}finally{m(!1),setTimeout(()=>z(null),3e3)}},C=async()=>{if(!c)return;x(!0),z(null);let a=c.enabled?"off":"on";try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a})}),await A(),z({type:"success",text:c.enabled?b?.autoSyncDisabled??"Auto-sync disabled":b?.autoSyncEnabled??"Auto-sync enabled"})}catch{z({type:"error",text:b?.toggleFailed??"Failed to toggle sync"})}finally{x(!1),setTimeout(()=>z(null),3e3)}},D=async()=>{x(!0);try{await (0,q.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reset"})}),await A()}catch{z({type:"error",text:b?.resetFailed??"Failed to reset sync configuration"})}finally{x(!1),setTimeout(()=>z(null),3e3)}};if(i)return(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.A,{size:18,className:"animate-spin text-muted-foreground"})});if(!c||!c.enabled)return(0,d.jsx)(v,{t:a,onInitComplete:A});if(c.needsSetup)return(0,d.jsx)("div",{className:"space-y-6",children:(0,d.jsxs)("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-destructive/10",children:[(0,d.jsx)(f.A,{size:18,className:"text-destructive shrink-0 mt-0.5"}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-destructive",children:b?.brokenTitle??"Sync configuration is broken"}),(0,d.jsx)("p",{className:"text-xs text-destructive/80",children:c.lastError||(b?.brokenDesc??"The git repository or remote is missing. Reset to re-configure.")}),(0,d.jsxs)(p.jn,{onClick:D,disabled:w,className:"flex items-center gap-2 mt-2",children:[w&&(0,d.jsx)(h.A,{size:14,className:"animate-spin"}),b?.resetButton??"Reset & Re-configure"]})]})]})});let E=c.conflicts||[];return(0,d.jsx)("div",{className:"space-y-4",children:(0,d.jsxs)(p.L7,{icon:(0,d.jsx)(k.A,{size:15}),title:b?.sectionTitle??"Sync",description:c.remote,badge:(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-success/15 text-success font-medium",children:b?.labelEnabled??"Active"}),children:[(0,d.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:b?.labelBranch??"Branch"}),(0,d.jsx)("span",{className:"font-mono text-xs",children:c.branch})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:b?.labelLastSync??"Last sync"}),(0,d.jsx)("span",{className:"text-xs",children:r(c.lastSync,b)})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:b?.labelUnpushed??"Unpushed"}),(0,d.jsx)("span",{className:"text-xs",children:"string"==typeof c.unpushed&&/^\d+$/.test(c.unpushed)?b?.unpushedCommits?.(parseInt(c.unpushed,10))??`${c.unpushed} commits`:`${c.unpushed??"?"} commits`})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:b?.labelAutoSync??"Auto-sync"}),(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs",children:["commit"," ",(0,d.jsxs)("select",{className:"bg-muted rounded px-1.5 py-0.5 text-xs border border-border cursor-pointer",value:c.autoCommitInterval,onChange:async a=>{let b=parseInt(a.target.value,10);try{(await fetch("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update-intervals",autoCommitInterval:b})})).ok&&A()}catch{}},children:[(0,d.jsx)("option",{value:10,children:"10s"}),(0,d.jsx)("option",{value:15,children:"15s"}),(0,d.jsx)("option",{value:30,children:"30s"}),(0,d.jsx)("option",{value:60,children:"60s"}),(0,d.jsx)("option",{value:120,children:"120s"})]})," \xb7 pull ",(0,d.jsxs)("select",{className:"bg-muted rounded px-1.5 py-0.5 text-xs border border-border cursor-pointer",value:c.autoPullInterval,onChange:async a=>{let b=parseInt(a.target.value,10);try{(await fetch("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update-intervals",autoPullInterval:b})})).ok&&A()}catch{}},children:[(0,d.jsx)("option",{value:60,children:"1min"}),(0,d.jsx)("option",{value:120,children:"2min"}),(0,d.jsx)("option",{value:300,children:"5min"}),(0,d.jsx)("option",{value:600,children:"10min"}),(0,d.jsx)("option",{value:1800,children:"30min"}),(0,d.jsx)("option",{value:3600,children:"60min"})]})]})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,d.jsxs)("button",{type:"button",onClick:B,disabled:l,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,d.jsx)(o.A,{size:12,className:l?"animate-spin":""}),b?.syncNow??"Sync Now"]}),(0,d.jsx)("button",{type:"button",onClick:C,disabled:w,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-destructive hover:border-destructive/50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:b?.disableAutoSync??"Disable Auto-sync"})]}),y&&(0,d.jsx)("div",{className:"flex items-start gap-1.5 text-xs",role:"status","aria-live":"polite",children:"success"===y.type?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.A,{size:13,className:"text-success shrink-0 mt-0.5"}),(0,d.jsx)("span",{className:"text-success",children:y.text})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{size:13,className:"text-destructive shrink-0 mt-0.5"}),(0,d.jsx)("div",{className:"space-y-0.5",children:y.text.split("\n").map((a,b)=>(0,d.jsx)("span",{className:`block ${b>0?"text-destructive/70":"text-destructive"}`,children:a},b))})]})}),E.length>0&&(0,d.jsxs)("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-foreground",children:b?.conflictsTitle?.(E.length)??`Conflicts (${E.length})`}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:b?.conflictExplain??"These files were changed on both this device and the remote. Choose which version to keep for each file."}),(0,d.jsx)("div",{className:"space-y-2",children:E.map((a,c)=>(0,d.jsx)(t,{file:a.file,time:a.time,syncT:b,onResolved:A},c))})]}),c.lastError&&0===E.length&&(0,d.jsxs)("div",{className:"flex items-start gap-2 text-xs p-2.5 rounded-lg bg-destructive/10 text-destructive",children:[(0,d.jsx)(f.A,{size:12,className:"shrink-0 mt-0.5"}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("span",{className:"block",children:c.lastError}),s(c.lastError,c.remote,b)&&(0,d.jsx)("span",{className:"block text-destructive/70",children:s(c.lastError,c.remote,b)})]})]}),(0,d.jsx)(u,{syncT:b})]})})}},29272:(a,b,c)=>{"use strict";c.d(b,{G:()=>v});var d=c(48249),e=c(67484),f=c(36041),g=c(73908),h=c(56884),i=c(84121),j=c(41023),k=c(35654),l=c(83052),m=c(3541),n=c(99917),o=c(44218),p=c(19794);let q=[{value:"680px",label:"Narrow",width:42},{value:"780px",label:"Default",width:56},{value:"960px",label:"Wide",width:75},{value:"100%",label:"Full",width:100}],r=[{value:"lora",label:"Lora",category:"Serif",style:{fontFamily:"Lora, Georgia, serif"}},{value:"ibm-plex-sans",label:"IBM Plex Sans",category:"Sans",style:{fontFamily:"'IBM Plex Sans', sans-serif"}},{value:"geist",label:"Geist",category:"Sans",style:{fontFamily:"var(--font-geist-sans), sans-serif"}},{value:"ibm-plex-mono",label:"IBM Plex Mono",category:"Mono",style:{fontFamily:"'IBM Plex Mono', monospace"}}];var s=c(81285);function t({icon:a,label:b,children:c}){return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:a}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:b})]}),c]})}function u({options:a,value:b,onChange:c}){return(0,d.jsx)("div",{className:"flex gap-2",children:a.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>c(a.value),className:`flex items-center gap-1.5 px-3.5 py-2 text-sm font-medium rounded-xl transition-all ${b===a.value?"bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm":"bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:[a.icon,a.label]},a.value))})}function v({font:a,setFont:b,fontSize:c,setFontSize:v,contentWidth:w,setContentWidth:x,dark:y,setDark:z,locale:A,setLocale:B,t:C}){let[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(()=>"system"),[H,I]=(0,e.useState)(()=>"system"),J=C.settings.appearance;return(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)(s.L7,{icon:(0,d.jsx)(f.A,{size:15}),title:J.preferencesTitle??"Preferences",children:[(0,d.jsx)(t,{icon:(0,d.jsx)(g.A,{size:14}),label:J.colorTheme,children:(0,d.jsx)(u,{options:[{value:"system",label:J.system,icon:(0,d.jsx)(h.A,{size:14})},{value:"dark",label:J.dark,icon:(0,d.jsx)(i.A,{size:14})},{value:"light",label:J.light,icon:(0,d.jsx)(g.A,{size:14})}],value:F,onChange:a=>{G(a),localStorage.setItem("theme",a);let b="system"===a?window.matchMedia("(prefers-color-scheme: dark)").matches:"dark"===a;z(b),document.documentElement.classList.toggle("dark",b)}})}),(0,d.jsx)(t,{icon:(0,d.jsx)(j.A,{size:14}),label:J.language,children:(0,d.jsx)(u,{options:[{value:"system",label:J.system,icon:(0,d.jsx)(h.A,{size:14})},{value:"en",label:"EN"},{value:"zh",label:"中文"}],value:H,onChange:a=>{I(a),localStorage.setItem("locale",a);let b="system"===a?navigator.language.startsWith("zh")?"zh":"en":a;B(b),document.cookie=`locale=${b};path=/;max-age=31536000;SameSite=Lax`}})})]}),(0,d.jsxs)(s.L7,{icon:(0,d.jsx)(k.A,{size:15}),title:J.readingTitle??"Reading",description:J.readingDesc??"Customize how your notes look",children:[(0,d.jsx)(t,{icon:(0,d.jsx)(l.A,{size:14}),label:J.readingFont,children:(0,d.jsx)("div",{className:"space-y-0.5",children:r.map(c=>{let e=a===c.value;return(0,d.jsxs)("button",{type:"button",onClick:()=>b(c.value),className:`flex items-center gap-4 w-full px-3 py-2.5 rounded-lg transition-all text-left relative ${e?"bg-[var(--amber-subtle)]":"hover:bg-muted/50"}`,children:[e&&(0,d.jsx)("div",{className:"absolute left-0 top-2 bottom-2 w-[3px] rounded-r-full bg-[var(--amber)]"}),(0,d.jsx)("span",{className:`text-xl font-medium w-10 text-center shrink-0 ${e?"text-foreground":"text-muted-foreground/60"}`,style:{fontFamily:c.style.fontFamily},children:"Aa"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:`text-sm font-medium ${e?"text-foreground":"text-muted-foreground"}`,style:{fontFamily:c.style.fontFamily},children:c.label}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground/50",children:c.category})]}),(0,d.jsx)("p",{className:`text-sm truncate mt-0.5 ${e?"text-muted-foreground":"text-muted-foreground/40"}`,style:{fontFamily:c.style.fontFamily},children:J.fontPreview})]})]},c.value)})})}),(0,d.jsx)(t,{icon:(0,d.jsx)(m.A,{size:14}),label:J.fontSize,children:(0,d.jsxs)("div",{className:"px-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 shrink-0",style:{fontSize:"11px"},children:"A"}),(0,d.jsx)("input",{type:"range",min:14,max:17,step:1,value:parseInt(c),onChange:a=>v(`${a.target.value}px`),className:"flex-1 h-1.5 rounded-full appearance-none bg-muted cursor-pointer accent-[var(--amber)] [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[var(--amber)] [&::-webkit-slider-thumb]:shadow-sm [&::-webkit-slider-thumb]:cursor-pointer [&::-webkit-slider-thumb]:transition-transform [&::-webkit-slider-thumb]:hover:scale-110 [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-[var(--amber)] [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:shadow-sm [&::-moz-range-thumb]:cursor-pointer"}),(0,d.jsx)("span",{className:"text-base text-muted-foreground/60 shrink-0",children:"A"})]}),(0,d.jsx)("div",{className:"text-center mt-1.5",children:(0,d.jsxs)("span",{className:"text-xs tabular-nums text-muted-foreground",children:[parseInt(c),"px"]})}),(0,d.jsx)("p",{className:"text-muted-foreground leading-relaxed mt-2 px-1",style:{fontSize:c,fontFamily:r.find(b=>b.value===a)?.style.fontFamily},children:J.fontSizePreview})]})}),(0,d.jsx)(t,{icon:(0,d.jsx)(n.A,{size:14}),label:J.contentWidth,children:(0,d.jsx)("div",{className:"space-y-1",children:q.map(a=>{let b=w===a.value;return(0,d.jsxs)("button",{type:"button",onClick:()=>x(a.value),className:`flex items-center gap-3 w-full px-3 py-2 rounded-lg transition-all ${b?"bg-[var(--amber-subtle)]":"hover:bg-muted/50"}`,children:[(0,d.jsx)("div",{className:"flex-1 h-2 rounded-full bg-muted/40 overflow-hidden",children:(0,d.jsx)("div",{className:`h-full rounded-full transition-all ${b?"bg-[var(--amber)]":"bg-muted-foreground/20"}`,style:{width:`${a.width}%`}})}),(0,d.jsx)("span",{className:`text-sm shrink-0 w-14 text-right ${b?"text-foreground font-medium":"text-muted-foreground"}`,children:a.label})]},a.value)})})})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/40 px-0.5",children:J.browserNote}),(0,d.jsxs)("div",{className:"border-t border-border pt-4",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>E(!D),className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:[D?(0,d.jsx)(o.A,{size:14}):(0,d.jsx)(p.A,{size:14}),C.settings.tabs.shortcuts]}),D&&(0,d.jsx)("div",{className:"mt-3 space-y-0.5",children:C.shortcuts.map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center justify-between py-1.5 px-1",children:[(0,d.jsx)("span",{className:"text-sm text-foreground",children:a.description}),(0,d.jsx)("div",{className:"flex items-center gap-1",children:a.keys.map((a,b)=>(0,d.jsx)("kbd",{className:"px-1.5 py-0.5 text-2xs font-mono bg-muted border border-border rounded text-muted-foreground",children:a},b))})]},b))})]})]})}},29713:(a,b,c)=>{"use strict";c.d(b,{Z:()=>m});var d=c(67484);let e="mindos-pinned-files",f="mindos:pins-changed";function g(){return j}let h=[];function i(){return h}let j=[];function k(a){let b=b=>{b.key===e&&(j=[],a())},c=()=>{j=[],a()};return window.addEventListener("storage",b),window.addEventListener(f,c),()=>{window.removeEventListener("storage",b),window.removeEventListener(f,c)}}function l(a){j=a;try{localStorage.setItem(e,JSON.stringify(a))}catch{}window.dispatchEvent(new Event(f))}function m(){let a=(0,d.useSyncExternalStore)(k,g,i),b=(0,d.useCallback)(b=>a.includes(b),[a]),c=(0,d.useCallback)(a=>{let b=[],c=b.indexOf(a);c>=0?b.splice(c,1):b.unshift(a),l(b)},[]);return{pinnedFiles:a,isPinned:b,togglePin:c,reorderPins:(0,d.useCallback)(a=>{l(a)},[]),removePin:(0,d.useCallback)(a=>{l([].filter(b=>b!==a))},[])}}},29820:(a,b,c)=>{"use strict";c.d(b,{A:()=>C});var d=c(48249),e=c(67484),f=c(19099),g=c(98631),h=c(84248),i=c(69924),j=c(98971),k=c(90473),l=c(2188),m=c(10316),n=c(16651),o=c(17512),p=c(70366),q=c(95801),r=c(41861),s=c(44218),t=c(4140),u=c(78890),v=c(30315),w=c(86367),x=c(92464),y=c(29974),z=c(81285);function A({icon:a,title:b,prompt:c,tryLabel:e}){return(0,d.jsxs)("div",{className:"group flex items-center gap-2.5 px-4 py-1.5 hover:bg-muted/50 transition-colors rounded-sm mx-1",children:[(0,d.jsx)("span",{className:"text-muted-foreground shrink-0",children:a}),(0,d.jsx)("span",{className:"text-xs text-foreground truncate flex-1",title:b,children:b}),(0,d.jsx)("button",{onClick:()=>(0,x.NH)(c,"user"),className:"opacity-0 group-hover:opacity-100 text-2xs px-2 py-0.5 rounded text-[var(--amber-text)] bg-[var(--amber-dim)] hover:opacity-80 transition-all duration-150 shrink-0",children:e})]})}let B={c1:(0,d.jsx)(g.A,{size:12}),c2:(0,d.jsx)(h.A,{size:12}),c3:(0,d.jsx)(i.A,{size:12}),c4:(0,d.jsx)(j.A,{size:12}),c5:(0,d.jsx)(k.A,{size:12}),c6:(0,d.jsx)(l.A,{size:12}),c7:(0,d.jsx)(m.A,{size:12}),c8:(0,d.jsx)(n.A,{size:12}),c9:(0,d.jsx)(o.A,{size:12})};function C({active:a,maximized:b,onMaximize:c}){let{t:g}=(0,v.Y)(),h=g.panels.discover,i=g.explore,j=g.panels.plugins,l=(0,f.useRouter)(),[m,n]=(0,e.useState)(!1),[o,x]=(0,e.useState)(!1),[,C]=(0,e.useState)(0),[D,E]=(0,e.useState)(new Set);(0,e.useRef)(!1);let F=(0,e.useCallback)((a,b)=>{(0,y.$7)(a,b),C(a=>a+1),window.dispatchEvent(new Event("renderer-state-changed"))},[]),G=(0,e.useCallback)(a=>{l.push(`/view/${a.split("/").map(encodeURIComponent).join("/")}`)},[l]),H=m?(0,y.MZ)():[],I=m?H.filter(a=>(0,y.pl)(a.id)).length:0;return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(t.A,{title:h.title,maximized:b,onMaximize:c}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[(0,d.jsxs)("div",{className:"py-2",children:[(0,d.jsx)(u.G,{icon:(0,d.jsx)(k.A,{size:14,className:"text-[var(--amber)]"}),title:h.useCases,badge:(0,d.jsx)("span",{className:"text-2xs tabular-nums text-muted-foreground",children:w.LD.length}),href:"/explore"}),(0,d.jsx)(u.G,{icon:(0,d.jsx)(p.A,{size:14,className:"text-muted-foreground"}),title:h.pluginMarket,badge:(0,d.jsx)(u.M,{label:h.comingSoon})}),(0,d.jsx)(u.G,{icon:(0,d.jsx)(q.A,{size:14,className:"text-muted-foreground"}),title:h.skillMarket,badge:(0,d.jsx)(u.M,{label:h.comingSoon})}),(0,d.jsx)(u.G,{icon:(0,d.jsx)(r.A,{size:14,className:"text-muted-foreground"}),title:h.spaceTemplates,badge:(0,d.jsx)(u.M,{label:h.comingSoon})})]}),(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),(0,d.jsxs)("div",{className:"py-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>x(a=>!a),className:"w-full flex items-center gap-1.5 px-4 py-1.5 text-left",children:[(0,d.jsx)(s.A,{size:11,className:`text-muted-foreground transition-transform duration-150 ${o?"":"-rotate-90"}`}),(0,d.jsx)(p.A,{size:13,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider flex-1",children:j.title}),(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground tabular-nums",children:[I,"/",H.length]})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${o?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsx)("div",{className:"overflow-hidden",...!o&&{inert:!0},children:H.map(a=>{let b=(0,y.pl)(a.id),c=!!a.entryPath&&D.has(a.entryPath),e=b&&a.entryPath&&c;return(0,d.jsxs)("div",{className:`flex items-center gap-2 px-4 py-1.5 mx-1 rounded-sm transition-colors ${e?"cursor-pointer hover:bg-muted/50":""} ${!b?"opacity-50":""}`,onClick:e?()=>G(a.entryPath):void 0,role:e?"link":void 0,tabIndex:e?0:void 0,onKeyDown:e?b=>{("Enter"===b.key||" "===b.key)&&(b.preventDefault(),G(a.entryPath))}:void 0,children:[(0,d.jsx)("span",{className:"text-sm shrink-0",suppressHydrationWarning:!0,children:a.icon}),(0,d.jsx)("span",{className:"text-xs text-foreground truncate flex-1",title:a.name,children:a.name}),a.core?(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:j.core}):(0,d.jsx)("div",{onClick:a=>a.stopPropagation(),children:(0,d.jsx)(z.lM,{checked:b,onChange:b=>F(a.id,b),size:"sm"})})]},a.id)})})})]}),(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),(0,d.jsxs)("div",{className:"py-2",children:[(0,d.jsx)("div",{className:"px-4 py-1.5",children:(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider",children:h.useCases})}),w.LD.map(a=>{var b;let c=(b=a.id,({c1:i.c1,c2:i.c2,c3:i.c3,c4:i.c4,c5:i.c5,c6:i.c6,c7:i.c7,c8:i.c8,c9:i.c9})[b]);return c?(0,d.jsx)(A,{icon:B[a.id]||(0,d.jsx)(k.A,{size:12}),title:c.title,prompt:c.prompt,tryLabel:h.tryIt},a.id):null})]})]})]})}},29974:(a,b,c)=>{"use strict";c.d(b,{$7:()=>g,MZ:()=>k,TS:()=>i,UG:()=>f,YB:()=>j,pl:()=>h});let d=[],e=new Set;function f(){}function g(a,b){let c=d.find(b=>b.id===a);c?.core||(b?e.delete(a):e.add(a))}function h(a){let b=d.find(b=>b.id===a);return!!b?.core||!e.has(a)}function i(a){d.find(b=>b.id===a.id)||d.push(a)}function j(a,b,c){if(c){let a=d.find(a=>a.id===c);return a&&h(a.id)?a:void 0}return d.find(c=>h(c.id)&&c.match({filePath:a,extension:b}))}function k(){return d.filter(a=>!a.appBuiltinFeature)}},30315:(a,b,c)=>{"use strict";c.d(b,{Y:()=>g,D:()=>f});var d=c(31417);let e={en:{common:{relatedFiles:"Related Files"},app:{tagline:"You think here, Agents act there.",footer:"MindOS \xb7 human-agent collaborative mind system"},login:{tagline:"You think here, Agents act there.",subtitle:"Enter your password to continue",passwordLabel:"Password",passwordPlaceholder:"Enter password",signIn:"Sign in",signingIn:"Signing in…",incorrectPassword:"Incorrect password. Please try again.",connectionError:"Connection error. Please try again."},notFound:{title:"File not found",description:"This file does not exist in your knowledge base.",createButton:"Create this file",creating:"Creating...",goToParent:"Go to parent folder",goHome:"Home"},updateBanner:{newVersion:(a,b)=>`MindOS v${a} available (current: v${b})`,updateNow:"Update",runUpdate:"Run",orSee:"or",releaseNotes:"release notes"},sidebar:{files:"Spaces",search:"Search",searchTitle:"Search",askTitle:"MindOS Agent",settingsTitle:"Settings",plugins:"Plugins",agents:"Agents",echo:"Echo",discover:"Discover",workflows:"Flows",history:"History",help:"Help",syncLabel:"Sync",collapseTitle:"Collapse sidebar",expandTitle:"Expand sidebar",collapseLevel:"Collapse one level",collapseLevelHint:"Collapse one level (double-click: all)",expandLevel:"Expand one level",expandLevelHint:"Expand one level (double-click: all)",importFile:"Import file",new:"New",newFile:"New file",newSpace:"New Space",more:"More",showHiddenFiles:"Show hidden files",sync:{synced:"Synced",unpushed:"awaiting push",unpushedHint:"commit(s) not yet pushed to remote — will sync automatically",conflicts:"conflicts",conflictsHint:"file(s) have merge conflicts — open Settings > Sync to resolve",syncError:"Sync error",syncOff:"Sync off",syncing:"Syncing...",syncNow:"Sync now",syncDone:"Sync complete",syncFailed:"Sync failed",syncRestored:"Sync restored",enableSync:"Enable sync",enableHint:"Set up cross-device sync"}},search:{placeholder:"Search files...",noResults:"No results found",prompt:"Type to search across all files",navigate:"navigate",open:"open",close:"close",tabSearch:"Search",tabActions:"Actions",openSettings:"Open Settings",restartWalkthrough:"Restart Walkthrough",toggleDarkMode:"Toggle Dark Mode",goToAgents:"Go to Agents",goToDiscover:"Go to Discover",goToHelp:"Go to Help",walkthroughRestarted:"Walkthrough restarted"},shortcutPanel:{title:"Keyboard Shortcuts",navigation:"Navigation",panelsSection:"Panels",editor:"Editor",toggleSearch:"Toggle Search",toggleAskAI:"Toggle Ask AI",openSettings:"Open Settings",keyboardShortcuts:"Keyboard Shortcuts",closePanel:"Close panel / Exit maximize",saveFile:"Save file",undo:"Undo",redo:"Redo",toggleHint:"to toggle this panel"},ask:{title:"MindOS Agent",fabLabel:"Ask AI",placeholder:"Ask a question... @ files, / skills",emptyPrompt:"How can I help?",emptyHint:"Type @ to reference files \xb7 / to use skills",send:"send",newlineHint:"new line",panelComposerResize:"Drag up to enlarge the input area",panelComposerFooter:"Resize height",panelComposerResetHint:"Double-click to reset height",panelComposerKeyboard:"Arrow keys adjust height; Home/End min/max",attachFile:"Context",attachFileLabel:"Document",attachImageLabel:"Image",uploadedFiles:"Uploaded",skillsHint:"skills",attachCurrent:"attach current file",stopTitle:"Stop",cancelReconnect:"Cancel reconnect",connecting:"Thinking with you...",thinking:"Thinking...",thinkingLabel:"Thinking",searching:"Searching knowledge base...",generating:"Generating response...",stopped:"Generation stopped.",errorNoResponse:"AI returned no content. Possible causes: model does not support streaming, proxy compatibility issue, or request exceeds context limit.",reconnecting:(a,b)=>`Connection lost. Reconnecting (${a}/${b})...`,reconnectFailed:"Connection failed after multiple attempts.",retry:"Retry",suggestions:["Summarize this document","Organize my recent notes","Find related notes","Draft a new note"],modeChat:"Chat",modeAgent:"Agent",modeChatHint:"Can search / read KB \xb7 saves tokens",modeAgentHint:"Full tool access \xb7 can modify KB",sessionHistory:"Session History",clearAll:"Clear all",confirmClear:"Confirm clear?",noSessions:"No saved sessions.",renameSession:"Rename",draftingHint:"AI is still running — you can draft the next step now.",providerCapsule:"Switch model provider",providerDefault:"Default",providerNoKey:"No configured providers"},changes:{unreadBanner:a=>`${a} content change${1===a?"":"s"} unread`,reviewNow:"Review now",dismiss:"Dismiss notification",title:"Content changes",subtitle:"Review recent edits across user and agent operations.",eventsCount:a=>`${a} event${1===a?"":"s"}`,unreadCount:a=>`${a} unread`,refresh:"Refresh",markSeen:"Mark seen",markAllRead:"Mark all read",filters:{filePath:"File path",filePathPlaceholder:"e.g. Projects/plan.md",source:"Agents (source)",operation:"Tools (operation)",operationAll:"All operations",keyword:"Keyword",keywordPlaceholder:"summary / op / path",all:"All",agent:"Agent",user:"User",system:"System"},loading:"Loading changes...",empty:"No content changes yet.",open:"Open",unchangedLines:a=>`... ${a} unchanged lines ...`,relativeTime:{justNow:"just now",minutesAgo:a=>`${a}m ago`,hoursAgo:a=>`${a}h ago`,daysAgo:a=>`${a}d ago`}},hints:{noValidFiles:"No valid files selected",aiOrganizing:"AI is organizing",importInProgress:"Import in progress",templateInitializing:"Another template is being initialized",configureAiKey:"Configure API key in Settings → AI",syncInProgress:"Sync already in progress",toggleInProgress:"Toggle operation in progress",typeMessage:"Type a message",mentionInProgress:"Mention or command in progress",cleanupInProgress:"Cleanup already in progress",tokenResetInProgress:"Token reset in progress",aiNotConfigured:"AI not configured or generation in progress",generationInProgress:"Generation in progress or AI not configured",cannotJumpForward:"Cannot jump forward in setup",testInProgressOrNoKey:"Test in progress or no API key",workflowStepRunning:"Workflow step already running",workflowRunning:"Workflow step is running",sessionHistory:"Session history",newSession:"New session",attachFile:"Attach local file",maximizePanel:"Focus mode",restorePanel:"Exit focus",dockToSide:"Dock to side panel",openAsPopup:"Open as popup",closePanel:"Close",newChat:"New chat",closeSession:"Close session"},home:{recentlyModified:"Recently Modified",recentlyActive:"Recently Active",recentlyEdited:"Recently Edited",allSpaces:"All Spaces",spaces:"Spaces",nFiles:a=>`${a} file${1===a?"":"s"}`,other:"Other",newSpace:"New Space",spaceName:"Space name",spaceDescription:"Description",spaceDescPlaceholder:"Describe the purpose of this space",spaceNameNoSlash:"Name cannot contain / or \\",spaceExists:"A space with this name already exists",spaceCreateFailed:"Failed to create space",noSpacesYet:"No spaces yet. Create one to organize your knowledge.",spaceLocation:"Location",rootLevel:"Root",optional:"optional",aiInit:"AI initialize content",aiInitHint:"AI will generate a description and guidelines for this space",aiInitNoKey:"Configure an API key in Settings → AI to enable",aiInitGenerating:a=>`Generating content for ${a}`,aiInitReady:a=>`${a} ready`,aiInitReview:"Review",aiInitDiscard:"Discard",aiInitReverted:a=>`${a} reverted to template`,createSpace:"Create",cancelCreate:"Cancel",continueEditing:"Continue editing",newNote:"New Notes",builtinFeatures:"Tools",builtinActive:"Active",builtinInactive:"Not active",toolName:{"agent-inspector":"Agent Inspector","config-panel":"Config Panel",todo:"TODO Board","workflow-yaml":"Workflows"},toolDesc:{"agent-inspector":"View agent tool-call logs and audit trail","config-panel":"Edit and manage global configuration",todo:"Manage tasks as an interactive kanban board","workflow-yaml":"Execute step-by-step workflows with AI assistance"},plugins:"Extensions",changeHistory:"Change History",showMore:"Show more",showLess:"Show less",viewAll:"View all",createToActivate:"Create {file} to activate",shortcuts:{searchFiles:"Search files",askAI:"MindOS Agent",editFile:"Edit file",save:"Save",settings:"Settings"},relativeTime:{justNow:"just now",minutesAgo:a=>`${a}m ago`,hoursAgo:a=>`${a}h ago`,daysAgo:a=>`${a}d ago`},cleanupExamples:a=>`${a} example file${a>1?"s":""} from the template can be removed`,cleanupExamplesButton:"Clean up",cleanupExamplesDone:"Example files removed"},echoSpotlight:{title:"Echo",dailyLine:"Today's thought",placeholder:"A quiet line for today...",invite:"Record today's one thought",inviteDesc:"One line, no pressure. Echo reflects your thinking patterns over time.",goToEcho:"Open Echo",savedLocally:"Saved locally on this device"},suggestion:{title:"You might want to",staleFiles:a=>`${a} file${1!==a?"s":""} not updated in 30+ days`,reviewStale:"Review",dismiss:"Dismiss"},inbox:{title:"Capture",count:a=>`${a}`,emptyTitle:"Quick capture, organize later",emptyDesc:"Drag files here or click Upload to save them instantly.",uploadButton:"Upload Files",organizeButton:"AI Organize",organizing:"Organizing...",viewAll:"View all",more:a=>`${a} more`,agingHint:"7+ days",savedToast:a=>`${a} file${1===a?"":"s"} saved to Capture`,savedWithSkipped:(a,b)=>a>0?`${a} saved, ${b} skipped (unsupported format)`:`${b} file${1===b?"":"s"} skipped — unsupported format`,tooLarge:a=>`${a} file${1===a?"":"s"} too large (max 10 MB)`,savedWithOversized:(a,b)=>`${a} saved, ${b} skipped (too large)`,organizePrompt:a=>`Please organize these files from Inbox into appropriate locations in my knowledge base. Analyze each file's content and move it to the most fitting Space or directory. Create new directories if needed. Here are the files:
57
66
 
@@ -91,9 +100,9 @@ ${a.trim()||"(空行)"}`,pastYouDrawLabel:"往日一瞥",pastYouAnother:"再
91
100
  border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
92
101
  disabled:opacity-40 disabled:cursor-not-allowed
93
102
  ${u?"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground":"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15"}
94
- `,title:x(a),"aria-expanded":n,"aria-haspopup":"listbox",children:[v(a,11),(0,d.jsx)("span",{className:"truncate max-w-[80px]",children:w(a)}),(0,d.jsx)(j.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&y&&(0,f.createPortal)(y,document.body)]})}},39868:(a,b,c)=>{"use strict";async function d(a){if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(a),!0}catch{}try{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select();let c=document.execCommand("copy");return document.body.removeChild(b),c}catch{return!1}}c.d(b,{l:()=>d})},41297:(a,b,c)=>{"use strict";c.d(b,{l:()=>h});var d=c(67484);let e=new Set([".txt",".md",".markdown",".csv",".json",".yaml",".yml",".xml",".html",".htm",".pdf"]);function f(a){let b=a.lastIndexOf(".");return b>=0?a.slice(b).toLowerCase():""}async function g(a){let b=function(a){let b="";for(let c=0;c<a.length;c+=32768)b+=String.fromCharCode(...a.subarray(c,c+32768));return btoa(b)}(new Uint8Array(await a.arrayBuffer())),c=await fetch("/api/extract-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a.name,dataBase64:b})}),d={};try{d=await c.json()}catch{}if(!c.ok)throw Error(d.error||`PDF extraction failed (${c.status})`);return d.extracted&&d.text||""}function h(){let[a,b]=(0,d.useState)([]),[c,h]=(0,d.useState)(""),i=(0,d.useRef)(null),j=(0,d.useCallback)(async a=>{if(!a||0===a.length)return;let c=Array.from(a).slice(0,8),d=[],i=[];for(let a of c){let b=f(a.name);e.has(b)?d.push(a):i.push(a.name)}i.length>0?h(`Unsupported file type: ${i.join(", ")}`):h("");let j=await Promise.all(d.map(async a=>{if(".pdf"===f(a.name))try{let b=await g(a);return{name:a.name,content:b?`[PDF TEXT EXTRACTED: ${a.name}]
103
+ `,title:x(a),"aria-expanded":n,"aria-haspopup":"listbox",children:[v(a,11),(0,d.jsx)("span",{className:"truncate max-w-[80px]",children:w(a)}),(0,d.jsx)(j.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&y&&(0,f.createPortal)(y,document.body)]})}},39690:(a,b,c)=>{"use strict";c.d(b,{D:()=>e});var d=c(99829);let e=(0,d.createServerReference)("007b570256fa6870396fa8337f73e8bbbdd3b278b2",d.callServer,void 0,d.findSourceMapURL,"scanExampleFilesAction")},39868:(a,b,c)=>{"use strict";async function d(a){if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(a),!0}catch{}try{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.opacity="0",document.body.appendChild(b),b.select();let c=document.execCommand("copy");return document.body.removeChild(b),c}catch{return!1}}c.d(b,{l:()=>d})},41297:(a,b,c)=>{"use strict";c.d(b,{l:()=>h});var d=c(67484);let e=new Set([".txt",".md",".markdown",".csv",".json",".yaml",".yml",".xml",".html",".htm",".pdf"]);function f(a){let b=a.lastIndexOf(".");return b>=0?a.slice(b).toLowerCase():""}async function g(a){let b=function(a){let b="";for(let c=0;c<a.length;c+=32768)b+=String.fromCharCode(...a.subarray(c,c+32768));return btoa(b)}(new Uint8Array(await a.arrayBuffer())),c=await fetch("/api/extract-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a.name,dataBase64:b})}),d={};try{d=await c.json()}catch{}if(!c.ok)throw Error(d.error||`PDF extraction failed (${c.status})`);return d.extracted&&d.text||""}function h(){let[a,b]=(0,d.useState)([]),[c,h]=(0,d.useState)(""),i=(0,d.useRef)(null),j=(0,d.useCallback)(async a=>{if(!a||0===a.length)return;let c=Array.from(a).slice(0,8),d=[],i=[];for(let a of c){let b=f(a.name);e.has(b)?d.push(a):i.push(a.name)}i.length>0?h(`Unsupported file type: ${i.join(", ")}`):h("");let j=await Promise.all(d.map(async a=>{if(".pdf"===f(a.name))try{let b=await g(a);return{name:a.name,content:b?`[PDF TEXT EXTRACTED: ${a.name}]
95
104
 
96
- ${b}`:`[PDF: ${a.name}] Could not extract readable text (possibly scanned/image PDF).`}}catch{return{name:a.name,content:`[PDF: ${a.name}] Failed to extract text from this PDF.`}}return{name:a.name,content:await a.text()}}));b(a=>{let b=[...a];for(let a of j)b.some(b=>b.name===a.name&&b.content===a.content)||b.push(a);return b})},[]),k=(0,d.useCallback)(a=>{b(b=>b.filter((b,c)=>c!==a))},[]);return{localAttachments:a,uploadError:c,uploadInputRef:i,pickFiles:j,removeAttachment:k,clearAttachments:(0,d.useCallback)(()=>{b([]),h("")},[]),injectFiles:(0,d.useCallback)(a=>{b(b=>{let c=[...b];for(let b of a)c.some(a=>a.name===b.name)||c.push(b);return c})},[])}}},41739:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(6079),g=c(96286),h=c(35389),i=c(45231),j=c(13481),k=c(92343),l=c(50514),m=c(46674),n=c(30315);let o=(0,e.memo)(function({isPanel:a,showHistory:b,onToggleHistory:c,onReset:e,isLoading:o,maximized:p,onMaximize:q,askMode:r,onModeSwitch:s,onClose:t}){let{t:u}=(0,n.Y)(),v=a?13:14;return(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[!a&&(0,d.jsx)("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-8 h-1 rounded-full bg-muted-foreground/20 md:hidden"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,d.jsx)(f.A,{size:a?14:15,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:a?"font-display text-xs uppercase tracking-wider text-muted-foreground":"font-display",children:a?"MindOS Agent":u.ask.title})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),c()},"aria-pressed":b,className:`p-2 rounded transition-colors ${b?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:u.hints.sessionHistory,children:(0,d.jsx)(g.A,{size:v})}),(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e()},disabled:o,className:"p-2 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",title:u.hints.newSession,children:(0,d.jsx)(h.A,{size:v})}),a&&q&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),q()},className:"p-2 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:p?u.hints.restorePanel:u.hints.maximizePanel,children:p?(0,d.jsx)(i.A,{size:v}):(0,d.jsx)(j.A,{size:v})}),s&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),s()},className:"p-2 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"popup"===r?u.hints.dockToSide:u.hints.openAsPopup,children:"popup"===r?(0,d.jsx)(k.A,{size:v}):(0,d.jsx)(l.A,{size:v})}),t&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),t()},className:"p-2 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:u.hints.closePanel,"aria-label":"Close",children:(0,d.jsx)(m.A,{size:a?v:15})})]})]})})},43248:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(48249);function e({error:a,reset:b}){return(0,d.jsx)("html",{lang:"en",children:(0,d.jsx)("body",{style:{margin:0,fontFamily:"system-ui, sans-serif",background:"#0f0f0f",color:"#e5e5e5"},children:(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",gap:"16px",padding:"24px",textAlign:"center"},children:[(0,d.jsx)("h2",{style:{fontSize:"18px",fontWeight:600,margin:0},children:"Something went wrong"}),(0,d.jsx)("p",{style:{fontSize:"14px",color:"#888",maxWidth:"400px",margin:0},children:a.message||"An unexpected error occurred. Please try again."}),(0,d.jsxs)("div",{style:{display:"flex",gap:"12px",marginTop:"8px"},children:[(0,d.jsx)("button",{onClick:b,style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,background:"#222",color:"#e5e5e5",border:"1px solid #333",cursor:"pointer"},children:"Try again"}),(0,d.jsx)("a",{href:"/setup",style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,background:"#c8873a",color:"#fff",textDecoration:"none",cursor:"pointer"},children:"Go to Setup"})]})]})})})}},45108:(a,b,c)=>{"use strict";c.d(b,{u:()=>h});var d=c(67484);let e=new Set(["image/png","image/jpeg","image/gif","image/webp"]);async function f(a){let b=a.type;if(a.size<=5242880){let c=new Uint8Array(await a.arrayBuffer()),d="";for(let a=0;a<c.length;a+=32768)d+=String.fromCharCode(...c.subarray(a,a+32768));return{data:btoa(d),mimeType:b}}return new Promise((b,c)=>{let d=new Image;d.onload=()=>{let{width:a,height:e}=d;if(a>1920||e>1920){let b=Math.min(1920/a,1920/e);a=Math.round(a*b),e=Math.round(e*b)}let f=document.createElement("canvas");f.width=a,f.height=e;let g=f.getContext("2d");g?(g.drawImage(d,0,0,a,e),b({data:f.toDataURL("image/jpeg",.85).split(",")[1],mimeType:"image/jpeg"}),URL.revokeObjectURL(d.src)):c(Error("Canvas not supported"))},d.onerror=()=>{c(Error("Failed to load image")),URL.revokeObjectURL(d.src)},d.src=URL.createObjectURL(a)})}function g(a){let b=[];for(let c of Array.from(a))if("file"===c.kind&&e.has(c.type)){let a=c.getAsFile();a&&b.push(a)}return b}function h(){let[a,b]=(0,d.useState)([]),[c,h]=(0,d.useState)(""),i=(0,d.useCallback)(async a=>{h("");let c=a.slice(0,4),d=[];for(let a of c){var g;if(g=a.type,!e.has(g)){h(`Unsupported image type: ${a.type}`);continue}try{let{data:b,mimeType:c}=await f(a);d.push({type:"image",data:b,mimeType:c})}catch{h(`Failed to process image: ${a.name}`)}}b(a=>{let b=[...a,...d];return b.length>4?(h("Maximum 4 images allowed"),b.slice(0,4)):b})},[]),j=(0,d.useCallback)(async a=>{let b=a.clipboardData?.items;if(!b)return!1;let c=g(b);return 0!==c.length&&(await i(c),!0)},[i]),k=(0,d.useCallback)(async a=>{let b=a.dataTransfer?.items;if(!b)return;let c=g(b);c.length>0&&(a.preventDefault(),await i(c))},[i]),l=(0,d.useCallback)(async a=>{if(!a)return;let b=Array.from(a).filter(a=>{var b;return b=a.type,e.has(b)});await i(b)},[i]);return{images:a,imageError:c,addImages:i,handlePaste:j,handleDrop:k,handleFileSelect:l,removeImage:(0,d.useCallback)(a=>{b(b=>b.filter((b,c)=>c!==a))},[]),clearImages:(0,d.useCallback)(()=>{b([]),h("")},[])}}},45862:(a,b,c)=>{"use strict";c.r(b),c.d(b,{SummaryRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SummaryRenderer() from the server but SummaryRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/summary/SummaryRenderer.tsx","SummaryRenderer")},46427:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>D});var d=c(48249),e=c(67484),f=c.n(e),g=c(93053),h=c(75155),i=c(22242),j=c(91282),k=c(65732),l=c.n(k);function m(a,b){return l().unparse([a,...b])}let n=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"#8ab4d8"},{bg:"rgba(200,160,216,0.12)",text:"#c8a0d8"},{bg:"rgba(200,96,96,0.12)",text:"#c86060"},{bg:"rgba(150,150,150,0.12)",text:"var(--muted-foreground)"}];function o(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)&65535;return n[b%n.length]}var p=c(82884),q=c(72419),r=c(44218),s=c(59347),t=c(24520);function u({value:a,onCommit:b}){let[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(a),i=(0,e.useRef)(null);function j(){f(!1),g!==a?b(g):h(a)}return c?(0,d.jsx)("input",{ref:i,value:g,onChange:a=>h(a.target.value),onBlur:j,onKeyDown:b=>{"Enter"===b.key&&j(),"Escape"===b.key&&(h(a),f(!1))},className:"w-full bg-transparent outline-none text-sm",onClick:a=>a.stopPropagation(),style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)",minWidth:60}}):(0,d.jsx)("div",{className:"truncate text-sm cursor-text",style:{color:"var(--foreground)",minWidth:60},onClick:()=>f(!0),title:a,children:a||(0,d.jsx)("span",{style:{color:"var(--muted-foreground)",opacity:.3},children:"—"})})}function v({headers:a,visibleIndices:b,onAdd:c,onCancel:f}){let[g,h]=(0,e.useState)(()=>Array(a.length).fill(""));return(0,d.jsxs)("tr",{style:{background:"color-mix(in srgb, var(--amber) 6%, transparent)",borderTop:"1px solid var(--amber)"},children:[b.map((b,e)=>(0,d.jsx)("td",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)("input",{autoFocus:0===e,value:g[b],onChange:a=>{var c;return c=a.target.value,void h(a=>{let d=[...a];return d[b]=c,d})},onKeyDown:a=>{"Enter"===a.key&&c(g),"Escape"===a.key&&f()},placeholder:a[b],className:"w-full bg-transparent outline-none text-sm placeholder:opacity-30",style:{color:"var(--foreground)",borderBottom:"1px solid var(--border)"}})},b)),(0,d.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"}})]})}function w({headers:a,rows:b,cfg:c,saveAction:g}){let[h,i]=(0,e.useState)(b),[j,k]=(0,e.useState)(!1),l=(0,e.useMemo)(()=>a.map((a,b)=>b).filter(b=>!c.hiddenFields.includes(a[b])),[a,c.hiddenFields]),n=a.indexOf(c.sortField),o=(0,e.useMemo)(()=>{let a=[...h];return n>=0&&a.sort((a,b)=>{let d=a[n]??"",e=b[n]??"",f=parseFloat(d),g=parseFloat(e),h=isNaN(f)||isNaN(g)?d.localeCompare(e):f-g;return"asc"===c.sortDir?h:-h}),a},[h,n,c.sortDir]),p=a.indexOf(c.groupField),w=(0,e.useMemo)(()=>{if(p<0)return[{key:null,rows:o.map(a=>({row:a,orig:a}))}];let a=new Map;for(let b of o){let c=b[p]||"(empty)";a.has(c)||a.set(c,[]),a.get(c).push(b)}return[...a.entries()].map(([a,b])=>({key:a,rows:b.map(a=>({row:a,orig:a}))}))},[o,p]);async function x(b,c,d){let e=h.map(a=>a===b?a.map((a,b)=>b===c?d:a):a);i(e),await g(m(a,e))}async function y(b){let c=h.filter(a=>a!==b);i(c),await g(m(a,c))}async function z(b){let c=[...h,b];i(c),k(!1),await g(m(a,c))}let A={borderBottom:"1px solid var(--border)",fontSize:"0.72rem",letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted-foreground)",fontWeight:600},B=0;return(0,d.jsxs)("div",{className:"rounded-xl overflow-hidden border",style:{borderColor:"var(--border)"},children:[(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"min-w-full text-sm border-collapse",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{style:{background:"var(--muted)"},children:[l.map(b=>(0,d.jsx)("th",{className:"px-4 py-2.5 text-left whitespace-nowrap",style:A,children:(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[a[b],c.sortField===a[b]&&("asc"===c.sortDir?(0,d.jsx)(q.A,{size:10,style:{color:"var(--amber)"}}):(0,d.jsx)(r.A,{size:10,style:{color:"var(--amber)"}}))]})},b)),(0,d.jsx)("th",{className:"w-8",style:{...A,background:"var(--muted)"}})]})}),(0,d.jsxs)("tbody",{children:[w.map((a,b)=>(0,d.jsxs)(f().Fragment,{children:[null!==a.key&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:l.length+1,className:"px-4 py-1.5",style:{background:"var(--accent)",borderBottom:"1px solid var(--border)",borderTop:"1px solid var(--border)"},children:(0,d.jsxs)("span",{className:"text-xs font-semibold font-display",style:{color:"var(--muted-foreground)"},children:[a.key," \xb7 ",a.rows.length]})})},`grp-${a.key}`),a.rows.map(({row:a,orig:b})=>{let c=B++;return(0,d.jsxs)("tr",{className:"group transition-colors",style:{background:c%2==0?"var(--background)":"var(--card)"},onMouseEnter:a=>a.currentTarget.style.background="var(--muted)",onMouseLeave:a=>a.currentTarget.style.background=c%2==0?"var(--background)":"var(--card)",children:[l.map(c=>(0,d.jsx)("td",{className:"px-4 py-2 max-w-xs",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)(u,{value:a[c]??"",onCommit:a=>x(b,c,a)})},c)),(0,d.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)("button",{onClick:()=>y(b),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},children:(0,d.jsx)(s.A,{size:12})})})]},c)})]},a.key??`section-${b}`)),j&&(0,d.jsx)(v,{headers:a,visibleIndices:l,onAdd:z,onCancel:()=>k(!1)})]})]})}),(0,d.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between",style:{background:"var(--muted)",borderTop:"1px solid var(--border)"},children:[(0,d.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)"},children:[h.length," rows \xb7 ",a.length," cols"]}),j?(0,d.jsx)("button",{onClick:()=>k(!1),className:"text-xs px-2.5 py-1 rounded-md",style:{color:"var(--muted-foreground)"},children:"Cancel"}):(0,d.jsxs)("button",{onClick:()=>k(!0),className:"flex items-center gap-1 text-xs px-2.5 py-1 rounded-md",style:{color:"var(--amber)",background:"var(--amber-dim)"},children:[(0,d.jsx)(t.A,{size:12})," Add row"]})]})]})}function x({headers:a,rows:b,cfg:c}){let e=a.indexOf(c.titleField),f=a.indexOf(c.descField),g=a.indexOf(c.tagField);return(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:b.map((b,c)=>{let h=e>=0?b[e]:b[0]??"",i=f>=0?b[f]:"",j=g>=0?b[g]:"",k=j?o(j):null;return(0,d.jsxs)("div",{className:"rounded-xl border p-4 flex flex-col gap-2 hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[j&&k&&(0,d.jsx)("span",{className:"self-start text-xs px-2 py-0.5 rounded-full font-medium",style:{background:k.bg,color:k.text},children:j}),(0,d.jsx)("p",{className:"text-sm font-semibold leading-snug",style:{color:"var(--foreground)"},children:h}),i&&(0,d.jsx)("p",{className:"text-xs leading-relaxed line-clamp-3",style:{color:"var(--muted-foreground)"},children:i}),(0,d.jsx)("div",{className:"mt-1 flex flex-col gap-0.5",children:a.map((a,c)=>{if(c===e||c===f||c===g)return null;let h=b[c];return h?(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5 text-xs",children:[(0,d.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",opacity:.6,fontSize:"0.68rem"},children:a}),(0,d.jsx)("span",{className:"truncate",style:{color:"var(--muted-foreground)"},children:h})]},c):null})})]},c)})})}function y({headers:a,rows:b,cfg:c,saveAction:f}){let[g,h]=(0,e.useState)(b),[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(""),[n,p]=(0,e.useState)(!1),q=a.indexOf(c.groupField),r=a.indexOf(c.titleField),s=a.indexOf(c.descField),{groups:u,groupKeys:v}=(0,e.useMemo)(()=>{let a=new Map;return g.forEach((b,c)=>{let d=(q>=0?b[q]:"")||"(empty)";a.has(d)||a.set(d,[]),a.get(d).push({row:b,origIdx:c})}),{groups:a,groupKeys:[...a.keys()]}},[g,q]);async function w(b,c){let d=g.map((a,d)=>{if(d!==b)return a;let e=[...a];return q>=0&&(e[q]=c),e});h(d),await f(m(a,d))}function x({group:b}){let c=u.get(b)??[],e=o(b),f=i===b;return(0,d.jsxs)("div",{className:"flex-shrink-0 w-64 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,d.jsx)("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{background:e.text}}),(0,d.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider truncate font-display",style:{color:e.text},children:b}),(0,d.jsx)("span",{className:"text-xs ml-auto shrink-0",style:{color:"var(--muted-foreground)",opacity:.5},children:c.length})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl p-1.5 min-h-[80px] transition-colors",style:{background:f?"var(--amber-dim)":"var(--muted)",border:`1px solid ${f?"var(--amber)":"transparent"}`},onDragOver:a=>{a.preventDefault(),j(b)},onDragLeave:a=>{a.currentTarget.contains(a.relatedTarget)||j(null)},onDrop:a=>{j(null);let c=parseInt(a.dataTransfer.getData("origIdx"));isNaN(c)||w(c,b)},children:[c.map(({row:b,origIdx:c})=>{let e=r>=0?b[r]:b[0]??"",f=s>=0?b[s]:"";return(0,d.jsxs)("div",{draggable:!0,onDragStart:a=>{a.dataTransfer.setData("origIdx",String(c)),j(null)},onDragEnd:()=>j(null),className:"rounded-lg border p-3 flex flex-col gap-1.5 cursor-grab active:cursor-grabbing hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,d.jsx)("p",{className:"text-sm font-medium leading-snug",style:{color:"var(--foreground)"},children:e}),f&&(0,d.jsx)("p",{className:"text-xs leading-relaxed line-clamp-2",style:{color:"var(--muted-foreground)"},children:f}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1 mt-0.5",children:a.map((a,c)=>{if(c===q||c===r||c===s)return null;let e=b[c];return e?(0,d.jsxs)("span",{className:"text-2xs px-1.5 py-0.5 rounded font-display",style:{background:"var(--muted)",color:"var(--muted-foreground)"},children:[a,": ",e]},c):null})})]},c)}),0===c.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-12",children:(0,d.jsx)("span",{className:"text-xs",style:{color:"var(--muted-foreground)",opacity:.4},children:"Drop here"})})]})]})}return(0,d.jsxs)("div",{className:"flex gap-3 overflow-x-auto pb-3 items-start",children:[v.map(a=>(0,d.jsx)(x,{group:a},a)),(0,d.jsx)("div",{className:"flex-shrink-0 w-64",children:n?(0,d.jsxs)("div",{className:"rounded-xl border p-3 flex flex-col gap-2",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,d.jsx)("input",{autoFocus:!0,value:k,onChange:a=>l(a.target.value),onKeyDown:a=>{"Enter"===a.key&&k.trim()&&(l(""),p(!1)),"Escape"===a.key&&(l(""),p(!1))},placeholder:"Column name…",className:"text-xs bg-transparent outline-none w-full font-display",style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)"}}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{onClick:()=>{l(""),p(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:"Create"}),(0,d.jsx)("button",{onClick:()=>{l(""),p(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{color:"var(--muted-foreground)"},children:"Cancel"})]})]}):(0,d.jsxs)("button",{onClick:()=>p(!0),className:"flex items-center gap-1.5 text-xs px-3 py-2 rounded-xl border border-dashed w-full transition-colors hover:bg-muted font-display",style:{borderColor:"var(--border)",color:"var(--muted-foreground)"},children:[(0,d.jsx)(t.A,{size:12})," Add column"]})})]})}var z=c(46674),A=c(27608);function B({headers:a,cfg:b,view:c,onClose:e,onChange:f}){let g={color:"var(--muted-foreground)",fontSize:"0.72rem"};function h({label:b,value:c,onChange:e}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{className:"font-display",style:g,children:b}),(0,d.jsx)(A.A,{value:c,onChange:e,size:"sm",options:[{value:"",label:"— none —"},...a.map(a=>({value:a,label:a}))]})]})}return(0,d.jsxs)("div",{className:"absolute right-0 top-10 z-20 w-72 rounded-xl border shadow-xl p-4 flex flex-col gap-3",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:[c," settings"]}),(0,d.jsx)("button",{onClick:e,style:{color:"var(--muted-foreground)"},children:(0,d.jsx)(z.A,{size:13})})]}),"table"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Sort"}),(0,d.jsx)(h,{label:"Sort by",value:b.table.sortField,onChange:a=>f({...b,table:{...b.table,sortField:a}})}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{style:g,children:"Direction"}),(0,d.jsx)("div",{className:"flex rounded overflow-hidden border",style:{borderColor:"var(--border)"},children:["asc","desc"].map(a=>(0,d.jsx)("button",{onClick:()=>f({...b,table:{...b.table,sortDir:a}}),className:"px-3 py-1 text-xs transition-colors font-display",style:{fontSize:"0.72rem",background:b.table.sortDir===a?"var(--amber)":"var(--background)",color:b.table.sortDir===a?"var(--amber-foreground)":"var(--muted-foreground)"},children:a},a))})]}),(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Group"}),(0,d.jsx)(h,{label:"Group by",value:b.table.groupField,onChange:a=>f({...b,table:{...b.table,groupField:a}})}),(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Columns"}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.map(a=>{let c=b.table.hiddenFields.includes(a);return(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{style:g,children:a}),(0,d.jsx)("button",{onClick:()=>{let d=c?b.table.hiddenFields.filter(b=>b!==a):[...b.table.hiddenFields,a];f({...b,table:{...b.table,hiddenFields:d}})},className:"text-xs px-2 py-0.5 rounded transition-colors font-display",style:{background:c?"var(--muted)":"var(--amber-dim)",color:c?"var(--muted-foreground)":"var(--amber)"},children:c?"Hidden":"Visible"})]},a)})})]}),"gallery"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{label:"Title",value:b.gallery.titleField,onChange:a=>f({...b,gallery:{...b.gallery,titleField:a}})}),(0,d.jsx)(h,{label:"Description",value:b.gallery.descField,onChange:a=>f({...b,gallery:{...b.gallery,descField:a}})}),(0,d.jsx)(h,{label:"Tag / Badge",value:b.gallery.tagField,onChange:a=>f({...b,gallery:{...b.gallery,tagField:a}})})]}),"board"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{label:"Group by",value:b.board.groupField,onChange:a=>f({...b,board:{...b.board,groupField:a}})}),(0,d.jsx)(h,{label:"Card title",value:b.board.titleField,onChange:a=>f({...b,board:{...b.board,titleField:a}})}),(0,d.jsx)(h,{label:"Card desc",value:b.board.descField,onChange:a=>f({...b,board:{...b.board,descField:a}})})]})]})}let C=[{id:"table",icon:(0,d.jsx)(g.A,{size:13}),label:"Table"},{id:"gallery",icon:(0,d.jsx)(h.A,{size:13}),label:"Gallery"},{id:"board",icon:(0,d.jsx)(i.A,{size:13}),label:"Board"}];function D({filePath:a,content:b,saveAction:c}){let{headers:f,rows:g}=(0,e.useMemo)(()=>{let a;return{headers:(a=l().parse(b,{skipEmptyLines:!0}).data)[0]??[],rows:a.slice(1)}},[b]),h=(0,e.useMemo)(()=>({activeView:"table",table:{sortField:"",sortDir:"asc",groupField:"",hiddenFields:[]},gallery:{titleField:f[0]??"",descField:f[1]??"",tagField:f[2]??""},board:{groupField:f[f.length-1]??"",titleField:f[0]??"",descField:f[1]??""}}),[f]),[i,k]=(0,p.Un)("csv",a,h),[m,n]=(0,e.useState)(!1),o=(0,e.useCallback)(a=>{k(a)},[k]),q=i.activeView;return(0,d.jsxs)("div",{className:"max-w-[1100px] mx-auto px-0 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4 relative",children:[(0,d.jsx)("div",{className:"flex items-center gap-0.5 p-1 rounded-lg",style:{background:"var(--muted)"},children:C.map(a=>(0,d.jsxs)("button",{onClick:()=>o({...i,activeView:a.id}),className:"flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors font-display",style:{background:q===a.id?"var(--card)":"transparent",color:q===a.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:q===a.id?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:[a.icon,a.label]},a.id))}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)",opacity:.5},children:[g.length," rows"]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{onClick:()=>n(a=>!a),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors",style:{background:m?"var(--accent)":"var(--muted)",color:m?"var(--foreground)":"var(--muted-foreground)"},title:"View settings",children:(0,d.jsx)(j.A,{size:13})}),m&&(0,d.jsx)(B,{headers:f,cfg:i,view:q,onClose:()=>n(!1),onChange:o})]})]}),"table"===q&&(0,d.jsx)(w,{headers:f,rows:g,cfg:i.table,saveAction:c}),"gallery"===q&&(0,d.jsx)(x,{headers:f,rows:g,cfg:i.gallery}),"board"===q&&(0,d.jsx)(y,{headers:f,rows:g,cfg:i.board,saveAction:c})]})}},46633:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>E});var e=c(48249),f=c(67484),g=c(6079),h=c(87148),i=c(95581),j=c(36041),k=c(69924),l=c(84248),m=c(59347),n=c(8455),o=c(40560),p=c(89165),q=c(49681),r=c(46674),s=c(39703),t=c(19099),u=c(30315),v=c(95054),w=c(99788),x=c(29272),y=c(23343),z=c(29185),A=c(51272),B=c(14039),C=c(89872),D=a([w]);function E({visible:a,initialTab:b,variant:c,onClose:d}){let[D,E]=(0,f.useState)("ai"),[F,G]=(0,f.useState)(null),[H,I]=(0,f.useState)(!1),[J,K]=(0,f.useState)("idle"),{t:L,locale:M,setLocale:N}=(0,u.Y)(),O=(0,t.useRouter)();(0,f.useRef)(void 0),(0,f.useRef)(!1);let P=(0,f.useRef)(null),[Q,R]=(0,f.useState)("lora"),[S,T]=(0,f.useState)("15px"),[U,V]=(0,f.useState)("780px"),[W,X]=(0,f.useState)(!0),[Y,Z]=(0,f.useState)(()=>!1),$="panel"===c;(0,f.useRef)(!1);let _=(0,f.useCallback)(a=>{E(a),P.current?.scrollTo?.(0,0)},[]);(0,f.useCallback)(async a=>{I(!0);try{await (0,v.n)("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ai:a.ai,agent:a.agent,mindRoot:a.mindRoot,webPassword:a.webPassword,authToken:a.authToken})}),K("saved"),window.dispatchEvent(new Event("mindos:settings-changed")),setTimeout(()=>K("idle"),2500)}catch{K("error"),setTimeout(()=>K("idle"),2500)}finally{I(!1)}},[]);let aa=(0,f.useCallback)(a=>{G(b=>b?{...b,ai:{...b.ai,...a}}:b)},[]),ab=(0,f.useCallback)(a=>{G(b=>b?{...b,agent:{...b.agent??{},...a}}:b)},[]),ac=(0,f.useCallback)(async()=>{if(!F)return;let a={provider:"anthropic",providers:{anthropic:{apiKey:"",model:"claude-sonnet-4-6"},openai:{apiKey:"",model:"gpt-5.4",baseUrl:""}}};G(b=>b?{...b,ai:a}:b),setTimeout(()=>{(0,v.n)("/api/settings").then(a=>{G(a)}).catch(()=>K("error"))},1300)},[F]),ad=F?.envOverrides??{},ae=$?12:13,af=[{id:"ai",label:L.settings.tabs.ai,icon:(0,e.jsx)(g.A,{size:ae})},{id:"mcp",label:L.settings.tabs.mcp??"Connections",icon:(0,e.jsx)(h.A,{size:ae})},{id:"knowledge",label:L.settings.tabs.knowledge,icon:(0,e.jsx)(i.A,{size:ae})},{id:"appearance",label:L.settings.tabs.appearance,icon:(0,e.jsx)(j.A,{size:ae})},{id:"sync",label:L.settings.tabs.sync??"Sync",icon:(0,e.jsx)(k.A,{size:ae})},{id:"update",label:L.settings.tabs.update??"Update",icon:(0,e.jsx)(l.A,{size:ae}),badge:Y},{id:"uninstall",label:L.settings.tabs.uninstall??"Uninstall",icon:(0,e.jsx)(m.A,{size:ae})}],ag=af.find(a=>a.id===D)?.label??"",ah=()=>(0,e.jsx)("div",{ref:P,className:`flex-1 overflow-y-auto min-h-0 ${$?"px-4 py-4 space-y-4":"px-5 py-5 space-y-5"}`,children:"load-error"===J&&("ai"===D||"knowledge"===D)?(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2 py-8 text-center",children:[(0,e.jsx)(n.A,{size:$?18:20,className:"text-destructive"}),(0,e.jsx)("p",{className:`${$?"text-xs":"text-sm"} text-destructive font-medium`,children:"Failed to load settings"}),!$&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Check that the server is running and AUTH_TOKEN is configured correctly."})]}):F||"appearance"===D||"mcp"===D||"sync"===D||"update"===D||"uninstall"===D?(0,e.jsxs)(e.Fragment,{children:["ai"===D&&F?.ai&&(0,e.jsx)(w.S,{data:F,updateAi:aa,updateAgent:ab,t:L}),"appearance"===D&&(0,e.jsx)(x.G,{font:Q,setFont:R,fontSize:S,setFontSize:T,contentWidth:U,setContentWidth:V,dark:W,setDark:X,locale:M,setLocale:N,t:L}),"knowledge"===D&&F&&(0,e.jsx)(y.M,{data:F,setData:G,t:L}),"sync"===D&&(0,e.jsx)(z.v,{t:L}),"mcp"===D&&(0,e.jsx)(A.w,{t:L}),"update"===D&&(0,e.jsx)(B.P,{}),"uninstall"===D&&(0,e.jsx)(C.Q,{})]}):(0,e.jsx)("div",{className:"flex justify-center py-8",children:(0,e.jsx)(o.A,{size:$?16:18,className:"animate-spin text-muted-foreground"})})}),ai=()=>"ai"===D||"knowledge"===D?(0,e.jsxs)("div",{className:`${$?"px-4 py-2":"px-5 py-2.5"} border-t border-border shrink-0 flex items-center justify-between`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:["ai"===D&&Object.values(ad).some(Boolean)&&(0,e.jsxs)("button",{onClick:ac,disabled:H||!F,className:`flex items-center gap-1.5 ${$?"px-2.5 py-1 text-xs rounded-md":"px-3 py-1.5 text-sm rounded-lg"} border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[(0,e.jsx)(p.A,{size:$?12:13}),L.settings.ai.restoreFromEnv]}),"knowledge"===D&&(0,e.jsxs)("a",{href:"/setup?force=1",className:`flex items-center gap-1.5 ${$?"px-2.5 py-1 text-xs rounded-md":"px-3 py-1.5 text-sm rounded-lg"} border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors`,children:[(0,e.jsx)(p.A,{size:$?12:13}),L.settings.reconfigure]})]}),!$&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-xs",role:"status","aria-live":"polite",children:[H&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.A,{size:12,className:"animate-spin text-muted-foreground"}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[L.settings.save,"..."]})]}),"saved"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(q.A,{size:12,className:"text-success"}),(0,e.jsx)("span",{className:"text-success",children:L.settings.saved})]}),"error"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.A,{size:12,className:"text-destructive"}),(0,e.jsx)("span",{className:"text-destructive",children:L.settings.saveFailed})]})]})]}):null;return $?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)(i.A,{size:14,className:"text-muted-foreground"}),(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider font-display",children:"Settings"})]}),(0,e.jsx)("div",{className:"flex items-center gap-1.5",children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px]",role:"status","aria-live":"polite",children:[H&&(0,e.jsx)(o.A,{size:10,className:"animate-spin text-muted-foreground"}),"saved"===J&&(0,e.jsx)(q.A,{size:10,className:"text-success"}),"error"===J&&(0,e.jsx)(n.A,{size:10,className:"text-destructive"})]})})]}),(0,e.jsx)("div",{className:"flex border-b border-border px-3 shrink-0 overflow-x-auto scrollbar-none gap-0",children:af.map(a=>(0,e.jsxs)("button",{onClick:()=>_(a.id),className:`flex items-center gap-1 px-2 py-2 text-xs font-medium transition-colors border-b-2 -mb-px whitespace-nowrap ${D===a.id?"border-[var(--amber)] text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.icon,a.label,a.badge&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-error shrink-0"})]},a.id))}),ah(),ai()]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex flex-col h-full md:hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[(0,e.jsx)("div",{className:"flex justify-center pt-2 pb-0 absolute top-0 left-1/2 -translate-x-1/2",children:(0,e.jsx)("div",{className:"w-8 h-1 rounded-full bg-muted-foreground/20"})}),(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)(i.A,{size:15,className:"text-muted-foreground"}),(0,e.jsx)("span",{className:"font-display",children:L.settings.title})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px]",role:"status","aria-live":"polite",children:[H&&(0,e.jsx)(o.A,{size:12,className:"animate-spin text-muted-foreground"}),"saved"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(q.A,{size:12,className:"text-success"}),(0,e.jsx)("span",{className:"text-success",children:L.settings.saved})]}),"error"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.A,{size:12,className:"text-destructive"}),(0,e.jsx)("span",{className:"text-destructive",children:L.settings.saveFailed})]})]}),d&&(0,e.jsx)("button",{onClick:d,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(r.A,{size:15})})]})]}),(0,e.jsxs)("div",{className:"flex border-b border-border px-4 shrink-0 overflow-x-auto scrollbar-none gap-0",children:[af.map(a=>(0,e.jsxs)("button",{onClick:()=>_(a.id),className:`flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2 -mb-px whitespace-nowrap ${D===a.id?"border-[var(--amber)] text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.icon,a.label,a.badge&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-error shrink-0"})]},a.id)),(0,e.jsxs)("button",{onClick:()=>{d?.(),O.push("/help")},className:"flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2 -mb-px whitespace-nowrap border-transparent text-muted-foreground hover:text-foreground",children:[(0,e.jsx)(s.A,{size:ae}),L.sidebar.help]})]}),ah(),ai()]}),(0,e.jsxs)("div",{className:"hidden md:flex flex-row h-full min-h-0",children:[(0,e.jsxs)("div",{className:"w-[180px] shrink-0 border-r border-border flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[(0,e.jsx)(i.A,{size:15,className:"text-muted-foreground"}),(0,e.jsx)("span",{className:"text-sm font-medium font-display text-foreground",children:L.settings.title})]}),(0,e.jsx)("nav",{className:"flex-1 overflow-y-auto py-1.5",children:af.map(a=>(0,e.jsxs)("button",{onClick:()=>_(a.id),className:`flex items-center gap-2 w-full px-4 py-2 text-sm font-medium transition-colors relative ${D===a.id?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[D===a.id&&(0,e.jsx)("div",{className:"absolute left-0 top-1 bottom-1 w-[3px] rounded-r-full bg-[var(--amber)]"}),a.icon,a.label,a.badge&&(0,e.jsx)("span",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-error shrink-0"})]},a.id))}),(0,e.jsx)("div",{className:"shrink-0 border-t border-border px-4 py-2",children:(0,e.jsxs)("button",{onClick:()=>{d?.(),O.push("/help")},className:"flex items-center gap-2 w-full px-0 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,e.jsx)(s.A,{size:13}),L.sidebar.help]})})]}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground font-display",children:ag}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px]",role:"status","aria-live":"polite",children:[H&&(0,e.jsx)(o.A,{size:12,className:"animate-spin text-muted-foreground"}),"saved"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(q.A,{size:12,className:"text-success"}),(0,e.jsx)("span",{className:"text-success",children:L.settings.saved})]}),"error"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.A,{size:12,className:"text-destructive"}),(0,e.jsx)("span",{className:"text-destructive",children:L.settings.saveFailed})]})]}),d&&(0,e.jsx)("button",{onClick:d,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(r.A,{size:15})})]})]}),ah(),ai()]})]})]})}w=(D.then?(await D)():D)[0],d()}catch(a){d(a)}})},49905:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{default:()=>i});var e=c(48249),f=c(19099),g=c(89119),h=a([g]);function i({fileTree:a,children:b}){let c=(0,f.usePathname)();return"/login"===c?(0,e.jsx)(e.Fragment,{children:b}):(0,e.jsx)(g.A,{fileTree:a,children:b})}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},51272:(a,b,c)=>{"use strict";c.d(b,{w:()=>U});var d=c(48249),e=c(67484),f=c(40560),g=c(6079),h=c(8505),i=c(41479),j=c(61075),k=c(11035),l=c(76592),m=c(87148),n=c(56884),o=c(49681),p=c(68762),q=c(41023),r=c(15273),s=c(8455),t=c(44218),u=c(19794),v=c(89165),w=c(69924),x=c(42742),y=c(99101),z=c(18329),A=c(60725),B=c(39868),C=c(95054),D=c(27608);function E({agents:a,t:b,onRefresh:c,mode:g="mcp",activeSkillName:h="mindos"}){let i=b.settings?.mcp,[j,k]=(0,e.useState)(new Set),[l,m]=(0,e.useState)("auto"),[n,p]=(0,e.useState)("http://localhost:8781/mcp"),[q,r]=(0,e.useState)(""),[t,u]=(0,e.useState)({}),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),z=async()=>{if(0!==j.size){w(!0),y(null);try{let b={agents:[...j].map(b=>{let c=a.find(a=>a.key===b),d="auto"===l?c?.preferredTransport||"stdio":l;return{key:b,scope:t[b]||(c?.hasProjectScope?"project":"global"),transport:d}}),transport:l,..."http"===l?{url:n,token:q}:{},..."auto"===l?{url:n,token:q}:{}},d=await (0,C.n)("/api/mcp/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=d.results.filter(a=>"ok"===a.status).length,f=d.results.filter(a=>"error"===a.status);f.length>0?y({type:"error",text:f.map(a=>`${a.agent}: ${a.message}`).join("; ")}):y({type:"success",text:i?.installSuccess?i.installSuccess(e):`${e} agent(s) configured`}),k(new Set),c()}catch{y({type:"error",text:i?.installFailed??"Install failed"})}finally{w(!1),setTimeout(()=>y(null),4e3)}}},A="http"===l||"auto"===l&&[...j].some(b=>{let c=a.find(a=>a.key===b);return c?.preferredTransport==="http"});return"cli"===g?(0,d.jsx)(F,{agents:a,m:i,activeSkillName:h}):(0,d.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:i?.mcpInstallDesc??"Install MCP config + Skill to detected agents on this machine."}),(0,d.jsx)("div",{className:"space-y-1",children:a.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-3 py-1.5 text-sm",children:[(0,d.jsx)("input",{type:"checkbox",checked:j.has(a.key),onChange:()=>{var b;return b=a.key,void k(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"form-check"}),(0,d.jsx)("span",{className:"w-28 shrink-0 text-xs",children:a.name}),(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded font-mono bg-muted",children:"auto"===l?a.preferredTransport:l}),a.installed?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-success/15 text-success font-mono",children:a.transport}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground",children:a.scope})]}):(0,d.jsx)("span",{className:"text-2xs text-muted-foreground",children:a.present?i?.detected??"Detected":i?.notFound??"Not found"}),j.has(a.key)&&a.hasProjectScope&&a.hasGlobalScope&&(0,d.jsx)(D.A,{value:t[a.key]||"project",onChange:b=>u({...t,[a.key]:b}),size:"sm",className:"ml-auto",options:[{value:"project",label:i?.project??"Project"},{value:"global",label:i?.global??"Global"}]})]},a.key))}),(0,d.jsxs)("div",{className:"flex gap-2 text-xs pt-1",children:[(0,d.jsx)("button",{type:"button",onClick:()=>k(new Set(a.filter(a=>!a.installed&&a.present).map(a=>a.key))),className:"px-2.5 py-1 rounded-md border border-[var(--amber)] text-[var(--amber)] transition-colors hover:bg-muted/50",children:i?.selectDetected??"Select Detected"}),(0,d.jsx)("button",{type:"button",onClick:()=>k(new Set),className:"px-2.5 py-1 rounded-md border border-border text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:i?.clearSelection??"Clear"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-4 text-xs pt-1",children:[(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"radio",name:"transport",checked:"auto"===l,onChange:()=>m("auto"),className:"form-radio"}),i?.transportAuto??"auto (recommended)"]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"radio",name:"transport",checked:"stdio"===l,onChange:()=>m("stdio"),className:"form-radio"}),i?.transportStdio??"stdio"]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"radio",name:"transport",checked:"http"===l,onChange:()=>m("http"),className:"form-radio"}),i?.transportHttp??"http"]})]}),A&&(0,d.jsxs)("div",{className:"space-y-2 pl-5 text-xs",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("label",{className:"text-muted-foreground",children:i?.httpUrl??"MCP URL"}),(0,d.jsx)("input",{type:"text",value:n,onChange:a=>p(a.target.value),className:"w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-background font-mono text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring"})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("label",{className:"text-muted-foreground",children:i?.httpToken??"Auth Token"}),(0,d.jsx)("input",{type:"password",value:q,onChange:a=>r(a.target.value),placeholder:"Bearer token",className:"w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-background font-mono text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring"})]})]}),(0,d.jsxs)("button",{onClick:z,disabled:0===j.size||v,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed bg-[var(--amber)] text-[var(--amber-foreground)]",children:[v&&(0,d.jsx)(f.A,{size:12,className:"animate-spin"}),v?i?.installing??"Installing...":i?.installSelected??"Install Selected"]}),x&&(0,d.jsx)("div",{className:"flex items-center gap-1.5 text-xs",role:"status",children:"success"===x.type?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(o.A,{size:12,className:"text-success"}),(0,d.jsx)("span",{className:"text-success",children:x.text})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.A,{size:12,className:"text-destructive"}),(0,d.jsx)("span",{className:"text-destructive",children:x.text})]})})]})}function F({agents:a,m:b,activeSkillName:c}){let[f,g]=(0,e.useState)(a[0]?.key??"claude-code"),h=a.find(a=>a.key===f),i=`npx skills add GeminiLight/MindOS --skill ${c} -a ${f} -g -y`,j=async()=>{await (0,B.l)(i)&&y.oR.copy()},k=a.filter(a=>a.present&&a.installed),l=a.filter(a=>a.present&&!a.installed),m=a.filter(a=>!a.present);return(0,d.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:b?.cliInstallDesc??"Install the MindOS Skill to your agent so it can operate your knowledge base."}),(0,d.jsx)(D.A,{value:f,onChange:g,size:"sm",options:[...k.length>0?[{label:b?.connectedGroup??"Connected",options:k.map(a=>({value:a.key,label:a.name}))}]:[],...l.length>0?[{label:b?.detectedGroup??"Detected",options:l.map(a=>({value:a.key,label:a.name}))}]:[],...m.length>0?[{label:b?.notFoundGroup??"Not Installed",options:m.map(a=>({value:a.key,label:a.name}))}]:[]]}),h&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-2xs",children:[h.present&&h.installed?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full font-medium bg-success/10 text-success",children:[(0,d.jsx)(o.A,{size:10})," ",b?.tagConnected??"Connected"]}):h.present?(0,d.jsx)("span",{className:"text-muted-foreground",children:b?.detected??"Detected"}):(0,d.jsx)("span",{className:"text-muted-foreground",children:b?.notFound??"Not found"}),null!=h.installedSkillCount&&h.installedSkillCount>0&&(0,d.jsxs)("span",{className:"text-muted-foreground",children:[h.installedSkillCount," ",b?.skillsInstalled??"skills installed"]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("code",{className:"flex-1 text-[10px] font-mono bg-muted/50 border border-border rounded-lg px-2.5 py-2 text-muted-foreground select-all overflow-x-auto whitespace-nowrap",children:i}),(0,d.jsx)("button",{onClick:j,className:"p-1.5 rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0",children:(0,d.jsx)(r.A,{size:11})})]})]})}var G=c(10316),H=c(46674),I=c(24520),J=c(57056),K=c(12625),L=c(59347),M=c(81285);let N=(0,c(90314).default)(async()=>{},{loadableGenerated:{modules:["components/settings/McpSkillRow.tsx -> @/components/MarkdownView"]},ssr:!1});function O({skill:a,expanded:b,onExpand:c,onToggle:e,onDelete:g,onEditStart:h,onEditSave:i,onEditCancel:j,editing:k,editContent:l,setEditContent:m,editError:n,saving:o,fullContent:p,loadingContent:q,loadErrors:r,m:v}){return(0,d.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>c(a.name),children:[b?(0,d.jsx)(t.A,{size:12}):(0,d.jsx)(u.A,{size:12}),(0,d.jsx)("span",{className:"text-xs font-medium flex-1",children:a.name}),(0,d.jsx)("span",{className:`text-2xs px-1.5 py-0.5 rounded ${"builtin"===a.source?"bg-muted text-muted-foreground":"bg-[var(--amber-subtle)] text-[var(--amber-text)]"}`,children:"builtin"===a.source?v?.skillBuiltin??"Built-in":v?.skillUser??"Custom"}),(0,d.jsx)(M.lM,{size:"sm",checked:a.enabled,onClick:b=>{b.stopPropagation(),e(a.name,!a.enabled)}})]}),b&&(0,d.jsxs)("div",{className:"px-3 py-2 border-t border-border text-xs space-y-2 bg-muted/20",children:[(0,d.jsx)("p",{className:"text-muted-foreground",children:a.description||"No description"}),(0,d.jsx)("p",{className:"text-muted-foreground font-mono text-2xs",children:a.path}),q===a.name?(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[(0,d.jsx)(f.A,{size:10,className:"animate-spin"}),(0,d.jsx)("span",{className:"text-2xs",children:"Loading..."})]}):p[a.name]?(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-2xs text-muted-foreground font-medium",children:v?.skillContent??"Content"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a.editable&&k!==a.name&&(0,d.jsxs)("button",{onClick:()=>h(a.name),className:"flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,d.jsx)(K.A,{size:10}),v?.editSkill??"Edit"]}),a.editable&&(0,d.jsxs)("button",{onClick:()=>g(a.name),className:"flex items-center gap-1 text-2xs text-destructive hover:underline",children:[(0,d.jsx)(L.A,{size:10}),v?.deleteSkill??"Delete"]})]})]}),k===a.name?(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("textarea",{value:l,onChange:a=>m(a.target.value),rows:Math.min(20,(l.match(/\n/g)||[]).length+3),className:"w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring resize-y font-mono"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("button",{onClick:()=>i(a.name),disabled:o,className:"flex items-center gap-1 px-2.5 py-1 text-xs rounded-md disabled:opacity-40 disabled:cursor-not-allowed transition-colors bg-[var(--amber)] text-[var(--amber-foreground)]",children:[o&&(0,d.jsx)(f.A,{size:10,className:"animate-spin"}),v?.saveSkill??"Save"]}),(0,d.jsx)("button",{onClick:j,className:"px-2.5 py-1 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground transition-colors",children:v?.cancelSkill??"Cancel"})]}),n&&(0,d.jsxs)("p",{className:"text-2xs text-destructive flex items-center gap-1",children:[(0,d.jsx)(s.A,{size:10}),n]})]}):(0,d.jsx)("div",{className:"w-full rounded-md border border-border bg-background/50 max-h-[300px] overflow-y-auto px-2.5 py-1.5 text-xs [&_.prose]:max-w-none [&_.prose]:text-xs [&_h1]:text-sm [&_h2]:text-xs [&_h3]:text-xs [&_pre]:text-2xs [&_code]:text-2xs",children:(0,d.jsx)(N,{content:function(a){if(!a.startsWith("---"))return a;let b=a.indexOf("\n---",3);return -1===b?a:a.slice(b+4).replace(/^\n+/,"")}(p[a.name])})})]}):r[a.name]?(0,d.jsxs)("p",{className:"text-2xs text-destructive flex items-center gap-1",children:[(0,d.jsx)(s.A,{size:10}),r[a.name]]}):null]})]})}let P=a=>`---
105
+ ${b}`:`[PDF: ${a.name}] Could not extract readable text (possibly scanned/image PDF).`}}catch{return{name:a.name,content:`[PDF: ${a.name}] Failed to extract text from this PDF.`}}return{name:a.name,content:await a.text()}}));b(a=>{let b=[...a];for(let a of j)b.some(b=>b.name===a.name&&b.content===a.content)||b.push(a);return b})},[]),k=(0,d.useCallback)(a=>{b(b=>b.filter((b,c)=>c!==a))},[]);return{localAttachments:a,uploadError:c,uploadInputRef:i,pickFiles:j,removeAttachment:k,clearAttachments:(0,d.useCallback)(()=>{b([]),h("")},[]),injectFiles:(0,d.useCallback)(a=>{b(b=>{let c=[...b];for(let b of a)c.some(a=>a.name===b.name)||c.push(b);return c})},[])}}},41739:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(6079),g=c(96286),h=c(35389),i=c(45231),j=c(13481),k=c(92343),l=c(50514),m=c(46674),n=c(30315);let o=(0,e.memo)(function({isPanel:a,showHistory:b,onToggleHistory:c,onReset:e,isLoading:o,maximized:p,onMaximize:q,askMode:r,onModeSwitch:s,onClose:t}){let{t:u}=(0,n.Y)(),v=a?13:14;return(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[!a&&(0,d.jsx)("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-8 h-1 rounded-full bg-muted-foreground/20 md:hidden"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,d.jsx)(f.A,{size:a?14:15,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:a?"font-display text-xs uppercase tracking-wider text-muted-foreground":"font-display",children:a?"MindOS Agent":u.ask.title})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),c()},"aria-pressed":b,className:`p-2 rounded transition-colors ${b?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:u.hints.sessionHistory,children:(0,d.jsx)(g.A,{size:v})}),(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e()},disabled:o,className:"p-2 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",title:u.hints.newSession,children:(0,d.jsx)(h.A,{size:v})}),a&&q&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),q()},className:"p-2 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:p?u.hints.restorePanel:u.hints.maximizePanel,children:p?(0,d.jsx)(i.A,{size:v}):(0,d.jsx)(j.A,{size:v})}),s&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),s()},className:"p-2 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"popup"===r?u.hints.dockToSide:u.hints.openAsPopup,children:"popup"===r?(0,d.jsx)(k.A,{size:v}):(0,d.jsx)(l.A,{size:v})}),t&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),t()},className:"p-2 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:u.hints.closePanel,"aria-label":"Close",children:(0,d.jsx)(m.A,{size:a?v:15})})]})]})})},43248:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(48249);function e({error:a,reset:b}){return(0,d.jsx)("html",{lang:"en",children:(0,d.jsx)("body",{style:{margin:0,fontFamily:"system-ui, sans-serif",background:"#0f0f0f",color:"#e5e5e5"},children:(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",gap:"16px",padding:"24px",textAlign:"center"},children:[(0,d.jsx)("h2",{style:{fontSize:"18px",fontWeight:600,margin:0},children:"Something went wrong"}),(0,d.jsx)("p",{style:{fontSize:"14px",color:"#888",maxWidth:"400px",margin:0},children:a.message||"An unexpected error occurred. Please try again."}),(0,d.jsxs)("div",{style:{display:"flex",gap:"12px",marginTop:"8px"},children:[(0,d.jsx)("button",{onClick:b,style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,background:"#222",color:"#e5e5e5",border:"1px solid #333",cursor:"pointer"},children:"Try again"}),(0,d.jsx)("a",{href:"/setup",style:{padding:"8px 16px",borderRadius:"6px",fontSize:"14px",fontWeight:500,background:"#c8873a",color:"#fff",textDecoration:"none",cursor:"pointer"},children:"Go to Setup"})]})]})})})}},44791:(a,b,c)=>{"use strict";c.d(b,{i:()=>e});var d=c(99829);let e=(0,d.createServerReference)("405a54a7c8d6011ad85002a50be12c1fb8f3aa2419",d.callServer,void 0,d.findSourceMapURL,"deleteFileAction")},45108:(a,b,c)=>{"use strict";c.d(b,{u:()=>h});var d=c(67484);let e=new Set(["image/png","image/jpeg","image/gif","image/webp"]);async function f(a){let b=a.type;if(a.size<=5242880){let c=new Uint8Array(await a.arrayBuffer()),d="";for(let a=0;a<c.length;a+=32768)d+=String.fromCharCode(...c.subarray(a,a+32768));return{data:btoa(d),mimeType:b}}return new Promise((b,c)=>{let d=new Image;d.onload=()=>{let{width:a,height:e}=d;if(a>1920||e>1920){let b=Math.min(1920/a,1920/e);a=Math.round(a*b),e=Math.round(e*b)}let f=document.createElement("canvas");f.width=a,f.height=e;let g=f.getContext("2d");g?(g.drawImage(d,0,0,a,e),b({data:f.toDataURL("image/jpeg",.85).split(",")[1],mimeType:"image/jpeg"}),URL.revokeObjectURL(d.src)):c(Error("Canvas not supported"))},d.onerror=()=>{c(Error("Failed to load image")),URL.revokeObjectURL(d.src)},d.src=URL.createObjectURL(a)})}function g(a){let b=[];for(let c of Array.from(a))if("file"===c.kind&&e.has(c.type)){let a=c.getAsFile();a&&b.push(a)}return b}function h(){let[a,b]=(0,d.useState)([]),[c,h]=(0,d.useState)(""),i=(0,d.useCallback)(async a=>{h("");let c=a.slice(0,4),d=[];for(let a of c){var g;if(g=a.type,!e.has(g)){h(`Unsupported image type: ${a.type}`);continue}try{let{data:b,mimeType:c}=await f(a);d.push({type:"image",data:b,mimeType:c})}catch{h(`Failed to process image: ${a.name}`)}}b(a=>{let b=[...a,...d];return b.length>4?(h("Maximum 4 images allowed"),b.slice(0,4)):b})},[]),j=(0,d.useCallback)(async a=>{let b=a.clipboardData?.items;if(!b)return!1;let c=g(b);return 0!==c.length&&(await i(c),!0)},[i]),k=(0,d.useCallback)(async a=>{let b=a.dataTransfer?.items;if(!b)return;let c=g(b);c.length>0&&(a.preventDefault(),await i(c))},[i]),l=(0,d.useCallback)(async a=>{if(!a)return;let b=Array.from(a).filter(a=>{var b;return b=a.type,e.has(b)});await i(b)},[i]);return{images:a,imageError:c,addImages:i,handlePaste:j,handleDrop:k,handleFileSelect:l,removeImage:(0,d.useCallback)(a=>{b(b=>b.filter((b,c)=>c!==a))},[]),clearImages:(0,d.useCallback)(()=>{b([]),h("")},[])}}},45862:(a,b,c)=>{"use strict";c.r(b),c.d(b,{SummaryRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SummaryRenderer() from the server but SummaryRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/summary/SummaryRenderer.tsx","SummaryRenderer")},46427:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>D});var d=c(48249),e=c(67484),f=c.n(e),g=c(93053),h=c(75155),i=c(22242),j=c(91282),k=c(65732),l=c.n(k);function m(a,b){return l().unparse([a,...b])}let n=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"#8ab4d8"},{bg:"rgba(200,160,216,0.12)",text:"#c8a0d8"},{bg:"rgba(200,96,96,0.12)",text:"#c86060"},{bg:"rgba(150,150,150,0.12)",text:"var(--muted-foreground)"}];function o(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)&65535;return n[b%n.length]}var p=c(82884),q=c(72419),r=c(44218),s=c(59347),t=c(24520);function u({value:a,onCommit:b}){let[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(a),i=(0,e.useRef)(null);function j(){f(!1),g!==a?b(g):h(a)}return c?(0,d.jsx)("input",{ref:i,value:g,onChange:a=>h(a.target.value),onBlur:j,onKeyDown:b=>{"Enter"===b.key&&j(),"Escape"===b.key&&(h(a),f(!1))},className:"w-full bg-transparent outline-none text-sm",onClick:a=>a.stopPropagation(),style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)",minWidth:60}}):(0,d.jsx)("div",{className:"truncate text-sm cursor-text",style:{color:"var(--foreground)",minWidth:60},onClick:()=>f(!0),title:a,children:a||(0,d.jsx)("span",{style:{color:"var(--muted-foreground)",opacity:.3},children:"—"})})}function v({headers:a,visibleIndices:b,onAdd:c,onCancel:f}){let[g,h]=(0,e.useState)(()=>Array(a.length).fill(""));return(0,d.jsxs)("tr",{style:{background:"color-mix(in srgb, var(--amber) 6%, transparent)",borderTop:"1px solid var(--amber)"},children:[b.map((b,e)=>(0,d.jsx)("td",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)("input",{autoFocus:0===e,value:g[b],onChange:a=>{var c;return c=a.target.value,void h(a=>{let d=[...a];return d[b]=c,d})},onKeyDown:a=>{"Enter"===a.key&&c(g),"Escape"===a.key&&f()},placeholder:a[b],className:"w-full bg-transparent outline-none text-sm placeholder:opacity-30",style:{color:"var(--foreground)",borderBottom:"1px solid var(--border)"}})},b)),(0,d.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"}})]})}function w({headers:a,rows:b,cfg:c,saveAction:g}){let[h,i]=(0,e.useState)(b),[j,k]=(0,e.useState)(!1),l=(0,e.useMemo)(()=>a.map((a,b)=>b).filter(b=>!c.hiddenFields.includes(a[b])),[a,c.hiddenFields]),n=a.indexOf(c.sortField),o=(0,e.useMemo)(()=>{let a=[...h];return n>=0&&a.sort((a,b)=>{let d=a[n]??"",e=b[n]??"",f=parseFloat(d),g=parseFloat(e),h=isNaN(f)||isNaN(g)?d.localeCompare(e):f-g;return"asc"===c.sortDir?h:-h}),a},[h,n,c.sortDir]),p=a.indexOf(c.groupField),w=(0,e.useMemo)(()=>{if(p<0)return[{key:null,rows:o.map(a=>({row:a,orig:a}))}];let a=new Map;for(let b of o){let c=b[p]||"(empty)";a.has(c)||a.set(c,[]),a.get(c).push(b)}return[...a.entries()].map(([a,b])=>({key:a,rows:b.map(a=>({row:a,orig:a}))}))},[o,p]);async function x(b,c,d){let e=h.map(a=>a===b?a.map((a,b)=>b===c?d:a):a);i(e),await g(m(a,e))}async function y(b){let c=h.filter(a=>a!==b);i(c),await g(m(a,c))}async function z(b){let c=[...h,b];i(c),k(!1),await g(m(a,c))}let A={borderBottom:"1px solid var(--border)",fontSize:"0.72rem",letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted-foreground)",fontWeight:600},B=0;return(0,d.jsxs)("div",{className:"rounded-xl overflow-hidden border",style:{borderColor:"var(--border)"},children:[(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"min-w-full text-sm border-collapse",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{style:{background:"var(--muted)"},children:[l.map(b=>(0,d.jsx)("th",{className:"px-4 py-2.5 text-left whitespace-nowrap",style:A,children:(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[a[b],c.sortField===a[b]&&("asc"===c.sortDir?(0,d.jsx)(q.A,{size:10,style:{color:"var(--amber)"}}):(0,d.jsx)(r.A,{size:10,style:{color:"var(--amber)"}}))]})},b)),(0,d.jsx)("th",{className:"w-8",style:{...A,background:"var(--muted)"}})]})}),(0,d.jsxs)("tbody",{children:[w.map((a,b)=>(0,d.jsxs)(f().Fragment,{children:[null!==a.key&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:l.length+1,className:"px-4 py-1.5",style:{background:"var(--accent)",borderBottom:"1px solid var(--border)",borderTop:"1px solid var(--border)"},children:(0,d.jsxs)("span",{className:"text-xs font-semibold font-display",style:{color:"var(--muted-foreground)"},children:[a.key," \xb7 ",a.rows.length]})})},`grp-${a.key}`),a.rows.map(({row:a,orig:b})=>{let c=B++;return(0,d.jsxs)("tr",{className:"group transition-colors",style:{background:c%2==0?"var(--background)":"var(--card)"},onMouseEnter:a=>a.currentTarget.style.background="var(--muted)",onMouseLeave:a=>a.currentTarget.style.background=c%2==0?"var(--background)":"var(--card)",children:[l.map(c=>(0,d.jsx)("td",{className:"px-4 py-2 max-w-xs",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)(u,{value:a[c]??"",onCommit:a=>x(b,c,a)})},c)),(0,d.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,d.jsx)("button",{onClick:()=>y(b),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},children:(0,d.jsx)(s.A,{size:12})})})]},c)})]},a.key??`section-${b}`)),j&&(0,d.jsx)(v,{headers:a,visibleIndices:l,onAdd:z,onCancel:()=>k(!1)})]})]})}),(0,d.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between",style:{background:"var(--muted)",borderTop:"1px solid var(--border)"},children:[(0,d.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)"},children:[h.length," rows \xb7 ",a.length," cols"]}),j?(0,d.jsx)("button",{onClick:()=>k(!1),className:"text-xs px-2.5 py-1 rounded-md",style:{color:"var(--muted-foreground)"},children:"Cancel"}):(0,d.jsxs)("button",{onClick:()=>k(!0),className:"flex items-center gap-1 text-xs px-2.5 py-1 rounded-md",style:{color:"var(--amber)",background:"var(--amber-dim)"},children:[(0,d.jsx)(t.A,{size:12})," Add row"]})]})]})}function x({headers:a,rows:b,cfg:c}){let e=a.indexOf(c.titleField),f=a.indexOf(c.descField),g=a.indexOf(c.tagField);return(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:b.map((b,c)=>{let h=e>=0?b[e]:b[0]??"",i=f>=0?b[f]:"",j=g>=0?b[g]:"",k=j?o(j):null;return(0,d.jsxs)("div",{className:"rounded-xl border p-4 flex flex-col gap-2 hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[j&&k&&(0,d.jsx)("span",{className:"self-start text-xs px-2 py-0.5 rounded-full font-medium",style:{background:k.bg,color:k.text},children:j}),(0,d.jsx)("p",{className:"text-sm font-semibold leading-snug",style:{color:"var(--foreground)"},children:h}),i&&(0,d.jsx)("p",{className:"text-xs leading-relaxed line-clamp-3",style:{color:"var(--muted-foreground)"},children:i}),(0,d.jsx)("div",{className:"mt-1 flex flex-col gap-0.5",children:a.map((a,c)=>{if(c===e||c===f||c===g)return null;let h=b[c];return h?(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5 text-xs",children:[(0,d.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",opacity:.6,fontSize:"0.68rem"},children:a}),(0,d.jsx)("span",{className:"truncate",style:{color:"var(--muted-foreground)"},children:h})]},c):null})})]},c)})})}function y({headers:a,rows:b,cfg:c,saveAction:f}){let[g,h]=(0,e.useState)(b),[i,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(""),[n,p]=(0,e.useState)(!1),q=a.indexOf(c.groupField),r=a.indexOf(c.titleField),s=a.indexOf(c.descField),{groups:u,groupKeys:v}=(0,e.useMemo)(()=>{let a=new Map;return g.forEach((b,c)=>{let d=(q>=0?b[q]:"")||"(empty)";a.has(d)||a.set(d,[]),a.get(d).push({row:b,origIdx:c})}),{groups:a,groupKeys:[...a.keys()]}},[g,q]);async function w(b,c){let d=g.map((a,d)=>{if(d!==b)return a;let e=[...a];return q>=0&&(e[q]=c),e});h(d),await f(m(a,d))}function x({group:b}){let c=u.get(b)??[],e=o(b),f=i===b;return(0,d.jsxs)("div",{className:"flex-shrink-0 w-64 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,d.jsx)("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{background:e.text}}),(0,d.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider truncate font-display",style:{color:e.text},children:b}),(0,d.jsx)("span",{className:"text-xs ml-auto shrink-0",style:{color:"var(--muted-foreground)",opacity:.5},children:c.length})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl p-1.5 min-h-[80px] transition-colors",style:{background:f?"var(--amber-dim)":"var(--muted)",border:`1px solid ${f?"var(--amber)":"transparent"}`},onDragOver:a=>{a.preventDefault(),j(b)},onDragLeave:a=>{a.currentTarget.contains(a.relatedTarget)||j(null)},onDrop:a=>{j(null);let c=parseInt(a.dataTransfer.getData("origIdx"));isNaN(c)||w(c,b)},children:[c.map(({row:b,origIdx:c})=>{let e=r>=0?b[r]:b[0]??"",f=s>=0?b[s]:"";return(0,d.jsxs)("div",{draggable:!0,onDragStart:a=>{a.dataTransfer.setData("origIdx",String(c)),j(null)},onDragEnd:()=>j(null),className:"rounded-lg border p-3 flex flex-col gap-1.5 cursor-grab active:cursor-grabbing hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,d.jsx)("p",{className:"text-sm font-medium leading-snug",style:{color:"var(--foreground)"},children:e}),f&&(0,d.jsx)("p",{className:"text-xs leading-relaxed line-clamp-2",style:{color:"var(--muted-foreground)"},children:f}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1 mt-0.5",children:a.map((a,c)=>{if(c===q||c===r||c===s)return null;let e=b[c];return e?(0,d.jsxs)("span",{className:"text-2xs px-1.5 py-0.5 rounded font-display",style:{background:"var(--muted)",color:"var(--muted-foreground)"},children:[a,": ",e]},c):null})})]},c)}),0===c.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-12",children:(0,d.jsx)("span",{className:"text-xs",style:{color:"var(--muted-foreground)",opacity:.4},children:"Drop here"})})]})]})}return(0,d.jsxs)("div",{className:"flex gap-3 overflow-x-auto pb-3 items-start",children:[v.map(a=>(0,d.jsx)(x,{group:a},a)),(0,d.jsx)("div",{className:"flex-shrink-0 w-64",children:n?(0,d.jsxs)("div",{className:"rounded-xl border p-3 flex flex-col gap-2",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,d.jsx)("input",{autoFocus:!0,value:k,onChange:a=>l(a.target.value),onKeyDown:a=>{"Enter"===a.key&&k.trim()&&(l(""),p(!1)),"Escape"===a.key&&(l(""),p(!1))},placeholder:"Column name…",className:"text-xs bg-transparent outline-none w-full font-display",style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)"}}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{onClick:()=>{l(""),p(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:"Create"}),(0,d.jsx)("button",{onClick:()=>{l(""),p(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{color:"var(--muted-foreground)"},children:"Cancel"})]})]}):(0,d.jsxs)("button",{onClick:()=>p(!0),className:"flex items-center gap-1.5 text-xs px-3 py-2 rounded-xl border border-dashed w-full transition-colors hover:bg-muted font-display",style:{borderColor:"var(--border)",color:"var(--muted-foreground)"},children:[(0,d.jsx)(t.A,{size:12})," Add column"]})})]})}var z=c(46674),A=c(27608);function B({headers:a,cfg:b,view:c,onClose:e,onChange:f}){let g={color:"var(--muted-foreground)",fontSize:"0.72rem"};function h({label:b,value:c,onChange:e}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{className:"font-display",style:g,children:b}),(0,d.jsx)(A.A,{value:c,onChange:e,size:"sm",options:[{value:"",label:"— none —"},...a.map(a=>({value:a,label:a}))]})]})}return(0,d.jsxs)("div",{className:"absolute right-0 top-10 z-20 w-72 rounded-xl border shadow-xl p-4 flex flex-col gap-3",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("span",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:[c," settings"]}),(0,d.jsx)("button",{onClick:e,style:{color:"var(--muted-foreground)"},children:(0,d.jsx)(z.A,{size:13})})]}),"table"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Sort"}),(0,d.jsx)(h,{label:"Sort by",value:b.table.sortField,onChange:a=>f({...b,table:{...b.table,sortField:a}})}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{style:g,children:"Direction"}),(0,d.jsx)("div",{className:"flex rounded overflow-hidden border",style:{borderColor:"var(--border)"},children:["asc","desc"].map(a=>(0,d.jsx)("button",{onClick:()=>f({...b,table:{...b.table,sortDir:a}}),className:"px-3 py-1 text-xs transition-colors font-display",style:{fontSize:"0.72rem",background:b.table.sortDir===a?"var(--amber)":"var(--background)",color:b.table.sortDir===a?"var(--amber-foreground)":"var(--muted-foreground)"},children:a},a))})]}),(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Group"}),(0,d.jsx)(h,{label:"Group by",value:b.table.groupField,onChange:a=>f({...b,table:{...b.table,groupField:a}})}),(0,d.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,d.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:g,children:"Columns"}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:a.map(a=>{let c=b.table.hiddenFields.includes(a);return(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{style:g,children:a}),(0,d.jsx)("button",{onClick:()=>{let d=c?b.table.hiddenFields.filter(b=>b!==a):[...b.table.hiddenFields,a];f({...b,table:{...b.table,hiddenFields:d}})},className:"text-xs px-2 py-0.5 rounded transition-colors font-display",style:{background:c?"var(--muted)":"var(--amber-dim)",color:c?"var(--muted-foreground)":"var(--amber)"},children:c?"Hidden":"Visible"})]},a)})})]}),"gallery"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{label:"Title",value:b.gallery.titleField,onChange:a=>f({...b,gallery:{...b.gallery,titleField:a}})}),(0,d.jsx)(h,{label:"Description",value:b.gallery.descField,onChange:a=>f({...b,gallery:{...b.gallery,descField:a}})}),(0,d.jsx)(h,{label:"Tag / Badge",value:b.gallery.tagField,onChange:a=>f({...b,gallery:{...b.gallery,tagField:a}})})]}),"board"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{label:"Group by",value:b.board.groupField,onChange:a=>f({...b,board:{...b.board,groupField:a}})}),(0,d.jsx)(h,{label:"Card title",value:b.board.titleField,onChange:a=>f({...b,board:{...b.board,titleField:a}})}),(0,d.jsx)(h,{label:"Card desc",value:b.board.descField,onChange:a=>f({...b,board:{...b.board,descField:a}})})]})]})}let C=[{id:"table",icon:(0,d.jsx)(g.A,{size:13}),label:"Table"},{id:"gallery",icon:(0,d.jsx)(h.A,{size:13}),label:"Gallery"},{id:"board",icon:(0,d.jsx)(i.A,{size:13}),label:"Board"}];function D({filePath:a,content:b,saveAction:c}){let{headers:f,rows:g}=(0,e.useMemo)(()=>{let a;return{headers:(a=l().parse(b,{skipEmptyLines:!0}).data)[0]??[],rows:a.slice(1)}},[b]),h=(0,e.useMemo)(()=>({activeView:"table",table:{sortField:"",sortDir:"asc",groupField:"",hiddenFields:[]},gallery:{titleField:f[0]??"",descField:f[1]??"",tagField:f[2]??""},board:{groupField:f[f.length-1]??"",titleField:f[0]??"",descField:f[1]??""}}),[f]),[i,k]=(0,p.Un)("csv",a,h),[m,n]=(0,e.useState)(!1),o=(0,e.useCallback)(a=>{k(a)},[k]),q=i.activeView;return(0,d.jsxs)("div",{className:"max-w-[1100px] mx-auto px-0 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4 relative",children:[(0,d.jsx)("div",{className:"flex items-center gap-0.5 p-1 rounded-lg",style:{background:"var(--muted)"},children:C.map(a=>(0,d.jsxs)("button",{onClick:()=>o({...i,activeView:a.id}),className:"flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors font-display",style:{background:q===a.id?"var(--card)":"transparent",color:q===a.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:q===a.id?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:[a.icon,a.label]},a.id))}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)",opacity:.5},children:[g.length," rows"]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{onClick:()=>n(a=>!a),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors",style:{background:m?"var(--accent)":"var(--muted)",color:m?"var(--foreground)":"var(--muted-foreground)"},title:"View settings",children:(0,d.jsx)(j.A,{size:13})}),m&&(0,d.jsx)(B,{headers:f,cfg:i,view:q,onClose:()=>n(!1),onChange:o})]})]}),"table"===q&&(0,d.jsx)(w,{headers:f,rows:g,cfg:i.table,saveAction:c}),"gallery"===q&&(0,d.jsx)(x,{headers:f,rows:g,cfg:i.gallery}),"board"===q&&(0,d.jsx)(y,{headers:f,rows:g,cfg:i.board,saveAction:c})]})}},46633:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>E});var e=c(48249),f=c(67484),g=c(6079),h=c(87148),i=c(95581),j=c(36041),k=c(69924),l=c(84248),m=c(59347),n=c(8455),o=c(40560),p=c(89165),q=c(49681),r=c(46674),s=c(39703),t=c(19099),u=c(30315),v=c(95054),w=c(99788),x=c(29272),y=c(23343),z=c(29185),A=c(51272),B=c(14039),C=c(89872),D=a([w]);function E({visible:a,initialTab:b,variant:c,onClose:d}){let[D,E]=(0,f.useState)("ai"),[F,G]=(0,f.useState)(null),[H,I]=(0,f.useState)(!1),[J,K]=(0,f.useState)("idle"),{t:L,locale:M,setLocale:N}=(0,u.Y)(),O=(0,t.useRouter)();(0,f.useRef)(void 0),(0,f.useRef)(!1);let P=(0,f.useRef)(null),[Q,R]=(0,f.useState)("lora"),[S,T]=(0,f.useState)("15px"),[U,V]=(0,f.useState)("780px"),[W,X]=(0,f.useState)(!0),[Y,Z]=(0,f.useState)(()=>!1),$="panel"===c;(0,f.useRef)(!1);let _=(0,f.useCallback)(a=>{E(a),P.current?.scrollTo?.(0,0)},[]);(0,f.useCallback)(async a=>{I(!0);try{await (0,v.n)("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ai:a.ai,agent:a.agent,mindRoot:a.mindRoot,webPassword:a.webPassword,authToken:a.authToken})}),K("saved"),window.dispatchEvent(new Event("mindos:settings-changed")),setTimeout(()=>K("idle"),2500)}catch{K("error"),setTimeout(()=>K("idle"),2500)}finally{I(!1)}},[]);let aa=(0,f.useCallback)(a=>{G(b=>b?{...b,ai:{...b.ai,...a}}:b)},[]),ab=(0,f.useCallback)(a=>{G(b=>b?{...b,agent:{...b.agent??{},...a}}:b)},[]),ac=(0,f.useCallback)(async()=>{if(!F)return;let a={provider:"anthropic",providers:{anthropic:{apiKey:"",model:"claude-sonnet-4-6"},openai:{apiKey:"",model:"gpt-5.4",baseUrl:""}}};G(b=>b?{...b,ai:a}:b),setTimeout(()=>{(0,v.n)("/api/settings").then(a=>{G(a)}).catch(()=>K("error"))},1300)},[F]),ad=F?.envOverrides??{},ae=$?12:13,af=[{id:"ai",label:L.settings.tabs.ai,icon:(0,e.jsx)(g.A,{size:ae})},{id:"mcp",label:L.settings.tabs.mcp??"Connections",icon:(0,e.jsx)(h.A,{size:ae})},{id:"knowledge",label:L.settings.tabs.knowledge,icon:(0,e.jsx)(i.A,{size:ae})},{id:"appearance",label:L.settings.tabs.appearance,icon:(0,e.jsx)(j.A,{size:ae})},{id:"sync",label:L.settings.tabs.sync??"Sync",icon:(0,e.jsx)(k.A,{size:ae})},{id:"update",label:L.settings.tabs.update??"Update",icon:(0,e.jsx)(l.A,{size:ae}),badge:Y},{id:"uninstall",label:L.settings.tabs.uninstall??"Uninstall",icon:(0,e.jsx)(m.A,{size:ae})}],ag=af.find(a=>a.id===D)?.label??"",ah=()=>(0,e.jsx)("div",{ref:P,className:`flex-1 overflow-y-auto min-h-0 ${$?"px-4 py-4 space-y-4":"px-5 py-5 space-y-5"}`,children:"load-error"===J&&("ai"===D||"knowledge"===D)?(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2 py-8 text-center",children:[(0,e.jsx)(n.A,{size:$?18:20,className:"text-destructive"}),(0,e.jsx)("p",{className:`${$?"text-xs":"text-sm"} text-destructive font-medium`,children:"Failed to load settings"}),!$&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Check that the server is running and AUTH_TOKEN is configured correctly."})]}):F||"appearance"===D||"mcp"===D||"sync"===D||"update"===D||"uninstall"===D?(0,e.jsxs)(e.Fragment,{children:["ai"===D&&F?.ai&&(0,e.jsx)(w.S,{data:F,updateAi:aa,updateAgent:ab,t:L}),"appearance"===D&&(0,e.jsx)(x.G,{font:Q,setFont:R,fontSize:S,setFontSize:T,contentWidth:U,setContentWidth:V,dark:W,setDark:X,locale:M,setLocale:N,t:L}),"knowledge"===D&&F&&(0,e.jsx)(y.M,{data:F,setData:G,t:L}),"sync"===D&&(0,e.jsx)(z.v,{t:L}),"mcp"===D&&(0,e.jsx)(A.w,{t:L}),"update"===D&&(0,e.jsx)(B.P,{}),"uninstall"===D&&(0,e.jsx)(C.Q,{})]}):(0,e.jsx)("div",{className:"flex justify-center py-8",children:(0,e.jsx)(o.A,{size:$?16:18,className:"animate-spin text-muted-foreground"})})}),ai=()=>"ai"===D||"knowledge"===D?(0,e.jsxs)("div",{className:`${$?"px-4 py-2":"px-5 py-2.5"} border-t border-border shrink-0 flex items-center justify-between`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:["ai"===D&&Object.values(ad).some(Boolean)&&(0,e.jsxs)("button",{onClick:ac,disabled:H||!F,className:`flex items-center gap-1.5 ${$?"px-2.5 py-1 text-xs rounded-md":"px-3 py-1.5 text-sm rounded-lg"} border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:[(0,e.jsx)(p.A,{size:$?12:13}),L.settings.ai.restoreFromEnv]}),"knowledge"===D&&(0,e.jsxs)("a",{href:"/setup?force=1",className:`flex items-center gap-1.5 ${$?"px-2.5 py-1 text-xs rounded-md":"px-3 py-1.5 text-sm rounded-lg"} border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors`,children:[(0,e.jsx)(p.A,{size:$?12:13}),L.settings.reconfigure]})]}),!$&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-xs",role:"status","aria-live":"polite",children:[H&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.A,{size:12,className:"animate-spin text-muted-foreground"}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[L.settings.save,"..."]})]}),"saved"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(q.A,{size:12,className:"text-success"}),(0,e.jsx)("span",{className:"text-success",children:L.settings.saved})]}),"error"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.A,{size:12,className:"text-destructive"}),(0,e.jsx)("span",{className:"text-destructive",children:L.settings.saveFailed})]})]})]}):null;return $?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)(i.A,{size:14,className:"text-muted-foreground"}),(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider font-display",children:"Settings"})]}),(0,e.jsx)("div",{className:"flex items-center gap-1.5",children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px]",role:"status","aria-live":"polite",children:[H&&(0,e.jsx)(o.A,{size:10,className:"animate-spin text-muted-foreground"}),"saved"===J&&(0,e.jsx)(q.A,{size:10,className:"text-success"}),"error"===J&&(0,e.jsx)(n.A,{size:10,className:"text-destructive"})]})})]}),(0,e.jsx)("div",{className:"flex border-b border-border px-3 shrink-0 overflow-x-auto scrollbar-none gap-0",children:af.map(a=>(0,e.jsxs)("button",{onClick:()=>_(a.id),className:`flex items-center gap-1 px-2 py-2 text-xs font-medium transition-colors border-b-2 -mb-px whitespace-nowrap ${D===a.id?"border-[var(--amber)] text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.icon,a.label,a.badge&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-error shrink-0"})]},a.id))}),ah(),ai()]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex flex-col h-full md:hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[(0,e.jsx)("div",{className:"flex justify-center pt-2 pb-0 absolute top-0 left-1/2 -translate-x-1/2",children:(0,e.jsx)("div",{className:"w-8 h-1 rounded-full bg-muted-foreground/20"})}),(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)(i.A,{size:15,className:"text-muted-foreground"}),(0,e.jsx)("span",{className:"font-display",children:L.settings.title})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px]",role:"status","aria-live":"polite",children:[H&&(0,e.jsx)(o.A,{size:12,className:"animate-spin text-muted-foreground"}),"saved"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(q.A,{size:12,className:"text-success"}),(0,e.jsx)("span",{className:"text-success",children:L.settings.saved})]}),"error"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.A,{size:12,className:"text-destructive"}),(0,e.jsx)("span",{className:"text-destructive",children:L.settings.saveFailed})]})]}),d&&(0,e.jsx)("button",{onClick:d,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(r.A,{size:15})})]})]}),(0,e.jsxs)("div",{className:"flex border-b border-border px-4 shrink-0 overflow-x-auto scrollbar-none gap-0",children:[af.map(a=>(0,e.jsxs)("button",{onClick:()=>_(a.id),className:`flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2 -mb-px whitespace-nowrap ${D===a.id?"border-[var(--amber)] text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.icon,a.label,a.badge&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-error shrink-0"})]},a.id)),(0,e.jsxs)("button",{onClick:()=>{d?.(),O.push("/help")},className:"flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium transition-colors border-b-2 -mb-px whitespace-nowrap border-transparent text-muted-foreground hover:text-foreground",children:[(0,e.jsx)(s.A,{size:ae}),L.sidebar.help]})]}),ah(),ai()]}),(0,e.jsxs)("div",{className:"hidden md:flex flex-row h-full min-h-0",children:[(0,e.jsxs)("div",{className:"w-[180px] shrink-0 border-r border-border flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[(0,e.jsx)(i.A,{size:15,className:"text-muted-foreground"}),(0,e.jsx)("span",{className:"text-sm font-medium font-display text-foreground",children:L.settings.title})]}),(0,e.jsx)("nav",{className:"flex-1 overflow-y-auto py-1.5",children:af.map(a=>(0,e.jsxs)("button",{onClick:()=>_(a.id),className:`flex items-center gap-2 w-full px-4 py-2 text-sm font-medium transition-colors relative ${D===a.id?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[D===a.id&&(0,e.jsx)("div",{className:"absolute left-0 top-1 bottom-1 w-[3px] rounded-r-full bg-[var(--amber)]"}),a.icon,a.label,a.badge&&(0,e.jsx)("span",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-error shrink-0"})]},a.id))}),(0,e.jsx)("div",{className:"shrink-0 border-t border-border px-4 py-2",children:(0,e.jsxs)("button",{onClick:()=>{d?.(),O.push("/help")},className:"flex items-center gap-2 w-full px-0 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,e.jsx)(s.A,{size:13}),L.sidebar.help]})})]}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground font-display",children:ag}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px]",role:"status","aria-live":"polite",children:[H&&(0,e.jsx)(o.A,{size:12,className:"animate-spin text-muted-foreground"}),"saved"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(q.A,{size:12,className:"text-success"}),(0,e.jsx)("span",{className:"text-success",children:L.settings.saved})]}),"error"===J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.A,{size:12,className:"text-destructive"}),(0,e.jsx)("span",{className:"text-destructive",children:L.settings.saveFailed})]})]}),d&&(0,e.jsx)("button",{onClick:d,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(r.A,{size:15})})]})]}),ah(),ai()]})]})]})}w=(D.then?(await D)():D)[0],d()}catch(a){d(a)}})},49905:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{default:()=>i});var e=c(48249),f=c(19099),g=c(89119),h=a([g]);function i({fileTree:a,children:b}){let c=(0,f.usePathname)();return"/login"===c?(0,e.jsx)(e.Fragment,{children:b}):(0,e.jsx)(g.A,{fileTree:a,children:b})}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},51272:(a,b,c)=>{"use strict";c.d(b,{w:()=>U});var d=c(48249),e=c(67484),f=c(40560),g=c(6079),h=c(8505),i=c(41479),j=c(61075),k=c(11035),l=c(76592),m=c(87148),n=c(56884),o=c(49681),p=c(68762),q=c(41023),r=c(15273),s=c(8455),t=c(44218),u=c(19794),v=c(89165),w=c(69924),x=c(42742),y=c(99101),z=c(18329),A=c(60725),B=c(39868),C=c(95054),D=c(27608);function E({agents:a,t:b,onRefresh:c,mode:g="mcp",activeSkillName:h="mindos"}){let i=b.settings?.mcp,[j,k]=(0,e.useState)(new Set),[l,m]=(0,e.useState)("auto"),[n,p]=(0,e.useState)("http://localhost:8781/mcp"),[q,r]=(0,e.useState)(""),[t,u]=(0,e.useState)({}),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(null),z=async()=>{if(0!==j.size){w(!0),y(null);try{let b={agents:[...j].map(b=>{let c=a.find(a=>a.key===b),d="auto"===l?c?.preferredTransport||"stdio":l;return{key:b,scope:t[b]||(c?.hasProjectScope?"project":"global"),transport:d}}),transport:l,..."http"===l?{url:n,token:q}:{},..."auto"===l?{url:n,token:q}:{}},d=await (0,C.n)("/api/mcp/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=d.results.filter(a=>"ok"===a.status).length,f=d.results.filter(a=>"error"===a.status);f.length>0?y({type:"error",text:f.map(a=>`${a.agent}: ${a.message}`).join("; ")}):y({type:"success",text:i?.installSuccess?i.installSuccess(e):`${e} agent(s) configured`}),k(new Set),c()}catch{y({type:"error",text:i?.installFailed??"Install failed"})}finally{w(!1),setTimeout(()=>y(null),4e3)}}},A="http"===l||"auto"===l&&[...j].some(b=>{let c=a.find(a=>a.key===b);return c?.preferredTransport==="http"});return"cli"===g?(0,d.jsx)(F,{agents:a,m:i,activeSkillName:h}):(0,d.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:i?.mcpInstallDesc??"Install MCP config + Skill to detected agents on this machine."}),(0,d.jsx)("div",{className:"space-y-1",children:a.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-3 py-1.5 text-sm",children:[(0,d.jsx)("input",{type:"checkbox",checked:j.has(a.key),onChange:()=>{var b;return b=a.key,void k(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"form-check"}),(0,d.jsx)("span",{className:"w-28 shrink-0 text-xs",children:a.name}),(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded font-mono bg-muted",children:"auto"===l?a.preferredTransport:l}),a.installed?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-success/15 text-success font-mono",children:a.transport}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground",children:a.scope})]}):(0,d.jsx)("span",{className:"text-2xs text-muted-foreground",children:a.present?i?.detected??"Detected":i?.notFound??"Not found"}),j.has(a.key)&&a.hasProjectScope&&a.hasGlobalScope&&(0,d.jsx)(D.A,{value:t[a.key]||"project",onChange:b=>u({...t,[a.key]:b}),size:"sm",className:"ml-auto",options:[{value:"project",label:i?.project??"Project"},{value:"global",label:i?.global??"Global"}]})]},a.key))}),(0,d.jsxs)("div",{className:"flex gap-2 text-xs pt-1",children:[(0,d.jsx)("button",{type:"button",onClick:()=>k(new Set(a.filter(a=>!a.installed&&a.present).map(a=>a.key))),className:"px-2.5 py-1 rounded-md border border-[var(--amber)] text-[var(--amber)] transition-colors hover:bg-muted/50",children:i?.selectDetected??"Select Detected"}),(0,d.jsx)("button",{type:"button",onClick:()=>k(new Set),className:"px-2.5 py-1 rounded-md border border-border text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:i?.clearSelection??"Clear"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-4 text-xs pt-1",children:[(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"radio",name:"transport",checked:"auto"===l,onChange:()=>m("auto"),className:"form-radio"}),i?.transportAuto??"auto (recommended)"]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"radio",name:"transport",checked:"stdio"===l,onChange:()=>m("stdio"),className:"form-radio"}),i?.transportStdio??"stdio"]}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,d.jsx)("input",{type:"radio",name:"transport",checked:"http"===l,onChange:()=>m("http"),className:"form-radio"}),i?.transportHttp??"http"]})]}),A&&(0,d.jsxs)("div",{className:"space-y-2 pl-5 text-xs",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("label",{className:"text-muted-foreground",children:i?.httpUrl??"MCP URL"}),(0,d.jsx)("input",{type:"text",value:n,onChange:a=>p(a.target.value),className:"w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-background font-mono text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring"})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("label",{className:"text-muted-foreground",children:i?.httpToken??"Auth Token"}),(0,d.jsx)("input",{type:"password",value:q,onChange:a=>r(a.target.value),placeholder:"Bearer token",className:"w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-background font-mono text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring"})]})]}),(0,d.jsxs)("button",{onClick:z,disabled:0===j.size||v,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed bg-[var(--amber)] text-[var(--amber-foreground)]",children:[v&&(0,d.jsx)(f.A,{size:12,className:"animate-spin"}),v?i?.installing??"Installing...":i?.installSelected??"Install Selected"]}),x&&(0,d.jsx)("div",{className:"flex items-center gap-1.5 text-xs",role:"status",children:"success"===x.type?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(o.A,{size:12,className:"text-success"}),(0,d.jsx)("span",{className:"text-success",children:x.text})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.A,{size:12,className:"text-destructive"}),(0,d.jsx)("span",{className:"text-destructive",children:x.text})]})})]})}function F({agents:a,m:b,activeSkillName:c}){let[f,g]=(0,e.useState)(a[0]?.key??"claude-code"),h=a.find(a=>a.key===f),i=`npx skills add GeminiLight/MindOS --skill ${c} -a ${f} -g -y`,j=async()=>{await (0,B.l)(i)&&y.oR.copy()},k=a.filter(a=>a.present&&a.installed),l=a.filter(a=>a.present&&!a.installed),m=a.filter(a=>!a.present);return(0,d.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:b?.cliInstallDesc??"Install the MindOS Skill to your agent so it can operate your knowledge base."}),(0,d.jsx)(D.A,{value:f,onChange:g,size:"sm",options:[...k.length>0?[{label:b?.connectedGroup??"Connected",options:k.map(a=>({value:a.key,label:a.name}))}]:[],...l.length>0?[{label:b?.detectedGroup??"Detected",options:l.map(a=>({value:a.key,label:a.name}))}]:[],...m.length>0?[{label:b?.notFoundGroup??"Not Installed",options:m.map(a=>({value:a.key,label:a.name}))}]:[]]}),h&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-2xs",children:[h.present&&h.installed?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full font-medium bg-success/10 text-success",children:[(0,d.jsx)(o.A,{size:10})," ",b?.tagConnected??"Connected"]}):h.present?(0,d.jsx)("span",{className:"text-muted-foreground",children:b?.detected??"Detected"}):(0,d.jsx)("span",{className:"text-muted-foreground",children:b?.notFound??"Not found"}),null!=h.installedSkillCount&&h.installedSkillCount>0&&(0,d.jsxs)("span",{className:"text-muted-foreground",children:[h.installedSkillCount," ",b?.skillsInstalled??"skills installed"]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("code",{className:"flex-1 text-[10px] font-mono bg-muted/50 border border-border rounded-lg px-2.5 py-2 text-muted-foreground select-all overflow-x-auto whitespace-nowrap",children:i}),(0,d.jsx)("button",{onClick:j,className:"p-1.5 rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors shrink-0",children:(0,d.jsx)(r.A,{size:11})})]})]})}var G=c(10316),H=c(46674),I=c(24520),J=c(57056),K=c(12625),L=c(59347),M=c(81285);let N=(0,c(90314).default)(async()=>{},{loadableGenerated:{modules:["components/settings/McpSkillRow.tsx -> @/components/MarkdownView"]},ssr:!1});function O({skill:a,expanded:b,onExpand:c,onToggle:e,onDelete:g,onEditStart:h,onEditSave:i,onEditCancel:j,editing:k,editContent:l,setEditContent:m,editError:n,saving:o,fullContent:p,loadingContent:q,loadErrors:r,m:v}){return(0,d.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>c(a.name),children:[b?(0,d.jsx)(t.A,{size:12}):(0,d.jsx)(u.A,{size:12}),(0,d.jsx)("span",{className:"text-xs font-medium flex-1",children:a.name}),(0,d.jsx)("span",{className:`text-2xs px-1.5 py-0.5 rounded ${"builtin"===a.source?"bg-muted text-muted-foreground":"bg-[var(--amber-subtle)] text-[var(--amber-text)]"}`,children:"builtin"===a.source?v?.skillBuiltin??"Built-in":v?.skillUser??"Custom"}),(0,d.jsx)(M.lM,{size:"sm",checked:a.enabled,onClick:b=>{b.stopPropagation(),e(a.name,!a.enabled)}})]}),b&&(0,d.jsxs)("div",{className:"px-3 py-2 border-t border-border text-xs space-y-2 bg-muted/20",children:[(0,d.jsx)("p",{className:"text-muted-foreground",children:a.description||"No description"}),(0,d.jsx)("p",{className:"text-muted-foreground font-mono text-2xs",children:a.path}),q===a.name?(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[(0,d.jsx)(f.A,{size:10,className:"animate-spin"}),(0,d.jsx)("span",{className:"text-2xs",children:"Loading..."})]}):p[a.name]?(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-2xs text-muted-foreground font-medium",children:v?.skillContent??"Content"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a.editable&&k!==a.name&&(0,d.jsxs)("button",{onClick:()=>h(a.name),className:"flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,d.jsx)(K.A,{size:10}),v?.editSkill??"Edit"]}),a.editable&&(0,d.jsxs)("button",{onClick:()=>g(a.name),className:"flex items-center gap-1 text-2xs text-destructive hover:underline",children:[(0,d.jsx)(L.A,{size:10}),v?.deleteSkill??"Delete"]})]})]}),k===a.name?(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("textarea",{value:l,onChange:a=>m(a.target.value),rows:Math.min(20,(l.match(/\n/g)||[]).length+3),className:"w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring resize-y font-mono"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("button",{onClick:()=>i(a.name),disabled:o,className:"flex items-center gap-1 px-2.5 py-1 text-xs rounded-md disabled:opacity-40 disabled:cursor-not-allowed transition-colors bg-[var(--amber)] text-[var(--amber-foreground)]",children:[o&&(0,d.jsx)(f.A,{size:10,className:"animate-spin"}),v?.saveSkill??"Save"]}),(0,d.jsx)("button",{onClick:j,className:"px-2.5 py-1 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground transition-colors",children:v?.cancelSkill??"Cancel"})]}),n&&(0,d.jsxs)("p",{className:"text-2xs text-destructive flex items-center gap-1",children:[(0,d.jsx)(s.A,{size:10}),n]})]}):(0,d.jsx)("div",{className:"w-full rounded-md border border-border bg-background/50 max-h-[300px] overflow-y-auto px-2.5 py-1.5 text-xs [&_.prose]:max-w-none [&_.prose]:text-xs [&_h1]:text-sm [&_h2]:text-xs [&_h3]:text-xs [&_pre]:text-2xs [&_code]:text-2xs",children:(0,d.jsx)(N,{content:function(a){if(!a.startsWith("---"))return a;let b=a.indexOf("\n---",3);return -1===b?a:a.slice(b+4).replace(/^\n+/,"")}(p[a.name])})})]}):r[a.name]?(0,d.jsxs)("p",{className:"text-2xs text-destructive flex items-center gap-1",children:[(0,d.jsx)(s.A,{size:10}),r[a.name]]}):null]})]})}let P=a=>`---
97
106
  name: ${a}
98
107
  description: >
99
108
  Describe WHEN the agent should use this
@@ -153,12 +162,7 @@ Please provide a concise daily briefing in this format:
153
162
  Be specific. Reference actual content from the files. Keep the total response under 300 words.`;try{let b=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:e}],attachedFiles:c}),signal:a.signal});if(!b.ok)throw Error(`HTTP ${b.status}`);if(!b.body)throw Error("No response body");let d=b.body.getReader(),f=new TextDecoder,g="";for(;;){let{done:a,value:b}=await d.read();if(a)break;for(let a of f.decode(b,{stream:!0}).split("\n")){let b=a.match(/^0:"((?:[^"\\]|\\.)*)"$/);b?g+=b[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):!a||a.startsWith("d:")||a.startsWith("e:")||a.startsWith("0:")||(g+=a)}n(g)}t(!0)}catch(a){a instanceof Error&&"AbortError"!==a.name&&r(a.message||"Failed to generate summary")}finally{p(!1)}}return(0,d.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:"1.5rem",flexWrap:"wrap"},children:[(0,d.jsx)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:b.length>0?`${b.length} recently modified files`:"Loading recent files…"}),(0,d.jsxs)("button",{onClick:v,disabled:o||0===b.length,className:"font-display",style:{display:"flex",alignItems:"center",gap:6,padding:"5px 14px",borderRadius:7,fontSize:12,cursor:o||0===b.length?"not-allowed":"pointer",border:"none",background:o?"var(--muted)":"var(--amber)",color:o?"var(--muted-foreground)":"var(--amber-foreground)",opacity:0===b.length?.5:1,transition:"opacity .15s"},children:[o?(0,d.jsx)(f.A,{size:12,style:{animation:"spin 1s linear infinite"}}):(0,d.jsx)(g.A,{size:12}),o?"Generating…":s?"Regenerate":"Generate briefing"]})]}),b.length>0&&(0,d.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:"1.5rem"},children:b.map(a=>(0,d.jsxs)("a",{href:`/view/${(0,j.O0)(a.path)}`,className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 10px",borderRadius:999,fontSize:"0.7rem",background:"var(--muted)",color:"var(--muted-foreground)",textDecoration:"none",border:"1px solid var(--border)",transition:"color .15s"},onMouseEnter:a=>a.currentTarget.style.color="var(--foreground)",onMouseLeave:a=>a.currentTarget.style.color="var(--muted-foreground)",title:a.path,children:[(0,d.jsx)(h.A,{size:10}),l(a.path),(0,d.jsxs)("span",{style:{opacity:.5},children:[(0,d.jsx)(i.A,{size:9,style:{display:"inline",marginLeft:2}})," ",k(a.mtime)]})]},a.path))}),q&&(0,d.jsx)("div",{className:"font-display",style:{padding:"10px 14px",borderRadius:8,background:"color-mix(in srgb, var(--error) 10%, transparent)",border:"1px solid color-mix(in srgb, var(--error) 30%, transparent)",color:"var(--error)",fontSize:12,marginBottom:"1rem"},children:q}),m?(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,padding:"18px 20px",position:"relative"},children:[o&&(0,d.jsx)("div",{style:{position:"absolute",top:12,right:14,width:6,height:6,borderRadius:"50%",background:"var(--amber)",animation:"pulse 1.2s ease-in-out infinite"}}),(0,d.jsx)("div",{dangerouslySetInnerHTML:{__html:m.replace(/^### (.+)$/gm,'<h3 style="font-size:.8rem;font-weight:600;color:var(--muted-foreground);text-transform:uppercase;letter-spacing:.06em;margin:1em 0 .3em">$1</h3>').replace(/^## (.+)$/gm,'<h2 style="font-size:.9rem;font-weight:700;color:var(--foreground);margin:1.2em 0 .4em">$1</h2>').replace(/^# (.+)$/gm,'<h1 style="font-size:1rem;font-weight:700;color:var(--foreground);margin:1.2em 0 .4em">$1</h1>').replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="font-display" style="font-size:.82em;padding:1px 5px;border-radius:4px;background:var(--muted)">$1</code>').replace(/^[-*] (.+)$/gm,'<li style="margin:.2em 0;padding-left:.3em">$1</li>').replace(/(<li[^>]*>.*<\/li>\n?)+/g,a=>`<ul style="margin:.4em 0;padding-left:1.4em;list-style:disc">${a}</ul>`).replace(/\n{2,}/g,'</p><p style="margin:.5em 0;font-size:.85rem;line-height:1.7;color:var(--foreground)">').replace(/^(?!<[hulo])(.+)$/gm,'<p style="margin:.5em 0;font-size:.85rem;line-height:1.7;color:var(--foreground)">$1</p>')}})]}):o||s||!(b.length>0)?null:(0,d.jsxs)("div",{style:{border:"1px dashed var(--border)",borderRadius:10,padding:"2.5rem 1.5rem",textAlign:"center",color:"var(--muted-foreground)"},children:[(0,d.jsx)(g.A,{size:28,style:{margin:"0 auto 10px",opacity:.3,color:"var(--amber)"}}),(0,d.jsxs)("p",{className:"font-display",style:{fontSize:12},children:["Click ",(0,d.jsx)("strong",{style:{color:"var(--foreground)"},children:"Generate briefing"})," to summarize recent changes with AI."]})]}),(0,d.jsx)("style",{children:`
154
163
  @keyframes spin { to { transform: rotate(360deg); } }
155
164
  @keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }
156
- `})]})}c(95054)},52415:(a,b,c)=>{Promise.resolve().then(c.bind(c,43248))},53696:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>z,Ld:()=>y,iP:()=>x,Ay:()=>A});var d=c(48249),e=c(67484),f=c(19099),g=c(24520),h=c(80600),i=c(86718),j=c(7817),k=c(84699),l=c(12417),m=c(24703),n=c(41479),o=c(61075),p=c(59347),q=c(82298),r=c(60907),s=c(4140),t=c(2548),u=c(30315),v=c(99829);v.callServer,v.findSourceMapURL;let w=()=>{},x={files:280,search:280,echo:280,agents:280,discover:280,workflows:280},y=240,z=600;function A({activePanel:a,fileTree:b,onNavigate:c,onOpenSyncSettings:v,railWidth:A=48,panelWidth:B,onWidthChange:C,onWidthCommit:D,maximized:E=!1,onMaximize:F,onImport:G,children:H}){let I=a?x[a]:280,J=E?void 0:B??I,{t:K}=(0,u.Y)(),L=(0,f.useRouter)(),[M,N]=(0,e.useState)(null),O=(0,e.useMemo)(()=>(function a(b,c=0){let d=c;for(let e of b)"directory"===e.type&&(d=Math.max(d,a(e.children??[],c+1)));return d})(b),[b]),[P,Q]=(0,e.useState)(!1),R=(0,e.useRef)(null),S=(0,e.useRef)(null),[T,U]=(0,e.useState)(!1),V=(0,e.useRef)(null),W=(0,e.useRef)(null),X=(0,q.gL)(),[Y,Z]=(0,e.useState)(0),[$,_]=(0,e.useState)(!1),aa=(0,e.useCallback)(()=>{if(!$){_(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[$]),ab=(0,t._)({width:B??I,minWidth:y,maxWidth:z,maxWidthRatio:.45,direction:"right",disabled:E,onResize:C??w,onResizeEnd:D??w});return(0,d.jsxs)("aside",{className:`
157
- hidden md:flex fixed top-0 h-screen z-30
158
- flex-col bg-card border-r border-border
159
- transition-[transform,left,width] duration-200 ease-out
160
- ${null!==a?"translate-x-0":"-translate-x-full pointer-events-none"}
161
- `,style:{width:E?`calc(100vw - ${A}px)`:`${J}px`,left:`${A}px`},role:"region","aria-label":a?`${a} panel`:void 0,children:[(0,d.jsxs)("div",{className:`flex flex-col h-full ${"files"===a?"":"hidden"}`,children:[(0,d.jsx)(s.A,{title:K.sidebar.files,children:(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:R,type:"button",onClick:()=>{U(!1),Q(a=>!a)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.new,title:K.sidebar.new,children:(0,d.jsx)(g.A,{size:13})}),P&&(0,d.jsxs)("div",{ref:S,className:"absolute top-full right-0 mt-1 min-w-[152px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Q(!1),L.push("/view/Untitled.md")},children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0"}),K.sidebar.newFile]}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Q(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,d.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),K.sidebar.newSpace]})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>G?.(),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.importFile,title:K.sidebar.importFile,children:(0,d.jsx)(j.A,{size:13})}),(0,d.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,d.jsx)("button",{onClick:()=>N(a=>Math.max(-1,(a??O)-1)),onDoubleClick:()=>{N(-1),aa()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.collapseLevel,title:$?K.sidebar.collapseLevel:K.sidebar.collapseLevelHint??K.sidebar.collapseLevel,children:(0,d.jsx)(k.A,{size:13})}),(0,d.jsx)("button",{onClick:()=>N(a=>{let b=(a??0)+1;return b>O?null:b}),onDoubleClick:()=>{N(null),aa()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.expandLevel,title:$?K.sidebar.expandLevel:K.sidebar.expandLevelHint??K.sidebar.expandLevel,children:(0,d.jsx)(l.A,{size:13})}),(0,d.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:V,type:"button",onClick:()=>{Q(!1),U(a=>!a)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.more,title:K.sidebar.more,children:(0,d.jsx)(m.A,{size:13})}),T&&(0,d.jsxs)("div",{ref:W,className:"absolute top-full right-0 mt-1 min-w-[172px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{(0,q.Fo)(!X)},children:[X?(0,d.jsx)(n.A,{size:14,className:"shrink-0"}):(0,d.jsx)(o.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:K.sidebar.showHiddenFiles}),X&&(0,d.jsx)("span",{className:"text-[var(--amber)] text-xs",children:"✓"})]}),(0,d.jsx)("div",{className:"my-1 border-t border-border/50"}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{U(!1),L.push("/trash")},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:K.trash.title}),Y>0&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:Y})]})]})]})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,d.jsx)(q.Ay,{nodes:b,onNavigate:c,maxOpenDepth:M,onImport:G})}),(0,d.jsx)(r.Ay,{collapsed:!1,onOpenSyncSettings:v})]}),H,!E&&C&&(0,d.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:ab,children:(0,d.jsx)("div",{className:"absolute right-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/60 transition-opacity"})})]})}},54461:(a,b,c)=>{"use strict";c.d(b,{X:()=>k,d:()=>f});var d=c(67484);function e(a){let b=Date.now();return{id:`${b}-${Math.random().toString(36).slice(2,8)}`,currentFile:a,createdAt:b,updatedAt:b,messages:[]}}function f(a){if(a.title)return a.title;let b=a.messages.find(a=>"user"===a.role);if(!b)return"(empty session)";let c=b.content.replace(/\s+/g," ").trim();return!c&&b.images&&b.images.length>0?`[${b.images.length} image${b.images.length>1?"s":""}]`:c.length>42?`${c.slice(0,42)}...`:c||"(empty session)"}async function g(){try{let a=await fetch("/api/ask-sessions",{cache:"no-store"});if(!a.ok)return[];let b=await a.json();if(!Array.isArray(b))return[];return b.slice(0,30)}catch{return[]}}async function h(a){try{let b={...a,messages:a.messages.map(a=>a.images&&0!==a.images.length?{...a,images:a.images.map(a=>({...a,data:""}))}:a)};await fetch("/api/ask-sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:b})})}catch{}}async function i(a){try{await fetch("/api/ask-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})})}catch{}}async function j(a){try{await fetch("/api/ask-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:a})})}catch{}}function k(a){let[b,c]=(0,d.useState)([]),[f,k]=(0,d.useState)([]),[l,m]=(0,d.useState)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(async()=>{let b=(await g()).sort((a,b)=>b.updatedAt-a.updatedAt).slice(0,30),d=b.filter(a=>0===a.messages.length).map(a=>a.id),f=d.length>0?b.filter(a=>!d.includes(a.id)):b;d.length>0&&j(d);let h=e(a),i=a?f.find(b=>b.currentFile===a):f[0];i?(m(i.id),c(i.messages),k([...f])):(m(h.id),c([]),k([h,...f].slice(0,30)))},[a]),p=(0,d.useCallback)((b,c)=>{if(!c||0===b.length)return;let d=null;k(e=>{let f=Date.now(),g=e.find(a=>a.id===c);d=g?{...g,currentFile:a,updatedAt:f,messages:b}:{id:c,currentFile:a,createdAt:f,updatedAt:f,messages:b};let h=e.filter(a=>a.id!==c);return[d,...h].sort((a,b)=>b.updatedAt-a.updatedAt).slice(0,30)}),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{d&&h(d)},600)},[a]),q=(0,d.useCallback)(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]),r=(0,d.useCallback)(()=>{k(b=>{let d=b.find(a=>a.id===l);if(d&&0===d.messages.length)return b;let f=e(a);return m(f.id),c([]),[f,...b].sort((a,b)=>b.updatedAt-a.updatedAt).slice(0,30)})},[a,l]),s=(0,d.useCallback)(a=>{let b=f.find(b=>b.id===a);if(!b)return;let d=l?f.find(a=>a.id===l):null;d&&0===d.messages.length&&d.id!==a&&k(a=>a.filter(a=>a.id!==d.id)),m(b.id),c(b.messages)},[f,l]),t=(0,d.useCallback)(b=>{let d=f.find(a=>a.id===b);d&&d.messages.length>0&&i(b);let g=f.filter(a=>a.id!==b);if(k(g),l===b){let b=e(a);m(b.id),c([]),k([b,...g].slice(0,30))}},[l,a,f]),u=(0,d.useCallback)((a,b)=>{let c=b.trim();k(b=>{let d=b.findIndex(b=>b.id===a);if(d<0)return b;let e={...b[d],title:c||void 0},f=[...b];return f[d]=e,h(e),f})},[]),v=(0,d.useCallback)(()=>{let b=f.filter(a=>a.messages.length>0).map(a=>a.id);b.length>0&&j(b);let d=e(a);m(d.id),c([]),k([d])},[a,f]);return{messages:b,setMessages:c,sessions:f,activeSessionId:l,initSessions:o,persistSession:p,clearPersistTimer:q,resetSession:r,loadSession:s,deleteSession:t,renameSession:u,clearAllSessions:v}}},55038:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/app/global-error.tsx","default")},55134:(a,b,c)=>{Promise.resolve().then(c.bind(c,10500)),Promise.resolve().then(c.bind(c,67809)),Promise.resolve().then(c.bind(c,66535)),Promise.resolve().then(c.bind(c,78340)),Promise.resolve().then(c.bind(c,72362)),Promise.resolve().then(c.bind(c,46427)),Promise.resolve().then(c.bind(c,80992)),Promise.resolve().then(c.bind(c,51488)),Promise.resolve().then(c.bind(c,6732)),Promise.resolve().then(c.bind(c,33378)),Promise.resolve().then(c.bind(c,2820)),Promise.resolve().then(c.bind(c,49905)),Promise.resolve().then(c.bind(c,89386)),Promise.resolve().then(c.bind(c,31168)),Promise.resolve().then(c.bind(c,94416)),Promise.resolve().then(c.bind(c,5200))},55232:(a,b,c)=>{"use strict";c.d(b,{C:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(null),[f,g]=(0,d.useState)([]),[h,i]=(0,d.useState)(0),j=(0,d.useRef)(!1),k=(0,d.useCallback)(async()=>{b((await fetch("/api/skills").then(a=>a.ok?a.json():{skills:[]}).then(a=>Array.isArray(a?.skills)?a.skills:[]).catch(()=>[])).filter(a=>a.enabled)),j.current=!0},[]),l=(0,d.useCallback)((b,c)=>{let d=b.slice(0,c),f=d.lastIndexOf("/");if(-1===f||f>0&&" "!==d[f-1]&&"\n"!==d[f-1])return void e(null);let h=d.slice(f+1);if(h.includes(" "))return void e(null);if(!j.current){k(),e(null);return}let l=h.toLowerCase(),m=l?a.map(a=>{let b=a.name.toLowerCase(),c=0;return b.startsWith(l)?c=100:b.includes(l)?c=50:a.description.toLowerCase().includes(l)&&(c=10),{s:a,score:c}}).filter(a=>a.score>0).sort((a,b)=>b.score-a.score).slice(0,20).map(a=>({type:"skill",name:a.s.name,description:a.s.description})):a.slice(0,20).map(a=>({type:"skill",name:a.name,description:a.description}));if(0===m.length){e(null),g([]),i(0);return}e(h),g(m),i(0)},[a,k]),m=(0,d.useCallback)(a=>{0!==f.length&&("down"===a?i(a=>Math.min(a+1,f.length-1)):i(a=>Math.max(a-1,0)))},[f.length]);return{slashQuery:c,slashResults:f,slashIndex:h,updateSlashFromInput:l,navigateSlash:m,resetSlash:(0,d.useCallback)(()=>{e(null),g([]),i(0)},[])}}},57056:(a,b,c)=>{"use strict";c.d(b,{BK:()=>u,DO:()=>k,KF:()=>i,Mv:()=>m,TM:()=>t,ZC:()=>s,lx:()=>r,md:()=>j,pp:()=>n,rA:()=>l});var d=c(48249),e=c(46674),f=c(40560),g=c(24520),h=c(67484);function i({active:a,label:b,onClick:c}){return(0,d.jsx)("button",{type:"button",onClick:c,"aria-pressed":a,className:`relative px-2.5 min-h-[28px] rounded text-xs cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${a?"bg-[var(--amber-dim)] text-[var(--amber-text)] font-medium shadow-[0_1px_2px_rgba(200,135,58,0.08)]":"text-muted-foreground hover:text-foreground hover:bg-muted/60"}`,children:b})}function j({tone:a,label:b,count:c}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full ${"ok"===a?"bg-[var(--success)]":"warn"===a?"bg-[var(--amber)]":"bg-muted-foreground/60"}`,"aria-hidden":"true"}),(0,d.jsx)("span",{className:"text-xs",children:b}),(0,d.jsx)("span",{className:`tabular-nums font-medium ${"ok"===a?"text-foreground":"warn"===a?"text-[var(--amber)]":"text-muted-foreground"}`,children:c})]})}function k({value:a,onChange:b,placeholder:c,ariaLabel:f,icon:g}){return(0,d.jsxs)("label",{className:"relative block group/search",children:[(0,d.jsx)(g,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/60 group-focus-within/search:text-[var(--amber)] pointer-events-none transition-colors duration-150"}),(0,d.jsx)("input",{value:a,onChange:a=>b(a.target.value),placeholder:c,"aria-label":f,className:"w-full h-9 rounded-lg border border-border bg-background pl-9 pr-8 text-sm text-foreground placeholder:text-muted-foreground/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--amber)]/30 focus-visible:border-[var(--amber)]/40 transition-all duration-150"}),a.length>0&&(0,d.jsx)("button",{type:"button",onClick:()=>b(""),"aria-label":"Clear search",className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 rounded-full text-muted-foreground hover:text-foreground hover:bg-muted cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150",children:(0,d.jsx)(e.A,{size:13})})]})}function l({onClick:a,disabled:b,busy:c,label:e,busyLabel:g,variant:h="default"}){return(0,d.jsxs)("button",{type:"button",onClick:a,disabled:b,"aria-busy":c,className:`inline-flex items-center justify-center gap-1.5 text-2xs min-h-[28px] px-2.5 rounded-md cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-150 ${{default:"border border-border hover:bg-muted",primary:"bg-[var(--amber)] text-background hover:bg-[var(--amber)]/90"}[h]}`,children:[c&&(0,d.jsx)(f.A,{size:12,className:"animate-spin","aria-hidden":"true"}),c?g??e:e]})}function m({message:a}){return a?(0,d.jsx)("span",{role:"status","aria-live":"polite",className:"text-2xs text-muted-foreground animate-in fade-in duration-200",children:a}):null}function n({message:a,icon:b,className:c}){return(0,d.jsxs)("div",{className:`rounded-xl border border-dashed border-border/60 bg-gradient-to-b from-card/80 to-card/40 p-10 text-center ${c??""}`,children:[b&&(0,d.jsx)("div",{className:"w-10 h-10 rounded-full bg-muted/50 flex items-center justify-center mx-auto mb-3 text-muted-foreground/40",children:b}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground/70 leading-relaxed max-w-xs mx-auto",children:a})]})}let o=[["bg-rose-100/70 dark:bg-rose-900/30","border-rose-300/50 dark:border-rose-700/40","text-rose-600/80 dark:text-rose-400/80"],["bg-violet-100/70 dark:bg-violet-900/30","border-violet-300/50 dark:border-violet-700/40","text-violet-600/80 dark:text-violet-400/80"],["bg-emerald-100/70 dark:bg-emerald-900/30","border-emerald-300/50 dark:border-emerald-700/40","text-emerald-600/80 dark:text-emerald-400/80"],["bg-sky-100/70 dark:bg-sky-900/30","border-sky-300/50 dark:border-sky-700/40","text-sky-600/80 dark:text-sky-400/80"],["bg-amber-100/70 dark:bg-amber-900/30","border-amber-300/50 dark:border-amber-700/40","text-amber-700/80 dark:text-amber-400/80"],["bg-teal-100/70 dark:bg-teal-900/30","border-teal-300/50 dark:border-teal-700/40","text-teal-600/80 dark:text-teal-400/80"],["bg-pink-100/70 dark:bg-pink-900/30","border-pink-300/50 dark:border-pink-700/40","text-pink-600/80 dark:text-pink-400/80"],["bg-indigo-100/70 dark:bg-indigo-900/30","border-indigo-300/50 dark:border-indigo-700/40","text-indigo-600/80 dark:text-indigo-400/80"],["bg-lime-100/70 dark:bg-lime-900/30","border-lime-300/50 dark:border-lime-700/40","text-lime-700/80 dark:text-lime-400/80"],["bg-fuchsia-100/70 dark:bg-fuchsia-900/30","border-fuchsia-300/50 dark:border-fuchsia-700/40","text-fuchsia-600/80 dark:text-fuchsia-400/80"],["bg-cyan-100/70 dark:bg-cyan-900/30","border-cyan-300/50 dark:border-cyan-700/40","text-cyan-600/80 dark:text-cyan-400/80"],["bg-orange-100/70 dark:bg-orange-900/30","border-orange-300/50 dark:border-orange-700/40","text-orange-600/80 dark:text-orange-400/80"]];function p(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)|0;return Math.abs(b)}function q(a){let b=a.split(/[\s\-_]+/).filter(Boolean);return b.length>=2?(b[0][0]+b[1][0]).toUpperCase():a.slice(0,2).toUpperCase()}function r({name:a,status:b,size:c="md",onRemove:f,href:g}){let[h,i,j]=o[p(a)%o.length],k="connected"===b?"bg-[var(--success)]":"detected"===b?"bg-[var(--amber)]":"bg-muted-foreground";return(0,d.jsxs)("div",{className:"relative group/avatar",title:a,children:[(0,d.jsx)("div",{className:`${"sm"===c?"w-7 h-7 text-[10px]":"w-9 h-9 text-xs"} ${h} ${i} ${j} border rounded-full flex items-center justify-center font-semibold select-none`,children:q(a)}),b&&(0,d.jsx)("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-card ${k}`,"aria-hidden":"true"}),f&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.preventDefault(),a.stopPropagation(),f()},className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-destructive text-white flex items-center justify-center opacity-0 scale-75 group-hover/avatar:opacity-100 group-hover/avatar:scale-100 transition-all duration-150 cursor-pointer focus-visible:opacity-100 focus-visible:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Remove ${a}`,children:(0,d.jsx)(e.A,{size:9})})]})}function s({onClick:a,label:b,size:c="md"}){return(0,d.jsx)("button",{type:"button",onClick:a,title:b,"aria-label":b,className:`${"sm"===c?"w-7 h-7":"w-9 h-9"} rounded-full border-2 border-dashed border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:border-foreground/30 hover:bg-muted cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,d.jsx)(g.A,{size:14})})}function t({open:a,title:b,message:c,confirmLabel:e,cancelLabel:f,onConfirm:g,onCancel:i,variant:j="destructive"}){let k=(0,h.useRef)(null);return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",role:"alertdialog","aria-modal":"true","aria-label":b,children:[(0,d.jsx)("div",{className:"absolute inset-0 overlay-backdrop",onClick:i,"aria-hidden":"true"}),(0,d.jsxs)("div",{className:"relative bg-card border border-border rounded-lg shadow-xl p-5 max-w-sm w-full mx-4 animate-in fade-in zoom-in-95 duration-200",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1.5",children:b}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mb-4 leading-relaxed",children:c}),(0,d.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,d.jsx)("button",{ref:k,type:"button",onClick:i,className:"px-3 min-h-[32px] text-sm rounded-md border border-border hover:bg-muted cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150",children:f}),(0,d.jsx)("button",{type:"button",onClick:g,className:`px-3 min-h-[32px] text-sm rounded-md cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150 ${"destructive"===j?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-[var(--amber)] text-background hover:bg-[var(--amber)]/90"}`,children:e})]})]})]}):null}function u({open:a,agents:b,emptyLabel:c,onSelect:e,onClose:f}){let g=(0,h.useRef)(null);return a?(0,d.jsx)("div",{ref:g,className:"absolute right-0 top-full mt-1 z-30 w-56 rounded-lg border border-border bg-card shadow-lg animate-in fade-in slide-in-from-top-1 duration-150",children:0===b.length?(0,d.jsx)("p",{className:"px-3 py-2.5 text-xs text-muted-foreground",children:c}):(0,d.jsx)("div",{className:"py-1 max-h-48 overflow-y-auto",children:b.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>e(a.key),className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-muted cursor-pointer flex items-center gap-2 transition-colors duration-100",children:[(()=>{let[b,c,e]=o[p(a.name)%o.length];return(0,d.jsx)("div",{className:`w-6 h-6 rounded-full border ${b} ${c} ${e} flex items-center justify-center text-[9px] font-semibold shrink-0`,children:q(a.name)})})(),a.name]},a.key))})}):null}},60442:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call CsvRenderer() from the server but CsvRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/csv/CsvRenderer.tsx","CsvRenderer")},60725:(a,b,c)=>{"use strict";function d(a,b,c){let d,e,f;if("stdio"===c){var g,h;let b={type:"stdio",command:"mindos",args:["mcp"]};if("toml"===a.format){let b=`[${a.configKey}.mindos]
165
+ `})]})}c(95054)},52415:(a,b,c)=>{Promise.resolve().then(c.bind(c,43248))},54461:(a,b,c)=>{"use strict";c.d(b,{X:()=>k,d:()=>f});var d=c(67484);function e(a){let b=Date.now();return{id:`${b}-${Math.random().toString(36).slice(2,8)}`,currentFile:a,createdAt:b,updatedAt:b,messages:[]}}function f(a){if(a.title)return a.title;let b=a.messages.find(a=>"user"===a.role);if(!b)return"(empty session)";let c=b.content.replace(/\s+/g," ").trim();return!c&&b.images&&b.images.length>0?`[${b.images.length} image${b.images.length>1?"s":""}]`:c.length>42?`${c.slice(0,42)}...`:c||"(empty session)"}async function g(){try{let a=await fetch("/api/ask-sessions",{cache:"no-store"});if(!a.ok)return[];let b=await a.json();if(!Array.isArray(b))return[];return b.slice(0,30)}catch{return[]}}async function h(a){try{let b={...a,messages:a.messages.map(a=>a.images&&0!==a.images.length?{...a,images:a.images.map(a=>({...a,data:""}))}:a)};await fetch("/api/ask-sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:b})})}catch{}}async function i(a){try{await fetch("/api/ask-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})})}catch{}}async function j(a){try{await fetch("/api/ask-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:a})})}catch{}}function k(a){let[b,c]=(0,d.useState)([]),[f,k]=(0,d.useState)([]),[l,m]=(0,d.useState)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(async()=>{let b=(await g()).sort((a,b)=>b.updatedAt-a.updatedAt).slice(0,30),d=b.filter(a=>0===a.messages.length).map(a=>a.id),f=d.length>0?b.filter(a=>!d.includes(a.id)):b;d.length>0&&j(d);let h=e(a),i=a?f.find(b=>b.currentFile===a):f[0];i?(m(i.id),c(i.messages),k([...f])):(m(h.id),c([]),k([h,...f].slice(0,30)))},[a]),p=(0,d.useCallback)((b,c)=>{if(!c||0===b.length)return;let d=null;k(e=>{let f=Date.now(),g=e.find(a=>a.id===c);d=g?{...g,currentFile:a,updatedAt:f,messages:b}:{id:c,currentFile:a,createdAt:f,updatedAt:f,messages:b};let h=e.filter(a=>a.id!==c);return[d,...h].sort((a,b)=>b.updatedAt-a.updatedAt).slice(0,30)}),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{d&&h(d)},600)},[a]),q=(0,d.useCallback)(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]),r=(0,d.useCallback)(()=>{k(b=>{let d=b.find(a=>a.id===l);if(d&&0===d.messages.length)return b;let f=e(a);return m(f.id),c([]),[f,...b].sort((a,b)=>b.updatedAt-a.updatedAt).slice(0,30)})},[a,l]),s=(0,d.useCallback)(a=>{let b=f.find(b=>b.id===a);if(!b)return;let d=l?f.find(a=>a.id===l):null;d&&0===d.messages.length&&d.id!==a&&k(a=>a.filter(a=>a.id!==d.id)),m(b.id),c(b.messages)},[f,l]),t=(0,d.useCallback)(b=>{let d=f.find(a=>a.id===b);d&&d.messages.length>0&&i(b);let g=f.filter(a=>a.id!==b);if(k(g),l===b){let b=e(a);m(b.id),c([]),k([b,...g].slice(0,30))}},[l,a,f]),u=(0,d.useCallback)((a,b)=>{let c=b.trim();k(b=>{let d=b.findIndex(b=>b.id===a);if(d<0)return b;let e={...b[d],title:c||void 0},f=[...b];return f[d]=e,h(e),f})},[]),v=(0,d.useCallback)(()=>{let b=f.filter(a=>a.messages.length>0).map(a=>a.id);b.length>0&&j(b);let d=e(a);m(d.id),c([]),k([d])},[a,f]);return{messages:b,setMessages:c,sessions:f,activeSessionId:l,initSessions:o,persistSession:p,clearPersistTimer:q,resetSession:r,loadSession:s,deleteSession:t,renameSession:u,clearAllSessions:v}}},55038:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/app/global-error.tsx","default")},55134:(a,b,c)=>{Promise.resolve().then(c.bind(c,10500)),Promise.resolve().then(c.bind(c,67809)),Promise.resolve().then(c.bind(c,66535)),Promise.resolve().then(c.bind(c,78340)),Promise.resolve().then(c.bind(c,72362)),Promise.resolve().then(c.bind(c,46427)),Promise.resolve().then(c.bind(c,80992)),Promise.resolve().then(c.bind(c,51488)),Promise.resolve().then(c.bind(c,6732)),Promise.resolve().then(c.bind(c,33378)),Promise.resolve().then(c.bind(c,2820)),Promise.resolve().then(c.bind(c,49905)),Promise.resolve().then(c.bind(c,89386)),Promise.resolve().then(c.bind(c,31168)),Promise.resolve().then(c.bind(c,94416)),Promise.resolve().then(c.bind(c,5200))},55232:(a,b,c)=>{"use strict";c.d(b,{C:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(null),[f,g]=(0,d.useState)([]),[h,i]=(0,d.useState)(0),j=(0,d.useRef)(!1),k=(0,d.useCallback)(async()=>{b((await fetch("/api/skills").then(a=>a.ok?a.json():{skills:[]}).then(a=>Array.isArray(a?.skills)?a.skills:[]).catch(()=>[])).filter(a=>a.enabled)),j.current=!0},[]),l=(0,d.useCallback)((b,c)=>{let d=b.slice(0,c),f=d.lastIndexOf("/");if(-1===f||f>0&&" "!==d[f-1]&&"\n"!==d[f-1])return void e(null);let h=d.slice(f+1);if(h.includes(" "))return void e(null);if(!j.current){k(),e(null);return}let l=h.toLowerCase(),m=l?a.map(a=>{let b=a.name.toLowerCase(),c=0;return b.startsWith(l)?c=100:b.includes(l)?c=50:a.description.toLowerCase().includes(l)&&(c=10),{s:a,score:c}}).filter(a=>a.score>0).sort((a,b)=>b.score-a.score).slice(0,20).map(a=>({type:"skill",name:a.s.name,description:a.s.description})):a.slice(0,20).map(a=>({type:"skill",name:a.name,description:a.description}));if(0===m.length){e(null),g([]),i(0);return}e(h),g(m),i(0)},[a,k]),m=(0,d.useCallback)(a=>{0!==f.length&&("down"===a?i(a=>Math.min(a+1,f.length-1)):i(a=>Math.max(a-1,0)))},[f.length]);return{slashQuery:c,slashResults:f,slashIndex:h,updateSlashFromInput:l,navigateSlash:m,resetSlash:(0,d.useCallback)(()=>{e(null),g([]),i(0)},[])}}},57056:(a,b,c)=>{"use strict";c.d(b,{BK:()=>u,DO:()=>k,KF:()=>i,Mv:()=>m,TM:()=>t,ZC:()=>s,lx:()=>r,md:()=>j,pp:()=>n,rA:()=>l});var d=c(48249),e=c(46674),f=c(40560),g=c(24520),h=c(67484);function i({active:a,label:b,onClick:c}){return(0,d.jsx)("button",{type:"button",onClick:c,"aria-pressed":a,className:`relative px-2.5 min-h-[28px] rounded text-xs cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${a?"bg-[var(--amber-dim)] text-[var(--amber-text)] font-medium shadow-[0_1px_2px_rgba(200,135,58,0.08)]":"text-muted-foreground hover:text-foreground hover:bg-muted/60"}`,children:b})}function j({tone:a,label:b,count:c}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full ${"ok"===a?"bg-[var(--success)]":"warn"===a?"bg-[var(--amber)]":"bg-muted-foreground/60"}`,"aria-hidden":"true"}),(0,d.jsx)("span",{className:"text-xs",children:b}),(0,d.jsx)("span",{className:`tabular-nums font-medium ${"ok"===a?"text-foreground":"warn"===a?"text-[var(--amber)]":"text-muted-foreground"}`,children:c})]})}function k({value:a,onChange:b,placeholder:c,ariaLabel:f,icon:g}){return(0,d.jsxs)("label",{className:"relative block group/search",children:[(0,d.jsx)(g,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/60 group-focus-within/search:text-[var(--amber)] pointer-events-none transition-colors duration-150"}),(0,d.jsx)("input",{value:a,onChange:a=>b(a.target.value),placeholder:c,"aria-label":f,className:"w-full h-9 rounded-lg border border-border bg-background pl-9 pr-8 text-sm text-foreground placeholder:text-muted-foreground/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--amber)]/30 focus-visible:border-[var(--amber)]/40 transition-all duration-150"}),a.length>0&&(0,d.jsx)("button",{type:"button",onClick:()=>b(""),"aria-label":"Clear search",className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 rounded-full text-muted-foreground hover:text-foreground hover:bg-muted cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150",children:(0,d.jsx)(e.A,{size:13})})]})}function l({onClick:a,disabled:b,busy:c,label:e,busyLabel:g,variant:h="default"}){return(0,d.jsxs)("button",{type:"button",onClick:a,disabled:b,"aria-busy":c,className:`inline-flex items-center justify-center gap-1.5 text-2xs min-h-[28px] px-2.5 rounded-md cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-150 ${{default:"border border-border hover:bg-muted",primary:"bg-[var(--amber)] text-background hover:bg-[var(--amber)]/90"}[h]}`,children:[c&&(0,d.jsx)(f.A,{size:12,className:"animate-spin","aria-hidden":"true"}),c?g??e:e]})}function m({message:a}){return a?(0,d.jsx)("span",{role:"status","aria-live":"polite",className:"text-2xs text-muted-foreground animate-in fade-in duration-200",children:a}):null}function n({message:a,icon:b,className:c}){return(0,d.jsxs)("div",{className:`rounded-xl border border-dashed border-border/60 bg-gradient-to-b from-card/80 to-card/40 p-10 text-center ${c??""}`,children:[b&&(0,d.jsx)("div",{className:"w-10 h-10 rounded-full bg-muted/50 flex items-center justify-center mx-auto mb-3 text-muted-foreground/40",children:b}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground/70 leading-relaxed max-w-xs mx-auto",children:a})]})}let o=[["bg-rose-100/70 dark:bg-rose-900/30","border-rose-300/50 dark:border-rose-700/40","text-rose-600/80 dark:text-rose-400/80"],["bg-violet-100/70 dark:bg-violet-900/30","border-violet-300/50 dark:border-violet-700/40","text-violet-600/80 dark:text-violet-400/80"],["bg-emerald-100/70 dark:bg-emerald-900/30","border-emerald-300/50 dark:border-emerald-700/40","text-emerald-600/80 dark:text-emerald-400/80"],["bg-sky-100/70 dark:bg-sky-900/30","border-sky-300/50 dark:border-sky-700/40","text-sky-600/80 dark:text-sky-400/80"],["bg-amber-100/70 dark:bg-amber-900/30","border-amber-300/50 dark:border-amber-700/40","text-amber-700/80 dark:text-amber-400/80"],["bg-teal-100/70 dark:bg-teal-900/30","border-teal-300/50 dark:border-teal-700/40","text-teal-600/80 dark:text-teal-400/80"],["bg-pink-100/70 dark:bg-pink-900/30","border-pink-300/50 dark:border-pink-700/40","text-pink-600/80 dark:text-pink-400/80"],["bg-indigo-100/70 dark:bg-indigo-900/30","border-indigo-300/50 dark:border-indigo-700/40","text-indigo-600/80 dark:text-indigo-400/80"],["bg-lime-100/70 dark:bg-lime-900/30","border-lime-300/50 dark:border-lime-700/40","text-lime-700/80 dark:text-lime-400/80"],["bg-fuchsia-100/70 dark:bg-fuchsia-900/30","border-fuchsia-300/50 dark:border-fuchsia-700/40","text-fuchsia-600/80 dark:text-fuchsia-400/80"],["bg-cyan-100/70 dark:bg-cyan-900/30","border-cyan-300/50 dark:border-cyan-700/40","text-cyan-600/80 dark:text-cyan-400/80"],["bg-orange-100/70 dark:bg-orange-900/30","border-orange-300/50 dark:border-orange-700/40","text-orange-600/80 dark:text-orange-400/80"]];function p(a){let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)|0;return Math.abs(b)}function q(a){let b=a.split(/[\s\-_]+/).filter(Boolean);return b.length>=2?(b[0][0]+b[1][0]).toUpperCase():a.slice(0,2).toUpperCase()}function r({name:a,status:b,size:c="md",onRemove:f,href:g}){let[h,i,j]=o[p(a)%o.length],k="connected"===b?"bg-[var(--success)]":"detected"===b?"bg-[var(--amber)]":"bg-muted-foreground";return(0,d.jsxs)("div",{className:"relative group/avatar",title:a,children:[(0,d.jsx)("div",{className:`${"sm"===c?"w-7 h-7 text-[10px]":"w-9 h-9 text-xs"} ${h} ${i} ${j} border rounded-full flex items-center justify-center font-semibold select-none`,children:q(a)}),b&&(0,d.jsx)("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-card ${k}`,"aria-hidden":"true"}),f&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.preventDefault(),a.stopPropagation(),f()},className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-destructive text-white flex items-center justify-center opacity-0 scale-75 group-hover/avatar:opacity-100 group-hover/avatar:scale-100 transition-all duration-150 cursor-pointer focus-visible:opacity-100 focus-visible:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Remove ${a}`,children:(0,d.jsx)(e.A,{size:9})})]})}function s({onClick:a,label:b,size:c="md"}){return(0,d.jsx)("button",{type:"button",onClick:a,title:b,"aria-label":b,className:`${"sm"===c?"w-7 h-7":"w-9 h-9"} rounded-full border-2 border-dashed border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:border-foreground/30 hover:bg-muted cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,d.jsx)(g.A,{size:14})})}function t({open:a,title:b,message:c,confirmLabel:e,cancelLabel:f,onConfirm:g,onCancel:i,variant:j="destructive"}){let k=(0,h.useRef)(null);return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",role:"alertdialog","aria-modal":"true","aria-label":b,children:[(0,d.jsx)("div",{className:"absolute inset-0 overlay-backdrop",onClick:i,"aria-hidden":"true"}),(0,d.jsxs)("div",{className:"relative bg-card border border-border rounded-lg shadow-xl p-5 max-w-sm w-full mx-4 animate-in fade-in zoom-in-95 duration-200",children:[(0,d.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1.5",children:b}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mb-4 leading-relaxed",children:c}),(0,d.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,d.jsx)("button",{ref:k,type:"button",onClick:i,className:"px-3 min-h-[32px] text-sm rounded-md border border-border hover:bg-muted cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150",children:f}),(0,d.jsx)("button",{type:"button",onClick:g,className:`px-3 min-h-[32px] text-sm rounded-md cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150 ${"destructive"===j?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-[var(--amber)] text-background hover:bg-[var(--amber)]/90"}`,children:e})]})]})]}):null}function u({open:a,agents:b,emptyLabel:c,onSelect:e,onClose:f}){let g=(0,h.useRef)(null);return a?(0,d.jsx)("div",{ref:g,className:"absolute right-0 top-full mt-1 z-30 w-56 rounded-lg border border-border bg-card shadow-lg animate-in fade-in slide-in-from-top-1 duration-150",children:0===b.length?(0,d.jsx)("p",{className:"px-3 py-2.5 text-xs text-muted-foreground",children:c}):(0,d.jsx)("div",{className:"py-1 max-h-48 overflow-y-auto",children:b.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>e(a.key),className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-muted cursor-pointer flex items-center gap-2 transition-colors duration-100",children:[(()=>{let[b,c,e]=o[p(a.name)%o.length];return(0,d.jsx)("div",{className:`w-6 h-6 rounded-full border ${b} ${c} ${e} flex items-center justify-center text-[9px] font-semibold shrink-0`,children:q(a.name)})})(),a.name]},a.key))})}):null}},60442:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call CsvRenderer() from the server but CsvRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/csv/CsvRenderer.tsx","CsvRenderer")},60725:(a,b,c)=>{"use strict";function d(a,b,c){let d,e,f;if("stdio"===c){var g,h;let b={type:"stdio",command:"mindos",args:["mcp"]};if("toml"===a.format){let b=`[${a.configKey}.mindos]
162
166
  command = "mindos"
163
167
  args = ["mcp"]
164
168
 
@@ -168,22 +172,23 @@ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if
168
172
  flex-col bg-card border-l border-border
169
173
  transition-[width,transform] duration-200 ease-out
170
174
  ${a?"translate-x-0":"translate-x-full pointer-events-none"}
171
- `,style:{width:B,minWidth:`${n}px`},role:"complementary","aria-label":"MindOS Agent panel",children:[(0,e.jsx)(i.default,{fallback:(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 px-6 text-center",children:[(0,e.jsx)(g.A,{size:20,className:"text-muted-foreground"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"AI panel encountered an error."}),(0,e.jsx)("button",{onClick:()=>window.location.reload(),className:"text-xs px-3 py-1.5 rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Reload page"})]}),children:(0,e.jsx)("div",{className:"flex min-h-0 w-full flex-1 flex-col overflow-hidden",children:(0,e.jsx)(h.A,{visible:a,variant:"panel",currentFile:a?c:void 0,initialMessage:d,initialAcpAgent:k,onFirstMessage:l,onClose:b,askMode:q,onModeSwitch:r,maximized:s,onMaximize:t})})}),(0,e.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:A,children:(0,e.jsx)("div",{className:"absolute left-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/60 transition-opacity"})})]})}d()}catch(a){d(a)}})},63112:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ConfigRenderer() from the server but ConfigRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/config/ConfigRenderer.tsx","ConfigRenderer")},63710:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(99101);async function e(a,b){let c=[],e=0;for(let b of a){if(b.size>0xa00000){e++;continue}try{if(b.name.toLowerCase().endsWith(".pdf")){let a=await b.arrayBuffer();c.push({name:b.name,content:function(a){let b=new Uint8Array(a),c=[];for(let a=0;a<b.length;a+=8192)c.push(String.fromCharCode(...b.subarray(a,a+8192)));return btoa(c.join(""))}(a),encoding:"base64"})}else{let a=await b.text();c.push({name:b.name,content:a})}}catch{}}if(0===c.length)return void(e>0?d.oR.error(b.inbox.tooLarge(e),4e3):a.length>0&&d.oR.error(b.inbox.saveFailed,4e3));try{var f;let a=await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:c})});if(!a.ok){let c=await a.json().catch(()=>({}));console.error("[QuickDrop] Save failed:",c.error),d.oR.error(b.inbox.saveFailed,4e3);return}let g=await a.json(),h=g.saved?.length??0,i=g.skipped?.length??0;f=e,h>0&&f>0&&0===i?d.oR.success(b.inbox.savedWithOversized(h,f),4e3):h>0&&i+f>0?d.oR.success(b.inbox.savedWithSkipped(h,i+f),4e3):h>0?d.oR.success(b.inbox.savedToast(h),3e3):(f>0&&d.oR.error(b.inbox.tooLarge(f),4e3),i>0&&d.oR.error(b.inbox.savedWithSkipped(0,i),4e3),0===f&&0===i&&d.oR.error(b.inbox.saveFailed,4e3)),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated"))}catch(a){console.error("[QuickDrop] Network error:",a),d.oR.error(b.inbox.saveFailed,4e3)}}},65141:(a,b,c)=>{"use strict";c.d(b,{b:()=>g});var d=c(67484),e=c(53696),f=c(4615);function g(){let[a,b]=(0,d.useState)("files"),[c,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(!1),[j,k]=(0,d.useState)(!1),l=(0,d.useCallback)(a=>g(a),[]),m=(0,d.useCallback)(a=>{try{localStorage.setItem("left-panel-width",String(a))}catch{}},[]),n=(0,d.useCallback)(()=>i(a=>!a),[]),o=(0,d.useCallback)(a=>{k(a);try{localStorage.setItem("rail-expanded",String(a))}catch{}},[]),p=j?f.we:f.SG,q=c??(a?e.iP[a]:280);return{activePanel:a,setActivePanel:b,panelWidth:c,panelMaximized:h,railExpanded:j,railWidth:p,panelOpen:null!==a,effectivePanelWidth:q,handlePanelWidthChange:l,handlePanelWidthCommit:m,handlePanelMaximize:n,handleExpandedChange:o}}},65607:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>h});var e=c(48249),f=c(46633),g=a([f]);function h({open:a,onClose:b,initialTab:c}){return a?(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-end md:items-start justify-center md:pt-[10vh] modal-backdrop",onClick:a=>a.target===a.currentTarget&&b(),children:(0,e.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Settings",className:"w-full md:max-w-3xl md:mx-4 bg-card border-t md:border border-border rounded-t-2xl md:rounded-xl shadow-2xl flex flex-col h-[88vh] md:h-[80vh] md:max-h-[85vh]",children:(0,e.jsx)(f.A,{visible:a,variant:"modal",onClose:b,initialTab:c})})}):null}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},65965:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>G});var e=c(48249),f=c(67484),g=c(24520),h=c(80600),i=c(33407),j=c(46674),k=c(51161),l=c(74118),m=c(30315),n=c(38957),o=c(54461),p=c(41297),q=c(45108),r=c(15330),s=c(55232),t=c(74356),u=c(28978),v=c(82110),w=c(75539),x=c(37515),y=c(41739),z=c(33827),A=c(74190),B=c(4452),C=c(93574),D=c(33191),E=c(17009),F=a([B]);function G({visible:a,currentFile:b,initialMessage:c,initialAcpAgent:d,onFirstMessage:F,variant:G,onClose:H,maximized:I,onMaximize:J,askMode:K,onModeSwitch:L}){let M="panel"===G,N=(0,f.useRef)(null),O=(0,f.useRef)(null),{t:P}=(0,m.Y)(),[Q,R]=(0,f.useState)(!1),[S,T]=(0,f.useState)(""),U=(0,f.useRef)("");U.current=S;let[V,W]=(0,f.useState)([]),X=(0,f.useRef)(V);X.current=V;let[Y,Z]=(0,f.useState)(!1),[$,_]=(0,f.useState)(!1),[aa,ab]=(0,f.useState)(!1),[ac,ad]=(0,f.useState)(null),ae=(0,f.useRef)(ac);ae.current=ac;let[af,ag]=(0,f.useState)(null),ah=(0,f.useRef)(af);ah.current=af;let[ai,aj]=(0,f.useState)("agent"),[ak,al]=(0,f.useState)(null),am=(0,o.X)(b),an=(0,f.useRef)(am);an.current=am;let ao=(0,p.l)(),ap=(0,f.useRef)(ao);ap.current=ao;let aq=(0,q.u)(),ar=(0,r.Q)(),as=(0,s.C)(),at=(0,E.z)(),au=(0,f.useRef)(aq);au.current=aq;let av=(0,f.useRef)(ar);av.current=ar;let aw=(0,f.useRef)(as);aw.current=as;let ax=(0,f.useCallback)(()=>{T(""),ad(null),ag(null),W(b?[b]:[])},[b]),ay=(0,f.useRef)({inputValueRef:U,mentionRef:av,slashRef:aw,imageUploadRef:au,sessionRef:an,uploadRef:ap,selectedSkillRef:ae,selectedAcpAgentRef:ah,attachedFilesRef:X}),az=(0,C.t)({currentFile:b,chatMode:ai,providerOverride:ak,onFirstMessage:F,refs:ay.current,errorLabels:{noResponse:P.ask.errorNoResponse,stopped:P.ask.stopped},resetInputState:ax}),{isLoading:aA,loadingPhase:aB,reconnectAttempt:aC,reconnectMaxRef:aD}=az,aE=az.submit,aF=az.stop;(0,f.useRef)(!1),(0,f.useRef)(b);let aG=(0,f.useRef)(null),aH=(0,f.useRef)(null),aI=(0,f.useRef)(null),aJ=(0,f.useCallback)((a,b)=>{T(a);let c=b??a.length;aH.current&&clearTimeout(aH.current),aI.current&&clearTimeout(aI.current),aH.current=setTimeout(()=>av.current.updateMentionFromInput(a,c),80),aI.current=setTimeout(()=>aw.current.updateSlashFromInput(a,c),80)},[]),aK=(0,f.useCallback)(a=>{let b=N.current,c=U.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("@"),f=c.slice(0,e)+c.slice(d);T(f),av.current.resetMention(),X.current.includes(a)||W(b=>[...b,a]),setTimeout(()=>{N.current?.focus(),N.current?.setSelectionRange(e,e)},0)},[]),aL=(0,f.useCallback)(a=>{let b=N.current,c=U.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("/"),f=c.slice(0,e)+c.slice(d);T(f),ad(a),aw.current.resetSlash(),setTimeout(()=>{N.current?.focus(),N.current?.setSelectionRange(e,e)},0)},[]),aM=(0,f.useRef)(aK);aM.current=aK;let aN=(0,f.useRef)(aL);aN.current=aL;let aO=(0,f.useCallback)(a=>{let b=av.current,c=aw.current;if(null!==b.mentionQuery){if("Escape"===a.key){a.preventDefault(),b.resetMention();return}if("ArrowDown"===a.key)a.preventDefault(),b.navigateMention("down");else if("ArrowUp"===a.key)a.preventDefault(),b.navigateMention("up");else if("Enter"===a.key||"Tab"===a.key){if("Enter"===a.key&&(a.shiftKey||a.nativeEvent.isComposing))return;b.mentionResults.length>0&&(a.preventDefault(),aM.current(b.mentionResults[b.mentionIndex]))}return}if(null!==c.slashQuery){if("Escape"===a.key){a.preventDefault(),c.resetSlash();return}if("ArrowDown"===a.key)a.preventDefault(),c.navigateSlash("down");else if("ArrowUp"===a.key)a.preventDefault(),c.navigateSlash("up");else if("Enter"===a.key||"Tab"===a.key){if("Enter"===a.key&&(a.shiftKey||a.nativeEvent.isComposing))return;c.slashResults.length>0&&(a.preventDefault(),aN.current(c.slashResults[c.slashIndex]))}return}"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&!az.isLoadingRef.current&&(U.current.trim()||au.current.images.length>0)&&(a.preventDefault(),a.currentTarget.form?.requestSubmit())},[]),aP=(0,f.useCallback)(()=>{az.isLoadingRef.current||(an.current.resetSession(),T(""),W(b?[b]:[]),ap.current.clearAttachments(),au.current.clearImages(),av.current.resetMention(),aw.current.resetSlash(),ad(null),ag(null),Z(!1),setTimeout(()=>N.current?.focus(),0))},[b]),aQ=(0,f.useCallback)(a=>{(a.dataTransfer.types.includes("text/mindos-path")||a.dataTransfer.types.includes("Files"))&&(a.preventDefault(),a.dataTransfer.dropEffect="copy",_(!0))},[]),aR=(0,f.useCallback)(()=>_(!1),[]),aS=(0,f.useCallback)(async a=>{a.preventDefault(),_(!1);let b=a.dataTransfer.getData("text/mindos-path");if(b){let c=a.dataTransfer.getData("text/mindos-type"),d="directory"===c?b.replace(/\/?$/,"/"):b;X.current.includes(d)||W(a=>[...a,d]);return}await au.current.handleDrop(a)},[]),aT=(0,f.useCallback)(a=>{let b=a.clipboardData?.items;!b||Array.from(b).some(a=>"file"===a.kind&&a.type.startsWith("image/"))&&(a.preventDefault(),au.current.handlePaste(a))},[]),aU=(0,f.useCallback)(a=>{an.current.loadSession(a),Z(!1),T(""),W(b?[b]:[]),ap.current.clearAttachments(),au.current.clearImages(),av.current.resetMention(),aw.current.resetSlash(),ad(null),ag(null),setTimeout(()=>N.current?.focus(),0)},[b]),aV=(0,f.useCallback)(()=>Z(a=>!a),[]),aW=(0,f.useMemo)(()=>({connecting:P.ask.connecting,thinking:P.ask.thinking,generating:P.ask.generating,reconnecting:aC>0?P.ask.reconnecting(aC,aD.current):void 0}),[P,aC]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(y.A,{isPanel:M,showHistory:Y,onToggleHistory:aV,onReset:aP,isLoading:aA,maximized:I,onMaximize:J,askMode:K,onModeSwitch:L,onClose:H}),M&&am.sessions.length>0&&(0,e.jsx)(x.A,{sessions:am.sessions,activeSessionId:am.activeSessionId,onLoad:aU,onDelete:am.deleteSession,onNew:aP}),Y&&(0,e.jsx)(w.A,{sessions:am.sessions,activeSessionId:am.activeSessionId,onLoad:aU,onDelete:am.deleteSession,onRename:am.renameSession,onClearAll:am.clearAllSessions,labels:{title:P.ask.sessionHistory??"Session History",clearAll:P.ask.clearAll??"Clear all",confirmClear:P.ask.confirmClear??"Confirm clear?",noSessions:P.ask.noSessions??"No saved sessions.",rename:P.ask.renameSession??"Rename"}}),(0,e.jsx)(t.A,{messages:am.messages,isLoading:aA,loadingPhase:aB,emptyPrompt:P.ask.emptyPrompt,emptyHint:P.ask.emptyHint,suggestions:P.ask.suggestions,onSuggestionClick:T,labels:aW}),null!==ar.mentionQuery&&ar.mentionResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(u.A,{results:ar.mentionResults,selectedIndex:ar.mentionIndex,query:ar.mentionQuery??void 0,onSelect:aK})}),null!==as.slashQuery&&as.slashResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(v.A,{results:as.slashResults,selectedIndex:as.slashIndex,query:as.slashQuery??void 0,onSelect:aL})}),(0,e.jsx)("div",{className:"shrink-0 px-3 pb-2 pt-1",children:(0,e.jsxs)("div",{className:(0,D.cn)("rounded-xl border border-border/60 bg-card shadow-sm transition-shadow",$&&"ring-2 ring-[var(--amber)] bg-[var(--amber-dim)]"),onDragOver:aQ,onDragLeave:aR,onDrop:aS,children:[(V.length>0||ao.localAttachments.length>0||aq.images.length>0||ac||af||ao.uploadError||aq.imageError)&&(0,e.jsxs)("div",{className:(0,D.cn)("px-3 pt-2.5 pb-1",M?"max-h-24 overflow-y-auto":"max-h-28 overflow-y-auto"),children:[(0,e.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[V.map(a=>(0,e.jsx)(z.A,{path:a,variant:"kb",onRemove:()=>W(b=>b.filter(b=>b!==a))},a)),ao.localAttachments.map((a,b)=>(0,e.jsx)(z.A,{path:a.name,variant:"upload",onRemove:()=>ao.removeAttachment(b)},`up-${a.name}-${b}`)),aq.images.map((a,b)=>(0,e.jsx)(z.A,{path:`Image ${b+1}`,variant:"image",imageData:a.data,imageMime:a.mimeType,onRemove:()=>aq.removeImage(b)},`img-${b}`)),ac&&(0,e.jsx)(z.A,{path:ac.name,variant:"skill",onRemove:()=>{ad(null),N.current?.focus()}})]}),(ao.uploadError||aq.imageError)&&(0,e.jsx)("div",{className:"mt-1 text-xs text-error",children:ao.uploadError||aq.imageError})]}),(0,e.jsxs)("form",{ref:aG,onSubmit:aE,className:"flex items-end gap-1 px-1.5 py-1.5",children:[(0,e.jsxs)("div",{className:"relative shrink-0",children:[(0,e.jsx)("button",{type:"button",onClick:()=>ab(a=>!a),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:P.hints.attachFile,children:(0,e.jsx)(g.A,{size:15})}),aa&&(0,e.jsxs)("div",{className:"absolute bottom-full left-0 mb-1 py-1 rounded-lg border border-border bg-card shadow-lg z-50 min-w-[140px]",children:[(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs hover:bg-muted transition-colors text-left",onClick:()=>{ab(!1),ao.uploadInputRef.current?.click()},children:[(0,e.jsx)(h.A,{size:12,className:"shrink-0 text-muted-foreground"}),P.ask.attachFileLabel]}),(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs hover:bg-muted transition-colors text-left",onClick:()=>{ab(!1),O.current?.click()},children:[(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-muted-foreground"}),P.ask.attachImageLabel]})]})]}),(0,e.jsx)("input",{ref:ao.uploadInputRef,type:"file",className:"hidden",multiple:!0,accept:".txt,.md,.markdown,.csv,.json,.yaml,.yml,.xml,.html,.htm,.pdf,text/plain,text/markdown,text/csv,application/json,application/pdf",onChange:async a=>{let b=a.currentTarget;await ao.pickFiles(b.files),b.value=""}}),(0,e.jsx)("input",{ref:O,type:"file",className:"hidden",multiple:!0,accept:"image/png,image/jpeg,image/gif,image/webp",onChange:async a=>{let b=a.currentTarget;await aq.handleFileSelect(b.files),b.value=""}}),(0,e.jsx)("textarea",{ref:a=>{N.current=a},value:S,onChange:a=>aJ(a.target.value,a.target.selectionStart??void 0),onKeyDown:aO,onPaste:aT,placeholder:P.ask.placeholder,rows:1,className:"min-w-0 flex-1 resize-none overflow-y-hidden bg-transparent py-1.5 text-sm leading-snug text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-0"}),aA?(0,e.jsx)("button",{type:"button",onClick:aF,className:"p-1.5 rounded-lg transition-colors shrink-0 text-muted-foreground hover:text-foreground hover:bg-muted/60",title:"reconnecting"===aB?P.ask.cancelReconnect:P.ask.stopTitle,children:"reconnecting"===aB?(0,e.jsx)(j.A,{size:15}):(0,e.jsx)(k.A,{size:15})}):(0,e.jsx)("button",{type:"submit",disabled:!S.trim()&&0===aq.images.length,className:"p-1.5 rounded-lg disabled:opacity-40 disabled:cursor-not-allowed transition-opacity shrink-0 bg-[var(--amber)] text-[var(--amber-foreground)]",children:(0,e.jsx)(l.A,{size:14})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5 px-3 pb-2 pt-0.5 border-t border-border/30",children:[(0,e.jsx)(n.Ay,{mode:ai,onChange:aj,disabled:aA}),Q&&at.installedAgents.length>0&&(0,e.jsx)(A.A,{selectedAgent:af,onSelect:ag,installedAgents:at.installedAgents,loading:at.loading}),Q&&(0,e.jsx)(B.Ay,{value:ak,onChange:al,disabled:aA})]})]})})]})}B=(F.then?(await F)():F)[0],new WeakMap,d()}catch(a){d(a)}})},66535:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>v});var d=c(48249),e=c(67484),f=c(19099),g=c(13576),h=c(22772),i=c(50567),j=c(59347),k=c(10316),l=c(76592),m=c(49681),n=c(8455),o=c(44218);function p(a){return/read|list|get|search/.test(a)?/search/.test(a)?"search":"read":/create/.test(a)?"create":/delete/.test(a)?"delete":/write|update|insert|append/.test(a)?"write":"other"}let q={read:{bg:"rgba(138,180,216,0.10)",text:"#8ab4d8",border:"rgba(138,180,216,0.25)"},write:{bg:"rgba(200,135,58,0.10)",text:"var(--amber)",border:"rgba(200,135,58,0.25)"},create:{bg:"rgba(122,173,128,0.10)",text:"var(--success)",border:"rgba(122,173,128,0.25)"},delete:{bg:"rgba(200,80,80,0.10)",text:"var(--error)",border:"rgba(200,80,80,0.25)"},search:{bg:"rgba(200,160,216,0.10)",text:"#c8a0d8",border:"rgba(200,160,216,0.25)"},other:{bg:"var(--muted)",text:"var(--muted-foreground)",border:"var(--border)"}};function r({kind:a,size:b=13}){return"read"===a?(0,d.jsx)(g.A,{size:b}):"write"===a?(0,d.jsx)(h.A,{size:b}):"create"===a?(0,d.jsx)(i.A,{size:b}):"delete"===a?(0,d.jsx)(j.A,{size:b}):"search"===a?(0,d.jsx)(k.A,{size:b}):(0,d.jsx)(l.A,{size:b})}function s(a){try{return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return a}}function t({op:a}){var b,c;let g,h,i,j,k=(0,f.useRouter)(),[l,t]=(0,e.useState)(!1),u=p(a.tool),v=q[u],w="string"==typeof(b=a.params).path?b.path:null,x=a.tool.replace("mindos_","");return(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",marginBottom:8},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",cursor:"pointer",userSelect:"none"},onClick:()=>t(a=>!a),children:[(0,d.jsxs)("span",{className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:999,fontSize:"0.68rem",fontWeight:600,background:v.bg,color:v.text,border:`1px solid ${v.border}`,flexShrink:0},children:[(0,d.jsx)(r,{kind:u,size:10}),u]}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.78rem",color:"var(--foreground)",fontWeight:600,flexShrink:0},children:x}),w&&(0,d.jsx)("span",{style:{fontSize:"0.72rem",color:"var(--amber)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},onClick:a=>{a.stopPropagation(),k.push("/view/"+w.split("/").map(encodeURIComponent).join("/"))},title:w,className:"font-display",children:w}),(0,d.jsxs)("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[a.agentName&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.62rem",fontWeight:500,padding:"1px 6px",borderRadius:999,background:"var(--muted)",color:"var(--muted-foreground)",whiteSpace:"nowrap",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis"},title:a.agentName,children:a.agentName.length>30?a.agentName.slice(0,30)+"...":a.agentName}),"ok"===a.result?(0,d.jsx)(m.A,{size:13,style:{color:"var(--success)"}}):(0,d.jsx)(n.A,{size:13,style:{color:"var(--error)"}}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6},title:s(a.ts),children:(c=a.ts,h=Math.floor((g=Date.now()-new Date(c).getTime())/6e4),i=Math.floor(g/36e5),j=Math.floor(g/864e5),h<1?"just now":h<60?`${h}m ago`:i<24?`${i}h ago`:`${j}d ago`)}),(0,d.jsx)(o.A,{size:12,style:{color:"var(--muted-foreground)",transform:l?"rotate(180deg)":"none",transition:"transform .15s"}})]})]}),l&&(0,d.jsxs)("div",{style:{borderTop:"1px solid var(--border)",padding:"10px 14px",background:"var(--background)"},children:[(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8*!!a.message},children:Object.entries(a.params).map(([a,b])=>(0,d.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0,minWidth:80},children:a}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--foreground)",wordBreak:"break-all",lineHeight:1.5},children:function(a,b=120){let c="string"==typeof a?a:JSON.stringify(a);return c.length>b?c.slice(0,b)+"…":c}(b)})]},a))}),a.message&&(0,d.jsx)("div",{className:"font-display",style:{marginTop:6,padding:"5px 9px",borderRadius:5,fontSize:"0.72rem",background:"error"===a.result?"rgba(200,80,80,0.08)":"rgba(122,173,128,0.08)",color:"error"===a.result?"var(--error)":"var(--success)",border:`1px solid ${"error"===a.result?"rgba(200,80,80,0.2)":"rgba(122,173,128,0.2)"}`},children:a.message}),a.agentName&&(0,d.jsxs)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.68rem",color:"var(--muted-foreground)"},children:["Agent: ",(0,d.jsx)("span",{style:{color:"var(--foreground)",fontWeight:500},children:a.agentName})]}),(0,d.jsx)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.65rem",color:"var(--muted-foreground)",opacity:.5},children:s(a.ts)})]})]})}let u=["all","write","create","delete","read","search"];function v({content:a}){let[b,c]=(0,e.useState)("all"),f=(0,e.useMemo)(()=>(function(a){try{let b=JSON.parse(a);if(Array.isArray(b.events))return b.events.filter(a=>!!a?.tool&&!!a?.ts).sort((a,b)=>new Date(b.ts).getTime()-new Date(a.ts).getTime())}catch{}return(function(a){let b=[];for(let c of a.split("\n")){let a=c.trim();if(!(!a||a.startsWith("#")||a.startsWith("//")))try{let c=JSON.parse(a);c.tool&&c.ts&&b.push(c)}catch{}}return b})(a).sort((a,b)=>new Date(b.ts).getTime()-new Date(a.ts).getTime())})(a),[a]),g=(0,e.useMemo)(()=>"all"===b?f:f.filter(a=>p(a.tool)===b),[f,b]),h=(0,e.useMemo)(()=>{let a={all:f.length};for(let b of f){let c=p(b.tool);a[c]=(a[c]??0)+1}return a},[f]);return 0===f.length?(0,d.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:12},children:[(0,d.jsx)(l.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,d.jsx)("p",{children:"No agent operations logged yet."}),(0,d.jsxs)("p",{style:{marginTop:6,opacity:.6,fontSize:11},children:["Agent writes appear here from ",(0,d.jsx)("code",{style:{background:"var(--muted)",padding:"1px 5px",borderRadius:4},children:".mindos/agent-audit-log.json"}),"."]})]}):(0,d.jsxs)("div",{style:{maxWidth:760,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:"1.2rem",flexWrap:"wrap"},children:u.map(a=>{let e=h[a]??0;if("all"!==a&&!e)return null;let f="all"!==a?q[a]:void 0,g=b===a;return(0,d.jsxs)("button",{onClick:()=>c(a),className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,fontSize:"0.7rem",cursor:"pointer",border:"none",background:g?f?.bg??"var(--accent)":"var(--muted)",color:g?f?.text??"var(--foreground)":"var(--muted-foreground)",outline:g?`1px solid ${f?.border??"var(--border)"}`:"none",transition:"all .1s"},children:["all"!==a&&(0,d.jsx)(r,{kind:a,size:10}),a," ",(0,d.jsxs)("span",{style:{opacity:.6},children:["(",e,")"]})]},a)})}),(0,d.jsx)("div",{children:g.map((a,b)=>(0,d.jsx)(t,{op:a},b))})]})}},66874:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call BacklinksRenderer() from the server but BacklinksRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/backlinks/BacklinksRenderer.tsx","BacklinksRenderer")},66913:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call AgentInspectorRenderer() from the server but AgentInspectorRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/agent-inspector/AgentInspectorRenderer.tsx","AgentInspectorRenderer")},67809:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(48249),e=c(67484);class f extends e.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,b){console.error("[ErrorBoundary]",a,b.componentStack)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,d.jsx)("div",{className:"flex items-center justify-center min-h-[50vh] px-4",children:(0,d.jsxs)("div",{className:"text-center max-w-md",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Something went wrong"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred."}),(0,d.jsx)("button",{onClick:()=>this.setState({hasError:!1,error:void 0}),className:"px-4 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Try again"})]})}):this.props.children}}},68533:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>e});var d=c(77943);(0,d.registerClientReference)(function(){throw Error("Attempted to call Tooltip() from the server but Tooltip is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","Tooltip"),(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipTrigger() from the server but TooltipTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipTrigger"),(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipContent() from the server but TooltipContent is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipContent");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipProvider() from the server but TooltipProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipProvider")},69593:(a,b,c)=>{"use strict";c.d(b,{Oo:()=>e,dB:()=>k});var d=c(67484);function e(a){let b=a.replace(/<(thinking|reasoning|scratchpad)>[\s\S]*?<\/\1>/gi,"");return(b=b.replace(/<(?:thinking|reasoning|scratchpad)>[\s\S]*$/gi,"")).trim()}let f=new Set(["create_file","write_file","batch_create_files","append_to_file","insert_after_heading","update_section","edit_lines","delete_file","rename_file","move_file","append_csv"]),g=new Set(["read_file","read_lines","search","list_files"]);function h(a,b){return b&&"object"==typeof b?"string"==typeof b.path?b.path:"string"==typeof b.from_path?b.from_path:"batch_create_files"===a&&Array.isArray(b.files)?b.files.map(a=>a.path??"").filter(Boolean).join(", "):"":""}async function i(a){try{let b=await fetch(`/api/file?path=${encodeURIComponent(a)}&op=read_file`);if(!b.ok)return"";return(await b.json()).content??""}catch{return""}}async function j(a,b,c,d){let j=a.getReader(),k=new TextDecoder,l="",m=[],n=new Map,o="",p=0,q=new Set;try{for(;!d?.aborted;){let{done:a,value:d}=await j.read();if(a)break;let u=(l+=k.decode(d,{stream:!0})).split("\n");for(let a of(l=u.pop()??"",u)){let d,j=a.trim();if(!j.startsWith("data:"))continue;let k=j.slice(5).trim();if(!k)continue;try{d=JSON.parse(k)}catch{continue}let l=d.type;switch(l){case"tool_start":{var r,s,t;let a=d.toolName,e=d.toolCallId,j=d.args;p++;let k=(r=l,s=a,t=j,"text_delta"===r?{stage:"analyzing"}:"tool_start"===r&&s?f.has(s)?{stage:"writing",detail:h(s,t)||void 0}:g.has(s)?{stage:"reading",detail:t&&"object"==typeof t&&"path"in t&&"string"==typeof t.path?t.path:void 0}:{stage:"analyzing"}:null);if(k&&b({stageHint:k}),f.has(a)){let d=h(a,j),f="update";"create_file"===a||"batch_create_files"===a?f="create":("delete_file"===a||"rename_file"===a||"move_file"===a)&&(f="unknown"),"update"===f&&d&&!q.has(d)&&(q.add(d),i(d).then(a=>{a&&c(d,a)})),n.set(e,{name:a,path:d,action:f}),b({currentTool:{name:a,path:d}})}break}case"tool_end":{let a=d.toolCallId,c=!!d.isError,e=n.get(a);if(e){if("batch_create_files"===e.name)for(let b of e.path.split(", ").filter(Boolean))m.push({action:e.action,path:b,toolCallId:a,ok:!c});else m.push({action:e.action,path:e.path,toolCallId:a,ok:!c});n.delete(a),b({changes:[...m],currentTool:null})}break}case"text_delta":o+=d.delta??"",b({stageHint:{stage:"analyzing"},summary:e(o)});break;case"error":throw Error(d.message||"AI organize failed")}}}}finally{j.releaseLock()}return{changes:m,summary:e(o),toolCallCount:p}}function k(){let[a,b]=(0,d.useState)("idle"),[c,e]=(0,d.useState)([]),[f,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(null),[k,l]=(0,d.useState)(""),[m,n]=(0,d.useState)(null),[o,p]=(0,d.useState)(0),q=(0,d.useRef)(null),r=(0,d.useRef)(0),s=(0,d.useRef)(new Map),[t,u]=(0,d.useState)([]),v=(0,d.useCallback)(async(a,c)=>{b("organizing"),e([]),g(null),i({stage:"connecting"}),l(""),n(null),p(0),u(a.map(a=>a.name)),s.current=new Map,r.current=Date.now();let d=new AbortController;q.current=d;let f=a.map(a=>({name:a.name,content:a.content.length>2e4?a.content.slice(0,2e4)+"\n\n[...truncated to first ~20000 chars]":a.content}));try{let a=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:c}],uploadedFiles:f,maxSteps:15,mode:"organize"}),signal:d.signal});if(!a.ok){let b=`Request failed (${a.status})`;try{let c=await a.json();"string"==typeof c?.error?b=c.error:"object"==typeof c?.error&&c.error?.message?b=c.error.message:c?.message&&(b=c.message)}catch{}throw Error(b)}if(!a.body)throw Error("No response body");let h=await j(a.body,a=>{r.current=Date.now(),a.changes&&e(a.changes),void 0!==a.currentTool&&g(a.currentTool),a.stageHint&&i(a.stageHint),void 0!==a.summary&&l(a.summary)},(a,b)=>{s.current.set(a,b)},d.signal);e(h.changes),l(h.summary),p(h.toolCallCount),g(null),b("done")}catch(a){"AbortError"===a.name?b("idle"):(n(a.message),b("error"))}finally{q.current=null}},[]),w=(0,d.useCallback)(()=>{q.current?.abort()},[]),x=(0,d.useCallback)(async a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);if(!b)return!1;try{if("create"===b.action){if(!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:b.path})})).ok)return!1}else{if("update"!==b.action)return!1;let c=s.current.get(a);if(!c||!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:b.path,content:c})})).ok)return!1}return e(b=>b.map(b=>b.path===a&&b.ok&&!b.undone?{...b,undone:!0}:b)),!0}catch{return!1}},[c]),y=(0,d.useCallback)(async()=>{let a=c.filter(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),b=0;for(let c of a)try{if("create"===c.action)(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:c.path})})).ok&&b++;else if("update"===c.action){let a=s.current.get(c.path);a&&(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:c.path,content:a})})).ok&&b++}}catch{}return b>0&&e(a=>a.map(a=>!a.ok||a.undone?a:"create"===a.action||"update"===a.action&&s.current.has(a.path)?{...a,undone:!0}:a)),b},[c]),z=(0,d.useCallback)(a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);return!!b&&("create"===b.action||"update"===b.action&&s.current.has(a))},[c]),A=c.some(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),B=(0,d.useCallback)(()=>{b("idle"),e([]),g(null),i(null),l(""),n(null),p(0),u([]),s.current=new Map,r.current=0},[]);return{phase:a,changes:c,currentTool:f,stageHint:h,summary:k,error:m,toolCallCount:o,sourceFileNames:t,snapshots:s,start:v,abort:w,undoOne:x,undoAll:y,canUndo:z,hasAnyUndoable:A,reset:B}}},70377:(a,b,c)=>{"use strict";var d=c(29974);for(let a of[{id:"agent-inspector",name:"Agent Inspector",description:"Visualizes agent tool-call logs as a filterable timeline. Auto-activates on .mindos/agent-audit-log.json and supports legacy .agent-log.json.",author:"MindOS",icon:"\uD83D\uDD0D",tags:["agent","inspector","log","mcp","tools"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/agent-audit-log.json",match:({filePath:a})=>/(^|\/)\.mindos\/agent-audit-log\.json$/i.test(a)||/\.agent-log\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,66535)).then(a=>({default:a.AgentInspectorRenderer}))},{id:"backlinks",name:"Backlinks Explorer",description:"Shows all files that link to the current page via wikilinks or markdown links, with highlighted snippet context.",author:"MindOS",icon:"\uD83D\uDD17",tags:["backlinks","wiki","links","references"],builtin:!0,entryPath:"BACKLINKS.md",match:({filePath:a})=>/\bBACKLINKS\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,78340)).then(a=>({default:a.BacklinksRenderer}))},{id:"config-panel",name:"Config Panel",description:"Renders CONFIG.json as an editable control panel based on uiSchema/keySpecs. Changes are written back to the JSON file directly.",author:"MindOS",icon:"\uD83E\uDDE9",tags:["config","json","settings","schema"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"CONFIG.json",match:({filePath:a,extension:b})=>"json"===b&&/(^|\/)CONFIG\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,72362)).then(a=>({default:a.ConfigRenderer}))},{id:"csv",name:"CSV Views",description:"Renders any CSV file as Table, Gallery, or Board. Each view is independently configurable — choose which columns map to title, description, tag, and group.",author:"MindOS",icon:"\uD83D\uDCCA",tags:["csv","table","gallery","board","data"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"Resources/Products.csv",match:({extension:a,filePath:b})=>"csv"===a&&!/\bTODO\b/i.test(b),load:()=>Promise.resolve().then(c.bind(c,46427)).then(a=>({default:a.CsvRenderer}))},{id:"summary",name:"AI Briefing",description:"Streams an AI-generated daily briefing summarizing your most recently modified files — key changes, recurring themes, and suggested next actions.",author:"MindOS",icon:"✨",tags:["ai","summary","briefing","daily"],builtin:!0,entryPath:"DAILY.md",match:({filePath:a})=>/\b(SUMMARY|summary|Summary|BRIEFING|briefing|Briefing|DAILY|daily|Daily)\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,51488)).then(a=>({default:a.SummaryRenderer}))},{id:"timeline",name:"Timeline",description:"Renders changelog and journal files as a vertical timeline. Any markdown with ## date headings (e.g. ## 2025-01-15) becomes a card in the feed.",author:"MindOS",icon:"\uD83D\uDCC5",tags:["timeline","changelog","journal","history"],builtin:!0,entryPath:"CHANGELOG.md",match:({filePath:a})=>/\b(CHANGELOG|changelog|TIMELINE|timeline|journal|Journal|diary|Diary)\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,6732)).then(a=>({default:a.TimelineRenderer}))},{id:"todo",name:"TODO Board",description:"Renders TODO.md/TODO.csv as an interactive kanban board grouped by section. Check items off directly — changes are written back to the source file.",author:"MindOS",icon:"✅",tags:["productivity","tasks","markdown"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"TODO.md",match:({filePath:a})=>/\bTODO\b.*\.(md|csv)$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,33378)).then(a=>({default:a.TodoRenderer}))},{id:"workflow-yaml",name:"Workflow Runner",description:"Execute step-by-step YAML workflows with Skills & Agent support.",author:"MindOS",icon:"⚡",tags:["workflow","automation","steps","ai","yaml"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/workflows/",match:({extension:a,filePath:b})=>("yaml"===a||"yml"===a)&&/\.flow\.(yaml|yml)$/i.test(b),load:()=>Promise.resolve().then(c.bind(c,2820)).then(a=>({default:a.WorkflowYamlRenderer}))},{id:"graph",name:"Wiki Graph",description:"Force-directed graph of wikilink references across all markdown files. Supports Global and Local (2-hop) scope filters.",author:"MindOS",icon:"\uD83D\uDD78️",tags:["graph","wiki","links","visualization"],builtin:!0,match:()=>!1,load:()=>Promise.resolve().then(c.bind(c,80992)).then(a=>({default:a.GraphRenderer}))}])(0,d.TS)(a)},70567:(a,b,c)=>{Promise.resolve().then(c.bind(c,55038))},72362:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>j});var d=c(48249),e=c(67484),f=c(40560),g=c(42742),h=c(46674),i=c(24520);function j({content:a,saveAction:b}){let c=(0,e.useMemo)(()=>{try{return JSON.parse(a)}catch{return null}},[a]),[j,k]=(0,e.useState)(c),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)({}),t=j??{},u=t.uiSchema?.sections??[],v=t.keySpecs??{},w=(0,e.useCallback)(async a=>{m(!0),o(!1),q("");try{await b(`${JSON.stringify(a,null,2)}
175
+ `,style:{width:B,minWidth:`${n}px`},role:"complementary","aria-label":"MindOS Agent panel",children:[(0,e.jsx)(i.default,{fallback:(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 px-6 text-center",children:[(0,e.jsx)(g.A,{size:20,className:"text-muted-foreground"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"AI panel encountered an error."}),(0,e.jsx)("button",{onClick:()=>window.location.reload(),className:"text-xs px-3 py-1.5 rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Reload page"})]}),children:(0,e.jsx)("div",{className:"flex min-h-0 w-full flex-1 flex-col overflow-hidden",children:(0,e.jsx)(h.A,{visible:a,variant:"panel",currentFile:a?c:void 0,initialMessage:d,initialAcpAgent:k,onFirstMessage:l,onClose:b,askMode:q,onModeSwitch:r,maximized:s,onMaximize:t})})}),(0,e.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:A,children:(0,e.jsx)("div",{className:"absolute left-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/60 transition-opacity"})})]})}d()}catch(a){d(a)}})},63112:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ConfigRenderer() from the server but ConfigRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/config/ConfigRenderer.tsx","ConfigRenderer")},63710:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(99101);async function e(a,b){let c=[],e=0;for(let b of a){if(b.size>0xa00000){e++;continue}try{if(b.name.toLowerCase().endsWith(".pdf")){let a=await b.arrayBuffer();c.push({name:b.name,content:function(a){let b=new Uint8Array(a),c=[];for(let a=0;a<b.length;a+=8192)c.push(String.fromCharCode(...b.subarray(a,a+8192)));return btoa(c.join(""))}(a),encoding:"base64"})}else{let a=await b.text();c.push({name:b.name,content:a})}}catch{}}if(0===c.length)return void(e>0?d.oR.error(b.inbox.tooLarge(e),4e3):a.length>0&&d.oR.error(b.inbox.saveFailed,4e3));try{var f;let a=await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:c})});if(!a.ok){let c=await a.json().catch(()=>({}));console.error("[QuickDrop] Save failed:",c.error),d.oR.error(b.inbox.saveFailed,4e3);return}let g=await a.json(),h=g.saved?.length??0,i=g.skipped?.length??0;f=e,h>0&&f>0&&0===i?d.oR.success(b.inbox.savedWithOversized(h,f),4e3):h>0&&i+f>0?d.oR.success(b.inbox.savedWithSkipped(h,i+f),4e3):h>0?d.oR.success(b.inbox.savedToast(h),3e3):(f>0&&d.oR.error(b.inbox.tooLarge(f),4e3),i>0&&d.oR.error(b.inbox.savedWithSkipped(0,i),4e3),0===f&&0===i&&d.oR.error(b.inbox.saveFailed,4e3)),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated"))}catch(a){console.error("[QuickDrop] Network error:",a),d.oR.error(b.inbox.saveFailed,4e3)}}},63962:(a,b,c)=>{"use strict";c.d(b,{E:()=>e});var d=c(99829);let e=(0,d.createServerReference)("00d25f4f1bd3a1e65fce3bdf79d38cf1f2197e755d",d.callServer,void 0,d.findSourceMapURL,"cleanupExamplesAction")},65141:(a,b,c)=>{"use strict";c.d(b,{b:()=>g});var d=c(67484),e=c(68828),f=c(4615);function g(){let[a,b]=(0,d.useState)("files"),[c,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(!1),[j,k]=(0,d.useState)(!1),l=(0,d.useCallback)(a=>g(a),[]),m=(0,d.useCallback)(a=>{try{localStorage.setItem("left-panel-width",String(a))}catch{}},[]),n=(0,d.useCallback)(()=>i(a=>!a),[]),o=(0,d.useCallback)(a=>{k(a);try{localStorage.setItem("rail-expanded",String(a))}catch{}},[]),p=j?f.we:f.SG,q=c??(a?e.iP[a]:280);return{activePanel:a,setActivePanel:b,panelWidth:c,panelMaximized:h,railExpanded:j,railWidth:p,panelOpen:null!==a,effectivePanelWidth:q,handlePanelWidthChange:l,handlePanelWidthCommit:m,handlePanelMaximize:n,handleExpandedChange:o}}},65607:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>h});var e=c(48249),f=c(46633),g=a([f]);function h({open:a,onClose:b,initialTab:c}){return a?(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-end md:items-start justify-center md:pt-[10vh] modal-backdrop",onClick:a=>a.target===a.currentTarget&&b(),children:(0,e.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Settings",className:"w-full md:max-w-3xl md:mx-4 bg-card border-t md:border border-border rounded-t-2xl md:rounded-xl shadow-2xl flex flex-col h-[88vh] md:h-[80vh] md:max-h-[85vh]",children:(0,e.jsx)(f.A,{visible:a,variant:"modal",onClose:b,initialTab:c})})}):null}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},65965:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>G});var e=c(48249),f=c(67484),g=c(24520),h=c(80600),i=c(33407),j=c(46674),k=c(51161),l=c(74118),m=c(30315),n=c(38957),o=c(54461),p=c(41297),q=c(45108),r=c(15330),s=c(55232),t=c(74356),u=c(28978),v=c(82110),w=c(75539),x=c(37515),y=c(41739),z=c(33827),A=c(74190),B=c(4452),C=c(93574),D=c(33191),E=c(17009),F=a([B]);function G({visible:a,currentFile:b,initialMessage:c,initialAcpAgent:d,onFirstMessage:F,variant:G,onClose:H,maximized:I,onMaximize:J,askMode:K,onModeSwitch:L}){let M="panel"===G,N=(0,f.useRef)(null),O=(0,f.useRef)(null),{t:P}=(0,m.Y)(),[Q,R]=(0,f.useState)(!1),[S,T]=(0,f.useState)(""),U=(0,f.useRef)("");U.current=S;let[V,W]=(0,f.useState)([]),X=(0,f.useRef)(V);X.current=V;let[Y,Z]=(0,f.useState)(!1),[$,_]=(0,f.useState)(!1),[aa,ab]=(0,f.useState)(!1),[ac,ad]=(0,f.useState)(null),ae=(0,f.useRef)(ac);ae.current=ac;let[af,ag]=(0,f.useState)(null),ah=(0,f.useRef)(af);ah.current=af;let[ai,aj]=(0,f.useState)("agent"),[ak,al]=(0,f.useState)(null),am=(0,o.X)(b),an=(0,f.useRef)(am);an.current=am;let ao=(0,p.l)(),ap=(0,f.useRef)(ao);ap.current=ao;let aq=(0,q.u)(),ar=(0,r.Q)(),as=(0,s.C)(),at=(0,E.z)(),au=(0,f.useRef)(aq);au.current=aq;let av=(0,f.useRef)(ar);av.current=ar;let aw=(0,f.useRef)(as);aw.current=as;let ax=(0,f.useCallback)(()=>{T(""),ad(null),ag(null),W(b?[b]:[])},[b]),ay=(0,f.useRef)({inputValueRef:U,mentionRef:av,slashRef:aw,imageUploadRef:au,sessionRef:an,uploadRef:ap,selectedSkillRef:ae,selectedAcpAgentRef:ah,attachedFilesRef:X}),az=(0,C.t)({currentFile:b,chatMode:ai,providerOverride:ak,onFirstMessage:F,refs:ay.current,errorLabels:{noResponse:P.ask.errorNoResponse,stopped:P.ask.stopped},resetInputState:ax}),{isLoading:aA,loadingPhase:aB,reconnectAttempt:aC,reconnectMaxRef:aD}=az,aE=az.submit,aF=az.stop;(0,f.useRef)(!1),(0,f.useRef)(b);let aG=(0,f.useRef)(null),aH=(0,f.useRef)(null),aI=(0,f.useRef)(null),aJ=(0,f.useCallback)((a,b)=>{T(a);let c=b??a.length;aH.current&&clearTimeout(aH.current),aI.current&&clearTimeout(aI.current),aH.current=setTimeout(()=>av.current.updateMentionFromInput(a,c),80),aI.current=setTimeout(()=>aw.current.updateSlashFromInput(a,c),80)},[]),aK=(0,f.useCallback)(a=>{let b=N.current,c=U.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("@"),f=c.slice(0,e)+c.slice(d);T(f),av.current.resetMention(),X.current.includes(a)||W(b=>[...b,a]),setTimeout(()=>{N.current?.focus(),N.current?.setSelectionRange(e,e)},0)},[]),aL=(0,f.useCallback)(a=>{let b=N.current,c=U.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("/"),f=c.slice(0,e)+c.slice(d);T(f),ad(a),aw.current.resetSlash(),setTimeout(()=>{N.current?.focus(),N.current?.setSelectionRange(e,e)},0)},[]),aM=(0,f.useRef)(aK);aM.current=aK;let aN=(0,f.useRef)(aL);aN.current=aL;let aO=(0,f.useCallback)(a=>{let b=av.current,c=aw.current;if(null!==b.mentionQuery){if("Escape"===a.key){a.preventDefault(),b.resetMention();return}if("ArrowDown"===a.key)a.preventDefault(),b.navigateMention("down");else if("ArrowUp"===a.key)a.preventDefault(),b.navigateMention("up");else if("Enter"===a.key||"Tab"===a.key){if("Enter"===a.key&&(a.shiftKey||a.nativeEvent.isComposing))return;b.mentionResults.length>0&&(a.preventDefault(),aM.current(b.mentionResults[b.mentionIndex]))}return}if(null!==c.slashQuery){if("Escape"===a.key){a.preventDefault(),c.resetSlash();return}if("ArrowDown"===a.key)a.preventDefault(),c.navigateSlash("down");else if("ArrowUp"===a.key)a.preventDefault(),c.navigateSlash("up");else if("Enter"===a.key||"Tab"===a.key){if("Enter"===a.key&&(a.shiftKey||a.nativeEvent.isComposing))return;c.slashResults.length>0&&(a.preventDefault(),aN.current(c.slashResults[c.slashIndex]))}return}"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&!az.isLoadingRef.current&&(U.current.trim()||au.current.images.length>0)&&(a.preventDefault(),a.currentTarget.form?.requestSubmit())},[]),aP=(0,f.useCallback)(()=>{az.isLoadingRef.current||(an.current.resetSession(),T(""),W(b?[b]:[]),ap.current.clearAttachments(),au.current.clearImages(),av.current.resetMention(),aw.current.resetSlash(),ad(null),ag(null),Z(!1),setTimeout(()=>N.current?.focus(),0))},[b]),aQ=(0,f.useCallback)(a=>{(a.dataTransfer.types.includes("text/mindos-path")||a.dataTransfer.types.includes("Files"))&&(a.preventDefault(),a.dataTransfer.dropEffect="copy",_(!0))},[]),aR=(0,f.useCallback)(()=>_(!1),[]),aS=(0,f.useCallback)(async a=>{a.preventDefault(),_(!1);let b=a.dataTransfer.getData("text/mindos-path");if(b){let c=a.dataTransfer.getData("text/mindos-type"),d="directory"===c?b.replace(/\/?$/,"/"):b;X.current.includes(d)||W(a=>[...a,d]);return}await au.current.handleDrop(a)},[]),aT=(0,f.useCallback)(a=>{let b=a.clipboardData?.items;!b||Array.from(b).some(a=>"file"===a.kind&&a.type.startsWith("image/"))&&(a.preventDefault(),au.current.handlePaste(a))},[]),aU=(0,f.useCallback)(a=>{an.current.loadSession(a),Z(!1),T(""),W(b?[b]:[]),ap.current.clearAttachments(),au.current.clearImages(),av.current.resetMention(),aw.current.resetSlash(),ad(null),ag(null),setTimeout(()=>N.current?.focus(),0)},[b]),aV=(0,f.useCallback)(()=>Z(a=>!a),[]),aW=(0,f.useMemo)(()=>({connecting:P.ask.connecting,thinking:P.ask.thinking,generating:P.ask.generating,reconnecting:aC>0?P.ask.reconnecting(aC,aD.current):void 0}),[P,aC]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(y.A,{isPanel:M,showHistory:Y,onToggleHistory:aV,onReset:aP,isLoading:aA,maximized:I,onMaximize:J,askMode:K,onModeSwitch:L,onClose:H}),M&&am.sessions.length>0&&(0,e.jsx)(x.A,{sessions:am.sessions,activeSessionId:am.activeSessionId,onLoad:aU,onDelete:am.deleteSession,onNew:aP}),Y&&(0,e.jsx)(w.A,{sessions:am.sessions,activeSessionId:am.activeSessionId,onLoad:aU,onDelete:am.deleteSession,onRename:am.renameSession,onClearAll:am.clearAllSessions,labels:{title:P.ask.sessionHistory??"Session History",clearAll:P.ask.clearAll??"Clear all",confirmClear:P.ask.confirmClear??"Confirm clear?",noSessions:P.ask.noSessions??"No saved sessions.",rename:P.ask.renameSession??"Rename"}}),(0,e.jsx)(t.A,{messages:am.messages,isLoading:aA,loadingPhase:aB,emptyPrompt:P.ask.emptyPrompt,emptyHint:P.ask.emptyHint,suggestions:P.ask.suggestions,onSuggestionClick:T,labels:aW}),null!==ar.mentionQuery&&ar.mentionResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(u.A,{results:ar.mentionResults,selectedIndex:ar.mentionIndex,query:ar.mentionQuery??void 0,onSelect:aK})}),null!==as.slashQuery&&as.slashResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(v.A,{results:as.slashResults,selectedIndex:as.slashIndex,query:as.slashQuery??void 0,onSelect:aL})}),(0,e.jsx)("div",{className:"shrink-0 px-3 pb-2 pt-1",children:(0,e.jsxs)("div",{className:(0,D.cn)("rounded-xl border border-border/60 bg-card shadow-sm transition-shadow",$&&"ring-2 ring-[var(--amber)] bg-[var(--amber-dim)]"),onDragOver:aQ,onDragLeave:aR,onDrop:aS,children:[(V.length>0||ao.localAttachments.length>0||aq.images.length>0||ac||af||ao.uploadError||aq.imageError)&&(0,e.jsxs)("div",{className:(0,D.cn)("px-3 pt-2.5 pb-1",M?"max-h-24 overflow-y-auto":"max-h-28 overflow-y-auto"),children:[(0,e.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[V.map(a=>(0,e.jsx)(z.A,{path:a,variant:"kb",onRemove:()=>W(b=>b.filter(b=>b!==a))},a)),ao.localAttachments.map((a,b)=>(0,e.jsx)(z.A,{path:a.name,variant:"upload",onRemove:()=>ao.removeAttachment(b)},`up-${a.name}-${b}`)),aq.images.map((a,b)=>(0,e.jsx)(z.A,{path:`Image ${b+1}`,variant:"image",imageData:a.data,imageMime:a.mimeType,onRemove:()=>aq.removeImage(b)},`img-${b}`)),ac&&(0,e.jsx)(z.A,{path:ac.name,variant:"skill",onRemove:()=>{ad(null),N.current?.focus()}})]}),(ao.uploadError||aq.imageError)&&(0,e.jsx)("div",{className:"mt-1 text-xs text-error",children:ao.uploadError||aq.imageError})]}),(0,e.jsxs)("form",{ref:aG,onSubmit:aE,className:"flex items-end gap-1 px-1.5 py-1.5",children:[(0,e.jsxs)("div",{className:"relative shrink-0",children:[(0,e.jsx)("button",{type:"button",onClick:()=>ab(a=>!a),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:P.hints.attachFile,children:(0,e.jsx)(g.A,{size:15})}),aa&&(0,e.jsxs)("div",{className:"absolute bottom-full left-0 mb-1 py-1 rounded-lg border border-border bg-card shadow-lg z-50 min-w-[140px]",children:[(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs hover:bg-muted transition-colors text-left",onClick:()=>{ab(!1),ao.uploadInputRef.current?.click()},children:[(0,e.jsx)(h.A,{size:12,className:"shrink-0 text-muted-foreground"}),P.ask.attachFileLabel]}),(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs hover:bg-muted transition-colors text-left",onClick:()=>{ab(!1),O.current?.click()},children:[(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-muted-foreground"}),P.ask.attachImageLabel]})]})]}),(0,e.jsx)("input",{ref:ao.uploadInputRef,type:"file",className:"hidden",multiple:!0,accept:".txt,.md,.markdown,.csv,.json,.yaml,.yml,.xml,.html,.htm,.pdf,text/plain,text/markdown,text/csv,application/json,application/pdf",onChange:async a=>{let b=a.currentTarget;await ao.pickFiles(b.files),b.value=""}}),(0,e.jsx)("input",{ref:O,type:"file",className:"hidden",multiple:!0,accept:"image/png,image/jpeg,image/gif,image/webp",onChange:async a=>{let b=a.currentTarget;await aq.handleFileSelect(b.files),b.value=""}}),(0,e.jsx)("textarea",{ref:a=>{N.current=a},value:S,onChange:a=>aJ(a.target.value,a.target.selectionStart??void 0),onKeyDown:aO,onPaste:aT,placeholder:P.ask.placeholder,rows:1,className:"min-w-0 flex-1 resize-none overflow-y-hidden bg-transparent py-1.5 text-sm leading-snug text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-0"}),aA?(0,e.jsx)("button",{type:"button",onClick:aF,className:"p-1.5 rounded-lg transition-colors shrink-0 text-muted-foreground hover:text-foreground hover:bg-muted/60",title:"reconnecting"===aB?P.ask.cancelReconnect:P.ask.stopTitle,children:"reconnecting"===aB?(0,e.jsx)(j.A,{size:15}):(0,e.jsx)(k.A,{size:15})}):(0,e.jsx)("button",{type:"submit",disabled:!S.trim()&&0===aq.images.length,className:"p-1.5 rounded-lg disabled:opacity-40 disabled:cursor-not-allowed transition-opacity shrink-0 bg-[var(--amber)] text-[var(--amber-foreground)]",children:(0,e.jsx)(l.A,{size:14})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5 px-3 pb-2 pt-0.5 border-t border-border/30",children:[(0,e.jsx)(n.Ay,{mode:ai,onChange:aj,disabled:aA}),Q&&at.installedAgents.length>0&&(0,e.jsx)(A.A,{selectedAgent:af,onSelect:ag,installedAgents:at.installedAgents,loading:at.loading}),Q&&(0,e.jsx)(B.Ay,{value:ak,onChange:al,disabled:aA})]})]})})]})}B=(F.then?(await F)():F)[0],new WeakMap,d()}catch(a){d(a)}})},66535:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>v});var d=c(48249),e=c(67484),f=c(19099),g=c(13576),h=c(22772),i=c(50567),j=c(59347),k=c(10316),l=c(76592),m=c(49681),n=c(8455),o=c(44218);function p(a){return/read|list|get|search/.test(a)?/search/.test(a)?"search":"read":/create/.test(a)?"create":/delete/.test(a)?"delete":/write|update|insert|append/.test(a)?"write":"other"}let q={read:{bg:"rgba(138,180,216,0.10)",text:"#8ab4d8",border:"rgba(138,180,216,0.25)"},write:{bg:"rgba(200,135,58,0.10)",text:"var(--amber)",border:"rgba(200,135,58,0.25)"},create:{bg:"rgba(122,173,128,0.10)",text:"var(--success)",border:"rgba(122,173,128,0.25)"},delete:{bg:"rgba(200,80,80,0.10)",text:"var(--error)",border:"rgba(200,80,80,0.25)"},search:{bg:"rgba(200,160,216,0.10)",text:"#c8a0d8",border:"rgba(200,160,216,0.25)"},other:{bg:"var(--muted)",text:"var(--muted-foreground)",border:"var(--border)"}};function r({kind:a,size:b=13}){return"read"===a?(0,d.jsx)(g.A,{size:b}):"write"===a?(0,d.jsx)(h.A,{size:b}):"create"===a?(0,d.jsx)(i.A,{size:b}):"delete"===a?(0,d.jsx)(j.A,{size:b}):"search"===a?(0,d.jsx)(k.A,{size:b}):(0,d.jsx)(l.A,{size:b})}function s(a){try{return new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return a}}function t({op:a}){var b,c;let g,h,i,j,k=(0,f.useRouter)(),[l,t]=(0,e.useState)(!1),u=p(a.tool),v=q[u],w="string"==typeof(b=a.params).path?b.path:null,x=a.tool.replace("mindos_","");return(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",marginBottom:8},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",cursor:"pointer",userSelect:"none"},onClick:()=>t(a=>!a),children:[(0,d.jsxs)("span",{className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:999,fontSize:"0.68rem",fontWeight:600,background:v.bg,color:v.text,border:`1px solid ${v.border}`,flexShrink:0},children:[(0,d.jsx)(r,{kind:u,size:10}),u]}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.78rem",color:"var(--foreground)",fontWeight:600,flexShrink:0},children:x}),w&&(0,d.jsx)("span",{style:{fontSize:"0.72rem",color:"var(--amber)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},onClick:a=>{a.stopPropagation(),k.push("/view/"+w.split("/").map(encodeURIComponent).join("/"))},title:w,className:"font-display",children:w}),(0,d.jsxs)("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[a.agentName&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.62rem",fontWeight:500,padding:"1px 6px",borderRadius:999,background:"var(--muted)",color:"var(--muted-foreground)",whiteSpace:"nowrap",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis"},title:a.agentName,children:a.agentName.length>30?a.agentName.slice(0,30)+"...":a.agentName}),"ok"===a.result?(0,d.jsx)(m.A,{size:13,style:{color:"var(--success)"}}):(0,d.jsx)(n.A,{size:13,style:{color:"var(--error)"}}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6},title:s(a.ts),children:(c=a.ts,h=Math.floor((g=Date.now()-new Date(c).getTime())/6e4),i=Math.floor(g/36e5),j=Math.floor(g/864e5),h<1?"just now":h<60?`${h}m ago`:i<24?`${i}h ago`:`${j}d ago`)}),(0,d.jsx)(o.A,{size:12,style:{color:"var(--muted-foreground)",transform:l?"rotate(180deg)":"none",transition:"transform .15s"}})]})]}),l&&(0,d.jsxs)("div",{style:{borderTop:"1px solid var(--border)",padding:"10px 14px",background:"var(--background)"},children:[(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8*!!a.message},children:Object.entries(a.params).map(([a,b])=>(0,d.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0,minWidth:80},children:a}),(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--foreground)",wordBreak:"break-all",lineHeight:1.5},children:function(a,b=120){let c="string"==typeof a?a:JSON.stringify(a);return c.length>b?c.slice(0,b)+"…":c}(b)})]},a))}),a.message&&(0,d.jsx)("div",{className:"font-display",style:{marginTop:6,padding:"5px 9px",borderRadius:5,fontSize:"0.72rem",background:"error"===a.result?"rgba(200,80,80,0.08)":"rgba(122,173,128,0.08)",color:"error"===a.result?"var(--error)":"var(--success)",border:`1px solid ${"error"===a.result?"rgba(200,80,80,0.2)":"rgba(122,173,128,0.2)"}`},children:a.message}),a.agentName&&(0,d.jsxs)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.68rem",color:"var(--muted-foreground)"},children:["Agent: ",(0,d.jsx)("span",{style:{color:"var(--foreground)",fontWeight:500},children:a.agentName})]}),(0,d.jsx)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.65rem",color:"var(--muted-foreground)",opacity:.5},children:s(a.ts)})]})]})}let u=["all","write","create","delete","read","search"];function v({content:a}){let[b,c]=(0,e.useState)("all"),f=(0,e.useMemo)(()=>(function(a){try{let b=JSON.parse(a);if(Array.isArray(b.events))return b.events.filter(a=>!!a?.tool&&!!a?.ts).sort((a,b)=>new Date(b.ts).getTime()-new Date(a.ts).getTime())}catch{}return(function(a){let b=[];for(let c of a.split("\n")){let a=c.trim();if(!(!a||a.startsWith("#")||a.startsWith("//")))try{let c=JSON.parse(a);c.tool&&c.ts&&b.push(c)}catch{}}return b})(a).sort((a,b)=>new Date(b.ts).getTime()-new Date(a.ts).getTime())})(a),[a]),g=(0,e.useMemo)(()=>"all"===b?f:f.filter(a=>p(a.tool)===b),[f,b]),h=(0,e.useMemo)(()=>{let a={all:f.length};for(let b of f){let c=p(b.tool);a[c]=(a[c]??0)+1}return a},[f]);return 0===f.length?(0,d.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:12},children:[(0,d.jsx)(l.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,d.jsx)("p",{children:"No agent operations logged yet."}),(0,d.jsxs)("p",{style:{marginTop:6,opacity:.6,fontSize:11},children:["Agent writes appear here from ",(0,d.jsx)("code",{style:{background:"var(--muted)",padding:"1px 5px",borderRadius:4},children:".mindos/agent-audit-log.json"}),"."]})]}):(0,d.jsxs)("div",{style:{maxWidth:760,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:"1.2rem",flexWrap:"wrap"},children:u.map(a=>{let e=h[a]??0;if("all"!==a&&!e)return null;let f="all"!==a?q[a]:void 0,g=b===a;return(0,d.jsxs)("button",{onClick:()=>c(a),className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,fontSize:"0.7rem",cursor:"pointer",border:"none",background:g?f?.bg??"var(--accent)":"var(--muted)",color:g?f?.text??"var(--foreground)":"var(--muted-foreground)",outline:g?`1px solid ${f?.border??"var(--border)"}`:"none",transition:"all .1s"},children:["all"!==a&&(0,d.jsx)(r,{kind:a,size:10}),a," ",(0,d.jsxs)("span",{style:{opacity:.6},children:["(",e,")"]})]},a)})}),(0,d.jsx)("div",{children:g.map((a,b)=>(0,d.jsx)(t,{op:a},b))})]})}},66874:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call BacklinksRenderer() from the server but BacklinksRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/backlinks/BacklinksRenderer.tsx","BacklinksRenderer")},66913:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call AgentInspectorRenderer() from the server but AgentInspectorRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/agent-inspector/AgentInspectorRenderer.tsx","AgentInspectorRenderer")},67809:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(48249),e=c(67484);class f extends e.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,b){console.error("[ErrorBoundary]",a,b.componentStack)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,d.jsx)("div",{className:"flex items-center justify-center min-h-[50vh] px-4",children:(0,d.jsxs)("div",{className:"text-center max-w-md",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Something went wrong"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred."}),(0,d.jsx)("button",{onClick:()=>this.setState({hasError:!1,error:void 0}),className:"px-4 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Try again"})]})}):this.props.children}}},68533:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>e});var d=c(77943);(0,d.registerClientReference)(function(){throw Error("Attempted to call Tooltip() from the server but Tooltip is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","Tooltip"),(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipTrigger() from the server but TooltipTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipTrigger"),(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipContent() from the server but TooltipContent is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipContent");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call TooltipProvider() from the server but TooltipProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/ui/tooltip.tsx","TooltipProvider")},68828:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>z,Ld:()=>y,iP:()=>x,Ay:()=>A});var d=c(48249),e=c(67484),f=c(19099),g=c(24520),h=c(80600),i=c(86718),j=c(7817),k=c(84699),l=c(12417),m=c(24703),n=c(41479),o=c(61075),p=c(59347),q=c(16613),r=c(60907),s=c(4140),t=c(2548),u=c(30315),v=c(99829);v.callServer,v.findSourceMapURL;let w=()=>{},x={files:280,search:280,echo:280,agents:280,discover:280,workflows:280},y=240,z=600;function A({activePanel:a,fileTree:b,onNavigate:c,onOpenSyncSettings:v,railWidth:A=48,panelWidth:B,onWidthChange:C,onWidthCommit:D,maximized:E=!1,onMaximize:F,onImport:G,children:H}){let I=a?x[a]:280,J=E?void 0:B??I,{t:K}=(0,u.Y)(),L=(0,f.useRouter)(),[M,N]=(0,e.useState)(null),O=(0,e.useMemo)(()=>(function a(b,c=0){let d=c;for(let e of b)"directory"===e.type&&(d=Math.max(d,a(e.children??[],c+1)));return d})(b),[b]),[P,Q]=(0,e.useState)(!1),R=(0,e.useRef)(null),S=(0,e.useRef)(null),[T,U]=(0,e.useState)(!1),V=(0,e.useRef)(null),W=(0,e.useRef)(null),X=(0,q.gL)(),[Y,Z]=(0,e.useState)(0),[$,_]=(0,e.useState)(!1),aa=(0,e.useCallback)(()=>{if(!$){_(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[$]),ab=(0,t._)({width:B??I,minWidth:y,maxWidth:z,maxWidthRatio:.45,direction:"right",disabled:E,onResize:C??w,onResizeEnd:D??w});return(0,d.jsxs)("aside",{className:`
176
+ hidden md:flex fixed top-0 h-screen z-30
177
+ flex-col bg-card border-r border-border
178
+ transition-[transform,left,width] duration-200 ease-out
179
+ ${null!==a?"translate-x-0":"-translate-x-full pointer-events-none"}
180
+ `,style:{width:E?`calc(100vw - ${A}px)`:`${J}px`,left:`${A}px`},role:"region","aria-label":a?`${a} panel`:void 0,children:[(0,d.jsxs)("div",{className:`flex flex-col h-full ${"files"===a?"":"hidden"}`,children:[(0,d.jsx)(s.A,{title:K.sidebar.files,children:(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:R,type:"button",onClick:()=>{U(!1),Q(a=>!a)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.new,title:K.sidebar.new,children:(0,d.jsx)(g.A,{size:13})}),P&&(0,d.jsxs)("div",{ref:S,className:"absolute top-full right-0 mt-1 min-w-[152px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Q(!1),L.push("/view/Untitled.md")},children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0"}),K.sidebar.newFile]}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{Q(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,d.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),K.sidebar.newSpace]})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>G?.(),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.importFile,title:K.sidebar.importFile,children:(0,d.jsx)(j.A,{size:13})}),(0,d.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,d.jsx)("button",{onClick:()=>N(a=>Math.max(-1,(a??O)-1)),onDoubleClick:()=>{N(-1),aa()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.collapseLevel,title:$?K.sidebar.collapseLevel:K.sidebar.collapseLevelHint??K.sidebar.collapseLevel,children:(0,d.jsx)(k.A,{size:13})}),(0,d.jsx)("button",{onClick:()=>N(a=>{let b=(a??0)+1;return b>O?null:b}),onDoubleClick:()=>{N(null),aa()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.expandLevel,title:$?K.sidebar.expandLevel:K.sidebar.expandLevelHint??K.sidebar.expandLevel,children:(0,d.jsx)(l.A,{size:13})}),(0,d.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:V,type:"button",onClick:()=>{Q(!1),U(a=>!a)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":K.sidebar.more,title:K.sidebar.more,children:(0,d.jsx)(m.A,{size:13})}),T&&(0,d.jsxs)("div",{ref:W,className:"absolute top-full right-0 mt-1 min-w-[172px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{(0,q.Fo)(!X)},children:[X?(0,d.jsx)(n.A,{size:14,className:"shrink-0"}):(0,d.jsx)(o.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:K.sidebar.showHiddenFiles}),X&&(0,d.jsx)("span",{className:"text-[var(--amber)] text-xs",children:"✓"})]}),(0,d.jsx)("div",{className:"my-1 border-t border-border/50"}),(0,d.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{U(!1),L.push("/trash")},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:K.trash.title}),Y>0&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:Y})]})]})]})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,d.jsx)(q.Ay,{nodes:b,onNavigate:c,maxOpenDepth:M,onImport:G})}),(0,d.jsx)(r.Ay,{collapsed:!1,onOpenSyncSettings:v})]}),H,!E&&C&&(0,d.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:ab,children:(0,d.jsx)("div",{className:"absolute right-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/60 transition-opacity"})})]})}},69593:(a,b,c)=>{"use strict";c.d(b,{Oo:()=>e,dB:()=>k});var d=c(67484);function e(a){let b=a.replace(/<(thinking|reasoning|scratchpad)>[\s\S]*?<\/\1>/gi,"");return(b=b.replace(/<(?:thinking|reasoning|scratchpad)>[\s\S]*$/gi,"")).trim()}let f=new Set(["create_file","write_file","batch_create_files","append_to_file","insert_after_heading","update_section","edit_lines","delete_file","rename_file","move_file","append_csv"]),g=new Set(["read_file","read_lines","search","list_files"]);function h(a,b){return b&&"object"==typeof b?"string"==typeof b.path?b.path:"string"==typeof b.from_path?b.from_path:"batch_create_files"===a&&Array.isArray(b.files)?b.files.map(a=>a.path??"").filter(Boolean).join(", "):"":""}async function i(a){try{let b=await fetch(`/api/file?path=${encodeURIComponent(a)}&op=read_file`);if(!b.ok)return"";return(await b.json()).content??""}catch{return""}}async function j(a,b,c,d){let j=a.getReader(),k=new TextDecoder,l="",m=[],n=new Map,o="",p=0,q=new Set;try{for(;!d?.aborted;){let{done:a,value:d}=await j.read();if(a)break;let u=(l+=k.decode(d,{stream:!0})).split("\n");for(let a of(l=u.pop()??"",u)){let d,j=a.trim();if(!j.startsWith("data:"))continue;let k=j.slice(5).trim();if(!k)continue;try{d=JSON.parse(k)}catch{continue}let l=d.type;switch(l){case"tool_start":{var r,s,t;let a=d.toolName,e=d.toolCallId,j=d.args;p++;let k=(r=l,s=a,t=j,"text_delta"===r?{stage:"analyzing"}:"tool_start"===r&&s?f.has(s)?{stage:"writing",detail:h(s,t)||void 0}:g.has(s)?{stage:"reading",detail:t&&"object"==typeof t&&"path"in t&&"string"==typeof t.path?t.path:void 0}:{stage:"analyzing"}:null);if(k&&b({stageHint:k}),f.has(a)){let d=h(a,j),f="update";"create_file"===a||"batch_create_files"===a?f="create":("delete_file"===a||"rename_file"===a||"move_file"===a)&&(f="unknown"),"update"===f&&d&&!q.has(d)&&(q.add(d),i(d).then(a=>{a&&c(d,a)})),n.set(e,{name:a,path:d,action:f}),b({currentTool:{name:a,path:d}})}break}case"tool_end":{let a=d.toolCallId,c=!!d.isError,e=n.get(a);if(e){if("batch_create_files"===e.name)for(let b of e.path.split(", ").filter(Boolean))m.push({action:e.action,path:b,toolCallId:a,ok:!c});else m.push({action:e.action,path:e.path,toolCallId:a,ok:!c});n.delete(a),b({changes:[...m],currentTool:null})}break}case"text_delta":o+=d.delta??"",b({stageHint:{stage:"analyzing"},summary:e(o)});break;case"error":throw Error(d.message||"AI organize failed")}}}}finally{j.releaseLock()}return{changes:m,summary:e(o),toolCallCount:p}}function k(){let[a,b]=(0,d.useState)("idle"),[c,e]=(0,d.useState)([]),[f,g]=(0,d.useState)(null),[h,i]=(0,d.useState)(null),[k,l]=(0,d.useState)(""),[m,n]=(0,d.useState)(null),[o,p]=(0,d.useState)(0),q=(0,d.useRef)(null),r=(0,d.useRef)(0),s=(0,d.useRef)(new Map),[t,u]=(0,d.useState)([]),v=(0,d.useCallback)(async(a,c)=>{b("organizing"),e([]),g(null),i({stage:"connecting"}),l(""),n(null),p(0),u(a.map(a=>a.name)),s.current=new Map,r.current=Date.now();let d=new AbortController;q.current=d;let f=a.map(a=>({name:a.name,content:a.content.length>2e4?a.content.slice(0,2e4)+"\n\n[...truncated to first ~20000 chars]":a.content}));try{let a=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:c}],uploadedFiles:f,maxSteps:15,mode:"organize"}),signal:d.signal});if(!a.ok){let b=`Request failed (${a.status})`;try{let c=await a.json();"string"==typeof c?.error?b=c.error:"object"==typeof c?.error&&c.error?.message?b=c.error.message:c?.message&&(b=c.message)}catch{}throw Error(b)}if(!a.body)throw Error("No response body");let h=await j(a.body,a=>{r.current=Date.now(),a.changes&&e(a.changes),void 0!==a.currentTool&&g(a.currentTool),a.stageHint&&i(a.stageHint),void 0!==a.summary&&l(a.summary)},(a,b)=>{s.current.set(a,b)},d.signal);e(h.changes),l(h.summary),p(h.toolCallCount),g(null),b("done")}catch(a){"AbortError"===a.name?b("idle"):(n(a.message),b("error"))}finally{q.current=null}},[]),w=(0,d.useCallback)(()=>{q.current?.abort()},[]),x=(0,d.useCallback)(async a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);if(!b)return!1;try{if("create"===b.action){if(!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:b.path})})).ok)return!1}else{if("update"!==b.action)return!1;let c=s.current.get(a);if(!c||!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:b.path,content:c})})).ok)return!1}return e(b=>b.map(b=>b.path===a&&b.ok&&!b.undone?{...b,undone:!0}:b)),!0}catch{return!1}},[c]),y=(0,d.useCallback)(async()=>{let a=c.filter(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),b=0;for(let c of a)try{if("create"===c.action)(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:c.path})})).ok&&b++;else if("update"===c.action){let a=s.current.get(c.path);a&&(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:c.path,content:a})})).ok&&b++}}catch{}return b>0&&e(a=>a.map(a=>!a.ok||a.undone?a:"create"===a.action||"update"===a.action&&s.current.has(a.path)?{...a,undone:!0}:a)),b},[c]),z=(0,d.useCallback)(a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);return!!b&&("create"===b.action||"update"===b.action&&s.current.has(a))},[c]),A=c.some(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),B=(0,d.useCallback)(()=>{b("idle"),e([]),g(null),i(null),l(""),n(null),p(0),u([]),s.current=new Map,r.current=0},[]);return{phase:a,changes:c,currentTool:f,stageHint:h,summary:k,error:m,toolCallCount:o,sourceFileNames:t,snapshots:s,start:v,abort:w,undoOne:x,undoAll:y,canUndo:z,hasAnyUndoable:A,reset:B}}},70377:(a,b,c)=>{"use strict";var d=c(29974);for(let a of[{id:"agent-inspector",name:"Agent Inspector",description:"Visualizes agent tool-call logs as a filterable timeline. Auto-activates on .mindos/agent-audit-log.json and supports legacy .agent-log.json.",author:"MindOS",icon:"\uD83D\uDD0D",tags:["agent","inspector","log","mcp","tools"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/agent-audit-log.json",match:({filePath:a})=>/(^|\/)\.mindos\/agent-audit-log\.json$/i.test(a)||/\.agent-log\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,66535)).then(a=>({default:a.AgentInspectorRenderer}))},{id:"backlinks",name:"Backlinks Explorer",description:"Shows all files that link to the current page via wikilinks or markdown links, with highlighted snippet context.",author:"MindOS",icon:"\uD83D\uDD17",tags:["backlinks","wiki","links","references"],builtin:!0,entryPath:"BACKLINKS.md",match:({filePath:a})=>/\bBACKLINKS\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,78340)).then(a=>({default:a.BacklinksRenderer}))},{id:"config-panel",name:"Config Panel",description:"Renders CONFIG.json as an editable control panel based on uiSchema/keySpecs. Changes are written back to the JSON file directly.",author:"MindOS",icon:"\uD83E\uDDE9",tags:["config","json","settings","schema"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"CONFIG.json",match:({filePath:a,extension:b})=>"json"===b&&/(^|\/)CONFIG\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,72362)).then(a=>({default:a.ConfigRenderer}))},{id:"csv",name:"CSV Views",description:"Renders any CSV file as Table, Gallery, or Board. Each view is independently configurable — choose which columns map to title, description, tag, and group.",author:"MindOS",icon:"\uD83D\uDCCA",tags:["csv","table","gallery","board","data"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"Resources/Products.csv",match:({extension:a,filePath:b})=>"csv"===a&&!/\bTODO\b/i.test(b),load:()=>Promise.resolve().then(c.bind(c,46427)).then(a=>({default:a.CsvRenderer}))},{id:"summary",name:"AI Briefing",description:"Streams an AI-generated daily briefing summarizing your most recently modified files — key changes, recurring themes, and suggested next actions.",author:"MindOS",icon:"✨",tags:["ai","summary","briefing","daily"],builtin:!0,entryPath:"DAILY.md",match:({filePath:a})=>/\b(SUMMARY|summary|Summary|BRIEFING|briefing|Briefing|DAILY|daily|Daily)\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,51488)).then(a=>({default:a.SummaryRenderer}))},{id:"timeline",name:"Timeline",description:"Renders changelog and journal files as a vertical timeline. Any markdown with ## date headings (e.g. ## 2025-01-15) becomes a card in the feed.",author:"MindOS",icon:"\uD83D\uDCC5",tags:["timeline","changelog","journal","history"],builtin:!0,entryPath:"CHANGELOG.md",match:({filePath:a})=>/\b(CHANGELOG|changelog|TIMELINE|timeline|journal|Journal|diary|Diary)\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,6732)).then(a=>({default:a.TimelineRenderer}))},{id:"todo",name:"TODO Board",description:"Renders TODO.md/TODO.csv as an interactive kanban board grouped by section. Check items off directly — changes are written back to the source file.",author:"MindOS",icon:"✅",tags:["productivity","tasks","markdown"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"TODO.md",match:({filePath:a})=>/\bTODO\b.*\.(md|csv)$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,33378)).then(a=>({default:a.TodoRenderer}))},{id:"workflow-yaml",name:"Workflow Runner",description:"Execute step-by-step YAML workflows with Skills & Agent support.",author:"MindOS",icon:"⚡",tags:["workflow","automation","steps","ai","yaml"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/workflows/",match:({extension:a,filePath:b})=>("yaml"===a||"yml"===a)&&/\.flow\.(yaml|yml)$/i.test(b),load:()=>Promise.resolve().then(c.bind(c,2820)).then(a=>({default:a.WorkflowYamlRenderer}))},{id:"graph",name:"Wiki Graph",description:"Force-directed graph of wikilink references across all markdown files. Supports Global and Local (2-hop) scope filters.",author:"MindOS",icon:"\uD83D\uDD78️",tags:["graph","wiki","links","visualization"],builtin:!0,match:()=>!1,load:()=>Promise.resolve().then(c.bind(c,80992)).then(a=>({default:a.GraphRenderer}))}])(0,d.TS)(a)},70567:(a,b,c)=>{Promise.resolve().then(c.bind(c,55038))},72362:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>j});var d=c(48249),e=c(67484),f=c(40560),g=c(42742),h=c(46674),i=c(24520);function j({content:a,saveAction:b}){let c=(0,e.useMemo)(()=>{try{return JSON.parse(a)}catch{return null}},[a]),[j,k]=(0,e.useState)(c),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)({}),t=j??{},u=t.uiSchema?.sections??[],v=t.keySpecs??{},w=(0,e.useCallback)(async a=>{m(!0),o(!1),q("");try{await b(`${JSON.stringify(a,null,2)}
172
181
  `),o(!0),setTimeout(()=>o(!1),1200)}catch(a){q(a instanceof Error?a.message:"Failed to save")}finally{m(!1)}},[b]),x=(0,e.useCallback)(async(a,b)=>{if(!j)return;let c=function(a,b,c){let d=b.split("."),e=structuredClone(a),f=e;for(let a=0;a<d.length-1;a++){let b=d[a],c=f[b];(!c||"object"!=typeof c||Array.isArray(c))&&(f[b]={}),f=f[b]}return f[d[d.length-1]]=c,e}(j,a,b);k(c),await w(c)},[j,w]);return c&&j?(0,d.jsxs)("div",{className:"max-w-3xl mx-auto flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-2.5",children:[(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:"CONFIG Control Panel"}),(0,d.jsxs)("div",{className:"text-xs flex items-center gap-2",children:[l&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,d.jsx)(f.A,{size:12,className:"animate-spin"}),"Saving"]}),!l&&n&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",style:{color:"var(--success)"},children:[(0,d.jsx)(g.A,{size:12}),"Saved"]})]})]}),p&&(0,d.jsx)("div",{className:"rounded-lg border border-error/30 bg-error/10 px-3 py-2 text-xs text-error",children:p}),u.map(a=>(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4",children:[(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:a.title}),a.description&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:a.description})]}),(0,d.jsx)("div",{className:"space-y-3",children:a.fields.map(a=>{let b=v[a]??{},c=function(a,b){let c=b.split("."),d=a;for(let a of c){if(!d||"object"!=typeof d||!(a in d))return null;d=d[a]}return d}(j,a),e=b.label||a;return(0,d.jsxs)("div",{className:"rounded-lg border border-border/80 bg-background px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-1.5",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-sm text-foreground",children:e}),b.description&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:b.description})]}),"switch"===b.control&&"boolean"==typeof c&&(0,d.jsx)("button",{type:"button",onClick:()=>x(a,!c),className:"px-2.5 py-1 rounded-md text-xs font-medium",style:{background:c?"var(--amber)":"var(--muted)",color:c?"var(--amber-foreground)":"var(--muted-foreground)"},children:c?"ON":"OFF"})]}),"text"===b.control&&"string"==typeof c&&(0,d.jsx)("input",{defaultValue:c,onBlur:b=>x(a,b.target.value),className:"w-full px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground"}),"number"===b.control&&"number"==typeof c&&(0,d.jsx)("input",{type:"number",defaultValue:c,min:b.constraints?.min,max:b.constraints?.max,onBlur:d=>{let e=Number(d.target.value),f=b.constraints?.min,g=b.constraints?.max,h=Number.isFinite(e)?e:c;"number"==typeof f&&h<f&&(h=f),"number"==typeof g&&h>g&&(h=g),x(a,h)},className:"w-full px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground"}),"tag-list"===b.control&&Array.isArray(c)&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.map((b,e)=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded border border-border text-xs bg-muted text-foreground",children:[String(b),(0,d.jsx)("button",{type:"button",onClick:()=>x(a,c.filter((a,b)=>b!==e)),className:"text-muted-foreground hover:text-foreground",children:(0,d.jsx)(h.A,{size:11})})]},`${String(b)}-${e}`))}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{value:r[a]??"",onChange:b=>s(c=>({...c,[a]:b.target.value})),onKeyDown:b=>{if("Enter"!==b.key)return;b.preventDefault();let d=(r[a]??"").trim();d&&(x(a,[...c,d]),s(b=>({...b,[a]:""})))},className:"flex-1 px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground",placeholder:"Add item"}),(0,d.jsxs)("button",{type:"button",onClick:()=>{let b=(r[a]??"").trim();b&&(x(a,[...c,b]),s(b=>({...b,[a]:""})))},className:"px-2.5 py-1.5 rounded-md text-xs bg-muted text-foreground inline-flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:12})," Add"]})]})]})]},a)})})]},a.id))]}):(0,d.jsx)("div",{className:"rounded-xl border border-border p-4 text-sm text-error",children:"CONFIG.json parse failed. Please check JSON format."})}},73778:(a,b,c)=>{"use strict";c.d(b,{A:()=>m});var d=c(48249),e=c(2116),f=c.n(e),g=c(67484),h=c(19099),i=c(96286),j=c(46674),k=c(95054),l=c(30315);function m(){let[a,b]=(0,g.useState)(0),[c,e]=(0,g.useState)(null),[m,n]=(0,g.useState)(!1);(0,g.useRef)(0);let[o,p]=(0,g.useState)(!1),[q,r]=(0,g.useState)(!1),s=(0,h.usePathname)(),{t}=(0,l.Y)();async function u(){try{await (0,k.n)("/api/changes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"mark_seen"})})}catch{}finally{b(0),e(0)}}return((0,g.useMemo)(()=>!(a<=0||s?.startsWith("/changes"))&&(null===c||!(a<=c))&&!m,[c,s,a,m]),o)?(0,d.jsx)("div",{className:`fixed right-3 top-[60px] md:right-6 md:top-4 z-30 transition-all duration-150 ease-out ${q?"opacity-100 translate-y-0 scale-100":"opacity-0 -translate-y-2 scale-[0.98] pointer-events-none"}`,children:(0,d.jsx)("div",{className:"rounded-2xl border bg-card/95 backdrop-blur px-3 py-2.5 shadow-lg min-w-[260px] max-w-[350px]",style:{borderColor:"color-mix(in srgb, var(--amber) 45%, var(--border))",boxShadow:"0 12px 28px color-mix(in srgb, var(--amber) 14%, rgba(0,0,0,.24))"},children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-[var(--amber)] bg-[var(--amber-subtle)]",children:(0,d.jsx)(i.A,{size:14})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-xs text-foreground font-display whitespace-nowrap",children:t.changes.unreadBanner(a)}),(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-1.5",children:[(0,d.jsx)(f(),{href:"/changes",className:"inline-flex items-center rounded-md px-2.5 py-1 text-xs font-medium bg-[var(--amber)] text-white focus-visible:ring-2 focus-visible:ring-ring hover:opacity-90",children:t.changes.reviewNow}),(0,d.jsx)("button",{type:"button",onClick:()=>void u(),className:"inline-flex items-center rounded-md px-2 py-1 text-xs font-medium bg-muted text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:t.changes.markAllRead})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>e(a),"aria-label":t.changes.dismiss,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring",children:(0,d.jsx)(j.A,{size:14})})]})})}):null}},74190:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(74429),g=c(65255),h=c(42742),i=c(46674),j=c(44218),k=c(30315);function l({selectedAgent:a,onSelect:b,installedAgents:c,loading:l=!1}){let{t:m}=(0,k.Y)(),n=m.panels.agents,[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(null),u=(0,e.useCallback)(()=>{b(null),p(!1)},[b]),v=(0,e.useCallback)(a=>{b({id:a.id,name:a.name}),p(!1)},[b]),w=(0,e.useCallback)(a=>{a.stopPropagation(),b(null)},[b]),x=!a,y=a?.name??n.acpDefaultAgent;if(!l&&0===c.length&&!a)return null;let z=o&&q?(0,d.jsxs)("div",{ref:t,role:"listbox","aria-label":n.acpSelectAgent,className:"fixed z-50 min-w-[180px] max-w-[240px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:q.left,..."up"===q.direction?{bottom:window.innerHeight-q.top}:{top:q.top}},children:[(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":x,onClick:u,className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-left transition-colors hover:bg-muted",children:[(0,d.jsx)(g.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"flex-1 truncate font-medium",children:n.acpDefaultAgent}),x&&(0,d.jsx)(h.A,{size:11,className:"shrink-0 text-[var(--amber)]"})]}),c.length>0&&(0,d.jsx)("div",{className:"mx-2 my-1 border-t border-border/60"}),c.map(b=>{let c=a?.id===b.id;return(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":c,onClick:()=>v(b),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-left transition-colors hover:bg-muted",children:[(0,d.jsx)("span",{className:"w-2 h-2 rounded-full bg-[var(--success)] shrink-0"}),(0,d.jsx)("span",{className:"flex-1 truncate",children:b.name}),c&&(0,d.jsx)(h.A,{size:11,className:"shrink-0 text-[var(--amber)]"})]},b.id)})]}):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{ref:s,type:"button",onClick:()=>p(a=>!a),className:`
173
182
  inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
174
183
  text-2xs font-medium transition-colors
175
184
  border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
176
185
  ${x?"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground":"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15"}
177
- `,title:n.acpChangeAgent,"aria-expanded":o,"aria-haspopup":"listbox",children:[x?(0,d.jsx)(g.A,{size:11,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--success)] shrink-0"}),(0,d.jsx)("span",{className:"truncate max-w-[120px]",children:y}),a?(0,d.jsx)("span",{role:"button",tabIndex:0,onClick:w,onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),w(a))},className:"p-0.5 -mr-1 rounded-full text-muted-foreground hover:text-foreground transition-colors","aria-label":`Remove ${a.name}`,children:(0,d.jsx)(i.A,{size:9})}):(0,d.jsx)(j.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&z&&(0,f.createPortal)(z,document.body)]})}},74356:(a,b,c)=>{"use strict";c.d(b,{A:()=>Y});var d=c(48249),e=c(67484),f=c(42742),g=c(15273),h=c(95801),i=c(40560),j=c(145),k=c(6079),l=c(8455),m=c(75157),n=c(96348),o=c(92023),p=c(36815),q=c(69593),r=c(39868),s=c(10316),t=c(7309),u=c(35654),v=c(12625),w=c(50567),x=c(80600),y=c(93017),z=c(59347),A=c(62688),B=c(11035),C=c(96286),D=c(13576),E=c(83654),F=c(44218),G=c(19794),H=c(31675),I=c(49681),J=c(2797);let K=new Set(["delete_file","move_file","rename_file","write_file"]),L=new Set(["write_file","create_file","update_section","insert_after_heading","edit_lines","append_to_file"]),M={search:s.A,list_files:t.A,read_file:u.A,write_file:v.A,create_file:w.A,append_to_file:x.A,insert_after_heading:y.A,update_section:v.A,delete_file:z.A,rename_file:x.A,move_file:A.A,get_backlinks:B.A,get_history:C.A,get_file_at_version:C.A,get_recent:D.A,append_csv:E.A},N="--- changes ---";function O({part:a}){let b=L.has(a.toolName),c="done"===a.state,[f,g]=(0,e.useState)(null),h=f??(b&&c),k=M[a.toolName]??j.A,l=K.has(a.toolName),m=(0,e.useMemo)(()=>(function(a){if(!a)return{header:"",stats:"",diffLines:[]};let b=a.indexOf(N);if(-1===b)return{header:a,stats:"",diffLines:[]};let c=a.slice(0,b).trim(),d=a.slice(b+N.length).trim(),e=c.match(/\((\+\d+\s*−\d+)\)/);return{header:c,stats:e?e[1]:"",diffLines:d.split("\n").map(a=>a.startsWith("+ ")?{prefix:"+",text:a.slice(2)}:a.startsWith("- ")?{prefix:"-",text:a.slice(2)}:a.startsWith(" ")?{prefix:" ",text:a.slice(2)}:{prefix:" ",text:a})}})(a.output),[a.output]),n=(0,e.useMemo)(()=>a.input&&"object"==typeof a.input?a.input.path??"":"",[a.input]),o=n?`${n.split("/").pop()??n}${m.stats?` (${m.stats})`:""}`:function(a){if(!a||"object"!=typeof a)return String(a??"");let b=[];for(let c of Object.values(a))"string"==typeof c?b.push(c.length>60?`${c.slice(0,60)}…`:c):Array.isArray(c)?b.push(`[${c.length} items]`):null!=c&&b.push(String(c));return b.join(", ")}(a.input);return(0,d.jsxs)("div",{className:`my-1 rounded-md border text-xs font-mono ${l?"border-[var(--amber)]/30 bg-background/60":"border-border/50 bg-background/60"}`,children:[(0,d.jsxs)("button",{type:"button",onClick:()=>g(a=>null===a?!h:!a),className:"w-full flex items-center gap-1.5 px-2 py-1.5 text-left hover:bg-muted/30 transition-colors rounded-md",children:[h?(0,d.jsx)(F.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(G.A,{size:12,className:"shrink-0 text-muted-foreground"}),l&&(0,d.jsx)(H.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)(k,{size:12,className:`shrink-0 ${l?"text-[var(--amber)]":"text-muted-foreground"}`}),(0,d.jsx)("span",{className:`font-medium ${l?"text-[var(--amber)]":"text-foreground"}`,children:a.toolName}),(0,d.jsx)("span",{className:"text-muted-foreground truncate flex-1",children:o}),(0,d.jsx)("span",{className:"shrink-0 ml-auto",children:"pending"===a.state||"running"===a.state?(0,d.jsx)(i.A,{size:12,className:"animate-spin text-[var(--amber)]"}):"done"===a.state?(0,d.jsx)(I.A,{size:12,className:"text-success"}):(0,d.jsx)(J.A,{size:12,className:"text-error"})})]}),h&&(0,d.jsx)("div",{className:"border-t border-border/30",children:b&&c&&m.diffLines.length>0?(0,d.jsx)("div",{className:"max-h-64 overflow-y-auto",children:m.diffLines.map((a,b)=>(0,d.jsxs)("div",{className:`px-2 py-px flex items-start gap-1.5 ${"+"===a.prefix?"bg-success/8":"-"===a.prefix?"bg-error/8":""}`,children:[(0,d.jsx)("span",{className:`select-none w-3 shrink-0 text-right ${"+"===a.prefix?"text-success":"-"===a.prefix?"text-error":"text-muted-foreground/50"}`,children:a.prefix}),(0,d.jsx)("span",{className:`whitespace-pre-wrap break-all flex-1 ${"+"===a.prefix?"text-success":"-"===a.prefix?"text-error":"text-muted-foreground"}`,children:a.text||"\xa0"})]},b))}):(0,d.jsxs)("div",{className:"px-2 pb-2 pt-1 space-y-1",children:["running"===a.state&&(0,d.jsxs)("div",{className:"text-muted-foreground/60 text-2xs flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:10,className:"animate-spin"})," Running..."]}),(0,d.jsxs)("div",{className:"text-muted-foreground",children:[(0,d.jsx)("span",{className:"font-semibold",children:"Input: "}),(0,d.jsx)("span",{className:"break-all whitespace-pre-wrap",children:JSON.stringify(a.input,null,2)})]}),void 0!==a.output&&""!==a.output&&(0,d.jsxs)("div",{className:"text-muted-foreground",children:[(0,d.jsx)("span",{className:"font-semibold",children:"Output: "}),(0,d.jsx)("span",{className:"break-all whitespace-pre-wrap",children:a.output.length>500?a.output.slice(0,500)+"…":a.output})]})]})})]})}var P=c(46218),Q=c(30315);function R({text:a,isStreaming:b}){let[c,f]=(0,e.useState)(!1),{t:g}=(0,Q.Y)();return a||b?(0,d.jsxs)("div",{className:"my-1 rounded-md border border-border/40 bg-muted/20 text-xs",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a=>!a),className:"w-full flex items-center gap-1.5 px-2 py-1.5 text-left hover:bg-muted/30 transition-colors rounded-md",children:[c?(0,d.jsx)(F.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(G.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsx)(P.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsxs)("span",{className:"text-muted-foreground font-medium",children:[g.ask.thinkingLabel,b&&!c&&(0,d.jsx)("span",{className:"ml-1 animate-pulse",children:"..."})]}),!c&&a&&(0,d.jsxs)("span",{className:"text-muted-foreground/60 truncate flex-1 ml-1",children:[a.slice(0,80),a.length>80?"...":""]})]}),c&&(0,d.jsx)("div",{className:"px-2 pb-2 pt-0.5 border-t border-border/30",children:(0,d.jsxs)("div",{className:"text-muted-foreground whitespace-pre-wrap leading-relaxed",children:[a,b&&(0,d.jsx)("span",{className:"inline-block w-1 h-3 bg-muted-foreground/40 ml-0.5 align-middle animate-pulse rounded-sm"})]})})]}):null}let S=/^Use the skill ([^:]+):\s*/;function T({text:a}){let[b,c]=(0,e.useState)(!1),h=(0,e.useCallback)(()=>{(0,r.l)(a).then(a=>{a&&(c(!0),setTimeout(()=>c(!1),2e3))})},[a]);return(0,d.jsx)("button",{type:"button",onClick:h,className:"absolute -bottom-1 right-1 p-1 rounded-md bg-card border border-border/60 shadow-sm text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy",children:b?(0,d.jsx)(f.A,{size:11,className:"text-success"}):(0,d.jsx)(g.A,{size:11})})}function U({content:a,skillName:b,images:c}){let e=b??a.match(S)?.[1],f=a.match(S),g=f?a.slice(f[0].length):a;return(0,d.jsxs)(d.Fragment,{children:[c&&c.length>0&&(0,d.jsx)("div",{className:`flex flex-wrap gap-1.5${a?" mb-2":""}`,children:c.map((a,b)=>a.data?(0,d.jsx)("img",{src:`data:${a.mimeType};base64,${a.data}`,alt:`Image ${b+1}`,className:"max-h-48 max-w-full rounded-md object-contain"},b):(0,d.jsx)("div",{className:"h-12 px-3 rounded-md bg-muted flex items-center gap-1.5 text-xs text-muted-foreground",children:(0,d.jsxs)("span",{children:["[Image ",b+1,"]"]})},b))}),e&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[11px] font-medium bg-[var(--amber)]/15 text-[var(--amber)] mr-1 align-middle",children:[(0,d.jsx)(h.A,{size:10,className:"shrink-0"}),e]}),e?g:a]})}function V({content:a,isStreaming:b}){let c=(0,q.Oo)(a);return c||b?(0,d.jsxs)("div",{className:"prose prose-sm prose-panel dark:prose-invert max-w-none text-foreground prose-p:my-2 prose-p:leading-relaxed prose-headings:font-semibold prose-headings:my-3 prose-h1:text-base prose-h2:text-[15px] prose-h3:text-sm prose-ul:my-1.5 prose-li:my-0.5 prose-ol:my-1.5 prose-code:text-[0.8em] prose-code:bg-background/60 prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none prose-pre:bg-background/60 prose-pre:text-foreground prose-pre:text-xs prose-blockquote:border-l-[var(--amber)] prose-blockquote:text-muted-foreground prose-a:text-[var(--amber)] prose-a:no-underline hover:prose-a:underline prose-strong:text-foreground prose-strong:font-semibold prose-table:text-xs prose-th:py-1 prose-td:py-1 ",children:[(0,d.jsx)(o.oz,{remarkPlugins:[p.A],children:c}),b&&(0,d.jsx)("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--amber)] ml-0.5 align-middle animate-pulse rounded-sm"})]}):null}function W({message:a,isStreaming:b}){let c=a.parts;if(!c||0===c.length)return a.content?(0,d.jsx)(V,{content:a.content,isStreaming:b}):null;let e=c[c.length-1],f=b&&"tool-call"===e.type&&("running"===e.state||"pending"===e.state);return(0,d.jsxs)("div",{children:[c.map((a,e)=>{if("reasoning"===a.type){let f=b&&e===c.length-1;return(0,d.jsx)(R,{text:a.text,isStreaming:f},`reasoning-${e}`)}if("text"===a.type){let f=b&&e===c.length-1;return a.text?(0,d.jsx)(V,{content:a.text,isStreaming:f},e):null}return"tool-call"===a.type?(0,d.jsx)(O,{part:a},a.toolCallId):null}),f&&(0,d.jsxs)("div",{className:"flex items-center gap-2 py-1 mt-1",children:[(0,d.jsx)(i.A,{size:12,className:"animate-spin text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"Executing tool…"})]})]})}function X({parts:a}){if(!a)return null;let b=a.filter(a=>"tool-call"===a.type);if(0===b.length)return null;let c=b[b.length-1],e="tool-call"===c.type?c.toolName:"";return(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5 text-xs text-muted-foreground/70",children:[(0,d.jsx)(j.A,{size:10}),(0,d.jsxs)("span",{children:["Step ",b.length,e?` — ${e}`:""]})]})}let Y=(0,e.memo)(function({messages:a,isLoading:b,loadingPhase:c,emptyPrompt:f,emptyHint:g,suggestions:h,onSuggestionClick:j,labels:o}){let p=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,t]=(0,e.useState)(!1),u=(0,e.useCallback)(()=>{p.current?.scrollIntoView({behavior:"smooth"})},[]);return(0,d.jsxs)("div",{ref:r,className:"relative flex-1 overflow-y-auto overflow-x-hidden px-4 py-4 space-y-4 min-h-0",children:[0===a.length&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1 min-h-[200px] px-4",children:[(0,d.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[var(--amber)]/10 flex items-center justify-center mb-4",children:(0,d.jsx)(k.A,{size:20,className:"text-[var(--amber)]"})}),(0,d.jsx)("p",{className:"text-center text-sm font-medium text-foreground/80 mb-1",children:f}),g&&(0,d.jsx)("p",{className:"text-center text-[11px] text-muted-foreground/50 mb-5",children:g}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 max-w-sm w-full",children:h.map((a,b)=>(0,d.jsx)("button",{type:"button",onClick:()=>j(a),className:"text-left text-xs px-3 py-2.5 rounded-lg border border-border/60 bg-card text-muted-foreground hover:text-foreground hover:border-[var(--amber)]/30 hover:bg-[var(--amber)]/5 transition-colors leading-snug",children:a},b))})]}),a.map((e,f)=>(0,d.jsxs)("div",{className:`flex gap-3 ${"user"===e.role?"justify-end":"justify-start"}`,children:["assistant"===e.role&&(0,d.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center shrink-0 mt-0.5 bg-[var(--amber-dim)]",children:(0,d.jsx)(k.A,{size:12,className:"text-[var(--amber)]"})}),"user"===e.role?(0,d.jsx)("div",{className:"max-w-[85%] px-3 py-2 rounded-xl rounded-br-sm text-sm leading-relaxed whitespace-pre-wrap bg-[var(--amber)] text-[var(--amber-foreground)]",children:(0,d.jsx)(U,{content:e.content,skillName:e.skillName,images:e.images})}):e.content.startsWith("__error__")?(0,d.jsx)("div",{className:"max-w-[85%] px-3 py-2.5 rounded-xl rounded-bl-sm border border-error/20 bg-error/8 text-sm",children:(0,d.jsxs)("div",{className:"flex items-start gap-2 text-error",children:[(0,d.jsx)(l.A,{size:14,className:"shrink-0 mt-0.5"}),(0,d.jsx)("span",{className:"leading-relaxed",children:e.content.slice(9)})]})}):(0,d.jsx)("div",{className:"group relative max-w-[85%] px-3 py-2 rounded-xl rounded-bl-sm bg-muted text-foreground text-sm",children:e.parts&&e.parts.length>0||(0,q.Oo)(e.content)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(W,{message:e,isStreaming:b&&f===a.length-1}),b&&f===a.length-1&&(0,d.jsx)(X,{parts:e.parts}),!(b&&f===a.length-1)&&(0,q.Oo)(e.content)&&(0,d.jsx)(T,{text:(0,q.Oo)(e.content)})]}):b&&f===a.length-1?(0,d.jsxs)("div",{className:"flex items-center gap-2 py-1",children:["reconnecting"===c?(0,d.jsx)(m.A,{size:14,className:"text-[var(--amber)] animate-pulse"}):(0,d.jsx)(i.A,{size:14,className:"animate-spin text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"reconnecting"===c?o.reconnecting??"Reconnecting...":"connecting"===c?o.connecting:"thinking"===c?o.thinking:o.generating})]}):null})]},f)),(0,d.jsx)("div",{ref:p}),s&&a.length>0&&(0,d.jsx)("button",{type:"button",onClick:u,className:"sticky bottom-2 left-1/2 -translate-x-1/2 z-10 p-1.5 rounded-full border border-border/60 bg-card shadow-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"Scroll to bottom",children:(0,d.jsx)(n.A,{size:14})})]})})},75539:(a,b,c)=>{"use strict";c.d(b,{A:()=>i});var d=c(48249),e=c(67484),f=c(12625),g=c(59347),h=c(54461);function i({sessions:a,activeSessionId:b,onLoad:c,onDelete:i,onRename:j,onClearAll:k,labels:l}){let[m,n]=(0,e.useState)(!1),o=(0,e.useRef)(void 0),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(""),t=(0,e.useRef)(null),u=(0,e.useCallback)(a=>{q(a.id),s((0,h.d)(a))},[]),v=(0,e.useCallback)(()=>{p&&(j(p,r),q(null))},[p,r,j]),w=(0,e.useCallback)(()=>{q(null)},[]);return(0,d.jsxs)("div",{className:"border-b border-border px-4 py-2.5 max-h-[190px] overflow-y-auto",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l.title}),a.length>1&&(0,d.jsx)("button",{type:"button",onClick:()=>{if(!m){n(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>n(!1),3e3);return}o.current&&clearTimeout(o.current),k(),n(!1)},className:`text-2xs px-1.5 py-0.5 rounded transition-colors ${m?"bg-error/10 text-error font-medium":"text-muted-foreground hover:text-error hover:bg-muted"}`,children:m?l.confirmClear:l.clearAll})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[0===a.length&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground/70",children:l.noSessions}),a.map(a=>(0,d.jsxs)("div",{className:"group flex items-center gap-1",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>c(a.id),onDoubleClick:()=>u(a),className:`flex-1 text-left px-2 py-1.5 rounded text-xs transition-colors min-w-0 ${b===a.id?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"}`,children:[p===a.id?(0,d.jsx)("input",{ref:t,type:"text",value:r,onChange:a=>s(a.target.value),onBlur:v,onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),v()),"Escape"===a.key&&(a.preventDefault(),w())},onClick:a=>a.stopPropagation(),className:"w-full bg-transparent border-b border-[var(--amber)] outline-none text-xs text-foreground"}):(0,d.jsx)("div",{className:"truncate",children:(0,h.d)(a)}),p!==a.id&&(0,d.jsx)("div",{className:"text-2xs opacity-60",children:new Date(a.updatedAt).toLocaleString()})]}),(0,d.jsx)("button",{type:"button",onClick:()=>u(a),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:l.rename,children:(0,d.jsx)(f.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:()=>i(a.id),className:"p-1 rounded text-muted-foreground hover:text-error hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete session",children:(0,d.jsx)(g.A,{size:12})})]},a.id))]})]})}},78340:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>l});var d=c(48249),e=c(67484),f=c(19099),g=c(80600),h=c(86588),i=c(33191);function j(a){return a.split("/").pop()?.replace(/\.md$/,"")??a}function k({text:a}){let b=a.split(/(\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\))/g);return(0,d.jsx)("span",{children:b.map((a,b)=>/^\[\[/.test(a)||/^\[/.test(a)?(0,d.jsx)("span",{style:{color:"var(--amber)",fontWeight:500},children:a},b):(0,d.jsx)("span",{children:a},b))})}function l({filePath:a}){let b=(0,f.useRouter)(),[c,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!0);if(m)return(0,d.jsx)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",fontSize:12,color:"var(--muted-foreground)"},children:"Scanning backlinks…"});let o=c??[];return(0,d.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,d.jsx)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:0===o.length?"No backlinks found":`${o.length} file${1===o.length?"":"s"} link here`})}),0===o.length?(0,d.jsxs)("div",{style:{border:"1px dashed var(--border)",borderRadius:10,padding:"2.5rem 1.5rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:[(0,d.jsx)(g.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,d.jsxs)("p",{className:"font-display",style:{fontSize:12},children:["No other files link to ",(0,d.jsx)("strong",{style:{color:"var(--foreground)"},children:j(a)})," yet."]})]}):(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:o.map(({filePath:a,snippets:c})=>{let e,f=j(a),l=(e=a.split("/")).length>1?e.slice(0,-1).join("/"):"";return(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",cursor:"pointer",transition:"border-color .15s"},onClick:()=>b.push("/view/"+(0,i.O0)(a)),onMouseEnter:a=>a.currentTarget.style.borderColor="rgba(200,135,58,0.4)",onMouseLeave:a=>a.currentTarget.style.borderColor="var(--border)",children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",borderBottom:c.length>0?"1px solid var(--border)":"none",background:"var(--muted)"},children:[(0,d.jsx)(g.A,{size:13,style:{color:"var(--muted-foreground)",flexShrink:0}}),(0,d.jsx)("span",{style:{fontWeight:600,fontSize:"0.85rem",color:"var(--foreground)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f}),l&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6,flexShrink:0},children:l}),(0,d.jsx)(h.A,{size:11,style:{color:"var(--muted-foreground)",opacity:.5,flexShrink:0}})]}),c.map((a,b)=>(0,d.jsx)("div",{style:{padding:"8px 14px",borderBottom:b<c.length-1?"1px solid var(--border)":"none",background:"var(--background)"},children:a.split("\n").map((a,b)=>(0,d.jsx)("div",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--muted-foreground)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,d.jsx)(k,{text:a})},b))},b))]},a)})})]})}c(95054)},78533:(a,b,c)=>{"use strict";var d=c(36312);for(let a of[{id:"agent-inspector",name:"Agent Inspector",description:"Visualizes agent tool-call logs as a filterable timeline. Auto-activates on .mindos/agent-audit-log.json and supports legacy .agent-log.json.",author:"MindOS",icon:"\uD83D\uDD0D",tags:["agent","inspector","log","mcp","tools"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/agent-audit-log.json",match:({filePath:a})=>/(^|\/)\.mindos\/agent-audit-log\.json$/i.test(a)||/\.agent-log\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,66913)).then(a=>({default:a.AgentInspectorRenderer}))},{id:"backlinks",name:"Backlinks Explorer",description:"Shows all files that link to the current page via wikilinks or markdown links, with highlighted snippet context.",author:"MindOS",icon:"\uD83D\uDD17",tags:["backlinks","wiki","links","references"],builtin:!0,entryPath:"BACKLINKS.md",match:({filePath:a})=>/\bBACKLINKS\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,66874)).then(a=>({default:a.BacklinksRenderer}))},{id:"config-panel",name:"Config Panel",description:"Renders CONFIG.json as an editable control panel based on uiSchema/keySpecs. Changes are written back to the JSON file directly.",author:"MindOS",icon:"\uD83E\uDDE9",tags:["config","json","settings","schema"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"CONFIG.json",match:({filePath:a,extension:b})=>"json"===b&&/(^|\/)CONFIG\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,63112)).then(a=>({default:a.ConfigRenderer}))},{id:"csv",name:"CSV Views",description:"Renders any CSV file as Table, Gallery, or Board. Each view is independently configurable — choose which columns map to title, description, tag, and group.",author:"MindOS",icon:"\uD83D\uDCCA",tags:["csv","table","gallery","board","data"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"Resources/Products.csv",match:({extension:a,filePath:b})=>"csv"===a&&!/\bTODO\b/i.test(b),load:()=>Promise.resolve().then(c.bind(c,60442)).then(a=>({default:a.CsvRenderer}))},{id:"summary",name:"AI Briefing",description:"Streams an AI-generated daily briefing summarizing your most recently modified files — key changes, recurring themes, and suggested next actions.",author:"MindOS",icon:"✨",tags:["ai","summary","briefing","daily"],builtin:!0,entryPath:"DAILY.md",match:({filePath:a})=>/\b(SUMMARY|summary|Summary|BRIEFING|briefing|Briefing|DAILY|daily|Daily)\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,45862)).then(a=>({default:a.SummaryRenderer}))},{id:"timeline",name:"Timeline",description:"Renders changelog and journal files as a vertical timeline. Any markdown with ## date headings (e.g. ## 2025-01-15) becomes a card in the feed.",author:"MindOS",icon:"\uD83D\uDCC5",tags:["timeline","changelog","journal","history"],builtin:!0,entryPath:"CHANGELOG.md",match:({filePath:a})=>/\b(CHANGELOG|changelog|TIMELINE|timeline|journal|Journal|diary|Diary)\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,1394)).then(a=>({default:a.TimelineRenderer}))},{id:"todo",name:"TODO Board",description:"Renders TODO.md/TODO.csv as an interactive kanban board grouped by section. Check items off directly — changes are written back to the source file.",author:"MindOS",icon:"✅",tags:["productivity","tasks","markdown"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"TODO.md",match:({filePath:a})=>/\bTODO\b.*\.(md|csv)$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,18776)).then(a=>({default:a.TodoRenderer}))},{id:"workflow-yaml",name:"Workflow Runner",description:"Execute step-by-step YAML workflows with Skills & Agent support.",author:"MindOS",icon:"⚡",tags:["workflow","automation","steps","ai","yaml"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/workflows/",match:({extension:a,filePath:b})=>("yaml"===a||"yml"===a)&&/\.flow\.(yaml|yml)$/i.test(b),load:()=>Promise.resolve().then(c.bind(c,83539)).then(a=>({default:a.WorkflowYamlRenderer}))},{id:"graph",name:"Wiki Graph",description:"Force-directed graph of wikilink references across all markdown files. Supports Global and Local (2-hop) scope filters.",author:"MindOS",icon:"\uD83D\uDD78️",tags:["graph","wiki","links","visualization"],builtin:!0,match:()=>!1,load:()=>Promise.resolve().then(c.bind(c,37718)).then(a=>({default:a.GraphRenderer}))}])(0,d.TS)(a)},78890:(a,b,c)=>{"use strict";c.d(b,{G:()=>i,M:()=>j});var d=c(48249),e=c(2116),f=c.n(e),g=c(19794),h=c(33191);function i({icon:a,title:b,subtitle:c,badge:e,href:i,onClick:j,active:k}){let l=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted",children:a}),(0,d.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"block text-left text-sm font-medium text-foreground truncate",title:b,children:b}),c?(0,d.jsx)("span",{className:"block text-left text-2xs text-muted-foreground truncate",title:c,children:c}):null]}),e,(0,d.jsx)(g.A,{size:14,className:"shrink-0 text-muted-foreground"})]}),m=!!(k&&i),n=(0,h.cn)("relative flex items-center gap-3 py-2.5 transition-colors duration-150 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",m?"bg-[var(--amber-dim)]/40 pl-3.5 pr-4 text-foreground":"px-4",i&&!m&&"cursor-pointer hover:bg-muted/50",m&&"cursor-default",!i&&"cursor-pointer hover:bg-muted/50");return i?(0,d.jsxs)(f(),{href:i,className:n,"aria-current":k?"page":void 0,children:[m?(0,d.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}):null,l]}):(0,d.jsx)("button",{type:"button",onClick:j,className:(0,h.cn)(n,"w-full"),children:l})}function j({label:a}){return(0,d.jsx)("span",{className:"text-2xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground shrink-0",children:a})}},80064:(a,b,c)=>{"use strict";c.d(b,{E:()=>e});var d=c(99829);let e=(0,d.createServerReference)("0081d0e6107ae00e6ac205a4fabb54b6f48fbfa8e7",d.callServer,void 0,d.findSourceMapURL,"cleanupExamplesAction")},80829:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(46674),g=c(49681),h=c(2797),i=c(69924),j=c(60907),k=c(81285);function l({open:a,onClose:b,anchorRect:c,railWidth:l,onOpenSyncSettings:m,syncStatus:n,onSyncStatusRefresh:o}){let p=(0,e.useRef)(null);(0,e.useRef)(b).current=b;let{syncing:q,syncResult:r,syncNow:s}=(0,j.bj)(o);if(!a||!c)return null;let t=(0,j.Bq)(n,q),{label:u}=(0,j.ky)(t,n),v=Math.max(8,c.bottom-180);return(0,d.jsxs)("div",{ref:p,className:"fixed z-40 w-[240px] border rounded-lg bg-card shadow-lg border-border animate-in fade-in slide-in-from-left-2 duration-150",style:{top:v,left:l},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Sync"}),(0,d.jsx)("button",{onClick:b,className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,d.jsx)(f.A,{size:14})})]}),(0,d.jsxs)("div",{className:"p-3 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${j.BG[t]} ${"syncing"===t||"conflicts"===t||"error"===t?"animate-pulse":""}`}),(0,d.jsx)("span",{className:"text-sm text-foreground",children:u}),"success"===r&&(0,d.jsx)(g.A,{size:14,className:"text-success shrink-0"}),"error"===r&&(0,d.jsx)(h.A,{size:14,className:"text-error shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:["off"!==t&&(0,d.jsxs)(k.jn,{onClick:s,disabled:q,className:"text-xs px-3 py-1.5 flex items-center gap-1.5",children:[(0,d.jsx)(i.A,{size:12,className:q?"animate-spin":""}),"Sync Now"]}),(0,d.jsx)("button",{onClick:()=>{m(),b()},className:"text-xs text-muted-foreground hover:text-foreground transition-colors rounded px-1 py-0.5 focus-visible:ring-2 focus-visible:ring-ring",children:"Settings →"})]})]})]})}},80992:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GraphRenderer:()=>j});var d=c(48249),e=c(67484),f=c(19099),g=c(96103),h=c(54633);c(71763),c(95054);let i=(0,e.memo)(function({data:a}){let b=(0,f.useRouter)(),{label:c,id:i,isCurrent:j,isOrphan:k,size:l=1}=a,m=(0,e.useCallback)(()=>{let a=i.split("/").map(encodeURIComponent).join("/");b.push("/view/"+a)},[i,b]),n=.8+Math.min(.1*l,1.2);return(0,d.jsxs)("div",{onClick:m,title:i,className:"group font-display",style:{fontSize:10*n,padding:`${4*n}px ${12*n}px`,borderRadius:999,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",opacity:k?.4:1,background:j?"var(--amber)":"var(--card)",color:j?"var(--amber-foreground)":"var(--foreground)",border:`1.5px solid ${j?"var(--amber)":"var(--border)"}`,boxShadow:j?"0 0 20px var(--amber-dim), 0 0 0 2px var(--amber-dim)":"0 2px 4px rgba(0,0,0,0.1)",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",zIndex:j?10:1},onMouseEnter:a=>{j||(a.currentTarget.style.borderColor="var(--amber)",a.currentTarget.style.background="var(--accent)")},onMouseLeave:a=>{j||(a.currentTarget.style.borderColor="var(--border)",a.currentTarget.style.background="var(--card)")},children:[(0,d.jsx)(g.h7,{type:"target",position:h.yX.Top,style:{opacity:0}}),c,(0,d.jsx)(g.h7,{type:"source",position:h.yX.Bottom,style:{opacity:0}})]})});function j({filePath:a}){let[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!0),[j,k]=(0,e.useState)("local"),[l,m]=(0,e.useState)(!1),n=(0,e.useMemo)(()=>{if(!b)return new Map;let a=new Map;for(let c of b.edges)a.set(c.source,(a.get(c.source)||0)+1),a.set(c.target,(a.get(c.target)||0)+1);return a},[b]),o=(0,e.useMemo)(()=>{if(!b)return null;let a=new Map;for(let c of b.edges)a.has(c.source)||a.set(c.source,new Set),a.has(c.target)||a.set(c.target,new Set),a.get(c.source).add(c.target),a.get(c.target).add(c.source);return a},[b]),{filteredNodes:p,filteredEdges:q}=(0,e.useMemo)(()=>{let c,d;if(!b)return{filteredNodes:[],filteredEdges:[]};if("global"===j)c=b.nodes,d=b.edges;else{let e=new Set,f=[{id:a,depth:0}];for(e.add(a);f.length>0;){let{id:a,depth:b}=f.shift();if(!(b>=2))for(let c of o?.get(a)??new Set)e.has(c)||(e.add(c),f.push({id:c,depth:b+1}))}let g=new Set((c=b.nodes.filter(a=>e.has(a.id))).map(a=>a.id));d=b.edges.filter(a=>g.has(a.source)&&g.has(a.target))}return{filteredNodes:c,filteredEdges:d}},[b,j,a,o]),r=(0,e.useMemo)(()=>{let a=new Set;for(let b of q)a.add(b.source),a.add(b.target);return a},[q]),{rfNodes:s,rfEdges:t}=(0,e.useMemo)(()=>{if(0===p.length)return{rfNodes:[],rfEdges:[]};let b=function(a,b,c){let d=a.length;if(0===d)return{};let e=(void 0)??(d>100?80:150),f=.6*Math.sqrt(108e4/Math.max(d,1)),g={};a.forEach((a,b)=>{let c=2*Math.PI*b/d,e=360*Math.random();g[a]={x:600+Math.cos(c)*e,y:450+Math.sin(c)*e}});let h={};for(let c=0;c<e;c++){let i=120*(1-c/e);for(let b of a)h[b]={x:0,y:0};for(let b=0;b<d;b++)for(let c=b+1;c<d;c++){let d=a[b],e=a[c],i=g[d].x-g[e].x,j=g[d].y-g[e].y,k=Math.sqrt(i*i+j*j||.01),l=f*f/k;h[d].x+=i/k*l,h[d].y+=j/k*l,h[e].x-=i/k*l,h[e].y-=j/k*l}for(let a of b){let b=a.source,c=a.target;if(!g[b]||!g[c])continue;let d=g[b].x-g[c].x,e=g[b].y-g[c].y,i=Math.sqrt(d*d+e*e||.01),j=i*i/f;h[b].x-=d/i*j,h[b].y-=e/i*j,h[c].x+=d/i*j,h[c].y+=e/i*j}for(let b of a){let a=g[b].x-600,c=g[b].y-450,d=Math.sqrt(a*a+c*c)||.01,e=.05*d;h[b].x-=a/d*e,h[b].y-=c/d*e}for(let b of a){let a=h[b],c=Math.sqrt(a.x*a.x+a.y*a.y)||.01;g[b].x+=a.x/c*Math.min(c,i),g[b].y+=a.y/c*Math.min(c,i),g[b].x=Math.max(0,Math.min(1200,g[b].x)),g[b].y=Math.max(0,Math.min(900,g[b].y))}}return g}(p.map(a=>a.id),q);return{rfNodes:p.map(c=>({id:c.id,type:"wiki",position:b[c.id]??{x:0,y:0},data:{label:c.label,id:c.id,isCurrent:c.id===a,isOrphan:!r.has(c.id),size:n.get(c.id)||1}})),rfEdges:q.map((b,c)=>{let d=b.source===a||b.target===a;return{id:`e-${c}`,source:b.source,target:b.target,type:"default",markerEnd:{type:"arrowclosed",color:d?"var(--amber)":"var(--border)"},style:{stroke:d?"var(--amber)":"var(--border)",strokeWidth:d?1.5:1,opacity:d?.8:.4},animated:d}})}},[p,q,a,r,n]),u=(0,e.useMemo)(()=>({wiki:i}),[]);return!l||f?(0,d.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400,borderRadius:12,background:"var(--muted)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,d.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",fontSize:12},children:f?"Building graph…":"Loading…"})}):(0,d.jsxs)("div",{style:{width:"100%",position:"relative",zIndex:0},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[(0,d.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[p.length," nodes \xb7 ",q.length," edges"]}),(0,d.jsx)("div",{style:{display:"flex",gap:2,padding:3,borderRadius:8,background:"var(--muted)"},children:[{id:"local",label:"Local"},{id:"global",label:"Global"}].map(a=>(0,d.jsx)("button",{onClick:()=>k(a.id),className:"font-display",style:{padding:"3px 12px",borderRadius:5,fontSize:11,cursor:"pointer",border:"none",outline:"none",background:j===a.id?"var(--card)":"transparent",color:j===a.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:j===a.id?"0 1px 3px rgba(0,0,0,0.1)":"none",transition:"all 0.1s"},children:a.label},a.id))})]}),(0,d.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400},children:(0,d.jsxs)(g.Gc,{nodes:s,edges:t,nodeTypes:u,fitView:!0,fitViewOptions:{padding:.15},proOptions:{hideAttribution:!0},style:{background:"var(--background)",borderRadius:12,border:"1px solid var(--border)"},children:[(0,d.jsx)(g.VS,{color:"var(--border)",gap:24,size:1,variant:g._5.Dots}),(0,d.jsx)(g.H2,{showInteractive:!1}),(0,d.jsx)(g.of,{nodeColor:a=>a.data?.isCurrent?"var(--amber)":"var(--muted-foreground)"})]})})]})}},81285:(a,b,c)=>{"use strict";c.d(b,{Ak:()=>n,Bt:()=>l,D0:()=>i,L7:()=>p,jn:()=>o,l6:()=>k,lM:()=>m,pM:()=>q,pd:()=>j});var d=c(48249),e=c(67484),f=c.n(e),g=c(44218),h=c(42742);function i({label:a,hint:b,children:c}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-sm text-foreground font-medium",children:a}),c,b&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:b})]})}function j({className:a="",...b}){return(0,d.jsx)("input",{...b,className:`w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 ${a}`})}function k({value:a,onChange:b,children:c,className:i="",disabled:j}){let k=(0,e.useId)(),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(-1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useMemo)(()=>f().Children.toArray(c).filter(a=>f().isValidElement(a)&&"option"===a.type).map(a=>({value:String(a.props.value??""),label:String(a.props.children??a.props.value??"")})),[c]),s=r.findIndex(b=>b.value===a),t=r[s]?.label??"",u=(0,e.useCallback)(a=>{a>=0&&a<r.length&&(b?.({target:{value:r[a].value}}),m(!1))},[r,b]),v=(0,e.useCallback)(a=>{if(!l){["Enter"," ","ArrowDown","ArrowUp"].includes(a.key)&&(a.preventDefault(),m(!0),o(s>=0?s:0));return}switch(a.key){case"ArrowDown":a.preventDefault(),o(a=>Math.min(a+1,r.length-1));break;case"ArrowUp":a.preventDefault(),o(a=>Math.max(a-1,0));break;case"Enter":case" ":a.preventDefault(),u(n);break;case"Escape":a.preventDefault(),m(!1);break;case"Tab":m(!1)}},[l,r.length,s,n,u]);return(0,d.jsxs)("div",{ref:p,className:`relative ${i}`,children:[(0,d.jsxs)("button",{type:"button",disabled:j,onClick:()=>{m(a=>!a),o(s>=0?s:0)},onKeyDown:v,"aria-haspopup":"listbox","aria-expanded":l,className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground text-left flex items-center justify-between gap-2 outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:`truncate ${t?"":"text-muted-foreground"}`,children:t||"—"}),(0,d.jsx)(g.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${l?"rotate-180":""}`})]}),l&&(0,d.jsx)("div",{ref:q,role:"listbox","aria-activedescendant":n>=0?`${k}-opt-${n}`:void 0,className:"absolute z-20 w-full mt-1 py-1 border border-border rounded-lg bg-card shadow-lg max-h-60 overflow-auto animate-in fade-in-0 zoom-in-95 duration-100",children:r.map((b,c)=>{let e=b.value===a,f=c===n;return(0,d.jsxs)("button",{id:`${k}-opt-${c}`,role:"option","aria-selected":e,type:"button",onMouseDown:a=>{a.preventDefault(),u(c)},onMouseEnter:()=>o(c),className:`w-full px-3 py-1.5 text-sm text-left flex items-center gap-2 transition-colors ${f?"bg-accent text-accent-foreground":"text-foreground"}`,children:[(0,d.jsx)(h.A,{size:14,className:`shrink-0 ${e?"text-[var(--amber)]":"invisible"}`}),(0,d.jsx)("span",{className:"truncate",children:b.label})]},b.value)})})]})}function l({overridden:a}){return a?(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-[var(--amber-subtle)] text-[var(--amber-text)] font-mono ml-1.5",children:"env"}):null}function m({checked:a,onChange:b,size:c="md",disabled:e,title:f,onClick:g}){let h="sm"===c;return(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:e,title:f,onClick:g??(()=>b?.(!a)),className:`relative inline-flex shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60 ${h?"h-4 w-7":"h-5 w-9"} ${a?"bg-[var(--amber)]":"bg-muted"}`,children:(0,d.jsx)("span",{className:`pointer-events-none inline-block rounded-full bg-white shadow-sm transition-transform ${h?"h-3 w-3":"h-4 w-4"} ${a?h?"translate-x-3":"translate-x-4":"translate-x-0"}`})})}function n({value:a,onChange:b,placeholder:c,disabled:e}){let f="***set***"===a;return(0,d.jsx)("input",{type:"password",value:f?"••••••••••••••••":a,onChange:a=>b(a.target.value),placeholder:c??"sk-...",disabled:e,className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",onFocus:()=>{f&&b("")}})}function o({children:a,disabled:b,onClick:c,type:e="button",className:f="",...g}){return(0,d.jsx)("button",{type:e,onClick:c,disabled:b,className:`px-4 py-2 text-sm font-medium rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${f}`,...g,children:a})}function p({icon:a,title:b,description:c,badge:e,children:f,className:g=""}){return(0,d.jsxs)("div",{className:`rounded-xl border border-border/50 bg-card/50 p-5 ${g}`,children:[(0,d.jsxs)("div",{className:"flex items-start gap-3 mb-4",children:[(0,d.jsx)("div",{className:"w-8 h-8 rounded-lg bg-muted/50 flex items-center justify-center shrink-0 mt-0.5",children:(0,d.jsx)("span",{className:"text-muted-foreground",children:a})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:b}),e]}),c&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:c})]})]}),(0,d.jsx)("div",{className:"space-y-4 pl-11",children:f})]})}function q({label:a,hint:b,children:c}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm text-foreground",children:a}),b&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:b})]}),(0,d.jsx)("div",{className:"shrink-0",children:c})]})}},82110:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(67484),f=c(95801),g=c(93096);function h({results:a,selectedIndex:b,query:c,onSelect:h}){let i=(0,e.useRef)(null),j=(0,e.useRef)(null),[k,l]=(0,e.useState)(280);return 0===a.length?null:(0,d.jsxs)("div",{ref:j,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,d.jsx)(f.A,{size:11,className:"text-[var(--amber)]/50"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Skills"}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:a.length})]}),(0,d.jsx)("div",{ref:i,className:"overflow-y-auto",style:{maxHeight:k},children:a.map((a,e)=>(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),h(a)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors ${e===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[(0,d.jsx)(f.A,{size:13,className:"text-[var(--amber)] shrink-0"}),(0,d.jsxs)("span",{className:"text-sm font-medium shrink-0",children:["/",(0,d.jsx)(g.A,{text:a.name,query:c})]}),a.description&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/50 truncate min-w-0 flex-1",title:a.description,children:a.description})]},a.name))}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,d.jsx)("span",{children:"↑↓ navigate"}),(0,d.jsx)("span",{children:"↵ / Tab select"}),(0,d.jsx)("span",{children:"ESC dismiss"})]})]})}},82298:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>aa,Fo:()=>R,gL:()=>S});var d=c(48249),e=c(67484),f=c(19099),g=c(93491),h=c(33191),i=c(83654),j=c(80600),k=c(24520),l=c(37917),m=c(801),n=c(16944),o=c(15273),p=c(12625),q=c(59347),r=c(86718),s=c(40560),t=c(44218),u=c(28330),v=c(7309),w=c(65032),x=c(24703),y=c(99829);let z=(0,y.createServerReference)("40e2e7d7a72f3dff1055ad1108f265024b4ffa4cdc",y.callServer,void 0,y.findSourceMapURL,"convertToSpaceAction"),A=(0,y.createServerReference)("60b48a4f0395079a09ff00adc52fef05be35536969",y.callServer,void 0,y.findSourceMapURL,"createFileAction"),B=(0,y.createServerReference)("60743e3f0c11ae99da4234ee535175037202d4ced7",y.callServer,void 0,y.findSourceMapURL,"renameSpaceAction");var C=c(83896);let D=(0,y.createServerReference)("40c860785c4901130d27de9318cde77f0e0ef816bb",y.callServer,void 0,y.findSourceMapURL,"deleteSpaceAction"),E=(0,y.createServerReference)("402b968346adcf3e5876840496bcc621be1a84d7e7",y.callServer,void 0,y.findSourceMapURL,"deleteFolderAction");var F=c(4399),G=c(15304),H=c(99101),I=c(30315),J=c(57056),K=c(29713),L=c(93678);function M(){window.dispatchEvent(new Event("mindos:files-changed"))}async function N(a){try{await navigator.clipboard.writeText(a)}catch{}}let O="show-hidden-files";function P(a){let b=b=>{b.key===O&&a()},c=()=>a();return window.addEventListener("storage",b),window.addEventListener("mindos:hidden-files-changed",c),()=>{window.removeEventListener("storage",b),window.removeEventListener("mindos:hidden-files-changed",c)}}function Q(){return!1}function R(a){localStorage.setItem(O,String(a)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function S(){return(0,e.useSyncExternalStore)(P,Q,()=>!1)}function T({x:a,y:b,onClose:c,menuHeight:f,children:g}){let h=(0,e.useRef)(null),i=Math.min(b,window.innerHeight-(f??160)),j=Math.min(a,window.innerWidth-200);return(0,d.jsx)("div",{ref:h,className:"fixed z-50 min-w-[180px] bg-card border border-border rounded-lg shadow-lg py-1",style:{top:i,left:j},children:g})}let U="w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",V="w-full flex items-center gap-2 px-3 py-2 text-sm text-error hover:bg-error/10 transition-colors text-left",W="my-1 border-t border-border/50";function X({x:a,y:b,node:c,onClose:e,onRename:g,onNewFile:i,onImport:j,onDelete:r}){let s=(0,f.useRouter)(),{t}=(0,I.Y)(),{isPinned:u,togglePin:v}=(0,K.Z)(),w=u(c.path);return(0,d.jsxs)(T,{x:a,y:b,onClose:e,children:[(0,d.jsxs)("button",{className:U,onClick:()=>{i(),e()},children:[(0,d.jsx)(k.A,{size:14,className:"shrink-0"})," ",t.fileTree.newFile]}),(0,d.jsxs)("button",{className:U,onClick:()=>{s.push(`/view/${(0,h.O0)(`${c.path}/INSTRUCTION.md`)}`),e()},children:[(0,d.jsx)(l.A,{size:14,className:"shrink-0"})," ",t.fileTree.viewRules]}),j&&(0,d.jsxs)("button",{className:U,onClick:()=>{j(c.path),e()},children:[(0,d.jsx)(m.A,{size:14,className:"shrink-0"})," ",t.fileTree.importFile]}),(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:U,onClick:()=>{v(c.path),e()},children:[(0,d.jsx)(n.A,{size:14,className:`shrink-0 ${w?"fill-[var(--amber)] text-[var(--amber)]":""}`}),w?t.fileTree.removeFromFavorites:t.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:U,onClick:()=>{N(c.path),e()},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",t.fileTree.copyPath]}),(0,d.jsxs)("button",{className:U,onClick:()=>{g(),e()},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",t.fileTree.renameSpace]}),(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:V,onClick:()=>{e(),r()},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"}),t.fileTree.deleteSpace]})]})}function Y({x:a,y:b,node:c,onClose:g,onRename:h,onNewFile:i,onDelete:j}){let l=(0,f.useRouter)(),{t:m}=(0,I.Y)(),[s,t]=(0,e.useTransition)(),{isPinned:u,togglePin:v}=(0,K.Z)(),w=u(c.path);return(0,d.jsxs)(T,{x:a,y:b,onClose:g,menuHeight:220,children:[(0,d.jsxs)("button",{className:U,onClick:()=>{i(),g()},children:[(0,d.jsx)(k.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:U,onClick:()=>{v(c.path),g()},children:[(0,d.jsx)(n.A,{size:14,className:`shrink-0 ${w?"fill-[var(--amber)] text-[var(--amber)]":""}`}),w?m.fileTree.removeFromFavorites:m.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:U,disabled:s,onClick:()=>{t(async()=>{if((await z(c.path)).success){l.refresh(),M();let a=c.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||c.name;(0,L.w)().then(b=>{b&&(0,L.V)(a,c.path)})}g()})},children:[(0,d.jsx)(r.A,{size:14,className:"shrink-0 text-[var(--amber)]"})," ",m.fileTree.convertToSpace]}),(0,d.jsxs)("button",{className:U,onClick:()=>{N(c.path),g()},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,d.jsxs)("button",{className:U,onClick:()=>{h(),g()},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",m.fileTree.rename]}),(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:V,onClick:()=>{g(),j()},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"}),m.fileTree.deleteFolder]})]})}function Z({dirPath:a,depth:b,onDone:c}){let[g,i]=(0,e.useState)(""),[j,k]=(0,e.useTransition)(),[l,m]=(0,e.useState)(""),n=(0,f.useRouter)(),{t:o}=(0,I.Y)(),p=(0,e.useRef)(null),q=(0,e.useCallback)(()=>{let b=g.trim();b?k(async()=>{let d=await A(a,b);d.success&&d.filePath?(c(),n.push(`/view/${(0,h.O0)(d.filePath)}`),n.refresh(),M()):m(d.error||o.fileTree.failed)}):m(o.fileTree.enterFileName)},[g,a,c,n,o]);return(0,d.jsxs)("div",{ref:p,className:"px-2 pb-1",style:{paddingLeft:`${12*b+20}px`},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("input",{autoFocus:!0,type:"text",value:g,onChange:a=>{i(a.target.value),m("")},onKeyDown:a=>{"Enter"===a.key&&q(),"Escape"===a.key&&c()},placeholder:"filename.md",className:" flex-1 bg-muted border border-border rounded px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring "}),j?(0,d.jsx)(s.A,{size:13,className:"text-muted-foreground animate-spin shrink-0"}):(0,d.jsx)("button",{onClick:q,className:"text-xs text-[var(--amber)] hover:text-foreground shrink-0 px-1",children:o.fileTree.create})]}),l&&(0,d.jsx)("p",{className:"text-xs text-error mt-0.5 px-1",children:l})]})}function $({node:a,depth:b,currentPath:c,onNavigate:i,maxOpenDepth:j,onImport:k}){let l=(0,f.useRouter)(),m=c.startsWith(a.path+"/")||c===a.path,n=!!a.isSpace,[o,p]=(0,e.useState)(0===b||m),[q,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[G,K]=(0,e.useState)(a.name),[L,N]=(0,e.useTransition)(),O=(0,e.useRef)(null),P=(0,e.useRef)(null),[Q,R]=(0,e.useState)(null),{t:S}=(0,I.Y)(),[T,U]=(0,e.useState)(null),[V,W]=(0,e.useTransition)(),$=(0,e.useCallback)(()=>p(a=>!a),[]);(0,e.useRef)(void 0);let _=(0,e.useCallback)(b=>{b?.preventDefault(),b?.stopPropagation(),P.current&&(clearTimeout(P.current),P.current=null),K(a.name),A(!0),setTimeout(()=>O.current?.select(),0)},[a.name]),ab=(0,e.useCallback)(()=>{let b=G.trim();b&&b!==a.name?N(async()=>{let c=n?B:C.f,d=await c(a.path,b);d.success&&d.newPath?(A(!1),l.push(`/view/${(0,h.O0)(d.newPath)}`),l.refresh(),M()):A(!1)}):A(!1)},[G,a.name,a.path,l,n]),ac=(0,e.useCallback)(()=>{z||(P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{l.push(`/view/${(0,h.O0)(a.path)}`),i?.(),P.current=null},180))},[z,l,a.path,i]),ad=(0,e.useCallback)(a=>{a.stopPropagation(),$()},[$]),ae=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),R({x:a.clientX,y:a.clientY})},[]),af=n?function a(b){return"file"===b.type?+!g.C.has(b.name):(b.children??[]).reduce((b,c)=>b+a(c),0)}(a):0;if(z)return(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:O,autoFocus:!0,value:G,onChange:a=>K(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ab(),"Escape"===a.key&&A(!1)},onBlur:ab,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),L&&(0,d.jsx)(s.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let ag=n&&0===b;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"relative group/dir flex items-center",onContextMenu:ae,children:[(0,d.jsx)("button",{onClick:$,className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground transition-colors",style:{marginLeft:`${12*b+4}px`},"aria-label":o?`Collapse ${a.name}`:`Expand ${a.name}`,children:(0,d.jsx)("span",{className:"block transition-transform duration-150",style:{transform:o?"rotate(0deg)":"rotate(-90deg)"},children:(0,d.jsx)(t.A,{size:13})})}),(0,d.jsxs)("button",{type:"button",onClick:ac,onDoubleClick:ad,draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.setData("text/mindos-type","directory"),b.dataTransfer.effectAllowed="copy"},className:`
178
- flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
179
- text-sm transition-colors duration-100
180
- hover:bg-muted
181
- ${m?"text-foreground":"text-muted-foreground hover:text-foreground"}
182
- `,children:[n?"Inbox"===a.name?(0,d.jsx)(u.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):(0,d.jsx)(r.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):o?(0,d.jsx)(v.A,{size:14,className:"text-yellow-400 shrink-0"}):(0,d.jsx)(w.A,{size:14,className:"text-yellow-400 shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),n&&!o&&(0,d.jsx)("span",{className:"ml-auto text-xs text-muted-foreground shrink-0 tabular-nums pr-1",children:af})]}),(0,d.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/dir:flex items-center gap-0.5 z-10",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.preventDefault(),a.stopPropagation();let b=a.currentTarget.getBoundingClientRect();R({x:b.left,y:b.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,d.jsx)(x.A,{size:14})})})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${o?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsxs)("div",{className:`overflow-hidden ${ag?"border-l-2 ml-[18px]":""}`,style:ag?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!o&&{inert:!0},children:[a.children&&(0,d.jsx)(aa,{nodes:a.children,depth:ag?1:b+1,onNavigate:i,maxOpenDepth:j,parentIsSpace:n,onImport:k}),q&&(0,d.jsx)(Z,{dirPath:a.path,depth:ag?0:b,onDone:()=>y(!1)})]})}),Q&&(n?(0,d.jsx)(X,{x:Q.x,y:Q.y,node:a,onClose:()=>R(null),onRename:()=>_(),onNewFile:()=>{p(!0),y(!0)},onImport:k,onDelete:()=>U("space")}):(0,d.jsx)(Y,{x:Q.x,y:Q.y,node:a,onClose:()=>R(null),onRename:()=>_(),onNewFile:()=>{p(!0),y(!0)},onDelete:()=>U("folder")})),(0,d.jsx)(J.TM,{open:null!==T,title:"space"===T?S.fileTree.deleteSpace:S.fileTree.deleteFolder,message:"space"===T?S.fileTree.confirmDeleteSpace(a.name):S.fileTree.confirmDeleteFolder(a.name),confirmLabel:"space"===T?S.fileTree.deleteSpace:S.fileTree.deleteFolder,cancelLabel:S.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>U(null),onConfirm:()=>{U(null),W(async()=>{let b="space"===T?await D(a.path):await E(a.path);if(b.success&&b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;H.oR.undo(`${S.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,F.Y)(c);a.success?(l.refresh(),M()):H.oR.error(a.error??"Undo failed")},{label:S.trash?.undo??"Undo"}),l.push("/"),l.refresh(),M()}})}})]})}function _({node:a,depth:b,currentPath:c,onNavigate:k}){let l=(0,f.useRouter)(),m=c===a.path,[r,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(a.name),[w,y]=(0,e.useTransition)(),[,z]=(0,e.useTransition)(),A=(0,e.useRef)(null),{t:B}=(0,I.Y)(),{isPinned:D,togglePin:E}=(0,K.Z)(),L=D(a.path),O=!a.path.includes("/")&&g.A.has(a.name),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(null),X=(0,e.useCallback)(()=>{r||(l.push(`/view/${(0,h.O0)(a.path)}`),k?.())},[l,a.path,k,r]),Y=(0,e.useCallback)(b=>{b.stopPropagation(),v(a.name),t(!0),setTimeout(()=>A.current?.select(),0)},[a.name]),Z=(0,e.useCallback)(()=>{let b=u.trim();b&&b!==a.name?y(async()=>{let c=await (0,C.f)(a.path,b);c.success&&c.newPath?(t(!1),l.push(`/view/${(0,h.O0)(c.newPath)}`),l.refresh(),M()):t(!1)}):t(!1)},[u,a.name,a.path,l]),$=(0,e.useCallback)(a=>{a.stopPropagation(),Q(!0)},[]),_=(0,e.useCallback)(b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.effectAllowed="copy"},[a.path]),aa=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),S({x:a.clientX,y:a.clientY})},[]);return r?(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:A,autoFocus:!0,value:u,onChange:a=>v(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Z(),"Escape"===a.key&&t(!1)},onBlur:Z,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),w&&(0,d.jsx)(s.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]}):(0,d.jsxs)("div",{className:"relative group/file",children:[(0,d.jsxs)("button",{onClick:X,onDoubleClick:O?void 0:Y,onContextMenu:aa,draggable:!0,onDragStart:_,"data-filepath":a.path,className:`
183
- w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
184
- text-sm transition-colors duration-100 cursor-pointer pr-16
185
- ${m?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
186
- `,style:{paddingLeft:`${12*b+8}px`},children:["directory"===a.type?null:".csv"===a.extension?(0,d.jsx)(i.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(j.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),L&&(0,d.jsx)(n.A,{size:10,className:"shrink-0 fill-[var(--amber)] text-[var(--amber)] opacity-60"})]}),(0,d.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/file:flex items-center gap-0.5",children:(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation();let b=a.currentTarget.getBoundingClientRect();S({x:b.left,y:b.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,d.jsx)(x.A,{size:14})})}),R&&(0,d.jsxs)(T,{x:R.x,y:R.y,onClose:()=>S(null),menuHeight:140,children:[(0,d.jsxs)("button",{className:U,onClick:()=>{N(a.path),S(null)},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",B.fileTree.copyPath]}),(0,d.jsxs)("button",{className:U,onClick:()=>{E(a.path),S(null)},children:[(0,d.jsx)(n.A,{size:14,className:`shrink-0 ${L?"fill-[var(--amber)] text-[var(--amber)]":""}`}),L?B.fileTree.removeFromFavorites:B.fileTree.pinToFavorites]}),!O&&(0,d.jsxs)("button",{className:U,onClick:a=>{S(null),Y(a)},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",B.fileTree.rename]}),!O&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:W}),(0,d.jsxs)("button",{className:V,onClick:a=>{S(null),$(a)},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"})," ",B.fileTree.delete]})]})]}),(0,d.jsx)(J.TM,{open:P,title:B.fileTree.delete,message:B.fileTree.confirmDelete(a.name),confirmLabel:B.fileTree.delete,cancelLabel:B.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>Q(!1),onConfirm:()=>{Q(!1),z(async()=>{let b=await (0,G.i)(a.path);if(b.success){if(b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;H.oR.undo(`${B.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,F.Y)(c);a.success?(l.refresh(),M()):H.oR.error(a.error??"Undo failed")},{label:B.trash?.undo??"Undo"})}l.refresh(),M()}})}})]})}function aa({nodes:a,depth:b=0,onNavigate:c,maxOpenDepth:e,parentIsSpace:h,onImport:i}){var j;let k,l=(k="/view/",(j=(0,f.usePathname)()).startsWith(k)?j.slice(k.length).split("/").map(decodeURIComponent).join("/"):""),m=S(),n=0===b,o=m?a:a.filter(a=>!(n&&a.name.startsWith(".")||"file"===a.type&&g.C.has(a.name)||"directory"===a.type&&a.name.startsWith(".")));return(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:o.map(a=>"directory"===a.type?(0,d.jsx)($,{node:a,depth:b,currentPath:l,onNavigate:c,maxOpenDepth:e,onImport:i},a.path):(0,d.jsx)(_,{node:a,depth:b,currentPath:l,onNavigate:c},a.path))})}},82626:(a,b,c)=>{"use strict";c.d(b,{A:()=>t});var d=c(48249),e=c(19099),f=c(37526),g=c(86320),h=c(73908),i=c(96286),j=c(46218),k=c(4140),l=c(78890),m=c(67484),n=c(70971),o=c(8455),p=c(22341);c(95054);var q=c(30315);function r(){let[a,b]=(0,m.useState)(null),[c,e]=(0,m.useState)([]),[f,g]=(0,m.useState)(!0),{t:h}=(0,q.Y)();return f||!a?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:(0,d.jsx)("div",{className:"h-2 w-20 bg-muted rounded animate-pulse"})}):(0,d.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-3 border-t border-border",children:[(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.fileCount}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Files"})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.unreadChanges}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Changes"})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.sessionCount}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Chats"})]})]}),c.length>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-0.5",children:"Recent"}),c.map(a=>{let b=function(a){try{let b=new Date(a),c=new Date().getTime()-b.getTime(),d=Math.floor(c/6e4),e=Math.floor(c/36e5),f=Math.floor(c/864e5);if(d<1)return"now";if(d<60)return`${d}m ago`;if(e<24)return`${e}h ago`;if(f<7)return`${f}d ago`;return b.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return"recently"}}(a.ts),c=function(a){switch(a){case"create":return(0,d.jsx)(n.A,{size:12,className:"text-success"});case"write":case"append":return(0,d.jsx)(o.A,{size:12,className:"text-foreground"});case"delete":return(0,d.jsx)(o.A,{size:12,className:"text-destructive"});case"rename":case"move":return(0,d.jsx)(p.A,{size:12,className:"text-muted-foreground"});default:return(0,d.jsx)(o.A,{size:12,className:"text-muted-foreground"})}}(a.op),e=a.path.split("/").pop()||a.path;return(0,d.jsxs)("div",{className:"flex items-start gap-2 p-1.5 rounded hover:bg-muted/40 transition-colors text-xs",children:[(0,d.jsx)("span",{className:"text-muted-foreground shrink-0 mt-0.5",children:c}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-foreground truncate font-medium",title:e,children:e}),(0,d.jsx)("p",{className:"text-muted-foreground text-2xs",children:b})]})]},a.id)})]})]})}var s=c(10072);function t({active:a,maximized:b,onMaximize:c}){let{t:m}=(0,q.Y)(),n=m.panels.echo,o=(0,e.usePathname)()??"",p={"about-you":{icon:(0,d.jsx)(f.A,{size:14}),title:n.aboutYouTitle},continued:{icon:(0,d.jsx)(g.A,{size:14}),title:n.continuedTitle},daily:{icon:(0,d.jsx)(h.A,{size:14}),title:n.dailyEchoTitle},"past-you":{icon:(0,d.jsx)(i.A,{size:14}),title:n.pastYouTitle},growth:{icon:(0,d.jsx)(j.A,{size:14}),title:n.intentGrowthTitle}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(k.A,{title:n.title,maximized:b,onMaximize:c}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0 flex flex-col",children:[(0,d.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:s.RS.map(a=>{let b=p[a],c=s.AI[a],e=o===c||o.startsWith(`${c}/`);return(0,d.jsx)(l.G,{href:c,icon:b.icon,title:b.title,active:e},a)})}),(0,d.jsx)("div",{className:"mt-auto",children:(0,d.jsx)(r,{})})]})]})}},82704:()=>{},82884:(a,b,c)=>{"use strict";c.d(b,{Un:()=>f});var d=c(67484);let e="mindos-renderer-state-change";function f(a,b,c){let f=`mindos-renderer:${a}:${b}`,g=(0,d.useRef)({key:f,raw:null,parsed:c});return g.current.key!==f&&(g.current={key:f,raw:null,parsed:c}),[(0,d.useSyncExternalStore)(a=>{let b=()=>a();return window.addEventListener("storage",b),window.addEventListener(e,b),()=>{window.removeEventListener("storage",b),window.removeEventListener(e,b)}},()=>{try{let a=localStorage.getItem(f);if(a===g.current.raw)return g.current.parsed;if(null===a)return g.current={key:f,raw:null,parsed:c},c;let b=JSON.parse(a);return g.current={key:f,raw:a,parsed:b},b}catch{return c}},()=>c),(0,d.useCallback)(a=>{try{let b=(()=>{try{let a=localStorage.getItem(f);return null!==a?JSON.parse(a):c}catch{return c}})(),d="function"==typeof a?a(b):a,e=JSON.stringify(d);localStorage.setItem(f,e),g.current={key:f,raw:e,parsed:d}}catch{}window.dispatchEvent(new Event(e))},[f,c])]}},83539:(a,b,c)=>{"use strict";c.r(b),c.d(b,{WorkflowYamlRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call WorkflowYamlRenderer() from the server but WorkflowYamlRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/workflow-yaml/WorkflowYamlRenderer.tsx","WorkflowYamlRenderer")},83896:(a,b,c)=>{"use strict";c.d(b,{f:()=>e});var d=c(99829);let e=(0,d.createServerReference)("60fd22f155497154ed40a3afe473ad294c7deace6c",d.callServer,void 0,d.findSourceMapURL,"renameFileAction")},84197:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(2116),g=c.n(f),h=c(24520),i=c(40560),j=c(95801),k=c(31675),l=c(4140),m=c(30315),n=c(33191);function o({active:a,maximized:b,onMaximize:c}){let{t:f}=(0,m.Y)(),o=f.panels.workflows,[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(""),B=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/workflows");if(!a.ok)return;let b=await a.json();q(b.workflows??[])}catch{}finally{s(!1)}},[]),C=async()=>{let a=v.trim();if(a&&!x){y(!0),A("");try{let b=await fetch("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})}),c=await b.json();if(!b.ok)return void A(409===b.status?o.exists:c.error||"Error");u(!1),w(""),await B(),window.location.href=`/view/${(0,n.O0)(c.path)}`}catch{A("Network error")}finally{y(!1)}}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(l.A,{title:o.title,maximized:b,onMaximize:c,children:(0,d.jsx)("button",{onClick:()=>u(a=>!a),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":o.newWorkflow,title:o.newWorkflow,children:(0,d.jsx)(h.A,{size:13})})}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t&&(0,d.jsxs)("div",{className:"px-3 py-3 border-b border-border",children:[(0,d.jsx)("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:o.name}),(0,d.jsx)("input",{type:"text",value:v,onChange:a=>{w(a.target.value),A("")},onKeyDown:a=>"Enter"===a.key&&C(),placeholder:o.namePlaceholder,autoFocus:!0,className:"w-full px-2.5 py-1.5 text-sm rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),z&&(0,d.jsx)("p",{className:"text-xs text-[var(--error)] mt-1",children:z}),(0,d.jsxs)("div",{className:"flex gap-2 mt-2.5",children:[(0,d.jsx)("button",{onClick:()=>{u(!1),w(""),A("")},className:"flex-1 px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground hover:bg-muted transition-colors",children:o.cancel}),(0,d.jsx)("button",{onClick:C,disabled:!v.trim()||x,className:"flex-1 px-3 py-1.5 text-xs rounded-md font-medium transition-colors disabled:opacity-50 bg-[var(--amber)] text-[var(--amber-foreground)]",children:x?o.creating:o.create})]})]}),r&&(0,d.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:(0,d.jsx)(i.A,{size:16,className:"animate-spin"})}),!r&&0===p.length&&!t&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:[(0,d.jsx)(j.A,{size:24,className:"text-muted-foreground/40 mb-3"}),(0,d.jsx)("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:o.empty}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-4 max-w-[200px]",children:o.emptyDesc}),(0,d.jsxs)("button",{onClick:()=>u(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors",children:[(0,d.jsx)(h.A,{size:12}),o.newWorkflow]})]}),!r&&p.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:p.map(a=>(0,d.jsxs)(g(),{href:`/view/${(0,n.O0)(a.path)}`,className:`flex items-start gap-2.5 px-3 py-2 mx-1 rounded-lg transition-colors hover:bg-muted ${a.error?"opacity-70":""}`,children:[(0,d.jsx)(j.A,{size:14,className:"shrink-0 mt-0.5 text-[var(--amber)]"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground block truncate",children:a.title}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[a.error?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-2xs text-[var(--error)]",children:[(0,d.jsx)(k.A,{size:10}),o.parseError]}):(0,d.jsx)("span",{className:"text-2xs text-muted-foreground",children:o.nSteps(a.stepCount)}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/60",suppressHydrationWarning:!0,children:(0,n.KW)(a.mtime,f.home?.relativeTime)})]})]})]},a.path))})]})]})}},84668:(a,b,c)=>{"use strict";c.d(b,{A:()=>n});var d=c(48249),e=c(67484),f=c(31417),g=c(21245);function h(a,b){fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{walkthroughStep:a,walkthroughDismissed:b}})}).catch(a=>{console.warn("[walkthrough-store] persist failed:",a)})}let i=(0,f.v)((a,b)=>{let c=g.g.length;return{status:"idle",currentStep:0,totalSteps:c,start:()=>{a({currentStep:0,status:"active"}),h(0,!1)},next:()=>{let d=b().currentStep+1;d>=c?(a({status:"completed"}),h(c,!1)):(a({currentStep:d}),h(d,!1))},back:()=>{let c=b().currentStep;c>0&&(a({currentStep:c-1}),h(c-1,!1))},skip:()=>{a({status:"dismissed"}),h(b().currentStep,!0)},_init:()=>{let b="1"===new URLSearchParams(window.location.search).get("welcome");if(b){let a=new URL(window.location.href);a.searchParams.delete("welcome"),window.history.replaceState({},"",a.pathname+(a.search||"")),window.dispatchEvent(new Event("mindos:first-visit"))}return window.innerWidth<768?()=>{}:(fetch("/api/setup").then(a=>a.json()).then(d=>{let e=d.guideState;!e||!e.walkthroughDismissed&&(e.active&&!e.dismissed&&void 0===e.walkthroughStep?b&&a({status:"active",currentStep:0}):"number"==typeof e.walkthroughStep&&e.walkthroughStep>=0&&e.walkthroughStep<c&&!e.walkthroughDismissed&&a({status:"active",currentStep:e.walkthroughStep}))}).catch(a=>{console.warn("[walkthrough-store] guideState read failed:",a)}),()=>{})}}});var j=c(30315);function k({stepIndex:a,rect:b,position:c}){let f,g,h=i(),{t:k}=(0,j.Y)(),[l,m]=(0,e.useState)({width:1024,height:768});if(!h)return null;let n=k.walkthrough.steps[a];if(!n)return null;"right"===c?(f=b.top+b.height/2,g=b.right+12):(f=b.bottom+12,g=b.left+b.width/2);let o=l.width-320,p=l.height-200;return g=Math.min(g,o),f=Math.max(f=Math.min(f,p),8),(0,d.jsxs)("div",{className:"fixed z-[102] w-[280px] rounded-xl border shadow-lg animate-in fade-in slide-in-from-left-2 duration-200",style:{top:`${f}px`,left:`${g}px`,transform:"right"===c?"translateY(-50%)":"translateX(-50%)",background:"var(--card)",borderColor:"var(--amber)"},children:[(0,d.jsxs)("div",{className:"p-4",children:[(0,d.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,d.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:k.walkthrough.step(a+1,h.totalSteps)})}),(0,d.jsx)("h3",{className:"text-sm font-semibold font-display mb-1",style:{color:"var(--foreground)"},children:n.title}),(0,d.jsx)("p",{className:"text-xs leading-relaxed",style:{color:"var(--muted-foreground)"},children:n.body}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-3",style:{borderTop:"1px solid var(--border)"},children:[(0,d.jsx)("button",{onClick:h.skip,className:"text-xs transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:k.walkthrough.skip}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a>0&&(0,d.jsx)("button",{onClick:h.back,className:"text-xs px-2.5 py-1 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:k.walkthrough.back}),(0,d.jsx)("button",{onClick:h.next,className:"text-xs px-3 py-1.5 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a===h.totalSteps-1?k.walkthrough.done:k.walkthrough.next})]})]})]}),(0,d.jsx)("div",{className:"flex items-center justify-center gap-1.5 pb-3",children:Array.from({length:h.totalSteps},(b,c)=>(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full transition-all duration-200",style:{background:c===a?"var(--amber)":"var(--border)",transform:c===a?"scale(1.3)":void 0}},c))})]})}function l(){let a=i(),[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!1),j=(0,e.useId)(),l=a?g.g[a.currentStep]:null;return((0,e.useCallback)(()=>{if(!l)return;let a=document.querySelector(`[data-walkthrough="${l.anchor}"]`);a?c(a.getBoundingClientRect()):c(null)},[l]),a?.skip,a&&l)?f?(0,d.jsx)(m,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("svg",{className:"fixed inset-0 z-[100] pointer-events-auto",width:"100%",height:"100%",onClick:c=>{if(b){let d=c.clientX,e=c.clientY;d>=b.left-6&&d<=b.right+6&&e>=b.top-6&&e<=b.bottom+6||a.skip()}else a.skip()},children:[(0,d.jsx)("defs",{children:(0,d.jsxs)("mask",{id:j,children:[(0,d.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),b&&(0,d.jsx)("rect",{x:b.left-6,y:b.top-6,width:b.width+12,height:b.height+12,rx:8,ry:8,fill:"black"})]})}),(0,d.jsx)("rect",{width:"100%",height:"100%",fill:"rgba(0, 0, 0, 0.5)",mask:`url(#${j})`})]}),b&&(0,d.jsx)(k,{stepIndex:a.currentStep,rect:b,position:l.position})]}):null}function m(){let a=i(),{t:b}=(0,j.Y)();if(!a)return null;let c=b.walkthrough.steps[a.currentStep];return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-sm",onClick:a.skip}),(0,d.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-[101] rounded-t-2xl border-t shadow-lg p-5 pb-8 animate-in slide-in-from-bottom duration-300",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:b.walkthrough.step(a.currentStep+1,a.totalSteps)}),(0,d.jsx)("div",{className:"flex items-center gap-1 ml-auto",children:Array.from({length:a.totalSteps},(b,c)=>(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:c===a.currentStep?"var(--amber)":"var(--border)"}},c))})]}),(0,d.jsx)("h3",{className:"text-base font-semibold font-display mb-1",style:{color:"var(--foreground)"},children:c.title}),(0,d.jsx)("p",{className:"text-sm leading-relaxed mb-5",style:{color:"var(--muted-foreground)"},children:c.body}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("button",{onClick:a.skip,className:"text-sm transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:b.walkthrough.skip}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a.currentStep>0&&(0,d.jsx)("button",{onClick:a.back,className:"text-sm px-3 py-2 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:b.walkthrough.back}),(0,d.jsx)("button",{onClick:a.next,className:"text-sm px-4 py-2 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a.currentStep===a.totalSteps-1?b.walkthrough.done:b.walkthrough.next})]})]})]})]}):null}function n(){return"active"===i(a=>a.status)?(0,d.jsx)(l,{}):null}},85034:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/app/error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/app/error.tsx","default")},85520:(a,b,c)=>{"use strict";c.d(b,{D:()=>e});var d=c(99829);let e=(0,d.createServerReference)("004277b0ddf905eaed45f61af2e364ff335151f197",d.callServer,void 0,d.findSourceMapURL,"scanExampleFilesAction")},86364:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/svg+xml",sizes:"any",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.svg")+"?3c05474ce4fc06a8"}]},86367:(a,b,c)=>{"use strict";c.d(b,{LD:()=>d,LZ:()=>e,qQ:()=>f});let d=[{id:"c1",icon:"\uD83D\uDC64",category:"memory-sync",scenario:"first-day"},{id:"c2",icon:"\uD83D\uDCE5",category:"knowledge-management",scenario:"daily"},{id:"c3",icon:"\uD83D\uDD04",category:"memory-sync",scenario:"project"},{id:"c4",icon:"\uD83D\uDD01",category:"experience-evolution",scenario:"daily"},{id:"c5",icon:"\uD83D\uDCA1",category:"auto-execute",scenario:"daily"},{id:"c6",icon:"\uD83D\uDE80",category:"auto-execute",scenario:"project"},{id:"c7",icon:"\uD83D\uDD0D",category:"knowledge-management",scenario:"project"},{id:"c8",icon:"\uD83E\uDD1D",category:"human-insights",scenario:"daily"},{id:"c9",icon:"\uD83D\uDEE1️",category:"audit-control",scenario:"advanced"}],e=["knowledge-management","memory-sync","auto-execute","experience-evolution","human-insights","audit-control"],f=["first-day","daily","project","advanced"]},86771:(a,b,c)=>{Promise.resolve().then(c.bind(c,2420))},89119:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>T});var e=c(48249),f=c(67484),g=c(19099),h=c(2116),i=c.n(h),j=c(9915),k=c(10316),l=c(95581),m=c(46674),n=c(801),o=c(4615),p=c(53696),q=c(82298),r=c(20892),s=c(99791),t=c(33073),u=c(29820),v=c(82626),w=c(84197),x=c(61112),y=c(96716),z=c(2923),A=c(80829),B=c(610),C=c(28079),D=c(65607),E=c(23017),F=c(73778),G=c(90933),H=c(94779),I=c(11197),J=c(60907),K=c(30315),L=c(90314),M=c(2518),N=c(84668);c(70377);var O=c(65141),P=c(13859),Q=c(69593);c(99101);var R=c(63710),S=a([x,C,D,P]);[x,C,D,P]=S.then?(await S)():S;let U=(0,L.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./ImportModal"]},ssr:!1});function T({fileTree:a,children:b}){let c=(0,O.b)(),d=(0,P.$)(),[h,L]=(0,f.useState)(!1),[S,T]=(0,f.useState)(void 0),[V,W]=(0,f.useState)(!1),[X,Y]=(0,f.useState)(null),[Z,$]=(0,f.useState)(null),[_,aa]=(0,f.useState)(()=>y.wl),ab=(0,Q.dB)(),[ac,ad]=(0,f.useState)(!1),[ae,af]=(0,f.useState)(0),ag=(0,f.useCallback)(()=>{ad(!1),"organizing"!==ab.phase||ab.abort(),ab.reset()},[ab]),ah=(0,f.useCallback)(()=>{af(a=>a+1),window.dispatchEvent(new Event("mindos:organize-history-update"))},[]),[ai,aj]=(0,f.useState)(!1),[ak,al]=(0,f.useState)(void 0),[am,an]=(0,f.useState)(void 0),[ao,ap]=(0,f.useState)(!1),aq=(0,f.useRef)(0),ar=(0,f.useCallback)(a=>{al(a),an(void 0),aj(!0)},[]),as=(0,f.useCallback)(()=>{aj(!1),al(void 0),an(void 0)},[]),[at,au]=(0,f.useState)(!1),[av,aw]=(0,f.useState)(!1),[ax,ay]=(0,f.useState)(!1),{t:az}=(0,K.Y)(),aA=(0,g.useRouter)(),aB=(0,g.usePathname)(),aC=(0,f.useMemo)(()=>(function a(b,c=""){let d=[];for(let e of b)if("directory"===e.type&&!e.name.startsWith(".")){let b=c?`${c}/${e.name}`:e.name;d.push(b),e.children&&d.push(...a(e.children,b))}return d})(a),[a]),{status:aD,fetchStatus:aE}=(0,J.dW)(),aF=aB.startsWith("/view/")?aB.slice(6).split("/").map(decodeURIComponent).join("/"):void 0,aG=aB?.startsWith("/agents"),aH=c.activePanel??(aG?"agents":null),aI=(0,f.useCallback)(()=>{let a=()=>window.dispatchEvent(new Event("guide-state-updated"));"guide"===d.askOpenSource?fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{askedAI:!0}})}).then(a).catch(a=>console.warn("Guide state update failed:",a)):"guide-next"===d.askOpenSource&&a()},[d.askOpenSource]),aJ=(0,f.useCallback)(a=>{aa(a);try{localStorage.setItem("right-agent-detail-panel-width",String(a))}catch{}},[]),aK=(0,f.useCallback)(()=>$(null),[]),aL=null!==Z&&"agents"===c.activePanel,aM=(0,f.useCallback)(()=>{T("sync"),W(!1),L(!0)},[]),aN=(0,f.useCallback)(()=>{L(!0),T(void 0)},[]),aO=(0,f.useCallback)(()=>{L(!1),T(void 0)},[]),aP=(0,f.useCallback)(a=>{Y(a),W(a=>!a)},[]),aQ=(0,f.useCallback)(a=>{c.handleExpandedChange(a),W(!1)},[c]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(M.A,{}),(0,e.jsx)(N.A,{}),(0,e.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[60] focus:px-4 focus:py-2 focus:rounded-lg focus:text-sm focus:font-medium focus:font-display bg-[var(--amber)] text-[var(--amber-foreground)]",children:"Skip to main content"}),(0,e.jsx)(o.Ay,{activePanel:aH,onPanelChange:c.setActivePanel,onEchoClick:()=>{let a="echo"===c.activePanel;c.setActivePanel(a?null:"echo"),a||aA.push("/echo/about-you")},onAgentsClick:()=>{let a="agents"===c.activePanel;c.setActivePanel(a?null:"agents"),a||aA.push("/agents"),$(null)},onDiscoverClick:()=>{let a="discover"===c.activePanel;c.setActivePanel(a?null:"discover"),a||aA.push("/explore")},syncStatus:aD,expanded:c.railExpanded,onExpandedChange:aQ,onSettingsClick:aN,onSyncClick:aP}),(0,e.jsxs)(p.Ay,{activePanel:c.activePanel,fileTree:a,onNavigate:()=>{},onOpenSyncSettings:aM,railWidth:c.railWidth,panelWidth:c.panelWidth??void 0,onWidthChange:c.handlePanelWidthChange,onWidthCommit:c.handlePanelWidthCommit,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,onImport:ar,children:[(0,e.jsx)("div",{className:`flex flex-col h-full ${"echo"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(v.A,{active:"echo"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"search"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(s.A,{active:"search"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"agents"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(t.A,{active:"agents"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,selectedAgentKey:aL?Z:null})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"discover"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(u.A,{active:"discover"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"workflows"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(w.A,{active:"workflows"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})})]}),(0,e.jsx)(x.Ay,{open:d.askPanelOpen,onClose:d.closeAskPanel,currentFile:aF,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aI,width:d.askPanelWidth,onWidthChange:d.handleAskWidthChange,onWidthCommit:d.handleAskWidthCommit,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch,maximized:d.askMaximized,onMaximize:d.toggleAskMaximized,sidebarOffset:c.panelOpen?c.railWidth+c.effectivePanelWidth:c.railWidth}),(0,e.jsx)(y.Ay,{open:aL,agentKey:Z,onClose:aK,rightOffset:d.askPanelOpen?d.askPanelWidth:0,width:_,onWidthChange:aa,onWidthCommit:aJ}),(0,e.jsx)(C.A,{open:d.desktopAskPopupOpen,onClose:d.closeDesktopAskPopup,currentFile:aF,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aI,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch}),(0,e.jsx)(z.A,{onToggle:d.toggleAskPanel,askPanelOpen:d.askPanelOpen||d.desktopAskPopupOpen}),(0,e.jsx)(E.A,{}),(0,e.jsx)(D.A,{open:h,onClose:aO,initialTab:S}),(0,e.jsx)(A.A,{open:V,onClose:()=>W(!1),anchorRect:X,railWidth:c.railWidth,onOpenSyncSettings:aM,syncStatus:aD,onSyncStatusRefresh:aE}),(0,e.jsxs)("header",{className:"md:hidden fixed top-0 left-0 right-0 z-30 bg-card border-b border-border flex items-center justify-between px-3 py-2",style:{paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,e.jsx)("button",{onClick:()=>au(!0),className:"p-3 -ml-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":"Open menu",children:(0,e.jsx)(j.A,{size:20})}),(0,e.jsxs)(i(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,e.jsx)(r.A,{id:"mobile"}),(0,e.jsx)("span",{className:"font-semibold text-foreground text-sm tracking-wide",children:"MindOS"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:aM,className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent flex items-center justify-center","aria-label":"Sync status",children:(0,e.jsx)(J.jc,{status:aD})}),(0,e.jsx)("button",{onClick:()=>aw(!0),className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":az.sidebar.searchTitle,children:(0,e.jsx)(k.A,{size:20})}),(0,e.jsx)("button",{onClick:()=>{L(!0),T(void 0)},className:"p-3 -mr-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":az.sidebar.settingsTitle,children:(0,e.jsx)(l.A,{size:20})})]})]}),at&&(0,e.jsx)("div",{className:"md:hidden fixed inset-0 z-40 overlay-backdrop",onClick:()=>au(!1)}),(0,e.jsxs)("aside",{className:`md:hidden fixed top-0 left-0 h-screen w-[85vw] max-w-[320px] z-50 bg-card border-r border-border flex flex-col transition-transform duration-300 ease-in-out ${at?"translate-x-0":"-translate-x-full"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-4 border-b border-border shrink-0",children:[(0,e.jsxs)(i(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,e.jsx)(r.A,{id:"drawer"}),(0,e.jsx)("span",{className:"font-semibold text-foreground text-sm tracking-wide font-display",children:"MindOS"})]}),(0,e.jsx)("button",{onClick:()=>au(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(m.A,{size:16})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,e.jsx)(q.Ay,{nodes:a,onNavigate:()=>au(!1),onImport:ar})})]}),(0,e.jsx)(B.A,{open:av,onClose:()=>aw(!1)}),(0,e.jsx)(C.A,{open:ax,onClose:()=>ay(!1),currentFile:aF}),(0,e.jsxs)("main",{id:"main-content",className:"min-h-screen transition-all duration-200 pt-[52px] md:pt-0",onDragEnter:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),aq.current++,1===aq.current&&ap(!0))},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&a.preventDefault()},onDragLeave:()=>{aq.current=Math.max(0,aq.current-1),0===aq.current&&ap(!1)},onDrop:a=>{a.preventDefault(),aq.current=0,ap(!1),a.dataTransfer.files.length>0&&!ai&&(0,R.Q)(Array.from(a.dataTransfer.files),az)},children:[(0,e.jsxs)("div",{className:"min-h-screen bg-background",style:{overflowX:"clip"},children:[(0,e.jsx)(F.A,{}),b]}),(0,e.jsx)(G.A,{}),(0,e.jsx)(I.A,{t:az,dirPaths:aC}),ao&&!ai&&(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm transition-opacity duration-200",children:(0,e.jsxs)("div",{className:"border-2 border-dashed border-[var(--amber)]/50 rounded-xl p-12 flex flex-col items-center gap-3",children:[(0,e.jsx)(n.A,{size:48,className:"text-[var(--amber)]/60"}),(0,e.jsx)("p",{className:"text-sm text-foreground font-medium",children:az.inbox.dropOverlay}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:az.inbox.dropOverlayFormats})]})})]}),(0,e.jsx)(U,{open:ai,onClose:as,defaultSpace:ak,initialFiles:am,aiOrganize:ab,dirPaths:aC}),ac&&(0,e.jsx)(H.A,{aiOrganize:ab,onDismiss:ag,onCancel:()=>{ab.abort(),ab.reset(),ad(!1)},onHistoryUpdate:ah}),(0,e.jsx)("style",{children:`
186
+ `,title:n.acpChangeAgent,"aria-expanded":o,"aria-haspopup":"listbox",children:[x?(0,d.jsx)(g.A,{size:11,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--success)] shrink-0"}),(0,d.jsx)("span",{className:"truncate max-w-[120px]",children:y}),a?(0,d.jsx)("span",{role:"button",tabIndex:0,onClick:w,onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),w(a))},className:"p-0.5 -mr-1 rounded-full text-muted-foreground hover:text-foreground transition-colors","aria-label":`Remove ${a.name}`,children:(0,d.jsx)(i.A,{size:9})}):(0,d.jsx)(j.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&z&&(0,f.createPortal)(z,document.body)]})}},74356:(a,b,c)=>{"use strict";c.d(b,{A:()=>Y});var d=c(48249),e=c(67484),f=c(42742),g=c(15273),h=c(95801),i=c(40560),j=c(145),k=c(6079),l=c(8455),m=c(75157),n=c(96348),o=c(92023),p=c(36815),q=c(69593),r=c(39868),s=c(10316),t=c(7309),u=c(35654),v=c(12625),w=c(50567),x=c(80600),y=c(93017),z=c(59347),A=c(62688),B=c(11035),C=c(96286),D=c(13576),E=c(83654),F=c(44218),G=c(19794),H=c(31675),I=c(49681),J=c(2797);let K=new Set(["delete_file","move_file","rename_file","write_file"]),L=new Set(["write_file","create_file","update_section","insert_after_heading","edit_lines","append_to_file"]),M={search:s.A,list_files:t.A,read_file:u.A,write_file:v.A,create_file:w.A,append_to_file:x.A,insert_after_heading:y.A,update_section:v.A,delete_file:z.A,rename_file:x.A,move_file:A.A,get_backlinks:B.A,get_history:C.A,get_file_at_version:C.A,get_recent:D.A,append_csv:E.A},N="--- changes ---";function O({part:a}){let b=L.has(a.toolName),c="done"===a.state,[f,g]=(0,e.useState)(null),h=f??(b&&c),k=M[a.toolName]??j.A,l=K.has(a.toolName),m=(0,e.useMemo)(()=>(function(a){if(!a)return{header:"",stats:"",diffLines:[]};let b=a.indexOf(N);if(-1===b)return{header:a,stats:"",diffLines:[]};let c=a.slice(0,b).trim(),d=a.slice(b+N.length).trim(),e=c.match(/\((\+\d+\s*−\d+)\)/);return{header:c,stats:e?e[1]:"",diffLines:d.split("\n").map(a=>a.startsWith("+ ")?{prefix:"+",text:a.slice(2)}:a.startsWith("- ")?{prefix:"-",text:a.slice(2)}:a.startsWith(" ")?{prefix:" ",text:a.slice(2)}:{prefix:" ",text:a})}})(a.output),[a.output]),n=(0,e.useMemo)(()=>a.input&&"object"==typeof a.input?a.input.path??"":"",[a.input]),o=n?`${n.split("/").pop()??n}${m.stats?` (${m.stats})`:""}`:function(a){if(!a||"object"!=typeof a)return String(a??"");let b=[];for(let c of Object.values(a))"string"==typeof c?b.push(c.length>60?`${c.slice(0,60)}…`:c):Array.isArray(c)?b.push(`[${c.length} items]`):null!=c&&b.push(String(c));return b.join(", ")}(a.input);return(0,d.jsxs)("div",{className:`my-1 rounded-md border text-xs font-mono ${l?"border-[var(--amber)]/30 bg-background/60":"border-border/50 bg-background/60"}`,children:[(0,d.jsxs)("button",{type:"button",onClick:()=>g(a=>null===a?!h:!a),className:"w-full flex items-center gap-1.5 px-2 py-1.5 text-left hover:bg-muted/30 transition-colors rounded-md",children:[h?(0,d.jsx)(F.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(G.A,{size:12,className:"shrink-0 text-muted-foreground"}),l&&(0,d.jsx)(H.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)(k,{size:12,className:`shrink-0 ${l?"text-[var(--amber)]":"text-muted-foreground"}`}),(0,d.jsx)("span",{className:`font-medium ${l?"text-[var(--amber)]":"text-foreground"}`,children:a.toolName}),(0,d.jsx)("span",{className:"text-muted-foreground truncate flex-1",children:o}),(0,d.jsx)("span",{className:"shrink-0 ml-auto",children:"pending"===a.state||"running"===a.state?(0,d.jsx)(i.A,{size:12,className:"animate-spin text-[var(--amber)]"}):"done"===a.state?(0,d.jsx)(I.A,{size:12,className:"text-success"}):(0,d.jsx)(J.A,{size:12,className:"text-error"})})]}),h&&(0,d.jsx)("div",{className:"border-t border-border/30",children:b&&c&&m.diffLines.length>0?(0,d.jsx)("div",{className:"max-h-64 overflow-y-auto",children:m.diffLines.map((a,b)=>(0,d.jsxs)("div",{className:`px-2 py-px flex items-start gap-1.5 ${"+"===a.prefix?"bg-success/8":"-"===a.prefix?"bg-error/8":""}`,children:[(0,d.jsx)("span",{className:`select-none w-3 shrink-0 text-right ${"+"===a.prefix?"text-success":"-"===a.prefix?"text-error":"text-muted-foreground/50"}`,children:a.prefix}),(0,d.jsx)("span",{className:`whitespace-pre-wrap break-all flex-1 ${"+"===a.prefix?"text-success":"-"===a.prefix?"text-error":"text-muted-foreground"}`,children:a.text||"\xa0"})]},b))}):(0,d.jsxs)("div",{className:"px-2 pb-2 pt-1 space-y-1",children:["running"===a.state&&(0,d.jsxs)("div",{className:"text-muted-foreground/60 text-2xs flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:10,className:"animate-spin"})," Running..."]}),(0,d.jsxs)("div",{className:"text-muted-foreground",children:[(0,d.jsx)("span",{className:"font-semibold",children:"Input: "}),(0,d.jsx)("span",{className:"break-all whitespace-pre-wrap",children:JSON.stringify(a.input,null,2)})]}),void 0!==a.output&&""!==a.output&&(0,d.jsxs)("div",{className:"text-muted-foreground",children:[(0,d.jsx)("span",{className:"font-semibold",children:"Output: "}),(0,d.jsx)("span",{className:"break-all whitespace-pre-wrap",children:a.output.length>500?a.output.slice(0,500)+"…":a.output})]})]})})]})}var P=c(46218),Q=c(30315);function R({text:a,isStreaming:b}){let[c,f]=(0,e.useState)(!1),{t:g}=(0,Q.Y)();return a||b?(0,d.jsxs)("div",{className:"my-1 rounded-md border border-border/40 bg-muted/20 text-xs",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a=>!a),className:"w-full flex items-center gap-1.5 px-2 py-1.5 text-left hover:bg-muted/30 transition-colors rounded-md",children:[c?(0,d.jsx)(F.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(G.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsx)(P.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsxs)("span",{className:"text-muted-foreground font-medium",children:[g.ask.thinkingLabel,b&&!c&&(0,d.jsx)("span",{className:"ml-1 animate-pulse",children:"..."})]}),!c&&a&&(0,d.jsxs)("span",{className:"text-muted-foreground/60 truncate flex-1 ml-1",children:[a.slice(0,80),a.length>80?"...":""]})]}),c&&(0,d.jsx)("div",{className:"px-2 pb-2 pt-0.5 border-t border-border/30",children:(0,d.jsxs)("div",{className:"text-muted-foreground whitespace-pre-wrap leading-relaxed",children:[a,b&&(0,d.jsx)("span",{className:"inline-block w-1 h-3 bg-muted-foreground/40 ml-0.5 align-middle animate-pulse rounded-sm"})]})})]}):null}let S=/^Use the skill ([^:]+):\s*/;function T({text:a}){let[b,c]=(0,e.useState)(!1),h=(0,e.useCallback)(()=>{(0,r.l)(a).then(a=>{a&&(c(!0),setTimeout(()=>c(!1),2e3))})},[a]);return(0,d.jsx)("button",{type:"button",onClick:h,className:"absolute -bottom-1 right-1 p-1 rounded-md bg-card border border-border/60 shadow-sm text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy",children:b?(0,d.jsx)(f.A,{size:11,className:"text-success"}):(0,d.jsx)(g.A,{size:11})})}function U({content:a,skillName:b,images:c}){let e=b??a.match(S)?.[1],f=a.match(S),g=f?a.slice(f[0].length):a;return(0,d.jsxs)(d.Fragment,{children:[c&&c.length>0&&(0,d.jsx)("div",{className:`flex flex-wrap gap-1.5${a?" mb-2":""}`,children:c.map((a,b)=>a.data?(0,d.jsx)("img",{src:`data:${a.mimeType};base64,${a.data}`,alt:`Image ${b+1}`,className:"max-h-48 max-w-full rounded-md object-contain"},b):(0,d.jsx)("div",{className:"h-12 px-3 rounded-md bg-muted flex items-center gap-1.5 text-xs text-muted-foreground",children:(0,d.jsxs)("span",{children:["[Image ",b+1,"]"]})},b))}),e&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[11px] font-medium bg-[var(--amber)]/15 text-[var(--amber)] mr-1 align-middle",children:[(0,d.jsx)(h.A,{size:10,className:"shrink-0"}),e]}),e?g:a]})}function V({content:a,isStreaming:b}){let c=(0,q.Oo)(a);return c||b?(0,d.jsxs)("div",{className:"prose prose-sm prose-panel dark:prose-invert max-w-none text-foreground prose-p:my-2 prose-p:leading-relaxed prose-headings:font-semibold prose-headings:my-3 prose-h1:text-base prose-h2:text-[15px] prose-h3:text-sm prose-ul:my-1.5 prose-li:my-0.5 prose-ol:my-1.5 prose-code:text-[0.8em] prose-code:bg-background/60 prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:before:content-none prose-code:after:content-none prose-pre:bg-background/60 prose-pre:text-foreground prose-pre:text-xs prose-blockquote:border-l-[var(--amber)] prose-blockquote:text-muted-foreground prose-a:text-[var(--amber)] prose-a:no-underline hover:prose-a:underline prose-strong:text-foreground prose-strong:font-semibold prose-table:text-xs prose-th:py-1 prose-td:py-1 ",children:[(0,d.jsx)(o.oz,{remarkPlugins:[p.A],children:c}),b&&(0,d.jsx)("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--amber)] ml-0.5 align-middle animate-pulse rounded-sm"})]}):null}function W({message:a,isStreaming:b}){let c=a.parts;if(!c||0===c.length)return a.content?(0,d.jsx)(V,{content:a.content,isStreaming:b}):null;let e=c[c.length-1],f=b&&"tool-call"===e.type&&("running"===e.state||"pending"===e.state);return(0,d.jsxs)("div",{children:[c.map((a,e)=>{if("reasoning"===a.type){let f=b&&e===c.length-1;return(0,d.jsx)(R,{text:a.text,isStreaming:f},`reasoning-${e}`)}if("text"===a.type){let f=b&&e===c.length-1;return a.text?(0,d.jsx)(V,{content:a.text,isStreaming:f},e):null}return"tool-call"===a.type?(0,d.jsx)(O,{part:a},a.toolCallId):null}),f&&(0,d.jsxs)("div",{className:"flex items-center gap-2 py-1 mt-1",children:[(0,d.jsx)(i.A,{size:12,className:"animate-spin text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"Executing tool…"})]})]})}function X({parts:a}){if(!a)return null;let b=a.filter(a=>"tool-call"===a.type);if(0===b.length)return null;let c=b[b.length-1],e="tool-call"===c.type?c.toolName:"";return(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5 text-xs text-muted-foreground/70",children:[(0,d.jsx)(j.A,{size:10}),(0,d.jsxs)("span",{children:["Step ",b.length,e?` — ${e}`:""]})]})}let Y=(0,e.memo)(function({messages:a,isLoading:b,loadingPhase:c,emptyPrompt:f,emptyHint:g,suggestions:h,onSuggestionClick:j,labels:o}){let p=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,t]=(0,e.useState)(!1),u=(0,e.useCallback)(()=>{p.current?.scrollIntoView({behavior:"smooth"})},[]);return(0,d.jsxs)("div",{ref:r,className:"relative flex-1 overflow-y-auto overflow-x-hidden px-4 py-4 space-y-4 min-h-0",children:[0===a.length&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1 min-h-[200px] px-4",children:[(0,d.jsx)("div",{className:"w-10 h-10 rounded-xl bg-[var(--amber)]/10 flex items-center justify-center mb-4",children:(0,d.jsx)(k.A,{size:20,className:"text-[var(--amber)]"})}),(0,d.jsx)("p",{className:"text-center text-sm font-medium text-foreground/80 mb-1",children:f}),g&&(0,d.jsx)("p",{className:"text-center text-[11px] text-muted-foreground/50 mb-5",children:g}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 max-w-sm w-full",children:h.map((a,b)=>(0,d.jsx)("button",{type:"button",onClick:()=>j(a),className:"text-left text-xs px-3 py-2.5 rounded-lg border border-border/60 bg-card text-muted-foreground hover:text-foreground hover:border-[var(--amber)]/30 hover:bg-[var(--amber)]/5 transition-colors leading-snug",children:a},b))})]}),a.map((e,f)=>(0,d.jsxs)("div",{className:`flex gap-3 ${"user"===e.role?"justify-end":"justify-start"}`,children:["assistant"===e.role&&(0,d.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center shrink-0 mt-0.5 bg-[var(--amber-dim)]",children:(0,d.jsx)(k.A,{size:12,className:"text-[var(--amber)]"})}),"user"===e.role?(0,d.jsx)("div",{className:"max-w-[85%] px-3 py-2 rounded-xl rounded-br-sm text-sm leading-relaxed whitespace-pre-wrap bg-[var(--amber)] text-[var(--amber-foreground)]",children:(0,d.jsx)(U,{content:e.content,skillName:e.skillName,images:e.images})}):e.content.startsWith("__error__")?(0,d.jsx)("div",{className:"max-w-[85%] px-3 py-2.5 rounded-xl rounded-bl-sm border border-error/20 bg-error/8 text-sm",children:(0,d.jsxs)("div",{className:"flex items-start gap-2 text-error",children:[(0,d.jsx)(l.A,{size:14,className:"shrink-0 mt-0.5"}),(0,d.jsx)("span",{className:"leading-relaxed",children:e.content.slice(9)})]})}):(0,d.jsx)("div",{className:"group relative max-w-[85%] px-3 py-2 rounded-xl rounded-bl-sm bg-muted text-foreground text-sm",children:e.parts&&e.parts.length>0||(0,q.Oo)(e.content)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(W,{message:e,isStreaming:b&&f===a.length-1}),b&&f===a.length-1&&(0,d.jsx)(X,{parts:e.parts}),!(b&&f===a.length-1)&&(0,q.Oo)(e.content)&&(0,d.jsx)(T,{text:(0,q.Oo)(e.content)})]}):b&&f===a.length-1?(0,d.jsxs)("div",{className:"flex items-center gap-2 py-1",children:["reconnecting"===c?(0,d.jsx)(m.A,{size:14,className:"text-[var(--amber)] animate-pulse"}):(0,d.jsx)(i.A,{size:14,className:"animate-spin text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"reconnecting"===c?o.reconnecting??"Reconnecting...":"connecting"===c?o.connecting:"thinking"===c?o.thinking:o.generating})]}):null})]},f)),(0,d.jsx)("div",{ref:p}),s&&a.length>0&&(0,d.jsx)("button",{type:"button",onClick:u,className:"sticky bottom-2 left-1/2 -translate-x-1/2 z-10 p-1.5 rounded-full border border-border/60 bg-card shadow-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"Scroll to bottom",children:(0,d.jsx)(n.A,{size:14})})]})})},75539:(a,b,c)=>{"use strict";c.d(b,{A:()=>i});var d=c(48249),e=c(67484),f=c(12625),g=c(59347),h=c(54461);function i({sessions:a,activeSessionId:b,onLoad:c,onDelete:i,onRename:j,onClearAll:k,labels:l}){let[m,n]=(0,e.useState)(!1),o=(0,e.useRef)(void 0),[p,q]=(0,e.useState)(null),[r,s]=(0,e.useState)(""),t=(0,e.useRef)(null),u=(0,e.useCallback)(a=>{q(a.id),s((0,h.d)(a))},[]),v=(0,e.useCallback)(()=>{p&&(j(p,r),q(null))},[p,r,j]),w=(0,e.useCallback)(()=>{q(null)},[]);return(0,d.jsxs)("div",{className:"border-b border-border px-4 py-2.5 max-h-[190px] overflow-y-auto",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l.title}),a.length>1&&(0,d.jsx)("button",{type:"button",onClick:()=>{if(!m){n(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>n(!1),3e3);return}o.current&&clearTimeout(o.current),k(),n(!1)},className:`text-2xs px-1.5 py-0.5 rounded transition-colors ${m?"bg-error/10 text-error font-medium":"text-muted-foreground hover:text-error hover:bg-muted"}`,children:m?l.confirmClear:l.clearAll})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[0===a.length&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground/70",children:l.noSessions}),a.map(a=>(0,d.jsxs)("div",{className:"group flex items-center gap-1",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>c(a.id),onDoubleClick:()=>u(a),className:`flex-1 text-left px-2 py-1.5 rounded text-xs transition-colors min-w-0 ${b===a.id?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"}`,children:[p===a.id?(0,d.jsx)("input",{ref:t,type:"text",value:r,onChange:a=>s(a.target.value),onBlur:v,onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),v()),"Escape"===a.key&&(a.preventDefault(),w())},onClick:a=>a.stopPropagation(),className:"w-full bg-transparent border-b border-[var(--amber)] outline-none text-xs text-foreground"}):(0,d.jsx)("div",{className:"truncate",children:(0,h.d)(a)}),p!==a.id&&(0,d.jsx)("div",{className:"text-2xs opacity-60",children:new Date(a.updatedAt).toLocaleString()})]}),(0,d.jsx)("button",{type:"button",onClick:()=>u(a),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:l.rename,children:(0,d.jsx)(f.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:()=>i(a.id),className:"p-1 rounded text-muted-foreground hover:text-error hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete session",children:(0,d.jsx)(g.A,{size:12})})]},a.id))]})]})}},78340:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>l});var d=c(48249),e=c(67484),f=c(19099),g=c(80600),h=c(86588),i=c(33191);function j(a){return a.split("/").pop()?.replace(/\.md$/,"")??a}function k({text:a}){let b=a.split(/(\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\))/g);return(0,d.jsx)("span",{children:b.map((a,b)=>/^\[\[/.test(a)||/^\[/.test(a)?(0,d.jsx)("span",{style:{color:"var(--amber)",fontWeight:500},children:a},b):(0,d.jsx)("span",{children:a},b))})}function l({filePath:a}){let b=(0,f.useRouter)(),[c,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!0);if(m)return(0,d.jsx)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",fontSize:12,color:"var(--muted-foreground)"},children:"Scanning backlinks…"});let o=c??[];return(0,d.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,d.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,d.jsx)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:0===o.length?"No backlinks found":`${o.length} file${1===o.length?"":"s"} link here`})}),0===o.length?(0,d.jsxs)("div",{style:{border:"1px dashed var(--border)",borderRadius:10,padding:"2.5rem 1.5rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:[(0,d.jsx)(g.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,d.jsxs)("p",{className:"font-display",style:{fontSize:12},children:["No other files link to ",(0,d.jsx)("strong",{style:{color:"var(--foreground)"},children:j(a)})," yet."]})]}):(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:o.map(({filePath:a,snippets:c})=>{let e,f=j(a),l=(e=a.split("/")).length>1?e.slice(0,-1).join("/"):"";return(0,d.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",cursor:"pointer",transition:"border-color .15s"},onClick:()=>b.push("/view/"+(0,i.O0)(a)),onMouseEnter:a=>a.currentTarget.style.borderColor="rgba(200,135,58,0.4)",onMouseLeave:a=>a.currentTarget.style.borderColor="var(--border)",children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",borderBottom:c.length>0?"1px solid var(--border)":"none",background:"var(--muted)"},children:[(0,d.jsx)(g.A,{size:13,style:{color:"var(--muted-foreground)",flexShrink:0}}),(0,d.jsx)("span",{style:{fontWeight:600,fontSize:"0.85rem",color:"var(--foreground)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f}),l&&(0,d.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6,flexShrink:0},children:l}),(0,d.jsx)(h.A,{size:11,style:{color:"var(--muted-foreground)",opacity:.5,flexShrink:0}})]}),c.map((a,b)=>(0,d.jsx)("div",{style:{padding:"8px 14px",borderBottom:b<c.length-1?"1px solid var(--border)":"none",background:"var(--background)"},children:a.split("\n").map((a,b)=>(0,d.jsx)("div",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--muted-foreground)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,d.jsx)(k,{text:a})},b))},b))]},a)})})]})}c(95054)},78533:(a,b,c)=>{"use strict";var d=c(36312);for(let a of[{id:"agent-inspector",name:"Agent Inspector",description:"Visualizes agent tool-call logs as a filterable timeline. Auto-activates on .mindos/agent-audit-log.json and supports legacy .agent-log.json.",author:"MindOS",icon:"\uD83D\uDD0D",tags:["agent","inspector","log","mcp","tools"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/agent-audit-log.json",match:({filePath:a})=>/(^|\/)\.mindos\/agent-audit-log\.json$/i.test(a)||/\.agent-log\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,66913)).then(a=>({default:a.AgentInspectorRenderer}))},{id:"backlinks",name:"Backlinks Explorer",description:"Shows all files that link to the current page via wikilinks or markdown links, with highlighted snippet context.",author:"MindOS",icon:"\uD83D\uDD17",tags:["backlinks","wiki","links","references"],builtin:!0,entryPath:"BACKLINKS.md",match:({filePath:a})=>/\bBACKLINKS\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,66874)).then(a=>({default:a.BacklinksRenderer}))},{id:"config-panel",name:"Config Panel",description:"Renders CONFIG.json as an editable control panel based on uiSchema/keySpecs. Changes are written back to the JSON file directly.",author:"MindOS",icon:"\uD83E\uDDE9",tags:["config","json","settings","schema"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"CONFIG.json",match:({filePath:a,extension:b})=>"json"===b&&/(^|\/)CONFIG\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,63112)).then(a=>({default:a.ConfigRenderer}))},{id:"csv",name:"CSV Views",description:"Renders any CSV file as Table, Gallery, or Board. Each view is independently configurable — choose which columns map to title, description, tag, and group.",author:"MindOS",icon:"\uD83D\uDCCA",tags:["csv","table","gallery","board","data"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"Resources/Products.csv",match:({extension:a,filePath:b})=>"csv"===a&&!/\bTODO\b/i.test(b),load:()=>Promise.resolve().then(c.bind(c,60442)).then(a=>({default:a.CsvRenderer}))},{id:"summary",name:"AI Briefing",description:"Streams an AI-generated daily briefing summarizing your most recently modified files — key changes, recurring themes, and suggested next actions.",author:"MindOS",icon:"✨",tags:["ai","summary","briefing","daily"],builtin:!0,entryPath:"DAILY.md",match:({filePath:a})=>/\b(SUMMARY|summary|Summary|BRIEFING|briefing|Briefing|DAILY|daily|Daily)\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,45862)).then(a=>({default:a.SummaryRenderer}))},{id:"timeline",name:"Timeline",description:"Renders changelog and journal files as a vertical timeline. Any markdown with ## date headings (e.g. ## 2025-01-15) becomes a card in the feed.",author:"MindOS",icon:"\uD83D\uDCC5",tags:["timeline","changelog","journal","history"],builtin:!0,entryPath:"CHANGELOG.md",match:({filePath:a})=>/\b(CHANGELOG|changelog|TIMELINE|timeline|journal|Journal|diary|Diary)\b.*\.md$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,1394)).then(a=>({default:a.TimelineRenderer}))},{id:"todo",name:"TODO Board",description:"Renders TODO.md/TODO.csv as an interactive kanban board grouped by section. Check items off directly — changes are written back to the source file.",author:"MindOS",icon:"✅",tags:["productivity","tasks","markdown"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"TODO.md",match:({filePath:a})=>/\bTODO\b.*\.(md|csv)$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,18776)).then(a=>({default:a.TodoRenderer}))},{id:"workflow-yaml",name:"Workflow Runner",description:"Execute step-by-step YAML workflows with Skills & Agent support.",author:"MindOS",icon:"⚡",tags:["workflow","automation","steps","ai","yaml"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/workflows/",match:({extension:a,filePath:b})=>("yaml"===a||"yml"===a)&&/\.flow\.(yaml|yml)$/i.test(b),load:()=>Promise.resolve().then(c.bind(c,83539)).then(a=>({default:a.WorkflowYamlRenderer}))},{id:"graph",name:"Wiki Graph",description:"Force-directed graph of wikilink references across all markdown files. Supports Global and Local (2-hop) scope filters.",author:"MindOS",icon:"\uD83D\uDD78️",tags:["graph","wiki","links","visualization"],builtin:!0,match:()=>!1,load:()=>Promise.resolve().then(c.bind(c,37718)).then(a=>({default:a.GraphRenderer}))}])(0,d.TS)(a)},78890:(a,b,c)=>{"use strict";c.d(b,{G:()=>i,M:()=>j});var d=c(48249),e=c(2116),f=c.n(e),g=c(19794),h=c(33191);function i({icon:a,title:b,subtitle:c,badge:e,href:i,onClick:j,active:k}){let l=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted",children:a}),(0,d.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"block text-left text-sm font-medium text-foreground truncate",title:b,children:b}),c?(0,d.jsx)("span",{className:"block text-left text-2xs text-muted-foreground truncate",title:c,children:c}):null]}),e,(0,d.jsx)(g.A,{size:14,className:"shrink-0 text-muted-foreground"})]}),m=!!(k&&i),n=(0,h.cn)("relative flex items-center gap-3 py-2.5 transition-colors duration-150 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",m?"bg-[var(--amber-dim)]/40 pl-3.5 pr-4 text-foreground":"px-4",i&&!m&&"cursor-pointer hover:bg-muted/50",m&&"cursor-default",!i&&"cursor-pointer hover:bg-muted/50");return i?(0,d.jsxs)(f(),{href:i,className:n,"aria-current":k?"page":void 0,children:[m?(0,d.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}):null,l]}):(0,d.jsx)("button",{type:"button",onClick:j,className:(0,h.cn)(n,"w-full"),children:l})}function j({label:a}){return(0,d.jsx)("span",{className:"text-2xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground shrink-0",children:a})}},80829:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(46674),g=c(49681),h=c(2797),i=c(69924),j=c(60907),k=c(81285);function l({open:a,onClose:b,anchorRect:c,railWidth:l,onOpenSyncSettings:m,syncStatus:n,onSyncStatusRefresh:o}){let p=(0,e.useRef)(null);(0,e.useRef)(b).current=b;let{syncing:q,syncResult:r,syncNow:s}=(0,j.bj)(o);if(!a||!c)return null;let t=(0,j.Bq)(n,q),{label:u}=(0,j.ky)(t,n),v=Math.max(8,c.bottom-180);return(0,d.jsxs)("div",{ref:p,className:"fixed z-40 w-[240px] border rounded-lg bg-card shadow-lg border-border animate-in fade-in slide-in-from-left-2 duration-150",style:{top:v,left:l},children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Sync"}),(0,d.jsx)("button",{onClick:b,className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,d.jsx)(f.A,{size:14})})]}),(0,d.jsxs)("div",{className:"p-3 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${j.BG[t]} ${"syncing"===t||"conflicts"===t||"error"===t?"animate-pulse":""}`}),(0,d.jsx)("span",{className:"text-sm text-foreground",children:u}),"success"===r&&(0,d.jsx)(g.A,{size:14,className:"text-success shrink-0"}),"error"===r&&(0,d.jsx)(h.A,{size:14,className:"text-error shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:["off"!==t&&(0,d.jsxs)(k.jn,{onClick:s,disabled:q,className:"text-xs px-3 py-1.5 flex items-center gap-1.5",children:[(0,d.jsx)(i.A,{size:12,className:q?"animate-spin":""}),"Sync Now"]}),(0,d.jsx)("button",{onClick:()=>{m(),b()},className:"text-xs text-muted-foreground hover:text-foreground transition-colors rounded px-1 py-0.5 focus-visible:ring-2 focus-visible:ring-ring",children:"Settings →"})]})]})]})}},80992:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GraphRenderer:()=>j});var d=c(48249),e=c(67484),f=c(19099),g=c(96103),h=c(54633);c(71763),c(95054);let i=(0,e.memo)(function({data:a}){let b=(0,f.useRouter)(),{label:c,id:i,isCurrent:j,isOrphan:k,size:l=1}=a,m=(0,e.useCallback)(()=>{let a=i.split("/").map(encodeURIComponent).join("/");b.push("/view/"+a)},[i,b]),n=.8+Math.min(.1*l,1.2);return(0,d.jsxs)("div",{onClick:m,title:i,className:"group font-display",style:{fontSize:10*n,padding:`${4*n}px ${12*n}px`,borderRadius:999,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",opacity:k?.4:1,background:j?"var(--amber)":"var(--card)",color:j?"var(--amber-foreground)":"var(--foreground)",border:`1.5px solid ${j?"var(--amber)":"var(--border)"}`,boxShadow:j?"0 0 20px var(--amber-dim), 0 0 0 2px var(--amber-dim)":"0 2px 4px rgba(0,0,0,0.1)",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",zIndex:j?10:1},onMouseEnter:a=>{j||(a.currentTarget.style.borderColor="var(--amber)",a.currentTarget.style.background="var(--accent)")},onMouseLeave:a=>{j||(a.currentTarget.style.borderColor="var(--border)",a.currentTarget.style.background="var(--card)")},children:[(0,d.jsx)(g.h7,{type:"target",position:h.yX.Top,style:{opacity:0}}),c,(0,d.jsx)(g.h7,{type:"source",position:h.yX.Bottom,style:{opacity:0}})]})});function j({filePath:a}){let[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!0),[j,k]=(0,e.useState)("local"),[l,m]=(0,e.useState)(!1),n=(0,e.useMemo)(()=>{if(!b)return new Map;let a=new Map;for(let c of b.edges)a.set(c.source,(a.get(c.source)||0)+1),a.set(c.target,(a.get(c.target)||0)+1);return a},[b]),o=(0,e.useMemo)(()=>{if(!b)return null;let a=new Map;for(let c of b.edges)a.has(c.source)||a.set(c.source,new Set),a.has(c.target)||a.set(c.target,new Set),a.get(c.source).add(c.target),a.get(c.target).add(c.source);return a},[b]),{filteredNodes:p,filteredEdges:q}=(0,e.useMemo)(()=>{let c,d;if(!b)return{filteredNodes:[],filteredEdges:[]};if("global"===j)c=b.nodes,d=b.edges;else{let e=new Set,f=[{id:a,depth:0}];for(e.add(a);f.length>0;){let{id:a,depth:b}=f.shift();if(!(b>=2))for(let c of o?.get(a)??new Set)e.has(c)||(e.add(c),f.push({id:c,depth:b+1}))}let g=new Set((c=b.nodes.filter(a=>e.has(a.id))).map(a=>a.id));d=b.edges.filter(a=>g.has(a.source)&&g.has(a.target))}return{filteredNodes:c,filteredEdges:d}},[b,j,a,o]),r=(0,e.useMemo)(()=>{let a=new Set;for(let b of q)a.add(b.source),a.add(b.target);return a},[q]),{rfNodes:s,rfEdges:t}=(0,e.useMemo)(()=>{if(0===p.length)return{rfNodes:[],rfEdges:[]};let b=function(a,b,c){let d=a.length;if(0===d)return{};let e=(void 0)??(d>100?80:150),f=.6*Math.sqrt(108e4/Math.max(d,1)),g={};a.forEach((a,b)=>{let c=2*Math.PI*b/d,e=360*Math.random();g[a]={x:600+Math.cos(c)*e,y:450+Math.sin(c)*e}});let h={};for(let c=0;c<e;c++){let i=120*(1-c/e);for(let b of a)h[b]={x:0,y:0};for(let b=0;b<d;b++)for(let c=b+1;c<d;c++){let d=a[b],e=a[c],i=g[d].x-g[e].x,j=g[d].y-g[e].y,k=Math.sqrt(i*i+j*j||.01),l=f*f/k;h[d].x+=i/k*l,h[d].y+=j/k*l,h[e].x-=i/k*l,h[e].y-=j/k*l}for(let a of b){let b=a.source,c=a.target;if(!g[b]||!g[c])continue;let d=g[b].x-g[c].x,e=g[b].y-g[c].y,i=Math.sqrt(d*d+e*e||.01),j=i*i/f;h[b].x-=d/i*j,h[b].y-=e/i*j,h[c].x+=d/i*j,h[c].y+=e/i*j}for(let b of a){let a=g[b].x-600,c=g[b].y-450,d=Math.sqrt(a*a+c*c)||.01,e=.05*d;h[b].x-=a/d*e,h[b].y-=c/d*e}for(let b of a){let a=h[b],c=Math.sqrt(a.x*a.x+a.y*a.y)||.01;g[b].x+=a.x/c*Math.min(c,i),g[b].y+=a.y/c*Math.min(c,i),g[b].x=Math.max(0,Math.min(1200,g[b].x)),g[b].y=Math.max(0,Math.min(900,g[b].y))}}return g}(p.map(a=>a.id),q);return{rfNodes:p.map(c=>({id:c.id,type:"wiki",position:b[c.id]??{x:0,y:0},data:{label:c.label,id:c.id,isCurrent:c.id===a,isOrphan:!r.has(c.id),size:n.get(c.id)||1}})),rfEdges:q.map((b,c)=>{let d=b.source===a||b.target===a;return{id:`e-${c}`,source:b.source,target:b.target,type:"default",markerEnd:{type:"arrowclosed",color:d?"var(--amber)":"var(--border)"},style:{stroke:d?"var(--amber)":"var(--border)",strokeWidth:d?1.5:1,opacity:d?.8:.4},animated:d}})}},[p,q,a,r,n]),u=(0,e.useMemo)(()=>({wiki:i}),[]);return!l||f?(0,d.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400,borderRadius:12,background:"var(--muted)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,d.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",fontSize:12},children:f?"Building graph…":"Loading…"})}):(0,d.jsxs)("div",{style:{width:"100%",position:"relative",zIndex:0},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[(0,d.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[p.length," nodes \xb7 ",q.length," edges"]}),(0,d.jsx)("div",{style:{display:"flex",gap:2,padding:3,borderRadius:8,background:"var(--muted)"},children:[{id:"local",label:"Local"},{id:"global",label:"Global"}].map(a=>(0,d.jsx)("button",{onClick:()=>k(a.id),className:"font-display",style:{padding:"3px 12px",borderRadius:5,fontSize:11,cursor:"pointer",border:"none",outline:"none",background:j===a.id?"var(--card)":"transparent",color:j===a.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:j===a.id?"0 1px 3px rgba(0,0,0,0.1)":"none",transition:"all 0.1s"},children:a.label},a.id))})]}),(0,d.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400},children:(0,d.jsxs)(g.Gc,{nodes:s,edges:t,nodeTypes:u,fitView:!0,fitViewOptions:{padding:.15},proOptions:{hideAttribution:!0},style:{background:"var(--background)",borderRadius:12,border:"1px solid var(--border)"},children:[(0,d.jsx)(g.VS,{color:"var(--border)",gap:24,size:1,variant:g._5.Dots}),(0,d.jsx)(g.H2,{showInteractive:!1}),(0,d.jsx)(g.of,{nodeColor:a=>a.data?.isCurrent?"var(--amber)":"var(--muted-foreground)"})]})})]})}},81285:(a,b,c)=>{"use strict";c.d(b,{Ak:()=>n,Bt:()=>l,D0:()=>i,L7:()=>p,jn:()=>o,l6:()=>k,lM:()=>m,pM:()=>q,pd:()=>j});var d=c(48249),e=c(67484),f=c.n(e),g=c(44218),h=c(42742);function i({label:a,hint:b,children:c}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("label",{className:"text-sm text-foreground font-medium",children:a}),c,b&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:b})]})}function j({className:a="",...b}){return(0,d.jsx)("input",{...b,className:`w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 ${a}`})}function k({value:a,onChange:b,children:c,className:i="",disabled:j}){let k=(0,e.useId)(),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(-1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useMemo)(()=>f().Children.toArray(c).filter(a=>f().isValidElement(a)&&"option"===a.type).map(a=>({value:String(a.props.value??""),label:String(a.props.children??a.props.value??"")})),[c]),s=r.findIndex(b=>b.value===a),t=r[s]?.label??"",u=(0,e.useCallback)(a=>{a>=0&&a<r.length&&(b?.({target:{value:r[a].value}}),m(!1))},[r,b]),v=(0,e.useCallback)(a=>{if(!l){["Enter"," ","ArrowDown","ArrowUp"].includes(a.key)&&(a.preventDefault(),m(!0),o(s>=0?s:0));return}switch(a.key){case"ArrowDown":a.preventDefault(),o(a=>Math.min(a+1,r.length-1));break;case"ArrowUp":a.preventDefault(),o(a=>Math.max(a-1,0));break;case"Enter":case" ":a.preventDefault(),u(n);break;case"Escape":a.preventDefault(),m(!1);break;case"Tab":m(!1)}},[l,r.length,s,n,u]);return(0,d.jsxs)("div",{ref:p,className:`relative ${i}`,children:[(0,d.jsxs)("button",{type:"button",disabled:j,onClick:()=>{m(a=>!a),o(s>=0?s:0)},onKeyDown:v,"aria-haspopup":"listbox","aria-expanded":l,className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground text-left flex items-center justify-between gap-2 outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:`truncate ${t?"":"text-muted-foreground"}`,children:t||"—"}),(0,d.jsx)(g.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${l?"rotate-180":""}`})]}),l&&(0,d.jsx)("div",{ref:q,role:"listbox","aria-activedescendant":n>=0?`${k}-opt-${n}`:void 0,className:"absolute z-20 w-full mt-1 py-1 border border-border rounded-lg bg-card shadow-lg max-h-60 overflow-auto animate-in fade-in-0 zoom-in-95 duration-100",children:r.map((b,c)=>{let e=b.value===a,f=c===n;return(0,d.jsxs)("button",{id:`${k}-opt-${c}`,role:"option","aria-selected":e,type:"button",onMouseDown:a=>{a.preventDefault(),u(c)},onMouseEnter:()=>o(c),className:`w-full px-3 py-1.5 text-sm text-left flex items-center gap-2 transition-colors ${f?"bg-accent text-accent-foreground":"text-foreground"}`,children:[(0,d.jsx)(h.A,{size:14,className:`shrink-0 ${e?"text-[var(--amber)]":"invisible"}`}),(0,d.jsx)("span",{className:"truncate",children:b.label})]},b.value)})})]})}function l({overridden:a}){return a?(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-[var(--amber-subtle)] text-[var(--amber-text)] font-mono ml-1.5",children:"env"}):null}function m({checked:a,onChange:b,size:c="md",disabled:e,title:f,onClick:g}){let h="sm"===c;return(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:e,title:f,onClick:g??(()=>b?.(!a)),className:`relative inline-flex shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60 ${h?"h-4 w-7":"h-5 w-9"} ${a?"bg-[var(--amber)]":"bg-muted"}`,children:(0,d.jsx)("span",{className:`pointer-events-none inline-block rounded-full bg-white shadow-sm transition-transform ${h?"h-3 w-3":"h-4 w-4"} ${a?h?"translate-x-3":"translate-x-4":"translate-x-0"}`})})}function n({value:a,onChange:b,placeholder:c,disabled:e}){let f="***set***"===a;return(0,d.jsx)("input",{type:"password",value:f?"••••••••••••••••":a,onChange:a=>b(a.target.value),placeholder:c??"sk-...",disabled:e,className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",onFocus:()=>{f&&b("")}})}function o({children:a,disabled:b,onClick:c,type:e="button",className:f="",...g}){return(0,d.jsx)("button",{type:e,onClick:c,disabled:b,className:`px-4 py-2 text-sm font-medium rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${f}`,...g,children:a})}function p({icon:a,title:b,description:c,badge:e,children:f,className:g=""}){return(0,d.jsxs)("div",{className:`rounded-xl border border-border/50 bg-card/50 p-5 ${g}`,children:[(0,d.jsxs)("div",{className:"flex items-start gap-3 mb-4",children:[(0,d.jsx)("div",{className:"w-8 h-8 rounded-lg bg-muted/50 flex items-center justify-center shrink-0 mt-0.5",children:(0,d.jsx)("span",{className:"text-muted-foreground",children:a})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:b}),e]}),c&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:c})]})]}),(0,d.jsx)("div",{className:"space-y-4 pl-11",children:f})]})}function q({label:a,hint:b,children:c}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm text-foreground",children:a}),b&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:b})]}),(0,d.jsx)("div",{className:"shrink-0",children:c})]})}},82110:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(67484),f=c(95801),g=c(93096);function h({results:a,selectedIndex:b,query:c,onSelect:h}){let i=(0,e.useRef)(null),j=(0,e.useRef)(null),[k,l]=(0,e.useState)(280);return 0===a.length?null:(0,d.jsxs)("div",{ref:j,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,d.jsx)(f.A,{size:11,className:"text-[var(--amber)]/50"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Skills"}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:a.length})]}),(0,d.jsx)("div",{ref:i,className:"overflow-y-auto",style:{maxHeight:k},children:a.map((a,e)=>(0,d.jsxs)("button",{type:"button",onMouseDown:b=>{b.preventDefault(),h(a)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors ${e===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[(0,d.jsx)(f.A,{size:13,className:"text-[var(--amber)] shrink-0"}),(0,d.jsxs)("span",{className:"text-sm font-medium shrink-0",children:["/",(0,d.jsx)(g.A,{text:a.name,query:c})]}),a.description&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/50 truncate min-w-0 flex-1",title:a.description,children:a.description})]},a.name))}),(0,d.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,d.jsx)("span",{children:"↑↓ navigate"}),(0,d.jsx)("span",{children:"↵ / Tab select"}),(0,d.jsx)("span",{children:"ESC dismiss"})]})]})}},82626:(a,b,c)=>{"use strict";c.d(b,{A:()=>t});var d=c(48249),e=c(19099),f=c(37526),g=c(86320),h=c(73908),i=c(96286),j=c(46218),k=c(4140),l=c(78890),m=c(67484),n=c(70971),o=c(8455),p=c(22341);c(95054);var q=c(30315);function r(){let[a,b]=(0,m.useState)(null),[c,e]=(0,m.useState)([]),[f,g]=(0,m.useState)(!0),{t:h}=(0,q.Y)();return f||!a?(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:(0,d.jsx)("div",{className:"h-2 w-20 bg-muted rounded animate-pulse"})}):(0,d.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-3 border-t border-border",children:[(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.fileCount}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Files"})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.unreadChanges}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Changes"})]}),(0,d.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground",children:a.sessionCount}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Chats"})]})]}),c.length>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-0.5",children:"Recent"}),c.map(a=>{let b=function(a){try{let b=new Date(a),c=new Date().getTime()-b.getTime(),d=Math.floor(c/6e4),e=Math.floor(c/36e5),f=Math.floor(c/864e5);if(d<1)return"now";if(d<60)return`${d}m ago`;if(e<24)return`${e}h ago`;if(f<7)return`${f}d ago`;return b.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return"recently"}}(a.ts),c=function(a){switch(a){case"create":return(0,d.jsx)(n.A,{size:12,className:"text-success"});case"write":case"append":return(0,d.jsx)(o.A,{size:12,className:"text-foreground"});case"delete":return(0,d.jsx)(o.A,{size:12,className:"text-destructive"});case"rename":case"move":return(0,d.jsx)(p.A,{size:12,className:"text-muted-foreground"});default:return(0,d.jsx)(o.A,{size:12,className:"text-muted-foreground"})}}(a.op),e=a.path.split("/").pop()||a.path;return(0,d.jsxs)("div",{className:"flex items-start gap-2 p-1.5 rounded hover:bg-muted/40 transition-colors text-xs",children:[(0,d.jsx)("span",{className:"text-muted-foreground shrink-0 mt-0.5",children:c}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-foreground truncate font-medium",title:e,children:e}),(0,d.jsx)("p",{className:"text-muted-foreground text-2xs",children:b})]})]},a.id)})]})]})}var s=c(10072);function t({active:a,maximized:b,onMaximize:c}){let{t:m}=(0,q.Y)(),n=m.panels.echo,o=(0,e.usePathname)()??"",p={"about-you":{icon:(0,d.jsx)(f.A,{size:14}),title:n.aboutYouTitle},continued:{icon:(0,d.jsx)(g.A,{size:14}),title:n.continuedTitle},daily:{icon:(0,d.jsx)(h.A,{size:14}),title:n.dailyEchoTitle},"past-you":{icon:(0,d.jsx)(i.A,{size:14}),title:n.pastYouTitle},growth:{icon:(0,d.jsx)(j.A,{size:14}),title:n.intentGrowthTitle}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(k.A,{title:n.title,maximized:b,onMaximize:c}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0 flex flex-col",children:[(0,d.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:s.RS.map(a=>{let b=p[a],c=s.AI[a],e=o===c||o.startsWith(`${c}/`);return(0,d.jsx)(l.G,{href:c,icon:b.icon,title:b.title,active:e},a)})}),(0,d.jsx)("div",{className:"mt-auto",children:(0,d.jsx)(r,{})})]})]})}},82704:()=>{},82884:(a,b,c)=>{"use strict";c.d(b,{Un:()=>f});var d=c(67484);let e="mindos-renderer-state-change";function f(a,b,c){let f=`mindos-renderer:${a}:${b}`,g=(0,d.useRef)({key:f,raw:null,parsed:c});return g.current.key!==f&&(g.current={key:f,raw:null,parsed:c}),[(0,d.useSyncExternalStore)(a=>{let b=()=>a();return window.addEventListener("storage",b),window.addEventListener(e,b),()=>{window.removeEventListener("storage",b),window.removeEventListener(e,b)}},()=>{try{let a=localStorage.getItem(f);if(a===g.current.raw)return g.current.parsed;if(null===a)return g.current={key:f,raw:null,parsed:c},c;let b=JSON.parse(a);return g.current={key:f,raw:a,parsed:b},b}catch{return c}},()=>c),(0,d.useCallback)(a=>{try{let b=(()=>{try{let a=localStorage.getItem(f);return null!==a?JSON.parse(a):c}catch{return c}})(),d="function"==typeof a?a(b):a,e=JSON.stringify(d);localStorage.setItem(f,e),g.current={key:f,raw:e,parsed:d}}catch{}window.dispatchEvent(new Event(e))},[f,c])]}},82892:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(97621),g=c(42742),h=c(6079),i=c(46674),j=c(19099),k=c(30315),l=c(33191),m=c(99829);let n=(0,m.createServerReference)("70312fa9a281c166e956f96c5d5ac7351e313270f3",m.callServer,void 0,m.findSourceMapURL,"revertSpaceInitAction");function o(){let[a,b]=(0,e.useState)(null),[c,m]=(0,e.useState)(!1),[o,q]=(0,e.useTransition)(),r=(0,j.useRouter)(),{t:s}=(0,k.Y)(),t=(0,e.useCallback)(()=>{m(!1),setTimeout(()=>b(null),200)},[]);(0,e.useCallback)(a=>{let c=a.detail;"working"===c.state?(b(c),requestAnimationFrame(()=>m(!0))):"done"===c.state?(b(a=>a?{...a,state:"done"}:null),r.refresh()):t()},[r,t]);let u=(0,e.useCallback)(()=>{a&&(t(),r.push(`/view/${(0,l.O0)(a.spacePath+"/")}`))},[a,t,r]),v=(0,e.useCallback)(()=>{a&&q(async()=>{await n(a.spacePath,a.spaceName,a.description),b(a=>a?{...a,state:"reverted"}:null),r.refresh(),window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(t,2e3)})},[a,r,t]),w=(0,e.useCallback)(()=>{t()},[t]);if(!a)return null;let x=s.home,{state:y}=a,z="done"===y,A="reverted"===y;return(0,d.jsx)("div",{className:`fixed bottom-6 left-1/2 z-50 -translate-x-1/2 transition-all duration-200 ease-out ${c?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-3 scale-[0.96] pointer-events-none"}`,children:(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-full border bg-card/95 backdrop-blur py-2 shadow-lg",style:{borderColor:"color-mix(in srgb, var(--amber) 40%, var(--border))",boxShadow:"0 8px 24px color-mix(in srgb, var(--amber) 12%, rgba(0,0,0,.2))",paddingLeft:"0.75rem",paddingRight:z?"0.5rem":"1rem"},children:[(0,d.jsx)("span",{className:`inline-flex h-6 w-6 items-center justify-center rounded-full shrink-0 ${A?"text-muted-foreground bg-muted":"text-[var(--amber)] bg-[var(--amber-subtle)]"} ${"working"===y?"animate-pulse":""}`,children:A?(0,d.jsx)(f.A,{size:12}):z?(0,d.jsx)(g.A,{size:13,strokeWidth:2.5}):(0,d.jsx)(h.A,{size:13})}),(0,d.jsx)("span",{className:"text-xs text-foreground whitespace-nowrap select-none font-medium",children:A?x.aiInitReverted(a.spaceName):z?x.aiInitReady(a.spaceName):(0,d.jsxs)(d.Fragment,{children:[x.aiInitGenerating(a.spaceName),(0,d.jsx)(p,{})]})}),z&&(0,d.jsxs)("div",{className:"flex items-center gap-1 ml-1",children:[(0,d.jsx)("button",{type:"button",onClick:u,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-[var(--amber)] text-white hover:opacity-90 transition-opacity focus-visible:ring-2 focus-visible:ring-ring",children:x.aiInitReview}),(0,d.jsx)("button",{type:"button",onClick:v,disabled:o,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:x.aiInitDiscard}),(0,d.jsx)("button",{type:"button",onClick:w,"aria-label":"Accept",className:"ml-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors focus-visible:ring-2 focus-visible:ring-ring",children:(0,d.jsx)(i.A,{size:12})})]})]})})}function p(){return(0,d.jsxs)("span",{className:"inline-flex gap-[2px] items-end h-[1em] ml-px",children:[(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_0ms_infinite]"}),(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_200ms_infinite]"}),(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_400ms_infinite]"}),(0,d.jsx)("style",{children:`
187
+ @keyframes dotBounce {
188
+ 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
189
+ 30% { opacity: 1; transform: translateY(-2px); }
190
+ }
191
+ `})]})}},83539:(a,b,c)=>{"use strict";c.r(b),c.d(b,{WorkflowYamlRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call WorkflowYamlRenderer() from the server but WorkflowYamlRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/renderers/workflow-yaml/WorkflowYamlRenderer.tsx","WorkflowYamlRenderer")},84197:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(2116),g=c.n(f),h=c(24520),i=c(40560),j=c(95801),k=c(31675),l=c(4140),m=c(30315),n=c(33191);function o({active:a,maximized:b,onMaximize:c}){let{t:f}=(0,m.Y)(),o=f.panels.workflows,[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(""),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(""),B=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/workflows");if(!a.ok)return;let b=await a.json();q(b.workflows??[])}catch{}finally{s(!1)}},[]),C=async()=>{let a=v.trim();if(a&&!x){y(!0),A("");try{let b=await fetch("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a})}),c=await b.json();if(!b.ok)return void A(409===b.status?o.exists:c.error||"Error");u(!1),w(""),await B(),window.location.href=`/view/${(0,n.O0)(c.path)}`}catch{A("Network error")}finally{y(!1)}}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(l.A,{title:o.title,maximized:b,onMaximize:c,children:(0,d.jsx)("button",{onClick:()=>u(a=>!a),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":o.newWorkflow,title:o.newWorkflow,children:(0,d.jsx)(h.A,{size:13})})}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t&&(0,d.jsxs)("div",{className:"px-3 py-3 border-b border-border",children:[(0,d.jsx)("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:o.name}),(0,d.jsx)("input",{type:"text",value:v,onChange:a=>{w(a.target.value),A("")},onKeyDown:a=>"Enter"===a.key&&C(),placeholder:o.namePlaceholder,autoFocus:!0,className:"w-full px-2.5 py-1.5 text-sm rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),z&&(0,d.jsx)("p",{className:"text-xs text-[var(--error)] mt-1",children:z}),(0,d.jsxs)("div",{className:"flex gap-2 mt-2.5",children:[(0,d.jsx)("button",{onClick:()=>{u(!1),w(""),A("")},className:"flex-1 px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground hover:bg-muted transition-colors",children:o.cancel}),(0,d.jsx)("button",{onClick:C,disabled:!v.trim()||x,className:"flex-1 px-3 py-1.5 text-xs rounded-md font-medium transition-colors disabled:opacity-50 bg-[var(--amber)] text-[var(--amber-foreground)]",children:x?o.creating:o.create})]})]}),r&&(0,d.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:(0,d.jsx)(i.A,{size:16,className:"animate-spin"})}),!r&&0===p.length&&!t&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:[(0,d.jsx)(j.A,{size:24,className:"text-muted-foreground/40 mb-3"}),(0,d.jsx)("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:o.empty}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-4 max-w-[200px]",children:o.emptyDesc}),(0,d.jsxs)("button",{onClick:()=>u(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors",children:[(0,d.jsx)(h.A,{size:12}),o.newWorkflow]})]}),!r&&p.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:p.map(a=>(0,d.jsxs)(g(),{href:`/view/${(0,n.O0)(a.path)}`,className:`flex items-start gap-2.5 px-3 py-2 mx-1 rounded-lg transition-colors hover:bg-muted ${a.error?"opacity-70":""}`,children:[(0,d.jsx)(j.A,{size:14,className:"shrink-0 mt-0.5 text-[var(--amber)]"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground block truncate",children:a.title}),(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[a.error?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-2xs text-[var(--error)]",children:[(0,d.jsx)(k.A,{size:10}),o.parseError]}):(0,d.jsx)("span",{className:"text-2xs text-muted-foreground",children:o.nSteps(a.stepCount)}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/60",suppressHydrationWarning:!0,children:(0,n.KW)(a.mtime,f.home?.relativeTime)})]})]})]},a.path))})]})]})}},84668:(a,b,c)=>{"use strict";c.d(b,{A:()=>n});var d=c(48249),e=c(67484),f=c(31417),g=c(21245);function h(a,b){fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{walkthroughStep:a,walkthroughDismissed:b}})}).catch(a=>{console.warn("[walkthrough-store] persist failed:",a)})}let i=(0,f.v)((a,b)=>{let c=g.g.length;return{status:"idle",currentStep:0,totalSteps:c,start:()=>{a({currentStep:0,status:"active"}),h(0,!1)},next:()=>{let d=b().currentStep+1;d>=c?(a({status:"completed"}),h(c,!1)):(a({currentStep:d}),h(d,!1))},back:()=>{let c=b().currentStep;c>0&&(a({currentStep:c-1}),h(c-1,!1))},skip:()=>{a({status:"dismissed"}),h(b().currentStep,!0)},_init:()=>{let b="1"===new URLSearchParams(window.location.search).get("welcome");if(b){let a=new URL(window.location.href);a.searchParams.delete("welcome"),window.history.replaceState({},"",a.pathname+(a.search||"")),window.dispatchEvent(new Event("mindos:first-visit"))}return window.innerWidth<768?()=>{}:(fetch("/api/setup").then(a=>a.json()).then(d=>{let e=d.guideState;!e||!e.walkthroughDismissed&&(e.active&&!e.dismissed&&void 0===e.walkthroughStep?b&&a({status:"active",currentStep:0}):"number"==typeof e.walkthroughStep&&e.walkthroughStep>=0&&e.walkthroughStep<c&&!e.walkthroughDismissed&&a({status:"active",currentStep:e.walkthroughStep}))}).catch(a=>{console.warn("[walkthrough-store] guideState read failed:",a)}),()=>{})}}});var j=c(30315);function k({stepIndex:a,rect:b,position:c}){let f,g,h=i(),{t:k}=(0,j.Y)(),[l,m]=(0,e.useState)({width:1024,height:768});if(!h)return null;let n=k.walkthrough.steps[a];if(!n)return null;"right"===c?(f=b.top+b.height/2,g=b.right+12):(f=b.bottom+12,g=b.left+b.width/2);let o=l.width-320,p=l.height-200;return g=Math.min(g,o),f=Math.max(f=Math.min(f,p),8),(0,d.jsxs)("div",{className:"fixed z-[102] w-[280px] rounded-xl border shadow-lg animate-in fade-in slide-in-from-left-2 duration-200",style:{top:`${f}px`,left:`${g}px`,transform:"right"===c?"translateY(-50%)":"translateX(-50%)",background:"var(--card)",borderColor:"var(--amber)"},children:[(0,d.jsxs)("div",{className:"p-4",children:[(0,d.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,d.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:k.walkthrough.step(a+1,h.totalSteps)})}),(0,d.jsx)("h3",{className:"text-sm font-semibold font-display mb-1",style:{color:"var(--foreground)"},children:n.title}),(0,d.jsx)("p",{className:"text-xs leading-relaxed",style:{color:"var(--muted-foreground)"},children:n.body}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-3",style:{borderTop:"1px solid var(--border)"},children:[(0,d.jsx)("button",{onClick:h.skip,className:"text-xs transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:k.walkthrough.skip}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a>0&&(0,d.jsx)("button",{onClick:h.back,className:"text-xs px-2.5 py-1 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:k.walkthrough.back}),(0,d.jsx)("button",{onClick:h.next,className:"text-xs px-3 py-1.5 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a===h.totalSteps-1?k.walkthrough.done:k.walkthrough.next})]})]})]}),(0,d.jsx)("div",{className:"flex items-center justify-center gap-1.5 pb-3",children:Array.from({length:h.totalSteps},(b,c)=>(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full transition-all duration-200",style:{background:c===a?"var(--amber)":"var(--border)",transform:c===a?"scale(1.3)":void 0}},c))})]})}function l(){let a=i(),[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!1),j=(0,e.useId)(),l=a?g.g[a.currentStep]:null;return((0,e.useCallback)(()=>{if(!l)return;let a=document.querySelector(`[data-walkthrough="${l.anchor}"]`);a?c(a.getBoundingClientRect()):c(null)},[l]),a?.skip,a&&l)?f?(0,d.jsx)(m,{}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("svg",{className:"fixed inset-0 z-[100] pointer-events-auto",width:"100%",height:"100%",onClick:c=>{if(b){let d=c.clientX,e=c.clientY;d>=b.left-6&&d<=b.right+6&&e>=b.top-6&&e<=b.bottom+6||a.skip()}else a.skip()},children:[(0,d.jsx)("defs",{children:(0,d.jsxs)("mask",{id:j,children:[(0,d.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),b&&(0,d.jsx)("rect",{x:b.left-6,y:b.top-6,width:b.width+12,height:b.height+12,rx:8,ry:8,fill:"black"})]})}),(0,d.jsx)("rect",{width:"100%",height:"100%",fill:"rgba(0, 0, 0, 0.5)",mask:`url(#${j})`})]}),b&&(0,d.jsx)(k,{stepIndex:a.currentStep,rect:b,position:l.position})]}):null}function m(){let a=i(),{t:b}=(0,j.Y)();if(!a)return null;let c=b.walkthrough.steps[a.currentStep];return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-sm",onClick:a.skip}),(0,d.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-[101] rounded-t-2xl border-t shadow-lg p-5 pb-8 animate-in slide-in-from-bottom duration-300",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,d.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:b.walkthrough.step(a.currentStep+1,a.totalSteps)}),(0,d.jsx)("div",{className:"flex items-center gap-1 ml-auto",children:Array.from({length:a.totalSteps},(b,c)=>(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:c===a.currentStep?"var(--amber)":"var(--border)"}},c))})]}),(0,d.jsx)("h3",{className:"text-base font-semibold font-display mb-1",style:{color:"var(--foreground)"},children:c.title}),(0,d.jsx)("p",{className:"text-sm leading-relaxed mb-5",style:{color:"var(--muted-foreground)"},children:c.body}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("button",{onClick:a.skip,className:"text-sm transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:b.walkthrough.skip}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[a.currentStep>0&&(0,d.jsx)("button",{onClick:a.back,className:"text-sm px-3 py-2 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:b.walkthrough.back}),(0,d.jsx)("button",{onClick:a.next,className:"text-sm px-4 py-2 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a.currentStep===a.totalSteps-1?b.walkthrough.done:b.walkthrough.next})]})]})]})]}):null}function n(){return"active"===i(a=>a.status)?(0,d.jsx)(l,{}):null}},85034:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/app/error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/app/error.tsx","default")},86364:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/svg+xml",sizes:"any",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.svg")+"?3c05474ce4fc06a8"}]},86367:(a,b,c)=>{"use strict";c.d(b,{LD:()=>d,LZ:()=>e,qQ:()=>f});let d=[{id:"c1",icon:"\uD83D\uDC64",category:"memory-sync",scenario:"first-day"},{id:"c2",icon:"\uD83D\uDCE5",category:"knowledge-management",scenario:"daily"},{id:"c3",icon:"\uD83D\uDD04",category:"memory-sync",scenario:"project"},{id:"c4",icon:"\uD83D\uDD01",category:"experience-evolution",scenario:"daily"},{id:"c5",icon:"\uD83D\uDCA1",category:"auto-execute",scenario:"daily"},{id:"c6",icon:"\uD83D\uDE80",category:"auto-execute",scenario:"project"},{id:"c7",icon:"\uD83D\uDD0D",category:"knowledge-management",scenario:"project"},{id:"c8",icon:"\uD83E\uDD1D",category:"human-insights",scenario:"daily"},{id:"c9",icon:"\uD83D\uDEE1️",category:"audit-control",scenario:"advanced"}],e=["knowledge-management","memory-sync","auto-execute","experience-evolution","human-insights","audit-control"],f=["first-day","daily","project","advanced"]},86771:(a,b,c)=>{Promise.resolve().then(c.bind(c,2420))},89119:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>T});var e=c(48249),f=c(67484),g=c(19099),h=c(2116),i=c.n(h),j=c(9915),k=c(10316),l=c(95581),m=c(46674),n=c(801),o=c(4615),p=c(68828),q=c(16613),r=c(20892),s=c(99791),t=c(33073),u=c(29820),v=c(82626),w=c(84197),x=c(61112),y=c(96716),z=c(2923),A=c(80829),B=c(610),C=c(28079),D=c(65607),E=c(23017),F=c(73778),G=c(82892),H=c(94779),I=c(3691),J=c(60907),K=c(30315),L=c(90314),M=c(2518),N=c(84668);c(70377);var O=c(65141),P=c(13859),Q=c(69593);c(99101);var R=c(63710),S=a([x,C,D,P]);[x,C,D,P]=S.then?(await S)():S;let U=(0,L.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./ImportModal"]},ssr:!1});function T({fileTree:a,children:b}){let c=(0,O.b)(),d=(0,P.$)(),[h,L]=(0,f.useState)(!1),[S,T]=(0,f.useState)(void 0),[V,W]=(0,f.useState)(!1),[X,Y]=(0,f.useState)(null),[Z,$]=(0,f.useState)(null),[_,aa]=(0,f.useState)(()=>y.wl),ab=(0,Q.dB)(),[ac,ad]=(0,f.useState)(!1),[ae,af]=(0,f.useState)(0),ag=(0,f.useCallback)(()=>{ad(!1),"organizing"!==ab.phase||ab.abort(),ab.reset()},[ab]),ah=(0,f.useCallback)(()=>{af(a=>a+1),window.dispatchEvent(new Event("mindos:organize-history-update"))},[]),[ai,aj]=(0,f.useState)(!1),[ak,al]=(0,f.useState)(void 0),[am,an]=(0,f.useState)(void 0),[ao,ap]=(0,f.useState)(!1),aq=(0,f.useRef)(0),ar=(0,f.useCallback)(a=>{al(a),an(void 0),aj(!0)},[]),as=(0,f.useCallback)(()=>{aj(!1),al(void 0),an(void 0)},[]),[at,au]=(0,f.useState)(!1),[av,aw]=(0,f.useState)(!1),[ax,ay]=(0,f.useState)(!1),{t:az}=(0,K.Y)(),aA=(0,g.useRouter)(),aB=(0,g.usePathname)(),aC=(0,f.useMemo)(()=>(function a(b,c=""){let d=[];for(let e of b)if("directory"===e.type&&!e.name.startsWith(".")){let b=c?`${c}/${e.name}`:e.name;d.push(b),e.children&&d.push(...a(e.children,b))}return d})(a),[a]),{status:aD,fetchStatus:aE}=(0,J.dW)(),aF=aB.startsWith("/view/")?aB.slice(6).split("/").map(decodeURIComponent).join("/"):void 0,aG=aB?.startsWith("/agents"),aH=c.activePanel??(aG?"agents":null),aI=(0,f.useCallback)(()=>{let a=()=>window.dispatchEvent(new Event("guide-state-updated"));"guide"===d.askOpenSource?fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{askedAI:!0}})}).then(a).catch(a=>console.warn("Guide state update failed:",a)):"guide-next"===d.askOpenSource&&a()},[d.askOpenSource]),aJ=(0,f.useCallback)(a=>{aa(a);try{localStorage.setItem("right-agent-detail-panel-width",String(a))}catch{}},[]),aK=(0,f.useCallback)(()=>$(null),[]),aL=null!==Z&&"agents"===c.activePanel,aM=(0,f.useCallback)(()=>{T("sync"),W(!1),L(!0)},[]),aN=(0,f.useCallback)(()=>{L(!0),T(void 0)},[]),aO=(0,f.useCallback)(()=>{L(!1),T(void 0)},[]),aP=(0,f.useCallback)(a=>{Y(a),W(a=>!a)},[]),aQ=(0,f.useCallback)(a=>{c.handleExpandedChange(a),W(!1)},[c]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(M.A,{}),(0,e.jsx)(N.A,{}),(0,e.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[60] focus:px-4 focus:py-2 focus:rounded-lg focus:text-sm focus:font-medium focus:font-display bg-[var(--amber)] text-[var(--amber-foreground)]",children:"Skip to main content"}),(0,e.jsx)(o.Ay,{activePanel:aH,onPanelChange:c.setActivePanel,onEchoClick:()=>{let a="echo"===c.activePanel;c.setActivePanel(a?null:"echo"),a||aA.push("/echo/about-you")},onAgentsClick:()=>{let a="agents"===c.activePanel;c.setActivePanel(a?null:"agents"),a||aA.push("/agents"),$(null)},onDiscoverClick:()=>{let a="discover"===c.activePanel;c.setActivePanel(a?null:"discover"),a||aA.push("/explore")},syncStatus:aD,expanded:c.railExpanded,onExpandedChange:aQ,onSettingsClick:aN,onSyncClick:aP}),(0,e.jsxs)(p.Ay,{activePanel:c.activePanel,fileTree:a,onNavigate:()=>{},onOpenSyncSettings:aM,railWidth:c.railWidth,panelWidth:c.panelWidth??void 0,onWidthChange:c.handlePanelWidthChange,onWidthCommit:c.handlePanelWidthCommit,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,onImport:ar,children:[(0,e.jsx)("div",{className:`flex flex-col h-full ${"echo"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(v.A,{active:"echo"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"search"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(s.A,{active:"search"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"agents"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(t.A,{active:"agents"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,selectedAgentKey:aL?Z:null})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"discover"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(u.A,{active:"discover"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})}),(0,e.jsx)("div",{className:`flex flex-col h-full ${"workflows"===c.activePanel?"":"hidden"}`,children:(0,e.jsx)(w.A,{active:"workflows"===c.activePanel,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize})})]}),(0,e.jsx)(x.Ay,{open:d.askPanelOpen,onClose:d.closeAskPanel,currentFile:aF,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aI,width:d.askPanelWidth,onWidthChange:d.handleAskWidthChange,onWidthCommit:d.handleAskWidthCommit,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch,maximized:d.askMaximized,onMaximize:d.toggleAskMaximized,sidebarOffset:c.panelOpen?c.railWidth+c.effectivePanelWidth:c.railWidth}),(0,e.jsx)(y.Ay,{open:aL,agentKey:Z,onClose:aK,rightOffset:d.askPanelOpen?d.askPanelWidth:0,width:_,onWidthChange:aa,onWidthCommit:aJ}),(0,e.jsx)(C.A,{open:d.desktopAskPopupOpen,onClose:d.closeDesktopAskPopup,currentFile:aF,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aI,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch}),(0,e.jsx)(z.A,{onToggle:d.toggleAskPanel,askPanelOpen:d.askPanelOpen||d.desktopAskPopupOpen}),(0,e.jsx)(E.A,{}),(0,e.jsx)(D.A,{open:h,onClose:aO,initialTab:S}),(0,e.jsx)(A.A,{open:V,onClose:()=>W(!1),anchorRect:X,railWidth:c.railWidth,onOpenSyncSettings:aM,syncStatus:aD,onSyncStatusRefresh:aE}),(0,e.jsxs)("header",{className:"md:hidden fixed top-0 left-0 right-0 z-30 bg-card border-b border-border flex items-center justify-between px-3 py-2",style:{paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,e.jsx)("button",{onClick:()=>au(!0),className:"p-3 -ml-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":"Open menu",children:(0,e.jsx)(j.A,{size:20})}),(0,e.jsxs)(i(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,e.jsx)(r.A,{id:"mobile"}),(0,e.jsx)("span",{className:"font-semibold text-foreground text-sm tracking-wide",children:"MindOS"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:aM,className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent flex items-center justify-center","aria-label":"Sync status",children:(0,e.jsx)(J.jc,{status:aD})}),(0,e.jsx)("button",{onClick:()=>aw(!0),className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":az.sidebar.searchTitle,children:(0,e.jsx)(k.A,{size:20})}),(0,e.jsx)("button",{onClick:()=>{L(!0),T(void 0)},className:"p-3 -mr-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":az.sidebar.settingsTitle,children:(0,e.jsx)(l.A,{size:20})})]})]}),at&&(0,e.jsx)("div",{className:"md:hidden fixed inset-0 z-40 overlay-backdrop",onClick:()=>au(!1)}),(0,e.jsxs)("aside",{className:`md:hidden fixed top-0 left-0 h-screen w-[85vw] max-w-[320px] z-50 bg-card border-r border-border flex flex-col transition-transform duration-300 ease-in-out ${at?"translate-x-0":"-translate-x-full"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-4 border-b border-border shrink-0",children:[(0,e.jsxs)(i(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,e.jsx)(r.A,{id:"drawer"}),(0,e.jsx)("span",{className:"font-semibold text-foreground text-sm tracking-wide font-display",children:"MindOS"})]}),(0,e.jsx)("button",{onClick:()=>au(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,e.jsx)(m.A,{size:16})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,e.jsx)(q.Ay,{nodes:a,onNavigate:()=>au(!1),onImport:ar})})]}),(0,e.jsx)(B.A,{open:av,onClose:()=>aw(!1)}),(0,e.jsx)(C.A,{open:ax,onClose:()=>ay(!1),currentFile:aF}),(0,e.jsxs)("main",{id:"main-content",className:"min-h-screen transition-all duration-200 pt-[52px] md:pt-0",onDragEnter:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),aq.current++,1===aq.current&&ap(!0))},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&a.preventDefault()},onDragLeave:()=>{aq.current=Math.max(0,aq.current-1),0===aq.current&&ap(!1)},onDrop:a=>{a.preventDefault(),aq.current=0,ap(!1),a.dataTransfer.files.length>0&&!ai&&(0,R.Q)(Array.from(a.dataTransfer.files),az)},children:[(0,e.jsxs)("div",{className:"min-h-screen bg-background",style:{overflowX:"clip"},children:[(0,e.jsx)(F.A,{}),b]}),(0,e.jsx)(G.A,{}),(0,e.jsx)(I.A,{t:az,dirPaths:aC}),ao&&!ai&&(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm transition-opacity duration-200",children:(0,e.jsxs)("div",{className:"border-2 border-dashed border-[var(--amber)]/50 rounded-xl p-12 flex flex-col items-center gap-3",children:[(0,e.jsx)(n.A,{size:48,className:"text-[var(--amber)]/60"}),(0,e.jsx)("p",{className:"text-sm text-foreground font-medium",children:az.inbox.dropOverlay}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:az.inbox.dropOverlayFormats})]})})]}),(0,e.jsx)(U,{open:ai,onClose:as,defaultSpace:ak,initialFiles:am,aiOrganize:ab,dirPaths:aC}),ac&&(0,e.jsx)(H.A,{aiOrganize:ab,onDismiss:ag,onCancel:()=>{ab.abort(),ab.reset(),ad(!1)},onHistoryUpdate:ah}),(0,e.jsx)("style",{children:`
187
192
  @media (min-width: 768px) {
188
193
  :root {
189
194
  --right-panel-width: ${d.askMaximized?`calc(100vw - ${c.panelOpen?c.railWidth+c.effectivePanelWidth:c.railWidth}px)`:`${d.askPanelOpen?d.askPanelWidth:0}px`};
@@ -195,12 +200,7 @@ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if
195
200
  padding-top: 0;
196
201
  }
197
202
  }
198
- `})]})}d()}catch(a){d(a)}})},89386:(a,b,c)=>{"use strict";c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(42742),g=c(8455),h=c(41160),i=c(46674),j=c(99101);let k={success:(0,d.jsx)(f.A,{size:15,className:"text-success shrink-0"}),error:(0,d.jsx)(g.A,{size:15,className:"text-error shrink-0"}),info:(0,d.jsx)(h.A,{size:15,className:"text-muted-foreground shrink-0"})};function l(){let a=(0,e.useSyncExternalStore)(j.B1,j.dV,j.dV);return 0===a.length?null:(0,d.jsx)("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col-reverse gap-2 pointer-events-none","aria-live":"polite",children:a.map(a=>(0,d.jsxs)("div",{className:"pointer-events-auto flex items-center gap-2.5 bg-card border border-border rounded-lg shadow-lg px-4 py-2.5 min-w-[180px] max-w-[320px] animate-in slide-in-from-right-4 fade-in duration-200",children:[k[a.type],(0,d.jsx)("span",{className:"text-sm text-foreground flex-1 truncate",children:a.message}),a.action&&(0,d.jsx)("button",{type:"button",onClick:()=>{a.action.onClick(),(0,j.X8)(a.id)},className:"shrink-0 px-2.5 py-1 rounded text-xs font-medium text-[var(--amber)] hover:bg-[var(--amber-dim)] transition-colors min-h-[28px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:a.action.label}),(0,d.jsx)("button",{type:"button",onClick:()=>(0,j.X8)(a.id),className:"shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":a.action?.label?"Close":"Dismiss",children:(0,d.jsx)(i.A,{size:13})})]},a.id))})}},89872:(a,b,c)=>{"use strict";c.d(b,{Q:()=>n});var d=c(48249),e=c(67484),f=c(59347),g=c(17512),h=c(40560),i=c(49681),j=c(31675),k=c(95054),l=c(30315),m=c(81285);function n(){let{t:a}=(0,l.Y)(),b=a.settings.uninstall,[c,n]=(0,e.useState)("idle"),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!0),[s,t]=(0,e.useState)(!0),u=async()=>{n("running"),p("");try{await (0,k.n)("/api/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({removeConfig:q})}),n("success")}catch(a){p(a instanceof Error?a.message:String(a)),n("error")}},v=({checked:a,onChange:b,label:c,desc:e,disabled:f})=>(0,d.jsxs)("label",{className:`flex items-start gap-2.5 p-2.5 rounded bg-muted/30 cursor-pointer select-none ${f?"opacity-50 cursor-not-allowed":"hover:bg-muted/50"}`,children:[(0,d.jsx)("input",{type:"checkbox",checked:a,onChange:a=>!f&&b(a.target.checked),disabled:f,className:"mt-0.5 form-check"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-foreground",children:c}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:e})]})]});return(0,d.jsxs)(m.L7,{icon:(0,d.jsx)(f.A,{size:15}),title:b.title,description:(0,b.descCli),children:[(0,d.jsxs)("div",{className:"flex gap-2.5 p-3 rounded-md bg-muted/50 border border-border",children:[(0,d.jsx)(g.A,{size:14,className:"text-success shrink-0 mt-0.5"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:b.kbSafe})]}),"idle"===c||"confirming"===c?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(v,{checked:!0,disabled:!0,label:b.stopServices,desc:b.stopServicesDesc,onChange:()=>{}}),(0,d.jsx)(v,{checked:q,onChange:r,label:b.removeConfig,desc:b.removeConfigDesc}),(0,d.jsx)(v,{checked:!0,disabled:!0,label:b.removeNpm,desc:b.removeNpmDesc,onChange:()=>{}}),!1]}):null,"idle"===c&&(0,d.jsxs)("button",{onClick:()=>n("confirming"),className:"px-3.5 py-2 text-sm font-medium rounded-lg bg-error/10 text-error border border-error/20 hover:bg-error/20 transition-colors focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,d.jsx)(f.A,{size:12,className:"inline mr-1.5 -mt-px"}),b.confirmButton]}),"confirming"===c&&(0,d.jsxs)("div",{className:"p-3 rounded-md border border-error/30 bg-error/5 space-y-2.5",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-error",children:b.confirmTitle}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{onClick:u,className:"px-3.5 py-2 text-sm font-medium rounded-lg bg-error text-white hover:bg-error/90 transition-colors focus-visible:ring-1 focus-visible:ring-ring",children:b.confirmButton}),(0,d.jsx)("button",{onClick:()=>n("idle"),className:"px-3.5 py-2 text-sm font-medium rounded-lg bg-muted text-foreground hover:bg-muted/80 transition-colors focus-visible:ring-1 focus-visible:ring-ring",children:b.cancelButton})]})]}),"running"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 py-2",children:[(0,d.jsx)(h.A,{size:14,className:"animate-spin text-muted-foreground"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:b.running})]}),"success"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 py-2",children:[(0,d.jsx)(i.A,{size:14,className:"text-success"}),(0,d.jsx)("span",{className:"text-xs text-success font-medium",children:(0,b.success)})]}),"error"===c&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(j.A,{size:14,className:"text-error"}),(0,d.jsx)("span",{className:"text-xs text-error font-medium",children:b.error})]}),o&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground font-mono",children:o}),(0,d.jsx)("button",{onClick:()=>n("idle"),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-muted text-foreground hover:bg-muted/80 transition-colors focus-visible:ring-1 focus-visible:ring-ring",children:b.cancelButton})]})]})}},90598:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/components/UpdateOverlay.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/UpdateOverlay.tsx","default")},90826:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(74429),g=c(19794),h=c(65032),i=c(42742),j=c(44218),k=c(33191);function l({dirPaths:a,value:b,onChange:c,rootLabel:l="Root"}){let[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(b),[q,r]=(0,e.useState)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(null);(0,e.useCallback)(()=>{if(!s.current)return;let a=s.current.getBoundingClientRect(),b=window.innerHeight-a.bottom,c=a.top,d=b<208&&c>b;r({top:d?a.top:a.bottom,left:a.left,width:a.width,flipUp:d})},[]);let u=(0,e.useCallback)(()=>n(!1),[]),v=(0,e.useMemo)(()=>{let b=o?o+"/":"";return a.filter(a=>{if(!a.startsWith(b))return!1;let c=a.slice(b.length);return c.length>0&&!c.includes("/")}).sort()},[a,o]),w=(0,e.useMemo)(()=>o?o.split("/"):[],[o]),x=a=>{if(a<0)p(""),c("");else{let b=w.slice(0,a+1).join("/");p(b),c(b)}},y=b?b.split("/").map(a=>(0,k.vr)(a)).join(" / "):"/ "+l,z=m&&q&&(0,f.createPortal)((0,d.jsxs)("div",{ref:t,className:"fixed z-[9999] rounded-lg border border-[var(--amber)] bg-card shadow-lg overflow-hidden flex flex-col",style:{left:q.left,width:q.width,maxHeight:200,...q.flipUp?{bottom:window.innerHeight-q.top+4}:{top:q.top+4}},children:[(0,d.jsxs)("div",{className:"flex items-center gap-0.5 px-3 py-1.5 bg-muted/30 border-b border-border overflow-x-auto text-xs shrink-0",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>x(-1),className:`shrink-0 px-1.5 py-0.5 rounded transition-colors ${""===o?"text-[var(--amber)] font-medium":"text-muted-foreground hover:text-foreground"}`,children:["/ ",l]}),w.map((a,b)=>(0,d.jsxs)("span",{className:"flex items-center gap-0.5 shrink-0",children:[(0,d.jsx)(g.A,{size:10,className:"text-muted-foreground/50"}),(0,d.jsx)("button",{type:"button",onClick:()=>x(b),className:`px-1.5 py-0.5 rounded transition-colors truncate max-w-[100px] ${b===w.length-1?"text-[var(--amber)] font-medium":"text-muted-foreground hover:text-foreground"}`,children:a})]},b))]}),v.length>0?(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:v.map(b=>{let e=b.split("/").pop()||b,f=a.some(a=>a.startsWith(b+"/"));return(0,d.jsxs)("button",{type:"button",onClick:()=>{p(b),c(b)},className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-muted/60 transition-colors",children:[(0,d.jsx)(h.A,{size:12,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1 text-left truncate",children:e}),f&&(0,d.jsx)(g.A,{size:11,className:"shrink-0 text-muted-foreground/40"})]},b)})}):(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground/50 text-center",children:"—"}),(0,d.jsx)("button",{type:"button",onClick:u,className:"w-full py-1.5 flex items-center justify-center gap-1 text-xs font-medium text-[var(--amber)] border-t border-border hover:bg-muted/30 transition-colors shrink-0",children:(0,d.jsx)(i.A,{size:12})})]}),document.body);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{ref:s,type:"button",onClick:()=>n(a=>!a),"aria-haspopup":"true","aria-expanded":m,className:`w-full flex items-center gap-2 px-3 py-2 text-sm rounded-lg border bg-background text-foreground transition-colors text-left focus-visible:ring-1 focus-visible:ring-ring outline-none ${m?"border-[var(--amber)]":"border-border hover:border-[var(--amber)]/40"}`,children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1 truncate",children:y}),(0,d.jsx)(j.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${m?"rotate-180":""}`})]}),z]})}},90933:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(97621),g=c(42742),h=c(6079),i=c(46674),j=c(19099),k=c(30315),l=c(33191),m=c(99829);let n=(0,m.createServerReference)("70ea0a40c710282728f15766f84d4a53ead712e44b",m.callServer,void 0,m.findSourceMapURL,"revertSpaceInitAction");function o(){let[a,b]=(0,e.useState)(null),[c,m]=(0,e.useState)(!1),[o,q]=(0,e.useTransition)(),r=(0,j.useRouter)(),{t:s}=(0,k.Y)(),t=(0,e.useCallback)(()=>{m(!1),setTimeout(()=>b(null),200)},[]);(0,e.useCallback)(a=>{let c=a.detail;"working"===c.state?(b(c),requestAnimationFrame(()=>m(!0))):"done"===c.state?(b(a=>a?{...a,state:"done"}:null),r.refresh()):t()},[r,t]);let u=(0,e.useCallback)(()=>{a&&(t(),r.push(`/view/${(0,l.O0)(a.spacePath+"/")}`))},[a,t,r]),v=(0,e.useCallback)(()=>{a&&q(async()=>{await n(a.spacePath,a.spaceName,a.description),b(a=>a?{...a,state:"reverted"}:null),r.refresh(),window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(t,2e3)})},[a,r,t]),w=(0,e.useCallback)(()=>{t()},[t]);if(!a)return null;let x=s.home,{state:y}=a,z="done"===y,A="reverted"===y;return(0,d.jsx)("div",{className:`fixed bottom-6 left-1/2 z-50 -translate-x-1/2 transition-all duration-200 ease-out ${c?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-3 scale-[0.96] pointer-events-none"}`,children:(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-full border bg-card/95 backdrop-blur py-2 shadow-lg",style:{borderColor:"color-mix(in srgb, var(--amber) 40%, var(--border))",boxShadow:"0 8px 24px color-mix(in srgb, var(--amber) 12%, rgba(0,0,0,.2))",paddingLeft:"0.75rem",paddingRight:z?"0.5rem":"1rem"},children:[(0,d.jsx)("span",{className:`inline-flex h-6 w-6 items-center justify-center rounded-full shrink-0 ${A?"text-muted-foreground bg-muted":"text-[var(--amber)] bg-[var(--amber-subtle)]"} ${"working"===y?"animate-pulse":""}`,children:A?(0,d.jsx)(f.A,{size:12}):z?(0,d.jsx)(g.A,{size:13,strokeWidth:2.5}):(0,d.jsx)(h.A,{size:13})}),(0,d.jsx)("span",{className:"text-xs text-foreground whitespace-nowrap select-none font-medium",children:A?x.aiInitReverted(a.spaceName):z?x.aiInitReady(a.spaceName):(0,d.jsxs)(d.Fragment,{children:[x.aiInitGenerating(a.spaceName),(0,d.jsx)(p,{})]})}),z&&(0,d.jsxs)("div",{className:"flex items-center gap-1 ml-1",children:[(0,d.jsx)("button",{type:"button",onClick:u,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-[var(--amber)] text-white hover:opacity-90 transition-opacity focus-visible:ring-2 focus-visible:ring-ring",children:x.aiInitReview}),(0,d.jsx)("button",{type:"button",onClick:v,disabled:o,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:x.aiInitDiscard}),(0,d.jsx)("button",{type:"button",onClick:w,"aria-label":"Accept",className:"ml-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors focus-visible:ring-2 focus-visible:ring-ring",children:(0,d.jsx)(i.A,{size:12})})]})]})})}function p(){return(0,d.jsxs)("span",{className:"inline-flex gap-[2px] items-end h-[1em] ml-px",children:[(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_0ms_infinite]"}),(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_200ms_infinite]"}),(0,d.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_400ms_infinite]"}),(0,d.jsx)("style",{children:`
199
- @keyframes dotBounce {
200
- 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
201
- 30% { opacity: 1; transform: translateY(-2px); }
202
- }
203
- `})]})}},92464:(a,b,c)=>{"use strict";c.d(b,{KT:()=>k,NH:()=>j});var d=c(67484);let e={open:!1,initialMessage:"",source:"user",acpAgent:null},f=new Set;function g(){f.forEach(a=>a())}function h(a){return f.add(a),()=>{f.delete(a)}}function i(){return e}function j(a="",b="user",c=null){e={open:!0,initialMessage:a,source:b,acpAgent:c},g()}function k(){let a=(0,d.useSyncExternalStore)(h,i,i);return{open:a.open,initialMessage:a.initialMessage,source:a.source,acpAgent:a.acpAgent,openWith:(0,d.useCallback)((a,b="user",c=null)=>j(a,b,c),[]),close:(0,d.useCallback)(()=>void(e={open:!1,initialMessage:"",source:"user",acpAgent:null},g()),[])}}},93096:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(48249);function e({text:a,query:b}){if(!b)return(0,d.jsx)(d.Fragment,{children:a});let c=a.toLowerCase().indexOf(b.toLowerCase());return -1===c?(0,d.jsx)(d.Fragment,{children:a}):(0,d.jsxs)(d.Fragment,{children:[a.slice(0,c),(0,d.jsx)("span",{className:"text-[var(--amber)] font-semibold",children:a.slice(c,c+b.length)}),a.slice(c+b.length)]})}},93491:(a,b,c)=>{"use strict";c.d(b,{A:()=>e,C:()=>d});let d=new Set(["INSTRUCTION.md","README.md","CONFIG.json","CHANGELOG.md"]),e=new Set(["TODO.md"])},93574:(a,b,c)=>{"use strict";c.d(b,{t:()=>h});var d=c(67484),e=c(4299);let f=new Set([401,403,429]),g=[/api.?key/i,/model.*not.?found/i,/authentication/i,/unauthorized/i,/forbidden/i];function h({currentFile:a,chatMode:b,providerOverride:c,onFirstMessage:h,refs:i,errorLabels:j,resetInputState:k}){let[l,m]=(0,d.useState)(!1),[n,o]=(0,d.useState)("connecting"),[p,q]=(0,d.useState)(0),r=(0,d.useRef)(3),s=(0,d.useRef)(null),t=(0,d.useRef)(!1),u=(0,d.useCallback)(()=>{s.current?.abort()},[]),v=(0,d.useCallback)(async d=>{d.preventDefault();let l=i.mentionRef.current,n=i.slashRef.current,p=i.imageUploadRef.current,u=i.sessionRef.current,v=i.uploadRef.current;if(!l||!n||!p||!u||!v||null!==l.mentionQuery||null!==n.slashQuery)return;let x=i.inputValueRef.current?.trim()??"";if(!x&&0===p.images.length||w.current)return;let y=i.selectedSkillRef.current,z=i.selectedAcpAgentRef.current,A=p.images.length>0?[...p.images]:void 0,B={role:"user",content:x,timestamp:Date.now(),...y&&{skillName:y.name},...A&&{images:A}};p.clearImages();let C=[...u.messages,B];u.setMessages([...C,{role:"assistant",content:"",timestamp:Date.now()}]),k(),h&&!t.current&&(t.current=!0,h()),m(!0),o("connecting"),q(0);let D=new AbortController;s.current=D;let E=3;try{let a=localStorage.getItem("mindos-reconnect-retries");if(null!==a){let b=parseInt(a,10);Number.isFinite(b)&&(E=Math.max(0,Math.min(10,b)))}}catch{}r.current=E;let F=JSON.stringify({messages:C,currentFile:a,attachedFiles:i.attachedFilesRef.current,uploadedFiles:v.localAttachments.map(a=>({name:a.name,content:a.content.length>2e4?a.content.slice(0,2e4)+"\n\n[...truncated to first ~20000 chars]":a.content})),selectedAcpAgent:z,mode:b,providerOverride:c??void 0}),G=async()=>{let a=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:F,signal:D.signal});if(!a.ok){let b=`Request failed (${a.status})`;try{let c=await a.json();"string"==typeof c?.error&&c.error.trim()?b=c.error:"object"==typeof c?.error&&"string"==typeof c.error?.message&&c.error.message.trim()?b=c.error.message:"string"==typeof c?.message&&c.message.trim()&&(b=c.message)}catch(a){console.warn("[useAskChat] error body parse failed:",a)}let c=Error(b);throw c.httpStatus=a.status,c}if(!a.body)throw Error("No response body");return o("thinking"),{finalMessage:await (0,e.m)(a.body,a=>{o("streaming"),i.sessionRef.current?.setMessages(b=>{let c=[...b];return c[c.length-1]=a,c})},D.signal)}};try{let a=null;for(let b=0;b<=E&&!D.signal.aborted;b++){if(b>0){var H;q(b),o("reconnecting"),i.sessionRef.current?.setMessages(a=>{let b=[...a];return b[b.length-1]={role:"assistant",content:"",timestamp:Date.now()},b}),await function(a,b){return new Promise((c,d)=>{let e=()=>b?.reason??new DOMException("The operation was aborted.","AbortError");if(b?.aborted)return void d(e());let f=setTimeout(c,a);b?.addEventListener("abort",()=>{clearTimeout(f),d(e())},{once:!0})})}((H=b-1,Math.min(1e3*2**H,1e4)),D.signal),o("connecting")}try{let{finalMessage:a}=await G();a.content.trim()||a.parts&&0!==a.parts.length||i.sessionRef.current?.setMessages(a=>{let b=[...a];return b[b.length-1]={role:"assistant",content:`__error__${j.noResponse}`},b});return}catch(d){a=d instanceof Error?d:Error(String(d));let c=d.httpStatus;if(!function(a,b){if(a instanceof DOMException&&"AbortError"===a.name||b&&f.has(b))return!1;if(a instanceof Error){let b=a.message;if(g.some(a=>a.test(b)))return!1}return!0}(d,c)||b>=E)break}}if(a)throw a}catch(a){if("AbortError"===a.name)i.sessionRef.current?.setMessages(a=>{let b=[...a],c=b.length-1;if(c>=0&&"assistant"===b[c].role){let a=b[c];a.content.trim()||a.parts&&a.parts.length>0||(b[c]={role:"assistant",content:`__error__${j.stopped}`})}return b});else{let b=a instanceof Error?a.message:"Something went wrong";i.sessionRef.current?.setMessages(a=>{let c=[...a],d=c.length-1;if(d>=0&&"assistant"===c[d].role){let a=c[d];if(!(a.content.trim()||a.parts&&a.parts.length>0))return c[d]={role:"assistant",content:`__error__${b}`},c}return[...c,{role:"assistant",content:`__error__${b}`}]})}}finally{m(!1),q(0),s.current=null}},[a,b,c,j.noResponse,j.stopped,h,i,k]),w=(0,d.useRef)(l);return w.current=l,{isLoading:l,isLoadingRef:w,loadingPhase:n,reconnectAttempt:p,reconnectMaxRef:r,abortRef:s,firstMessageFired:t,submit:v,stop:u}}},93678:(a,b,c)=>{"use strict";c.d(b,{V:()=>f,w:()=>e});var d=c(95054);async function e(){try{let a=await (0,d.n)("/api/settings"),b=a.ai?.provider??"",c=(a.ai?.providers??{})[b];return!!c?.apiKey}catch{return!1}}function f(a,b,c=""){let d="u">typeof document&&"zh"===document.documentElement.lang?`初始化新建的心智空间「${a}」,路径为「${b}/」。${c?`描述:「${c}」。`:""}两个文件均已存在模板,用 write_file 覆盖:
203
+ `})]})}d()}catch(a){d(a)}})},89386:(a,b,c)=>{"use strict";c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(42742),g=c(8455),h=c(41160),i=c(46674),j=c(99101);let k={success:(0,d.jsx)(f.A,{size:15,className:"text-success shrink-0"}),error:(0,d.jsx)(g.A,{size:15,className:"text-error shrink-0"}),info:(0,d.jsx)(h.A,{size:15,className:"text-muted-foreground shrink-0"})};function l(){let a=(0,e.useSyncExternalStore)(j.B1,j.dV,j.dV);return 0===a.length?null:(0,d.jsx)("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col-reverse gap-2 pointer-events-none","aria-live":"polite",children:a.map(a=>(0,d.jsxs)("div",{className:"pointer-events-auto flex items-center gap-2.5 bg-card border border-border rounded-lg shadow-lg px-4 py-2.5 min-w-[180px] max-w-[320px] animate-in slide-in-from-right-4 fade-in duration-200",children:[k[a.type],(0,d.jsx)("span",{className:"text-sm text-foreground flex-1 truncate",children:a.message}),a.action&&(0,d.jsx)("button",{type:"button",onClick:()=>{a.action.onClick(),(0,j.X8)(a.id)},className:"shrink-0 px-2.5 py-1 rounded text-xs font-medium text-[var(--amber)] hover:bg-[var(--amber-dim)] transition-colors min-h-[28px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:a.action.label}),(0,d.jsx)("button",{type:"button",onClick:()=>(0,j.X8)(a.id),className:"shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":a.action?.label?"Close":"Dismiss",children:(0,d.jsx)(i.A,{size:13})})]},a.id))})}},89872:(a,b,c)=>{"use strict";c.d(b,{Q:()=>n});var d=c(48249),e=c(67484),f=c(59347),g=c(17512),h=c(40560),i=c(49681),j=c(31675),k=c(95054),l=c(30315),m=c(81285);function n(){let{t:a}=(0,l.Y)(),b=a.settings.uninstall,[c,n]=(0,e.useState)("idle"),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!0),[s,t]=(0,e.useState)(!0),u=async()=>{n("running"),p("");try{await (0,k.n)("/api/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({removeConfig:q})}),n("success")}catch(a){p(a instanceof Error?a.message:String(a)),n("error")}},v=({checked:a,onChange:b,label:c,desc:e,disabled:f})=>(0,d.jsxs)("label",{className:`flex items-start gap-2.5 p-2.5 rounded bg-muted/30 cursor-pointer select-none ${f?"opacity-50 cursor-not-allowed":"hover:bg-muted/50"}`,children:[(0,d.jsx)("input",{type:"checkbox",checked:a,onChange:a=>!f&&b(a.target.checked),disabled:f,className:"mt-0.5 form-check"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-foreground",children:c}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:e})]})]});return(0,d.jsxs)(m.L7,{icon:(0,d.jsx)(f.A,{size:15}),title:b.title,description:(0,b.descCli),children:[(0,d.jsxs)("div",{className:"flex gap-2.5 p-3 rounded-md bg-muted/50 border border-border",children:[(0,d.jsx)(g.A,{size:14,className:"text-success shrink-0 mt-0.5"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:b.kbSafe})]}),"idle"===c||"confirming"===c?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(v,{checked:!0,disabled:!0,label:b.stopServices,desc:b.stopServicesDesc,onChange:()=>{}}),(0,d.jsx)(v,{checked:q,onChange:r,label:b.removeConfig,desc:b.removeConfigDesc}),(0,d.jsx)(v,{checked:!0,disabled:!0,label:b.removeNpm,desc:b.removeNpmDesc,onChange:()=>{}}),!1]}):null,"idle"===c&&(0,d.jsxs)("button",{onClick:()=>n("confirming"),className:"px-3.5 py-2 text-sm font-medium rounded-lg bg-error/10 text-error border border-error/20 hover:bg-error/20 transition-colors focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,d.jsx)(f.A,{size:12,className:"inline mr-1.5 -mt-px"}),b.confirmButton]}),"confirming"===c&&(0,d.jsxs)("div",{className:"p-3 rounded-md border border-error/30 bg-error/5 space-y-2.5",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-error",children:b.confirmTitle}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{onClick:u,className:"px-3.5 py-2 text-sm font-medium rounded-lg bg-error text-white hover:bg-error/90 transition-colors focus-visible:ring-1 focus-visible:ring-ring",children:b.confirmButton}),(0,d.jsx)("button",{onClick:()=>n("idle"),className:"px-3.5 py-2 text-sm font-medium rounded-lg bg-muted text-foreground hover:bg-muted/80 transition-colors focus-visible:ring-1 focus-visible:ring-ring",children:b.cancelButton})]})]}),"running"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 py-2",children:[(0,d.jsx)(h.A,{size:14,className:"animate-spin text-muted-foreground"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:b.running})]}),"success"===c&&(0,d.jsxs)("div",{className:"flex items-center gap-2 py-2",children:[(0,d.jsx)(i.A,{size:14,className:"text-success"}),(0,d.jsx)("span",{className:"text-xs text-success font-medium",children:(0,b.success)})]}),"error"===c&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(j.A,{size:14,className:"text-error"}),(0,d.jsx)("span",{className:"text-xs text-error font-medium",children:b.error})]}),o&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground font-mono",children:o}),(0,d.jsx)("button",{onClick:()=>n("idle"),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-muted text-foreground hover:bg-muted/80 transition-colors focus-visible:ring-1 focus-visible:ring-ring",children:b.cancelButton})]})]})}},90598:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/app/components/UpdateOverlay.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/app/components/UpdateOverlay.tsx","default")},90826:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(74429),g=c(19794),h=c(65032),i=c(42742),j=c(44218),k=c(33191);function l({dirPaths:a,value:b,onChange:c,rootLabel:l="Root"}){let[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(b),[q,r]=(0,e.useState)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(null);(0,e.useCallback)(()=>{if(!s.current)return;let a=s.current.getBoundingClientRect(),b=window.innerHeight-a.bottom,c=a.top,d=b<208&&c>b;r({top:d?a.top:a.bottom,left:a.left,width:a.width,flipUp:d})},[]);let u=(0,e.useCallback)(()=>n(!1),[]),v=(0,e.useMemo)(()=>{let b=o?o+"/":"";return a.filter(a=>{if(!a.startsWith(b))return!1;let c=a.slice(b.length);return c.length>0&&!c.includes("/")}).sort()},[a,o]),w=(0,e.useMemo)(()=>o?o.split("/"):[],[o]),x=a=>{if(a<0)p(""),c("");else{let b=w.slice(0,a+1).join("/");p(b),c(b)}},y=b?b.split("/").map(a=>(0,k.vr)(a)).join(" / "):"/ "+l,z=m&&q&&(0,f.createPortal)((0,d.jsxs)("div",{ref:t,className:"fixed z-[9999] rounded-lg border border-[var(--amber)] bg-card shadow-lg overflow-hidden flex flex-col",style:{left:q.left,width:q.width,maxHeight:200,...q.flipUp?{bottom:window.innerHeight-q.top+4}:{top:q.top+4}},children:[(0,d.jsxs)("div",{className:"flex items-center gap-0.5 px-3 py-1.5 bg-muted/30 border-b border-border overflow-x-auto text-xs shrink-0",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>x(-1),className:`shrink-0 px-1.5 py-0.5 rounded transition-colors ${""===o?"text-[var(--amber)] font-medium":"text-muted-foreground hover:text-foreground"}`,children:["/ ",l]}),w.map((a,b)=>(0,d.jsxs)("span",{className:"flex items-center gap-0.5 shrink-0",children:[(0,d.jsx)(g.A,{size:10,className:"text-muted-foreground/50"}),(0,d.jsx)("button",{type:"button",onClick:()=>x(b),className:`px-1.5 py-0.5 rounded transition-colors truncate max-w-[100px] ${b===w.length-1?"text-[var(--amber)] font-medium":"text-muted-foreground hover:text-foreground"}`,children:a})]},b))]}),v.length>0?(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:v.map(b=>{let e=b.split("/").pop()||b,f=a.some(a=>a.startsWith(b+"/"));return(0,d.jsxs)("button",{type:"button",onClick:()=>{p(b),c(b)},className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-muted/60 transition-colors",children:[(0,d.jsx)(h.A,{size:12,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1 text-left truncate",children:e}),f&&(0,d.jsx)(g.A,{size:11,className:"shrink-0 text-muted-foreground/40"})]},b)})}):(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground/50 text-center",children:"—"}),(0,d.jsx)("button",{type:"button",onClick:u,className:"w-full py-1.5 flex items-center justify-center gap-1 text-xs font-medium text-[var(--amber)] border-t border-border hover:bg-muted/30 transition-colors shrink-0",children:(0,d.jsx)(i.A,{size:12})})]}),document.body);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{ref:s,type:"button",onClick:()=>n(a=>!a),"aria-haspopup":"true","aria-expanded":m,className:`w-full flex items-center gap-2 px-3 py-2 text-sm rounded-lg border bg-background text-foreground transition-colors text-left focus-visible:ring-1 focus-visible:ring-ring outline-none ${m?"border-[var(--amber)]":"border-border hover:border-[var(--amber)]/40"}`,children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1 truncate",children:y}),(0,d.jsx)(j.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${m?"rotate-180":""}`})]}),z]})}},92464:(a,b,c)=>{"use strict";c.d(b,{KT:()=>k,NH:()=>j});var d=c(67484);let e={open:!1,initialMessage:"",source:"user",acpAgent:null},f=new Set;function g(){f.forEach(a=>a())}function h(a){return f.add(a),()=>{f.delete(a)}}function i(){return e}function j(a="",b="user",c=null){e={open:!0,initialMessage:a,source:b,acpAgent:c},g()}function k(){let a=(0,d.useSyncExternalStore)(h,i,i);return{open:a.open,initialMessage:a.initialMessage,source:a.source,acpAgent:a.acpAgent,openWith:(0,d.useCallback)((a,b="user",c=null)=>j(a,b,c),[]),close:(0,d.useCallback)(()=>void(e={open:!1,initialMessage:"",source:"user",acpAgent:null},g()),[])}}},92800:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});var d=c(99829);let e=(0,d.createServerReference)("40469e1a3f65754f08872955f4fa07f79cd904e53a",d.callServer,void 0,d.findSourceMapURL,"undoDeleteAction")},93096:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(48249);function e({text:a,query:b}){if(!b)return(0,d.jsx)(d.Fragment,{children:a});let c=a.toLowerCase().indexOf(b.toLowerCase());return -1===c?(0,d.jsx)(d.Fragment,{children:a}):(0,d.jsxs)(d.Fragment,{children:[a.slice(0,c),(0,d.jsx)("span",{className:"text-[var(--amber)] font-semibold",children:a.slice(c,c+b.length)}),a.slice(c+b.length)]})}},93491:(a,b,c)=>{"use strict";c.d(b,{A:()=>e,C:()=>d});let d=new Set(["INSTRUCTION.md","README.md","CONFIG.json","CHANGELOG.md"]),e=new Set(["TODO.md"])},93574:(a,b,c)=>{"use strict";c.d(b,{t:()=>h});var d=c(67484),e=c(4299);let f=new Set([401,403,429]),g=[/api.?key/i,/model.*not.?found/i,/authentication/i,/unauthorized/i,/forbidden/i];function h({currentFile:a,chatMode:b,providerOverride:c,onFirstMessage:h,refs:i,errorLabels:j,resetInputState:k}){let[l,m]=(0,d.useState)(!1),[n,o]=(0,d.useState)("connecting"),[p,q]=(0,d.useState)(0),r=(0,d.useRef)(3),s=(0,d.useRef)(null),t=(0,d.useRef)(!1),u=(0,d.useCallback)(()=>{s.current?.abort()},[]),v=(0,d.useCallback)(async d=>{d.preventDefault();let l=i.mentionRef.current,n=i.slashRef.current,p=i.imageUploadRef.current,u=i.sessionRef.current,v=i.uploadRef.current;if(!l||!n||!p||!u||!v||null!==l.mentionQuery||null!==n.slashQuery)return;let x=i.inputValueRef.current?.trim()??"";if(!x&&0===p.images.length||w.current)return;let y=i.selectedSkillRef.current,z=i.selectedAcpAgentRef.current,A=p.images.length>0?[...p.images]:void 0,B={role:"user",content:x,timestamp:Date.now(),...y&&{skillName:y.name},...A&&{images:A}};p.clearImages();let C=[...u.messages,B];u.setMessages([...C,{role:"assistant",content:"",timestamp:Date.now()}]),k(),h&&!t.current&&(t.current=!0,h()),m(!0),o("connecting"),q(0);let D=new AbortController;s.current=D;let E=3;try{let a=localStorage.getItem("mindos-reconnect-retries");if(null!==a){let b=parseInt(a,10);Number.isFinite(b)&&(E=Math.max(0,Math.min(10,b)))}}catch{}r.current=E;let F=JSON.stringify({messages:C,currentFile:a,attachedFiles:i.attachedFilesRef.current,uploadedFiles:v.localAttachments.map(a=>({name:a.name,content:a.content.length>2e4?a.content.slice(0,2e4)+"\n\n[...truncated to first ~20000 chars]":a.content})),selectedAcpAgent:z,mode:b,providerOverride:c??void 0}),G=async()=>{let a=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:F,signal:D.signal});if(!a.ok){let b=`Request failed (${a.status})`;try{let c=await a.json();"string"==typeof c?.error&&c.error.trim()?b=c.error:"object"==typeof c?.error&&"string"==typeof c.error?.message&&c.error.message.trim()?b=c.error.message:"string"==typeof c?.message&&c.message.trim()&&(b=c.message)}catch(a){console.warn("[useAskChat] error body parse failed:",a)}let c=Error(b);throw c.httpStatus=a.status,c}if(!a.body)throw Error("No response body");return o("thinking"),{finalMessage:await (0,e.m)(a.body,a=>{o("streaming"),i.sessionRef.current?.setMessages(b=>{let c=[...b];return c[c.length-1]=a,c})},D.signal)}};try{let a=null;for(let b=0;b<=E&&!D.signal.aborted;b++){if(b>0){var H;q(b),o("reconnecting"),i.sessionRef.current?.setMessages(a=>{let b=[...a];return b[b.length-1]={role:"assistant",content:"",timestamp:Date.now()},b}),await function(a,b){return new Promise((c,d)=>{let e=()=>b?.reason??new DOMException("The operation was aborted.","AbortError");if(b?.aborted)return void d(e());let f=setTimeout(c,a);b?.addEventListener("abort",()=>{clearTimeout(f),d(e())},{once:!0})})}((H=b-1,Math.min(1e3*2**H,1e4)),D.signal),o("connecting")}try{let{finalMessage:a}=await G();a.content.trim()||a.parts&&0!==a.parts.length||i.sessionRef.current?.setMessages(a=>{let b=[...a];return b[b.length-1]={role:"assistant",content:`__error__${j.noResponse}`},b});return}catch(d){a=d instanceof Error?d:Error(String(d));let c=d.httpStatus;if(!function(a,b){if(a instanceof DOMException&&"AbortError"===a.name||b&&f.has(b))return!1;if(a instanceof Error){let b=a.message;if(g.some(a=>a.test(b)))return!1}return!0}(d,c)||b>=E)break}}if(a)throw a}catch(a){if("AbortError"===a.name)i.sessionRef.current?.setMessages(a=>{let b=[...a],c=b.length-1;if(c>=0&&"assistant"===b[c].role){let a=b[c];a.content.trim()||a.parts&&a.parts.length>0||(b[c]={role:"assistant",content:`__error__${j.stopped}`})}return b});else{let b=a instanceof Error?a.message:"Something went wrong";i.sessionRef.current?.setMessages(a=>{let c=[...a],d=c.length-1;if(d>=0&&"assistant"===c[d].role){let a=c[d];if(!(a.content.trim()||a.parts&&a.parts.length>0))return c[d]={role:"assistant",content:`__error__${b}`},c}return[...c,{role:"assistant",content:`__error__${b}`}]})}}finally{m(!1),q(0),s.current=null}},[a,b,c,j.noResponse,j.stopped,h,i,k]),w=(0,d.useRef)(l);return w.current=l,{isLoading:l,isLoadingRef:w,loadingPhase:n,reconnectAttempt:p,reconnectMaxRef:r,abortRef:s,firstMessageFired:t,submit:v,stop:u}}},93678:(a,b,c)=>{"use strict";c.d(b,{V:()=>f,w:()=>e});var d=c(95054);async function e(){try{let a=await (0,d.n)("/api/settings"),b=a.ai?.provider??"",c=(a.ai?.providers??{})[b];return!!c?.apiKey}catch{return!1}}function f(a,b,c=""){let d="u">typeof document&&"zh"===document.documentElement.lang?`初始化新建的心智空间「${a}」,路径为「${b}/」。${c?`描述:「${c}」。`:""}两个文件均已存在模板,用 write_file 覆盖:
204
204
  1. 「${b}/README.md」— 写入空间用途、结构概览、使用指南
205
205
  2. 「${b}/INSTRUCTION.md」— 写入 AI Agent 在此空间中的行为规则和操作约定
206
206