@geminilight/mindos 0.6.59 → 0.6.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) 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 +23 -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/routes-manifest.json +6 -0
  10. package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
  11. package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  12. package/_standalone/.next/server/app/_global-error.html +2 -2
  13. package/_standalone/.next/server/app/_global-error.rsc +1 -1
  14. package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  15. package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  16. package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  17. package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/_standalone/.next/server/app/_not-found/page.js +1 -1
  21. package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
  24. package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
  25. package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
  26. package/_standalone/.next/server/app/agents/page.js +1 -1
  27. package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
  28. package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  29. package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
  30. package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
  31. package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
  32. package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
  33. package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
  34. package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
  35. package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
  36. package/_standalone/.next/server/app/api/acp/registry/route.js +1 -1
  37. package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
  38. package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
  39. package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
  40. package/_standalone/.next/server/app/api/agents/copy-skill/route.js +1 -0
  41. package/_standalone/.next/server/app/api/agents/copy-skill/route.js.nft.json +1 -0
  42. package/_standalone/.next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -0
  43. package/_standalone/.next/server/app/api/agents/custom/detect/route.js +1 -1
  44. package/_standalone/.next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
  45. package/_standalone/.next/server/app/api/agents/custom/route.js +1 -1
  46. package/_standalone/.next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
  47. package/_standalone/.next/server/app/api/ask/route.js +20 -9
  48. package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
  49. package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
  50. package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
  51. package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
  52. package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
  53. package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
  54. package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
  55. package/_standalone/.next/server/app/api/extract-pdf/route.js +2 -2
  56. package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
  57. package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
  58. package/_standalone/.next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
  59. package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
  60. package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  61. package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  62. package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
  63. package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  64. package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
  65. package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  66. package/_standalone/.next/server/app/api/mcp/agents/route.js +1 -1
  67. package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
  68. package/_standalone/.next/server/app/api/mcp/install/route.js +1 -1
  69. package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
  70. package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
  71. package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
  72. package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
  73. package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
  74. package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
  75. package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
  76. package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  77. package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  78. package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
  79. package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
  80. package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  81. package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
  82. package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
  83. package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
  84. package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
  85. package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
  86. package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
  87. package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  88. package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  89. package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
  90. package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
  91. package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  92. package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
  93. package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
  94. package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  95. package/_standalone/.next/server/app/changes/page.js +2 -2
  96. package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
  97. package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
  98. package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
  99. package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
  100. package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
  101. package/_standalone/.next/server/app/echo/page.js +1 -1
  102. package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
  103. package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
  104. package/_standalone/.next/server/app/explore/page.js +1 -1
  105. package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
  106. package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
  107. package/_standalone/.next/server/app/help/page.js +1 -1
  108. package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
  109. package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
  110. package/_standalone/.next/server/app/inbox/history/page.js +1 -1
  111. package/_standalone/.next/server/app/inbox/history/page.js.nft.json +1 -1
  112. package/_standalone/.next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
  113. package/_standalone/.next/server/app/login/page.js +1 -1
  114. package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
  115. package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  116. package/_standalone/.next/server/app/page.js +1 -1
  117. package/_standalone/.next/server/app/page.js.nft.json +1 -1
  118. package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  119. package/_standalone/.next/server/app/setup/page.js +1 -1
  120. package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
  121. package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  122. package/_standalone/.next/server/app/trash/page.js +3 -3
  123. package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
  124. package/_standalone/.next/server/app/view/[...path]/page.js +2 -2
  125. package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
  126. package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
  127. package/_standalone/.next/server/app/wiki/page.js +1 -1
  128. package/_standalone/.next/server/app/wiki/page.js.nft.json +1 -1
  129. package/_standalone/.next/server/app/wiki/page_client-reference-manifest.js +1 -1
  130. package/_standalone/.next/server/app-paths-manifest.json +23 -22
  131. package/_standalone/.next/server/chunks/1550.js +1 -1
  132. package/_standalone/.next/server/chunks/1750.js +1 -1
  133. package/_standalone/.next/server/chunks/3484.js +1 -1
  134. package/_standalone/.next/server/chunks/530.js +33 -33
  135. package/_standalone/.next/server/chunks/6539.js +1 -1
  136. package/_standalone/.next/server/chunks/{8343.js → 8955.js} +3 -3
  137. package/_standalone/.next/server/pages/500.html +2 -2
  138. package/_standalone/.next/server/server-reference-manifest.js +1 -1
  139. package/_standalone/.next/server/server-reference-manifest.json +1 -1
  140. package/_standalone/.next/static/5GmVArEG8OX03azKICsGq/_buildManifest.js +1 -0
  141. package/_standalone/.next/static/chunks/1369-7d0ac5d1564eed1e.js +1 -0
  142. package/_standalone/.next/static/chunks/{5581-dac72e9f16e5ea29.js → 5581-0c700c20718bd916.js} +4 -4
  143. package/_standalone/.next/static/chunks/7249-b0a9c77b9a84b11c.js +11 -0
  144. package/_standalone/.next/static/chunks/7637-904b0a381dc3ec02.js +1 -0
  145. package/_standalone/.next/static/chunks/8520-76d1b05072178b43.js +22 -0
  146. package/_standalone/.next/static/chunks/9186-ead47513192f658b.js +1 -0
  147. package/_standalone/.next/static/chunks/app/.well-known/agent-card.json/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
  148. package/_standalone/.next/static/chunks/app/_global-error/{page-2f4705aa66819b86.js → page-2ceea6eabf25b1f2.js} +1 -1
  149. package/_standalone/.next/static/chunks/app/agents/[agentKey]/page-0ea3571c8fbae823.js +1 -0
  150. package/_standalone/.next/static/chunks/app/agents/{page-b172ea3743adb047.js → page-66858acbcd1d4bf8.js} +1 -1
  151. package/_standalone/.next/static/chunks/app/api/a2a/agents/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
  152. package/_standalone/.next/static/chunks/app/api/a2a/delegations/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
  153. package/_standalone/.next/static/chunks/app/api/a2a/discover/route-2ceea6eabf25b1f2.js +1 -0
  154. package/_standalone/.next/static/chunks/app/api/a2a/route-2ceea6eabf25b1f2.js +1 -0
  155. package/_standalone/.next/static/chunks/app/api/acp/config/route-2ceea6eabf25b1f2.js +1 -0
  156. package/_standalone/.next/static/chunks/app/api/acp/detect/route-2ceea6eabf25b1f2.js +1 -0
  157. package/_standalone/.next/static/chunks/app/api/acp/install/route-2ceea6eabf25b1f2.js +1 -0
  158. package/_standalone/.next/static/chunks/app/api/acp/registry/route-2ceea6eabf25b1f2.js +1 -0
  159. package/_standalone/.next/static/chunks/app/api/acp/session/route-2ceea6eabf25b1f2.js +1 -0
  160. package/_standalone/.next/static/chunks/app/api/agent-activity/route-2ceea6eabf25b1f2.js +1 -0
  161. package/_standalone/.next/static/chunks/app/api/agents/copy-skill/route-2ceea6eabf25b1f2.js +1 -0
  162. package/_standalone/.next/static/chunks/app/api/agents/custom/detect/route-2ceea6eabf25b1f2.js +1 -0
  163. package/_standalone/.next/static/chunks/app/api/agents/custom/route-2ceea6eabf25b1f2.js +1 -0
  164. package/_standalone/.next/static/chunks/app/api/ask/route-2ceea6eabf25b1f2.js +1 -0
  165. package/_standalone/.next/static/chunks/app/api/ask-sessions/route-2ceea6eabf25b1f2.js +1 -0
  166. package/_standalone/.next/static/chunks/app/api/auth/route-2ceea6eabf25b1f2.js +1 -0
  167. package/_standalone/.next/static/chunks/app/api/backlinks/route-2ceea6eabf25b1f2.js +1 -0
  168. package/_standalone/.next/static/chunks/app/api/bootstrap/route-2ceea6eabf25b1f2.js +1 -0
  169. package/_standalone/.next/static/chunks/app/api/changes/route-2ceea6eabf25b1f2.js +1 -0
  170. package/_standalone/.next/static/chunks/app/api/export/route-2ceea6eabf25b1f2.js +1 -0
  171. package/_standalone/.next/static/chunks/app/api/extract-pdf/route-2ceea6eabf25b1f2.js +1 -0
  172. package/_standalone/.next/static/chunks/app/api/file/import/route-2ceea6eabf25b1f2.js +1 -0
  173. package/_standalone/.next/static/chunks/app/api/file/raw/route-2ceea6eabf25b1f2.js +1 -0
  174. package/_standalone/.next/static/chunks/app/api/file/route-2ceea6eabf25b1f2.js +1 -0
  175. package/_standalone/.next/static/chunks/app/api/files/route-2ceea6eabf25b1f2.js +1 -0
  176. package/_standalone/.next/static/chunks/app/api/git/route-2ceea6eabf25b1f2.js +1 -0
  177. package/_standalone/.next/static/chunks/app/api/graph/route-2ceea6eabf25b1f2.js +1 -0
  178. package/_standalone/.next/static/chunks/app/api/health/route-2ceea6eabf25b1f2.js +1 -0
  179. package/_standalone/.next/static/chunks/app/api/inbox/route-2ceea6eabf25b1f2.js +1 -0
  180. package/_standalone/.next/static/chunks/app/api/init/route-2ceea6eabf25b1f2.js +1 -0
  181. package/_standalone/.next/static/chunks/app/api/mcp/agents/route-2ceea6eabf25b1f2.js +1 -0
  182. package/_standalone/.next/static/chunks/app/api/mcp/install/route-2ceea6eabf25b1f2.js +1 -0
  183. package/_standalone/.next/static/chunks/app/api/mcp/install-skill/route-2ceea6eabf25b1f2.js +1 -0
  184. package/_standalone/.next/static/chunks/app/api/mcp/restart/route-2ceea6eabf25b1f2.js +1 -0
  185. package/_standalone/.next/static/chunks/app/api/mcp/status/route-2ceea6eabf25b1f2.js +1 -0
  186. package/_standalone/.next/static/chunks/app/api/mcp/uninstall/route-2ceea6eabf25b1f2.js +1 -0
  187. package/_standalone/.next/static/chunks/app/api/monitoring/route-2ceea6eabf25b1f2.js +1 -0
  188. package/_standalone/.next/static/chunks/app/api/recent-files/route-2ceea6eabf25b1f2.js +1 -0
  189. package/_standalone/.next/static/chunks/app/api/restart/route-2ceea6eabf25b1f2.js +1 -0
  190. package/_standalone/.next/static/chunks/app/api/search/route-2ceea6eabf25b1f2.js +1 -0
  191. package/_standalone/.next/static/chunks/app/api/settings/list-models/route-2ceea6eabf25b1f2.js +1 -0
  192. package/_standalone/.next/static/chunks/app/api/settings/reset-token/route-2ceea6eabf25b1f2.js +1 -0
  193. package/_standalone/.next/static/chunks/app/api/settings/route-2ceea6eabf25b1f2.js +1 -0
  194. package/_standalone/.next/static/chunks/app/api/settings/test-key/route-2ceea6eabf25b1f2.js +1 -0
  195. package/_standalone/.next/static/chunks/app/api/setup/check-path/route-2ceea6eabf25b1f2.js +1 -0
  196. package/_standalone/.next/static/chunks/app/api/setup/check-port/route-2ceea6eabf25b1f2.js +1 -0
  197. package/_standalone/.next/static/chunks/app/api/setup/generate-token/route-2ceea6eabf25b1f2.js +1 -0
  198. package/_standalone/.next/static/chunks/app/api/setup/ls/route-2ceea6eabf25b1f2.js +1 -0
  199. package/_standalone/.next/static/chunks/app/api/setup/route-2ceea6eabf25b1f2.js +1 -0
  200. package/_standalone/.next/static/chunks/app/api/skills/route-2ceea6eabf25b1f2.js +1 -0
  201. package/_standalone/.next/static/chunks/app/api/sync/route-2ceea6eabf25b1f2.js +1 -0
  202. package/_standalone/.next/static/chunks/app/api/tree-version/route-2ceea6eabf25b1f2.js +1 -0
  203. package/_standalone/.next/static/chunks/app/api/uninstall/route-2ceea6eabf25b1f2.js +1 -0
  204. package/_standalone/.next/static/chunks/app/api/update/route-2ceea6eabf25b1f2.js +1 -0
  205. package/_standalone/.next/static/chunks/app/api/update-check/route-2ceea6eabf25b1f2.js +1 -0
  206. package/_standalone/.next/static/chunks/app/api/update-status/route-2ceea6eabf25b1f2.js +1 -0
  207. package/_standalone/.next/static/chunks/app/api/workflows/route-2ceea6eabf25b1f2.js +1 -0
  208. package/_standalone/.next/static/chunks/app/changes/page-dd0b00a7b81f74e2.js +1 -0
  209. package/_standalone/.next/static/chunks/app/echo/[segment]/{page-84b95256f6e38aae.js → page-bf5c290fa3ccff09.js} +1 -1
  210. package/_standalone/.next/static/chunks/app/echo/page-2ceea6eabf25b1f2.js +1 -0
  211. package/_standalone/.next/static/chunks/app/inbox/history/{page-26e71fb6f716a4c4.js → page-3279585360df132c.js} +1 -1
  212. package/_standalone/.next/static/chunks/app/{layout-b89b0d955f39a753.js → layout-a5d5925b47e87cc3.js} +24 -24
  213. package/_standalone/.next/static/chunks/app/loading-2ceea6eabf25b1f2.js +1 -0
  214. package/_standalone/.next/static/chunks/app/{page-a8e6f085f38388bf.js → page-6a1f8d21c12b829e.js} +1 -1
  215. package/_standalone/.next/static/chunks/app/trash/page-40bc7316806acd62.js +1 -0
  216. package/_standalone/.next/static/chunks/app/view/[...path]/loading-2ceea6eabf25b1f2.js +1 -0
  217. package/_standalone/.next/static/chunks/app/view/[...path]/{page-f87f4901b5e1a88f.js → page-6fbb14b8f322d0f0.js} +1 -1
  218. package/_standalone/.next/static/chunks/app/wiki/page-ba36eccf4fe62cfe.js +1 -0
  219. package/_standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-2ceea6eabf25b1f2.js +1 -0
  220. package/_standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-2ceea6eabf25b1f2.js +1 -0
  221. package/_standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-2ceea6eabf25b1f2.js +1 -0
  222. package/_standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-2ceea6eabf25b1f2.js +1 -0
  223. package/_standalone/.next/static/css/b57c4eb3cc88308b.css +1 -0
  224. package/_standalone/.next/trace +65 -64
  225. package/_standalone/.next/types/routes.d.ts +2 -1
  226. package/_standalone/.next/types/validator.ts +9 -0
  227. package/_standalone/__tests__/api/mcp-install.test.ts +5 -2
  228. package/_standalone/components/AskFab.tsx +7 -1
  229. package/_standalone/components/FileTree.tsx +83 -1
  230. package/_standalone/components/Panel.tsx +20 -1
  231. package/_standalone/components/agents/AgentsOverviewSection.tsx +13 -11
  232. package/_standalone/components/agents/CustomAgentModal.tsx +72 -18
  233. package/_standalone/components/ask/AskContent.tsx +19 -3
  234. package/_standalone/components/ask/FileChip.tsx +93 -12
  235. package/_standalone/components/changes/ChangesBanner.tsx +1 -1
  236. package/_standalone/components/home/InboxSection.tsx +148 -32
  237. package/_standalone/components/walkthrough/WalkthroughTooltip.tsx +3 -1
  238. package/_standalone/components/walkthrough/steps.ts +1 -1
  239. package/_standalone/hooks/useAskChat.ts +10 -8
  240. package/_standalone/hooks/useFileUpload.ts +97 -43
  241. package/_standalone/hooks/useImageUpload.ts +1 -1
  242. package/_standalone/lib/inbox-upload.ts +86 -0
  243. package/_standalone/package-lock.json +2 -2
  244. package/_standalone/package.json +1 -1
  245. package/_standalone/scripts/extract-pdf.cjs +110 -3
  246. package/_standalone/tsconfig.tsbuildinfo +1 -1
  247. package/app/app/api/agents/copy-skill/route.ts +110 -0
  248. package/app/app/api/agents/custom/detect/route.ts +16 -1
  249. package/app/app/api/ask/route.ts +9 -3
  250. package/app/app/api/extract-pdf/route.ts +12 -5
  251. package/app/app/api/mcp/agents/route.ts +64 -2
  252. package/app/app/api/mcp/install/route.ts +17 -1
  253. package/app/components/AskFab.tsx +7 -1
  254. package/app/components/FileTree.tsx +83 -1
  255. package/app/components/HomeContent.tsx +14 -6
  256. package/app/components/Panel.tsx +20 -1
  257. package/app/components/agents/AgentDetailContent.tsx +58 -1
  258. package/app/components/agents/AgentsOverviewSection.tsx +13 -11
  259. package/app/components/agents/CustomAgentModal.tsx +72 -18
  260. package/app/components/ask/AskContent.tsx +19 -3
  261. package/app/components/ask/FileChip.tsx +93 -12
  262. package/app/components/changes/ChangesBanner.tsx +1 -1
  263. package/app/components/changes/ChangesContentPage.tsx +368 -168
  264. package/app/components/home/InboxSection.tsx +148 -32
  265. package/app/components/walkthrough/WalkthroughTooltip.tsx +3 -1
  266. package/app/components/walkthrough/steps.ts +1 -1
  267. package/app/hooks/useAskChat.ts +10 -8
  268. package/app/hooks/useFileUpload.ts +97 -43
  269. package/app/hooks/useImageUpload.ts +1 -1
  270. package/app/lib/acp/agent-descriptors.ts +3 -0
  271. package/app/lib/acp/subprocess.ts +56 -8
  272. package/app/lib/agent/prompt.ts +15 -4
  273. package/app/lib/custom-agents.ts +109 -1
  274. package/app/lib/file-ops.ts +58 -0
  275. package/app/lib/i18n/modules/ai-chat.ts +37 -0
  276. package/app/lib/i18n/modules/knowledge.ts +12 -0
  277. package/app/lib/inbox-upload.ts +86 -0
  278. package/app/lib/mcp-agents.ts +30 -1
  279. package/app/lib/types.ts +12 -0
  280. package/app/package.json +1 -1
  281. package/app/scripts/extract-pdf.cjs +110 -3
  282. package/bin/lib/mcp-agents.js +34 -1
  283. package/bin/lib/mcp-install.js +94 -20
  284. package/bin/lib/toml.js +125 -0
  285. package/package.json +1 -1
  286. package/scripts/build-runtime-archive.sh +5 -1
  287. package/scripts/setup.js +19 -0
  288. package/_standalone/.next/static/chunks/4237-ffc6e7c15d4007b6.js +0 -1
  289. package/_standalone/.next/static/chunks/6878-e2c5459e1c608f89.js +0 -1
  290. package/_standalone/.next/static/chunks/7249-6cf8f2b78718c59e.js +0 -11
  291. package/_standalone/.next/static/chunks/8520-56ec9ff087c15204.js +0 -22
  292. package/_standalone/.next/static/chunks/9286-5b09baa5200318c2.js +0 -1
  293. package/_standalone/.next/static/chunks/app/agents/[agentKey]/page-35ea6de1af2be3b5.js +0 -1
  294. package/_standalone/.next/static/chunks/app/api/a2a/discover/route-2f4705aa66819b86.js +0 -1
  295. package/_standalone/.next/static/chunks/app/api/a2a/route-2f4705aa66819b86.js +0 -1
  296. package/_standalone/.next/static/chunks/app/api/acp/config/route-2f4705aa66819b86.js +0 -1
  297. package/_standalone/.next/static/chunks/app/api/acp/detect/route-2f4705aa66819b86.js +0 -1
  298. package/_standalone/.next/static/chunks/app/api/acp/install/route-2f4705aa66819b86.js +0 -1
  299. package/_standalone/.next/static/chunks/app/api/acp/registry/route-2f4705aa66819b86.js +0 -1
  300. package/_standalone/.next/static/chunks/app/api/acp/session/route-2f4705aa66819b86.js +0 -1
  301. package/_standalone/.next/static/chunks/app/api/agent-activity/route-2f4705aa66819b86.js +0 -1
  302. package/_standalone/.next/static/chunks/app/api/agents/custom/detect/route-2f4705aa66819b86.js +0 -1
  303. package/_standalone/.next/static/chunks/app/api/agents/custom/route-2f4705aa66819b86.js +0 -1
  304. package/_standalone/.next/static/chunks/app/api/ask/route-2f4705aa66819b86.js +0 -1
  305. package/_standalone/.next/static/chunks/app/api/ask-sessions/route-2f4705aa66819b86.js +0 -1
  306. package/_standalone/.next/static/chunks/app/api/auth/route-2f4705aa66819b86.js +0 -1
  307. package/_standalone/.next/static/chunks/app/api/backlinks/route-2f4705aa66819b86.js +0 -1
  308. package/_standalone/.next/static/chunks/app/api/bootstrap/route-2f4705aa66819b86.js +0 -1
  309. package/_standalone/.next/static/chunks/app/api/changes/route-2f4705aa66819b86.js +0 -1
  310. package/_standalone/.next/static/chunks/app/api/export/route-2f4705aa66819b86.js +0 -1
  311. package/_standalone/.next/static/chunks/app/api/extract-pdf/route-2f4705aa66819b86.js +0 -1
  312. package/_standalone/.next/static/chunks/app/api/file/import/route-2f4705aa66819b86.js +0 -1
  313. package/_standalone/.next/static/chunks/app/api/file/raw/route-2f4705aa66819b86.js +0 -1
  314. package/_standalone/.next/static/chunks/app/api/file/route-2f4705aa66819b86.js +0 -1
  315. package/_standalone/.next/static/chunks/app/api/files/route-2f4705aa66819b86.js +0 -1
  316. package/_standalone/.next/static/chunks/app/api/git/route-2f4705aa66819b86.js +0 -1
  317. package/_standalone/.next/static/chunks/app/api/graph/route-2f4705aa66819b86.js +0 -1
  318. package/_standalone/.next/static/chunks/app/api/health/route-2f4705aa66819b86.js +0 -1
  319. package/_standalone/.next/static/chunks/app/api/inbox/route-2f4705aa66819b86.js +0 -1
  320. package/_standalone/.next/static/chunks/app/api/init/route-2f4705aa66819b86.js +0 -1
  321. package/_standalone/.next/static/chunks/app/api/mcp/agents/route-2f4705aa66819b86.js +0 -1
  322. package/_standalone/.next/static/chunks/app/api/mcp/install/route-2f4705aa66819b86.js +0 -1
  323. package/_standalone/.next/static/chunks/app/api/mcp/install-skill/route-2f4705aa66819b86.js +0 -1
  324. package/_standalone/.next/static/chunks/app/api/mcp/restart/route-2f4705aa66819b86.js +0 -1
  325. package/_standalone/.next/static/chunks/app/api/mcp/status/route-2f4705aa66819b86.js +0 -1
  326. package/_standalone/.next/static/chunks/app/api/mcp/uninstall/route-2f4705aa66819b86.js +0 -1
  327. package/_standalone/.next/static/chunks/app/api/monitoring/route-2f4705aa66819b86.js +0 -1
  328. package/_standalone/.next/static/chunks/app/api/recent-files/route-2f4705aa66819b86.js +0 -1
  329. package/_standalone/.next/static/chunks/app/api/restart/route-2f4705aa66819b86.js +0 -1
  330. package/_standalone/.next/static/chunks/app/api/search/route-2f4705aa66819b86.js +0 -1
  331. package/_standalone/.next/static/chunks/app/api/settings/list-models/route-2f4705aa66819b86.js +0 -1
  332. package/_standalone/.next/static/chunks/app/api/settings/reset-token/route-2f4705aa66819b86.js +0 -1
  333. package/_standalone/.next/static/chunks/app/api/settings/route-2f4705aa66819b86.js +0 -1
  334. package/_standalone/.next/static/chunks/app/api/settings/test-key/route-2f4705aa66819b86.js +0 -1
  335. package/_standalone/.next/static/chunks/app/api/setup/check-path/route-2f4705aa66819b86.js +0 -1
  336. package/_standalone/.next/static/chunks/app/api/setup/check-port/route-2f4705aa66819b86.js +0 -1
  337. package/_standalone/.next/static/chunks/app/api/setup/generate-token/route-2f4705aa66819b86.js +0 -1
  338. package/_standalone/.next/static/chunks/app/api/setup/ls/route-2f4705aa66819b86.js +0 -1
  339. package/_standalone/.next/static/chunks/app/api/setup/route-2f4705aa66819b86.js +0 -1
  340. package/_standalone/.next/static/chunks/app/api/skills/route-2f4705aa66819b86.js +0 -1
  341. package/_standalone/.next/static/chunks/app/api/sync/route-2f4705aa66819b86.js +0 -1
  342. package/_standalone/.next/static/chunks/app/api/tree-version/route-2f4705aa66819b86.js +0 -1
  343. package/_standalone/.next/static/chunks/app/api/uninstall/route-2f4705aa66819b86.js +0 -1
  344. package/_standalone/.next/static/chunks/app/api/update/route-2f4705aa66819b86.js +0 -1
  345. package/_standalone/.next/static/chunks/app/api/update-check/route-2f4705aa66819b86.js +0 -1
  346. package/_standalone/.next/static/chunks/app/api/update-status/route-2f4705aa66819b86.js +0 -1
  347. package/_standalone/.next/static/chunks/app/api/workflows/route-2f4705aa66819b86.js +0 -1
  348. package/_standalone/.next/static/chunks/app/changes/page-6d2f49651c0061f7.js +0 -1
  349. package/_standalone/.next/static/chunks/app/echo/page-2f4705aa66819b86.js +0 -1
  350. package/_standalone/.next/static/chunks/app/loading-2f4705aa66819b86.js +0 -1
  351. package/_standalone/.next/static/chunks/app/trash/page-f92b728b78ac0f7e.js +0 -1
  352. package/_standalone/.next/static/chunks/app/view/[...path]/loading-2f4705aa66819b86.js +0 -1
  353. package/_standalone/.next/static/chunks/app/wiki/page-641edb1f3cff2f93.js +0 -1
  354. package/_standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-2f4705aa66819b86.js +0 -1
  355. package/_standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-2f4705aa66819b86.js +0 -1
  356. package/_standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-2f4705aa66819b86.js +0 -1
  357. package/_standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-2f4705aa66819b86.js +0 -1
  358. package/_standalone/.next/static/css/6c104b118d3bc9b7.css +0 -1
  359. package/_standalone/.next/static/u8p6oIRTcr_ns-ElNZ9rl/_buildManifest.js +0 -1
  360. /package/_standalone/.next/static/{u8p6oIRTcr_ns-ElNZ9rl → 5GmVArEG8OX03azKICsGq}/_ssgManifest.js +0 -0
@@ -27,7 +27,7 @@ Execute concisely. Provide:
27
27
  2. Any decisions made
28
28
  3. What the next step should watch out for
29
29
 
30
- Be specific and actionable. Format in Markdown.`}(a,b,g)}],currentFile:c};h&&(i.selectedAcpAgent=h);let j=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:e});if(!j.ok)throw Error(`Request failed (HTTP ${j.status})`);if(!j.body)throw Error("No response body");let k=j.body.getReader(),l=new TextDecoder,m="";for(;;){let{done:a,value:b}=await k.read();if(a)break;for(let a of l.decode(b,{stream:!0}).split("\n")){let b=a.match(/^data:(.+)$/);if(b){try{let a=JSON.parse(b[1]);if("text_delta"===a.type&&"string"==typeof a.delta)m+=a.delta,d(m);else if("thinking_delta"===a.type&&"string"==typeof a.delta)m+=a.delta,d(m);else if("error"===a.type&&a.message)throw Error(a.message)}catch{let b=a.match(/^0:"((?:[^"\\]|\\.)*)"$/);b&&d(m+=b[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"))}continue}let c=a.match(/^0:"((?:[^"\\]|\\.)*)"$/);c&&d(m+=c[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"))}}}function R(a){return a.steps.map((a,b)=>({...a,index:b,status:"pending",output:"",error:void 0}))}function S({status:a,index:b}){let c="w-[26px] h-[26px] rounded-full flex items-center justify-center shrink-0 transition-all";return"running"===a?(0,d.jsx)("div",{className:`${c} bg-[var(--amber)]/15 ring-2 ring-[var(--amber)]/30`,children:(0,d.jsx)(m.A,{size:12,className:"text-[var(--amber)] animate-spin"})}):"done"===a?(0,d.jsx)("div",{className:`${c} bg-[var(--success)]/15`,children:(0,d.jsx)(o.A,{size:13,className:"text-[var(--success)]"})}):"error"===a?(0,d.jsx)("div",{className:`${c} bg-[var(--error)]/15`,children:(0,d.jsx)(i.A,{size:13,className:"text-[var(--error)]"})}):"skipped"===a?(0,d.jsx)("div",{className:`${c} bg-muted/50`,children:(0,d.jsx)(I.A,{size:11,className:"text-muted-foreground/40"})}):(0,d.jsx)("div",{className:`${c} border-2 border-border bg-background`,children:(0,d.jsx)("span",{className:"text-[11px] font-bold text-muted-foreground/50",children:b+1})})}function T({step:a,canRun:b,onRun:c,onSkip:f,onCancel:h}){let[j,k]=(0,e.useState)(!1),l=!!(a.output||a.error),m=a.skills?.length?a.skills:a.skill?[a.skill]:[];return"running"===a.status||a.status,(0,d.jsx)("div",{className:`transition-opacity ${"skipped"===a.status?"opacity-50":""}`,children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(S,{status:a.status,index:a.index}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 pt-0.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 justify-between",children:[(0,d.jsx)("span",{className:`text-sm font-medium truncate ${"done"===a.status?"text-foreground":"running"===a.status?"text-[var(--amber)]":"error"===a.status?"text-[var(--error)]":"text-foreground/70"}`,children:a.name}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[null!=a.durationMs&&("done"===a.status||"error"===a.status)&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 font-mono",children:function(a){if(a<1e3)return`${a}ms`;let b=Math.round(a/1e3);return b<60?`${b}s`:`${Math.floor(b/60)}m ${b%60}s`}(a.durationMs)}),"pending"===a.status&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:c,disabled:!b,className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-2xs font-medium transition-all disabled:opacity-30 bg-[var(--amber)] text-[var(--amber-foreground)]",children:[(0,d.jsx)(g.A,{size:9})," Run"]}),(0,d.jsx)("button",{onClick:f,className:"px-1.5 py-0.5 rounded-md text-2xs text-muted-foreground/50 hover:text-muted-foreground hover:bg-muted transition-colors",children:"Skip"})]}),"running"===a.status&&(0,d.jsxs)("button",{onClick:h,className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-2xs text-[var(--error)]/70 hover:text-[var(--error)] hover:bg-[var(--error)]/10 transition-colors",children:[(0,d.jsx)(J.A,{size:9})," Stop"]}),l&&"running"!==a.status&&(0,d.jsx)("button",{onClick:()=>k(a=>!a),className:"p-0.5 rounded text-muted-foreground/30 hover:text-muted-foreground transition-colors",children:(0,d.jsx)(p.A,{size:12,className:`transition-transform ${j?"rotate-180":""}`})})]})]}),(a.agent||m.length>0)&&(0,d.jsxs)("div",{className:"flex gap-1 mt-0.5 flex-wrap",children:[a.agent&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/50",children:a.agent}),a.agent&&m.length>0&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/20",children:"/"}),m.map(a=>(0,d.jsx)("span",{className:"text-2xs text-[var(--amber)]/60",children:a},a))]}),(j||"running"===a.status)&&l&&(0,d.jsxs)("div",{className:"mt-2 rounded-lg overflow-hidden border border-border/50",children:[a.error&&(0,d.jsxs)("div",{className:"px-3 py-2.5 bg-[var(--error)]/5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,d.jsx)(i.A,{size:10,className:"text-[var(--error)]"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-[var(--error)]",children:"Error"})]}),(0,d.jsx)("div",{className:"text-xs text-[var(--error)]/80 whitespace-pre-wrap break-words leading-relaxed",children:a.error})]}),a.output&&(0,d.jsxs)("div",{className:"px-3 py-2.5 bg-muted/20",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5",children:[(0,d.jsx)(K.A,{size:10,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/50 uppercase tracking-wider font-medium",children:"Output"}),"running"===a.status&&(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--amber)] animate-pulse"})]}),(0,d.jsx)("div",{className:"text-xs leading-relaxed text-foreground/80 whitespace-pre-wrap break-words",children:a.output})]})]})]})]})})}function U({workflow:a,filePath:b}){let[c,f]=(0,e.useState)(()=>R(a)),[g,h]=(0,e.useState)(!1),j=(0,e.useRef)(null),l=(0,e.useCallback)(()=>{j.current?.abort(),j.current=null,h(!1),f(a=>a.map(a=>"running"===a.status?{...a,status:"error",error:"Cancelled"}:a))},[]),n=(0,e.useCallback)(async c=>{if(g)return;j.current?.abort();let d=new AbortController;j.current=d,h(!0);let e=Date.now();f(a=>a.map((a,b)=>b===c?{...a,status:"running",output:"",error:void 0,startedAt:new Date}:a));try{let g={...a.steps[c],index:c,status:"running",output:""};await Q(g,a,b,a=>f(b=>b.map((b,d)=>d===c?{...b,output:a}:b)),d.signal);let h=Date.now()-e;f(a=>a.map((a,b)=>b===c?{...a,status:"done",completedAt:new Date,durationMs:h}:a))}catch(b){if(b instanceof Error&&"AbortError"===b.name)return;let a=Date.now()-e;f(d=>d.map((d,e)=>e===c?{...d,status:"error",error:b instanceof Error?b.message:String(b),durationMs:a}:d))}finally{h(!1)}},[g,a,b]),p=(0,e.useCallback)(a=>{f(b=>b.map((b,c)=>c===a?{...b,status:"skipped"}:b))},[]),q=(0,e.useCallback)(()=>{j.current?.abort(),j.current=null,h(!1),N.clear(),f(R(a))},[a]),r=c.filter(a=>"done"===a.status).length,s=c.length>0?Math.round(r/c.length*100):0,t=r===c.length&&c.length>0,u=c.findIndex(a=>"pending"===a.status),v=c.some(a=>"error"===a.status);return(0,d.jsxs)("div",{children:[(a.workDir||a.description)&&(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4 text-xs text-muted-foreground flex-wrap",children:[a.workDir&&(0,d.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-2xs bg-muted/50 px-2 py-0.5 rounded",children:[(0,d.jsx)(k.A,{size:10,className:"shrink-0"}),a.workDir]}),a.description&&(0,d.jsx)("span",{className:"leading-relaxed",children:a.description})]}),(0,d.jsxs)("div",{className:"mb-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("div",{className:"flex items-center gap-2",children:t?(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-[var(--success)]",children:[(0,d.jsx)(o.A,{size:13}),"Complete"]}):v?(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-[var(--error)]",children:[(0,d.jsx)(i.A,{size:13}),r,"/",c.length," done"]}):(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r,"/",c.length]})}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[u>=0&&(0,d.jsxs)("button",{onClick:()=>n(u),disabled:g,className:"flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all disabled:opacity-40 bg-[var(--amber)] text-[var(--amber-foreground)]",children:[g?(0,d.jsx)(m.A,{size:11,className:"animate-spin"}):(0,d.jsx)(L.A,{size:11}),g?"Running...":"Run next"]}),(0,d.jsxs)("button",{onClick:q,className:"flex items-center gap-1 px-2 py-1 rounded-md text-2xs text-muted-foreground/50 hover:text-muted-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(M.A,{size:10}),"Reset"]})]})]}),(0,d.jsx)("div",{className:"h-1 rounded-full bg-border/50 overflow-hidden",children:(0,d.jsx)("div",{className:`h-full rounded-full transition-all duration-500 ease-out ${t?"bg-[var(--success)]":v?"bg-[var(--error)]":"bg-[var(--amber)]"}`,style:{width:`${s}%`}})})]}),(0,d.jsxs)("div",{className:"relative",children:[c.length>1&&(0,d.jsx)("div",{className:"absolute left-[12px] top-5 bottom-5 w-px bg-border/50"}),(0,d.jsx)("div",{className:"flex flex-col gap-4",children:c.map((a,b)=>(0,d.jsx)(T,{step:a,canRun:!g,onRun:()=>n(b),onSkip:()=>p(b),onCancel:l},a.id))})]})]})}function V({filePath:a,content:b}){let c=(0,e.useMemo)(()=>(function(a){try{let b=j.Ay.load(a,{schema:j.Ay.JSON_SCHEMA});if(!b)return{workflow:null,errors:["File is empty"]};if("object"!=typeof b)return{workflow:null,errors:["Content is not valid YAML"]};let c=function(a){let b=[];if(!a||"object"!=typeof a)return{valid:!1,errors:["Must be a valid YAML object"]};if(a.title&&"string"==typeof a.title&&a.title.trim()||b.push("Missing required field 'title' (string)"),void 0!==a.description&&"string"!=typeof a.description&&b.push("'description' must be a string"),void 0!==a.skills&&(Array.isArray(a.skills)?a.skills.every(a=>"string"==typeof a)||b.push("'skills' must contain only strings"):b.push("'skills' must be an array of strings")),void 0!==a.tools&&(Array.isArray(a.tools)?a.tools.every(a=>"string"==typeof a)||b.push("'tools' must contain only strings"):b.push("'tools' must be an array of strings")),a.steps)if(Array.isArray(a.steps))if(0===a.steps.length)b.push("'steps' must have at least 1 step");else{let c=new Set;a.steps.forEach((a,d)=>{var e,f;let g,h,i=(e=a,f=d,g=[],h=`steps[${f}]`,e&&"object"==typeof e?(e.id&&"string"==typeof e.id&&e.id.trim()?/^[a-z0-9_-]+$/.test(e.id)||g.push(`${h}.id: '${e.id}' is invalid — use only lowercase letters, numbers, hyphens, underscores (e.g., 'run-tests')`):g.push(`${h}: missing required field 'id' (non-empty string)`),e.name&&"string"==typeof e.name&&e.name.trim()||g.push(`${h}: missing required field 'name' (non-empty string)`),void 0!==e.description&&"string"!=typeof e.description&&g.push(`${h}.description: must be a string`),void 0===e.agent||"string"==typeof e.agent&&e.agent.trim()||g.push(`${h}.agent: must be a non-empty string`),void 0===e.skill||"string"==typeof e.skill&&e.skill.trim()||g.push(`${h}.skill: must be a non-empty string`),void 0!==e.tools&&(Array.isArray(e.tools)?e.tools.every(a=>"string"==typeof a)||g.push(`${h}.tools: must contain only strings`):g.push(`${h}.tools: must be an array of strings`)),e.prompt&&"string"==typeof e.prompt&&e.prompt.trim()||g.push(`${h}: missing required field 'prompt' (non-empty string)`),void 0!==e.timeout&&("number"!=typeof e.timeout||e.timeout<=0)&&g.push(`${h}.timeout: must be a positive number (seconds)`)):g.push(`${h}: must be a valid object`),g);b.push(...i);let j=a?.id;"string"==typeof j&&j.trim()&&(c.has(j)&&b.push(`steps[${d}].id: duplicate id '${j}' (each step must have a unique id)`),c.add(j))})}else b.push("'steps' must be an array");else b.push("Missing required field 'steps' (array)");return{valid:0===b.length,errors:b}}(b);if(!c.valid)return{workflow:null,errors:c.errors};return{workflow:b,errors:[]}}catch(a){return{workflow:null,errors:[a instanceof Error?a.message:String(a)]}}})(b),[b]),[k,l]=(0,e.useState)("edit"),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(()=>c.workflow?structuredClone(c.workflow):{title:"",description:"",steps:[]});(0,e.useRef)(b);let q=(0,e.useMemo)(()=>c.workflow??null,[c.workflow]),r=(0,e.useCallback)(a=>{p(a),n(!0)},[]),s=(0,e.useCallback)(()=>n(!1),[]),t=q??o,u=t.steps.length>0&&!!t.title,v=c.errors.length>0,w=t.title?0===t.steps.length?"Add at least one step":m?"Save changes first":void 0:"Add a title first",x=a=>{("run"!==a||u)&&l(a)};return(0,d.jsxs)("div",{className:"max-w-[720px] mx-auto py-8 px-2",children:[(0,d.jsxs)("div",{className:"mb-8",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 p-0.5 rounded-lg bg-muted/50",children:[(0,d.jsxs)("button",{onClick:()=>x("edit"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${"edit"===k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)(f.A,{size:11}),"Edit"]}),(0,d.jsxs)("button",{onClick:()=>x("run"),disabled:!u,title:w,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all disabled:opacity-30 disabled:cursor-not-allowed ${"run"===k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)(g.A,{size:11}),"Run"]})]}),o.steps.length>0&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/60 font-mono",children:[o.steps.length," step",1!==o.steps.length?"s":""]})]}),(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"mt-1 w-8 h-8 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:(0,d.jsx)(h.A,{size:16,className:"text-[var(--amber)]"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("h1",{className:"text-lg font-semibold text-foreground truncate leading-tight",children:[o.title||"Untitled Flow",m&&(0,d.jsx)("span",{className:"text-[var(--amber)] ml-1.5 text-sm",title:"Unsaved changes",children:"*"})]}),o.description&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:o.description})]})]})]}),v&&"edit"===k&&(0,d.jsxs)("div",{className:"mb-5 px-3.5 py-3 rounded-lg bg-[var(--error)]/8 border border-[var(--error)]/20",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,d.jsx)(i.A,{size:13,className:"text-[var(--error)] shrink-0"}),(0,d.jsx)("span",{className:"text-xs font-medium text-[var(--error)]",children:"Parse issues found"})]}),(0,d.jsx)("ul",{className:"text-2xs text-[var(--error)]/70 pl-5 list-disc space-y-0.5",children:c.errors.slice(0,3).map((a,b)=>(0,d.jsx)("li",{children:a},b))})]}),"edit"===k?(0,d.jsx)(H,{workflow:o,filePath:a,onChange:r,onSaved:s}):(0,d.jsx)(U,{workflow:t,filePath:a})]})}},2887:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(41023),g=c(46674),h=c(40560),i=c(8455),j=c(49681),k=c(47223);function l({open:a,onClose:b,onDiscover:c,discovering:l,error:m}){let{t:n}=(0,k.Y)(),o=n.panels.agents,[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(null);if(!a)return null;let t=async()=>{if(!p.trim()||l)return;s(null);let a=await c(p.trim());a&&s(a)},u=()=>{q(""),s(null),b()};return(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:u,children:(0,d.jsxs)("div",{className:"bg-popover border border-border rounded-xl shadow-lg w-full max-w-md mx-4 p-5",onClick:a=>a.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o.a2aDiscover,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,d.jsx)(f.A,{size:15,className:"text-muted-foreground"}),o.a2aDiscover]}),(0,d.jsx)("button",{type:"button",onClick:u,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,d.jsx)(g.A,{size:14})})]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground mb-3",children:o.a2aDiscoverHint}),(0,d.jsxs)("div",{className:"flex gap-2 mb-4",children:[(0,d.jsx)("input",{type:"url",value:p,onChange:a=>q(a.target.value),onKeyDown:a=>{"Enter"===a.key&&t(),"Escape"===a.key&&b()},placeholder:o.a2aDiscoverPlaceholder,disabled:l,className:"flex-1 px-3 py-2 text-xs rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",autoFocus:!0}),(0,d.jsxs)("button",{type:"button",onClick:t,disabled:l||!p.trim(),className:"px-3 py-2 text-xs font-medium rounded-lg bg-foreground text-background hover:bg-foreground/90 disabled:opacity-50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring flex items-center gap-1.5 shrink-0",children:[l&&(0,d.jsx)(h.A,{size:12,className:"animate-spin"}),l?o.a2aDiscovering:o.a2aDiscover]})]}),m&&!r&&(0,d.jsx)("div",{className:"rounded-lg border border-error/30 bg-error/5 px-3 py-2.5 mb-3",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(i.A,{size:14,className:"text-error mt-0.5 shrink-0"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-medium text-error",children:o.a2aDiscoverFailed}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground mt-0.5",children:o.a2aDiscoverFailedHint})]})]})}),r&&(0,d.jsx)("div",{className:"rounded-lg border border-success/30 bg-success/5 px-3 py-2.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(j.A,{size:14,className:"text-success mt-0.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-success mb-1.5",children:o.a2aDiscoverSuccess}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsxs)("p",{className:"text-xs font-medium text-foreground truncate",title:r.card.name,children:[r.card.name,(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground ml-1.5",children:["v",r.card.version]})]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground truncate",title:r.card.description,children:r.card.description}),r.card.skills.length>0&&(0,d.jsxs)("div",{className:"mt-1.5",children:[(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground mb-1",children:[o.a2aSkills,":"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1",children:r.card.skills.map(a=>(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-muted/80 text-muted-foreground border border-border/50",title:a.description,children:a.name},a.id))})]}),(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground mt-1 truncate",title:r.endpoint,children:[o.a2aEndpoint,": ",r.endpoint]})]})]})]})})]})})}},2923:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(48249),e=c(6079),f=c(47223);function g({onToggle:a,askPanelOpen:b}){let{t:c}=(0,f.Y)(),g=`${c.ask?.fabLabel??"Ask AI"} (⌘/)`;return(0,d.jsxs)("button",{onClick:a,className:`
30
+ Be specific and actionable. Format in Markdown.`}(a,b,g)}],currentFile:c};h&&(i.selectedAcpAgent=h);let j=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:e});if(!j.ok)throw Error(`Request failed (HTTP ${j.status})`);if(!j.body)throw Error("No response body");let k=j.body.getReader(),l=new TextDecoder,m="";for(;;){let{done:a,value:b}=await k.read();if(a)break;for(let a of l.decode(b,{stream:!0}).split("\n")){let b=a.match(/^data:(.+)$/);if(b){try{let a=JSON.parse(b[1]);if("text_delta"===a.type&&"string"==typeof a.delta)m+=a.delta,d(m);else if("thinking_delta"===a.type&&"string"==typeof a.delta)m+=a.delta,d(m);else if("error"===a.type&&a.message)throw Error(a.message)}catch{let b=a.match(/^0:"((?:[^"\\]|\\.)*)"$/);b&&d(m+=b[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"))}continue}let c=a.match(/^0:"((?:[^"\\]|\\.)*)"$/);c&&d(m+=c[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"))}}}function R(a){return a.steps.map((a,b)=>({...a,index:b,status:"pending",output:"",error:void 0}))}function S({status:a,index:b}){let c="w-[26px] h-[26px] rounded-full flex items-center justify-center shrink-0 transition-all";return"running"===a?(0,d.jsx)("div",{className:`${c} bg-[var(--amber)]/15 ring-2 ring-[var(--amber)]/30`,children:(0,d.jsx)(m.A,{size:12,className:"text-[var(--amber)] animate-spin"})}):"done"===a?(0,d.jsx)("div",{className:`${c} bg-[var(--success)]/15`,children:(0,d.jsx)(o.A,{size:13,className:"text-[var(--success)]"})}):"error"===a?(0,d.jsx)("div",{className:`${c} bg-[var(--error)]/15`,children:(0,d.jsx)(i.A,{size:13,className:"text-[var(--error)]"})}):"skipped"===a?(0,d.jsx)("div",{className:`${c} bg-muted/50`,children:(0,d.jsx)(I.A,{size:11,className:"text-muted-foreground/40"})}):(0,d.jsx)("div",{className:`${c} border-2 border-border bg-background`,children:(0,d.jsx)("span",{className:"text-[11px] font-bold text-muted-foreground/50",children:b+1})})}function T({step:a,canRun:b,onRun:c,onSkip:f,onCancel:h}){let[j,k]=(0,e.useState)(!1),l=!!(a.output||a.error),m=a.skills?.length?a.skills:a.skill?[a.skill]:[];return"running"===a.status||a.status,(0,d.jsx)("div",{className:`transition-opacity ${"skipped"===a.status?"opacity-50":""}`,children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(S,{status:a.status,index:a.index}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 pt-0.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 justify-between",children:[(0,d.jsx)("span",{className:`text-sm font-medium truncate ${"done"===a.status?"text-foreground":"running"===a.status?"text-[var(--amber)]":"error"===a.status?"text-[var(--error)]":"text-foreground/70"}`,children:a.name}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[null!=a.durationMs&&("done"===a.status||"error"===a.status)&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 font-mono",children:function(a){if(a<1e3)return`${a}ms`;let b=Math.round(a/1e3);return b<60?`${b}s`:`${Math.floor(b/60)}m ${b%60}s`}(a.durationMs)}),"pending"===a.status&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:c,disabled:!b,className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-2xs font-medium transition-all disabled:opacity-30 bg-[var(--amber)] text-[var(--amber-foreground)]",children:[(0,d.jsx)(g.A,{size:9})," Run"]}),(0,d.jsx)("button",{onClick:f,className:"px-1.5 py-0.5 rounded-md text-2xs text-muted-foreground/50 hover:text-muted-foreground hover:bg-muted transition-colors",children:"Skip"})]}),"running"===a.status&&(0,d.jsxs)("button",{onClick:h,className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-2xs text-[var(--error)]/70 hover:text-[var(--error)] hover:bg-[var(--error)]/10 transition-colors",children:[(0,d.jsx)(J.A,{size:9})," Stop"]}),l&&"running"!==a.status&&(0,d.jsx)("button",{onClick:()=>k(a=>!a),className:"p-0.5 rounded text-muted-foreground/30 hover:text-muted-foreground transition-colors",children:(0,d.jsx)(p.A,{size:12,className:`transition-transform ${j?"rotate-180":""}`})})]})]}),(a.agent||m.length>0)&&(0,d.jsxs)("div",{className:"flex gap-1 mt-0.5 flex-wrap",children:[a.agent&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/50",children:a.agent}),a.agent&&m.length>0&&(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/20",children:"/"}),m.map(a=>(0,d.jsx)("span",{className:"text-2xs text-[var(--amber)]/60",children:a},a))]}),(j||"running"===a.status)&&l&&(0,d.jsxs)("div",{className:"mt-2 rounded-lg overflow-hidden border border-border/50",children:[a.error&&(0,d.jsxs)("div",{className:"px-3 py-2.5 bg-[var(--error)]/5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,d.jsx)(i.A,{size:10,className:"text-[var(--error)]"}),(0,d.jsx)("span",{className:"text-2xs font-medium text-[var(--error)]",children:"Error"})]}),(0,d.jsx)("div",{className:"text-xs text-[var(--error)]/80 whitespace-pre-wrap break-words leading-relaxed",children:a.error})]}),a.output&&(0,d.jsxs)("div",{className:"px-3 py-2.5 bg-muted/20",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5",children:[(0,d.jsx)(K.A,{size:10,className:"text-[var(--amber)]"}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/50 uppercase tracking-wider font-medium",children:"Output"}),"running"===a.status&&(0,d.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--amber)] animate-pulse"})]}),(0,d.jsx)("div",{className:"text-xs leading-relaxed text-foreground/80 whitespace-pre-wrap break-words",children:a.output})]})]})]})]})})}function U({workflow:a,filePath:b}){let[c,f]=(0,e.useState)(()=>R(a)),[g,h]=(0,e.useState)(!1),j=(0,e.useRef)(null),l=(0,e.useCallback)(()=>{j.current?.abort(),j.current=null,h(!1),f(a=>a.map(a=>"running"===a.status?{...a,status:"error",error:"Cancelled"}:a))},[]),n=(0,e.useCallback)(async c=>{if(g)return;j.current?.abort();let d=new AbortController;j.current=d,h(!0);let e=Date.now();f(a=>a.map((a,b)=>b===c?{...a,status:"running",output:"",error:void 0,startedAt:new Date}:a));try{let g={...a.steps[c],index:c,status:"running",output:""};await Q(g,a,b,a=>f(b=>b.map((b,d)=>d===c?{...b,output:a}:b)),d.signal);let h=Date.now()-e;f(a=>a.map((a,b)=>b===c?{...a,status:"done",completedAt:new Date,durationMs:h}:a))}catch(b){if(b instanceof Error&&"AbortError"===b.name)return;let a=Date.now()-e;f(d=>d.map((d,e)=>e===c?{...d,status:"error",error:b instanceof Error?b.message:String(b),durationMs:a}:d))}finally{h(!1)}},[g,a,b]),p=(0,e.useCallback)(a=>{f(b=>b.map((b,c)=>c===a?{...b,status:"skipped"}:b))},[]),q=(0,e.useCallback)(()=>{j.current?.abort(),j.current=null,h(!1),N.clear(),f(R(a))},[a]),r=c.filter(a=>"done"===a.status).length,s=c.length>0?Math.round(r/c.length*100):0,t=r===c.length&&c.length>0,u=c.findIndex(a=>"pending"===a.status),v=c.some(a=>"error"===a.status);return(0,d.jsxs)("div",{children:[(a.workDir||a.description)&&(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4 text-xs text-muted-foreground flex-wrap",children:[a.workDir&&(0,d.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-2xs bg-muted/50 px-2 py-0.5 rounded",children:[(0,d.jsx)(k.A,{size:10,className:"shrink-0"}),a.workDir]}),a.description&&(0,d.jsx)("span",{className:"leading-relaxed",children:a.description})]}),(0,d.jsxs)("div",{className:"mb-6",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("div",{className:"flex items-center gap-2",children:t?(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-[var(--success)]",children:[(0,d.jsx)(o.A,{size:13}),"Complete"]}):v?(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-[var(--error)]",children:[(0,d.jsx)(i.A,{size:13}),r,"/",c.length," done"]}):(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r,"/",c.length]})}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[u>=0&&(0,d.jsxs)("button",{onClick:()=>n(u),disabled:g,className:"flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all disabled:opacity-40 bg-[var(--amber)] text-[var(--amber-foreground)]",children:[g?(0,d.jsx)(m.A,{size:11,className:"animate-spin"}):(0,d.jsx)(L.A,{size:11}),g?"Running...":"Run next"]}),(0,d.jsxs)("button",{onClick:q,className:"flex items-center gap-1 px-2 py-1 rounded-md text-2xs text-muted-foreground/50 hover:text-muted-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(M.A,{size:10}),"Reset"]})]})]}),(0,d.jsx)("div",{className:"h-1 rounded-full bg-border/50 overflow-hidden",children:(0,d.jsx)("div",{className:`h-full rounded-full transition-all duration-500 ease-out ${t?"bg-[var(--success)]":v?"bg-[var(--error)]":"bg-[var(--amber)]"}`,style:{width:`${s}%`}})})]}),(0,d.jsxs)("div",{className:"relative",children:[c.length>1&&(0,d.jsx)("div",{className:"absolute left-[12px] top-5 bottom-5 w-px bg-border/50"}),(0,d.jsx)("div",{className:"flex flex-col gap-4",children:c.map((a,b)=>(0,d.jsx)(T,{step:a,canRun:!g,onRun:()=>n(b),onSkip:()=>p(b),onCancel:l},a.id))})]})]})}function V({filePath:a,content:b}){let c=(0,e.useMemo)(()=>(function(a){try{let b=j.Ay.load(a,{schema:j.Ay.JSON_SCHEMA});if(!b)return{workflow:null,errors:["File is empty"]};if("object"!=typeof b)return{workflow:null,errors:["Content is not valid YAML"]};let c=function(a){let b=[];if(!a||"object"!=typeof a)return{valid:!1,errors:["Must be a valid YAML object"]};if(a.title&&"string"==typeof a.title&&a.title.trim()||b.push("Missing required field 'title' (string)"),void 0!==a.description&&"string"!=typeof a.description&&b.push("'description' must be a string"),void 0!==a.skills&&(Array.isArray(a.skills)?a.skills.every(a=>"string"==typeof a)||b.push("'skills' must contain only strings"):b.push("'skills' must be an array of strings")),void 0!==a.tools&&(Array.isArray(a.tools)?a.tools.every(a=>"string"==typeof a)||b.push("'tools' must contain only strings"):b.push("'tools' must be an array of strings")),a.steps)if(Array.isArray(a.steps))if(0===a.steps.length)b.push("'steps' must have at least 1 step");else{let c=new Set;a.steps.forEach((a,d)=>{var e,f;let g,h,i=(e=a,f=d,g=[],h=`steps[${f}]`,e&&"object"==typeof e?(e.id&&"string"==typeof e.id&&e.id.trim()?/^[a-z0-9_-]+$/.test(e.id)||g.push(`${h}.id: '${e.id}' is invalid — use only lowercase letters, numbers, hyphens, underscores (e.g., 'run-tests')`):g.push(`${h}: missing required field 'id' (non-empty string)`),e.name&&"string"==typeof e.name&&e.name.trim()||g.push(`${h}: missing required field 'name' (non-empty string)`),void 0!==e.description&&"string"!=typeof e.description&&g.push(`${h}.description: must be a string`),void 0===e.agent||"string"==typeof e.agent&&e.agent.trim()||g.push(`${h}.agent: must be a non-empty string`),void 0===e.skill||"string"==typeof e.skill&&e.skill.trim()||g.push(`${h}.skill: must be a non-empty string`),void 0!==e.tools&&(Array.isArray(e.tools)?e.tools.every(a=>"string"==typeof a)||g.push(`${h}.tools: must contain only strings`):g.push(`${h}.tools: must be an array of strings`)),e.prompt&&"string"==typeof e.prompt&&e.prompt.trim()||g.push(`${h}: missing required field 'prompt' (non-empty string)`),void 0!==e.timeout&&("number"!=typeof e.timeout||e.timeout<=0)&&g.push(`${h}.timeout: must be a positive number (seconds)`)):g.push(`${h}: must be a valid object`),g);b.push(...i);let j=a?.id;"string"==typeof j&&j.trim()&&(c.has(j)&&b.push(`steps[${d}].id: duplicate id '${j}' (each step must have a unique id)`),c.add(j))})}else b.push("'steps' must be an array");else b.push("Missing required field 'steps' (array)");return{valid:0===b.length,errors:b}}(b);if(!c.valid)return{workflow:null,errors:c.errors};return{workflow:b,errors:[]}}catch(a){return{workflow:null,errors:[a instanceof Error?a.message:String(a)]}}})(b),[b]),[k,l]=(0,e.useState)("edit"),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(()=>c.workflow?structuredClone(c.workflow):{title:"",description:"",steps:[]});(0,e.useRef)(b);let q=(0,e.useMemo)(()=>c.workflow??null,[c.workflow]),r=(0,e.useCallback)(a=>{p(a),n(!0)},[]),s=(0,e.useCallback)(()=>n(!1),[]),t=q??o,u=t.steps.length>0&&!!t.title,v=c.errors.length>0,w=t.title?0===t.steps.length?"Add at least one step":m?"Save changes first":void 0:"Add a title first",x=a=>{("run"!==a||u)&&l(a)};return(0,d.jsxs)("div",{className:"max-w-[720px] mx-auto py-8 px-2",children:[(0,d.jsxs)("div",{className:"mb-8",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 p-0.5 rounded-lg bg-muted/50",children:[(0,d.jsxs)("button",{onClick:()=>x("edit"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${"edit"===k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)(f.A,{size:11}),"Edit"]}),(0,d.jsxs)("button",{onClick:()=>x("run"),disabled:!u,title:w,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all disabled:opacity-30 disabled:cursor-not-allowed ${"run"===k?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)(g.A,{size:11}),"Run"]})]}),o.steps.length>0&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/60 font-mono",children:[o.steps.length," step",1!==o.steps.length?"s":""]})]}),(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"mt-1 w-8 h-8 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:(0,d.jsx)(h.A,{size:16,className:"text-[var(--amber)]"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("h1",{className:"text-lg font-semibold text-foreground truncate leading-tight",children:[o.title||"Untitled Flow",m&&(0,d.jsx)("span",{className:"text-[var(--amber)] ml-1.5 text-sm",title:"Unsaved changes",children:"*"})]}),o.description&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:o.description})]})]})]}),v&&"edit"===k&&(0,d.jsxs)("div",{className:"mb-5 px-3.5 py-3 rounded-lg bg-[var(--error)]/8 border border-[var(--error)]/20",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,d.jsx)(i.A,{size:13,className:"text-[var(--error)] shrink-0"}),(0,d.jsx)("span",{className:"text-xs font-medium text-[var(--error)]",children:"Parse issues found"})]}),(0,d.jsx)("ul",{className:"text-2xs text-[var(--error)]/70 pl-5 list-disc space-y-0.5",children:c.errors.slice(0,3).map((a,b)=>(0,d.jsx)("li",{children:a},b))})]}),"edit"===k?(0,d.jsx)(H,{workflow:o,filePath:a,onChange:r,onSaved:s}):(0,d.jsx)(U,{workflow:t,filePath:a})]})}},2887:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(41023),g=c(46674),h=c(40560),i=c(8455),j=c(49681),k=c(47223);function l({open:a,onClose:b,onDiscover:c,discovering:l,error:m}){let{t:n}=(0,k.Y)(),o=n.panels.agents,[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(null);if(!a)return null;let t=async()=>{if(!p.trim()||l)return;s(null);let a=await c(p.trim());a&&s(a)},u=()=>{q(""),s(null),b()};return(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:u,children:(0,d.jsxs)("div",{className:"bg-popover border border-border rounded-xl shadow-lg w-full max-w-md mx-4 p-5",onClick:a=>a.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o.a2aDiscover,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,d.jsx)(f.A,{size:15,className:"text-muted-foreground"}),o.a2aDiscover]}),(0,d.jsx)("button",{type:"button",onClick:u,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,d.jsx)(g.A,{size:14})})]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground mb-3",children:o.a2aDiscoverHint}),(0,d.jsxs)("div",{className:"flex gap-2 mb-4",children:[(0,d.jsx)("input",{type:"url",value:p,onChange:a=>q(a.target.value),onKeyDown:a=>{"Enter"===a.key&&t(),"Escape"===a.key&&b()},placeholder:o.a2aDiscoverPlaceholder,disabled:l,className:"flex-1 px-3 py-2 text-xs rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",autoFocus:!0}),(0,d.jsxs)("button",{type:"button",onClick:t,disabled:l||!p.trim(),className:"px-3 py-2 text-xs font-medium rounded-lg bg-foreground text-background hover:bg-foreground/90 disabled:opacity-50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring flex items-center gap-1.5 shrink-0",children:[l&&(0,d.jsx)(h.A,{size:12,className:"animate-spin"}),l?o.a2aDiscovering:o.a2aDiscover]})]}),m&&!r&&(0,d.jsx)("div",{className:"rounded-lg border border-error/30 bg-error/5 px-3 py-2.5 mb-3",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(i.A,{size:14,className:"text-error mt-0.5 shrink-0"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-medium text-error",children:o.a2aDiscoverFailed}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground mt-0.5",children:o.a2aDiscoverFailedHint})]})]})}),r&&(0,d.jsx)("div",{className:"rounded-lg border border-success/30 bg-success/5 px-3 py-2.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(j.A,{size:14,className:"text-success mt-0.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-xs font-medium text-success mb-1.5",children:o.a2aDiscoverSuccess}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsxs)("p",{className:"text-xs font-medium text-foreground truncate",title:r.card.name,children:[r.card.name,(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground ml-1.5",children:["v",r.card.version]})]}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground truncate",title:r.card.description,children:r.card.description}),r.card.skills.length>0&&(0,d.jsxs)("div",{className:"mt-1.5",children:[(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground mb-1",children:[o.a2aSkills,":"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1",children:r.card.skills.map(a=>(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-muted/80 text-muted-foreground border border-border/50",title:a.description,children:a.name},a.id))})]}),(0,d.jsxs)("p",{className:"text-2xs text-muted-foreground mt-1 truncate",title:r.endpoint,children:[o.a2aEndpoint,": ",r.endpoint]})]})]})]})})]})})}},2923:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(6079),f=c(47223),g=c(19099);function h({onToggle:a,askPanelOpen:b}){let{t:c}=(0,f.Y)(),h=(0,g.usePathname)(),i=`${c.ask?.fabLabel??"Ask AI"} (⌘/)`;return(0,d.jsxs)("button",{onClick:a,className:`
31
31
  group hidden md:flex
32
32
  fixed z-40 bottom-5 right-5
33
33
  items-center justify-center
@@ -38,8 +38,8 @@ Be specific and actionable. Format in Markdown.`}(a,b,g)}],currentFile:c};h&&(i.
38
38
  transition-all duration-200 ease-out
39
39
  hover:shadow-lg hover:shadow-[var(--amber)]/20
40
40
  active:scale-95 cursor-pointer overflow-hidden
41
- ${b?"opacity-0 pointer-events-none translate-y-2":"opacity-100 translate-y-0"}
42
- `,style:{background:"var(--amber)"},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",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:`
41
+ ${b||"/"===h||""===h?"opacity-0 pointer-events-none translate-y-2":"opacity-100 translate-y-0"}
42
+ `,style:{background:"var(--amber)"},title:i,"aria-label":i,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",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
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(47223),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 e of m.jt){let f=m.T_[e],g=c[e]?.apiKey==="***set***",h=(0,m.Ux)(e),i=!!h&&!!d[h];if(g||i)b.push(e);else if(f.apiKeyFallback){let d=a.ai?.provider===e,f=c[e];(d||f&&(f.model||f.baseUrl))&&b.push(e)}}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
@@ -51,25 +51,25 @@ 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,onSpacesClick:z,syncStatus:A,expanded:B,onExpandedChange:C,onSettingsClick:D,onSyncClick:E}){let F=(0,e.useRef)(0),G=(0,e.useRef)(null),{t:H}=(0,r.Y)(),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(!1),O=(0,e.useCallback)(a=>{let b=Date.now();b-F.current<300||(F.current=b,a())},[]),P=(0,e.useCallback)(c=>{O(()=>b(a===c?null:c))},[a,b,O]),Q=(0,s.Bq)(A,!1),R=B?v:u,S="off"!==Q&&"synced"!==Q?(0,d.jsx)("span",{className:`absolute ${B?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full ${s.BG[Q]} ${"error"===Q||"conflicts"===Q?"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:`${R}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 ${B?"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"}),B&&(0,d.jsx)("span",{className:"text-sm text-foreground font-brand whitespace-nowrap",children:"MindOS"})]}),(0,d.jsx)("div",{className:`${B?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsxs)("div",{className:`flex flex-col ${B?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,d.jsx)(w,{icon:(0,d.jsx)(h.A,{size:18}),label:H.sidebar.files,active:"files"===a,expanded:B,onClick:()=>z?O(z):P("files"),walkthroughId:"files-panel"}),K&&(0,d.jsx)(w,{icon:(0,d.jsx)(i.A,{size:18}),label:H.sidebar.echo,active:"echo"===a,expanded:B,onClick:()=>c?O(c):P("echo"),walkthroughId:"echo-panel"}),(0,d.jsx)(w,{icon:(0,d.jsx)(j.A,{size:18}),label:H.sidebar.searchTitle,shortcut:"⌘K",active:"search"===a,expanded:B,onClick:()=>P("search")}),(0,d.jsx)(w,{icon:(0,d.jsx)(k.A,{size:18}),label:H.sidebar.agents,active:"agents"===a,expanded:B,onClick:()=>f?O(f):P("agents"),walkthroughId:"agents-panel"}),M&&(0,d.jsx)(w,{icon:(0,d.jsx)(l.A,{size:18}),label:H.sidebar.workflows??"Flows",active:"workflows"===a,expanded:B,onClick:()=>y?O(y):P("workflows")})]}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsx)("div",{className:`${B?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsx)("div",{className:`flex flex-col ${B?"px-1.5":"items-center"} gap-1 py-2`,children:(0,d.jsx)(w,{icon:(0,d.jsx)(m.A,{size:18}),label:H.sidebar.discover,active:"discover"===a,expanded:B,onClick:()=>x?O(x):P("discover")})}),(0,d.jsx)("div",{className:`${B?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsxs)("div",{className:`flex flex-col ${B?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,d.jsx)(w,{icon:(0,d.jsx)(n.A,{size:18}),label:H.sidebar.settingsTitle,shortcut:"⌘,",expanded:B,onClick:()=>O(D),badge:I?(0,d.jsx)("span",{className:`absolute ${B?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full bg-error`}):void 0}),A?.enabled&&A?.remote&&"(not configured)"!==A.remote&&(0,d.jsx)(w,{icon:(0,d.jsx)(o.A,{size:18}),label:H.sidebar.syncLabel,expanded:B,buttonRef:G,badge:S,onClick:()=>O(()=>{let a=G.current?.getBoundingClientRect();a&&E(a)})})]})]}),(0,d.jsx)("button",{onClick:()=>C(!B),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":B?"Collapse sidebar":"Expand sidebar",title:B?"Collapse":"Expand",children:B?(0,d.jsx)(p.A,{size:10}):(0,d.jsx)(q.A,{size:10})})]})}},4949:(a,b,c)=>{"use strict";c.d(b,{A:()=>x});var d=c(48249),e=c(67484),f=c(19099),g=c(97621),h=c(50567),i=c(22772),j=c(86588),k=c(40560),l=c(42742),m=c(6079),n=c(8455),o=c(45231),p=c(46674),q=c(47086),r=c(13481),s=c(44218),t=c(47223),u=c(33191),v=c(39624);function w(a,b){let c=a.fileImport;if(!b)return c.organizeProcessing;switch(b.stage){case"connecting":return c.organizeConnecting;case"analyzing":return c.organizeAnalyzing;case"reading":return c.organizeReading(b.detail);case"thinking":return c.organizeThinking;case"writing":return c.organizeWriting(b.detail);default:return c.organizeProcessing}}function x({aiOrganize:a,onDismiss:b,onCancel:c,onHistoryUpdate:x}){let{t:y}=(0,t.Y)(),z=(0,f.useRouter)(),A=y.fileImport,B="organizing"===a.phase,{elapsed:C,displayHint:D}=function(a,b){let[c,d]=(0,e.useState)(0),[f,g]=(0,e.useState)(!1);return(0,e.useRef)(Date.now()),{elapsed:c,displayHint:f?{stage:"thinking"}:b}}(0,a.stageHint),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(!1),K=(0,e.useRef)(null),L=(0,e.useRef)(null),M="done"===a.phase,N="error"===a.phase,O=B||M||N,P=a.changes.filter(a=>a.ok&&!a.undone).length,Q=(0,e.useCallback)(()=>{K.current&&clearTimeout(K.current),(M||N)&&(K.current=setTimeout(()=>{b()},18e4))},[M,N,b]),R=(0,e.useCallback)(()=>{Q()},[Q]),S=(0,e.useCallback)(async b=>{R(),J(!0);let c=await a.undoOne(b);J(!1),c&&(window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(()=>{if(L.current){let c=a.changes.map(a=>({action:a.action,path:a.path,ok:a.ok,undone:a.path===b||a.undone})),d=c.every(a=>!a.ok||a.undone);(0,v.W8)(L.current,{files:c,status:d?"undone":"partial"}),x?.()}},0))},[a,R,x]),T=(0,e.useCallback)(async()=>{R(),J(!0);let b=await a.undoAll();J(!1),b>0&&(window.dispatchEvent(new Event("mindos:files-changed")),L.current&&((0,v.W8)(L.current,{files:a.changes.map(a=>({action:a.action,path:a.path,ok:a.ok,undone:!!a.ok||a.undone})),status:"undone"}),x?.()))},[a,R,x]),U=(0,e.useCallback)(a=>{R(),z.push(`/view/${(0,u.O0)(a)}`)},[z,R]),V=(0,e.useCallback)(()=>{b()},[b]);if(!O)return null;function W(b,c){let e=b.undone,f=a.canUndo(b.path),k=b.path.split("/").pop()??b.path;return(0,d.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors ${e?"bg-muted/30 opacity-50":"bg-muted/50"}`,children:[e?(0,d.jsx)(g.A,{size:14,className:"text-muted-foreground shrink-0"}):"create"===b.action?(0,d.jsx)(h.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(i.A,{size:14,className:"text-[var(--amber)] shrink-0"}),(0,d.jsx)("span",{className:`truncate flex-1 ${e?"line-through text-muted-foreground":"text-foreground"}`,children:k}),e?(0,d.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:A.organizeUndone}):(0,d.jsx)("span",{className:`text-xs shrink-0 ${b.ok?"text-muted-foreground":"text-error"}`,children:b.ok?"create"===b.action?A.organizeCreated:A.organizeUpdated:A.organizeFailed}),f&&(0,d.jsx)("button",{type:"button",onClick:()=>S(b.path),disabled:I,className:"text-2xs text-muted-foreground/60 hover:text-foreground transition-colors shrink-0 px-1 disabled:opacity-40",title:A.organizeUndoOne,children:(0,d.jsx)(g.A,{size:12})}),b.ok&&!b.undone&&(0,d.jsx)("button",{type:"button",onClick:()=>U(b.path),className:"text-2xs text-muted-foreground/60 hover:text-[var(--amber)] transition-colors shrink-0 px-1",title:A.organizeViewFile,children:(0,d.jsx)(j.A,{size:12})})]},`${b.path}-${c}`)}function X(){return(0,d.jsxs)("div",{className:"flex items-center justify-end gap-3 px-4 py-3 border-t border-border",children:[M&&a.hasAnyUndoable&&(0,d.jsxs)("button",{onClick:T,disabled:I,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1.5 disabled:opacity-50",children:[I?(0,d.jsx)(k.A,{size:12,className:"animate-spin"}):(0,d.jsx)(g.A,{size:12}),A.organizeUndoAll]}),(0,d.jsxs)("button",{onClick:V,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-all",children:[(0,d.jsx)(l.A,{size:12}),A.organizeDone]})]})}return G?(0,d.jsx)("div",{className:"fixed inset-0 z-50 overlay-backdrop flex items-center justify-center p-4",onClick:a=>{a.target===a.currentTarget&&H(!1)},children:(0,d.jsxs)("div",{className:"w-full max-w-xl max-h-[80vh] flex flex-col bg-card rounded-xl shadow-xl border border-border animate-in fade-in-0 zoom-in-95 duration-200",onClick:R,role:"dialog","aria-modal":"true","aria-label":A.organizeDetailTitle,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-3 shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[B?(0,d.jsxs)("div",{className:"relative shrink-0",children:[(0,d.jsx)(m.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)(k.A,{size:10,className:"absolute -bottom-0.5 -right-0.5 text-[var(--amber)] animate-spin"})]}):M?(0,d.jsx)(l.A,{size:16,className:"text-success"}):(0,d.jsx)(n.A,{size:16,className:"text-error"}),(0,d.jsx)("h2",{className:"text-base font-semibold text-foreground",children:A.organizeDetailTitle}),B&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums",children:A.organizeElapsed(C)})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{type:"button",onClick:()=>H(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:A.organizeMinimizeModal,children:(0,d.jsx)(o.A,{size:14})}),(0,d.jsx)("button",{type:"button",onClick:V,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,d.jsx)(p.A,{size:14})})]})]}),(0,d.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto px-5 pb-2 space-y-4",children:[B&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-lg bg-[var(--amber-subtle)] border border-[var(--amber-dim)]",children:[(0,d.jsx)(k.A,{size:14,className:"text-[var(--amber)] animate-spin shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-foreground",children:w(y,D)})]}),a.sourceFileNames.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:A.organizeSourceFiles}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.sourceFileNames.map((a,b)=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md bg-muted/60 text-xs text-foreground",children:[(0,d.jsx)(q.A,{size:11,className:"text-muted-foreground shrink-0"}),a]},b))})]}),(a.summary||B)&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:A.organizeSummaryLabel}),(0,d.jsx)("div",{className:"px-3 py-2.5 rounded-lg bg-muted/30 border border-border text-sm text-foreground leading-relaxed whitespace-pre-wrap",children:a.summary||A.organizeNoSummary})]}),a.changes.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:A.organizeChangesLabel(a.changes.length)}),(0,d.jsx)("div",{className:"space-y-0.5",children:a.changes.map((a,b)=>W(a,b))})]}),N&&(0,d.jsx)("div",{className:"px-3 py-2.5 rounded-lg bg-error/5 border border-error/20 text-xs text-error",children:a.error})]}),(M||N)&&X()]})}):E&&(M||N)?(0,d.jsxs)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 w-[420px] max-w-[calc(100vw-2rem)] bg-card border border-border rounded-xl shadow-xl animate-in fade-in-0 slide-in-from-bottom-2 duration-200",onClick:R,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[M?(0,d.jsx)(l.A,{size:14,className:"text-success"}):(0,d.jsx)(n.A,{size:14,className:"text-error"}),(0,d.jsx)("span",{className:"text-xs font-medium text-foreground",children:M?A.organizeReviewTitle:A.organizeErrorTitle})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{F(!1),H(!0)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:A.organizeDetailTitle,children:(0,d.jsx)(r.A,{size:13})}),(0,d.jsx)("button",{type:"button",onClick:()=>F(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,d.jsx)(s.A,{size:14})})]})]}),M&&(0,d.jsx)("div",{className:"max-h-[240px] overflow-y-auto p-2 space-y-0.5",children:a.changes.map((a,b)=>W(a,b))}),N&&(0,d.jsx)("div",{className:"p-4 text-center",children:(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:a.error})}),X()]}):(0,d.jsx)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 bg-card border border-border rounded-xl shadow-lg px-4 py-3 max-w-md animate-in fade-in-0 slide-in-from-bottom-2 duration-200",onClick:R,children:M?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.A,{size:16,className:"text-success shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-foreground truncate",children:A.organizeReviewDesc(P)}),a.changes.length>0&&(0,d.jsxs)("button",{type:"button",onClick:()=>{F(!0),R()},className:"flex items-center gap-1 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:[(0,d.jsx)(s.A,{size:12,className:"rotate-180"}),A.organizeExpand]}),(0,d.jsxs)("button",{type:"button",onClick:V,className:"flex items-center gap-1 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:[(0,d.jsx)(l.A,{size:12}),A.organizeDone]})]}):N?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.A,{size:16,className:"text-error shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-foreground truncate",children:A.organizeError}),(0,d.jsx)("button",{type:"button",onClick:()=>{F(!0),R()},className:"text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:A.organizeExpand}),(0,d.jsx)("button",{type:"button",onClick:V,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:(0,d.jsx)(p.A,{size:14})})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"relative shrink-0",children:[(0,d.jsx)(m.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)(k.A,{size:10,className:"absolute -bottom-0.5 -right-0.5 text-[var(--amber)] animate-spin"})]}),(0,d.jsx)("span",{className:"text-xs text-foreground truncate",children:w(y,D)}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:A.organizeElapsed(C)}),(0,d.jsx)("button",{type:"button",onClick:()=>{H(!0),R()},className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",title:A.organizeDetailTitle,children:(0,d.jsx)(r.A,{size:13})}),(0,d.jsx)("button",{type:"button",onClick:V,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:(0,d.jsx)(p.A,{size:14})})]})})}},5200:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(67484),e=c(47223),f=c(52610);function g({ssrLocale:a}){let b=(0,d.useRef)(!1);return b.current||(b.current=!0,e.D.getState().locale!==a&&e.D.setState({locale:a,t:f.D[a]})),null}},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(47223),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))]})]})}},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)},10927:(a,b,c)=>{"use strict";function d(a,b=!0){}c.d(b,{r:()=>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")},13706:(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)("70eedfa0cdb1bf6564fa3543e9494e4e4c6632162b",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 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)}},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(47223);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."]})]})]})})}},14986:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call VideoRenderer() from the server but VideoRenderer 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/video/VideoRenderer.tsx","VideoRenderer")},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"}]},21416:(a,b,c)=>{"use strict";c.r(b),c.d(b,{PdfRenderer:()=>f});var d=c(48249),e=c(67484);function f({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,[c,f]=(0,e.useState)(!0),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(0),k=(0,e.useCallback)(()=>{h(!1),f(!0),j(a=>a+1)},[]);return(0,d.jsxs)("div",{className:"w-full h-full min-h-[80vh] flex flex-col relative",children:[c&&!g&&(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-[var(--bg-secondary)] rounded-lg z-10",children:(0,d.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading PDF..."})}),g&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-[var(--bg-secondary)] rounded-lg z-10 gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load PDF"}),(0,d.jsx)("button",{onClick:k,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,d.jsx)("iframe",{src:b,className:"w-full flex-1 min-h-[80vh] border-0 rounded-lg bg-[var(--bg-secondary)]",title:a.split("/").pop()??"PDF",onLoad:()=>f(!1),onError:()=>{f(!1),h(!0)},style:{display:g?"none":"block"}},i)]})}},23017:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(67484),f=c(46674),g=c(47223);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 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]})})]})})}},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")},25971:(a,b,c)=>{"use strict";c.d(b,{M:()=>B});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(77720),z=c(99829);z.callServer,z.findSourceMapURL;let A=(0,z.createServerReference)("00730a74d0e75070dd47c1d8b90694b253b60f235f",z.callServer,void 0,z.findSourceMapURL,"cleanupExamplesAction");function B({data:a,setData:b,t:c}){let p=a.envOverrides??{},q=c.settings.knowledge,r=c.settings.appearance,[x,z]=(0,e.useState)(()=>!1),[B,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)(C,{label:r.labsEcho??"Echo",description:r.labsEchoDesc??"Reflective journaling powered by your notes.",checked:x,onChange:a=>{z(a),localStorage.setItem("mindos:labs-echo",a?"1":"0"),window.dispatchEvent(new Event("mindos:labs-changed"))}}),(0,d.jsx)(C,{label:r.labsWorkflows??"Flows",description:r.labsWorkflowsDesc??"Visual workflow automation for agents.",checked:B,onChange:a=>{E(a),localStorage.setItem("mindos:labs-workflows",a?"1":"0"),window.dispatchEvent(new Event("mindos:labs-changed"))}})]})}),(0,d.jsx)(D,{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 A();K(!1),a.success&&(M(a.deleted),I(0))},onCancel:()=>ac(!1)})]})}function C({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 D({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"})]})}},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(47223),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/60 rounded-t-2xl md:rounded-2xl 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,onSpacesClick:z,syncStatus:A,expanded:B,onExpandedChange:C,onSettingsClick:D,onSyncClick:E}){let F=(0,e.useRef)(0),G=(0,e.useRef)(null),{t:H}=(0,r.Y)(),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(!1),O=(0,e.useCallback)(a=>{let b=Date.now();b-F.current<300||(F.current=b,a())},[]),P=(0,e.useCallback)(c=>{O(()=>b(a===c?null:c))},[a,b,O]),Q=(0,s.Bq)(A,!1),R=B?v:u,S="off"!==Q&&"synced"!==Q?(0,d.jsx)("span",{className:`absolute ${B?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full ${s.BG[Q]} ${"error"===Q||"conflicts"===Q?"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:`${R}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 ${B?"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"}),B&&(0,d.jsx)("span",{className:"text-sm text-foreground font-brand whitespace-nowrap",children:"MindOS"})]}),(0,d.jsx)("div",{className:`${B?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsxs)("div",{className:`flex flex-col ${B?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,d.jsx)(w,{icon:(0,d.jsx)(h.A,{size:18}),label:H.sidebar.files,active:"files"===a,expanded:B,onClick:()=>z?O(z):P("files"),walkthroughId:"files-panel"}),K&&(0,d.jsx)(w,{icon:(0,d.jsx)(i.A,{size:18}),label:H.sidebar.echo,active:"echo"===a,expanded:B,onClick:()=>c?O(c):P("echo"),walkthroughId:"echo-panel"}),(0,d.jsx)(w,{icon:(0,d.jsx)(j.A,{size:18}),label:H.sidebar.searchTitle,shortcut:"⌘K",active:"search"===a,expanded:B,onClick:()=>P("search")}),(0,d.jsx)(w,{icon:(0,d.jsx)(k.A,{size:18}),label:H.sidebar.agents,active:"agents"===a,expanded:B,onClick:()=>f?O(f):P("agents"),walkthroughId:"agents-panel"}),M&&(0,d.jsx)(w,{icon:(0,d.jsx)(l.A,{size:18}),label:H.sidebar.workflows??"Flows",active:"workflows"===a,expanded:B,onClick:()=>y?O(y):P("workflows")})]}),(0,d.jsx)("div",{className:"flex-1"}),(0,d.jsx)("div",{className:`${B?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsx)("div",{className:`flex flex-col ${B?"px-1.5":"items-center"} gap-1 py-2`,children:(0,d.jsx)(w,{icon:(0,d.jsx)(m.A,{size:18}),label:H.sidebar.discover,active:"discover"===a,expanded:B,onClick:()=>x?O(x):P("discover")})}),(0,d.jsx)("div",{className:`${B?"mx-3":"mx-2"} border-t border-border`}),(0,d.jsxs)("div",{className:`flex flex-col ${B?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,d.jsx)(w,{icon:(0,d.jsx)(n.A,{size:18}),label:H.sidebar.settingsTitle,shortcut:"⌘,",expanded:B,onClick:()=>O(D),badge:I?(0,d.jsx)("span",{className:`absolute ${B?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full bg-error`}):void 0}),A?.enabled&&A?.remote&&"(not configured)"!==A.remote&&(0,d.jsx)(w,{icon:(0,d.jsx)(o.A,{size:18}),label:H.sidebar.syncLabel,expanded:B,buttonRef:G,badge:S,onClick:()=>O(()=>{let a=G.current?.getBoundingClientRect();a&&E(a)})})]})]}),(0,d.jsx)("button",{onClick:()=>C(!B),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":B?"Collapse sidebar":"Expand sidebar",title:B?"Collapse":"Expand",children:B?(0,d.jsx)(p.A,{size:10}):(0,d.jsx)(q.A,{size:10})})]})}},4949:(a,b,c)=>{"use strict";c.d(b,{A:()=>x});var d=c(48249),e=c(67484),f=c(19099),g=c(97621),h=c(50567),i=c(22772),j=c(86588),k=c(40560),l=c(42742),m=c(6079),n=c(8455),o=c(45231),p=c(46674),q=c(47086),r=c(13481),s=c(44218),t=c(47223),u=c(33191),v=c(39624);function w(a,b){let c=a.fileImport;if(!b)return c.organizeProcessing;switch(b.stage){case"connecting":return c.organizeConnecting;case"analyzing":return c.organizeAnalyzing;case"reading":return c.organizeReading(b.detail);case"thinking":return c.organizeThinking;case"writing":return c.organizeWriting(b.detail);default:return c.organizeProcessing}}function x({aiOrganize:a,onDismiss:b,onCancel:c,onHistoryUpdate:x}){let{t:y}=(0,t.Y)(),z=(0,f.useRouter)(),A=y.fileImport,B="organizing"===a.phase,{elapsed:C,displayHint:D}=function(a,b){let[c,d]=(0,e.useState)(0),[f,g]=(0,e.useState)(!1);return(0,e.useRef)(Date.now()),{elapsed:c,displayHint:f?{stage:"thinking"}:b}}(0,a.stageHint),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(!1),K=(0,e.useRef)(null),L=(0,e.useRef)(null),M="done"===a.phase,N="error"===a.phase,O=B||M||N,P=a.changes.filter(a=>a.ok&&!a.undone).length,Q=(0,e.useCallback)(()=>{K.current&&clearTimeout(K.current),(M||N)&&(K.current=setTimeout(()=>{b()},18e4))},[M,N,b]),R=(0,e.useCallback)(()=>{Q()},[Q]),S=(0,e.useCallback)(async b=>{R(),J(!0);let c=await a.undoOne(b);J(!1),c&&(window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(()=>{if(L.current){let c=a.changes.map(a=>({action:a.action,path:a.path,ok:a.ok,undone:a.path===b||a.undone})),d=c.every(a=>!a.ok||a.undone);(0,v.W8)(L.current,{files:c,status:d?"undone":"partial"}),x?.()}},0))},[a,R,x]),T=(0,e.useCallback)(async()=>{R(),J(!0);let b=await a.undoAll();J(!1),b>0&&(window.dispatchEvent(new Event("mindos:files-changed")),L.current&&((0,v.W8)(L.current,{files:a.changes.map(a=>({action:a.action,path:a.path,ok:a.ok,undone:!!a.ok||a.undone})),status:"undone"}),x?.()))},[a,R,x]),U=(0,e.useCallback)(a=>{R(),z.push(`/view/${(0,u.O0)(a)}`)},[z,R]),V=(0,e.useCallback)(()=>{b()},[b]);if(!O)return null;function W(b,c){let e=b.undone,f=a.canUndo(b.path),k=b.path.split("/").pop()??b.path;return(0,d.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors ${e?"bg-muted/30 opacity-50":"bg-muted/50"}`,children:[e?(0,d.jsx)(g.A,{size:14,className:"text-muted-foreground shrink-0"}):"create"===b.action?(0,d.jsx)(h.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(i.A,{size:14,className:"text-[var(--amber)] shrink-0"}),(0,d.jsx)("span",{className:`truncate flex-1 ${e?"line-through text-muted-foreground":"text-foreground"}`,children:k}),e?(0,d.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:A.organizeUndone}):(0,d.jsx)("span",{className:`text-xs shrink-0 ${b.ok?"text-muted-foreground":"text-error"}`,children:b.ok?"create"===b.action?A.organizeCreated:A.organizeUpdated:A.organizeFailed}),f&&(0,d.jsx)("button",{type:"button",onClick:()=>S(b.path),disabled:I,className:"text-2xs text-muted-foreground/60 hover:text-foreground transition-colors shrink-0 px-1 disabled:opacity-40",title:A.organizeUndoOne,children:(0,d.jsx)(g.A,{size:12})}),b.ok&&!b.undone&&(0,d.jsx)("button",{type:"button",onClick:()=>U(b.path),className:"text-2xs text-muted-foreground/60 hover:text-[var(--amber)] transition-colors shrink-0 px-1",title:A.organizeViewFile,children:(0,d.jsx)(j.A,{size:12})})]},`${b.path}-${c}`)}function X(){return(0,d.jsxs)("div",{className:"flex items-center justify-end gap-3 px-4 py-3 border-t border-border",children:[M&&a.hasAnyUndoable&&(0,d.jsxs)("button",{onClick:T,disabled:I,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1.5 disabled:opacity-50",children:[I?(0,d.jsx)(k.A,{size:12,className:"animate-spin"}):(0,d.jsx)(g.A,{size:12}),A.organizeUndoAll]}),(0,d.jsxs)("button",{onClick:V,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-all",children:[(0,d.jsx)(l.A,{size:12}),A.organizeDone]})]})}return G?(0,d.jsx)("div",{className:"fixed inset-0 z-50 overlay-backdrop flex items-center justify-center p-4",onClick:a=>{a.target===a.currentTarget&&H(!1)},children:(0,d.jsxs)("div",{className:"w-full max-w-xl max-h-[80vh] flex flex-col bg-card rounded-xl shadow-xl border border-border animate-in fade-in-0 zoom-in-95 duration-200",onClick:R,role:"dialog","aria-modal":"true","aria-label":A.organizeDetailTitle,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-3 shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[B?(0,d.jsxs)("div",{className:"relative shrink-0",children:[(0,d.jsx)(m.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)(k.A,{size:10,className:"absolute -bottom-0.5 -right-0.5 text-[var(--amber)] animate-spin"})]}):M?(0,d.jsx)(l.A,{size:16,className:"text-success"}):(0,d.jsx)(n.A,{size:16,className:"text-error"}),(0,d.jsx)("h2",{className:"text-base font-semibold text-foreground",children:A.organizeDetailTitle}),B&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums",children:A.organizeElapsed(C)})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{type:"button",onClick:()=>H(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:A.organizeMinimizeModal,children:(0,d.jsx)(o.A,{size:14})}),(0,d.jsx)("button",{type:"button",onClick:V,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,d.jsx)(p.A,{size:14})})]})]}),(0,d.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto px-5 pb-2 space-y-4",children:[B&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-lg bg-[var(--amber-subtle)] border border-[var(--amber-dim)]",children:[(0,d.jsx)(k.A,{size:14,className:"text-[var(--amber)] animate-spin shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-foreground",children:w(y,D)})]}),a.sourceFileNames.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:A.organizeSourceFiles}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.sourceFileNames.map((a,b)=>(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md bg-muted/60 text-xs text-foreground",children:[(0,d.jsx)(q.A,{size:11,className:"text-muted-foreground shrink-0"}),a]},b))})]}),(a.summary||B)&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:A.organizeSummaryLabel}),(0,d.jsx)("div",{className:"px-3 py-2.5 rounded-lg bg-muted/30 border border-border text-sm text-foreground leading-relaxed whitespace-pre-wrap",children:a.summary||A.organizeNoSummary})]}),a.changes.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:A.organizeChangesLabel(a.changes.length)}),(0,d.jsx)("div",{className:"space-y-0.5",children:a.changes.map((a,b)=>W(a,b))})]}),N&&(0,d.jsx)("div",{className:"px-3 py-2.5 rounded-lg bg-error/5 border border-error/20 text-xs text-error",children:a.error})]}),(M||N)&&X()]})}):E&&(M||N)?(0,d.jsxs)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 w-[420px] max-w-[calc(100vw-2rem)] bg-card border border-border rounded-xl shadow-xl animate-in fade-in-0 slide-in-from-bottom-2 duration-200",onClick:R,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[M?(0,d.jsx)(l.A,{size:14,className:"text-success"}):(0,d.jsx)(n.A,{size:14,className:"text-error"}),(0,d.jsx)("span",{className:"text-xs font-medium text-foreground",children:M?A.organizeReviewTitle:A.organizeErrorTitle})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{F(!1),H(!0)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:A.organizeDetailTitle,children:(0,d.jsx)(r.A,{size:13})}),(0,d.jsx)("button",{type:"button",onClick:()=>F(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,d.jsx)(s.A,{size:14})})]})]}),M&&(0,d.jsx)("div",{className:"max-h-[240px] overflow-y-auto p-2 space-y-0.5",children:a.changes.map((a,b)=>W(a,b))}),N&&(0,d.jsx)("div",{className:"p-4 text-center",children:(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:a.error})}),X()]}):(0,d.jsx)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 bg-card border border-border rounded-xl shadow-lg px-4 py-3 max-w-md animate-in fade-in-0 slide-in-from-bottom-2 duration-200",onClick:R,children:M?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.A,{size:16,className:"text-success shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-foreground truncate",children:A.organizeReviewDesc(P)}),a.changes.length>0&&(0,d.jsxs)("button",{type:"button",onClick:()=>{F(!0),R()},className:"flex items-center gap-1 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:[(0,d.jsx)(s.A,{size:12,className:"rotate-180"}),A.organizeExpand]}),(0,d.jsxs)("button",{type:"button",onClick:V,className:"flex items-center gap-1 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:[(0,d.jsx)(l.A,{size:12}),A.organizeDone]})]}):N?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.A,{size:16,className:"text-error shrink-0"}),(0,d.jsx)("span",{className:"text-xs text-foreground truncate",children:A.organizeError}),(0,d.jsx)("button",{type:"button",onClick:()=>{F(!0),R()},className:"text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:A.organizeExpand}),(0,d.jsx)("button",{type:"button",onClick:V,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:(0,d.jsx)(p.A,{size:14})})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"relative shrink-0",children:[(0,d.jsx)(m.A,{size:16,className:"text-[var(--amber)]"}),(0,d.jsx)(k.A,{size:10,className:"absolute -bottom-0.5 -right-0.5 text-[var(--amber)] animate-spin"})]}),(0,d.jsx)("span",{className:"text-xs text-foreground truncate",children:w(y,D)}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:A.organizeElapsed(C)}),(0,d.jsx)("button",{type:"button",onClick:()=>{H(!0),R()},className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",title:A.organizeDetailTitle,children:(0,d.jsx)(r.A,{size:13})}),(0,d.jsx)("button",{type:"button",onClick:V,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:(0,d.jsx)(p.A,{size:14})})]})})}},5200:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(67484),e=c(47223),f=c(52610);function g({ssrLocale:a}){let b=(0,d.useRef)(!1);return b.current||(b.current=!0,e.D.getState().locale!==a&&e.D.setState({locale:a,t:f.D[a]})),null}},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(47223),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))]})]})}},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)},10927:(a,b,c)=>{"use strict";function d(a,b=!0){}c.d(b,{r:()=>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(47223);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."]})]})]})})}},14986:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call VideoRenderer() from the server but VideoRenderer 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/video/VideoRenderer.tsx","VideoRenderer")},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")},19765:(a,b,c)=>{"use strict";c.d(b,{f:()=>e});var d=c(99829);let e=(0,d.createServerReference)("60243dca79d5ab1ef1e0297569c5320b53b6f27b29",d.callServer,void 0,d.findSourceMapURL,"renameFileAction")},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:"bottom"},{anchor:"agents-panel",position:"right"}]},21416:(a,b,c)=>{"use strict";c.r(b),c.d(b,{PdfRenderer:()=>f});var d=c(48249),e=c(67484);function f({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,[c,f]=(0,e.useState)(!0),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(0),k=(0,e.useCallback)(()=>{h(!1),f(!0),j(a=>a+1)},[]);return(0,d.jsxs)("div",{className:"w-full h-full min-h-[80vh] flex flex-col relative",children:[c&&!g&&(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-[var(--bg-secondary)] rounded-lg z-10",children:(0,d.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading PDF..."})}),g&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-[var(--bg-secondary)] rounded-lg z-10 gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load PDF"}),(0,d.jsx)("button",{onClick:k,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,d.jsx)("iframe",{src:b,className:"w-full flex-1 min-h-[80vh] border-0 rounded-lg bg-[var(--bg-secondary)]",title:a.split("/").pop()??"PDF",onLoad:()=>f(!1),onError:()=>{f(!1),h(!0)},style:{display:g?"none":"block"}},i)]})}},23017:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(48249),e=c(67484),f=c(46674),g=c(47223);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 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]})})]})})}},23931:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>C,Ld:()=>A,iP:()=>z,Ay:()=>D});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(28330),q=c(59347),r=c(61572),s=c(60907),t=c(4140),u=c(2548),v=c(47223),w=c(99829);w.callServer,w.findSourceMapURL;var x=c(1108);let y=()=>{},z=x.qQ,A=x.Dp.MIN,B=x.Dp.MAX_RATIO,C=x.Dp.MAX_ABS;function D({activePanel:a,fileTree:b,onNavigate:c,onOpenSyncSettings:w,railWidth:x=48,panelWidth:D,onWidthChange:E,onWidthCommit:F,maximized:G=!1,onMaximize:H,onImport:I,children:J}){let K=a?z[a]:280,L=G?void 0:D??K,{t:M}=(0,v.Y)(),N=(0,f.useRouter)(),[O,P]=(0,e.useState)(null),Q=(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]),[R,S]=(0,e.useState)(!1),T=(0,e.useRef)(null),U=(0,e.useRef)(null),[V,W]=(0,e.useState)(!1),X=(0,e.useRef)(null),Y=(0,e.useRef)(null),Z=(0,r.gL)(),[$,_]=(0,e.useState)(0),[aa,ab]=(0,e.useState)(0),[ac,ad]=(0,e.useState)(!1),ae=(0,e.useCallback)(()=>{if(!ac){ad(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[ac]),af=(0,u._)({width:D??K,minWidth:A,maxWidth:C,maxWidthRatio:B,direction:"right",disabled:G,onResize:E??y,onResizeEnd:F??y});return(0,d.jsxs)("aside",{className:`
55
+ hidden md:flex fixed top-0 h-screen z-30
56
+ flex-col bg-card border-r border-border
57
+ transition-[transform,left,width] duration-200 ease-out
58
+ ${null!==a?"translate-x-0":"-translate-x-full pointer-events-none"}
59
+ `,style:{width:G?`calc(100vw - ${x}px)`:`${L}px`,left:`${x}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)(t.A,{title:M.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:T,type:"button",onClick:()=>{W(!1),S(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":M.sidebar.new,title:M.sidebar.new,children:(0,d.jsx)(g.A,{size:13})}),R&&(0,d.jsxs)("div",{ref:U,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:()=>{S(!1),N.push("/view/Untitled.md")},children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0"}),M.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:()=>{S(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,d.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),M.sidebar.newSpace]})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>I?.(),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":M.sidebar.importFile,title:M.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:()=>P(a=>Math.max(-1,(a??Q)-1)),onDoubleClick:()=>{P(-1),ae()},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":M.sidebar.collapseLevel,title:ac?M.sidebar.collapseLevel:M.sidebar.collapseLevelHint??M.sidebar.collapseLevel,children:(0,d.jsx)(k.A,{size:13})}),(0,d.jsx)("button",{onClick:()=>P(a=>{let b=(a??0)+1;return b>Q?null:b}),onDoubleClick:()=>{P(null),ae()},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":M.sidebar.expandLevel,title:ac?M.sidebar.expandLevel:M.sidebar.expandLevelHint??M.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:X,type:"button",onClick:()=>{S(!1),W(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":M.sidebar.more,title:M.sidebar.more,children:(0,d.jsx)(m.A,{size:13})}),V&&(0,d.jsxs)("div",{ref:Y,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,r.Fo)(!Z)},children:[Z?(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:M.sidebar.showHiddenFiles}),Z&&(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:()=>{W(!1),N.push("/view/Inbox/")},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:M.sidebar.capture}),aa>0&&(0,d.jsx)("span",{className:"text-xs font-medium text-[var(--amber)] tabular-nums",children:aa})]}),(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:()=>{W(!1),N.push("/trash")},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:M.trash.title}),$>0&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:$})]})]})]})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",onDragEnter:a=>{a.dataTransfer.types.includes("Files")&&a.stopPropagation()},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation())},onDrop:a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation())},children:(0,d.jsx)(r.Ay,{nodes:b,onNavigate:c,maxOpenDepth:O,onImport:I})}),(0,d.jsxs)("button",{type:"button",onClick:()=>N.push("/view/Inbox/"),className:"flex items-center gap-2 mx-2 px-2 py-1.5 text-sm rounded-md transition-colors hover:bg-muted group border-t border-border/40 shrink-0",children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1 text-left text-muted-foreground group-hover:text-foreground transition-colors text-xs",children:M.sidebar.capture}),aa>0&&(0,d.jsx)("span",{className:"text-xs font-medium text-[var(--amber)] tabular-nums",children:aa})]}),(0,d.jsx)(s.Ay,{collapsed:!1,onOpenSyncSettings:w})]}),J,!G&&E&&(0,d.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:af,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"})})]})}},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(47223),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/60 rounded-t-2xl md:rounded-2xl 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
60
  ${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
61
  ${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:"inter",label:"Inter",category:"Sans",style:{fontFamily:"var(--font-inter), 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))})]})]})}},29406:(a,b,c)=>{"use strict";c.r(b),c.d(b,{PdfRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call PdfRenderer() from the server but PdfRenderer 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/pdf/PdfRenderer.tsx","PdfRenderer")},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(47223),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)}},30488:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AudioRenderer:()=>f});var d=c(48249),e=c(67484);function f({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,c=a.split("/").pop()??"audio",f=c.split(".").pop()?.toLowerCase()??"",[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(0),[k,l]=(0,e.useState)(null),m=(0,e.useCallback)(()=>{h(!1),j(a=>a+1)},[]);return(0,d.jsxs)("div",{className:"w-full flex flex-col items-center gap-6 py-12 px-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 text-xs text-[var(--text-secondary)]",children:[(0,d.jsx)("span",{className:"text-4xl opacity-40",children:"\uD83C\uDFB5"}),(0,d.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:c}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"uppercase opacity-60",children:f}),null!==k&&(0,d.jsx)("span",{children:k<1024?`${k} B`:k<1048576?`${(k/1024).toFixed(1)} KB`:`${(k/1048576).toFixed(1)} MB`})]})]})]}),g?(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load audio"}),(0,d.jsx)("button",{onClick:m,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}):(0,d.jsx)("audio",{controls:!0,preload:"metadata",className:"w-full max-w-lg",onError:()=>h(!0),children:(0,d.jsx)("source",{src:b})},i)]})}},31168:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>f});var d=c(48249),e=c(50530);function f({delay:a=0,...b}){return(0,d.jsx)(e.B,{"data-slot":"tooltip-provider",delay:a,...b})}},31442:(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/lib/stores/LocaleStoreInit.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/lib/stores/LocaleStoreInit.tsx","default")},32056:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{default:()=>x,metadata:()=>y,viewport:()=>z});var e=c(5735),f=c(82204),g=c.n(f),h=c(10890),i=c.n(h),j=c(1256),k=c.n(j),l=c(57353),m=c.n(l);c(82704);var n=c(50953),o=c(5315),p=c(68533),q=c(31442),r=c(24387),s=c(32248),t=c(12978),u=c(90598),v=c(65573);c(41558);var w=a([n]);n=(w.then?(await w)():w)[0];let y={title:"MindOS",description:"Personal knowledge base",icons:{icon:"/logo-square.svg",apple:"/icons/icon-192.png"},manifest:"/manifest.json",other:{"mobile-web-app-capable":"yes","apple-mobile-web-app-capable":"yes","apple-mobile-web-app-status-bar-style":"black-translucent"}},z={width:"device-width",initialScale:1,viewportFit:"cover"};async function x({children:a}){let b=[];try{b=(0,n.xY)()}catch(a){console.error("[RootLayout] Failed to load file tree:",a)}let c=await (0,v.UL)(),d=c.get("locale")?.value,f="en";return"zh"===d?f="zh":"en"!==d&&(f=((await (0,v.b3)()).get("Accept-Language")||"").includes("zh")?"zh":"en"),(0,e.jsxs)("html",{lang:f,suppressHydrationWarning:!0,children:[(0,e.jsxs)("head",{children:[(0,e.jsx)("meta",{name:"theme-color",content:"#c8871e"}),(0,e.jsx)("script",{dangerouslySetInnerHTML:{__html:"(function(){if(typeof Node!=='undefined'){var o=Node.prototype.removeChild;Node.prototype.removeChild=function(c){if(c.parentNode!==this){try{return o.call(c.parentNode,c)}catch(e){return c}}return o.call(this,c)};var i=Node.prototype.insertBefore;Node.prototype.insertBefore=function(n,r){if(r&&r.parentNode!==this){try{return i.call(r.parentNode,n,r)}catch(e){return i.call(this,n,null)}}return i.call(this,n,r)}}})();"}}),(0,e.jsx)("script",{dangerouslySetInnerHTML:{__html:"(function(){try{if(/electron/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)){document.documentElement.setAttribute('data-electron-mac','')}}catch(e){}})();"}}),(0,e.jsx)("script",{dangerouslySetInnerHTML:{__html:"(function(){try{var s=localStorage.getItem('theme');var dark=s&&s!=='system'?s==='dark':window.matchMedia('(prefers-color-scheme: dark)').matches;document.documentElement.classList.toggle('dark',dark);var cw=localStorage.getItem('content-width');if(cw)document.documentElement.style.setProperty('--content-width-override',cw);var pf=localStorage.getItem('prose-font');if(pf==='geist'){pf='inter';localStorage.setItem('prose-font','inter')}var fm={lora:'\"Lora\", Georgia, serif','ibm-plex-sans':'\"IBM Plex Sans\", sans-serif',inter:'var(--font-inter), sans-serif','ibm-plex-mono':'\"IBM Plex Mono\", monospace'};if(pf&&fm[pf])document.documentElement.style.setProperty('--prose-font-override',fm[pf]);var loc=localStorage.getItem('locale')||'system';var rl=loc==='system'?(navigator.language.startsWith('zh')?'zh':'en'):loc;window.__mindos_locale__=rl;document.documentElement.lang=rl==='zh'?'zh':'en';document.cookie='locale='+rl+';path=/;max-age=31536000;SameSite=Lax'}catch(e){}})();"}})]}),(0,e.jsxs)("body",{className:`${g().variable} ${i().variable} ${k().variable} ${m().variable} antialiased bg-background text-foreground`,suppressHydrationWarning:!0,children:[(0,e.jsx)(q.default,{ssrLocale:f}),(0,e.jsx)(p.TooltipProvider,{delay:300,children:(0,e.jsx)(r.default,{children:(0,e.jsx)(o.default,{fileTree:b,children:a})})}),(0,e.jsx)(s.default,{}),(0,e.jsx)(t.default,{}),(0,e.jsx)(u.default,{})]})]})}d()}catch(a){d(a)}})},32248:(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/ui/Toaster.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/ui/Toaster.tsx","default")},32621:(a,b,c)=>{"use strict";c.d(b,{V:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(!1),[f,g]=(0,d.useState)(null),h=(0,d.useCallback)(async a=>{e(!0),g(null);try{let c=await fetch("/api/a2a/discover",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:a})}),d=await c.json();if(d.agent)return b(a=>a.some(a=>a.id===d.agent.id)?a.map(a=>a.id===d.agent.id?d.agent:a):[...a,d.agent]),d.agent;return g(d.error||"Discovery failed"),null}catch(a){return g(a.message),null}finally{e(!1)}},[]);return{agents:a,discovering:c,error:f,discover:h,remove:(0,d.useCallback)(a=>{b(b=>b.filter(b=>b.id!==a))},[]),refresh:(0,d.useCallback)(()=>{b([]),g(null)},[])}}},33073:(a,b,c)=>{"use strict";c.d(b,{A:()=>E});var d=c(48249),e=c(67484),f=c(19099),g=c(69924),h=c(40560),i=c(41023),j=c(95581),k=c(18329),l=c(32621),m=c(47223),n=c(4140),o=c(4919),p=c(13799),q=c(95801),r=c(78890);function s({copy:a,connectedCount:b,mcpEnabled:c=!0}){let e=(0,f.usePathname)(),g=(0,f.useSearchParams)().get("tab"),h="/agents"===e;return(0,d.jsxs)("div",{className:"py-2",children:[(0,d.jsx)(r.G,{icon:(0,d.jsx)(o.A,{size:14,className:h&&(null===g||"overview"===g)?"text-[var(--amber)]":"text-muted-foreground"}),title:a.navOverview,badge:(0,d.jsx)("span",{className:"text-2xs tabular-nums text-muted-foreground/60 px-1.5 py-0.5 rounded bg-muted/40 font-medium",children:b}),href:"/agents",active:h&&(null===g||"overview"===g)}),c&&(0,d.jsx)(r.G,{icon:(0,d.jsx)(p.A,{size:14,className:h&&"mcp"===g?"text-[var(--amber)]":"text-muted-foreground"}),title:a.navMcp,href:"/agents?tab=mcp",active:h&&"mcp"===g}),(0,d.jsx)(r.G,{icon:(0,d.jsx)(q.A,{size:14,className:h&&"skills"===g?"text-[var(--amber)]":"text-muted-foreground"}),title:a.navSkills,href:"/agents?tab=skills",active:h&&"skills"===g}),(0,d.jsx)(r.G,{icon:(0,d.jsx)(i.A,{size:14,className:h&&"a2a"===g?"text-[var(--amber)]":"text-muted-foreground"}),title:a.navNetwork,href:"/agents?tab=a2a",active:h&&"a2a"===g})]})}var t=c(44218),u=c(19794),v=c(2116),w=c.n(v),x=c(42742),y=c(82594),z=c(57056);function A({agent:a,agentStatus:b,selected:c=!1,detailHref:e,onInstallAgent:f,copy:g,isA2aReady:h=!1,a2aTooltip:j}){return(0,d.jsxs)("div",{className:`
57
62
  group flex items-center gap-0 rounded-xl border transition-all duration-150
58
63
  ${c?"border-border ring-2 ring-ring/50 bg-[var(--amber-dim)]/45":"border-border/70 bg-card/50 hover:border-border hover:bg-muted/25"}
59
- `,children:[(0,d.jsxs)(w(),{href:e,className:"flex flex-1 min-w-0 items-center gap-2.5 text-left rounded-xl pl-2.5 pr-2 py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(z.lx,{name:a.name,status:b,size:"sm"}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate leading-tight",children:a.name}),"connected"===b&&a.transport&&(0,d.jsx)("span",{className:"text-2xs font-mono tabular-nums px-1.5 py-0.5 rounded-md bg-muted/90 text-muted-foreground shrink-0 border border-border/50",children:a.transport}),h&&(0,d.jsx)("span",{title:j,className:"shrink-0 text-muted-foreground/70",children:(0,d.jsx)(i.A,{size:12})}),(0,d.jsx)("span",{className:"flex-1 min-w-[4px]"}),(0,d.jsx)(u.A,{size:15,className:`shrink-0 transition-opacity duration-150 ${c?"text-[var(--amber)] opacity-90":"text-muted-foreground/45 group-hover:text-muted-foreground/80"}`,"aria-hidden":!0})]}),"detected"===b&&(0,d.jsx)("div",{className:"pr-2 py-2 shrink-0",children:(0,d.jsx)(B,{agentKey:a.key,agentName:a.name,onInstallAgent:f,copy:g})})]})}function B({agentKey:a,agentName:b,onInstallAgent:c,copy:f}){let[g,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("idle"),l=async b=>{if(b.stopPropagation(),g)return;i(!0),k("idle");let d=await c(a);i(!1),k(d?"success":"error")},m="error"===j,n="success"===j,o=g?f.installing:n?f.installSuccess:m?f.retryInstall:f.install;return(0,d.jsxs)("button",{type:"button",onClick:l,disabled:g,className:`flex items-center gap-1 px-2 py-1.5 text-2xs rounded-lg font-medium text-white disabled:opacity-50 transition-colors shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${m?"bg-error hover:bg-error/90":n?"bg-success hover:bg-success/90":"bg-[var(--amber)] hover:bg-[var(--amber)]/90"}`,"aria-label":`${b} ${o}`,children:[g?(0,d.jsx)(h.A,{size:10,className:"animate-spin"}):null,!g&&n?(0,d.jsx)(x.A,{size:10}):null,!g&&m?(0,d.jsx)(y.A,{size:10}):null,o,(0,d.jsx)("span",{className:"sr-only","aria-live":"polite",children:m?f.installFailed:""})]})}function C({connected:a,detected:b,notFound:c,selectedAgentKey:e,onInstallAgent:f,listCopy:g,showNotDetected:h,setShowNotDetected:i,p:j}){return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-0 py-1.5 mb-1",children:(0,d.jsx)("span",{className:"text-2xs font-semibold text-muted-foreground/70 uppercase tracking-wider",children:j.rosterLabel})}),a.length>0&&(0,d.jsxs)("section",{className:"mb-3",children:[(0,d.jsxs)("h3",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground/80 uppercase tracking-wider mb-2 pl-0.5",children:[(0,d.jsx)("span",{className:"w-1 h-3 rounded-full bg-[var(--success)]/50","aria-hidden":"true"}),j.sectionConnected," ",(0,d.jsxs)("span",{className:"text-muted-foreground/50 tabular-nums",children:["(",a.length,")"]})]}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(A,{agent:a,agentStatus:"connected",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]}),b.length>0&&(0,d.jsxs)("section",{className:"mb-3",children:[(0,d.jsxs)("h3",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground/80 uppercase tracking-wider mb-2 pl-0.5",children:[(0,d.jsx)("span",{className:"w-1 h-3 rounded-full bg-[var(--amber)]/50","aria-hidden":"true"}),j.sectionDetected," ",(0,d.jsxs)("span",{className:"text-muted-foreground/50 tabular-nums",children:["(",b.length,")"]})]}),(0,d.jsx)("div",{className:"space-y-1.5",children:b.map(a=>(0,d.jsx)(A,{agent:a,agentStatus:"detected",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]}),c.length>0&&(0,d.jsxs)("section",{children:[(0,d.jsxs)("button",{type:"button",onClick:()=>i(!h),className:"flex items-center gap-1 text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-2 hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm pl-0.5",children:[h?(0,d.jsx)(t.A,{size:12}):(0,d.jsx)(u.A,{size:12}),j.sectionNotDetected," (",c.length,")"]}),h&&(0,d.jsx)("div",{className:"space-y-1.5",children:c.map(a=>(0,d.jsx)(A,{agent:a,agentStatus:"notFound",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]})]})}var D=c(2887);function E({active:a,maximized:b,onMaximize:c,selectedAgentKey:o=null}){let{t:p}=(0,m.Y)(),q=p.panels.agents,r=(0,k.kr)(),t=(0,f.usePathname)(),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),A=(0,l.V)(),B=async()=>{v(!0),await r.refresh(),v(!1)},E=r.agents.filter(a=>a.present&&a.installed),F=r.agents.filter(a=>a.present&&!a.installed),G=r.agents.filter(a=>!a.present),H=async a=>{let b=await r.installAgent(a);return b&&await r.refresh(),b},I=t?.startsWith("/agents/")?decodeURIComponent(t.slice(8)):null,J={installing:q.installing,install:q.install,installSuccess:q.installSuccess,installFailed:q.installFailed,retryInstall:q.retryInstall},K={navOverview:q.navOverview,navMcp:q.navMcp,navSkills:q.navSkills,navNetwork:q.navNetwork,navSessions:q.navSessions,navActivity:q.navActivity},L=(0,d.jsx)(s,{copy:K,connectedCount:E.length,mcpEnabled:r.status?.connectionMode?.mcp??!1});return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(n.A,{title:q.title,maximized:b,onMaximize:c,children:(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[!r.loading&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:[E.length," ",q.connected,A.agents.length>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",q.a2aLabel," ",A.agents.length]})]}),(0,d.jsx)("button",{onClick:B,disabled:u,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":q.refresh,title:q.refresh,type:"button",children:(0,d.jsx)(g.A,{size:12,className:u?"animate-spin":""})})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:r.loading?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.A,{size:16,className:"animate-spin text-muted-foreground"})}):0===r.agents.length&&0===r.skills.length?(0,d.jsxs)("div",{className:"flex flex-col gap-2 py-4 px-0",children:[L,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),(0,d.jsxs)("div",{className:"mx-3 rounded-lg border border-border/40 bg-card/30 px-3 py-5 text-center",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-1.5",children:q.noAgents}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/40 mb-3",children:q.skillsEmptyHint}),(0,d.jsxs)("button",{onClick:B,type:"button",className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(g.A,{size:11})," ",q.retry]})]})]}):(0,d.jsxs)("div",{className:"pb-3",children:[L,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),(0,d.jsx)("div",{className:"px-3 py-3 space-y-4",children:(0,d.jsx)(C,{connected:E,detected:F,notFound:G,selectedAgentKey:I??o,listCopy:J,onInstallAgent:H,showNotDetected:w,setShowNotDetected:x,p:{rosterLabel:q.rosterLabel,sectionConnected:q.sectionConnected,sectionDetected:q.sectionDetected,sectionNotDetected:q.sectionNotDetected}})})]})}),(0,d.jsxs)("div",{className:"px-3 py-2 border-t border-border shrink-0 space-y-1",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>z(!0),className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,d.jsx)(i.A,{size:11}),q.a2aDiscover]}),(0,d.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"mcp"}}))},className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,d.jsx)(j.A,{size:11}),q.advancedConfig]})]}),(0,d.jsx)(D.A,{open:y,onClose:()=>z(!1),onDiscover:A.discover,discovering:A.discovering,error:A.error})]})}},33191:(a,b,c)=>{"use strict";c.d(b,{IX:()=>i,KW:()=>h,O0:()=>g,cn:()=>f,vr:()=>j});var d=c(99314),e=c(96862);function f(...a){return(0,e.QP)((0,d.$)(a))}function g(a){return a.split("/").map(encodeURIComponent).join("/")}function h(a,b){let c=Date.now()-a,d=Math.floor(c/6e4),e=Math.floor(c/36e5),f=Math.floor(c/864e5);return d<1?b.justNow:d<60?b.minutesAgo(d):e<24?b.hoursAgo(e):f<7?b.daysAgo(f):new Date(a).toLocaleDateString()}function i(a){let b=a.match(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}]+/u);return b?.[0]??""}function j(a){return a.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||a}},33378:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TodoRenderer:()=>O});var d=c(48249),e=c(67484),f=c(56692),g=c(46674),h=c(75154),i=c(99941),j=c(33740),k=c(44643),l=c(24520),m=c(44218),n=c(19794),o=c(59347),p=c(13576);let q=/^##\s+(.+)/,r=/^#\s+/,s=/^#{3,6}\s+(.+)/,t=/^(\s*)- \[([ xX~])\]\s+(.*)$/,u=/`(P[012])`/,v=/`(\d{4}-\d{2}-\d{2}|\d{2}-\d{2})`/,w=/#([a-zA-Z\u4e00-\u9fff][\w\u4e00-\u9fff-]*)/g;function x(a,b){let c=[...a];return b(c),c.join("\n")}function y(a){let b=function(a){if(!a)return null;let b=new Date;return new Date(/^\d{2}-\d{2}$/.test(a)?`${b.getFullYear()}-${a}`:a)}(a);if(!b||isNaN(b.getTime()))return null;let c=new Date,d=new Date(c.getFullYear(),c.getMonth(),c.getDate()),e=(new Date(b.getFullYear(),b.getMonth(),b.getDate()).getTime()-d.getTime())/864e5;return e<0?"overdue":0===e?"today":e<=3?"soon":"future"}let z={P0:{bg:"bg-red-500/10",text:"text-red-500",border:"border-red-500/20"},P1:{bg:"bg-amber-500/10",text:"text-amber-500",border:"border-amber-500/20"},P2:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/20"}},A={overdue:{text:"text-red-500",bg:"bg-red-500/10"},today:{text:"text-amber-500",bg:"bg-amber-500/10"},soon:{text:"text-amber-400",bg:"bg-amber-400/5"},future:{text:"text-muted-foreground",bg:""}},B={TODAY:{dot:"bg-red-400",label:"text-red-400"},"This Week":{dot:"bg-orange-400",label:"text-orange-400"},Workflows:{dot:"bg-amber-400",label:"text-amber-400"},Backlog:{dot:"bg-blue-400",label:"text-blue-400"},Done:{dot:"bg-emerald-400",label:"text-emerald-400"},Maintenance:{dot:"bg-zinc-400",label:"text-zinc-400"}};function C(a,b){return a.reduce((a,c)=>a+ +(c.status===b)+C(c.children,b),0)}function D(a){return a.reduce((a,b)=>a+1+D(b.children),0)}function E({filters:a,onFilterChange:b,allTags:c,allPriorities:e,counts:h}){let i="all"!==a.priority||"all"!==a.tag||"all"!==a.status;return 0===c.length&&0===e.length?null:(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[(0,d.jsx)(f.A,{size:12,className:"text-muted-foreground shrink-0"}),(0,d.jsxs)("div",{className:"flex items-center rounded-lg border border-border overflow-hidden text-xs",children:[(0,d.jsxs)("button",{onClick:()=>b({...a,status:"all"}),className:`px-2.5 py-1 transition-colors ${"all"===a.status?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["All ",h.total]}),(0,d.jsxs)("button",{onClick:()=>b({...a,status:"todo"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"todo"===a.status?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["Todo ",h.todo]}),(0,d.jsxs)("button",{onClick:()=>b({...a,status:"in-progress"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"in-progress"===a.status?"bg-amber-500/10 text-amber-500 font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["In Progress ",h.inProgress]}),(0,d.jsxs)("button",{onClick:()=>b({...a,status:"done"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"done"===a.status?"bg-emerald-500/10 text-emerald-500 font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["Done ",h.done]})]}),e.length>0&&(0,d.jsx)("div",{className:"flex items-center gap-1",children:e.map(c=>{if(!c)return null;let e=z[c],f=a.priority===c;return(0,d.jsx)("button",{onClick:()=>b({...a,priority:f?"all":c}),className:`px-2 py-0.5 rounded text-xs font-mono font-medium border transition-colors ${f?`${e.bg} ${e.text} ${e.border}`:"border-transparent text-muted-foreground hover:bg-muted"}`,children:c},c)})}),c.length>0&&(0,d.jsx)("div",{className:"flex items-center gap-1",children:c.map(c=>{let e=a.tag===c;return(0,d.jsxs)("button",{onClick:()=>b({...a,tag:e?"all":c}),className:`px-2 py-0.5 rounded-full text-xs transition-colors ${e?"bg-[var(--amber)]/15 text-[var(--amber)]":"text-muted-foreground hover:bg-muted"}`,children:["#",c]},c)})}),i&&(0,d.jsxs)("button",{onClick:()=>b({priority:"all",tag:"all",status:"all"}),className:"flex items-center gap-1 px-2 py-0.5 rounded text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(g.A,{size:10})," Clear"]})]})}function F({priority:a}){if(!a)return null;let b=z[a];return(0,d.jsx)("span",{className:`inline-flex items-center px-1.5 py-0 rounded text-[10px] font-mono font-semibold leading-4 border shrink-0 ${b.bg} ${b.text} ${b.border}`,children:a})}function G({dateStr:a,status:b}){if(!a||"done"===b)return null;let c=y(a);if(!c)return null;let e=A[c];return(0,d.jsxs)("span",{className:`inline-flex items-center gap-0.5 px-1.5 py-0 rounded text-[10px] leading-4 shrink-0 ${e.text} ${e.bg}`,children:[(0,d.jsx)(h.A,{size:9}),a]})}function H({tag:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center px-1.5 py-0 rounded-full text-[10px] leading-4 text-muted-foreground bg-muted/60 shrink-0",children:["#",a]})}function I({status:a,onClick:b}){return(0,d.jsxs)("button",{onClick:b,className:"shrink-0 transition-colors",title:"Click to cycle status",children:["done"===a&&(0,d.jsx)(i.A,{size:15,style:{color:"var(--amber)"}}),"in-progress"===a&&(0,d.jsx)(j.A,{size:15,className:"text-amber-500 fill-amber-500/20"}),"todo"===a&&(0,d.jsx)(k.A,{size:15,style:{color:"var(--muted-foreground)"}})]})}function J({text:a,status:b,onRename:c}){let[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(a),j=(0,e.useRef)(null);function k(){let b=h.trim();b&&b!==a?c(b):i(a),g(!1)}return f?(0,d.jsx)("input",{ref:j,value:h,onChange:a=>i(a.target.value),onBlur:k,onKeyDown:b=>{"Enter"===b.key&&k(),"Escape"===b.key&&(i(a),g(!1))},className:"flex-1 bg-transparent border-b text-sm leading-relaxed outline-none min-w-0",style:{borderColor:"var(--amber)",color:"var(--foreground)"},onClick:a=>a.stopPropagation()}):(0,d.jsx)("span",{className:`flex-1 text-sm leading-relaxed cursor-text min-w-0 ${"done"===b?"line-through text-muted-foreground":"text-foreground"}`,onDoubleClick:()=>g(!0),title:"Double-click to edit",children:a})}function K({onAdd:a}){let[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(""),h=(0,e.useRef)(null);function i(){let b=f.trim();b&&a(b),g(""),c(!1)}return b?(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mt-1",children:[(0,d.jsx)("span",{className:"w-[13px] shrink-0"}),(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--muted-foreground)"},children:(0,d.jsx)(k.A,{size:15})}),(0,d.jsx)("input",{ref:h,value:f,onChange:a=>g(a.target.value),onBlur:i,onKeyDown:a=>{"Enter"===a.key&&i(),"Escape"===a.key&&(g(""),c(!1))},placeholder:"New item… (supports `P0` `03-28` #tag)",className:"flex-1 bg-transparent border-b text-sm outline-none",style:{borderColor:"var(--amber)",color:"var(--foreground)"}})]}):(0,d.jsxs)("button",{onClick:()=>c(!0),className:"flex items-center gap-1.5 w-full px-3 py-1.5 rounded-lg text-xs transition-colors hover:bg-muted/60 mt-1",style:{color:"var(--muted-foreground)"},children:[(0,d.jsx)(l.A,{size:12}),(0,d.jsx)("span",{children:"Add item"})]})}function L(a,b){return("all"===b.status||a.status===b.status)&&("all"===b.priority||a.meta.priority===b.priority)&&("all"===b.tag||!!a.meta.tags.includes(b.tag))}function M({item:a,depth:b,filters:c,onCycleStatus:f,onRename:g,onDelete:h}){let[i,j]=(0,e.useState)(!0),k=a.children.length>0,l=L(a,c),p=a.children.some(a=>(function a(b,c){return!!L(b,c)||b.children.some(b=>a(b,c))})(a,c));if(("all"!==c.status||"all"!==c.priority||"all"!==c.tag)&&!l&&!p)return null;let q=y(a.meta.dueDate);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:`group flex items-center gap-2 py-1.5 px-2 rounded-lg transition-colors hover:bg-muted/60 ${"done"===a.status?"opacity-45":""} ${"overdue"===q&&"done"!==a.status?"bg-red-500/[0.03]":""}`,style:{paddingLeft:`${8+20*b}px`},children:[k?(0,d.jsx)("button",{onClick:()=>j(a=>!a),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:i?(0,d.jsx)(m.A,{size:13}):(0,d.jsx)(n.A,{size:13})}):(0,d.jsx)("span",{className:"w-[13px] shrink-0"}),(0,d.jsx)(I,{status:a.status,onClick:()=>{var b;return f(a.lineIndex,"todo"===(b=a.status)?"in-progress":"in-progress"===b?"done":"todo")}}),(0,d.jsx)(J,{text:a.text,status:a.status,onRename:b=>g(a.lineIndex,b)}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)(F,{priority:a.meta.priority}),(0,d.jsx)(G,{dateStr:a.meta.dueDate,status:a.status}),a.meta.tags.map(a=>(0,d.jsx)(H,{tag:a},a))]}),(0,d.jsx)("button",{onClick:()=>h(a.lineIndex),className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},title:"Delete item",children:(0,d.jsx)(o.A,{size:12})})]}),k&&i&&(0,d.jsx)("div",{children:a.children.map(a=>(0,d.jsx)(M,{item:a,depth:b+1,filters:c,onCycleStatus:f,onRename:g,onDelete:h},a.id))})]})}function N({name:a,meta:b,filters:c,defaultCollapsed:f,onCycleStatus:g,onRename:h,onDelete:i,onAdd:j}){let k,[l,o]=(0,e.useState)(f??!1),q=(k=Object.keys(B).find(b=>a.includes(b)))?B[k]:{dot:"bg-zinc-500",label:"text-zinc-400"},{items:r,lastLineIndex:s}=b,t=C(r,"done"),u=C(r,"in-progress"),v=D(r),w=a.includes("Done");return(0,d.jsxs)("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[(0,d.jsxs)("button",{onClick:()=>o(a=>!a),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-muted/40 transition-colors",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${q.dot}`}),(0,d.jsx)("span",{className:`text-xs font-semibold uppercase tracking-wider ${q.label} font-display`,children:a}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[t,"/",v]}),u>0&&(0,d.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-amber-500",children:[(0,d.jsx)(p.A,{size:9})," ",u]})]}),l?(0,d.jsx)(n.A,{size:14,className:"text-muted-foreground"}):(0,d.jsx)(m.A,{size:14,className:"text-muted-foreground"})]}),(0,d.jsx)("div",{className:"h-0.5 bg-muted mx-4",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:v?`${t/v*100}%`:"0%",background:w?"var(--success, #22c55e)":"var(--amber)"}})}),!l&&(0,d.jsxs)("div",{className:"px-2 py-2",children:[r.map(a=>(0,d.jsx)(M,{item:a,depth:0,filters:c,onCycleStatus:g,onRename:h,onDelete:i},a.id)),0===r.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground px-4 py-2",children:"No items"}),!w&&(0,d.jsx)(K,{onAdd:a=>j(s,a)})]})]})}function O({content:a,saveAction:b}){let[c,f]=(0,e.useState)(a),[g,h]=(0,e.useState)({priority:"all",tag:"all",status:"all"}),{sections:i,lines:k,sectionOrder:l}=(0,e.useMemo)(()=>{let a,b,d,e,f,g,h;return a=c.split("\n"),b="General",d={},e=[],f=[],g=!1,h=!1,a.forEach((a,c)=>{if(!h){if(0===c&&"---"===a.trim()){g=!0;return}if(g){"---"===a.trim()&&(g=!1,h=!0);return}h=!0}if(r.test(a))return;let i=a.match(q);if(i){d[b=i[1].replace(/^[^\w\s\u4e00-\u9fff]+\s*/,"").trim()]||(d[b]={items:[],lastLineIndex:-1,headingLineIndex:c},e.push(b));return}if(s.test(a))return;let j=a.match(t);if(!j)return;let[,k,l,m]=j,n=Math.floor(k.length/2),o="~"===l?"in-progress":"x"===l.toLowerCase()?"done":"todo",{cleanText:p,meta:x}=function(a){let b,c=a,d=null,e=null,f=[],g=c.match(u);g&&(d=g[1],c=c.replace(u,"").trim());let h=c.match(v);h&&(e=h[1],c=c.replace(v,"").trim());let i=RegExp(w.source,"g");for(;null!==(b=i.exec(c));)f.push(b[1]);return f.length>0&&(c=c.replace(/#[a-zA-Z\u4e00-\u9fff][\w\u4e00-\u9fff-]*/g,"").trim()),{cleanText:c=c.replace(/\*\*(.*?)\*\*/g,"$1").trim(),meta:{priority:d,dueDate:e,tags:f}}}(m),y={id:`${c}`,text:p,rawText:m,status:o,indent:n,lineIndex:c,section:b,children:[],meta:x};for(;f.length>0&&f[f.length-1].indent>=n;)f.pop();d[b]||(d[b]={items:[],lastLineIndex:-1,headingLineIndex:-1},e.push(b)),f.length>0?f[f.length-1].children.push(y):d[b].items.push(y),d[b].lastLineIndex=Math.max(d[b].lastLineIndex,c),f.push(y)}),{sections:d,lines:a,sectionOrder:e}},[c]),m=(0,e.useMemo)(()=>Object.values(i).reduce((a,b)=>a+C(b.items,"done"),0),[i]),n=(0,e.useMemo)(()=>Object.values(i).reduce((a,b)=>a+C(b.items,"in-progress"),0),[i]),o=(0,e.useMemo)(()=>Object.values(i).reduce((a,b)=>a+D(b.items),0),[i]),p=o-m-n,y=(0,e.useMemo)(()=>(function(a){let b=new Set;for(let c of Object.values(a))!function a(c){for(let d of c){for(let a of d.meta.tags)b.add(a);a(d.children)}}(c.items);return[...b].sort()})(i),[i]),z=(0,e.useMemo)(()=>(function(a){let b=new Set;for(let c of Object.values(a))!function a(c){for(let d of c)d.meta.priority&&b.add(d.meta.priority),a(d.children)}(c.items);return["P0","P1","P2"].filter(a=>b.has(a))})(i),[i]),A=(0,e.useCallback)(async a=>{f(a),await b(a)},[b]),B=(0,e.useCallback)(async(a,b)=>{await A(x(k,c=>{c[a]=c[a].replace(/- \[[ xX~]\]/,`- [${"done"===b?"x":"in-progress"===b?"~":" "}]`)}))},[k,A]),F=(0,e.useCallback)(async(a,b)=>{await A(x(k,c=>{c[a]=c[a].replace(/(- \[[ xX~]\]\s*)(.*)$/,`$1${b}`)}))},[k,A]),G=(0,e.useCallback)(async a=>{await A(x(k,b=>{b.splice(a,1)}))},[k,A]),H=(0,e.useCallback)(async(a,b)=>{await A(x(k,c=>{let d=a<0?c.length:a+1;c.splice(d,0,`- [ ] ${b}`)}))},[k,A]),I=l.filter(a=>i[a]).map(a=>[a,i[a]]),J=o?Math.round(m/o*100):0;return(0,d.jsxs)("div",{className:"max-w-[900px] mx-auto xl:mr-[220px] px-0 py-2",children:[(0,d.jsx)("div",{className:"mb-5 flex items-center gap-4",children:(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsxs)("span",{className:"text-lg font-semibold font-display text-foreground tabular-nums",children:[J,"%"]}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground font-display",children:[m,"/",o," completed"]}),n>0&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs text-amber-500",children:[(0,d.jsx)(j.A,{size:8,className:"fill-amber-500/30"}),n," in progress"]})]}),(0,d.jsx)("div",{className:"mt-2 w-full max-w-xs h-1.5 bg-muted rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${J}%`,background:"var(--amber)"}})})]})}),(0,d.jsx)(E,{filters:g,onFilterChange:h,allTags:y,allPriorities:z,counts:{todo:p,inProgress:n,done:m,total:o}}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[I.map(([a,b])=>(0,d.jsx)(N,{name:a,meta:b,filters:g,defaultCollapsed:a.includes("Done"),onCycleStatus:B,onRename:F,onDelete:G,onAdd:H},a)),0===I.length&&(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"No TODO items found in this file."})]})]})}},33627:(a,b,c)=>{Promise.resolve().then(c.bind(c,85034))},33827:(a,b,c)=>{"use strict";c.d(b,{A:()=>q});var d=c(48249),e=c(67484),f=c(74429),g=c(80600),h=c(19226),i=c(33407),j=c(95801),k=c(65255),l=c(65032),m=c(83654),n=c(46674);let o={kb:{icon:g.A,cls:"text-muted-foreground"},upload:{icon:h.A,cls:"text-muted-foreground"},image:{icon:i.A,cls:"text-muted-foreground"},skill:{icon:j.A,cls:"text-[var(--amber)]"},agent:{icon:k.A,cls:"text-muted-foreground"}},p={kb:"border-border bg-muted text-foreground",upload:"border-border bg-muted text-foreground",image:"border-border bg-muted text-foreground",skill:"border-[var(--amber)]/25 bg-[var(--amber)]/10 text-foreground",agent:"border-[var(--amber)]/25 bg-[var(--amber)]/10 text-foreground"};function q({path:a,onRemove:b,variant:c="kb",imageData:g,imageMime:h}){let[i,j]=(0,e.useState)(!1),[k,q]=(0,e.useState)(!1),r=(0,e.useRef)(null),[s,t]=(0,e.useState)(null),u="kb"===c&&a.endsWith("/"),v=u?a.slice(0,-1):a,w=v.split("/").pop()??v,x="kb"===c&&!u&&w.endsWith(".csv"),{icon:y,cls:z}=u?{icon:l.A,cls:"text-yellow-400"}:x?{icon:m.A,cls:"text-success"}:o[c],A=p[c],B=i&&s&&g&&h?(0,d.jsx)("div",{className:"fixed z-50 p-1 rounded-lg border border-border bg-card shadow-lg pointer-events-none",style:{left:s.left,bottom:window.innerHeight-s.top},children:(0,d.jsx)("img",{src:`data:${h};base64,${g}`,alt:w,className:"max-h-48 max-w-64 rounded object-contain"})}):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{ref:r,className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs border max-w-[220px] ${A}`,onMouseEnter:()=>g&&j(!0),onMouseLeave:()=>j(!1),children:[(0,d.jsx)(y,{size:11,className:`${z} shrink-0`}),(0,d.jsx)("span",{className:"truncate",title:u?v:a,children:w}),(0,d.jsx)("button",{type:"button",onClick:b,"aria-label":`Remove ${w}`,className:"p-0.5 -mr-1 rounded hover:text-foreground transition-colors shrink-0 text-muted-foreground",children:(0,d.jsx)(n.A,{size:10})})]}),k&&B&&(0,f.createPortal)(B,document.body)]})}},33923:(a,b,c)=>{"use strict";var d=c(29974);let e=new Set(["mp3","wav","m4a","ogg","flac","aac"]),f=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),g=new Set(["mp4","webm","mov","mkv"]);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:"audio",name:"Audio Player",description:"Plays audio files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFB5",tags:["audio","music","voice","mp3","wav"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>e.has(a),load:()=>Promise.resolve().then(c.bind(c,30488)).then(a=>({default:a.AudioRenderer}))},{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:"image",name:"Image Viewer",description:"Renders image files with zoom, fit-to-view, and transparency support.",author:"MindOS",icon:"\uD83D\uDDBC",tags:["image","photo","viewer","png","jpg","svg"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>f.has(a),load:()=>Promise.resolve().then(c.bind(c,47336)).then(a=>({default:a.ImageRenderer}))},{id:"pdf",name:"PDF Viewer",description:"Renders PDF files using the browser built-in PDF viewer.",author:"MindOS",icon:"\uD83D\uDCC4",tags:["pdf","document","viewer"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>"pdf"===a,load:()=>Promise.resolve().then(c.bind(c,21416)).then(a=>({default:a.PdfRenderer}))},{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:"video",name:"Video Player",description:"Plays video files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFAC",tags:["video","movie","recording","mp4","webm"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>g.has(a),load:()=>Promise.resolve().then(c.bind(c,63956)).then(a=>({default:a.VideoRenderer}))},{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)},36161:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},36312:(a,b,c)=>{"use strict";c.d(b,{TS:()=>e,ow:()=>f});let d=[];function e(a){d.find(b=>b.id===a.id)||d.push(a)}function f(){return d}},37718:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GraphRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call GraphRenderer() from the server but GraphRenderer 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/graph/GraphRenderer.tsx","GraphRenderer")},38957:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>n,bA:()=>l});var d=c(48249),e=c(67484),f=c(74429),g=c(22341),h=c(6079),i=c(42742),j=c(44218),k=c(47223);function l(){return"agent"}let m=["agent","chat"];function n({mode:a,onChange:b,disabled:c}){let{t:l}=(0,k.Y)(),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(null),r=(0,e.useRef)(null),s=(0,e.useRef)(null);(0,e.useCallback)(()=>{if(!r.current)return;let a=r.current.getBoundingClientRect(),b=a.top,c=b>window.innerHeight-a.bottom&&b>120?"up":"down";q({left:a.left,top:"up"===c?a.top-6:a.bottom+6,direction:c})},[]);let t=(0,e.useCallback)(a=>{b(a);try{localStorage.setItem("mindos-ask-mode",a)}catch{}o(!1)},[b]),u="chat"===a,v=(a,b)=>"chat"===a?(0,d.jsx)(g.A,{size:b,className:"shrink-0"}):(0,d.jsx)(h.A,{size:b,className:"shrink-0"}),w=a=>"chat"===a?l.ask.modeChat:l.ask.modeAgent,x=a=>"chat"===a?l.ask.modeChatHint:l.ask.modeAgentHint,y=n&&p?(0,d.jsx)("div",{ref:s,role:"listbox","aria-label":"Select mode",className:"fixed z-50 min-w-[200px] max-w-[260px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:p.left,..."up"===p.direction?{bottom:window.innerHeight-p.top}:{top:p.top}},children:m.map(b=>{let c=a===b;return(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":c,onClick:()=>t(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,d.jsx)("span",{className:"text-muted-foreground",children:v(b,13)}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"font-medium",children:w(b)}),(0,d.jsx)("div",{className:"text-2xs text-muted-foreground mt-0.5",children:x(b)})]}),c&&(0,d.jsx)(i.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]},b)})}):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{ref:r,type:"button",onClick:()=>{c||o(a=>!a)},disabled:c,className:`
64
+ `,children:[(0,d.jsxs)(w(),{href:e,className:"flex flex-1 min-w-0 items-center gap-2.5 text-left rounded-xl pl-2.5 pr-2 py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(z.lx,{name:a.name,status:b,size:"sm"}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate leading-tight",children:a.name}),"connected"===b&&a.transport&&(0,d.jsx)("span",{className:"text-2xs font-mono tabular-nums px-1.5 py-0.5 rounded-md bg-muted/90 text-muted-foreground shrink-0 border border-border/50",children:a.transport}),h&&(0,d.jsx)("span",{title:j,className:"shrink-0 text-muted-foreground/70",children:(0,d.jsx)(i.A,{size:12})}),(0,d.jsx)("span",{className:"flex-1 min-w-[4px]"}),(0,d.jsx)(u.A,{size:15,className:`shrink-0 transition-opacity duration-150 ${c?"text-[var(--amber)] opacity-90":"text-muted-foreground/45 group-hover:text-muted-foreground/80"}`,"aria-hidden":!0})]}),"detected"===b&&(0,d.jsx)("div",{className:"pr-2 py-2 shrink-0",children:(0,d.jsx)(B,{agentKey:a.key,agentName:a.name,onInstallAgent:f,copy:g})})]})}function B({agentKey:a,agentName:b,onInstallAgent:c,copy:f}){let[g,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("idle"),l=async b=>{if(b.stopPropagation(),g)return;i(!0),k("idle");let d=await c(a);i(!1),k(d?"success":"error")},m="error"===j,n="success"===j,o=g?f.installing:n?f.installSuccess:m?f.retryInstall:f.install;return(0,d.jsxs)("button",{type:"button",onClick:l,disabled:g,className:`flex items-center gap-1 px-2 py-1.5 text-2xs rounded-lg font-medium text-white disabled:opacity-50 transition-colors shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${m?"bg-error hover:bg-error/90":n?"bg-success hover:bg-success/90":"bg-[var(--amber)] hover:bg-[var(--amber)]/90"}`,"aria-label":`${b} ${o}`,children:[g?(0,d.jsx)(h.A,{size:10,className:"animate-spin"}):null,!g&&n?(0,d.jsx)(x.A,{size:10}):null,!g&&m?(0,d.jsx)(y.A,{size:10}):null,o,(0,d.jsx)("span",{className:"sr-only","aria-live":"polite",children:m?f.installFailed:""})]})}function C({connected:a,detected:b,notFound:c,selectedAgentKey:e,onInstallAgent:f,listCopy:g,showNotDetected:h,setShowNotDetected:i,p:j}){return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-0 py-1.5 mb-1",children:(0,d.jsx)("span",{className:"text-2xs font-semibold text-muted-foreground/70 uppercase tracking-wider",children:j.rosterLabel})}),a.length>0&&(0,d.jsxs)("section",{className:"mb-3",children:[(0,d.jsxs)("h3",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground/80 uppercase tracking-wider mb-2 pl-0.5",children:[(0,d.jsx)("span",{className:"w-1 h-3 rounded-full bg-[var(--success)]/50","aria-hidden":"true"}),j.sectionConnected," ",(0,d.jsxs)("span",{className:"text-muted-foreground/50 tabular-nums",children:["(",a.length,")"]})]}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(A,{agent:a,agentStatus:"connected",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]}),b.length>0&&(0,d.jsxs)("section",{className:"mb-3",children:[(0,d.jsxs)("h3",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground/80 uppercase tracking-wider mb-2 pl-0.5",children:[(0,d.jsx)("span",{className:"w-1 h-3 rounded-full bg-[var(--amber)]/50","aria-hidden":"true"}),j.sectionDetected," ",(0,d.jsxs)("span",{className:"text-muted-foreground/50 tabular-nums",children:["(",b.length,")"]})]}),(0,d.jsx)("div",{className:"space-y-1.5",children:b.map(a=>(0,d.jsx)(A,{agent:a,agentStatus:"detected",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]}),c.length>0&&(0,d.jsxs)("section",{children:[(0,d.jsxs)("button",{type:"button",onClick:()=>i(!h),className:"flex items-center gap-1 text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-2 hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm pl-0.5",children:[h?(0,d.jsx)(t.A,{size:12}):(0,d.jsx)(u.A,{size:12}),j.sectionNotDetected," (",c.length,")"]}),h&&(0,d.jsx)("div",{className:"space-y-1.5",children:c.map(a=>(0,d.jsx)(A,{agent:a,agentStatus:"notFound",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]})]})}var D=c(2887);function E({active:a,maximized:b,onMaximize:c,selectedAgentKey:o=null}){let{t:p}=(0,m.Y)(),q=p.panels.agents,r=(0,k.kr)(),t=(0,f.usePathname)(),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),A=(0,l.V)(),B=async()=>{v(!0),await r.refresh(),v(!1)},E=r.agents.filter(a=>a.present&&a.installed),F=r.agents.filter(a=>a.present&&!a.installed),G=r.agents.filter(a=>!a.present),H=async a=>{let b=await r.installAgent(a);return b&&await r.refresh(),b},I=t?.startsWith("/agents/")?decodeURIComponent(t.slice(8)):null,J={installing:q.installing,install:q.install,installSuccess:q.installSuccess,installFailed:q.installFailed,retryInstall:q.retryInstall},K={navOverview:q.navOverview,navMcp:q.navMcp,navSkills:q.navSkills,navNetwork:q.navNetwork,navSessions:q.navSessions,navActivity:q.navActivity},L=(0,d.jsx)(s,{copy:K,connectedCount:E.length,mcpEnabled:r.status?.connectionMode?.mcp??!1});return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(n.A,{title:q.title,maximized:b,onMaximize:c,children:(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[!r.loading&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:[E.length," ",q.connected,A.agents.length>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",q.a2aLabel," ",A.agents.length]})]}),(0,d.jsx)("button",{onClick:B,disabled:u,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":q.refresh,title:q.refresh,type:"button",children:(0,d.jsx)(g.A,{size:12,className:u?"animate-spin":""})})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:r.loading?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.A,{size:16,className:"animate-spin text-muted-foreground"})}):0===r.agents.length&&0===r.skills.length?(0,d.jsxs)("div",{className:"flex flex-col gap-2 py-4 px-0",children:[L,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),(0,d.jsxs)("div",{className:"mx-3 rounded-lg border border-border/40 bg-card/30 px-3 py-5 text-center",children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-1.5",children:q.noAgents}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/40 mb-3",children:q.skillsEmptyHint}),(0,d.jsxs)("button",{onClick:B,type:"button",className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(g.A,{size:11})," ",q.retry]})]})]}):(0,d.jsxs)("div",{className:"pb-3",children:[L,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),(0,d.jsx)("div",{className:"px-3 py-3 space-y-4",children:(0,d.jsx)(C,{connected:E,detected:F,notFound:G,selectedAgentKey:I??o,listCopy:J,onInstallAgent:H,showNotDetected:w,setShowNotDetected:x,p:{rosterLabel:q.rosterLabel,sectionConnected:q.sectionConnected,sectionDetected:q.sectionDetected,sectionNotDetected:q.sectionNotDetected}})})]})}),(0,d.jsxs)("div",{className:"px-3 py-2 border-t border-border shrink-0 space-y-1",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>z(!0),className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,d.jsx)(i.A,{size:11}),q.a2aDiscover]}),(0,d.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"mcp"}}))},className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,d.jsx)(j.A,{size:11}),q.advancedConfig]})]}),(0,d.jsx)(D.A,{open:y,onClose:()=>z(!1),onDiscover:A.discover,discovering:A.discovering,error:A.error})]})}},33191:(a,b,c)=>{"use strict";c.d(b,{IX:()=>i,KW:()=>h,O0:()=>g,cn:()=>f,vr:()=>j});var d=c(99314),e=c(96862);function f(...a){return(0,e.QP)((0,d.$)(a))}function g(a){return a.split("/").map(encodeURIComponent).join("/")}function h(a,b){let c=Date.now()-a,d=Math.floor(c/6e4),e=Math.floor(c/36e5),f=Math.floor(c/864e5);return d<1?b.justNow:d<60?b.minutesAgo(d):e<24?b.hoursAgo(e):f<7?b.daysAgo(f):new Date(a).toLocaleDateString()}function i(a){let b=a.match(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}]+/u);return b?.[0]??""}function j(a){return a.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||a}},33378:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TodoRenderer:()=>O});var d=c(48249),e=c(67484),f=c(56692),g=c(46674),h=c(75154),i=c(99941),j=c(33740),k=c(44643),l=c(24520),m=c(44218),n=c(19794),o=c(59347),p=c(13576);let q=/^##\s+(.+)/,r=/^#\s+/,s=/^#{3,6}\s+(.+)/,t=/^(\s*)- \[([ xX~])\]\s+(.*)$/,u=/`(P[012])`/,v=/`(\d{4}-\d{2}-\d{2}|\d{2}-\d{2})`/,w=/#([a-zA-Z\u4e00-\u9fff][\w\u4e00-\u9fff-]*)/g;function x(a,b){let c=[...a];return b(c),c.join("\n")}function y(a){let b=function(a){if(!a)return null;let b=new Date;return new Date(/^\d{2}-\d{2}$/.test(a)?`${b.getFullYear()}-${a}`:a)}(a);if(!b||isNaN(b.getTime()))return null;let c=new Date,d=new Date(c.getFullYear(),c.getMonth(),c.getDate()),e=(new Date(b.getFullYear(),b.getMonth(),b.getDate()).getTime()-d.getTime())/864e5;return e<0?"overdue":0===e?"today":e<=3?"soon":"future"}let z={P0:{bg:"bg-red-500/10",text:"text-red-500",border:"border-red-500/20"},P1:{bg:"bg-amber-500/10",text:"text-amber-500",border:"border-amber-500/20"},P2:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/20"}},A={overdue:{text:"text-red-500",bg:"bg-red-500/10"},today:{text:"text-amber-500",bg:"bg-amber-500/10"},soon:{text:"text-amber-400",bg:"bg-amber-400/5"},future:{text:"text-muted-foreground",bg:""}},B={TODAY:{dot:"bg-red-400",label:"text-red-400"},"This Week":{dot:"bg-orange-400",label:"text-orange-400"},Workflows:{dot:"bg-amber-400",label:"text-amber-400"},Backlog:{dot:"bg-blue-400",label:"text-blue-400"},Done:{dot:"bg-emerald-400",label:"text-emerald-400"},Maintenance:{dot:"bg-zinc-400",label:"text-zinc-400"}};function C(a,b){return a.reduce((a,c)=>a+ +(c.status===b)+C(c.children,b),0)}function D(a){return a.reduce((a,b)=>a+1+D(b.children),0)}function E({filters:a,onFilterChange:b,allTags:c,allPriorities:e,counts:h}){let i="all"!==a.priority||"all"!==a.tag||"all"!==a.status;return 0===c.length&&0===e.length?null:(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[(0,d.jsx)(f.A,{size:12,className:"text-muted-foreground shrink-0"}),(0,d.jsxs)("div",{className:"flex items-center rounded-lg border border-border overflow-hidden text-xs",children:[(0,d.jsxs)("button",{onClick:()=>b({...a,status:"all"}),className:`px-2.5 py-1 transition-colors ${"all"===a.status?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["All ",h.total]}),(0,d.jsxs)("button",{onClick:()=>b({...a,status:"todo"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"todo"===a.status?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["Todo ",h.todo]}),(0,d.jsxs)("button",{onClick:()=>b({...a,status:"in-progress"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"in-progress"===a.status?"bg-amber-500/10 text-amber-500 font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["In Progress ",h.inProgress]}),(0,d.jsxs)("button",{onClick:()=>b({...a,status:"done"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"done"===a.status?"bg-emerald-500/10 text-emerald-500 font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["Done ",h.done]})]}),e.length>0&&(0,d.jsx)("div",{className:"flex items-center gap-1",children:e.map(c=>{if(!c)return null;let e=z[c],f=a.priority===c;return(0,d.jsx)("button",{onClick:()=>b({...a,priority:f?"all":c}),className:`px-2 py-0.5 rounded text-xs font-mono font-medium border transition-colors ${f?`${e.bg} ${e.text} ${e.border}`:"border-transparent text-muted-foreground hover:bg-muted"}`,children:c},c)})}),c.length>0&&(0,d.jsx)("div",{className:"flex items-center gap-1",children:c.map(c=>{let e=a.tag===c;return(0,d.jsxs)("button",{onClick:()=>b({...a,tag:e?"all":c}),className:`px-2 py-0.5 rounded-full text-xs transition-colors ${e?"bg-[var(--amber)]/15 text-[var(--amber)]":"text-muted-foreground hover:bg-muted"}`,children:["#",c]},c)})}),i&&(0,d.jsxs)("button",{onClick:()=>b({priority:"all",tag:"all",status:"all"}),className:"flex items-center gap-1 px-2 py-0.5 rounded text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,d.jsx)(g.A,{size:10})," Clear"]})]})}function F({priority:a}){if(!a)return null;let b=z[a];return(0,d.jsx)("span",{className:`inline-flex items-center px-1.5 py-0 rounded text-[10px] font-mono font-semibold leading-4 border shrink-0 ${b.bg} ${b.text} ${b.border}`,children:a})}function G({dateStr:a,status:b}){if(!a||"done"===b)return null;let c=y(a);if(!c)return null;let e=A[c];return(0,d.jsxs)("span",{className:`inline-flex items-center gap-0.5 px-1.5 py-0 rounded text-[10px] leading-4 shrink-0 ${e.text} ${e.bg}`,children:[(0,d.jsx)(h.A,{size:9}),a]})}function H({tag:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center px-1.5 py-0 rounded-full text-[10px] leading-4 text-muted-foreground bg-muted/60 shrink-0",children:["#",a]})}function I({status:a,onClick:b}){return(0,d.jsxs)("button",{onClick:b,className:"shrink-0 transition-colors",title:"Click to cycle status",children:["done"===a&&(0,d.jsx)(i.A,{size:15,style:{color:"var(--amber)"}}),"in-progress"===a&&(0,d.jsx)(j.A,{size:15,className:"text-amber-500 fill-amber-500/20"}),"todo"===a&&(0,d.jsx)(k.A,{size:15,style:{color:"var(--muted-foreground)"}})]})}function J({text:a,status:b,onRename:c}){let[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(a),j=(0,e.useRef)(null);function k(){let b=h.trim();b&&b!==a?c(b):i(a),g(!1)}return f?(0,d.jsx)("input",{ref:j,value:h,onChange:a=>i(a.target.value),onBlur:k,onKeyDown:b=>{"Enter"===b.key&&k(),"Escape"===b.key&&(i(a),g(!1))},className:"flex-1 bg-transparent border-b text-sm leading-relaxed outline-none min-w-0",style:{borderColor:"var(--amber)",color:"var(--foreground)"},onClick:a=>a.stopPropagation()}):(0,d.jsx)("span",{className:`flex-1 text-sm leading-relaxed cursor-text min-w-0 ${"done"===b?"line-through text-muted-foreground":"text-foreground"}`,onDoubleClick:()=>g(!0),title:"Double-click to edit",children:a})}function K({onAdd:a}){let[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(""),h=(0,e.useRef)(null);function i(){let b=f.trim();b&&a(b),g(""),c(!1)}return b?(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mt-1",children:[(0,d.jsx)("span",{className:"w-[13px] shrink-0"}),(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--muted-foreground)"},children:(0,d.jsx)(k.A,{size:15})}),(0,d.jsx)("input",{ref:h,value:f,onChange:a=>g(a.target.value),onBlur:i,onKeyDown:a=>{"Enter"===a.key&&i(),"Escape"===a.key&&(g(""),c(!1))},placeholder:"New item… (supports `P0` `03-28` #tag)",className:"flex-1 bg-transparent border-b text-sm outline-none",style:{borderColor:"var(--amber)",color:"var(--foreground)"}})]}):(0,d.jsxs)("button",{onClick:()=>c(!0),className:"flex items-center gap-1.5 w-full px-3 py-1.5 rounded-lg text-xs transition-colors hover:bg-muted/60 mt-1",style:{color:"var(--muted-foreground)"},children:[(0,d.jsx)(l.A,{size:12}),(0,d.jsx)("span",{children:"Add item"})]})}function L(a,b){return("all"===b.status||a.status===b.status)&&("all"===b.priority||a.meta.priority===b.priority)&&("all"===b.tag||!!a.meta.tags.includes(b.tag))}function M({item:a,depth:b,filters:c,onCycleStatus:f,onRename:g,onDelete:h}){let[i,j]=(0,e.useState)(!0),k=a.children.length>0,l=L(a,c),p=a.children.some(a=>(function a(b,c){return!!L(b,c)||b.children.some(b=>a(b,c))})(a,c));if(("all"!==c.status||"all"!==c.priority||"all"!==c.tag)&&!l&&!p)return null;let q=y(a.meta.dueDate);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:`group flex items-center gap-2 py-1.5 px-2 rounded-lg transition-colors hover:bg-muted/60 ${"done"===a.status?"opacity-45":""} ${"overdue"===q&&"done"!==a.status?"bg-red-500/[0.03]":""}`,style:{paddingLeft:`${8+20*b}px`},children:[k?(0,d.jsx)("button",{onClick:()=>j(a=>!a),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:i?(0,d.jsx)(m.A,{size:13}):(0,d.jsx)(n.A,{size:13})}):(0,d.jsx)("span",{className:"w-[13px] shrink-0"}),(0,d.jsx)(I,{status:a.status,onClick:()=>{var b;return f(a.lineIndex,"todo"===(b=a.status)?"in-progress":"in-progress"===b?"done":"todo")}}),(0,d.jsx)(J,{text:a.text,status:a.status,onRename:b=>g(a.lineIndex,b)}),(0,d.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,d.jsx)(F,{priority:a.meta.priority}),(0,d.jsx)(G,{dateStr:a.meta.dueDate,status:a.status}),a.meta.tags.map(a=>(0,d.jsx)(H,{tag:a},a))]}),(0,d.jsx)("button",{onClick:()=>h(a.lineIndex),className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},title:"Delete item",children:(0,d.jsx)(o.A,{size:12})})]}),k&&i&&(0,d.jsx)("div",{children:a.children.map(a=>(0,d.jsx)(M,{item:a,depth:b+1,filters:c,onCycleStatus:f,onRename:g,onDelete:h},a.id))})]})}function N({name:a,meta:b,filters:c,defaultCollapsed:f,onCycleStatus:g,onRename:h,onDelete:i,onAdd:j}){let k,[l,o]=(0,e.useState)(f??!1),q=(k=Object.keys(B).find(b=>a.includes(b)))?B[k]:{dot:"bg-zinc-500",label:"text-zinc-400"},{items:r,lastLineIndex:s}=b,t=C(r,"done"),u=C(r,"in-progress"),v=D(r),w=a.includes("Done");return(0,d.jsxs)("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[(0,d.jsxs)("button",{onClick:()=>o(a=>!a),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-muted/40 transition-colors",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${q.dot}`}),(0,d.jsx)("span",{className:`text-xs font-semibold uppercase tracking-wider ${q.label} font-display`,children:a}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[t,"/",v]}),u>0&&(0,d.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-amber-500",children:[(0,d.jsx)(p.A,{size:9})," ",u]})]}),l?(0,d.jsx)(n.A,{size:14,className:"text-muted-foreground"}):(0,d.jsx)(m.A,{size:14,className:"text-muted-foreground"})]}),(0,d.jsx)("div",{className:"h-0.5 bg-muted mx-4",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:v?`${t/v*100}%`:"0%",background:w?"var(--success, #22c55e)":"var(--amber)"}})}),!l&&(0,d.jsxs)("div",{className:"px-2 py-2",children:[r.map(a=>(0,d.jsx)(M,{item:a,depth:0,filters:c,onCycleStatus:g,onRename:h,onDelete:i},a.id)),0===r.length&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground px-4 py-2",children:"No items"}),!w&&(0,d.jsx)(K,{onAdd:a=>j(s,a)})]})]})}function O({content:a,saveAction:b}){let[c,f]=(0,e.useState)(a),[g,h]=(0,e.useState)({priority:"all",tag:"all",status:"all"}),{sections:i,lines:k,sectionOrder:l}=(0,e.useMemo)(()=>{let a,b,d,e,f,g,h;return a=c.split("\n"),b="General",d={},e=[],f=[],g=!1,h=!1,a.forEach((a,c)=>{if(!h){if(0===c&&"---"===a.trim()){g=!0;return}if(g){"---"===a.trim()&&(g=!1,h=!0);return}h=!0}if(r.test(a))return;let i=a.match(q);if(i){d[b=i[1].replace(/^[^\w\s\u4e00-\u9fff]+\s*/,"").trim()]||(d[b]={items:[],lastLineIndex:-1,headingLineIndex:c},e.push(b));return}if(s.test(a))return;let j=a.match(t);if(!j)return;let[,k,l,m]=j,n=Math.floor(k.length/2),o="~"===l?"in-progress":"x"===l.toLowerCase()?"done":"todo",{cleanText:p,meta:x}=function(a){let b,c=a,d=null,e=null,f=[],g=c.match(u);g&&(d=g[1],c=c.replace(u,"").trim());let h=c.match(v);h&&(e=h[1],c=c.replace(v,"").trim());let i=RegExp(w.source,"g");for(;null!==(b=i.exec(c));)f.push(b[1]);return f.length>0&&(c=c.replace(/#[a-zA-Z\u4e00-\u9fff][\w\u4e00-\u9fff-]*/g,"").trim()),{cleanText:c=c.replace(/\*\*(.*?)\*\*/g,"$1").trim(),meta:{priority:d,dueDate:e,tags:f}}}(m),y={id:`${c}`,text:p,rawText:m,status:o,indent:n,lineIndex:c,section:b,children:[],meta:x};for(;f.length>0&&f[f.length-1].indent>=n;)f.pop();d[b]||(d[b]={items:[],lastLineIndex:-1,headingLineIndex:-1},e.push(b)),f.length>0?f[f.length-1].children.push(y):d[b].items.push(y),d[b].lastLineIndex=Math.max(d[b].lastLineIndex,c),f.push(y)}),{sections:d,lines:a,sectionOrder:e}},[c]),m=(0,e.useMemo)(()=>Object.values(i).reduce((a,b)=>a+C(b.items,"done"),0),[i]),n=(0,e.useMemo)(()=>Object.values(i).reduce((a,b)=>a+C(b.items,"in-progress"),0),[i]),o=(0,e.useMemo)(()=>Object.values(i).reduce((a,b)=>a+D(b.items),0),[i]),p=o-m-n,y=(0,e.useMemo)(()=>(function(a){let b=new Set;for(let c of Object.values(a))!function a(c){for(let d of c){for(let a of d.meta.tags)b.add(a);a(d.children)}}(c.items);return[...b].sort()})(i),[i]),z=(0,e.useMemo)(()=>(function(a){let b=new Set;for(let c of Object.values(a))!function a(c){for(let d of c)d.meta.priority&&b.add(d.meta.priority),a(d.children)}(c.items);return["P0","P1","P2"].filter(a=>b.has(a))})(i),[i]),A=(0,e.useCallback)(async a=>{f(a),await b(a)},[b]),B=(0,e.useCallback)(async(a,b)=>{await A(x(k,c=>{c[a]=c[a].replace(/- \[[ xX~]\]/,`- [${"done"===b?"x":"in-progress"===b?"~":" "}]`)}))},[k,A]),F=(0,e.useCallback)(async(a,b)=>{await A(x(k,c=>{c[a]=c[a].replace(/(- \[[ xX~]\]\s*)(.*)$/,`$1${b}`)}))},[k,A]),G=(0,e.useCallback)(async a=>{await A(x(k,b=>{b.splice(a,1)}))},[k,A]),H=(0,e.useCallback)(async(a,b)=>{await A(x(k,c=>{let d=a<0?c.length:a+1;c.splice(d,0,`- [ ] ${b}`)}))},[k,A]),I=l.filter(a=>i[a]).map(a=>[a,i[a]]),J=o?Math.round(m/o*100):0;return(0,d.jsxs)("div",{className:"max-w-[900px] mx-auto xl:mr-[220px] px-0 py-2",children:[(0,d.jsx)("div",{className:"mb-5 flex items-center gap-4",children:(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsxs)("span",{className:"text-lg font-semibold font-display text-foreground tabular-nums",children:[J,"%"]}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground font-display",children:[m,"/",o," completed"]}),n>0&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs text-amber-500",children:[(0,d.jsx)(j.A,{size:8,className:"fill-amber-500/30"}),n," in progress"]})]}),(0,d.jsx)("div",{className:"mt-2 w-full max-w-xs h-1.5 bg-muted rounded-full overflow-hidden",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${J}%`,background:"var(--amber)"}})})]})}),(0,d.jsx)(E,{filters:g,onFilterChange:h,allTags:y,allPriorities:z,counts:{todo:p,inProgress:n,done:m,total:o}}),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[I.map(([a,b])=>(0,d.jsx)(N,{name:a,meta:b,filters:g,defaultCollapsed:a.includes("Done"),onCycleStatus:B,onRename:F,onDelete:G,onAdd:H},a)),0===I.length&&(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"No TODO items found in this file."})]})]})}},33627:(a,b,c)=>{Promise.resolve().then(c.bind(c,85034))},33827:(a,b,c)=>{"use strict";c.d(b,{A:()=>u});var d=c(48249),e=c(67484),f=c(74429),g=c(80600),h=c(19226),i=c(33407),j=c(95801),k=c(65255),l=c(65032),m=c(83654),n=c(40560),o=c(8455),p=c(31675),q=c(49681),r=c(46674);let s={kb:{icon:g.A,cls:"text-muted-foreground"},upload:{icon:h.A,cls:"text-muted-foreground"},image:{icon:i.A,cls:"text-muted-foreground"},skill:{icon:j.A,cls:"text-[var(--amber)]"},agent:{icon:k.A,cls:"text-muted-foreground"}},t={kb:"border-border bg-muted text-foreground",upload:"border-border bg-muted text-foreground",image:"border-border bg-muted text-foreground",skill:"border-[var(--amber)]/25 bg-[var(--amber)]/10 text-foreground",agent:"border-[var(--amber)]/25 bg-[var(--amber)]/10 text-foreground"};function u({path:a,onRemove:b,variant:c="kb",imageData:g,imageMime:h,status:i,error:j,truncatedInfo:k}){let[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),A=(0,e.useRef)(null),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(null),F="kb"===c&&a.endsWith("/"),G=F?a.slice(0,-1):a,H=G.split("/").pop()??G,I="kb"===c&&!F&&H.endsWith(".csv"),{icon:J,cls:K}=F?{icon:l.A,cls:"text-yellow-400"}:I?{icon:m.A,cls:"text-success"}:s[c],L=!!k,M=null,N="";"loading"===i?(M=n.A,N="text-muted-foreground animate-spin"):"error"===i?(M=o.A,N="text-destructive"):L?(M=p.A,N="text-amber-500"):"success"===i&&(M=q.A,N="text-emerald-500");let O="error"===i?"border-destructive/30 bg-destructive/5 text-foreground":L?"border-amber-500/30 bg-amber-500/5 text-foreground":t[c],P=null;if("error"===i&&j)P=j;else if(L){let a=k.totalChars>0?Math.round(k.includedChars/k.totalChars*100):0;P=`Document truncated — only ${a}% included (${Math.round(k.includedChars/1e3)}K / ${Math.round(k.totalChars/1e3)}K chars, ${k.totalPages} pages total)`}let Q=u&&B&&g&&h?(0,d.jsx)("div",{className:"fixed z-50 p-1 rounded-lg border border-border bg-card shadow-lg pointer-events-none",style:{left:B.left,bottom:window.innerHeight-B.top},children:(0,d.jsx)("img",{src:`data:${h};base64,${g}`,alt:H,className:"max-h-48 max-w-64 rounded object-contain"})}):null,R=w&&D&&P?(0,d.jsx)("div",{className:`fixed z-50 px-2.5 py-1.5 rounded-lg border bg-card text-xs shadow-lg pointer-events-none max-w-[280px] ${"error"===i?"border-destructive/20 text-destructive":"border-amber-500/20 text-amber-600 dark:text-amber-400"}`,style:{left:D.left,bottom:window.innerHeight-D.top},children:P}):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{ref:A,className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs border max-w-[220px] ${O}`,onMouseEnter:()=>{g&&v(!0),P&&x(!0)},onMouseLeave:()=>{v(!1),x(!1)},children:[(0,d.jsx)(J,{size:11,className:`${K} shrink-0`}),(0,d.jsx)("span",{className:"truncate",title:F?G:a,children:H}),M&&(0,d.jsx)(M,{size:10,className:`${N} shrink-0`}),(0,d.jsx)("button",{type:"button",onClick:b,"aria-label":`Remove ${H}`,className:"p-0.5 -mr-1 rounded hover:text-foreground transition-colors shrink-0 text-muted-foreground",children:(0,d.jsx)(r.A,{size:10})})]}),y&&Q&&(0,f.createPortal)(Q,document.body),y&&R&&(0,f.createPortal)(R,document.body)]})}},33923:(a,b,c)=>{"use strict";var d=c(29974);let e=new Set(["mp3","wav","m4a","ogg","flac","aac"]),f=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),g=new Set(["mp4","webm","mov","mkv"]);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:"audio",name:"Audio Player",description:"Plays audio files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFB5",tags:["audio","music","voice","mp3","wav"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>e.has(a),load:()=>Promise.resolve().then(c.bind(c,30488)).then(a=>({default:a.AudioRenderer}))},{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:"image",name:"Image Viewer",description:"Renders image files with zoom, fit-to-view, and transparency support.",author:"MindOS",icon:"\uD83D\uDDBC",tags:["image","photo","viewer","png","jpg","svg"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>f.has(a),load:()=>Promise.resolve().then(c.bind(c,47336)).then(a=>({default:a.ImageRenderer}))},{id:"pdf",name:"PDF Viewer",description:"Renders PDF files using the browser built-in PDF viewer.",author:"MindOS",icon:"\uD83D\uDCC4",tags:["pdf","document","viewer"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>"pdf"===a,load:()=>Promise.resolve().then(c.bind(c,21416)).then(a=>({default:a.PdfRenderer}))},{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:"video",name:"Video Player",description:"Plays video files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFAC",tags:["video","movie","recording","mp4","webm"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>g.has(a),load:()=>Promise.resolve().then(c.bind(c,63956)).then(a=>({default:a.VideoRenderer}))},{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)},34279:(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)("7048382ea5253f1beab235fcf8a9a470c5d792219b",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 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)}},36161:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},36312:(a,b,c)=>{"use strict";c.d(b,{TS:()=>e,ow:()=>f});let d=[];function e(a){d.find(b=>b.id===a.id)||d.push(a)}function f(){return d}},37718:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GraphRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call GraphRenderer() from the server but GraphRenderer 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/graph/GraphRenderer.tsx","GraphRenderer")},38957:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>n,bA:()=>l});var d=c(48249),e=c(67484),f=c(74429),g=c(22341),h=c(6079),i=c(42742),j=c(44218),k=c(47223);function l(){return"agent"}let m=["agent","chat"];function n({mode:a,onChange:b,disabled:c}){let{t:l}=(0,k.Y)(),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(null),r=(0,e.useRef)(null),s=(0,e.useRef)(null);(0,e.useCallback)(()=>{if(!r.current)return;let a=r.current.getBoundingClientRect(),b=a.top,c=b>window.innerHeight-a.bottom&&b>120?"up":"down";q({left:a.left,top:"up"===c?a.top-6:a.bottom+6,direction:c})},[]);let t=(0,e.useCallback)(a=>{b(a);try{localStorage.setItem("mindos-ask-mode",a)}catch{}o(!1)},[b]),u="chat"===a,v=(a,b)=>"chat"===a?(0,d.jsx)(g.A,{size:b,className:"shrink-0"}):(0,d.jsx)(h.A,{size:b,className:"shrink-0"}),w=a=>"chat"===a?l.ask.modeChat:l.ask.modeAgent,x=a=>"chat"===a?l.ask.modeChatHint:l.ask.modeAgentHint,y=n&&p?(0,d.jsx)("div",{ref:s,role:"listbox","aria-label":"Select mode",className:"fixed z-50 min-w-[200px] max-w-[260px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:p.left,..."up"===p.direction?{bottom:window.innerHeight-p.top}:{top:p.top}},children:m.map(b=>{let c=a===b;return(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":c,onClick:()=>t(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,d.jsx)("span",{className:"text-muted-foreground",children:v(b,13)}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"font-medium",children:w(b)}),(0,d.jsx)("div",{className:"text-2xs text-muted-foreground mt-0.5",children:x(b)})]}),c&&(0,d.jsx)(i.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]},b)})}):null;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{ref:r,type:"button",onClick:()=>{c||o(a=>!a)},disabled:c,className:`
60
65
  inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
61
66
  text-2xs font-medium transition-colors select-none
62
67
  border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
63
68
  disabled:opacity-40 disabled:cursor-not-allowed
64
69
  ${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"}
65
- `,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)]})}},39624:(a,b,c)=>{"use strict";function d(){return[]}function e(a){}function f(a){let b=[];b.unshift(a);let c=b.slice(0,50);return e(c),c}function g(a,b){let c=[],d=c.findIndex(b=>b.id===a);return d>=0&&(c[d]={...c[d],...b},e(c)),c}function h(){}c.d(b,{D4:()=>f,FB:()=>d,W8:()=>g,g4:()=>h,jQ:()=>j});let i=0;function j(){return`org-${Date.now()}-${++i}`}},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}]
70
+ `,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)]})}},39624:(a,b,c)=>{"use strict";function d(){return[]}function e(a){}function f(a){let b=[];b.unshift(a);let c=b.slice(0,50);return e(c),c}function g(a,b){let c=[],d=c.findIndex(b=>b.id===a);return d>=0&&(c[d]={...c[d],...b},e(c)),c}function h(){}c.d(b,{D4:()=>f,FB:()=>d,W8:()=>g,g4:()=>h,jQ:()=>j});let i=0;function j(){return`org-${Date.now()}-${++i}`}},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=a.name;try{let c=await a.arrayBuffer(),d=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(c)),e=await fetch("/api/extract-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b,dataBase64:d})}),f={};try{f=await e.json()}catch{throw Error("Failed to parse extraction response")}if(!e.ok)throw Error(f.error||`PDF extraction failed (${e.status})`);let g=f.extracted&&f.text||"";if(!g)return{name:b,content:`[PDF: ${b}] Could not extract readable text (possibly scanned/image PDF).`,status:"error",error:"Scanned or image-only PDF — no extractable text"};let h={name:b,content:`[PDF TEXT EXTRACTED: ${b}]
66
71
 
67
- ${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})},[])}}},41558:(a,b,c)=>{"use strict";var d=c(36312);let e=new Set(["mp3","wav","m4a","ogg","flac","aac"]),f=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),g=new Set(["mp4","webm","mov","mkv"]);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:"audio",name:"Audio Player",description:"Plays audio files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFB5",tags:["audio","music","voice","mp3","wav"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>e.has(a),load:()=>Promise.resolve().then(c.bind(c,59238)).then(a=>({default:a.AudioRenderer}))},{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:"image",name:"Image Viewer",description:"Renders image files with zoom, fit-to-view, and transparency support.",author:"MindOS",icon:"\uD83D\uDDBC",tags:["image","photo","viewer","png","jpg","svg"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>f.has(a),load:()=>Promise.resolve().then(c.bind(c,92206)).then(a=>({default:a.ImageRenderer}))},{id:"pdf",name:"PDF Viewer",description:"Renders PDF files using the browser built-in PDF viewer.",author:"MindOS",icon:"\uD83D\uDCC4",tags:["pdf","document","viewer"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>"pdf"===a,load:()=>Promise.resolve().then(c.bind(c,29406)).then(a=>({default:a.PdfRenderer}))},{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:"video",name:"Video Player",description:"Plays video files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFAC",tags:["video","movie","recording","mp4","webm"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>g.has(a),load:()=>Promise.resolve().then(c.bind(c,14986)).then(a=>({default:a.VideoRenderer}))},{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)},41739:(a,b,c)=>{"use strict";c.d(b,{A:()=>w});var d=c(48249),e=c(67484),f=c(74429),g=c(93017),h=c(42742),i=c(3129),j=c(12625),k=c(59347),l=c(6079),m=c(44218),n=c(96286),o=c(35389),p=c(45231),q=c(13481),r=c(92343),s=c(50514),t=c(46674),u=c(47223),v=c(54461);let w=(0,e.memo)(function({isPanel:a,showHistory:b,onToggleHistory:c,onReset:w,isLoading:x,maximized:y,onMaximize:z,askMode:A,onModeSwitch:B,onClose:C,hideTitle:D,sessions:E,activeSessionId:F,onLoadSession:G,onDeleteSession:H,onRenameSession:I,onTogglePinSession:J}){let{t:K}=(0,u.Y)(),L=E&&E.length>=1,M=E?.find(a=>a.id===F),N=M?(0,v.d)(M):null,[O,P]=(0,e.useState)(!1),Q=(0,e.useRef)(null),R=(0,e.useRef)(null),[S,T]=(0,e.useState)(null),[U,V]=(0,e.useState)(""),W=(0,e.useRef)(null),X=(0,e.useCallback)(a=>{G?.(a),P(!1)},[G]),Y=(0,e.useCallback)((a,b)=>{T(a),V("(empty session)"===b?"":b)},[]),Z=(0,e.useCallback)(()=>{S&&I&&U.trim()&&I(S,U.trim()),T(null)},[S,U,I]),[$,_]=(0,e.useState)(null),aa=O&&$&&E?(0,f.createPortal)((0,d.jsx)("div",{ref:R,className:"fixed z-50 rounded-xl border border-border/50 bg-card shadow-lg py-1 animate-in fade-in-0 slide-in-from-top-1 duration-100",style:{top:$.top,left:$.left,minWidth:$.width,maxWidth:320},role:"listbox",children:E.map(a=>{let b=a.id===F,c=(0,v.d)(a),e="(empty session)"===c?K.hints?.newChat??"New chat":c;return S===a.id?(0,d.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5",children:(0,d.jsx)("input",{ref:W,type:"text",value:U,onChange:a=>V(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Z(),"Escape"===a.key&&T(null)},onBlur:Z,className:"flex-1 min-w-0 px-2 py-1 text-xs rounded-md border border-border bg-background text-foreground outline-none focus:border-[var(--amber)]/50",placeholder:"Session name..."})},a.id):(0,d.jsxs)("div",{className:"group/item flex items-center",children:[(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":b,onClick:()=>X(a.id),className:`flex-1 min-w-0 flex items-center gap-2 px-3 py-2 text-xs text-left transition-colors ${b?"text-foreground font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[a.pinned&&(0,d.jsx)(g.A,{size:10,className:"shrink-0 text-[var(--amber)]/60 -rotate-45"}),b&&!a.pinned&&(0,d.jsx)(h.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"truncate",children:e})]}),(0,d.jsxs)("div",{className:"shrink-0 flex items-center gap-0.5 mr-1 opacity-0 group-hover/item:opacity-100 transition-opacity",children:[J&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),J(a.id)},className:`p-1.5 rounded-md transition-colors ${a.pinned?"text-[var(--amber)] hover:text-muted-foreground hover:bg-muted/60":"text-muted-foreground/40 hover:text-[var(--amber)] hover:bg-[var(--amber)]/5"}`,"aria-label":a.pinned?"Unpin":"Pin",children:a.pinned?(0,d.jsx)(i.A,{size:10}):(0,d.jsx)(g.A,{size:10})}),I&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),Y(a.id,c)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-foreground hover:bg-muted/60","aria-label":`Rename: ${e}`,children:(0,d.jsx)(j.A,{size:10})}),E.length>1&&H&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),H(a.id)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-error hover:bg-error/5","aria-label":`Delete: ${e}`,children:(0,d.jsx)(k.A,{size:10})})]})]},a.id)})}),document.body):null;return(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 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"}),!D&&(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsx)("div",{className:"w-6 h-6 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:(0,d.jsx)(l.A,{size:13,className:"text-[var(--amber)]"})}),L&&N?(0,d.jsxs)("button",{ref:Q,type:"button",onClick:()=>{E&&E.length>=2?P(a=>!a):c()},className:"flex items-center gap-1 min-w-0 text-sm font-medium text-[var(--amber)] hover:text-[var(--amber)]/80 transition-colors","aria-expanded":O,"aria-haspopup":"listbox",children:[(0,d.jsx)("span",{className:"truncate max-w-[180px]",children:"(empty session)"===N?K.hints?.newChat??"New chat":N}),(0,d.jsx)(m.A,{size:12,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${O?"rotate-180":""}`})]}):N?(0,d.jsx)("span",{className:"text-sm font-medium text-muted-foreground/60 truncate max-w-[180px]",children:"(empty session)"===N?K.hints?.newChat??"New chat":N}):(0,d.jsx)("span",{className:"text-sm font-medium text-muted-foreground/40",children:K.hints?.newChat??"New chat"})]}),D&&(0,d.jsx)("div",{}),(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-lg transition-colors ${b?"bg-[var(--amber)]/10 text-[var(--amber)]":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:K.hints.sessionHistory,children:(0,d.jsx)(n.A,{size:14})}),(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),w()},disabled:x,className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",title:K.hints.newSession,children:(0,d.jsx)(o.A,{size:14})}),z&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),z()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:y?K.hints.restorePanel:K.hints.maximizePanel,children:y?(0,d.jsx)(p.A,{size:14}):(0,d.jsx)(q.A,{size:14})}),B&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),B()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"popup"===A?K.hints.dockToSide:K.hints.openAsPopup,children:"popup"===A?(0,d.jsx)(r.A,{size:14}):(0,d.jsx)(s.A,{size:14})}),C&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),C()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:K.hints.closePanel,"aria-label":"Close",children:(0,d.jsx)(t.A,{size:14})})]}),"u">typeof document&&aa]})})},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:"'IBM Plex Sans', system-ui, sans-serif",background:"#131210",color:"#e8e4dc"},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:"#8a8275",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:"#1c1a17",color:"#e8e4dc",border:"1px solid rgba(232,228,220,0.08)",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"})]})]})})})}},43706:(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(47223),l=c(33191),m=c(99829);let n=(0,m.createServerReference)("703ae7acded946912bd9988b0bcfe3ac15c20a89b4",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:`
68
- @keyframes dotBounce {
69
- 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
70
- 30% { opacity: 1; transform: translateY(-2px); }
71
- }
72
- `})]})}},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(47223),v=c(95054),w=c(99788),x=c(29272),y=c(25971),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)}},[]),(0,f.useRef)(null);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",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",{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 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",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)}})},47223:(a,b,c)=>{"use strict";c.d(b,{D:()=>f,Y:()=>g});var d=c(31417),e=c(52610);let f=(0,d.v)(a=>({locale:"en",t:e.D.en,setLocale:b=>{document.cookie=`locale=${b};path=/;max-age=31536000;SameSite=Lax`,document.documentElement.lang="zh"===b?"zh":"en",window.__mindos_locale__=b,a({locale:b,t:e.D[b]}),window.dispatchEvent(new Event("mindos-locale-change"))},_init:b=>{"en"!==f.getState().locale&&a({locale:"en",t:e.D.en});let c=()=>{a({locale:"en",t:e.D.en})};return window.addEventListener("mindos-locale-change",c),()=>window.removeEventListener("mindos-locale-change",c)}}));function g(){return f()}},47336:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ImageRenderer:()=>g});var d=c(48249),e=c(67484);let f=[.25,.5,.75,1,1.5,2,3,4];function g({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,c=a.split("/").pop()??"image",g=c.split(".").pop()?.toLowerCase()??"",h=["png","svg","webp","ico","gif"].includes(g),[i,j]=(0,e.useState)(!0),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(0),[o,p]=(0,e.useState)("fit"),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(null),u=(0,e.useRef)(null),v=(0,e.useRef)(null),w=(0,e.useCallback)(()=>{j(!1);let a=u.current;a&&r({w:a.naturalWidth,h:a.naturalHeight})},[]),x=(0,e.useCallback)(()=>{j(!1),l(!0)},[]),y=(0,e.useCallback)(()=>{l(!1),j(!0),n(a=>a+1)},[]),z=(0,e.useCallback)(()=>{p(a=>{let b="fit"===a?1:a;return f.find(a=>a>b)??b})},[]),A=(0,e.useCallback)(()=>{p(a=>{let b="fit"===a?1:a;return[...f].reverse().find(a=>a<b)??b})},[]),B=(0,e.useCallback)(()=>{p(a=>"fit"===a?1:"fit")},[]),C="fit"===o?"Fit":`${Math.round(100*o)}%`,D="fit"===o?{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"}:q?{width:q.w*o,height:"auto"}:{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"};return(0,d.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[q&&(0,d.jsxs)("span",{children:[q.w," x ",q.h]}),null!==s&&(0,d.jsx)("span",{children:s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`}),(0,d.jsx)("span",{className:"uppercase opacity-60",children:g})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{onClick:A,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom out (-)",children:"-"}),(0,d.jsx)("button",{onClick:B,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors min-w-[48px] text-center disabled:opacity-30",title:"fit"===o?"Actual size (1)":"Fit to view (0)",children:C}),(0,d.jsx)("button",{onClick:z,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom in (+)",children:"+"})]})]}),(0,d.jsxs)("div",{ref:v,tabIndex:-1,className:`relative flex-1 min-h-[70vh] overflow-auto flex items-center justify-center outline-none ${h?"bg-checkerboard":"bg-[var(--bg-secondary)]"}`,children:[i&&!k&&(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:(0,d.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading..."})}),k&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center z-10 gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load image"}),(0,d.jsx)("button",{onClick:y,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,d.jsx)("img",{ref:u,src:b,alt:c,onLoad:w,onError:x,draggable:!1,className:"select-none",style:{display:k?"none":"block",...D}},m)]})]})}},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(87148),i=c(76592),j=c(8505),k=c(41479),l=c(61075),m=c(11035),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=>`---
72
+ ${g}`,status:"success"};return f.truncated&&f.totalChars&&(h.truncatedInfo={totalChars:f.totalChars,includedChars:g.length,totalPages:f.pagesParsed??0}),h}catch(a){return{name:b,content:`[PDF: ${b}] Failed to extract text from this PDF.`,status:"error",error:a instanceof Error?a.message:"Unknown error"}}}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=[],k=[];for(let a of d)".pdf"===f(a.name)?(k.push({name:a.name,content:"",status:"loading"}),j.push(a)):k.push({name:a.name,content:await a.text(),status:"success"});if(b(a=>{let b=[...a];for(let a of k)b.some(b=>b.name===a.name)||b.push(a);return b}),j.length>0){let a=await Promise.all(j.map(g));b(b=>b.map(b=>"loading"!==b.status?b:a.find(a=>a.name===b.name)??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})},[])}}},41558:(a,b,c)=>{"use strict";var d=c(36312);let e=new Set(["mp3","wav","m4a","ogg","flac","aac"]),f=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),g=new Set(["mp4","webm","mov","mkv"]);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:"audio",name:"Audio Player",description:"Plays audio files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFB5",tags:["audio","music","voice","mp3","wav"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>e.has(a),load:()=>Promise.resolve().then(c.bind(c,59238)).then(a=>({default:a.AudioRenderer}))},{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:"image",name:"Image Viewer",description:"Renders image files with zoom, fit-to-view, and transparency support.",author:"MindOS",icon:"\uD83D\uDDBC",tags:["image","photo","viewer","png","jpg","svg"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>f.has(a),load:()=>Promise.resolve().then(c.bind(c,92206)).then(a=>({default:a.ImageRenderer}))},{id:"pdf",name:"PDF Viewer",description:"Renders PDF files using the browser built-in PDF viewer.",author:"MindOS",icon:"\uD83D\uDCC4",tags:["pdf","document","viewer"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>"pdf"===a,load:()=>Promise.resolve().then(c.bind(c,29406)).then(a=>({default:a.PdfRenderer}))},{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:"video",name:"Video Player",description:"Plays video files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFAC",tags:["video","movie","recording","mp4","webm"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:a})=>g.has(a),load:()=>Promise.resolve().then(c.bind(c,14986)).then(a=>({default:a.VideoRenderer}))},{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)},41739:(a,b,c)=>{"use strict";c.d(b,{A:()=>w});var d=c(48249),e=c(67484),f=c(74429),g=c(93017),h=c(42742),i=c(3129),j=c(12625),k=c(59347),l=c(6079),m=c(44218),n=c(96286),o=c(35389),p=c(45231),q=c(13481),r=c(92343),s=c(50514),t=c(46674),u=c(47223),v=c(54461);let w=(0,e.memo)(function({isPanel:a,showHistory:b,onToggleHistory:c,onReset:w,isLoading:x,maximized:y,onMaximize:z,askMode:A,onModeSwitch:B,onClose:C,hideTitle:D,sessions:E,activeSessionId:F,onLoadSession:G,onDeleteSession:H,onRenameSession:I,onTogglePinSession:J}){let{t:K}=(0,u.Y)(),L=E&&E.length>=1,M=E?.find(a=>a.id===F),N=M?(0,v.d)(M):null,[O,P]=(0,e.useState)(!1),Q=(0,e.useRef)(null),R=(0,e.useRef)(null),[S,T]=(0,e.useState)(null),[U,V]=(0,e.useState)(""),W=(0,e.useRef)(null),X=(0,e.useCallback)(a=>{G?.(a),P(!1)},[G]),Y=(0,e.useCallback)((a,b)=>{T(a),V("(empty session)"===b?"":b)},[]),Z=(0,e.useCallback)(()=>{S&&I&&U.trim()&&I(S,U.trim()),T(null)},[S,U,I]),[$,_]=(0,e.useState)(null),aa=O&&$&&E?(0,f.createPortal)((0,d.jsx)("div",{ref:R,className:"fixed z-50 rounded-xl border border-border/50 bg-card shadow-lg py-1 animate-in fade-in-0 slide-in-from-top-1 duration-100",style:{top:$.top,left:$.left,minWidth:$.width,maxWidth:320},role:"listbox",children:E.map(a=>{let b=a.id===F,c=(0,v.d)(a),e="(empty session)"===c?K.hints?.newChat??"New chat":c;return S===a.id?(0,d.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5",children:(0,d.jsx)("input",{ref:W,type:"text",value:U,onChange:a=>V(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Z(),"Escape"===a.key&&T(null)},onBlur:Z,className:"flex-1 min-w-0 px-2 py-1 text-xs rounded-md border border-border bg-background text-foreground outline-none focus:border-[var(--amber)]/50",placeholder:"Session name..."})},a.id):(0,d.jsxs)("div",{className:"group/item flex items-center",children:[(0,d.jsxs)("button",{type:"button",role:"option","aria-selected":b,onClick:()=>X(a.id),className:`flex-1 min-w-0 flex items-center gap-2 px-3 py-2 text-xs text-left transition-colors ${b?"text-foreground font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[a.pinned&&(0,d.jsx)(g.A,{size:10,className:"shrink-0 text-[var(--amber)]/60 -rotate-45"}),b&&!a.pinned&&(0,d.jsx)(h.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"truncate",children:e})]}),(0,d.jsxs)("div",{className:"shrink-0 flex items-center gap-0.5 mr-1 opacity-0 group-hover/item:opacity-100 transition-opacity",children:[J&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),J(a.id)},className:`p-1.5 rounded-md transition-colors ${a.pinned?"text-[var(--amber)] hover:text-muted-foreground hover:bg-muted/60":"text-muted-foreground/40 hover:text-[var(--amber)] hover:bg-[var(--amber)]/5"}`,"aria-label":a.pinned?"Unpin":"Pin",children:a.pinned?(0,d.jsx)(i.A,{size:10}):(0,d.jsx)(g.A,{size:10})}),I&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),Y(a.id,c)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-foreground hover:bg-muted/60","aria-label":`Rename: ${e}`,children:(0,d.jsx)(j.A,{size:10})}),E.length>1&&H&&(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),H(a.id)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-error hover:bg-error/5","aria-label":`Delete: ${e}`,children:(0,d.jsx)(k.A,{size:10})})]})]},a.id)})}),document.body):null;return(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 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"}),!D&&(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsx)("div",{className:"w-6 h-6 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:(0,d.jsx)(l.A,{size:13,className:"text-[var(--amber)]"})}),L&&N?(0,d.jsxs)("button",{ref:Q,type:"button",onClick:()=>{E&&E.length>=2?P(a=>!a):c()},className:"flex items-center gap-1 min-w-0 text-sm font-medium text-[var(--amber)] hover:text-[var(--amber)]/80 transition-colors","aria-expanded":O,"aria-haspopup":"listbox",children:[(0,d.jsx)("span",{className:"truncate max-w-[180px]",children:"(empty session)"===N?K.hints?.newChat??"New chat":N}),(0,d.jsx)(m.A,{size:12,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${O?"rotate-180":""}`})]}):N?(0,d.jsx)("span",{className:"text-sm font-medium text-muted-foreground/60 truncate max-w-[180px]",children:"(empty session)"===N?K.hints?.newChat??"New chat":N}):(0,d.jsx)("span",{className:"text-sm font-medium text-muted-foreground/40",children:K.hints?.newChat??"New chat"})]}),D&&(0,d.jsx)("div",{}),(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-lg transition-colors ${b?"bg-[var(--amber)]/10 text-[var(--amber)]":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:K.hints.sessionHistory,children:(0,d.jsx)(n.A,{size:14})}),(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),w()},disabled:x,className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",title:K.hints.newSession,children:(0,d.jsx)(o.A,{size:14})}),z&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),z()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:y?K.hints.restorePanel:K.hints.maximizePanel,children:y?(0,d.jsx)(p.A,{size:14}):(0,d.jsx)(q.A,{size:14})}),B&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),B()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"popup"===A?K.hints.dockToSide:K.hints.openAsPopup,children:"popup"===A?(0,d.jsx)(r.A,{size:14}):(0,d.jsx)(s.A,{size:14})}),C&&(0,d.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),C()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:K.hints.closePanel,"aria-label":"Close",children:(0,d.jsx)(t.A,{size:14})})]}),"u">typeof document&&aa]})})},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:"'IBM Plex Sans', system-ui, sans-serif",background:"#131210",color:"#e8e4dc"},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:"#8a8275",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:"#1c1a17",color:"#e8e4dc",border:"1px solid rgba(232,228,220,0.08)",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,fileName:a.name||void 0})}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(47223),v=c(95054),w=c(99788),x=c(29272),y=c(91667),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)}},[]),(0,f.useRef)(null);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",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",{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 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",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)}})},47223:(a,b,c)=>{"use strict";c.d(b,{D:()=>f,Y:()=>g});var d=c(31417),e=c(52610);let f=(0,d.v)(a=>({locale:"en",t:e.D.en,setLocale:b=>{document.cookie=`locale=${b};path=/;max-age=31536000;SameSite=Lax`,document.documentElement.lang="zh"===b?"zh":"en",window.__mindos_locale__=b,a({locale:b,t:e.D[b]}),window.dispatchEvent(new Event("mindos-locale-change"))},_init:b=>{"en"!==f.getState().locale&&a({locale:"en",t:e.D.en});let c=()=>{a({locale:"en",t:e.D.en})};return window.addEventListener("mindos-locale-change",c),()=>window.removeEventListener("mindos-locale-change",c)}}));function g(){return f()}},47336:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ImageRenderer:()=>g});var d=c(48249),e=c(67484);let f=[.25,.5,.75,1,1.5,2,3,4];function g({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,c=a.split("/").pop()??"image",g=c.split(".").pop()?.toLowerCase()??"",h=["png","svg","webp","ico","gif"].includes(g),[i,j]=(0,e.useState)(!0),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(0),[o,p]=(0,e.useState)("fit"),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(null),u=(0,e.useRef)(null),v=(0,e.useRef)(null),w=(0,e.useCallback)(()=>{j(!1);let a=u.current;a&&r({w:a.naturalWidth,h:a.naturalHeight})},[]),x=(0,e.useCallback)(()=>{j(!1),l(!0)},[]),y=(0,e.useCallback)(()=>{l(!1),j(!0),n(a=>a+1)},[]),z=(0,e.useCallback)(()=>{p(a=>{let b="fit"===a?1:a;return f.find(a=>a>b)??b})},[]),A=(0,e.useCallback)(()=>{p(a=>{let b="fit"===a?1:a;return[...f].reverse().find(a=>a<b)??b})},[]),B=(0,e.useCallback)(()=>{p(a=>"fit"===a?1:"fit")},[]),C="fit"===o?"Fit":`${Math.round(100*o)}%`,D="fit"===o?{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"}:q?{width:q.w*o,height:"auto"}:{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"};return(0,d.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[q&&(0,d.jsxs)("span",{children:[q.w," x ",q.h]}),null!==s&&(0,d.jsx)("span",{children:s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`}),(0,d.jsx)("span",{className:"uppercase opacity-60",children:g})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("button",{onClick:A,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom out (-)",children:"-"}),(0,d.jsx)("button",{onClick:B,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors min-w-[48px] text-center disabled:opacity-30",title:"fit"===o?"Actual size (1)":"Fit to view (0)",children:C}),(0,d.jsx)("button",{onClick:z,disabled:!q,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom in (+)",children:"+"})]})]}),(0,d.jsxs)("div",{ref:v,tabIndex:-1,className:`relative flex-1 min-h-[70vh] overflow-auto flex items-center justify-center outline-none ${h?"bg-checkerboard":"bg-[var(--bg-secondary)]"}`,children:[i&&!k&&(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:(0,d.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading..."})}),k&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center z-10 gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load image"}),(0,d.jsx)("button",{onClick:y,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,d.jsx)("img",{ref:u,src:b,alt:c,onLoad:w,onError:x,draggable:!1,className:"select-none",style:{display:k?"none":"block",...D}},m)]})]})}},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(87148),i=c(76592),j=c(8505),k=c(41479),l=c(61075),m=c(11035),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=>`---
73
73
  name: ${a}
74
74
  description: >
75
75
  Describe WHEN the agent should use this
@@ -129,9 +129,9 @@ Please provide a concise daily briefing in this format:
129
129
  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:`
130
130
  @keyframes spin { to { transform: rotate(360deg); } }
131
131
  @keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }
132
- `})]})}c(95054)},52415:(a,b,c)=>{Promise.resolve().then(c.bind(c,43248))},52610:(a,b,c)=>{"use strict";c.d(b,{D:()=>e});let d={ask:{title:"MindOS Agent",fabLabel:"AI 助手",placeholder:"输入问题… @ 附加文件,/ 技能",emptyPrompt:"有什么可以帮你?",emptyHint:"输入 @ 引用文件 \xb7 / 使用技能 \xb7 拖拽图片",executingTool:"正在执行工具…",toolRunning:"运行中...",copyMessage:"复制",toolInput:"输入",toolOutput:"输出",send:"发送",newlineHint:"换行",panelComposerResize:"向上拖拽以拉高输入区",panelComposerFooter:"拉高输入区",panelComposerResetHint:"双击恢复默认高度",panelComposerKeyboard:"方向键调节高度;Home/End 最小或最大",attachFile:"上下文",attachFileLabel:"文档",attachImageLabel:"图片",uploadedFiles:"已上传",skillsHint:"技能",attachCurrent:"附加当前文件",stopTitle:"停止",cancelReconnect:"取消重连",connecting:"正在和你一起思考...",thinking:"思考中...",thinkingLabel:"思考中",searching:"正在搜索知识库...",generating:"正在生成回复...",stopped:"已停止生成。",errorNoResponse:"AI 未返回有效内容。可能原因:模型不支持流式输出、中转站兼容性问题、或请求超出上下文限制。",reconnecting:(a,b)=>`连接中断,正在重连 (${a}/${b})...`,reconnectFailed:"多次重连失败,请检查网络后重试。",proxyCompatMode:"正在以兼容模式调用...",proxyCompatFailed:a=>`兼容模式失败:${a}。请检查 Base URL、API Key 和模型名称。`,proxyCompatDetecting:"正在检测接口兼容性,切换到兼容模式重试...",proxyCompatAlsoFailed:a=>`兼容模式也失败了:${a}。请检查 Base URL、API Key 和模型名称。`,retry:"重试",suggestions:[{label:"整理收件箱",prompt:"把收件箱的文件整理到对应空间"},{label:"调研一个话题",prompt:"调研一下 AI Agent 的最新趋势"},{label:"起草周报",prompt:"根据最近的笔记起草一份周报"},{label:"想新 idea",prompt:"为我的下一个项目想 3 个新 idea"}],homeCategories:[{label:"知识管理",items:[{label:"整理到 Space",desc:"按主题归类零散笔记",prompt:"帮我把最近的零散笔记整理到合适的 Space,并打好标签"},{label:"同步去重",desc:"清理跨平台重复内容",prompt:"找出我各个 Space 中重复或重叠的内容,帮我合并整理"},{label:"自动打标签",desc:"给未分类笔记加结构",prompt:"检查我未标记的笔记,建议合适的分类和标签"},{label:"每周摘要",desc:"汇总本周变更",prompt:"总结我这周在所有 Space 中新增和修改的内容"}]},{label:"内容创作",items:[{label:"笔记变博客",desc:"草稿变成精修文章",prompt:"把我的草稿笔记改写成一篇结构清晰的博客文章"},{label:"产品文案",desc:"落地页与产品描述",prompt:"根据我的笔记写一段有吸引力的产品描述和落地页文案"},{label:"润色优化",desc:"提升清晰度和语气",prompt:"审阅这篇文档的清晰度、语气和结构,重写不好的部分"},{label:"演示大纲",desc:"从笔记生成演讲结构",prompt:"根据我关于这个主题的笔记,创建一个演示文稿大纲"}]},{label:"分析洞察",items:[{label:"竞品对比",desc:"比较产品差异化",prompt:"对比我调研笔记中的产品,找出关键差异点"},{label:"提炼洞察",desc:"发现阅读笔记中的规律",prompt:"我的阅读笔记中有哪些最重要的见解和规律?"},{label:"决策框架",desc:"利弊分析与建议",prompt:"帮我用利弊、风险和建议来结构化这个决策"},{label:"GTM 策略",desc:"从调研到上市方案",prompt:"根据我的产品和市场调研笔记,帮我制定一份上市计划"}]},{label:"启发创新",items:[{label:"挑战假设",desc:"找出思维盲点",prompt:"审视我的笔记,挑战我正在做的关键假设。我遗漏了什么?"},{label:"反常识探索",desc:"探索替代可能性",prompt:"根据我的调研,生成 3 个我没考虑过的反常识场景"},{label:"跨域融合",desc:"不同领域的创意碰撞",prompt:"在我不同 Space 的想法中找到意想不到的联系,并建议新颖的组合"},{label:"发现机会",desc:"别人没看到的空白",prompt:"分析我的市场调研笔记,找出未被充分服务的小众市场或新兴机会"}]}],modeChat:"对话",modeAgent:"Agent",modeChatHint:"可搜索/阅读知识库 \xb7 省 token",modeAgentHint:"完整工具权限 \xb7 可修改知识库",sessionHistory:"对话历史",clearAll:"清除全部",confirmClear:"确认清除?",noSessions:"暂无历史对话。",renameSession:"重命名",draftingHint:"AI 仍在执行,你可以先输入下一步。",providerCapsule:"切换模型服务商",providerDefault:"默认",providerNoKey:"暂无已配置的服务商"},changes:{unreadBanner:a=>`${a} 条内容变更未读`,reviewNow:"立即查看",dismiss:"关闭提醒",title:"内容变更",subtitle:"集中查看用户与 Agent 的最近编辑记录。",eventsCount:a=>`${a} 条事件`,unreadCount:a=>`${a} 条未读`,refresh:"刷新",markSeen:"标记已读",markAllRead:"全部已读",filters:{filePath:"文件路径",filePathPlaceholder:"例如:Projects/plan.md",source:"Agents(来源)",operation:"工具(操作)",operationAll:"全部操作",keyword:"关键词",keywordPlaceholder:"摘要 / 操作 / 路径",all:"全部",agent:"Agent",user:"用户",system:"系统"},loading:"正在加载变更...",empty:"暂无内容变更。",open:"打开",unchangedLines:a=>`... ${a} 行未变更 ...`,operations:{save_file:"保存文件",append_to_file:"追加到文件",insert_lines:"插入行",update_lines:"更新行",insert_after_heading:"标题后插入",update_section:"更新章节",create_file:"创建文件",delete_file:"删除文件",rename_file:"重命名文件",move_file:"移动文件",create_space:"创建空间",rename_space:"重命名空间",append_csv:"追加到 CSV",import_file:"导入文件",legacy_agent_diff_import:"从 Agent Diff 导入"},relativeTime:{justNow:"刚刚",minutesAgo:a=>`${a} 分钟前`,hoursAgo:a=>`${a} 小时前`,daysAgo:a=>`${a} 天前`}},hints:{noValidFiles:"未选择有效文件",aiOrganizing:"AI 正在整理中",importInProgress:"正在导入",templateInitializing:"正在初始化另一个模板",configureAiKey:"请在 设置 → AI 中配置 API 密钥",syncInProgress:"正在同步中",toggleInProgress:"正在切换中",typeMessage:"请输入消息",mentionInProgress:"正在输入提及或命令",cleanupInProgress:"正在清理中",tokenResetInProgress:"正在重置令牌",aiNotConfigured:"AI 未配置或正在生成",generationInProgress:"正在生成或 AI 未配置",cannotJumpForward:"无法跳过前序步骤",testInProgressOrNoKey:"正在测试或未配置 API 密钥",workflowStepRunning:"工作流步骤正在运行",workflowRunning:"工作流步骤正在运行",sessionHistory:"会话历史",newSession:"新会话",attachFile:"附加本地文件",maximizePanel:"专注模式",restorePanel:"退出专注",dockToSide:"停靠到侧边栏",openAsPopup:"弹窗模式",closePanel:"关闭",newChat:"新对话",closeSession:"关闭会话"}},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:"Wiki",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",capture:"Capture",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 \xb7 drag images",executingTool:"Executing tool…",toolRunning:"Running...",copyMessage:"Copy",toolInput:"Input",toolOutput:"Output",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.",proxyCompatMode:"Using compatibility mode (non-streaming)...",proxyCompatFailed:a=>`Compatibility mode failed: ${a}. Please check your Base URL, API key, and model name.`,proxyCompatDetecting:"Detecting proxy compatibility, switching to non-streaming mode...",proxyCompatAlsoFailed:a=>`Compatibility mode also failed: ${a}. Please check your Base URL, API key, and model name.`,retry:"Retry",suggestions:[{label:"Organize inbox",prompt:"Organize my inbox files into the right spaces"},{label:"Research a topic",prompt:"Research the latest trends in AI agents"},{label:"Draft weekly review",prompt:"Draft a weekly review based on my recent notes"},{label:"Brainstorm ideas",prompt:"Brainstorm 3 creative ideas for my next project"}],homeCategories:[{label:"Knowledge",items:[{label:"Organize into Spaces",desc:"Sort scattered notes by topic",prompt:"Help me organize my recent unstructured notes into appropriate spaces with proper tags"},{label:"Sync & Deduplicate",desc:"Clean up cross-platform overlap",prompt:"Find duplicate or overlapping content across my spaces and help me consolidate them"},{label:"Auto-tag & Categorize",desc:"Add structure to raw notes",prompt:"Review my untagged notes and suggest categories and tags for each"},{label:"Weekly Digest",desc:"Summarize this week's changes",prompt:"Summarize everything I added or changed this week across all spaces"}]},{label:"Writing",items:[{label:"Blog from Notes",desc:"Turn drafts into polished posts",prompt:"Turn my draft notes into a polished blog post with clear structure"},{label:"Product Copy",desc:"Landing page & descriptions",prompt:"Write compelling product description and landing page copy based on my notes"},{label:"Polish & Refine",desc:"Improve clarity and tone",prompt:"Review this document for clarity, tone, and structure, then rewrite the weak parts"},{label:"Slide Deck Outline",desc:"Presentation structure from notes",prompt:"Create a slide deck outline from my notes on this topic"}]},{label:"Analysis",items:[{label:"Competitive Overview",desc:"Compare products & differentiators",prompt:"Compare the products in my research notes and identify key differentiators"},{label:"Extract Insights",desc:"Patterns across reading notes",prompt:"What are the most important insights and patterns across my reading notes?"},{label:"Decision Framework",desc:"Pros, cons, recommendation",prompt:"Help me structure this decision with pros, cons, risks, and a recommendation"},{label:"GTM Strategy",desc:"Go-to-market from research",prompt:"Help me build a go-to-market plan based on my product and market research notes"}]},{label:"Innovation",items:[{label:"Challenge My Assumptions",desc:"Find blind spots in my thinking",prompt:"Review my notes and challenge the key assumptions I'm making. What am I missing?"},{label:"What If Scenarios",desc:"Explore alternative futures",prompt:'Based on my research, generate 3 contrarian "what if" scenarios I haven\'t considered'},{label:"Combine & Remix Ideas",desc:"Cross-pollinate across domains",prompt:"Find unexpected connections between ideas in different spaces and suggest novel combinations"},{label:"Spot the Opportunity",desc:"Gaps others are missing",prompt:"Analyze my market research notes and identify underserved niches or emerging opportunities"}]}],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 ...`,operations:{save_file:"Save file",append_to_file:"Append to file",insert_lines:"Insert lines",update_lines:"Update lines",insert_after_heading:"Insert after heading",update_section:"Update section",create_file:"Create file",delete_file:"Delete file",rename_file:"Rename file",move_file:"Move file",create_space:"Create space",rename_space:"Rename space",append_csv:"Append to CSV",import_file:"Import file",legacy_agent_diff_import:"Import from Agent Diff"},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",wikiTagline:"Your knowledge spaces, organized.",sortRecent:"Recent",sortName:"A-Z",sortCount:"File Count",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`,viewAllFiles:a=>`View all ${a} files in Inbox`,viewAllHistory:a=>`View all ${a} records →`,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:
132
+ `})]})}c(95054)},52415:(a,b,c)=>{Promise.resolve().then(c.bind(c,43248))},52610:(a,b,c)=>{"use strict";c.d(b,{D:()=>e});let d={ask:{title:"MindOS Agent",fabLabel:"AI 助手",placeholder:"输入问题… @ 附加文件,/ 技能",emptyPrompt:"有什么可以帮你?",emptyHint:"输入 @ 引用文件 \xb7 / 使用技能 \xb7 拖拽图片",executingTool:"正在执行工具…",toolRunning:"运行中...",copyMessage:"复制",toolInput:"输入",toolOutput:"输出",send:"发送",newlineHint:"换行",panelComposerResize:"向上拖拽以拉高输入区",panelComposerFooter:"拉高输入区",panelComposerResetHint:"双击恢复默认高度",panelComposerKeyboard:"方向键调节高度;Home/End 最小或最大",attachFile:"上下文",attachFileLabel:"文档",attachImageLabel:"图片",uploadedFiles:"已上传",skillsHint:"技能",attachCurrent:"附加当前文件",stopTitle:"停止",cancelReconnect:"取消重连",connecting:"正在和你一起思考...",thinking:"思考中...",thinkingLabel:"思考中",searching:"正在搜索知识库...",generating:"正在生成回复...",stopped:"已停止生成。",errorNoResponse:"AI 未返回有效内容。可能原因:模型不支持流式输出、中转站兼容性问题、或请求超出上下文限制。",reconnecting:(a,b)=>`连接中断,正在重连 (${a}/${b})...`,reconnectFailed:"多次重连失败,请检查网络后重试。",proxyCompatMode:"正在以兼容模式调用...",proxyCompatFailed:a=>`兼容模式失败:${a}。请检查 Base URL、API Key 和模型名称。`,proxyCompatDetecting:"正在检测接口兼容性,切换到兼容模式重试...",proxyCompatAlsoFailed:a=>`兼容模式也失败了:${a}。请检查 Base URL、API Key 和模型名称。`,retry:"重试",suggestions:[{label:"整理收件箱",prompt:"把收件箱的文件整理到对应空间"},{label:"调研一个话题",prompt:"调研一下 AI Agent 的最新趋势"},{label:"起草周报",prompt:"根据最近的笔记起草一份周报"},{label:"想新 idea",prompt:"为我的下一个项目想 3 个新 idea"}],homeCategories:[{label:"知识管理",items:[{label:"整理到 Space",desc:"按主题归类零散笔记",prompt:"帮我把最近的零散笔记整理到合适的 Space,并打好标签"},{label:"同步去重",desc:"清理跨平台重复内容",prompt:"找出我各个 Space 中重复或重叠的内容,帮我合并整理"},{label:"自动打标签",desc:"给未分类笔记加结构",prompt:"检查我未标记的笔记,建议合适的分类和标签"},{label:"每周摘要",desc:"汇总本周变更",prompt:"总结我这周在所有 Space 中新增和修改的内容"}]},{label:"内容创作",items:[{label:"笔记变博客",desc:"草稿变成精修文章",prompt:"把我的草稿笔记改写成一篇结构清晰的博客文章"},{label:"产品文案",desc:"落地页与产品描述",prompt:"根据我的笔记写一段有吸引力的产品描述和落地页文案"},{label:"润色优化",desc:"提升清晰度和语气",prompt:"审阅这篇文档的清晰度、语气和结构,重写不好的部分"},{label:"演示大纲",desc:"从笔记生成演讲结构",prompt:"根据我关于这个主题的笔记,创建一个演示文稿大纲"}]},{label:"分析洞察",items:[{label:"竞品对比",desc:"比较产品差异化",prompt:"对比我调研笔记中的产品,找出关键差异点"},{label:"提炼洞察",desc:"发现阅读笔记中的规律",prompt:"我的阅读笔记中有哪些最重要的见解和规律?"},{label:"决策框架",desc:"利弊分析与建议",prompt:"帮我用利弊、风险和建议来结构化这个决策"},{label:"GTM 策略",desc:"从调研到上市方案",prompt:"根据我的产品和市场调研笔记,帮我制定一份上市计划"}]},{label:"启发创新",items:[{label:"挑战假设",desc:"找出思维盲点",prompt:"审视我的笔记,挑战我正在做的关键假设。我遗漏了什么?"},{label:"反常识探索",desc:"探索替代可能性",prompt:"根据我的调研,生成 3 个我没考虑过的反常识场景"},{label:"跨域融合",desc:"不同领域的创意碰撞",prompt:"在我不同 Space 的想法中找到意想不到的联系,并建议新颖的组合"},{label:"发现机会",desc:"别人没看到的空白",prompt:"分析我的市场调研笔记,找出未被充分服务的小众市场或新兴机会"}]}],modeChat:"对话",modeAgent:"Agent",modeChatHint:"可搜索/阅读知识库 \xb7 省 token",modeAgentHint:"完整工具权限 \xb7 可修改知识库",sessionHistory:"对话历史",clearAll:"清除全部",confirmClear:"确认清除?",noSessions:"暂无历史对话。",renameSession:"重命名",draftingHint:"AI 仍在执行,你可以先输入下一步。",providerCapsule:"切换模型服务商",providerDefault:"默认",providerNoKey:"暂无已配置的服务商"},changes:{unreadBanner:a=>`${a} 条内容变更未读`,reviewNow:"立即查看",dismiss:"关闭提醒",title:"内容变更",subtitle:"集中查看用户与 Agent 的最近编辑记录。",eventsCount:a=>`${a} 条事件`,unreadCount:a=>`${a} 条未读`,refresh:"刷新",markSeen:"标记已读",markAllRead:"全部已读",filters:{filePath:"文件路径",filePathPlaceholder:"例如:Projects/plan.md",source:"Agents(来源)",operation:"工具(操作)",operationAll:"全部操作",keyword:"关键词",keywordPlaceholder:"摘要 / 操作 / 路径",all:"全部",agent:"Agent",user:"用户",system:"系统"},loading:"正在加载变更...",empty:"暂无内容变更。",emptyHint:"你或 Agent 编辑文件时,变更会显示在这里。",open:"打开",unchangedLines:a=>`... ${a} 行未变更 ...`,operations:{save_file:"保存文件",append_to_file:"追加到文件",insert_lines:"插入行",update_lines:"更新行",insert_after_heading:"标题后插入",update_section:"更新章节",create_file:"创建文件",delete_file:"删除文件",rename_file:"重命名文件",move_file:"移动文件",create_space:"创建空间",rename_space:"重命名空间",append_csv:"追加到 CSV",import_file:"导入文件",legacy_agent_diff_import:"从 Agent Diff 导入"},summaries:{updatedFileContent:"更新了文件内容",appendedContent:"追加了文件内容",insertedLines:a=>`插入了 ${a} 行`,updatedLines:(a,b)=>`更新了第 ${a}-${b} 行`,insertedAfterHeading:a=>`在标题「${a}」后插入了内容`,updatedSection:a=>`更新了章节「${a}」`,movedToTrash:"移到了回收站",renamedFile:a=>`重命名为 ${a}`,createdFile:"创建了文件",movedFile:a=>`移动到了 ${a}`,createdSpace:"创建了空间",renamedSpace:a=>`重命名空间为 ${a}`,appendedCsvRow:a=>`追加了 CSV 行(${a} 个单元格)`,importedFile:"导入了文件到知识库",importedLegacyDiff:"从 Agent Diff 导入了变更"},relativeTime:{justNow:"刚刚",minutesAgo:a=>`${a} 分钟前`,hoursAgo:a=>`${a} 小时前`,daysAgo:a=>`${a} 天前`}},hints:{noValidFiles:"未选择有效文件",aiOrganizing:"AI 正在整理中",importInProgress:"正在导入",templateInitializing:"正在初始化另一个模板",configureAiKey:"请在 设置 → AI 中配置 API 密钥",syncInProgress:"正在同步中",toggleInProgress:"正在切换中",typeMessage:"请输入消息",mentionInProgress:"正在输入提及或命令",cleanupInProgress:"正在清理中",tokenResetInProgress:"正在重置令牌",aiNotConfigured:"AI 未配置或正在生成",generationInProgress:"正在生成或 AI 未配置",cannotJumpForward:"无法跳过前序步骤",testInProgressOrNoKey:"正在测试或未配置 API 密钥",workflowStepRunning:"工作流步骤正在运行",workflowRunning:"工作流步骤正在运行",sessionHistory:"会话历史",newSession:"新会话",attachFile:"附加本地文件",maximizePanel:"专注模式",restorePanel:"退出专注",dockToSide:"停靠到侧边栏",openAsPopup:"弹窗模式",closePanel:"关闭",newChat:"新对话",closeSession:"关闭会话"}},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:"Wiki",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",capture:"Capture",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 \xb7 drag images",executingTool:"Executing tool…",toolRunning:"Running...",copyMessage:"Copy",toolInput:"Input",toolOutput:"Output",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.",proxyCompatMode:"Using compatibility mode (non-streaming)...",proxyCompatFailed:a=>`Compatibility mode failed: ${a}. Please check your Base URL, API key, and model name.`,proxyCompatDetecting:"Detecting proxy compatibility, switching to non-streaming mode...",proxyCompatAlsoFailed:a=>`Compatibility mode also failed: ${a}. Please check your Base URL, API key, and model name.`,retry:"Retry",suggestions:[{label:"Organize inbox",prompt:"Organize my inbox files into the right spaces"},{label:"Research a topic",prompt:"Research the latest trends in AI agents"},{label:"Draft weekly review",prompt:"Draft a weekly review based on my recent notes"},{label:"Brainstorm ideas",prompt:"Brainstorm 3 creative ideas for my next project"}],homeCategories:[{label:"Knowledge",items:[{label:"Organize into Spaces",desc:"Sort scattered notes by topic",prompt:"Help me organize my recent unstructured notes into appropriate spaces with proper tags"},{label:"Sync & Deduplicate",desc:"Clean up cross-platform overlap",prompt:"Find duplicate or overlapping content across my spaces and help me consolidate them"},{label:"Auto-tag & Categorize",desc:"Add structure to raw notes",prompt:"Review my untagged notes and suggest categories and tags for each"},{label:"Weekly Digest",desc:"Summarize this week's changes",prompt:"Summarize everything I added or changed this week across all spaces"}]},{label:"Writing",items:[{label:"Blog from Notes",desc:"Turn drafts into polished posts",prompt:"Turn my draft notes into a polished blog post with clear structure"},{label:"Product Copy",desc:"Landing page & descriptions",prompt:"Write compelling product description and landing page copy based on my notes"},{label:"Polish & Refine",desc:"Improve clarity and tone",prompt:"Review this document for clarity, tone, and structure, then rewrite the weak parts"},{label:"Slide Deck Outline",desc:"Presentation structure from notes",prompt:"Create a slide deck outline from my notes on this topic"}]},{label:"Analysis",items:[{label:"Competitive Overview",desc:"Compare products & differentiators",prompt:"Compare the products in my research notes and identify key differentiators"},{label:"Extract Insights",desc:"Patterns across reading notes",prompt:"What are the most important insights and patterns across my reading notes?"},{label:"Decision Framework",desc:"Pros, cons, recommendation",prompt:"Help me structure this decision with pros, cons, risks, and a recommendation"},{label:"GTM Strategy",desc:"Go-to-market from research",prompt:"Help me build a go-to-market plan based on my product and market research notes"}]},{label:"Innovation",items:[{label:"Challenge My Assumptions",desc:"Find blind spots in my thinking",prompt:"Review my notes and challenge the key assumptions I'm making. What am I missing?"},{label:"What If Scenarios",desc:"Explore alternative futures",prompt:'Based on my research, generate 3 contrarian "what if" scenarios I haven\'t considered'},{label:"Combine & Remix Ideas",desc:"Cross-pollinate across domains",prompt:"Find unexpected connections between ideas in different spaces and suggest novel combinations"},{label:"Spot the Opportunity",desc:"Gaps others are missing",prompt:"Analyze my market research notes and identify underserved niches or emerging opportunities"}]}],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.",emptyHint:"Changes made to your files will appear here when you or an agent edits content.",open:"Open",unchangedLines:a=>`... ${a} unchanged lines ...`,operations:{save_file:"Save file",append_to_file:"Append to file",insert_lines:"Insert lines",update_lines:"Update lines",insert_after_heading:"Insert after heading",update_section:"Update section",create_file:"Create file",delete_file:"Delete file",rename_file:"Rename file",move_file:"Move file",create_space:"Create space",rename_space:"Rename space",append_csv:"Append to CSV",import_file:"Import file",legacy_agent_diff_import:"Import from Agent Diff"},summaries:{updatedFileContent:"Updated file content",appendedContent:"Appended content to file",insertedLines:a=>`Inserted ${a} line(s)`,updatedLines:(a,b)=>`Updated lines ${a}-${b}`,insertedAfterHeading:a=>`Inserted content after heading "${a}"`,updatedSection:a=>`Updated section "${a}"`,movedToTrash:"Moved to trash",renamedFile:a=>`Renamed file to ${a}`,createdFile:"Created file",movedFile:a=>`Moved file to ${a}`,createdSpace:"Created space",renamedSpace:a=>`Renamed space to ${a}`,appendedCsvRow:a=>`Appended CSV row (${a} cell${1===a?"":"s"})`,importedFile:"Imported file into knowledge base",importedLegacyDiff:"Imported legacy agent diff"},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",wikiTagline:"Your knowledge spaces, organized.",sortRecent:"Recent",sortName:"A-Z",sortCount:"File Count",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`,viewAllFiles:a=>`View all ${a} files in Inbox`,viewAllHistory:a=>`View all ${a} records →`,agingHint:"7+ days",savedToast:a=>`${a} file${1===a?"":"s"} saved to Capture`,savedToDir:(a,b)=>`${a} file${1===a?"":"s"} saved to ${b}`,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:
133
133
 
134
- ${a.map(a=>`- Inbox/${a}`).join("\n")}`,dropOverlay:"Drop to save to Capture",dropOverlayFormats:"md \xb7 txt \xb7 pdf \xb7 csv \xb7 json",noMindRoot:"Please configure your knowledge base first",saveFailed:"Failed to save files. Check disk space and permissions.",organizeFailed:"Could not read files for organizing. Check file permissions."},pulse:{title:"Your Agents",manage:"Manage",connectTitle:"Connect your AI tools",connectDesc:"Let Cursor, Claude Code, and ChatGPT read your notes.",connectAction:"Connect Agent",active:"Connected",detected:"Detected",notFound:"Not found",running:"Online",offline:"Offline",summary:(a,b)=>`${a} Agent${1!==a?"s":""} \xb7 ${b} Skills`,skillCount:(a,b)=>`${a}/${b} skills`,showMore:a=>`${a} more agent${1!==a?"s":""}`,showLess:"Show less",otherDetected:"Detected"},fileTree:{newFileTitle:"New file in this directory",rename:"Rename",delete:"Delete",create:"Create",enterFileName:"Enter a file name",failed:"Failed",confirmDelete:a=>`Delete "${a}"? You can recover from Trash for 30 days.`,rules:"Rules",about:"About",viewAll:"View all",editRules:"Edit Rules",viewRules:"View Rules",renameSpace:"Rename Space",deleteSpace:"Delete Space",confirmDeleteSpace:a=>`Delete space "${a}" and all its files? You can recover from Trash for 30 days.`,convertToSpace:"Convert to Space",deleteFolder:"Delete Folder",confirmDeleteFolder:a=>`Delete folder "${a}" and all its contents? You can recover from Trash for 30 days.`,newFile:"New File",importFile:"Import File",importToSpace:"Import file to this space",copyPath:"Copy Path",pathCopied:"Path copied",pinToFavorites:"Pin to Favorites",removeFromFavorites:"Remove from Favorites",export:"Export..."},pinnedFiles:{title:"Pinned Files",addedToast:"Added to Favorites",removedToast:"Removed from Favorites",empty:"No pinned files",emptyHint:"Click the star icon on any file to pin it here"},trash:{title:"Trash",subtitle:"Items you delete appear here for 30 days.",empty:"No deleted files yet.",emptySubtext:"Items you delete will appear here for 30 days.",emptyTrash:"Empty Trash",emptyTrashConfirm:"Permanently delete all items in Trash? This cannot be undone.",restore:"Restore",deletePermanently:"Delete Forever",deletePermanentlyConfirm:a=>`Permanently delete "${a}"? This cannot be undone.`,from:"From",deletedAgo:a=>`Deleted ${a}`,expiresIn:a=>`Expires in ${a} day${1!==a?"s":""}`,restored:"Restored successfully",deleted:"Permanently deleted",movedToTrash:"Deleted",undo:"Undo",undoFailed:"Undo failed",restoreFailed:"Could not restore file. Check disk space and try again.",deleteFailed:"Could not permanently delete. Please try again.",emptyFailed:"Could not empty trash. Please try again.",emptied:a=>`Emptied ${a} item${1!==a?"s":""} from Trash`,restoreConflict:"A file with this name already exists at the original location.",overwrite:"Overwrite",saveAsCopy:"Save as Copy",itemCount:a=>`${a} item${1!==a?"s":""}`,undoDelete:"Undo",viewInTrash:"View in Trash",fileDeleted:a=>`"${a}" moved to Trash`,cancel:"Cancel",justNow:"just now",minutesAgo:a=>`${a}m ago`,hoursAgo:a=>`${a}h ago`,daysAgo:a=>`${a}d ago`},export:{title:"Export",exportFile:"Export File",exportSpace:"Export Space",chooseFormat:"Choose format",formatMd:"Markdown (.md)",formatMdDesc:"Original format, editable",formatHtml:"HTML (.html)",formatHtmlDesc:"Static webpage, shareable",formatZipMd:"Markdown ZIP",formatZipMdDesc:"All files in original format",formatZipHtml:"HTML ZIP",formatZipHtmlDesc:"All files as webpages",preview:"Preview",exporting:"Exporting...",exportButton:"Export",cancel:"Cancel",close:"Done",done:"Export Complete",downloadAgain:"Download Again",fileCount:a=>`${a} file${1!==a?"s":""}`,downloaded:"Downloaded",error:"Export failed. Please check disk space and try again.",retry:"Retry"},fileImport:{title:"Import Files",subtitle:"Save files to your knowledge base or let AI organize them",dropzoneText:"Drag files here, or",dropzoneButton:"click to select",dropzoneCompact:"Drag more files, or",dropzoneCompactButton:"click to add",dropzoneMobile:"Tap to select files",fileCount:a=>`${a} file${1!==a?"s":""}`,clearAll:"Clear all",unsupported:"Unsupported file type",tooLarge:a=>`File too large (max ${a})`,archiveTitle:"Save to Knowledge Base",archiveDesc:"Save as-is to a space",digestTitle:"AI Organize",digestDesc:"Extract key points into notes",archiveConfigTitle:"Save to Knowledge Base",back:"← Back",targetSpace:"Target space",rootDir:"Root",conflictLabel:"If file already exists",conflictRename:"Auto-rename (add number suffix)",conflictSkip:"Skip",conflictOverwrite:"Overwrite existing file",overwriteWarn:"This will permanently replace existing file content",cancel:"Cancel",importButton:a=>`Save ${a} file${1!==a?"s":""}`,importing:"Saving...",preparing:"Preparing...",successToast:(a,b)=>`Saved ${a} file${1!==a?"s":""} to ${b||"knowledge base"}`,updatedIndex:a=>`Updated ${a} index file${1!==a?"s":""}`,partialToast:(a,b)=>`Saved ${a}/${b} files`,skipReason:"File already exists",failToast:"Import failed",retry:"Retry",undo:"Undo",discardTitle:"Discard import?",discardMessage:a=>`Discard ${a} selected file${1!==a?"s":""}?`,discardConfirm:"Discard",discardCancel:"Cancel",dropOverlay:"Drop files to import into knowledge base",dropOverlayFormats:"Supports .md .txt .pdf .csv .json .yaml .html",onboardingHint:"Already have notes? Import files →",digestPromptSingle:(a,b)=>{let c=b?` under the "${b}" space`:"";return`The user uploaded "${a}". You MUST:
134
+ ${a.map(a=>`- Inbox/${a}`).join("\n")}`,dropOverlay:"Drop to save to Capture",dropOverlayFormats:"md \xb7 txt \xb7 pdf \xb7 csv \xb7 json",noMindRoot:"Please configure your knowledge base first",saveFailed:"Failed to save files. Check disk space and permissions.",organizeFailed:"Could not read files for organizing. Check file permissions.",removeFile:"Remove from Inbox",openFile:"Open",copyName:"Copy Name",fileRemoved:"File removed from Inbox",fileRemoveFailed:"Failed to remove file"},pulse:{title:"Your Agents",manage:"Manage",connectTitle:"Connect your AI tools",connectDesc:"Let Cursor, Claude Code, and ChatGPT read your notes.",connectAction:"Connect Agent",active:"Connected",detected:"Detected",notFound:"Not found",running:"Online",offline:"Offline",summary:(a,b)=>`${a} Agent${1!==a?"s":""} \xb7 ${b} Skills`,skillCount:(a,b)=>`${a}/${b} skills`,showMore:a=>`${a} more agent${1!==a?"s":""}`,showLess:"Show less",otherDetected:"Detected"},fileTree:{newFileTitle:"New file in this directory",rename:"Rename",delete:"Delete",create:"Create",enterFileName:"Enter a file name",failed:"Failed",confirmDelete:a=>`Delete "${a}"? You can recover from Trash for 30 days.`,rules:"Rules",about:"About",viewAll:"View all",editRules:"Edit Rules",viewRules:"View Rules",renameSpace:"Rename Space",deleteSpace:"Delete Space",confirmDeleteSpace:a=>`Delete space "${a}" and all its files? You can recover from Trash for 30 days.`,convertToSpace:"Convert to Space",deleteFolder:"Delete Folder",confirmDeleteFolder:a=>`Delete folder "${a}" and all its contents? You can recover from Trash for 30 days.`,newFile:"New File",importFile:"Import File",importToSpace:"Import file to this space",copyPath:"Copy Path",pathCopied:"Path copied",pinToFavorites:"Pin to Favorites",removeFromFavorites:"Remove from Favorites",export:"Export..."},pinnedFiles:{title:"Pinned Files",addedToast:"Added to Favorites",removedToast:"Removed from Favorites",empty:"No pinned files",emptyHint:"Click the star icon on any file to pin it here"},trash:{title:"Trash",subtitle:"Items you delete appear here for 30 days.",empty:"No deleted files yet.",emptySubtext:"Items you delete will appear here for 30 days.",emptyTrash:"Empty Trash",emptyTrashConfirm:"Permanently delete all items in Trash? This cannot be undone.",restore:"Restore",deletePermanently:"Delete Forever",deletePermanentlyConfirm:a=>`Permanently delete "${a}"? This cannot be undone.`,from:"From",deletedAgo:a=>`Deleted ${a}`,expiresIn:a=>`Expires in ${a} day${1!==a?"s":""}`,restored:"Restored successfully",deleted:"Permanently deleted",movedToTrash:"Deleted",undo:"Undo",undoFailed:"Undo failed",restoreFailed:"Could not restore file. Check disk space and try again.",deleteFailed:"Could not permanently delete. Please try again.",emptyFailed:"Could not empty trash. Please try again.",emptied:a=>`Emptied ${a} item${1!==a?"s":""} from Trash`,restoreConflict:"A file with this name already exists at the original location.",overwrite:"Overwrite",saveAsCopy:"Save as Copy",itemCount:a=>`${a} item${1!==a?"s":""}`,undoDelete:"Undo",viewInTrash:"View in Trash",fileDeleted:a=>`"${a}" moved to Trash`,cancel:"Cancel",justNow:"just now",minutesAgo:a=>`${a}m ago`,hoursAgo:a=>`${a}h ago`,daysAgo:a=>`${a}d ago`},export:{title:"Export",exportFile:"Export File",exportSpace:"Export Space",chooseFormat:"Choose format",formatMd:"Markdown (.md)",formatMdDesc:"Original format, editable",formatHtml:"HTML (.html)",formatHtmlDesc:"Static webpage, shareable",formatZipMd:"Markdown ZIP",formatZipMdDesc:"All files in original format",formatZipHtml:"HTML ZIP",formatZipHtmlDesc:"All files as webpages",preview:"Preview",exporting:"Exporting...",exportButton:"Export",cancel:"Cancel",close:"Done",done:"Export Complete",downloadAgain:"Download Again",fileCount:a=>`${a} file${1!==a?"s":""}`,downloaded:"Downloaded",error:"Export failed. Please check disk space and try again.",retry:"Retry"},fileImport:{title:"Import Files",subtitle:"Save files to your knowledge base or let AI organize them",dropzoneText:"Drag files here, or",dropzoneButton:"click to select",dropzoneCompact:"Drag more files, or",dropzoneCompactButton:"click to add",dropzoneMobile:"Tap to select files",fileCount:a=>`${a} file${1!==a?"s":""}`,clearAll:"Clear all",unsupported:"Unsupported file type",tooLarge:a=>`File too large (max ${a})`,archiveTitle:"Save to Knowledge Base",archiveDesc:"Save as-is to a space",digestTitle:"AI Organize",digestDesc:"Extract key points into notes",archiveConfigTitle:"Save to Knowledge Base",back:"← Back",targetSpace:"Target space",rootDir:"Root",conflictLabel:"If file already exists",conflictRename:"Auto-rename (add number suffix)",conflictSkip:"Skip",conflictOverwrite:"Overwrite existing file",overwriteWarn:"This will permanently replace existing file content",cancel:"Cancel",importButton:a=>`Save ${a} file${1!==a?"s":""}`,importing:"Saving...",preparing:"Preparing...",successToast:(a,b)=>`Saved ${a} file${1!==a?"s":""} to ${b||"knowledge base"}`,updatedIndex:a=>`Updated ${a} index file${1!==a?"s":""}`,partialToast:(a,b)=>`Saved ${a}/${b} files`,skipReason:"File already exists",failToast:"Import failed",retry:"Retry",undo:"Undo",discardTitle:"Discard import?",discardMessage:a=>`Discard ${a} selected file${1!==a?"s":""}?`,discardConfirm:"Discard",discardCancel:"Cancel",dropOverlay:"Drop files to import into knowledge base",dropOverlayFormats:"Supports .md .txt .pdf .csv .json .yaml .html",onboardingHint:"Already have notes? Import files →",digestPromptSingle:(a,b)=>{let c=b?` under the "${b}" space`:"";return`The user uploaded "${a}". You MUST:
135
135
  1. Read the content from the "USER-UPLOADED FILES" section above
136
136
  2. Extract and reorganize the key information into well-structured Markdown notes
137
137
  3. Save the result${c} in the knowledge base — create new files or update existing ones as appropriate
@@ -143,9 +143,9 @@ Do NOT just reply with a text summary. You must actually write to the knowledge
143
143
 
144
144
  Do NOT just reply with a text summary. You must actually write to the knowledge base.`},arrowTo:"→",remove:"Remove",aiRecommended:"Recommended",aiRecommendedHint:"Auto-matched by filename",conflictsFound:a=>`${a} file${1!==a?"s":""} already exist${1===a?"s":""}`,organizeTitle:"AI Organizing",organizeProcessing:"AI is analyzing and organizing your files...",organizeConnecting:"Connecting to AI...",organizeAnalyzing:"AI is analyzing your files...",organizeReading:a=>a?`Reading ${a}...`:"Reading files...",organizeThinking:"AI is thinking deeply...",organizeWriting:a=>a?`Writing ${a}...`:"Writing files...",organizeElapsed:a=>{let b=Math.floor(a/60);return`${b}:${(a%60).toString().padStart(2,"0")}`},organizeCancel:"Cancel",organizeMinimize:"Continue browsing",organizeExpand:"View",organizeCreating:a=>`Creating ${a}`,organizeUpdating:a=>`Updating ${a}`,organizeReviewTitle:"Organization Complete",organizeErrorTitle:"Organization Failed",organizeReviewDesc:a=>`AI organized your files into ${a} change${1!==a?"s":""}`,organizeCreated:"Created",organizeUpdated:"Updated",organizeFailed:"Failed",organizeNoChanges:"AI analyzed your files but made no changes.",organizeToolCallsInfo:a=>`AI executed ${a} operation${a>1?"s":""} — check knowledge base for updates`,organizeError:"Organization failed",organizeRetry:"Retry",organizeDone:"Done",organizeUndoAll:"Undo All",organizeUndoOne:"Undo",organizeUndone:"Undone",organizeViewFile:"View file",organizeUndoSuccess:a=>`Reverted ${a} file${1!==a?"s":""}`,organizeDetailTitle:"AI Organize Details",organizeSourceFiles:"Source Files",organizeSummaryLabel:"AI Summary",organizeChangesLabel:a=>`Changes (${a})`,organizeNoSummary:"AI is working...",organizeMinimizeModal:"Minimize"},importHistory:{title:"Import History",clearAll:"Clear history",clearConfirm:"Clear all history? This cannot be undone.",emptyTitle:"No import history yet",emptyDesc:"AI organize results will appear here",back:"← Back",sourceLabel:"Source",changesCount:(a,b)=>`${a}/${b} changes`,recordCount:a=>`${a} record${1!==a?"s":""}`,today:"Today",yesterday:"Yesterday",older:"Older",processedArchive:"Processed files are archived in Inbox/.processed/"},dirView:{gridView:"Grid view",listView:"List view",emptyFolder:"This folder is empty.",fileCount:a=>`${a} files`,newFile:"New file",uninitTitle:"Space not yet initialized",uninitDesc:"README.md and INSTRUCTION.md contain default templates. Configure an AI API key in Settings to auto-generate personalized content, or edit them manually.",uninitEditReadme:"Edit README",uninitEditInstruction:"Edit Instruction",uninitSettings:"Settings"},view:{saveDirectory:"Directory",saveFileName:"File name",delete:"Delete",deleteConfirm:a=>`Delete "${a}"? It will be moved to Trash.`,cancel:"Cancel",rename:"Rename",copyPath:"Copy Path",more:"More",dismiss:"Dismiss",tocTitle:"On this page",tocCollapse:"Collapse",tocExpand:"Expand",emptyNote:"This note is empty. Press E to start writing.",switchToDoc:"Document view",switchToGraph:"Wiki Graph"},findInPage:{placeholder:"Find in document…",matchCount:(a,b)=>`${a} of ${b}`,noResults:"No results"},panels:{agents:{title:"Agents",connected:"connected",refresh:"Refresh agent status",retry:"Retry",failedToLoad:"Failed to load agents",mcpServer:"MCP Server",stopped:"Stopped",sectionConnected:"Connected",sectionDetected:"Detected",sectionNotDetected:"Not Detected",noAgents:"No agents detected.",autoRefresh:"Auto-refresh every 30s",connect:"Connect",installing:"Installing...",install:"Install",installSuccess:"Installed",installFailed:"Install failed",retryInstall:"Retry",copyConfig:"Copy Config",copied:"Copied!",transportLocal:"Local",transportRemote:"Remote",configPath:"Config path",noAuthWarning:"No auth token — set in Advanced Config",skillsTitle:"Skills",skillsActive:"active",builtinSkills:"Built-in",newSkill:"+ New",advancedConfig:"Advanced Config →",navOverview:"Overview",navMcp:"MCP",navSkills:"Skills",navNetwork:"Network",navSessions:"Sessions",navActivity:"Activity",activitySubtitle:"Agent operations audit log.",activity:{loading:"Loading activity...",empty:"No agent operations logged yet.",emptyHint:"Operations from connected agents will appear here.",agentLabel:"Agent"},a2aTabTitle:"Remote Agents",a2aTabEmpty:"No remote agents",a2aTabEmptyHint:"Discover agents to enable cross-agent delegation.",a2aRemoveAgent:"Remove",rosterLabel:"Your setup",notFoundDetail:"This agent app was not detected on this machine. Install it, then refresh the list.",skillsEmptyHint:"Enable and edit skills in MCP & Skills settings.",backToList:"Back",closeAgentDetail:"Close",agentDetailPanelAria:"Agent connection configuration",agentDetailTransport:"Transport",agentDetailSnippet:"Config snippet",a2aLabel:"A2A",a2aReady:"A2A Ready",a2aChecking:"Checking A2A...",a2aUnavailable:"A2A Unavailable",a2aRemote:"Remote",a2aDiscover:"Discover Remote Agent",a2aDiscoverHint:"Connect to an external A2A agent by URL",a2aDiscoverPlaceholder:"https://agent.example.com",a2aDiscovering:"Discovering...",a2aDiscoverSuccess:"Agent discovered!",a2aDiscoverFailed:"No A2A agent found at this URL",a2aDiscoverFailedHint:"The server may not support the A2A protocol. Check the URL and try again.",a2aSkills:"Skills",a2aEndpoint:"Endpoint",a2aVersion:"Version",a2aCapabilities:"A2A Capabilities",a2aStatus:"Status",a2aConnected:"Connected & A2A Ready",a2aNoRemote:"No remote agents",a2aNoRemoteHint:"Discover remote agents to enable cross-agent delegation.",a2aDelegations:"Recent Delegations",a2aDelegationsEmpty:"No delegations yet",a2aDelegationCompleted:"Completed",a2aDelegationFailed:"Failed",a2aDelegationPending:"Pending",acpSectionTitle:"Installed Agents",acpSectionDesc:a=>`${a} agent${1!==a?"s":""} detected`,acpNoInstalled:"No coding agents detected. Install one to delegate tasks directly from MindOS.",acpAvailableTitle:"Available in Registry",acpAvailableDesc:a=>`${a} more agent${1!==a?"s":""} available`,acpShowAvailable:"Show",acpHideAvailable:"Hide",acpCopyCmd:"Copy",acpCopied:"Copied",acpTransportNpx:"npx",acpTransportBinary:"binary",acpTransportUvx:"uvx",acpTransportStdio:"stdio",acpUseAgent:"Use",acpComingSoon:"Coming soon — use Ask AI to invoke",acpReady:"Ready",acpNotInstalled:"Not Installed",acpScan:"Re-scan",acpInstallHint:a=>`Install with: ${a}`,acpInstall:"Install",acpInstalling:"Installing…",acpLoading:"Loading ACP registry…",acpLoadFailed:"Failed to load ACP registry.",acpRetry:"Retry",acpQuickReview:"Review code",acpQuickFix:"Fix bugs",acpQuickExplain:"Explain repo",acpUseWith:a=>`Use ${a} to `,acpDefaultAgent:"MindOS Agent",acpSelectAgent:"Select Agent",acpChangeAgent:"Change agent",acpConfigToggle:"Configure",acpConfigCommand:"Command",acpConfigArgs:"Args",acpConfigEnv:"Env",acpConfigEnvAdd:"Add env var",acpConfigSource:"Source",acpConfigSourceBuiltin:"built-in",acpConfigSourceRegistry:"registry",acpConfigSourceUser:"custom",acpConfigReset:"Reset",acpConfigSave:"Save",acpConfigSaved:"Saved",acpConfigPath:"Path",networkEmptyTitle:"Connect to the agent ecosystem",networkEmptyDesc:"Discover remote agents or browse coding agents from the ACP registry.",networkDiscoverBtn:"Discover Agent",networkBrowseBtn:"Browse Registry"},plugins:{title:"Plugins",active:"active",noPlugins:"No plugins registered",core:"Core",coreDisabled:"Core plugin — cannot be disabled",footer:"Plugins customize how files render. Core plugins cannot be disabled.",ready:"Ready — click to open",disabled:"Disabled",noFile:"Entry file not found",createFile:"Create {file} to activate"},echo:{title:"Echo",aboutYouTitle:"About you",aboutYouDesc:"Notes that point back to you",continuedTitle:"Unfinished",continuedDesc:"Drafts and open loops",dailyEchoTitle:"Today",dailyDesc:"One line, no pressure",pastYouTitle:"Past self",pastYouDesc:"A glimpse at another time",intentGrowthTitle:"Growth",growthDesc:"The direction you're pushing"},discover:{title:"Discover",useCases:"Use Cases",useCasesDesc:"Try MindOS scenarios hands-on",pluginMarket:"Plugin Market",pluginMarketDesc:"Extend how files are rendered and edited",skillMarket:"Skill Market",skillMarketDesc:"Add new abilities to your AI agents",spaceTemplates:"Space Templates",spaceTemplatesDesc:"Pre-built space structures for common workflows",comingSoon:"Coming soon",viewAll:"View all use cases",tryIt:"Try"},workflows:{title:"Flows",empty:"No flows yet",emptyDesc:"Create your first flow to automate multi-step tasks with AI.",newWorkflow:"New Flow",nSteps:a=>`${a} step${1===a?"":"s"}`,parseError:"Parse error",name:"Name",namePlaceholder:"My Flow",template:"Template",templateBlank:"Blank",create:"Create",cancel:"Cancel",creating:"Creating...",exists:"A workflow with this name already exists"}},echoPages:{parent:"Echo",heroKicker:"Echo",segmentNavAria:"Echo sections",snapshotBadge:"Local \xb7 private",factsHeading:"Snapshot",snapshotAboutYouTitle:"Clues gather here",snapshotAboutYouBody:"Notes whose paths, links, or titles point back to you will surface here — each one opens in the editor. Use the button below to explore with Agent.",snapshotContinuedTitle:"Drafts and open loops",snapshotContinuedBody:"Untitled drafts, half-finished pieces, and unchecked tasks will collect here once the library feed is connected.",snapshotDailyTitle:"Start with one line",snapshotDailyBody:"Your line saves in this browser the moment you leave the field. One line is enough — open Agent when you want depth.",snapshotPastYouTitle:"A glimpse at another time",snapshotPastYouBody:"A random older note will surface here — not a diff tool, just a gentle glance at who you were. Coming soon.",snapshotGrowthTitle:"Intent lives here",snapshotGrowthBody:"Write one sentence about the direction you are pushing. It stays on this device and can change over time.",insightTitle:"Insight",insightShow:"Show insight",insightHide:"Hide insight",insightHint:"Uses only what is visible on this page—including this snapshot and anything you typed here—not your full library. Configure AI under Settings first.",generateInsight:"Generate insight",generateInsightNoAi:"Add an API key under Settings → AI (or set env vars), then refresh this page.",insightGenerating:"Generating…",insightErrorPrefix:"Something went wrong:",insightRetry:"Try again",continueAgent:"Open in Agent",continuedDrafts:"Drafts",continuedTodos:"Open loops",subEmptyHint:"Items will appear in each column once the library feed is connected.",dailyLineLabel:"A line for today",dailyLinePlaceholder:"Write one quiet line…",dailySavedNote:"Saved in this browser; visible only on this device.",savedFlash:"Saved",dailyAskPrefill:a=>`Echo / Daily — reflect on this line:
145
145
 
146
- ${a.trim()||"(empty line)"}`,pastYouDrawLabel:"A glimpse from the past",pastYouAnother:"Draw another moment",pastYouComingSoon:"Coming soon",pastYouDisabledHint:"Sampling from your timeline is on the way — soon a tap here will surface an old excerpt.",growthIntentLabel:"What you are steering toward",growthIntentPlaceholder:"Write your current intent…",growthSavedNote:"Saved on this device.",aboutYouLead:"Notes and links that point back to you — surfaced, not searched.",continuedLead:"Drafts, open tasks, and thoughts you left mid-sentence.",dailyLead:"One line. No pressure. Open Agent when you want depth.",pastYouLead:"A gentle glimpse at who you were at another time.",growthLead:"The direction you are pushing — and how it drifts."},agentsContent:{title:"Agents",subtitle:"Connections, skills, and status at a glance.",workspacePulse:{title:"Your Agents",connected:"Connected",detected:"Detected",notFound:"Not found",risk:"Risks",enabledSkills:"Skills on",healthy:"Healthy",needsAttention:a=>`${a} issue${1!==a?"s":""}`},navOverview:"Overview",navMcp:"MCP",navSkills:"Skills",navNetwork:"Network",navSessions:"Sessions",navActivity:"Activity",activitySubtitle:"Agent operations audit log.",activity:{loading:"Loading activity...",empty:"No agent operations logged yet.",emptyHint:"Operations from connected agents will appear here.",agentLabel:"Agent"},a2aTabTitle:"Remote Agents",a2aTabEmptyHint:"Discover agents to enable cross-agent delegation.",backToOverview:"Back to Agents",na:"N/A",status:{connected:"Connected",detected:"Detected",notFound:"Not found"},overview:{connected:"Connected",detected:"Detected",notFound:"Not found",riskQueue:"Attention",noRisk:"All clear — no issues detected.",usagePulse:"All agents",nextAction:"Suggested next",nextActionHint:"Reconnect detected agents first, then enable remaining skills.",riskLevelError:"Error",riskLevelWarn:"Warning",na:"N/A",colAgent:"Agent",colStatus:"Status",colMcp:"MCP",colSkills:"Skills",colMode:"Mode",colRuntime:"Runtime",pulseMcp:"MCP",pulseTools:"Tools",mcpOffline:"Offline",toolsUnit:a=>`${a} tools`,enabledUnit:a=>`${a} enabled`,agentCount:a=>`${a} agent${1!==a?"s":""}`,runtimeActive:"Active",riskMcpStopped:"MCP server is not running.",riskDetected:a=>`${a} detected agent(s) need configuration.`,riskSkillsDisabled:"All skills are disabled.",recentActivity:"Recent Activity",viewAll:"View all",showLess:"Show less",addCustomAgent:"Add your own agent",addCustomAgentTitle:"Add Custom Agent",editCustomAgentTitle:a=>`Edit ${a}`,customAgentName:"Agent Name",customAgentNamePlaceholder:"e.g. QCLaw, WorkBuddy",customAgentDir:"Config Directory",customAgentDirPlaceholder:"~/.qclaw/",customAgentDirHint:"Common: ~/.xxx/ or ~/Library/Application Support/",customAgentKeyPreview:a=>`Key: ${a}`,customAgentContinue:"Continue",customAgentDetecting:"Detecting...",customAgentDirFound:"Directory found",customAgentDirNotFound:"Not found yet — agent will appear when installed",customAgentDetectTimeout:"Detection timed out, using defaults",customAgentDetectedTitle:"Detected Configuration",customAgentDefaultTitle:"Default Configuration",customAgentConfigLabel:"MCP Config",customAgentFormatLabel:"Format",customAgentTransportLabel:"Transport",customAgentSkillsLabel:"Skills",customAgentSkillsFound:a=>`${a} skill${1!==a?"s":""} found`,customAgentSkillsNone:"Not detected",customAgentSkillDir:"Skills Directory",customAgentSkillDirHint:"Where skills are installed for this agent",customAgentSkillDirPlaceholder:"~/.xxx/skills/",customAgentCustomize:"Customize these settings",customAgentAdd:"Add Agent",customAgentAdding:"Adding...",customAgentSave:"Save Changes",customAgentSaving:"Saving...",customAgentRetry:"Retry",customAgentAdded:a=>`${a} added`,customAgentUpdated:a=>`${a} updated`,customAgentRemoved:a=>`${a} removed`,customAgentRemoveTitle:a=>`Remove "${a}"?`,customAgentRemoveMessage:"This removes the agent from MindOS. No files will be deleted on disk.",customAgentRemoveConfirm:"Remove",customAgentConfigPath:"MCP Config File Path",customAgentConfigKey:"Config Key",customAgentFormat:"Format",customAgentTransport:"Transport",customAgentProjectConfig:"Project Config (optional)",customAgentCliBinary:"CLI Binary (optional)",customAgentCliBinaryPlaceholder:"e.g. qclaw",customAgentEdit:"Edit",customAgentRemove:"Remove",customAgentCancel:"Cancel",customAgentNetworkError:"Network error. Please try again.",customAgentFailedSave:"Failed to save",customAgentFailedRemove:"Failed to remove",customAgentKeyConflict:a=>`An agent with key "${a}" already exists`,customAgentBuiltinConflict:a=>`Conflicts with built-in agent "${a}"`},mcp:{title:"MCP Connections",refresh:"Refresh",connectionGraph:"Server connections across agents",tabs:{manage:"Manage",topology:"Topology",byAgent:"By Agent",byServer:"By MCP Server"},searchPlaceholder:"Search agents...",installMindos:"Install MindOS MCP",installed:"Installed",mcpServerLabel:"MCP Server",searchServersPlaceholder:"Search MCP servers...",serverAgentCount:a=>`${a} agent${1!==a?"s":""}`,emptyState:"No agents match current filters.",resultCount:a=>`${a} agents`,filteredSummaryTitle:"Filtered status summary",filteredConnected:a=>`Connected: ${a}`,filteredDetected:a=>`Detected: ${a}`,filteredNotFound:a=>`Not found: ${a}`,crossAgentServersTitle:"MCP Servers",crossAgentServersEmpty:"No MCP servers detected.",crossAgentServerAgents:a=>`Used by ${a}`,configVisibilityTitle:"Configuration",hiddenRootDetected:(a,b)=>`Hidden roots: ${a}/${b}`,runtimeSignalDetected:(a,b)=>`Runtime signals: ${a}/${b}`,riskQueueTitle:"Attention",riskMcpStopped:"MCP server is not running.",riskDetected:a=>`${a} detected agent(s) need configuration.`,riskNotFound:a=>`${a} agent(s) not found on this machine.`,riskSkillsDisabled:"All skills are disabled.",bulkReconnectFiltered:"Reconnect all",bulkRunning:"Running reconnect...",bulkSummary:(a,b)=>`Reconnected ${a}, failed ${b}.`,transportFilters:{all:"All transport",stdio:"stdio",http:"http",other:"other"},filters:{all:"All",connected:"Connected",detected:"Detected",notFound:"Not found"},table:{agent:"Agent",status:"Status",transport:"Transport",actions:"Actions"},actions:{copySnippet:"Copy Snippet",copied:"Copied",testConnection:"Test Connection",reconnect:"Reconnect"},addAgent:"Add",removeFromServer:"Remove",confirmRemoveTitle:"Remove from server?",confirmRemoveMessage:(a,b)=>`Remove "${a}" from "${b}"? The agent config will be updated automatically.`,cancel:"Cancel",noAvailableAgents:"All agents already connected.",manualRemoveHint:"Flagged for removal — edit the agent config to finalize.",removeSuccess:"Removed. Restart your agent to apply.",removeFailed:"Failed to remove. Try editing the config file manually.",reconnectAllInServer:"Reconnect all",reconnectAllRunning:"Reconnecting...",reconnectAllDone:(a,b)=>`Done: ${a} reconnected${b>0?`, ${b} failed`:""}.`,serverTransport:a=>`Transport: ${a}`,mcpDisabledMessage:"MCP mode is not enabled.",mcpDisabledHint:"Enable it in Settings → Connections to use MCP agents."},skills:{title:"Skills",summaryTitle:"Skill Status",summaryEnabled:a=>`Enabled: ${a}`,summaryDisabled:a=>`Disabled: ${a}`,summaryAttention:a=>`Needs attention: ${a}`,crossAgentSkillsTitle:"Installed Skills",crossAgentSkillsEmpty:"No skills detected.",crossAgentSkillAgents:a=>`Installed in ${a}`,capabilityGroups:"Skill management across agents",registrySummaryTitle:"Skill Registry",registryUniversal:a=>`Universal: ${a}`,registryAdditional:a=>`Additional: ${a}`,registryUnsupported:a=>`Unsupported: ${a}`,registryHiddenRoots:(a,b)=>`Hidden roots: ${a}/${b}`,tabs:{manage:"Manage",matrix:"Matrix",bySkill:"By Skill",byAgent:"By Agent"},searchPlaceholder:"Search skills...",agentSkillMode:"Skill Mode",agentMcpServers:"MCP Servers",agentNativeSkills:"Native Skills",agentMindosSkills:"MindOS Skills",noAgentsYet:"No agents detected yet.",moreSkills:a=>`+${a} more`,sourceAll:"All",sourceBuiltin:"Built-in",sourceUser:"Custom",sourceNative:"Native",summaryNative:a=>`Native: ${a}`,statusAll:"All status",statusEnabled:"Enabled",statusDisabled:"Disabled",statusAttention:"Needs attention",capabilityAll:"All capabilities",bulkEnableFiltered:"Enable all",bulkDisableFiltered:"Disable all",bulkRunning:"Applying changes...",bulkNoChanges:"No skill changes needed.",bulkAllSucceeded:a=>`Updated ${a} skills.`,bulkPartialFailed:(a,b)=>`Updated ${a}, failed ${b}.`,resultCount:a=>`${a} skills`,matrixAgentFocusLabel:"Agent focus",matrixAgentFocusAll:"All agents",matrixColumnSkill:"Skill",matrixEnabled:"Enabled",matrixDisabled:"Disabled",matrixUnsupported:"Unsupported",matrixNoAgents:"No agents available for matrix.",noSkillsMatchFilter:"No skills match current filters.",matrixEmpty:"No skills match current filters.",addAgentToSkill:"Add",removeAgentFromSkill:"Remove",confirmRemoveAgentTitle:"Remove from skill?",confirmRemoveAgentMessage:(a,b)=>`Remove "${a}" from "${b}"? This requires editing the agent config file.`,cancelSkillAction:"Cancel",noAvailableAgentsForSkill:"All agents already have this skill.",manualSkillHint:"Flagged — edit the agent config to finalize.",skillDescription:"Description",skillNoDescription:"No description available.",skillDeleteAction:"Delete",confirmDeleteSkillTitle:"Delete skill?",confirmDeleteSkillMessage:a=>`Permanently delete skill "${a}"? This cannot be undone.`,skillDeleted:"Skill deleted.",skillDeleteFailed:"Failed to delete skill.",copyInstallCmd:"Copy install command",installCmdCopied:"Copied!",skillAgentCount:a=>`${a} agent${1===a?"":"s"}`,quickStatsMcp:a=>`${a} MCP`,quickStatsSkills:a=>`${a} skills`,showAllNative:a=>`Show all ${a}`,collapseNative:"Collapse",emptyGroup:"No skills in this group.",groupLabels:{research:"Research",coding:"Coding",docs:"Docs",ops:"Ops",memory:"Memory"},skillPopover:{close:"Close",source:"Source",sourceBuiltin:"Built-in",sourceUser:"Custom",sourceNative:"Native",capability:"Capability",path:"File path",enabled:"Enabled",disabled:"Disabled",agents:"Agents",noAgents:"No agents have this skill.",content:"Skill content",loading:"Loading...",loadFailed:"Failed to load skill content.",retry:"Retry",copyContent:"Copy",copied:"Copied!",noDescription:"No description available.",deleteSkill:"Delete",confirmDeleteTitle:"Delete skill?",confirmDeleteMessage:a=>`Permanently delete skill "${a}"? This cannot be undone.`,confirmDeleteAction:"Delete",cancelAction:"Cancel",deleted:"Skill deleted.",deleteFailed:"Failed to delete skill."}},detail:{healthStripTitle:"Status",healthConnected:"Connected",healthInstalled:"MCP installed",healthRuntimeSignals:"Runtime signals",healthConfiguredServers:"Configured servers",healthInstalledSkills:"Native installed skills",identity:"Identity",connection:"Connection",capabilities:"Capability Profile",skillAssignments:"Skill Assignments",runtimeSignals:"Runtime",recentActivity:"Recent Activity",spaceReach:"Space Reach",agentKey:"Agent key",status:"Status",transport:"Transport",endpoint:"Endpoint",port:"Port",auth:"Auth",authConfigured:"Configured",authMissing:"Missing",projectScope:"Project scope",globalScope:"Global scope",format:"Config format",skillMode:"Skill mode",hiddenRoot:"Hidden root path",hiddenRootPresent:"Hidden root",conversationSignal:"Conversation",usageSignal:"Usage",lastActivityAt:"Last active",skillsAll:"All skills",skillsEnabled:"Enabled skills",skillsSourceBuiltin:"Built-in",skillsSourceUser:"Custom",skillsSearchPlaceholder:"Search all configured skills...",skillsFilterAll:"All",skillsFilterBuiltin:"Built-in",skillsFilterUser:"Custom",skillEnable:"Enable",skillDisable:"Disable",skillEdit:"Edit",skillSave:"Save",skillCancel:"Cancel",skillActionLoading:"Working...",skillReadFailed:"Failed to read skill content.",skillSaveFailed:"Failed to save skill content.",mcpManagement:"MCP Management",mcpInstalled:"Installed",mcpScope:"Current scope",mcpConfigPath:"Config path",mcpTargetScope:"Target scope",mcpTargetTransport:"Target transport",mcpScopeProject:"Project",mcpScopeGlobal:"Global",mcpCopySnippet:"Copy snippet",mcpCopied:"Copied",mcpRefresh:"Refresh status",mcpReconnect:"Apply MCP config",mcpApplying:"Applying MCP config...",mcpApplySuccess:"MCP config applied.",mcpApplyFailed:"Failed to apply MCP config.",nativeInstalledSkills:"Installed Skills",nativeInstalledSkillsCount:a=>`${a} detected`,nativeInstalledSkillsEmpty:"No installed skills detected.",nativeInstalledSkillsMore:a=>`+${a} more`,configuredMcpServers:"MCP Servers",configuredMcpServersCount:a=>`${a} detected`,configuredMcpServersEmpty:"No MCP servers configured.",configuredMcpServersMore:a=>`+${a} more`,yes:"Yes",no:"No",noSkills:"No enabled skills.",noActivity:"No activity recorded yet.",noSpaceReach:"No space reach data yet.",skillDelete:"Delete",skillDeleteConfirm:a=>`Delete skill "${a}"? This cannot be undone.`,skillDeleteSuccess:"Skill deleted.",skillDeleteFailed:"Failed to delete skill.",mcpServerAdd:"Add MCP server",mcpServerRemove:"Remove",mcpServerRemoveConfirm:a=>`Remove "${a}" from this agent? This requires editing the config file.`,mcpServerHint:"Flagged — edit the agent config to finalize.",mcpReconnectAll:"Reconnect all",mcpReconnectAllRunning:"Reconnecting...",mcpReconnectAllDone:(a,b)=>`Reconnected ${a}${b>0?`, failed ${b}`:""}.`,runtimeDiagTitle:"Runtime & Diagnostics",runtimePing:"Ping",runtimePinging:"Pinging...",runtimePingOk:a=>`Reachable (${a}ms)`,runtimePingFail:"Unreachable",runtimeUptime:"Uptime",runtimePid:"Process",runtimeMemory:"Memory",runtimeVersion:"Version",runtimeStartedAt:"Started",runtimeNoData:"No runtime data available.",envPermTitle:"Environment & Permissions",envVars:"Environment variables",envVarsCount:a=>`${a} configured`,envVarsEmpty:"No custom environment variables.",envScope:"Scope",envReadOnly:"Read-only access",envWriteAccess:"Write access",envFileAccess:"File access",envNetworkAccess:"Network access",envAllowed:"Allowed",envRestricted:"Restricted",activityTitle:"Activity & Usage",activityTotal:"Total invocations",activityLast7d:"Last 7 days",activityLastInvocation:"Last invocation",activityTokensUsed:"Tokens used",activityAvgLatency:"Avg latency",activityNoData:"No activity recorded yet.",knowledgeInteraction:"Knowledge Interaction",knowledgeNoData:"No interactions yet. Agents will show activity here once they start working with your knowledge base.",recentOps:"Recent Operations",statTotalCalls:"Total calls",statFilesTouched:"Files touched",statReadWrite:"Read / Write",statHealth:"Health",viewFullLog:"View full log",showLess:"Show less"},detailSubtitle:"",detailNotFound:"Agent not found — it may have been removed or renamed.",detailNotFoundHint:"The agent may have disconnected or its configuration file was moved. Try restarting the agent or check the MCP configuration.",detailNotFoundSuggestion:"Connected agents you can explore:"},settings:{title:"Settings",tabs:{ai:"AI",appearance:"Appearance",knowledge:"General",sync:"Sync",mcp:"Connections",plugins:"Plugins",shortcuts:"Shortcuts",monitoring:"Monitoring",agents:"Agents",update:"Update",uninstall:"Uninstall"},ai:{provider:"Provider",model:"Model",apiKey:"API Key",baseUrl:"Base URL",baseUrlHint:"Optional. Use for proxies or custom API endpoints.",keyHint:"Stored locally in ~/.mindos/config.json",keyOptionalHint:"Optional for local providers. Stored in ~/.mindos/config.json",keyChange:"Change",keyCancel:"Cancel",envHint:"Fields marked env have a value from environment variables. You can override them here, or restore all to env defaults.",envFieldNote:a=>`Env var ${a} is set. Clear this field to fall back to it.`,resetToEnv:"Reset to env value",restoreFromEnv:"Restore from env",noApiKey:"API key is not set. AI features will be unavailable until you add one.",testKey:"Test",testKeyTesting:"Testing...",testKeyOk:a=>`\u2713 ${a}ms`,testKeyAuthError:"Invalid API key",testKeyModelNotFound:"Model not found",testKeyRateLimited:"Rate limited, try again later",testKeyNetworkError:"Network error",testKeyNoKey:"No API key configured",testKeyUnknown:"Test failed",listModels:"Browse",noModelsFound:"No models found"},agent:{title:"Agent Behavior",subtitle:"Configure how the AI agent operates",maxSteps:"Max Steps",maxStepsHint:"Maximum tool call steps per request (1-30)",contextStrategy:"Context Strategy",contextStrategyHint:"Auto: summarize early messages when context fills up. Off: no summarization (emergency pruning still applies).",contextStrategyAuto:"Auto (compact + prune)",contextStrategyOff:"Off",thinking:"Extended Thinking",thinkingHint:"Show Claude's reasoning process (uses more tokens)",thinkingBudget:"Thinking Budget",thinkingBudgetHint:"Max tokens for reasoning (1000-50000)",reconnectRetries:"Auto Reconnect",reconnectRetriesHint:"When connection drops, automatically retry this many times before giving up (0 = disabled)"},appearance:{readingTitle:"Reading",readingDesc:"Customize how your notes look",readingFont:"Reading font",fontSize:"Font size",fontSizePreview:"The quick brown fox.",contentWidth:"Content width",preferencesTitle:"Preferences",colorTheme:"Color theme",system:"System",dark:"Dark",light:"Light",language:"Language",browserNote:"Appearance settings are saved in your browser.",labsTitle:"Labs",labsDesc:"Experimental features still in development. May change or be removed.",labsEcho:"Echo",labsEchoDesc:"Reflective journaling powered by your notes.",labsWorkflows:"Flows",labsWorkflowsDesc:"Visual workflow automation for agents.",fontPreview:"The quick brown fox jumps over the lazy dog."},knowledge:{cardTitle:"Knowledge Base",securityTitle:"Security",passwordPlaceholder:"Leave empty to disable",passwordShow:"Show",passwordHide:"Hide",tokenNotSet:"— not set —",mcpUrl:"MCP URL",tokenGenerated:"New token generated. Copy it now — it won't be shown in full again.",monitoringTitle:"System Monitoring",monitoringFailed:"Failed to load monitoring data",monitorHeap:"Heap",monitorRss:"RSS",monitorUptime:"Uptime",monitorNode:"Node",monitorRequests:"Requests",monitorToolCalls:"Tool Calls",monitorTokens:"Tokens",monitorFiles:"Files",monitorErrors:"Errors",monitorMcpRunning:a=>`Running :${a}`,monitorMcpStopped:"Stopped",cancel:"Cancel",mindRoot:"Knowledge base root",mindRootHint:"Absolute path to your notes directory. Requires server restart to take effect.",mindRootEnvHint:a=>`MIND_ROOT env var is set to "${a}". Fill in above to override it.`,envNote:"MIND_ROOT env var is set. Fill in above to override it — your value takes priority.",webPassword:"Web UI password",webPasswordHint:"Protect the browser UI with a password. Leave empty to disable. Changes take effect on next page load.",webPasswordClear:"Clear password",authToken:"MCP / API auth token",authTokenHint:"Bearer token for Agent and MCP clients. Not required for browser access.",authTokenNone:"No token set — API is open to all requests.",authTokenCopy:"Copy",authTokenCopied:"Copied!",authTokenReset:"Regenerate",authTokenClear:"Clear token",authTokenResetConfirm:"Regenerate token? All existing MCP clients will need to update their config.",authTokenMcpPort:"MCP port",restartWalkthrough:"Restart walkthrough",showHiddenFiles:"Show hidden files",showHiddenFilesHint:"Display dot-prefixed folders (.agents, .claude, .mindos, etc.) in the file tree.",cleanupExamples:"Clean up example files",cleanupExamplesHint:"Remove all template example files (\uD83E\uDDEA_example_*) from your knowledge base.",cleanupExamplesButton:"Clean up",cleanupExamplesNone:"No example files found",cleanupExamplesConfirm:a=>`Delete ${a} example file${a>1?"s":""}? This cannot be undone.`,cleanupExamplesDone:a=>`Removed ${a} example file${a>1?"s":""}`,cleanupExamplesScanning:"Scanning..."},sync:{emptyTitle:"Cross-device Sync",emptyDesc:"Automatically sync your knowledge base across devices via Git.",featureAutoCommit:"Auto-commit on save",featureAutoPull:"Auto-pull from remote",featureConflict:"Conflict detection",featureMultiDevice:"Works across devices",remoteUrl:"Git Remote URL",invalidUrl:"Invalid Git URL — use HTTPS (https://...) or SSH (git@...)",sshBrief:"one-time key setup, no token needed",httpsBrief:"works anywhere, token recommended",sshHint:"Requires SSH key on this machine. Verify with: ssh -T git@github.com",accessToken:"Access Token",optional:"(optional, for private repos)",tokenHint:"GitHub:",tokenLink:"Create a token (repo scope)",branchLabel:"Branch",connectButton:"Connect & Start Sync",connecting:"Connecting...",stepConnecting:"Connecting to remote...",stepAuthenticating:"Authenticating...",stepSyncing:"Syncing data...",stepAlmostDone:"Almost done...",stepDone:"Sync configured successfully!",gitignoreTitle:"Excluded files",gitignorePlaceholder:"# Files to exclude from sync\n*.tmp\nsecret/",gitignoreSave:"Save",gitignoreSaved:"Saved",conflictExplain:"These files were changed on both this device and the remote. Choose which version to keep.",keepLocal:"Keep local",keepRemote:"Keep remote",keepLocalHint:"Keep this device's version",keepRemoteHint:"Replace with the remote version",viewDiff:"Click to compare versions",localVersion:"Local (this device)",remoteVersion:"Remote",emptyFile:"(empty)",sectionTitle:"Sync",labelProvider:"Provider",labelRemote:"Remote",labelBranch:"Branch",labelLastSync:"Last sync",labelUnpushed:"Unpushed",labelAutoSync:"Auto-sync",unpushedCommits:a=>`${a} commits`,syncNow:"Sync Now",disableAutoSync:"Disable Auto-sync",enableAutoSync:"Enable Auto-sync",syncComplete:"Sync complete",syncFailed:"Sync failed",autoSyncDisabled:"Auto-sync disabled",autoSyncEnabled:"Auto-sync enabled",toggleFailed:"Failed to toggle sync",conflictsTitle:a=>`Conflicts (${a})`,conflictHint:"Click a file to view your version. Hover and click",conflictHintSuffix:"to see the remote version.",timeNever:"never",timeJustNow:"just now",timeMinAgo:a=>`${a}m ago`,timeHourAgo:a=>`${a}h ago`,timeDayAgo:a=>`${a}d ago`},plugins:{title:"Installed Renderers",builtinBadge:"built-in",coreBadge:"core",enabled:"Enabled",disabled:"Disabled",matchHint:"Auto-activates on",coreHint:"Core renderer — always enabled",noPlugins:"No renderers installed.",comingSoon:"Plugin marketplace coming soon."},mcp:{modeCardTitle:"Connection Mode",modeCardDesc:"Choose how agents connect to MindOS.",cliLabel:"CLI",cliModeDesc:"Claude Code, Gemini CLI, Codex, etc.",mcpLabel:"MCP",mcpModeDesc:"Claude Desktop, Cursor, Windsurf, etc.",alwaysOn:"Always On",mcpRunning:"Running",mcpStopped:"Stopped",mcpEnabledHint:"MCP mode enabled. Disable to simplify the interface if you only use CLI agents.",mcpDisabledHint:"Enable MCP to connect Desktop clients like Claude Desktop or Cursor.",serverTitle:"MindOS MCP Server",status:"Status",running:"Running",stopped:"Stopped",transport:"Transport",endpoint:"Endpoint",tools:"Tools",toolsRegistered:a=>`${a} registered`,auth:"Auth",authSet:"Token set",authNotSet:"No token",copyEndpoint:"Copy Endpoint",copyConfig:"Copy Config",copied:"Copied!",agentsTitle:"Agent Configuration",agent:"Agent",scope:"Scope",project:"Project",global:"Global",installed:"Installed",notInstalled:"Not installed",detected:"Detected",notFound:"Not found",transportStdio:"stdio (recommended)",transportHttp:"http",transportAuto:"auto (recommended)",httpUrl:"MCP URL",httpToken:"Auth Token",installSelected:"Install Selected",installing:"Installing...",installSuccess:a=>`${a} agent(s) configured`,installFailed:"Install failed",portLabel:"MCP Port",portHint:"Changes require server restart",skillsTitle:"Skills",skillsDesc:"Teach agents how to operate your knowledge base.",skillAutoLoaded:"Auto-loaded on every request",skillSource:"Source",skillBuiltin:"Built-in",skillUser:"Custom",addSkill:"+ Add Skill",cliInstallHint:"Install via CLI:",skillPathHint:"Skill files installed at:",deleteSkill:"Delete",editSkill:"Edit",saveSkill:"Save",cancelSkill:"Cancel",skillName:"Name",skillDesc:"Description",skillContent:"Content",skillNameConflict:"A skill with this name already exists",skillDeleteConfirm:a=>`Delete skill "${a}"? This cannot be undone.`,skillLanguage:"Skill Language",skillLangEn:"English",skillLangZh:"中文",searchSkills:"Search skills...",customGroup:"Custom",builtinGroup:"Built-in",noSkillsMatch:a=>`No skills match "${a}"`,skillTemplate:"Template",skillTemplateGeneral:"General",skillTemplateToolUse:"Tool-use",skillTemplateWorkflow:"Workflow",selectDetected:"Select Detected",clearSelection:"Clear",quickSetup:"Quick Setup",configureFor:"Configure for",configPath:"Config path",transportLocal:"Local",transportRemote:"Remote",transportLocalHint:"Local — same machine as MindOS server",transportRemoteHint:"Remote — connect from another device via HTTP",remoteDetectedHint:"Using your current remote IP.",remoteManualHint:"Replace 127.0.0.1 with your server's public or LAN IP.",remoteSteps:"To connect from another device: ① Open port {port} in firewall/security group ② Use the config below in your Agent ③ For public networks, consider SSH tunnel for encryption.",noAuthWarning:"⚠ No auth token — set one in Settings → General before enabling remote access.",showJson:"Show JSON",hideJson:"Hide JSON",connectionTitle:"Connect Agents",connectionHint:"Choose how your AI agents connect to MindOS.",tokenCardTitle:"Auth Token",tokenCardDesc:"Used by CLI remote mode and MCP connections.",mcpHint:"For Claude Desktop, Cursor, and agents that use MCP tool protocol.",tokenLabel:"Auth Token",tokenMasked:"Click Show to reveal the full token",tokenShow:"Show",tokenHide:"Hide",tokenCopy:"Copy",tokenCopied:"Token copied!",tokenNone:"No token set — your MCP server is open to all requests.",tokenNoneAction:"Generate a token in Settings → General → Security.",serverUrl:"MCP Server URL",serverUrlCopy:"Copy URL",howToConnect:"How to connect an AI agent",howToStep1:"Open your agent's MCP settings (e.g. Claude Code, Cursor)",howToStep2:"Add a new MCP server with the URL above",howToStep3:"Set the Auth Token as the bearer token",howToStep4:"Save and verify the connection",cliSkillTitle:"CLI Skill",cliSkillHint:"For agents with bash (Claude Code, Gemini CLI, Codex) — lower token cost, no MCP needed.",cliSkillDesc:"Lower token cost, Skill included — just install and go.",cliLocalDesc:"MindOS Skill is built-in. Install the CLI and you're good to go.",cliRemoteDesc:"Install the CLI on another machine and connect to this MindOS server.",cliSkillInstall:"Install",cliSkillInstallCmd:"npm install -g @geminilight/mindos",cliSkillRemote:"Remote",cliSkillVerify:"Verify",cliSkillVerifyCmd:"mindos file list",cliRemoteConfigure:"Configure",cliInstallSkill:"Install Skill",cliAgents:"Claude Code \xb7 Gemini CLI \xb7 Codex",mcpAgents:"Claude Desktop \xb7 Cursor",mcpDesc:"Requires per-agent MCP config. Install Skill separately via",mcpLocalDesc:"Copy the config snippet and paste into your agent's MCP settings.",mcpRunningLabel:"MCP Running",mcpServerStatus:"MCP Server",autoInstallAgents:"Auto-install to detected agents",detectedAgentsTitle:"Detected Agents",cliInstallDesc:"Install the MindOS Skill to your agent so it can operate your knowledge base.",mcpInstallDesc:"Install MCP config + Skill to detected agents on this machine.",tokenCopyFullHint:"Copies full token",skillsInstalled:"skills installed",recommended:"Recommended",localTitle:"Local",localReady:"Ready to use",remoteTitle:"Remote Access",remoteSubtitle:"Connect from another device",restarting:"Restarting...",restart:"Restart"},monitoring:{system:"System",heapMemory:"Heap Memory",rss:"RSS",uptime:"Uptime",nodeVersion:"Node",application:"Application",requests:"Requests",toolCalls:"Tool Calls",avgResponse:"Avg Response",tokens:"Tokens",errors:"Errors",knowledgeBase:"Knowledge Base",files:"Files",totalSize:"Total Size",rootPath:"Root",mcpStatus:"Status",mcpRunning:"Running",mcpStopped:"Stopped",mcpPort:"Port",autoRefresh:"Auto-refresh every 5s",fetchError:"Failed to load monitoring data"},agents:{mcpServer:"MCP Server",running:"Running",stopped:"Not running",restarting:"Restarting...",restart:"Restart",onPort:a=>`on :${a}`,refresh:"Refresh",refreshing:"Refreshing...",connected:"Connected",connectedCount:a=>`Connected (${a})`,detectedNotConfigured:"Detected but not configured",detectedCount:a=>`Detected but not configured (${a})`,notDetected:"Not Detected",notDetectedCount:a=>`Not Detected (${a})`,showAll:"Show all",hideAll:"Hide",connect:"Connect",noAgents:"No agents detected on this machine.",fetchError:"Failed to load agent data",autoRefresh:"Auto-refresh every 30s"},save:"Save",saved:"Saved",saveFailed:"Save failed",reconfigure:"Reconfigure",askDisplayMode:{label:"Display Mode",hint:"Side panel stays docked on the right. Popup opens a floating dialog.",panel:"Side Panel",popup:"Popup"},update:{checking:"Checking for updates...",upToDate:"You're up to date",available:(a,b)=>`Update available: v${a} → v${b}`,updating:"Updating MindOS... The server will restart shortly.",updatingHint:"This may take 1–3 minutes. Do not close this page.",serverRestarting:"Server is restarting, please wait...",updated:"Updated successfully! Reloading...",timeout:"Update may still be in progress.",timeoutHint:"The server may need more time to rebuild. Try refreshing.",refreshButton:"Refresh Page",retryButton:"Retry Update",error:"Failed to check for updates. Check your network connection.",checkButton:"Check for Updates",updateButton:a=>`Update to v${a}`,releaseNotes:"View release notes",hint:"Updates are installed via npm. Equivalent to running",inTerminal:"in your terminal.",desktopDownloading:"Downloading update...",desktopReady:"Update downloaded. Restart to apply.",desktopRestart:"Restart Now",desktopHint:"Updates are delivered through the Desktop app auto-updater.",coreTitle:"MindOS Core",coreUpToDate:"Core is up to date",coreAvailable:a=>`Update available (${a})`,coreDownloading:"Downloading...",coreCancel:"Cancel",coreReady:"Ready — restart services to apply",coreRestartServices:"Restart Services",coreApplying:"Applying update...",coreApplied:"Updated! Reloading...",coreError:"Core update failed.",coreRetry:"Retry",coreDesktopTooOld:a=>`v${a} requires a newer Desktop version.`,coreDesktopTooOldHint:"Please update MindOS Desktop first.",coreHint:"Core updates only restart services — no app restart needed.",shellTitle:"MindOS Desktop"},uninstall:{title:"Uninstall MindOS",descCli:"Remove MindOS CLI, background services, and configuration files from this machine.",descDesktop:"Remove MindOS Desktop, background services, and configuration files from this machine.",warning:"Select what to clean up. Your knowledge base files are always kept safe.",stopServices:"Stop services & remove daemon",stopServicesDesc:"Stop all running MindOS processes and remove the background daemon.",removeConfig:"Remove configuration",removeConfigDesc:"Delete ~/.mindos/ directory (config, logs, PID files).",removeNpm:"Uninstall CLI package",removeNpmDesc:"Run npm uninstall -g @geminilight/mindos.",removeApp:"Move Desktop app to Trash",removeAppDesc:"Move MindOS.app to Trash. You can restore it later if needed.",confirmTitle:"Confirm Uninstall",confirmButton:"Uninstall",cancelButton:"Cancel",running:"Uninstalling...",success:"MindOS has been uninstalled.",successDesktop:"MindOS has been uninstalled. The app will quit now.",error:"Uninstall failed. You can run `mindos uninstall` in terminal manually.",nothingSelected:"Select at least one item to uninstall.",kbSafe:"Your knowledge base files are always safe — they are never deleted by this action."}},onboarding:{subtitle:"Your knowledge base is empty. Pick a starter template to get going.",templates:{en:{title:"English",desc:"Pre-built structure with Profile, Notes, Projects, and more."},zh:{title:"中文",desc:"预置画像、笔记、项目等中文目录结构。"},empty:{title:"Empty",desc:"Just the essentials — README, CONFIG, and INSTRUCTION."}},importHint:"Already have notes? Set MIND_ROOT to your existing directory in Settings.",syncHint:"Want cross-device sync? Run",syncHintSuffix:"in the terminal after setup.",initError:"Initialization failed. Please refresh the page or try a different template.",dismiss:"Dismiss"},setup:{stepTitles:["Knowledge Base","AI Configuration","Agent Connection","Confirm"],kbPath:"Knowledge base path",kbPathHint:"Absolute path to your notes directory.",kbPathDefault:"~/MindOS/mind",kbPathUseDefault:a=>`Use ${a}`,kbPathHasFiles:a=>`This directory already contains ${a} file${a>1?"s":""}. You can skip the template or merge (existing files won't be overwritten).`,kbTemplateSkip:"Skip template",kbTemplateMerge:"Choose a template to merge",template:"Starter template",templateSkip:"Skip (directory already has files)",aiProvider:"AI Provider",aiProviderHint:"Choose your preferred AI service.",aiSkip:"Skip — configure later",apiKey:"API Key",apiKeyExisting:"Existing key configured. Leave blank to keep it.",model:"Model",baseUrl:"Base URL",baseUrlHint:"Optional. For proxies or custom API endpoints.",webPort:"Web UI port",mcpPort:"MCP server port",portHint:"Valid range: 1024–65535",portRestartWarning:"The service will start on these ports after setup completes.",portInUse:a=>`Port ${a} is already in use.`,portSuggest:a=>`Use ${a}`,portChecking:"Checking…",portSelf:"Current port",portConflict:"Web UI and MCP ports must be different.",portVerifyHint:"Click outside each field to verify, or wait for auto-check.",authToken:"Auth Token",authTokenHint:"Bearer token for MCP / API clients. Auto-generated.",authTokenUsage:"Used for MCP connections and API clients. When configuring an Agent, this token is written automatically — no manual steps needed.",authTokenUsageWhat:"What is this?",authTokenSeed:"Custom seed (optional)",authTokenSeedHint:"Enter a passphrase to derive a deterministic token.",generateToken:"Generate",copyToken:"Copy",copiedToken:"Copied!",webPassword:"Web Password",webPasswordHint:"Protect your knowledge base from unauthorized browser access.",webPasswordRequired:"Password is required to protect your data.",advancedPorts:"Advanced Settings",tokenSectionTitle:"Auth Token (auto-generated)",tokenSectionHint:"Used by AI agents to connect to your MindOS server.",agentToolsTitle:"Agent Connection",connectionModeTitle:"Connection Mode",connectionModeCliHint:"Recommended \xb7 Lower token usage",connectionModeMcpHint:"Optional \xb7 Higher token usage",agentToolsHint:"Select which AI agents to configure. This step is optional.",agentToolsHintCliOnly:"Agent selection applies when MCP mode is enabled. CLI works with all agents that have bash access.",agentToolsHintNone:"No connection mode selected. Select at least one mode to connect agents.",agentTransport:"Transport",agentScope:"Scope",agentToolsLoading:"Loading agents…",agentToolsEmpty:"No supported agents detected.",agentNoneSelected:"No agents selected. You can configure agents later in Settings.",agentSkipLater:"Clear all",agentSelectDetected:"Select detected agents",agentNoneDetected:"No agents detected on your system.",agentShowMore:a=>`Show ${a} more agents`,agentAdvanced:"Advanced options",agentScopeGlobal:"Install for all projects",agentScopeProject:"This project only",badgeInstalled:"Installed",badgeDetected:"Detected",badgeNotFound:"Not found",agentNotInstalled:"not installed",agentDetected:"detected",agentNotFound:"not found",agentGetIt:"Get it →",agentStatusOk:"configured",agentStatusError:"failed",agentInstalling:"Configuring…",agentTransportAuto:"Auto (recommended)",agentTransportLabel:"Transport",agentVerified:"verified",agentUnverified:"unverified",agentVerifyNote:"stdio agents are verified after restart",skillWhat:"",skillAutoHint:()=>"",skillLabel:"Skill",skillInstalling:"Installing skill…",skillInstalled:"Skill installed",skillFailed:"Skill install failed",aiSkipTitle:"Skip for now",aiSkipDesc:"You can add an API key later in Settings → AI.",reviewHint:"Verify your settings, then press Complete Setup.",reviewInstallResults:"Agent configuration results:",phaseSaving:"Saving configuration…",phaseAgents:"Configuring agents…",phaseSkill:"Installing skill…",phaseDone:"Setup complete!",retryAgent:"Retry",agentFailedCount:a=>`${a} agent${a>1?"s":""} failed`,agentCountSummary:a=>`${a} agent${a>1?"s":""}`,agentFailureNote:"Agent failures are non-blocking — you can enter MindOS and retry from Settings → Connections.",portAvailable:"Available",portChanged:"Port changed — please restart the server for it to take effect.",restartRequired:"Server restart required for these changes to take effect.",restartNow:"Restart now",restarting:"Restarting…",restartDone:"Server is restarting. Redirecting shortly…",restartManual:"Restart manually:",back:"Back",next:"Next",complete:"Complete Setup",skip:"Skip",completing:"Saving...",completeDone:"Setup complete!",completeFailed:"Setup failed. Please try again.",healthKb:"Knowledge Base",healthKbNone:"Not configured",healthAi:"AI Provider",healthAiNone:"Not configured — AI features disabled",healthAiAction:"Add an API key in Settings → AI.",healthAgents:"Agent Connection",healthAgentsOk:a=>`${a} agent${a>1?"s":""} configured`,healthAgentsPartial:"Configuration in progress...",healthAgentsNone:"No agents configured",healthAgentsAction:"You can add agents later in Settings → Connections.",healthSkills:"Skills",healthSkillsOk:"Skills installed successfully",healthSkillsError:"Skill installation failed",healthSkillsSkipped:"Skipped",healthSkillsInstalling:"Installing skills...",healthSkillsAction:"You can install skills manually later.",healthTokenTitle:"Auth Token",healthTokenCopy:"Copy token",healthTokenHint:"Used by CLI remote mode and MCP connections. Also available in Settings → Connections.",healthGoHome:"Go to MindOS",welcomeTitle:"Welcome to MindOS!",welcomeDesc:"Setup is complete. Start by asking AI a question, browsing your knowledge base, or configuring MCP agents.",welcomeLinkReconfigure:"Reconfigure",welcomeLinkAskAI:"MindOS Agent",welcomeLinkMCP:"MCP Settings"},guide:{title:"Quick Start",showGuide:"Show getting started guide",close:"Close",skip:"Skip",import:{title:"Import your files",cta:"Import",desc:"Upload your resume, project docs, or notes — anything you want AI agents to know about you.",button:"Import Files"},ai:{title:"Save with AI",cta:"Try it",desc:"Ask MindOS Agent to capture knowledge from this conversation into your KB:",prompt:"Help me distill the key takeaways from our conversation into a reusable SOP in my knowledge base.",promptEmpty:"Help me design a knowledge base folder structure that fits my needs"},agent:{title:"Connect other Agents",cta:"Copy prompt",desc:"Open Cursor, Claude Code, or any Agent with MindOS CLI and paste:",copyPrompt:"Summarize what we discussed and save it to my MindOS knowledge base as a reusable SOP.",copy:"Copy",copied:"Copied!"},done:{title:"You're all set!",titleFinal:"You've mastered MindOS essentials!",steps:[{hint:"Next: try saving an article into your KB →",prompt:"Help me save the key points from this article into MindOS."},{hint:"Next: try turning experience into a reusable SOP →",prompt:"Help me distill this conversation into a reusable workflow in MindOS."}]}},walkthrough:{step:(a,b)=>`${a} of ${b}`,next:"Next",back:"Back",skip:"Skip tour",done:"Done",exploreCta:"Explore what you can do →",steps:[{title:"Your Project Memory",body:"Organize projects, SOPs, and preferences in Spaces. Everything is local-first and under your control."},{title:"AI That Already Knows You",body:"MindOS Agent reads your entire knowledge base automatically. Ask about your projects — no need to re-explain anything."},{title:"Connect Any Agent",body:"Link Cursor, Claude Code, or Windsurf via MCP — they all share the same project memory."}]},shortcuts:[{keys:["⌘","K"],description:"Search"},{keys:["⌘","/"],description:"MindOS Agent"},{keys:["⌘",","],description:"Settings"},{keys:["E"],description:"Edit current file"},{keys:["⌘","S"],description:"Save"},{keys:["Esc"],description:"Cancel edit / close modal"},{keys:["@"],description:"Attach file in MindOS Agent"}],help:{title:"Help & Guide",subtitle:"Everything you need to get started with MindOS",whatIs:{title:"What is MindOS?",body:"MindOS is where you think, and where your AI agents act. You and AI share the same brain — when you correct AI, that correction is captured automatically; next time AI understands you better, and your own thinking gets sharper along the way. You and AI grow together. In an age of AI anxiety, MindOS focuses on human growth — think clearly, make better decisions, ship faster, and build up knowledge that's truly yours."},quickStart:{title:"Quick Start",step1Title:"Browse your knowledge base",step1Desc:'Click the Spaces icon in the left sidebar to explore your files. Each top-level folder is a "Space" — a themed area like Profile, Notes, or Projects.',step2Title:"Chat with AI",step2Desc:"Press ⌘/ (or Ctrl/) to open the AI panel. Ask anything about your knowledge base, or use @ to attach a specific file for context.",step3Title:"Connect your AI agents",step3Desc:"Go to Settings → Connections to connect external agents like Claude Code, Cursor, or Windsurf. Once connected, they can read and write your knowledge base directly."},concepts:{title:"Core Concepts",spaceTitle:"Space",spaceDesc:"Spaces are knowledge partitions organized the way you think. You decide the structure, and AI agents follow it to read, write, and manage automatically.",instructionTitle:"Instruction",instructionDesc:"A rules file that all AI agents obey. You write the boundaries once, and every agent connected to your knowledge base follows them.",skillTitle:"Skill",skillDesc:"Teaches agents how to operate your knowledge base — reading, writing, organizing. Agents don't guess; they follow the skills you've installed."},shortcutsTitle:"Keyboard Shortcuts",agentUsage:{title:"Using MindOS with AI Agents",intro:"Once you connect an agent (Claude Code, Cursor, Windsurf, etc.) via MCP, just talk to it naturally. The agent can read and write your knowledge base directly — no special commands needed. Here are the most common scenarios:",scenarios:[{emoji:"\uD83E\uDEAA",title:"Inject Your Identity",desc:"Tell all AI agents who you are — preferences, tech stack, communication style — in one shot.",prompt:'"Here\'s my resume, read it and organize my info into MindOS."'},{emoji:"\uD83D\uDD04",title:"Cross-Agent Handoff",desc:"Brainstorm ideas in GPT, then execute in Claude Code — zero context loss.",prompt:'"Save this conversation to MindOS."\n"Read the plan in MindOS and help me start coding."'},{emoji:"\uD83D\uDCCB",title:"Experience → SOP",desc:"Turn hard-won debugging sessions into reusable workflows that prevent future mistakes.",prompt:'"Help me distill this conversation into a reusable workflow in MindOS."'},{emoji:"\uD83D\uDE80",title:"Project Cold Start",desc:"Spin up a new project in minutes — your profile and SOPs guide the scaffolding automatically.",prompt:'"Help me start a new project following the Startup SOP in MindOS."'},{emoji:"\uD83D\uDD0D",title:"Research & Archive",desc:"Let agents research competitors or topics for you, then file structured results in your knowledge base.",prompt:'"Help me research X, Y, Z products and save results to the MindOS product library."'}],copy:"Copy prompt",hint:'Tip: The agent auto-discovers your knowledge base structure. Just mention "MindOS" in your prompt and it will know where to look. Click "Explore" in the left sidebar for more scenarios.'},shortcuts:{search:"Search files",askAI:"Toggle AI panel",settings:"Open Settings",shortcutPanel:"Keyboard shortcuts panel",editFile:"Edit current file",save:"Save file",closePanel:"Close panel / Exit modal",attachFile:"Attach file in AI chat"},faq:{title:"FAQ",items:[{q:"How do I change the language?",a:"Go to Settings → Appearance → Language. You can switch between English and Chinese."},{q:"How do I connect an AI agent?",a:"Go to Settings → Connections. MindOS auto-detects installed agents (Claude Code, Cursor, etc.) and lets you connect them with one click."},{q:"Where is my data stored?",a:"All your data stays on your local machine as plain Markdown files. MindOS never uploads your data to any cloud service. You own everything."},{q:"How do I sync across devices?",a:"Go to Settings → Sync. MindOS uses Git for cross-device sync. Enter your Git remote URL and access token to start syncing."},{q:"Can I use my own AI provider?",a:"Yes! Go to Settings → AI. You can use OpenAI, Anthropic, Google, or any OpenAI-compatible API with a custom base URL."},{q:"What file formats are supported?",a:"MindOS works best with Markdown (.md) files, but also supports JSON, CSV, and plain text. Plugins extend rendering for special formats like Kanban boards or timelines."},{q:"How do I create a new note?",a:"Click the + icon next to any folder in the file tree, or ask AI to create one for you. Notes are just Markdown files — you can also create them from your file system."}]}},explore:{title:"Explore Use Cases",subtitle:"Discover what you can do with MindOS — pick a scenario and try it now.",tryIt:"Try it",all:"All",byCapability:"By Capability",byScenario:"By Scenario",categories:{"knowledge-management":"Knowledge Management","memory-sync":"Memory Sync","auto-execute":"Auto Execute","experience-evolution":"Experience Evolution","human-insights":"Human Insights","audit-control":"Audit & Control"},scenarios:{"first-day":"First Day",daily:"Daily Work",project:"Project Work",advanced:"Advanced"},c1:{title:"Inject Your Identity",desc:"Tell all AI agents who you are — preferences, tech stack, communication style — in one shot.",prompt:"Here's my resume, read it and organize my info into MindOS."},c2:{title:"Save Information",desc:"Archive articles, meeting notes, or web pages into your knowledge base with one prompt.",prompt:"Help me save the key points from this article into MindOS."},c3:{title:"Cross-Agent Handoff",desc:"Start a plan in MindOS, continue coding in Claude Code, refine in Cursor — zero context loss.",prompt:"Help me start coding based on the plan in MindOS."},c4:{title:"Experience → SOP",desc:"Turn hard-won debugging sessions into reusable workflows that prevent future mistakes.",prompt:"Help me distill this conversation into a reusable workflow in MindOS."},c5:{title:"Capture Ideas on the Go",desc:"Jot down an inspiration on your phone — MindOS archives, decomposes, and assigns to agents.",prompt:"Help me organize this idea into MindOS and break it into actionable sub-tasks."},c6:{title:"Project Cold Start",desc:"Spin up a new project in 4 minutes — your profile and SOPs guide the scaffolding automatically.",prompt:"Help me start a new project following the Startup SOP in MindOS."},c7:{title:"Research & Archive",desc:"Let agents research competitors or topics for you, then file structured results in your KB.",prompt:"Help me research X, Y, Z products and save results to the MindOS product library."},c8:{title:"Network Management",desc:"Log conversations with contacts, auto-generate follow-up TODOs, and keep full context.",prompt:"I met with someone today — update MindOS Connections and create follow-up TODOs."},c9:{title:"Audit & Correct",desc:"Review what agents know about you, fix mistakes in one place, and all agents update instantly.",prompt:"Check my MindOS Profile for accuracy and correct any errors."}}},zh:{common:{relatedFiles:"关联视图"},app:{tagline:"你在此思考,Agent 依此行动。",footer:"MindOS \xb7 人机共生知识系统"},login:{tagline:"人类在此思考,Agent 依此行动。",subtitle:"请输入密码以继续",passwordLabel:"密码",passwordPlaceholder:"输入密码",signIn:"登录",signingIn:"登录中…",incorrectPassword:"密码错误,请重试。",connectionError:"连接错误,请重试。"},notFound:{title:"文件未找到",description:"该文件不存在于你的知识库中。",createButton:"创建此文件",creating:"创建中...",goToParent:"返回上级目录",goHome:"首页"},updateBanner:{newVersion:(a,b)=>`MindOS v${a} 可用(当前 v${b})`,updateNow:"更新",runUpdate:"终端运行",orSee:"或",releaseNotes:"查看更新说明"},sidebar:{files:"知识库",search:"搜索",searchTitle:"搜索",askTitle:"MindOS Agent",settingsTitle:"设置",plugins:"插件",agents:"智能体",echo:"回响",discover:"探索",workflows:"流程",history:"历史",help:"帮助",syncLabel:"同步",collapseTitle:"收起侧栏",expandTitle:"展开侧栏",collapseLevel:"折叠一级",collapseLevelHint:"折叠一级(双击:全部折叠)",expandLevel:"展开一级",expandLevelHint:"展开一级(双击:全部展开)",importFile:"导入文件",new:"新建",newFile:"新建文件",newSpace:"新建空间",more:"更多",capture:"暂存台",showHiddenFiles:"显示隐藏文件",sync:{synced:"已同步",unpushed:"待推送",unpushedHint:"个提交尚未推送到远程 — 将自动同步",conflicts:"冲突",conflictsHint:"个文件存在合并冲突 — 前往 设置 > 同步 解决",syncError:"同步出错",syncOff:"同步关闭",syncing:"同步中...",syncNow:"立即同步",syncDone:"同步完成",syncFailed:"同步失败",syncRestored:"同步已恢复",enableSync:"启用同步",enableHint:"设置跨设备同步"}},search:{placeholder:"搜索文件...",noResults:"没有找到结果",prompt:"输入关键词搜索所有文件",navigate:"上下导航",open:"打开",close:"关闭",tabSearch:"搜索",tabActions:"快捷操作",openSettings:"打开设置",restartWalkthrough:"重新开始引导",toggleDarkMode:"切换深色模式",goToAgents:"前往智能体",goToDiscover:"前往探索",goToHelp:"前往帮助",walkthroughRestarted:"引导已重置"},shortcutPanel:{title:"快捷键",navigation:"导航",panelsSection:"面板",editor:"编辑器",toggleSearch:"切换搜索",toggleAskAI:"切换 AI 助手",openSettings:"打开设置",keyboardShortcuts:"快捷键",closePanel:"关闭面板 / 退出最大化",saveFile:"保存文件",undo:"撤销",redo:"重做",toggleHint:"切换此面板"},...d,home:{recentlyModified:"最近修改",recentlyActive:"最近活跃",recentlyEdited:"最近编辑",allSpaces:"所有空间",spaces:"心智空间",nFiles:a=>`${a} 个文件`,other:"其他",newSpace:"新建空间",spaceName:"空间名称",spaceDescription:"描述",spaceDescPlaceholder:"描述这个空间的用途",spaceNameNoSlash:"名称不能包含 / 或 \\",spaceExists:"已存在同名空间",spaceCreateFailed:"创建空间失败",noSpacesYet:"还没有空间,创建一个来整理你的知识吧。",spaceLocation:"位置",rootLevel:"根目录",optional:"可选",aiInit:"AI 初始化内容",aiInitHint:"AI 将自动生成空间说明和操作指南",aiInitNoKey:"在 设置 → AI 中配置 API 密钥以启用",aiInitGenerating:a=>`正在为「${a}」生成内容`,aiInitReady:a=>`「${a}」已就绪`,aiInitReview:"查看",aiInitDiscard:"撤销",aiInitReverted:a=>`「${a}」已恢复为模板`,createSpace:"创建",cancelCreate:"取消",continueEditing:"继续编辑",newNote:"新建笔记",builtinFeatures:"工具面板",builtinActive:"已启用",builtinInactive:"未激活",toolName:{"agent-inspector":"审计面板","config-panel":"配置面板",todo:"待办面板","workflow-yaml":"工作流"},toolDesc:{"agent-inspector":"查看 Agent 操作日志与调用轨迹","config-panel":"编辑和管理全局配置项",todo:"以看板形式管理待办事项","workflow-yaml":"执行多步骤工作流,AI 辅助执行"},plugins:"扩展",changeHistory:"变更历史",showMore:"查看更多",showLess:"收起",viewAll:"查看全部",wikiTagline:"你的知识空间,井然有序。",sortRecent:"最近",sortName:"字母序",sortCount:"文件数",createToActivate:"创建 {file} 以启用",shortcuts:{searchFiles:"搜索文件",askAI:"MindOS Agent",editFile:"编辑文件",save:"保存",settings:"设置"},relativeTime:{justNow:"刚刚",minutesAgo:a=>`${a} 分钟前`,hoursAgo:a=>`${a} 小时前`,daysAgo:a=>`${a} 天前`},cleanupExamples:a=>`有 ${a} 个模板示例文件可以清理`,cleanupExamplesButton:"一键清理",cleanupExamplesDone:"示例文件已清理"},echoSpotlight:{title:"回响",dailyLine:"今日一行",placeholder:"写下今天的一行想法…",invite:"记录今天的一行想法",inviteDesc:"一行就够。回响会沉淀你的思维模式。",goToEcho:"打开回响",savedLocally:"保存在本设备"},suggestion:{title:"你可能想",staleFiles:a=>`${a} 个文件超过 30 天未更新`,reviewStale:"查看",dismiss:"忽略"},inbox:{title:"暂存台",count:a=>`${a}`,emptyTitle:"快速捕获,稍后整理",emptyDesc:"拖拽文件到此处,或点击上传按钮,即刻保存到暂存台。",uploadButton:"上传文件",organizeButton:"AI 整理",organizing:"整理中...",viewAll:"查看全部",more:a=>`还有 ${a} 个`,viewAllFiles:a=>`查看 Inbox 中全部 ${a} 个文件`,viewAllHistory:a=>`查看全部 ${a} 条记录 →`,agingHint:"7天+",savedToast:a=>`${a} 个文件已保存到暂存台`,savedWithSkipped:(a,b)=>a>0?`已保存 ${a} 个,跳过 ${b} 个(格式不支持)`:`${b} 个文件被跳过(格式不支持)`,tooLarge:a=>`${a} 个文件过大(上限 10 MB)`,savedWithOversized:(a,b)=>`已保存 ${a} 个,${b} 个过大被跳过`,organizePrompt:a=>`请将暂存台中的这些文件整理到知识库的合适位置。分析每个文件的内容,将其移动到最匹配的空间或目录。需要的话可以创建新目录。以下是待整理的文件:
146
+ ${a.trim()||"(empty line)"}`,pastYouDrawLabel:"A glimpse from the past",pastYouAnother:"Draw another moment",pastYouComingSoon:"Coming soon",pastYouDisabledHint:"Sampling from your timeline is on the way — soon a tap here will surface an old excerpt.",growthIntentLabel:"What you are steering toward",growthIntentPlaceholder:"Write your current intent…",growthSavedNote:"Saved on this device.",aboutYouLead:"Notes and links that point back to you — surfaced, not searched.",continuedLead:"Drafts, open tasks, and thoughts you left mid-sentence.",dailyLead:"One line. No pressure. Open Agent when you want depth.",pastYouLead:"A gentle glimpse at who you were at another time.",growthLead:"The direction you are pushing — and how it drifts."},agentsContent:{title:"Agents",subtitle:"Connections, skills, and status at a glance.",workspacePulse:{title:"Your Agents",connected:"Connected",detected:"Detected",notFound:"Not found",risk:"Risks",enabledSkills:"Skills on",healthy:"Healthy",needsAttention:a=>`${a} issue${1!==a?"s":""}`},navOverview:"Overview",navMcp:"MCP",navSkills:"Skills",navNetwork:"Network",navSessions:"Sessions",navActivity:"Activity",activitySubtitle:"Agent operations audit log.",activity:{loading:"Loading activity...",empty:"No agent operations logged yet.",emptyHint:"Operations from connected agents will appear here.",agentLabel:"Agent"},a2aTabTitle:"Remote Agents",a2aTabEmptyHint:"Discover agents to enable cross-agent delegation.",backToOverview:"Back to Agents",na:"N/A",status:{connected:"Connected",detected:"Detected",notFound:"Not found"},overview:{connected:"Connected",detected:"Detected",notFound:"Not found",riskQueue:"Attention",noRisk:"All clear — no issues detected.",usagePulse:"All agents",nextAction:"Suggested next",nextActionHint:"Reconnect detected agents first, then enable remaining skills.",riskLevelError:"Error",riskLevelWarn:"Warning",na:"N/A",colAgent:"Agent",colStatus:"Status",colMcp:"MCP",colSkills:"Skills",colMode:"Mode",colRuntime:"Runtime",pulseMcp:"MCP",pulseTools:"Tools",mcpOffline:"Offline",toolsUnit:a=>`${a} tools`,enabledUnit:a=>`${a} enabled`,agentCount:a=>`${a} agent${1!==a?"s":""}`,runtimeActive:"Active",riskMcpStopped:"MCP server is not running.",riskDetected:a=>`${a} detected agent(s) need configuration.`,riskSkillsDisabled:"All skills are disabled.",recentActivity:"Recent Activity",viewAll:"View all",showLess:"Show less",addCustomAgent:"Add your own agent",addCustomAgentTitle:"Add Custom Agent",editCustomAgentTitle:a=>`Edit ${a}`,customAgentName:"Agent Name",customAgentNamePlaceholder:"e.g. QCLaw, WorkBuddy",customAgentDir:"Config Directory",customAgentDirPlaceholder:"~/.qclaw/",customAgentDirHint:"Common: ~/.xxx/ or ~/Library/Application Support/",customAgentKeyPreview:a=>`Key: ${a}`,customAgentContinue:"Continue",customAgentDetecting:"Detecting...",customAgentDirFound:"Directory found",customAgentDirNotFound:"Not found yet — agent will appear when installed",customAgentDetectTimeout:"Detection timed out, using defaults",customAgentDetectedTitle:"Detected Configuration",customAgentDefaultTitle:"Default Configuration",customAgentConfigLabel:"MCP Config",customAgentFormatLabel:"Format",customAgentTransportLabel:"Transport",customAgentSkillsLabel:"Skills",customAgentSkillsFound:a=>`${a} skill${1!==a?"s":""} found`,customAgentSkillsNone:"Not detected",customAgentSkillDir:"Skills Directory",customAgentSkillDirHint:"Where skills are installed for this agent",customAgentSkillDirPlaceholder:"~/.xxx/skills/",customAgentCustomize:"Customize these settings",customAgentAdd:"Add Agent",customAgentAdding:"Adding...",customAgentSave:"Save Changes",customAgentSaving:"Saving...",customAgentRetry:"Retry",customAgentAdded:a=>`${a} added`,customAgentUpdated:a=>`${a} updated`,customAgentRemoved:a=>`${a} removed`,customAgentRemoveTitle:a=>`Remove "${a}"?`,customAgentRemoveMessage:"This removes the agent from MindOS. No files will be deleted on disk.",customAgentRemoveConfirm:"Remove",customAgentConfigPath:"MCP Config File Path",customAgentConfigKey:"Config Key",customAgentFormat:"Format",customAgentTransport:"Transport",customAgentProjectConfig:"Project Config (optional)",customAgentCliBinary:"CLI Binary (optional)",customAgentCliBinaryPlaceholder:"e.g. qclaw",customAgentEdit:"Edit",customAgentRemove:"Remove",customAgentCancel:"Cancel",customAgentNetworkError:"Network error. Please try again.",customAgentFailedSave:"Failed to save",customAgentFailedRemove:"Failed to remove",customAgentKeyConflict:a=>`An agent with key "${a}" already exists`,customAgentBuiltinConflict:a=>`Conflicts with built-in agent "${a}"`},mcp:{title:"MCP Connections",refresh:"Refresh",connectionGraph:"Server connections across agents",tabs:{manage:"Manage",topology:"Topology",byAgent:"By Agent",byServer:"By MCP Server"},searchPlaceholder:"Search agents...",installMindos:"Install MindOS MCP",installed:"Installed",mcpServerLabel:"MCP Server",searchServersPlaceholder:"Search MCP servers...",serverAgentCount:a=>`${a} agent${1!==a?"s":""}`,emptyState:"No agents match current filters.",resultCount:a=>`${a} agents`,filteredSummaryTitle:"Filtered status summary",filteredConnected:a=>`Connected: ${a}`,filteredDetected:a=>`Detected: ${a}`,filteredNotFound:a=>`Not found: ${a}`,crossAgentServersTitle:"MCP Servers",crossAgentServersEmpty:"No MCP servers detected.",crossAgentServerAgents:a=>`Used by ${a}`,configVisibilityTitle:"Configuration",hiddenRootDetected:(a,b)=>`Hidden roots: ${a}/${b}`,runtimeSignalDetected:(a,b)=>`Runtime signals: ${a}/${b}`,riskQueueTitle:"Attention",riskMcpStopped:"MCP server is not running.",riskDetected:a=>`${a} detected agent(s) need configuration.`,riskNotFound:a=>`${a} agent(s) not found on this machine.`,riskSkillsDisabled:"All skills are disabled.",bulkReconnectFiltered:"Reconnect all",bulkRunning:"Running reconnect...",bulkSummary:(a,b)=>`Reconnected ${a}, failed ${b}.`,transportFilters:{all:"All transport",stdio:"stdio",http:"http",other:"other"},filters:{all:"All",connected:"Connected",detected:"Detected",notFound:"Not found"},table:{agent:"Agent",status:"Status",transport:"Transport",actions:"Actions"},actions:{copySnippet:"Copy Snippet",copied:"Copied",testConnection:"Test Connection",reconnect:"Reconnect"},addAgent:"Add",removeFromServer:"Remove",confirmRemoveTitle:"Remove from server?",confirmRemoveMessage:(a,b)=>`Remove "${a}" from "${b}"? The agent config will be updated automatically.`,cancel:"Cancel",noAvailableAgents:"All agents already connected.",manualRemoveHint:"Flagged for removal — edit the agent config to finalize.",removeSuccess:"Removed. Restart your agent to apply.",removeFailed:"Failed to remove. Try editing the config file manually.",reconnectAllInServer:"Reconnect all",reconnectAllRunning:"Reconnecting...",reconnectAllDone:(a,b)=>`Done: ${a} reconnected${b>0?`, ${b} failed`:""}.`,serverTransport:a=>`Transport: ${a}`,mcpDisabledMessage:"MCP mode is not enabled.",mcpDisabledHint:"Enable it in Settings → Connections to use MCP agents."},skills:{title:"Skills",summaryTitle:"Skill Status",summaryEnabled:a=>`Enabled: ${a}`,summaryDisabled:a=>`Disabled: ${a}`,summaryAttention:a=>`Needs attention: ${a}`,crossAgentSkillsTitle:"Installed Skills",crossAgentSkillsEmpty:"No skills detected.",crossAgentSkillAgents:a=>`Installed in ${a}`,capabilityGroups:"Skill management across agents",registrySummaryTitle:"Skill Registry",registryUniversal:a=>`Universal: ${a}`,registryAdditional:a=>`Additional: ${a}`,registryUnsupported:a=>`Unsupported: ${a}`,registryHiddenRoots:(a,b)=>`Hidden roots: ${a}/${b}`,tabs:{manage:"Manage",matrix:"Matrix",bySkill:"By Skill",byAgent:"By Agent"},searchPlaceholder:"Search skills...",agentSkillMode:"Skill Mode",agentMcpServers:"MCP Servers",agentNativeSkills:"Native Skills",agentMindosSkills:"MindOS Skills",noAgentsYet:"No agents detected yet.",moreSkills:a=>`+${a} more`,sourceAll:"All",sourceBuiltin:"Built-in",sourceUser:"Custom",sourceNative:"Native",summaryNative:a=>`Native: ${a}`,statusAll:"All status",statusEnabled:"Enabled",statusDisabled:"Disabled",statusAttention:"Needs attention",capabilityAll:"All capabilities",bulkEnableFiltered:"Enable all",bulkDisableFiltered:"Disable all",bulkRunning:"Applying changes...",bulkNoChanges:"No skill changes needed.",bulkAllSucceeded:a=>`Updated ${a} skills.`,bulkPartialFailed:(a,b)=>`Updated ${a}, failed ${b}.`,resultCount:a=>`${a} skills`,matrixAgentFocusLabel:"Agent focus",matrixAgentFocusAll:"All agents",matrixColumnSkill:"Skill",matrixEnabled:"Enabled",matrixDisabled:"Disabled",matrixUnsupported:"Unsupported",matrixNoAgents:"No agents available for matrix.",noSkillsMatchFilter:"No skills match current filters.",matrixEmpty:"No skills match current filters.",addAgentToSkill:"Add",removeAgentFromSkill:"Remove",confirmRemoveAgentTitle:"Remove from skill?",confirmRemoveAgentMessage:(a,b)=>`Remove "${a}" from "${b}"? This requires editing the agent config file.`,cancelSkillAction:"Cancel",noAvailableAgentsForSkill:"All agents already have this skill.",manualSkillHint:"Flagged — edit the agent config to finalize.",skillDescription:"Description",skillNoDescription:"No description available.",skillDeleteAction:"Delete",confirmDeleteSkillTitle:"Delete skill?",confirmDeleteSkillMessage:a=>`Permanently delete skill "${a}"? This cannot be undone.`,skillDeleted:"Skill deleted.",skillDeleteFailed:"Failed to delete skill.",copyInstallCmd:"Copy install command",installCmdCopied:"Copied!",skillAgentCount:a=>`${a} agent${1===a?"":"s"}`,quickStatsMcp:a=>`${a} MCP`,quickStatsSkills:a=>`${a} skills`,showAllNative:a=>`Show all ${a}`,collapseNative:"Collapse",emptyGroup:"No skills in this group.",groupLabels:{research:"Research",coding:"Coding",docs:"Docs",ops:"Ops",memory:"Memory"},skillPopover:{close:"Close",source:"Source",sourceBuiltin:"Built-in",sourceUser:"Custom",sourceNative:"Native",capability:"Capability",path:"File path",enabled:"Enabled",disabled:"Disabled",agents:"Agents",noAgents:"No agents have this skill.",content:"Skill content",loading:"Loading...",loadFailed:"Failed to load skill content.",retry:"Retry",copyContent:"Copy",copied:"Copied!",noDescription:"No description available.",deleteSkill:"Delete",confirmDeleteTitle:"Delete skill?",confirmDeleteMessage:a=>`Permanently delete skill "${a}"? This cannot be undone.`,confirmDeleteAction:"Delete",cancelAction:"Cancel",deleted:"Skill deleted.",deleteFailed:"Failed to delete skill."}},detail:{healthStripTitle:"Status",healthConnected:"Connected",healthInstalled:"MCP installed",healthRuntimeSignals:"Runtime signals",healthConfiguredServers:"Configured servers",healthInstalledSkills:"Native installed skills",identity:"Identity",connection:"Connection",capabilities:"Capability Profile",skillAssignments:"Skill Assignments",runtimeSignals:"Runtime",recentActivity:"Recent Activity",spaceReach:"Space Reach",agentKey:"Agent key",status:"Status",transport:"Transport",endpoint:"Endpoint",port:"Port",auth:"Auth",authConfigured:"Configured",authMissing:"Missing",projectScope:"Project scope",globalScope:"Global scope",format:"Config format",skillMode:"Skill mode",hiddenRoot:"Hidden root path",hiddenRootPresent:"Hidden root",conversationSignal:"Conversation",usageSignal:"Usage",lastActivityAt:"Last active",skillsAll:"All skills",skillsEnabled:"Enabled skills",skillsSourceBuiltin:"Built-in",skillsSourceUser:"Custom",skillsSearchPlaceholder:"Search all configured skills...",skillsFilterAll:"All",skillsFilterBuiltin:"Built-in",skillsFilterUser:"Custom",skillEnable:"Enable",skillDisable:"Disable",skillEdit:"Edit",skillSave:"Save",skillCancel:"Cancel",skillActionLoading:"Working...",skillReadFailed:"Failed to read skill content.",skillSaveFailed:"Failed to save skill content.",mcpManagement:"MCP Management",mcpInstalled:"Installed",mcpScope:"Current scope",mcpConfigPath:"Config path",mcpTargetScope:"Target scope",mcpTargetTransport:"Target transport",mcpScopeProject:"Project",mcpScopeGlobal:"Global",mcpCopySnippet:"Copy snippet",mcpCopied:"Copied",mcpRefresh:"Refresh status",mcpReconnect:"Apply MCP config",mcpApplying:"Applying MCP config...",mcpApplySuccess:"MCP config applied.",mcpApplyFailed:"Failed to apply MCP config.",nativeInstalledSkills:"Installed Skills",nativeInstalledSkillsCount:a=>`${a} detected`,nativeInstalledSkillsEmpty:"No installed skills detected.",nativeInstalledSkillsMore:a=>`+${a} more`,configuredMcpServers:"MCP Servers",configuredMcpServersCount:a=>`${a} detected`,configuredMcpServersEmpty:"No MCP servers configured.",configuredMcpServersMore:a=>`+${a} more`,yes:"Yes",no:"No",noSkills:"No enabled skills.",noActivity:"No activity recorded yet.",noSpaceReach:"No space reach data yet.",skillDelete:"Delete",skillDeleteConfirm:a=>`Delete skill "${a}"? This cannot be undone.`,skillDeleteSuccess:"Skill deleted.",skillDeleteFailed:"Failed to delete skill.",mcpServerAdd:"Add MCP server",mcpServerRemove:"Remove",mcpServerRemoveConfirm:a=>`Remove "${a}" from this agent? This requires editing the config file.`,mcpServerHint:"Flagged — edit the agent config to finalize.",mcpReconnectAll:"Reconnect all",mcpReconnectAllRunning:"Reconnecting...",mcpReconnectAllDone:(a,b)=>`Reconnected ${a}${b>0?`, failed ${b}`:""}.`,runtimeDiagTitle:"Runtime & Diagnostics",runtimePing:"Ping",runtimePinging:"Pinging...",runtimePingOk:a=>`Reachable (${a}ms)`,runtimePingFail:"Unreachable",runtimeUptime:"Uptime",runtimePid:"Process",runtimeMemory:"Memory",runtimeVersion:"Version",runtimeStartedAt:"Started",runtimeNoData:"No runtime data available.",envPermTitle:"Environment & Permissions",envVars:"Environment variables",envVarsCount:a=>`${a} configured`,envVarsEmpty:"No custom environment variables.",envScope:"Scope",envReadOnly:"Read-only access",envWriteAccess:"Write access",envFileAccess:"File access",envNetworkAccess:"Network access",envAllowed:"Allowed",envRestricted:"Restricted",activityTitle:"Activity & Usage",activityTotal:"Total invocations",activityLast7d:"Last 7 days",activityLastInvocation:"Last invocation",activityTokensUsed:"Tokens used",activityAvgLatency:"Avg latency",activityNoData:"No activity recorded yet.",knowledgeInteraction:"Knowledge Interaction",knowledgeNoData:"No interactions yet. Agents will show activity here once they start working with your knowledge base.",recentOps:"Recent Operations",statTotalCalls:"Total calls",statFilesTouched:"Files touched",statReadWrite:"Read / Write",statHealth:"Health",viewFullLog:"View full log",showLess:"Show less"},detailSubtitle:"",detailNotFound:"Agent not found — it may have been removed or renamed.",detailNotFoundHint:"The agent may have disconnected or its configuration file was moved. Try restarting the agent or check the MCP configuration.",detailNotFoundSuggestion:"Connected agents you can explore:"},settings:{title:"Settings",tabs:{ai:"AI",appearance:"Appearance",knowledge:"General",sync:"Sync",mcp:"Connections",plugins:"Plugins",shortcuts:"Shortcuts",monitoring:"Monitoring",agents:"Agents",update:"Update",uninstall:"Uninstall"},ai:{provider:"Provider",model:"Model",apiKey:"API Key",baseUrl:"Base URL",baseUrlHint:"Optional. Use for proxies or custom API endpoints.",keyHint:"Stored locally in ~/.mindos/config.json",keyOptionalHint:"Optional for local providers. Stored in ~/.mindos/config.json",keyChange:"Change",keyCancel:"Cancel",envHint:"Fields marked env have a value from environment variables. You can override them here, or restore all to env defaults.",envFieldNote:a=>`Env var ${a} is set. Clear this field to fall back to it.`,resetToEnv:"Reset to env value",restoreFromEnv:"Restore from env",noApiKey:"API key is not set. AI features will be unavailable until you add one.",testKey:"Test",testKeyTesting:"Testing...",testKeyOk:a=>`\u2713 ${a}ms`,testKeyAuthError:"Invalid API key",testKeyModelNotFound:"Model not found",testKeyRateLimited:"Rate limited, try again later",testKeyNetworkError:"Network error",testKeyNoKey:"No API key configured",testKeyUnknown:"Test failed",listModels:"Browse",noModelsFound:"No models found"},agent:{title:"Agent Behavior",subtitle:"Configure how the AI agent operates",maxSteps:"Max Steps",maxStepsHint:"Maximum tool call steps per request (1-30)",contextStrategy:"Context Strategy",contextStrategyHint:"Auto: summarize early messages when context fills up. Off: no summarization (emergency pruning still applies).",contextStrategyAuto:"Auto (compact + prune)",contextStrategyOff:"Off",thinking:"Extended Thinking",thinkingHint:"Show Claude's reasoning process (uses more tokens)",thinkingBudget:"Thinking Budget",thinkingBudgetHint:"Max tokens for reasoning (1000-50000)",reconnectRetries:"Auto Reconnect",reconnectRetriesHint:"When connection drops, automatically retry this many times before giving up (0 = disabled)"},appearance:{readingTitle:"Reading",readingDesc:"Customize how your notes look",readingFont:"Reading font",fontSize:"Font size",fontSizePreview:"The quick brown fox.",contentWidth:"Content width",preferencesTitle:"Preferences",colorTheme:"Color theme",system:"System",dark:"Dark",light:"Light",language:"Language",browserNote:"Appearance settings are saved in your browser.",labsTitle:"Labs",labsDesc:"Experimental features still in development. May change or be removed.",labsEcho:"Echo",labsEchoDesc:"Reflective journaling powered by your notes.",labsWorkflows:"Flows",labsWorkflowsDesc:"Visual workflow automation for agents.",fontPreview:"The quick brown fox jumps over the lazy dog."},knowledge:{cardTitle:"Knowledge Base",securityTitle:"Security",passwordPlaceholder:"Leave empty to disable",passwordShow:"Show",passwordHide:"Hide",tokenNotSet:"— not set —",mcpUrl:"MCP URL",tokenGenerated:"New token generated. Copy it now — it won't be shown in full again.",monitoringTitle:"System Monitoring",monitoringFailed:"Failed to load monitoring data",monitorHeap:"Heap",monitorRss:"RSS",monitorUptime:"Uptime",monitorNode:"Node",monitorRequests:"Requests",monitorToolCalls:"Tool Calls",monitorTokens:"Tokens",monitorFiles:"Files",monitorErrors:"Errors",monitorMcpRunning:a=>`Running :${a}`,monitorMcpStopped:"Stopped",cancel:"Cancel",mindRoot:"Knowledge base root",mindRootHint:"Absolute path to your notes directory. Requires server restart to take effect.",mindRootEnvHint:a=>`MIND_ROOT env var is set to "${a}". Fill in above to override it.`,envNote:"MIND_ROOT env var is set. Fill in above to override it — your value takes priority.",webPassword:"Web UI password",webPasswordHint:"Protect the browser UI with a password. Leave empty to disable. Changes take effect on next page load.",webPasswordClear:"Clear password",authToken:"MCP / API auth token",authTokenHint:"Bearer token for Agent and MCP clients. Not required for browser access.",authTokenNone:"No token set — API is open to all requests.",authTokenCopy:"Copy",authTokenCopied:"Copied!",authTokenReset:"Regenerate",authTokenClear:"Clear token",authTokenResetConfirm:"Regenerate token? All existing MCP clients will need to update their config.",authTokenMcpPort:"MCP port",restartWalkthrough:"Restart walkthrough",showHiddenFiles:"Show hidden files",showHiddenFilesHint:"Display dot-prefixed folders (.agents, .claude, .mindos, etc.) in the file tree.",cleanupExamples:"Clean up example files",cleanupExamplesHint:"Remove all template example files (\uD83E\uDDEA_example_*) from your knowledge base.",cleanupExamplesButton:"Clean up",cleanupExamplesNone:"No example files found",cleanupExamplesConfirm:a=>`Delete ${a} example file${a>1?"s":""}? This cannot be undone.`,cleanupExamplesDone:a=>`Removed ${a} example file${a>1?"s":""}`,cleanupExamplesScanning:"Scanning..."},sync:{emptyTitle:"Cross-device Sync",emptyDesc:"Automatically sync your knowledge base across devices via Git.",featureAutoCommit:"Auto-commit on save",featureAutoPull:"Auto-pull from remote",featureConflict:"Conflict detection",featureMultiDevice:"Works across devices",remoteUrl:"Git Remote URL",invalidUrl:"Invalid Git URL — use HTTPS (https://...) or SSH (git@...)",sshBrief:"one-time key setup, no token needed",httpsBrief:"works anywhere, token recommended",sshHint:"Requires SSH key on this machine. Verify with: ssh -T git@github.com",accessToken:"Access Token",optional:"(optional, for private repos)",tokenHint:"GitHub:",tokenLink:"Create a token (repo scope)",branchLabel:"Branch",connectButton:"Connect & Start Sync",connecting:"Connecting...",stepConnecting:"Connecting to remote...",stepAuthenticating:"Authenticating...",stepSyncing:"Syncing data...",stepAlmostDone:"Almost done...",stepDone:"Sync configured successfully!",gitignoreTitle:"Excluded files",gitignorePlaceholder:"# Files to exclude from sync\n*.tmp\nsecret/",gitignoreSave:"Save",gitignoreSaved:"Saved",conflictExplain:"These files were changed on both this device and the remote. Choose which version to keep.",keepLocal:"Keep local",keepRemote:"Keep remote",keepLocalHint:"Keep this device's version",keepRemoteHint:"Replace with the remote version",viewDiff:"Click to compare versions",localVersion:"Local (this device)",remoteVersion:"Remote",emptyFile:"(empty)",sectionTitle:"Sync",labelProvider:"Provider",labelRemote:"Remote",labelBranch:"Branch",labelLastSync:"Last sync",labelUnpushed:"Unpushed",labelAutoSync:"Auto-sync",unpushedCommits:a=>`${a} commits`,syncNow:"Sync Now",disableAutoSync:"Disable Auto-sync",enableAutoSync:"Enable Auto-sync",syncComplete:"Sync complete",syncFailed:"Sync failed",autoSyncDisabled:"Auto-sync disabled",autoSyncEnabled:"Auto-sync enabled",toggleFailed:"Failed to toggle sync",conflictsTitle:a=>`Conflicts (${a})`,conflictHint:"Click a file to view your version. Hover and click",conflictHintSuffix:"to see the remote version.",timeNever:"never",timeJustNow:"just now",timeMinAgo:a=>`${a}m ago`,timeHourAgo:a=>`${a}h ago`,timeDayAgo:a=>`${a}d ago`},plugins:{title:"Installed Renderers",builtinBadge:"built-in",coreBadge:"core",enabled:"Enabled",disabled:"Disabled",matchHint:"Auto-activates on",coreHint:"Core renderer — always enabled",noPlugins:"No renderers installed.",comingSoon:"Plugin marketplace coming soon."},mcp:{modeCardTitle:"Connection Mode",modeCardDesc:"Choose how agents connect to MindOS.",cliLabel:"CLI",cliModeDesc:"Claude Code, Gemini CLI, Codex, etc.",mcpLabel:"MCP",mcpModeDesc:"Claude Desktop, Cursor, Windsurf, etc.",alwaysOn:"Always On",mcpRunning:"Running",mcpStopped:"Stopped",mcpEnabledHint:"MCP mode enabled. Disable to simplify the interface if you only use CLI agents.",mcpDisabledHint:"Enable MCP to connect Desktop clients like Claude Desktop or Cursor.",serverTitle:"MindOS MCP Server",status:"Status",running:"Running",stopped:"Stopped",transport:"Transport",endpoint:"Endpoint",tools:"Tools",toolsRegistered:a=>`${a} registered`,auth:"Auth",authSet:"Token set",authNotSet:"No token",copyEndpoint:"Copy Endpoint",copyConfig:"Copy Config",copied:"Copied!",agentsTitle:"Agent Configuration",agent:"Agent",scope:"Scope",project:"Project",global:"Global",installed:"Installed",notInstalled:"Not installed",detected:"Detected",notFound:"Not found",transportStdio:"stdio (recommended)",transportHttp:"http",transportAuto:"auto (recommended)",httpUrl:"MCP URL",httpToken:"Auth Token",installSelected:"Install Selected",installing:"Installing...",installSuccess:a=>`${a} agent(s) configured`,installFailed:"Install failed",portLabel:"MCP Port",portHint:"Changes require server restart",skillsTitle:"Skills",skillsDesc:"Teach agents how to operate your knowledge base.",skillAutoLoaded:"Auto-loaded on every request",skillSource:"Source",skillBuiltin:"Built-in",skillUser:"Custom",addSkill:"+ Add Skill",cliInstallHint:"Install via CLI:",skillPathHint:"Skill files installed at:",deleteSkill:"Delete",editSkill:"Edit",saveSkill:"Save",cancelSkill:"Cancel",skillName:"Name",skillDesc:"Description",skillContent:"Content",skillNameConflict:"A skill with this name already exists",skillDeleteConfirm:a=>`Delete skill "${a}"? This cannot be undone.`,skillLanguage:"Skill Language",skillLangEn:"English",skillLangZh:"中文",searchSkills:"Search skills...",customGroup:"Custom",builtinGroup:"Built-in",noSkillsMatch:a=>`No skills match "${a}"`,skillTemplate:"Template",skillTemplateGeneral:"General",skillTemplateToolUse:"Tool-use",skillTemplateWorkflow:"Workflow",selectDetected:"Select Detected",clearSelection:"Clear",quickSetup:"Quick Setup",configureFor:"Configure for",configPath:"Config path",transportLocal:"Local",transportRemote:"Remote",transportLocalHint:"Local — same machine as MindOS server",transportRemoteHint:"Remote — connect from another device via HTTP",remoteDetectedHint:"Using your current remote IP.",remoteManualHint:"Replace 127.0.0.1 with your server's public or LAN IP.",remoteSteps:"To connect from another device: ① Open port {port} in firewall/security group ② Use the config below in your Agent ③ For public networks, consider SSH tunnel for encryption.",noAuthWarning:"⚠ No auth token — set one in Settings → General before enabling remote access.",showJson:"Show JSON",hideJson:"Hide JSON",connectionTitle:"Connect Agents",connectionHint:"Choose how your AI agents connect to MindOS.",tokenCardTitle:"Auth Token",tokenCardDesc:"Used by CLI remote mode and MCP connections.",mcpHint:"For Claude Desktop, Cursor, and agents that use MCP tool protocol.",tokenLabel:"Auth Token",tokenMasked:"Click Show to reveal the full token",tokenShow:"Show",tokenHide:"Hide",tokenCopy:"Copy",tokenCopied:"Token copied!",tokenNone:"No token set — your MCP server is open to all requests.",tokenNoneAction:"Generate a token in Settings → General → Security.",serverUrl:"MCP Server URL",serverUrlCopy:"Copy URL",howToConnect:"How to connect an AI agent",howToStep1:"Open your agent's MCP settings (e.g. Claude Code, Cursor)",howToStep2:"Add a new MCP server with the URL above",howToStep3:"Set the Auth Token as the bearer token",howToStep4:"Save and verify the connection",cliSkillTitle:"CLI Skill",cliSkillHint:"For agents with bash (Claude Code, Gemini CLI, Codex) — lower token cost, no MCP needed.",cliSkillDesc:"Lower token cost, Skill included — just install and go.",cliLocalDesc:"MindOS Skill is built-in. Install the CLI and you're good to go.",cliRemoteDesc:"Install the CLI on another machine and connect to this MindOS server.",cliSkillInstall:"Install",cliSkillInstallCmd:"npm install -g @geminilight/mindos",cliSkillRemote:"Remote",cliSkillVerify:"Verify",cliSkillVerifyCmd:"mindos file list",cliRemoteConfigure:"Configure",cliInstallSkill:"Install Skill",cliAgents:"Claude Code \xb7 Gemini CLI \xb7 Codex",mcpAgents:"Claude Desktop \xb7 Cursor",mcpDesc:"Requires per-agent MCP config. Install Skill separately via",mcpLocalDesc:"Copy the config snippet and paste into your agent's MCP settings.",mcpRunningLabel:"MCP Running",mcpServerStatus:"MCP Server",autoInstallAgents:"Auto-install to detected agents",detectedAgentsTitle:"Detected Agents",cliInstallDesc:"Install the MindOS Skill to your agent so it can operate your knowledge base.",mcpInstallDesc:"Install MCP config + Skill to detected agents on this machine.",tokenCopyFullHint:"Copies full token",skillsInstalled:"skills installed",recommended:"Recommended",localTitle:"Local",localReady:"Ready to use",remoteTitle:"Remote Access",remoteSubtitle:"Connect from another device",restarting:"Restarting...",restart:"Restart"},monitoring:{system:"System",heapMemory:"Heap Memory",rss:"RSS",uptime:"Uptime",nodeVersion:"Node",application:"Application",requests:"Requests",toolCalls:"Tool Calls",avgResponse:"Avg Response",tokens:"Tokens",errors:"Errors",knowledgeBase:"Knowledge Base",files:"Files",totalSize:"Total Size",rootPath:"Root",mcpStatus:"Status",mcpRunning:"Running",mcpStopped:"Stopped",mcpPort:"Port",autoRefresh:"Auto-refresh every 5s",fetchError:"Failed to load monitoring data"},agents:{mcpServer:"MCP Server",running:"Running",stopped:"Not running",restarting:"Restarting...",restart:"Restart",onPort:a=>`on :${a}`,refresh:"Refresh",refreshing:"Refreshing...",connected:"Connected",connectedCount:a=>`Connected (${a})`,detectedNotConfigured:"Detected but not configured",detectedCount:a=>`Detected but not configured (${a})`,notDetected:"Not Detected",notDetectedCount:a=>`Not Detected (${a})`,showAll:"Show all",hideAll:"Hide",connect:"Connect",noAgents:"No agents detected on this machine.",fetchError:"Failed to load agent data",autoRefresh:"Auto-refresh every 30s"},save:"Save",saved:"Saved",saveFailed:"Save failed",reconfigure:"Reconfigure",askDisplayMode:{label:"Display Mode",hint:"Side panel stays docked on the right. Popup opens a floating dialog.",panel:"Side Panel",popup:"Popup"},update:{checking:"Checking for updates...",upToDate:"You're up to date",available:(a,b)=>`Update available: v${a} → v${b}`,updating:"Updating MindOS... The server will restart shortly.",updatingHint:"This may take 1–3 minutes. Do not close this page.",serverRestarting:"Server is restarting, please wait...",updated:"Updated successfully! Reloading...",timeout:"Update may still be in progress.",timeoutHint:"The server may need more time to rebuild. Try refreshing.",refreshButton:"Refresh Page",retryButton:"Retry Update",error:"Failed to check for updates. Check your network connection.",checkButton:"Check for Updates",updateButton:a=>`Update to v${a}`,releaseNotes:"View release notes",hint:"Updates are installed via npm. Equivalent to running",inTerminal:"in your terminal.",desktopDownloading:"Downloading update...",desktopReady:"Update downloaded. Restart to apply.",desktopRestart:"Restart Now",desktopHint:"Updates are delivered through the Desktop app auto-updater.",coreTitle:"MindOS Core",coreUpToDate:"Core is up to date",coreAvailable:a=>`Update available (${a})`,coreDownloading:"Downloading...",coreCancel:"Cancel",coreReady:"Ready — restart services to apply",coreRestartServices:"Restart Services",coreApplying:"Applying update...",coreApplied:"Updated! Reloading...",coreError:"Core update failed.",coreRetry:"Retry",coreDesktopTooOld:a=>`v${a} requires a newer Desktop version.`,coreDesktopTooOldHint:"Please update MindOS Desktop first.",coreHint:"Core updates only restart services — no app restart needed.",shellTitle:"MindOS Desktop"},uninstall:{title:"Uninstall MindOS",descCli:"Remove MindOS CLI, background services, and configuration files from this machine.",descDesktop:"Remove MindOS Desktop, background services, and configuration files from this machine.",warning:"Select what to clean up. Your knowledge base files are always kept safe.",stopServices:"Stop services & remove daemon",stopServicesDesc:"Stop all running MindOS processes and remove the background daemon.",removeConfig:"Remove configuration",removeConfigDesc:"Delete ~/.mindos/ directory (config, logs, PID files).",removeNpm:"Uninstall CLI package",removeNpmDesc:"Run npm uninstall -g @geminilight/mindos.",removeApp:"Move Desktop app to Trash",removeAppDesc:"Move MindOS.app to Trash. You can restore it later if needed.",confirmTitle:"Confirm Uninstall",confirmButton:"Uninstall",cancelButton:"Cancel",running:"Uninstalling...",success:"MindOS has been uninstalled.",successDesktop:"MindOS has been uninstalled. The app will quit now.",error:"Uninstall failed. You can run `mindos uninstall` in terminal manually.",nothingSelected:"Select at least one item to uninstall.",kbSafe:"Your knowledge base files are always safe — they are never deleted by this action."}},onboarding:{subtitle:"Your knowledge base is empty. Pick a starter template to get going.",templates:{en:{title:"English",desc:"Pre-built structure with Profile, Notes, Projects, and more."},zh:{title:"中文",desc:"预置画像、笔记、项目等中文目录结构。"},empty:{title:"Empty",desc:"Just the essentials — README, CONFIG, and INSTRUCTION."}},importHint:"Already have notes? Set MIND_ROOT to your existing directory in Settings.",syncHint:"Want cross-device sync? Run",syncHintSuffix:"in the terminal after setup.",initError:"Initialization failed. Please refresh the page or try a different template.",dismiss:"Dismiss"},setup:{stepTitles:["Knowledge Base","AI Configuration","Agent Connection","Confirm"],kbPath:"Knowledge base path",kbPathHint:"Absolute path to your notes directory.",kbPathDefault:"~/MindOS/mind",kbPathUseDefault:a=>`Use ${a}`,kbPathHasFiles:a=>`This directory already contains ${a} file${a>1?"s":""}. You can skip the template or merge (existing files won't be overwritten).`,kbTemplateSkip:"Skip template",kbTemplateMerge:"Choose a template to merge",template:"Starter template",templateSkip:"Skip (directory already has files)",aiProvider:"AI Provider",aiProviderHint:"Choose your preferred AI service.",aiSkip:"Skip — configure later",apiKey:"API Key",apiKeyExisting:"Existing key configured. Leave blank to keep it.",model:"Model",baseUrl:"Base URL",baseUrlHint:"Optional. For proxies or custom API endpoints.",webPort:"Web UI port",mcpPort:"MCP server port",portHint:"Valid range: 1024–65535",portRestartWarning:"The service will start on these ports after setup completes.",portInUse:a=>`Port ${a} is already in use.`,portSuggest:a=>`Use ${a}`,portChecking:"Checking…",portSelf:"Current port",portConflict:"Web UI and MCP ports must be different.",portVerifyHint:"Click outside each field to verify, or wait for auto-check.",authToken:"Auth Token",authTokenHint:"Bearer token for MCP / API clients. Auto-generated.",authTokenUsage:"Used for MCP connections and API clients. When configuring an Agent, this token is written automatically — no manual steps needed.",authTokenUsageWhat:"What is this?",authTokenSeed:"Custom seed (optional)",authTokenSeedHint:"Enter a passphrase to derive a deterministic token.",generateToken:"Generate",copyToken:"Copy",copiedToken:"Copied!",webPassword:"Web Password",webPasswordHint:"Protect your knowledge base from unauthorized browser access.",webPasswordRequired:"Password is required to protect your data.",advancedPorts:"Advanced Settings",tokenSectionTitle:"Auth Token (auto-generated)",tokenSectionHint:"Used by AI agents to connect to your MindOS server.",agentToolsTitle:"Agent Connection",connectionModeTitle:"Connection Mode",connectionModeCliHint:"Recommended \xb7 Lower token usage",connectionModeMcpHint:"Optional \xb7 Higher token usage",agentToolsHint:"Select which AI agents to configure. This step is optional.",agentToolsHintCliOnly:"Agent selection applies when MCP mode is enabled. CLI works with all agents that have bash access.",agentToolsHintNone:"No connection mode selected. Select at least one mode to connect agents.",agentTransport:"Transport",agentScope:"Scope",agentToolsLoading:"Loading agents…",agentToolsEmpty:"No supported agents detected.",agentNoneSelected:"No agents selected. You can configure agents later in Settings.",agentSkipLater:"Clear all",agentSelectDetected:"Select detected agents",agentNoneDetected:"No agents detected on your system.",agentShowMore:a=>`Show ${a} more agents`,agentAdvanced:"Advanced options",agentScopeGlobal:"Install for all projects",agentScopeProject:"This project only",badgeInstalled:"Installed",badgeDetected:"Detected",badgeNotFound:"Not found",agentNotInstalled:"not installed",agentDetected:"detected",agentNotFound:"not found",agentGetIt:"Get it →",agentStatusOk:"configured",agentStatusError:"failed",agentInstalling:"Configuring…",agentTransportAuto:"Auto (recommended)",agentTransportLabel:"Transport",agentVerified:"verified",agentUnverified:"unverified",agentVerifyNote:"stdio agents are verified after restart",skillWhat:"",skillAutoHint:()=>"",skillLabel:"Skill",skillInstalling:"Installing skill…",skillInstalled:"Skill installed",skillFailed:"Skill install failed",aiSkipTitle:"Skip for now",aiSkipDesc:"You can add an API key later in Settings → AI.",reviewHint:"Verify your settings, then press Complete Setup.",reviewInstallResults:"Agent configuration results:",phaseSaving:"Saving configuration…",phaseAgents:"Configuring agents…",phaseSkill:"Installing skill…",phaseDone:"Setup complete!",retryAgent:"Retry",agentFailedCount:a=>`${a} agent${a>1?"s":""} failed`,agentCountSummary:a=>`${a} agent${a>1?"s":""}`,agentFailureNote:"Agent failures are non-blocking — you can enter MindOS and retry from Settings → Connections.",portAvailable:"Available",portChanged:"Port changed — please restart the server for it to take effect.",restartRequired:"Server restart required for these changes to take effect.",restartNow:"Restart now",restarting:"Restarting…",restartDone:"Server is restarting. Redirecting shortly…",restartManual:"Restart manually:",back:"Back",next:"Next",complete:"Complete Setup",skip:"Skip",completing:"Saving...",completeDone:"Setup complete!",completeFailed:"Setup failed. Please try again.",healthKb:"Knowledge Base",healthKbNone:"Not configured",healthAi:"AI Provider",healthAiNone:"Not configured — AI features disabled",healthAiAction:"Add an API key in Settings → AI.",healthAgents:"Agent Connection",healthAgentsOk:a=>`${a} agent${a>1?"s":""} configured`,healthAgentsPartial:"Configuration in progress...",healthAgentsNone:"No agents configured",healthAgentsAction:"You can add agents later in Settings → Connections.",healthSkills:"Skills",healthSkillsOk:"Skills installed successfully",healthSkillsError:"Skill installation failed",healthSkillsSkipped:"Skipped",healthSkillsInstalling:"Installing skills...",healthSkillsAction:"You can install skills manually later.",healthTokenTitle:"Auth Token",healthTokenCopy:"Copy token",healthTokenHint:"Used by CLI remote mode and MCP connections. Also available in Settings → Connections.",healthGoHome:"Go to MindOS",welcomeTitle:"Welcome to MindOS!",welcomeDesc:"Setup is complete. Start by asking AI a question, browsing your knowledge base, or configuring MCP agents.",welcomeLinkReconfigure:"Reconfigure",welcomeLinkAskAI:"MindOS Agent",welcomeLinkMCP:"MCP Settings"},guide:{title:"Quick Start",showGuide:"Show getting started guide",close:"Close",skip:"Skip",import:{title:"Import your files",cta:"Import",desc:"Upload your resume, project docs, or notes — anything you want AI agents to know about you.",button:"Import Files"},ai:{title:"Save with AI",cta:"Try it",desc:"Ask MindOS Agent to capture knowledge from this conversation into your KB:",prompt:"Help me distill the key takeaways from our conversation into a reusable SOP in my knowledge base.",promptEmpty:"Help me design a knowledge base folder structure that fits my needs"},agent:{title:"Connect other Agents",cta:"Copy prompt",desc:"Open Cursor, Claude Code, or any Agent with MindOS CLI and paste:",copyPrompt:"Summarize what we discussed and save it to my MindOS knowledge base as a reusable SOP.",copy:"Copy",copied:"Copied!"},done:{title:"You're all set!",titleFinal:"You've mastered MindOS essentials!",steps:[{hint:"Next: try saving an article into your KB →",prompt:"Help me save the key points from this article into MindOS."},{hint:"Next: try turning experience into a reusable SOP →",prompt:"Help me distill this conversation into a reusable workflow in MindOS."}]}},walkthrough:{step:(a,b)=>`${a} of ${b}`,next:"Next",back:"Back",skip:"Skip tour",done:"Done",exploreCta:"Explore what you can do →",steps:[{title:"Your Project Memory",body:"Organize projects, SOPs, and preferences in Spaces. Everything is local-first and under your control."},{title:"AI That Already Knows You",body:"MindOS Agent reads your entire knowledge base automatically. Ask about your projects — no need to re-explain anything."},{title:"Connect Any Agent",body:"Link Cursor, Claude Code, or Windsurf via MCP — they all share the same project memory."}]},shortcuts:[{keys:["⌘","K"],description:"Search"},{keys:["⌘","/"],description:"MindOS Agent"},{keys:["⌘",","],description:"Settings"},{keys:["E"],description:"Edit current file"},{keys:["⌘","S"],description:"Save"},{keys:["Esc"],description:"Cancel edit / close modal"},{keys:["@"],description:"Attach file in MindOS Agent"}],help:{title:"Help & Guide",subtitle:"Everything you need to get started with MindOS",whatIs:{title:"What is MindOS?",body:"MindOS is where you think, and where your AI agents act. You and AI share the same brain — when you correct AI, that correction is captured automatically; next time AI understands you better, and your own thinking gets sharper along the way. You and AI grow together. In an age of AI anxiety, MindOS focuses on human growth — think clearly, make better decisions, ship faster, and build up knowledge that's truly yours."},quickStart:{title:"Quick Start",step1Title:"Browse your knowledge base",step1Desc:'Click the Spaces icon in the left sidebar to explore your files. Each top-level folder is a "Space" — a themed area like Profile, Notes, or Projects.',step2Title:"Chat with AI",step2Desc:"Press ⌘/ (or Ctrl/) to open the AI panel. Ask anything about your knowledge base, or use @ to attach a specific file for context.",step3Title:"Connect your AI agents",step3Desc:"Go to Settings → Connections to connect external agents like Claude Code, Cursor, or Windsurf. Once connected, they can read and write your knowledge base directly."},concepts:{title:"Core Concepts",spaceTitle:"Space",spaceDesc:"Spaces are knowledge partitions organized the way you think. You decide the structure, and AI agents follow it to read, write, and manage automatically.",instructionTitle:"Instruction",instructionDesc:"A rules file that all AI agents obey. You write the boundaries once, and every agent connected to your knowledge base follows them.",skillTitle:"Skill",skillDesc:"Teaches agents how to operate your knowledge base — reading, writing, organizing. Agents don't guess; they follow the skills you've installed."},shortcutsTitle:"Keyboard Shortcuts",agentUsage:{title:"Using MindOS with AI Agents",intro:"Once you connect an agent (Claude Code, Cursor, Windsurf, etc.) via MCP, just talk to it naturally. The agent can read and write your knowledge base directly — no special commands needed. Here are the most common scenarios:",scenarios:[{emoji:"\uD83E\uDEAA",title:"Inject Your Identity",desc:"Tell all AI agents who you are — preferences, tech stack, communication style — in one shot.",prompt:'"Here\'s my resume, read it and organize my info into MindOS."'},{emoji:"\uD83D\uDD04",title:"Cross-Agent Handoff",desc:"Brainstorm ideas in GPT, then execute in Claude Code — zero context loss.",prompt:'"Save this conversation to MindOS."\n"Read the plan in MindOS and help me start coding."'},{emoji:"\uD83D\uDCCB",title:"Experience → SOP",desc:"Turn hard-won debugging sessions into reusable workflows that prevent future mistakes.",prompt:'"Help me distill this conversation into a reusable workflow in MindOS."'},{emoji:"\uD83D\uDE80",title:"Project Cold Start",desc:"Spin up a new project in minutes — your profile and SOPs guide the scaffolding automatically.",prompt:'"Help me start a new project following the Startup SOP in MindOS."'},{emoji:"\uD83D\uDD0D",title:"Research & Archive",desc:"Let agents research competitors or topics for you, then file structured results in your knowledge base.",prompt:'"Help me research X, Y, Z products and save results to the MindOS product library."'}],copy:"Copy prompt",hint:'Tip: The agent auto-discovers your knowledge base structure. Just mention "MindOS" in your prompt and it will know where to look. Click "Explore" in the left sidebar for more scenarios.'},shortcuts:{search:"Search files",askAI:"Toggle AI panel",settings:"Open Settings",shortcutPanel:"Keyboard shortcuts panel",editFile:"Edit current file",save:"Save file",closePanel:"Close panel / Exit modal",attachFile:"Attach file in AI chat"},faq:{title:"FAQ",items:[{q:"How do I change the language?",a:"Go to Settings → Appearance → Language. You can switch between English and Chinese."},{q:"How do I connect an AI agent?",a:"Go to Settings → Connections. MindOS auto-detects installed agents (Claude Code, Cursor, etc.) and lets you connect them with one click."},{q:"Where is my data stored?",a:"All your data stays on your local machine as plain Markdown files. MindOS never uploads your data to any cloud service. You own everything."},{q:"How do I sync across devices?",a:"Go to Settings → Sync. MindOS uses Git for cross-device sync. Enter your Git remote URL and access token to start syncing."},{q:"Can I use my own AI provider?",a:"Yes! Go to Settings → AI. You can use OpenAI, Anthropic, Google, or any OpenAI-compatible API with a custom base URL."},{q:"What file formats are supported?",a:"MindOS works best with Markdown (.md) files, but also supports JSON, CSV, and plain text. Plugins extend rendering for special formats like Kanban boards or timelines."},{q:"How do I create a new note?",a:"Click the + icon next to any folder in the file tree, or ask AI to create one for you. Notes are just Markdown files — you can also create them from your file system."}]}},explore:{title:"Explore Use Cases",subtitle:"Discover what you can do with MindOS — pick a scenario and try it now.",tryIt:"Try it",all:"All",byCapability:"By Capability",byScenario:"By Scenario",categories:{"knowledge-management":"Knowledge Management","memory-sync":"Memory Sync","auto-execute":"Auto Execute","experience-evolution":"Experience Evolution","human-insights":"Human Insights","audit-control":"Audit & Control"},scenarios:{"first-day":"First Day",daily:"Daily Work",project:"Project Work",advanced:"Advanced"},c1:{title:"Inject Your Identity",desc:"Tell all AI agents who you are — preferences, tech stack, communication style — in one shot.",prompt:"Here's my resume, read it and organize my info into MindOS."},c2:{title:"Save Information",desc:"Archive articles, meeting notes, or web pages into your knowledge base with one prompt.",prompt:"Help me save the key points from this article into MindOS."},c3:{title:"Cross-Agent Handoff",desc:"Start a plan in MindOS, continue coding in Claude Code, refine in Cursor — zero context loss.",prompt:"Help me start coding based on the plan in MindOS."},c4:{title:"Experience → SOP",desc:"Turn hard-won debugging sessions into reusable workflows that prevent future mistakes.",prompt:"Help me distill this conversation into a reusable workflow in MindOS."},c5:{title:"Capture Ideas on the Go",desc:"Jot down an inspiration on your phone — MindOS archives, decomposes, and assigns to agents.",prompt:"Help me organize this idea into MindOS and break it into actionable sub-tasks."},c6:{title:"Project Cold Start",desc:"Spin up a new project in 4 minutes — your profile and SOPs guide the scaffolding automatically.",prompt:"Help me start a new project following the Startup SOP in MindOS."},c7:{title:"Research & Archive",desc:"Let agents research competitors or topics for you, then file structured results in your KB.",prompt:"Help me research X, Y, Z products and save results to the MindOS product library."},c8:{title:"Network Management",desc:"Log conversations with contacts, auto-generate follow-up TODOs, and keep full context.",prompt:"I met with someone today — update MindOS Connections and create follow-up TODOs."},c9:{title:"Audit & Correct",desc:"Review what agents know about you, fix mistakes in one place, and all agents update instantly.",prompt:"Check my MindOS Profile for accuracy and correct any errors."}}},zh:{common:{relatedFiles:"关联视图"},app:{tagline:"你在此思考,Agent 依此行动。",footer:"MindOS \xb7 人机共生知识系统"},login:{tagline:"人类在此思考,Agent 依此行动。",subtitle:"请输入密码以继续",passwordLabel:"密码",passwordPlaceholder:"输入密码",signIn:"登录",signingIn:"登录中…",incorrectPassword:"密码错误,请重试。",connectionError:"连接错误,请重试。"},notFound:{title:"文件未找到",description:"该文件不存在于你的知识库中。",createButton:"创建此文件",creating:"创建中...",goToParent:"返回上级目录",goHome:"首页"},updateBanner:{newVersion:(a,b)=>`MindOS v${a} 可用(当前 v${b})`,updateNow:"更新",runUpdate:"终端运行",orSee:"或",releaseNotes:"查看更新说明"},sidebar:{files:"知识库",search:"搜索",searchTitle:"搜索",askTitle:"MindOS Agent",settingsTitle:"设置",plugins:"插件",agents:"智能体",echo:"回响",discover:"探索",workflows:"流程",history:"历史",help:"帮助",syncLabel:"同步",collapseTitle:"收起侧栏",expandTitle:"展开侧栏",collapseLevel:"折叠一级",collapseLevelHint:"折叠一级(双击:全部折叠)",expandLevel:"展开一级",expandLevelHint:"展开一级(双击:全部展开)",importFile:"导入文件",new:"新建",newFile:"新建文件",newSpace:"新建空间",more:"更多",capture:"暂存台",showHiddenFiles:"显示隐藏文件",sync:{synced:"已同步",unpushed:"待推送",unpushedHint:"个提交尚未推送到远程 — 将自动同步",conflicts:"冲突",conflictsHint:"个文件存在合并冲突 — 前往 设置 > 同步 解决",syncError:"同步出错",syncOff:"同步关闭",syncing:"同步中...",syncNow:"立即同步",syncDone:"同步完成",syncFailed:"同步失败",syncRestored:"同步已恢复",enableSync:"启用同步",enableHint:"设置跨设备同步"}},search:{placeholder:"搜索文件...",noResults:"没有找到结果",prompt:"输入关键词搜索所有文件",navigate:"上下导航",open:"打开",close:"关闭",tabSearch:"搜索",tabActions:"快捷操作",openSettings:"打开设置",restartWalkthrough:"重新开始引导",toggleDarkMode:"切换深色模式",goToAgents:"前往智能体",goToDiscover:"前往探索",goToHelp:"前往帮助",walkthroughRestarted:"引导已重置"},shortcutPanel:{title:"快捷键",navigation:"导航",panelsSection:"面板",editor:"编辑器",toggleSearch:"切换搜索",toggleAskAI:"切换 AI 助手",openSettings:"打开设置",keyboardShortcuts:"快捷键",closePanel:"关闭面板 / 退出最大化",saveFile:"保存文件",undo:"撤销",redo:"重做",toggleHint:"切换此面板"},...d,home:{recentlyModified:"最近修改",recentlyActive:"最近活跃",recentlyEdited:"最近编辑",allSpaces:"所有空间",spaces:"心智空间",nFiles:a=>`${a} 个文件`,other:"其他",newSpace:"新建空间",spaceName:"空间名称",spaceDescription:"描述",spaceDescPlaceholder:"描述这个空间的用途",spaceNameNoSlash:"名称不能包含 / 或 \\",spaceExists:"已存在同名空间",spaceCreateFailed:"创建空间失败",noSpacesYet:"还没有空间,创建一个来整理你的知识吧。",spaceLocation:"位置",rootLevel:"根目录",optional:"可选",aiInit:"AI 初始化内容",aiInitHint:"AI 将自动生成空间说明和操作指南",aiInitNoKey:"在 设置 → AI 中配置 API 密钥以启用",aiInitGenerating:a=>`正在为「${a}」生成内容`,aiInitReady:a=>`「${a}」已就绪`,aiInitReview:"查看",aiInitDiscard:"撤销",aiInitReverted:a=>`「${a}」已恢复为模板`,createSpace:"创建",cancelCreate:"取消",continueEditing:"继续编辑",newNote:"新建笔记",builtinFeatures:"工具面板",builtinActive:"已启用",builtinInactive:"未激活",toolName:{"agent-inspector":"审计面板","config-panel":"配置面板",todo:"待办面板","workflow-yaml":"工作流"},toolDesc:{"agent-inspector":"查看 Agent 操作日志与调用轨迹","config-panel":"编辑和管理全局配置项",todo:"以看板形式管理待办事项","workflow-yaml":"执行多步骤工作流,AI 辅助执行"},plugins:"扩展",changeHistory:"变更历史",showMore:"查看更多",showLess:"收起",viewAll:"查看全部",wikiTagline:"你的知识空间,井然有序。",sortRecent:"最近",sortName:"字母序",sortCount:"文件数",createToActivate:"创建 {file} 以启用",shortcuts:{searchFiles:"搜索文件",askAI:"MindOS Agent",editFile:"编辑文件",save:"保存",settings:"设置"},relativeTime:{justNow:"刚刚",minutesAgo:a=>`${a} 分钟前`,hoursAgo:a=>`${a} 小时前`,daysAgo:a=>`${a} 天前`},cleanupExamples:a=>`有 ${a} 个模板示例文件可以清理`,cleanupExamplesButton:"一键清理",cleanupExamplesDone:"示例文件已清理"},echoSpotlight:{title:"回响",dailyLine:"今日一行",placeholder:"写下今天的一行想法…",invite:"记录今天的一行想法",inviteDesc:"一行就够。回响会沉淀你的思维模式。",goToEcho:"打开回响",savedLocally:"保存在本设备"},suggestion:{title:"你可能想",staleFiles:a=>`${a} 个文件超过 30 天未更新`,reviewStale:"查看",dismiss:"忽略"},inbox:{title:"暂存台",count:a=>`${a}`,emptyTitle:"快速捕获,稍后整理",emptyDesc:"拖拽文件到此处,或点击上传按钮,即刻保存到暂存台。",uploadButton:"上传文件",organizeButton:"AI 整理",organizing:"整理中...",viewAll:"查看全部",more:a=>`还有 ${a} 个`,viewAllFiles:a=>`查看 Inbox 中全部 ${a} 个文件`,viewAllHistory:a=>`查看全部 ${a} 条记录 →`,agingHint:"7天+",savedToast:a=>`${a} 个文件已保存到暂存台`,savedToDir:(a,b)=>`${a} 个文件已保存到 ${b}`,savedWithSkipped:(a,b)=>a>0?`已保存 ${a} 个,跳过 ${b} 个(格式不支持)`:`${b} 个文件被跳过(格式不支持)`,tooLarge:a=>`${a} 个文件过大(上限 10 MB)`,savedWithOversized:(a,b)=>`已保存 ${a} 个,${b} 个过大被跳过`,organizePrompt:a=>`请将暂存台中的这些文件整理到知识库的合适位置。分析每个文件的内容,将其移动到最匹配的空间或目录。需要的话可以创建新目录。以下是待整理的文件:
147
147
 
148
- ${a.map(a=>`- Inbox/${a}`).join("\n")}`,dropOverlay:"拖放到暂存台快速保存",dropOverlayFormats:"md \xb7 txt \xb7 pdf \xb7 csv \xb7 json",noMindRoot:"请先配置知识库路径",saveFailed:"保存文件失败,请检查磁盘空间和权限。",organizeFailed:"无法读取文件进行整理,请检查文件权限。"},pulse:{title:"你的 Agent",manage:"管理",connectTitle:"连接你的 AI 工具",connectDesc:"让 Cursor、Claude Code 等 AI 读到你的笔记。",connectAction:"连接 Agent",active:"已连接",detected:"已检测",notFound:"未发现",running:"在线",offline:"离线",summary:(a,b)=>`${a} 个 Agent \xb7 ${b} 个技能`,skillCount:(a,b)=>`${a}/${b} 个技能`,showMore:a=>`还有 ${a} 个`,showLess:"收起",otherDetected:"已检测到"},fileTree:{newFileTitle:"在此目录新建文件",rename:"重命名",delete:"删除",create:"创建",enterFileName:"请输入文件名",failed:"操作失败",confirmDelete:a=>`确定删除「${a}」?可在回收站恢复(30 天内)。`,rules:"规则",about:"说明",viewAll:"查看全部",editRules:"编辑规则",viewRules:"查看规则",renameSpace:"重命名空间",deleteSpace:"删除空间",confirmDeleteSpace:a=>`删除空间「${a}」及其所有文件?可在回收站恢复(30 天内)。`,convertToSpace:"转为空间",deleteFolder:"删除文件夹",confirmDeleteFolder:a=>`删除文件夹「${a}」及其所有内容?可在回收站恢复(30 天内)。`,newFile:"新建文件",importFile:"导入文件",importToSpace:"导入文件到此空间",copyPath:"复制路径",pathCopied:"路径已复制",pinToFavorites:"固定到收藏",removeFromFavorites:"取消收藏",export:"导出..."},pinnedFiles:{title:"收藏文件",addedToast:"已添加到收藏",removedToast:"已取消收藏",empty:"还没有收藏文件",emptyHint:"点击任何文件上的星标图标即可收藏"},trash:{title:"回收站",subtitle:"删除的文件将保留 30 天。",empty:"回收站为空",emptySubtext:"删除的文件将在此处保留 30 天。",emptyTrash:"清空回收站",emptyTrashConfirm:"永久删除回收站中的所有项目?此操作不可撤销。",restore:"恢复",deletePermanently:"彻底删除",deletePermanentlyConfirm:a=>`确定彻底删除「${a}」?此操作不可撤销。`,from:"来自",deletedAgo:a=>`${a}删除`,expiresIn:a=>`${a} 天后过期`,restored:"已恢复",deleted:"已彻底删除",movedToTrash:"已删除",undo:"撤销",undoFailed:"撤销失败",restoreFailed:"无法恢复文件,请检查磁盘空间后重试。",deleteFailed:"无法彻底删除,请重试。",emptyFailed:"无法清空回收站,请重试。",emptied:a=>`已清空 ${a} 个项目`,restoreConflict:"原位置已有同名文件。",overwrite:"覆盖",saveAsCopy:"保存副本",itemCount:a=>`${a} 个项目`,undoDelete:"撤销",viewInTrash:"查看回收站",fileDeleted:a=>`「${a}」已移至回收站`,cancel:"取消",justNow:"刚刚",minutesAgo:a=>`${a} 分钟前`,hoursAgo:a=>`${a} 小时前`,daysAgo:a=>`${a} 天前`},export:{title:"导出",exportFile:"导出文件",exportSpace:"导出空间",chooseFormat:"选择格式",formatMd:"Markdown (.md)",formatMdDesc:"原始格式,可编辑",formatHtml:"HTML (.html)",formatHtmlDesc:"静态网页,可分享",formatZipMd:"Markdown ZIP",formatZipMdDesc:"所有文件,原始格式",formatZipHtml:"HTML ZIP",formatZipHtmlDesc:"所有文件,网页格式",preview:"预览",exporting:"导出中...",exportButton:"导出",cancel:"取消",close:"完成",done:"导出完成",downloadAgain:"再次下载",fileCount:a=>`${a} 个文件`,downloaded:"已下载",error:"导出失败,请检查磁盘空间后重试。",retry:"重试"},fileImport:{title:"导入文件",subtitle:"将外部文件存入知识库或让 AI 帮你整理",dropzoneText:"拖拽文件到这里,或",dropzoneButton:"点击选择",dropzoneCompact:"拖拽更多文件,或",dropzoneCompactButton:"点击添加",dropzoneMobile:"点击选择文件",fileCount:a=>`${a} 个文件`,clearAll:"清空全部",unsupported:"不支持的文件类型",tooLarge:a=>`文件过大(最大 ${a})`,archiveTitle:"存入知识库",archiveDesc:"原样归档到指定空间",digestTitle:"AI 帮我整理",digestDesc:"提取要点,沉淀到笔记",archiveConfigTitle:"存入知识库",back:"← 返回",targetSpace:"目标空间",rootDir:"根目录",conflictLabel:"同名文件已存在时",conflictRename:"自动重命名(添加序号后缀)",conflictSkip:"跳过不导入",conflictOverwrite:"覆盖已有文件",overwriteWarn:"将永久替换已有文件内容",cancel:"取消",importButton:a=>`存入 ${a} 个文件`,importing:"正在存入...",preparing:"准备中...",successToast:(a,b)=>`已存入 ${a} 个文件到 ${b||"知识库"}`,updatedIndex:a=>`更新了 ${a} 个索引文件`,partialToast:(a,b)=>`存入 ${a}/${b} 个文件`,skipReason:"同名文件已存在",failToast:"导入失败",retry:"重试",undo:"撤销",discardTitle:"放弃导入?",discardMessage:a=>`放弃已选的 ${a} 个文件?`,discardConfirm:"放弃",discardCancel:"取消",dropOverlay:"松开鼠标,导入文件到知识库",dropOverlayFormats:"支持 .md .txt .pdf .csv .json .yaml .html",onboardingHint:"已有笔记?导入文件到知识库 →",digestPromptSingle:(a,b)=>{let c=b?`"${b}" 空间下`:"知识库中合适的位置";return`用户上传了「${a}」。你必须:
148
+ ${a.map(a=>`- Inbox/${a}`).join("\n")}`,dropOverlay:"拖放到暂存台快速保存",dropOverlayFormats:"md \xb7 txt \xb7 pdf \xb7 csv \xb7 json",noMindRoot:"请先配置知识库路径",saveFailed:"保存文件失败,请检查磁盘空间和权限。",organizeFailed:"无法读取文件进行整理,请检查文件权限。",removeFile:"从暂存台移除",openFile:"打开",copyName:"复制文件名",fileRemoved:"文件已从暂存台移除",fileRemoveFailed:"移除文件失败"},pulse:{title:"你的 Agent",manage:"管理",connectTitle:"连接你的 AI 工具",connectDesc:"让 Cursor、Claude Code 等 AI 读到你的笔记。",connectAction:"连接 Agent",active:"已连接",detected:"已检测",notFound:"未发现",running:"在线",offline:"离线",summary:(a,b)=>`${a} 个 Agent \xb7 ${b} 个技能`,skillCount:(a,b)=>`${a}/${b} 个技能`,showMore:a=>`还有 ${a} 个`,showLess:"收起",otherDetected:"已检测到"},fileTree:{newFileTitle:"在此目录新建文件",rename:"重命名",delete:"删除",create:"创建",enterFileName:"请输入文件名",failed:"操作失败",confirmDelete:a=>`确定删除「${a}」?可在回收站恢复(30 天内)。`,rules:"规则",about:"说明",viewAll:"查看全部",editRules:"编辑规则",viewRules:"查看规则",renameSpace:"重命名空间",deleteSpace:"删除空间",confirmDeleteSpace:a=>`删除空间「${a}」及其所有文件?可在回收站恢复(30 天内)。`,convertToSpace:"转为空间",deleteFolder:"删除文件夹",confirmDeleteFolder:a=>`删除文件夹「${a}」及其所有内容?可在回收站恢复(30 天内)。`,newFile:"新建文件",importFile:"导入文件",importToSpace:"导入文件到此空间",copyPath:"复制路径",pathCopied:"路径已复制",pinToFavorites:"固定到收藏",removeFromFavorites:"取消收藏",export:"导出..."},pinnedFiles:{title:"收藏文件",addedToast:"已添加到收藏",removedToast:"已取消收藏",empty:"还没有收藏文件",emptyHint:"点击任何文件上的星标图标即可收藏"},trash:{title:"回收站",subtitle:"删除的文件将保留 30 天。",empty:"回收站为空",emptySubtext:"删除的文件将在此处保留 30 天。",emptyTrash:"清空回收站",emptyTrashConfirm:"永久删除回收站中的所有项目?此操作不可撤销。",restore:"恢复",deletePermanently:"彻底删除",deletePermanentlyConfirm:a=>`确定彻底删除「${a}」?此操作不可撤销。`,from:"来自",deletedAgo:a=>`${a}删除`,expiresIn:a=>`${a} 天后过期`,restored:"已恢复",deleted:"已彻底删除",movedToTrash:"已删除",undo:"撤销",undoFailed:"撤销失败",restoreFailed:"无法恢复文件,请检查磁盘空间后重试。",deleteFailed:"无法彻底删除,请重试。",emptyFailed:"无法清空回收站,请重试。",emptied:a=>`已清空 ${a} 个项目`,restoreConflict:"原位置已有同名文件。",overwrite:"覆盖",saveAsCopy:"保存副本",itemCount:a=>`${a} 个项目`,undoDelete:"撤销",viewInTrash:"查看回收站",fileDeleted:a=>`「${a}」已移至回收站`,cancel:"取消",justNow:"刚刚",minutesAgo:a=>`${a} 分钟前`,hoursAgo:a=>`${a} 小时前`,daysAgo:a=>`${a} 天前`},export:{title:"导出",exportFile:"导出文件",exportSpace:"导出空间",chooseFormat:"选择格式",formatMd:"Markdown (.md)",formatMdDesc:"原始格式,可编辑",formatHtml:"HTML (.html)",formatHtmlDesc:"静态网页,可分享",formatZipMd:"Markdown ZIP",formatZipMdDesc:"所有文件,原始格式",formatZipHtml:"HTML ZIP",formatZipHtmlDesc:"所有文件,网页格式",preview:"预览",exporting:"导出中...",exportButton:"导出",cancel:"取消",close:"完成",done:"导出完成",downloadAgain:"再次下载",fileCount:a=>`${a} 个文件`,downloaded:"已下载",error:"导出失败,请检查磁盘空间后重试。",retry:"重试"},fileImport:{title:"导入文件",subtitle:"将外部文件存入知识库或让 AI 帮你整理",dropzoneText:"拖拽文件到这里,或",dropzoneButton:"点击选择",dropzoneCompact:"拖拽更多文件,或",dropzoneCompactButton:"点击添加",dropzoneMobile:"点击选择文件",fileCount:a=>`${a} 个文件`,clearAll:"清空全部",unsupported:"不支持的文件类型",tooLarge:a=>`文件过大(最大 ${a})`,archiveTitle:"存入知识库",archiveDesc:"原样归档到指定空间",digestTitle:"AI 帮我整理",digestDesc:"提取要点,沉淀到笔记",archiveConfigTitle:"存入知识库",back:"← 返回",targetSpace:"目标空间",rootDir:"根目录",conflictLabel:"同名文件已存在时",conflictRename:"自动重命名(添加序号后缀)",conflictSkip:"跳过不导入",conflictOverwrite:"覆盖已有文件",overwriteWarn:"将永久替换已有文件内容",cancel:"取消",importButton:a=>`存入 ${a} 个文件`,importing:"正在存入...",preparing:"准备中...",successToast:(a,b)=>`已存入 ${a} 个文件到 ${b||"知识库"}`,updatedIndex:a=>`更新了 ${a} 个索引文件`,partialToast:(a,b)=>`存入 ${a}/${b} 个文件`,skipReason:"同名文件已存在",failToast:"导入失败",retry:"重试",undo:"撤销",discardTitle:"放弃导入?",discardMessage:a=>`放弃已选的 ${a} 个文件?`,discardConfirm:"放弃",discardCancel:"取消",dropOverlay:"松开鼠标,导入文件到知识库",dropOverlayFormats:"支持 .md .txt .pdf .csv .json .yaml .html",onboardingHint:"已有笔记?导入文件到知识库 →",digestPromptSingle:(a,b)=>{let c=b?`"${b}" 空间下`:"知识库中合适的位置";return`用户上传了「${a}」。你必须:
149
149
  1. 从上方「USER-UPLOADED FILES」区域读取文件内容
150
150
  2. 提取和重新整理关键信息为结构清晰的 Markdown 笔记
151
151
  3. 将整理后的内容保存到${c}——可以创建新文件,也可以更新已有文件
@@ -167,22 +167,27 @@ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if
167
167
  flex-col bg-background border-l border-border/40 shadow-[-4px_0_16px_rgba(0,0,0,0.04)]
168
168
  transition-[width,transform] duration-200 ease-out
169
169
  ${a?"translate-x-0":"translate-x-full pointer-events-none"}
170
- `,style:{width:C,minWidth:`${o}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:r,onModeSwitch:s,maximized:t,onMaximize:u})})}),(0,e.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:B,children:(0,e.jsx)("div",{className:"absolute left-[2px] top-0 w-[1px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity duration-150"})})]})}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)}}},63956:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>f});var d=c(48249),e=c(67484);function f({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,c=a.split("/").pop()??"video",f=c.split(".").pop()?.toLowerCase()??"",[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(0),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),o=(0,e.useRef)(null),p=(0,e.useCallback)(()=>{let a=o.current;a&&n({w:a.videoWidth,h:a.videoHeight})},[]),q=(0,e.useCallback)(()=>{h(!1),j(a=>a+1)},[]);return(0,d.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[m&&(0,d.jsxs)("span",{children:[m.w," x ",m.h]}),null!==k&&(0,d.jsx)("span",{children:k<1024?`${k} B`:k<1048576?`${(k/1024).toFixed(1)} KB`:`${(k/1048576).toFixed(1)} MB`}),(0,d.jsx)("span",{className:"uppercase opacity-60",children:f})]}),(0,d.jsx)("div",{className:"flex-1 min-h-[50vh] flex items-center justify-center bg-black rounded-b-lg overflow-hidden",children:g?(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-neutral-400",children:"Failed to load video"}),(0,d.jsx)("button",{onClick:q,className:"text-xs px-3 py-1.5 rounded-md bg-neutral-800 hover:bg-neutral-700 text-neutral-200 transition-colors",children:"Retry"})]}):(0,d.jsx)("video",{ref:o,controls:!0,preload:"metadata",className:"max-w-full max-h-[70vh]",onLoadedMetadata:p,onError:()=>h(!0),children:(0,d.jsx)("source",{src:b})},i)})]})}},64229:(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,59238)),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,92206)),Promise.resolve().then(c.bind(c,29406)),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,14986)),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))},64501:(a,b,c)=>{"use strict";c.d(b,{i:()=>e});var d=c(99829);let e=(0,d.createServerReference)("40c86ac21ee661ed9d62ce7c5af52049cbaeca26a2",d.callServer,void 0,d.findSourceMapURL,"deleteFileAction")},65141:(a,b,c)=>{"use strict";c.d(b,{b:()=>g});var d=c(67484),e=c(91052),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:()=>F});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(47223),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(41739),y=c(33827),z=c(74190),A=c(4452),B=c(93574),C=c(33191),D=c(17009),E=a([A]);function F({visible:a,currentFile:b,initialMessage:c,initialAcpAgent:d,onFirstMessage:E,variant:F,onClose:G,maximized:H,onMaximize:I,askMode:J,onModeSwitch:K}){let L="panel"===F,M="home"===F,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,D.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,B.t)({currentFile:b,chatMode:ai,providerOverride:ak,onFirstMessage:E,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),az.firstMessageFired.current=!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,copyMessage:P.ask.copyMessage}),[P,aC]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(x.A,{isPanel:L||M,showHistory:Y,onToggleHistory:aV,onReset:aP,isLoading:aA,maximized:H,onMaximize:I,askMode:M?void 0:J,onModeSwitch:M?void 0:K,onClose:M?void 0:G,sessions:am.sessions,activeSessionId:am.activeSessionId,onLoadSession:aU,onDeleteSession:am.deleteSession,onRenameSession:am.renameSession,onTogglePinSession:am.togglePinSession}),Y&&(0,e.jsx)(w.A,{sessions:am.sessions,activeSessionId:am.activeSessionId,onLoad:aU,onDelete:am.deleteSession,onRename:am.renameSession,onTogglePin:am.togglePinSession,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"}}),!M&&(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}),M&&am.messages.length>0&&(0,e.jsx)(t.A,{messages:am.messages,isLoading:aA,loadingPhase:aB,emptyPrompt:P.ask.emptyPrompt,emptyHint:P.ask.emptyHint,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.5 pt-1",children:(0,e.jsxs)("div",{className:(0,C.cn)("rounded-xl bg-muted/40 transition-all focus-within:bg-muted/60",$&&"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,C.cn)("px-3 pt-2.5 pb-1",L?"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)(y.A,{path:a,variant:"kb",onRemove:()=>W(b=>b.filter(b=>b!==a))},a)),ao.localAttachments.map((a,b)=>(0,e.jsx)(y.A,{path:a.name,variant:"upload",onRemove:()=>ao.removeAttachment(b)},`up-${a.name}-${b}`)),aq.images.map((a,b)=>(0,e.jsx)(y.A,{path:`Image ${b+1}`,variant:"image",imageData:a.data,imageMime:a.mimeType,onRemove:()=>aq.removeImage(b)},`img-${b}`)),ac&&(0,e.jsx)(y.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.5 px-3 py-2",children:[(0,e.jsxs)("div",{className:"relative shrink-0",children:[(0,e.jsx)("button",{type:"button",onClick:()=>ab(a=>!a),className:"p-2 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.5 py-1 rounded-xl border border-border/60 bg-card shadow-lg z-50 min-w-[150px] animate-in fade-in-0 slide-in-from-bottom-2 duration-150",children:[(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",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.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",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-2 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground/50 outline-none focus-visible:ring-0"}),aA?(0,e.jsx)("button",{type:"button",onClick:aF,className:"p-2 rounded-xl transition-colors shrink-0 text-foreground bg-muted hover:bg-muted/80",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-2 rounded-xl disabled:opacity-20 disabled:scale-95 disabled:cursor-not-allowed transition-all duration-150 shrink-0 bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/15 hover:shadow-md hover:shadow-[var(--amber)]/20 active:scale-95",children:(0,e.jsx)(l.A,{size:14})})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 pb-2 pt-1.5 border-t border-border/10",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(n.Ay,{mode:ai,onChange:aj,disabled:aA}),Q&&at.installedAgents.length>0&&(0,e.jsx)(z.A,{selectedAgent:af,onSelect:ag,installedAgents:at.installedAgents,loading:at.loading}),Q&&(0,e.jsx)(A.Ay,{value:ak,onChange:al,disabled:aA})]}),(0,e.jsxs)("span",{className:"hidden md:inline text-2xs text-muted-foreground/40 select-none",children:[(0,e.jsx)("kbd",{className:"font-mono",children:"Enter"})," ",P.ask.send," \xb7 ",(0,e.jsx)("kbd",{className:"font-mono",children:"Shift+Enter"})," ",P.ask.newlineHint]})]})]})})]})}A=(E.then?(await E)():E)[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,w]=(0,d.useState)("upload"),x=(0,d.useRef)(0),[y,z]=(0,d.useState)(0),A=(0,d.useCallback)(async(a,c,d="upload")=>{b("organizing"),e([]),g(null),i({stage:"connecting"}),l(""),n(null),p(0),u(a.map(a=>a.name)),w(d),x.current=Date.now(),z(0),s.current=new Map,r.current=Date.now();let f=new AbortController;q.current=f;let h=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:h,maxSteps:15,mode:"organize"}),signal:f.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 d=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)},f.signal);e(d.changes),l(d.summary),p(d.toolCallCount),g(null),z(Date.now()-x.current),b("done")}catch(a){"AbortError"===a.name?b("idle"):(n(a.message),b("error"))}finally{q.current=null}},[]),B=(0,d.useCallback)(()=>{q.current?.abort()},[]),C=(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]),D=(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]),E=(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]),F=c.some(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),G=(0,d.useCallback)(()=>{b("idle"),e([]),g(null),i(null),l(""),n(null),p(0),u([]),w("upload"),z(0),x.current=0,s.current=new Map,r.current=0},[]);return{phase:a,changes:c,currentTool:f,stageHint:h,summary:k,error:m,toolCallCount:o,sourceFileNames:t,source:v,durationMs:y,snapshots:s,start:A,abort:B,undoOne:C,undoAll:D,canUndo:E,hasAnyUndoable:F,reset:G}}},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)}
171
- `),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(47223);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(47223);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:`
172
- inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
173
- text-2xs font-medium transition-colors
174
- border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
175
- ${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"}
176
- `,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:()=>_});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(801),m=c(10316),n=c(11732),o=c(90473),p=c(8455),q=c(75157),r=c(96348),s=c(92023),t=c(36815),u=c(69593),v=c(39868),w=c(7309),x=c(35654),y=c(12625),z=c(50567),A=c(80600),B=c(93017),C=c(59347),D=c(62688),E=c(11035),F=c(96286),G=c(13576),H=c(83654),I=c(44218),J=c(19794),K=c(31675),L=c(49681),M=c(2797);let N=new Set(["delete_file","move_file","rename_file","write_file"]),O=new Set(["write_file","create_file","update_section","insert_after_heading","edit_lines","append_to_file"]),P={search:m.A,list_files:w.A,read_file:x.A,write_file:y.A,create_file:z.A,append_to_file:A.A,insert_after_heading:B.A,update_section:y.A,delete_file:C.A,rename_file:A.A,move_file:D.A,get_backlinks:E.A,get_history:F.A,get_file_at_version:F.A,get_recent:G.A,append_csv:H.A},Q="--- changes ---";function R({part:a}){let b=O.has(a.toolName),c="done"===a.state,[f,g]=(0,e.useState)(null),h=f??(b&&c),k=P[a.toolName]??j.A,l=N.has(a.toolName),m=(0,e.useMemo)(()=>(function(a){if(!a)return{header:"",stats:"",diffLines:[]};let b=a.indexOf(Q);if(-1===b)return{header:a,stats:"",diffLines:[]};let c=a.slice(0,b).trim(),d=a.slice(b+Q.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.5 rounded-lg border text-xs font-mono ${l?"border-[var(--amber)]/30 bg-background/60":"border-border/40 bg-background/50"}`,children:[(0,d.jsxs)("button",{type:"button",onClick:()=>g(a=>null===a?!h:!a),"aria-expanded":h,className:"w-full flex items-center gap-1.5 px-2.5 py-2 text-left hover:bg-muted/30 transition-colors rounded-lg",children:[h?(0,d.jsx)(I.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(J.A,{size:12,className:"shrink-0 text-muted-foreground"}),l&&(0,d.jsx)(K.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)(L.A,{size:12,className:"text-success"}):(0,d.jsx)(M.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.5 pb-2.5 pt-1.5 space-y-1.5",children:["running"===a.state&&(0,d.jsxs)("div",{className:"text-muted-foreground/60 text-2xs flex items-center gap-1.5",children:[(0,d.jsx)(i.A,{size:10,className:"animate-spin"})," Running..."]}),(0,d.jsxs)("div",{className:"text-muted-foreground leading-relaxed",children:[(0,d.jsx)("span",{className:"font-semibold text-foreground/70",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 leading-relaxed",children:[(0,d.jsx)("span",{className:"font-semibold text-foreground/70",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 S=c(46218),T=c(47223);function U({text:a,isStreaming:b}){let[c,f]=(0,e.useState)(!1),{t:g}=(0,T.Y)();return a||b?(0,d.jsxs)("div",{className:"my-1.5 rounded-lg border border-border/30 bg-muted/15 text-xs",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a=>!a),"aria-expanded":c,className:"w-full flex items-center gap-1.5 px-2.5 py-2 text-left hover:bg-muted/30 transition-colors rounded-lg",children:[c?(0,d.jsx)(I.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(J.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsx)(S.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/50 truncate flex-1 ml-1",children:[a.slice(0,80),a.length>80?"...":""]})]}),c&&(0,d.jsx)("div",{className:"px-2.5 pb-2.5 pt-1 border-t border-border/20",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-full"})]})})]}):null}let V=/^Use the skill ([^:]+):\s*/;function W({text:a,label:b}){let[c,h]=(0,e.useState)(!1),i=(0,e.useCallback)(()=>{(0,v.l)(a).then(a=>{a&&(h(!0),setTimeout(()=>h(!1),2e3))})},[a]);return(0,d.jsx)("button",{type:"button",onClick:i,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-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",title:b??"Copy",children:c?(0,d.jsx)(f.A,{size:11,className:"text-success"}):(0,d.jsx)(g.A,{size:11})})}function X({content:a,skillName:b,images:c}){let e=b??a.match(V)?.[1],f=a.match(V),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-white/20 text-white/90 mr-1 align-middle",children:[(0,d.jsx)(h.A,{size:10,className:"shrink-0"}),e]}),e?g:a]})}function Y({content:a,isStreaming:b}){let c=(0,u.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-muted/80 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:before:content-none prose-code:after:content-none prose-code:font-mono prose-pre:bg-muted/60 prose-pre:text-foreground prose-pre:text-xs prose-pre:rounded-lg prose-blockquote:border-l-[var(--amber)] prose-blockquote:text-muted-foreground prose-blockquote:not-italic 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.5 prose-td:py-1 ",children:[(0,d.jsx)(s.oz,{remarkPlugins:[t.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-full"})]}):null}function Z({message:a,isStreaming:b}){let c=a.parts;if(!c||0===c.length)return a.content?(0,d.jsx)(Y,{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)(U,{text:a.text,isStreaming:f},`reasoning-${e}`)}if("text"===a.type){let f=b&&e===c.length-1;return a.text?(0,d.jsx)(Y,{content:a.text,isStreaming:f},e):null}return"tool-call"===a.type?(0,d.jsx)(R,{part:a},a.toolCallId):null}),f&&(0,d.jsxs)("div",{className:"flex items-center gap-2 py-1.5 mt-1.5",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 $({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-2 pt-1.5 border-t border-border/15 text-xs text-muted-foreground/60",children:[(0,d.jsx)(j.A,{size:10}),(0,d.jsxs)("span",{className:"font-medium",children:["Step ",b.length,e?` — ${e}`:""]})]})}let _=(0,e.memo)(function({messages:a,isLoading:b,loadingPhase:c,emptyPrompt:f,emptyHint:g,suggestions:h,onSuggestionClick:j,labels:s}){let t=(0,e.useRef)(null),v=(0,e.useRef)(null),[w,x]=(0,e.useState)(!1),y=(0,e.useCallback)(()=>{let a=v.current;a&&a.scrollTo({top:a.scrollHeight,behavior:"smooth"})},[]);return(0,d.jsxs)("div",{ref:v,role:"log","aria-live":"polite",className:"relative flex-1 overflow-y-auto overflow-x-hidden px-4 py-5 space-y-5 min-h-0",children:[0===a.length&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1 min-h-[260px] px-6 pt-10 pb-4",children:[(0,d.jsxs)("div",{className:"relative w-12 h-12 rounded-2xl bg-[var(--amber)]/10 flex items-center justify-center mb-6",children:[(0,d.jsx)("div",{className:"absolute inset-0 rounded-2xl bg-[var(--amber)]/5 scale-[1.4]"}),(0,d.jsx)(k.A,{size:22,className:"text-[var(--amber)] relative z-10"})]}),(0,d.jsx)("p",{className:"text-center text-[15px] font-semibold text-foreground tracking-tight mb-2",children:f}),g&&(0,d.jsx)("p",{className:"text-center text-xs text-muted-foreground/80 mb-10 tracking-wide",children:g}),(0,d.jsx)("div",{className:"flex flex-col gap-2.5 max-w-[280px] w-full",children:h.map((a,b)=>{let c=[l.A,m.A,n.A,o.A],e=c[b%c.length];return(0,d.jsxs)("button",{type:"button",onClick:()=>j(a.prompt),className:"group/sug flex items-center gap-3 text-left text-[13px] px-3.5 py-3 rounded-xl border border-border/40 bg-transparent text-muted-foreground hover:text-foreground hover:border-[var(--amber)]/30 hover:bg-[var(--amber)]/5 transition-all leading-snug","aria-label":a.prompt,children:[(0,d.jsx)("span",{className:"shrink-0 w-8 h-8 rounded-lg bg-muted/60 flex items-center justify-center group-hover/sug:bg-[var(--amber)]/10 transition-colors",children:(0,d.jsx)(e,{size:15,className:"text-muted-foreground/70 group-hover/sug:text-[var(--amber)] transition-colors"})}),(0,d.jsx)("span",{className:"flex-1",children:a.label})]},b)})})]}),a.map((e,f)=>(0,d.jsxs)("div",{className:`flex gap-3 animate-[fadeSlideUp_0.22s_ease_both] ${"user"===e.role?"justify-end":"justify-start"}`,children:["assistant"===e.role&&(0,d.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 mt-0.5 bg-[var(--amber)]/8",children:(0,d.jsx)(k.A,{size:13,className:"text-[var(--amber)]"})}),"user"===e.role?(0,d.jsx)("div",{className:"max-w-[85%] px-3.5 py-2.5 rounded-2xl rounded-br-lg text-sm leading-relaxed whitespace-pre-wrap bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/10",children:(0,d.jsx)(X,{content:e.content,skillName:e.skillName,images:e.images})}):e.content.startsWith("__error__")?(0,d.jsx)("div",{className:"max-w-[85%] px-3.5 py-3 rounded-2xl rounded-bl-md border border-error/30 bg-error/10 text-sm shadow-sm",children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5 text-error",children:[(0,d.jsx)(p.A,{size:15,className:"shrink-0 mt-0.5"}),(0,d.jsx)("span",{className:"leading-relaxed font-medium",children:e.content.slice(9)})]})}):(0,d.jsx)("div",{className:"group relative max-w-[85%] px-3.5 py-2.5 rounded-2xl rounded-bl-lg bg-card border border-border/30 shadow-sm text-foreground text-sm",children:e.parts&&e.parts.length>0||(0,u.Oo)(e.content)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Z,{message:e,isStreaming:b&&f===a.length-1}),b&&f===a.length-1&&(0,d.jsx)($,{parts:e.parts}),!(b&&f===a.length-1)&&(0,u.Oo)(e.content)&&(0,d.jsx)(W,{text:(0,u.Oo)(e.content),label:s.copyMessage})]}):b&&f===a.length-1?(0,d.jsxs)("div",{className:"flex items-center gap-2.5 py-1",children:["reconnecting"===c?(0,d.jsx)(q.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",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:["reconnecting"===c?s.reconnecting??"Reconnecting...":"connecting"===c?s.connecting:"thinking"===c?s.thinking:s.generating,(0,d.jsxs)("span",{className:"inline-flex gap-0.5",children:[(0,d.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:0ms]"}),(0,d.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:150ms]"}),(0,d.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:300ms]"})]})]})})]}):null})]},f)),(0,d.jsx)("div",{ref:t}),w&&a.length>0&&(0,d.jsx)("button",{type:"button",onClick:y,className:"sticky bottom-2 left-1/2 -translate-x-1/2 z-10 p-2 rounded-full border border-border/60 bg-card shadow-md text-muted-foreground hover:text-foreground hover:bg-muted transition-all hover:shadow-lg",title:"Scroll to bottom",children:(0,d.jsx)(r.A,{size:14})})]})})},75539:(a,b,c)=>{"use strict";c.d(b,{A:()=>k});var d=c(48249),e=c(67484),f=c(93017),g=c(3129),h=c(12625),i=c(59347),j=c(54461);function k({sessions:a,activeSessionId:b,onLoad:c,onDelete:k,onRename:l,onTogglePin:m,onClearAll:n,labels:o}){let[p,q]=(0,e.useState)(!1),r=(0,e.useRef)(void 0),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(""),w=(0,e.useRef)(null),x=(0,e.useCallback)(a=>{t(a.id),v((0,j.d)(a))},[]),y=(0,e.useCallback)(()=>{s&&(l(s,u),t(null))},[s,u,l]),z=(0,e.useCallback)(()=>{t(null)},[]);return(0,d.jsxs)("div",{className:"border-b border-border/40 px-4 py-3 max-h-[220px] overflow-y-auto",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:o.title}),a.length>1&&(0,d.jsx)("button",{type:"button",onClick:()=>{if(!p){q(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>q(!1),3e3);return}r.current&&clearTimeout(r.current),n(),q(!1)},className:`text-2xs px-2 py-0.5 rounded-md transition-colors ${p?"bg-error/10 text-error font-medium":"text-muted-foreground/60 hover:text-error hover:bg-muted"}`,children:p?o.confirmClear:o.clearAll})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[0===a.length&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground/50 py-2 text-center",children:o.noSessions}),a.map(a=>{let e=b===a.id;return(0,d.jsxs)("div",{className:"group flex items-center gap-0.5",children:[a.pinned&&(0,d.jsx)(f.A,{size:10,className:"shrink-0 text-[var(--amber)]/50 -rotate-45 ml-1"}),(0,d.jsxs)("button",{type:"button",onClick:()=>c(a.id),onDoubleClick:()=>x(a),className:`flex-1 text-left px-2.5 py-2 rounded-lg text-xs transition-colors min-w-0 ${e?"bg-[var(--amber)]/8 text-foreground border border-[var(--amber)]/15":"text-muted-foreground hover:bg-muted hover:text-foreground border border-transparent"}`,children:[s===a.id?(0,d.jsx)("input",{ref:w,type:"text",value:u,onChange:a=>v(a.target.value),onBlur:y,onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),y()),"Escape"===a.key&&(a.preventDefault(),z())},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 font-medium",children:(0,j.d)(a)}),s!==a.id&&(0,d.jsx)("div",{className:"text-2xs text-muted-foreground/50 mt-0.5",children:function(a){let b=Math.floor((Date.now()-a.getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return d<7?`${d}d ago`:a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(new Date(a.updatedAt))})]}),(0,d.jsx)("button",{type:"button",onClick:()=>m(a.id),className:`p-1.5 rounded-lg transition-opacity opacity-0 group-hover:opacity-100 ${a.pinned?"text-[var(--amber)] hover:text-muted-foreground":"text-muted-foreground hover:text-[var(--amber)]"}`,title:a.pinned?"Unpin":"Pin",children:a.pinned?(0,d.jsx)(g.A,{size:11}):(0,d.jsx)(f.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:()=>x(a),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:o.rename,children:(0,d.jsx)(h.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:()=>k(a.id),className:"p-1.5 rounded-lg text-muted-foreground hover:text-error hover:bg-error/5 opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete session",children:(0,d.jsx)(i.A,{size:11})})]},a.id)})]})]})}},77720:(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)("4019c85807995f6d2c0ddbf7e34f067240518721db",y.callServer,void 0,y.findSourceMapURL,"convertToSpaceAction"),A=(0,y.createServerReference)("60086aac16846e7543e4e5d9b7f6ae6f85bd303b02",y.callServer,void 0,y.findSourceMapURL,"createFileAction"),B=(0,y.createServerReference)("60514eb6d89625f146634c094363137fa7c5b3ffbd",y.callServer,void 0,y.findSourceMapURL,"renameSpaceAction");var C=c(92395);let D=(0,y.createServerReference)("40c2f41416ac04fd7377bb002e68c453787a30e0a8",y.callServer,void 0,y.findSourceMapURL,"deleteSpaceAction"),E=(0,y.createServerReference)("4036f7a581dd59783d5fffa80331b2a4d18b65ed43",y.callServer,void 0,y.findSourceMapURL,"deleteFolderAction");var F=c(95303),G=c(64501),H=c(99101),I=c(47223),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]);(0,e.useCallback)(a=>{a.stopPropagation(),$()},[$]);let ad=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),R({x:a.clientX,y:a.clientY})},[]),ae=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 af=n&&0===b;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"relative group/dir flex items-center",onContextMenu:ad,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}`,"aria-expanded":o,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:10})})}),(0,d.jsxs)("button",{type:"button",onClick:ac,draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.setData("text/mindos-type","directory"),b.dataTransfer.effectAllowed="copy"},className:`
170
+ `,style:{width:C,minWidth:`${o}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:r,onModeSwitch:s,maximized:t,onMaximize:u})})}),(0,e.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:B,children:(0,e.jsx)("div",{className:"absolute left-[2px] top-0 w-[1px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity duration-150"})})]})}d()}catch(a){d(a)}})},61572:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>ab,Fo:()=>S,gL:()=>T});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)("4036ed6785c2bdcd0c2e14a4445d571615318ab699",y.callServer,void 0,y.findSourceMapURL,"convertToSpaceAction"),A=(0,y.createServerReference)("60ea96ae82c4236eec257dd4f09f3f4f7672dcf519",y.callServer,void 0,y.findSourceMapURL,"createFileAction"),B=(0,y.createServerReference)("60fbaa16d8e17aacf66fc85b115c652f72844a7076",y.callServer,void 0,y.findSourceMapURL,"renameSpaceAction");var C=c(19765);let D=(0,y.createServerReference)("407a777f67f9059923f362281bbc10ede55dbd4f72",y.callServer,void 0,y.findSourceMapURL,"deleteSpaceAction"),E=(0,y.createServerReference)("406b84708d2165b47f20d918c55dc1ae207c14fa1a",y.callServer,void 0,y.findSourceMapURL,"deleteFolderAction");var F=c(98541),G=c(84416),H=c(99101),I=c(47223),J=c(63710),K=c(57056),L=c(29713),M=c(93678);function N(){window.dispatchEvent(new Event("mindos:files-changed"))}async function O(a){try{await navigator.clipboard.writeText(a)}catch{}}let P="show-hidden-files";function Q(a){let b=b=>{b.key===P&&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 R(){return!1}function S(a){localStorage.setItem(P,String(a)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function T(){return(0,e.useSyncExternalStore)(Q,R,()=>!1)}function U({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 V="w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",W="w-full flex items-center gap-2 px-3 py-2 text-sm text-error hover:bg-error/10 transition-colors text-left",X="my-1 border-t border-border/50";function Y({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,L.Z)(),w=u(c.path);return(0,d.jsxs)(U,{x:a,y:b,onClose:e,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{i(),e()},children:[(0,d.jsx)(k.A,{size:14,className:"shrink-0"})," ",t.fileTree.newFile]}),(0,d.jsxs)("button",{className:V,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:V,onClick:()=>{j(c.path),e()},children:[(0,d.jsx)(m.A,{size:14,className:"shrink-0"})," ",t.fileTree.importFile]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:V,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:V,onClick:()=>{O(c.path),e()},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",t.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{g(),e()},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",t.fileTree.renameSpace]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:()=>{e(),r()},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"}),t.fileTree.deleteSpace]})]})}function Z({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,L.Z)(),w=u(c.path);return(0,d.jsxs)(U,{x:a,y:b,onClose:g,menuHeight:220,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{i(),g()},children:[(0,d.jsx)(k.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:V,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:V,disabled:s,onClick:()=>{t(async()=>{if((await z(c.path)).success){l.refresh(),N();let a=c.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||c.name;(0,M.w)().then(b=>{b&&(0,M.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:V,onClick:()=>{O(c.path),g()},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{h(),g()},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",m.fileTree.rename]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:()=>{g(),j()},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"}),m.fileTree.deleteFolder]})]})}function $({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(),N()):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,L]=(0,e.useState)(a.name),[M,O]=(0,e.useTransition)(),P=(0,e.useRef)(null),Q=(0,e.useRef)(null),[R,S]=(0,e.useState)(null),{t:T}=(0,I.Y)(),[U,V]=(0,e.useState)(null),[W,X]=(0,e.useTransition)(),[_,aa]=(0,e.useState)(!1),ac=(0,e.useRef)(null),ad=(0,e.useRef)(null),ae=(0,e.useCallback)(()=>{ac.current&&(clearTimeout(ac.current),ac.current=null)},[]),af=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",ad.current&&(clearTimeout(ad.current),ad.current=null),_||aa(!0))},[_]),ag=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),aa(!0),ae(),o||(ac.current=setTimeout(()=>{p(!0),ac.current=null},500)))},[o,ae]),ah=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.stopPropagation(),ad.current=setTimeout(()=>{aa(!1),ae(),ad.current=null},50))},[ae]),ai=(0,e.useCallback)(b=>{b.preventDefault(),b.stopPropagation(),aa(!1),ae(),ad.current&&(clearTimeout(ad.current),ad.current=null);let c=b.dataTransfer.files;c.length>0&&(0,J.N)(Array.from(c),a.path,T)},[a.path,T,ae]),aj=(0,e.useCallback)(()=>p(a=>!a),[]);(0,e.useRef)(void 0);let ak=(0,e.useCallback)(b=>{b?.preventDefault(),b?.stopPropagation(),Q.current&&(clearTimeout(Q.current),Q.current=null),L(a.name),A(!0),setTimeout(()=>P.current?.select(),0)},[a.name]),al=(0,e.useCallback)(()=>{let b=G.trim();b&&b!==a.name?O(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(),N()):A(!1)}):A(!1)},[G,a.name,a.path,l,n]),am=(0,e.useCallback)(()=>{z||(Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{l.push(`/view/${(0,h.O0)(a.path)}`),i?.(),Q.current=null},180))},[z,l,a.path,i]);(0,e.useCallback)(a=>{a.stopPropagation(),aj()},[aj]);let an=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),S({x:a.clientX,y:a.clientY})},[]),ao=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:P,autoFocus:!0,value:G,onChange:a=>L(a.target.value),onKeyDown:a=>{"Enter"===a.key&&al(),"Escape"===a.key&&A(!1)},onBlur:al,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"}),M&&(0,d.jsx)(s.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let ap=n&&0===b;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:`relative group/dir flex items-center transition-colors duration-100 ${_?"bg-[var(--amber)]/10 rounded-md":""}`,onContextMenu:an,onDragEnter:ag,onDragOver:af,onDragLeave:ah,onDrop:ai,children:[(0,d.jsx)("button",{onClick:aj,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}`,"aria-expanded":o,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:10})})}),(0,d.jsxs)("button",{type:"button",onClick:am,draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.setData("text/mindos-type","directory"),b.dataTransfer.effectAllowed="copy"},className:`
177
171
  flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
178
172
  text-sm transition-colors duration-100
179
173
  hover:bg-muted cursor-default
180
174
  ${m?"text-foreground":"text-muted-foreground hover:text-foreground"}
181
- `,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:ae})]}),(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 ${af?"border-l-2 ml-[18px]":""}`,style:af?{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:af?1:b+1,onNavigate:i,maxOpenDepth:j,parentIsSpace:n,onImport:k}),q&&(0,d.jsx)(Z,{dirPath:a.path,depth:af?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,onContextMenu:aa,draggable:!0,onDragStart:_,"data-filepath":a.path,className:`
175
+ `,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:ao})]}),(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();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})})})]}),(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 ${ap?"border-l-2 ml-[18px]":""}`,style:ap?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!o&&{inert:!0},children:[a.children&&(0,d.jsx)(ab,{nodes:a.children,depth:ap?1:b+1,onNavigate:i,maxOpenDepth:j,parentIsSpace:n,onImport:k}),q&&(0,d.jsx)($,{dirPath:a.path,depth:ap?0:b,onDone:()=>y(!1)})]})}),R&&(n?(0,d.jsx)(Y,{x:R.x,y:R.y,node:a,onClose:()=>S(null),onRename:()=>ak(),onNewFile:()=>{p(!0),y(!0)},onImport:k,onDelete:()=>V("space")}):(0,d.jsx)(Z,{x:R.x,y:R.y,node:a,onClose:()=>S(null),onRename:()=>ak(),onNewFile:()=>{p(!0),y(!0)},onDelete:()=>V("folder")})),(0,d.jsx)(K.TM,{open:null!==U,title:"space"===U?T.fileTree.deleteSpace:T.fileTree.deleteFolder,message:"space"===U?T.fileTree.confirmDeleteSpace(a.name):T.fileTree.confirmDeleteFolder(a.name),confirmLabel:"space"===U?T.fileTree.deleteSpace:T.fileTree.deleteFolder,cancelLabel:T.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>V(null),onConfirm:()=>{V(null),X(async()=>{let b="space"===U?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(`${T.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,F.Y)(c);a.success?(l.refresh(),N()):H.oR.error(a.error??"Undo failed")},{label:T.trash?.undo??"Undo"}),l.push("/"),l.refresh(),N()}})}})]})}function aa({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,L.Z)(),J=D(a.path),M=!a.path.includes("/")&&g.A.has(a.name),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(null),T=(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(),N()):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:T,onContextMenu:aa,draggable:!0,onDragStart:_,"data-filepath":a.path,className:`
182
176
  w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
183
177
  text-sm transition-colors duration-100 cursor-default pr-16
184
178
  ${m?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
185
- `,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("."))),p=n?o.filter(a=>"directory"!==a.type||"Inbox"!==a.name):o;return(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:p.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))})}},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)},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:f,labels:g}){let h="***set***"===a,[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),m=(0,e.useRef)(null);(0,e.useRef)(a);let n=(0,e.useCallback)(()=>{k.trim()&&b(k),j(!1),l("")},[k,b]),o=(0,e.useCallback)(()=>{j(!1),l("")},[]),p=g?.change??"Change",q=g?.cancel??"Cancel";return h&&!i?(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("div",{className:"flex-1 px-3 py-2 text-sm bg-muted/50 border border-border rounded-lg text-muted-foreground select-none tracking-widest",children:"••••••••••••"}),(0,d.jsx)("button",{type:"button",onClick:()=>{l(""),j(!0),requestAnimationFrame(()=>m.current?.focus())},disabled:f,className:"shrink-0 px-3 py-2 text-xs font-medium rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",children:p})]}):i?(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{ref:m,type:"password",value:k,onChange:a=>l(a.target.value),onKeyDown:a=>{"Enter"===a.key&&n()},onBlur:n,placeholder:c??"sk-...",disabled:f,className:"flex-1 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"}),(0,d.jsx)("button",{type:"button",onMouseDown:a=>a.preventDefault(),onClick:o,className:"shrink-0 px-3 py-2 text-xs font-medium rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:q})]}):(0,d.jsx)("input",{type:"password",value:a,onChange:a=>b(a.target.value),placeholder:c??"sk-...",disabled:f,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"})}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(47223);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")},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(47223),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))})]})]})}},84276:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(5735);function e(){return(0,d.jsxs)("div",{className:"content-width px-4 md:px-6 py-10 md:py-14 animate-pulse","aria-busy":"true","aria-label":"Loading",children:[(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,d.jsx)("div",{className:"w-1 h-7 rounded-full bg-muted"}),(0,d.jsx)("div",{className:"h-6 w-28 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"h-4 w-64 bg-muted rounded ml-4 mb-6"}),(0,d.jsxs)("div",{className:"w-full max-w-xl flex flex-col sm:flex-row items-stretch sm:items-center gap-2 ml-4",children:[(0,d.jsx)("div",{className:"flex-1 h-12 rounded-xl bg-muted"}),(0,d.jsx)("div",{className:"h-12 w-16 rounded-xl bg-muted shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 mt-4 ml-4",children:[(0,d.jsx)("div",{className:"h-9 w-28 rounded-lg bg-muted"}),(0,d.jsx)("div",{className:"h-9 w-40 rounded-lg bg-muted"})]})]}),(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-4 w-16 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:Array.from({length:6}).map((a,b)=>(0,d.jsxs)("div",{className:"flex items-start gap-3 px-3.5 py-3 rounded-xl border border-border",children:[(0,d.jsx)("div",{className:"w-5 h-5 rounded bg-muted shrink-0 mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,d.jsx)("div",{className:"h-4 w-20 bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-full bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-12 bg-muted rounded"})]})]},b))})]}),(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-4 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-3",children:Array.from({length:3}).map((a,b)=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-3 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5 ml-2 border-l border-border/40 pl-3",children:Array.from({length:2}).map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2",children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded bg-muted shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,d.jsx)("div",{className:"h-4 w-40 bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"h-3 w-12 bg-muted rounded shrink-0"})]},b))})]},b))})]})]})}},84668:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(31417),g=c(21245);let h="mindos_walkthrough_done";function i(a,b){if(a>=g.g.length||b)try{localStorage.setItem(h,"1")}catch{}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 j=(0,f.v)((a,b)=>{let c=g.g.length;return{status:"idle",currentStep:0,totalSteps:c,start:()=>{a({currentStep:0,status:"active"}),i(0,!1)},next:()=>{let d=b().currentStep+1;d>=c?(a({status:"completed"}),i(c,!1)):(a({currentStep:d}),i(d,!1))},back:()=>{let c=b().currentStep;c>0&&(a({currentStep:c-1}),i(c-1,!1))},skip:()=>{a({status:"dismissed"}),i(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||function(){try{return"1"===localStorage.getItem(h)}catch{return!1}}()?()=>{}:(fetch("/api/setup").then(a=>a.json()).then(d=>{let e=d.guideState;if(e){if(e.walkthroughDismissed||"number"==typeof e.walkthroughStep&&e.walkthroughStep>=c){try{localStorage.setItem(h,"1")}catch{}return}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 k=c(47223);function l({stepIndex:a,rect:b,position:c}){let f,g,h=j(),{t:i}=(0,k.Y)(),[l,m]=(0,e.useState)({width:1024,height:768});if(!h)return null;let n=i.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:i.walkthrough.step(a+1,h.totalSteps)})}),(0,d.jsx)("h3",{className:"text-sm font-semibold 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:i.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:i.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?i.walkthrough.done:i.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 m(){let a=j(),[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!1),i=(0,e.useId)(),k=a?g.g[a.currentStep]:null;return((0,e.useCallback)(()=>{if(!k)return;let a=document.querySelector(`[data-walkthrough="${k.anchor}"]`);a?c(a.getBoundingClientRect()):c(null)},[k]),a?.skip,a?.currentStep,a&&k)?f?(0,d.jsx)(n,{}):(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:i,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(#${i})`})]}),b&&(0,d.jsx)(l,{stepIndex:a.currentStep,rect:b,position:k.position}),!b&&(0,d.jsx)("div",{className:"fixed inset-0 z-[101] flex items-center justify-center pointer-events-none",children:(0,d.jsx)("button",{onClick:a.skip,className:"pointer-events-auto px-4 py-2 text-sm rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a.currentStep===a.totalSteps-1?"✓":"→"})})]}):null}function n(){let a=j(),{t:b}=(0,k.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 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 o(){return"active"===j(a=>a.status)?(0,d.jsx)(m,{}):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(91052),q=c(77720),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(43706),H=c(4949),I=c(13706),J=c(60907),K=c(47223),L=c(90314),M=c(2518),N=c(84668);c(33923);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);(0,f.useRef)([]);let 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 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")},onSpacesClick:()=>{let a="files"===c.activePanel;c.setActivePanel(a?null:"files"),a||aA.push("/wiki")},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:"text-foreground text-sm font-brand",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:"text-foreground text-sm font-brand",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:`
179
+ `,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}),J&&(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)(U,{x:R.x,y:R.y,onClose:()=>S(null),menuHeight:140,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{O(a.path),S(null)},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0"})," ",B.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{E(a.path),S(null)},children:[(0,d.jsx)(n.A,{size:14,className:`shrink-0 ${J?"fill-[var(--amber)] text-[var(--amber)]":""}`}),J?B.fileTree.removeFromFavorites:B.fileTree.pinToFavorites]}),!M&&(0,d.jsxs)("button",{className:V,onClick:a=>{S(null),Y(a)},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"})," ",B.fileTree.rename]}),!M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:a=>{S(null),$(a)},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"})," ",B.fileTree.delete]})]})]}),(0,d.jsx)(K.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(),N()):H.oR.error(a.error??"Undo failed")},{label:B.trash?.undo??"Undo"})}l.refresh(),N()}})}})]})}function ab({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=T(),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("."))),p=n?o.filter(a=>"directory"!==a.type||"Inbox"!==a.name):o;return(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:p.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)(aa,{node:a,depth:b,currentPath:l,onNavigate:c},a.path))})}},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,{N:()=>g,Q:()=>f});var d=c(99101);function e(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(""))}async function f(a,b){let c=[],f=0;for(let b of a){if(b.size>0xa00000){f++;continue}try{if(b.name.toLowerCase().endsWith(".pdf")){let a=await b.arrayBuffer();c.push({name:b.name,content:e(a),encoding:"base64"})}else{let a=await b.text();c.push({name:b.name,content:a})}}catch{}}if(0===c.length)return void(f>0?d.oR.error(b.inbox.tooLarge(f),4e3):a.length>0&&d.oR.error(b.inbox.saveFailed,4e3));try{var g;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 e=await a.json(),h=e.saved?.length??0,i=e.skipped?.length??0;g=f,h>0&&g>0&&0===i?d.oR.success(b.inbox.savedWithOversized(h,g),4e3):h>0&&i+g>0?d.oR.success(b.inbox.savedWithSkipped(h,i+g),4e3):h>0?d.oR.success(b.inbox.savedToast(h),3e3):(g>0&&d.oR.error(b.inbox.tooLarge(g),4e3),i>0&&d.oR.error(b.inbox.savedWithSkipped(0,i),4e3),0===g&&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)}}async function g(a,b,c){let f=[],g=0,h=new Set(["pdf","png","jpg","jpeg","gif","webp","bmp","ico","mp3","wav","m4a","ogg","flac","aac","mp4","webm","mov","mkv"]);for(let b of a){if(b.size>0xa00000){g++;continue}try{let a=(b.name.split(".").pop()??"").toLowerCase();if(h.has(a)){let a=await b.arrayBuffer();f.push({name:b.name,content:e(a),encoding:"base64"})}else{let a=await b.text();f.push({name:b.name,content:a})}}catch{}}if(0===f.length)return void(g>0?d.oR.error(c.inbox.tooLarge(g),4e3):a.length>0&&d.oR.error(c.inbox.saveFailed,4e3));let i=b.split("/").pop()||b;try{let a=await fetch("/api/file/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:f,targetSpace:b,organize:!1,conflict:"rename"})});if(!a.ok){let b=await a.json().catch(()=>({}));console.error("[TreeDrop] Save failed:",b.error),d.oR.error(c.inbox.saveFailed,4e3);return}let e=await a.json(),h=e.created?.length??0,j=e.skipped?.length??0;h>0&&j+g>0?d.oR.success(c.inbox.savedWithSkipped(h,j+g),4e3):h>0?d.oR.success(c.inbox.savedToDir(h,i),3e3):(g>0&&d.oR.error(c.inbox.tooLarge(g),4e3),j>0&&d.oR.error(c.inbox.savedWithSkipped(0,j),4e3)),window.dispatchEvent(new Event("mindos:files-changed"))}catch(a){console.error("[TreeDrop] Network error:",a),d.oR.error(c.inbox.saveFailed,4e3)}}},63956:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>f});var d=c(48249),e=c(67484);function f({filePath:a}){let b=`/api/file/raw?path=${encodeURIComponent(a)}`,c=a.split("/").pop()??"video",f=c.split(".").pop()?.toLowerCase()??"",[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(0),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),o=(0,e.useRef)(null),p=(0,e.useCallback)(()=>{let a=o.current;a&&n({w:a.videoWidth,h:a.videoHeight})},[]),q=(0,e.useCallback)(()=>{h(!1),j(a=>a+1)},[]);return(0,d.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[m&&(0,d.jsxs)("span",{children:[m.w," x ",m.h]}),null!==k&&(0,d.jsx)("span",{children:k<1024?`${k} B`:k<1048576?`${(k/1024).toFixed(1)} KB`:`${(k/1048576).toFixed(1)} MB`}),(0,d.jsx)("span",{className:"uppercase opacity-60",children:f})]}),(0,d.jsx)("div",{className:"flex-1 min-h-[50vh] flex items-center justify-center bg-black rounded-b-lg overflow-hidden",children:g?(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-neutral-400",children:"Failed to load video"}),(0,d.jsx)("button",{onClick:q,className:"text-xs px-3 py-1.5 rounded-md bg-neutral-800 hover:bg-neutral-700 text-neutral-200 transition-colors",children:"Retry"})]}):(0,d.jsx)("video",{ref:o,controls:!0,preload:"metadata",className:"max-w-full max-h-[70vh]",onLoadedMetadata:p,onError:()=>h(!0),children:(0,d.jsx)("source",{src:b})},i)})]})}},64229:(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,59238)),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,92206)),Promise.resolve().then(c.bind(c,29406)),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,14986)),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))},65141:(a,b,c)=>{"use strict";c.d(b,{b:()=>g});var d=c(67484),e=c(23931),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:()=>F});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(47223),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(41739),y=c(33827),z=c(74190),A=c(4452),B=c(93574),C=c(33191),D=c(17009),E=a([A]);function F({visible:a,currentFile:b,initialMessage:c,initialAcpAgent:d,onFirstMessage:E,variant:F,onClose:G,maximized:H,onMaximize:I,askMode:J,onModeSwitch:K}){let L="panel"===F,M="home"===F,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,D.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,B.t)({currentFile:b,chatMode:ai,providerOverride:ak,onFirstMessage:E,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),az.firstMessageFired.current=!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.stopPropagation(),a.dataTransfer.dropEffect="copy",_(!0))},[]),aR=(0,f.useCallback)(()=>_(!1),[]),aS=(0,f.useCallback)(async a=>{a.preventDefault(),a.stopPropagation(),_(!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}let c=a.dataTransfer.files;if(c.length>0){Array.from(c).some(a=>a.type.startsWith("image/"))&&await au.current.handleDrop(a);let b=Array.from(c).filter(a=>!a.type.startsWith("image/"));if(b.length>0){let a=new DataTransfer;b.forEach(b=>a.items.add(b)),await ap.current.pickFiles(a.files)}}},[]),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,copyMessage:P.ask.copyMessage}),[P,aC]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(x.A,{isPanel:L||M,showHistory:Y,onToggleHistory:aV,onReset:aP,isLoading:aA,maximized:H,onMaximize:I,askMode:M?void 0:J,onModeSwitch:M?void 0:K,onClose:M?void 0:G,sessions:am.sessions,activeSessionId:am.activeSessionId,onLoadSession:aU,onDeleteSession:am.deleteSession,onRenameSession:am.renameSession,onTogglePinSession:am.togglePinSession}),Y&&(0,e.jsx)(w.A,{sessions:am.sessions,activeSessionId:am.activeSessionId,onLoad:aU,onDelete:am.deleteSession,onRename:am.renameSession,onTogglePin:am.togglePinSession,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"}}),!M&&(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}),M&&am.messages.length>0&&(0,e.jsx)(t.A,{messages:am.messages,isLoading:aA,loadingPhase:aB,emptyPrompt:P.ask.emptyPrompt,emptyHint:P.ask.emptyHint,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.5 pt-1",children:(0,e.jsxs)("div",{className:(0,C.cn)("rounded-xl bg-muted/40 transition-all focus-within:bg-muted/60",$&&"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,C.cn)("px-3 pt-2.5 pb-1",L?"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)(y.A,{path:a,variant:"kb",onRemove:()=>W(b=>b.filter(b=>b!==a))},a)),ao.localAttachments.map((a,b)=>(0,e.jsx)(y.A,{path:a.name,variant:"upload",status:a.status,error:a.error,truncatedInfo:a.truncatedInfo,onRemove:()=>ao.removeAttachment(b)},`up-${a.name}-${b}`)),aq.images.map((a,b)=>(0,e.jsx)(y.A,{path:a.fileName||`Image ${b+1}`,variant:"image",imageData:a.data,imageMime:a.mimeType,onRemove:()=>aq.removeImage(b)},`img-${b}`)),ac&&(0,e.jsx)(y.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.5 px-3 py-2",children:[(0,e.jsxs)("div",{className:"relative shrink-0",children:[(0,e.jsx)("button",{type:"button",onClick:()=>ab(a=>!a),className:"p-2 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.5 py-1 rounded-xl border border-border/60 bg-card shadow-lg z-50 min-w-[150px] animate-in fade-in-0 slide-in-from-bottom-2 duration-150",children:[(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",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.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",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-2 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground/50 outline-none focus-visible:ring-0"}),aA?(0,e.jsx)("button",{type:"button",onClick:aF,className:"p-2 rounded-xl transition-colors shrink-0 text-foreground bg-muted hover:bg-muted/80",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-2 rounded-xl disabled:opacity-20 disabled:scale-95 disabled:cursor-not-allowed transition-all duration-150 shrink-0 bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/15 hover:shadow-md hover:shadow-[var(--amber)]/20 active:scale-95",children:(0,e.jsx)(l.A,{size:14})})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 pb-2 pt-1.5 border-t border-border/10",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(n.Ay,{mode:ai,onChange:aj,disabled:aA}),Q&&at.installedAgents.length>0&&(0,e.jsx)(z.A,{selectedAgent:af,onSelect:ag,installedAgents:at.installedAgents,loading:at.loading}),Q&&(0,e.jsx)(A.Ay,{value:ak,onChange:al,disabled:aA})]}),(0,e.jsxs)("span",{className:"hidden md:inline text-2xs text-muted-foreground/40 select-none",children:[(0,e.jsx)("kbd",{className:"font-mono",children:"Enter"})," ",P.ask.send," \xb7 ",(0,e.jsx)("kbd",{className:"font-mono",children:"Shift+Enter"})," ",P.ask.newlineHint]})]})]})})]})}A=(E.then?(await E)():E)[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")},69139:(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(47223),l=c(33191),m=c(99829);let n=(0,m.createServerReference)("70e1e3535e4aaa837f0f6fbf5b149df3ee0cf1fd73",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:`
180
+ @keyframes dotBounce {
181
+ 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
182
+ 30% { opacity: 1; transform: translateY(-2px); }
183
+ }
184
+ `})]})}},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,w]=(0,d.useState)("upload"),x=(0,d.useRef)(0),[y,z]=(0,d.useState)(0),A=(0,d.useCallback)(async(a,c,d="upload")=>{b("organizing"),e([]),g(null),i({stage:"connecting"}),l(""),n(null),p(0),u(a.map(a=>a.name)),w(d),x.current=Date.now(),z(0),s.current=new Map,r.current=Date.now();let f=new AbortController;q.current=f;let h=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:h,maxSteps:15,mode:"organize"}),signal:f.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 d=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)},f.signal);e(d.changes),l(d.summary),p(d.toolCallCount),g(null),z(Date.now()-x.current),b("done")}catch(a){"AbortError"===a.name?b("idle"):(n(a.message),b("error"))}finally{q.current=null}},[]),B=(0,d.useCallback)(()=>{q.current?.abort()},[]),C=(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]),D=(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]),E=(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]),F=c.some(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&s.current.has(a.path))),G=(0,d.useCallback)(()=>{b("idle"),e([]),g(null),i(null),l(""),n(null),p(0),u([]),w("upload"),z(0),x.current=0,s.current=new Map,r.current=0},[]);return{phase:a,changes:c,currentTool:f,stageHint:h,summary:k,error:m,toolCallCount:o,sourceFileNames:t,source:v,durationMs:y,snapshots:s,start:A,abort:B,undoOne:C,undoAll:D,canUndo:E,hasAnyUndoable:F,reset:G}}},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)}
185
+ `),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(47223);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-medium 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(47223);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:`
186
+ inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
187
+ text-2xs font-medium transition-colors
188
+ border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
189
+ ${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"}
190
+ `,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:()=>_});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(801),m=c(10316),n=c(11732),o=c(90473),p=c(8455),q=c(75157),r=c(96348),s=c(92023),t=c(36815),u=c(69593),v=c(39868),w=c(7309),x=c(35654),y=c(12625),z=c(50567),A=c(80600),B=c(93017),C=c(59347),D=c(62688),E=c(11035),F=c(96286),G=c(13576),H=c(83654),I=c(44218),J=c(19794),K=c(31675),L=c(49681),M=c(2797);let N=new Set(["delete_file","move_file","rename_file","write_file"]),O=new Set(["write_file","create_file","update_section","insert_after_heading","edit_lines","append_to_file"]),P={search:m.A,list_files:w.A,read_file:x.A,write_file:y.A,create_file:z.A,append_to_file:A.A,insert_after_heading:B.A,update_section:y.A,delete_file:C.A,rename_file:A.A,move_file:D.A,get_backlinks:E.A,get_history:F.A,get_file_at_version:F.A,get_recent:G.A,append_csv:H.A},Q="--- changes ---";function R({part:a}){let b=O.has(a.toolName),c="done"===a.state,[f,g]=(0,e.useState)(null),h=f??(b&&c),k=P[a.toolName]??j.A,l=N.has(a.toolName),m=(0,e.useMemo)(()=>(function(a){if(!a)return{header:"",stats:"",diffLines:[]};let b=a.indexOf(Q);if(-1===b)return{header:a,stats:"",diffLines:[]};let c=a.slice(0,b).trim(),d=a.slice(b+Q.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.5 rounded-lg border text-xs font-mono ${l?"border-[var(--amber)]/30 bg-background/60":"border-border/40 bg-background/50"}`,children:[(0,d.jsxs)("button",{type:"button",onClick:()=>g(a=>null===a?!h:!a),"aria-expanded":h,className:"w-full flex items-center gap-1.5 px-2.5 py-2 text-left hover:bg-muted/30 transition-colors rounded-lg",children:[h?(0,d.jsx)(I.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(J.A,{size:12,className:"shrink-0 text-muted-foreground"}),l&&(0,d.jsx)(K.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)(L.A,{size:12,className:"text-success"}):(0,d.jsx)(M.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.5 pb-2.5 pt-1.5 space-y-1.5",children:["running"===a.state&&(0,d.jsxs)("div",{className:"text-muted-foreground/60 text-2xs flex items-center gap-1.5",children:[(0,d.jsx)(i.A,{size:10,className:"animate-spin"})," Running..."]}),(0,d.jsxs)("div",{className:"text-muted-foreground leading-relaxed",children:[(0,d.jsx)("span",{className:"font-semibold text-foreground/70",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 leading-relaxed",children:[(0,d.jsx)("span",{className:"font-semibold text-foreground/70",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 S=c(46218),T=c(47223);function U({text:a,isStreaming:b}){let[c,f]=(0,e.useState)(!1),{t:g}=(0,T.Y)();return a||b?(0,d.jsxs)("div",{className:"my-1.5 rounded-lg border border-border/30 bg-muted/15 text-xs",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a=>!a),"aria-expanded":c,className:"w-full flex items-center gap-1.5 px-2.5 py-2 text-left hover:bg-muted/30 transition-colors rounded-lg",children:[c?(0,d.jsx)(I.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(J.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsx)(S.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/50 truncate flex-1 ml-1",children:[a.slice(0,80),a.length>80?"...":""]})]}),c&&(0,d.jsx)("div",{className:"px-2.5 pb-2.5 pt-1 border-t border-border/20",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-full"})]})})]}):null}let V=/^Use the skill ([^:]+):\s*/;function W({text:a,label:b}){let[c,h]=(0,e.useState)(!1),i=(0,e.useCallback)(()=>{(0,v.l)(a).then(a=>{a&&(h(!0),setTimeout(()=>h(!1),2e3))})},[a]);return(0,d.jsx)("button",{type:"button",onClick:i,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-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",title:b??"Copy",children:c?(0,d.jsx)(f.A,{size:11,className:"text-success"}):(0,d.jsx)(g.A,{size:11})})}function X({content:a,skillName:b,images:c}){let e=b??a.match(V)?.[1],f=a.match(V),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-white/20 text-white/90 mr-1 align-middle",children:[(0,d.jsx)(h.A,{size:10,className:"shrink-0"}),e]}),e?g:a]})}function Y({content:a,isStreaming:b}){let c=(0,u.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-muted/80 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:before:content-none prose-code:after:content-none prose-code:font-mono prose-pre:bg-muted/60 prose-pre:text-foreground prose-pre:text-xs prose-pre:rounded-lg prose-blockquote:border-l-[var(--amber)] prose-blockquote:text-muted-foreground prose-blockquote:not-italic 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.5 prose-td:py-1 ",children:[(0,d.jsx)(s.oz,{remarkPlugins:[t.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-full"})]}):null}function Z({message:a,isStreaming:b}){let c=a.parts;if(!c||0===c.length)return a.content?(0,d.jsx)(Y,{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)(U,{text:a.text,isStreaming:f},`reasoning-${e}`)}if("text"===a.type){let f=b&&e===c.length-1;return a.text?(0,d.jsx)(Y,{content:a.text,isStreaming:f},e):null}return"tool-call"===a.type?(0,d.jsx)(R,{part:a},a.toolCallId):null}),f&&(0,d.jsxs)("div",{className:"flex items-center gap-2 py-1.5 mt-1.5",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 $({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-2 pt-1.5 border-t border-border/15 text-xs text-muted-foreground/60",children:[(0,d.jsx)(j.A,{size:10}),(0,d.jsxs)("span",{className:"font-medium",children:["Step ",b.length,e?` — ${e}`:""]})]})}let _=(0,e.memo)(function({messages:a,isLoading:b,loadingPhase:c,emptyPrompt:f,emptyHint:g,suggestions:h,onSuggestionClick:j,labels:s}){let t=(0,e.useRef)(null),v=(0,e.useRef)(null),[w,x]=(0,e.useState)(!1),y=(0,e.useCallback)(()=>{let a=v.current;a&&a.scrollTo({top:a.scrollHeight,behavior:"smooth"})},[]);return(0,d.jsxs)("div",{ref:v,role:"log","aria-live":"polite",className:"relative flex-1 overflow-y-auto overflow-x-hidden px-4 py-5 space-y-5 min-h-0",children:[0===a.length&&(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1 min-h-[260px] px-6 pt-10 pb-4",children:[(0,d.jsxs)("div",{className:"relative w-12 h-12 rounded-2xl bg-[var(--amber)]/10 flex items-center justify-center mb-6",children:[(0,d.jsx)("div",{className:"absolute inset-0 rounded-2xl bg-[var(--amber)]/5 scale-[1.4]"}),(0,d.jsx)(k.A,{size:22,className:"text-[var(--amber)] relative z-10"})]}),(0,d.jsx)("p",{className:"text-center text-[15px] font-semibold text-foreground tracking-tight mb-2",children:f}),g&&(0,d.jsx)("p",{className:"text-center text-xs text-muted-foreground/80 mb-10 tracking-wide",children:g}),(0,d.jsx)("div",{className:"flex flex-col gap-2.5 max-w-[280px] w-full",children:h.map((a,b)=>{let c=[l.A,m.A,n.A,o.A],e=c[b%c.length];return(0,d.jsxs)("button",{type:"button",onClick:()=>j(a.prompt),className:"group/sug flex items-center gap-3 text-left text-[13px] px-3.5 py-3 rounded-xl border border-border/40 bg-transparent text-muted-foreground hover:text-foreground hover:border-[var(--amber)]/30 hover:bg-[var(--amber)]/5 transition-all leading-snug","aria-label":a.prompt,children:[(0,d.jsx)("span",{className:"shrink-0 w-8 h-8 rounded-lg bg-muted/60 flex items-center justify-center group-hover/sug:bg-[var(--amber)]/10 transition-colors",children:(0,d.jsx)(e,{size:15,className:"text-muted-foreground/70 group-hover/sug:text-[var(--amber)] transition-colors"})}),(0,d.jsx)("span",{className:"flex-1",children:a.label})]},b)})})]}),a.map((e,f)=>(0,d.jsxs)("div",{className:`flex gap-3 animate-[fadeSlideUp_0.22s_ease_both] ${"user"===e.role?"justify-end":"justify-start"}`,children:["assistant"===e.role&&(0,d.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 mt-0.5 bg-[var(--amber)]/8",children:(0,d.jsx)(k.A,{size:13,className:"text-[var(--amber)]"})}),"user"===e.role?(0,d.jsx)("div",{className:"max-w-[85%] px-3.5 py-2.5 rounded-2xl rounded-br-lg text-sm leading-relaxed whitespace-pre-wrap bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/10",children:(0,d.jsx)(X,{content:e.content,skillName:e.skillName,images:e.images})}):e.content.startsWith("__error__")?(0,d.jsx)("div",{className:"max-w-[85%] px-3.5 py-3 rounded-2xl rounded-bl-md border border-error/30 bg-error/10 text-sm shadow-sm",children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5 text-error",children:[(0,d.jsx)(p.A,{size:15,className:"shrink-0 mt-0.5"}),(0,d.jsx)("span",{className:"leading-relaxed font-medium",children:e.content.slice(9)})]})}):(0,d.jsx)("div",{className:"group relative max-w-[85%] px-3.5 py-2.5 rounded-2xl rounded-bl-lg bg-card border border-border/30 shadow-sm text-foreground text-sm",children:e.parts&&e.parts.length>0||(0,u.Oo)(e.content)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Z,{message:e,isStreaming:b&&f===a.length-1}),b&&f===a.length-1&&(0,d.jsx)($,{parts:e.parts}),!(b&&f===a.length-1)&&(0,u.Oo)(e.content)&&(0,d.jsx)(W,{text:(0,u.Oo)(e.content),label:s.copyMessage})]}):b&&f===a.length-1?(0,d.jsxs)("div",{className:"flex items-center gap-2.5 py-1",children:["reconnecting"===c?(0,d.jsx)(q.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",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:["reconnecting"===c?s.reconnecting??"Reconnecting...":"connecting"===c?s.connecting:"thinking"===c?s.thinking:s.generating,(0,d.jsxs)("span",{className:"inline-flex gap-0.5",children:[(0,d.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:0ms]"}),(0,d.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:150ms]"}),(0,d.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:300ms]"})]})]})})]}):null})]},f)),(0,d.jsx)("div",{ref:t}),w&&a.length>0&&(0,d.jsx)("button",{type:"button",onClick:y,className:"sticky bottom-2 left-1/2 -translate-x-1/2 z-10 p-2 rounded-full border border-border/60 bg-card shadow-md text-muted-foreground hover:text-foreground hover:bg-muted transition-all hover:shadow-lg",title:"Scroll to bottom",children:(0,d.jsx)(r.A,{size:14})})]})})},75539:(a,b,c)=>{"use strict";c.d(b,{A:()=>k});var d=c(48249),e=c(67484),f=c(93017),g=c(3129),h=c(12625),i=c(59347),j=c(54461);function k({sessions:a,activeSessionId:b,onLoad:c,onDelete:k,onRename:l,onTogglePin:m,onClearAll:n,labels:o}){let[p,q]=(0,e.useState)(!1),r=(0,e.useRef)(void 0),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(""),w=(0,e.useRef)(null),x=(0,e.useCallback)(a=>{t(a.id),v((0,j.d)(a))},[]),y=(0,e.useCallback)(()=>{s&&(l(s,u),t(null))},[s,u,l]),z=(0,e.useCallback)(()=>{t(null)},[]);return(0,d.jsxs)("div",{className:"border-b border-border/40 px-4 py-3 max-h-[220px] overflow-y-auto",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:o.title}),a.length>1&&(0,d.jsx)("button",{type:"button",onClick:()=>{if(!p){q(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>q(!1),3e3);return}r.current&&clearTimeout(r.current),n(),q(!1)},className:`text-2xs px-2 py-0.5 rounded-md transition-colors ${p?"bg-error/10 text-error font-medium":"text-muted-foreground/60 hover:text-error hover:bg-muted"}`,children:p?o.confirmClear:o.clearAll})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[0===a.length&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground/50 py-2 text-center",children:o.noSessions}),a.map(a=>{let e=b===a.id;return(0,d.jsxs)("div",{className:"group flex items-center gap-0.5",children:[a.pinned&&(0,d.jsx)(f.A,{size:10,className:"shrink-0 text-[var(--amber)]/50 -rotate-45 ml-1"}),(0,d.jsxs)("button",{type:"button",onClick:()=>c(a.id),onDoubleClick:()=>x(a),className:`flex-1 text-left px-2.5 py-2 rounded-lg text-xs transition-colors min-w-0 ${e?"bg-[var(--amber)]/8 text-foreground border border-[var(--amber)]/15":"text-muted-foreground hover:bg-muted hover:text-foreground border border-transparent"}`,children:[s===a.id?(0,d.jsx)("input",{ref:w,type:"text",value:u,onChange:a=>v(a.target.value),onBlur:y,onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),y()),"Escape"===a.key&&(a.preventDefault(),z())},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 font-medium",children:(0,j.d)(a)}),s!==a.id&&(0,d.jsx)("div",{className:"text-2xs text-muted-foreground/50 mt-0.5",children:function(a){let b=Math.floor((Date.now()-a.getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return d<7?`${d}d ago`:a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(new Date(a.updatedAt))})]}),(0,d.jsx)("button",{type:"button",onClick:()=>m(a.id),className:`p-1.5 rounded-lg transition-opacity opacity-0 group-hover:opacity-100 ${a.pinned?"text-[var(--amber)] hover:text-muted-foreground":"text-muted-foreground hover:text-[var(--amber)]"}`,title:a.pinned?"Unpin":"Pin",children:a.pinned?(0,d.jsx)(g.A,{size:11}):(0,d.jsx)(f.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:()=>x(a),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:o.rename,children:(0,d.jsx)(h.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:()=>k(a.id),className:"p-1.5 rounded-lg text-muted-foreground hover:text-error hover:bg-error/5 opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete session",children:(0,d.jsx)(i.A,{size:11})})]},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)},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:f,labels:g}){let h="***set***"===a,[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(""),m=(0,e.useRef)(null);(0,e.useRef)(a);let n=(0,e.useCallback)(()=>{k.trim()&&b(k),j(!1),l("")},[k,b]),o=(0,e.useCallback)(()=>{j(!1),l("")},[]),p=g?.change??"Change",q=g?.cancel??"Cancel";return h&&!i?(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("div",{className:"flex-1 px-3 py-2 text-sm bg-muted/50 border border-border rounded-lg text-muted-foreground select-none tracking-widest",children:"••••••••••••"}),(0,d.jsx)("button",{type:"button",onClick:()=>{l(""),j(!0),requestAnimationFrame(()=>m.current?.focus())},disabled:f,className:"shrink-0 px-3 py-2 text-xs font-medium rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50",children:p})]}):i?(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{ref:m,type:"password",value:k,onChange:a=>l(a.target.value),onKeyDown:a=>{"Enter"===a.key&&n()},onBlur:n,placeholder:c??"sk-...",disabled:f,className:"flex-1 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"}),(0,d.jsx)("button",{type:"button",onMouseDown:a=>a.preventDefault(),onClick:o,className:"shrink-0 px-3 py-2 text-xs font-medium rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:q})]}):(0,d.jsx)("input",{type:"password",value:a,onChange:a=>b(a.target.value),placeholder:c??"sk-...",disabled:f,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"})}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(47223);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")},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(47223),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))})]})]})}},84276:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(5735);function e(){return(0,d.jsxs)("div",{className:"content-width px-4 md:px-6 py-10 md:py-14 animate-pulse","aria-busy":"true","aria-label":"Loading",children:[(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,d.jsx)("div",{className:"w-1 h-7 rounded-full bg-muted"}),(0,d.jsx)("div",{className:"h-6 w-28 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"h-4 w-64 bg-muted rounded ml-4 mb-6"}),(0,d.jsxs)("div",{className:"w-full max-w-xl flex flex-col sm:flex-row items-stretch sm:items-center gap-2 ml-4",children:[(0,d.jsx)("div",{className:"flex-1 h-12 rounded-xl bg-muted"}),(0,d.jsx)("div",{className:"h-12 w-16 rounded-xl bg-muted shrink-0"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 mt-4 ml-4",children:[(0,d.jsx)("div",{className:"h-9 w-28 rounded-lg bg-muted"}),(0,d.jsx)("div",{className:"h-9 w-40 rounded-lg bg-muted"})]})]}),(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-4 w-16 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:Array.from({length:6}).map((a,b)=>(0,d.jsxs)("div",{className:"flex items-start gap-3 px-3.5 py-3 rounded-xl border border-border",children:[(0,d.jsx)("div",{className:"w-5 h-5 rounded bg-muted shrink-0 mt-0.5"}),(0,d.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,d.jsx)("div",{className:"h-4 w-20 bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-full bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-12 bg-muted rounded"})]})]},b))})]}),(0,d.jsxs)("div",{className:"mb-10",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-4 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-3",children:Array.from({length:3}).map((a,b)=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,d.jsx)("div",{className:"w-4 h-4 rounded bg-muted"}),(0,d.jsx)("div",{className:"h-3 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-0.5 ml-2 border-l border-border/40 pl-3",children:Array.from({length:2}).map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2",children:[(0,d.jsx)("div",{className:"w-3 h-3 rounded bg-muted shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,d.jsx)("div",{className:"h-4 w-40 bg-muted rounded"}),(0,d.jsx)("div",{className:"h-3 w-24 bg-muted rounded"})]}),(0,d.jsx)("div",{className:"h-3 w-12 bg-muted rounded shrink-0"})]},b))})]},b))})]})]})}},84416:(a,b,c)=>{"use strict";c.d(b,{i:()=>e});var d=c(99829);let e=(0,d.createServerReference)("4034f606760908535f5f7cd820a62714756441642c",d.callServer,void 0,d.findSourceMapURL,"deleteFileAction")},84668:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(48249),e=c(67484),f=c(31417),g=c(21245);let h="mindos_walkthrough_done";function i(a,b){if(a>=g.g.length||b)try{localStorage.setItem(h,"1")}catch{}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 j=(0,f.v)((a,b)=>{let c=g.g.length;return{status:"idle",currentStep:0,totalSteps:c,start:()=>{a({currentStep:0,status:"active"}),i(0,!1)},next:()=>{let d=b().currentStep+1;d>=c?(a({status:"completed"}),i(c,!1)):(a({currentStep:d}),i(d,!1))},back:()=>{let c=b().currentStep;c>0&&(a({currentStep:c-1}),i(c-1,!1))},skip:()=>{a({status:"dismissed"}),i(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||function(){try{return"1"===localStorage.getItem(h)}catch{return!1}}()?()=>{}:(fetch("/api/setup").then(a=>a.json()).then(d=>{let e=d.guideState;if(e){if(e.walkthroughDismissed||"number"==typeof e.walkthroughStep&&e.walkthroughStep>=c){try{localStorage.setItem(h,"1")}catch{}return}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 k=c(47223);function l({stepIndex:a,rect:b,position:c}){let f,g,h=j(),{t:i}=(0,k.Y)(),[l,m]=(0,e.useState)({width:1024,height:768});if(!h)return null;let n=i.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 duration-200 ${"right"===c?"slide-in-from-left-2":"slide-in-from-top-2"}`,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:i.walkthrough.step(a+1,h.totalSteps)})}),(0,d.jsx)("h3",{className:"text-sm font-semibold 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:i.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:i.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?i.walkthrough.done:i.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 m(){let a=j(),[b,c]=(0,e.useState)(null),[f,h]=(0,e.useState)(!1),i=(0,e.useId)(),k=a?g.g[a.currentStep]:null;return((0,e.useCallback)(()=>{if(!k)return;let a=document.querySelector(`[data-walkthrough="${k.anchor}"]`);a?c(a.getBoundingClientRect()):c(null)},[k]),a?.skip,a?.currentStep,a&&k)?f?(0,d.jsx)(n,{}):(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:i,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(#${i})`})]}),b&&(0,d.jsx)(l,{stepIndex:a.currentStep,rect:b,position:k.position}),!b&&(0,d.jsx)("div",{className:"fixed inset-0 z-[101] flex items-center justify-center pointer-events-none",children:(0,d.jsx)("button",{onClick:a.skip,className:"pointer-events-auto px-4 py-2 text-sm rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:a.currentStep===a.totalSteps-1?"✓":"→"})})]}):null}function n(){let a=j(),{t:b}=(0,k.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 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 o(){return"active"===j(a=>a.status)?(0,d.jsx)(m,{}):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(23931),q=c(61572),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(69139),H=c(4949),I=c(34279),J=c(60907),K=c(47223),L=c(90314),M=c(2518),N=c(84668);c(33923);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);(0,f.useRef)([]);let 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 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")},onSpacesClick:()=>{let a="files"===c.activePanel;c.setActivePanel(a?null:"files"),a||aA.push("/wiki")},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:"text-foreground text-sm font-brand",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:"text-foreground text-sm font-brand",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
191
  @media (min-width: 768px) {
187
192
  :root {
188
193
  --right-panel-width: ${d.askMaximized?`calc(100vw - ${c.panelOpen?c.railWidth+c.effectivePanelWidth:c.railWidth}px)`:`${d.askPanelOpen?d.askPanelWidth:0}px`};
@@ -194,12 +199,7 @@ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if
194
199
  padding-top: 0;
195
200
  }
196
201
  }
197
- `})]})}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",role:"status","aria-live":"polite","aria-atomic":"false",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(47223),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]})}},91052:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>C,Ld:()=>A,iP:()=>z,Ay:()=>D});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(28330),q=c(59347),r=c(77720),s=c(60907),t=c(4140),u=c(2548),v=c(47223),w=c(99829);w.callServer,w.findSourceMapURL;var x=c(1108);let y=()=>{},z=x.qQ,A=x.Dp.MIN,B=x.Dp.MAX_RATIO,C=x.Dp.MAX_ABS;function D({activePanel:a,fileTree:b,onNavigate:c,onOpenSyncSettings:w,railWidth:x=48,panelWidth:D,onWidthChange:E,onWidthCommit:F,maximized:G=!1,onMaximize:H,onImport:I,children:J}){let K=a?z[a]:280,L=G?void 0:D??K,{t:M}=(0,v.Y)(),N=(0,f.useRouter)(),[O,P]=(0,e.useState)(null),Q=(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]),[R,S]=(0,e.useState)(!1),T=(0,e.useRef)(null),U=(0,e.useRef)(null),[V,W]=(0,e.useState)(!1),X=(0,e.useRef)(null),Y=(0,e.useRef)(null),Z=(0,r.gL)(),[$,_]=(0,e.useState)(0),[aa,ab]=(0,e.useState)(0),[ac,ad]=(0,e.useState)(!1),ae=(0,e.useCallback)(()=>{if(!ac){ad(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[ac]),af=(0,u._)({width:D??K,minWidth:A,maxWidth:C,maxWidthRatio:B,direction:"right",disabled:G,onResize:E??y,onResizeEnd:F??y});return(0,d.jsxs)("aside",{className:`
198
- hidden md:flex fixed top-0 h-screen z-30
199
- flex-col bg-card border-r border-border
200
- transition-[transform,left,width] duration-200 ease-out
201
- ${null!==a?"translate-x-0":"-translate-x-full pointer-events-none"}
202
- `,style:{width:G?`calc(100vw - ${x}px)`:`${L}px`,left:`${x}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)(t.A,{title:M.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:T,type:"button",onClick:()=>{W(!1),S(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":M.sidebar.new,title:M.sidebar.new,children:(0,d.jsx)(g.A,{size:13})}),R&&(0,d.jsxs)("div",{ref:U,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:()=>{S(!1),N.push("/view/Untitled.md")},children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0"}),M.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:()=>{S(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,d.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),M.sidebar.newSpace]})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>I?.(),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":M.sidebar.importFile,title:M.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:()=>P(a=>Math.max(-1,(a??Q)-1)),onDoubleClick:()=>{P(-1),ae()},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":M.sidebar.collapseLevel,title:ac?M.sidebar.collapseLevel:M.sidebar.collapseLevelHint??M.sidebar.collapseLevel,children:(0,d.jsx)(k.A,{size:13})}),(0,d.jsx)("button",{onClick:()=>P(a=>{let b=(a??0)+1;return b>Q?null:b}),onDoubleClick:()=>{P(null),ae()},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":M.sidebar.expandLevel,title:ac?M.sidebar.expandLevel:M.sidebar.expandLevelHint??M.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:X,type:"button",onClick:()=>{S(!1),W(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":M.sidebar.more,title:M.sidebar.more,children:(0,d.jsx)(m.A,{size:13})}),V&&(0,d.jsxs)("div",{ref:Y,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,r.Fo)(!Z)},children:[Z?(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:M.sidebar.showHiddenFiles}),Z&&(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:()=>{W(!1),N.push("/view/Inbox/")},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:M.sidebar.capture}),aa>0&&(0,d.jsx)("span",{className:"text-xs font-medium text-[var(--amber)] tabular-nums",children:aa})]}),(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:()=>{W(!1),N.push("/trash")},children:[(0,d.jsx)(q.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:M.trash.title}),$>0&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:$})]})]})]})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,d.jsx)(r.Ay,{nodes:b,onNavigate:c,maxOpenDepth:O,onImport:I})}),(0,d.jsx)(s.Ay,{collapsed:!1,onOpenSyncSettings:w})]}),J,!G&&E&&(0,d.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:af,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"})})]})}},92206:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ImageRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ImageRenderer() from the server but ImageRenderer 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/image/ImageRenderer.tsx","ImageRenderer")},92395:(a,b,c)=>{"use strict";c.d(b,{f:()=>e});var d=c(99829);let e=(0,d.createServerReference)("60caab788d0a97f69cb3a7a7f69dd321d69d6025d1",d.callServer,void 0,d.findSourceMapURL,"renameFileAction")},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 覆盖:
202
+ `})]})}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",role:"status","aria-live":"polite","aria-atomic":"false",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(47223),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]})}},91667:(a,b,c)=>{"use strict";c.d(b,{M:()=>B});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(61572),z=c(99829);z.callServer,z.findSourceMapURL;let A=(0,z.createServerReference)("005535884e94350c62e28126613d44d4558d09cba0",z.callServer,void 0,z.findSourceMapURL,"cleanupExamplesAction");function B({data:a,setData:b,t:c}){let p=a.envOverrides??{},q=c.settings.knowledge,r=c.settings.appearance,[x,z]=(0,e.useState)(()=>!1),[B,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)(C,{label:r.labsEcho??"Echo",description:r.labsEchoDesc??"Reflective journaling powered by your notes.",checked:x,onChange:a=>{z(a),localStorage.setItem("mindos:labs-echo",a?"1":"0"),window.dispatchEvent(new Event("mindos:labs-changed"))}}),(0,d.jsx)(C,{label:r.labsWorkflows??"Flows",description:r.labsWorkflowsDesc??"Visual workflow automation for agents.",checked:B,onChange:a=>{E(a),localStorage.setItem("mindos:labs-workflows",a?"1":"0"),window.dispatchEvent(new Event("mindos:labs-changed"))}})]})}),(0,d.jsx)(D,{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 A();K(!1),a.success&&(M(a.deleted),I(0))},onCancel:()=>ac(!1)})]})}function C({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 D({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"})]})}},92206:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ImageRenderer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ImageRenderer() from the server but ImageRenderer 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/image/ImageRenderer.tsx","ImageRenderer")},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.filter(a=>"loading"!==a.status).map(a=>({name:a.name,content:a.content.length>8e4?a.content.slice(0,8e4)+"\n\n[...truncated to first ~80000 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
203
  1. 「${b}/README.md」— 写入空间用途、结构概览、使用指南
204
204
  2. 「${b}/INSTRUCTION.md」— 写入 AI Agent 在此空间中的行为规则和操作约定
205
205
 
@@ -207,11 +207,11 @@ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if
207
207
  1. "${b}/README.md" — write purpose, structure overview, usage guidelines
208
208
  2. "${b}/INSTRUCTION.md" — write rules for AI agents operating in this space
209
209
 
210
- Keep content concise and actionable. Write files directly using tools.`;window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spaceName:a,spacePath:b,description:c,state:"working"}})),fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:d}],currentFile:b+"/INSTRUCTION.md"})}).then(async a=>{if(!a.ok||!a.body)throw Error(`HTTP ${a.status}`);let c=a.body.getReader();try{for(;;){let{done:a}=await c.read();if(a)break}}finally{c.releaseLock()}window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:b,state:"done"}})),window.dispatchEvent(new Event("mindos:files-changed"))}).catch(()=>{window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:b,state:"error"}}))})}},94416:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49681),g=c(40560),h=c(47223);let i="mindos_update_in_progress";function j(){let[a,b]=(0,e.useState)(!1),[c,j]=(0,e.useState)(!1),k=(0,e.useRef)(void 0),{locale:l}=(0,h.Y)(),m="zh"===l;return((0,e.useCallback)(()=>{k.current=setInterval(async()=>{try{if((await fetch("/api/health",{signal:AbortSignal.timeout(3e3)})).ok){clearInterval(k.current),k.current=void 0;try{let a=localStorage.getItem(i);if(a){let{originalVer:b}=JSON.parse(a),c=await fetch("/api/update-check",{signal:AbortSignal.timeout(5e3)}).then(a=>a.json());if(c.current&&c.current!==b){j(!0),localStorage.removeItem(i),localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),setTimeout(()=>window.location.reload(),1500);return}}}catch{}localStorage.removeItem(i),window.location.reload()}}catch{}},3e3)},[]),a)?(0,d.jsxs)("div",{style:{position:"fixed",inset:0,zIndex:99999,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(8px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontFamily:"'IBM Plex Sans', system-ui, sans-serif"},children:[c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{size:32,style:{color:"var(--success)",marginBottom:12}}),(0,d.jsx)("div",{style:{color:"var(--foreground)",fontSize:18,fontWeight:600},children:m?"更新成功!":"Update Complete!"}),(0,d.jsx)("div",{style:{color:"var(--muted-foreground)",fontSize:13,marginTop:6},children:m?"正在刷新页面...":"Reloading..."})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{size:32,style:{color:"var(--amber)",marginBottom:12,animation:"spin 1s linear infinite"}}),(0,d.jsx)("div",{style:{color:"var(--foreground)",fontSize:18,fontWeight:600},children:m?"MindOS 正在更新...":"MindOS is Updating..."}),(0,d.jsx)("div",{style:{color:"var(--muted-foreground)",fontSize:13,marginTop:6,textAlign:"center",maxWidth:300,lineHeight:1.5},children:m?"服务正在重启,请勿关闭此页面。完成后将自动刷新。":"The server is restarting. Please do not close this page. It will auto-reload when ready."})]}),(0,d.jsx)("style",{children:"@keyframes spin { to { transform: rotate(360deg) } }"})]}):null}},95054:(a,b,c)=>{"use strict";c.d(b,{h:()=>d,n:()=>e});class d extends Error{constructor(a,b,c){super(a),this.name="ApiError",this.status=b,this.code=c}}async function e(a,b={}){let c,f,g,{timeout:h=3e4,signal:i,...j}=b;if((h>0||i)&&(c=new AbortController),h>0&&c&&(f=setTimeout(()=>{c.abort(Error(`Request timed out after ${Math.round(h/1e3)}s`))},h)),i&&c)if(i.aborted)c.abort();else{let a=()=>c?.abort();i.addEventListener("abort",a,{once:!0}),g=()=>{i.removeEventListener("abort",a)}}let k=c?.signal??i;try{let b=await fetch(a,{...j,signal:k});if(!b.ok){let a,c=`Request failed (${b.status})`;try{let d=await b.json();d?.error?.code&&d?.error?.message?(c=d.error.message,a=d.error.code):d?.error&&(c="string"==typeof d.error?d.error:d.error.message??c)}catch{}throw new d(c,b.status,a)}return await b.json()}finally{f&&clearTimeout(f),g&&g()}}},95303:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});var d=c(99829);let e=(0,d.createServerReference)("40e068f238ad6b0c3c038043142db432d430be10bf",d.callServer,void 0,d.findSourceMapURL,"undoDeleteAction")},96716:(a,b,c)=>{"use strict";c.d(b,{wl:()=>v,ZV:()=>x,dS:()=>w,Ay:()=>z});var d=c(48249),e=c(67484),f=c(18329),g=c(47223),h=c(2548),i=c(46674),j=c(72987),k=c(40560),l=c(49681),m=c(8455),n=c(56884),o=c(41023),p=c(15273),q=c(99101),r=c(60725),s=c(39868);function t({agent:a,agentStatus:b,mcpStatus:c,onBack:f,onInstallAgent:g,copy:h,headerVariant:t="inline"}){let[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(()=>a.preferredTransport),A=(0,e.useMemo)(()=>"notFound"===b?null:(0,r.$k)(a,c,y),[a,c,y,b]),B=async()=>{v(!0),x(null),x(await g(a.key)?{type:"success",text:`${a.name} ${h.connected}`}:{type:"error",text:h.installFailed}),v(!1)},C=async()=>{!A||await (0,s.l)(A.snippet)&&q.oR.copy()},D="connected"===b?"bg-[var(--success)]":"detected"===b?"bg-[var(--amber)]":"bg-muted-foreground";return(0,d.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:["dock"===t?(0,d.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 border-b border-border px-4 py-3 bg-card",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${D}`}),(0,d.jsx)("h2",{className:"text-sm font-semibold text-foreground truncate",title:a.name,children:a.name})]}),(0,d.jsx)("button",{type:"button",onClick:f,className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring shrink-0","aria-label":h.closeDetail??"Close",children:(0,d.jsx)(i.A,{size:16})})]}):(0,d.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background/95 px-3 py-2.5 backdrop-blur-sm shrink-0",children:[(0,d.jsxs)("button",{type:"button",onClick:f,className:"flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground rounded-md px-1 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring shrink-0",children:[(0,d.jsx)(j.A,{size:16}),h.backToList]}),(0,d.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${D}`}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate",title:a.name,children:a.name})]}),(0,d.jsxs)("div",{className:"px-4 py-4 space-y-4 flex-1 min-h-0 overflow-y-auto",children:["detected"===b&&(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:B,disabled:u,className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs rounded-lg font-medium text-white disabled:opacity-50 bg-[var(--amber)] hover:bg-[var(--amber)]/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[u?(0,d.jsx)(k.A,{size:14,className:"animate-spin"}):null,u?h.installing:h.install]}),w&&(0,d.jsxs)("span",{className:`flex items-center gap-1 text-2xs ${"success"===w.type?"text-success":"text-destructive"}`,children:["success"===w.type?(0,d.jsx)(l.A,{size:12}):(0,d.jsx)(m.A,{size:12}),w.text]})]}),"notFound"===b&&(0,d.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:h.notFoundDetail}),"notFound"!==b&&A&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-1",children:h.configPath}),(0,d.jsx)("p",{className:"text-xs font-mono text-foreground break-all",children:A.path})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:h.agentDetailTransport}),(0,d.jsxs)("div",{className:"flex items-center gap-1 p-0.5 rounded-lg bg-muted/40 w-fit",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>z("stdio"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${"stdio"===y?"bg-card shadow-sm text-foreground":"text-muted-foreground"}`,children:[(0,d.jsx)(n.A,{size:13}),h.transportLocal]}),(0,d.jsxs)("button",{type:"button",onClick:()=>z("http"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${"http"===y?"bg-card shadow-sm text-foreground":"text-muted-foreground"}`,children:[(0,d.jsx)(o.A,{size:13}),h.transportRemote]})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:h.agentDetailSnippet}),(0,d.jsx)("pre",{className:"text-[11px] font-mono bg-muted/50 border border-border rounded-lg p-3 overflow-x-auto whitespace-pre max-h-[min(320px,50vh)] overflow-y-auto select-all",children:A.displaySnippet})]}),(0,d.jsxs)("button",{type:"button",onClick:C,className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(p.A,{size:14}),h.copyConfig]})]})]})]})}var u=c(1108);let v=u.oT.DEFAULT,w=u.oT.MIN,x=u.oT.MAX_ABS,y=u.oT.MAX_RATIO;function z({open:a,agentKey:b,onClose:c,rightOffset:i,width:j,onWidthChange:k,onWidthCommit:l}){let m=(0,f.kr)(),{t:n}=(0,g.Y)(),o=n.panels.agents,p=m.agents.filter(a=>a.present&&a.installed),q=m.agents.filter(a=>a.present&&!a.installed),r=m.agents.filter(a=>!a.present),s=(0,e.useMemo)(()=>{if(!b)return null;let a=m.agents.find(a=>a.key===b);if(!a)return null;let c=p.some(a=>a.key===b)?"connected":q.some(a=>a.key===b)?"detected":r.some(a=>a.key===b)?"notFound":null;return c?{agent:a,status:c}:null},[b,m.agents,p,q,r]),u=(0,h._)({width:j,minWidth:w,maxWidth:x,maxWidthRatio:y,direction:"left",onResize:k,onResizeEnd:l}),v={connected:o.connected,installing:o.installing,install:o.install,installFailed:o.installFailed,copyConfig:o.copyConfig,copied:o.copied,transportLocal:o.transportLocal,transportRemote:o.transportRemote,configPath:o.configPath,notFoundDetail:o.notFoundDetail,backToList:o.backToList,closeDetail:o.closeAgentDetail,agentDetailTransport:o.agentDetailTransport,agentDetailSnippet:o.agentDetailSnippet};return(0,d.jsxs)("aside",{className:`
210
+ Keep content concise and actionable. Write files directly using tools.`;window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spaceName:a,spacePath:b,description:c,state:"working"}})),fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:d}],currentFile:b+"/INSTRUCTION.md"})}).then(async a=>{if(!a.ok||!a.body)throw Error(`HTTP ${a.status}`);let c=a.body.getReader();try{for(;;){let{done:a}=await c.read();if(a)break}}finally{c.releaseLock()}window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:b,state:"done"}})),window.dispatchEvent(new Event("mindos:files-changed"))}).catch(()=>{window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:b,state:"error"}}))})}},94416:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49681),g=c(40560),h=c(47223);let i="mindos_update_in_progress";function j(){let[a,b]=(0,e.useState)(!1),[c,j]=(0,e.useState)(!1),k=(0,e.useRef)(void 0),{locale:l}=(0,h.Y)(),m="zh"===l;return((0,e.useCallback)(()=>{k.current=setInterval(async()=>{try{if((await fetch("/api/health",{signal:AbortSignal.timeout(3e3)})).ok){clearInterval(k.current),k.current=void 0;try{let a=localStorage.getItem(i);if(a){let{originalVer:b}=JSON.parse(a),c=await fetch("/api/update-check",{signal:AbortSignal.timeout(5e3)}).then(a=>a.json());if(c.current&&c.current!==b){j(!0),localStorage.removeItem(i),localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),setTimeout(()=>window.location.reload(),1500);return}}}catch{}localStorage.removeItem(i),window.location.reload()}}catch{}},3e3)},[]),a)?(0,d.jsxs)("div",{style:{position:"fixed",inset:0,zIndex:99999,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(8px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontFamily:"'IBM Plex Sans', system-ui, sans-serif"},children:[c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{size:32,style:{color:"var(--success)",marginBottom:12}}),(0,d.jsx)("div",{style:{color:"var(--foreground)",fontSize:18,fontWeight:600},children:m?"更新成功!":"Update Complete!"}),(0,d.jsx)("div",{style:{color:"var(--muted-foreground)",fontSize:13,marginTop:6},children:m?"正在刷新页面...":"Reloading..."})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{size:32,style:{color:"var(--amber)",marginBottom:12,animation:"spin 1s linear infinite"}}),(0,d.jsx)("div",{style:{color:"var(--foreground)",fontSize:18,fontWeight:600},children:m?"MindOS 正在更新...":"MindOS is Updating..."}),(0,d.jsx)("div",{style:{color:"var(--muted-foreground)",fontSize:13,marginTop:6,textAlign:"center",maxWidth:300,lineHeight:1.5},children:m?"服务正在重启,请勿关闭此页面。完成后将自动刷新。":"The server is restarting. Please do not close this page. It will auto-reload when ready."})]}),(0,d.jsx)("style",{children:"@keyframes spin { to { transform: rotate(360deg) } }"})]}):null}},95054:(a,b,c)=>{"use strict";c.d(b,{h:()=>d,n:()=>e});class d extends Error{constructor(a,b,c){super(a),this.name="ApiError",this.status=b,this.code=c}}async function e(a,b={}){let c,f,g,{timeout:h=3e4,signal:i,...j}=b;if((h>0||i)&&(c=new AbortController),h>0&&c&&(f=setTimeout(()=>{c.abort(Error(`Request timed out after ${Math.round(h/1e3)}s`))},h)),i&&c)if(i.aborted)c.abort();else{let a=()=>c?.abort();i.addEventListener("abort",a,{once:!0}),g=()=>{i.removeEventListener("abort",a)}}let k=c?.signal??i;try{let b=await fetch(a,{...j,signal:k});if(!b.ok){let a,c=`Request failed (${b.status})`;try{let d=await b.json();d?.error?.code&&d?.error?.message?(c=d.error.message,a=d.error.code):d?.error&&(c="string"==typeof d.error?d.error:d.error.message??c)}catch{}throw new d(c,b.status,a)}return await b.json()}finally{f&&clearTimeout(f),g&&g()}}},96716:(a,b,c)=>{"use strict";c.d(b,{wl:()=>v,ZV:()=>x,dS:()=>w,Ay:()=>z});var d=c(48249),e=c(67484),f=c(18329),g=c(47223),h=c(2548),i=c(46674),j=c(72987),k=c(40560),l=c(49681),m=c(8455),n=c(56884),o=c(41023),p=c(15273),q=c(99101),r=c(60725),s=c(39868);function t({agent:a,agentStatus:b,mcpStatus:c,onBack:f,onInstallAgent:g,copy:h,headerVariant:t="inline"}){let[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(()=>a.preferredTransport),A=(0,e.useMemo)(()=>"notFound"===b?null:(0,r.$k)(a,c,y),[a,c,y,b]),B=async()=>{v(!0),x(null),x(await g(a.key)?{type:"success",text:`${a.name} ${h.connected}`}:{type:"error",text:h.installFailed}),v(!1)},C=async()=>{!A||await (0,s.l)(A.snippet)&&q.oR.copy()},D="connected"===b?"bg-[var(--success)]":"detected"===b?"bg-[var(--amber)]":"bg-muted-foreground";return(0,d.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:["dock"===t?(0,d.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 border-b border-border px-4 py-3 bg-card",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,d.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${D}`}),(0,d.jsx)("h2",{className:"text-sm font-semibold text-foreground truncate",title:a.name,children:a.name})]}),(0,d.jsx)("button",{type:"button",onClick:f,className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring shrink-0","aria-label":h.closeDetail??"Close",children:(0,d.jsx)(i.A,{size:16})})]}):(0,d.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background/95 px-3 py-2.5 backdrop-blur-sm shrink-0",children:[(0,d.jsxs)("button",{type:"button",onClick:f,className:"flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground rounded-md px-1 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring shrink-0",children:[(0,d.jsx)(j.A,{size:16}),h.backToList]}),(0,d.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${D}`}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate",title:a.name,children:a.name})]}),(0,d.jsxs)("div",{className:"px-4 py-4 space-y-4 flex-1 min-h-0 overflow-y-auto",children:["detected"===b&&(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:B,disabled:u,className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs rounded-lg font-medium text-white disabled:opacity-50 bg-[var(--amber)] hover:bg-[var(--amber)]/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[u?(0,d.jsx)(k.A,{size:14,className:"animate-spin"}):null,u?h.installing:h.install]}),w&&(0,d.jsxs)("span",{className:`flex items-center gap-1 text-2xs ${"success"===w.type?"text-success":"text-destructive"}`,children:["success"===w.type?(0,d.jsx)(l.A,{size:12}):(0,d.jsx)(m.A,{size:12}),w.text]})]}),"notFound"===b&&(0,d.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:h.notFoundDetail}),"notFound"!==b&&A&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-1",children:h.configPath}),(0,d.jsx)("p",{className:"text-xs font-mono text-foreground break-all",children:A.path})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:h.agentDetailTransport}),(0,d.jsxs)("div",{className:"flex items-center gap-1 p-0.5 rounded-lg bg-muted/40 w-fit",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>z("stdio"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${"stdio"===y?"bg-card shadow-sm text-foreground":"text-muted-foreground"}`,children:[(0,d.jsx)(n.A,{size:13}),h.transportLocal]}),(0,d.jsxs)("button",{type:"button",onClick:()=>z("http"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${"http"===y?"bg-card shadow-sm text-foreground":"text-muted-foreground"}`,children:[(0,d.jsx)(o.A,{size:13}),h.transportRemote]})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:h.agentDetailSnippet}),(0,d.jsx)("pre",{className:"text-[11px] font-mono bg-muted/50 border border-border rounded-lg p-3 overflow-x-auto whitespace-pre max-h-[min(320px,50vh)] overflow-y-auto select-all",children:A.displaySnippet})]}),(0,d.jsxs)("button",{type:"button",onClick:C,className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,d.jsx)(p.A,{size:14}),h.copyConfig]})]})]})]})}var u=c(1108);let v=u.oT.DEFAULT,w=u.oT.MIN,x=u.oT.MAX_ABS,y=u.oT.MAX_RATIO;function z({open:a,agentKey:b,onClose:c,rightOffset:i,width:j,onWidthChange:k,onWidthCommit:l}){let m=(0,f.kr)(),{t:n}=(0,g.Y)(),o=n.panels.agents,p=m.agents.filter(a=>a.present&&a.installed),q=m.agents.filter(a=>a.present&&!a.installed),r=m.agents.filter(a=>!a.present),s=(0,e.useMemo)(()=>{if(!b)return null;let a=m.agents.find(a=>a.key===b);if(!a)return null;let c=p.some(a=>a.key===b)?"connected":q.some(a=>a.key===b)?"detected":r.some(a=>a.key===b)?"notFound":null;return c?{agent:a,status:c}:null},[b,m.agents,p,q,r]),u=(0,h._)({width:j,minWidth:w,maxWidth:x,maxWidthRatio:y,direction:"left",onResize:k,onResizeEnd:l}),v={connected:o.connected,installing:o.installing,install:o.install,installFailed:o.installFailed,copyConfig:o.copyConfig,copied:o.copied,transportLocal:o.transportLocal,transportRemote:o.transportRemote,configPath:o.configPath,notFoundDetail:o.notFoundDetail,backToList:o.backToList,closeDetail:o.closeAgentDetail,agentDetailTransport:o.agentDetailTransport,agentDetailSnippet:o.agentDetailSnippet};return(0,d.jsxs)("aside",{className:`
211
211
  hidden md:flex fixed top-0 h-screen z-[31] flex-col bg-card border-l border-border shadow-sm
212
212
  transition-transform duration-200 ease-out
213
213
  ${a?"translate-x-0":"translate-x-full pointer-events-none"}
214
- `,style:{width:`${j}px`,right:`${i}px`},role:"complementary","aria-label":o.agentDetailPanelAria,"aria-hidden":!a||!s,children:[s&&(0,d.jsx)("div",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto",children:(0,d.jsx)(t,{agent:s.agent,agentStatus:s.status,mcpStatus:m.status,onBack:c,onInstallAgent:m.installAgent,copy:v,headerVariant:"dock"})}),(0,d.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:u,children:(0,d.jsx)("div",{className:"absolute left-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity"})})]})}},98610:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ot:()=>k,T_:()=>l,Ux:()=>j,bf:()=>h,jt:()=>m,rl:()=>g});var e=c(14270),f=a([e]);e=(f.then?(await f)():f)[0];let l={anthropic:{id:"anthropic",name:"Anthropic",nameZh:"Anthropic",defaultModel:"claude-sonnet-4-6",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://console.anthropic.com/settings/keys",category:"primary"},openai:{id:"openai",name:"OpenAI",nameZh:"OpenAI",defaultModel:"gpt-5.4",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.openai.com/api-keys",category:"primary"},google:{id:"google",name:"Google Gemini",nameZh:"Google Gemini",defaultModel:"gemini-2.5-flash",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://aistudio.google.com/apikey",category:"primary"},groq:{id:"groq",name:"Groq",nameZh:"Groq",defaultModel:"llama-3.3-70b-versatile",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://console.groq.com/keys",category:"more"},xai:{id:"xai",name:"xAI (Grok)",nameZh:"xAI (Grok)",defaultModel:"grok-3",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},openrouter:{id:"openrouter",name:"OpenRouter",nameZh:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},mistral:{id:"mistral",name:"Mistral",nameZh:"Mistral",defaultModel:"mistral-large-latest",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},deepseek:{id:"deepseek",name:"DeepSeek",nameZh:"DeepSeek",defaultModel:"deepseek-chat",piProviderOverride:"openai",fixedBaseUrl:"https://api.deepseek.com/v1",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.deepseek.com/api_keys",category:"more"},zai:{id:"zai",name:"ZhipuAI (GLM)",nameZh:"智谱 AI (GLM 国际版)",defaultModel:"glm-4-plus",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"zai-cn":{id:"zai-cn",name:"ZhipuAI (GLM China)",nameZh:"智谱 AI (GLM 国内版)",defaultModel:"glm-4-plus",piProviderOverride:"zai",fixedBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://open.bigmodel.cn/",category:"more"},"kimi-coding":{id:"kimi-coding",name:"Kimi Coding",nameZh:"Kimi Coding (月之暗面)",defaultModel:"kimi-k2-thinking",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},cerebras:{id:"cerebras",name:"Cerebras",nameZh:"Cerebras",defaultModel:"llama-4-scout-17b-16e",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},minimax:{id:"minimax",name:"MiniMax",nameZh:"MiniMax (国际版)",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"minimax-cn":{id:"minimax-cn",name:"MiniMax (China)",nameZh:"MiniMax (国内版)",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},huggingface:{id:"huggingface",name:"Hugging Face",nameZh:"Hugging Face",defaultModel:"Qwen/Qwen3-235B-A22B-Thinking-2507",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},ollama:{id:"ollama",name:"Ollama",nameZh:"Ollama (本地)",defaultModel:"llama3.2",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:11434/v1",apiKeyFallback:"ollama",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://ollama.com/download",category:"more"}},m=Object.keys(l);function g(a){return a in l}function h(){let a=[],b=[];for(let c of m)"primary"===l[c].category?a.push(c):b.push(c);return b.sort((a,b)=>l[a].name.localeCompare(l[b].name)),{primary:a,more:b}}function i(a){return l[a].piProviderOverride??a}let n={deepseek:"DEEPSEEK_API_KEY"};function j(a){return n[a]?n[a]:o[i(a)]}function k(a){let b=l[a];if(b.fixedBaseUrl)return b.fixedBaseUrl;try{let b=(0,e.getModels)(i(a));return b[0]?.baseUrl??""}catch{return""}}let o={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",google:"GEMINI_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY",zai:"ZAI_API_KEY","zai-cn":"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_API_KEY",huggingface:"HF_TOKEN","kimi-coding":"KIMI_API_KEY"};d()}catch(a){d(a)}})},99101:(a,b,c)=>{"use strict";c.d(b,{B1:()=>h,X8:()=>j,dV:()=>i,oR:()=>l});let d=[],e=[],f=0;function g(){for(let a of e)a()}function h(a){return e=[...e,a],()=>{e=e.filter(b=>b!==a)}}function i(){return d}function j(a){d=d.filter(b=>b.id!==a),g()}function k(a){let b=`toast-${++f}`,c={id:b,message:a.message,type:a.type??"info",duration:a.duration??2e3,action:a.action};d=[...d,c].slice(-3),g(),c.duration>0&&setTimeout(()=>j(b),c.duration)}function l(a,b){k({message:a,...b})}l.success=(a,b)=>k({message:a,type:"success",duration:b}),l.undo=(a,b,c)=>k({message:a,type:"info",duration:c?.duration??5e3,action:{label:c?.label??"Undo",onClick:b}}),l.error=(a,b)=>k({message:a,type:"error",duration:b}),l.copy=(a="Copied")=>k({message:a,type:"success",duration:1500})},99713:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},99788:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{S:()=>s});var e=c(48249),f=c(67484),g=c(40560),h=c(6079),i=c(86588),j=c(8455),k=c(65255),l=c(44218),m=c(56884),n=c(81285),o=c(47223),p=c(98610),q=c(6596),r=a([p,q]);function s({data:a,updateAi:b,updateAgent:c,t:d}){var l,m;let r,s,v,{locale:w}=(0,o.Y)(),x=a.envOverrides??{};a.envValues;let y=a.ai.provider,z=(0,p.rl)(y)?p.T_[y]:null,[A,B]=(0,f.useState)({}),C=(0,f.useRef)(void 0);(0,f.useRef)(y);let D=(0,f.useCallback)(async b=>{let c=a.ai.providers?.[b]??{};B(a=>({...a,[b]:{state:"testing"}}));try{let a={provider:b};c.apiKey&&(a.apiKey=c.apiKey),c.model&&(a.model=c.model),c.baseUrl&&(a.baseUrl=c.baseUrl);let d=await fetch("/api/settings/test-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),e=await d.json();e.ok?(B(a=>({...a,[b]:{state:"ok",latency:e.latency}})),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{B(a=>({...a,[b]:{state:"idle"}}))},8e3)):B(a=>({...a,[b]:{state:"error",error:e.error,code:e.code}}))}catch{B(a=>({...a,[b]:{state:"error",code:"network_error",error:"Network error"}}))}},[a.ai.providers]),E=(0,f.useCallback)((c,d)=>{"apiKey"in d&&B(a=>({...a,[c]:{state:"idle"}})),b({providers:{...a.ai.providers,[c]:{...a.ai.providers?.[c],...d}}})},[a.ai.providers,b]),F=a.ai.providers?.[y]??{apiKey:"",model:"",baseUrl:""},G=z?(0,p.Ux)(y):void 0,H=F.apiKey,I=!!G&&x[G],J=!!z?.apiKeyFallback,K=new Set(Object.entries(a.ai.providers??{}).filter(([a,b])=>b&&b.apiKey||p.T_[a]?.apiKeyFallback).map(([a])=>a)),L=z?"zh"===w?z.nameZh:z.name:y;return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)(n.L7,{icon:(0,e.jsx)(h.A,{size:15}),title:d.settings.ai.provider,description:L,children:[(0,e.jsx)(q.A,{value:y,onChange:a=>{"skip"!==a&&b({provider:a})},compact:!0,configuredProviders:K}),z&&(0,e.jsxs)("div",{className:"space-y-3 pt-3",style:{borderTop:"1px solid var(--border)"},children:[(0,e.jsxs)(n.D0,{label:(0,e.jsxs)(e.Fragment,{children:[d.settings.ai.apiKey," ",G&&(0,e.jsx)(n.Bt,{overridden:x[G]})]}),hint:I?d.settings.ai.envFieldNote(G):J?d.settings.ai.keyOptionalHint:d.settings.ai.keyHint,children:[(0,e.jsx)(n.Ak,{value:F.apiKey,onChange:a=>E(y,{apiKey:a}),labels:{change:d.settings.ai.keyChange,cancel:d.settings.ai.keyCancel}}),z.signupUrl&&!F.apiKey&&!I&&(0,e.jsxs)("a",{href:z.signupUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs mt-1.5 hover:underline",style:{color:"var(--amber)"},children:[(0,e.jsx)(i.A,{size:10}),J?"zh"===w?`下载 ${z.nameZh}`:`Download ${z.name}`:"zh"===w?`获取 ${z.nameZh} API Key`:`Get ${z.name} API Key`]})]}),z.supportsBaseUrl&&(0,e.jsx)(n.D0,{label:d.settings.ai.baseUrl,hint:d.settings.ai.baseUrlHint,children:(0,e.jsx)(n.pd,{value:F.baseUrl??"",onChange:a=>E(y,{baseUrl:a.target.value}),placeholder:z.fixedBaseUrl||(0,p.Ot)(y)||"https://api.openai.com/v1"})}),(0,e.jsx)(n.D0,{label:d.settings.ai.model,children:(0,e.jsx)(t,{value:F.model,onChange:a=>E(y,{model:a}),placeholder:z.defaultModel,provider:y,apiKey:F.apiKey,envKey:!!I,baseUrl:F.baseUrl,supportsListModels:z.supportsListModels,t:d})}),(l=!!F.apiKey,m=!!I,r=A[y]??{state:"idle"},s=!!p.T_[y]?.apiKeyFallback,v="testing"===r.state||!l&&!m&&!s,(0,e.jsxs)("div",{className:"flex items-center gap-2 mt-1.5",children:[(0,e.jsx)("button",{type:"button",disabled:v,title:v?d.hints.testInProgressOrNoKey:void 0,onClick:()=>D(y),className:"inline-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:border-foreground/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"testing"===r.state?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(g.A,{size:12,className:"animate-spin"}),d.settings.ai.testKeyTesting]}):d.settings.ai.testKey}),"ok"===r.state&&null!=r.latency&&(0,e.jsx)("span",{className:"text-xs text-success",children:d.settings.ai.testKeyOk(r.latency)}),"error"===r.state&&(0,e.jsxs)("span",{className:"text-xs text-error",children:["✗ ",function(a,b){switch(b){case"auth_error":return a.settings.ai.testKeyAuthError;case"model_not_found":return a.settings.ai.testKeyModelNotFound;case"rate_limited":return a.settings.ai.testKeyRateLimited;case"network_error":return a.settings.ai.testKeyNetworkError;default:return a.settings.ai.testKeyUnknown}}(d,r.code)]})]}))]}),!H&&!I&&!J&&(0,e.jsxs)("div",{className:"flex items-start gap-2 text-xs text-destructive/80 bg-destructive/8 border border-destructive/20 rounded-lg px-3 py-2.5",children:[(0,e.jsx)(j.A,{size:13,className:"shrink-0 mt-0.5"}),(0,e.jsx)("span",{children:d.settings.ai.noApiKey})]}),Object.values(x).some(Boolean)&&(0,e.jsxs)("div",{className:"flex items-start gap-2 text-xs text-[var(--amber)] bg-[var(--amber-subtle)] border border-[var(--amber)]/20 rounded-lg px-3 py-2.5",children:[(0,e.jsx)(j.A,{size:13,className:"shrink-0 mt-0.5"}),(0,e.jsx)("span",{children:d.settings.ai.envHint})]})]}),(0,e.jsxs)(n.L7,{icon:(0,e.jsx)(k.A,{size:15}),title:d.settings.agent.title,description:d.settings.agent.subtitle??"Configure how the AI agent operates",children:[(0,e.jsx)(n.pM,{label:d.settings.agent.maxSteps,hint:d.settings.agent.maxStepsHint,children:(0,e.jsxs)(n.l6,{value:String(a.agent?.maxSteps??20),onChange:a=>c({maxSteps:Number(a.target.value)}),className:"w-20",children:[(0,e.jsx)("option",{value:"5",children:"5"}),(0,e.jsx)("option",{value:"10",children:"10"}),(0,e.jsx)("option",{value:"15",children:"15"}),(0,e.jsx)("option",{value:"20",children:"20"}),(0,e.jsx)("option",{value:"25",children:"25"}),(0,e.jsx)("option",{value:"30",children:"30"})]})}),(0,e.jsx)(n.pM,{label:d.settings.agent.contextStrategy,hint:d.settings.agent.contextStrategyHint,children:(0,e.jsxs)(n.l6,{value:a.agent?.contextStrategy??"auto",onChange:a=>c({contextStrategy:a.target.value}),className:"w-24",children:[(0,e.jsx)("option",{value:"auto",children:d.settings.agent.contextStrategyAuto}),(0,e.jsx)("option",{value:"off",children:d.settings.agent.contextStrategyOff})]})}),(0,e.jsx)(n.pM,{label:d.settings.agent.reconnectRetries,hint:d.settings.agent.reconnectRetriesHint,children:(0,e.jsxs)(n.l6,{value:String(a.agent?.reconnectRetries??3),onChange:a=>{let b=Number(a.target.value);c({reconnectRetries:b});try{localStorage.setItem("mindos-reconnect-retries",String(b))}catch(a){console.warn("[AiTab] localStorage setItem reconnectRetries failed:",a)}},className:"w-20",children:[(0,e.jsx)("option",{value:"0",children:"Off"}),(0,e.jsx)("option",{value:"1",children:"1"}),(0,e.jsx)("option",{value:"2",children:"2"}),(0,e.jsx)("option",{value:"3",children:"3"}),(0,e.jsx)("option",{value:"5",children:"5"}),(0,e.jsx)("option",{value:"10",children:"10"})]})}),z?.supportsThinking&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.pM,{label:d.settings.agent.thinking,hint:d.settings.agent.thinkingHint,children:(0,e.jsx)(n.lM,{checked:a.agent?.enableThinking??!1,onChange:()=>c({enableThinking:!a.agent?.enableThinking})})}),a.agent?.enableThinking&&(0,e.jsx)(n.D0,{label:d.settings.agent.thinkingBudget,hint:d.settings.agent.thinkingBudgetHint,children:(0,e.jsx)(n.pd,{type:"number",value:String(a.agent?.thinkingBudget??5e3),onChange:a=>{let b=parseInt(a.target.value,10);isNaN(b)||c({thinkingBudget:Math.max(1e3,Math.min(5e4,b))})},min:1e3,max:5e4,step:1e3})})]})]}),(0,e.jsx)(u,{})]})}function t({value:a,onChange:b,placeholder:c,provider:d,apiKey:h,envKey:i,baseUrl:j,supportsListModels:k,t:m}){let[o,q]=(0,f.useState)(null),[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(!1),[v,w]=(0,f.useState)(""),[x,y]=(0,f.useState)(!1),[z,A]=(0,f.useState)(-1),B=(0,f.useRef)(null),C=(0,f.useRef)(null),D=(0,f.useRef)(!1),E=(0,f.useRef)(0),F=(0,f.useRef)(!1),G=!!h||!!i||!!p.T_[d]?.apiKeyFallback,H=(0,f.useCallback)(async(a=!1)=>{if(F.current)return;F.current=!0,s(!0),a||w("");let b=E.current;try{let c={provider:d};h&&(c.apiKey=h),j&&(c.baseUrl=j);let e=await fetch("/api/settings/list-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(b!==E.current)return;let f=await e.json();if(b!==E.current)return;f.ok&&Array.isArray(f.models)?(q(f.models),D.current=!0,a||u(!0)):a||w(f.error||"Failed to fetch models")}catch{if(b!==E.current)return;a||w("Network error")}finally{F.current=!1,s(!1)}},[d,h,j]),I=(0,f.useCallback)(()=>{y(!0),!D.current&&k&&G&&!F.current&&H(!0)},[k,G,H]),J=(0,f.useMemo)(()=>{if(!o||!a.trim())return o??[];let b=a.toLowerCase();return o.filter(a=>a.toLowerCase().includes(b))},[o,a]),K=t||x&&null!==o&&a.trim().length>0&&J.length>0,L=(0,f.useCallback)(a=>{let c=K?J:[];c.length&&("ArrowDown"===a.key?(a.preventDefault(),A(a=>(a+1)%c.length)):"ArrowUp"===a.key?(a.preventDefault(),A(a=>(a-1+c.length)%c.length)):"Enter"===a.key&&z>=0&&z<c.length?(a.preventDefault(),b(c[z]),u(!1),y(!1)):"Escape"===a.key&&(u(!1),y(!1)))},[K,J,z,b]);return(0,e.jsxs)("div",{ref:B,className:"relative",children:[(0,e.jsxs)("div",{className:"flex gap-1.5",children:[(0,e.jsx)(n.pd,{value:a,onChange:a=>{b(a.target.value),t||y(!0)},onFocus:I,onKeyDown:L,placeholder:c,className:"flex-1",autoComplete:"off"}),k&&(0,e.jsxs)("button",{type:"button",disabled:!G||r,onClick:()=>H(!1),title:m.settings.ai.listModels,className:"inline-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:border-foreground/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed shrink-0",children:[r?(0,e.jsx)(g.A,{size:12,className:"animate-spin"}):(0,e.jsx)(l.A,{size:12}),m.settings.ai.listModels]})]}),v&&(0,e.jsx)("p",{className:"text-xs text-error mt-1",children:v}),K&&J.length>0&&(0,e.jsx)("div",{ref:C,className:"absolute z-50 mt-1 w-full max-h-48 overflow-y-auto rounded-lg border border-border bg-popover shadow-lg",children:J.map((c,d)=>(0,e.jsx)("button",{type:"button","data-model-item":!0,className:`w-full text-left px-3 py-1.5 text-sm transition-colors ${c===a?"bg-accent/60 font-medium":d===z?"bg-accent":"hover:bg-accent"}`,onClick:()=>{b(c),u(!1),y(!1)},children:c},c))}),t&&0===J.length&&(0,e.jsx)("div",{className:"absolute z-50 mt-1 w-full rounded-lg border border-border bg-popover shadow-lg px-3 py-2 text-xs text-muted-foreground",children:m.settings.ai.noModelsFound})]})}function u(){let{t:a}=(0,o.Y)(),[b,c]=(0,f.useState)("panel");return(0,e.jsx)(n.L7,{icon:(0,e.jsx)(m.A,{size:15}),title:a.settings.askDisplayMode?.label??"Display Mode",description:a.settings.askDisplayMode?.hint??"Side panel stays docked on the right. Popup opens a floating dialog.",children:(0,e.jsxs)(n.l6,{value:b,onChange:a=>(a=>{c(a);try{localStorage.setItem("ask-mode",a)}catch(a){console.warn("[AiTab] localStorage setItem ask-mode failed:",a)}window.dispatchEvent(new StorageEvent("storage",{key:"ask-mode",newValue:a}))})(a.target.value),children:[(0,e.jsx)("option",{value:"panel",children:a.settings.askDisplayMode?.panel??"Side Panel"}),(0,e.jsx)("option",{value:"popup",children:a.settings.askDisplayMode?.popup??"Popup"})]})})}[p,q]=r.then?(await r)():r,d()}catch(a){d(a)}})},99791:(a,b,c)=>{"use strict";c.d(b,{A:()=>p});var d=c(48249),e=c(67484),f=c(19099),g=c(10316),h=c(46674),i=c(83654),j=c(80600),k=c(33191),l=c(95054),m=c(47223),n=c(4140),o=c(95657);function p({active:a,onNavigate:b,maximized:c,onMaximize:p}){let[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)([]),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(0),y=(0,e.useRef)(null),z=(0,f.useRouter)(),A=(0,e.useRef)(null),{t:B}=(0,m.Y)(),C=(0,e.useCallback)(a=>{if(A.current&&clearTimeout(A.current),!a.trim()){t([]),v(!1);return}v(!0),A.current=setTimeout(async()=>{try{let b=await (0,l.n)(`/api/search?q=${encodeURIComponent(a)}`);t(Array.isArray(b)?b:[]),x(0)}catch{t([])}finally{v(!1)}},300)},[]),D=(0,e.useCallback)(a=>{let b=a.target.value;r(b),C(b)},[C]),E=(0,e.useCallback)(a=>{z.push(`/view/${(0,k.O0)(a.path)}`),b?.()},[z,b]),F=(0,e.useCallback)(a=>{"ArrowDown"===a.key?(a.preventDefault(),x(a=>Math.min(a+1,s.length-1))):"ArrowUp"===a.key?(a.preventDefault(),x(a=>Math.max(a-1,0))):"Enter"===a.key&&s[w]&&E(s[w])},[s,w,E]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.A,{title:"Search",maximized:c,onMaximize:p}),(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b border-border shrink-0",children:[(0,d.jsx)(g.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("input",{ref:y,type:"text",value:q,onChange:D,onKeyDown:F,placeholder:B.search.placeholder,"aria-label":B.search.placeholder,className:"flex-1 bg-transparent text-foreground placeholder:text-muted-foreground text-sm outline-none"}),u&&(0,d.jsx)("div",{className:"w-3.5 h-3.5 border-2 border-muted-foreground/40 border-t-foreground rounded-full animate-spin shrink-0"}),!u&&q&&(0,d.jsx)("button",{onClick:()=>{r(""),t([]),y.current?.focus()},children:(0,d.jsx)(h.A,{size:13,className:"text-muted-foreground hover:text-foreground"})})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",role:"listbox","aria-label":"Search results",children:[0===s.length&&q&&!u&&(0,d.jsx)("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:B.search.noResults}),0===s.length&&!q&&(0,d.jsx)("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground/60",children:B.search.prompt}),s.length>0&&(0,d.jsx)(o.aY,{totalCount:s.length,overscan:100,itemContent:a=>{let b=s[a],c=b.path.endsWith(".csv")?".csv":".md",e=b.path.split("/"),f=e[e.length-1],g=e.slice(0,-1).join("/");return(0,d.jsxs)("button",{role:"option","aria-selected":a===w,onClick:()=>E(b),onMouseEnter:()=>x(a),className:`
214
+ `,style:{width:`${j}px`,right:`${i}px`},role:"complementary","aria-label":o.agentDetailPanelAria,"aria-hidden":!a||!s,children:[s&&(0,d.jsx)("div",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto",children:(0,d.jsx)(t,{agent:s.agent,agentStatus:s.status,mcpStatus:m.status,onBack:c,onInstallAgent:m.installAgent,copy:v,headerVariant:"dock"})}),(0,d.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:u,children:(0,d.jsx)("div",{className:"absolute left-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity"})})]})}},98541:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});var d=c(99829);let e=(0,d.createServerReference)("40d1ccdb3bfbd3b45067cf4fc3593e34d34aec672e",d.callServer,void 0,d.findSourceMapURL,"undoDeleteAction")},98610:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ot:()=>k,T_:()=>l,Ux:()=>j,bf:()=>h,jt:()=>m,rl:()=>g});var e=c(14270),f=a([e]);e=(f.then?(await f)():f)[0];let l={anthropic:{id:"anthropic",name:"Anthropic",nameZh:"Anthropic",defaultModel:"claude-sonnet-4-6",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://console.anthropic.com/settings/keys",category:"primary"},openai:{id:"openai",name:"OpenAI",nameZh:"OpenAI",defaultModel:"gpt-5.4",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.openai.com/api-keys",category:"primary"},google:{id:"google",name:"Google Gemini",nameZh:"Google Gemini",defaultModel:"gemini-2.5-flash",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://aistudio.google.com/apikey",category:"primary"},groq:{id:"groq",name:"Groq",nameZh:"Groq",defaultModel:"llama-3.3-70b-versatile",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://console.groq.com/keys",category:"more"},xai:{id:"xai",name:"xAI (Grok)",nameZh:"xAI (Grok)",defaultModel:"grok-3",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},openrouter:{id:"openrouter",name:"OpenRouter",nameZh:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},mistral:{id:"mistral",name:"Mistral",nameZh:"Mistral",defaultModel:"mistral-large-latest",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},deepseek:{id:"deepseek",name:"DeepSeek",nameZh:"DeepSeek",defaultModel:"deepseek-chat",piProviderOverride:"openai",fixedBaseUrl:"https://api.deepseek.com/v1",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.deepseek.com/api_keys",category:"more"},zai:{id:"zai",name:"ZhipuAI (GLM)",nameZh:"智谱 AI (GLM 国际版)",defaultModel:"glm-4-plus",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"zai-cn":{id:"zai-cn",name:"ZhipuAI (GLM China)",nameZh:"智谱 AI (GLM 国内版)",defaultModel:"glm-4-plus",piProviderOverride:"zai",fixedBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://open.bigmodel.cn/",category:"more"},"kimi-coding":{id:"kimi-coding",name:"Kimi Coding",nameZh:"Kimi Coding (月之暗面)",defaultModel:"kimi-k2-thinking",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},cerebras:{id:"cerebras",name:"Cerebras",nameZh:"Cerebras",defaultModel:"llama-4-scout-17b-16e",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},minimax:{id:"minimax",name:"MiniMax",nameZh:"MiniMax (国际版)",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"minimax-cn":{id:"minimax-cn",name:"MiniMax (China)",nameZh:"MiniMax (国内版)",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},huggingface:{id:"huggingface",name:"Hugging Face",nameZh:"Hugging Face",defaultModel:"Qwen/Qwen3-235B-A22B-Thinking-2507",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},ollama:{id:"ollama",name:"Ollama",nameZh:"Ollama (本地)",defaultModel:"llama3.2",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:11434/v1",apiKeyFallback:"ollama",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://ollama.com/download",category:"more"}},m=Object.keys(l);function g(a){return a in l}function h(){let a=[],b=[];for(let c of m)"primary"===l[c].category?a.push(c):b.push(c);return b.sort((a,b)=>l[a].name.localeCompare(l[b].name)),{primary:a,more:b}}function i(a){return l[a].piProviderOverride??a}let n={deepseek:"DEEPSEEK_API_KEY"};function j(a){return n[a]?n[a]:o[i(a)]}function k(a){let b=l[a];if(b.fixedBaseUrl)return b.fixedBaseUrl;try{let b=(0,e.getModels)(i(a));return b[0]?.baseUrl??""}catch{return""}}let o={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",google:"GEMINI_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY",zai:"ZAI_API_KEY","zai-cn":"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_API_KEY",huggingface:"HF_TOKEN","kimi-coding":"KIMI_API_KEY"};d()}catch(a){d(a)}})},99101:(a,b,c)=>{"use strict";c.d(b,{B1:()=>h,X8:()=>j,dV:()=>i,oR:()=>l});let d=[],e=[],f=0;function g(){for(let a of e)a()}function h(a){return e=[...e,a],()=>{e=e.filter(b=>b!==a)}}function i(){return d}function j(a){d=d.filter(b=>b.id!==a),g()}function k(a){let b=`toast-${++f}`,c={id:b,message:a.message,type:a.type??"info",duration:a.duration??2e3,action:a.action};d=[...d,c].slice(-3),g(),c.duration>0&&setTimeout(()=>j(b),c.duration)}function l(a,b){k({message:a,...b})}l.success=(a,b)=>k({message:a,type:"success",duration:b}),l.undo=(a,b,c)=>k({message:a,type:"info",duration:c?.duration??5e3,action:{label:c?.label??"Undo",onClick:b}}),l.error=(a,b)=>k({message:a,type:"error",duration:b}),l.copy=(a="Copied")=>k({message:a,type:"success",duration:1500})},99713:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},99788:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{S:()=>s});var e=c(48249),f=c(67484),g=c(40560),h=c(6079),i=c(86588),j=c(8455),k=c(65255),l=c(44218),m=c(56884),n=c(81285),o=c(47223),p=c(98610),q=c(6596),r=a([p,q]);function s({data:a,updateAi:b,updateAgent:c,t:d}){var l,m;let r,s,v,{locale:w}=(0,o.Y)(),x=a.envOverrides??{};a.envValues;let y=a.ai.provider,z=(0,p.rl)(y)?p.T_[y]:null,[A,B]=(0,f.useState)({}),C=(0,f.useRef)(void 0);(0,f.useRef)(y);let D=(0,f.useCallback)(async b=>{let c=a.ai.providers?.[b]??{};B(a=>({...a,[b]:{state:"testing"}}));try{let a={provider:b};c.apiKey&&(a.apiKey=c.apiKey),c.model&&(a.model=c.model),c.baseUrl&&(a.baseUrl=c.baseUrl);let d=await fetch("/api/settings/test-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),e=await d.json();e.ok?(B(a=>({...a,[b]:{state:"ok",latency:e.latency}})),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{B(a=>({...a,[b]:{state:"idle"}}))},8e3)):B(a=>({...a,[b]:{state:"error",error:e.error,code:e.code}}))}catch{B(a=>({...a,[b]:{state:"error",code:"network_error",error:"Network error"}}))}},[a.ai.providers]),E=(0,f.useCallback)((c,d)=>{"apiKey"in d&&B(a=>({...a,[c]:{state:"idle"}})),b({providers:{...a.ai.providers,[c]:{...a.ai.providers?.[c],...d}}})},[a.ai.providers,b]),F=a.ai.providers?.[y]??{apiKey:"",model:"",baseUrl:""},G=z?(0,p.Ux)(y):void 0,H=F.apiKey,I=!!G&&x[G],J=!!z?.apiKeyFallback,K=new Set(Object.entries(a.ai.providers??{}).filter(([a,b])=>b&&b.apiKey||p.T_[a]?.apiKeyFallback).map(([a])=>a)),L=z?"zh"===w?z.nameZh:z.name:y;return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)(n.L7,{icon:(0,e.jsx)(h.A,{size:15}),title:d.settings.ai.provider,description:L,children:[(0,e.jsx)(q.A,{value:y,onChange:a=>{"skip"!==a&&b({provider:a})},compact:!0,configuredProviders:K}),z&&(0,e.jsxs)("div",{className:"space-y-3 pt-3",style:{borderTop:"1px solid var(--border)"},children:[(0,e.jsxs)(n.D0,{label:(0,e.jsxs)(e.Fragment,{children:[d.settings.ai.apiKey," ",G&&(0,e.jsx)(n.Bt,{overridden:x[G]})]}),hint:I?d.settings.ai.envFieldNote(G):J?d.settings.ai.keyOptionalHint:d.settings.ai.keyHint,children:[(0,e.jsx)(n.Ak,{value:F.apiKey,onChange:a=>E(y,{apiKey:a}),labels:{change:d.settings.ai.keyChange,cancel:d.settings.ai.keyCancel}}),z.signupUrl&&!F.apiKey&&!I&&(0,e.jsxs)("a",{href:z.signupUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs mt-1.5 hover:underline",style:{color:"var(--amber)"},children:[(0,e.jsx)(i.A,{size:10}),J?"zh"===w?`下载 ${z.nameZh}`:`Download ${z.name}`:"zh"===w?`获取 ${z.nameZh} API Key`:`Get ${z.name} API Key`]})]}),z.supportsBaseUrl&&(0,e.jsx)(n.D0,{label:d.settings.ai.baseUrl,hint:d.settings.ai.baseUrlHint,children:(0,e.jsx)(n.pd,{value:F.baseUrl??"",onChange:a=>E(y,{baseUrl:a.target.value}),placeholder:z.fixedBaseUrl||(0,p.Ot)(y)||"https://api.openai.com/v1"})}),(0,e.jsx)(n.D0,{label:d.settings.ai.model,children:(0,e.jsx)(t,{value:F.model,onChange:a=>E(y,{model:a}),placeholder:z.defaultModel,provider:y,apiKey:F.apiKey,envKey:!!I,baseUrl:F.baseUrl,supportsListModels:z.supportsListModels,t:d})}),(l=!!F.apiKey,m=!!I,r=A[y]??{state:"idle"},s=!!p.T_[y]?.apiKeyFallback,v="testing"===r.state||!l&&!m&&!s,(0,e.jsxs)("div",{className:"flex items-center gap-2 mt-1.5",children:[(0,e.jsx)("button",{type:"button",disabled:v,title:v?d.hints.testInProgressOrNoKey:void 0,onClick:()=>D(y),className:"inline-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:border-foreground/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"testing"===r.state?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(g.A,{size:12,className:"animate-spin"}),d.settings.ai.testKeyTesting]}):d.settings.ai.testKey}),"ok"===r.state&&null!=r.latency&&(0,e.jsx)("span",{className:"text-xs text-success",children:d.settings.ai.testKeyOk(r.latency)}),"error"===r.state&&(0,e.jsxs)("span",{className:"text-xs text-error",children:["✗ ",function(a,b){switch(b){case"auth_error":return a.settings.ai.testKeyAuthError;case"model_not_found":return a.settings.ai.testKeyModelNotFound;case"rate_limited":return a.settings.ai.testKeyRateLimited;case"network_error":return a.settings.ai.testKeyNetworkError;default:return a.settings.ai.testKeyUnknown}}(d,r.code)]})]}))]}),!H&&!I&&!J&&(0,e.jsxs)("div",{className:"flex items-start gap-2 text-xs text-destructive/80 bg-destructive/8 border border-destructive/20 rounded-lg px-3 py-2.5",children:[(0,e.jsx)(j.A,{size:13,className:"shrink-0 mt-0.5"}),(0,e.jsx)("span",{children:d.settings.ai.noApiKey})]}),Object.values(x).some(Boolean)&&(0,e.jsxs)("div",{className:"flex items-start gap-2 text-xs text-[var(--amber)] bg-[var(--amber-subtle)] border border-[var(--amber)]/20 rounded-lg px-3 py-2.5",children:[(0,e.jsx)(j.A,{size:13,className:"shrink-0 mt-0.5"}),(0,e.jsx)("span",{children:d.settings.ai.envHint})]})]}),(0,e.jsxs)(n.L7,{icon:(0,e.jsx)(k.A,{size:15}),title:d.settings.agent.title,description:d.settings.agent.subtitle??"Configure how the AI agent operates",children:[(0,e.jsx)(n.pM,{label:d.settings.agent.maxSteps,hint:d.settings.agent.maxStepsHint,children:(0,e.jsxs)(n.l6,{value:String(a.agent?.maxSteps??20),onChange:a=>c({maxSteps:Number(a.target.value)}),className:"w-20",children:[(0,e.jsx)("option",{value:"5",children:"5"}),(0,e.jsx)("option",{value:"10",children:"10"}),(0,e.jsx)("option",{value:"15",children:"15"}),(0,e.jsx)("option",{value:"20",children:"20"}),(0,e.jsx)("option",{value:"25",children:"25"}),(0,e.jsx)("option",{value:"30",children:"30"})]})}),(0,e.jsx)(n.pM,{label:d.settings.agent.contextStrategy,hint:d.settings.agent.contextStrategyHint,children:(0,e.jsxs)(n.l6,{value:a.agent?.contextStrategy??"auto",onChange:a=>c({contextStrategy:a.target.value}),className:"w-24",children:[(0,e.jsx)("option",{value:"auto",children:d.settings.agent.contextStrategyAuto}),(0,e.jsx)("option",{value:"off",children:d.settings.agent.contextStrategyOff})]})}),(0,e.jsx)(n.pM,{label:d.settings.agent.reconnectRetries,hint:d.settings.agent.reconnectRetriesHint,children:(0,e.jsxs)(n.l6,{value:String(a.agent?.reconnectRetries??3),onChange:a=>{let b=Number(a.target.value);c({reconnectRetries:b});try{localStorage.setItem("mindos-reconnect-retries",String(b))}catch(a){console.warn("[AiTab] localStorage setItem reconnectRetries failed:",a)}},className:"w-20",children:[(0,e.jsx)("option",{value:"0",children:"Off"}),(0,e.jsx)("option",{value:"1",children:"1"}),(0,e.jsx)("option",{value:"2",children:"2"}),(0,e.jsx)("option",{value:"3",children:"3"}),(0,e.jsx)("option",{value:"5",children:"5"}),(0,e.jsx)("option",{value:"10",children:"10"})]})}),z?.supportsThinking&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.pM,{label:d.settings.agent.thinking,hint:d.settings.agent.thinkingHint,children:(0,e.jsx)(n.lM,{checked:a.agent?.enableThinking??!1,onChange:()=>c({enableThinking:!a.agent?.enableThinking})})}),a.agent?.enableThinking&&(0,e.jsx)(n.D0,{label:d.settings.agent.thinkingBudget,hint:d.settings.agent.thinkingBudgetHint,children:(0,e.jsx)(n.pd,{type:"number",value:String(a.agent?.thinkingBudget??5e3),onChange:a=>{let b=parseInt(a.target.value,10);isNaN(b)||c({thinkingBudget:Math.max(1e3,Math.min(5e4,b))})},min:1e3,max:5e4,step:1e3})})]})]}),(0,e.jsx)(u,{})]})}function t({value:a,onChange:b,placeholder:c,provider:d,apiKey:h,envKey:i,baseUrl:j,supportsListModels:k,t:m}){let[o,q]=(0,f.useState)(null),[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(!1),[v,w]=(0,f.useState)(""),[x,y]=(0,f.useState)(!1),[z,A]=(0,f.useState)(-1),B=(0,f.useRef)(null),C=(0,f.useRef)(null),D=(0,f.useRef)(!1),E=(0,f.useRef)(0),F=(0,f.useRef)(!1),G=!!h||!!i||!!p.T_[d]?.apiKeyFallback,H=(0,f.useCallback)(async(a=!1)=>{if(F.current)return;F.current=!0,s(!0),a||w("");let b=E.current;try{let c={provider:d};h&&(c.apiKey=h),j&&(c.baseUrl=j);let e=await fetch("/api/settings/list-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(b!==E.current)return;let f=await e.json();if(b!==E.current)return;f.ok&&Array.isArray(f.models)?(q(f.models),D.current=!0,a||u(!0)):a||w(f.error||"Failed to fetch models")}catch{if(b!==E.current)return;a||w("Network error")}finally{F.current=!1,s(!1)}},[d,h,j]),I=(0,f.useCallback)(()=>{y(!0),!D.current&&k&&G&&!F.current&&H(!0)},[k,G,H]),J=(0,f.useMemo)(()=>{if(!o||!a.trim())return o??[];let b=a.toLowerCase();return o.filter(a=>a.toLowerCase().includes(b))},[o,a]),K=t||x&&null!==o&&a.trim().length>0&&J.length>0,L=(0,f.useCallback)(a=>{let c=K?J:[];c.length&&("ArrowDown"===a.key?(a.preventDefault(),A(a=>(a+1)%c.length)):"ArrowUp"===a.key?(a.preventDefault(),A(a=>(a-1+c.length)%c.length)):"Enter"===a.key&&z>=0&&z<c.length?(a.preventDefault(),b(c[z]),u(!1),y(!1)):"Escape"===a.key&&(u(!1),y(!1)))},[K,J,z,b]);return(0,e.jsxs)("div",{ref:B,className:"relative",children:[(0,e.jsxs)("div",{className:"flex gap-1.5",children:[(0,e.jsx)(n.pd,{value:a,onChange:a=>{b(a.target.value),t||y(!0)},onFocus:I,onKeyDown:L,placeholder:c,className:"flex-1",autoComplete:"off"}),k&&(0,e.jsxs)("button",{type:"button",disabled:!G||r,onClick:()=>H(!1),title:m.settings.ai.listModels,className:"inline-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:border-foreground/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed shrink-0",children:[r?(0,e.jsx)(g.A,{size:12,className:"animate-spin"}):(0,e.jsx)(l.A,{size:12}),m.settings.ai.listModels]})]}),v&&(0,e.jsx)("p",{className:"text-xs text-error mt-1",children:v}),K&&J.length>0&&(0,e.jsx)("div",{ref:C,className:"absolute z-50 mt-1 w-full max-h-48 overflow-y-auto rounded-lg border border-border bg-popover shadow-lg",children:J.map((c,d)=>(0,e.jsx)("button",{type:"button","data-model-item":!0,className:`w-full text-left px-3 py-1.5 text-sm transition-colors ${c===a?"bg-accent/60 font-medium":d===z?"bg-accent":"hover:bg-accent"}`,onClick:()=>{b(c),u(!1),y(!1)},children:c},c))}),t&&0===J.length&&(0,e.jsx)("div",{className:"absolute z-50 mt-1 w-full rounded-lg border border-border bg-popover shadow-lg px-3 py-2 text-xs text-muted-foreground",children:m.settings.ai.noModelsFound})]})}function u(){let{t:a}=(0,o.Y)(),[b,c]=(0,f.useState)("panel");return(0,e.jsx)(n.L7,{icon:(0,e.jsx)(m.A,{size:15}),title:a.settings.askDisplayMode?.label??"Display Mode",description:a.settings.askDisplayMode?.hint??"Side panel stays docked on the right. Popup opens a floating dialog.",children:(0,e.jsxs)(n.l6,{value:b,onChange:a=>(a=>{c(a);try{localStorage.setItem("ask-mode",a)}catch(a){console.warn("[AiTab] localStorage setItem ask-mode failed:",a)}window.dispatchEvent(new StorageEvent("storage",{key:"ask-mode",newValue:a}))})(a.target.value),children:[(0,e.jsx)("option",{value:"panel",children:a.settings.askDisplayMode?.panel??"Side Panel"}),(0,e.jsx)("option",{value:"popup",children:a.settings.askDisplayMode?.popup??"Popup"})]})})}[p,q]=r.then?(await r)():r,d()}catch(a){d(a)}})},99791:(a,b,c)=>{"use strict";c.d(b,{A:()=>p});var d=c(48249),e=c(67484),f=c(19099),g=c(10316),h=c(46674),i=c(83654),j=c(80600),k=c(33191),l=c(95054),m=c(47223),n=c(4140),o=c(95657);function p({active:a,onNavigate:b,maximized:c,onMaximize:p}){let[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)([]),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(0),y=(0,e.useRef)(null),z=(0,f.useRouter)(),A=(0,e.useRef)(null),{t:B}=(0,m.Y)(),C=(0,e.useCallback)(a=>{if(A.current&&clearTimeout(A.current),!a.trim()){t([]),v(!1);return}v(!0),A.current=setTimeout(async()=>{try{let b=await (0,l.n)(`/api/search?q=${encodeURIComponent(a)}`);t(Array.isArray(b)?b:[]),x(0)}catch{t([])}finally{v(!1)}},300)},[]),D=(0,e.useCallback)(a=>{let b=a.target.value;r(b),C(b)},[C]),E=(0,e.useCallback)(a=>{z.push(`/view/${(0,k.O0)(a.path)}`),b?.()},[z,b]),F=(0,e.useCallback)(a=>{"ArrowDown"===a.key?(a.preventDefault(),x(a=>Math.min(a+1,s.length-1))):"ArrowUp"===a.key?(a.preventDefault(),x(a=>Math.max(a-1,0))):"Enter"===a.key&&s[w]&&E(s[w])},[s,w,E]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.A,{title:"Search",maximized:c,onMaximize:p}),(0,d.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b border-border shrink-0",children:[(0,d.jsx)(g.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,d.jsx)("input",{ref:y,type:"text",value:q,onChange:D,onKeyDown:F,placeholder:B.search.placeholder,"aria-label":B.search.placeholder,className:"flex-1 bg-transparent text-foreground placeholder:text-muted-foreground text-sm outline-none"}),u&&(0,d.jsx)("div",{className:"w-3.5 h-3.5 border-2 border-muted-foreground/40 border-t-foreground rounded-full animate-spin shrink-0"}),!u&&q&&(0,d.jsx)("button",{onClick:()=>{r(""),t([]),y.current?.focus()},children:(0,d.jsx)(h.A,{size:13,className:"text-muted-foreground hover:text-foreground"})})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",role:"listbox","aria-label":"Search results",children:[0===s.length&&q&&!u&&(0,d.jsx)("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:B.search.noResults}),0===s.length&&!q&&(0,d.jsx)("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground/60",children:B.search.prompt}),s.length>0&&(0,d.jsx)(o.aY,{totalCount:s.length,overscan:100,itemContent:a=>{let b=s[a],c=b.path.endsWith(".csv")?".csv":".md",e=b.path.split("/"),f=e[e.length-1],g=e.slice(0,-1).join("/");return(0,d.jsxs)("button",{role:"option","aria-selected":a===w,onClick:()=>E(b),onMouseEnter:()=>x(a),className:`
215
215
  w-full px-4 py-2.5 flex items-start gap-3 text-left transition-colors duration-75
216
216
  ${a===w?"bg-muted":"hover:bg-muted/50"}
217
217
  ${a<s.length-1?"border-b border-border":""}