@geminilight/mindos-windows-arm64 1.0.4 → 1.0.6

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 (373) 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 +25 -25
  4. package/_standalone/__next/build-manifest.json +3 -3
  5. package/_standalone/__next/prerender-manifest.json +3 -3
  6. package/_standalone/__next/react-loadable-manifest.json +4 -4
  7. package/_standalone/__next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
  8. package/_standalone/__next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/_standalone/__next/server/app/_global-error.html +2 -2
  10. package/_standalone/__next/server/app/_global-error.rsc +1 -1
  11. package/_standalone/__next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/_standalone/__next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  13. package/_standalone/__next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  14. package/_standalone/__next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  15. package/_standalone/__next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  16. package/_standalone/__next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/_standalone/__next/server/app/_not-found/page.js +1 -1
  18. package/_standalone/__next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/_standalone/__next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/_standalone/__next/server/app/agents/[agentKey]/page.js +1 -1
  21. package/_standalone/__next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
  22. package/_standalone/__next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
  23. package/_standalone/__next/server/app/agents/page.js +1 -1
  24. package/_standalone/__next/server/app/agents/page.js.nft.json +1 -1
  25. package/_standalone/__next/server/app/agents/page_client-reference-manifest.js +1 -1
  26. package/_standalone/__next/server/app/api/a2a/agents/route.js +1 -1
  27. package/_standalone/__next/server/app/api/a2a/agents/route.js.nft.json +1 -1
  28. package/_standalone/__next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
  29. package/_standalone/__next/server/app/api/a2a/delegations/route.js +1 -1
  30. package/_standalone/__next/server/app/api/a2a/delegations/route.js.nft.json +1 -1
  31. package/_standalone/__next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
  32. package/_standalone/__next/server/app/api/a2a/discover/route.js +1 -1
  33. package/_standalone/__next/server/app/api/a2a/discover/route.js.nft.json +1 -1
  34. package/_standalone/__next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
  35. package/_standalone/__next/server/app/api/a2a/route.js +1 -1
  36. package/_standalone/__next/server/app/api/a2a/route.js.nft.json +1 -1
  37. package/_standalone/__next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
  38. package/_standalone/__next/server/app/api/acp/config/route.js +1 -1
  39. package/_standalone/__next/server/app/api/acp/config/route.js.nft.json +1 -1
  40. package/_standalone/__next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
  41. package/_standalone/__next/server/app/api/acp/detect/route.js +1 -1
  42. package/_standalone/__next/server/app/api/acp/detect/route.js.nft.json +1 -1
  43. package/_standalone/__next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
  44. package/_standalone/__next/server/app/api/acp/install/route.js +1 -1
  45. package/_standalone/__next/server/app/api/acp/install/route.js.nft.json +1 -1
  46. package/_standalone/__next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
  47. package/_standalone/__next/server/app/api/acp/registry/route.js +1 -1
  48. package/_standalone/__next/server/app/api/acp/registry/route.js.nft.json +1 -1
  49. package/_standalone/__next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
  50. package/_standalone/__next/server/app/api/acp/session/route.js +1 -1
  51. package/_standalone/__next/server/app/api/acp/session/route.js.nft.json +1 -1
  52. package/_standalone/__next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
  53. package/_standalone/__next/server/app/api/agent-activity/route.js +1 -1
  54. package/_standalone/__next/server/app/api/agent-activity/route.js.nft.json +1 -1
  55. package/_standalone/__next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
  56. package/_standalone/__next/server/app/api/agents/copy-skill/route.js +1 -1
  57. package/_standalone/__next/server/app/api/agents/copy-skill/route.js.nft.json +1 -1
  58. package/_standalone/__next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -1
  59. package/_standalone/__next/server/app/api/agents/custom/detect/route.js +1 -1
  60. package/_standalone/__next/server/app/api/agents/custom/detect/route.js.nft.json +1 -1
  61. package/_standalone/__next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
  62. package/_standalone/__next/server/app/api/agents/custom/route.js +1 -1
  63. package/_standalone/__next/server/app/api/agents/custom/route.js.nft.json +1 -1
  64. package/_standalone/__next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
  65. package/_standalone/__next/server/app/api/ask/route.js +1 -1
  66. package/_standalone/__next/server/app/api/ask/route.js.nft.json +1 -1
  67. package/_standalone/__next/server/app/api/ask/route_client-reference-manifest.js +1 -1
  68. package/_standalone/__next/server/app/api/ask-sessions/route.js +1 -1
  69. package/_standalone/__next/server/app/api/ask-sessions/route.js.nft.json +1 -1
  70. package/_standalone/__next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
  71. package/_standalone/__next/server/app/api/auth/route_client-reference-manifest.js +1 -1
  72. package/_standalone/__next/server/app/api/backlinks/route.js +1 -1
  73. package/_standalone/__next/server/app/api/backlinks/route.js.nft.json +1 -1
  74. package/_standalone/__next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
  75. package/_standalone/__next/server/app/api/bootstrap/route.js +1 -1
  76. package/_standalone/__next/server/app/api/bootstrap/route.js.nft.json +1 -1
  77. package/_standalone/__next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
  78. package/_standalone/__next/server/app/api/changes/route.js +1 -1
  79. package/_standalone/__next/server/app/api/changes/route.js.nft.json +1 -1
  80. package/_standalone/__next/server/app/api/changes/route_client-reference-manifest.js +1 -1
  81. package/_standalone/__next/server/app/api/channels/verify/route.js +1 -1
  82. package/_standalone/__next/server/app/api/channels/verify/route.js.nft.json +1 -1
  83. package/_standalone/__next/server/app/api/channels/verify/route_client-reference-manifest.js +1 -1
  84. package/_standalone/__next/server/app/api/connect/route.js +1 -1
  85. package/_standalone/__next/server/app/api/connect/route.js.nft.json +1 -1
  86. package/_standalone/__next/server/app/api/connect/route_client-reference-manifest.js +1 -1
  87. package/_standalone/__next/server/app/api/embedding/route.js +1 -1
  88. package/_standalone/__next/server/app/api/embedding/route.js.nft.json +1 -1
  89. package/_standalone/__next/server/app/api/embedding/route_client-reference-manifest.js +1 -1
  90. package/_standalone/__next/server/app/api/export/route.js +1 -1
  91. package/_standalone/__next/server/app/api/export/route.js.nft.json +1 -1
  92. package/_standalone/__next/server/app/api/export/route_client-reference-manifest.js +1 -1
  93. package/_standalone/__next/server/app/api/extract-docx/route_client-reference-manifest.js +1 -1
  94. package/_standalone/__next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
  95. package/_standalone/__next/server/app/api/file/import/route.js +1 -1
  96. package/_standalone/__next/server/app/api/file/import/route.js.nft.json +1 -1
  97. package/_standalone/__next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
  98. package/_standalone/__next/server/app/api/file/raw/route.js +1 -1
  99. package/_standalone/__next/server/app/api/file/raw/route.js.nft.json +1 -1
  100. package/_standalone/__next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
  101. package/_standalone/__next/server/app/api/file/route.js +1 -1
  102. package/_standalone/__next/server/app/api/file/route.js.nft.json +1 -1
  103. package/_standalone/__next/server/app/api/file/route_client-reference-manifest.js +1 -1
  104. package/_standalone/__next/server/app/api/files/route.js +1 -1
  105. package/_standalone/__next/server/app/api/files/route.js.nft.json +1 -1
  106. package/_standalone/__next/server/app/api/files/route_client-reference-manifest.js +1 -1
  107. package/_standalone/__next/server/app/api/git/route.js +1 -1
  108. package/_standalone/__next/server/app/api/git/route.js.nft.json +1 -1
  109. package/_standalone/__next/server/app/api/git/route_client-reference-manifest.js +1 -1
  110. package/_standalone/__next/server/app/api/graph/route.js +1 -1
  111. package/_standalone/__next/server/app/api/graph/route.js.nft.json +1 -1
  112. package/_standalone/__next/server/app/api/graph/route_client-reference-manifest.js +1 -1
  113. package/_standalone/__next/server/app/api/health/route.js +1 -1
  114. package/_standalone/__next/server/app/api/health/route.js.nft.json +1 -1
  115. package/_standalone/__next/server/app/api/health/route_client-reference-manifest.js +1 -1
  116. package/_standalone/__next/server/app/api/im/activity/route.js +1 -1
  117. package/_standalone/__next/server/app/api/im/activity/route.js.nft.json +1 -1
  118. package/_standalone/__next/server/app/api/im/activity/route_client-reference-manifest.js +1 -1
  119. package/_standalone/__next/server/app/api/im/config/route.js +1 -1
  120. package/_standalone/__next/server/app/api/im/config/route.js.nft.json +1 -1
  121. package/_standalone/__next/server/app/api/im/config/route_client-reference-manifest.js +1 -1
  122. package/_standalone/__next/server/app/api/im/feishu/long-connection/event/route.js +1 -1
  123. package/_standalone/__next/server/app/api/im/feishu/long-connection/event/route.js.nft.json +1 -1
  124. package/_standalone/__next/server/app/api/im/feishu/long-connection/event/route_client-reference-manifest.js +1 -1
  125. package/_standalone/__next/server/app/api/im/feishu/long-connection/route.js +1 -1
  126. package/_standalone/__next/server/app/api/im/feishu/long-connection/route.js.nft.json +1 -1
  127. package/_standalone/__next/server/app/api/im/feishu/long-connection/route_client-reference-manifest.js +1 -1
  128. package/_standalone/__next/server/app/api/im/status/route.js +1 -1
  129. package/_standalone/__next/server/app/api/im/status/route.js.nft.json +1 -1
  130. package/_standalone/__next/server/app/api/im/status/route_client-reference-manifest.js +1 -1
  131. package/_standalone/__next/server/app/api/im/test/route.js +1 -1
  132. package/_standalone/__next/server/app/api/im/test/route.js.nft.json +1 -1
  133. package/_standalone/__next/server/app/api/im/test/route_client-reference-manifest.js +1 -1
  134. package/_standalone/__next/server/app/api/im/webhook/feishu/route.js +1 -1
  135. package/_standalone/__next/server/app/api/im/webhook/feishu/route.js.nft.json +1 -1
  136. package/_standalone/__next/server/app/api/im/webhook/feishu/route_client-reference-manifest.js +1 -1
  137. package/_standalone/__next/server/app/api/im/webhook-status/route.js +1 -1
  138. package/_standalone/__next/server/app/api/im/webhook-status/route.js.nft.json +1 -1
  139. package/_standalone/__next/server/app/api/im/webhook-status/route_client-reference-manifest.js +1 -1
  140. package/_standalone/__next/server/app/api/inbox/clip/route.js +1 -1
  141. package/_standalone/__next/server/app/api/inbox/clip/route.js.nft.json +1 -1
  142. package/_standalone/__next/server/app/api/inbox/clip/route_client-reference-manifest.js +1 -1
  143. package/_standalone/__next/server/app/api/inbox/route.js +1 -1
  144. package/_standalone/__next/server/app/api/inbox/route.js.nft.json +1 -1
  145. package/_standalone/__next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
  146. package/_standalone/__next/server/app/api/init/route.js +1 -1
  147. package/_standalone/__next/server/app/api/init/route.js.nft.json +1 -1
  148. package/_standalone/__next/server/app/api/init/route_client-reference-manifest.js +1 -1
  149. package/_standalone/__next/server/app/api/lint/route.js +1 -1
  150. package/_standalone/__next/server/app/api/lint/route.js.nft.json +1 -1
  151. package/_standalone/__next/server/app/api/lint/route_client-reference-manifest.js +1 -1
  152. package/_standalone/__next/server/app/api/mcp/agents/route.js +1 -1
  153. package/_standalone/__next/server/app/api/mcp/agents/route.js.nft.json +1 -1
  154. package/_standalone/__next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
  155. package/_standalone/__next/server/app/api/mcp/direct-tools/route.js +1 -1
  156. package/_standalone/__next/server/app/api/mcp/direct-tools/route.js.nft.json +1 -1
  157. package/_standalone/__next/server/app/api/mcp/direct-tools/route_client-reference-manifest.js +1 -1
  158. package/_standalone/__next/server/app/api/mcp/install/route.js +1 -1
  159. package/_standalone/__next/server/app/api/mcp/install/route.js.nft.json +1 -1
  160. package/_standalone/__next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
  161. package/_standalone/__next/server/app/api/mcp/install-skill/route.js +1 -1
  162. package/_standalone/__next/server/app/api/mcp/install-skill/route.js.nft.json +1 -1
  163. package/_standalone/__next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
  164. package/_standalone/__next/server/app/api/mcp/restart/route.js +1 -1
  165. package/_standalone/__next/server/app/api/mcp/restart/route.js.nft.json +1 -1
  166. package/_standalone/__next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
  167. package/_standalone/__next/server/app/api/mcp/status/route.js +1 -1
  168. package/_standalone/__next/server/app/api/mcp/status/route.js.nft.json +1 -1
  169. package/_standalone/__next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
  170. package/_standalone/__next/server/app/api/mcp/tools/route.js +1 -1
  171. package/_standalone/__next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  172. package/_standalone/__next/server/app/api/mcp/tools/route_client-reference-manifest.js +1 -1
  173. package/_standalone/__next/server/app/api/mcp/uninstall/route.js +1 -1
  174. package/_standalone/__next/server/app/api/mcp/uninstall/route.js.nft.json +1 -1
  175. package/_standalone/__next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
  176. package/_standalone/__next/server/app/api/monitoring/route.js +1 -1
  177. package/_standalone/__next/server/app/api/monitoring/route.js.nft.json +1 -1
  178. package/_standalone/__next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
  179. package/_standalone/__next/server/app/api/obsidian/compat-report/route.js +1 -1
  180. package/_standalone/__next/server/app/api/obsidian/compat-report/route.js.nft.json +1 -1
  181. package/_standalone/__next/server/app/api/obsidian/compat-report/route_client-reference-manifest.js +1 -1
  182. package/_standalone/__next/server/app/api/obsidian/import/route.js +1 -1
  183. package/_standalone/__next/server/app/api/obsidian/import/route.js.nft.json +1 -1
  184. package/_standalone/__next/server/app/api/obsidian/import/route_client-reference-manifest.js +1 -1
  185. package/_standalone/__next/server/app/api/obsidian-plugins/settings/route.js +1 -1
  186. package/_standalone/__next/server/app/api/obsidian-plugins/settings/route.js.nft.json +1 -1
  187. package/_standalone/__next/server/app/api/obsidian-plugins/settings/route_client-reference-manifest.js +1 -1
  188. package/_standalone/__next/server/app/api/recent-files/route.js +1 -1
  189. package/_standalone/__next/server/app/api/recent-files/route.js.nft.json +1 -1
  190. package/_standalone/__next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
  191. package/_standalone/__next/server/app/api/restart/route.js +1 -1
  192. package/_standalone/__next/server/app/api/restart/route.js.nft.json +1 -1
  193. package/_standalone/__next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  194. package/_standalone/__next/server/app/api/search/prewarm/route.js +1 -1
  195. package/_standalone/__next/server/app/api/search/prewarm/route.js.nft.json +1 -1
  196. package/_standalone/__next/server/app/api/search/prewarm/route_client-reference-manifest.js +1 -1
  197. package/_standalone/__next/server/app/api/search/route.js +1 -1
  198. package/_standalone/__next/server/app/api/search/route.js.nft.json +1 -1
  199. package/_standalone/__next/server/app/api/search/route_client-reference-manifest.js +1 -1
  200. package/_standalone/__next/server/app/api/settings/list-models/route.js +1 -1
  201. package/_standalone/__next/server/app/api/settings/list-models/route.js.nft.json +1 -1
  202. package/_standalone/__next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
  203. package/_standalone/__next/server/app/api/settings/reset-token/route.js +1 -1
  204. package/_standalone/__next/server/app/api/settings/reset-token/route.js.nft.json +1 -1
  205. package/_standalone/__next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
  206. package/_standalone/__next/server/app/api/settings/route.js +1 -1
  207. package/_standalone/__next/server/app/api/settings/route.js.nft.json +1 -1
  208. package/_standalone/__next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  209. package/_standalone/__next/server/app/api/settings/test-key/route.js +1 -1
  210. package/_standalone/__next/server/app/api/settings/test-key/route.js.nft.json +1 -1
  211. package/_standalone/__next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
  212. package/_standalone/__next/server/app/api/setup/check-path/route.js +1 -1
  213. package/_standalone/__next/server/app/api/setup/check-path/route.js.nft.json +1 -1
  214. package/_standalone/__next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
  215. package/_standalone/__next/server/app/api/setup/check-port/route.js +1 -1
  216. package/_standalone/__next/server/app/api/setup/check-port/route.js.nft.json +1 -1
  217. package/_standalone/__next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
  218. package/_standalone/__next/server/app/api/setup/generate-token/route.js +1 -1
  219. package/_standalone/__next/server/app/api/setup/generate-token/route.js.nft.json +1 -1
  220. package/_standalone/__next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
  221. package/_standalone/__next/server/app/api/setup/ls/route.js +1 -1
  222. package/_standalone/__next/server/app/api/setup/ls/route.js.nft.json +1 -1
  223. package/_standalone/__next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
  224. package/_standalone/__next/server/app/api/setup/route.js +1 -1
  225. package/_standalone/__next/server/app/api/setup/route.js.nft.json +1 -1
  226. package/_standalone/__next/server/app/api/setup/route_client-reference-manifest.js +1 -1
  227. package/_standalone/__next/server/app/api/skills/route.js +1 -1
  228. package/_standalone/__next/server/app/api/skills/route.js.nft.json +1 -1
  229. package/_standalone/__next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  230. package/_standalone/__next/server/app/api/space-overview/route.js +1 -1
  231. package/_standalone/__next/server/app/api/space-overview/route.js.nft.json +1 -1
  232. package/_standalone/__next/server/app/api/space-overview/route_client-reference-manifest.js +1 -1
  233. package/_standalone/__next/server/app/api/sync/route.js +1 -1
  234. package/_standalone/__next/server/app/api/sync/route.js.nft.json +1 -1
  235. package/_standalone/__next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  236. package/_standalone/__next/server/app/api/tree-version/route.js +1 -1
  237. package/_standalone/__next/server/app/api/tree-version/route.js.nft.json +1 -1
  238. package/_standalone/__next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
  239. package/_standalone/__next/server/app/api/uninstall/route.js +1 -1
  240. package/_standalone/__next/server/app/api/uninstall/route.js.nft.json +1 -1
  241. package/_standalone/__next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
  242. package/_standalone/__next/server/app/api/update/route.js +1 -1
  243. package/_standalone/__next/server/app/api/update/route.js.nft.json +1 -1
  244. package/_standalone/__next/server/app/api/update/route_client-reference-manifest.js +1 -1
  245. package/_standalone/__next/server/app/api/update-check/route.js +1 -1
  246. package/_standalone/__next/server/app/api/update-check/route.js.nft.json +1 -1
  247. package/_standalone/__next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
  248. package/_standalone/__next/server/app/api/update-status/route.js +1 -1
  249. package/_standalone/__next/server/app/api/update-status/route.js.nft.json +1 -1
  250. package/_standalone/__next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
  251. package/_standalone/__next/server/app/api/workflows/route.js +1 -1
  252. package/_standalone/__next/server/app/api/workflows/route.js.nft.json +1 -1
  253. package/_standalone/__next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  254. package/_standalone/__next/server/app/capture/history/page.js +1 -1
  255. package/_standalone/__next/server/app/capture/history/page.js.nft.json +1 -1
  256. package/_standalone/__next/server/app/capture/history/page_client-reference-manifest.js +1 -1
  257. package/_standalone/__next/server/app/capture/page.js +1 -1
  258. package/_standalone/__next/server/app/capture/page.js.nft.json +1 -1
  259. package/_standalone/__next/server/app/capture/page_client-reference-manifest.js +1 -1
  260. package/_standalone/__next/server/app/changelog/page.js +1 -1
  261. package/_standalone/__next/server/app/changelog/page.js.nft.json +1 -1
  262. package/_standalone/__next/server/app/changelog/page_client-reference-manifest.js +1 -1
  263. package/_standalone/__next/server/app/changes/page.js +1 -1
  264. package/_standalone/__next/server/app/changes/page.js.nft.json +1 -1
  265. package/_standalone/__next/server/app/changes/page_client-reference-manifest.js +1 -1
  266. package/_standalone/__next/server/app/echo/[segment]/page.js +1 -1
  267. package/_standalone/__next/server/app/echo/[segment]/page.js.nft.json +1 -1
  268. package/_standalone/__next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
  269. package/_standalone/__next/server/app/echo/page.js +1 -1
  270. package/_standalone/__next/server/app/echo/page.js.nft.json +1 -1
  271. package/_standalone/__next/server/app/echo/page_client-reference-manifest.js +1 -1
  272. package/_standalone/__next/server/app/explore/page.js +1 -1
  273. package/_standalone/__next/server/app/explore/page.js.nft.json +1 -1
  274. package/_standalone/__next/server/app/explore/page_client-reference-manifest.js +1 -1
  275. package/_standalone/__next/server/app/help/page.js +1 -1
  276. package/_standalone/__next/server/app/help/page.js.nft.json +1 -1
  277. package/_standalone/__next/server/app/help/page_client-reference-manifest.js +1 -1
  278. package/_standalone/__next/server/app/inbox/history/page.js +1 -1
  279. package/_standalone/__next/server/app/inbox/history/page.js.nft.json +1 -1
  280. package/_standalone/__next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
  281. package/_standalone/__next/server/app/login/page.js +1 -1
  282. package/_standalone/__next/server/app/login/page.js.nft.json +1 -1
  283. package/_standalone/__next/server/app/login/page_client-reference-manifest.js +1 -1
  284. package/_standalone/__next/server/app/page.js +1 -1
  285. package/_standalone/__next/server/app/page.js.nft.json +1 -1
  286. package/_standalone/__next/server/app/page_client-reference-manifest.js +1 -1
  287. package/_standalone/__next/server/app/settings/page.js +2 -2
  288. package/_standalone/__next/server/app/settings/page.js.nft.json +1 -1
  289. package/_standalone/__next/server/app/settings/page_client-reference-manifest.js +1 -1
  290. package/_standalone/__next/server/app/setup/page.js +1 -1
  291. package/_standalone/__next/server/app/setup/page.js.nft.json +1 -1
  292. package/_standalone/__next/server/app/setup/page_client-reference-manifest.js +1 -1
  293. package/_standalone/__next/server/app/todo/page.js +1 -1
  294. package/_standalone/__next/server/app/todo/page.js.nft.json +1 -1
  295. package/_standalone/__next/server/app/todo/page_client-reference-manifest.js +1 -1
  296. package/_standalone/__next/server/app/trash/page.js +2 -2
  297. package/_standalone/__next/server/app/trash/page.js.nft.json +1 -1
  298. package/_standalone/__next/server/app/trash/page_client-reference-manifest.js +1 -1
  299. package/_standalone/__next/server/app/view/[...path]/page.js +3 -3
  300. package/_standalone/__next/server/app/view/[...path]/page.js.nft.json +1 -1
  301. package/_standalone/__next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
  302. package/_standalone/__next/server/app/wiki/page.js +1 -1
  303. package/_standalone/__next/server/app/wiki/page.js.nft.json +1 -1
  304. package/_standalone/__next/server/app/wiki/page_client-reference-manifest.js +1 -1
  305. package/_standalone/__next/server/app-paths-manifest.json +25 -25
  306. package/_standalone/__next/server/chunks/1976.js +3 -3
  307. package/_standalone/__next/server/chunks/{49.js → 3219.js} +5 -5
  308. package/_standalone/__next/server/chunks/3566.js +1 -1
  309. package/_standalone/__next/server/chunks/6602.js +37 -37
  310. package/_standalone/__next/server/chunks/6754.js +1 -1
  311. package/_standalone/__next/server/chunks/6965.js +3 -3
  312. package/_standalone/__next/server/chunks/7765.js +1 -1
  313. package/_standalone/__next/server/chunks/8028.js +1 -1
  314. package/_standalone/__next/server/chunks/{7295.js → 8461.js} +19 -19
  315. package/_standalone/__next/server/middleware-build-manifest.js +1 -1
  316. package/_standalone/__next/server/middleware-react-loadable-manifest.js +1 -1
  317. package/_standalone/__next/server/pages/500.html +2 -2
  318. package/_standalone/__next/server/server-reference-manifest.js +1 -1
  319. package/_standalone/__next/server/server-reference-manifest.json +1 -1
  320. package/_standalone/__next/static/chunks/{1430-a3447cf370715cad.js → 1430-c4ffa328888515c1.js} +1 -1
  321. package/{static-web/_next/static/chunks/2992-509ffe91c9d819fe.js → _standalone/__next/static/chunks/2461-a1073a0bd04c228a.js} +12 -12
  322. package/_standalone/__next/static/chunks/{862-ad4c9d6035101858.js → 47-41e1a06e6d389b69.js} +1 -1
  323. package/_standalone/__next/static/chunks/{5200-2447cea5eb41a922.js → 5200-6c82e5ce54a95b4b.js} +2 -2
  324. package/_standalone/__next/static/chunks/{6947.5f1325c9403c27b2.js → 6947.7e50e18da7dc4aef.js} +1 -1
  325. package/_standalone/__next/static/chunks/9216.d3339c27169b21bf.js +1 -0
  326. package/{static-web/_next/static/chunks/app/layout-14395cc1f39f1847.js → _standalone/__next/static/chunks/app/layout-5966cd317bbed698.js} +6 -6
  327. package/_standalone/__next/static/chunks/app/settings/{page-2786e9eb5103d6f3.js → page-c9f44b3447a41431.js} +1 -1
  328. package/_standalone/__next/static/chunks/app/trash/page-d87207a63591ee16.js +1 -0
  329. package/_standalone/__next/static/chunks/app/view/[...path]/page-1898f4ae4ab28db0.js +12 -0
  330. package/_standalone/__next/static/chunks/{webpack-44b6c35a50fd7205.js → webpack-75abef9cbb1ea912.js} +1 -1
  331. package/dist/server/handlers/mcp-agents.d.ts +1 -0
  332. package/dist/server/handlers/mcp-agents.d.ts.map +1 -1
  333. package/dist/server/handlers/mcp-agents.js +230 -7
  334. package/dist/server/handlers/mcp-agents.js.map +1 -1
  335. package/dist/server/http.d.ts +7 -4
  336. package/dist/server/http.d.ts.map +1 -1
  337. package/dist/server/http.js +2 -0
  338. package/dist/server/http.js.map +1 -1
  339. package/dist/server/mcp-agent-registry.d.ts +4 -0
  340. package/dist/server/mcp-agent-registry.d.ts.map +1 -0
  341. package/dist/server/mcp-agent-registry.js +266 -0
  342. package/dist/server/mcp-agent-registry.js.map +1 -0
  343. package/package.json +1 -1
  344. package/runtime-manifest.json +1 -1
  345. package/scripts/smoke-desktop-app.mjs +82 -8
  346. package/scripts/verify-desktop-runtime.mjs +2 -1
  347. package/static-web/.mindos-build-version +1 -1
  348. package/static-web/_next/static/chunks/{1430-a3447cf370715cad.js → 1430-c4ffa328888515c1.js} +1 -1
  349. package/{_standalone/__next/static/chunks/2992-509ffe91c9d819fe.js → static-web/_next/static/chunks/2461-a1073a0bd04c228a.js} +12 -12
  350. package/static-web/_next/static/chunks/{862-ad4c9d6035101858.js → 47-41e1a06e6d389b69.js} +1 -1
  351. package/static-web/_next/static/chunks/{5200-2447cea5eb41a922.js → 5200-6c82e5ce54a95b4b.js} +2 -2
  352. package/static-web/_next/static/chunks/{6947.5f1325c9403c27b2.js → 6947.7e50e18da7dc4aef.js} +1 -1
  353. package/static-web/_next/static/chunks/9216.d3339c27169b21bf.js +1 -0
  354. package/{_standalone/__next/static/chunks/app/layout-14395cc1f39f1847.js → static-web/_next/static/chunks/app/layout-5966cd317bbed698.js} +6 -6
  355. package/static-web/_next/static/chunks/app/settings/{page-2786e9eb5103d6f3.js → page-c9f44b3447a41431.js} +1 -1
  356. package/static-web/_next/static/chunks/app/trash/page-d87207a63591ee16.js +1 -0
  357. package/static-web/_next/static/chunks/app/view/[...path]/page-1898f4ae4ab28db0.js +12 -0
  358. package/static-web/_next/static/chunks/{webpack-44b6c35a50fd7205.js → webpack-75abef9cbb1ea912.js} +1 -1
  359. package/static-web/help/index.html +3 -3
  360. package/static-web/index.html +3 -3
  361. package/static-web/setup/index.html +3 -3
  362. package/static-web/static-web-manifest.json +1 -1
  363. package/static-web/wiki/index.html +3 -3
  364. package/_standalone/__next/static/chunks/32.c0cfe8b9737e00f0.js +0 -1
  365. package/_standalone/__next/static/chunks/app/trash/page-98300a315c5d021a.js +0 -1
  366. package/_standalone/__next/static/chunks/app/view/[...path]/page-44010b2aff77acd6.js +0 -12
  367. package/static-web/_next/static/chunks/32.c0cfe8b9737e00f0.js +0 -1
  368. package/static-web/_next/static/chunks/app/trash/page-98300a315c5d021a.js +0 -1
  369. package/static-web/_next/static/chunks/app/view/[...path]/page-44010b2aff77acd6.js +0 -12
  370. /package/_standalone/__next/static/{Zq7WEkb-0jkSRDtJcWLrD → J9M4pgRyRHH7Ofbxuuklh}/_buildManifest.js +0 -0
  371. /package/_standalone/__next/static/{Zq7WEkb-0jkSRDtJcWLrD → J9M4pgRyRHH7Ofbxuuklh}/_ssgManifest.js +0 -0
  372. /package/static-web/_next/static/{Zq7WEkb-0jkSRDtJcWLrD → J9M4pgRyRHH7Ofbxuuklh}/_buildManifest.js +0 -0
  373. /package/static-web/_next/static/{Zq7WEkb-0jkSRDtJcWLrD → J9M4pgRyRHH7Ofbxuuklh}/_ssgManifest.js +0 -0
@@ -3,12 +3,12 @@ exports.id=6602,exports.ids=[6602],exports.modules={23:(a,b,c)=>{"use strict";c.
3
3
  border-b border-border/50
4
4
  ${h?"bg-[var(--amber-dim)] border-l-2 border-[var(--amber)]":"border-l-2 border-transparent"}
5
5
  ${l?"bg-muted/70":h?"":"hover:bg-muted/60"}
6
- `,children:[(0,d.jsx)("div",{className:"shrink-0 flex-none mt-0.5",children:".csv"===e?(0,d.jsx)(i.A,{size:14,className:"text-success"}):(0,d.jsx)(j.A,{size:14,className:"text-muted-foreground"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground truncate",title:f,children:f}),g.length>0&&(0,d.jsx)("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-muted-foreground/70 truncate",children:g.map((a,b)=>(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[b>0&&(0,d.jsx)(k.A,{size:10,className:"shrink-0 flex-none"}),(0,d.jsx)("span",{className:"truncate",children:a})]},b))}),c.snippet&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 leading-relaxed",title:c.snippet,children:function(a,b){if(!b.trim())return a;let c=b.trim().split(/\s+/).filter(Boolean).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),e=RegExp(`(${c.join("|")})`,"gi");return a.split(e).map((a,b)=>e.test(a)?(0,d.jsx)("mark",{className:"bg-[var(--amber)]/25 text-foreground rounded-sm px-0.5",children:a},b):a)}(c.snippet,s)})]}),h&&!l&&(0,d.jsx)("div",{className:"shrink-0 flex-none text-[10px] text-muted-foreground/50 font-mono pt-0.5",children:"⬆ Drag"})]})}})]}),u.length>0&&(H||L)&&(0,d.jsxs)("div",{className:"border-t border-border shrink-0 max-h-[30%] overflow-y-auto",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-muted-foreground border-b border-border/50 sticky top-0 bg-card z-10",children:[(0,d.jsx)(l.A,{size:12,className:"shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:J??""})]}),L&&!H?(0,d.jsxs)("div",{className:"px-3 py-4 space-y-2 animate-pulse",children:[(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-full"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-5/6"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-4/6"})]}):H?(0,d.jsxs)("pre",{className:"px-3 py-2 text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap break-words font-sans",children:[H,H.length>=2e3&&(0,d.jsx)("span",{className:"text-muted-foreground/40",children:" …"})]}):null]}),u.length>0&&(0,d.jsxs)("div",{className:"px-3 py-2 border-t border-border/50 flex items-center gap-2 text-xs text-muted-foreground/60 shrink-0",children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"↑↓"})," ",F.search.navigate]}),(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"↵"})," ",F.search.open]}),(0,d.jsx)("span",{className:"text-muted-foreground/40 mx-0.5",children:"•"}),(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"Drag"})," ",F.search.dragToChat]})]})]})}},3712:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ny:()=>h,lh:()=>i,mV:()=>g});var e=c(22222),f=a([e]);function g(){return"p_"+Math.random().toString(36).slice(2,10)}function h(a){return"string"==typeof a&&a.startsWith("p_")}function i(a,b){return a.find(a=>a.id===b)}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},4137:(a,b,c)=>{"use strict";function d(a,b,c){let d,e,f;if("stdio"===c){var g,h;let b={type:"stdio",command:"mindos",args:["mcp"]};if("toml"===a.format){let b=`[${a.configKey}.mindos]
6
+ `,children:[(0,d.jsx)("div",{className:"shrink-0 flex-none mt-0.5",children:".csv"===e?(0,d.jsx)(i.A,{size:14,className:"text-success"}):(0,d.jsx)(j.A,{size:14,className:"text-muted-foreground"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-sm font-semibold text-foreground truncate",title:f,children:f}),g.length>0&&(0,d.jsx)("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-muted-foreground/70 truncate",children:g.map((a,b)=>(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[b>0&&(0,d.jsx)(k.A,{size:10,className:"shrink-0 flex-none"}),(0,d.jsx)("span",{className:"truncate",children:a})]},b))}),c.snippet&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 leading-relaxed",title:c.snippet,children:function(a,b){if(!b.trim())return a;let c=b.trim().split(/\s+/).filter(Boolean).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),e=RegExp(`(${c.join("|")})`,"gi");return a.split(e).map((a,b)=>e.test(a)?(0,d.jsx)("mark",{className:"bg-[var(--amber)]/25 text-foreground rounded-sm px-0.5",children:a},b):a)}(c.snippet,s)})]}),h&&!l&&(0,d.jsx)("div",{className:"shrink-0 flex-none text-[10px] text-muted-foreground/50 font-mono pt-0.5",children:"⬆ Drag"})]})}})]}),u.length>0&&(H||L)&&(0,d.jsxs)("div",{className:"border-t border-border shrink-0 max-h-[30%] overflow-y-auto",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-muted-foreground border-b border-border/50 sticky top-0 bg-card z-10",children:[(0,d.jsx)(l.A,{size:12,className:"shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:J??""})]}),L&&!H?(0,d.jsxs)("div",{className:"px-3 py-4 space-y-2 animate-pulse",children:[(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-full"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-5/6"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-4/6"})]}):H?(0,d.jsxs)("pre",{className:"px-3 py-2 text-xs text-muted-foreground leading-relaxed whitespace-pre-wrap break-words font-sans",children:[H,H.length>=2e3&&(0,d.jsx)("span",{className:"text-muted-foreground/40",children:" …"})]}):null]}),u.length>0&&(0,d.jsxs)("div",{className:"px-3 py-2 border-t border-border/50 flex items-center gap-2 text-xs text-muted-foreground/60 shrink-0",children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"↑↓"})," ",F.search.navigate]}),(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"↵"})," ",F.search.open]}),(0,d.jsx)("span",{className:"text-muted-foreground/40 mx-0.5",children:"•"}),(0,d.jsxs)("span",{children:[(0,d.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"Drag"})," ",F.search.dragToChat]})]})]})}},3712:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Ny:()=>h,lh:()=>i,mV:()=>g});var e=c(22222),f=a([e]);function g(){return"p_"+Math.random().toString(36).slice(2,10)}function h(a){return"string"==typeof a&&a.startsWith("p_")}function i(a,b){return a.find(a=>a.id===b)}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},4137:(a,b,c)=>{"use strict";function d(a){return JSON.stringify(String(a))}function e(a){return/^[A-Za-z0-9_-]+$/.test(a)?a:d(a)}function f(a,b){let c=a.split(".").map(a=>a.trim()).filter(Boolean),d={},e=d;for(let a of c)e[a]={},e=e[a];return Object.assign(e,b),d}function g(a,b){let c=[`${e(a)}:`," mindos:"];if(b.type&&c.push(` type: ${d(b.type)}`),b.command&&c.push(` command: ${d(b.command)}`),b.url&&c.push(` url: ${d(b.url)}`),Array.isArray(b.args)&&c.push(` args: [${b.args.map(d).join(", ")}]`),b.env&&"object"==typeof b.env)for(let[a,f]of(c.push(" env:"),Object.entries(b.env)))c.push(` ${e(a)}: ${d(f)}`);if(b.headers&&"object"==typeof b.headers)for(let[a,f]of(c.push(" headers:"),Object.entries(b.headers)))c.push(` ${e(a)}: ${d(f)}`);return c.join("\n")}function h(a,b,c){var d,e;let h,i,j;if("stdio"===c)return function(a){let b={type:"stdio",command:"mindos",args:["mcp"],env:{MCP_TRANSPORT:"stdio"}};if("toml"===a.format){let b=`[${a.configKey}.mindos]
7
7
  command = "mindos"
8
8
  args = ["mcp"]
9
9
 
10
10
  [${a.configKey}.mindos.env]
11
- MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if(a.globalNestedKey){let c=JSON.stringify({[a.configKey]:{mindos:b}},null,2);return{snippet:c,displaySnippet:c,path:a.projectPath??a.globalPath}}let c=JSON.stringify({[a.configKey]:{mindos:b}},null,2);return{snippet:c,displaySnippet:c,path:a.globalPath}}let i=b?.localIP?`http://${b.localIP}:${b.port}/mcp`:b?.endpoint??"http://127.0.0.1:8781/mcp";return g=b?.authToken,h=b?.maskedToken,d={url:i},g&&(d.headers={Authorization:`Bearer ${g}`}),e={url:i},h&&(e.headers={Authorization:`Bearer ${h}`}),{snippet:(f=b=>{if("toml"===a.format){let c=[`[${a.configKey}.mindos]`,'type = "http"',`url = "${i}"`],d=b.headers?.Authorization;return d&&(c.push(""),c.push(`[${a.configKey}.mindos.headers]`),c.push(`Authorization = "${d}"`)),c.join("\n")}return a.globalNestedKey,JSON.stringify({[a.configKey]:{mindos:b}},null,2)})(d),displaySnippet:f(g?e:d),path:"toml"===a.format?a.globalPath:a.globalNestedKey?a.projectPath??a.globalPath:a.globalPath}}c.d(b,{$k:()=>d})},5075:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>Q});var e=c(72269),f=c(78520),g=c(35959),h=c(23104),i=c.n(h),j=c(15850),k=c(35205),l=c(26356),m=c(55433),n=c(31448),o=c(67395),p=c(89162),q=c(41761),r=c(74808),s=c(3236),t=c(85892),u=c(40192),v=c(17641),w=c(45057),x=c(60756),y=c(83761),z=c(47375),A=c(87473),B=c(53541),C=c(10742),D=c(10131),E=c(8257),F=c(69599),G=c(33659),H=c(24249),I=c(19966),J=c(97938),K=c(91030);c(29335);var L=c(26161),M=c(31271),N=c(90245);c(74569);var O=c(51522),P=a([x,M]);[x,M]=P.then?(await P)():P;let R=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./SearchModal"]},ssr:!1}),S=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./AskModal"]},ssr:!1}),T=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./SettingsModal"]},ssr:!1}),U=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./CreateSpaceModal"]},ssr:!1}),V=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./ImportModal"]},ssr:!1}),W=()=>{};function Q({fileTree:a,children:b}){let c=(0,L.b)(),d=(0,M.$)(),[h,I]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(void 0),[X,Y]=(0,f.useState)(!1),[Z,$]=(0,f.useState)(null),[_,aa]=(0,f.useState)(null),[ab,ac]=(0,f.useState)(()=>y.wl),ad=(0,N.dB)(),[ae,af]=(0,f.useState)(!1),[ag,ah]=(0,f.useState)(0),ai=(0,f.useCallback)(()=>{af(!1),"organizing"!==ad.phase||ad.abort(),ad.reset()},[ad]),aj=(0,f.useCallback)(()=>{ah(a=>a+1),window.dispatchEvent(new Event("mindos:organize-history-update"))},[]),[ak,al]=(0,f.useState)(!1),[am,an]=(0,f.useState)(void 0),[ao,ap]=(0,f.useState)(void 0),[aq,ar]=(0,f.useState)(!1),as=(0,f.useRef)(0),at=(0,f.useCallback)(a=>{an(a),ap(void 0),al(!0)},[]),au=(0,f.useCallback)(()=>{al(!1),an(void 0),ap(void 0)},[]),[av,aw]=(0,f.useState)(!1),[ax,ay]=(0,f.useState)(!1),[az,aA]=(0,f.useState)(!1),{t:aB}=(0,G.Y)(),aC=(0,g.useRouter)(),aD=(0,g.usePathname)(),aE=(0,f.useMemo)(()=>{let b=H.Y.startTimer("sidebar.collect_dir_paths"),c=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);return b({nodeCount:a.length,pathCount:c.length}),c},[a]),{status:aF,fetchStatus:aG}=(0,F.dW)(),aH=aD.startsWith("/view/")?aD.slice(6).split("/").map(decodeURIComponent).join("/"):void 0,aI=(0,f.useCallback)(()=>{d.askMaximized&&d.toggleAskMaximized()},[d.askMaximized,d.toggleAskMaximized]),aJ=aD?.startsWith("/agents"),aK=c.activePanel??(aJ?"agents":null);(0,f.useRef)([]);let aL=(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]),aM=(0,f.useCallback)(a=>{ac(a);try{localStorage.setItem("right-agent-detail-panel-width",String(a))}catch{}},[]),aN=(0,f.useCallback)(()=>aa(null),[]),aO=null!==_&&"agents"===c.activePanel,aP=(0,f.useCallback)(()=>{Q("sync"),Y(!1),I(!0)},[]),aQ=(0,f.useCallback)(()=>{I(!0),Q(void 0)},[]),aR=(0,f.useCallback)(()=>{I(!1),Q(void 0)},[]),aS=(0,f.useCallback)(a=>{$(a),Y(a=>!a)},[]),aT=(0,f.useCallback)(a=>{c.handleExpandedChange(a),Y(!1)},[c]),aU=(0,f.useCallback)(()=>aw(!1),[]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(J.A,{}),(0,e.jsx)(K.A,{}),(0,e.jsx)("a",{href:"#main-content",className:"sr-only focus-visible:not-sr-only focus-visible:fixed focus-visible:top-2 focus-visible:left-2 focus-visible:z-[60] focus-visible:px-4 focus-visible:py-2 focus-visible:rounded-lg focus-visible:text-sm focus-visible:font-medium bg-[var(--amber)] text-[var(--amber-foreground)]",children:"Skip to main content"}),(0,e.jsx)(o.Ay,{activePanel:aK,onPanelChange:c.setActivePanel,onEchoClick:()=>{aI();let a="echo"===c.activePanel,b=aD?.startsWith("/echo");a?b?c.setActivePanel(null):aC.push("/echo/about-you"):(c.setActivePanel("echo"),aC.push("/echo/about-you"))},onAgentsClick:()=>{aI();let a="agents"===c.activePanel,b=aD?.startsWith("/agents");a?b?c.setActivePanel(null):aC.push("/agents"):(c.setActivePanel("agents"),aC.push("/agents")),aa(null)},onDiscoverClick:()=>{aI();let a="discover"===c.activePanel,b=aD?.startsWith("/explore");a?b?c.setActivePanel(null):aC.push("/explore"):(c.setActivePanel("discover"),aC.push("/explore"))},onSpacesClick:()=>{aI();let a="/"===aD,b="files"===c.activePanel,d="/wiki"===aD||aD?.startsWith("/view/")||aD?.startsWith("/wiki/");a||!b?(c.setActivePanel("files"),aC.push("/wiki")):d?c.setActivePanel(null):aC.push("/wiki")},syncStatus:aF,expanded:c.railExpanded,onExpandedChange:aT,onSettingsClick:aQ,onSyncClick:aS}),(0,e.jsxs)(p.Ay,{activePanel:c.activePanel,fileTree:a,onNavigate:W,onOpenSyncSettings:aP,railWidth:c.railWidth,panelWidth:c.panelWidth??void 0,onWidthChange:c.handlePanelWidthChange,onWidthCommit:c.handlePanelWidthCommit,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,onImport:at,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.Ay,{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:aO?_: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:aH,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aL,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:aO,agentKey:_,onClose:aN,rightOffset:d.askPanelOpen?d.askPanelWidth:0,width:ab,onWidthChange:ac,onWidthCommit:aM}),(0,e.jsx)(S,{open:d.desktopAskPopupOpen,onClose:d.closeDesktopAskPopup,currentFile:aH,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aL,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch}),(0,e.jsx)(z.A,{onToggle:d.toggleAskPanel,askPanelOpen:d.askPanelOpen||d.desktopAskPopupOpen}),(0,e.jsx)(B.A,{}),(0,e.jsx)(T,{open:h,onClose:aR,initialTab:P}),(0,e.jsx)(A.A,{open:X,onClose:()=>Y(!1),anchorRect:Z,railWidth:c.railWidth,onOpenSyncSettings:aP,syncStatus:aF,onSyncStatusRefresh:aG}),(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:()=>aw(!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:aP,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)(F.jc,{status:aF})}),(0,e.jsx)("button",{onClick:()=>ay(!0),className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":aB.sidebar.searchTitle,children:(0,e.jsx)(k.A,{size:20})}),(0,e.jsx)("button",{onClick:()=>{I(!0),Q(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":aB.sidebar.settingsTitle,children:(0,e.jsx)(l.A,{size:20})})]})]}),av&&(0,e.jsx)("div",{className:"md:hidden fixed inset-0 z-40 overlay-backdrop",onClick:()=>aw(!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 ${av?"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:()=>aw(!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,onImport:at})})]}),(0,e.jsx)(R,{open:ax,onClose:()=>ay(!1)}),(0,e.jsx)(S,{open:az,onClose:()=>aA(!1),currentFile:aH}),(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(),as.current++,1===as.current&&ar(!0))},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&a.preventDefault()},onDragLeave:()=>{as.current=Math.max(0,as.current-1),0===as.current&&ar(!1)},onDrop:a=>{a.preventDefault(),as.current=0,ar(!1),a.dataTransfer.files.length>0&&!ak&&(0,O.QL)(Array.from(a.dataTransfer.files),aB)},children:[(0,e.jsxs)("div",{className:"min-h-screen bg-background",style:{overflowX:"clip"},children:[(0,e.jsx)(C.A,{}),b]}),(0,e.jsx)(D.A,{}),(0,e.jsx)(U,{t:aB,dirPaths:aE}),aq&&!ak&&(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:aB.inbox.dropOverlay}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:aB.inbox.dropOverlayFormats})]})})]}),(0,e.jsx)(V,{open:ak,onClose:au,defaultSpace:am,initialFiles:ao,aiOrganize:ad,dirPaths:aE}),ae&&(0,e.jsx)(E.A,{aiOrganize:ad,onDismiss:ai,onCancel:()=>{ad.abort(),ad.reset(),af(!1)},onHistoryUpdate:aj}),(0,e.jsx)("style",{children:`
11
+ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if("yaml"===a.format){let c=g(a.configKey,b);return{snippet:c,displaySnippet:c,path:a.globalPath}}if(a.globalNestedKey){let c=JSON.stringify(f(a.globalNestedKey,{mindos:b}),null,2);return{snippet:c,displaySnippet:c,path:a.globalPath}}let c=JSON.stringify({[a.configKey]:{mindos:b}},null,2);return{snippet:c,displaySnippet:c,path:a.globalPath}}(a);let k=b?.localIP?`http://${b.localIP}:${b.port}/mcp`:b?.endpoint??"http://127.0.0.1:8781/mcp";return d=b?.authToken,e=b?.maskedToken,h={url:k},d&&(h.headers={Authorization:`Bearer ${d}`}),i={url:k},e&&(i.headers={Authorization:`Bearer ${e}`}),{snippet:(j=b=>{if("toml"===a.format){let c=[`[${a.configKey}.mindos]`,'type = "http"',`url = "${k}"`],d=b.headers?.Authorization;return d&&(c.push(""),c.push(`[${a.configKey}.mindos.headers]`),c.push(`Authorization = "${d}"`)),c.join("\n")}return"yaml"===a.format?g(a.configKey,b):a.globalNestedKey?JSON.stringify(f(a.globalNestedKey,{mindos:b}),null,2):JSON.stringify({[a.configKey]:{mindos:b}},null,2)})(h),displaySnippet:j(d?i:h),path:(a.format,a.globalPath)}}c.d(b,{$k:()=>h})},5075:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>Q});var e=c(72269),f=c(78520),g=c(35959),h=c(23104),i=c.n(h),j=c(15850),k=c(35205),l=c(26356),m=c(55433),n=c(31448),o=c(67395),p=c(42807),q=c(80676),r=c(74808),s=c(3236),t=c(85892),u=c(40192),v=c(17641),w=c(45057),x=c(60756),y=c(83761),z=c(47375),A=c(87473),B=c(53541),C=c(10742),D=c(43506),E=c(8257),F=c(69599),G=c(33659),H=c(24249),I=c(19966),J=c(97938),K=c(91030);c(29335);var L=c(26161),M=c(31271),N=c(90245);c(74569);var O=c(51522),P=a([x,M]);[x,M]=P.then?(await P)():P;let R=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./SearchModal"]},ssr:!1}),S=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./AskModal"]},ssr:!1}),T=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./SettingsModal"]},ssr:!1}),U=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./CreateSpaceModal"]},ssr:!1}),V=(0,I.default)(async()=>{},{loadableGenerated:{modules:["components/SidebarLayout.tsx -> ./ImportModal"]},ssr:!1}),W=()=>{};function Q({fileTree:a,children:b}){let c=(0,L.b)(),d=(0,M.$)(),[h,I]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(void 0),[X,Y]=(0,f.useState)(!1),[Z,$]=(0,f.useState)(null),[_,aa]=(0,f.useState)(null),[ab,ac]=(0,f.useState)(()=>y.wl),ad=(0,N.dB)(),[ae,af]=(0,f.useState)(!1),[ag,ah]=(0,f.useState)(0),ai=(0,f.useCallback)(()=>{af(!1),"organizing"!==ad.phase||ad.abort(),ad.reset()},[ad]),aj=(0,f.useCallback)(()=>{ah(a=>a+1),window.dispatchEvent(new Event("mindos:organize-history-update"))},[]),[ak,al]=(0,f.useState)(!1),[am,an]=(0,f.useState)(void 0),[ao,ap]=(0,f.useState)(void 0),[aq,ar]=(0,f.useState)(!1),as=(0,f.useRef)(0),at=(0,f.useCallback)(a=>{an(a),ap(void 0),al(!0)},[]),au=(0,f.useCallback)(()=>{al(!1),an(void 0),ap(void 0)},[]),[av,aw]=(0,f.useState)(!1),[ax,ay]=(0,f.useState)(!1),[az,aA]=(0,f.useState)(!1),{t:aB}=(0,G.Y)(),aC=(0,g.useRouter)(),aD=(0,g.usePathname)(),aE=(0,f.useMemo)(()=>{let b=H.Y.startTimer("sidebar.collect_dir_paths"),c=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);return b({nodeCount:a.length,pathCount:c.length}),c},[a]),{status:aF,fetchStatus:aG}=(0,F.dW)(),aH=aD.startsWith("/view/")?aD.slice(6).split("/").map(decodeURIComponent).join("/"):void 0,aI=(0,f.useCallback)(()=>{d.askMaximized&&d.toggleAskMaximized()},[d.askMaximized,d.toggleAskMaximized]),aJ=aD?.startsWith("/agents"),aK=c.activePanel??(aJ?"agents":null);(0,f.useRef)([]);let aL=(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]),aM=(0,f.useCallback)(a=>{ac(a);try{localStorage.setItem("right-agent-detail-panel-width",String(a))}catch{}},[]),aN=(0,f.useCallback)(()=>aa(null),[]),aO=null!==_&&"agents"===c.activePanel,aP=(0,f.useCallback)(()=>{Q("sync"),Y(!1),I(!0)},[]),aQ=(0,f.useCallback)(()=>{I(!0),Q(void 0)},[]),aR=(0,f.useCallback)(()=>{I(!1),Q(void 0)},[]),aS=(0,f.useCallback)(a=>{$(a),Y(a=>!a)},[]),aT=(0,f.useCallback)(a=>{c.handleExpandedChange(a),Y(!1)},[c]),aU=(0,f.useCallback)(()=>aw(!1),[]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(J.A,{}),(0,e.jsx)(K.A,{}),(0,e.jsx)("a",{href:"#main-content",className:"sr-only focus-visible:not-sr-only focus-visible:fixed focus-visible:top-2 focus-visible:left-2 focus-visible:z-[60] focus-visible:px-4 focus-visible:py-2 focus-visible:rounded-lg focus-visible:text-sm focus-visible:font-medium bg-[var(--amber)] text-[var(--amber-foreground)]",children:"Skip to main content"}),(0,e.jsx)(o.Ay,{activePanel:aK,onPanelChange:c.setActivePanel,onEchoClick:()=>{aI();let a="echo"===c.activePanel,b=aD?.startsWith("/echo");a?b?c.setActivePanel(null):aC.push("/echo/about-you"):(c.setActivePanel("echo"),aC.push("/echo/about-you"))},onAgentsClick:()=>{aI();let a="agents"===c.activePanel,b=aD?.startsWith("/agents");a?b?c.setActivePanel(null):aC.push("/agents"):(c.setActivePanel("agents"),aC.push("/agents")),aa(null)},onDiscoverClick:()=>{aI();let a="discover"===c.activePanel,b=aD?.startsWith("/explore");a?b?c.setActivePanel(null):aC.push("/explore"):(c.setActivePanel("discover"),aC.push("/explore"))},onSpacesClick:()=>{aI();let a="/"===aD,b="files"===c.activePanel,d="/wiki"===aD||aD?.startsWith("/view/")||aD?.startsWith("/wiki/");a||!b?(c.setActivePanel("files"),aC.push("/wiki")):d?c.setActivePanel(null):aC.push("/wiki")},syncStatus:aF,expanded:c.railExpanded,onExpandedChange:aT,onSettingsClick:aQ,onSyncClick:aS}),(0,e.jsxs)(p.Ay,{activePanel:c.activePanel,fileTree:a,onNavigate:W,onOpenSyncSettings:aP,railWidth:c.railWidth,panelWidth:c.panelWidth??void 0,onWidthChange:c.handlePanelWidthChange,onWidthCommit:c.handlePanelWidthCommit,maximized:c.panelMaximized,onMaximize:c.handlePanelMaximize,onImport:at,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.Ay,{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:aO?_: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:aH,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aL,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:aO,agentKey:_,onClose:aN,rightOffset:d.askPanelOpen?d.askPanelWidth:0,width:ab,onWidthChange:ac,onWidthCommit:aM}),(0,e.jsx)(S,{open:d.desktopAskPopupOpen,onClose:d.closeDesktopAskPopup,currentFile:aH,initialMessage:d.askInitialMessage,initialAcpAgent:d.askAcpAgent,onFirstMessage:aL,askMode:d.askMode,onModeSwitch:d.handleAskModeSwitch}),(0,e.jsx)(z.A,{onToggle:d.toggleAskPanel,askPanelOpen:d.askPanelOpen||d.desktopAskPopupOpen}),(0,e.jsx)(B.A,{}),(0,e.jsx)(T,{open:h,onClose:aR,initialTab:P}),(0,e.jsx)(A.A,{open:X,onClose:()=>Y(!1),anchorRect:Z,railWidth:c.railWidth,onOpenSyncSettings:aP,syncStatus:aF,onSyncStatusRefresh:aG}),(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:()=>aw(!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:aP,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)(F.jc,{status:aF})}),(0,e.jsx)("button",{onClick:()=>ay(!0),className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":aB.sidebar.searchTitle,children:(0,e.jsx)(k.A,{size:20})}),(0,e.jsx)("button",{onClick:()=>{I(!0),Q(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":aB.sidebar.settingsTitle,children:(0,e.jsx)(l.A,{size:20})})]})]}),av&&(0,e.jsx)("div",{className:"md:hidden fixed inset-0 z-40 overlay-backdrop",onClick:()=>aw(!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 ${av?"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:()=>aw(!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,onImport:at})})]}),(0,e.jsx)(R,{open:ax,onClose:()=>ay(!1)}),(0,e.jsx)(S,{open:az,onClose:()=>aA(!1),currentFile:aH}),(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(),as.current++,1===as.current&&ar(!0))},onDragOver:a=>{a.dataTransfer.types.includes("Files")&&a.preventDefault()},onDragLeave:()=>{as.current=Math.max(0,as.current-1),0===as.current&&ar(!1)},onDrop:a=>{a.preventDefault(),as.current=0,ar(!1),a.dataTransfer.files.length>0&&!ak&&(0,O.QL)(Array.from(a.dataTransfer.files),aB)},children:[(0,e.jsxs)("div",{className:"min-h-screen bg-background",style:{overflowX:"clip"},children:[(0,e.jsx)(C.A,{}),b]}),(0,e.jsx)(D.A,{}),(0,e.jsx)(U,{t:aB,dirPaths:aE}),aq&&!ak&&(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:aB.inbox.dropOverlay}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:aB.inbox.dropOverlayFormats})]})})]}),(0,e.jsx)(V,{open:ak,onClose:au,defaultSpace:am,initialFiles:ao,aiOrganize:ad,dirPaths:aE}),ae&&(0,e.jsx)(E.A,{aiOrganize:ad,onDismiss:ai,onCancel:()=>{ad.abort(),ad.reset(),af(!1)},onHistoryUpdate:aj}),(0,e.jsx)("style",{children:`
12
12
  @media (min-width: 768px) {
13
13
  :root {
14
14
  --right-panel-width: ${d.askMaximized?`calc(100vw - ${c.panelOpen?c.railWidth+c.effectivePanelWidth:c.railWidth}px)`:`${d.askPanelOpen?d.askPanelWidth:0}px`};
@@ -20,14 +20,9 @@ MCP_TRANSPORT = "stdio"`;return{snippet:b,displaySnippet:b,path:a.globalPath}}if
20
20
  padding-top: 0;
21
21
  }
22
22
  }
23
- `})]})}d()}catch(a){d(a)}})},5229:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>e});var d=c(52707);(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/packages/web/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/packages/web/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/packages/web/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/packages/web/components/ui/tooltip.tsx","TooltipProvider")},6234:(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)}},6970:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/app/register-sw.tsx","default")},7288:(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})},8257:(a,b,c)=>{"use strict";c.d(b,{A:()=>x});var d=c(72269),e=c(78520),f=c(35959),g=c(48204),h=c(99820),i=c(37081),j=c(34623),k=c(53679),l=c(63301),m=c(69050),n=c(83614),o=c(97370),p=c(55433),q=c(75863),r=c(5004),s=c(55231),t=c(33659),u=c(76867),v=c(75004);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})})]})})}},9518:(a,b,c)=>{"use strict";c.d(b,{G:()=>i,M:()=>j});var d=c(72269),e=c(23104),f=c.n(e),g=c(37461),h=c(76867);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 text-muted-foreground",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,n=(0,h.cn)("relative flex items-center gap-3 py-2.5 transition-[background-color] 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",!m&&"cursor-pointer hover:bg-muted/50",m&&"cursor-default"),o=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;return i?(0,d.jsxs)(f(),{href:i,className:n,"aria-current":k?"page":void 0,children:[o,l]}):(0,d.jsxs)("button",{type:"button",onClick:j,className:(0,h.cn)(n,"w-full"),children:[o,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})}},10002:(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()}}},10131:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(72269),e=c(78520),f=c(48204),g=c(63301),h=c(69050),i=c(55433),j=c(35959),k=c(33659),l=c(76867),m=c(5025);let n=(0,m.createServerReference)("70cb13eda0b82ed6d9a3f860f656cc5ce8ec75f5d2",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-[var(--amber-foreground)] 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:`
24
- @keyframes dotBounce {
25
- 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
26
- 30% { opacity: 1; transform: translateY(-2px); }
27
- }
28
- `})]})}},10742:(a,b,c)=>{"use strict";c.d(b,{A:()=>m});var d=c(72269),e=c(23104),f=c.n(e),g=c(78520),h=c(35959),i=c(77949),j=c(55433),k=c(10002),l=c(33659);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")||s?.startsWith("/changelog"))&&(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:"/changelog",className:"inline-flex items-center rounded-md px-2.5 py-1 text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] 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}},10776:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(72269);function e({error:a,reset:b}){return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-[50vh] gap-4 px-6",children:[(0,d.jsxs)("div",{className:"text-center",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 max-w-md",children:a.message||"An unexpected error occurred while rendering this page."})]}),(0,d.jsx)("button",{onClick:b,className:"px-4 py-2 rounded-md text-sm font-medium transition-colors",style:{background:"var(--muted)",color:"var(--foreground)"},children:"Try again"})]})}c(78520)},11926:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(78520);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)},[])}}},12516:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(72269),e=c(78520),f=c(28761),g=c(63301),h=c(55231);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-50 overflow-y-auto rounded-md border border-border bg-card shadow-lg py-0.5":"fixed z-50 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]})}},12518:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/packages/web/app/global-error.tsx","default")},13532:(a,b,c)=>{"use strict";c.r(b),c.d(b,{PdfRenderer:()=>f});var d=c(72269),e=c(78520);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)]})}},14627:(a,b,c)=>{"use strict";c.d(b,{vP:()=>w,$_:()=>t,fF:()=>s});var d=c(72269),e=c(78520),f=c(83614),g=c(37461),h=c(53679),i=c(7230),j=c(63301),k=c(97218),l=c(65241),m=c(65836),n=c(71977),o=c(10002),p=c(77940),q=c(99712);function r({t:a,onInitComplete:b}){var c;let g=a.settings?.sync,[i,l]=(0,e.useState)(""),[r,s]=(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,o.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=t(a,i,g);B(b?`${a}
23
+ `})]})}d()}catch(a){d(a)}})},5229:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>e});var d=c(52707);(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/packages/web/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/packages/web/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/packages/web/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/packages/web/components/ui/tooltip.tsx","TooltipProvider")},6234:(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)}},6970:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/app/register-sw.tsx","default")},7288:(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})},8257:(a,b,c)=>{"use strict";c.d(b,{A:()=>x});var d=c(72269),e=c(78520),f=c(35959),g=c(48204),h=c(99820),i=c(37081),j=c(34623),k=c(53679),l=c(63301),m=c(69050),n=c(83614),o=c(97370),p=c(55433),q=c(75863),r=c(5004),s=c(55231),t=c(33659),u=c(76867),v=c(75004);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})})]})})}},9518:(a,b,c)=>{"use strict";c.d(b,{G:()=>i,M:()=>j});var d=c(72269),e=c(23104),f=c.n(e),g=c(37461),h=c(76867);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 text-muted-foreground",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,n=(0,h.cn)("relative flex items-center gap-3 py-2.5 transition-[background-color] 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",!m&&"cursor-pointer hover:bg-muted/50",m&&"cursor-default"),o=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;return i?(0,d.jsxs)(f(),{href:i,className:n,"aria-current":k?"page":void 0,children:[o,l]}):(0,d.jsxs)("button",{type:"button",onClick:j,className:(0,h.cn)(n,"w-full"),children:[o,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})}},10002:(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()}}},10742:(a,b,c)=>{"use strict";c.d(b,{A:()=>m});var d=c(72269),e=c(23104),f=c.n(e),g=c(78520),h=c(35959),i=c(77949),j=c(55433),k=c(10002),l=c(33659);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")||s?.startsWith("/changelog"))&&(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:"/changelog",className:"inline-flex items-center rounded-md px-2.5 py-1 text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] 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}},10776:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(72269);function e({error:a,reset:b}){return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-[50vh] gap-4 px-6",children:[(0,d.jsxs)("div",{className:"text-center",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 max-w-md",children:a.message||"An unexpected error occurred while rendering this page."})]}),(0,d.jsx)("button",{onClick:b,className:"px-4 py-2 rounded-md text-sm font-medium transition-colors",style:{background:"var(--muted)",color:"var(--foreground)"},children:"Try again"})]})}c(78520)},11926:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(78520);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)},[])}}},12516:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(72269),e=c(78520),f=c(28761),g=c(63301),h=c(55231);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-50 overflow-y-auto rounded-md border border-border bg-card shadow-lg py-0.5":"fixed z-50 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]})}},12518:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/packages/web/app/global-error.tsx","default")},13532:(a,b,c)=>{"use strict";c.r(b),c.d(b,{PdfRenderer:()=>f});var d=c(72269),e=c(78520);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)]})}},14627:(a,b,c)=>{"use strict";c.d(b,{vP:()=>w,$_:()=>t,fF:()=>s});var d=c(72269),e=c(78520),f=c(83614),g=c(37461),h=c(53679),i=c(7230),j=c(63301),k=c(97218),l=c(65241),m=c(65836),n=c(71977),o=c(10002),p=c(77940),q=c(99712);function r({t:a,onInitComplete:b}){var c;let g=a.settings?.sync,[i,l]=(0,e.useState)(""),[r,s]=(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,o.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=t(a,i,g);B(b?`${a}
29
24
  ${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)(n.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)(n.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)(n.pd,{type:"text",value:i,onChange:a=>{l(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)(n.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)(n.pd,{type:w?"text":"password",value:r,onChange:a=>s(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)(p.A,{size:14}):(0,d.jsx)(q.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)(n.D0,{label:g?.branchLabel??"Branch",children:(0,d.jsx)(n.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)(n.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)(m.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)(m.A,{size:11,className:"text-success/60 shrink-0"}),(0,d.jsx)("span",{children:a})]},b))})]})}function s(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 t(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 u({file:a,time:b,syncT:c,onResolved:i}){let[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(!1),[n,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(!1),t=async()=>{if(l)return void m(!1);if(!n){r(!0);try{let b=await (0,o.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"conflict-preview",remote:a})});p(b)}catch{}r(!1)}m(!0)},u=async b=>{k("keep-local"===b?"local":"remote");try{await (0,o.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:s(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:q?(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 v({syncT:a}){let[b,c]=(0,e.useState)(!1),[f,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(""),[n,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(!1);(0,e.useRef)(!1);let s=f!==l,t=async()=>{try{await (0,o.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-visible:ring-1 focus-visible: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"}),q&&(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 w({t:a,visible:b}){let c=a.settings?.sync,[g,i]=(0,e.useState)(null),[j,p]=(0,e.useState)(!0),[q,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(null),B=(0,e.useCallback)(async()=>{try{let a=await (0,o.n)("/api/sync",{timeout:1e4});i(a)}catch{i(a=>a??null)}finally{p(!1)}},[]);(0,e.useRef)(b);let C=async()=>{w(!0),A(null);try{await (0,o.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"now"}),timeout:12e4}),A({type:"success",text:c?.syncComplete??"Sync complete"}),await B()}catch(d){var a;let b;A({type:"error",text:(b=t(a=d instanceof Error?d.message:"Sync failed",void 0,c))?`${a}
30
- ${b}`:a})}finally{w(!1),setTimeout(()=>A(null),3e3)}},D=async()=>{if(!g)return;y(!0),A(null);let a=g.enabled?"off":"on";try{await (0,o.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a})}),await B(),A({type:"success",text:g.enabled?c?.autoSyncDisabled??"Auto-sync disabled":c?.autoSyncEnabled??"Auto-sync enabled"})}catch{A({type:"error",text:c?.toggleFailed??"Failed to toggle sync"})}finally{y(!1),setTimeout(()=>A(null),3e3)}},E=async()=>{y(!0);try{await (0,o.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reset"})}),await B()}catch{A({type:"error",text:c?.resetFailed??"Failed to reset sync configuration"})}finally{y(!1),setTimeout(()=>A(null),3e3)}};if(j)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(!g||!g.enabled)return(0,d.jsx)(r,{t:a,onInitComplete:B});if(g.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:c?.brokenTitle??"Sync configuration is broken"}),(0,d.jsx)("p",{className:"text-xs text-destructive/80",children:g.lastError||(c?.brokenDesc??"The git repository or remote is missing. Reset to re-configure.")}),(0,d.jsxs)(n.jn,{onClick:E,disabled:x,className:"flex items-center gap-2 mt-2",children:[x&&(0,d.jsx)(h.A,{size:14,className:"animate-spin"}),c?.resetButton??"Reset & Re-configure"]})]})]})});let F=g.conflicts||[];return(0,d.jsx)("div",{className:"space-y-4",children:(0,d.jsxs)(n.L7,{icon:(0,d.jsx)(k.A,{size:15}),title:c?.sectionTitle??"Sync",description:g.remote,badge:(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-success/15 text-success font-medium",children:c?.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:c?.labelBranch??"Branch"}),(0,d.jsx)("span",{className:"font-mono text-xs",children:g.branch})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:c?.labelLastSync??"Last sync"}),(0,d.jsx)("span",{className:"text-xs",children:s(g.lastSync,c)})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:c?.labelUnpushed??"Unpushed"}),(0,d.jsx)("span",{className:"text-xs",children:"string"==typeof g.unpushed&&/^\d+$/.test(g.unpushed)?c?.unpushedCommits?.(parseInt(g.unpushed,10))??`${g.unpushed} commits`:`${g.unpushed??"?"} commits`})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:c?.labelAutoSync??"Auto-sync"}),(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs",children:["commit"," ",(0,d.jsxs)(n.l6,{size:"sm",value:String(g.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&&B()}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)(n.l6,{size:"sm",value:String(g.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&&B()}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:C,disabled:q,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:12,className:q?"animate-spin":""}),c?.syncNow??"Sync Now"]}),(0,d.jsx)("button",{type:"button",onClick:D,disabled:x,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:c?.disableAutoSync??"Disable Auto-sync"})]}),z&&(0,d.jsx)("div",{className:"flex items-start gap-1.5 text-xs",role:"status","aria-live":"polite",children:"success"===z.type?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(m.A,{size:13,className:"text-success shrink-0 mt-0.5"}),(0,d.jsx)("span",{className:"text-success",children:z.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:z.text.split("\n").map((a,b)=>(0,d.jsx)("span",{className:`block ${b>0?"text-destructive/70":"text-destructive"}`,children:a},b))})]})}),F.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:c?.conflictsTitle?.(F.length)??`Conflicts (${F.length})`}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:c?.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:F.map((a,b)=>(0,d.jsx)(u,{file:a.file,time:a.time,syncT:c,onResolved:B},b))})]}),g.lastError&&0===F.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:g.lastError}),t(g.lastError,g.remote,c)&&(0,d.jsx)("span",{className:"block text-destructive/70",children:t(g.lastError,g.remote,c)})]})]}),(0,d.jsx)(v,{syncT:c})]})})}},15706:(a,b,c)=>{Promise.resolve().then(c.bind(c,76994))},16704:(a,b,c)=>{"use strict";c.d(b,{Dp:()=>e,Sx:()=>f,oT:()=>g,qQ:()=>d});let d={files:280,search:320,echo:340,agents:300,discover:300,workflows:320},e={DEFAULT:280,MIN:240,MAX_RATIO:.45,MAX_ABS:600},f={DEFAULT:380,MIN:320,MAX_ABS:4e3,MIN_CONTENT:200},g={DEFAULT:400,MIN:300,MAX_ABS:640,MAX_RATIO:.42}},17141:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(72269),e=c(78520);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}}},17392:(a,b,c)=>{Promise.resolve().then(c.bind(c,6970)),Promise.resolve().then(c.bind(c,56939)),Promise.resolve().then(c.bind(c,75817)),Promise.resolve().then(c.bind(c,92494)),Promise.resolve().then(c.bind(c,43714)),Promise.resolve().then(c.bind(c,23)),Promise.resolve().then(c.bind(c,38416)),Promise.resolve().then(c.bind(c,39234)),Promise.resolve().then(c.bind(c,34558)),Promise.resolve().then(c.bind(c,35542)),Promise.resolve().then(c.bind(c,74246)),Promise.resolve().then(c.bind(c,40206)),Promise.resolve().then(c.bind(c,91994)),Promise.resolve().then(c.bind(c,43456)),Promise.resolve().then(c.bind(c,97426)),Promise.resolve().then(c.bind(c,72731)),Promise.resolve().then(c.bind(c,34955)),Promise.resolve().then(c.bind(c,22176)),Promise.resolve().then(c.bind(c,5229)),Promise.resolve().then(c.bind(c,77982)),Promise.resolve().then(c.bind(c,53899)),Promise.resolve().then(c.bind(c,17626))},17437:(a,b,c)=>{"use strict";c.d(b,{A:()=>p});var d=c(72269),e=c(78520),f=c(35205),g=c(55433),h=c(21228),i=c(520),j=c(32068),k=c(49054),l=c(78598),m=c(25860),n=c(70545),o=c(33659);function p({sessions:a,activeSessionId:b,onLoad:c,onDelete:k,onRename:l,onTogglePin:m,onClearAll:p,onClose:r,onNewChat:s}){let{t}=(0,o.Y)(),[u,v]=(0,e.useTransition)(),w=t.ask,[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),F=(0,e.useRef)(void 0),G=(0,e.useRef)(null),H=(0,e.useRef)(null),I=(0,e.useMemo)(()=>{if(!x.trim())return a;let b=x.toLowerCase();return a.filter(a=>!!(0,n.d)(a).toLowerCase().includes(b)||a.messages.some(a=>a.content.toLowerCase().includes(b)))},[a,x]),J=(0,e.useMemo)(()=>{let a=[],b=[],c=[],d=[],e=[];for(let f of I){if(f.pinned){a.push(f);continue}let g=function(a){let b=new Date,c=new Date(b.getFullYear(),b.getMonth(),b.getDate()).getTime(),d=c-864e5*b.getDay();return a>=c?"today":a>=c-864e5?"yesterday":a>=d?"week":"older"}(f.updatedAt);"today"===g?b.push(f):"yesterday"===g?c.push(f):"week"===g?d.push(f):e.push(f)}return{pinned:a,today:b,yesterday:c,week:d,older:e}},[I]),K=a.filter(a=>a.pinned).length,L=a.filter(a=>a.messages.length>0).length,M=(0,e.useCallback)(a=>{v(()=>{c(a),r()})},[c,r]),N=(0,e.useCallback)(()=>{v(()=>{s(),r()})},[s,r]),O=(0,e.useCallback)(a=>{A(a.id),C((0,n.d)(a))},[]),P=(0,e.useCallback)(()=>{v(()=>{z&&B.trim()&&l(z,B.trim()),A(null)})},[z,B,l]),Q=(0,e.useCallback)(()=>{if(!D){E(!0),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>E(!1),3e3);return}v(()=>{F.current&&clearTimeout(F.current),p(),E(!1)})},[D,p]),R=(a,c)=>0===c.length?null:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-2xs font-medium text-muted-foreground/50 uppercase tracking-wider px-1 py-2",children:a}),(0,d.jsx)("div",{className:"flex flex-col gap-1",children:c.map(a=>(0,d.jsx)(q,{session:a,isActive:a.id===b,editing:z===a.id,editValue:B,onEditValueChange:C,inputRef:H,onLoad:()=>M(a.id),onStartRename:()=>O(a),onCommitRename:P,onCancelRename:()=>A(null),onDelete:()=>k(a.id),onTogglePin:()=>m(a.id),ask:w},a.id))})]},a),S=I.length>0;return(0,d.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 animate-in fade-in-0 duration-150",children:[(0,d.jsx)("div",{className:"px-4 pt-3 pb-2 shrink-0",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(f.A,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground/50"}),(0,d.jsx)("input",{ref:G,type:"text",value:x,onChange:a=>y(a.target.value),placeholder:w?.historySearch??"Search conversations...",className:"w-full pl-8 pr-8 py-2 text-xs rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground/40 outline-none focus-visible:border-[var(--amber)]/40 transition-colors"}),x&&(0,d.jsx)("button",{type:"button",onClick:()=>y(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded text-muted-foreground/40 hover:text-foreground",children:(0,d.jsx)(g.A,{size:12})})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 pb-2 shrink-0",children:[(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/60",children:[w?.historyStats?.(L)??`${L} conversations`,K>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",K," ",w?.historyPinned??"pinned"]})]}),(0,d.jsxs)("button",{type:"button",onClick:N,className:"flex items-center gap-1 text-2xs text-[var(--amber)] hover:text-[var(--amber)]/80 transition-colors",children:[(0,d.jsx)(h.A,{size:11}),(0,d.jsx)("span",{children:t.hints?.newChat??"New chat"})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-3 pb-3",children:S?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[R(w?.historyPinned??"Pinned",J.pinned),R(w?.historyToday??"Today",J.today),R(w?.historyYesterday??"Yesterday",J.yesterday),R(w?.historyThisWeek??"This week",J.week),R(w?.historyOlder??"Older",J.older)]}):(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,d.jsx)(i.A,{size:32,className:"text-muted-foreground/20 mb-3"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground/60",children:x?"No matching conversations":w?.historyEmpty??"No conversations yet"}),!x&&(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/40 mt-1",children:w?.historyEmptyHint??"Start a new chat to begin"})]})}),L>0&&(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 border-t border-border/40 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:Q,className:`text-2xs px-2 py-0.5 rounded-md transition-colors ${D?"bg-error/10 text-error font-medium":"text-muted-foreground/50 hover:text-error hover:bg-muted"}`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)(j.A,{size:10}),D?w?.confirmClear??"Confirm clear?":w?.clearAll??"Clear all"]})}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums",children:w?.historyCapacity?.(L)??`${L} of 30`})]})]})}function q({session:a,isActive:b,editing:c,editValue:e,onEditValueChange:f,inputRef:g,onLoad:h,onStartRename:o,onCommitRename:p,onCancelRename:q,onDelete:r,onTogglePin:s,ask:t}){let u=(0,n.d)(a),v=function(a){let b=a.messages.find(a=>"user"===a.role);if(!b)return"";let c=b.content.replace(/\s+/g," ").trim();return c.length>60?`${c.slice(0,60)}...`:c}(a),w=a.messages.length;return(0,d.jsxs)("div",{className:`group relative rounded-lg transition-colors cursor-pointer ${b?"bg-[var(--amber)]/8 border border-[var(--amber)]/15":"hover:bg-muted/60 border border-transparent"}`,onClick:h,children:[b&&(0,d.jsx)("span",{className:"absolute left-0 top-3 bottom-3 w-[2px] rounded-r-full bg-[var(--amber)]"}),(0,d.jsxs)("div",{className:"px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.pinned&&(0,d.jsx)(k.A,{size:10,className:"shrink-0 text-[var(--amber)]/60 -rotate-45"}),c?(0,d.jsx)("input",{ref:g,type:"text",value:e,onChange:a=>f(a.target.value),onBlur:p,onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),p()),"Escape"===a.key&&(a.preventDefault(),q())},onClick:a=>a.stopPropagation(),className:"flex-1 min-w-0 bg-transparent border-b border-[var(--amber)] outline-none text-xs font-medium text-foreground"}):(0,d.jsx)("span",{className:"flex-1 min-w-0 text-xs font-medium text-foreground truncate",children:u}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 shrink-0 tabular-nums",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))})]}),!c&&v&&(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/50 truncate mt-0.5 pl-0.5",children:v}),!c&&(0,d.jsxs)("div",{className:"flex items-center justify-between mt-1.5",children:[(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/40 flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:9}),t?.historyMsgs?.(w)??`${w} msgs`]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("button",{type:"button",onClick:s,className:`p-1 rounded-md transition-colors ${a.pinned?"text-[var(--amber)] hover:text-muted-foreground":"text-muted-foreground/40 hover:text-[var(--amber)]"}`,title:a.pinned?"Unpin":"Pin",children:a.pinned?(0,d.jsx)(l.A,{size:11}):(0,d.jsx)(k.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:o,className:"p-1 rounded-md text-muted-foreground/40 hover:text-foreground hover:bg-muted/60 transition-colors",title:t?.renameSession??"Rename",children:(0,d.jsx)(m.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:r,className:"p-1 rounded-md text-muted-foreground/40 hover:text-error hover:bg-error/5 transition-colors",title:"Delete",children:(0,d.jsx)(j.A,{size:11})})]})]})]})]})}},17626:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/lib/stores/LocaleStoreInit.tsx","default")},17641:(a,b,c)=>{"use strict";c.d(b,{A:()=>r});var d=c(72269),e=c(35959),f=c(83269),g=c(3505),h=c(99712),i=c(85224),j=c(9518),k=c(78520),l=c(3436),m=c(83614),n=c(520);c(10002);var o=c(33659);function p(){let[a,b]=(0,k.useState)(null),[c,e]=(0,k.useState)([]),[f,g]=(0,k.useState)(!0),{t:h}=(0,o.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)(l.A,{size:12,className:"text-success"});case"write":case"append":return(0,d.jsx)(m.A,{size:12,className:"text-foreground"});case"delete":return(0,d.jsx)(m.A,{size:12,className:"text-destructive"});case"rename":case"move":return(0,d.jsx)(n.A,{size:12,className:"text-muted-foreground"});default:return(0,d.jsx)(m.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 q=c(59204);function r({active:a,maximized:b,onMaximize:c}){let{t:k}=(0,o.Y)(),l=k.panels.echo,m=(0,e.usePathname)()??"",n={imprint:{icon:(0,d.jsx)(f.A,{size:14}),title:l.imprintTitle},growth:{icon:(0,d.jsx)(g.A,{size:14}),title:l.growthTitle},self:{icon:(0,d.jsx)(h.A,{size:14}),title:l.selfTitle}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(i.A,{title:l.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:q.RS.map(a=>{let b=n[a],c=q.AI[a],e=m===c||m.startsWith(`${c}/`);return(0,d.jsx)(j.G,{href:c,icon:b.icon,title:b.title,active:e},a)})}),(0,d.jsx)("div",{className:"mt-auto",children:(0,d.jsx)(p,{})})]})]})}},18620:(a,b,c)=>{"use strict";c.d(b,{KT:()=>k,NH:()=>j});var d=c(78520);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()),[])}}},19424:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TimelineRenderer:()=>k,renderBody:()=>i});var d=c(72269),e=c(78520),f=c(28617);let g=/(\d{4}[-/]\d{1,2}(?:[-/]\d{1,2})?|[A-Za-z]+ \d{4}|\d{4}年\d{1,2}月(?:\d{1,2}日)?)/;function h(a){return(0,f.ZD)(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="${(0,f.Gj)(b)}">${c??b}</span>`).replace(/\[([^\]]+)\]\(([^)]+)\)/g,(a,b,c)=>`<a href="${(0,f.v7)(c)}" style="color:var(--amber)">${b}</a>`)}function i(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">${h(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)">${h(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)">${h(b.replace(/^\d+\. /,""))}</li>`);continue}e(),c.push(`<p style="margin:.25em 0;font-size:.82rem;line-height:1.6;color:var(--foreground)">${h(b)}</p>`)}return e(),c.join("")}let j=[{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:"var(--tool-read)"},{bg:"rgba(200,160,216,0.12)",text:"var(--tool-search)"}];function k({content:a}){let b=(0,e.useMemo)(()=>(function(a){let b=a.split("\n"),c=[],d=null,e=[],f=()=>{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)){f();let b=a.slice(3).trim();d={heading:b,date:function(a){let b=g.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 f(),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:i(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 j[b%j.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))]})]})}},21105:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>H});var e=c(72269),f=c(78520),g=c(28761),h=c(63353),i=c(23095),j=c(27788),k=c(55433),l=c(53642),m=c(25075),n=c(33659),o=c(50065),p=c(70545),q=c(89461),r=c(64448),s=c(11926),t=c(33500),u=c(46078),v=c(93558),w=c(21290),x=c(17437),y=c(51471),z=c(65407),A=c(26866),B=c(48840),C=c(85973),D=c(22499),E=c(76867),F=c(45189),G=a([B]);function H({visible:a,currentFile:b,initialMessage:c,initialAcpAgent:d,onFirstMessage:G,variant:H,onClose:I,maximized:J,onMaximize:K,askMode:L,onModeSwitch:M,onDockToPanel:N}){let O="panel"===H,P="home"===H,Q=(0,f.useRef)(null),R=(0,f.useRef)(null),{t:S}=(0,n.Y)(),[T,U]=(0,f.useState)(!1),[V,W]=(0,f.useState)(""),X=(0,f.useRef)(V),[Y,Z]=(0,f.useState)([]),$=(0,f.useRef)(Y),[_,aa]=(0,f.useState)(!1),[ab,ac]=(0,f.useState)(!1),[ad,ae]=(0,f.useState)(!1),af=(0,f.useRef)(null),ag=(0,f.useRef)(null),[ah,ai]=(0,f.useState)(null),[aj,ak]=(0,f.useState)(""),[al,am]=(0,f.useState)(null),an=(0,f.useRef)(al),[ao,ap]=(0,f.useState)(null),aq=(0,f.useRef)(ao),ar=(0,f.useRef)(null),[as,at]=(0,f.useState)("agent"),[au,av]=(0,f.useState)(null),[aw,ax]=(0,f.useState)(null),ay=(0,p.X)(b),az=(0,f.useRef)(ay),aA=(0,f.useMemo)(()=>({unsupportedType:S.fileImport?.unsupported}),[S]),{localAttachments:aB,uploadError:aC,uploadInputRef:aD,pickFiles:aE,removeAttachment:aF,clearAttachments:aG,injectFiles:aH}=(0,q.l)(aA),aI=(0,f.useMemo)(()=>({localAttachments:aB,pickFiles:aE,clearAttachments:aG,injectFiles:aH}),[aG,aH,aB,aE]),aJ=(0,f.useRef)(aI),{images:aK,imageError:aL,handlePaste:aM,handleDrop:aN,handleFileSelect:aO,removeImage:aP,clearImages:aQ}=(0,r.u)(),aR=(0,f.useMemo)(()=>({images:aK,clearImages:aQ,handleDrop:aN,handlePaste:aM}),[aQ,aN,aM,aK]),aS=(0,s.Q)(),aT=(0,t.C)(),aU=(0,F.z)(),aV=(0,f.useRef)(aR),aW=(0,f.useRef)(aS),aX=(0,f.useRef)(aT),aY=(0,f.useCallback)(()=>{W(""),am(null),Z(b?[b]:[]),aJ.current.clearAttachments()},[b]),aZ=(0,f.useCallback)(a=>{W(a.content),a.images&&a.images.length>0&&aV.current.clearImages(),a.attachedFiles&&Z(a.attachedFiles),a.skillName&&aX.current.resetSlash(),ap((0,D.EI)(a)),setTimeout(()=>Q.current?.focus(),50)},[]),a$=(0,f.useMemo)(()=>({inputValueRef:X,mentionRef:aW,slashRef:aX,imageUploadRef:aV,sessionRef:az,uploadRef:aJ,selectedSkillRef:an,selectedAcpAgentRef:aq,attachedFilesRef:$}),[]),a_=(0,C.t)({currentFile:b,chatMode:as,providerOverride:au,modelOverride:aw,onFirstMessage:G,refs:a$,errorLabels:{noResponse:S.ask.errorNoResponse,stopped:S.ask.stopped},resetInputState:aY,onRestoreInput:aZ}),{isLoading:a0,loadingPhase:a1,reconnectAttempt:a2,reconnectMax:a3}=a_,a4=a_.submit,a5=a_.stop,a6=(0,f.useCallback)(a=>{ap(a),ay.setSessionDefaultAcpAgent(a)},[ay]),a7=aB.some(a=>"loading"===a.status),a8=aC||aL||aj||"";(0,f.useRef)(!1),(0,f.useRef)(b),(0,f.useRef)(ay.clearPersistTimer);let a9=(0,f.useRef)(null),ba=(0,f.useRef)(!1),bb=(0,f.useRef)(null),bc=(0,f.useRef)(null),bd=(0,f.useRef)(!0),be=(0,f.useCallback)((a,b)=>{W(a);let c=b??a.length;bb.current&&clearTimeout(bb.current),bc.current&&clearTimeout(bc.current),bb.current=setTimeout(()=>{bd.current&&aW.current.updateMentionFromInput(a,c)},80),bc.current=setTimeout(()=>{bd.current&&aX.current.updateSlashFromInput(a,c)},80)},[]),bf=(0,f.useCallback)(a=>{let b=Q.current,c=X.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("@"),f=c.slice(0,e)+c.slice(d);W(f),aW.current.resetMention(),$.current.includes(a)||Z(b=>[...b,a]),setTimeout(()=>{Q.current?.focus(),Q.current?.setSelectionRange(e,e)},0)},[]),bg=(0,f.useCallback)(a=>{let b=Q.current,c=X.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("/"),f=c.slice(0,e)+c.slice(d);W(f),am(a),aX.current.resetSlash(),setTimeout(()=>{Q.current?.focus(),Q.current?.setSelectionRange(e,e)},0)},[]),bh=(0,f.useRef)(bf),bi=(0,f.useRef)(bg),bj=(0,f.useCallback)(a=>{let b=aW.current,c=aX.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(),bh.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(),bi.current(c.slashResults[c.slashIndex]))}return}"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&!a_.isLoadingRef.current&&(X.current.trim()||aV.current.images.length>0)&&(a.preventDefault(),a.currentTarget.form?.requestSubmit())},[]),bk=(0,f.useCallback)(()=>{a_.isLoadingRef.current||(az.current.resetSession(),W(""),Z(b?[b]:[]),aJ.current.clearAttachments(),aV.current.clearImages(),aW.current.resetMention(),aX.current.resetSlash(),am(null),ap(null),ar.current=null,aa(!1),a_.firstMessageFired.current=!1,setTimeout(()=>Q.current?.focus(),0))},[b]),bl=(0,f.useCallback)(a=>{(a.dataTransfer.types.includes("text/mindos-path")||a.dataTransfer.types.includes("Files"))&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",ac(!0))},[]),bm=(0,f.useCallback)(()=>ac(!1),[]),bn=(0,f.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),ac(!1),ak("");let b=a.dataTransfer.getData("text/mindos-path");if(b){let c=a.dataTransfer.getData("text/mindos-type"),d="directory"===c?b.replace(/\/?$/,"/"):b;$.current.includes(d)||Z(a=>[...a,d]);return}let c=a.dataTransfer.files;if(c.length>0){let b=Array.from(c).some(a=>a.type.startsWith("image/")),d=Array.from(c).filter(a=>!a.type.startsWith("image/"));(async()=>{try{if(b&&await aV.current.handleDrop(a),d.length>0){let a=new DataTransfer;d.forEach(b=>a.items.add(b)),await aJ.current.pickFiles(a.files)}}catch(b){let a=b instanceof Error?b.message:"Failed to process dropped files";ak(a),console.error("[AskContent] Drop file processing failed:",b)}})()}},[]),bo=(0,f.useCallback)(a=>{let b=a.clipboardData?.items;!b||Array.from(b).some(a=>"file"===a.kind&&a.type.startsWith("image/"))&&(a.preventDefault(),aV.current.handlePaste(a))},[]),bp=(0,f.useCallback)(a=>{if(a_.isLoadingRef.current)return;let c=ay.sessions.find(b=>b.id===a)??null;az.current.loadSession(a),aa(!1),W(""),Z(b?[b]:[]),aJ.current.clearAttachments(),aV.current.clearImages(),aW.current.resetMention(),aX.current.resetSlash(),am(null),ap(c?.defaultAcpAgent??null),setTimeout(()=>Q.current?.focus(),0)},[b,ay.sessions]),bq=(0,f.useCallback)(()=>aa(a=>!a),[]),br=(0,f.useMemo)(()=>({connecting:S.ask.connecting,thinking:S.ask.thinking,generating:S.ask.generating,reconnecting:a2>0?S.ask.reconnecting(a2,a3):void 0,copyMessage:S.ask.copyMessage,editMessage:S.ask.editMessage,regenerateMessage:S.ask.regenerateMessage}),[S,a2,a3]),bs=(0,f.useCallback)(a=>{let b=ay.messages[a];b&&"user"===b.role&&(ay.setMessages(ay.messages.slice(0,a)),W(b.content),setTimeout(()=>Q.current?.focus(),50))},[ay]),bt=(0,f.useCallback)(a=>{let b=ay.messages[a];b&&"user"===b.role&&(ay.setMessages(ay.messages.slice(0,a)),W(b.content),ba.current=!0)},[ay]),bu=(0,f.useCallback)(a=>{av(a),ax(null)},[]);return(0,e.jsxs)("div",{className:"flex min-h-0 w-full flex-col h-full",children:[(0,e.jsx)(y.A,{isPanel:O||P,showHistory:_,onToggleHistory:bq,onReset:bk,isLoading:a0,maximized:J,onMaximize:K,askMode:P?void 0:L,onModeSwitch:P?void 0:M,onClose:P?void 0:I,onDockToPanel:J?N:void 0,sessions:ay.sessions,activeSessionId:ay.activeSessionId,onLoadSession:bp,onDeleteSession:ay.deleteSession,onRenameSession:ay.renameSession,onTogglePinSession:ay.togglePinSession,messages:ay.messages}),_&&(0,e.jsx)(x.A,{sessions:ay.sessions,activeSessionId:ay.activeSessionId,onLoad:bp,onDelete:ay.deleteSession,onRename:ay.renameSession,onTogglePin:ay.togglePinSession,onClearAll:ay.clearAllSessions,onClose:()=>aa(!1),onNewChat:bk}),!_&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col",children:[!P&&(0,e.jsx)(u.A,{messages:ay.messages,isLoading:a0,loadingPhase:a1,emptyPrompt:S.ask.emptyPrompt,emptyHint:S.ask.emptyHint,suggestions:S.ask.suggestions,onSuggestionClick:W,onEditMessage:bs,onResendMessage:bt,labels:br}),P&&(ay.messages.length>0||J)&&(0,e.jsx)(u.A,{messages:ay.messages,isLoading:a0,loadingPhase:a1,emptyPrompt:S.ask.emptyPrompt,emptyHint:S.ask.emptyHint,suggestions:J&&0===ay.messages.length?S.ask.suggestions:[],onSuggestionClick:W,onEditMessage:bs,onResendMessage:bt,labels:br})]}),null!==aS.mentionQuery&&aS.mentionResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(v.A,{results:aS.mentionResults,selectedIndex:aS.mentionIndex,query:aS.mentionQuery??void 0,onSelect:bf})}),null!==aT.slashQuery&&aT.slashResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(w.A,{results:aT.slashResults,selectedIndex:aT.slashIndex,query:aT.slashQuery??void 0,onSelect:bg})}),(0,e.jsx)("div",{className:(0,E.cn)("shrink-0",P?"px-2 pb-2 pt-0.5":"px-3 pb-2.5 pt-1"),children:(0,e.jsxs)("div",{className:(0,E.cn)("rounded-xl bg-muted/40 border border-transparent transition-all focus-within:bg-muted/60",ab&&"ring-2 ring-[var(--amber)] border-[var(--amber)]/40 bg-[var(--amber)]/5 shadow-[0_0_12px_rgba(200,135,58,0.15)]"),onDragOver:bl,onDragLeave:bm,onDrop:bn,children:[(Y.length>0||aB.length>0||aK.length>0||al||ao||aC||aL)&&(0,e.jsxs)("div",{className:(0,E.cn)("px-3 pt-2.5 pb-2 border-b border-border/30",O?"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:[Y.map(a=>(0,e.jsx)(z.A,{path:a,variant:"kb",onRemove:()=>Z(b=>b.filter(b=>b!==a))},a)),aB.map((a,b)=>(0,e.jsx)(z.A,{path:a.name,variant:"upload",status:a.status,error:a.error,truncatedInfo:a.truncatedInfo,onRemove:()=>aF(b)},`up-${a.name}-${b}`)),aK.map((a,b)=>(0,e.jsx)(z.A,{path:a.fileName||`Image ${b+1}`,variant:"image",imageData:a.data,imageMime:a.mimeType,onRemove:()=>aP(b)},`img-${b}`)),al&&(0,e.jsx)(z.A,{path:al.name,variant:"skill",onRemove:()=>{am(null),Q.current?.focus()}}),ao&&(0,e.jsx)(z.A,{path:"object"==typeof ao&&"name"in ao?ao.name:"Remote Agent",variant:"agent",onRemove:()=>{a6(null),Q.current?.focus()}})]}),a8&&(0,e.jsx)("div",{className:"mt-1 text-xs text-error",children:a8})]}),(0,e.jsxs)("form",{ref:a9,onSubmit:a4,className:(0,E.cn)("flex items-end gap-1.5",P?"px-2 py-1.5":"px-3 py-2"),children:[(0,e.jsx)("div",{className:"relative shrink-0",children:(0,e.jsx)("button",{ref:af,type:"button",onClick:()=>ae(a=>!a),className:"p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:S.hints.attachFile,children:(0,e.jsx)(h.A,{size:15})})}),T&&ad&&ah&&(0,g.createPortal)((0,e.jsxs)("div",{ref:ag,className:"fixed 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",style:{top:`${ah.top}px`,left:`${ah.left}px`,transform:"translateY(-100%)"},onClick:a=>a.stopPropagation(),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:()=>{aD.current?.click(),ae(!1)},children:[(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-muted-foreground"}),S.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:()=>{R.current?.click(),ae(!1)},children:[(0,e.jsx)(j.A,{size:12,className:"shrink-0 text-muted-foreground"}),S.ask.attachImageLabel]})]}),document.body),(0,e.jsx)("input",{ref:aD,type:"file",className:"hidden",multiple:!0,accept:".txt,.md,.markdown,.csv,.json,.yaml,.yml,.xml,.html,.htm,.pdf,.doc,.docx,.docm,text/plain,text/markdown,text/csv,application/json,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-word.document.macroEnabled.12",onChange:async a=>{let b=a.currentTarget;await aE(b.files),b.value=""}}),(0,e.jsx)("input",{ref:R,type:"file",className:"hidden",multiple:!0,accept:"image/png,image/jpeg,image/gif,image/webp",onChange:async a=>{let b=a.currentTarget;await aO(b.files),b.value=""}}),(0,e.jsx)("textarea",{ref:a=>{Q.current=a},value:V,onChange:a=>be(a.target.value,a.target.selectionStart??void 0),onKeyDown:bj,onPaste:bo,placeholder:S.ask.placeholder,rows:1,suppressHydrationWarning:!0,className:(0,E.cn)("min-w-0 flex-1 resize-none overflow-y-hidden bg-transparent py-2 leading-relaxed text-foreground placeholder:text-muted-foreground/50 outline-none focus-visible:ring-0",P?"text-xs":"text-sm")}),a0?(0,e.jsx)("button",{type:"button",onClick:a5,className:"p-2 rounded-xl transition-colors shrink-0 text-foreground bg-muted hover:bg-muted/80",title:"reconnecting"===a1?S.ask.cancelReconnect:S.ask.stopTitle,children:"reconnecting"===a1?(0,e.jsx)(k.A,{size:15}):(0,e.jsx)(l.A,{size:15})}):(0,e.jsx)("button",{type:"submit",title:a7?S.ask.uploadsProcessing??"Wait for uploaded files to finish processing before sending.":S.ask.send,disabled:a7||!V.trim()&&0===aK.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)(m.A,{size:14})})]}),(0,e.jsxs)("div",{className:(0,E.cn)("flex items-center justify-between border-t border-border/10",O?"px-2 pb-1.5 pt-1 gap-1":"px-3 pb-2 pt-1.5"),children:[(0,e.jsxs)("div",{className:(0,E.cn)("flex items-center flex-wrap",O?"gap-1":"gap-2"),children:[(0,e.jsx)(o.Ay,{mode:as,onChange:at,disabled:a0}),T&&(0,e.jsx)(A.A,{selectedAgent:ao,onSelect:a6,installedAgents:aU.installedAgents,loading:aU.loading}),T&&(0,e.jsx)(B.A,{providerValue:au,onProviderChange:bu,modelValue:aw,onModelChange:ax,disabled:a0})]}),!O&&!P&&(0,e.jsxs)("span",{className:"hidden md:inline text-2xs text-muted-foreground/40 select-none shrink-0",children:[(0,e.jsx)("kbd",{className:"font-mono",children:"Enter"})," ",S.ask.send," \xb7 ",(0,e.jsx)("kbd",{className:"font-mono",children:"Shift+Enter"})," ",S.ask.newlineHint]})]})]})})]})]})}B=(G.then?(await G)():G)[0],new WeakMap,d()}catch(a){d(a)}})},21290:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(72269),e=c(78520),f=c(57262),g=c(58940);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"})]})]})}},21673:(a,b,c)=>{"use strict";c.d(b,{V:()=>e});var d=c(78520);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)},[])}}},22176:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/components/ui/Toaster.tsx","default")},22222:(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);c(24663);var f=a([e]);e=(f.then?(await f)():f)[0];let l={anthropic:{id:"anthropic",name:"Anthropic",nameZh:"Anthropic",shortLabel:"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",shortLabel:"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",shortLabel:"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",shortLabel:"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)",shortLabel:"xAI",defaultModel:"grok-3",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},openrouter:{id:"openrouter",name:"OpenRouter",nameZh:"OpenRouter",shortLabel:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},mistral:{id:"mistral",name:"Mistral",nameZh:"Mistral",shortLabel:"Mistral",defaultModel:"mistral-large-latest",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},deepseek:{id:"deepseek",name:"DeepSeek",nameZh:"DeepSeek",shortLabel:"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 国际版)",shortLabel:"智谱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 国内版)",shortLabel:"智谱GLM-CN",description:"China region version",descriptionZh:"中国区版本",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 (月之暗面)",shortLabel:"Kimi Coding",defaultModel:"kimi-k2-thinking",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},cerebras:{id:"cerebras",name:"Cerebras",nameZh:"Cerebras",shortLabel:"Cerebras",defaultModel:"llama-4-scout-17b-16e",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},minimax:{id:"minimax",name:"MiniMax",nameZh:"MiniMax (国际版)",shortLabel:"MiniMax",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"minimax-cn":{id:"minimax-cn",name:"MiniMax (China)",nameZh:"MiniMax (国内版)",shortLabel:"MiniMax-CN",description:"China region version",descriptionZh:"中国区版本",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},huggingface:{id:"huggingface",name:"Hugging Face",nameZh:"Hugging Face",shortLabel:"HuggingFace",defaultModel:"Qwen/Qwen3-235B-A22B-Thinking-2507",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},ollama:{id:"ollama",name:"Ollama",nameZh:"Ollama (本地)",shortLabel:"Ollama",description:"Local server (requires setup)",descriptionZh:"本地服务器 (需要本地部署)",defaultModel:"llama3.2",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:11434/v1",apiKeyFallback:"ollama",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://ollama.com/download",category:"local"},"lm-studio":{id:"lm-studio",name:"LM Studio",nameZh:"LM Studio (本地)",shortLabel:"LM Studio",description:"Local OpenAI-compatible server",descriptionZh:"本地 OpenAI 兼容服务",defaultModel:"local-model",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:1234/v1",apiKeyFallback:"lm-studio",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://lmstudio.ai/",category:"local"},vllm:{id:"vllm",name:"vLLM",nameZh:"vLLM (本地)",shortLabel:"vLLM",description:"Local OpenAI-compatible server",descriptionZh:"本地 OpenAI 兼容服务",defaultModel:"local-model",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:8000/v1",apiKeyFallback:"vllm",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://docs.vllm.ai/",category:"local"}},m=Object.keys(l);function g(a){return a in l}function h(){let a=[],b=[],c=[];for(let d of m){let e=l[d].category;"primary"===e?a.push(d):"local"===e?b.push(d):c.push(d)}return b.sort((a,b)=>l[a].name.localeCompare(l[b].name)),c.sort((a,b)=>l[a].name.localeCompare(l[b].name)),{primary:a,local:b,more:c}}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)}})},22499:(a,b,c)=>{"use strict";c.d(b,{EI:()=>g,No:()=>e,R3:()=>h,_r:()=>f});let d={id:"mindos",name:"MindOS"};function e(a,b){let c=b??d;return{...a,agentId:c.id,agentName:c.name}}function f({sessionAgent:a,initialAgent:b}){return a??b??null}function g(a){return a.agentId&&a.agentName&&a.agentId!==d.id?{id:a.agentId,name:a.agentName}:null}function h(a,b){return{...a,defaultAcpAgent:b}}},24249:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});class d{track(a,b){this.record({name:a,ts:Date.now(),props:b})}startTimer(a,b){let c=Date.now();return d=>{this.record({name:a,ts:c,durationMs:Date.now()-c,props:{...b??{},...d??{}}})}}getEvents(){return this.history.map(a=>({...a,props:a.props?{...a.props}:void 0}))}reset(){this.history=[],this.pending=[]}async flush(){if(0===this.pending.length)return 0;let a=this.pending.splice(0),b=process.env.MINDOS_TELEMETRY_ENDPOINT?.trim();if(!b)return a.length;try{return await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),a.length}catch{return this.pending.unshift(...a),0}}record(a){this.history.push(a),this.history.length>200&&this.history.splice(0,this.history.length-200),this.pending.push(a),this.log(a)}log(a){}constructor(){this.history=[],this.pending=[]}}let e=new d},24663:(a,b,c)=>{"use strict";c.d(b,{$d:()=>h,t4:()=>e,a2:()=>i,yy:()=>j});let d=["text_delta","thinking_delta","tool_start","tool_end","done","error","status"];function e(a){let b=a.trim();if(!b.startsWith("data:"))return null;let c=b.slice(5).trim();if(!c||"[DONE]"===c)return null;try{let a=JSON.parse(c);if(!(a&&"object"==typeof a)||"string"!=typeof a.type||!d.includes(a.type))return null;return a}catch{return null}}let f=new Set([401,403,429]),g=[/api.?key/i,/model.*not.?found/i,/authentication/i,/unauthorized/i,/forbidden/i];function h(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}function i(a){return Math.min(1e3*2**a,1e4)}function j(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})})}},26161:(a,b,c)=>{"use strict";c.d(b,{b:()=>g});var d=c(78520),e=c(89162),f=c(67395);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}}},26866:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(72269),e=c(78520),f=c(28761),g=c(48712),h=c(63301),i=c(55433),j=c(55231),k=c(33659);function l({selectedAgent:a,onSelect:b,installedAgents:c,loading:l=!1}){let{t:m}=(0,k.Y)(),n=m.panels?.agents??{acpDefaultAgent:"MindOS",acpSelectAgent:"Select Agent",acpChangeAgent:"Change agent"},[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,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:`
25
+ ${b}`:a})}finally{w(!1),setTimeout(()=>A(null),3e3)}},D=async()=>{if(!g)return;y(!0),A(null);let a=g.enabled?"off":"on";try{await (0,o.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a})}),await B(),A({type:"success",text:g.enabled?c?.autoSyncDisabled??"Auto-sync disabled":c?.autoSyncEnabled??"Auto-sync enabled"})}catch{A({type:"error",text:c?.toggleFailed??"Failed to toggle sync"})}finally{y(!1),setTimeout(()=>A(null),3e3)}},E=async()=>{y(!0);try{await (0,o.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reset"})}),await B()}catch{A({type:"error",text:c?.resetFailed??"Failed to reset sync configuration"})}finally{y(!1),setTimeout(()=>A(null),3e3)}};if(j)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(!g||!g.enabled)return(0,d.jsx)(r,{t:a,onInitComplete:B});if(g.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:c?.brokenTitle??"Sync configuration is broken"}),(0,d.jsx)("p",{className:"text-xs text-destructive/80",children:g.lastError||(c?.brokenDesc??"The git repository or remote is missing. Reset to re-configure.")}),(0,d.jsxs)(n.jn,{onClick:E,disabled:x,className:"flex items-center gap-2 mt-2",children:[x&&(0,d.jsx)(h.A,{size:14,className:"animate-spin"}),c?.resetButton??"Reset & Re-configure"]})]})]})});let F=g.conflicts||[];return(0,d.jsx)("div",{className:"space-y-4",children:(0,d.jsxs)(n.L7,{icon:(0,d.jsx)(k.A,{size:15}),title:c?.sectionTitle??"Sync",description:g.remote,badge:(0,d.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-success/15 text-success font-medium",children:c?.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:c?.labelBranch??"Branch"}),(0,d.jsx)("span",{className:"font-mono text-xs",children:g.branch})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:c?.labelLastSync??"Last sync"}),(0,d.jsx)("span",{className:"text-xs",children:s(g.lastSync,c)})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:c?.labelUnpushed??"Unpushed"}),(0,d.jsx)("span",{className:"text-xs",children:"string"==typeof g.unpushed&&/^\d+$/.test(g.unpushed)?c?.unpushedCommits?.(parseInt(g.unpushed,10))??`${g.unpushed} commits`:`${g.unpushed??"?"} commits`})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-muted-foreground",children:c?.labelAutoSync??"Auto-sync"}),(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs",children:["commit"," ",(0,d.jsxs)(n.l6,{size:"sm",value:String(g.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&&B()}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)(n.l6,{size:"sm",value:String(g.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&&B()}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:C,disabled:q,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:12,className:q?"animate-spin":""}),c?.syncNow??"Sync Now"]}),(0,d.jsx)("button",{type:"button",onClick:D,disabled:x,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:c?.disableAutoSync??"Disable Auto-sync"})]}),z&&(0,d.jsx)("div",{className:"flex items-start gap-1.5 text-xs",role:"status","aria-live":"polite",children:"success"===z.type?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(m.A,{size:13,className:"text-success shrink-0 mt-0.5"}),(0,d.jsx)("span",{className:"text-success",children:z.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:z.text.split("\n").map((a,b)=>(0,d.jsx)("span",{className:`block ${b>0?"text-destructive/70":"text-destructive"}`,children:a},b))})]})}),F.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:c?.conflictsTitle?.(F.length)??`Conflicts (${F.length})`}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:c?.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:F.map((a,b)=>(0,d.jsx)(u,{file:a.file,time:a.time,syncT:c,onResolved:B},b))})]}),g.lastError&&0===F.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:g.lastError}),t(g.lastError,g.remote,c)&&(0,d.jsx)("span",{className:"block text-destructive/70",children:t(g.lastError,g.remote,c)})]})]}),(0,d.jsx)(v,{syncT:c})]})})}},15706:(a,b,c)=>{Promise.resolve().then(c.bind(c,76994))},16704:(a,b,c)=>{"use strict";c.d(b,{Dp:()=>e,Sx:()=>f,oT:()=>g,qQ:()=>d});let d={files:280,search:320,echo:340,agents:300,discover:300,workflows:320},e={DEFAULT:280,MIN:240,MAX_RATIO:.45,MAX_ABS:600},f={DEFAULT:380,MIN:320,MAX_ABS:4e3,MIN_CONTENT:200},g={DEFAULT:400,MIN:300,MAX_ABS:640,MAX_RATIO:.42}},17141:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(72269),e=c(78520);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}}},17392:(a,b,c)=>{Promise.resolve().then(c.bind(c,6970)),Promise.resolve().then(c.bind(c,56939)),Promise.resolve().then(c.bind(c,75817)),Promise.resolve().then(c.bind(c,92494)),Promise.resolve().then(c.bind(c,43714)),Promise.resolve().then(c.bind(c,23)),Promise.resolve().then(c.bind(c,38416)),Promise.resolve().then(c.bind(c,39234)),Promise.resolve().then(c.bind(c,34558)),Promise.resolve().then(c.bind(c,35542)),Promise.resolve().then(c.bind(c,74246)),Promise.resolve().then(c.bind(c,40206)),Promise.resolve().then(c.bind(c,91994)),Promise.resolve().then(c.bind(c,43456)),Promise.resolve().then(c.bind(c,97426)),Promise.resolve().then(c.bind(c,72731)),Promise.resolve().then(c.bind(c,34955)),Promise.resolve().then(c.bind(c,22176)),Promise.resolve().then(c.bind(c,5229)),Promise.resolve().then(c.bind(c,77982)),Promise.resolve().then(c.bind(c,53899)),Promise.resolve().then(c.bind(c,17626))},17437:(a,b,c)=>{"use strict";c.d(b,{A:()=>p});var d=c(72269),e=c(78520),f=c(35205),g=c(55433),h=c(21228),i=c(520),j=c(32068),k=c(49054),l=c(78598),m=c(25860),n=c(70545),o=c(33659);function p({sessions:a,activeSessionId:b,onLoad:c,onDelete:k,onRename:l,onTogglePin:m,onClearAll:p,onClose:r,onNewChat:s}){let{t}=(0,o.Y)(),[u,v]=(0,e.useTransition)(),w=t.ask,[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)(""),[D,E]=(0,e.useState)(!1),F=(0,e.useRef)(void 0),G=(0,e.useRef)(null),H=(0,e.useRef)(null),I=(0,e.useMemo)(()=>{if(!x.trim())return a;let b=x.toLowerCase();return a.filter(a=>!!(0,n.d)(a).toLowerCase().includes(b)||a.messages.some(a=>a.content.toLowerCase().includes(b)))},[a,x]),J=(0,e.useMemo)(()=>{let a=[],b=[],c=[],d=[],e=[];for(let f of I){if(f.pinned){a.push(f);continue}let g=function(a){let b=new Date,c=new Date(b.getFullYear(),b.getMonth(),b.getDate()).getTime(),d=c-864e5*b.getDay();return a>=c?"today":a>=c-864e5?"yesterday":a>=d?"week":"older"}(f.updatedAt);"today"===g?b.push(f):"yesterday"===g?c.push(f):"week"===g?d.push(f):e.push(f)}return{pinned:a,today:b,yesterday:c,week:d,older:e}},[I]),K=a.filter(a=>a.pinned).length,L=a.filter(a=>a.messages.length>0).length,M=(0,e.useCallback)(a=>{v(()=>{c(a),r()})},[c,r]),N=(0,e.useCallback)(()=>{v(()=>{s(),r()})},[s,r]),O=(0,e.useCallback)(a=>{A(a.id),C((0,n.d)(a))},[]),P=(0,e.useCallback)(()=>{v(()=>{z&&B.trim()&&l(z,B.trim()),A(null)})},[z,B,l]),Q=(0,e.useCallback)(()=>{if(!D){E(!0),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>E(!1),3e3);return}v(()=>{F.current&&clearTimeout(F.current),p(),E(!1)})},[D,p]),R=(a,c)=>0===c.length?null:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-2xs font-medium text-muted-foreground/50 uppercase tracking-wider px-1 py-2",children:a}),(0,d.jsx)("div",{className:"flex flex-col gap-1",children:c.map(a=>(0,d.jsx)(q,{session:a,isActive:a.id===b,editing:z===a.id,editValue:B,onEditValueChange:C,inputRef:H,onLoad:()=>M(a.id),onStartRename:()=>O(a),onCommitRename:P,onCancelRename:()=>A(null),onDelete:()=>k(a.id),onTogglePin:()=>m(a.id),ask:w},a.id))})]},a),S=I.length>0;return(0,d.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 animate-in fade-in-0 duration-150",children:[(0,d.jsx)("div",{className:"px-4 pt-3 pb-2 shrink-0",children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(f.A,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground/50"}),(0,d.jsx)("input",{ref:G,type:"text",value:x,onChange:a=>y(a.target.value),placeholder:w?.historySearch??"Search conversations...",className:"w-full pl-8 pr-8 py-2 text-xs rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground/40 outline-none focus-visible:border-[var(--amber)]/40 transition-colors"}),x&&(0,d.jsx)("button",{type:"button",onClick:()=>y(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded text-muted-foreground/40 hover:text-foreground",children:(0,d.jsx)(g.A,{size:12})})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 pb-2 shrink-0",children:[(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/60",children:[w?.historyStats?.(L)??`${L} conversations`,K>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",K," ",w?.historyPinned??"pinned"]})]}),(0,d.jsxs)("button",{type:"button",onClick:N,className:"flex items-center gap-1 text-2xs text-[var(--amber)] hover:text-[var(--amber)]/80 transition-colors",children:[(0,d.jsx)(h.A,{size:11}),(0,d.jsx)("span",{children:t.hints?.newChat??"New chat"})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-3 pb-3",children:S?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[R(w?.historyPinned??"Pinned",J.pinned),R(w?.historyToday??"Today",J.today),R(w?.historyYesterday??"Yesterday",J.yesterday),R(w?.historyThisWeek??"This week",J.week),R(w?.historyOlder??"Older",J.older)]}):(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,d.jsx)(i.A,{size:32,className:"text-muted-foreground/20 mb-3"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground/60",children:x?"No matching conversations":w?.historyEmpty??"No conversations yet"}),!x&&(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/40 mt-1",children:w?.historyEmptyHint??"Start a new chat to begin"})]})}),L>0&&(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 border-t border-border/40 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:Q,className:`text-2xs px-2 py-0.5 rounded-md transition-colors ${D?"bg-error/10 text-error font-medium":"text-muted-foreground/50 hover:text-error hover:bg-muted"}`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)(j.A,{size:10}),D?w?.confirmClear??"Confirm clear?":w?.clearAll??"Clear all"]})}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums",children:w?.historyCapacity?.(L)??`${L} of 30`})]})]})}function q({session:a,isActive:b,editing:c,editValue:e,onEditValueChange:f,inputRef:g,onLoad:h,onStartRename:o,onCommitRename:p,onCancelRename:q,onDelete:r,onTogglePin:s,ask:t}){let u=(0,n.d)(a),v=function(a){let b=a.messages.find(a=>"user"===a.role);if(!b)return"";let c=b.content.replace(/\s+/g," ").trim();return c.length>60?`${c.slice(0,60)}...`:c}(a),w=a.messages.length;return(0,d.jsxs)("div",{className:`group relative rounded-lg transition-colors cursor-pointer ${b?"bg-[var(--amber)]/8 border border-[var(--amber)]/15":"hover:bg-muted/60 border border-transparent"}`,onClick:h,children:[b&&(0,d.jsx)("span",{className:"absolute left-0 top-3 bottom-3 w-[2px] rounded-r-full bg-[var(--amber)]"}),(0,d.jsxs)("div",{className:"px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.pinned&&(0,d.jsx)(k.A,{size:10,className:"shrink-0 text-[var(--amber)]/60 -rotate-45"}),c?(0,d.jsx)("input",{ref:g,type:"text",value:e,onChange:a=>f(a.target.value),onBlur:p,onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),p()),"Escape"===a.key&&(a.preventDefault(),q())},onClick:a=>a.stopPropagation(),className:"flex-1 min-w-0 bg-transparent border-b border-[var(--amber)] outline-none text-xs font-medium text-foreground"}):(0,d.jsx)("span",{className:"flex-1 min-w-0 text-xs font-medium text-foreground truncate",children:u}),(0,d.jsx)("span",{className:"text-2xs text-muted-foreground/40 shrink-0 tabular-nums",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))})]}),!c&&v&&(0,d.jsx)("p",{className:"text-2xs text-muted-foreground/50 truncate mt-0.5 pl-0.5",children:v}),!c&&(0,d.jsxs)("div",{className:"flex items-center justify-between mt-1.5",children:[(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/40 flex items-center gap-1",children:[(0,d.jsx)(i.A,{size:9}),t?.historyMsgs?.(w)??`${w} msgs`]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("button",{type:"button",onClick:s,className:`p-1 rounded-md transition-colors ${a.pinned?"text-[var(--amber)] hover:text-muted-foreground":"text-muted-foreground/40 hover:text-[var(--amber)]"}`,title:a.pinned?"Unpin":"Pin",children:a.pinned?(0,d.jsx)(l.A,{size:11}):(0,d.jsx)(k.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:o,className:"p-1 rounded-md text-muted-foreground/40 hover:text-foreground hover:bg-muted/60 transition-colors",title:t?.renameSession??"Rename",children:(0,d.jsx)(m.A,{size:11})}),(0,d.jsx)("button",{type:"button",onClick:r,className:"p-1 rounded-md text-muted-foreground/40 hover:text-error hover:bg-error/5 transition-colors",title:"Delete",children:(0,d.jsx)(j.A,{size:11})})]})]})]})]})}},17626:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/lib/stores/LocaleStoreInit.tsx","default")},17641:(a,b,c)=>{"use strict";c.d(b,{A:()=>r});var d=c(72269),e=c(35959),f=c(83269),g=c(3505),h=c(99712),i=c(85224),j=c(9518),k=c(78520),l=c(3436),m=c(83614),n=c(520);c(10002);var o=c(33659);function p(){let[a,b]=(0,k.useState)(null),[c,e]=(0,k.useState)([]),[f,g]=(0,k.useState)(!0),{t:h}=(0,o.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)(l.A,{size:12,className:"text-success"});case"write":case"append":return(0,d.jsx)(m.A,{size:12,className:"text-foreground"});case"delete":return(0,d.jsx)(m.A,{size:12,className:"text-destructive"});case"rename":case"move":return(0,d.jsx)(n.A,{size:12,className:"text-muted-foreground"});default:return(0,d.jsx)(m.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 q=c(59204);function r({active:a,maximized:b,onMaximize:c}){let{t:k}=(0,o.Y)(),l=k.panels.echo,m=(0,e.usePathname)()??"",n={imprint:{icon:(0,d.jsx)(f.A,{size:14}),title:l.imprintTitle},growth:{icon:(0,d.jsx)(g.A,{size:14}),title:l.growthTitle},self:{icon:(0,d.jsx)(h.A,{size:14}),title:l.selfTitle}};return(0,d.jsxs)("div",{className:`flex flex-col h-full ${a?"":"hidden"}`,children:[(0,d.jsx)(i.A,{title:l.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:q.RS.map(a=>{let b=n[a],c=q.AI[a],e=m===c||m.startsWith(`${c}/`);return(0,d.jsx)(j.G,{href:c,icon:b.icon,title:b.title,active:e},a)})}),(0,d.jsx)("div",{className:"mt-auto",children:(0,d.jsx)(p,{})})]})]})}},18591:(a,b,c)=>{"use strict";c.d(b,{i:()=>e});var d=c(5025);let e=(0,d.createServerReference)("40e93274068af9427baf93a6b8b937a4c4e85e76f7",d.callServer,void 0,d.findSourceMapURL,"deleteFileAction")},18620:(a,b,c)=>{"use strict";c.d(b,{KT:()=>k,NH:()=>j});var d=c(78520);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()),[])}}},19424:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TimelineRenderer:()=>k,renderBody:()=>i});var d=c(72269),e=c(78520),f=c(28617);let g=/(\d{4}[-/]\d{1,2}(?:[-/]\d{1,2})?|[A-Za-z]+ \d{4}|\d{4}年\d{1,2}月(?:\d{1,2}日)?)/;function h(a){return(0,f.ZD)(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="${(0,f.Gj)(b)}">${c??b}</span>`).replace(/\[([^\]]+)\]\(([^)]+)\)/g,(a,b,c)=>`<a href="${(0,f.v7)(c)}" style="color:var(--amber)">${b}</a>`)}function i(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">${h(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)">${h(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)">${h(b.replace(/^\d+\. /,""))}</li>`);continue}e(),c.push(`<p style="margin:.25em 0;font-size:.82rem;line-height:1.6;color:var(--foreground)">${h(b)}</p>`)}return e(),c.join("")}let j=[{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:"var(--tool-read)"},{bg:"rgba(200,160,216,0.12)",text:"var(--tool-search)"}];function k({content:a}){let b=(0,e.useMemo)(()=>(function(a){let b=a.split("\n"),c=[],d=null,e=[],f=()=>{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)){f();let b=a.slice(3).trim();d={heading:b,date:function(a){let b=g.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 f(),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:i(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 j[b%j.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))]})]})}},21105:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>H});var e=c(72269),f=c(78520),g=c(28761),h=c(63353),i=c(23095),j=c(27788),k=c(55433),l=c(53642),m=c(25075),n=c(33659),o=c(50065),p=c(70545),q=c(89461),r=c(64448),s=c(11926),t=c(33500),u=c(46078),v=c(93558),w=c(21290),x=c(17437),y=c(51471),z=c(65407),A=c(26866),B=c(48840),C=c(85973),D=c(22499),E=c(76867),F=c(45189),G=a([B]);function H({visible:a,currentFile:b,initialMessage:c,initialAcpAgent:d,onFirstMessage:G,variant:H,onClose:I,maximized:J,onMaximize:K,askMode:L,onModeSwitch:M,onDockToPanel:N}){let O="panel"===H,P="home"===H,Q=(0,f.useRef)(null),R=(0,f.useRef)(null),{t:S}=(0,n.Y)(),[T,U]=(0,f.useState)(!1),[V,W]=(0,f.useState)(""),X=(0,f.useRef)(V),[Y,Z]=(0,f.useState)([]),$=(0,f.useRef)(Y),[_,aa]=(0,f.useState)(!1),[ab,ac]=(0,f.useState)(!1),[ad,ae]=(0,f.useState)(!1),af=(0,f.useRef)(null),ag=(0,f.useRef)(null),[ah,ai]=(0,f.useState)(null),[aj,ak]=(0,f.useState)(""),[al,am]=(0,f.useState)(null),an=(0,f.useRef)(al),[ao,ap]=(0,f.useState)(null),aq=(0,f.useRef)(ao),ar=(0,f.useRef)(null),[as,at]=(0,f.useState)("agent"),[au,av]=(0,f.useState)(null),[aw,ax]=(0,f.useState)(null),ay=(0,p.X)(b),az=(0,f.useRef)(ay),aA=(0,f.useMemo)(()=>({unsupportedType:S.fileImport?.unsupported}),[S]),{localAttachments:aB,uploadError:aC,uploadInputRef:aD,pickFiles:aE,removeAttachment:aF,clearAttachments:aG,injectFiles:aH}=(0,q.l)(aA),aI=(0,f.useMemo)(()=>({localAttachments:aB,pickFiles:aE,clearAttachments:aG,injectFiles:aH}),[aG,aH,aB,aE]),aJ=(0,f.useRef)(aI),{images:aK,imageError:aL,handlePaste:aM,handleDrop:aN,handleFileSelect:aO,removeImage:aP,clearImages:aQ}=(0,r.u)(),aR=(0,f.useMemo)(()=>({images:aK,clearImages:aQ,handleDrop:aN,handlePaste:aM}),[aQ,aN,aM,aK]),aS=(0,s.Q)(),aT=(0,t.C)(),aU=(0,F.z)(),aV=(0,f.useRef)(aR),aW=(0,f.useRef)(aS),aX=(0,f.useRef)(aT),aY=(0,f.useCallback)(()=>{W(""),am(null),Z(b?[b]:[]),aJ.current.clearAttachments()},[b]),aZ=(0,f.useCallback)(a=>{W(a.content),a.images&&a.images.length>0&&aV.current.clearImages(),a.attachedFiles&&Z(a.attachedFiles),a.skillName&&aX.current.resetSlash(),ap((0,D.EI)(a)),setTimeout(()=>Q.current?.focus(),50)},[]),a$=(0,f.useMemo)(()=>({inputValueRef:X,mentionRef:aW,slashRef:aX,imageUploadRef:aV,sessionRef:az,uploadRef:aJ,selectedSkillRef:an,selectedAcpAgentRef:aq,attachedFilesRef:$}),[]),a_=(0,C.t)({currentFile:b,chatMode:as,providerOverride:au,modelOverride:aw,onFirstMessage:G,refs:a$,errorLabels:{noResponse:S.ask.errorNoResponse,stopped:S.ask.stopped},resetInputState:aY,onRestoreInput:aZ}),{isLoading:a0,loadingPhase:a1,reconnectAttempt:a2,reconnectMax:a3}=a_,a4=a_.submit,a5=a_.stop,a6=(0,f.useCallback)(a=>{ap(a),ay.setSessionDefaultAcpAgent(a)},[ay]),a7=aB.some(a=>"loading"===a.status),a8=aC||aL||aj||"";(0,f.useRef)(!1),(0,f.useRef)(b),(0,f.useRef)(ay.clearPersistTimer);let a9=(0,f.useRef)(null),ba=(0,f.useRef)(!1),bb=(0,f.useRef)(null),bc=(0,f.useRef)(null),bd=(0,f.useRef)(!0),be=(0,f.useCallback)((a,b)=>{W(a);let c=b??a.length;bb.current&&clearTimeout(bb.current),bc.current&&clearTimeout(bc.current),bb.current=setTimeout(()=>{bd.current&&aW.current.updateMentionFromInput(a,c)},80),bc.current=setTimeout(()=>{bd.current&&aX.current.updateSlashFromInput(a,c)},80)},[]),bf=(0,f.useCallback)(a=>{let b=Q.current,c=X.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("@"),f=c.slice(0,e)+c.slice(d);W(f),aW.current.resetMention(),$.current.includes(a)||Z(b=>[...b,a]),setTimeout(()=>{Q.current?.focus(),Q.current?.setSelectionRange(e,e)},0)},[]),bg=(0,f.useCallback)(a=>{let b=Q.current,c=X.current,d=b?.selectionStart??c.length,e=c.slice(0,d).lastIndexOf("/"),f=c.slice(0,e)+c.slice(d);W(f),am(a),aX.current.resetSlash(),setTimeout(()=>{Q.current?.focus(),Q.current?.setSelectionRange(e,e)},0)},[]),bh=(0,f.useRef)(bf),bi=(0,f.useRef)(bg),bj=(0,f.useCallback)(a=>{let b=aW.current,c=aX.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(),bh.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(),bi.current(c.slashResults[c.slashIndex]))}return}"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&!a_.isLoadingRef.current&&(X.current.trim()||aV.current.images.length>0)&&(a.preventDefault(),a.currentTarget.form?.requestSubmit())},[]),bk=(0,f.useCallback)(()=>{a_.isLoadingRef.current||(az.current.resetSession(),W(""),Z(b?[b]:[]),aJ.current.clearAttachments(),aV.current.clearImages(),aW.current.resetMention(),aX.current.resetSlash(),am(null),ap(null),ar.current=null,aa(!1),a_.firstMessageFired.current=!1,setTimeout(()=>Q.current?.focus(),0))},[b]),bl=(0,f.useCallback)(a=>{(a.dataTransfer.types.includes("text/mindos-path")||a.dataTransfer.types.includes("Files"))&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",ac(!0))},[]),bm=(0,f.useCallback)(()=>ac(!1),[]),bn=(0,f.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),ac(!1),ak("");let b=a.dataTransfer.getData("text/mindos-path");if(b){let c=a.dataTransfer.getData("text/mindos-type"),d="directory"===c?b.replace(/\/?$/,"/"):b;$.current.includes(d)||Z(a=>[...a,d]);return}let c=a.dataTransfer.files;if(c.length>0){let b=Array.from(c).some(a=>a.type.startsWith("image/")),d=Array.from(c).filter(a=>!a.type.startsWith("image/"));(async()=>{try{if(b&&await aV.current.handleDrop(a),d.length>0){let a=new DataTransfer;d.forEach(b=>a.items.add(b)),await aJ.current.pickFiles(a.files)}}catch(b){let a=b instanceof Error?b.message:"Failed to process dropped files";ak(a),console.error("[AskContent] Drop file processing failed:",b)}})()}},[]),bo=(0,f.useCallback)(a=>{let b=a.clipboardData?.items;!b||Array.from(b).some(a=>"file"===a.kind&&a.type.startsWith("image/"))&&(a.preventDefault(),aV.current.handlePaste(a))},[]),bp=(0,f.useCallback)(a=>{if(a_.isLoadingRef.current)return;let c=ay.sessions.find(b=>b.id===a)??null;az.current.loadSession(a),aa(!1),W(""),Z(b?[b]:[]),aJ.current.clearAttachments(),aV.current.clearImages(),aW.current.resetMention(),aX.current.resetSlash(),am(null),ap(c?.defaultAcpAgent??null),setTimeout(()=>Q.current?.focus(),0)},[b,ay.sessions]),bq=(0,f.useCallback)(()=>aa(a=>!a),[]),br=(0,f.useMemo)(()=>({connecting:S.ask.connecting,thinking:S.ask.thinking,generating:S.ask.generating,reconnecting:a2>0?S.ask.reconnecting(a2,a3):void 0,copyMessage:S.ask.copyMessage,editMessage:S.ask.editMessage,regenerateMessage:S.ask.regenerateMessage}),[S,a2,a3]),bs=(0,f.useCallback)(a=>{let b=ay.messages[a];b&&"user"===b.role&&(ay.setMessages(ay.messages.slice(0,a)),W(b.content),setTimeout(()=>Q.current?.focus(),50))},[ay]),bt=(0,f.useCallback)(a=>{let b=ay.messages[a];b&&"user"===b.role&&(ay.setMessages(ay.messages.slice(0,a)),W(b.content),ba.current=!0)},[ay]),bu=(0,f.useCallback)(a=>{av(a),ax(null)},[]);return(0,e.jsxs)("div",{className:"flex min-h-0 w-full flex-col h-full",children:[(0,e.jsx)(y.A,{isPanel:O||P,showHistory:_,onToggleHistory:bq,onReset:bk,isLoading:a0,maximized:J,onMaximize:K,askMode:P?void 0:L,onModeSwitch:P?void 0:M,onClose:P?void 0:I,onDockToPanel:J?N:void 0,sessions:ay.sessions,activeSessionId:ay.activeSessionId,onLoadSession:bp,onDeleteSession:ay.deleteSession,onRenameSession:ay.renameSession,onTogglePinSession:ay.togglePinSession,messages:ay.messages}),_&&(0,e.jsx)(x.A,{sessions:ay.sessions,activeSessionId:ay.activeSessionId,onLoad:bp,onDelete:ay.deleteSession,onRename:ay.renameSession,onTogglePin:ay.togglePinSession,onClearAll:ay.clearAllSessions,onClose:()=>aa(!1),onNewChat:bk}),!_&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col",children:[!P&&(0,e.jsx)(u.A,{messages:ay.messages,isLoading:a0,loadingPhase:a1,emptyPrompt:S.ask.emptyPrompt,emptyHint:S.ask.emptyHint,suggestions:S.ask.suggestions,onSuggestionClick:W,onEditMessage:bs,onResendMessage:bt,labels:br}),P&&(ay.messages.length>0||J)&&(0,e.jsx)(u.A,{messages:ay.messages,isLoading:a0,loadingPhase:a1,emptyPrompt:S.ask.emptyPrompt,emptyHint:S.ask.emptyHint,suggestions:J&&0===ay.messages.length?S.ask.suggestions:[],onSuggestionClick:W,onEditMessage:bs,onResendMessage:bt,labels:br})]}),null!==aS.mentionQuery&&aS.mentionResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(v.A,{results:aS.mentionResults,selectedIndex:aS.mentionIndex,query:aS.mentionQuery??void 0,onSelect:bf})}),null!==aT.slashQuery&&aT.slashResults.length>0&&(0,e.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,e.jsx)(w.A,{results:aT.slashResults,selectedIndex:aT.slashIndex,query:aT.slashQuery??void 0,onSelect:bg})}),(0,e.jsx)("div",{className:(0,E.cn)("shrink-0",P?"px-2 pb-2 pt-0.5":"px-3 pb-2.5 pt-1"),children:(0,e.jsxs)("div",{className:(0,E.cn)("rounded-xl bg-muted/40 border border-transparent transition-all focus-within:bg-muted/60",ab&&"ring-2 ring-[var(--amber)] border-[var(--amber)]/40 bg-[var(--amber)]/5 shadow-[0_0_12px_rgba(200,135,58,0.15)]"),onDragOver:bl,onDragLeave:bm,onDrop:bn,children:[(Y.length>0||aB.length>0||aK.length>0||al||ao||aC||aL)&&(0,e.jsxs)("div",{className:(0,E.cn)("px-3 pt-2.5 pb-2 border-b border-border/30",O?"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:[Y.map(a=>(0,e.jsx)(z.A,{path:a,variant:"kb",onRemove:()=>Z(b=>b.filter(b=>b!==a))},a)),aB.map((a,b)=>(0,e.jsx)(z.A,{path:a.name,variant:"upload",status:a.status,error:a.error,truncatedInfo:a.truncatedInfo,onRemove:()=>aF(b)},`up-${a.name}-${b}`)),aK.map((a,b)=>(0,e.jsx)(z.A,{path:a.fileName||`Image ${b+1}`,variant:"image",imageData:a.data,imageMime:a.mimeType,onRemove:()=>aP(b)},`img-${b}`)),al&&(0,e.jsx)(z.A,{path:al.name,variant:"skill",onRemove:()=>{am(null),Q.current?.focus()}}),ao&&(0,e.jsx)(z.A,{path:"object"==typeof ao&&"name"in ao?ao.name:"Remote Agent",variant:"agent",onRemove:()=>{a6(null),Q.current?.focus()}})]}),a8&&(0,e.jsx)("div",{className:"mt-1 text-xs text-error",children:a8})]}),(0,e.jsxs)("form",{ref:a9,onSubmit:a4,className:(0,E.cn)("flex items-end gap-1.5",P?"px-2 py-1.5":"px-3 py-2"),children:[(0,e.jsx)("div",{className:"relative shrink-0",children:(0,e.jsx)("button",{ref:af,type:"button",onClick:()=>ae(a=>!a),className:"p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:S.hints.attachFile,children:(0,e.jsx)(h.A,{size:15})})}),T&&ad&&ah&&(0,g.createPortal)((0,e.jsxs)("div",{ref:ag,className:"fixed 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",style:{top:`${ah.top}px`,left:`${ah.left}px`,transform:"translateY(-100%)"},onClick:a=>a.stopPropagation(),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:()=>{aD.current?.click(),ae(!1)},children:[(0,e.jsx)(i.A,{size:12,className:"shrink-0 text-muted-foreground"}),S.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:()=>{R.current?.click(),ae(!1)},children:[(0,e.jsx)(j.A,{size:12,className:"shrink-0 text-muted-foreground"}),S.ask.attachImageLabel]})]}),document.body),(0,e.jsx)("input",{ref:aD,type:"file",className:"hidden",multiple:!0,accept:".txt,.md,.markdown,.csv,.json,.yaml,.yml,.xml,.html,.htm,.pdf,.doc,.docx,.docm,text/plain,text/markdown,text/csv,application/json,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-word.document.macroEnabled.12",onChange:async a=>{let b=a.currentTarget;await aE(b.files),b.value=""}}),(0,e.jsx)("input",{ref:R,type:"file",className:"hidden",multiple:!0,accept:"image/png,image/jpeg,image/gif,image/webp",onChange:async a=>{let b=a.currentTarget;await aO(b.files),b.value=""}}),(0,e.jsx)("textarea",{ref:a=>{Q.current=a},value:V,onChange:a=>be(a.target.value,a.target.selectionStart??void 0),onKeyDown:bj,onPaste:bo,placeholder:S.ask.placeholder,rows:1,suppressHydrationWarning:!0,className:(0,E.cn)("min-w-0 flex-1 resize-none overflow-y-hidden bg-transparent py-2 leading-relaxed text-foreground placeholder:text-muted-foreground/50 outline-none focus-visible:ring-0",P?"text-xs":"text-sm")}),a0?(0,e.jsx)("button",{type:"button",onClick:a5,className:"p-2 rounded-xl transition-colors shrink-0 text-foreground bg-muted hover:bg-muted/80",title:"reconnecting"===a1?S.ask.cancelReconnect:S.ask.stopTitle,children:"reconnecting"===a1?(0,e.jsx)(k.A,{size:15}):(0,e.jsx)(l.A,{size:15})}):(0,e.jsx)("button",{type:"submit",title:a7?S.ask.uploadsProcessing??"Wait for uploaded files to finish processing before sending.":S.ask.send,disabled:a7||!V.trim()&&0===aK.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)(m.A,{size:14})})]}),(0,e.jsxs)("div",{className:(0,E.cn)("flex items-center justify-between border-t border-border/10",O?"px-2 pb-1.5 pt-1 gap-1":"px-3 pb-2 pt-1.5"),children:[(0,e.jsxs)("div",{className:(0,E.cn)("flex items-center flex-wrap",O?"gap-1":"gap-2"),children:[(0,e.jsx)(o.Ay,{mode:as,onChange:at,disabled:a0}),T&&(0,e.jsx)(A.A,{selectedAgent:ao,onSelect:a6,installedAgents:aU.installedAgents,loading:aU.loading}),T&&(0,e.jsx)(B.A,{providerValue:au,onProviderChange:bu,modelValue:aw,onModelChange:ax,disabled:a0})]}),!O&&!P&&(0,e.jsxs)("span",{className:"hidden md:inline text-2xs text-muted-foreground/40 select-none shrink-0",children:[(0,e.jsx)("kbd",{className:"font-mono",children:"Enter"})," ",S.ask.send," \xb7 ",(0,e.jsx)("kbd",{className:"font-mono",children:"Shift+Enter"})," ",S.ask.newlineHint]})]})]})})]})]})}B=(G.then?(await G)():G)[0],new WeakMap,d()}catch(a){d(a)}})},21290:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(72269),e=c(78520),f=c(57262),g=c(58940);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"})]})]})}},21673:(a,b,c)=>{"use strict";c.d(b,{V:()=>e});var d=c(78520);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)},[])}}},22176:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/components/ui/Toaster.tsx","default")},22222:(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);c(24663);var f=a([e]);e=(f.then?(await f)():f)[0];let l={anthropic:{id:"anthropic",name:"Anthropic",nameZh:"Anthropic",shortLabel:"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",shortLabel:"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",shortLabel:"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",shortLabel:"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)",shortLabel:"xAI",defaultModel:"grok-3",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},openrouter:{id:"openrouter",name:"OpenRouter",nameZh:"OpenRouter",shortLabel:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},mistral:{id:"mistral",name:"Mistral",nameZh:"Mistral",shortLabel:"Mistral",defaultModel:"mistral-large-latest",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},deepseek:{id:"deepseek",name:"DeepSeek",nameZh:"DeepSeek",shortLabel:"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 国际版)",shortLabel:"智谱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 国内版)",shortLabel:"智谱GLM-CN",description:"China region version",descriptionZh:"中国区版本",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 (月之暗面)",shortLabel:"Kimi Coding",defaultModel:"kimi-k2-thinking",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},cerebras:{id:"cerebras",name:"Cerebras",nameZh:"Cerebras",shortLabel:"Cerebras",defaultModel:"llama-4-scout-17b-16e",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},minimax:{id:"minimax",name:"MiniMax",nameZh:"MiniMax (国际版)",shortLabel:"MiniMax",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"minimax-cn":{id:"minimax-cn",name:"MiniMax (China)",nameZh:"MiniMax (国内版)",shortLabel:"MiniMax-CN",description:"China region version",descriptionZh:"中国区版本",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},huggingface:{id:"huggingface",name:"Hugging Face",nameZh:"Hugging Face",shortLabel:"HuggingFace",defaultModel:"Qwen/Qwen3-235B-A22B-Thinking-2507",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},ollama:{id:"ollama",name:"Ollama",nameZh:"Ollama (本地)",shortLabel:"Ollama",description:"Local server (requires setup)",descriptionZh:"本地服务器 (需要本地部署)",defaultModel:"llama3.2",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:11434/v1",apiKeyFallback:"ollama",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://ollama.com/download",category:"local"},"lm-studio":{id:"lm-studio",name:"LM Studio",nameZh:"LM Studio (本地)",shortLabel:"LM Studio",description:"Local OpenAI-compatible server",descriptionZh:"本地 OpenAI 兼容服务",defaultModel:"local-model",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:1234/v1",apiKeyFallback:"lm-studio",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://lmstudio.ai/",category:"local"},vllm:{id:"vllm",name:"vLLM",nameZh:"vLLM (本地)",shortLabel:"vLLM",description:"Local OpenAI-compatible server",descriptionZh:"本地 OpenAI 兼容服务",defaultModel:"local-model",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:8000/v1",apiKeyFallback:"vllm",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://docs.vllm.ai/",category:"local"}},m=Object.keys(l);function g(a){return a in l}function h(){let a=[],b=[],c=[];for(let d of m){let e=l[d].category;"primary"===e?a.push(d):"local"===e?b.push(d):c.push(d)}return b.sort((a,b)=>l[a].name.localeCompare(l[b].name)),c.sort((a,b)=>l[a].name.localeCompare(l[b].name)),{primary:a,local:b,more:c}}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)}})},22499:(a,b,c)=>{"use strict";c.d(b,{EI:()=>g,No:()=>e,R3:()=>h,_r:()=>f});let d={id:"mindos",name:"MindOS"};function e(a,b){let c=b??d;return{...a,agentId:c.id,agentName:c.name}}function f({sessionAgent:a,initialAgent:b}){return a??b??null}function g(a){return a.agentId&&a.agentName&&a.agentId!==d.id?{id:a.agentId,name:a.agentName}:null}function h(a,b){return{...a,defaultAcpAgent:b}}},24249:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});class d{track(a,b){this.record({name:a,ts:Date.now(),props:b})}startTimer(a,b){let c=Date.now();return d=>{this.record({name:a,ts:c,durationMs:Date.now()-c,props:{...b??{},...d??{}}})}}getEvents(){return this.history.map(a=>({...a,props:a.props?{...a.props}:void 0}))}reset(){this.history=[],this.pending=[]}async flush(){if(0===this.pending.length)return 0;let a=this.pending.splice(0),b=process.env.MINDOS_TELEMETRY_ENDPOINT?.trim();if(!b)return a.length;try{return await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),a.length}catch{return this.pending.unshift(...a),0}}record(a){this.history.push(a),this.history.length>200&&this.history.splice(0,this.history.length-200),this.pending.push(a),this.log(a)}log(a){}constructor(){this.history=[],this.pending=[]}}let e=new d},24663:(a,b,c)=>{"use strict";c.d(b,{$d:()=>h,t4:()=>e,a2:()=>i,yy:()=>j});let d=["text_delta","thinking_delta","tool_start","tool_end","done","error","status"];function e(a){let b=a.trim();if(!b.startsWith("data:"))return null;let c=b.slice(5).trim();if(!c||"[DONE]"===c)return null;try{let a=JSON.parse(c);if(!(a&&"object"==typeof a)||"string"!=typeof a.type||!d.includes(a.type))return null;return a}catch{return null}}let f=new Set([401,403,429]),g=[/api.?key/i,/model.*not.?found/i,/authentication/i,/unauthorized/i,/forbidden/i];function h(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}function i(a){return Math.min(1e3*2**a,1e4)}function j(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})})}},26161:(a,b,c)=>{"use strict";c.d(b,{b:()=>g});var d=c(78520),e=c(42807),f=c(67395);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}}},26866:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(72269),e=c(78520),f=c(28761),g=c(48712),h=c(63301),i=c(55433),j=c(55231),k=c(33659);function l({selectedAgent:a,onSelect:b,installedAgents:c,loading:l=!1}){let{t:m}=(0,k.Y)(),n=m.panels?.agents??{acpDefaultAgent:"MindOS",acpSelectAgent:"Select Agent",acpChangeAgent:"Change agent"},[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,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:`
31
26
  inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
32
27
  text-2xs font-medium transition-colors
33
28
  border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
@@ -58,27 +53,20 @@ Be specific and actionable. Format in Markdown.`}(a,b,g)}],currentFile:c};h&&(i.
58
53
  fixed bottom-14 left-14 z-40 pointer-events-none
59
54
  transition-all duration-200
60
55
  ${"visible"===c?"opacity-100 translate-y-0":"opacity-0 translate-y-2"}
61
- `,children:(0,d.jsxs)("div",{className:"pointer-events-auto flex flex-col gap-2.5 bg-card border border-border rounded-xl shadow-lg px-4 py-3 w-[290px]",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"mt-[5px] w-2 h-2 rounded-full bg-[var(--amber)] shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-foreground leading-snug",children:s}),t&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t})]}),(0,d.jsx)("button",{type:"button",onClick:q,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":"Dismiss",children:(0,d.jsx)(f.A,{size:13})})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded-lg text-[var(--amber-foreground)] bg-[var(--amber)] hover:opacity-90 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:b.viewDetails}),(0,d.jsx)("button",{type:"button",onClick:q,className:"flex-1 px-3 py-1.5 text-xs rounded-lg text-muted-foreground border border-border hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r?b.skipAll:b.skipVersion})]})]})})}},33500:(a,b,c)=>{"use strict";c.d(b,{C:()=>e});var d=c(78520);function e(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(null),[f,g]=(0,d.useState)([]),[h,i]=(0,d.useState)(0),j=(0,d.useRef)(!1),k=(0,d.useCallback)(async()=>{b((await fetch("/api/skills").then(a=>a.ok?a.json():{skills:[]}).then(a=>Array.isArray(a?.skills)?a.skills:[]).catch(()=>[])).filter(a=>a.enabled)),j.current=!0},[]),l=(0,d.useCallback)((b,c)=>{let d=b.slice(0,c),f=d.lastIndexOf("/");if(-1===f||f>0&&" "!==d[f-1]&&"\n"!==d[f-1])return void e(null);let h=d.slice(f+1);if(h.includes(" "))return void e(null);if(!j.current){k(),e(null);return}let l=h.toLowerCase(),m=l?a.map(a=>{let b=a.name.toLowerCase(),c=0;return b.startsWith(l)?c=100:b.includes(l)?c=50:a.description.toLowerCase().includes(l)&&(c=10),{s:a,score:c}}).filter(a=>a.score>0).sort((a,b)=>b.score-a.score).slice(0,20).map(a=>({type:"skill",name:a.s.name,description:a.s.description})):a.slice(0,20).map(a=>({type:"skill",name:a.name,description:a.description}));if(0===m.length){e(null),g([]),i(0);return}e(h),g(m),i(0)},[a,k]),m=(0,d.useCallback)(a=>{0!==f.length&&("down"===a?i(a=>Math.min(a+1,f.length-1)):i(a=>Math.max(a-1,0)))},[f.length]);return{slashQuery:c,slashResults:f,slashIndex:h,updateSlashFromInput:l,navigateSlash:m,resetSlash:(0,d.useCallback)(()=>{e(null),g([]),i(0)},[])}}},33659:(a,b,c)=>{"use strict";c.d(b,{D:()=>f,Y:()=>g});var d=c(12187),e=c(53333);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()}},34558:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GraphRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/graph/GraphRenderer.tsx","GraphRenderer")},34955:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/components/ShellLayout.tsx","default")},35542:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ImageRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/image/ImageRenderer.tsx","ImageRenderer")},35564:(a,b,c)=>{"use strict";c.d(b,{m:()=>f});var d=c(24663);let e=new Set(["write_file","create_file","batch_create_files","update_section","insert_after_heading","delete_file","rename_file","create_space"]);async function f(a,b,c){let f=a.getReader(),g=new TextDecoder,h="",i=[],j=new Map,k=null,l=null,m=Date.now();function n(){let a=i.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:m}}function o(a,b){let c=j.get(a);return c||(c={type:"tool-call",toolCallId:a,toolName:b??"unknown",input:void 0,state:"pending"},j.set(a,c),i.push(c),k=null),c}try{for(;!c?.aborted;){let{done:a,value:c}=await f.read();if(a&&!h)break;a||(h+=g.decode(c,{stream:!0}));let j=a?[h]:h.split("\n");h=a?"":j.pop()??"";let m=!1;for(let a of j){let b=a.trim(),c=(0,d.t4)(b);if(c)switch(c.type){case"text_delta":{let a=function(a){if(k===a){let a=i[i.length-1];if(a&&"text"===a.type)return a}let b={type:"text",text:""};return i.push(b),k=a,b}("text");a.text+=c.delta??"",m=!0;break}case"thinking_delta":l||(l={type:"reasoning",text:""},i.push(l),k=null),l.text+=c.delta??"",m=!0;break;case"tool_start":{let a=c.toolCallId;if(!a)break;let b=c.toolName,d=o(a,b);d.input=c.args,d.state="running",m=!0;break}case"tool_end":{let a=c.toolCallId;if(!a)break;let b=o(a,c.toolName);b.output=c.output??"",b.state=c.isError?"error":"done",m=!0,c.isError||e.has(b.toolName);break}case"error":{let a=c.message;i.push({type:"text",text:`
56
+ `,children:(0,d.jsxs)("div",{className:"pointer-events-auto flex flex-col gap-2.5 bg-card border border-border rounded-xl shadow-lg px-4 py-3 w-[290px]",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"mt-[5px] w-2 h-2 rounded-full bg-[var(--amber)] shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-foreground leading-snug",children:s}),t&&(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t})]}),(0,d.jsx)("button",{type:"button",onClick:q,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":"Dismiss",children:(0,d.jsx)(f.A,{size:13})})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded-lg text-[var(--amber-foreground)] bg-[var(--amber)] hover:opacity-90 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:b.viewDetails}),(0,d.jsx)("button",{type:"button",onClick:q,className:"flex-1 px-3 py-1.5 text-xs rounded-lg text-muted-foreground border border-border hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r?b.skipAll:b.skipVersion})]})]})})}},33500:(a,b,c)=>{"use strict";c.d(b,{C:()=>e});var d=c(78520);function e(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(null),[f,g]=(0,d.useState)([]),[h,i]=(0,d.useState)(0),j=(0,d.useRef)(!1),k=(0,d.useCallback)(async()=>{b((await fetch("/api/skills").then(a=>a.ok?a.json():{skills:[]}).then(a=>Array.isArray(a?.skills)?a.skills:[]).catch(()=>[])).filter(a=>a.enabled)),j.current=!0},[]),l=(0,d.useCallback)((b,c)=>{let d=b.slice(0,c),f=d.lastIndexOf("/");if(-1===f||f>0&&" "!==d[f-1]&&"\n"!==d[f-1])return void e(null);let h=d.slice(f+1);if(h.includes(" "))return void e(null);if(!j.current){k(),e(null);return}let l=h.toLowerCase(),m=l?a.map(a=>{let b=a.name.toLowerCase(),c=0;return b.startsWith(l)?c=100:b.includes(l)?c=50:a.description.toLowerCase().includes(l)&&(c=10),{s:a,score:c}}).filter(a=>a.score>0).sort((a,b)=>b.score-a.score).slice(0,20).map(a=>({type:"skill",name:a.s.name,description:a.s.description})):a.slice(0,20).map(a=>({type:"skill",name:a.name,description:a.description}));if(0===m.length){e(null),g([]),i(0);return}e(h),g(m),i(0)},[a,k]),m=(0,d.useCallback)(a=>{0!==f.length&&("down"===a?i(a=>Math.min(a+1,f.length-1)):i(a=>Math.max(a-1,0)))},[f.length]);return{slashQuery:c,slashResults:f,slashIndex:h,updateSlashFromInput:l,navigateSlash:m,resetSlash:(0,d.useCallback)(()=>{e(null),g([]),i(0)},[])}}},33659:(a,b,c)=>{"use strict";c.d(b,{D:()=>f,Y:()=>g});var d=c(12187),e=c(53333);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()}},33966:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});var d=c(5025);let e=(0,d.createServerReference)("405c268338104564b3515ba0c568ffa466d3b52f50",d.callServer,void 0,d.findSourceMapURL,"undoDeleteAction")},34558:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GraphRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/graph/GraphRenderer.tsx","GraphRenderer")},34955:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/components/ShellLayout.tsx","default")},35542:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ImageRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/image/ImageRenderer.tsx","ImageRenderer")},35564:(a,b,c)=>{"use strict";c.d(b,{m:()=>f});var d=c(24663);let e=new Set(["write_file","create_file","batch_create_files","update_section","insert_after_heading","delete_file","rename_file","create_space"]);async function f(a,b,c){let f=a.getReader(),g=new TextDecoder,h="",i=[],j=new Map,k=null,l=null,m=Date.now();function n(){let a=i.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:m}}function o(a,b){let c=j.get(a);return c||(c={type:"tool-call",toolCallId:a,toolName:b??"unknown",input:void 0,state:"pending"},j.set(a,c),i.push(c),k=null),c}try{for(;!c?.aborted;){let{done:a,value:c}=await f.read();if(a&&!h)break;a||(h+=g.decode(c,{stream:!0}));let j=a?[h]:h.split("\n");h=a?"":j.pop()??"";let m=!1;for(let a of j){let b=a.trim(),c=(0,d.t4)(b);if(c)switch(c.type){case"text_delta":{let a=function(a){if(k===a){let a=i[i.length-1];if(a&&"text"===a.type)return a}let b={type:"text",text:""};return i.push(b),k=a,b}("text");a.text+=c.delta??"",m=!0;break}case"thinking_delta":l||(l={type:"reasoning",text:""},i.push(l),k=null),l.text+=c.delta??"",m=!0;break;case"tool_start":{let a=c.toolCallId;if(!a)break;let b=c.toolName,d=o(a,b);d.input=c.args,d.state="running",m=!0;break}case"tool_end":{let a=c.toolCallId;if(!a)break;let b=o(a,c.toolName);b.output=c.output??"",b.state=c.isError?"error":"done",m=!0,c.isError||e.has(b.toolName);break}case"error":{let a=c.message;i.push({type:"text",text:`
62
57
 
63
58
  **Stream Error:** ${a}`}),k=null,m=!0}}}if(m&&b(n()),a)break}}finally{f.releaseLock()}let p=!1;for(let a of j.values())("running"===a.state||"pending"===a.state)&&(a.state="error",a.output=a.output??"Stream ended before tool completed",p=!0);return p&&b(n()),n()}},35879:(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"])},36768:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(41496);let e=async a=>[{type:"image/svg+xml",sizes:"any",url:(0,d.fillMetadataSegment)(".",await a.params,"icon.svg")+"?3c05474ce4fc06a8"}]},37029:(a,b,c)=>{"use strict";c.d(b,{P:()=>d,u:()=>e});let d=[{id:"telegram",name:"Telegram",icon:"\uD83D\uDCF1",guide:"1. Open Telegram → search @BotFather\n2. Send /newbot → follow prompts\n3. Copy the token below",purpose:"Receive MindOS notifications and quick updates in Telegram.",purposeZh:"通过 Telegram 接收 MindOS 的通知和快速更新。",useCases:["Agent completion alerts","Error notifications","Test messages"],useCasesZh:["Agent 完成提醒","错误通知","测试消息"],recipientExample:"e.g. chat ID like 123456789 or -1001234567890",recipientExampleZh:"例如 123456789 或 -1001234567890 这样的 chat ID",fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456789:AABBccDD-EeFfGgHh...",hint:"Format: number:alphanumeric"}]},{id:"feishu",name:"Feishu",icon:"\uD83D\uDC26",guide:"1. open.feishu.cn → Create App\n2. Credentials page → copy App ID & Secret\n3. Enable Bot capability + add permissions",guideUrl:"https://open.feishu.cn/",editHint:"Need to update credentials? Edit and save below — MindOS will reconnect automatically.",purpose:"Receive MindOS results in Feishu, or let users message the bot directly when conversations are enabled.",purposeZh:"通过飞书接收 MindOS 的结果;开启对话后,也可以让用户直接在飞书里给机器人发消息。",useCases:["Agent completion alerts","Error notifications","Test messages","Direct bot conversations in Feishu"],useCasesZh:["Agent 完成提醒","错误通知","测试消息","在飞书里直接与机器人对话"],recipientExample:"e.g. ou_xxx, oc_xxx, or a work email",recipientExampleZh:"例如 ou_xxx、oc_xxx,或企业邮箱",fields:[{key:"app_id",label:"App ID",placeholder:"CLI_XXXXXXXXXXXXXXXXX",hint:"From Credentials page on open.feishu.cn"},{key:"app_secret",label:"App Secret",placeholder:"XXXXXXXXXXXXXXXXXXXXXXXX",hint:"Keep this secret — do not share"}]},{id:"discord",name:"Discord",icon:"\uD83D\uDCAC",guide:"1. discord.com/developers → New Application\n2. Bot tab → Reset Token → copy\n3. Enable Message Content Intent",purpose:"Send MindOS updates into Discord channels and DMs.",purposeZh:"把 MindOS 的更新发送到 Discord 频道或私信。",useCases:["Agent completion alerts","Error notifications","Test messages"],useCasesZh:["Agent 完成提醒","错误通知","测试消息"],recipientExample:"e.g. Discord channel or user ID",recipientExampleZh:"例如 Discord 频道 ID 或用户 ID",fields:[{key:"bot_token",label:"Bot Token",placeholder:"MTIxNzM..."}]},{id:"slack",name:"Slack",icon:"\uD83D\uDCBC",guide:"1. api.slack.com/apps → Create New App\n2. OAuth & Permissions → add chat:write scope\n3. Install to Workspace → copy Bot Token",purpose:"Route MindOS notifications into Slack channels and direct messages.",purposeZh:"把 MindOS 的通知发送到 Slack 频道或私信。",useCases:["Agent completion alerts","Error notifications","Test messages"],useCasesZh:["Agent 完成提醒","错误通知","测试消息"],recipientExample:"e.g. Slack channel or user ID like C123... or U123...",recipientExampleZh:"例如 Slack 频道 ID 或用户 ID(如 C123... / U123...)",fields:[{key:"bot_token",label:"Bot Token",placeholder:"xoxb-xxxx-xxxx-xxxx",hint:"Starts with xoxb-"}]},{id:"wecom",name:"WeCom",icon:"\uD83C\uDFE2",guide:"1. Group chat → Add Robot → Custom\n2. Copy Webhook URL\n3. Extract the key parameter from URL",purpose:"Deliver MindOS notifications into WeCom group chats.",purposeZh:"把 MindOS 通知投递到企业微信群聊。",useCases:["Agent completion alerts","Error notifications","Test messages"],useCasesZh:["Agent 完成提醒","错误通知","测试消息"],recipientExample:"Use your configured robot or WeCom target",recipientExampleZh:"使用你配置好的机器人或企业微信目标",fields:[{key:"webhook_key",label:"Webhook Key",placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",hint:"The key= value from webhook URL"}]},{id:"dingtalk",name:"DingTalk",icon:"\uD83D\uDD14",guide:"1. Group → Settings → Smart Assistant → Add Robot\n2. Select Custom (Webhook)\n3. Copy the full Webhook URL",purpose:"Push MindOS notifications into DingTalk groups.",purposeZh:"把 MindOS 通知发送到钉钉群。",useCases:["Agent completion alerts","Error notifications","Test messages"],useCasesZh:["Agent 完成提醒","错误通知","测试消息"],recipientExample:"Use your configured DingTalk robot target",recipientExampleZh:"使用你配置好的钉钉机器人目标",fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",hint:"Full URL including access_token"}]},{id:"wechat",name:"WeChat",icon:"\uD83D\uDC9A",guide:"1. Visit ilinkai.weixin.qq.com\n2. Register & create a bot application\n3. QR login in the console → copy Bot Token from dashboard",purpose:"Send MindOS updates to WeChat via your configured bot.",purposeZh:"通过你配置好的机器人把 MindOS 更新发送到微信。",useCases:["Agent completion alerts","Error notifications","Test messages"],useCasesZh:["Agent 完成提醒","错误通知","测试消息"],recipientExample:"Use the WeChat user or chat ID supported by your bot",recipientExampleZh:"使用你的机器人支持的微信用户或群聊 ID",fields:[{key:"bot_token",label:"Bot Token",placeholder:"wx_xxxxxxxxxxxxxxxx",hint:"From iLink Bot console after QR login"}]},{id:"qq",name:"QQ",icon:"\uD83D\uDC27",guide:"1. q.qq.com → Create Bot\n2. Development tab → copy App ID & Secret\n3. Add group/C2C intents as needed",purpose:"Deliver MindOS notifications through QQ bot channels.",purposeZh:"通过 QQ 机器人频道接收 MindOS 通知。",useCases:["Agent completion alerts","Error notifications","Test messages"],useCasesZh:["Agent 完成提醒","错误通知","测试消息"],recipientExample:"Use the QQ openid or group_openid for your target",recipientExampleZh:"使用目标 QQ 的 openid 或 group_openid",fields:[{key:"app_id",label:"App ID",placeholder:"102xxxxxx"},{key:"app_secret",label:"App Secret",placeholder:"xxxxxxxxxxxxxxxxxxxxxxxx"}]}];function e(a){return d.find(b=>b.id===a)}},37566:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>j});var d=c(72269),e=c(78520),f=c(53679),g=c(63301),h=c(55433),i=c(63353);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)}
64
- `),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."})}},38416:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/config/ConfigRenderer.tsx","ConfigRenderer")},39234:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call CsvRenderer() from the server but CsvRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/packages/web/components/renderers/csv/CsvRenderer.tsx","CsvRenderer")},39486:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(72269),e=c(78520),f=c(28761),g=c(37461),h=c(74917),i=c(63301),j=c(55231),k=c(76867);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),u=(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})},[]),v=(0,e.useRef)(0);(0,e.useCallback)(()=>{v.current||(v.current=requestAnimationFrame(()=>{v.current=0,u()}))},[u]);let w=(0,e.useCallback)(()=>n(!1),[]),x=(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]),y=(0,e.useMemo)(()=>o?o.split("/"):[],[o]),z=a=>{if(a<0)p(""),c("");else{let b=y.slice(0,a+1).join("/");p(b),c(b)}},A=b?b.split("/").map(a=>(0,k.vr)(a)).join(" / "):"/ "+l,B=m&&q&&(0,f.createPortal)((0,d.jsxs)("div",{ref:t,className:"fixed z-50 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:()=>z(-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]}),y.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:()=>z(b),className:`px-1.5 py-0.5 rounded transition-colors truncate max-w-[100px] ${b===y.length-1?"text-[var(--amber)] font-medium":"text-muted-foreground hover:text-foreground"}`,children:a})]},b))]}),x.length>0?(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:x.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:w,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:A}),(0,d.jsx)(j.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${m?"rotate-180":""}`})]}),B]})}},40192:(a,b,c)=>{"use strict";c.d(b,{A:()=>C});var d=c(72269),e=c(78520),f=c(35959),g=c(22762),h=c(69005),i=c(65241),j=c(42362),k=c(20634),l=c(37277),m=c(35205),n=c(51832),o=c(69425),p=c(41559),q=c(57262),r=c(42102),s=c(55231),t=c(85224),u=c(9518),v=c(33659),w=c(75571),x=c(18620),y=c(6234),z=c(71977);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})]})]})]})}},40206:(a,b,c)=>{"use strict";c.r(b),c.d(b,{SummaryRenderer:()=>g,appendSummaryStreamChunk:()=>f,renderMarkdown:()=>e});var d=c(52707);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call renderMarkdown() from the server but renderMarkdown 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/packages/web/components/renderers/summary/SummaryRenderer.tsx","renderMarkdown"),f=(0,d.registerClientReference)(function(){throw Error("Attempted to call appendSummaryStreamChunk() from the server but appendSummaryStreamChunk 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/packages/web/components/renderers/summary/SummaryRenderer.tsx","appendSummaryStreamChunk"),g=(0,d.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/packages/web/components/renderers/summary/SummaryRenderer.tsx","SummaryRenderer")},41726:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>D});var d=c(72269),e=c(78520),f=c.n(e),g=c(11366),h=c(89292),i=c(64149),j=c(63151),k=c(74077),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:"var(--tool-read)"},{bg:"rgba(200,160,216,0.12)",text:"var(--tool-search)"},{bg:"rgba(200,96,96,0.12)",text:"var(--error)"},{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(72640),q=c(31634),r=c(55231),s=c(32068),t=c(63353);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"),10);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(55433),A=c(12516);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:"w-full 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})]})}},41761:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>af,Fo:()=>K,gL:()=>L});var d=c(72269),e=c(78520),f=c(35959),g=c(35879),h=c(76867),i=c(90697),j=c(23095),k=c(53679),l=c(55231),m=c(69733),n=c(40303),o=c(3278),p=c(74917),q=c(62746),r=c(89189),s=c(81644),t=c(25860),u=c(32068),v=c(5025);let w=(0,v.createServerReference)("609444cc6bbf47a5b7c6b928461403b8e6e4abf5c4",v.callServer,void 0,v.findSourceMapURL,"createFileAction"),x=(0,v.createServerReference)("6098a057357252360a4d7656e31f0f7f3a560cebd9",v.callServer,void 0,v.findSourceMapURL,"renameSpaceAction");var y=c(92728);let z=(0,v.createServerReference)("406e81bfc57cfec55d08a5b8e31855f654fd7ff5e9",v.callServer,void 0,v.findSourceMapURL,"deleteSpaceAction"),A=(0,v.createServerReference)("401b8173854cd55615199ff5f1d57641739a2f0fd3",v.callServer,void 0,v.findSourceMapURL,"deleteFolderAction");var B=c(88299),C=c(98081),D=c(74569),E=c(33659),F=c(73420),G=c(48509);let H="show-hidden-files";function I(a){let b=b=>{b.key===H&&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 J(){return!1}function K(a){localStorage.setItem(H,String(a)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function L(){return(0,e.useSyncExternalStore)(I,J,()=>!1)}var M=c(63353),N=c(44046),O=c(31448);let P=(0,v.createServerReference)("4032b5558036dc9b69cb9d014cbd06c075a25eef26",v.callServer,void 0,v.findSourceMapURL,"convertToSpaceAction");var Q=c(10002);async function R(){try{let a=await (0,Q.n)("/api/settings"),b=a.ai?.provider??"",c=(a.ai?.providers??{})[b];return!!c?.apiKey}catch{return!1}}function S(a){for(let b of a.split("\n")){let a=b.trim();if(!a.startsWith("data:"))continue;let c=a.slice(5).trim();if(c)try{let a=JSON.parse(c);if("error"===a.type)return String(a.message||"AI initialization failed")}catch{}}return null}async function T(a){let b=a.getReader(),c=new TextDecoder,d="";try{for(;;){let{done:a,value:e}=await b.read();if(a)break;let f=(d+=c.decode(e,{stream:!0})).split("\n");d=f.pop()??"";let g=S(f.join("\n"));if(g)throw Error(g)}if(d){let a=S(d);if(a)throw Error(a)}}finally{b.releaseLock()}}async function U(a){try{await navigator.clipboard.writeText(a)}catch{}}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,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})}function Z({x:a,y:b,node:c,onClose:e,onRename:g,onNewFile:i,onImport:j,onDelete:k}){let l=(0,f.useRouter)(),{t:m}=(0,E.Y)(),{isPinned:n,togglePin:o}=(0,G.Z)(),p=n(c.path);return(0,d.jsxs)(Y,{x:a,y:b,onClose:e,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{i(),e()},children:[(0,d.jsx)(M.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,d.jsxs)("button",{className:V,onClick:()=>{l.push(`/view/${(0,h.O0)(`${c.path}/INSTRUCTION.md`)}`),e()},children:[(0,d.jsx)(N.A,{size:14,className:"shrink-0"})," ",m.fileTree.viewRules]}),j&&(0,d.jsxs)("button",{className:V,onClick:()=>{j(c.path),e()},children:[(0,d.jsx)(O.A,{size:14,className:"shrink-0"})," ",m.fileTree.importFile]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:V,onClick:()=>{o(c.path),e()},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${p?"fill-[var(--amber)] text-[var(--amber)]":""}`}),p?m.fileTree.removeFromFavorites:m.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:V,onClick:()=>{U(c.path),e()},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{g(),e()},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",m.fileTree.renameSpace]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:()=>{e(),k()},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"}),m.fileTree.deleteSpace]})]})}function $({x:a,y:b,node:c,onClose:g,onRename:h,onNewFile:i,onDelete:j}){let k=(0,f.useRouter)(),{t:l}=(0,E.Y)(),[m,o]=(0,e.useTransition)(),{isPinned:p,togglePin:q}=(0,G.Z)(),v=p(c.path);return(0,d.jsxs)(Y,{x:a,y:b,onClose:g,menuHeight:220,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{i(),g()},children:[(0,d.jsx)(M.A,{size:14,className:"shrink-0"})," ",l.fileTree.newFile]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:V,onClick:()=>{q(c.path),g()},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${v?"fill-[var(--amber)] text-[var(--amber)]":""}`}),v?l.fileTree.removeFromFavorites:l.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:V,disabled:m,onClick:()=>{o(async()=>{if((await P(c.path)).success){k.refresh(),window.dispatchEvent(new Event("mindos:files-changed"));let a=c.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||c.name;R().then(b=>{b&&function(a,b,c=""){let d="u">typeof document&&"zh"===document.documentElement.lang?`初始化新建的心智空间「${a}」,路径为「${b}/」。${c?`描述:「${c}」。`:""}两个文件均已存在模板,用 write_file 覆盖:
65
- 1. 「${b}/README.md」— 写入空间用途、结构概览、使用指南
66
- 2. 「${b}/INSTRUCTION.md」— 写入 AI Agent 在此空间中的行为规则和操作约定
67
-
68
- 内容简洁实用,直接使用工具写入。`:`Initialize the new Mind Space "${a}" at "${b}/". ${c?`Description: "${c}". `:""}Both files already exist with templates — use write_file to overwrite:
69
- 1. "${b}/README.md" — write purpose, structure overview, usage guidelines
70
- 2. "${b}/INSTRUCTION.md" — write rules for AI agents operating in this space
71
-
72
- 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}`);await T(a.body),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"}}))})}(a,c.path)})}g()})},children:[(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"})," ",l.fileTree.convertToSpace]}),(0,d.jsxs)("button",{className:V,onClick:()=>{U(c.path),g()},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",l.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{h(),g()},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",l.fileTree.rename]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:()=>{g(),j()},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"}),l.fileTree.deleteFolder]})]})}var _=c(51522);function aa(){window.dispatchEvent(new Event("mindos:files-changed"))}async function ab(a){try{await navigator.clipboard.writeText(a)}catch{}}function ac({dirPath:a,depth:b,onDone:c}){let[g,i]=(0,e.useState)(""),[j,l]=(0,e.useTransition)(),[m,n]=(0,e.useState)(""),o=(0,f.useRouter)(),{t:p}=(0,E.Y)(),q=(0,e.useRef)(null),r=(0,e.useCallback)(()=>{let b=g.trim();b?l(async()=>{let d=await w(a,b);d.success&&d.filePath?(c(),o.push(`/view/${(0,h.O0)(d.filePath)}`),o.refresh(),aa()):n(d.error||p.fileTree.failed)}):n(p.fileTree.enterFileName)},[g,a,c,o,p]);return(0,d.jsxs)("div",{ref:q,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),n("")},onKeyDown:a=>{"Enter"===a.key&&r(),"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)(k.A,{size:13,className:"text-muted-foreground animate-spin shrink-0"}):(0,d.jsx)("button",{onClick:r,className:"text-xs text-[var(--amber)] hover:text-foreground shrink-0 px-1",children:p.fileTree.create})]}),m&&(0,d.jsx)("p",{className:"text-xs text-error mt-0.5 px-1",children:m})]})}let ad=(0,e.memo)(function({node:a,depth:b,currentPath:c,onNavigate:i,maxOpenDepth:j,onImport:r}){let s=(0,f.useRouter)(),t=c.startsWith(a.path+"/")||c===a.path,u=!!a.isSpace,[v,w]=(0,e.useState)(0===b||t),[C,G]=(0,e.useState)(0===b||t),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(!1),[L,M]=(0,e.useState)(a.name),[N,O]=(0,e.useTransition)(),P=(0,e.useRef)(null),Q=(0,e.useRef)(null),[R,S]=(0,e.useState)(null),{t:T}=(0,E.Y)(),[U,V]=(0,e.useState)(null),[W,X]=(0,e.useTransition)(),{isDragTarget:Y,handleRowDragOver:ab,handleRowDragEnter:ad,handleRowDragLeave:ae,handleRowDrop:ag}=function(a,b,c,d){let[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,e.useRef)(null),j=(0,e.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),k=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",i.current&&(clearTimeout(i.current),i.current=null),f||g(!0))},[f]),l=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),g(!0),j(),b||(h.current=setTimeout(()=>{c(!0),h.current=null},500)))},[b,j,c]);return{isDragTarget:f,handleRowDragOver:k,handleRowDragEnter:l,handleRowDragLeave:(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.stopPropagation(),i.current=setTimeout(()=>{g(!1),j(),i.current=null},50))},[j]),handleRowDrop:(0,e.useCallback)(b=>{b.preventDefault(),b.stopPropagation(),g(!1),j(),i.current&&(clearTimeout(i.current),i.current=null);let c=b.dataTransfer.files;c.length>0&&(0,_.Nh)(Array.from(c),a.path,d)},[a.path,d,j])}}(a,v,(0,e.useCallback)(a=>{w(a),a&&G(!0)},[]),T),ah=(0,e.useCallback)(()=>{w(a=>(a||G(!0),!a))},[]),ai=(0,e.useRef)(void 0);(0,e.useEffect)(()=>{if(null==j){ai.current=j;return}if(ai.current!==j){if(null===ai.current||void 0===ai.current)b>j?w(!1):G(!0);else{let a=b<=j;w(a),a&&G(!0)}ai.current=j}},[j,b]),(0,e.useEffect)(()=>()=>{Q.current&&clearTimeout(Q.current)},[]);let aj=(0,e.useCallback)(b=>{b?.preventDefault(),b?.stopPropagation(),Q.current&&(clearTimeout(Q.current),Q.current=null),M(a.name),K(!0),setTimeout(()=>P.current?.select(),0)},[a.name]),ak=(0,e.useCallback)(()=>{let b=L.trim();b&&b!==a.name?O(async()=>{let c=u?x:y.f,d=await c(a.path,b);d.success&&d.newPath?(K(!1),s.push(`/view/${(0,h.O0)(d.newPath)}`),s.refresh(),aa()):K(!1)}):K(!1)},[L,a.name,a.path,s,u]),al=(0,e.useCallback)(()=>{J||(Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{s.push(`/view/${(0,h.O0)(a.path)}`),i?.(),Q.current=null},180))},[J,s,a.path,i]);(0,e.useCallback)(a=>{a.stopPropagation(),ah()},[ah]);let am=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),S({x:a.clientX,y:a.clientY})},[]),an=u?function a(b){return"file"===b.type?+!g.C.has(b.name):(b.children??[]).reduce((b,c)=>b+a(c),0)}(a):0;if(J)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:L,onChange:a=>M(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ak(),"Escape"===a.key&&K(!1)},onBlur:ak,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"}),N&&(0,d.jsx)(k.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let ao=u&&0===b;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:`relative group/dir flex items-center transition-colors duration-100 ${Y?"bg-[var(--amber)]/10 rounded-md":""}`,onContextMenu:am,onDragEnter:ad,onDragOver:ab,onDragLeave:ae,onDrop:ag,children:[(0,d.jsx)("button",{onClick:ah,className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground transition-colors",style:{marginLeft:`${12*b+4}px`},"aria-label":v?`Collapse ${a.name}`:`Expand ${a.name}`,"aria-expanded":v,children:(0,d.jsx)("span",{className:"block transition-transform duration-150",style:{transform:v?"rotate(0deg)":"rotate(-90deg)"},children:(0,d.jsx)(l.A,{size:10})})}),(0,d.jsxs)("button",{type:"button",onClick:al,draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.setData("text/mindos-type","directory"),b.dataTransfer.effectAllowed="copy"},className:`
73
- flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
74
- text-sm transition-colors duration-100
75
- hover:bg-muted cursor-default
76
- ${t?"text-foreground":"text-muted-foreground hover:text-foreground"}
77
- `,children:[u?"Inbox"===a.name?(0,d.jsx)(m.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):v?(0,d.jsx)(o.A,{size:14,className:"text-yellow-400 shrink-0"}):(0,d.jsx)(p.A,{size:14,className:"text-yellow-400 shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),u&&!v&&(0,d.jsx)("span",{className:"ml-auto text-xs text-muted-foreground shrink-0 tabular-nums pr-1",children:an})]}),(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)(q.A,{size:14})})})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${v?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsxs)("div",{className:`overflow-hidden ${ao?"border-l-2 ml-[18px]":""}`,style:ao?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!v&&{inert:!0},children:[C&&a.children&&(0,d.jsx)(af,{nodes:a.children,depth:ao?1:b+1,onNavigate:i,maxOpenDepth:j,parentIsSpace:u,onImport:r}),H&&(0,d.jsx)(ac,{dirPath:a.path,depth:ao?0:b,onDone:()=>I(!1)})]})}),R&&(u?(0,d.jsx)(Z,{x:R.x,y:R.y,node:a,onClose:()=>S(null),onRename:()=>aj(),onNewFile:()=>{w(!0),G(!0),I(!0)},onImport:r,onDelete:()=>V("space")}):(0,d.jsx)($,{x:R.x,y:R.y,node:a,onClose:()=>S(null),onRename:()=>aj(),onNewFile:()=>{w(!0),G(!0),I(!0)},onDelete:()=>V("folder")})),(0,d.jsx)(F.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 z(a.path):await A(a.path);if(b.success&&b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;D.oR.undo(`${T.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,B.Y)(c);a.success?(s.refresh(),aa()):D.oR.error(a.error??"Undo failed")},{label:T.trash?.undo??"Undo"}),s.push("/"),s.refresh(),aa()}})}})]})}),ae=(0,e.memo)(function({node:a,depth:b,currentPath:c,onNavigate:l}){let m=(0,f.useRouter)(),n=c===a.path,[o,p]=(0,e.useState)(!1),[v,w]=(0,e.useState)(a.name),[x,z]=(0,e.useTransition)(),[,A]=(0,e.useTransition)(),H=(0,e.useRef)(null),{t:I}=(0,E.Y)(),{isPinned:J,togglePin:K}=(0,G.Z)(),L=J(a.path),M=!a.path.includes("/")&&g.A.has(a.name),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(null),R=(0,e.useCallback)(()=>{o||(m.push(`/view/${(0,h.O0)(a.path)}`),l?.())},[m,a.path,l,o]),S=(0,e.useCallback)(b=>{b.stopPropagation(),w(a.name),p(!0),setTimeout(()=>H.current?.select(),0)},[a.name]),T=(0,e.useCallback)(()=>{let b=v.trim();b&&b!==a.name?z(async()=>{let c=await (0,y.f)(a.path,b);c.success&&c.newPath?(p(!1),m.push(`/view/${(0,h.O0)(c.newPath)}`),m.refresh(),aa()):p(!1)}):p(!1)},[v,a.name,a.path,m]),U=(0,e.useCallback)(a=>{a.stopPropagation(),O(!0)},[]),Z=(0,e.useCallback)(b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.effectAllowed="copy"},[a.path]),$=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),Q({x:a.clientX,y:a.clientY})},[]);return o?(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:H,autoFocus:!0,value:v,onChange:a=>w(a.target.value),onKeyDown:a=>{"Enter"===a.key&&T(),"Escape"===a.key&&p(!1)},onBlur:T,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"}),x&&(0,d.jsx)(k.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:R,onContextMenu:$,draggable:!0,onDragStart:Z,"data-filepath":a.path,className:`
78
- w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
79
- text-sm transition-colors duration-100 cursor-default pr-16
80
- ${n?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
81
- `,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)(r.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();Q({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)(q.A,{size:14})})}),P&&(0,d.jsxs)(Y,{x:P.x,y:P.y,onClose:()=>Q(null),menuHeight:140,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{ab(a.path),Q(null)},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",I.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{K(a.path),Q(null)},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${L?"fill-[var(--amber)] text-[var(--amber)]":""}`}),L?I.fileTree.removeFromFavorites:I.fileTree.pinToFavorites]}),!M&&(0,d.jsxs)("button",{className:V,onClick:a=>{Q(null),S(a)},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",I.fileTree.rename]}),!M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:a=>{Q(null),U(a)},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"})," ",I.fileTree.delete]})]})]}),(0,d.jsx)(F.TM,{open:N,title:I.fileTree.delete,message:I.fileTree.confirmDelete(a.name),confirmLabel:I.fileTree.delete,cancelLabel:I.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>O(!1),onConfirm:()=>{O(!1),A(async()=>{let b=await (0,C.i)(a.path);if(b.success){if(b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;D.oR.undo(`${I.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,B.Y)(c);a.success?(m.refresh(),aa()):D.oR.error(a.error??"Undo failed")},{label:I.trash?.undo??"Undo"})}m.refresh(),aa()}})}})]})});function af({nodes:a,depth:b=0,onNavigate:c,maxOpenDepth:h,parentIsSpace:i,onImport:j}){var k;let l,m=(l="/view/",(k=(0,f.usePathname)()).startsWith(l)?k.slice(l.length).split("/").map(decodeURIComponent).join("/"):""),n=L(),o=0===b,p=(0,e.useMemo)(()=>{let b=n?a:a.filter(a=>!(o&&a.name.startsWith(".")||"file"===a.type&&g.C.has(a.name)||"directory"===a.type&&a.name.startsWith(".")));return o?b.filter(a=>"directory"!==a.type||"Inbox"!==a.name):b},[a,n,o]);return(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:p.map(a=>"directory"===a.type?(0,d.jsx)(ad,{node:a,depth:b,currentPath:m,onNavigate:c,maxOpenDepth:h,onImport:j},a.path):(0,d.jsx)(ae,{node:a,depth:b,currentPath:m,onNavigate:c},a.path))})}},43456:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TodoRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/todo/TodoRenderer.tsx","TodoRenderer")},43714:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/backlinks/BacklinksRenderer.tsx","BacklinksRenderer")},45057:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(72269),e=c(78520),f=c(23104),g=c.n(f),h=c(63353),i=c(53679),j=c(57262),k=c(14790),l=c(85224),m=c(33659),n=c(76867);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-visible:ring-1 focus-visible: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))})]})]})}},45189:(a,b,c)=>{"use strict";c.d(b,{z:()=>f});var d=c(78520);let e="mindos:acp-detection";function f(){let[a]=(0,d.useState)(()=>(function(){try{let a=sessionStorage.getItem(e);if(!a)return null;let b=JSON.parse(a);if("object"!=typeof b||null===b||Array.isArray(b)||!Array.isArray(b.installed)||!Array.isArray(b.notInstalled)||"number"!=typeof b.ts||Date.now()-b.ts>18e5)return null;return{installed:b.installed,notInstalled:b.notInstalled,ts:b.ts}}catch{return null}})()),b=(0,d.useRef)(a),[c,f]=(0,d.useState)(()=>a?.installed??[]),[g,h]=(0,d.useState)(()=>a?.notInstalled??[]),[i,j]=(0,d.useState)(()=>!a),[k,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(0);(0,d.useRef)(!1);let o=(0,d.useRef)(!1);return{installedAgents:c,notInstalledAgents:g,loading:i,error:k,refresh:(0,d.useCallback)(()=>{try{sessionStorage.removeItem(e)}catch{}b.current=null,o.current=!0,n(a=>a+1)},[])}}},46078:(a,b,c)=>{"use strict";c.d(b,{A:()=>ah});var d=c(72269),e=c(78520),f=c(63301),g=c(81644),h=c(57262),i=c(23095),j=c(67677),k=c(48712),l=c(53679),m=c(6456),n=c(69050),o=c(31448),p=c(35205),q=c(10981),r=c(20634),s=c(83614),t=c(71240),u=c(10425),v=c(41444),w=c(70057),x=c(90245),y=c(7288),z=c(89516),A=c(3278),B=c(10777),C=c(25860),D=c(99820),E=c(49054),F=c(32068),G=c(89805),H=c(46258),I=c(77949),J=c(26911),K=c(90697),L=c(55231),M=c(37461),N=c(14790),O=c(65836),P=c(35508);let Q=new Set(["delete_file","move_file","rename_file","write_file"]),R=new Set(["write_file","create_file","update_section","insert_after_heading","edit_lines","append_to_file"]),S={web_search:z.A,search:p.A,list_files:A.A,read_file:B.A,write_file:C.A,create_file:D.A,append_to_file:i.A,insert_after_heading:E.A,update_section:C.A,delete_file:F.A,rename_file:i.A,move_file:G.A,get_backlinks:H.A,get_history:I.A,get_file_at_version:I.A,get_recent:J.A,append_csv:K.A},T="--- changes ---";function U({part:a}){let b=R.has(a.toolName),c="done"===a.state,[f,g]=(0,e.useState)(null),h=f??(b&&c),i=S[a.toolName]??m.A,j=Q.has(a.toolName),k=(0,e.useMemo)(()=>(function(a){if(!a)return{header:"",stats:"",diffLines:[]};let b=a.indexOf(T);if(-1===b)return{header:a,stats:"",diffLines:[]};let c=a.slice(0,b).trim(),d=a.slice(b+T.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}${k.stats?` (${k.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 ${j?"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)(L.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(M.A,{size:12,className:"shrink-0 text-muted-foreground"}),j&&(0,d.jsx)(N.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)(i,{size:12,className:`shrink-0 ${j?"text-[var(--amber)]":"text-muted-foreground"}`}),(0,d.jsx)("span",{className:`font-medium ${j?"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)(l.A,{size:12,className:"animate-spin text-[var(--amber)]"}):"done"===a.state?(0,d.jsx)(O.A,{size:12,className:"text-success"}):(0,d.jsx)(P.A,{size:12,className:"text-error"})})]}),h&&(0,d.jsx)("div",{className:"border-t border-border/30",children:b&&c&&k.diffLines.length>0?(0,d.jsx)("div",{className:"max-h-64 overflow-y-auto",children:k.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)(l.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 V=c(3505),W=c(33659);function X({text:a,isStreaming:b}){let[c,f]=(0,e.useState)(!1),{t:g}=(0,W.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)(L.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(M.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsx)(V.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}var Y=c(98809),Z=c(14484);function $({label:a,delay:b=800,children:c}){let[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,e.useCallback)(()=>{h.current=setTimeout(()=>g(!0),b)},[b]),j=(0,e.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null),g(!1)},[]);return(0,d.jsxs)("span",{className:"relative inline-flex",onMouseEnter:i,onMouseLeave:j,children:[c,f&&(0,d.jsx)("span",{role:"tooltip",className:"pointer-events-none absolute -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-foreground/90 px-2 py-0.5 text-[11px] font-medium text-background shadow-sm animate-in fade-in-0 slide-in-from-bottom-1 duration-100 z-20",children:a})]})}function _({content:a,isLastUserMessage:b,isLoading:c,onEdit:h,onResend:i,labels:j}){let[k,l]=(0,e.useState)(!1),m=(0,e.useRef)(!1),n=(0,e.useCallback)(()=>{(0,y.l)(a).then(a=>{a&&(l(!0),setTimeout(()=>l(!1),2e3))})},[a]),o=(0,e.useCallback)(()=>{m.current||c||(m.current=!0,setTimeout(()=>{m.current=!1},300),i?.())},[i,c]),p="p-1 rounded-md bg-card border border-border/60 shadow-sm text-muted-foreground transition-colors";return(0,d.jsxs)("div",{className:"absolute -bottom-1 left-1 z-10 flex items-center gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",children:[(0,d.jsx)($,{label:j.copy,children:(0,d.jsx)("button",{type:"button",onClick:n,className:`${p} hover:text-foreground`,children:k?(0,d.jsx)(f.A,{size:11,className:"text-success"}):(0,d.jsx)(g.A,{size:11})})}),b&&!c&&h&&(0,d.jsx)($,{label:j.edit,children:(0,d.jsx)("button",{type:"button",onClick:h,className:`${p} hover:text-foreground`,children:(0,d.jsx)(q.A,{size:11})})}),b&&!c&&i&&(0,d.jsx)($,{label:j.regenerate,children:(0,d.jsx)("button",{type:"button",onClick:o,className:`${p} hover:text-[var(--amber)]`,children:(0,d.jsx)(Z.A,{size:11})})})]})}let aa=/^Use the skill ([^:]+):\s*/;function ab({text:a,label:b}){let[c,h]=(0,e.useState)(!1),i=(0,e.useCallback)(()=>{(0,y.l)(a).then(a=>{a&&(h(!0),setTimeout(()=>h(!1),2e3))})},[a]);return(0,d.jsx)("button",{type:"button",onClick:i,className:"p-1 rounded-md bg-card border border-border/60 shadow-sm text-muted-foreground hover:text-foreground transition-colors",title:b??"Copy",children:c?(0,d.jsx)(f.A,{size:11,className:"text-success"}):(0,d.jsx)(g.A,{size:11})})}function ac({content:a,skillName:b,images:c,attachedFiles:e,uploadedFileNames:f}){let g=b??a.match(aa)?.[1],k=a.match(aa),l=k?a.slice(k[0].length):a,m=new Set(f??[]),n=e?.filter(a=>!m.has(a.split("/").pop()??a)),o=n&&n.length>0||f&&f.length>0;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))}),g&&(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"}),g]}),g?l:a,o&&(0,d.jsxs)("div",{className:"mt-2 pt-1.5 border-t border-white/15 flex flex-wrap gap-1 whitespace-normal",role:"list","aria-label":"Attached files",children:[n?.map(a=>(0,d.jsxs)("span",{role:"listitem",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-white/10 text-white/80 min-w-0",title:a,children:[(0,d.jsx)(i.A,{size:9,className:"shrink-0 opacity-70"}),(0,d.jsx)("span",{className:"truncate max-w-[120px]",children:a.split("/").pop()})]},a)),f?.map(a=>(0,d.jsxs)("span",{role:"listitem",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-white/10 text-white/80 min-w-0",title:a,children:[(0,d.jsx)(j.A,{size:9,className:"shrink-0 opacity-70"}),(0,d.jsx)("span",{className:"truncate max-w-[120px]",children:a})]},a))]})]})}function ad({agentName:a}){return a?(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1 rounded-full border border-[var(--amber)]/15 bg-[var(--amber)]/8 px-2 py-0.5 text-[10px] font-medium tracking-wide text-[var(--amber)]",children:[(0,d.jsx)(k.A,{size:10,className:"shrink-0"}),(0,d.jsx)("span",{children:a})]}):null}function ae({content:a,isStreaming:b}){let c=(0,x.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)(v.oz,{remarkPlugins:[w.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 af({message:a,isStreaming:b}){let c=a.parts;if(!c||0===c.length)return a.content?(0,d.jsx)(ae,{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)(X,{text:a.text,isStreaming:f},`reasoning-${e}`)}if("text"===a.type){let f=b&&e===c.length-1;return a.text?(0,d.jsx)(ae,{content:a.text,isStreaming:f},e):null}return"tool-call"===a.type?(0,d.jsx)(U,{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)(l.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 ag({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)(m.A,{size:10}),(0,d.jsxs)("span",{className:"font-medium",children:["Step ",b.length,e?` — ${e}`:""]})]})}let ah=(0,e.memo)(function({messages:a,isLoading:b,loadingPhase:c,emptyPrompt:f,emptyHint:g,suggestions:h,onSuggestionClick:i,onEditMessage:j,onResendMessage:k,labels:m}){let v=(0,e.useRef)(null),w=(0,e.useRef)(null),[y,z]=(0,e.useState)(!1),A=(0,e.useRef)(!1);(0,e.useRef)(a.length);let B=(0,e.useMemo)(()=>{for(let b=a.length-1;b>=0;b--)if("user"===a[b].role)return b;return -1},[a]),C=(0,e.useCallback)((a="smooth")=>{let b=w.current;b&&b.scrollTo({top:b.scrollHeight,behavior:a})},[]);return(0,d.jsxs)("div",{ref:w,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)(n.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=[o.A,p.A,q.A,r.A],e=c[b%c.length];return(0,d.jsxs)("button",{type:"button",onClick:()=>i(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)(n.A,{size:13,className:"text-[var(--amber)]"})}),"user"===e.role?(0,d.jsxs)("div",{className:"group relative 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)(ac,{content:e.content,skillName:e.skillName,images:e.images,attachedFiles:e.attachedFiles,uploadedFileNames:e.uploadedFileNames}),(0,d.jsx)(_,{content:e.content,isLastUserMessage:f===B,isLoading:b,onEdit:j?()=>j(f):void 0,onResend:k?()=>k(f):void 0,labels:{copy:m.copyMessage??"Copy",edit:m.editMessage??"Edit",regenerate:m.regenerateMessage??"Regenerate"}})]}):e.content.startsWith("__error__")?(0,d.jsxs)("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.jsx)(ad,{agentName:e.agentName}),(0,d.jsxs)("div",{className:"flex items-start gap-2.5 text-error",children:[(0,d.jsx)(s.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.jsxs)("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:[(0,d.jsx)(ad,{agentName:e.agentName}),e.parts&&e.parts.length>0||(0,x.Oo)(e.content)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(af,{message:e,isStreaming:b&&f===a.length-1}),b&&f===a.length-1&&(0,d.jsx)(ag,{parts:e.parts}),!(b&&f===a.length-1)&&(0,x.Oo)(e.content)&&(0,d.jsxs)("div",{className:"absolute -bottom-1 right-1 z-10 flex items-center gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",children:[(0,d.jsx)(Y.x,{text:e.content}),(0,d.jsx)(ab,{text:(0,x.Oo)(e.content),label:m.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)(t.A,{size:14,className:"text-[var(--amber)] animate-pulse"}):(0,d.jsx)(l.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?m.reconnecting??"Reconnecting...":"connecting"===c?m.connecting:"thinking"===c?m.thinking:m.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:v}),y&&a.length>0&&(0,d.jsx)("button",{type:"button",onClick:()=>{A.current=!1,C()},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)(u.A,{size:14})})]})})},47375:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(72269),e=c(69050),f=c(33659),g=c(35959);function h({onToggle:a,askPanelOpen:b}){let{t:c}=(0,f.Y)(),h=(0,g.usePathname)(),i=`${c.ask?.fabLabel??"Ask MindOS"} (⌘/)`;return(0,d.jsxs)("button",{onClick:a,className:`
59
+ `),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."})}},38416:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ConfigRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/config/ConfigRenderer.tsx","ConfigRenderer")},39234:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call CsvRenderer() from the server but CsvRenderer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/MindOS/MindOS/packages/web/components/renderers/csv/CsvRenderer.tsx","CsvRenderer")},39486:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(72269),e=c(78520),f=c(28761),g=c(37461),h=c(74917),i=c(63301),j=c(55231),k=c(76867);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),u=(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})},[]),v=(0,e.useRef)(0);(0,e.useCallback)(()=>{v.current||(v.current=requestAnimationFrame(()=>{v.current=0,u()}))},[u]);let w=(0,e.useCallback)(()=>n(!1),[]),x=(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]),y=(0,e.useMemo)(()=>o?o.split("/"):[],[o]),z=a=>{if(a<0)p(""),c("");else{let b=y.slice(0,a+1).join("/");p(b),c(b)}},A=b?b.split("/").map(a=>(0,k.vr)(a)).join(" / "):"/ "+l,B=m&&q&&(0,f.createPortal)((0,d.jsxs)("div",{ref:t,className:"fixed z-50 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:()=>z(-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]}),y.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:()=>z(b),className:`px-1.5 py-0.5 rounded transition-colors truncate max-w-[100px] ${b===y.length-1?"text-[var(--amber)] font-medium":"text-muted-foreground hover:text-foreground"}`,children:a})]},b))]}),x.length>0?(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:x.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:w,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:A}),(0,d.jsx)(j.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${m?"rotate-180":""}`})]}),B]})}},40192:(a,b,c)=>{"use strict";c.d(b,{A:()=>C});var d=c(72269),e=c(78520),f=c(35959),g=c(22762),h=c(69005),i=c(65241),j=c(42362),k=c(20634),l=c(37277),m=c(35205),n=c(51832),o=c(69425),p=c(41559),q=c(57262),r=c(42102),s=c(55231),t=c(85224),u=c(9518),v=c(33659),w=c(75571),x=c(18620),y=c(6234),z=c(71977);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})]})]})]})}},40206:(a,b,c)=>{"use strict";c.r(b),c.d(b,{SummaryRenderer:()=>g,appendSummaryStreamChunk:()=>f,renderMarkdown:()=>e});var d=c(52707);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call renderMarkdown() from the server but renderMarkdown 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/packages/web/components/renderers/summary/SummaryRenderer.tsx","renderMarkdown"),f=(0,d.registerClientReference)(function(){throw Error("Attempted to call appendSummaryStreamChunk() from the server but appendSummaryStreamChunk 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/packages/web/components/renderers/summary/SummaryRenderer.tsx","appendSummaryStreamChunk"),g=(0,d.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/packages/web/components/renderers/summary/SummaryRenderer.tsx","SummaryRenderer")},41726:(a,b,c)=>{"use strict";c.r(b),c.d(b,{CsvRenderer:()=>D});var d=c(72269),e=c(78520),f=c.n(e),g=c(11366),h=c(89292),i=c(64149),j=c(63151),k=c(74077),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:"var(--tool-read)"},{bg:"rgba(200,160,216,0.12)",text:"var(--tool-search)"},{bg:"rgba(200,96,96,0.12)",text:"var(--error)"},{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(72640),q=c(31634),r=c(55231),s=c(32068),t=c(63353);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"),10);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(55433),A=c(12516);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:"w-full 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})]})}},42807:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>D,Ld:()=>B,iP:()=>A,Ay:()=>E});var d=c(72269),e=c(78520),f=c(35959),g=c(63353),h=c(23095),i=c(40303),j=c(39532),k=c(25410),l=c(91312),m=c(62746),n=c(69733),o=c(77949),p=c(32068),q=c(77940),r=c(99712),s=c(80676),t=c(69599),u=c(85224),v=c(99440),w=c(33659),x=c(5025);x.callServer,x.findSourceMapURL;var y=c(16704);let z=()=>{},A=y.qQ,B=y.Dp.MIN,C=y.Dp.MAX_RATIO,D=y.Dp.MAX_ABS;function E({activePanel:a,fileTree:b,onNavigate:c,onOpenSyncSettings:x,railWidth:y=48,panelWidth:E,onWidthChange:F,onWidthCommit:G,maximized:H=!1,onMaximize:I,onImport:J,children:K}){let L=a?A[a]:280,M=H?void 0:E??L,{t:N}=(0,w.Y)(),[O,P]=(0,e.useTransition)(),Q=(0,f.useRouter)(),R=(0,f.usePathname)(),S="/capture"===R||"/capture/"===R,[T,U]=(0,e.useState)(null),V=(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]),[W,X]=(0,e.useState)(!1),Y=(0,e.useRef)(null),Z=(0,e.useRef)(null),[$,_]=(0,e.useState)(!1),aa=(0,e.useRef)(null),ab=(0,e.useRef)(null),ac=(0,s.gL)(),[ad,ae]=(0,e.useState)(0),[af,ag]=(0,e.useState)(0),[ah,ai]=(0,e.useState)(!1),aj=(0,e.useCallback)(()=>{if(!ah){ai(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[ah]),ak=(0,v._)({width:E??L,minWidth:B,maxWidth:D,maxWidthRatio:C,direction:"right",disabled:H,onResize:F??z,onResizeEnd:G??z});return(0,d.jsxs)("aside",{className:`
60
+ hidden md:flex fixed top-0 h-screen z-30
61
+ flex-col bg-card border-r border-border
62
+ transition-[transform,left,width] duration-200 ease-out
63
+ ${null!==a?"translate-x-0":"-translate-x-full pointer-events-none"}
64
+ `,style:{width:H?`calc(100vw - ${y}px)`:`${M}px`,left:`${y}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)(u.A,{title:N.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:Y,type:"button",onClick:()=>{P(()=>{_(!1),X(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":N.sidebar.new,title:N.sidebar.new,children:(0,d.jsx)(g.A,{size:13})}),W&&(0,d.jsxs)("div",{ref:Z,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:()=>{P(()=>{X(!1),Q.push("/view/Untitled.md")})},children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0"}),N.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:()=>{X(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,d.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),N.sidebar.newSpace]})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>J?.(),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":N.sidebar.importFile,title:N.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:()=>U(a=>Math.max(-1,(a??V)-1)),onDoubleClick:()=>{U(-1),aj()},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":N.sidebar.collapseLevel,title:ah?N.sidebar.collapseLevel:N.sidebar.collapseLevelHint??N.sidebar.collapseLevel,children:(0,d.jsx)(k.A,{size:13})}),(0,d.jsx)("button",{onClick:()=>U(a=>{let b=(a??0)+1;return b>V?null:b}),onDoubleClick:()=>{U(null),aj()},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":N.sidebar.expandLevel,title:ah?N.sidebar.expandLevel:N.sidebar.expandLevelHint??N.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:aa,type:"button",onClick:()=>{P(()=>{X(!1),_(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":N.sidebar.more,title:N.sidebar.more,children:(0,d.jsx)(m.A,{size:13})}),$&&(0,d.jsxs)("div",{ref:ab,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:()=>{P(()=>{_(!1),Q.push("/capture")})},children:[(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:N.sidebar.capture}),af>0&&(0,d.jsx)("span",{className:"text-2xs font-medium tabular-nums px-1.5 py-px rounded-full bg-[var(--amber)]/10 text-[var(--amber)]/70",children:af})]}),(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:()=>{P(()=>{_(!1),Q.push("/view/.mindos/change-log.json")})},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:N.changes.title})]}),(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:()=>{P(()=>{_(!1),Q.push("/trash")})},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:N.trash.title}),ad>0&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:ad})]}),(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:()=>{(0,s.Fo)(!ac)},children:[ac?(0,d.jsx)(q.A,{size:14,className:"shrink-0"}):(0,d.jsx)(r.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:N.sidebar.showHiddenFiles}),ac&&(0,d.jsx)("span",{className:"text-[var(--amber)] text-xs",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)(s.Ay,{nodes:b,onNavigate:c,maxOpenDepth:T,onImport:J})}),(0,d.jsxs)("button",{type:"button",onClick:()=>Q.push("/capture"),className:`flex items-center gap-2 mx-2 px-2 py-1.5 text-sm rounded-lg transition-all duration-150 group shrink-0 ${S?"bg-[var(--amber-dim)] text-[var(--amber)]":"hover:bg-muted text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)("div",{className:`flex items-center justify-center w-5 h-5 rounded-md shrink-0 transition-colors ${S?"bg-[var(--amber)]/15":"bg-transparent"}`,children:(0,d.jsx)(n.A,{size:13,className:`shrink-0 transition-colors ${S?"text-[var(--amber)]":"text-[var(--amber)]/60 group-hover:text-[var(--amber)]"}`})}),(0,d.jsx)("span",{className:`flex-1 text-left text-xs transition-colors ${S?"font-medium text-[var(--amber)]":"text-muted-foreground group-hover:text-foreground"}`,children:N.sidebar.capture}),af>0&&(0,d.jsx)("span",{className:`text-2xs font-medium tabular-nums px-1.5 py-px rounded-full transition-colors ${S?"bg-[var(--amber)]/15 text-[var(--amber)]":"bg-[var(--amber)]/10 text-[var(--amber)]/70"}`,children:af})]}),(0,d.jsx)(t.Ay,{collapsed:!1,onOpenSyncSettings:x})]}),K,!H&&F&&(0,d.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:ak,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"})})]})}},43456:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TodoRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/todo/TodoRenderer.tsx","TodoRenderer")},43506:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(72269),e=c(78520),f=c(48204),g=c(63301),h=c(69050),i=c(55433),j=c(35959),k=c(33659),l=c(76867),m=c(5025);let n=(0,m.createServerReference)("70c2dd3b19a8b7dc287ba47cc50916b3dc0f2be0fd",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-[var(--amber-foreground)] 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:`
65
+ @keyframes dotBounce {
66
+ 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
67
+ 30% { opacity: 1; transform: translateY(-2px); }
68
+ }
69
+ `})]})}},43714:(a,b,c)=>{"use strict";c.r(b),c.d(b,{BacklinksRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/backlinks/BacklinksRenderer.tsx","BacklinksRenderer")},45057:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(72269),e=c(78520),f=c(23104),g=c.n(f),h=c(63353),i=c(53679),j=c(57262),k=c(14790),l=c(85224),m=c(33659),n=c(76867);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-visible:ring-1 focus-visible: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))})]})]})}},45189:(a,b,c)=>{"use strict";c.d(b,{z:()=>f});var d=c(78520);let e="mindos:acp-detection";function f(){let[a]=(0,d.useState)(()=>(function(){try{let a=sessionStorage.getItem(e);if(!a)return null;let b=JSON.parse(a);if("object"!=typeof b||null===b||Array.isArray(b)||!Array.isArray(b.installed)||!Array.isArray(b.notInstalled)||"number"!=typeof b.ts||Date.now()-b.ts>18e5)return null;return{installed:b.installed,notInstalled:b.notInstalled,ts:b.ts}}catch{return null}})()),b=(0,d.useRef)(a),[c,f]=(0,d.useState)(()=>a?.installed??[]),[g,h]=(0,d.useState)(()=>a?.notInstalled??[]),[i,j]=(0,d.useState)(()=>!a),[k,l]=(0,d.useState)(null),[m,n]=(0,d.useState)(0);(0,d.useRef)(!1);let o=(0,d.useRef)(!1);return{installedAgents:c,notInstalledAgents:g,loading:i,error:k,refresh:(0,d.useCallback)(()=>{try{sessionStorage.removeItem(e)}catch{}b.current=null,o.current=!0,n(a=>a+1)},[])}}},46078:(a,b,c)=>{"use strict";c.d(b,{A:()=>ah});var d=c(72269),e=c(78520),f=c(63301),g=c(81644),h=c(57262),i=c(23095),j=c(67677),k=c(48712),l=c(53679),m=c(6456),n=c(69050),o=c(31448),p=c(35205),q=c(10981),r=c(20634),s=c(83614),t=c(71240),u=c(10425),v=c(41444),w=c(70057),x=c(90245),y=c(7288),z=c(89516),A=c(3278),B=c(10777),C=c(25860),D=c(99820),E=c(49054),F=c(32068),G=c(89805),H=c(46258),I=c(77949),J=c(26911),K=c(90697),L=c(55231),M=c(37461),N=c(14790),O=c(65836),P=c(35508);let Q=new Set(["delete_file","move_file","rename_file","write_file"]),R=new Set(["write_file","create_file","update_section","insert_after_heading","edit_lines","append_to_file"]),S={web_search:z.A,search:p.A,list_files:A.A,read_file:B.A,write_file:C.A,create_file:D.A,append_to_file:i.A,insert_after_heading:E.A,update_section:C.A,delete_file:F.A,rename_file:i.A,move_file:G.A,get_backlinks:H.A,get_history:I.A,get_file_at_version:I.A,get_recent:J.A,append_csv:K.A},T="--- changes ---";function U({part:a}){let b=R.has(a.toolName),c="done"===a.state,[f,g]=(0,e.useState)(null),h=f??(b&&c),i=S[a.toolName]??m.A,j=Q.has(a.toolName),k=(0,e.useMemo)(()=>(function(a){if(!a)return{header:"",stats:"",diffLines:[]};let b=a.indexOf(T);if(-1===b)return{header:a,stats:"",diffLines:[]};let c=a.slice(0,b).trim(),d=a.slice(b+T.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}${k.stats?` (${k.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 ${j?"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)(L.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(M.A,{size:12,className:"shrink-0 text-muted-foreground"}),j&&(0,d.jsx)(N.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)(i,{size:12,className:`shrink-0 ${j?"text-[var(--amber)]":"text-muted-foreground"}`}),(0,d.jsx)("span",{className:`font-medium ${j?"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)(l.A,{size:12,className:"animate-spin text-[var(--amber)]"}):"done"===a.state?(0,d.jsx)(O.A,{size:12,className:"text-success"}):(0,d.jsx)(P.A,{size:12,className:"text-error"})})]}),h&&(0,d.jsx)("div",{className:"border-t border-border/30",children:b&&c&&k.diffLines.length>0?(0,d.jsx)("div",{className:"max-h-64 overflow-y-auto",children:k.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)(l.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 V=c(3505),W=c(33659);function X({text:a,isStreaming:b}){let[c,f]=(0,e.useState)(!1),{t:g}=(0,W.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)(L.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,d.jsx)(M.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,d.jsx)(V.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}var Y=c(98809),Z=c(14484);function $({label:a,delay:b=800,children:c}){let[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,e.useCallback)(()=>{h.current=setTimeout(()=>g(!0),b)},[b]),j=(0,e.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null),g(!1)},[]);return(0,d.jsxs)("span",{className:"relative inline-flex",onMouseEnter:i,onMouseLeave:j,children:[c,f&&(0,d.jsx)("span",{role:"tooltip",className:"pointer-events-none absolute -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-foreground/90 px-2 py-0.5 text-[11px] font-medium text-background shadow-sm animate-in fade-in-0 slide-in-from-bottom-1 duration-100 z-20",children:a})]})}function _({content:a,isLastUserMessage:b,isLoading:c,onEdit:h,onResend:i,labels:j}){let[k,l]=(0,e.useState)(!1),m=(0,e.useRef)(!1),n=(0,e.useCallback)(()=>{(0,y.l)(a).then(a=>{a&&(l(!0),setTimeout(()=>l(!1),2e3))})},[a]),o=(0,e.useCallback)(()=>{m.current||c||(m.current=!0,setTimeout(()=>{m.current=!1},300),i?.())},[i,c]),p="p-1 rounded-md bg-card border border-border/60 shadow-sm text-muted-foreground transition-colors";return(0,d.jsxs)("div",{className:"absolute -bottom-1 left-1 z-10 flex items-center gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",children:[(0,d.jsx)($,{label:j.copy,children:(0,d.jsx)("button",{type:"button",onClick:n,className:`${p} hover:text-foreground`,children:k?(0,d.jsx)(f.A,{size:11,className:"text-success"}):(0,d.jsx)(g.A,{size:11})})}),b&&!c&&h&&(0,d.jsx)($,{label:j.edit,children:(0,d.jsx)("button",{type:"button",onClick:h,className:`${p} hover:text-foreground`,children:(0,d.jsx)(q.A,{size:11})})}),b&&!c&&i&&(0,d.jsx)($,{label:j.regenerate,children:(0,d.jsx)("button",{type:"button",onClick:o,className:`${p} hover:text-[var(--amber)]`,children:(0,d.jsx)(Z.A,{size:11})})})]})}let aa=/^Use the skill ([^:]+):\s*/;function ab({text:a,label:b}){let[c,h]=(0,e.useState)(!1),i=(0,e.useCallback)(()=>{(0,y.l)(a).then(a=>{a&&(h(!0),setTimeout(()=>h(!1),2e3))})},[a]);return(0,d.jsx)("button",{type:"button",onClick:i,className:"p-1 rounded-md bg-card border border-border/60 shadow-sm text-muted-foreground hover:text-foreground transition-colors",title:b??"Copy",children:c?(0,d.jsx)(f.A,{size:11,className:"text-success"}):(0,d.jsx)(g.A,{size:11})})}function ac({content:a,skillName:b,images:c,attachedFiles:e,uploadedFileNames:f}){let g=b??a.match(aa)?.[1],k=a.match(aa),l=k?a.slice(k[0].length):a,m=new Set(f??[]),n=e?.filter(a=>!m.has(a.split("/").pop()??a)),o=n&&n.length>0||f&&f.length>0;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))}),g&&(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"}),g]}),g?l:a,o&&(0,d.jsxs)("div",{className:"mt-2 pt-1.5 border-t border-white/15 flex flex-wrap gap-1 whitespace-normal",role:"list","aria-label":"Attached files",children:[n?.map(a=>(0,d.jsxs)("span",{role:"listitem",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-white/10 text-white/80 min-w-0",title:a,children:[(0,d.jsx)(i.A,{size:9,className:"shrink-0 opacity-70"}),(0,d.jsx)("span",{className:"truncate max-w-[120px]",children:a.split("/").pop()})]},a)),f?.map(a=>(0,d.jsxs)("span",{role:"listitem",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-white/10 text-white/80 min-w-0",title:a,children:[(0,d.jsx)(j.A,{size:9,className:"shrink-0 opacity-70"}),(0,d.jsx)("span",{className:"truncate max-w-[120px]",children:a})]},a))]})]})}function ad({agentName:a}){return a?(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1 rounded-full border border-[var(--amber)]/15 bg-[var(--amber)]/8 px-2 py-0.5 text-[10px] font-medium tracking-wide text-[var(--amber)]",children:[(0,d.jsx)(k.A,{size:10,className:"shrink-0"}),(0,d.jsx)("span",{children:a})]}):null}function ae({content:a,isStreaming:b}){let c=(0,x.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)(v.oz,{remarkPlugins:[w.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 af({message:a,isStreaming:b}){let c=a.parts;if(!c||0===c.length)return a.content?(0,d.jsx)(ae,{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)(X,{text:a.text,isStreaming:f},`reasoning-${e}`)}if("text"===a.type){let f=b&&e===c.length-1;return a.text?(0,d.jsx)(ae,{content:a.text,isStreaming:f},e):null}return"tool-call"===a.type?(0,d.jsx)(U,{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)(l.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 ag({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)(m.A,{size:10}),(0,d.jsxs)("span",{className:"font-medium",children:["Step ",b.length,e?` — ${e}`:""]})]})}let ah=(0,e.memo)(function({messages:a,isLoading:b,loadingPhase:c,emptyPrompt:f,emptyHint:g,suggestions:h,onSuggestionClick:i,onEditMessage:j,onResendMessage:k,labels:m}){let v=(0,e.useRef)(null),w=(0,e.useRef)(null),[y,z]=(0,e.useState)(!1),A=(0,e.useRef)(!1);(0,e.useRef)(a.length);let B=(0,e.useMemo)(()=>{for(let b=a.length-1;b>=0;b--)if("user"===a[b].role)return b;return -1},[a]),C=(0,e.useCallback)((a="smooth")=>{let b=w.current;b&&b.scrollTo({top:b.scrollHeight,behavior:a})},[]);return(0,d.jsxs)("div",{ref:w,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)(n.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=[o.A,p.A,q.A,r.A],e=c[b%c.length];return(0,d.jsxs)("button",{type:"button",onClick:()=>i(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)(n.A,{size:13,className:"text-[var(--amber)]"})}),"user"===e.role?(0,d.jsxs)("div",{className:"group relative 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)(ac,{content:e.content,skillName:e.skillName,images:e.images,attachedFiles:e.attachedFiles,uploadedFileNames:e.uploadedFileNames}),(0,d.jsx)(_,{content:e.content,isLastUserMessage:f===B,isLoading:b,onEdit:j?()=>j(f):void 0,onResend:k?()=>k(f):void 0,labels:{copy:m.copyMessage??"Copy",edit:m.editMessage??"Edit",regenerate:m.regenerateMessage??"Regenerate"}})]}):e.content.startsWith("__error__")?(0,d.jsxs)("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.jsx)(ad,{agentName:e.agentName}),(0,d.jsxs)("div",{className:"flex items-start gap-2.5 text-error",children:[(0,d.jsx)(s.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.jsxs)("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:[(0,d.jsx)(ad,{agentName:e.agentName}),e.parts&&e.parts.length>0||(0,x.Oo)(e.content)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(af,{message:e,isStreaming:b&&f===a.length-1}),b&&f===a.length-1&&(0,d.jsx)(ag,{parts:e.parts}),!(b&&f===a.length-1)&&(0,x.Oo)(e.content)&&(0,d.jsxs)("div",{className:"absolute -bottom-1 right-1 z-10 flex items-center gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",children:[(0,d.jsx)(Y.x,{text:e.content}),(0,d.jsx)(ab,{text:(0,x.Oo)(e.content),label:m.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)(t.A,{size:14,className:"text-[var(--amber)] animate-pulse"}):(0,d.jsx)(l.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?m.reconnecting??"Reconnecting...":"connecting"===c?m.connecting:"thinking"===c?m.thinking:m.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:v}),y&&a.length>0&&(0,d.jsx)("button",{type:"button",onClick:()=>{A.current=!1,C()},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)(u.A,{size:14})})]})})},47375:(a,b,c)=>{"use strict";c.d(b,{A:()=>h});var d=c(72269),e=c(69050),f=c(33659),g=c(35959);function h({onToggle:a,askPanelOpen:b}){let{t:c}=(0,f.Y)(),h=(0,g.usePathname)(),i=`${c.ask?.fabLabel??"Ask MindOS"} (⌘/)`;return(0,d.jsxs)("button",{onClick:a,className:`
82
70
  group hidden md:flex
83
71
  fixed z-40 bottom-5 right-5
84
72
  items-center justify-center
@@ -90,7 +78,7 @@ Keep content concise and actionable. Write files directly using tools.`;window.d
90
78
  hover:shadow-lg hover:shadow-[var(--amber)]/20
91
79
  active:scale-95 cursor-pointer overflow-hidden
92
80
  ${b||"/"===h||""===h?"opacity-0 pointer-events-none translate-y-2":"opacity-100 translate-y-0"}
93
- `,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 MindOS"})]})}},48009:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ChangeLogRenderer:()=>D});var d=c(72269),e=c(78520),f=c(23104),g=c.n(f),h=c(27201),i=c(55566),j=c(10981),k=c(25860),l=c(81644),m=c(55604),n=c(57262),o=c(23095),p=c(48712),q=c(22762),r=c(66447),s=c(77949),t=c(6221),u=c(65241),v=c(35205),w=c(55231),x=c(37461),y=c(10002),z=c(33659),A=c(12516),B=c(49459);function C(){return(0,d.jsx)("div",{className:"rounded-lg border border-border bg-card overflow-hidden animate-pulse",children:(0,d.jsx)("div",{className:"px-4 py-3 space-y-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("div",{className:"w-4 h-4 bg-muted rounded mt-1"}),(0,d.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,d.jsx)("div",{className:"h-5 bg-muted rounded w-2/3"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-full"})]})]})})})}function D(a){let{t:b}=(0,z.Y)(),[c,f]=(0,e.useState)("all"),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)([]),[H,I]=(0,e.useState)({unreadCount:0,totalCount:0}),[J,K]=(0,e.useState)({}),[L,M]=(0,e.useState)(!0),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),R=(0,e.useCallback)(async()=>{M(!0),O(null);try{let a=new URLSearchParams({op:"list",limit:"120"});"all"!==c&&a.set("source",c),D.trim()&&a.set("q",D.trim());let[b,d]=await Promise.all([(0,y.n)(`/api/changes?${a.toString()}`),(0,y.n)("/api/changes?op=summary")]);G(b.events),I(d)}catch(a){O(a instanceof Error?a.message:String(a))}finally{M(!1)}},[c,D]),S=(0,e.useCallback)(async()=>{await (0,y.n)("/api/changes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"mark_seen"})}),await R()},[R]),T=(0,e.useMemo)(()=>[{value:"all",label:b.changes.filters.all},{value:"agent",label:b.changes.filters.agent},{value:"user",label:b.changes.filters.user},{value:"system",label:b.changes.filters.system}],[b]),U=(0,e.useCallback)(a=>"agent"===a?b.changes.filters.agent:"user"===a?b.changes.filters.user:b.changes.filters.system,[b]),V=(0,e.useCallback)(a=>b.changes.operations?.[a]??a,[b]);return(0,d.jsxs)("div",{style:{padding:"1.5rem 0"},children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"w-10 h-10 rounded-lg bg-[var(--amber)]/8 flex items-center justify-center shrink-0",children:(0,d.jsx)(s.A,{size:20,className:"text-[var(--amber)]"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("h1",{className:"text-xl font-semibold text-foreground tracking-tight",children:b.changes.title}),(0,d.jsx)("p",{className:"mt-1 text-sm text-muted-foreground leading-relaxed",children:b.changes.subtitle})]})]}),(0,d.jsxs)("div",{className:"mt-4 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"px-2.5 py-1 rounded-full bg-muted/60 text-muted-foreground text-xs font-medium",children:b.changes.eventsCount(F.length)}),H.unreadCount>0&&(0,d.jsx)("span",{className:"px-2.5 py-1 rounded-full bg-[var(--amber)]/10 text-[var(--amber)] text-xs font-medium border border-[var(--amber)]/20",children:b.changes.unreadCount(H.unreadCount)})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:()=>Q(a=>!a),className:`inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring ${P?"bg-[var(--amber)]/10 text-[var(--amber)]":"bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:b.changes.filters.source,children:(0,d.jsx)(t.A,{size:14})}),(0,d.jsx)("button",{type:"button",onClick:()=>void R(),className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring",title:b.changes.refresh,children:(0,d.jsx)(u.A,{size:14})}),H.unreadCount>0&&(0,d.jsxs)("button",{type:"button",onClick:()=>void S(),className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring",title:b.changes.markAllRead,children:[(0,d.jsx)("span",{className:"hidden sm:inline",children:b.changes.markAllRead}),(0,d.jsx)("span",{className:"inline sm:hidden",children:"✓"})]})]})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${P?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsx)("div",{className:"overflow-hidden",children:(0,d.jsx)("div",{className:"rounded-lg border border-border/60 bg-card/60 p-4 mb-4",children:(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground block mb-1.5",children:b.changes.filters.source}),(0,d.jsx)(A.A,{value:c,onChange:a=>f(a),options:T})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground block mb-1.5",children:b.changes.filters.keyword}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(v.A,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/50"}),(0,d.jsx)("input",{value:D,onChange:a=>E(a.target.value),placeholder:b.changes.filters.keywordPlaceholder,className:"w-full pl-9 pr-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground/40 outline-none focus-visible:ring-1 focus-visible:ring-ring hover:border-border/80 transition-all"})]})]})]})})})}),L&&(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsx)(C,{}),(0,d.jsx)(C,{}),(0,d.jsx)(C,{})]}),!L&&N&&(0,d.jsxs)("div",{className:"rounded-lg border border-error/20 bg-error/5 p-4 text-sm text-error",children:[N,(0,d.jsx)("button",{onClick:()=>void R(),className:"ml-2 underline hover:no-underline font-medium",children:b.changes.refresh})]}),!L&&!N&&0===F.length&&(0,d.jsx)("div",{className:"rounded-lg border border-border/60 bg-card/60 p-8 md:p-12",children:(0,d.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,d.jsx)("div",{className:"mb-4 p-4 bg-muted/50 rounded-lg",children:(0,d.jsx)(o.A,{size:28,className:"text-muted-foreground/60"})}),(0,d.jsx)("h3",{className:"text-base font-semibold text-foreground mb-1",children:b.changes.empty}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground max-w-sm",children:b.changes.emptyHint})]})}),!L&&!N&&F.length>0&&(0,d.jsx)("div",{className:"space-y-2",children:F.map(a=>{var c,e,f,s;let t,u,v=!!J[a.id],y=(0,B.m)(a.before??"",a.after??""),z=(0,B.S)(y),A=y.filter(a=>"insert"===a.type).length,C=y.filter(a=>"delete"===a.type).length;return(0,d.jsxs)("div",{className:"group rounded-lg border border-border/60 bg-card/70 overflow-hidden transition-all duration-150 hover:border-border hover:bg-card hover:shadow-sm",children:[(0,d.jsx)("button",{type:"button",onClick:()=>K(b=>({...b,[a.id]:!b[a.id]})),className:"w-full px-4 py-3 text-left focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring hover:bg-muted/20 transition-all",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsxs)("div",{className:"pt-0.5 text-muted-foreground/60 shrink-0 relative",children:[v&&(0,d.jsx)("div",{className:"absolute -left-4 top-0 bottom-0 w-[2px] rounded-r-full bg-[var(--amber)]"}),v?(0,d.jsx)(w.A,{size:15}):(0,d.jsx)(x.A,{size:15})]}),(0,d.jsx)("div",{className:"w-7 h-7 rounded-md bg-muted/50 flex items-center justify-center shrink-0 text-muted-foreground group-hover:bg-muted transition-all",children:"create_file"===(c=a.op)||"create_space"===c?(0,d.jsx)(h.A,{size:14}):"delete_file"===c?(0,d.jsx)(i.A,{size:14}):"update_lines"===c||"update_section"===c?(0,d.jsx)(j.A,{size:14}):"insert_lines"===c||"insert_after_heading"===c?(0,d.jsx)(k.A,{size:14}):"append_to_file"===c||"append_csv"===c?(0,d.jsx)(l.A,{size:14}):"rename_file"===c||"rename_space"===c||"move_file"===c?(0,d.jsx)(m.A,{size:14}):"import_file"===c?(0,d.jsx)(n.A,{size:14}):(0,d.jsx)(o.A,{size:14})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:function(a,b){let c=b.changes.summaries;if("Updated file content"===a)return c.updatedFileContent;if("Appended content to file"===a)return c.appendedContent;if("Moved to trash"===a)return c.movedToTrash;if("Created file"===a)return c.createdFile;if("Created space"===a)return c.createdSpace;if("Imported file into knowledge base"===a)return c.importedFile;let d=a.match(/^Inserted (\d+) line\(s\)$/);if(d)return c.insertedLines(Number(d[1]));let e=a.match(/^Updated lines (\d+)-(\d+)$/);if(e)return c.updatedLines(Number(e[1]),Number(e[2]));let f=a.match(/^Inserted content after heading "(.+)"$/);if(f)return c.insertedAfterHeading(f[1]);let g=a.match(/^Updated section "(.+)"$/);if(g)return c.updatedSection(g[1]);let h=a.match(/^Renamed file to (.+)$/);if(h)return c.renamedFile(h[1]);let i=a.match(/^Moved file to (.+)$/);if(i)return c.movedFile(i[1]);let j=a.match(/^Renamed space to (.+)$/);if(j)return c.renamedSpace(j[1]);let k=a.match(/^Appended CSV row \((\d+) cells?\)$/);return k?c.appendedCsvRow(Number(k[1])):a.startsWith("Imported legacy agent diff")?c.importedLegacyDiff:a}(a.summary,b)}),(A>0||C>0)&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground/70",children:[A>0&&(0,d.jsxs)("span",{className:"text-success font-semibold",children:["+",A]}),A>0&&C>0&&(0,d.jsx)("span",{className:"mx-0.5",children:"\xb7"}),C>0&&(0,d.jsxs)("span",{className:"text-error font-semibold",children:["-",C]})]})]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"rounded-md px-2 py-0.5 bg-[var(--amber-dim)] text-[var(--amber)] text-xs font-medium truncate inline-block max-w-[200px]",title:a.path,children:a.path}),(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-medium ${"agent"===(e=a.source)?"bg-[var(--info)]/10 text-[var(--info)] border border-[var(--info)]/20":"user"===e?"bg-[var(--success)]/10 text-[var(--success)] border border-[var(--success)]/20":"bg-muted text-muted-foreground border border-border"} transition-colors`,children:["agent"===(f=a.source)?(0,d.jsx)(p.A,{size:13}):"user"===f?(0,d.jsx)(q.A,{size:13}):(0,d.jsx)(r.A,{size:13}),U(a.source)]}),(0,d.jsx)("span",{className:`text-xs font-medium ${(s=a.op).startsWith("create")||"import_file"===s?"text-success":s.startsWith("delete")?"text-error":s.startsWith("rename")||s.startsWith("move")?"text-muted-foreground":""}`,children:V(a.op)}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 ml-auto shrink-0",children:function(a,b){let c=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(c<1)return b.changes.relativeTime.justNow;if(c<60)return b.changes.relativeTime.minutesAgo(c);let d=Math.floor(c/60);return d<24?b.changes.relativeTime.hoursAgo(d):b.changes.relativeTime.daysAgo(Math.floor(d/24))}(a.ts,b)})]})]}),(0,d.jsx)(g(),{href:`/view/${a.path.split("/").map(encodeURIComponent).join("/")}`,className:"inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium bg-[var(--amber)]/10 text-[var(--amber)] hover:bg-[var(--amber)] hover:text-[var(--amber-foreground)] focus-visible:ring-2 focus-visible:ring-ring transition-all duration-150 shrink-0",onClick:a=>a.stopPropagation(),title:b.changes.open,children:b.changes.open})]})}),v&&(t=1,u=1,(0,d.jsx)("div",{className:"border-t border-border/50 bg-background/60 max-h-80 overflow-y-auto",children:z.map((c,e)=>{if("gap"===c.type)return t+=c.count,u+=c.count,(0,d.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground/50 border-y border-border/30 bg-muted/10 text-center font-medium",children:b.changes.unchangedLines(c.count)},`${a.id}-gap-${e}`);let f="insert"===c.type?"+":"delete"===c.type?"-":" ",g="insert"!==c.type?t:"",h="delete"!==c.type?u:"";return"insert"!==c.type&&t++,"delete"!==c.type&&u++,(0,d.jsxs)("div",{className:`flex items-start text-xs font-mono leading-6 px-4 ${"insert"===c.type?"bg-success/5 hover:bg-success/8":"delete"===c.type?"bg-error/5 hover:bg-error/8":"hover:bg-muted/20"} transition-colors`,children:[(0,d.jsx)("span",{className:"w-8 shrink-0 text-right pr-2 select-none text-muted-foreground/40",children:g}),(0,d.jsx)("span",{className:"w-8 shrink-0 text-right pr-2 select-none text-muted-foreground/40",children:h}),(0,d.jsx)("span",{className:`w-3 shrink-0 text-center select-none font-bold ${"insert"===c.type?"text-success":"delete"===c.type?"text-error":"text-muted-foreground/20"}`,children:f}),(0,d.jsx)("span",{className:`flex-1 whitespace-pre-wrap break-all overflow-hidden ${"insert"===c.type?"text-success":"delete"===c.type?"text-error":"text-muted-foreground"}`,children:c.text||"\xa0"})]},`${a.id}-${e}`)})}))]},a.id)})})]})}},48135:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>m,ZI:()=>p,k$:()=>o,m_:()=>n});var d=c(72269),e=c(20147),f=c(83584),g=c(38761),h=c(10391),i=c(25914),j=c(26906),k=c(64473),l=c(76867);function m({delay:a=0,...b}){return(0,d.jsx)(e.B,{"data-slot":"tooltip-provider",delay:a,...b})}function n({...a}){return(0,d.jsx)(f.s,{"data-slot":"tooltip",...a})}function o({...a}){return(0,d.jsx)(g.k,{"data-slot":"tooltip-trigger",...a})}function p({className:a,side:b="top",sideOffset:c=4,align:e="center",alignOffset:f=0,children:g,...m}){return(0,d.jsx)(h.K,{children:(0,d.jsx)(i.o,{align:e,alignOffset:f,side:b,sideOffset:c,className:"isolate z-50",children:(0,d.jsxs)(j.o,{"data-slot":"tooltip-content",className:(0,l.cn)("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...m,children:[g,(0,d.jsx)(k.P,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}},48509:(a,b,c)=>{"use strict";c.d(b,{Z:()=>m});var d=c(78520);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))},[])}}},48684:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AudioRenderer:()=>f});var d=c(72269),e=c(78520);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)]})}},48840:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>u,C:()=>s});var e=c(72269),f=c(78520),g=c(28761),h=c(65241),i=c(35205),j=c(53679),k=c(63301),l=c(37461),m=c(66447),n=c(55231),o=c(33659),p=c(22222),q=c(3712),r=a([p,q]);[p,q]=r.then?(await r)():r;let v="mindos-provider-model";function s(){return{provider:null,model:null}}function t(a,b){try{a||b?localStorage.setItem(v,JSON.stringify({provider:a,model:b})):localStorage.removeItem(v),localStorage.removeItem("mindos-provider-override")}catch{}}function u({providerValue:a,onProviderChange:b,modelValue:c,onModelChange:d,disabled:r=!1}){let s,{t:u,locale:v}=(0,o.Y)(),[w,x]=(0,f.useState)(!1),y=(0,f.useRef)(null),z=(0,f.useRef)(null),A=(0,f.useRef)(null),B=(0,f.useRef)(null),C=(0,f.useRef)(null),[D,E]=(0,f.useState)(null),F=(0,f.useRef)(null),G=(0,f.useRef)(null),[H,I]=(0,f.useState)(null),[J,K]=(0,f.useState)({}),[L,M]=(0,f.useState)(null),[N,O]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(""),[R,S]=(0,f.useState)(""),[T,U]=(0,f.useState)(-1),[V,W]=(0,f.useState)(null),X=(0,f.useRef)(0),Y=(0,f.useRef)({}),Z=(0,f.useRef)(void 0),$=(0,f.useRef)(void 0),_=(0,f.useCallback)(()=>{Z.current&&(clearTimeout(Z.current),Z.current=void 0)},[]),aa=(0,f.useCallback)(()=>{_(),Z.current=setTimeout(()=>{I(null),S("")},300)},[_]),ab=D?.ai?.activeProvider||"",ac=(0,f.useMemo)(()=>D?(D.ai?.providers??[]).map(a=>a.id):[],[D]);(0,f.useRef)(!1);let ad=a??ab,ae=(0,q.lh)(D?.ai?.providers??[],String(ad)),af=ae?p.T_[ae.protocol]:null,ag=ae?.model||af?.defaultModel||"",ah=c||ag,ai=ae?.name||(af?"zh"===v?af.nameZh:af.name:String(ad)),[aj,ak]=(0,f.useState)({}),al=(0,f.useRef)(void 0),am=(0,f.useCallback)(()=>{if(!y.current)return;let a=y.current.getBoundingClientRect(),b=a.top>window.innerHeight-a.bottom&&a.top>280;ak({position:"fixed",left:Math.min(a.left,window.innerWidth-270),...b?{bottom:window.innerHeight-a.top+6}:{top:a.bottom+6},zIndex:50})},[]);(0,f.useCallback)(()=>{al.current&&clearTimeout(al.current),al.current=setTimeout(()=>{am()},0)},[am]);let an=(0,f.useCallback)(async(a,b=!1)=>{if(!b&&Y.current[a]){M(Y.current[a]),O(!1);return}b&&delete Y.current[a],O(!0),Q(""),M(null);let c=++X.current;try{let b=await fetch("/api/settings/list-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a})});if(c!==X.current)return;let d=await b.json();if(c!==X.current)return;d.ok&&Array.isArray(d.models)?(Y.current[a]=d.models,M(d.models)):Q(d.error||"Failed")}catch{c===X.current&&Q("Network error")}finally{c===X.current&&O(!1)}},[]),ao=(0,f.useCallback)(a=>{W(b=>({providerId:a,nonce:(b?.nonce??0)+1}))},[]),ap=(0,f.useCallback)(a=>{let b=(0,q.lh)(D?.ai?.providers??[],a);if(!b)return!1;let c=p.T_[b.protocol];return c?.supportsListModels??!1},[D]),aq=(0,f.useCallback)(()=>{let a=F.current,b=G.current;if(!a||!b)return;let c=a.getBoundingClientRect(),d=b.getBoundingClientRect(),e=c.right+4,f=d.top;window.innerHeight-f<320&&(f=Math.max(8,d.bottom-320));let g=e+220>window.innerWidth-8?c.left-220-4:e;K({position:"fixed",left:g,top:f,zIndex:51})},[]),ar=(0,f.useCallback)(a=>{_(),$.current&&clearTimeout($.current),$.current=setTimeout(()=>{if(!ap(a)){I(null),S("");return}I(a),S(""),U(-1),Q(""),M(Y.current[a]??null),Y.current[a]||an(a),requestAnimationFrame(()=>{aq(),setTimeout(()=>B.current?.focus(),50)})},80)},[_,an,aq,ap]),as=(0,f.useCallback)(()=>{_(),$.current&&(clearTimeout($.current),$.current=void 0),I(null),S("")},[_]),at=(0,f.useCallback)(a=>{b(a),d(null),t(a,null),x(!1),I(null),S("")},[d,b]),au=(0,f.useCallback)((a,c)=>{b(a),d(c),t(a,c),x(!1),I(null),S("")},[d,b]),av=(0,f.useMemo)(()=>{if(!L)return[];if(!R.trim())return L;let a=R.toLowerCase();return L.filter(b=>b.toLowerCase().includes(a))},[L,R]),aw=(0,f.useCallback)(a=>{av.length&&("ArrowDown"===a.key?(a.preventDefault(),U(a=>(a+1)%av.length)):"ArrowUp"===a.key?(a.preventDefault(),U(a=>(a-1+av.length)%av.length)):"Enter"===a.key&&T>=0&&T<av.length&&H?(a.preventDefault(),au(H,av[T])):"Escape"===a.key&&(a.preventDefault(),I(null),S("")))},[av,T,H,au]);if(!D||0===ac.length)return null;let ax=(ah||"").length>20?(ah||"").slice(0,18)+"…":ah,ay=(s=ae?.name||"")&&s.length>12?s.slice(0,10)+"…":s||af?.shortLabel||ai,az=`${ai} \xb7 ${ah}`,aA=!!(c&&c!==ag),aB=w?(0,e.jsx)("div",{ref:z,style:aj,children:(0,e.jsx)("div",{ref:F,role:"listbox","aria-label":u.ask?.providerCapsule??"Provider",className:"w-[260px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{maxHeight:"70vh",overflowY:"auto"},children:ac.map(b=>{let d=(0,q.lh)(D?.ai?.providers??[],b);if(!d)return null;let f=p.T_[d.protocol],g=d.name||("zh"===v?f?.nameZh:f?.name)||b,h=c&&a===b?c:d.model||f?.defaultModel||"",i=a===b||!a&&ab===b,j=H===b,m=ap(b);return(0,e.jsx)("div",{ref:j?G:void 0,onMouseEnter:()=>m?ar(b):as(),onMouseLeave:aa,children:(0,e.jsxs)("div",{className:`flex w-full items-center text-xs transition-colors ${j?"bg-accent/60":"hover:bg-muted/60"}`,children:[(0,e.jsxs)("button",{type:"button",role:"option","aria-selected":i,onClick:()=>at(b),className:"flex flex-1 items-center gap-2 px-3 py-1.5 min-w-0 text-left",children:[(0,e.jsx)("span",{className:`shrink-0 text-xs ${i?"font-medium text-foreground":"text-foreground/80"}`,children:g}),h&&(0,e.jsx)("span",{className:"min-w-0 truncate rounded bg-muted/70 px-1.5 py-px text-[10px] font-mono leading-tight text-muted-foreground",children:h}),i&&(0,e.jsx)(k.A,{size:11,className:"shrink-0 ml-auto text-[var(--amber)]"})]}),m&&(0,e.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),H===b?as():ar(b)},className:`shrink-0 px-1.5 py-1.5 mr-1 rounded transition-colors ${j?"text-foreground":"text-muted-foreground/40 hover:text-muted-foreground"}`,title:u.ask?.selectModel??"Select model",children:(0,e.jsx)(l.A,{size:11})})]})},b)})})}):null;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{ref:y,type:"button",onClick:()=>{!r&&(x(a=>!a),w&&(I(null),S("")))},disabled:r,className:`
81
+ `,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 MindOS"})]})}},48006:(a,b,c)=>{"use strict";c.d(b,{f:()=>e});var d=c(5025);let e=(0,d.createServerReference)("60239502cf2efb160c3deb517f047df9dee5c98d60",d.callServer,void 0,d.findSourceMapURL,"renameFileAction")},48009:(a,b,c)=>{"use strict";c.r(b),c.d(b,{ChangeLogRenderer:()=>D});var d=c(72269),e=c(78520),f=c(23104),g=c.n(f),h=c(27201),i=c(55566),j=c(10981),k=c(25860),l=c(81644),m=c(55604),n=c(57262),o=c(23095),p=c(48712),q=c(22762),r=c(66447),s=c(77949),t=c(6221),u=c(65241),v=c(35205),w=c(55231),x=c(37461),y=c(10002),z=c(33659),A=c(12516),B=c(49459);function C(){return(0,d.jsx)("div",{className:"rounded-lg border border-border bg-card overflow-hidden animate-pulse",children:(0,d.jsx)("div",{className:"px-4 py-3 space-y-2",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("div",{className:"w-4 h-4 bg-muted rounded mt-1"}),(0,d.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,d.jsx)("div",{className:"h-5 bg-muted rounded w-2/3"}),(0,d.jsx)("div",{className:"h-3 bg-muted rounded w-full"})]})]})})})}function D(a){let{t:b}=(0,z.Y)(),[c,f]=(0,e.useState)("all"),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)([]),[H,I]=(0,e.useState)({unreadCount:0,totalCount:0}),[J,K]=(0,e.useState)({}),[L,M]=(0,e.useState)(!0),[N,O]=(0,e.useState)(null),[P,Q]=(0,e.useState)(!1),R=(0,e.useCallback)(async()=>{M(!0),O(null);try{let a=new URLSearchParams({op:"list",limit:"120"});"all"!==c&&a.set("source",c),D.trim()&&a.set("q",D.trim());let[b,d]=await Promise.all([(0,y.n)(`/api/changes?${a.toString()}`),(0,y.n)("/api/changes?op=summary")]);G(b.events),I(d)}catch(a){O(a instanceof Error?a.message:String(a))}finally{M(!1)}},[c,D]),S=(0,e.useCallback)(async()=>{await (0,y.n)("/api/changes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"mark_seen"})}),await R()},[R]),T=(0,e.useMemo)(()=>[{value:"all",label:b.changes.filters.all},{value:"agent",label:b.changes.filters.agent},{value:"user",label:b.changes.filters.user},{value:"system",label:b.changes.filters.system}],[b]),U=(0,e.useCallback)(a=>"agent"===a?b.changes.filters.agent:"user"===a?b.changes.filters.user:b.changes.filters.system,[b]),V=(0,e.useCallback)(a=>b.changes.operations?.[a]??a,[b]);return(0,d.jsxs)("div",{style:{padding:"1.5rem 0"},children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"w-10 h-10 rounded-lg bg-[var(--amber)]/8 flex items-center justify-center shrink-0",children:(0,d.jsx)(s.A,{size:20,className:"text-[var(--amber)]"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("h1",{className:"text-xl font-semibold text-foreground tracking-tight",children:b.changes.title}),(0,d.jsx)("p",{className:"mt-1 text-sm text-muted-foreground leading-relaxed",children:b.changes.subtitle})]})]}),(0,d.jsxs)("div",{className:"mt-4 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"px-2.5 py-1 rounded-full bg-muted/60 text-muted-foreground text-xs font-medium",children:b.changes.eventsCount(F.length)}),H.unreadCount>0&&(0,d.jsx)("span",{className:"px-2.5 py-1 rounded-full bg-[var(--amber)]/10 text-[var(--amber)] text-xs font-medium border border-[var(--amber)]/20",children:b.changes.unreadCount(H.unreadCount)})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,d.jsx)("button",{type:"button",onClick:()=>Q(a=>!a),className:`inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring ${P?"bg-[var(--amber)]/10 text-[var(--amber)]":"bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:b.changes.filters.source,children:(0,d.jsx)(t.A,{size:14})}),(0,d.jsx)("button",{type:"button",onClick:()=>void R(),className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring",title:b.changes.refresh,children:(0,d.jsx)(u.A,{size:14})}),H.unreadCount>0&&(0,d.jsxs)("button",{type:"button",onClick:()=>void S(),className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg text-xs font-medium bg-muted/50 text-muted-foreground hover:text-foreground hover:bg-muted transition-all duration-150 focus-visible:ring-2 focus-visible:ring-ring",title:b.changes.markAllRead,children:[(0,d.jsx)("span",{className:"hidden sm:inline",children:b.changes.markAllRead}),(0,d.jsx)("span",{className:"inline sm:hidden",children:"✓"})]})]})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${P?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsx)("div",{className:"overflow-hidden",children:(0,d.jsx)("div",{className:"rounded-lg border border-border/60 bg-card/60 p-4 mb-4",children:(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground block mb-1.5",children:b.changes.filters.source}),(0,d.jsx)(A.A,{value:c,onChange:a=>f(a),options:T})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground block mb-1.5",children:b.changes.filters.keyword}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)(v.A,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/50"}),(0,d.jsx)("input",{value:D,onChange:a=>E(a.target.value),placeholder:b.changes.filters.keywordPlaceholder,className:"w-full pl-9 pr-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground placeholder:text-muted-foreground/40 outline-none focus-visible:ring-1 focus-visible:ring-ring hover:border-border/80 transition-all"})]})]})]})})})}),L&&(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsx)(C,{}),(0,d.jsx)(C,{}),(0,d.jsx)(C,{})]}),!L&&N&&(0,d.jsxs)("div",{className:"rounded-lg border border-error/20 bg-error/5 p-4 text-sm text-error",children:[N,(0,d.jsx)("button",{onClick:()=>void R(),className:"ml-2 underline hover:no-underline font-medium",children:b.changes.refresh})]}),!L&&!N&&0===F.length&&(0,d.jsx)("div",{className:"rounded-lg border border-border/60 bg-card/60 p-8 md:p-12",children:(0,d.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,d.jsx)("div",{className:"mb-4 p-4 bg-muted/50 rounded-lg",children:(0,d.jsx)(o.A,{size:28,className:"text-muted-foreground/60"})}),(0,d.jsx)("h3",{className:"text-base font-semibold text-foreground mb-1",children:b.changes.empty}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground max-w-sm",children:b.changes.emptyHint})]})}),!L&&!N&&F.length>0&&(0,d.jsx)("div",{className:"space-y-2",children:F.map(a=>{var c,e,f,s;let t,u,v=!!J[a.id],y=(0,B.m)(a.before??"",a.after??""),z=(0,B.S)(y),A=y.filter(a=>"insert"===a.type).length,C=y.filter(a=>"delete"===a.type).length;return(0,d.jsxs)("div",{className:"group rounded-lg border border-border/60 bg-card/70 overflow-hidden transition-all duration-150 hover:border-border hover:bg-card hover:shadow-sm",children:[(0,d.jsx)("button",{type:"button",onClick:()=>K(b=>({...b,[a.id]:!b[a.id]})),className:"w-full px-4 py-3 text-left focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring hover:bg-muted/20 transition-all",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsxs)("div",{className:"pt-0.5 text-muted-foreground/60 shrink-0 relative",children:[v&&(0,d.jsx)("div",{className:"absolute -left-4 top-0 bottom-0 w-[2px] rounded-r-full bg-[var(--amber)]"}),v?(0,d.jsx)(w.A,{size:15}):(0,d.jsx)(x.A,{size:15})]}),(0,d.jsx)("div",{className:"w-7 h-7 rounded-md bg-muted/50 flex items-center justify-center shrink-0 text-muted-foreground group-hover:bg-muted transition-all",children:"create_file"===(c=a.op)||"create_space"===c?(0,d.jsx)(h.A,{size:14}):"delete_file"===c?(0,d.jsx)(i.A,{size:14}):"update_lines"===c||"update_section"===c?(0,d.jsx)(j.A,{size:14}):"insert_lines"===c||"insert_after_heading"===c?(0,d.jsx)(k.A,{size:14}):"append_to_file"===c||"append_csv"===c?(0,d.jsx)(l.A,{size:14}):"rename_file"===c||"rename_space"===c||"move_file"===c?(0,d.jsx)(m.A,{size:14}):"import_file"===c?(0,d.jsx)(n.A,{size:14}):(0,d.jsx)(o.A,{size:14})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-foreground",children:function(a,b){let c=b.changes.summaries;if("Updated file content"===a)return c.updatedFileContent;if("Appended content to file"===a)return c.appendedContent;if("Moved to trash"===a)return c.movedToTrash;if("Created file"===a)return c.createdFile;if("Created space"===a)return c.createdSpace;if("Imported file into knowledge base"===a)return c.importedFile;let d=a.match(/^Inserted (\d+) line\(s\)$/);if(d)return c.insertedLines(Number(d[1]));let e=a.match(/^Updated lines (\d+)-(\d+)$/);if(e)return c.updatedLines(Number(e[1]),Number(e[2]));let f=a.match(/^Inserted content after heading "(.+)"$/);if(f)return c.insertedAfterHeading(f[1]);let g=a.match(/^Updated section "(.+)"$/);if(g)return c.updatedSection(g[1]);let h=a.match(/^Renamed file to (.+)$/);if(h)return c.renamedFile(h[1]);let i=a.match(/^Moved file to (.+)$/);if(i)return c.movedFile(i[1]);let j=a.match(/^Renamed space to (.+)$/);if(j)return c.renamedSpace(j[1]);let k=a.match(/^Appended CSV row \((\d+) cells?\)$/);return k?c.appendedCsvRow(Number(k[1])):a.startsWith("Imported legacy agent diff")?c.importedLegacyDiff:a}(a.summary,b)}),(A>0||C>0)&&(0,d.jsxs)("span",{className:"text-xs font-mono text-muted-foreground/70",children:[A>0&&(0,d.jsxs)("span",{className:"text-success font-semibold",children:["+",A]}),A>0&&C>0&&(0,d.jsx)("span",{className:"mx-0.5",children:"\xb7"}),C>0&&(0,d.jsxs)("span",{className:"text-error font-semibold",children:["-",C]})]})]}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"rounded-md px-2 py-0.5 bg-[var(--amber-dim)] text-[var(--amber)] text-xs font-medium truncate inline-block max-w-[200px]",title:a.path,children:a.path}),(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-medium ${"agent"===(e=a.source)?"bg-[var(--info)]/10 text-[var(--info)] border border-[var(--info)]/20":"user"===e?"bg-[var(--success)]/10 text-[var(--success)] border border-[var(--success)]/20":"bg-muted text-muted-foreground border border-border"} transition-colors`,children:["agent"===(f=a.source)?(0,d.jsx)(p.A,{size:13}):"user"===f?(0,d.jsx)(q.A,{size:13}):(0,d.jsx)(r.A,{size:13}),U(a.source)]}),(0,d.jsx)("span",{className:`text-xs font-medium ${(s=a.op).startsWith("create")||"import_file"===s?"text-success":s.startsWith("delete")?"text-error":s.startsWith("rename")||s.startsWith("move")?"text-muted-foreground":""}`,children:V(a.op)}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground/60 ml-auto shrink-0",children:function(a,b){let c=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(c<1)return b.changes.relativeTime.justNow;if(c<60)return b.changes.relativeTime.minutesAgo(c);let d=Math.floor(c/60);return d<24?b.changes.relativeTime.hoursAgo(d):b.changes.relativeTime.daysAgo(Math.floor(d/24))}(a.ts,b)})]})]}),(0,d.jsx)(g(),{href:`/view/${a.path.split("/").map(encodeURIComponent).join("/")}`,className:"inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium bg-[var(--amber)]/10 text-[var(--amber)] hover:bg-[var(--amber)] hover:text-[var(--amber-foreground)] focus-visible:ring-2 focus-visible:ring-ring transition-all duration-150 shrink-0",onClick:a=>a.stopPropagation(),title:b.changes.open,children:b.changes.open})]})}),v&&(t=1,u=1,(0,d.jsx)("div",{className:"border-t border-border/50 bg-background/60 max-h-80 overflow-y-auto",children:z.map((c,e)=>{if("gap"===c.type)return t+=c.count,u+=c.count,(0,d.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground/50 border-y border-border/30 bg-muted/10 text-center font-medium",children:b.changes.unchangedLines(c.count)},`${a.id}-gap-${e}`);let f="insert"===c.type?"+":"delete"===c.type?"-":" ",g="insert"!==c.type?t:"",h="delete"!==c.type?u:"";return"insert"!==c.type&&t++,"delete"!==c.type&&u++,(0,d.jsxs)("div",{className:`flex items-start text-xs font-mono leading-6 px-4 ${"insert"===c.type?"bg-success/5 hover:bg-success/8":"delete"===c.type?"bg-error/5 hover:bg-error/8":"hover:bg-muted/20"} transition-colors`,children:[(0,d.jsx)("span",{className:"w-8 shrink-0 text-right pr-2 select-none text-muted-foreground/40",children:g}),(0,d.jsx)("span",{className:"w-8 shrink-0 text-right pr-2 select-none text-muted-foreground/40",children:h}),(0,d.jsx)("span",{className:`w-3 shrink-0 text-center select-none font-bold ${"insert"===c.type?"text-success":"delete"===c.type?"text-error":"text-muted-foreground/20"}`,children:f}),(0,d.jsx)("span",{className:`flex-1 whitespace-pre-wrap break-all overflow-hidden ${"insert"===c.type?"text-success":"delete"===c.type?"text-error":"text-muted-foreground"}`,children:c.text||"\xa0"})]},`${a.id}-${e}`)})}))]},a.id)})})]})}},48135:(a,b,c)=>{"use strict";c.d(b,{TooltipProvider:()=>m,ZI:()=>p,k$:()=>o,m_:()=>n});var d=c(72269),e=c(20147),f=c(83584),g=c(38761),h=c(10391),i=c(25914),j=c(26906),k=c(64473),l=c(76867);function m({delay:a=0,...b}){return(0,d.jsx)(e.B,{"data-slot":"tooltip-provider",delay:a,...b})}function n({...a}){return(0,d.jsx)(f.s,{"data-slot":"tooltip",...a})}function o({...a}){return(0,d.jsx)(g.k,{"data-slot":"tooltip-trigger",...a})}function p({className:a,side:b="top",sideOffset:c=4,align:e="center",alignOffset:f=0,children:g,...m}){return(0,d.jsx)(h.K,{children:(0,d.jsx)(i.o,{align:e,alignOffset:f,side:b,sideOffset:c,className:"isolate z-50",children:(0,d.jsxs)(j.o,{"data-slot":"tooltip-content",className:(0,l.cn)("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...m,children:[g,(0,d.jsx)(k.P,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}},48509:(a,b,c)=>{"use strict";c.d(b,{Z:()=>m});var d=c(78520);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))},[])}}},48684:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AudioRenderer:()=>f});var d=c(72269),e=c(78520);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)]})}},48840:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>u,C:()=>s});var e=c(72269),f=c(78520),g=c(28761),h=c(65241),i=c(35205),j=c(53679),k=c(63301),l=c(37461),m=c(66447),n=c(55231),o=c(33659),p=c(22222),q=c(3712),r=a([p,q]);[p,q]=r.then?(await r)():r;let v="mindos-provider-model";function s(){return{provider:null,model:null}}function t(a,b){try{a||b?localStorage.setItem(v,JSON.stringify({provider:a,model:b})):localStorage.removeItem(v),localStorage.removeItem("mindos-provider-override")}catch{}}function u({providerValue:a,onProviderChange:b,modelValue:c,onModelChange:d,disabled:r=!1}){let s,{t:u,locale:v}=(0,o.Y)(),[w,x]=(0,f.useState)(!1),y=(0,f.useRef)(null),z=(0,f.useRef)(null),A=(0,f.useRef)(null),B=(0,f.useRef)(null),C=(0,f.useRef)(null),[D,E]=(0,f.useState)(null),F=(0,f.useRef)(null),G=(0,f.useRef)(null),[H,I]=(0,f.useState)(null),[J,K]=(0,f.useState)({}),[L,M]=(0,f.useState)(null),[N,O]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(""),[R,S]=(0,f.useState)(""),[T,U]=(0,f.useState)(-1),[V,W]=(0,f.useState)(null),X=(0,f.useRef)(0),Y=(0,f.useRef)({}),Z=(0,f.useRef)(void 0),$=(0,f.useRef)(void 0),_=(0,f.useCallback)(()=>{Z.current&&(clearTimeout(Z.current),Z.current=void 0)},[]),aa=(0,f.useCallback)(()=>{_(),Z.current=setTimeout(()=>{I(null),S("")},300)},[_]),ab=D?.ai?.activeProvider||"",ac=(0,f.useMemo)(()=>D?(D.ai?.providers??[]).map(a=>a.id):[],[D]);(0,f.useRef)(!1);let ad=a??ab,ae=(0,q.lh)(D?.ai?.providers??[],String(ad)),af=ae?p.T_[ae.protocol]:null,ag=ae?.model||af?.defaultModel||"",ah=c||ag,ai=ae?.name||(af?"zh"===v?af.nameZh:af.name:String(ad)),[aj,ak]=(0,f.useState)({}),al=(0,f.useRef)(void 0),am=(0,f.useCallback)(()=>{if(!y.current)return;let a=y.current.getBoundingClientRect(),b=a.top>window.innerHeight-a.bottom&&a.top>280;ak({position:"fixed",left:Math.min(a.left,window.innerWidth-270),...b?{bottom:window.innerHeight-a.top+6}:{top:a.bottom+6},zIndex:50})},[]);(0,f.useCallback)(()=>{al.current&&clearTimeout(al.current),al.current=setTimeout(()=>{am()},0)},[am]);let an=(0,f.useCallback)(async(a,b=!1)=>{if(!b&&Y.current[a]){M(Y.current[a]),O(!1);return}b&&delete Y.current[a],O(!0),Q(""),M(null);let c=++X.current;try{let b=await fetch("/api/settings/list-models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a})});if(c!==X.current)return;let d=await b.json();if(c!==X.current)return;d.ok&&Array.isArray(d.models)?(Y.current[a]=d.models,M(d.models)):Q(d.error||"Failed")}catch{c===X.current&&Q("Network error")}finally{c===X.current&&O(!1)}},[]),ao=(0,f.useCallback)(a=>{W(b=>({providerId:a,nonce:(b?.nonce??0)+1}))},[]),ap=(0,f.useCallback)(a=>{let b=(0,q.lh)(D?.ai?.providers??[],a);if(!b)return!1;let c=p.T_[b.protocol];return c?.supportsListModels??!1},[D]),aq=(0,f.useCallback)(()=>{let a=F.current,b=G.current;if(!a||!b)return;let c=a.getBoundingClientRect(),d=b.getBoundingClientRect(),e=c.right+4,f=d.top;window.innerHeight-f<320&&(f=Math.max(8,d.bottom-320));let g=e+220>window.innerWidth-8?c.left-220-4:e;K({position:"fixed",left:g,top:f,zIndex:51})},[]),ar=(0,f.useCallback)(a=>{_(),$.current&&clearTimeout($.current),$.current=setTimeout(()=>{if(!ap(a)){I(null),S("");return}I(a),S(""),U(-1),Q(""),M(Y.current[a]??null),Y.current[a]||an(a),requestAnimationFrame(()=>{aq(),setTimeout(()=>B.current?.focus(),50)})},80)},[_,an,aq,ap]),as=(0,f.useCallback)(()=>{_(),$.current&&(clearTimeout($.current),$.current=void 0),I(null),S("")},[_]),at=(0,f.useCallback)(a=>{b(a),d(null),t(a,null),x(!1),I(null),S("")},[d,b]),au=(0,f.useCallback)((a,c)=>{b(a),d(c),t(a,c),x(!1),I(null),S("")},[d,b]),av=(0,f.useMemo)(()=>{if(!L)return[];if(!R.trim())return L;let a=R.toLowerCase();return L.filter(b=>b.toLowerCase().includes(a))},[L,R]),aw=(0,f.useCallback)(a=>{av.length&&("ArrowDown"===a.key?(a.preventDefault(),U(a=>(a+1)%av.length)):"ArrowUp"===a.key?(a.preventDefault(),U(a=>(a-1+av.length)%av.length)):"Enter"===a.key&&T>=0&&T<av.length&&H?(a.preventDefault(),au(H,av[T])):"Escape"===a.key&&(a.preventDefault(),I(null),S("")))},[av,T,H,au]);if(!D||0===ac.length)return null;let ax=(ah||"").length>20?(ah||"").slice(0,18)+"…":ah,ay=(s=ae?.name||"")&&s.length>12?s.slice(0,10)+"…":s||af?.shortLabel||ai,az=`${ai} \xb7 ${ah}`,aA=!!(c&&c!==ag),aB=w?(0,e.jsx)("div",{ref:z,style:aj,children:(0,e.jsx)("div",{ref:F,role:"listbox","aria-label":u.ask?.providerCapsule??"Provider",className:"w-[260px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{maxHeight:"70vh",overflowY:"auto"},children:ac.map(b=>{let d=(0,q.lh)(D?.ai?.providers??[],b);if(!d)return null;let f=p.T_[d.protocol],g=d.name||("zh"===v?f?.nameZh:f?.name)||b,h=c&&a===b?c:d.model||f?.defaultModel||"",i=a===b||!a&&ab===b,j=H===b,m=ap(b);return(0,e.jsx)("div",{ref:j?G:void 0,onMouseEnter:()=>m?ar(b):as(),onMouseLeave:aa,children:(0,e.jsxs)("div",{className:`flex w-full items-center text-xs transition-colors ${j?"bg-accent/60":"hover:bg-muted/60"}`,children:[(0,e.jsxs)("button",{type:"button",role:"option","aria-selected":i,onClick:()=>at(b),className:"flex flex-1 items-center gap-2 px-3 py-1.5 min-w-0 text-left",children:[(0,e.jsx)("span",{className:`shrink-0 text-xs ${i?"font-medium text-foreground":"text-foreground/80"}`,children:g}),h&&(0,e.jsx)("span",{className:"min-w-0 truncate rounded bg-muted/70 px-1.5 py-px text-[10px] font-mono leading-tight text-muted-foreground",children:h}),i&&(0,e.jsx)(k.A,{size:11,className:"shrink-0 ml-auto text-[var(--amber)]"})]}),m&&(0,e.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),H===b?as():ar(b)},className:`shrink-0 px-1.5 py-1.5 mr-1 rounded transition-colors ${j?"text-foreground":"text-muted-foreground/40 hover:text-muted-foreground"}`,title:u.ask?.selectModel??"Select model",children:(0,e.jsx)(l.A,{size:11})})]})},b)})})}):null;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{ref:y,type:"button",onClick:()=>{!r&&(x(a=>!a),w&&(I(null),S("")))},disabled:r,className:`
94
82
  inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
95
83
  text-2xs font-medium transition-colors select-none max-w-[260px]
96
84
  border focus:outline-none focus-visible:ring-2 focus-visible:ring-ring
@@ -180,7 +168,24 @@ Be specific. Reference actual content from the files. Keep the total response un
180
168
  transition: color .15s;
181
169
  }
182
170
  .summary-source-chip:hover { color: var(--foreground); }
183
- `})]})}},74246:(a,b,c)=>{"use strict";c.r(b),c.d(b,{PdfRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/pdf/PdfRenderer.tsx","PdfRenderer")},74569:(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})},74808:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(72269);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:"var(--logo-sparkle)"})]})}},75004:(a,b,c)=>{"use strict";c.d(b,{D4:()=>f,FB:()=>d,W8:()=>g,g4:()=>h,jQ:()=>j});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(){}let i=0;function j(){return`org-${Date.now()}-${++i}`}},75571:(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"]},75817:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/agent-inspector/AgentInspectorRenderer.tsx","AgentInspectorRenderer")},76867:(a,b,c)=>{"use strict";c.d(b,{IX:()=>i,KW:()=>h,O0:()=>g,cn:()=>f,vr:()=>j});var d=c(30557),e=c(1358);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}},76994:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/app/error.tsx","default")},77982:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/components/UpdateOverlay.tsx","default")},79149:(a,b,c)=>{"use strict";c.d(b,{av:()=>l,cd:()=>j,kr:()=>i,oc:()=>k,u_:()=>m,zd:()=>h});var d=c(12187),e=c(10002);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()}let k=()=>h(a=>a.agents),l=()=>h(a=>a.status),m=()=>h(a=>a.installAgent)},80144:(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}},80188:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(78520),e=c(33659),f=c(53333);function g({ssrLocale:a}){return(0,d.useState)(()=>(e.D.getState().locale!==a&&e.D.setState({locale:a,t:f.D[a]}),null)),null}},82556:(a,b,c)=>{Promise.resolve().then(c.bind(c,12518))},83761:(a,b,c)=>{"use strict";c.d(b,{wl:()=>v,ZV:()=>x,dS:()=>w,Ay:()=>z});var d=c(72269),e=c(78520),f=c(79149),g=c(33659),h=c(99440),i=c(55433),j=c(27246),k=c(53679),l=c(65836),m=c(83614),n=c(44975),o=c(89516),p=c(81644),q=c(74569),r=c(4137),s=c(7288);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-[var(--amber-foreground)] 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(16704);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.oc)(),n=(0,f.av)(),o=(0,f.u_)(),{t:p}=(0,g.Y)(),q=p.panels.agents,r=m.filter(a=>a.present&&a.installed),s=m.filter(a=>a.present&&!a.installed),u=m.filter(a=>!a.present),v=(0,e.useMemo)(()=>{if(!b)return null;let a=m.find(a=>a.key===b);if(!a)return null;let c=r.some(a=>a.key===b)?"connected":s.some(a=>a.key===b)?"detected":u.some(a=>a.key===b)?"notFound":null;return c?{agent:a,status:c}:null},[b,m,r,s,u]),z=(0,h._)({width:j,minWidth:w,maxWidth:x,maxWidthRatio:y,direction:"left",onResize:k,onResizeEnd:l}),A={connected:q.connected,installing:q.installing,install:q.install,installFailed:q.installFailed,copyConfig:q.copyConfig,copied:q.copied,transportLocal:q.transportLocal,transportRemote:q.transportRemote,configPath:q.configPath,notFoundDetail:q.notFoundDetail,backToList:q.backToList,closeDetail:q.closeAgentDetail,agentDetailTransport:q.agentDetailTransport,agentDetailSnippet:q.agentDetailSnippet};return(0,d.jsxs)("aside",{className:`
171
+ `})]})}},74246:(a,b,c)=>{"use strict";c.r(b),c.d(b,{PdfRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/pdf/PdfRenderer.tsx","PdfRenderer")},74569:(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})},74808:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(72269);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:"var(--logo-sparkle)"})]})}},75004:(a,b,c)=>{"use strict";c.d(b,{D4:()=>f,FB:()=>d,W8:()=>g,g4:()=>h,jQ:()=>j});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(){}let i=0;function j(){return`org-${Date.now()}-${++i}`}},75571:(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"]},75817:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AgentInspectorRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/agent-inspector/AgentInspectorRenderer.tsx","AgentInspectorRenderer")},76867:(a,b,c)=>{"use strict";c.d(b,{IX:()=>i,KW:()=>h,O0:()=>g,cn:()=>f,vr:()=>j});var d=c(30557),e=c(1358);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}},76994:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/app/error.tsx","default")},77982:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/MindOS/MindOS/packages/web/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/packages/web/components/UpdateOverlay.tsx","default")},79149:(a,b,c)=>{"use strict";c.d(b,{av:()=>l,cd:()=>j,kr:()=>i,oc:()=>k,u_:()=>m,zd:()=>h});var d=c(12187),e=c(10002);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()}let k=()=>h(a=>a.agents),l=()=>h(a=>a.status),m=()=>h(a=>a.installAgent)},80144:(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}},80188:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(78520),e=c(33659),f=c(53333);function g({ssrLocale:a}){return(0,d.useState)(()=>(e.D.getState().locale!==a&&e.D.setState({locale:a,t:f.D[a]}),null)),null}},80676:(a,b,c)=>{"use strict";c.d(b,{Ay:()=>af,Fo:()=>K,gL:()=>L});var d=c(72269),e=c(78520),f=c(35959),g=c(35879),h=c(76867),i=c(90697),j=c(23095),k=c(53679),l=c(55231),m=c(69733),n=c(40303),o=c(3278),p=c(74917),q=c(62746),r=c(89189),s=c(81644),t=c(25860),u=c(32068),v=c(5025);let w=(0,v.createServerReference)("60370ba03dc83c1e902aff5b9a25205c5b6b843ea5",v.callServer,void 0,v.findSourceMapURL,"createFileAction"),x=(0,v.createServerReference)("60a7147e8a589aa8fcd0602636bbfc11893a44886d",v.callServer,void 0,v.findSourceMapURL,"renameSpaceAction");var y=c(48006);let z=(0,v.createServerReference)("40dde1921e0bb2f8e4a43d2e77a41225230de413db",v.callServer,void 0,v.findSourceMapURL,"deleteSpaceAction"),A=(0,v.createServerReference)("40d3b59414a5e0520ddec1039741e96386c7445f78",v.callServer,void 0,v.findSourceMapURL,"deleteFolderAction");var B=c(33966),C=c(18591),D=c(74569),E=c(33659),F=c(73420),G=c(48509);let H="show-hidden-files";function I(a){let b=b=>{b.key===H&&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 J(){return!1}function K(a){localStorage.setItem(H,String(a)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function L(){return(0,e.useSyncExternalStore)(I,J,()=>!1)}var M=c(63353),N=c(44046),O=c(31448);let P=(0,v.createServerReference)("40d306efe4cd5d739ab6ba5ae5d669fee638371e69",v.callServer,void 0,v.findSourceMapURL,"convertToSpaceAction");var Q=c(10002);async function R(){try{let a=await (0,Q.n)("/api/settings"),b=a.ai?.provider??"",c=(a.ai?.providers??{})[b];return!!c?.apiKey}catch{return!1}}function S(a){for(let b of a.split("\n")){let a=b.trim();if(!a.startsWith("data:"))continue;let c=a.slice(5).trim();if(c)try{let a=JSON.parse(c);if("error"===a.type)return String(a.message||"AI initialization failed")}catch{}}return null}async function T(a){let b=a.getReader(),c=new TextDecoder,d="";try{for(;;){let{done:a,value:e}=await b.read();if(a)break;let f=(d+=c.decode(e,{stream:!0})).split("\n");d=f.pop()??"";let g=S(f.join("\n"));if(g)throw Error(g)}if(d){let a=S(d);if(a)throw Error(a)}}finally{b.releaseLock()}}async function U(a){try{await navigator.clipboard.writeText(a)}catch{}}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,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})}function Z({x:a,y:b,node:c,onClose:e,onRename:g,onNewFile:i,onImport:j,onDelete:k}){let l=(0,f.useRouter)(),{t:m}=(0,E.Y)(),{isPinned:n,togglePin:o}=(0,G.Z)(),p=n(c.path);return(0,d.jsxs)(Y,{x:a,y:b,onClose:e,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{i(),e()},children:[(0,d.jsx)(M.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,d.jsxs)("button",{className:V,onClick:()=>{l.push(`/view/${(0,h.O0)(`${c.path}/INSTRUCTION.md`)}`),e()},children:[(0,d.jsx)(N.A,{size:14,className:"shrink-0"})," ",m.fileTree.viewRules]}),j&&(0,d.jsxs)("button",{className:V,onClick:()=>{j(c.path),e()},children:[(0,d.jsx)(O.A,{size:14,className:"shrink-0"})," ",m.fileTree.importFile]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:V,onClick:()=>{o(c.path),e()},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${p?"fill-[var(--amber)] text-[var(--amber)]":""}`}),p?m.fileTree.removeFromFavorites:m.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:V,onClick:()=>{U(c.path),e()},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{g(),e()},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",m.fileTree.renameSpace]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:()=>{e(),k()},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"}),m.fileTree.deleteSpace]})]})}function $({x:a,y:b,node:c,onClose:g,onRename:h,onNewFile:i,onDelete:j}){let k=(0,f.useRouter)(),{t:l}=(0,E.Y)(),[m,o]=(0,e.useTransition)(),{isPinned:p,togglePin:q}=(0,G.Z)(),v=p(c.path);return(0,d.jsxs)(Y,{x:a,y:b,onClose:g,menuHeight:220,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{i(),g()},children:[(0,d.jsx)(M.A,{size:14,className:"shrink-0"})," ",l.fileTree.newFile]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:V,onClick:()=>{q(c.path),g()},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${v?"fill-[var(--amber)] text-[var(--amber)]":""}`}),v?l.fileTree.removeFromFavorites:l.fileTree.pinToFavorites]}),(0,d.jsxs)("button",{className:V,disabled:m,onClick:()=>{o(async()=>{if((await P(c.path)).success){k.refresh(),window.dispatchEvent(new Event("mindos:files-changed"));let a=c.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||c.name;R().then(b=>{b&&function(a,b,c=""){let d="u">typeof document&&"zh"===document.documentElement.lang?`初始化新建的心智空间「${a}」,路径为「${b}/」。${c?`描述:「${c}」。`:""}两个文件均已存在模板,用 write_file 覆盖:
172
+ 1. 「${b}/README.md」— 写入空间用途、结构概览、使用指南
173
+ 2. 「${b}/INSTRUCTION.md」— 写入 AI Agent 在此空间中的行为规则和操作约定
174
+
175
+ 内容简洁实用,直接使用工具写入。`:`Initialize the new Mind Space "${a}" at "${b}/". ${c?`Description: "${c}". `:""}Both files already exist with templates — use write_file to overwrite:
176
+ 1. "${b}/README.md" — write purpose, structure overview, usage guidelines
177
+ 2. "${b}/INSTRUCTION.md" — write rules for AI agents operating in this space
178
+
179
+ 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}`);await T(a.body),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"}}))})}(a,c.path)})}g()})},children:[(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"})," ",l.fileTree.convertToSpace]}),(0,d.jsxs)("button",{className:V,onClick:()=>{U(c.path),g()},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",l.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{h(),g()},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",l.fileTree.rename]}),(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:()=>{g(),j()},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"}),l.fileTree.deleteFolder]})]})}var _=c(51522);function aa(){window.dispatchEvent(new Event("mindos:files-changed"))}async function ab(a){try{await navigator.clipboard.writeText(a)}catch{}}function ac({dirPath:a,depth:b,onDone:c}){let[g,i]=(0,e.useState)(""),[j,l]=(0,e.useTransition)(),[m,n]=(0,e.useState)(""),o=(0,f.useRouter)(),{t:p}=(0,E.Y)(),q=(0,e.useRef)(null),r=(0,e.useCallback)(()=>{let b=g.trim();b?l(async()=>{let d=await w(a,b);d.success&&d.filePath?(c(),o.push(`/view/${(0,h.O0)(d.filePath)}`),o.refresh(),aa()):n(d.error||p.fileTree.failed)}):n(p.fileTree.enterFileName)},[g,a,c,o,p]);return(0,d.jsxs)("div",{ref:q,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),n("")},onKeyDown:a=>{"Enter"===a.key&&r(),"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)(k.A,{size:13,className:"text-muted-foreground animate-spin shrink-0"}):(0,d.jsx)("button",{onClick:r,className:"text-xs text-[var(--amber)] hover:text-foreground shrink-0 px-1",children:p.fileTree.create})]}),m&&(0,d.jsx)("p",{className:"text-xs text-error mt-0.5 px-1",children:m})]})}let ad=(0,e.memo)(function({node:a,depth:b,currentPath:c,onNavigate:i,maxOpenDepth:j,onImport:r}){let s=(0,f.useRouter)(),t=c.startsWith(a.path+"/")||c===a.path,u=!!a.isSpace,[v,w]=(0,e.useState)(0===b||t),[C,G]=(0,e.useState)(0===b||t),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(!1),[L,M]=(0,e.useState)(a.name),[N,O]=(0,e.useTransition)(),P=(0,e.useRef)(null),Q=(0,e.useRef)(null),[R,S]=(0,e.useState)(null),{t:T}=(0,E.Y)(),[U,V]=(0,e.useState)(null),[W,X]=(0,e.useTransition)(),{isDragTarget:Y,handleRowDragOver:ab,handleRowDragEnter:ad,handleRowDragLeave:ae,handleRowDrop:ag}=function(a,b,c,d){let[f,g]=(0,e.useState)(!1),h=(0,e.useRef)(null),i=(0,e.useRef)(null),j=(0,e.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),k=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),a.dataTransfer.dropEffect="copy",i.current&&(clearTimeout(i.current),i.current=null),f||g(!0))},[f]),l=(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.preventDefault(),a.stopPropagation(),g(!0),j(),b||(h.current=setTimeout(()=>{c(!0),h.current=null},500)))},[b,j,c]);return{isDragTarget:f,handleRowDragOver:k,handleRowDragEnter:l,handleRowDragLeave:(0,e.useCallback)(a=>{a.dataTransfer.types.includes("Files")&&(a.stopPropagation(),i.current=setTimeout(()=>{g(!1),j(),i.current=null},50))},[j]),handleRowDrop:(0,e.useCallback)(b=>{b.preventDefault(),b.stopPropagation(),g(!1),j(),i.current&&(clearTimeout(i.current),i.current=null);let c=b.dataTransfer.files;c.length>0&&(0,_.Nh)(Array.from(c),a.path,d)},[a.path,d,j])}}(a,v,(0,e.useCallback)(a=>{w(a),a&&G(!0)},[]),T),ah=(0,e.useCallback)(()=>{w(a=>(a||G(!0),!a))},[]),ai=(0,e.useRef)(void 0);(0,e.useEffect)(()=>{if(null==j){ai.current=j;return}if(ai.current!==j){if(null===ai.current||void 0===ai.current)b>j?w(!1):G(!0);else{let a=b<=j;w(a),a&&G(!0)}ai.current=j}},[j,b]),(0,e.useEffect)(()=>()=>{Q.current&&clearTimeout(Q.current)},[]);let aj=(0,e.useCallback)(b=>{b?.preventDefault(),b?.stopPropagation(),Q.current&&(clearTimeout(Q.current),Q.current=null),M(a.name),K(!0),setTimeout(()=>P.current?.select(),0)},[a.name]),ak=(0,e.useCallback)(()=>{let b=L.trim();b&&b!==a.name?O(async()=>{let c=u?x:y.f,d=await c(a.path,b);d.success&&d.newPath?(K(!1),s.push(`/view/${(0,h.O0)(d.newPath)}`),s.refresh(),aa()):K(!1)}):K(!1)},[L,a.name,a.path,s,u]),al=(0,e.useCallback)(()=>{J||(Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{s.push(`/view/${(0,h.O0)(a.path)}`),i?.(),Q.current=null},180))},[J,s,a.path,i]);(0,e.useCallback)(a=>{a.stopPropagation(),ah()},[ah]);let am=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),S({x:a.clientX,y:a.clientY})},[]),an=u?function a(b){return"file"===b.type?+!g.C.has(b.name):(b.children??[]).reduce((b,c)=>b+a(c),0)}(a):0;if(J)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:L,onChange:a=>M(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ak(),"Escape"===a.key&&K(!1)},onBlur:ak,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"}),N&&(0,d.jsx)(k.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let ao=u&&0===b;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:`relative group/dir flex items-center transition-colors duration-100 ${Y?"bg-[var(--amber)]/10 rounded-md":""}`,onContextMenu:am,onDragEnter:ad,onDragOver:ab,onDragLeave:ae,onDrop:ag,children:[(0,d.jsx)("button",{onClick:ah,className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground transition-colors",style:{marginLeft:`${12*b+4}px`},"aria-label":v?`Collapse ${a.name}`:`Expand ${a.name}`,"aria-expanded":v,children:(0,d.jsx)("span",{className:"block transition-transform duration-150",style:{transform:v?"rotate(0deg)":"rotate(-90deg)"},children:(0,d.jsx)(l.A,{size:10})})}),(0,d.jsxs)("button",{type:"button",onClick:al,draggable:!0,onDragStart:b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.setData("text/mindos-type","directory"),b.dataTransfer.effectAllowed="copy"},className:`
180
+ flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
181
+ text-sm transition-colors duration-100
182
+ hover:bg-muted cursor-default
183
+ ${t?"text-foreground":"text-muted-foreground hover:text-foreground"}
184
+ `,children:[u?"Inbox"===a.name?(0,d.jsx)(m.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):v?(0,d.jsx)(o.A,{size:14,className:"text-yellow-400 shrink-0"}):(0,d.jsx)(p.A,{size:14,className:"text-yellow-400 shrink-0"}),(0,d.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:a.name}),u&&!v&&(0,d.jsx)("span",{className:"ml-auto text-xs text-muted-foreground shrink-0 tabular-nums pr-1",children:an})]}),(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)(q.A,{size:14})})})]}),(0,d.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${v?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,d.jsxs)("div",{className:`overflow-hidden ${ao?"border-l-2 ml-[18px]":""}`,style:ao?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!v&&{inert:!0},children:[C&&a.children&&(0,d.jsx)(af,{nodes:a.children,depth:ao?1:b+1,onNavigate:i,maxOpenDepth:j,parentIsSpace:u,onImport:r}),H&&(0,d.jsx)(ac,{dirPath:a.path,depth:ao?0:b,onDone:()=>I(!1)})]})}),R&&(u?(0,d.jsx)(Z,{x:R.x,y:R.y,node:a,onClose:()=>S(null),onRename:()=>aj(),onNewFile:()=>{w(!0),G(!0),I(!0)},onImport:r,onDelete:()=>V("space")}):(0,d.jsx)($,{x:R.x,y:R.y,node:a,onClose:()=>S(null),onRename:()=>aj(),onNewFile:()=>{w(!0),G(!0),I(!0)},onDelete:()=>V("folder")})),(0,d.jsx)(F.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 z(a.path):await A(a.path);if(b.success&&b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;D.oR.undo(`${T.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,B.Y)(c);a.success?(s.refresh(),aa()):D.oR.error(a.error??"Undo failed")},{label:T.trash?.undo??"Undo"}),s.push("/"),s.refresh(),aa()}})}})]})}),ae=(0,e.memo)(function({node:a,depth:b,currentPath:c,onNavigate:l}){let m=(0,f.useRouter)(),n=c===a.path,[o,p]=(0,e.useState)(!1),[v,w]=(0,e.useState)(a.name),[x,z]=(0,e.useTransition)(),[,A]=(0,e.useTransition)(),H=(0,e.useRef)(null),{t:I}=(0,E.Y)(),{isPinned:J,togglePin:K}=(0,G.Z)(),L=J(a.path),M=!a.path.includes("/")&&g.A.has(a.name),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(null),R=(0,e.useCallback)(()=>{o||(m.push(`/view/${(0,h.O0)(a.path)}`),l?.())},[m,a.path,l,o]),S=(0,e.useCallback)(b=>{b.stopPropagation(),w(a.name),p(!0),setTimeout(()=>H.current?.select(),0)},[a.name]),T=(0,e.useCallback)(()=>{let b=v.trim();b&&b!==a.name?z(async()=>{let c=await (0,y.f)(a.path,b);c.success&&c.newPath?(p(!1),m.push(`/view/${(0,h.O0)(c.newPath)}`),m.refresh(),aa()):p(!1)}):p(!1)},[v,a.name,a.path,m]),U=(0,e.useCallback)(a=>{a.stopPropagation(),O(!0)},[]),Z=(0,e.useCallback)(b=>{b.dataTransfer.setData("text/mindos-path",a.path),b.dataTransfer.effectAllowed="copy"},[a.path]),$=(0,e.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),Q({x:a.clientX,y:a.clientY})},[]);return o?(0,d.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*b+8}px`},children:[(0,d.jsx)("input",{ref:H,autoFocus:!0,value:v,onChange:a=>w(a.target.value),onKeyDown:a=>{"Enter"===a.key&&T(),"Escape"===a.key&&p(!1)},onBlur:T,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"}),x&&(0,d.jsx)(k.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:R,onContextMenu:$,draggable:!0,onDragStart:Z,"data-filepath":a.path,className:`
185
+ w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
186
+ text-sm transition-colors duration-100 cursor-default pr-16
187
+ ${n?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
188
+ `,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)(r.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();Q({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)(q.A,{size:14})})}),P&&(0,d.jsxs)(Y,{x:P.x,y:P.y,onClose:()=>Q(null),menuHeight:140,children:[(0,d.jsxs)("button",{className:V,onClick:()=>{ab(a.path),Q(null)},children:[(0,d.jsx)(s.A,{size:14,className:"shrink-0"})," ",I.fileTree.copyPath]}),(0,d.jsxs)("button",{className:V,onClick:()=>{K(a.path),Q(null)},children:[(0,d.jsx)(r.A,{size:14,className:`shrink-0 ${L?"fill-[var(--amber)] text-[var(--amber)]":""}`}),L?I.fileTree.removeFromFavorites:I.fileTree.pinToFavorites]}),!M&&(0,d.jsxs)("button",{className:V,onClick:a=>{Q(null),S(a)},children:[(0,d.jsx)(t.A,{size:14,className:"shrink-0"})," ",I.fileTree.rename]}),!M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:X}),(0,d.jsxs)("button",{className:W,onClick:a=>{Q(null),U(a)},children:[(0,d.jsx)(u.A,{size:14,className:"shrink-0"})," ",I.fileTree.delete]})]})]}),(0,d.jsx)(F.TM,{open:N,title:I.fileTree.delete,message:I.fileTree.confirmDelete(a.name),confirmLabel:I.fileTree.delete,cancelLabel:I.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>O(!1),onConfirm:()=>{O(!1),A(async()=>{let b=await (0,C.i)(a.path);if(b.success){if(b.trashId){let c=b.trashId,d=a.path.split("/").pop()??a.path;D.oR.undo(`${I.trash?.movedToTrash??"Deleted"} ${d}`,async()=>{let a=await (0,B.Y)(c);a.success?(m.refresh(),aa()):D.oR.error(a.error??"Undo failed")},{label:I.trash?.undo??"Undo"})}m.refresh(),aa()}})}})]})});function af({nodes:a,depth:b=0,onNavigate:c,maxOpenDepth:h,parentIsSpace:i,onImport:j}){var k;let l,m=(l="/view/",(k=(0,f.usePathname)()).startsWith(l)?k.slice(l.length).split("/").map(decodeURIComponent).join("/"):""),n=L(),o=0===b,p=(0,e.useMemo)(()=>{let b=n?a:a.filter(a=>!(o&&a.name.startsWith(".")||"file"===a.type&&g.C.has(a.name)||"directory"===a.type&&a.name.startsWith(".")));return o?b.filter(a=>"directory"!==a.type||"Inbox"!==a.name):b},[a,n,o]);return(0,d.jsx)("div",{className:"flex flex-col gap-0.5",children:p.map(a=>"directory"===a.type?(0,d.jsx)(ad,{node:a,depth:b,currentPath:m,onNavigate:c,maxOpenDepth:h,onImport:j},a.path):(0,d.jsx)(ae,{node:a,depth:b,currentPath:m,onNavigate:c},a.path))})}},82556:(a,b,c)=>{Promise.resolve().then(c.bind(c,12518))},83761:(a,b,c)=>{"use strict";c.d(b,{wl:()=>v,ZV:()=>x,dS:()=>w,Ay:()=>z});var d=c(72269),e=c(78520),f=c(79149),g=c(33659),h=c(99440),i=c(55433),j=c(27246),k=c(53679),l=c(65836),m=c(83614),n=c(44975),o=c(89516),p=c(81644),q=c(74569),r=c(4137),s=c(7288);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-[var(--amber-foreground)] 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(16704);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.oc)(),n=(0,f.av)(),o=(0,f.u_)(),{t:p}=(0,g.Y)(),q=p.panels.agents,r=m.filter(a=>a.present&&a.installed),s=m.filter(a=>a.present&&!a.installed),u=m.filter(a=>!a.present),v=(0,e.useMemo)(()=>{if(!b)return null;let a=m.find(a=>a.key===b);if(!a)return null;let c=r.some(a=>a.key===b)?"connected":s.some(a=>a.key===b)?"detected":u.some(a=>a.key===b)?"notFound":null;return c?{agent:a,status:c}:null},[b,m,r,s,u]),z=(0,h._)({width:j,minWidth:w,maxWidth:x,maxWidthRatio:y,direction:"left",onResize:k,onResizeEnd:l}),A={connected:q.connected,installing:q.installing,install:q.install,installFailed:q.installFailed,copyConfig:q.copyConfig,copied:q.copied,transportLocal:q.transportLocal,transportRemote:q.transportRemote,configPath:q.configPath,notFoundDetail:q.notFoundDetail,backToList:q.backToList,closeDetail:q.closeAgentDetail,agentDetailTransport:q.agentDetailTransport,agentDetailSnippet:q.agentDetailSnippet};return(0,d.jsxs)("aside",{className:`
184
189
  hidden md:flex fixed top-0 h-screen z-[31] flex-col bg-card border-l border-border shadow-sm
185
190
  transition-transform duration-200 ease-out
186
191
  ${a?"translate-x-0":"translate-x-full pointer-events-none"}
@@ -190,16 +195,11 @@ Be specific. Reference actual content from the files. Keep the total response un
190
195
  `,children:[(0,d.jsxs)(x(),{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)(A.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)(v.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)(C,{agentKey:a.key,agentName:a.name,onInstallAgent:f,copy:g})})]})}function C({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)(y.A,{size:10}):null,!g&&m?(0,d.jsx)(z.A,{size:10}):null,o,(0,d.jsx)("span",{className:"sr-only","aria-live":"polite",children:m?f.installFailed:""})]})}function D({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)(B,{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)(B,{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)(u.A,{size:12}):(0,d.jsx)(v.A,{size:12}),j.sectionNotDetected," (",c.length,")"]}),h&&(0,d.jsx)("div",{className:"space-y-1.5",children:c.map(a=>(0,d.jsx)(B,{agent:a,agentStatus:"notFound",selected:e===a.key,detailHref:`/agents/${encodeURIComponent(a.key)}`,onInstallAgent:f,copy:g},a.key))})]})]})}var E=c(49827),F=c(83614),G=c(65836),H=c(56589),I=c(37029);function J(){let{t:a}=(0,m.Y)(),b=a.panels.im,c=(0,f.useSearchParams)().get("platform"),[i,j]=(0,e.useState)([]),[k,l]=(0,e.useState)(!0),[n,o]=(0,e.useState)(!1),p=(0,e.useCallback)(async()=>{o(!1);try{let a=await fetch("/api/im/status");if(a.ok){let b=await a.json();j(b.platforms??[])}else o(!0)}catch{o(!0)}l(!1)},[]);if(k)return(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.A,{size:16,className:"animate-spin text-muted-foreground"})});if(n)return(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2 py-8 px-3",children:[(0,d.jsx)(F.A,{size:16,className:"text-muted-foreground"}),(0,d.jsx)("p",{className:"text-2xs text-muted-foreground",children:b.fetchError}),(0,d.jsxs)("button",{type:"button",onClick:()=>{l(!0),p()},className:"inline-flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,d.jsx)(g.A,{size:11})," ",b.retry]})]});let q=i.filter(a=>a.connected).length;return(0,d.jsxs)("div",{className:"flex flex-col py-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mb-0.5",children:[(0,d.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider",children:b.title}),q>0&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground/60",children:[q," ",b.connected]})]}),(0,d.jsx)("div",{className:"flex flex-col",children:I.P.map(({id:a,name:b,icon:e})=>{let f=i.find(b=>b.platform===a),g=f?.connected??!1,h=c===a;return(0,d.jsxs)(x(),{href:`/agents?tab=channels&platform=${a}`,className:`
191
196
  relative flex items-center gap-2.5 px-3 py-2 text-left rounded-sm transition-colors
192
197
  ${h?"bg-[var(--amber-dim)]/40 pl-3.5":"hover:bg-muted/50"}
193
- `,children:[h&&(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}),(0,d.jsx)("span",{className:"text-sm",children:e}),(0,d.jsx)("span",{className:"text-sm flex-1 truncate text-foreground",children:b}),g?(0,d.jsx)(G.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(H.A,{size:14,className:"text-border shrink-0"})]},a)})})]})}function K({active:a,maximized:b,onMaximize:c,selectedAgentKey:o=null}){let{t:p}=(0,m.Y)(),q=p.panels.agents,r=(0,f.useRouter)(),s=(0,k.kr)(),u=(0,f.usePathname)(),v=(0,f.useSearchParams)(),w="/agents"===u&&"channels"===v.get("tab"),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),F=(0,l.V)(),G=async()=>{y(!0),await s.refresh(),y(!1)},H=s.agents.filter(a=>a.present&&a.installed),I=s.agents.filter(a=>a.present&&!a.installed),K=s.agents.filter(a=>!a.present),L=async a=>{let b=await s.installAgent(a);return b&&await s.refresh(),b},M=u?.startsWith("/agents/")?decodeURIComponent(u.slice(8)):null,N={installing:q.installing,install:q.install,installSuccess:q.installSuccess,installFailed:q.installFailed,retryInstall:q.retryInstall},O={navOverview:q.navOverview,navMcp:q.navMcp,navSkills:q.navSkills,navChannels:q.channels,navNetwork:q.navNetwork,navSessions:q.navSessions,navActivity:q.navActivity},P=(0,d.jsx)(t,{copy:O,connectedCount:H.length,mcpEnabled:s.status?.connectionMode?.mcp??!1,channelsActive:w,onChannelsClick:()=>{r.push("/agents?tab=channels")}});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:[!s.loading&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:[H.length," ",q.connected,F.agents.length>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",q.a2aLabel," ",F.agents.length]})]}),(0,d.jsx)("button",{onClick:G,disabled:x,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:x?"animate-spin":""})})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:s.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===s.agents.length&&0===s.skills.length?(0,d.jsxs)("div",{className:"flex flex-col gap-2 py-4 px-0",children:[P,(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:G,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:[P,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),w?(0,d.jsx)(J,{}):(0,d.jsx)("div",{className:"px-3 py-3 space-y-4",children:(0,d.jsx)(D,{connected:H,detected:I,notFound:K,selectedAgentKey:M??o,listCopy:N,onInstallAgent:L,showNotDetected:z,setShowNotDetected:A,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:()=>C(!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)(E.A,{open:B,onClose:()=>C(!1),onDiscover:F.discover,discovering:F.discovering,error:F.error})]})}},85973:(a,b,c)=>{"use strict";c.d(b,{t:()=>h});var d=c(78520),e=c(35564),f=c(22499),g=c(24663);function h({currentFile:a,chatMode:b,providerOverride:c,modelOverride:h,onFirstMessage:i,refs:j,errorLabels:k,resetInputState:l,onRestoreInput:m}){let[n,o]=(0,d.useState)(!1),[p,q]=(0,d.useState)("connecting"),[r,s]=(0,d.useState)(0),[t,u]=(0,d.useState)(3),v=(0,d.useRef)(3),w=(0,d.useRef)(null),x=(0,d.useRef)(!1),y=(0,d.useRef)(!1),z=(0,d.useRef)(null),A=(0,d.useRef)(!1),B=(0,d.useRef)(!1),C=(0,d.useCallback)(()=>{let a=z.current;w.current?.abort(),a&&(A.current=!0,j.sessionRef.current?.setMessages(b=>{let c=a.userMessage.timestamp;return b.filter((a,d)=>("user"!==a.role||a.timestamp!==c)&&(!(d>0)||"user"!==b[d-1].role||b[d-1].timestamp!==c||"assistant"!==a.role))}),m?.(a.userMessage),z.current=null,y.current=!0,setTimeout(()=>{y.current=!1},300))},[j,m]),D=(0,d.useCallback)(async d=>{if(d.preventDefault(),y.current)return;let m=j.mentionRef.current,n=j.slashRef.current,p=j.imageUploadRef.current,r=j.sessionRef.current,t=j.uploadRef.current;if(!m||!n||!p||!r||!t||null!==m.mentionQuery||null!==n.slashQuery)return;let C=j.inputValueRef.current?.trim()??"";if(t.localAttachments.some(a=>"loading"===a.status)||!C&&0===p.images.length||B.current)return;let D=j.selectedSkillRef.current,E=j.selectedAcpAgentRef.current,F=p.images.length>0?[...p.images]:void 0,G=j.attachedFilesRef.current.filter(b=>b!==a),H=G.length>0?G:void 0,I=t.localAttachments.filter(a=>"loading"!==a.status).map(a=>a.name),J=(0,f.No)({role:"user",content:C,timestamp:Date.now(),...D&&{skillName:D.name},...F&&{images:F},...H&&{attachedFiles:H},...I.length>0&&{uploadedFileNames:I}},E);p.clearImages();let K=[...r.messages,J];z.current={userMessageIndex:K.length-1,userMessage:J},A.current=!1,r.setMessages([...K,(0,f.No)({role:"assistant",content:"",timestamp:Date.now()},E)]),l(),i&&!x.current&&(x.current=!0,i()),o(!0),q("connecting"),s(0);let L=new AbortController;w.current=L;let M=3;try{let a=localStorage.getItem("mindos-reconnect-retries");if(null!==a){let b=parseInt(a,10);Number.isFinite(b)&&(M=Math.max(0,Math.min(10,b)))}}catch{}v.current=M,u(M);let N=JSON.stringify({messages:K,currentFile:a,attachedFiles:j.attachedFilesRef.current,uploadedFiles:t.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:E,mode:b,providerOverride:c??void 0,modelOverride:h??void 0}),O=async()=>{let a=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:N,signal:L.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 q("thinking"),{finalMessage:await (0,e.m)(a.body,a=>{q("streaming"),j.sessionRef.current?.setMessages(b=>{let c=[...b];return c[c.length-1]=(0,f.No)(a,E),c})},L.signal)}};try{let a=null;for(let b=0;b<=M&&!L.signal.aborted;b++){b>0&&(s(b),q("reconnecting"),j.sessionRef.current?.setMessages(a=>{let b=[...a];return b[b.length-1]=(0,f.No)({role:"assistant",content:"",timestamp:Date.now()},E),b}),await (0,g.yy)((0,g.a2)(b-1),L.signal),q("connecting"));try{let{finalMessage:a}=await O();a.content.trim()||a.parts&&0!==a.parts.length||j.sessionRef.current?.setMessages(a=>{let b=[...a];return b[b.length-1]=(0,f.No)({role:"assistant",content:`__error__${k.noResponse}`},E),b}),z.current=null;return}catch(d){a=d instanceof Error?d:Error(String(d));let c=d.httpStatus;if(!(0,g.$d)(d,c)||b>=M)break}}if(a)throw a}catch(a){if("AbortError"===a.name)A.current||j.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]=(0,f.No)({role:"assistant",content:`__error__${k.stopped}`},E))}return b});else{let b=a instanceof Error?a.message:"Something went wrong";j.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]=(0,f.No)({role:"assistant",content:`__error__${b}`},E),c}return[...c,(0,f.No)({role:"assistant",content:`__error__${b}`},E)]})}}finally{o(!1),s(0),w.current=null,z.current=null}},[a,b,c,h,k.noResponse,k.stopped,i,j,l]);return{isLoading:n,isLoadingRef:B,loadingPhase:p,reconnectAttempt:r,reconnectMax:t,reconnectMaxRef:v,abortRef:w,firstMessageFired:x,submit:D,stop:C}}},86864:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,2126,23)),Promise.resolve().then(c.t.bind(c,45640,23)),Promise.resolve().then(c.t.bind(c,98399,23)),Promise.resolve().then(c.t.bind(c,49783,23)),Promise.resolve().then(c.t.bind(c,8633,23)),Promise.resolve().then(c.t.bind(c,73638,23)),Promise.resolve().then(c.t.bind(c,33167,23))},87473:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(72269),e=c(78520),f=c(55433),g=c(65836),h=c(35508),i=c(65241),j=c(69599),k=c(71977);function l({open:a,onClose:b,anchorRect:c,railWidth:l,onOpenSyncSettings:m,syncStatus:n,onSyncStatusRefresh:o}){let p=(0,e.useRef)(null),{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 →"})]})]})]})}},88299:(a,b,c)=>{"use strict";c.d(b,{Y:()=>e});var d=c(5025);let e=(0,d.createServerReference)("407d2f77ecc1756f0a0057cc58ac7b26ee953b47e4",d.callServer,void 0,d.findSourceMapURL,"undoDeleteAction")},89064:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>f});var d=c(72269),e=c(78520);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)})]})}},89162:(a,b,c)=>{"use strict";c.d(b,{SQ:()=>D,Ld:()=>B,iP:()=>A,Ay:()=>E});var d=c(72269),e=c(78520),f=c(35959),g=c(63353),h=c(23095),i=c(40303),j=c(39532),k=c(25410),l=c(91312),m=c(62746),n=c(69733),o=c(77949),p=c(32068),q=c(77940),r=c(99712),s=c(41761),t=c(69599),u=c(85224),v=c(99440),w=c(33659),x=c(5025);x.callServer,x.findSourceMapURL;var y=c(16704);let z=()=>{},A=y.qQ,B=y.Dp.MIN,C=y.Dp.MAX_RATIO,D=y.Dp.MAX_ABS;function E({activePanel:a,fileTree:b,onNavigate:c,onOpenSyncSettings:x,railWidth:y=48,panelWidth:E,onWidthChange:F,onWidthCommit:G,maximized:H=!1,onMaximize:I,onImport:J,children:K}){let L=a?A[a]:280,M=H?void 0:E??L,{t:N}=(0,w.Y)(),[O,P]=(0,e.useTransition)(),Q=(0,f.useRouter)(),R=(0,f.usePathname)(),S="/capture"===R||"/capture/"===R,[T,U]=(0,e.useState)(null),V=(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]),[W,X]=(0,e.useState)(!1),Y=(0,e.useRef)(null),Z=(0,e.useRef)(null),[$,_]=(0,e.useState)(!1),aa=(0,e.useRef)(null),ab=(0,e.useRef)(null),ac=(0,s.gL)(),[ad,ae]=(0,e.useState)(0),[af,ag]=(0,e.useState)(0),[ah,ai]=(0,e.useState)(!1),aj=(0,e.useCallback)(()=>{if(!ah){ai(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[ah]),ak=(0,v._)({width:E??L,minWidth:B,maxWidth:D,maxWidthRatio:C,direction:"right",disabled:H,onResize:F??z,onResizeEnd:G??z});return(0,d.jsxs)("aside",{className:`
194
- hidden md:flex fixed top-0 h-screen z-30
195
- flex-col bg-card border-r border-border
196
- transition-[transform,left,width] duration-200 ease-out
197
- ${null!==a?"translate-x-0":"-translate-x-full pointer-events-none"}
198
- `,style:{width:H?`calc(100vw - ${y}px)`:`${M}px`,left:`${y}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)(u.A,{title:N.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:Y,type:"button",onClick:()=>{P(()=>{_(!1),X(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":N.sidebar.new,title:N.sidebar.new,children:(0,d.jsx)(g.A,{size:13})}),W&&(0,d.jsxs)("div",{ref:Z,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:()=>{P(()=>{X(!1),Q.push("/view/Untitled.md")})},children:[(0,d.jsx)(h.A,{size:14,className:"shrink-0"}),N.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:()=>{X(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,d.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),N.sidebar.newSpace]})]})]}),(0,d.jsx)("button",{type:"button",onClick:()=>J?.(),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":N.sidebar.importFile,title:N.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:()=>U(a=>Math.max(-1,(a??V)-1)),onDoubleClick:()=>{U(-1),aj()},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":N.sidebar.collapseLevel,title:ah?N.sidebar.collapseLevel:N.sidebar.collapseLevelHint??N.sidebar.collapseLevel,children:(0,d.jsx)(k.A,{size:13})}),(0,d.jsx)("button",{onClick:()=>U(a=>{let b=(a??0)+1;return b>V?null:b}),onDoubleClick:()=>{U(null),aj()},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":N.sidebar.expandLevel,title:ah?N.sidebar.expandLevel:N.sidebar.expandLevelHint??N.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:aa,type:"button",onClick:()=>{P(()=>{X(!1),_(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":N.sidebar.more,title:N.sidebar.more,children:(0,d.jsx)(m.A,{size:13})}),$&&(0,d.jsxs)("div",{ref:ab,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:()=>{P(()=>{_(!1),Q.push("/capture")})},children:[(0,d.jsx)(n.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:N.sidebar.capture}),af>0&&(0,d.jsx)("span",{className:"text-2xs font-medium tabular-nums px-1.5 py-px rounded-full bg-[var(--amber)]/10 text-[var(--amber)]/70",children:af})]}),(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:()=>{P(()=>{_(!1),Q.push("/view/.mindos/change-log.json")})},children:[(0,d.jsx)(o.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,d.jsx)("span",{className:"flex-1",children:N.changes.title})]}),(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:()=>{P(()=>{_(!1),Q.push("/trash")})},children:[(0,d.jsx)(p.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:N.trash.title}),ad>0&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:ad})]}),(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:()=>{(0,s.Fo)(!ac)},children:[ac?(0,d.jsx)(q.A,{size:14,className:"shrink-0"}):(0,d.jsx)(r.A,{size:14,className:"shrink-0"}),(0,d.jsx)("span",{className:"flex-1",children:N.sidebar.showHiddenFiles}),ac&&(0,d.jsx)("span",{className:"text-[var(--amber)] text-xs",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)(s.Ay,{nodes:b,onNavigate:c,maxOpenDepth:T,onImport:J})}),(0,d.jsxs)("button",{type:"button",onClick:()=>Q.push("/capture"),className:`flex items-center gap-2 mx-2 px-2 py-1.5 text-sm rounded-lg transition-all duration-150 group shrink-0 ${S?"bg-[var(--amber-dim)] text-[var(--amber)]":"hover:bg-muted text-muted-foreground hover:text-foreground"}`,children:[(0,d.jsx)("div",{className:`flex items-center justify-center w-5 h-5 rounded-md shrink-0 transition-colors ${S?"bg-[var(--amber)]/15":"bg-transparent"}`,children:(0,d.jsx)(n.A,{size:13,className:`shrink-0 transition-colors ${S?"text-[var(--amber)]":"text-[var(--amber)]/60 group-hover:text-[var(--amber)]"}`})}),(0,d.jsx)("span",{className:`flex-1 text-left text-xs transition-colors ${S?"font-medium text-[var(--amber)]":"text-muted-foreground group-hover:text-foreground"}`,children:N.sidebar.capture}),af>0&&(0,d.jsx)("span",{className:`text-2xs font-medium tabular-nums px-1.5 py-px rounded-full transition-colors ${S?"bg-[var(--amber)]/15 text-[var(--amber)]":"bg-[var(--amber)]/10 text-[var(--amber)]/70"}`,children:af})]}),(0,d.jsx)(t.Ay,{collapsed:!1,onOpenSyncSettings:x})]}),K,!H&&F&&(0,d.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:ak,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"})})]})}},89461:(a,b,c)=>{"use strict";c.d(b,{l:()=>j});var d=c(78520);let e=new Set([".txt",".md",".markdown",".csv",".json",".yaml",".yml",".xml",".html",".htm",".pdf",".doc",".docx",".docm"]);function f(a){let b=a.lastIndexOf(".");return b>=0?a.slice(b).toLowerCase():""}function g(a){let b="";for(let c=0;c<a.length;c+=32768)b+=String.fromCharCode(...a.subarray(c,c+32768));return btoa(b)}async function h(a){let b=a.name;try{let c=await a.arrayBuffer(),d=g(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})`);if("error"===f.extracted)return{name:b,content:`[PDF: ${b}] Failed to extract text from this PDF.`,status:"error",error:f.extractionError||"PDF extraction failed (unable to parse PDF)"};let h="success"===f.extracted&&f.text||"";if(!h)return{name:b,content:`[PDF: ${b}] Could not extract readable text (possibly scanned/image PDF).`,status:"error",error:"No extractable text found — PDF may be scanned, image-only, or have no text content"};let i={name:b,content:`[PDF TEXT EXTRACTED: ${b}]
198
+ `,children:[h&&(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}),(0,d.jsx)("span",{className:"text-sm",children:e}),(0,d.jsx)("span",{className:"text-sm flex-1 truncate text-foreground",children:b}),g?(0,d.jsx)(G.A,{size:14,className:"text-success shrink-0"}):(0,d.jsx)(H.A,{size:14,className:"text-border shrink-0"})]},a)})})]})}function K({active:a,maximized:b,onMaximize:c,selectedAgentKey:o=null}){let{t:p}=(0,m.Y)(),q=p.panels.agents,r=(0,f.useRouter)(),s=(0,k.kr)(),u=(0,f.usePathname)(),v=(0,f.useSearchParams)(),w="/agents"===u&&"channels"===v.get("tab"),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),F=(0,l.V)(),G=async()=>{y(!0),await s.refresh(),y(!1)},H=s.agents.filter(a=>a.present&&a.installed),I=s.agents.filter(a=>a.present&&!a.installed),K=s.agents.filter(a=>!a.present),L=async a=>{let b=await s.installAgent(a);return b&&await s.refresh(),b},M=u?.startsWith("/agents/")?decodeURIComponent(u.slice(8)):null,N={installing:q.installing,install:q.install,installSuccess:q.installSuccess,installFailed:q.installFailed,retryInstall:q.retryInstall},O={navOverview:q.navOverview,navMcp:q.navMcp,navSkills:q.navSkills,navChannels:q.channels,navNetwork:q.navNetwork,navSessions:q.navSessions,navActivity:q.navActivity},P=(0,d.jsx)(t,{copy:O,connectedCount:H.length,mcpEnabled:s.status?.connectionMode?.mcp??!1,channelsActive:w,onChannelsClick:()=>{r.push("/agents?tab=channels")}});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:[!s.loading&&(0,d.jsxs)("span",{className:"text-2xs text-muted-foreground",children:[H.length," ",q.connected,F.agents.length>0&&(0,d.jsxs)(d.Fragment,{children:[" \xb7 ",q.a2aLabel," ",F.agents.length]})]}),(0,d.jsx)("button",{onClick:G,disabled:x,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:x?"animate-spin":""})})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:s.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===s.agents.length&&0===s.skills.length?(0,d.jsxs)("div",{className:"flex flex-col gap-2 py-4 px-0",children:[P,(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:G,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:[P,(0,d.jsx)("div",{className:"mx-4 border-t border-border"}),w?(0,d.jsx)(J,{}):(0,d.jsx)("div",{className:"px-3 py-3 space-y-4",children:(0,d.jsx)(D,{connected:H,detected:I,notFound:K,selectedAgentKey:M??o,listCopy:N,onInstallAgent:L,showNotDetected:z,setShowNotDetected:A,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:()=>C(!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)(E.A,{open:B,onClose:()=>C(!1),onDiscover:F.discover,discovering:F.discovering,error:F.error})]})}},85973:(a,b,c)=>{"use strict";c.d(b,{t:()=>h});var d=c(78520),e=c(35564),f=c(22499),g=c(24663);function h({currentFile:a,chatMode:b,providerOverride:c,modelOverride:h,onFirstMessage:i,refs:j,errorLabels:k,resetInputState:l,onRestoreInput:m}){let[n,o]=(0,d.useState)(!1),[p,q]=(0,d.useState)("connecting"),[r,s]=(0,d.useState)(0),[t,u]=(0,d.useState)(3),v=(0,d.useRef)(3),w=(0,d.useRef)(null),x=(0,d.useRef)(!1),y=(0,d.useRef)(!1),z=(0,d.useRef)(null),A=(0,d.useRef)(!1),B=(0,d.useRef)(!1),C=(0,d.useCallback)(()=>{let a=z.current;w.current?.abort(),a&&(A.current=!0,j.sessionRef.current?.setMessages(b=>{let c=a.userMessage.timestamp;return b.filter((a,d)=>("user"!==a.role||a.timestamp!==c)&&(!(d>0)||"user"!==b[d-1].role||b[d-1].timestamp!==c||"assistant"!==a.role))}),m?.(a.userMessage),z.current=null,y.current=!0,setTimeout(()=>{y.current=!1},300))},[j,m]),D=(0,d.useCallback)(async d=>{if(d.preventDefault(),y.current)return;let m=j.mentionRef.current,n=j.slashRef.current,p=j.imageUploadRef.current,r=j.sessionRef.current,t=j.uploadRef.current;if(!m||!n||!p||!r||!t||null!==m.mentionQuery||null!==n.slashQuery)return;let C=j.inputValueRef.current?.trim()??"";if(t.localAttachments.some(a=>"loading"===a.status)||!C&&0===p.images.length||B.current)return;let D=j.selectedSkillRef.current,E=j.selectedAcpAgentRef.current,F=p.images.length>0?[...p.images]:void 0,G=j.attachedFilesRef.current.filter(b=>b!==a),H=G.length>0?G:void 0,I=t.localAttachments.filter(a=>"loading"!==a.status).map(a=>a.name),J=(0,f.No)({role:"user",content:C,timestamp:Date.now(),...D&&{skillName:D.name},...F&&{images:F},...H&&{attachedFiles:H},...I.length>0&&{uploadedFileNames:I}},E);p.clearImages();let K=[...r.messages,J];z.current={userMessageIndex:K.length-1,userMessage:J},A.current=!1,r.setMessages([...K,(0,f.No)({role:"assistant",content:"",timestamp:Date.now()},E)]),l(),i&&!x.current&&(x.current=!0,i()),o(!0),q("connecting"),s(0);let L=new AbortController;w.current=L;let M=3;try{let a=localStorage.getItem("mindos-reconnect-retries");if(null!==a){let b=parseInt(a,10);Number.isFinite(b)&&(M=Math.max(0,Math.min(10,b)))}}catch{}v.current=M,u(M);let N=JSON.stringify({messages:K,currentFile:a,attachedFiles:j.attachedFilesRef.current,uploadedFiles:t.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:E,mode:b,providerOverride:c??void 0,modelOverride:h??void 0}),O=async()=>{let a=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:N,signal:L.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 q("thinking"),{finalMessage:await (0,e.m)(a.body,a=>{q("streaming"),j.sessionRef.current?.setMessages(b=>{let c=[...b];return c[c.length-1]=(0,f.No)(a,E),c})},L.signal)}};try{let a=null;for(let b=0;b<=M&&!L.signal.aborted;b++){b>0&&(s(b),q("reconnecting"),j.sessionRef.current?.setMessages(a=>{let b=[...a];return b[b.length-1]=(0,f.No)({role:"assistant",content:"",timestamp:Date.now()},E),b}),await (0,g.yy)((0,g.a2)(b-1),L.signal),q("connecting"));try{let{finalMessage:a}=await O();a.content.trim()||a.parts&&0!==a.parts.length||j.sessionRef.current?.setMessages(a=>{let b=[...a];return b[b.length-1]=(0,f.No)({role:"assistant",content:`__error__${k.noResponse}`},E),b}),z.current=null;return}catch(d){a=d instanceof Error?d:Error(String(d));let c=d.httpStatus;if(!(0,g.$d)(d,c)||b>=M)break}}if(a)throw a}catch(a){if("AbortError"===a.name)A.current||j.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]=(0,f.No)({role:"assistant",content:`__error__${k.stopped}`},E))}return b});else{let b=a instanceof Error?a.message:"Something went wrong";j.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]=(0,f.No)({role:"assistant",content:`__error__${b}`},E),c}return[...c,(0,f.No)({role:"assistant",content:`__error__${b}`},E)]})}}finally{o(!1),s(0),w.current=null,z.current=null}},[a,b,c,h,k.noResponse,k.stopped,i,j,l]);return{isLoading:n,isLoadingRef:B,loadingPhase:p,reconnectAttempt:r,reconnectMax:t,reconnectMaxRef:v,abortRef:w,firstMessageFired:x,submit:D,stop:C}}},86864:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,2126,23)),Promise.resolve().then(c.t.bind(c,45640,23)),Promise.resolve().then(c.t.bind(c,98399,23)),Promise.resolve().then(c.t.bind(c,49783,23)),Promise.resolve().then(c.t.bind(c,8633,23)),Promise.resolve().then(c.t.bind(c,73638,23)),Promise.resolve().then(c.t.bind(c,33167,23))},87473:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(72269),e=c(78520),f=c(55433),g=c(65836),h=c(35508),i=c(65241),j=c(69599),k=c(71977);function l({open:a,onClose:b,anchorRect:c,railWidth:l,onOpenSyncSettings:m,syncStatus:n,onSyncStatusRefresh:o}){let p=(0,e.useRef)(null),{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 →"})]})]})]})}},89064:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>f});var d=c(72269),e=c(78520);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)})]})}},89461:(a,b,c)=>{"use strict";c.d(b,{l:()=>j});var d=c(78520);let e=new Set([".txt",".md",".markdown",".csv",".json",".yaml",".yml",".xml",".html",".htm",".pdf",".doc",".docx",".docm"]);function f(a){let b=a.lastIndexOf(".");return b>=0?a.slice(b).toLowerCase():""}function g(a){let b="";for(let c=0;c<a.length;c+=32768)b+=String.fromCharCode(...a.subarray(c,c+32768));return btoa(b)}async function h(a){let b=a.name;try{let c=await a.arrayBuffer(),d=g(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})`);if("error"===f.extracted)return{name:b,content:`[PDF: ${b}] Failed to extract text from this PDF.`,status:"error",error:f.extractionError||"PDF extraction failed (unable to parse PDF)"};let h="success"===f.extracted&&f.text||"";if(!h)return{name:b,content:`[PDF: ${b}] Could not extract readable text (possibly scanned/image PDF).`,status:"error",error:"No extractable text found — PDF may be scanned, image-only, or have no text content"};let i={name:b,content:`[PDF TEXT EXTRACTED: ${b}]
199
199
 
200
200
  ${h}`,status:"success"};return f.truncated&&f.totalChars&&(i.truncatedInfo={totalChars:f.totalChars,includedChars:h.length,totalPages:f.pagesParsed??0}),i}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"}}}async function i(a){let b=a.name;try{let c=await a.arrayBuffer(),d=g(new Uint8Array(c)),e=await fetch("/api/extract-docx",{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||`Word extraction failed (${e.status})`);if(!f.extracted)return{name:b,content:`[Word: ${b}] Failed to extract text from this Word document.`,status:"error",error:f.errorMessage||"Word extraction failed"};let h=f.text||"";if(!h)return{name:b,content:`[Word: ${b}] Could not extract readable text (empty document).`,status:"error",error:"No extractable text found — document may be empty or corrupted"};let i={name:b,content:`[WORD TEXT EXTRACTED: ${b}]
201
201
 
202
- ${h}`,status:"success"};return f.truncated&&f.chars&&(i.truncatedInfo={totalChars:f.chars||0,includedChars:f.charsTruncated||h.length,totalPages:f.pages??0}),f.warning&&(i.truncatedInfo||(i.truncatedInfo={totalChars:f.chars||h.length,includedChars:h.length,totalPages:f.pages??0}),i.truncatedInfo.warning=f.warning),i}catch(a){return{name:b,content:`[Word: ${b}] Failed to extract text from this Word document.`,status:"error",error:a instanceof Error?a.message:"Unknown error"}}}function j(a){let[b,c]=(0,d.useState)([]),[g,j]=(0,d.useState)(""),k=(0,d.useRef)(null),l=(0,d.useRef)(a),m=(0,d.useCallback)(async a=>{if(!a||0===a.length)return;let b=Array.from(a).slice(0,8),d=[],g=[];for(let a of b){let b=f(a.name);e.has(b)?d.push(a):g.push(a.name)}if(g.length>0){let a=l.current?.unsupportedType??"Unsupported file type";j(`${a}: ${g.join(", ")}`)}else j("");let k=[],m=[],n=[];for(let a of d){let b=f(a.name);".pdf"===b?(n.push({name:a.name,content:"",status:"loading"}),k.push(a)):".doc"===b||".docx"===b||".docm"===b?(n.push({name:a.name,content:"",status:"loading"}),m.push(a)):n.push({name:a.name,content:await a.text(),status:"success"})}c(a=>{let b=[...a];for(let a of n)b.some(b=>b.name===a.name)||b.push(a);return b});let o=[];k.length>0&&o.push(Promise.all(k.map(h)).then(a=>{c(b=>b.map(b=>"loading"!==b.status?b:a.find(a=>a.name===b.name)??b))})),m.length>0&&o.push(Promise.all(m.map(i)).then(a=>{c(b=>b.map(b=>"loading"!==b.status?b:a.find(a=>a.name===b.name)??b))})),await Promise.all(o)},[]),n=(0,d.useCallback)(a=>{c(b=>b.filter((b,c)=>c!==a))},[]);return{localAttachments:b,uploadError:g,uploadInputRef:k,pickFiles:m,removeAttachment:n,clearAttachments:(0,d.useCallback)(()=>{c([]),j("")},[]),injectFiles:(0,d.useCallback)(a=>{c(b=>{let c=[...b];for(let b of a)c.some(a=>a.name===b.name)||c.push(b);return c})},[])}}},90245:(a,b,c)=>{"use strict";c.d(b,{Oo:()=>e,dB:()=>k});var d=c(78520);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&&!l)break;a||(l+=k.decode(d,{stream:!0}));let u=a?[l]:l.split("\n");for(let d of(l=a?"":u.pop()??"",u)){let a,j=d.trim();if(!j.startsWith("data:"))continue;let k=j.slice(5).trim();if(!k)continue;try{a=JSON.parse(k)}catch{continue}let l=a.type;switch(l){case"tool_start":{var r,s,t;let d=a.toolName,e=a.toolCallId,j=a.args;p++;let k=(r=l,s=d,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(d)){let a=h(d,j),f="update";if("create_file"===d||"batch_create_files"===d?f="create":("delete_file"===d||"rename_file"===d||"move_file"===d)&&(f="unknown"),"update"===f&&a&&!q.has(a)){q.add(a);let b=await i(a);b&&c(a,b)}n.set(e,{name:d,path:a,action:f}),b({currentTool:{name:d,path:a}})}break}case"tool_end":{let c=a.toolCallId,d=!!a.isError,e=n.get(c);if(e){if("batch_create_files"===e.name)for(let a of e.path.split(", ").filter(Boolean))m.push({action:e.action,path:a,toolCallId:c,ok:!d});else m.push({action:e.action,path:e.path,toolCallId:c,ok:!d});n.delete(c),b({changes:[...m],currentTool:null})}break}case"text_delta":o+=a.delta??"",b({stageHint:{stage:"analyzing"},summary:e(o)});break;case"error":throw Error(a.message||"AI organize failed")}}if(a)break}}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)(()=>new Set),[v,w]=(0,d.useState)([]),[x,y]=(0,d.useState)("upload"),z=(0,d.useRef)(0),[A,B]=(0,d.useState)(0),C=(0,d.useCallback)(async(a,c,d="upload")=>{b("organizing"),e([]),g(null),i({stage:"connecting"}),l(""),n(null),p(0),w(a.map(a=>a.name)),y(d),z.current=Date.now(),B(0),s.current=new Map,u(new Set),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),u(b=>{if(b.has(a))return b;let c=new Set(b);return c.add(a),c})},f.signal);e(d.changes),l(d.summary),p(d.toolCallCount),g(null),B(Date.now()-z.current),b("done")}catch(a){"AbortError"===a.name?b("idle"):(n(a.message),b("error"))}finally{q.current=null}},[]),D=(0,d.useCallback)(()=>{q.current?.abort()},[]),E=(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]),F=(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]),G=(0,d.useCallback)(a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);return!!b&&("create"===b.action||"update"===b.action&&t.has(a))},[c,t]),H=c.some(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&t.has(a.path))),I=(0,d.useCallback)(()=>{b("idle"),e([]),g(null),i(null),l(""),n(null),p(0),w([]),y("upload"),B(0),z.current=0,s.current=new Map,u(new Set),r.current=0},[]);return{phase:a,changes:c,currentTool:f,stageHint:h,summary:k,error:m,toolCallCount:o,sourceFileNames:v,source:x,durationMs:A,snapshots:s,start:C,abort:D,undoOne:E,undoAll:F,canUndo:G,hasAnyUndoable:H,reset:I}}},91030:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(72269),e=c(78520),f=c(12187),g=c(70241);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(33659);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}},91994:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TimelineRenderer:()=>f,renderBody:()=>e});var d=c(52707);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call renderBody() from the server but renderBody 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/packages/web/components/renderers/timeline/TimelineRenderer.tsx","renderBody"),f=(0,d.registerClientReference)(function(){throw Error("Attempted to call TimelineRenderer() from the server but TimelineRenderer 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/packages/web/components/renderers/timeline/TimelineRenderer.tsx","TimelineRenderer")},92494:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AudioRenderer:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call AudioRenderer() from the server but AudioRenderer 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/packages/web/components/renderers/audio/AudioRenderer.tsx","AudioRenderer")},92728:(a,b,c)=>{"use strict";c.d(b,{f:()=>e});var d=c(5025);let e=(0,d.createServerReference)("60d5a08f775e86a6ff9efb5fb3ad2d3e24a9faeb34",d.callServer,void 0,d.findSourceMapURL,"renameFileAction")},93558:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(72269),e=c(78520),f=c(3278),g=c(90697),h=c(23095),i=c(58940);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"})]})]})}},93589:(a,b,c)=>{"use strict";var d=c(80144);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,75817)).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,92494)).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,43714)).then(a=>({default:a.BacklinksRenderer}))},{id:"change-log",name:"Content Changes",description:"Renders the .mindos/change-log.json file as a searchable timeline of content edits.",author:"MindOS",icon:"\uD83D\uDCCB",tags:["changelog","history","changes"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({filePath:a})=>/\.mindos\/change-log\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,23)).then(a=>({default:a.ChangeLogRenderer}))},{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,38416)).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,39234)).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,35542)).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,74246)).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,40206)).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,91994)).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,43456)).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,97426)).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,72731)).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,34558)).then(a=>({default:a.GraphRenderer}))}])(0,d.TS)(a)},95032:(a,b,c)=>{"use strict";function d(){return null}c.d(b,{default:()=>d}),c(78520)},96484:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(72269),e=c(78520),f=c(65836),g=c(53679),h=c(33659);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:"var(--font-ui)"},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}},96592:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15732,23)),Promise.resolve().then(c.t.bind(c,46042,23)),Promise.resolve().then(c.t.bind(c,16381,23)),Promise.resolve().then(c.t.bind(c,98761,23)),Promise.resolve().then(c.t.bind(c,11675,23)),Promise.resolve().then(c.t.bind(c,9732,23)),Promise.resolve().then(c.bind(c,42857))},97426:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/video/VideoRenderer.tsx","VideoRenderer")},97938:(a,b,c)=>{"use strict";function d(){return null}c.d(b,{A:()=>d}),c(78520),c(79149)},98081:(a,b,c)=>{"use strict";c.d(b,{i:()=>e});var d=c(5025);let e=(0,d.createServerReference)("40aaea56e6eaee5aecfda15290520ee99d69fff6cf",d.callServer,void 0,d.findSourceMapURL,"deleteFileAction")},98809:(a,b,c)=>{"use strict";c.d(b,{x:()=>u,A:()=>x});var d=c(72269),e=c(78520),f=c(28761),g=c(31448),h=c(69050),i=c(83614),j=c(53679),k=c(63301),l=c(37461),m=c(55231),n=c(33659),o=c(10002),p=c(74569),q=c(39486),r=c(90245);function s(a,b,c=new Date){let d=c.getFullYear(),e=String(c.getMonth()+1).padStart(2,"0"),f=String(c.getDate()).padStart(2,"0"),g=`> Saved session from MindOS Ask \xb7 ${d}-${e}-${f}`;if("full"===b){let b=a.map(a=>{let b=(0,r.Oo)(a.content).trim();if(!b)return null;let c="user"===a.role?"**User**":"**Assistant**";return`### ${c}
202
+ ${h}`,status:"success"};return f.truncated&&f.chars&&(i.truncatedInfo={totalChars:f.chars||0,includedChars:f.charsTruncated||h.length,totalPages:f.pages??0}),f.warning&&(i.truncatedInfo||(i.truncatedInfo={totalChars:f.chars||h.length,includedChars:h.length,totalPages:f.pages??0}),i.truncatedInfo.warning=f.warning),i}catch(a){return{name:b,content:`[Word: ${b}] Failed to extract text from this Word document.`,status:"error",error:a instanceof Error?a.message:"Unknown error"}}}function j(a){let[b,c]=(0,d.useState)([]),[g,j]=(0,d.useState)(""),k=(0,d.useRef)(null),l=(0,d.useRef)(a),m=(0,d.useCallback)(async a=>{if(!a||0===a.length)return;let b=Array.from(a).slice(0,8),d=[],g=[];for(let a of b){let b=f(a.name);e.has(b)?d.push(a):g.push(a.name)}if(g.length>0){let a=l.current?.unsupportedType??"Unsupported file type";j(`${a}: ${g.join(", ")}`)}else j("");let k=[],m=[],n=[];for(let a of d){let b=f(a.name);".pdf"===b?(n.push({name:a.name,content:"",status:"loading"}),k.push(a)):".doc"===b||".docx"===b||".docm"===b?(n.push({name:a.name,content:"",status:"loading"}),m.push(a)):n.push({name:a.name,content:await a.text(),status:"success"})}c(a=>{let b=[...a];for(let a of n)b.some(b=>b.name===a.name)||b.push(a);return b});let o=[];k.length>0&&o.push(Promise.all(k.map(h)).then(a=>{c(b=>b.map(b=>"loading"!==b.status?b:a.find(a=>a.name===b.name)??b))})),m.length>0&&o.push(Promise.all(m.map(i)).then(a=>{c(b=>b.map(b=>"loading"!==b.status?b:a.find(a=>a.name===b.name)??b))})),await Promise.all(o)},[]),n=(0,d.useCallback)(a=>{c(b=>b.filter((b,c)=>c!==a))},[]);return{localAttachments:b,uploadError:g,uploadInputRef:k,pickFiles:m,removeAttachment:n,clearAttachments:(0,d.useCallback)(()=>{c([]),j("")},[]),injectFiles:(0,d.useCallback)(a=>{c(b=>{let c=[...b];for(let b of a)c.some(a=>a.name===b.name)||c.push(b);return c})},[])}}},90245:(a,b,c)=>{"use strict";c.d(b,{Oo:()=>e,dB:()=>k});var d=c(78520);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&&!l)break;a||(l+=k.decode(d,{stream:!0}));let u=a?[l]:l.split("\n");for(let d of(l=a?"":u.pop()??"",u)){let a,j=d.trim();if(!j.startsWith("data:"))continue;let k=j.slice(5).trim();if(!k)continue;try{a=JSON.parse(k)}catch{continue}let l=a.type;switch(l){case"tool_start":{var r,s,t;let d=a.toolName,e=a.toolCallId,j=a.args;p++;let k=(r=l,s=d,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(d)){let a=h(d,j),f="update";if("create_file"===d||"batch_create_files"===d?f="create":("delete_file"===d||"rename_file"===d||"move_file"===d)&&(f="unknown"),"update"===f&&a&&!q.has(a)){q.add(a);let b=await i(a);b&&c(a,b)}n.set(e,{name:d,path:a,action:f}),b({currentTool:{name:d,path:a}})}break}case"tool_end":{let c=a.toolCallId,d=!!a.isError,e=n.get(c);if(e){if("batch_create_files"===e.name)for(let a of e.path.split(", ").filter(Boolean))m.push({action:e.action,path:a,toolCallId:c,ok:!d});else m.push({action:e.action,path:e.path,toolCallId:c,ok:!d});n.delete(c),b({changes:[...m],currentTool:null})}break}case"text_delta":o+=a.delta??"",b({stageHint:{stage:"analyzing"},summary:e(o)});break;case"error":throw Error(a.message||"AI organize failed")}}if(a)break}}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)(()=>new Set),[v,w]=(0,d.useState)([]),[x,y]=(0,d.useState)("upload"),z=(0,d.useRef)(0),[A,B]=(0,d.useState)(0),C=(0,d.useCallback)(async(a,c,d="upload")=>{b("organizing"),e([]),g(null),i({stage:"connecting"}),l(""),n(null),p(0),w(a.map(a=>a.name)),y(d),z.current=Date.now(),B(0),s.current=new Map,u(new Set),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),u(b=>{if(b.has(a))return b;let c=new Set(b);return c.add(a),c})},f.signal);e(d.changes),l(d.summary),p(d.toolCallCount),g(null),B(Date.now()-z.current),b("done")}catch(a){"AbortError"===a.name?b("idle"):(n(a.message),b("error"))}finally{q.current=null}},[]),D=(0,d.useCallback)(()=>{q.current?.abort()},[]),E=(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]),F=(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]),G=(0,d.useCallback)(a=>{let b=c.find(b=>b.path===a&&b.ok&&!b.undone);return!!b&&("create"===b.action||"update"===b.action&&t.has(a))},[c,t]),H=c.some(a=>a.ok&&!a.undone&&("create"===a.action||"update"===a.action&&t.has(a.path))),I=(0,d.useCallback)(()=>{b("idle"),e([]),g(null),i(null),l(""),n(null),p(0),w([]),y("upload"),B(0),z.current=0,s.current=new Map,u(new Set),r.current=0},[]);return{phase:a,changes:c,currentTool:f,stageHint:h,summary:k,error:m,toolCallCount:o,sourceFileNames:v,source:x,durationMs:A,snapshots:s,start:C,abort:D,undoOne:E,undoAll:F,canUndo:G,hasAnyUndoable:H,reset:I}}},91030:(a,b,c)=>{"use strict";c.d(b,{A:()=>o});var d=c(72269),e=c(78520),f=c(12187),g=c(70241);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(33659);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}},91994:(a,b,c)=>{"use strict";c.r(b),c.d(b,{TimelineRenderer:()=>f,renderBody:()=>e});var d=c(52707);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call renderBody() from the server but renderBody 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/packages/web/components/renderers/timeline/TimelineRenderer.tsx","renderBody"),f=(0,d.registerClientReference)(function(){throw Error("Attempted to call TimelineRenderer() from the server but TimelineRenderer 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/packages/web/components/renderers/timeline/TimelineRenderer.tsx","TimelineRenderer")},92494:(a,b,c)=>{"use strict";c.r(b),c.d(b,{AudioRenderer:()=>d});let d=(0,c(52707).registerClientReference)(function(){throw Error("Attempted to call AudioRenderer() from the server but AudioRenderer 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/packages/web/components/renderers/audio/AudioRenderer.tsx","AudioRenderer")},93558:(a,b,c)=>{"use strict";c.d(b,{A:()=>j});var d=c(72269),e=c(78520),f=c(3278),g=c(90697),h=c(23095),i=c(58940);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"})]})]})}},93589:(a,b,c)=>{"use strict";var d=c(80144);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,75817)).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,92494)).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,43714)).then(a=>({default:a.BacklinksRenderer}))},{id:"change-log",name:"Content Changes",description:"Renders the .mindos/change-log.json file as a searchable timeline of content edits.",author:"MindOS",icon:"\uD83D\uDCCB",tags:["changelog","history","changes"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({filePath:a})=>/\.mindos\/change-log\.json$/i.test(a),load:()=>Promise.resolve().then(c.bind(c,23)).then(a=>({default:a.ChangeLogRenderer}))},{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,38416)).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,39234)).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,35542)).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,74246)).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,40206)).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,91994)).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,43456)).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,97426)).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,72731)).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,34558)).then(a=>({default:a.GraphRenderer}))}])(0,d.TS)(a)},95032:(a,b,c)=>{"use strict";function d(){return null}c.d(b,{default:()=>d}),c(78520)},96484:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(72269),e=c(78520),f=c(65836),g=c(53679),h=c(33659);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:"var(--font-ui)"},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}},96592:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15732,23)),Promise.resolve().then(c.t.bind(c,46042,23)),Promise.resolve().then(c.t.bind(c,16381,23)),Promise.resolve().then(c.t.bind(c,98761,23)),Promise.resolve().then(c.t.bind(c,11675,23)),Promise.resolve().then(c.t.bind(c,9732,23)),Promise.resolve().then(c.bind(c,42857))},97426:(a,b,c)=>{"use strict";c.r(b),c.d(b,{VideoRenderer:()=>d});let d=(0,c(52707).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/packages/web/components/renderers/video/VideoRenderer.tsx","VideoRenderer")},97938:(a,b,c)=>{"use strict";function d(){return null}c.d(b,{A:()=>d}),c(78520),c(79149)},98809:(a,b,c)=>{"use strict";c.d(b,{x:()=>u,A:()=>x});var d=c(72269),e=c(78520),f=c(28761),g=c(31448),h=c(69050),i=c(83614),j=c(53679),k=c(63301),l=c(37461),m=c(55231),n=c(33659),o=c(10002),p=c(74569),q=c(39486),r=c(90245);function s(a,b,c=new Date){let d=c.getFullYear(),e=String(c.getMonth()+1).padStart(2,"0"),f=String(c.getDate()).padStart(2,"0"),g=`> Saved session from MindOS Ask \xb7 ${d}-${e}-${f}`;if("full"===b){let b=a.map(a=>{let b=(0,r.Oo)(a.content).trim();if(!b)return null;let c="user"===a.role?"**User**":"**Assistant**";return`### ${c}
203
203
 
204
204
  ${b}`}).filter(Boolean);return`${g}
205
205