@geminilight/mindos 0.6.73 → 0.6.75

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 (257) 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 +30 -30
  4. package/_standalone/.next/build-manifest.json +3 -3
  5. package/_standalone/.next/cache/.previewinfo +1 -1
  6. package/_standalone/.next/cache/.rscinfo +1 -1
  7. package/_standalone/.next/cache/config.json +3 -3
  8. package/_standalone/.next/prerender-manifest.json +3 -3
  9. package/_standalone/.next/react-loadable-manifest.json +5 -5
  10. package/_standalone/.next/required-server-files.json +14 -1
  11. package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
  12. package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  13. package/_standalone/.next/server/app/_global-error.html +2 -2
  14. package/_standalone/.next/server/app/_global-error.rsc +1 -1
  15. package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  16. package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  17. package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  18. package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  19. package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  20. package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  21. package/_standalone/.next/server/app/_not-found/page.js +1 -1
  22. package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  23. package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  24. package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
  25. package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
  26. package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
  27. package/_standalone/.next/server/app/agents/page.js +1 -1
  28. package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
  29. package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  30. package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
  33. package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
  34. package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
  35. package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
  36. package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
  37. package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
  38. package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
  39. package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
  40. package/_standalone/.next/server/app/api/agents/copy-skill/route.js.nft.json +1 -1
  41. package/_standalone/.next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -1
  42. package/_standalone/.next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
  43. package/_standalone/.next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
  44. package/_standalone/.next/server/app/api/ask/route.js +1 -1
  45. package/_standalone/.next/server/app/api/ask/route.js.nft.json +1 -1
  46. package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
  47. package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
  48. package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
  49. package/_standalone/.next/server/app/api/backlinks/route.js.nft.json +1 -1
  50. package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
  51. package/_standalone/.next/server/app/api/bootstrap/route.js.nft.json +1 -1
  52. package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
  53. package/_standalone/.next/server/app/api/changes/route.js.nft.json +1 -1
  54. package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
  55. package/_standalone/.next/server/app/api/channels/verify/route.js.nft.json +1 -1
  56. package/_standalone/.next/server/app/api/channels/verify/route_client-reference-manifest.js +1 -1
  57. package/_standalone/.next/server/app/api/connect/route_client-reference-manifest.js +1 -1
  58. package/_standalone/.next/server/app/api/embedding/route.js.nft.json +1 -1
  59. package/_standalone/.next/server/app/api/embedding/route_client-reference-manifest.js +1 -1
  60. package/_standalone/.next/server/app/api/export/route.js.nft.json +1 -1
  61. package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
  62. package/_standalone/.next/server/app/api/extract-pdf/route.js.nft.json +1 -1
  63. package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
  64. package/_standalone/.next/server/app/api/file/import/route.js.nft.json +1 -1
  65. package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
  66. package/_standalone/.next/server/app/api/file/raw/route.js.nft.json +1 -1
  67. package/_standalone/.next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
  68. package/_standalone/.next/server/app/api/file/route.js.nft.json +1 -1
  69. package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
  70. package/_standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  71. package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  72. package/_standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  73. package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  74. package/_standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
  75. package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
  76. package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  77. package/_standalone/.next/server/app/api/im/activity/route_client-reference-manifest.js +1 -1
  78. package/_standalone/.next/server/app/api/im/config/route.js +1 -1
  79. package/_standalone/.next/server/app/api/im/config/route_client-reference-manifest.js +1 -1
  80. package/_standalone/.next/server/app/api/im/status/route.js +1 -7
  81. package/_standalone/.next/server/app/api/im/status/route.js.nft.json +1 -1
  82. package/_standalone/.next/server/app/api/im/status/route_client-reference-manifest.js +1 -1
  83. package/_standalone/.next/server/app/api/im/test/route.js.nft.json +1 -1
  84. package/_standalone/.next/server/app/api/im/test/route_client-reference-manifest.js +1 -1
  85. package/_standalone/.next/server/app/api/im/webhook/feishu/route.js +1 -7
  86. package/_standalone/.next/server/app/api/im/webhook/feishu/route.js.nft.json +1 -1
  87. package/_standalone/.next/server/app/api/im/webhook/feishu/route_client-reference-manifest.js +1 -1
  88. package/_standalone/.next/server/app/api/im/webhook-status/route.js +1 -7
  89. package/_standalone/.next/server/app/api/im/webhook-status/route.js.nft.json +1 -1
  90. package/_standalone/.next/server/app/api/im/webhook-status/route_client-reference-manifest.js +1 -1
  91. package/_standalone/.next/server/app/api/inbox/clip/route.js.nft.json +1 -1
  92. package/_standalone/.next/server/app/api/inbox/clip/route_client-reference-manifest.js +1 -1
  93. package/_standalone/.next/server/app/api/inbox/route.js.nft.json +1 -1
  94. package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
  95. package/_standalone/.next/server/app/api/init/route.js.nft.json +1 -1
  96. package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  97. package/_standalone/.next/server/app/api/lint/route.js.nft.json +1 -1
  98. package/_standalone/.next/server/app/api/lint/route_client-reference-manifest.js +1 -1
  99. package/_standalone/.next/server/app/api/mcp/agents/route.js.nft.json +1 -1
  100. package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
  101. package/_standalone/.next/server/app/api/mcp/direct-tools/route_client-reference-manifest.js +1 -1
  102. package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
  103. package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
  104. package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
  105. package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
  106. package/_standalone/.next/server/app/api/mcp/tools/route_client-reference-manifest.js +1 -1
  107. package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
  108. package/_standalone/.next/server/app/api/monitoring/route.js.nft.json +1 -1
  109. package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
  110. package/_standalone/.next/server/app/api/recent-files/route.js.nft.json +1 -1
  111. package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
  112. package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  113. package/_standalone/.next/server/app/api/search/route.js.nft.json +1 -1
  114. package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  115. package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
  116. package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
  117. package/_standalone/.next/server/app/api/settings/route.js.nft.json +1 -1
  118. package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  119. package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
  120. package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
  121. package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
  122. package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
  123. package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
  124. package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
  125. package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  126. package/_standalone/.next/server/app/api/space-overview/route.js.nft.json +1 -1
  127. package/_standalone/.next/server/app/api/space-overview/route_client-reference-manifest.js +1 -1
  128. package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  129. package/_standalone/.next/server/app/api/tree-version/route.js.nft.json +1 -1
  130. package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
  131. package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
  132. package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  133. package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
  134. package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
  135. package/_standalone/.next/server/app/api/workflows/route.js.nft.json +1 -1
  136. package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  137. package/_standalone/.next/server/app/changelog/page.js +1 -1
  138. package/_standalone/.next/server/app/changelog/page.js.nft.json +1 -1
  139. package/_standalone/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  140. package/_standalone/.next/server/app/changes/page.js +1 -1
  141. package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
  142. package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
  143. package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
  144. package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
  145. package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
  146. package/_standalone/.next/server/app/echo/page.js +1 -1
  147. package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
  148. package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
  149. package/_standalone/.next/server/app/explore/page.js +1 -1
  150. package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
  151. package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
  152. package/_standalone/.next/server/app/help/page.js +1 -1
  153. package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
  154. package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
  155. package/_standalone/.next/server/app/inbox/history/page.js +1 -1
  156. package/_standalone/.next/server/app/inbox/history/page.js.nft.json +1 -1
  157. package/_standalone/.next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
  158. package/_standalone/.next/server/app/login/page.js +1 -1
  159. package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
  160. package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  161. package/_standalone/.next/server/app/page.js +1 -1
  162. package/_standalone/.next/server/app/page.js.nft.json +1 -1
  163. package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  164. package/_standalone/.next/server/app/setup/page.js +2 -2
  165. package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
  166. package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  167. package/_standalone/.next/server/app/trash/page.js +3 -3
  168. package/_standalone/.next/server/app/trash/page.js.nft.json +1 -1
  169. package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
  170. package/_standalone/.next/server/app/view/[...path]/page.js +3 -3
  171. package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
  172. package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
  173. package/_standalone/.next/server/app-paths-manifest.json +30 -30
  174. package/_standalone/.next/server/chunks/1076.js +1 -1
  175. package/_standalone/.next/server/chunks/{2449.js → 2424.js} +2 -2
  176. package/_standalone/.next/server/chunks/2792.js +1 -0
  177. package/_standalone/.next/server/chunks/2885.js +7 -0
  178. package/_standalone/.next/server/chunks/3800.js +1 -1
  179. package/_standalone/.next/server/chunks/5299.js +1 -1
  180. package/_standalone/.next/server/chunks/5464.js +1 -1
  181. package/_standalone/.next/server/chunks/6022.js +28 -28
  182. package/_standalone/.next/server/chunks/6539.js +1 -1
  183. package/_standalone/.next/server/chunks/8388.js +2 -2
  184. package/_standalone/.next/server/middleware-build-manifest.js +1 -1
  185. package/_standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  186. package/_standalone/.next/server/pages/500.html +2 -2
  187. package/_standalone/.next/server/server-reference-manifest.js +1 -1
  188. package/_standalone/.next/server/server-reference-manifest.json +1 -1
  189. package/_standalone/.next/static/chunks/{5331.c89084fd7f67887d.js → 4342.ccc18d7a45f204a4.js} +5 -5
  190. package/_standalone/.next/static/chunks/{4094.09364c01df411380.js → 4496.f77a677ac2034e48.js} +1 -1
  191. package/_standalone/.next/static/chunks/{5358-15618fc9b20018ee.js → 5358-15ceeb8c1cd9889d.js} +6 -6
  192. package/_standalone/.next/static/chunks/{6902-edc5c487c696bd0b.js → 6902-53a31f849968ddf8.js} +1 -1
  193. package/_standalone/.next/static/chunks/9207-456dc6941d557f33.js +1 -0
  194. package/_standalone/.next/static/chunks/app/{layout-fcbde5bee626d21a.js → layout-09f08f52e3cbfc47.js} +66 -66
  195. package/_standalone/.next/static/chunks/app/setup/{page-e40f3c5704c3c857.js → page-64d7fa097ef3f367.js} +1 -1
  196. package/_standalone/.next/static/chunks/app/trash/page-8e0ea3ba71702757.js +1 -0
  197. package/_standalone/.next/static/chunks/app/view/[...path]/page-04f43178679a8bfb.js +12 -0
  198. package/_standalone/.next/static/chunks/{webpack-dc486b68118d1328.js → webpack-ec9c6076012b75f3.js} +1 -1
  199. package/_standalone/.next/trace +72 -72
  200. package/_standalone/__tests__/agent/provider-presets.test.ts +32 -0
  201. package/_standalone/__tests__/api/im-config-feishu-conversation.test.ts +39 -0
  202. package/_standalone/__tests__/api/im-webhook-feishu.test.ts +21 -12
  203. package/_standalone/__tests__/api/pi-subagents.test.ts +81 -0
  204. package/_standalone/__tests__/ask/file-chip-variants.test.tsx +18 -0
  205. package/_standalone/__tests__/ask/message-list-agent-attribution.test.tsx +2 -0
  206. package/_standalone/__tests__/im/feishu-dispatcher.test.ts +151 -0
  207. package/_standalone/__tests__/im/feishu-webhook.test.ts +85 -57
  208. package/_standalone/__tests__/im/feishu-ws-client.test.ts +91 -0
  209. package/_standalone/__tests__/settings/custom-provider-form.test.ts +30 -0
  210. package/_standalone/components/ask/FileChip.tsx +1 -1
  211. package/_standalone/components/ask/MessageList.tsx +2 -2
  212. package/_standalone/components/settings/CustomProviderFields.tsx +1 -1
  213. package/_standalone/components/settings/CustomProvidersCard.tsx +3 -0
  214. package/_standalone/components/settings/useCustomProviderForm.ts +78 -24
  215. package/_standalone/components/shared/ProviderSelect.tsx +6 -5
  216. package/_standalone/next.config.ts +28 -4
  217. package/_standalone/package-lock.json +20 -2
  218. package/_standalone/package.json +3 -1
  219. package/_standalone/scripts/feishu-long-connection.ts +32 -0
  220. package/_standalone/server.js +1 -1
  221. package/_standalone/tsconfig.tsbuildinfo +1 -1
  222. package/app/__tests__/agent/provider-presets.test.ts +32 -0
  223. package/app/__tests__/api/im-config-feishu-conversation.test.ts +39 -0
  224. package/app/__tests__/api/im-webhook-feishu.test.ts +21 -12
  225. package/app/__tests__/api/pi-subagents.test.ts +81 -0
  226. package/app/__tests__/ask/file-chip-variants.test.tsx +18 -0
  227. package/app/__tests__/ask/message-list-agent-attribution.test.tsx +2 -0
  228. package/app/__tests__/im/feishu-dispatcher.test.ts +151 -0
  229. package/app/__tests__/im/feishu-webhook.test.ts +85 -57
  230. package/app/__tests__/im/feishu-ws-client.test.ts +91 -0
  231. package/app/__tests__/settings/custom-provider-form.test.ts +30 -0
  232. package/app/app/api/ask/route.ts +2 -0
  233. package/app/app/api/im/config/route.ts +2 -0
  234. package/app/app/api/im/webhook/feishu/route.ts +4 -2
  235. package/app/components/ask/FileChip.tsx +1 -1
  236. package/app/components/ask/MessageList.tsx +2 -2
  237. package/app/components/settings/CustomProviderFields.tsx +1 -1
  238. package/app/components/settings/CustomProvidersCard.tsx +3 -0
  239. package/app/components/settings/useCustomProviderForm.ts +78 -24
  240. package/app/components/shared/ProviderSelect.tsx +6 -5
  241. package/app/lib/agent/providers.ts +44 -6
  242. package/app/lib/im/feishu-dispatcher.ts +111 -0
  243. package/app/lib/im/feishu-ws-client.ts +72 -0
  244. package/app/lib/im/types.ts +14 -0
  245. package/app/lib/im/webhook/feishu.ts +44 -55
  246. package/app/next.config.ts +28 -4
  247. package/app/package.json +3 -1
  248. package/app/scripts/feishu-long-connection.ts +32 -0
  249. package/bin/cli.js +3 -1
  250. package/bin/commands/feishu-ws.js +39 -0
  251. package/package.json +1 -1
  252. package/scripts/build-runtime-archive.sh +36 -2
  253. package/_standalone/.next/static/chunks/9207-3b19c55a3c974a09.js +0 -1
  254. package/_standalone/.next/static/chunks/app/trash/page-e623ff0ab35de002.js +0 -1
  255. package/_standalone/.next/static/chunks/app/view/[...path]/page-49c4eff6ffdb5168.js +0 -12
  256. /package/_standalone/.next/static/{Dn8EHqUedSzanCfrM8WWS → dZDCx13MSM8QVQk2QNRs8}/_buildManifest.js +0 -0
  257. /package/_standalone/.next/static/{Dn8EHqUedSzanCfrM8WWS → dZDCx13MSM8QVQk2QNRs8}/_ssgManifest.js +0 -0
@@ -1,12 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3637,9508],{1012:(e,t,r)=>{"use strict";r.d(t,{default:()=>$});var n=r(95155),s=r(12115),a=r(98500),o=r.n(a),i=r(73321),l=r(80723),d=r(15282),c=r(21975),u=r(6296),m=r(86901),x=r(92451),p=r(59511),f=r(97233),h=r(50538),g=r(33078),b=r(48274),v=r(48368),j=r(33210),w=r(22164),y=r(67635),N=r(68459),k=r(13545),C=r(94514),E=r(66088),A=r(4235),S=r(35581),z=r(91337),R=r(29494),T=r(78520);let L={md:{bg:"bg-blue-500/10",text:"text-blue-500/70"},txt:{bg:"bg-muted/50",text:"text-muted-foreground/60"},csv:{bg:"bg-emerald-500/10",text:"text-emerald-500/70"},json:{bg:"bg-violet-500/10",text:"text-violet-500/70"},pdf:{bg:"bg-error/10",text:"text-error/60"}};function $(){let{t:e}=(0,S.Y)(),t=(0,i.useRouter)(),[r,a]=(0,s.useState)([]),[g,b]=(0,s.useState)(!0),[v,j]=(0,s.useState)(!1),[w,y]=(0,s.useState)(!1),[N,k]=(0,s.useState)([]),[C,E]=(0,s.useState)(""),[z,$]=(0,s.useState)(!1),[F,M]=(0,s.useState)(!1),O=(0,s.useRef)(null),I=(0,s.useRef)(null),H=(0,s.useRef)(0),W=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/inbox");if(!e.ok)return;let t=await e.json();Array.isArray(t.files)&&a(t.files)}catch(e){console.warn("[InboxView] fetch failed:",e)}finally{b(!1)}},[]),U=(0,s.useCallback)(()=>{k((0,T.FB)())},[]),V=(0,s.useRef)(void 0),B=(0,s.useCallback)(()=>{clearTimeout(V.current),V.current=setTimeout(()=>{W(),U()},80)},[W,U]);(0,s.useEffect)(()=>{W(),U();let e=()=>{j(!1),B()},t=()=>{H.current=0,y(!1)};return window.addEventListener("mindos:files-changed",B),window.addEventListener("mindos:inbox-updated",B),window.addEventListener("mindos:organize-done",e),window.addEventListener("mindos:organize-history-update",U),window.addEventListener("drop",t,!0),window.addEventListener("dragend",t,!0),()=>{clearTimeout(V.current),window.removeEventListener("mindos:files-changed",B),window.removeEventListener("mindos:inbox-updated",B),window.removeEventListener("mindos:organize-done",e),window.removeEventListener("mindos:organize-history-update",U),window.removeEventListener("drop",t,!0),window.removeEventListener("dragend",t,!0)}},[W,B,U]);let Y=(0,s.useCallback)(()=>{0===r.length||v||(j(!0),window.dispatchEvent(new CustomEvent("mindos:inbox-organize",{detail:{files:r}})))},[r,v]),_=(0,s.useCallback)(async t=>{try{if(!(await fetch("/api/inbox",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:[t]})})).ok)throw Error("Failed to delete");a(e=>e.filter(e=>e.name!==t)),window.dispatchEvent(new Event("mindos:inbox-updated")),A.oR.success(e.inbox.fileRemoved)}catch{A.oR.error(e.inbox.fileRemoveFailed)}},[e]),J=(0,s.useCallback)(t=>{t&&0!==t.length&&((0,R.QL)(Array.from(t),e),O.current&&(O.current.value=""))},[e]),K=(0,s.useCallback)(async t=>{let r=t.trim();if(r&&(0,R.h0)(r)){$(!0);try{await (0,R.TM)(r,e),E("")}finally{$(!1)}}},[e]),G=(0,s.useCallback)(t=>{t.preventDefault(),t.stopPropagation(),H.current=0,y(!1),M(!1);let r=(0,R.Aw)(t.nativeEvent);r?K(r):t.dataTransfer.files.length>0&&(0,R.QL)(Array.from(t.dataTransfer.files),e)},[e,K]),Z=(0,s.useMemo)(()=>r.filter(e=>e.isAging).length,[r]),X=r.length>0,q=(0,s.useMemo)(()=>N.slice(0,5),[N]),[Q,ee]=(0,s.useState)(!0),et=(0,s.useRef)(0);return((0,s.useEffect)(()=>{et.current>0&&r.length>0&&ee(!1),et.current=r.length},[r.length]),g)?(0,n.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,n.jsx)("div",{className:"sticky top-[52px] md:top-0 z-20 border-b border-border px-4 md:px-6 h-[46px] flex items-center bg-background",children:(0,n.jsx)("div",{className:"px-4 md:px-6",children:(0,n.jsx)("div",{className:"h-5 w-32 bg-muted rounded animate-pulse"})})}),(0,n.jsx)("div",{className:"flex-1 px-4 md:px-6 py-8",children:(0,n.jsx)("div",{className:"max-w-[780px] mx-auto space-y-3",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,n.jsx)("div",{className:"h-12 bg-muted/40 rounded-lg animate-pulse"},t))})})]}):(0,n.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,n.jsx)("input",{ref:O,type:"file",multiple:!0,accept:".md,.txt,.csv,.json,.pdf",className:"hidden",onChange:e=>J(e.target.files)}),(0,n.jsx)("div",{className:"sticky top-[52px] md:top-0 z-20 border-b border-border h-[46px] flex items-center bg-background",children:(0,n.jsx)("div",{className:"w-full px-4 md:px-6 flex items-center justify-between",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("button",{onClick:()=>t.push("/wiki"),className:"p-1.5 -ml-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"Back",children:(0,n.jsx)(l.A,{size:16})}),(0,n.jsxs)("div",{className:"flex items-center gap-2.5 flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"flex items-center justify-center w-7 h-7 rounded-lg bg-[var(--amber-subtle)] text-[var(--amber)]",children:(0,n.jsx)(d.A,{size:15})}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("h1",{className:"text-sm font-semibold text-foreground tracking-tight leading-tight",children:e.inbox.title}),X&&(0,n.jsxs)("p",{className:"text-2xs text-muted-foreground/60 leading-tight mt-0.5",children:[e.inbox.fileCount(r.length),Z>0&&(0,n.jsxs)("span",{className:"text-[var(--amber)]/70",children:[" \xb7 ",Z," ",e.inbox.agingHint]})]})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>O.current?.click(),className:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg transition-colors text-muted-foreground hover:text-foreground hover:bg-muted",title:e.inbox.uploadButton,children:[(0,n.jsx)(c.A,{size:13}),(0,n.jsx)("span",{className:"hidden sm:inline",children:e.inbox.uploadButton})]}),X&&(0,n.jsxs)("button",{onClick:Y,disabled:v,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition-all bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",title:v?e.inbox.organizing:e.inbox.organizeButton,children:[v?(0,n.jsx)(u.A,{size:13,className:"animate-spin"}):(0,n.jsx)(m.A,{size:13}),(0,n.jsx)("span",{children:v?e.inbox.organizing:e.inbox.organizeButton})]})]})]})})}),(0,n.jsx)("div",{className:"flex-1 px-4 md:px-6 py-6",children:(0,n.jsxs)("div",{className:"max-w-[780px] mx-auto",children:[(0,n.jsxs)("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 mb-6 ${w?"border-[var(--amber)] bg-[var(--amber-subtle)] shadow-[inset_0_0_0_1px_var(--amber)]":"border-border/50 bg-card/30"}`,onDragEnter:e=>{let t=e.dataTransfer.types.includes("Files"),r=(0,R.lL)(e.nativeEvent);(t||r)&&(e.preventDefault(),e.stopPropagation(),H.current++,1===H.current&&(y(!0),M(r&&!t)))},onDragOver:e=>{let t=e.dataTransfer.types.includes("Files"),r=(0,R.lL)(e.nativeEvent);(t||r)&&(e.preventDefault(),e.stopPropagation())},onDragLeave:e=>{e.stopPropagation(),H.current=Math.max(0,H.current-1),0===H.current&&(y(!1),M(!1))},onDrop:G,children:[(0,n.jsx)("div",{className:`cursor-pointer transition-colors duration-150 ${X?"px-4 py-3.5":"px-4 py-10"} ${!w?"hover:bg-muted/[0.06]":""}`,role:"button",tabIndex:0,"aria-label":e.inbox.uploadButton,onClick:()=>O.current?.click(),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),O.current?.click())},children:w&&F?(0,n.jsxs)("div",{className:"flex items-center justify-center gap-2.5 text-center py-1",children:[(0,n.jsx)(x.A,{size:22,className:"shrink-0 text-[var(--amber)] animate-pulse"}),(0,n.jsx)("p",{className:"text-sm font-medium text-[var(--amber)]",children:e.inbox.dropUrlOverlay})]}):X?(0,n.jsxs)("div",{className:"flex items-center justify-center gap-2 text-center",children:[(0,n.jsx)(p.A,{size:15,className:`shrink-0 ${w?"text-[var(--amber)]":"text-muted-foreground/30"}`}),(0,n.jsxs)("p",{className:"text-xs text-muted-foreground/50",children:[e.inbox.dropFilesOrLinks," ",(0,n.jsx)("span",{className:"text-[var(--amber)]/70 hover:text-[var(--amber)] hover:underline",children:e.fileImport.dropzoneCompactButton})]})]}):(0,n.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,n.jsx)("div",{className:`flex items-center justify-center w-14 h-14 rounded-2xl transition-colors duration-200 ${w?"bg-[var(--amber)]/15":"bg-[var(--amber-subtle)]"}`,children:(0,n.jsx)(p.A,{size:26,className:`transition-colors duration-200 ${w?"text-[var(--amber)]":"text-[var(--amber)]/35"}`})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground/70",children:e.inbox.emptyTitle}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground/50 mt-1.5 max-w-[280px] mx-auto leading-relaxed",children:e.inbox.emptyDesc})]}),(0,n.jsx)("div",{className:"flex items-center gap-1.5",children:["md","txt","pdf","csv","json"].map(e=>{let t=L[e]??{bg:"bg-muted/50",text:"text-muted-foreground/50"};return(0,n.jsxs)("span",{className:`text-2xs font-mono px-1.5 py-px rounded ${t.bg} ${t.text}`,children:[".",e]},e)})})]})}),(0,n.jsx)("div",{className:"border-t border-border/20 mx-4"}),(0,n.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 transition-colors duration-150 focus-within:bg-muted/[0.06]",onClick:e=>{e.stopPropagation(),I.current?.focus()},children:[(0,n.jsx)("div",{className:`flex items-center justify-center w-7 h-7 rounded-lg shrink-0 transition-colors duration-150 ${z?"bg-[var(--amber)]/15":C?"bg-[var(--amber)]/10":"bg-muted/50"}`,children:z?(0,n.jsx)(u.A,{size:13,className:"text-[var(--amber)] animate-spin"}):(0,n.jsx)(f.A,{size:13,className:`transition-colors duration-150 ${C?"text-[var(--amber)]":"text-muted-foreground/40"}`})}),(0,n.jsx)("input",{ref:I,type:"url",value:C,onChange:e=>E(e.target.value),onKeyDown:e=>{"Enter"!==e.key||z||(e.preventDefault(),K(C))},onPaste:e=>{let t=e.clipboardData.getData("text/plain").trim();t&&(0,R.h0)(t)&&!C&&(e.preventDefault(),E(t),setTimeout(()=>K(t),50))},placeholder:e.inbox.clipUrlPlaceholder,disabled:z,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/30 outline-none disabled:opacity-50"}),C&&!z&&(0,n.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),K(C)},className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-[var(--amber)]/10 text-[var(--amber)] hover:bg-[var(--amber)]/20 transition-all duration-150 ease-out cursor-pointer",children:[(0,n.jsx)(x.A,{size:12}),e.inbox.clipButton]}),z&&(0,n.jsx)("span",{className:"shrink-0 text-xs text-[var(--amber)]/70 tabular-nums",children:e.inbox.clipping})]})]}),X&&(0,n.jsx)("div",{className:"mb-8",children:(0,n.jsx)("div",{className:"rounded-xl border border-border overflow-hidden divide-y divide-border/50",children:r.map((e,t)=>(0,n.jsx)(D,{file:e,index:t,animate:Q,onDelete:_},e.path))})}),q.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,n.jsx)(h.A,{size:12,className:"text-muted-foreground/40"}),(0,n.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/50 uppercase tracking-wider",children:e.importHistory.title}),N.length>5&&(0,n.jsx)(o(),{href:"/inbox/history",className:"ml-auto text-2xs text-muted-foreground/50 hover:text-[var(--amber)] transition-colors",children:e.inbox.viewAllHistory(N.length)})]}),(0,n.jsx)("div",{className:"space-y-2",children:q.map(e=>(0,n.jsx)(P,{entry:e},e.id))})]}),X&&0===q.length&&(0,n.jsxs)("div",{className:"flex items-start gap-2.5 px-3.5 py-3 rounded-lg bg-[var(--amber-subtle)]/50 border border-[var(--amber)]/10 animate-[fadeSlideUp_0.22s_ease_both]",children:[(0,n.jsx)(m.A,{size:14,className:"text-[var(--amber)]/60 shrink-0 mt-0.5"}),(0,n.jsx)("p",{className:"text-xs text-foreground/60 leading-relaxed",children:e.inbox.viewOrganizeTip})]}),!X&&0===q.length&&(0,n.jsx)("div",{className:"flex flex-col items-center gap-1.5 py-2 text-center",children:(0,n.jsx)("p",{className:"text-2xs text-muted-foreground/30",children:e.inbox.viewEmptyGuide})})]})})]})}function D({file:e,onDelete:t,index:r,animate:a}){var o,l,d;let c,u,{t:m}=(0,S.Y)(),x=(0,i.useRouter)(),p=(c=(o=e.name).lastIndexOf("."))>0?o.slice(c+1).toLowerCase():"",f=(u=(l=e.name).lastIndexOf("."))>0?l.slice(0,u):l,h=L[p],w=M(e.modifiedAt,m.home.relativeTime),[y,N]=(0,s.useState)(null),k=(d=e.size)<1024?`${d} B`:d<1048576?`${Math.round(d/1024)} KB`:`${(d/1048576).toFixed(1)} MB`,C="csv"===p?g.A:"json"===p?b.A:v.A,E="csv"===p?"text-emerald-500/70":"json"===p?"text-violet-500/70":"pdf"===p?"text-error/60":"text-muted-foreground/60";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>x.push(`/view/${(0,z.O0)(e.path)}`),onKeyDown:t=>{"Enter"===t.key&&x.push(`/view/${(0,z.O0)(e.path)}`)},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),N({x:e.clientX,y:e.clientY})},className:`flex items-center gap-3 px-4 py-3 bg-card hover:bg-accent transition-colors duration-100 cursor-pointer group${a?" animate-[fadeSlideUp_0.22s_ease_both]":""}`,style:a?{animationDelay:`${30*r}ms`}:void 0,children:[(0,n.jsx)(C,{size:15,className:`shrink-0 ${E}`}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"text-sm text-foreground truncate",title:e.name,children:f}),h&&(0,n.jsxs)("span",{className:`text-2xs font-mono px-1.5 py-px rounded shrink-0 ${h.bg} ${h.text}`,children:[".",p]}),e.isAging&&(0,n.jsx)("span",{className:"text-2xs px-1.5 py-px rounded shrink-0 bg-[var(--amber)]/10 text-[var(--amber)]/70",title:m.inbox.agingHint,children:m.inbox.agingHint})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums",children:k}),(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/30",children:"\xb7"}),(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums",children:w})]})]}),(0,n.jsx)("button",{type:"button",onClick:r=>{r.stopPropagation(),r.preventDefault(),t(e.name)},className:"hidden group-hover:flex items-center justify-center w-7 h-7 rounded-md shrink-0 text-muted-foreground/40 hover:text-destructive hover:bg-destructive/10 transition-colors",title:m.inbox.removeFile,children:(0,n.jsx)(j.A,{size:14})})]}),y&&(0,n.jsx)(F,{x:y.x,y:y.y,file:e,onDelete:()=>{N(null),t(e.name)},onClose:()=>N(null)})]})}function F({x:e,y:t,file:r,onDelete:a,onClose:o}){let l=(0,s.useRef)(null),d=(0,i.useRouter)(),{t:c}=(0,S.Y)();(0,s.useEffect)(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&o()},t=e=>{"Escape"===e.key&&o()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]);let u=Math.min(e,window.innerWidth-200),m=Math.min(t,window.innerHeight-120),x="w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left";return(0,n.jsxs)("div",{ref:l,className:"fixed z-50 min-w-[160px] bg-card border border-border rounded-lg shadow-lg py-1",style:{top:m,left:u},children:[(0,n.jsxs)("button",{className:x,onClick:()=>{d.push(`/view/${(0,z.O0)(r.path)}`),o()},children:[(0,n.jsx)(w.A,{size:14,className:"shrink-0"})," ",c.inbox.openFile]}),(0,n.jsxs)("button",{className:x,onClick:()=>{navigator.clipboard.writeText(r.name),A.oR.copy(),o()},children:[(0,n.jsx)(y.A,{size:14,className:"shrink-0"})," ",c.inbox.copyName]}),(0,n.jsx)("div",{className:"border-t border-border my-1"}),(0,n.jsxs)("button",{className:`${x} text-destructive hover:text-destructive`,onClick:a,children:[(0,n.jsx)(N.A,{size:14,className:"shrink-0"})," ",c.inbox.removeFile]})]})}function P({entry:e}){let{t}=(0,S.Y)(),[r,a]=(0,s.useState)(!1),i="undone"===e.status,l=function(e){switch(e){case"drag-drop":return{label:"drop",className:"bg-muted/50 text-muted-foreground/50"};case"inbox-organize":return{label:"inbox",className:"bg-[var(--amber)]/10 text-[var(--amber)]/70"};case"import-modal":return{label:"import",className:"bg-blue-500/10 text-blue-500/70"};case"plugin":return{label:"plugin",className:"bg-violet-500/10 text-violet-500/70"};case"upload":return{label:"upload",className:"bg-teal-500/10 text-teal-500/70"};case"web-clipper":return{label:"clip",className:"bg-emerald-500/10 text-emerald-500/70"};default:return null}}(e.source),d=e.durationMs?function(e){let t=Math.round(e/1e3);if(t<60)return`${t}s`;let r=Math.floor(t/60),n=t%60;return`${r}m${n>0?`${n}s`:""}`}(e.durationMs):null,c=M(new Date(e.timestamp).toISOString(),t.home.relativeTime),u=e.files.filter(e=>e.ok&&!e.undone).length;return(0,n.jsxs)("div",{className:"rounded-lg border border-border/30 overflow-hidden",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),"aria-expanded":r,className:"w-full flex items-center gap-2.5 px-3.5 py-2.5 text-left hover:bg-muted/20 transition-colors",children:[i?(0,n.jsx)(k.A,{size:13,className:"text-muted-foreground/40 shrink-0"}):(0,n.jsx)(C.A,{size:13,className:"text-success/70 shrink-0"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:`text-xs truncate ${i?"text-muted-foreground/50 line-through":"text-foreground/80"}`,children:1===e.sourceFiles.length?e.sourceFiles[0]:t.importHistory.nFiles(e.sourceFiles.length)}),l&&(0,n.jsx)("span",{className:`text-2xs px-1.5 py-0.5 rounded shrink-0 ${l.className}`,children:l.label}),u>0&&(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 shrink-0",children:t.importHistory.changesSummary(u)})]}),(0,n.jsxs)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums shrink-0",children:[d&&`${d} \xb7 `,c]}),e.files.length>0&&(0,n.jsx)(E.A,{size:10,className:`text-muted-foreground/30 shrink-0 transition-transform duration-150 ${r?"rotate-180":""}`})]}),r&&e.files.length>0&&(0,n.jsx)("div",{className:"border-t border-border/20 px-3.5 py-2 space-y-0.5",children:e.files.map((e,r)=>{let s=e.path.split("/"),a=s.pop()??e.path,i=s.length>0?s.join("/"):null,l=!e.undone&&e.ok,d=`flex items-center gap-2 py-1 text-2xs${e.undone?" opacity-40":""}${l?" rounded -mx-1 px-1 hover:bg-muted/20 transition-colors":""}`,c=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:`w-1 h-1 rounded-full shrink-0 ${e.ok&&!e.undone?"bg-success/60":"bg-muted-foreground/30"}`}),(0,n.jsxs)("span",{className:`truncate flex-1 min-w-0 ${e.undone?"line-through text-muted-foreground":""}`,children:[i&&(0,n.jsxs)("span",{className:"text-muted-foreground/30",children:[i,"/"]}),(0,n.jsx)("span",{className:e.undone?"":"text-foreground/70",children:a})]}),(0,n.jsx)("span",{className:"text-muted-foreground/40 shrink-0",children:e.undone?t.importHistory.statusUndone:"create"===e.action?t.importHistory.statusCreated:t.importHistory.statusUpdated})]});return l?(0,n.jsx)(o(),{href:`/view/${(0,z.O0)(e.path)}`,className:d,children:c},`${e.path}-${r}`):(0,n.jsx)("div",{className:d,children:c},`${e.path}-${r}`)})})]})}function M(e,t){let r=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(r<1)return t.justNow;if(r<60)return t.minutesAgo(r);let n=Math.floor(r/60);if(n<24)return t.hoursAgo(n);let s=Math.floor(n/24);return t.daysAgo(s)}},2580:(e,t,r)=>{"use strict";r.d(t,{i:()=>s});var n=r(9339);let s=(0,n.createServerReference)("409c8f8b7df63a33bb3074b98fd9fb5bdff37b225d",n.callServer,void 0,n.findSourceMapURL,"deleteFileAction")},3109:(e,t,r)=>{"use strict";r.d(t,{default:()=>O});var n=r(95155),s=r(12115),a=r(98500),o=r.n(a),i=r(73321),l=r(38798),d=r(33078),c=r(48368),u=r(42129),m=r(97810),x=r(6296),p=r(41585),f=r(86901),h=r(94514),g=r(997),b=r(67635),v=r(93631),j=r(37595),w=r(38194),y=r(44406),N=r(91337),k=r(82125),C=r(35581);async function E(e){try{await navigator.clipboard.writeText(e)}catch{}}function A({node:e}){return"directory"===e.type?(0,n.jsx)(l.A,{size:16,className:"text-yellow-400 shrink-0"}):".csv"===e.extension?(0,n.jsx)(d.A,{size:16,className:"text-success shrink-0"}):(0,n.jsx)(c.A,{size:16,className:"text-muted-foreground shrink-0"})}function S({node:e}){return"directory"===e.type?(0,n.jsx)(u.A,{size:28,className:"text-yellow-400"}):".csv"===e.extension?(0,n.jsx)(d.A,{size:28,className:"text-success"}):(0,n.jsx)(c.A,{size:28,className:"text-muted-foreground"})}let z="mindos-dir-view",R="show-hidden-files";function T(e){let t=t=>{t.key===R&&e()},r=()=>e();return window.addEventListener("storage",t),window.addEventListener("mindos:hidden-files-changed",r),()=>{window.removeEventListener("storage",t),window.removeEventListener("mindos:hidden-files-changed",r)}}function L(){return"true"===localStorage.getItem(R)}function $({icon:e,title:t,lines:r,viewAllHref:s,viewAllLabel:a,trailing:i,footer:l}){return 0===r.length?null:(0,n.jsxs)("div",{className:"bg-muted/30 border border-border/40 rounded-lg px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 mb-2",children:[e,(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground flex-1",children:t}),i]}),(0,n.jsx)("div",{className:"space-y-1",children:r.map((e,t)=>(0,n.jsxs)("p",{className:"text-sm text-muted-foreground/80 leading-relaxed",suppressHydrationWarning:!0,children:["\xb7 ",e]},t))}),(0,n.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[l||(0,n.jsx)("span",{}),(0,n.jsx)(o(),{href:s,className:"text-xs hover:underline transition-colors text-[var(--amber)]",children:a})]})]})}function D({dirPath:e}){let{t}=(0,C.Y)(),r=(0,i.useRouter)(),[a,l]=(0,s.useState)("idle"),[d,c]=(0,s.useState)(""),u=function(e){let[t,r]=(0,s.useState)(null);return(0,s.useEffect)(()=>{fetch(`/api/space-overview?space=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>r(e.fileCount??0)).catch(()=>r(null))},[e]),t}(e),h=async()=>{l("loading"),c("");try{let t=await fetch("/api/space-overview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({space:e})}),n=await t.json();if(!t.ok){c(n.error||"Unknown error"),l("error");return}r.refresh()}catch(e){c(e instanceof Error?e.message:"Network error"),l("error")}};return(0,n.jsxs)("div",{className:"bg-muted/30 border border-border/40 rounded-lg px-4 py-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 mb-3",children:[(0,n.jsx)(m.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:t.fileTree.about})]}),"loading"===a?(0,n.jsxs)("div",{className:"flex flex-col items-center gap-2 py-3",children:[(0,n.jsx)(x.A,{size:20,className:"text-[var(--amber)] animate-spin"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:t.dirView.overviewGenerating}),null!=u&&u>0&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground/60",children:t.dirView.overviewScanningFiles(u)})]}):"error"===a?(0,n.jsxs)("div",{className:"flex flex-col items-center gap-2 py-3",children:[(0,n.jsx)(p.A,{size:18,className:"text-error"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:t.dirView.overviewError}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground/60 text-center max-w-[280px]",children:d}),(0,n.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,n.jsx)("button",{onClick:h,className:"text-xs text-[var(--amber)] hover:underline",children:t.dirView.overviewRetry}),(0,n.jsx)(o(),{href:"/settings",className:"text-xs text-muted-foreground hover:text-foreground",children:t.dirView.uninitSettings})]})]}):(0,n.jsxs)("div",{className:"flex flex-col items-center gap-2.5 py-2",children:[null!=u&&u>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground text-center",children:t.dirView.overviewCtaHint(u)}),(0,n.jsxs)("button",{onClick:h,className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm rounded-lg transition-colors bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90",children:[(0,n.jsx)(f.A,{size:14}),t.dirView.overviewCta]})]}):0===u?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:t.dirView.overviewNoFiles}):null,(0,n.jsx)(o(),{href:`/view/${(0,N.O0)(`${e}/README.md`)}`,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:t.dirView.overviewOrEdit})]})]})}function F({dirPath:e,preview:t}){let{t:r}=(0,C.Y)(),a=(0,i.useRouter)(),[o,l]=(0,s.useState)("idle"),[d,c]=(0,s.useState)(""),[u,p]=(0,s.useState)(!1),[g,b]=(0,s.useState)(""),v=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!u)return;let e=e=>{v.current&&!v.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]);let j=async()=>{p(!1),l("loading"),c(""),b("");try{let t=await fetch("/api/space-overview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({space:e})}),n=await t.json().catch(()=>({}));if(!t.ok){c(n.error||"Unknown error"),l("error");return}n.unchanged?(l("unchanged"),setTimeout(()=>l("idle"),3e3)):(n.stats?.mode==="incremental"&&(b(r.dirView.overviewIncremental(n.stats.scannedFiles)),setTimeout(()=>b(""),4e3)),a.refresh(),l("idle"))}catch(e){c(e instanceof Error?e.message:"Network error"),l("error")}};if("loading"===o)return(0,n.jsxs)("div",{className:"bg-muted/30 border border-border/40 rounded-lg px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 mb-2",children:[(0,n.jsx)(m.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground flex-1",children:r.fileTree.about})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 py-2",children:[(0,n.jsx)(x.A,{size:14,className:"text-[var(--amber)] animate-spin"}),(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:r.dirView.overviewGenerating})]})]});if("error"===o)return(0,n.jsxs)("div",{className:"bg-muted/30 border border-border/40 rounded-lg px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 mb-2",children:[(0,n.jsx)(m.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground flex-1",children:r.fileTree.about})]}),(0,n.jsxs)("div",{className:"flex flex-col items-center gap-1.5 py-2",children:[(0,n.jsx)("p",{className:"text-xs text-error",children:r.dirView.overviewError}),d&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground/60 text-center",children:d}),(0,n.jsx)("button",{onClick:j,className:"text-xs text-[var(--amber)] hover:underline mt-1",children:r.dirView.overviewRetry})]})]});let w=(0,n.jsxs)("div",{className:"relative",ref:v,children:[(0,n.jsxs)("button",{onClick:()=>p(!0),className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs text-muted-foreground/60 hover:text-[var(--amber)] hover:bg-[var(--amber)]/10 transition-colors",title:r.dirView.overviewRegenerate,children:[(0,n.jsx)(f.A,{size:13}),(0,n.jsx)("span",{className:"hidden sm:inline",children:r.dirView.overviewRegenerateLabel})]}),u&&(0,n.jsxs)("div",{className:"absolute right-0 top-full mt-1.5 z-30 w-[260px] bg-card border border-border rounded-lg shadow-lg p-3",children:[(0,n.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed mb-3",children:r.dirView.overviewRegenerateConfirm}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,n.jsx)("button",{onClick:()=>p(!1),className:"px-2.5 py-1 text-xs rounded-md text-muted-foreground hover:bg-muted transition-colors",children:r.dirView.overviewRegenerateCancel}),(0,n.jsxs)("button",{onClick:j,className:"inline-flex items-center gap-1 px-2.5 py-1 text-xs rounded-md bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-colors",children:[(0,n.jsx)(f.A,{size:11}),r.dirView.overviewRegenerateStart]})]})]})]}),y=(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/50",suppressHydrationWarning:!0,children:"unchanged"===o?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-success",children:[(0,n.jsx)(h.A,{size:10}),r.dirView.overviewUnchanged]}):g?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-success",children:[(0,n.jsx)(h.A,{size:10}),g]}):t.lastCompiled?r.dirView.overviewLastCompiled((0,N.KW)(new Date(t.lastCompiled).getTime(),r.home.relativeTime)):null});return(0,n.jsx)($,{icon:(0,n.jsx)(m.A,{size:14,className:"text-muted-foreground shrink-0"}),title:r.fileTree.about,lines:t.readmeLines,viewAllHref:`/view/${(0,N.O0)(`${e}/README.md`)}`,viewAllLabel:r.fileTree.viewAll,trailing:w,footer:y})}function P({preview:e,dirPath:t}){let{t:r}=(0,C.Y)(),s=e.instructionLines.length>0,a=!(e.readmeLines.length>0)||e.readmeIsTemplate||e.isTemplate;return(0,n.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:[s&&(0,n.jsx)($,{icon:(0,n.jsx)(g.A,{size:14,className:"text-muted-foreground shrink-0"}),title:r.fileTree.rules,lines:e.instructionLines,viewAllHref:`/view/${(0,N.O0)(`${t}/INSTRUCTION.md`)}`,viewAllLabel:r.fileTree.viewAll}),a?(0,n.jsx)(D,{dirPath:t}):(0,n.jsx)(F,{dirPath:t,preview:e})]})}function M({x:e,y:t,path:r,label:a,onClose:o}){let i=(0,s.useRef)(null),{t:l}=(0,C.Y)();(0,s.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&o()},t=e=>{"Escape"===e.key&&o()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]);let d=Math.min(e,window.innerWidth-200),c=Math.min(t,window.innerHeight-60);return(0,n.jsx)("div",{ref:i,className:"fixed z-50 min-w-[160px] bg-card border border-border rounded-lg shadow-lg py-1",style:{top:c,left:d},children:(0,n.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:()=>{E(r),o()},children:[(0,n.jsx)(b.A,{size:14,className:"shrink-0"})," ",l.fileTree.copyPath]})})}function O({dirPath:e,entries:t,spacePreview:r}){let[a,i]=[(0,s.useSyncExternalStore)(e=>{let t=()=>e();return window.addEventListener("mindos-dir-view-change",t),()=>window.removeEventListener("mindos-dir-view-change",t)},()=>{let e=localStorage.getItem(z);return"list"===e||"grid"===e?e:"grid"},()=>"grid"),e=>{localStorage.setItem(z,e),window.dispatchEvent(new Event("mindos-dir-view-change"))}],l=(0,s.useSyncExternalStore)(T,L,()=>!1),{t:d}=(0,C.Y)(),c=e=>(0,N.KW)(e,d.home.relativeTime),[m,x]=(0,s.useState)(null),p=(0,s.useCallback)((e,t)=>{e.preventDefault(),e.stopPropagation(),x({x:e.clientX,y:e.clientY,path:t})},[]),f=(0,s.useMemo)(()=>l?t:t.filter(e=>"file"!==e.type||!k.C.has(e.name)),[t,l]),h=(0,s.useMemo)(()=>{let e=new Map;for(let t of f)e.set(t.path,function e(t){return"file"===t.type?1:(t.children||[]).reduce((t,r)=>t+e(r),0)}(t));return e},[f]);return(0,n.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,n.jsx)("div",{className:"sticky top-[52px] md:top-0 z-20 border-b border-border px-4 md:px-6 h-[46px] flex items-center bg-background",children:(0,n.jsxs)("div",{className:"w-full flex items-center justify-between gap-2",children:[(0,n.jsx)("div",{className:"min-w-0 flex-1",children:(0,n.jsx)(y.A,{filePath:e})}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,n.jsxs)(o(),{href:`/view/${(0,N.O0)(e?`${e}/Untitled.md`:"Untitled.md")}`,className:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg transition-colors text-muted-foreground hover:text-foreground hover:bg-muted",children:[(0,n.jsx)(v.A,{size:13}),(0,n.jsx)("span",{className:"hidden sm:inline",children:d.dirView.newFile})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[(0,n.jsx)("button",{onClick:()=>i("grid"),className:`p-1.5 rounded transition-colors ${"grid"===a?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,title:d.dirView.gridView,children:(0,n.jsx)(j.A,{size:14})}),(0,n.jsx)("button",{onClick:()=>i("list"),className:`p-1.5 rounded transition-colors ${"list"===a?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,title:d.dirView.listView,children:(0,n.jsx)(w.A,{size:14})})]})]})]})}),(0,n.jsx)("div",{className:"flex-1 px-4 md:px-6 py-6",children:(0,n.jsxs)("div",{className:"max-w-[860px] mx-auto",children:[r&&(0,n.jsx)(P,{preview:r,dirPath:e}),0===f.length?(0,n.jsx)("p",{className:"text-muted-foreground text-sm",children:d.dirView.emptyFolder}):"grid"===a?(0,n.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-5 gap-3",children:f.map(e=>(0,n.jsxs)(o(),{href:`/view/${(0,N.O0)(e.path)}`,onContextMenu:t=>p(t,e.path),className:"directory"===e.type?"flex flex-col items-center gap-1.5 p-3 rounded-xl border border-border bg-card hover:bg-accent hover:border-border/80 transition-all duration-100 text-center":"flex flex-col items-center gap-2 p-4 rounded-xl border border-border bg-card hover:bg-accent hover:border-border/80 transition-all duration-100 text-center",children:["directory"===e.type?(0,n.jsx)(u.A,{size:22,className:"text-yellow-400"}):(0,n.jsx)(S,{node:e}),(0,n.jsx)("span",{className:"text-xs text-foreground leading-snug line-clamp-2 w-full",title:e.name,suppressHydrationWarning:!0,children:e.name}),"directory"===e.type&&(0,n.jsx)("span",{className:"text-2xs text-muted-foreground",children:d.dirView.fileCount(h.get(e.path)??0)}),"file"===e.type&&e.mtime&&(0,n.jsx)("span",{className:"text-2xs text-muted-foreground",suppressHydrationWarning:!0,children:c(e.mtime)})]},e.path))}):(0,n.jsx)("div",{className:"flex flex-col divide-y divide-border border border-border rounded-xl overflow-hidden",children:f.map(e=>(0,n.jsxs)(o(),{href:`/view/${(0,N.O0)(e.path)}`,onContextMenu:t=>p(t,e.path),className:"flex items-center gap-3 px-4 py-3 bg-card hover:bg-accent transition-colors duration-100",children:[(0,n.jsx)(A,{node:e}),(0,n.jsx)("span",{className:"flex-1 text-sm text-foreground truncate",title:e.name,suppressHydrationWarning:!0,children:e.name}),"directory"===e.type?(0,n.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:d.dirView.fileCount(h.get(e.path)??0)}):e.mtime?(0,n.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums",suppressHydrationWarning:!0,children:c(e.mtime)}):null]},e.path))})]})}),m&&(0,n.jsx)(M,{x:m.x,y:m.y,path:m.path,label:d.fileTree.copyPath,onClose:()=>x(null)})]})}},7337:(e,t,r)=>{"use strict";function n(e){if(/^(https?|file):\/\//.test(e))return e;if(e.startsWith("/")){let t=e.slice(1);return`/api/file/raw?path=${encodeURIComponent(t)}`}return e}r.d(t,{X:()=>n})},7834:(e,t,r)=>{"use strict";async function n(e){if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let r=document.execCommand("copy");return document.body.removeChild(t),r}catch{return!1}}r.d(t,{l:()=>n})},10377:(e,t,r)=>{"use strict";r.d(t,{Z:()=>f});var n=r(12115);let s="mindos-pinned-files",a="mindos:pins-changed";function o(){try{let e=localStorage.getItem(s);return e?JSON.parse(e):[]}catch{return[]}}function i(){return c}let l=[];function d(){return l}let c=[],u=!1;function m(){u||(c=o(),u=!0)}function x(e){m();let t=t=>{t.key===s&&(c=o(),e())},r=()=>{c=o(),e()};return window.addEventListener("storage",t),window.addEventListener(a,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(a,r)}}function p(e){c=e;try{localStorage.setItem(s,JSON.stringify(e))}catch{}window.dispatchEvent(new Event(a))}function f(){m();let e=(0,n.useSyncExternalStore)(x,i,d),t=(0,n.useCallback)(t=>e.includes(t),[e]),r=(0,n.useCallback)(e=>{let t=o(),r=t.indexOf(e);r>=0?t.splice(r,1):t.unshift(e),p(t)},[]);return{pinnedFiles:e,isPinned:t,togglePin:r,reorderPins:(0,n.useCallback)(e=>{p(e)},[]),removePin:(0,n.useCallback)(e=>{p(o().filter(t=>t!==e))},[])}}},22356:(e,t,r)=>{"use strict";r.d(t,{h:()=>n,n:()=>s});class n extends Error{constructor(e,t,r){super(e),this.name="ApiError",this.status=t,this.code=r}}async function s(e,t={}){let r,a,o,{timeout:i=3e4,signal:l,...d}=t;if((i>0||l)&&(r=new AbortController),i>0&&r&&(a=setTimeout(()=>{r.abort(Error(`Request timed out after ${Math.round(i/1e3)}s`))},i)),l&&r)if(l.aborted)r.abort();else{let e=()=>r?.abort();l.addEventListener("abort",e,{once:!0}),o=()=>{l.removeEventListener("abort",e)}}let c=r?.signal??l;try{let t=await fetch(e,{...d,signal:c});if(!t.ok){let e,r=`Request failed (${t.status})`;try{let n=await t.json();n?.error?.code&&n?.error?.message?(r=n.error.message,e=n.error.code):n?.error&&(r="string"==typeof n.error?n.error:n.error.message??r)}catch{}throw new n(r,t.status,e)}return await t.json()}finally{a&&clearTimeout(a),o&&o()}}},29494:(e,t,r)=>{"use strict";r.d(t,{Aw:()=>l,Nh:()=>c,QL:()=>a,TM:()=>o,h0:()=>i,lL:()=>d});var n=r(4235);function s(e){let t=new Uint8Array(e),r=[];for(let e=0;e<t.length;e+=8192)r.push(String.fromCharCode(...t.subarray(e,e+8192)));return btoa(r.join(""))}async function a(e,t){let r=[],a=0;for(let t of e){if(t.size>0xa00000){a++;continue}try{if(t.name.toLowerCase().endsWith(".pdf")){let e=await t.arrayBuffer();r.push({name:t.name,content:s(e),encoding:"base64"})}else{let e=await t.text();r.push({name:t.name,content:e})}}catch{}}if(0===r.length)return void(a>0?n.oR.error(t.inbox.tooLarge(a),4e3):e.length>0&&n.oR.error(t.inbox.saveFailed,4e3));try{var o;let e=await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:r})});if(!e.ok){let r=await e.json().catch(()=>({}));console.error("[QuickDrop] Save failed:",r.error),n.oR.error(t.inbox.saveFailed,4e3);return}let s=await e.json(),i=s.saved?.length??0,l=s.skipped?.length??0;o=a,i>0&&o>0&&0===l?n.oR.success(t.inbox.savedWithOversized(i,o),4e3):i>0&&l+o>0?n.oR.success(t.inbox.savedWithSkipped(i,l+o),4e3):i>0?n.oR.success(t.inbox.savedToast(i),3e3):(o>0&&n.oR.error(t.inbox.tooLarge(o),4e3),l>0&&n.oR.error(t.inbox.savedWithSkipped(0,l),4e3),0===o&&0===l&&n.oR.error(t.inbox.saveFailed,4e3)),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated"))}catch(e){console.error("[QuickDrop] Network error:",e),n.oR.error(t.inbox.saveFailed,4e3)}}async function o(e,t){try{let r=await fetch("/api/inbox/clip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})}),s=await r.json();if(!r.ok){let e=s.error||t.inbox.clipFailed;return n.oR.error(e,4e3),{ok:!1}}return n.oR.success(t.inbox.clipSuccess(s.title||e),3e3),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated")),{ok:!0,title:s.title}}catch(e){return console.error("[ClipURL] Network error:",e),n.oR.error(t.inbox.clipFailed,4e3),{ok:!1}}}function i(e){let t=e.trim();if(!t.startsWith("http://")&&!t.startsWith("https://"))return!1;try{return new URL(t),!0}catch{return!1}}function l(e){if(e.dataTransfer?.files&&e.dataTransfer.files.length>0)return null;let t=e.dataTransfer?.getData("text/uri-list");if(t){let e=t.split(/[\r\n]+/).find(e=>!e.startsWith("#")&&e.trim().length>0);if(e&&i(e))return e.trim()}let r=e.dataTransfer?.getData("text/plain");return r&&i(r)?r.trim():null}function d(e){let t=e.dataTransfer?.types??[];return!t.includes("Files")&&(t.includes("text/uri-list")||t.includes("text/plain"))}async function c(e,t,r){let a=[],o=0,i=new Set(["pdf","png","jpg","jpeg","gif","webp","bmp","ico","mp3","wav","m4a","ogg","flac","aac","mp4","webm","mov","mkv"]);for(let t of e){if(t.size>0xa00000){o++;continue}try{let e=(t.name.split(".").pop()??"").toLowerCase();if(i.has(e)){let e=await t.arrayBuffer();a.push({name:t.name,content:s(e),encoding:"base64"})}else{let e=await t.text();a.push({name:t.name,content:e})}}catch{}}if(0===a.length)return void(o>0?n.oR.error(r.inbox.tooLarge(o),4e3):e.length>0&&n.oR.error(r.inbox.saveFailed,4e3));let l=t.split("/").pop()||t;try{let e=await fetch("/api/file/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:a,targetSpace:t,organize:!1,conflict:"rename"})});if(!e.ok){let t=await e.json().catch(()=>({}));console.error("[TreeDrop] Save failed:",t.error),n.oR.error(r.inbox.saveFailed,4e3);return}let s=await e.json(),i=s.created?.length??0,d=s.skipped?.length??0;i>0&&d+o>0?n.oR.success(r.inbox.savedWithSkipped(i,d+o),4e3):i>0?n.oR.success(r.inbox.savedToDir(i,l),3e3):(o>0&&n.oR.error(r.inbox.tooLarge(o),4e3),d>0&&n.oR.error(r.inbox.savedWithSkipped(0,d),4e3)),window.dispatchEvent(new Event("mindos:files-changed"))}catch(e){console.error("[TreeDrop] Network error:",e),n.oR.error(r.inbox.saveFailed,4e3)}}},32913:(e,t,r)=>{"use strict";r.d(t,{Y:()=>s});var n=r(9339);let s=(0,n.createServerReference)("400a0980a13528af448c3be2b2dd16b1b5c9246d7f",n.callServer,void 0,n.findSourceMapURL,"undoDeleteAction")},44406:(e,t,r)=>{"use strict";r.d(t,{A:()=>f});var n=r(95155),s=r(98500),a=r.n(s),o=r(50538),i=r(33078),l=r(48368),d=r(38798),c=r(66614),u=r(21362),m=r(35581);let x={".mindos/change-log.json":{icon:(0,n.jsx)(o.A,{size:13,className:"text-[var(--amber)] shrink-0"}),getLabel:e=>e.changes.title}};function p({name:e}){let t=e.includes(".")?e.slice(e.lastIndexOf(".")).toLowerCase():"";return".csv"===t?(0,n.jsx)(i.A,{size:13,className:"text-success shrink-0"}):t?(0,n.jsx)(l.A,{size:13,className:"text-muted-foreground shrink-0"}):(0,n.jsx)(d.A,{size:13,className:"text-yellow-400 shrink-0"})}function f({filePath:e}){let{t}=(0,m.Y)(),r=x[e];if(r)return(0,n.jsxs)("nav",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground flex-nowrap overflow-hidden",children:[(0,n.jsx)(a(),{href:"/",className:"p-1.5 rounded-md hover:bg-muted/50 hover:text-foreground transition-colors shrink-0",title:"Home",children:(0,n.jsx)(c.A,{size:14})}),(0,n.jsx)(u.A,{size:12,className:"text-muted-foreground/50 shrink-0"}),(0,n.jsxs)("span",{className:"min-w-0 flex items-center gap-1.5 text-foreground font-medium",children:[r.icon,(0,n.jsx)("span",{className:"block truncate max-w-[180px] sm:max-w-[260px] md:max-w-[360px]",children:r.getLabel(t)})]})]});let s=e.split("/");return(0,n.jsxs)("nav",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground flex-nowrap overflow-hidden",children:[(0,n.jsx)(a(),{href:"/",className:"p-1.5 rounded-md hover:bg-muted/50 hover:text-foreground transition-colors shrink-0",title:"Home",children:(0,n.jsx)(c.A,{size:14})}),s.map((e,t)=>{let r=t===s.length-1,o="/view/"+s.slice(0,t+1).map(encodeURIComponent).join("/");return(0,n.jsxs)("span",{className:"flex items-center gap-1 min-w-0",children:[(0,n.jsx)(u.A,{size:12,className:"text-muted-foreground/50 shrink-0"}),r?(0,n.jsxs)("span",{className:"min-w-0 flex items-center gap-1.5 px-1 py-0.5 text-foreground font-medium",children:[(0,n.jsx)(p,{name:e}),(0,n.jsx)("span",{className:"block truncate max-w-[180px] sm:max-w-[260px] md:max-w-[360px]",suppressHydrationWarning:!0,children:e})]}):(0,n.jsx)(a(),{href:o,className:"block px-1 py-0.5 rounded-md hover:bg-muted/50 hover:text-foreground transition-colors truncate max-w-[120px] sm:max-w-[160px] md:max-w-[200px]",title:e,children:(0,n.jsx)("span",{suppressHydrationWarning:!0,children:e})})]},t)})]})}},46838:(e,t,r)=>{"use strict";r.d(t,{$7:()=>o,MZ:()=>c,TS:()=>l,UG:()=>a,YB:()=>d,pl:()=>i});let n=[],s=new Set;function a(){try{let e=localStorage.getItem("mindos-disabled-renderers");s=new Set(e?JSON.parse(e):[])}catch{s=new Set}}function o(e,t){let r=n.find(t=>t.id===e);r?.core||(t?s.delete(e):s.add(e),localStorage.setItem("mindos-disabled-renderers",JSON.stringify([...s])))}function i(e){let t=n.find(t=>t.id===e);return!!t?.core||!s.has(e)}function l(e){n.find(t=>t.id===e.id)||n.push(e)}function d(e,t,r){if(r){let e=n.find(e=>e.id===r);return e&&i(e.id)?e:void 0}return n.find(r=>i(r.id)&&r.match({filePath:e,extension:t}))}function c(){return n.filter(e=>!e.appBuiltinFeature)}},50037:(e,t,r)=>{"use strict";r.d(t,{default:()=>ef});var n=r(95155),s=r(12115),a=r(73321),o=r(80723),i=r(95057),l=r(52475),d=r(37618),c=r(33210),u=r(6296),m=r(55243),x=r(94290),p=r(60285),f=r(48368),h=r(53810),g=r(6962),b=r(67635),v=r(49387),j=r(68459),w=r(63637);function y({content:e}){let t=(0,s.useMemo)(()=>{try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}},[e]);return(0,n.jsx)("pre",{className:"rounded-xl border border-border bg-card px-4 py-3 overflow-x-auto text-sm leading-relaxed font-display",children:(0,n.jsx)("code",{suppressHydrationWarning:!0,children:t})})}var N=r(59386),k=r.n(N),C=r(9921),E=r(66088),A=r(56563),S=r(51914);function z(e,t){return k().unparse([e,...t])}function R({value:e,editable:t,onCommit:r}){let[a,o]=(0,s.useState)(!1),[i,l]=(0,s.useState)(e),d=(0,s.useRef)(null);function c(){o(!1),i!==e&&r(i)}return((0,s.useEffect)(()=>{a&&d.current?.select()},[a]),a)?(0,n.jsx)("input",{ref:d,value:i,onChange:e=>l(e.target.value),onBlur:c,onKeyDown:t=>{"Enter"===t.key&&c(),"Escape"===t.key&&(l(e),o(!1))},className:"w-full bg-transparent outline-none text-sm",style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)",minWidth:60},onClick:e=>e.stopPropagation()}):(0,n.jsx)("div",{className:`truncate text-sm ${t?"cursor-text":""}`,style:{color:"var(--foreground)",minWidth:60},onClick:t?function(){t&&(l(e),o(!0))}:void 0,title:e,children:e||(0,n.jsx)("span",{style:{color:"var(--muted-foreground)",opacity:.4},children:"—"})})}function T({headers:e,onAdd:t,onCancel:r}){let[a,o]=(0,s.useState)(()=>Array(e.length).fill("")),i=(0,s.useRef)(null);return(0,n.jsxs)("tr",{style:{background:"color-mix(in srgb, var(--amber) 6%, transparent)",borderTop:"1px solid var(--amber)"},children:[e.map((e,s)=>(0,n.jsx)("td",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,n.jsx)("input",{ref:0===s?i:void 0,autoFocus:0===s,value:a[s],onChange:e=>{var t;return t=e.target.value,void o(e=>{let r=[...e];return r[s]=t,r})},onKeyDown:e=>{"Enter"===e.key&&t(a),"Escape"===e.key&&r()},placeholder:e,className:"w-full bg-transparent outline-none text-sm placeholder:opacity-30",style:{color:"var(--foreground)",borderBottom:"1px solid var(--border)"}})},s)),(0,n.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"}})]})}function L({content:e,appendAction:t,saveAction:r}){let[a,o]=(0,s.useState)(e),[i,l]=(0,s.useState)(null),[d,c]=(0,s.useState)(null),[m,x]=(0,s.useState)(!1),[p,f]=(0,s.useState)(!1),h=(0,s.useMemo)(()=>k().parse(a,{skipEmptyLines:!0}).data,[a]),g=h[0]||[],b=h.slice(1),v=(0,s.useMemo)(()=>null===i||null===d?b:[...b].sort((e,t)=>{let r=e[i]??"",n=t[i]??"",s=parseFloat(r),a=parseFloat(n);return isNaN(s)||isNaN(a)?"asc"===d?r.localeCompare(n):n.localeCompare(r):"asc"===d?s-a:a-s}),[b,i,d]),w=(0,s.useCallback)(async(e,t,n)=>{if(!r)return;let s=z(g,b.map(r=>r===v[e]?r.map((e,r)=>r===t?n:e):r));o(s),f(!0);try{await r(s)}catch(e){console.error("[CsvView] Cell save failed:",e)}finally{f(!1)}},[r,b,v,g]),y=(0,s.useCallback)(async e=>{if(!r||p)return;let t=v[e],n=z(g,b.filter(e=>e!==t));o(n),f(!0);try{await r(n)}catch(e){console.error("[CsvView] Row delete failed:",e)}finally{f(!1)}},[r,b,v,g,p]),N=(0,s.useCallback)(async e=>{f(!0);try{if(t){let r=await t(e);o(r.newContent)}else if(r){let t=z(g,[...b,e]);o(t),await r(t)}x(!1)}catch(e){console.error("[CsvView] Add row failed:",e)}finally{f(!1)}},[t,r,g,b]),L=!!r||!!t;return 0===g.length?(0,n.jsx)("div",{className:"text-sm py-4",style:{color:"var(--muted-foreground)"},children:"Empty CSV file"}):(0,n.jsxs)("div",{className:"w-full rounded-xl overflow-hidden border",style:{borderColor:"var(--border)"},children:[(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)("table",{className:"min-w-full text-sm border-collapse",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{style:{background:"var(--muted)"},children:[g.map((e,t)=>(0,n.jsx)("th",{onClick:()=>(function(e){if(i!==e){l(e),c("asc");return}"asc"===d?c("desc"):(l(null),c(null))})(t),className:"px-4 py-2.5 text-left font-semibold cursor-pointer select-none whitespace-nowrap transition-colors hover:bg-accent",style:{color:"var(--foreground)",borderBottom:"1px solid var(--border)",fontSize:"0.75rem",letterSpacing:"0.04em",textTransform:"uppercase"},children:(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{children:e}),i===t?"asc"===d?(0,n.jsx)(C.A,{size:11,style:{color:"var(--amber)"}}):(0,n.jsx)(E.A,{size:11,style:{color:"var(--amber)"}}):(0,n.jsx)(A.A,{size:11,style:{color:"var(--muted-foreground)",opacity:.4}})]})},t)),L&&(0,n.jsx)("th",{className:"w-8",style:{borderBottom:"1px solid var(--border)",background:"var(--muted)"}})]})}),(0,n.jsxs)("tbody",{children:[v.map((e,t)=>(0,n.jsxs)("tr",{className:"group transition-colors",style:{background:t%2==0?"var(--background)":"var(--card)"},onMouseEnter:e=>e.currentTarget.style.background="var(--muted)",onMouseLeave:e=>e.currentTarget.style.background=t%2==0?"var(--background)":"var(--card)",children:[g.map((s,a)=>(0,n.jsx)("td",{className:"px-4 py-2.5 max-w-xs",style:{borderBottom:"1px solid var(--border)"},children:(0,n.jsx)(R,{value:e[a]??"",editable:!!r,onCommit:e=>w(t,a,e)})},a)),L&&(0,n.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"},children:r&&(0,n.jsx)("button",{onClick:()=>y(t),disabled:p,className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/10 disabled:opacity-30",style:{color:"var(--muted-foreground)"},title:p?"Saving...":"Delete row",children:(0,n.jsx)(j.A,{size:12})})})]},t)),m&&(0,n.jsx)(T,{headers:g,onAdd:N,onCancel:()=>x(!1)})]})]})}),(0,n.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between",style:{background:"var(--muted)",borderTop:"1px solid var(--border)"},children:[(0,n.jsxs)("span",{className:"text-xs font-display flex items-center gap-1.5",style:{color:"var(--muted-foreground)"},children:[b.length," rows \xb7 ",g.length," cols",p&&(0,n.jsx)(u.A,{size:10,className:"animate-spin",style:{color:"var(--amber)"}})]}),L&&!m&&(0,n.jsxs)("button",{onClick:()=>x(!0),className:"flex items-center gap-1 text-xs px-2.5 py-1 rounded-md transition-colors font-display",style:{color:"var(--amber)",background:"var(--amber-dim)"},children:[(0,n.jsx)(S.A,{size:12}),"Add row"]}),m&&(0,n.jsx)("button",{onClick:()=>x(!1),className:"text-xs px-2.5 py-1 rounded-md transition-colors font-display",style:{color:"var(--muted-foreground)"},children:"Cancel"})]})]})}var $=r(98500),D=r.n($),F=r(47834),P=r(35581),M=r(22356);function O({filePath:e}){let[t,r]=(0,s.useState)([]),[a,o]=(0,s.useState)(!0),{t:i}=(0,P.Y)();return((0,s.useEffect)(()=>{o(!0),(0,M.n)(`/api/backlinks?path=${encodeURIComponent(e)}`).then(e=>{r(Array.isArray(e)?e:[]),o(!1)}).catch(()=>{r([]),o(!1)})},[e]),a||0!==t.length)?(0,n.jsxs)("div",{className:"mt-12 pt-8 border-t border-border",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-6 text-muted-foreground",children:[(0,n.jsx)(F.A,{size:16,className:"text-[var(--amber)]/70"}),(0,n.jsx)("h3",{className:"text-sm font-semibold tracking-wider uppercase",children:i.common?.relatedFiles||"Related Files"}),(0,n.jsx)("span",{className:"text-xs bg-muted px-1.5 py-0.5 rounded-full font-mono",children:t.length})]}),(0,n.jsx)("div",{className:"grid gap-3",children:a?(0,n.jsx)("div",{className:"space-y-3",children:[1,2].map(e=>(0,n.jsx)("div",{className:"h-20 bg-muted/30 rounded-lg animate-pulse"},e))}):t.map(e=>(0,n.jsx)(D(),{href:`/view/${e.filePath.split("/").map(encodeURIComponent).join("/")}`,className:"group block p-4 rounded-xl border border-border/50 bg-card/30 hover:bg-muted/30 hover:border-[var(--amber)]/30 transition-all duration-200",children:(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("div",{className:"mt-1 p-1.5 rounded-md bg-muted group-hover:bg-[var(--amber)]/10 transition-colors",children:(0,n.jsx)(f.A,{size:14,className:"text-muted-foreground group-hover:text-[var(--amber)]"})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"font-medium text-sm text-foreground group-hover:text-[var(--amber)] transition-colors truncate mb-1",title:e.filePath,children:e.filePath}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed italic opacity-80 group-hover:opacity-100 transition-opacity",title:e.snippets[0]||"",children:e.snippets[0]||""})]})]})},e.filePath))})]}):null}var I=r(77148),H=r(44406),W=r(37206),U=r(8434),V=r(12710),B=r(7915);let Y=(0,W.default)(()=>Promise.all([r.e(6079),r.e(1477),r.e(362)]).then(r.bind(r,90362)),{loadableGenerated:{webpack:()=>[90362]},ssr:!1,loading:()=>(0,n.jsx)("div",{className:"h-full w-full min-h-[400px] rounded-lg border border-border bg-background flex items-center justify-center",children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[(0,n.jsx)("div",{className:"w-4 h-4 border-2 border-border border-t-foreground rounded-full animate-spin"}),(0,n.jsx)("span",{children:"Loading editor..."})]})})}),_=(0,W.default)(()=>Promise.all([r.e(5004),r.e(277),r.e(2647),r.e(6087)]).then(r.bind(r,16087)),{loadableGenerated:{webpack:()=>[16087]},ssr:!1}),J=[{id:"wysiwyg",icon:(0,n.jsx)(v.A,{size:12}),label:"WYSIWYG"},{id:"split",icon:(0,n.jsx)(U.A,{size:12}),label:"Split"},{id:"source",icon:(0,n.jsx)(V.A,{size:12}),label:"Source"},{id:"preview",icon:(0,n.jsx)(B.A,{size:12}),label:"Preview"}];function K({value:e,onChange:t,viewMode:r,onViewModeChange:s}){return(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg self-start",children:J.map(e=>(0,n.jsxs)("button",{onClick:()=>s(e.id),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded text-xs font-medium transition-colors ${r===e.id?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.icon,e.label]},e.id))}),(0,n.jsxs)("div",{className:"rounded-xl overflow-hidden border border-border flex",style:{height:"calc(100vh - 160px)"},children:["wysiwyg"===r&&(0,n.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,n.jsx)(_,{value:e,onChange:t})}),"split"===r&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"w-1/2 h-full overflow-auto border-r border-border",children:(0,n.jsx)(Y,{value:e,onChange:t,language:"markdown"})}),(0,n.jsx)("div",{className:"w-1/2 h-full overflow-auto bg-background",children:(0,n.jsx)("div",{className:"px-6 py-5",children:(0,n.jsx)(w.default,{content:e})})})]}),"source"===r&&(0,n.jsx)("div",{className:"w-full h-full overflow-auto",children:(0,n.jsx)(Y,{value:e,onChange:t,language:"markdown"})}),"preview"===r&&(0,n.jsx)("div",{className:"w-full h-full overflow-auto bg-background",children:(0,n.jsx)("div",{className:"px-6 py-5",children:(0,n.jsx)(w.default,{content:e})})})]})]})}var G=r(21362),Z=r(36306),X=r(91337);function q({content:e}){let{t}=(0,P.Y)(),{headings:r,minLevel:a}=(0,s.useMemo)(()=>{let t=function(e){let t=new Z.A,r=e.split("\n"),n=[],s=!1;for(let e of r){if(/^(`{3,}|~{3,})/.test(e)){s=!s;continue}if(s)continue;let r=e.match(/^(#{1,4})\s+(.+)/);if(r){let e=r[1].length,s=r[2].trim(),a=t.slug(s);n.push({id:a,text:s,level:e})}}return n}(e);return{headings:t,minLevel:t.length>0?Math.min(...t.map(e=>e.level)):1}},[e]),[o,i]=(0,s.useState)(""),[l,d]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=document.documentElement.style;return e.setProperty("--toc-width",l?"0px":"212px"),l?e.removeProperty("--toc-margin"):e.setProperty("--toc-margin","220px"),()=>{e.removeProperty("--toc-width"),e.removeProperty("--toc-margin")}},[l]);let c=(0,s.useRef)(null),u=(0,s.useRef)(null),m=(0,s.useRef)(new Map),x=(0,s.useCallback)(e=>{let t=m.current.get(e),r=u.current;if(!t||!r||!t.isConnected)return;let n=r.getBoundingClientRect(),s=t.getBoundingClientRect(),a=s.top<n.top+40,o=s.bottom>n.bottom-40;(a||o)&&t.scrollIntoView({block:"center",behavior:"auto"})},[]);return((0,s.useEffect)(()=>{if(0===r.length)return;let e=setTimeout(()=>{let e=r.map(e=>document.getElementById(e.id)).filter(Boolean);0!==e.length&&(c.current?.disconnect(),c.current=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting){i(t.target.id),x(t.target.id);break}},{rootMargin:"-58px 0% -70% 0%",threshold:0}),e.forEach(e=>c.current?.observe(e)))},150);return()=>{clearTimeout(e),c.current?.disconnect()}},[r]),r.length<2)?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:()=>d(e=>!e),className:"hidden xl:flex fixed z-10 top-[46px] flex items-center justify-center w-5 h-8 rounded-l-md border border-r-0 border-border hover:bg-muted transition-colors",style:{right:`calc(var(--right-panel-width, 0px) + ${212*!l}px)`,background:"var(--background)",transition:"right 200ms ease-in-out"},title:l?t.view.tocExpand:t.view.tocCollapse,children:(0,n.jsx)(G.A,{size:11,className:"text-muted-foreground/60 transition-transform duration-200",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})}),(0,n.jsxs)("aside",{className:"hidden xl:flex flex-col fixed z-10 overflow-hidden",style:{top:46,height:"calc(100vh - 46px)",width:212,right:"var(--right-panel-width, 0px)",transform:l?"translateX(212px)":"translateX(0)",transition:"transform 200ms ease-in-out, right 200ms ease-out"},children:[(0,n.jsx)("div",{className:"flex items-center h-[46px] px-4 border-l border-b border-border",style:{background:"var(--background)"},children:(0,n.jsx)("p",{className:"text-2xs font-semibold uppercase tracking-wider text-muted-foreground/55 shrink-0",children:t.view.tocTitle})}),(0,n.jsx)("nav",{ref:u,"aria-label":t.view.tocTitle,className:"flex flex-col gap-0.5 overflow-y-auto min-h-0 flex-1 pt-3 pb-5 pl-2 pr-3 border-l border-border",style:{background:"var(--background)"},children:r.map((e,t)=>{let r=(e.level-a)*14,s=o===e.id,l=e.level>a;return(0,n.jsx)("a",{ref:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)},href:`#${e.id}`,onClick:t=>((e,t)=>{e.preventDefault();let r=document.getElementById(t);if(!r)return;let n=r.getBoundingClientRect().top+window.scrollY-58;window.scrollTo({top:n,behavior:"smooth"}),i(t)})(t,e.id),className:(0,X.cn)("block text-xs py-1 rounded transition-colors duration-100 leading-snug shrink-0 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",s&&"font-medium"),style:{paddingLeft:`${8+r}px`,paddingRight:"8px",borderLeft:"2px solid",borderLeftColor:s?"var(--amber)":l?"var(--border)":"transparent",marginLeft:l?"7px":"0",...s?{color:"var(--amber)",background:"var(--amber-dim)"}:{color:"var(--muted-foreground)"}},title:e.text,children:(0,n.jsx)("span",{className:"block truncate",suppressHydrationWarning:!0,children:e.text})},`${e.id}-${t}`)})})]})]})}let Q="findip-highlight",ee="findip-active";function et({containerRef:e,onClose:t}){let{t:r}=(0,P.Y)(),[a,o]=(0,s.useState)(""),[i,l]=(0,s.useState)(0),d=(0,s.useRef)(null),u=(0,s.useRef)([]);(0,s.useEffect)(()=>{d.current?.focus()},[]);let m=(0,s.useCallback)(()=>{for(let e of u.current){let t=e.parentNode;t&&(t.replaceChild(document.createTextNode(e.textContent||""),e),t.normalize())}u.current=[]},[]);(0,s.useEffect)(()=>{m(),l(0);let t=e.current;if(!t||!a.trim())return;let r=a.toLowerCase(),n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.parentElement?.closest("[data-find-in-page]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),s=[];for(;n.nextNode();)s.push(n.currentNode);let o=[];for(let e of s){let t=e.textContent||"",n=t.toLowerCase(),s=0,a=[];for(;;){let e=n.indexOf(r,s);if(-1===e)break;a.push(e),s=e+r.length}if(0===a.length)continue;let i=e.parentNode;if(!i)continue;let l=document.createDocumentFragment(),d=0;for(let e of a){e>d&&l.appendChild(document.createTextNode(t.slice(d,e)));let n=document.createElement("mark");n.className=Q,n.textContent=t.slice(e,e+r.length),l.appendChild(n),o.push(n),d=e+r.length}d<t.length&&l.appendChild(document.createTextNode(t.slice(d))),i.replaceChild(l,e)}return u.current=o,l(+(o.length>0)),o.length>0&&(o[0].classList.add(ee),o[0].scrollIntoView({block:"center",behavior:"smooth"})),()=>{}},[a,e,m]),(0,s.useEffect)(()=>()=>{m()},[m]);let x=u.current.length,p=(0,s.useCallback)(e=>{let t=u.current;if(0===t.length)return;for(let e of t)e.classList.remove(ee);let r=((e-1)%t.length+t.length)%t.length;t[r].classList.add(ee),t[r].scrollIntoView({block:"center",behavior:"smooth"}),l(r+1)},[]),f=(0,s.useCallback)(()=>p(i+1),[i,p]),h=(0,s.useCallback)(()=>p(i-1),[i,p]),g=(0,s.useCallback)(e=>{"Escape"===e.key?(e.preventDefault(),t()):"Enter"===e.key&&(e.preventDefault(),e.shiftKey?h():f())},[t,f,h]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("style",{children:`
2
- mark.${Q} {
3
- background: rgba(250, 204, 21, 0.3);
4
- color: inherit;
5
- border-radius: 2px;
6
- padding: 0;
7
- }
8
- mark.${ee} {
9
- background: rgba(250, 204, 21, 0.7);
10
- outline: 2px solid rgba(250, 204, 21, 0.5);
11
- }
12
- `}),(0,n.jsx)("div",{className:"sticky top-[98px] md:top-[46px] z-30 flex justify-end px-4 md:px-6 pointer-events-none","data-find-in-page":!0,children:(0,n.jsxs)("div",{className:"pointer-events-auto flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card shadow-lg",children:[(0,n.jsx)("input",{ref:d,type:"text",value:a,onChange:e=>o(e.target.value),onKeyDown:g,placeholder:r.findInPage.placeholder,className:"w-[180px] sm:w-[220px] px-2 py-1 text-sm bg-transparent text-foreground placeholder:text-muted-foreground outline-none"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums shrink-0 min-w-[48px] text-center font-display",children:a.trim()?x>0?r.findInPage.matchCount(i,x):r.findInPage.noResults:""}),(0,n.jsx)("button",{onClick:h,disabled:0===x,className:"p-1 rounded text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors","aria-label":"Previous match",children:(0,n.jsx)(C.A,{size:14})}),(0,n.jsx)("button",{onClick:f,disabled:0===x,className:"p-1 rounded text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors","aria-label":"Next match",children:(0,n.jsx)(E.A,{size:14})}),(0,n.jsx)("button",{onClick:t,className:"p-1 rounded text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close find",children:(0,n.jsx)(c.A,{size:14})})]})})]})}var er=r(46838),en=r(70620),es=r(62159),ea=r(2580),eo=r(32913),ei=r(4235),el=r(39498),ed=r(97631),ec=r(10377),eu=r(24332),em=r(92451),ex=r(94514);function ep({open:e,onClose:t,filePath:r,isDirectory:a,fileName:o}){let{t:i}=(0,P.Y)(),[l,d]=(0,s.useState)(a?"zip":"md"),[m,x]=(0,s.useState)("idle"),[p,h]=(0,s.useState)(""),b=(0,s.useRef)(null),v=(0,s.useCallback)(()=>{x("exporting"),h("");let e=new AbortController;b.current=e,fetch(`/api/export?path=${encodeURIComponent(r)}&format=${l}`,{signal:e.signal}).then(e=>{if(!e.ok){if((e.headers.get("content-type")??"").includes("json"))return e.json().then(e=>{throw Error(e.error||"Export failed")});throw Error(`Export failed (${e.status})`)}return e.blob().then(t=>({blob:t,res:e}))}).then(({blob:e,res:t})=>{let r=(t.headers.get("Content-Disposition")??"").match(/filename="?([^"]+)"?/),n=r?decodeURIComponent(r[1]):o,s=document.createElement("a");s.href=URL.createObjectURL(e),s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(s.href),x("done"),ei.oR.success(i.export?.downloaded??"Downloaded")}).catch(e=>{"AbortError"!==e.name&&(x("error"),h(e.message??"Export failed"))}).finally(()=>{b.current=null})},[r,l,o,i]),j=(0,s.useCallback)(()=>{b.current&&(b.current.abort(),b.current=null),x("idle"),h("")},[]),w=(0,s.useCallback)(()=>{x("idle"),h("")},[]),y=(0,s.useCallback)(()=>{b.current&&b.current.abort(),b.current=null,x("idle"),h(""),t()},[t]);if(!e)return null;let N=a?[{value:"zip",label:i.export?.formatZipMd??"Markdown ZIP",desc:i.export?.formatZipMdDesc??"All files in original format",icon:(0,n.jsx)(eu.A,{size:14})},{value:"zip-html",label:i.export?.formatZipHtml??"HTML ZIP",desc:i.export?.formatZipHtmlDesc??"All files as webpages",icon:(0,n.jsx)(em.A,{size:14})}]:[{value:"md",label:i.export?.formatMd??"Markdown (.md)",desc:i.export?.formatMdDesc??"Original format, editable",icon:(0,n.jsx)(f.A,{size:14})},{value:"html",label:i.export?.formatHtml??"HTML (.html)",desc:i.export?.formatHtmlDesc??"Static webpage, shareable",icon:(0,n.jsx)(em.A,{size:14})}];return(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center modal-backdrop",onClick:"exporting"===m?void 0:y,children:(0,n.jsxs)("div",{className:"bg-card border border-border rounded-xl shadow-xl max-w-md w-full mx-4 animate-in fade-in-0 zoom-in-95 duration-200",role:"dialog","aria-modal":"true","aria-labelledby":"export-modal-title",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(g.A,{size:15,className:"text-[var(--amber)]"}),(0,n.jsx)("h3",{id:"export-modal-title",className:"text-sm font-semibold",children:a?i.export?.exportSpace??"Export Space":i.export?.exportFile??"Export File"})]}),(0,n.jsx)("button",{onClick:y,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":i.export?.cancel??"Close",children:(0,n.jsx)(c.A,{size:14})})]}),(0,n.jsx)("div",{className:"px-5 py-4",children:"done"===m?(0,n.jsxs)("div",{className:"text-center py-6",children:[(0,n.jsx)("div",{className:"w-10 h-10 rounded-full bg-success/10 flex items-center justify-center mx-auto mb-3",children:(0,n.jsx)(ex.A,{size:20,className:"text-success"})}),(0,n.jsx)("p",{className:"text-sm font-medium",children:i.export?.done??"Export Complete"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:o})]}):"error"===m?(0,n.jsxs)("div",{className:"text-center py-6",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-error",children:i.export?.error??"Export failed"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:p})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-xs text-muted-foreground mb-3 truncate",title:r,children:r}),(0,n.jsx)("p",{className:"text-xs font-medium text-foreground mb-2",children:i.export?.chooseFormat??"Choose format"}),(0,n.jsx)("div",{className:"space-y-1.5",children:N.map(e=>(0,n.jsxs)("label",{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-all ${l===e.value?"border-[var(--amber)]/40 bg-[var(--amber-dim)]":"border-border hover:border-border/80 hover:bg-muted/30"} ${e.disabled?"opacity-40 cursor-not-allowed":""}`,children:[(0,n.jsx)("input",{type:"radio",name:"export-format",value:e.value,checked:l===e.value,onChange:()=>!e.disabled&&d(e.value),disabled:e.disabled,className:"sr-only"}),(0,n.jsx)("span",{className:`mt-0.5 ${l===e.value?"text-[var(--amber)]":"text-muted-foreground"}`,children:e.icon}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:e.label}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground block mt-0.5",children:e.desc})]})]},e.value))})]})}),(0,n.jsx)("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border",children:"done"===m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:w,className:"px-3 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:i.export?.downloadAgain??"Download Again"}),(0,n.jsx)("button",{onClick:y,className:"px-3 py-1.5 rounded-md text-xs font-medium bg-[var(--amber-dim)] text-[var(--amber-text)] hover:opacity-80 transition-colors",children:i.export?.close??"Done"})]}):"error"===m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:y,className:"px-3 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:i.export?.cancel??"Cancel"}),(0,n.jsx)("button",{onClick:w,className:"px-3 py-1.5 rounded-md text-xs font-medium bg-[var(--amber-dim)] text-[var(--amber-text)] hover:opacity-80 transition-colors",children:i.export?.retry??"Retry"})]}):"exporting"===m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:j,className:"px-3 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:i.export?.cancel??"Cancel"}),(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium text-[var(--amber-text)] opacity-70",children:[(0,n.jsx)(u.A,{size:12,className:"animate-spin"})," ",i.export?.exporting??"Exporting..."]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:y,className:"px-3 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:i.export?.cancel??"Cancel"}),(0,n.jsxs)("button",{onClick:v,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-[var(--amber-dim)] text-[var(--amber-text)] hover:opacity-80 transition-colors",children:[(0,n.jsx)(g.A,{size:12})," ",i.export?.exportButton??"Export"]})]})})]})})}function ef({filePath:e,content:t,extension:r,saveAction:N,appendRowAction:k,initialEditing:C=!1,isDraft:E=!1,draftDirectories:A=[],createDraftAction:S}){let{t:z}=(0,P.Y)(),{isPinned:R,togglePin:T}=(0,ec.Z)(),$=R(e),[D,F]=(0,s.useState)(!1),M=(0,s.useSyncExternalStore)(()=>()=>{},()=>!0,()=>!1),[W,U]=(0,I.Un)("_raw",e,!1),[V,B]=(0,s.useState)(!1),Y=(0,a.useRouter)(),_=["pdf","png","jpg","jpeg","gif","webp","svg","bmp","ico","mp3","wav","m4a","ogg","flac","aac","mp4","webm","mov","mkv"].includes(r),[J,G]=(0,s.useState)(!_&&(C||""===t)),[Z,Q]=(0,s.useState)(t),[ee,eu]=(0,s.useState)(t);(0,s.useEffect)(()=>{J||eu(t)},[t,J]);let[em,ex]=(0,s.useTransition)(),[ef,eh]=(0,s.useState)(null),[eg,eb]=(0,s.useState)(!1),[ev,ej]=(0,s.useState)("wysiwyg"),[ew,ey]=(0,s.useState)(!1),eN=(0,s.useRef)(null),[ek,eC]=(0,s.useState)(!1),eE=(0,s.useRef)(null),eA=(0,s.useRef)(null),[eS,ez]=(0,s.useState)(!1),[eR,eT]=(0,s.useState)(!1),[eL,e$]=(0,s.useState)(""),[,eD]=(0,s.useTransition)(),eF=e.split("/").pop()||"Untitled.md",[eP,eM]=(0,s.useState)(E),[eO,eI]=(0,s.useState)(""),[eH,eW]=(0,s.useState)(eF);(0,s.useEffect)(()=>{if(!ek)return;let e=e=>{eE.current&&!eE.current.contains(e.target)&&eA.current&&!eA.current.contains(e.target)&&eC(!1)},t=e=>{"Escape"===e.key&&eC(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[ek]);let eU=(0,s.useCallback)(()=>{navigator.clipboard.writeText(e).catch(()=>{}),eC(!1)},[e]),eV=(0,s.useCallback)(()=>{eC(!1),e$(e.split("/").pop()??""),eT(!0)},[e]),eB=(0,s.useCallback)(()=>{let t=eL.trim();t&&t!==e.split("/").pop()?eD(async()=>{let r=await (0,es.f)(e,t);eT(!1),r.success&&r.newPath&&(Y.push(`/view/${(0,X.O0)(r.newPath)}`),Y.refresh(),window.dispatchEvent(new Event("mindos:files-changed")))}):eT(!1)},[eL,e,Y]),eY=(0,s.useCallback)(()=>{ez(!1);let t=e.split("/").pop()??e;ex(async()=>{let r=await (0,ea.i)(e);if(r.success){if(r.trashId){let e=r.trashId;ei.oR.undo(`${z.trash?.movedToTrash??"Deleted"} ${t}`,async()=>{let t=await (0,eo.Y)(e);t.success?(Y.refresh(),window.dispatchEvent(new Event("mindos:files-changed"))):ei.oR.error(t.error??"Undo failed")},{label:z.trash?.undo??"Undo"})}Y.push("/"),Y.refresh(),window.dispatchEvent(new Event("mindos:files-changed"))}})},[e,Y,z]),e_=!!M&&W,eJ=(0,s.useCallback)(()=>{U(e=>!e)},[U]),eK=(0,s.useCallback)(()=>{B(e=>!e)},[B]),eG=(0,er.YB)(e,r),eZ="md"===r&&V?(0,er.YB)(e,r,"graph"):void 0,eX=eZ||eG,eq="csv"===r,eQ=!J&&!!eX&&(!e_||!!eZ),e0=(0,s.useMemo)(()=>eX?eX.component?eX.component:eX.load?(0,s.lazy)(eX.load):null:null,[eX]),e1=(0,s.useCallback)(()=>{Q(ee),G(!0),eh(null),eb(!1)},[ee]),e5=(0,s.useCallback)(()=>{E?Y.push("/"):(G(!1),eh(null))},[E,Y]),e2=(0,s.useCallback)(()=>{let e=eH.trim();if(!e)return void eh("Please enter a file name");if(/[/\\:*?"<>|]/.test(e)||e.includes(".."))return void eh("File name contains invalid characters");if(!S)return void eh("Draft save is not available");let t=e.endsWith(".md")||e.endsWith(".csv")?e:`${e}.md`,r=eO?`${eO}/${t}`:t;eh(null),ex(async()=>{try{await S(r,Z),eu(Z),G(!1),eM(!1),eb(!0),setTimeout(()=>eb(!1),2500),Y.push(`/view/${(0,X.O0)(r)}`),Y.refresh()}catch(e){eh(e instanceof Error?e.message:"Failed to save")}})},[eH,S,eO,Z,Y]),e3=(0,s.useCallback)(()=>{if(eq){G(!1),eb(!0),setTimeout(()=>eb(!1),2500);return}E?eM(!0):(eh(null),ex(async()=>{try{await N(Z),eu(Z),G(!1),eb(!0),setTimeout(()=>eb(!1),2500)}catch(e){eh(e instanceof Error?e.message:"Failed to save")}}))},[eq,E,N,Z]),e4=(0,s.useCallback)(async e=>{await N(e),eu(e)},[N]);(0,s.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),J&&e3()),(e.metaKey||e.ctrlKey)&&"f"===e.key&&!J&&(e.preventDefault(),ey(!0)),"e"!==e.key||J||_||document.activeElement?.tagName!=="BODY"||e1(),"Escape"===e.key&&J&&e5()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[J,e3,e1,e5]);let[e6,e8]=(0,s.useState)(!1),[e7,e9]=(0,s.useState)([]),te=(0,s.useRef)(t),tt=(0,s.useRef)(!1),tr=(0,s.useRef)(null),tn=(0,s.useRef)(null);return(0,s.useEffect)(()=>{if(!J&&tt.current&&t!==te.current&&""!==te.current){tt.current=!1;let e=(0,ed.m)(te.current,t),r=[],n=1;for(let t of e)"insert"===t.type?(r.push(n),n++):"equal"===t.type&&n++;r.length>0&&(e9(r),tr.current&&clearTimeout(tr.current),tr.current=setTimeout(()=>e9([]),6e3),setTimeout(()=>{let e=document.querySelector("[data-highlight-line]");e&&e.scrollIntoView({block:"center",behavior:"smooth"})},100))}te.current=t},[t,J]),(0,s.useEffect)(()=>{let e=null,t=()=>{J||(e&&clearTimeout(e),e=setTimeout(()=>{tt.current=!0,Y.refresh(),e8(!0),tn.current&&clearTimeout(tn.current),tn.current=setTimeout(()=>e8(!1),3e3)},300))};return window.addEventListener("mindos:files-changed",t),()=>{window.removeEventListener("mindos:files-changed",t),e&&clearTimeout(e)}},[J,Y]),(0,n.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,n.jsx)("div",{className:"sticky top-[52px] md:top-0 z-20 border-b border-border px-4 md:px-6 h-[46px] flex items-center",style:{background:"var(--background)"},children:(0,n.jsxs)("div",{className:"w-full min-w-0 flex items-center justify-between gap-3 h-full",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1 flex items-center gap-1.5",children:[(0,n.jsx)("button",{onClick:()=>Y.back(),className:"md:hidden p-1 -ml-1 rounded text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Go back",children:(0,n.jsx)(o.A,{size:16})}),(0,n.jsx)(H.A,{filePath:e})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5 md:gap-2 shrink-0",children:[e6&&!J&&(0,n.jsxs)("span",{className:"text-xs flex items-center gap-1.5 text-[var(--amber)] animate-in fade-in-0 duration-200",children:[(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--amber)]"}),(0,n.jsx)("span",{className:"hidden sm:inline",children:"updated"})]}),eg&&(0,n.jsxs)("span",{className:"text-xs flex items-center gap-1.5",style:{color:"var(--success)"},children:[(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--success)"}}),(0,n.jsx)("span",{className:"hidden sm:inline",children:"saved"})]}),ef&&(0,n.jsx)("span",{className:"text-xs text-error hidden sm:inline",children:ef}),eG&&!J&&!E&&!eZ&&!_&&(0,n.jsxs)("button",{onClick:eJ,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors",style:{background:e_?"var(--amber)22":"var(--muted)",color:e_?"var(--amber)":"var(--muted-foreground)"},title:e_?`Switch to ${eG?.name}`:"View raw",children:[e_?(0,n.jsx)(i.A,{size:13}):(0,n.jsx)(l.A,{size:13}),(0,n.jsx)("span",{className:"hidden sm:inline",children:e_?eG.name:"Raw"})]}),!J&&!eQ&&!E&&!_&&(0,n.jsxs)("button",{onClick:e1,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors",style:{background:"var(--muted)",color:"var(--muted-foreground)"},onMouseEnter:e=>{e.currentTarget.style.color="var(--foreground)",e.currentTarget.style.background="var(--accent)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--muted-foreground)",e.currentTarget.style.background="var(--muted)"},children:[(0,n.jsx)(d.A,{size:13}),(0,n.jsx)("span",{className:"hidden sm:inline",children:"Edit"})]}),J&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:e5,disabled:em,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors disabled:opacity-50",style:{background:"var(--muted)",color:"var(--muted-foreground)"},onMouseEnter:e=>{e.currentTarget.style.background="var(--accent)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--muted)"},children:[(0,n.jsx)(c.A,{size:13}),(0,n.jsx)("span",{className:"hidden sm:inline",children:"Cancel"})]}),(0,n.jsxs)("button",{onClick:E&&eP?e2:e3,disabled:em,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium disabled:opacity-50",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:[em?(0,n.jsx)(u.A,{size:13,className:"animate-spin"}):(0,n.jsx)(m.A,{size:13}),(0,n.jsx)("span",{className:"hidden sm:inline",children:"Save"})]})]}),!E&&(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("button",{type:"button",onClick:()=>T(e),className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:$?z.fileTree.removeFromFavorites:z.fileTree.pinToFavorites,children:(0,n.jsx)(x.A,{size:16,className:$?"fill-[var(--amber)] text-[var(--amber)]":""})}),(0,n.jsx)("button",{ref:eE,type:"button",onClick:()=>eC(e=>!e),className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:z.view?.more??"More",children:(0,n.jsx)(p.A,{size:16})}),ek&&(0,n.jsxs)("div",{ref:eA,className:"absolute right-0 top-full mt-1 z-50 min-w-[160px] rounded-lg border border-border bg-card shadow-lg py-1",children:["md"===r&&!J&&!E&&(0,er.pl)("graph")&&(0,n.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{eC(!1),eK()},children:[V?(0,n.jsx)(f.A,{size:14,className:"shrink-0"}):(0,n.jsx)(h.A,{size:14,className:"shrink-0"}),V?z.view?.switchToDoc??"Document view":z.view?.switchToGraph??"Wiki Graph"]}),(0,n.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{eC(!1),F(!0)},children:[(0,n.jsx)(g.A,{size:14,className:"shrink-0"})," ",z.fileTree?.export??"Export"]}),(0,n.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:eU,children:[(0,n.jsx)(b.A,{size:14,className:"shrink-0"})," ",z.view?.copyPath??z.fileTree?.copyPath??"Copy Path"]}),(0,n.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:eV,children:[(0,n.jsx)(v.A,{size:14,className:"shrink-0"})," ",z.view?.rename??"Rename"]}),(0,n.jsx)("div",{className:"my-1 border-t border-border/50"}),(0,n.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-error hover:bg-error/10 transition-colors text-left",onClick:()=>{eC(!1),ez(!0)},children:[(0,n.jsx)(j.A,{size:14,className:"shrink-0"})," ",z.view?.delete??"Delete"]})]})]})]})]})}),(0,n.jsx)("div",{className:"flex-1 px-4 md:px-6 py-6 md:py-8",children:J?(0,n.jsxs)("div",{className:"content-width",children:[E&&eP&&(0,n.jsxs)("div",{className:"mb-3 rounded-lg border border-border bg-card p-3 flex flex-col gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:z.view?.saveDirectory??"Directory"}),(0,n.jsx)("div",{className:"mt-1",children:(0,n.jsx)(en.A,{dirPaths:A,value:eO,onChange:eI,rootLabel:z.home?.rootLevel??"Root"})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",children:z.view?.saveFileName??"File name"}),(0,n.jsx)("input",{value:eH,onChange:e=>eW(e.target.value),onKeyDown:e=>{"Enter"===e.key&&e2()},className:"mt-1 w-full px-2.5 py-1.5 text-sm bg-background border border-border rounded-lg text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring",placeholder:"Untitled.md"})]})]}),eq?(0,n.jsx)(L,{content:Z,filePath:e,appendAction:k,saveAction:async e=>{await N(e),Q(e),eu(e)}}):(0,n.jsx)(K,{value:Z,onChange:Q,viewMode:ev,onViewModeChange:ej})]}):eQ&&e0?(0,n.jsxs)("div",{ref:eN,className:"content-width",children:[ew&&(0,n.jsx)(et,{containerRef:eN,onClose:()=>ey(!1)}),(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,n.jsx)(u.A,{size:20,className:"animate-spin text-muted-foreground"})}),children:(0,n.jsx)(e0,{filePath:e,content:ee,extension:r,saveAction:e4})}),(0,n.jsx)(O,{filePath:e})]}):(0,n.jsxs)("div",{ref:eN,className:"content-width",children:[ew&&(0,n.jsx)(et,{containerRef:eN,onClose:()=>ey(!1)}),"csv"===r?(0,n.jsx)(L,{content:ee,filePath:e}):"json"===r?(0,n.jsx)(y,{content:ee}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w.default,{content:ee,highlightLines:e7,onDismissHighlight:()=>e9([]),emptyPlaceholder:z.view?.emptyNote}),(0,n.jsx)(q,{content:ee})]}),(0,n.jsx)(O,{filePath:e})]})}),eR&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/60 backdrop-blur-sm",children:(0,n.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-lg p-4 w-80",children:[(0,n.jsx)("h3",{className:"text-sm font-medium mb-2",children:"Rename"}),(0,n.jsx)("input",{autoFocus:!0,value:eL,onChange:e=>e$(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eB(),"Escape"===e.key&&eT(!1)},className:"w-full bg-muted border border-border rounded-md px-3 py-1.5 text-sm text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 mt-3",children:[(0,n.jsx)("button",{onClick:()=>eT(!1),className:"px-3 py-1.5 rounded-md text-xs bg-muted text-muted-foreground hover:bg-accent transition-colors",children:z.view?.cancel??"Cancel"}),(0,n.jsx)("button",{onClick:eB,className:"px-3 py-1.5 rounded-md text-xs bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors",children:z.view?.rename??"Rename"})]})]})}),(0,n.jsx)(el.TM,{open:eS,title:z.view?.delete??"Delete",message:z.view?.deleteConfirm?.(e.split("/").pop()??"")??`Delete "${e.split("/").pop()}"?`,confirmLabel:z.view?.delete??"Delete",cancelLabel:z.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>ez(!1),onConfirm:eY}),(0,n.jsx)(ep,{open:D,onClose:()=>F(!1),filePath:e,isDirectory:!1,fileName:e.split("/").pop()??e})]})}},50728:(e,t,r)=>{Promise.resolve().then(r.bind(r,50037)),Promise.resolve().then(r.bind(r,3109)),Promise.resolve().then(r.bind(r,1012))},62159:(e,t,r)=>{"use strict";r.d(t,{f:()=>s});var n=r(9339);let s=(0,n.createServerReference)("609756b5490f196ddab99396fa6785c780400b0f8b",n.callServer,void 0,n.findSourceMapURL,"renameFileAction")},63637:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>j});var n=r(95155),s=r(66804),a=r(32957),o=r(98076),i=r(96182),l=r(16535),d=r(12115),c=r(94514),u=r(67635),m=r(33210),x=r(7834),p=r(4235),f=r(7337);function h({code:e}){let[t,r]=(0,d.useState)(!1),s=(0,d.useCallback)(()=>{(0,x.l)(e).then(e=>{e&&(r(!0),setTimeout(()=>r(!1),2e3),p.oR.copy())})},[e]);return(0,n.jsx)("button",{onClick:s,className:" absolute top-2.5 right-2.5 p-1.5 rounded-md bg-muted hover:bg-accent text-muted-foreground hover:text-foreground transition-colors duration-100 opacity-0 group-hover:opacity-100 ",title:"Copy code",children:t?(0,n.jsx)(c.A,{size:13}):(0,n.jsx)(u.A,{size:13})})}function g(e){let{node:t,inline:r,ordered:n,depth:s,isHeader:a,...o}=e;return o}function b(e){let t=({children:t,...r})=>(0,n.jsx)(e,{...g(r),suppressHydrationWarning:!0,children:t});return t.displayName=e,t}let v={h1:b("h1"),h2:b("h2"),h3:b("h3"),h4:b("h4"),h5:b("h5"),h6:b("h6"),code:({children:e,node:t,...r})=>(0,n.jsx)("code",{...g(r),suppressHydrationWarning:!0,children:e}),pre({children:e,node:t,...r}){let s="";return e&&"object"==typeof e&&"props"in e&&(s=function e(t){return"string"==typeof t?t:Array.isArray(t)?t.map(e).join(""):t&&"object"==typeof t&&"props"in t?e(t.props?.children):""}(e.props?.children)),(0,n.jsxs)("div",{className:"relative group",children:[(0,n.jsx)("pre",{...g(r),suppressHydrationWarning:!0,children:e}),(0,n.jsx)(h,{code:s})]})},li:({children:e,node:t,...r})=>(0,n.jsx)("li",{...g(r),suppressHydrationWarning:!0,children:e}),p:({children:e,node:t,...r})=>(0,n.jsx)("p",{...g(r),suppressHydrationWarning:!0,children:e}),span:({children:e,node:t,...r})=>(0,n.jsx)("span",{...g(r),suppressHydrationWarning:!0,children:e}),a({href:e,children:t,node:r,...s}){let a=e?.startsWith("http");return(0,n.jsx)("a",{href:e,target:a?"_blank":void 0,rel:a?"noopener noreferrer":void 0,...g(s),children:t})},img({src:e,alt:t,node:r,...s}){if(!e)return null;let a="string"==typeof e?(0,f.X)(e):e;return(0,n.jsx)("img",{src:a,alt:t??"",...g(s)})}};function j({content:e,highlightLines:t,onDismissHighlight:r,emptyPlaceholder:d}){let c=t&&t.length>0;return!e.trim()&&d?(0,n.jsx)("div",{className:"py-12 text-center text-sm text-muted-foreground/50",children:d}):(0,n.jsxs)("div",{children:[c&&(0,n.jsxs)("div",{className:"mb-4 flex items-center gap-2 rounded-md border px-3 py-2 text-xs animate-in fade-in-0 duration-300",style:{borderColor:"color-mix(in srgb, var(--amber) 40%, var(--border))",background:"color-mix(in srgb, var(--amber) 8%, var(--card))",color:"var(--amber)"},"data-highlight-line":!0,children:[(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--amber)] animate-pulse shrink-0"}),(0,n.jsxs)("span",{className:"font-display font-medium flex-1",children:[t.length," line",1!==t.length?"s":""," updated by AI"]}),r&&(0,n.jsx)("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-[var(--amber)]/15 transition-colors shrink-0","aria-label":"Dismiss",children:(0,n.jsx)(m.A,{size:12})})]}),(0,n.jsx)("div",{className:"prose max-w-none",children:(0,n.jsx)(s.oz,{remarkPlugins:[a.A],rehypePlugins:[l.A,o.A,i.A],components:v,children:e})})]})}},70620:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(95155),s=r(12115),a=r(47650),o=r(21362),i=r(38798),l=r(94514),d=r(66088),c=r(91337);function u({dirPaths:e,value:t,onChange:r,rootLabel:u="Root"}){let[m,x]=(0,s.useState)(!1),[p,f]=(0,s.useState)(t),[h,g]=(0,s.useState)(null),b=(0,s.useRef)(null),v=(0,s.useRef)(null);(0,s.useEffect)(()=>{f(t)},[t]);let j=(0,s.useCallback)(()=>{if(!b.current)return;let e=b.current.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top,n=t<208&&r>t;g({top:n?e.top:e.bottom,left:e.left,width:e.width,flipUp:n})},[]),w=(0,s.useRef)(0),y=(0,s.useCallback)(()=>{w.current||(w.current=requestAnimationFrame(()=>{w.current=0,j()}))},[j]);(0,s.useEffect)(()=>m?(j(),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),w.current&&(cancelAnimationFrame(w.current),w.current=0)}):void g(null),[m,j,y]);let N=(0,s.useCallback)(()=>x(!1),[]);(0,s.useEffect)(()=>{if(!m)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),N())},t=e=>{let t=e.target;b.current?.contains(t)||v.current?.contains(t)||N()};return document.addEventListener("keydown",e),document.addEventListener("mousedown",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("mousedown",t)}},[m,N]);let k=(0,s.useMemo)(()=>{let t=p?p+"/":"";return e.filter(e=>{if(!e.startsWith(t))return!1;let r=e.slice(t.length);return r.length>0&&!r.includes("/")}).sort()},[e,p]),C=(0,s.useMemo)(()=>p?p.split("/"):[],[p]),E=e=>{if(e<0)f(""),r("");else{let t=C.slice(0,e+1).join("/");f(t),r(t)}},A=t?t.split("/").map(e=>(0,c.vr)(e)).join(" / "):"/ "+u,S=m&&h&&(0,a.createPortal)((0,n.jsxs)("div",{ref:v,className:"fixed z-50 rounded-lg border border-[var(--amber)] bg-card shadow-lg overflow-hidden flex flex-col",style:{left:h.left,width:h.width,maxHeight:200,...h.flipUp?{bottom:window.innerHeight-h.top+4}:{top:h.top+4}},children:[(0,n.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,n.jsxs)("button",{type:"button",onClick:()=>E(-1),className:`shrink-0 px-1.5 py-0.5 rounded transition-colors ${""===p?"text-[var(--amber)] font-medium":"text-muted-foreground hover:text-foreground"}`,children:["/ ",u]}),C.map((e,t)=>(0,n.jsxs)("span",{className:"flex items-center gap-0.5 shrink-0",children:[(0,n.jsx)(o.A,{size:10,className:"text-muted-foreground/50"}),(0,n.jsx)("button",{type:"button",onClick:()=>E(t),className:`px-1.5 py-0.5 rounded transition-colors truncate max-w-[100px] ${t===C.length-1?"text-[var(--amber)] font-medium":"text-muted-foreground hover:text-foreground"}`,children:e})]},t))]}),k.length>0?(0,n.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:k.map(t=>{let s=t.split("/").pop()||t,a=e.some(e=>e.startsWith(t+"/"));return(0,n.jsxs)("button",{type:"button",onClick:()=>{f(t),r(t)},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,n.jsx)(i.A,{size:12,className:"shrink-0 text-[var(--amber)]"}),(0,n.jsx)("span",{className:"flex-1 text-left truncate",children:s}),a&&(0,n.jsx)(o.A,{size:11,className:"shrink-0 text-muted-foreground/40"})]},t)})}):(0,n.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground/50 text-center",children:"—"}),(0,n.jsx)("button",{type:"button",onClick:N,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,n.jsx)(l.A,{size:12})})]}),document.body);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:b,type:"button",onClick:()=>x(e=>!e),"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,n.jsx)(i.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,n.jsx)("span",{className:"flex-1 truncate",children:A}),(0,n.jsx)(d.A,{size:14,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${m?"rotate-180":""}`})]}),S]})}},77148:(e,t,r)=>{"use strict";r.d(t,{Un:()=>a});var n=r(12115);let s="mindos-renderer-state-change";function a(e,t,r){let a=`mindos-renderer:${e}:${t}`,o=(0,n.useRef)({key:a,raw:null,parsed:r});return o.current.key!==a&&(o.current={key:a,raw:null,parsed:r}),[(0,n.useSyncExternalStore)(e=>{let t=()=>e();return window.addEventListener("storage",t),window.addEventListener(s,t),()=>{window.removeEventListener("storage",t),window.removeEventListener(s,t)}},()=>{try{let e=localStorage.getItem(a);if(e===o.current.raw)return o.current.parsed;if(null===e)return o.current={key:a,raw:null,parsed:r},r;let t=JSON.parse(e);return o.current={key:a,raw:e,parsed:t},t}catch{return r}},()=>r),(0,n.useCallback)(e=>{try{let t=(()=>{try{let e=localStorage.getItem(a);return null!==e?JSON.parse(e):r}catch{return r}})(),n="function"==typeof e?e(t):e,s=JSON.stringify(n);localStorage.setItem(a,s),o.current={key:a,raw:s,parsed:n}}catch{}window.dispatchEvent(new Event(s))},[a,r])]}},78520:(e,t,r)=>{"use strict";r.d(t,{D4:()=>o,FB:()=>s,W8:()=>i,g4:()=>l,jQ:()=>c});let n="mindos:organize-history";function s(){try{let e=localStorage.getItem(n);if(!e)return[];return JSON.parse(e)}catch{return[]}}function a(e){try{localStorage.setItem(n,JSON.stringify(e.slice(0,50)))}catch{}}function o(e){let t=s();t.unshift(e);let r=t.slice(0,50);return a(r),r}function i(e,t){let r=s(),n=r.findIndex(t=>t.id===e);return n>=0&&(r[n]={...r[n],...t},a(r)),r}function l(){try{localStorage.removeItem(n)}catch{}}let d=0;function c(){return`org-${Date.now()}-${++d}`}},82125:(e,t,r)=>{"use strict";r.d(t,{A:()=>s,C:()=>n});let n=new Set(["INSTRUCTION.md","README.md","CONFIG.json","CHANGELOG.md"]),s=new Set(["TODO.md"])},91337:(e,t,r)=>{"use strict";r.d(t,{IX:()=>l,KW:()=>i,O0:()=>o,cn:()=>a,vr:()=>d});var n=r(29722),s=r(622);function a(...e){return(0,s.QP)((0,n.$)(e))}function o(e){return e.split("/").map(encodeURIComponent).join("/")}function i(e,t){let r=Date.now()-e,n=Math.floor(r/6e4),s=Math.floor(r/36e5),a=Math.floor(r/864e5);return n<1?t.justNow:n<60?t.minutesAgo(n):s<24?t.hoursAgo(s):a<7?t.daysAgo(a):new Date(e).toLocaleDateString()}function l(e){let t=e.match(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}]+/u);return t?.[0]??""}function d(e){return e.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||e}},97631:(e,t,r)=>{"use strict";function n(e,t){let r=e.split("\n"),n=t.split("\n"),s=r.length,a=n.length,o=Array.from({length:s+1},()=>Array(a+1).fill(0));for(let e=s-1;e>=0;e--)for(let t=a-1;t>=0;t--)o[e][t]=r[e]===n[t]?1+o[e+1][t+1]:Math.max(o[e+1][t],o[e][t+1]);let i=[],l=0,d=0;for(;l<s||d<a;){if(l<s&&d<a&&r[l]===n[d]){i.push({type:"equal",text:r[l]}),l+=1,d+=1;continue}if(d<a&&(l>=s||o[l][d+1]>=o[l+1][d])){i.push({type:"insert",text:n[d]}),d+=1;continue}i.push({type:"delete",text:r[l]}),l+=1}return i}function s(e,t=2){let r=new Set;e.forEach((n,s)=>{if("equal"!==n.type)for(let n=Math.max(0,s-t);n<=Math.min(e.length-1,s+t);n++)r.add(n)});let n=[],a=-1;for(let t=0;t<e.length;t++){if(r.has(t)){-1!==a&&(n.push({type:"gap",count:t-a}),a=-1),n.push(e[t]);continue}-1===a&&(a=t)}return -1!==a&&n.push({type:"gap",count:e.length-a}),n}r.d(t,{S:()=>s,m:()=>n})}},e=>{e.O(0,[4237,8409,9748,3013,8719,4925,5581,8252,8441,3794,7358],()=>e(e.s=50728)),_N_E=e.O()}]);