upfynai-code 3.0.4 → 3.1.0

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 (246) hide show
  1. package/README.md +66 -91
  2. package/bin/cli.js +191 -0
  3. package/{client/dist/assets/AppContent-CwrTP6TW.js → dist/client/assets/AppContent-BofJquUs.js} +4 -4
  4. package/{client/dist/assets/BrowserPanel-0TLEl-IC.js → dist/client/assets/BrowserPanel-CSvD4jOX.js} +2 -2
  5. package/dist/client/assets/CanvasFullScreen-onRfarpc.js +1 -0
  6. package/dist/client/assets/CanvasWorkspace-DvGKdL-k.js +259 -0
  7. package/dist/client/assets/DashboardPanel-DqAHbXDO.js +1 -0
  8. package/dist/client/assets/FileTree-BE0h-9M9.js +1 -0
  9. package/{client/dist/assets/GitPanel-C_xFM-N2.js → dist/client/assets/GitPanel-DdeJ0bp5.js} +2 -2
  10. package/{client/dist/assets/LoginModal-CImJHRjX.js → dist/client/assets/LoginModal-BP0pCTrH.js} +3 -3
  11. package/dist/client/assets/MermaidBlock-D0rfEhrT.js +2 -0
  12. package/dist/client/assets/Onboarding-B2zQy-_6.js +1 -0
  13. package/dist/client/assets/SetupForm-Be7-WBe-.js +1 -0
  14. package/dist/client/assets/WorkflowsPanel-CusLbVJ6.js +1 -0
  15. package/{client/dist/assets/index-HaY-3pK1.js → dist/client/assets/index-BQy15irW.js} +24 -24
  16. package/dist/client/assets/index-CS0fDqEC.js +1 -0
  17. package/dist/client/assets/index-DYLSCCCp.css +1 -0
  18. package/dist/client/assets/vendor-canvas-QWTduIvM.js +23 -0
  19. package/{client/dist/assets/vendor-icons-GyYE35HP.js → dist/client/assets/vendor-icons-kix3Gb31.js} +1 -1
  20. package/{client/dist/assets/vendor-mermaid-DucWyDEe.js → dist/client/assets/vendor-mermaid-CS3J4_Bz.js} +329 -326
  21. package/dist/client/favicon.png +0 -0
  22. package/dist/client/favicon.svg +15 -0
  23. package/{client/dist → dist/client}/index.html +3 -3
  24. package/{client/dist → dist/client}/manifest.json +12 -12
  25. package/package.json +55 -104
  26. package/scripts/postinstall.js +9 -0
  27. package/scripts/prepublish.js +77 -0
  28. package/src/animation.js +228 -0
  29. package/src/auth.js +142 -0
  30. package/src/config.js +40 -0
  31. package/src/connect.js +416 -0
  32. package/src/launch.js +81 -0
  33. package/src/mcp.js +57 -0
  34. package/src/permissions.js +140 -0
  35. package/src/persistent-shell.js +261 -0
  36. package/src/server.js +54 -0
  37. package/client/dist/assets/CanvasFullScreen-D1GWQsGL.js +0 -1
  38. package/client/dist/assets/CanvasWorkspace-D7ORj358.js +0 -163
  39. package/client/dist/assets/DashboardPanel-BV7ybUDe.js +0 -1
  40. package/client/dist/assets/FileTree-5qfhBqdE.js +0 -1
  41. package/client/dist/assets/MermaidBlock-BFM21cwe.js +0 -2
  42. package/client/dist/assets/Onboarding-B3cteLu2.js +0 -1
  43. package/client/dist/assets/SetupForm-P6dsYgHO.js +0 -1
  44. package/client/dist/assets/WorkflowsPanel-CBoN80kc.js +0 -1
  45. package/client/dist/assets/index-46kkVu2i.css +0 -1
  46. package/client/dist/assets/vendor-canvas-DvHJ_Pn2.js +0 -49
  47. package/client/dist/favicon.png +0 -0
  48. package/client/dist/favicon.svg +0 -5
  49. package/commands/upfynai-connect.md +0 -59
  50. package/commands/upfynai-disconnect.md +0 -31
  51. package/commands/upfynai-doctor.md +0 -99
  52. package/commands/upfynai-export.md +0 -49
  53. package/commands/upfynai-local.md +0 -82
  54. package/commands/upfynai-status.md +0 -75
  55. package/commands/upfynai-stop.md +0 -49
  56. package/commands/upfynai-uninstall.md +0 -58
  57. package/commands/upfynai.md +0 -69
  58. package/scripts/build-client.js +0 -17
  59. package/scripts/fix-node-pty.js +0 -67
  60. package/scripts/install-commands.js +0 -78
  61. package/server/agent-loop.js +0 -242
  62. package/server/auto-compact.js +0 -99
  63. package/server/browser.js +0 -131
  64. package/server/claude-sdk.js +0 -797
  65. package/server/cli-ui.js +0 -798
  66. package/server/cli.js +0 -751
  67. package/server/constants/config.js +0 -31
  68. package/server/cursor-cli.js +0 -270
  69. package/server/database/auth.db +0 -0
  70. package/server/database/db.js +0 -1547
  71. package/server/database/init.sql +0 -70
  72. package/server/index.js +0 -3813
  73. package/server/load-env.js +0 -26
  74. package/server/mcp-server.js +0 -621
  75. package/server/middleware/auth.js +0 -184
  76. package/server/middleware/relayHelpers.js +0 -44
  77. package/server/middleware/sandboxRouter.js +0 -174
  78. package/server/openai-codex.js +0 -403
  79. package/server/openrouter.js +0 -137
  80. package/server/projects.js +0 -1807
  81. package/server/provider-factory.js +0 -174
  82. package/server/relay-client.js +0 -390
  83. package/server/routes/agent.js +0 -1234
  84. package/server/routes/auth.js +0 -559
  85. package/server/routes/browser.js +0 -419
  86. package/server/routes/canvas.js +0 -53
  87. package/server/routes/cli-auth.js +0 -263
  88. package/server/routes/codex.js +0 -396
  89. package/server/routes/commands.js +0 -707
  90. package/server/routes/composio.js +0 -176
  91. package/server/routes/cursor.js +0 -770
  92. package/server/routes/dashboard.js +0 -295
  93. package/server/routes/git.js +0 -1208
  94. package/server/routes/keys.js +0 -34
  95. package/server/routes/mcp-utils.js +0 -48
  96. package/server/routes/mcp.js +0 -661
  97. package/server/routes/payments.js +0 -227
  98. package/server/routes/projects.js +0 -754
  99. package/server/routes/sessions.js +0 -146
  100. package/server/routes/settings.js +0 -261
  101. package/server/routes/taskmaster.js +0 -1928
  102. package/server/routes/user.js +0 -106
  103. package/server/routes/vapi-chat.js +0 -624
  104. package/server/routes/voice.js +0 -235
  105. package/server/routes/webhooks.js +0 -166
  106. package/server/routes/workflows.js +0 -312
  107. package/server/sandbox.js +0 -120
  108. package/server/services/browser-ai.js +0 -154
  109. package/server/services/composio.js +0 -204
  110. package/server/services/sessionRegistry.js +0 -139
  111. package/server/services/whisperService.js +0 -84
  112. package/server/services/workflowScheduler.js +0 -211
  113. package/server/tests/relay-flow.test.js +0 -570
  114. package/server/tests/sessions.test.js +0 -259
  115. package/server/utils/commandParser.js +0 -303
  116. package/server/utils/email.js +0 -66
  117. package/server/utils/gitConfig.js +0 -24
  118. package/server/utils/mcp-detector.js +0 -198
  119. package/server/utils/taskmaster-websocket.js +0 -129
  120. package/shared/integrationCatalog.d.ts +0 -12
  121. package/shared/integrationCatalog.js +0 -172
  122. package/shared/modelConstants.js +0 -96
  123. /package/{shared → dist}/agents/claude.js +0 -0
  124. /package/{shared → dist}/agents/codex.js +0 -0
  125. /package/{shared → dist}/agents/cursor.js +0 -0
  126. /package/{shared → dist}/agents/detect.js +0 -0
  127. /package/{shared → dist}/agents/exec.js +0 -0
  128. /package/{shared → dist}/agents/files.js +0 -0
  129. /package/{shared → dist}/agents/git.js +0 -0
  130. /package/{shared → dist}/agents/gitagent.js +0 -0
  131. /package/{shared → dist}/agents/index.js +0 -0
  132. /package/{shared → dist}/agents/shell.js +0 -0
  133. /package/{shared → dist}/agents/utils.js +0 -0
  134. /package/{client/dist → dist/client}/api-docs.html +0 -0
  135. /package/{client/dist → dist/client}/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  136. /package/{client/dist → dist/client}/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  137. /package/{client/dist → dist/client}/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  138. /package/{client/dist → dist/client}/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  139. /package/{client/dist → dist/client}/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  140. /package/{client/dist → dist/client}/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  141. /package/{client/dist → dist/client}/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  142. /package/{client/dist → dist/client}/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  143. /package/{client/dist → dist/client}/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  144. /package/{client/dist → dist/client}/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  145. /package/{client/dist → dist/client}/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  146. /package/{client/dist → dist/client}/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  147. /package/{client/dist → dist/client}/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  148. /package/{client/dist → dist/client}/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  149. /package/{client/dist → dist/client}/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  150. /package/{client/dist → dist/client}/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  151. /package/{client/dist → dist/client}/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  152. /package/{client/dist → dist/client}/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  153. /package/{client/dist → dist/client}/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  154. /package/{client/dist → dist/client}/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  155. /package/{client/dist → dist/client}/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  156. /package/{client/dist → dist/client}/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  157. /package/{client/dist → dist/client}/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  158. /package/{client/dist → dist/client}/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  159. /package/{client/dist → dist/client}/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  160. /package/{client/dist → dist/client}/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  161. /package/{client/dist → dist/client}/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  162. /package/{client/dist → dist/client}/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  163. /package/{client/dist → dist/client}/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  164. /package/{client/dist → dist/client}/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  165. /package/{client/dist → dist/client}/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  166. /package/{client/dist → dist/client}/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  167. /package/{client/dist → dist/client}/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  168. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  169. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  170. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  171. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  172. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  173. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  174. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  175. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  176. /package/{client/dist → dist/client}/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  177. /package/{client/dist → dist/client}/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  178. /package/{client/dist → dist/client}/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  179. /package/{client/dist → dist/client}/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  180. /package/{client/dist → dist/client}/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  181. /package/{client/dist → dist/client}/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  182. /package/{client/dist → dist/client}/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  183. /package/{client/dist → dist/client}/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  184. /package/{client/dist → dist/client}/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  185. /package/{client/dist → dist/client}/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  186. /package/{client/dist → dist/client}/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  187. /package/{client/dist → dist/client}/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  188. /package/{client/dist → dist/client}/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  189. /package/{client/dist → dist/client}/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  190. /package/{client/dist → dist/client}/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  191. /package/{client/dist → dist/client}/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  192. /package/{client/dist → dist/client}/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  193. /package/{client/dist → dist/client}/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  194. /package/{client/dist → dist/client}/assets/MarkdownPreview-CESjI261.js +0 -0
  195. /package/{client/dist → dist/client}/assets/PreviewPanel-CqCa92Tf.js +0 -0
  196. /package/{client/dist → dist/client}/assets/pdf-CE_K4jFx.js +0 -0
  197. /package/{client/dist → dist/client}/assets/vendor-canvas-BZV40eAE.css +0 -0
  198. /package/{client/dist → dist/client}/assets/vendor-codemirror-D2ALgpaX.js +0 -0
  199. /package/{client/dist → dist/client}/assets/vendor-diff-DNQpbhrT.js +0 -0
  200. /package/{client/dist → dist/client}/assets/vendor-i18n-DCFGyhQR.js +0 -0
  201. /package/{client/dist → dist/client}/assets/vendor-markdown-CimbIo6Y.js +0 -0
  202. /package/{client/dist → dist/client}/assets/vendor-react-96lCPsRK.js +0 -0
  203. /package/{client/dist → dist/client}/assets/vendor-syntax-LS_Nt30I.js +0 -0
  204. /package/{client/dist → dist/client}/assets/vendor-xterm-CZq1hqo1.js +0 -0
  205. /package/{client/dist → dist/client}/assets/vendor-xterm-qxJ8_QYu.css +0 -0
  206. /package/{client/dist → dist/client}/clear-cache.html +0 -0
  207. /package/{client/dist → dist/client}/convert-icons.md +0 -0
  208. /package/{client/dist → dist/client}/generate-icons.js +0 -0
  209. /package/{client/dist → dist/client}/icons/claude-ai-icon.svg +0 -0
  210. /package/{client/dist → dist/client}/icons/codex-white.svg +0 -0
  211. /package/{client/dist → dist/client}/icons/codex.svg +0 -0
  212. /package/{client/dist → dist/client}/icons/cursor-white.svg +0 -0
  213. /package/{client/dist → dist/client}/icons/cursor.svg +0 -0
  214. /package/{client/dist → dist/client}/icons/icon-128x128.png +0 -0
  215. /package/{client/dist → dist/client}/icons/icon-128x128.svg +0 -0
  216. /package/{client/dist → dist/client}/icons/icon-144x144.png +0 -0
  217. /package/{client/dist → dist/client}/icons/icon-144x144.svg +0 -0
  218. /package/{client/dist → dist/client}/icons/icon-152x152.png +0 -0
  219. /package/{client/dist → dist/client}/icons/icon-152x152.svg +0 -0
  220. /package/{client/dist → dist/client}/icons/icon-192x192.png +0 -0
  221. /package/{client/dist → dist/client}/icons/icon-192x192.svg +0 -0
  222. /package/{client/dist → dist/client}/icons/icon-384x384.png +0 -0
  223. /package/{client/dist → dist/client}/icons/icon-384x384.svg +0 -0
  224. /package/{client/dist → dist/client}/icons/icon-512x512.png +0 -0
  225. /package/{client/dist → dist/client}/icons/icon-512x512.svg +0 -0
  226. /package/{client/dist → dist/client}/icons/icon-72x72.png +0 -0
  227. /package/{client/dist → dist/client}/icons/icon-72x72.svg +0 -0
  228. /package/{client/dist → dist/client}/icons/icon-96x96.png +0 -0
  229. /package/{client/dist → dist/client}/icons/icon-96x96.svg +0 -0
  230. /package/{client/dist → dist/client}/icons/icon-template.svg +0 -0
  231. /package/{client/dist → dist/client}/logo-128.png +0 -0
  232. /package/{client/dist → dist/client}/logo-256.png +0 -0
  233. /package/{client/dist → dist/client}/logo-32.png +0 -0
  234. /package/{client/dist → dist/client}/logo-512.png +0 -0
  235. /package/{client/dist → dist/client}/logo-64.png +0 -0
  236. /package/{client/dist → dist/client}/logo.svg +0 -0
  237. /package/{client/dist → dist/client}/mcp-docs.html +0 -0
  238. /package/{client/dist → dist/client}/offline.html +0 -0
  239. /package/{client/dist → dist/client}/screenshots/cli-selection.png +0 -0
  240. /package/{client/dist → dist/client}/screenshots/desktop-main.png +0 -0
  241. /package/{client/dist → dist/client}/screenshots/mobile-chat.png +0 -0
  242. /package/{client/dist → dist/client}/screenshots/tools-modal.png +0 -0
  243. /package/{client/dist → dist/client}/sw.js +0 -0
  244. /package/{shared → dist}/gitagent/index.js +0 -0
  245. /package/{shared → dist}/gitagent/parser.js +0 -0
  246. /package/{shared → dist}/gitagent/prompt-builder.js +0 -0
@@ -1,163 +0,0 @@
1
- import{b as Ue}from"./vendor-syntax-LS_Nt30I.js";import{r as a,j as e,R as Ye}from"./vendor-react-96lCPsRK.js";import{P as Z,Q as q,R as Ce,S as Ke,T as Ge,U as Je,V as Xe,W as Ze,X as qe,Y as Qe,Z as et,_ as tt,$ as nt,a0 as ot}from"./vendor-canvas-DvHJ_Pn2.js";import{M as st,a as rt}from"./vendor-markdown-CimbIo6Y.js";import{b as Q,u as at}from"./index-HaY-3pK1.js";import"./vendor-mermaid-DucWyDEe.js";import"./vendor-icons-GyYE35HP.js";import"./vendor-i18n-DCFGyhQR.js";function it({onAddNote:o,onAddPdf:c,onRun:l,onStop:t,onClearAi:x,onAutoLayout:m,onExport:i,isRunning:b}){const h=a.useRef(null),s=a.useCallback(p=>{var y;const n=(y=p.target.files)==null?void 0:y[0];n&&n.type==="application/pdf"&&c(n),h.current&&(h.current.value="")},[c]),u=[{label:"Add Note",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),onClick:o,color:"hover:bg-blue-50 hover:text-blue-600"},{label:"Add PDF",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),onClick:()=>{var p;return(p=h.current)==null?void 0:p.click()},color:"hover:bg-red-50 hover:text-red-600"},{type:"divider"},{label:b?"Stop AI":"Run AI",icon:b?e.jsx("div",{className:"w-3 h-3 bg-red-500 rounded-sm"}):e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M8 5v14l11-7z"})}),onClick:b?t:l,color:b?"bg-red-50 text-red-600 hover:bg-red-100":"hover:bg-green-50 hover:text-green-600"},{label:"Clear AI",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),onClick:x,color:"hover:bg-gray-100 hover:text-gray-600"},{type:"divider"},{label:"Auto Layout",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 10h16M4 14h16M4 18h16"})}),onClick:m,color:"hover:bg-indigo-50 hover:text-indigo-600"},{label:"Export",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),onClick:i,color:"hover:bg-emerald-50 hover:text-emerald-600"}];return e.jsxs("div",{className:"absolute top-1/2 left-3 -translate-y-1/2 z-20",children:[e.jsx("div",{className:"bg-white/90 backdrop-blur-sm border border-gray-200 rounded-xl shadow-lg p-1.5 flex flex-col gap-1",children:u.map((p,n)=>{if("type"in p&&p.type==="divider")return e.jsx("div",{className:"h-px bg-gray-200 mx-1 my-0.5"},n);const y=p;return e.jsx("button",{onClick:y.onClick,className:`w-8 h-8 rounded-lg flex items-center justify-center text-gray-500 transition-colors ${y.color}`,title:y.label,children:y.icon},y.label)})}),e.jsx("input",{ref:h,type:"file",accept:".pdf",onChange:s,className:"hidden"})]})}const lt=a.memo(it),ae={note:{bg:"bg-blue-50",border:"border-blue-300",accent:"text-blue-600",icon:"📝"},prompt:{bg:"bg-blue-50",border:"border-blue-400",accent:"text-blue-700",icon:"💬"},response:{bg:"bg-purple-50",border:"border-purple-300",accent:"text-purple-700",icon:"🤖"},research:{bg:"bg-teal-50",border:"border-teal-300",accent:"text-teal-700",icon:"🔍"},suggestion:{bg:"bg-amber-50",border:"border-amber-300",accent:"text-amber-700",icon:"💡"},pdf:{bg:"bg-red-50",border:"border-red-300",accent:"text-red-600",icon:"📄"},summary:{bg:"bg-green-50",border:"border-green-300",accent:"text-green-700",icon:"📋"},webpage:{bg:"bg-indigo-50",border:"border-indigo-300",accent:"text-indigo-700",icon:"🌐"}};function ct({id:o,nodeType:c,data:l,selected:t,children:x,actions:m}){const i=ae[c]||ae.note;if(l.compact===!0){const h=l.status==="completed"?"bg-emerald-400":l.status==="running"?"bg-amber-400 animate-pulse":"bg-gray-300";return e.jsxs("div",{className:`
2
- rounded-xl border-2 shadow-sm w-[220px] transition-shadow cursor-pointer
3
- ${i.bg} ${i.border}
4
- ${t?"ring-2 ring-primary/40 shadow-md":"hover:shadow-md"}
5
- `,onClick:()=>{var s;return(s=l.onNodeClick)==null?void 0:s.call(l,o)},children:[e.jsx(Z,{type:"target",position:q.Top,className:"!w-2 !h-2 !bg-gray-400 !border-gray-300"}),e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:"text-sm",children:i.icon}),e.jsx("span",{className:`text-[11px] font-semibold ${i.accent} uppercase tracking-wide truncate`,children:l.label||c})]}),e.jsx("p",{className:"text-[11px] text-gray-500 truncate leading-tight",children:l.summary||(l.content||"").slice(0,60)}),e.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${h}`}),e.jsx("span",{className:"text-[10px] text-gray-400 capitalize",children:l.status||"done"})]}),e.jsx("span",{className:"text-[10px] text-gray-400 hover:text-gray-600",children:"Click to expand"})]})]}),e.jsx(Z,{type:"source",position:q.Bottom,className:"!w-2 !h-2 !bg-gray-400 !border-gray-300"})]})}return e.jsxs("div",{className:`
6
- rounded-xl border-2 shadow-sm min-w-[240px] max-w-[360px] transition-shadow
7
- ${i.bg} ${i.border}
8
- ${t?"ring-2 ring-primary/40 shadow-md":"hover:shadow-md"}
9
- `,children:[e.jsx(Z,{type:"target",position:q.Top,className:"!w-2 !h-2 !bg-gray-400 !border-gray-300"}),e.jsxs("div",{className:`flex items-center justify-between px-3 py-2 border-b ${i.border}/30`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-sm",children:i.icon}),e.jsx("span",{className:`text-xs font-semibold ${i.accent} uppercase tracking-wide`,children:l.label||c})]}),m&&e.jsx("div",{className:"flex items-center gap-1",children:m})]}),e.jsx("div",{className:"px-3 py-2 text-xs text-gray-700 leading-relaxed whitespace-pre-wrap break-words max-h-[300px] overflow-y-auto",children:x||l.content||""}),e.jsx(Z,{type:"source",position:q.Bottom,className:"!w-2 !h-2 !bg-gray-400 !border-gray-300"})]})}const G=a.memo(ct);function dt({node:o,onClose:c,onPin:l,onDelete:t}){var s,u,p;a.useEffect(()=>{if(!o)return;const n=y=>{y.key==="Escape"&&c()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[o,c]);const x=a.useCallback(()=>{var y,v;if(!o)return;const n=String(((y=o.data)==null?void 0:y.fullContent)||((v=o.data)==null?void 0:v.content)||"");navigator.clipboard.writeText(n).catch(()=>{})},[o]);if(!o)return null;const m=o.type||"response",i=ae[m]||ae.note,b=String(((s=o.data)==null?void 0:s.fullContent)||((u=o.data)==null?void 0:u.content)||""),h=String(((p=o.data)==null?void 0:p.label)||m);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/20 z-40",onClick:c}),e.jsxs("div",{className:"fixed top-0 right-0 h-full w-[420px] max-w-[90vw] bg-white shadow-2xl z-50 flex flex-col animate-in slide-in-from-right duration-200",children:[e.jsxs("div",{className:`flex items-center justify-between px-4 py-3 border-b ${i.bg}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:i.icon}),e.jsx("span",{className:`text-sm font-semibold ${i.accent} uppercase tracking-wide`,children:h})]}),e.jsx("button",{onClick:c,className:"p-1 rounded-lg hover:bg-black/10 text-gray-500 transition-colors",title:"Close (Esc)",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4",children:e.jsx("div",{className:"prose prose-sm max-w-none text-gray-700",children:e.jsx(st,{remarkPlugins:[rt],children:b})})}),e.jsxs("div",{className:"border-t px-4 py-3 flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{l(o.id),c()},className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg bg-primary/10 text-primary text-xs font-medium hover:bg-primary/20 transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"})}),"Pin to Canvas"]}),e.jsxs("button",{onClick:x,className:"flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg bg-gray-100 text-gray-600 text-xs font-medium hover:bg-gray-200 transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]}),e.jsxs("button",{onClick:()=>{t(o.id),c()},className:"flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg bg-red-50 text-red-500 text-xs font-medium hover:bg-red-100 transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete"]})]})]})]})}const ut=a.memo(dt),pt=`
10
- (function() {
11
- let selectedEl = null;
12
- let hoverEl = null;
13
-
14
- const highlight = document.createElement('style');
15
- highlight.textContent = \`
16
- .__upfyn-hover { outline: 2px dashed #6366f1 !important; outline-offset: 2px; cursor: pointer; }
17
- .__upfyn-selected { outline: 2px solid #6366f1 !important; outline-offset: 2px; }
18
- \`;
19
- document.head.appendChild(highlight);
20
-
21
- document.addEventListener('mouseover', function(e) {
22
- if (hoverEl && hoverEl !== selectedEl) hoverEl.classList.remove('__upfyn-hover');
23
- if (e.target === document.body || e.target === document.documentElement) return;
24
- hoverEl = e.target;
25
- if (hoverEl !== selectedEl) hoverEl.classList.add('__upfyn-hover');
26
- }, true);
27
-
28
- document.addEventListener('mouseout', function(e) {
29
- if (hoverEl && hoverEl !== selectedEl) hoverEl.classList.remove('__upfyn-hover');
30
- }, true);
31
-
32
- document.addEventListener('click', function(e) {
33
- e.preventDefault();
34
- e.stopPropagation();
35
-
36
- if (selectedEl) selectedEl.classList.remove('__upfyn-selected');
37
- selectedEl = e.target;
38
- selectedEl.classList.add('__upfyn-selected');
39
-
40
- // Build CSS selector path
41
- function getSelector(el) {
42
- if (el.id) return '#' + el.id;
43
- let path = el.tagName.toLowerCase();
44
- if (el.className && typeof el.className === 'string') {
45
- const classes = el.className.split(' ').filter(c => !c.startsWith('__upfyn')).slice(0, 2).join('.');
46
- if (classes) path += '.' + classes;
47
- }
48
- return path;
49
- }
50
-
51
- const rect = selectedEl.getBoundingClientRect();
52
- window.parent.postMessage({
53
- type: 'upfyn-element-selected',
54
- outerHTML: selectedEl.outerHTML,
55
- tagName: selectedEl.tagName,
56
- selector: getSelector(selectedEl),
57
- rect: { top: rect.top, left: rect.left, width: rect.width, height: rect.height }
58
- }, '*');
59
- }, true);
60
-
61
- // Listen for HTML replacement from parent
62
- window.addEventListener('message', function(e) {
63
- if (e.data?.type === 'upfyn-replace-element' && selectedEl) {
64
- const temp = document.createElement('div');
65
- temp.innerHTML = e.data.newHTML;
66
- const newEl = temp.firstElementChild || temp.firstChild;
67
- if (newEl) {
68
- selectedEl.classList.remove('__upfyn-selected');
69
- selectedEl.replaceWith(newEl);
70
- selectedEl = newEl;
71
- selectedEl.classList.add('__upfyn-selected');
72
-
73
- // Send updated full HTML back
74
- window.parent.postMessage({
75
- type: 'upfyn-html-updated',
76
- fullHTML: document.documentElement.outerHTML
77
- }, '*');
78
- }
79
- }
80
-
81
- if (e.data?.type === 'upfyn-deselect' && selectedEl) {
82
- selectedEl.classList.remove('__upfyn-selected');
83
- selectedEl = null;
84
- }
85
- });
86
- })();
87
- `;function mt({html:o,pageName:c,nodeId:l,onClose:t,onHtmlChange:x,sendMessage:m,latestMessage:i}){const b=a.useRef(null),[h,s]=a.useState(!1),[u,p]=a.useState(o),[n,y]=a.useState(null),[v,S]=a.useState(""),[_,M]=a.useState(!1),P=a.useRef(null),H=a.useRef(""),A=a.useCallback(N=>{const $=b.current;if(!$)return;const w=$.contentDocument;if(!w)return;const L=N.replace("</body>",`<script>${pt}<\/script></body>`);w.open(),w.write(L),w.close(),p(N)},[]);a.useEffect(()=>{const N=setTimeout(()=>A(o),100);return()=>clearTimeout(N)},[o]),a.useEffect(()=>{const N=$=>{var w,L;if(((w=$.data)==null?void 0:w.type)==="upfyn-element-selected"&&(y({outerHTML:$.data.outerHTML,tagName:$.data.tagName,selector:$.data.selector,rect:$.data.rect}),S(""),setTimeout(()=>{var j;return(j=P.current)==null?void 0:j.focus()},100)),((L=$.data)==null?void 0:L.type)==="upfyn-html-updated"){let j=$.data.fullHTML;j=j.replace(/<style>[^<]*__upfyn[^<]*<\/style>/g,""),j=j.replace(/<script>[^]*?<\/script>\s*<\/body>/,"</body>"),j=j.replace(/ class="__upfyn-[^"]*"/g,""),j=j.replace(/ class=""/g,""),p(j),x(l,j)}};return window.addEventListener("message",N),()=>window.removeEventListener("message",N)},[l,x]),a.useEffect(()=>{var N,$;if(!(!i||!_)){if(i.type==="claude-response"||i.type==="assistant"){const w=i.content||i.text||i.message||"";w&&(H.current+=w)}if(i.type==="claude-complete"||i.type==="message_stop"){const w=H.current.trim();if(w){let L=w;const j=w.match(/```html?\s*\n([\s\S]*?)```/);j&&(L=j[1].trim()),($=(N=b.current)==null?void 0:N.contentWindow)==null||$.postMessage({type:"upfyn-replace-element",newHTML:L},"*")}M(!1),H.current=""}}},[i,_]);const J=a.useCallback(()=>{const N=v.trim();if(!N||!m||!n||_)return;const $=`You are editing an HTML element inline on a web page. Return ONLY the updated HTML element — no explanation, no markdown, just the raw HTML.
88
-
89
- Current element (${n.tagName}):
90
- \`\`\`html
91
- ${n.outerHTML}
92
- \`\`\`
93
-
94
- User instruction: ${N}
95
-
96
- Return the updated HTML element:`;H.current="",M(!0),m({type:"claude-command",command:$,options:{canvasMode:!0}})},[v,m,n,_]);a.useEffect(()=>{const N=$=>{var w,L;$.key==="Escape"&&(n?((L=(w=b.current)==null?void 0:w.contentWindow)==null||L.postMessage({type:"upfyn-deselect"},"*"),y(null)):t())};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[n,t]);const V=a.useCallback(()=>{A(u),x(l,u),s(!1)},[u,l,x,A]);return e.jsxs("div",{className:"fixed inset-0 z-50 bg-white flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-gray-50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg hover:bg-gray-200 text-sm text-gray-600 transition-colors",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})}),"Back to Canvas"]}),e.jsx("span",{className:"text-sm font-medium text-gray-800",children:c})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>s(!h),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${h?"bg-indigo-100 text-indigo-700":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:h?"</> Code":"</> View Code"}),n&&e.jsxs("span",{className:"text-xs text-indigo-500 bg-indigo-50 px-2 py-1 rounded",children:["Selected: <",n.tagName.toLowerCase(),">"]})]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:`relative ${h?"w-1/2":"w-full"}`,children:[e.jsx("iframe",{ref:b,className:"w-full h-full border-none",sandbox:"allow-scripts allow-same-origin",title:c}),n&&e.jsx("div",{className:"absolute z-30 animate-in fade-in duration-150",style:{top:Math.min(n.rect.top+n.rect.height+8,window.innerHeight-120),left:Math.max(8,Math.min(n.rect.left,window.innerWidth-360))},children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl border border-indigo-200 p-2 w-[340px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{ref:P,type:"text",value:v,onChange:N=>S(N.target.value),onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),J())},placeholder:`Change this ${n.tagName.toLowerCase()}...`,className:"flex-1 text-sm border border-gray-200 rounded-lg px-3 py-2 outline-none focus:border-indigo-400",disabled:_}),e.jsx("button",{onClick:J,disabled:!v.trim()||_,className:"shrink-0 w-8 h-8 rounded-lg bg-indigo-500 text-white flex items-center justify-center disabled:opacity-40 hover:bg-indigo-600 transition-colors",children:_?e.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 7l5 5m0 0l-5 5m5-5H6"})})})]}),_&&e.jsx("p",{className:"text-[10px] text-indigo-400 mt-1 px-1",children:"AI is editing this element..."})]})})]}),h&&e.jsxs("div",{className:"w-1/2 border-l flex flex-col",children:[e.jsxs("div",{className:"px-3 py-2 border-b bg-gray-800 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-gray-300 font-mono",children:"HTML Source"}),e.jsx("button",{onClick:V,className:"px-3 py-1 rounded text-xs font-medium bg-indigo-500 text-white hover:bg-indigo-600 transition-colors",children:"Apply Changes"})]}),e.jsx("textarea",{value:u,onChange:N=>p(N.target.value),className:"flex-1 bg-gray-900 text-green-300 font-mono text-xs p-4 resize-none outline-none leading-relaxed",spellCheck:!1})]})]}),e.jsx("div",{className:"px-4 py-1.5 border-t bg-gray-50 text-[10px] text-gray-400",children:"Click any element to select it, then type your change. Press Esc to deselect or close."})]})}const ht=a.memo(mt);function xt({nodes:o,projectName:c,onClose:l}){const[t,x]=a.useState("website"),[m,i]=a.useState("exported-site"),[b,h]=a.useState(!1),[s,u]=a.useState(null),[p,n]=a.useState(!1),y=o.filter(P=>P.selected),v=(p&&y.length>0?y:o).filter(P=>P.type==="webpage"),S=(p&&y.length>0?y:o).filter(P=>P.type&&["response","research","suggestion","note","summary"].includes(P.type)),_=t==="website"?v.length:S.length,M=a.useCallback(async()=>{var P,H,A,J,V,N,$;h(!0),u(null);try{if(t==="website"){const w=[];for(let j=0;j<v.length;j++){const B=v[j],te=String(((P=B.data)==null?void 0:P.pageName)||((H=B.data)==null?void 0:H.label)||`page-${j+1}`).toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")+".html",ie=String(((A=B.data)==null?void 0:A.html)||((J=B.data)==null?void 0:J.content)||"");w.push({name:te,content:ie})}let L=0;for(const j of w)try{const B=`${m}/${j.name}`;await Q.saveFile(c,B,j.content),L++}catch{}if(w.length>1&&!w.some(j=>j.name==="index.html")){const j=`<!DOCTYPE html>
97
- <html lang="en">
98
- <head>
99
- <meta charset="UTF-8">
100
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
101
- <title>Site Index</title>
102
- <style>
103
- body { font-family: system-ui, sans-serif; max-width: 600px; margin: 40px auto; padding: 0 20px; }
104
- h1 { color: #1f2937; }
105
- ul { list-style: none; padding: 0; }
106
- li { margin: 8px 0; }
107
- a { color: #4f46e5; text-decoration: none; padding: 8px 16px; border: 1px solid #e5e7eb; border-radius: 8px; display: inline-block; }
108
- a:hover { background: #eef2ff; }
109
- </style>
110
- </head>
111
- <body>
112
- <h1>Pages</h1>
113
- <ul>
114
- ${w.map(B=>`<li><a href="${B.name}">${B.name.replace(".html","")}</a></li>`).join(`
115
- `)}
116
- </ul>
117
- </body>
118
- </html>`;try{await Q.saveFile(c,`${m}/index.html`,j),L++}catch{}}u({ok:L>0,message:L>0?`Exported ${L} file(s) to ${m}/`:"Export failed — make sure a machine is connected"})}else{let w=0;for(let L=0;L<S.length;L++){const j=S[L],B=String(((V=j.data)==null?void 0:V.label)||j.type||`note-${L+1}`),ee=B.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")+".md",te=String(((N=j.data)==null?void 0:N.fullContent)||(($=j.data)==null?void 0:$.content)||"");try{await Q.saveFile(c,`${m}/${ee}`,`# ${B}
119
-
120
- ${te}`),w++}catch{}}u({ok:w>0,message:w>0?`Exported ${w} file(s) to ${m}/`:"Export failed — make sure a machine is connected"})}}catch{u({ok:!1,message:"Export failed — check your connection"})}finally{h(!1)}},[t,v,S,m,c]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 bg-black/30 z-40",onClick:l}),e.jsxs("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 w-[400px] max-w-[90vw] bg-white rounded-2xl shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:"Export Canvas"}),e.jsx("button",{onClick:l,className:"p-1 rounded hover:bg-gray-100 text-gray-400",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-gray-600 block mb-1.5",children:"Scope"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>n(!1),className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium border transition-colors ${p?"border-gray-200 text-gray-500 hover:bg-gray-50":"bg-indigo-50 border-indigo-300 text-indigo-700"}`,children:"All nodes"}),e.jsxs("button",{onClick:()=>n(!0),disabled:y.length===0,className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium border transition-colors disabled:opacity-40 ${p?"bg-indigo-50 border-indigo-300 text-indigo-700":"border-gray-200 text-gray-500 hover:bg-gray-50"}`,children:["Selected (",y.length,")"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-gray-600 block mb-1.5",children:"Format"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>x("website"),className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium border transition-colors ${t==="website"?"bg-indigo-50 border-indigo-300 text-indigo-700":"border-gray-200 text-gray-500 hover:bg-gray-50"}`,children:["Website (",v.length," pages)"]}),e.jsxs("button",{onClick:()=>x("markdown"),className:`flex-1 px-3 py-2 rounded-lg text-xs font-medium border transition-colors ${t==="markdown"?"bg-indigo-50 border-indigo-300 text-indigo-700":"border-gray-200 text-gray-500 hover:bg-gray-50"}`,children:["Markdown (",S.length," notes)"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-gray-600 block mb-1.5",children:"Target folder"}),e.jsx("input",{type:"text",value:m,onChange:P=>i(P.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm outline-none focus:border-indigo-400",placeholder:"exported-site"}),e.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"Relative to project root on connected machine"})]}),s&&e.jsx("div",{className:`px-3 py-2 rounded-lg text-xs ${s.ok?"bg-emerald-50 text-emerald-700":"bg-red-50 text-red-600"}`,children:s.message})]}),e.jsxs("div",{className:"px-5 py-3 border-t flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] text-gray-400",children:[_," item(s) will be exported"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:l,className:"px-4 py-2 rounded-lg text-xs font-medium text-gray-500 hover:bg-gray-100 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:M,disabled:b||_===0,className:"px-4 py-2 rounded-lg text-xs font-medium bg-indigo-500 text-white hover:bg-indigo-600 disabled:opacity-40 transition-colors flex items-center gap-1.5",children:b?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Exporting..."]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Export"]})})]})]})]})]})}const gt=a.memo(xt);function ft({id:o,data:c,selected:l}){const t=c,[x,m]=a.useState(!1),[i,b]=a.useState(String(t.content||"")),h=a.useCallback(()=>{var u;m(!1),(u=t.onEdit)==null||u.call(t,o)},[o,t]),s=e.jsxs(e.Fragment,{children:[!x&&e.jsx("button",{onClick:()=>m(!0),className:"p-0.5 rounded hover:bg-blue-100 text-blue-500 transition-colors",title:"Edit",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),t.onDelete&&e.jsx("button",{onClick:()=>t.onDelete(o),className:"p-0.5 rounded hover:bg-red-100 text-red-400 transition-colors",title:"Delete",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]});return e.jsx(G,{id:o,nodeType:"note",data:t,selected:l,actions:s,children:x?e.jsx("textarea",{autoFocus:!0,value:i,onChange:u=>b(u.target.value),onBlur:h,onKeyDown:u=>{u.key==="Escape"&&h()},className:"w-full bg-white/70 border border-blue-200 rounded px-2 py-1 text-xs resize-none min-h-[60px] outline-none focus:border-blue-400",rows:4}):e.jsx("div",{className:"cursor-text",onDoubleClick:()=>m(!0),children:i||e.jsx("span",{className:"text-gray-400 italic",children:"Double-click to edit..."})})})}const bt=a.memo(ft);function yt({id:o,data:c,selected:l}){const t=c,x=e.jsxs(e.Fragment,{children:[t.onRun&&e.jsx("button",{onClick:()=>t.onRun(o,String(t.content||"")),className:"p-0.5 rounded hover:bg-blue-100 text-blue-600 transition-colors",title:"Run this prompt",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M8 5v14l11-7z"})})}),t.onRerun&&e.jsx("button",{onClick:()=>t.onRerun(o,String(t.content||"")),className:"p-0.5 rounded hover:bg-green-100 text-green-600 transition-colors",title:"Rerun — send this prompt again",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),t.onDelete&&e.jsx("button",{onClick:()=>t.onDelete(o),className:"p-0.5 rounded hover:bg-red-100 text-red-400 transition-colors",title:"Delete",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]});return e.jsx(G,{id:o,nodeType:"prompt",data:t,selected:l,actions:x})}const vt=a.memo(yt);function wt({id:o,data:c,selected:l}){const t=c,x=a.useCallback(()=>{const i=String(t.fullContent||t.content||"");navigator.clipboard.writeText(i).catch(()=>{})},[t.fullContent,t.content]);if(t.compact)return e.jsx(G,{id:o,nodeType:"response",data:t,selected:l});const m=e.jsxs(e.Fragment,{children:[t.onBranch&&e.jsx("button",{onClick:()=>t.onBranch(o),className:"p-0.5 rounded hover:bg-purple-100 text-purple-500 transition-colors",title:"Branch — create new prompt from this",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})})}),e.jsx("button",{onClick:x,className:"p-0.5 rounded hover:bg-purple-100 text-purple-400 transition-colors",title:"Copy content",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]});return e.jsx(G,{id:o,nodeType:"response",data:t,selected:l,actions:m})}const jt=a.memo(wt);function kt({id:o,data:c,selected:l}){const t=c,x=a.useCallback(()=>{const i=t.extractedText||t.content||"";navigator.clipboard.writeText(String(i)).catch(()=>{})},[t]),m=e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:x,className:"p-0.5 rounded hover:bg-red-100 text-red-400 transition-colors",title:"Copy extracted text",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),t.onDelete&&e.jsx("button",{onClick:()=>t.onDelete(o),className:"p-0.5 rounded hover:bg-red-100 text-red-400 transition-colors",title:"Delete",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]});return e.jsx(G,{id:o,nodeType:"pdf",data:{...t,label:t.fileName||"PDF"},selected:l,actions:m,children:e.jsxs("div",{className:"space-y-2",children:[t.thumbnail&&e.jsx("img",{src:t.thumbnail,alt:"PDF preview",className:"w-full rounded border border-red-200"}),t.pageCount&&e.jsxs("div",{className:"text-[10px] text-red-400",children:[t.pageCount," page",t.pageCount>1?"s":""]}),e.jsxs("div",{className:"text-xs text-gray-600 max-h-[200px] overflow-y-auto",children:[(t.extractedText||t.content||"").toString().slice(0,500),(t.extractedText||t.content||"").toString().length>500&&"..."]})]})})}const Nt=a.memo(kt);function Ct({id:o,data:c,selected:l}){const t=c,x=a.useRef(null),[m,i]=a.useState(!1),b=ae.webpage;return a.useEffect(()=>{const h=x.current;if(!h||!t.html)return;const s=()=>i(!0);h.addEventListener("load",s);const u=h.contentDocument;return u&&(u.open(),u.write(t.html),u.close(),i(!0)),()=>h.removeEventListener("load",s)},[t.html]),e.jsxs("div",{className:`
121
- rounded-xl border-2 shadow-sm w-[240px] transition-shadow cursor-pointer
122
- ${b.bg} ${b.border}
123
- ${l?"ring-2 ring-primary/40 shadow-md":"hover:shadow-md"}
124
- `,onClick:()=>{var h;return(h=t.onWebPageClick)==null?void 0:h.call(t,o)},children:[e.jsx(Z,{type:"target",position:q.Left,className:"!w-2 !h-2 !bg-indigo-400 !border-indigo-300"}),t.pageIndex&&e.jsx("div",{className:"absolute -top-2 -left-2 w-5 h-5 rounded-full bg-indigo-500 text-white text-[10px] font-bold flex items-center justify-center shadow",children:t.pageIndex}),e.jsx("div",{className:"w-full h-[150px] overflow-hidden rounded-t-lg bg-white relative",children:t.html?e.jsx("div",{className:"w-[960px] h-[600px] origin-top-left",style:{transform:"scale(0.25)"},children:e.jsx("iframe",{ref:x,className:"w-full h-full border-none pointer-events-none",sandbox:"allow-same-origin",title:t.pageName||"Page preview"})}):e.jsx("div",{className:"flex items-center justify-center h-full text-gray-300",children:e.jsx("svg",{className:"w-8 h-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})})})}),e.jsxs("div",{className:"px-3 py-2 border-t border-indigo-200/50",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-sm",children:b.icon}),e.jsx("span",{className:"text-[11px] font-semibold text-indigo-700 truncate",children:t.pageName||t.label||"Page"})]}),e.jsx("p",{className:"text-[10px] text-gray-400 mt-0.5",children:"Click to edit"})]}),e.jsx(Z,{type:"source",position:q.Right,className:"!w-2 !h-2 !bg-indigo-400 !border-indigo-300"})]})}const Et=a.memo(Ct),xe=280,Ee=150;function Lt(o,c,l="TB"){var x,m;if(o.length===0)return o;const t=new Ce.graphlib.Graph;t.setGraph({rankdir:l,nodesep:60,ranksep:100,marginx:40,marginy:40}),t.setDefaultEdgeLabel(()=>({}));for(const i of o)t.setNode(i.id,{width:((x=i.measured)==null?void 0:x.width)||i.width||xe,height:((m=i.measured)==null?void 0:m.height)||i.height||Ee});for(const i of c)t.setEdge(i.source,i.target);return Ce.layout(t),o.map(i=>{var u,p;const b=t.node(i.id);if(!b)return i;const h=((u=i.measured)==null?void 0:u.width)||i.width||xe,s=((p=i.measured)==null?void 0:p.height)||i.height||Ee;return{...i,position:{x:b.x-h/2,y:b.y-s/2}}})}new Ke;function U(o,c,l={dx:320,dy:0}){var m;if(c){const i=o.find(b=>b.id===c);if(i)return{x:i.position.x+l.dx,y:i.position.y+l.dy}}if(o.length===0)return{x:100,y:100};let t=-1/0,x=1/0;for(const i of o){const b=((m=i.measured)==null?void 0:m.width)||i.width||xe,h=i.position.x+b;h>t&&(t=h),i.position.y<x&&(x=i.position.y)}return{x:t+80,y:x}}function K(o,c){return o.length<=c?o:o.slice(0,c)+"..."}function ue(o,c){var x,m,i,b,h,s;if(o.length===0)return"Canvas is empty.";const l=[`## Canvas Context
125
- `],t=new Map;for(const u of o){const p=u.type||"note";t.has(p)||t.set(p,[]),t.get(p).push(u)}l.push("### Blocks:");for(const u of o){const p=u.type||"note",n=((x=u.data)==null?void 0:x.content)||((m=u.data)==null?void 0:m.label)||"",y=K(String(n),120);l.push(`- [${p} at (${Math.round(u.position.x)}, ${Math.round(u.position.y)})]: "${y}"`)}if(l.push(""),c.length>0){l.push("### Connections:");for(const u of c){const p=o.find(S=>S.id===u.source),n=o.find(S=>S.id===u.target),y=K(String(((i=p==null?void 0:p.data)==null?void 0:i.content)||(p==null?void 0:p.type)||"unknown"),40),v=K(String(((b=n==null?void 0:n.data)==null?void 0:b.content)||(n==null?void 0:n.type)||"unknown"),40);l.push(`- "${y}" → "${v}"`)}l.push("")}if(o.length>1){const u=[...o].sort((y,v)=>y.position.x-v.position.x||y.position.y-v.position.y),p=u[0],n=u[u.length-1];l.push("### Spatial Layout:"),l.push(`- Leftmost: ${p.type} ("${K(String(((h=p.data)==null?void 0:h.content)||""),30)}")`),l.push(`- Rightmost: ${n.type} ("${K(String(((s=n.data)==null?void 0:s.content)||""),30)}")`),l.push(`- Total nodes: ${o.length}`),l.push("")}return l.join(`
126
- `)}function Le(o,c,l){var i,b,h,s;if(c.size===0)return null;const t=o.filter(u=>c.has(u.id));if(t.length===0)return null;const x=[`## Selected Items Context
127
- `];for(const u of t){const p=((i=u.data)==null?void 0:i.content)||((b=u.data)==null?void 0:b.label)||"";x.push(`- [${u.type}]: "${K(String(p),150)}"`)}const m=l.filter(u=>c.has(u.source)&&c.has(u.target));if(m.length>0){x.push(`
128
- ### Connections:`);for(const u of m){const p=t.find(y=>y.id===u.source),n=t.find(y=>y.id===u.target);x.push(`- "${K(String(((h=p==null?void 0:p.data)==null?void 0:h.content)||""),40)}" → "${K(String(((s=n==null?void 0:n.data)==null?void 0:s.content)||""),40)}"`)}}return x.join(`
129
- `)}function St(o){const c=[],l=o.split(`
130
- `);let t="response",x="",m=[],i=!1,b="";const h=[];let s=null,u="";const p=()=>{const n=m.join(`
131
- `).trim();n&&c.push({type:t,heading:x,content:n}),m=[]};for(const n of l){if(n.trim().startsWith("```")){if(i){if(s!==null){h.push({heading:u,html:s.join(`
132
- `)}),s=null,i=!1,b="";continue}i=!1,b=""}else if(i=!0,b=n.trim().slice(3).trim().toLowerCase(),b==="html"||b==="htm"){s=[],u=x||`Page ${h.length+1}`;continue}m.push(n);continue}if(s!==null){s.push(n);continue}if(i){m.push(n);continue}if(n.startsWith("## ")||n.startsWith("### ")){p();const y=n.replace(/^#{2,3}\s+/,"").trim();x=y;const v=y.toLowerCase();v.includes("research")||v.includes("analysis")||v.includes("finding")?t="research":v.includes("suggestion")||v.includes("idea")||v.includes("recommendation")?t="suggestion":t="response";continue}if(n.startsWith("> ")){t!=="suggestion"&&(p(),t="suggestion",x=x||"Suggestion"),m.push(n.slice(2));continue}m.push(n)}p();for(const n of h)c.push({type:"webpage",heading:n.heading,content:n.html});return c}let $t=0;function Se(){return`canvas_${Date.now()}_${++$t}`}function Tt(o,c,l,t){const x=St(o),m=[],i=[],b=x.filter(n=>n.type!=="webpage"),h=x.filter(n=>n.type==="webpage");let s=l;const u=15;for(const n of b){const y=Se(),v=n.content.split(`
133
- `)[0].slice(0,60);m.push({id:y,type:n.type,position:{x:c,y:s},data:{label:n.heading||n.type,content:n.content.length>800?n.content.slice(0,800)+`
134
- ...`:n.content,fullContent:n.content,summary:v,compact:!0,status:"completed"}}),s+=100+u}if(h.length>0){let n=c;const y=b.length>0?s+60:l,v=40;let S=null;for(let _=0;_<h.length;_++){const M=h[_],P=Se(),H=M.content.match(/<title[^>]*>([^<]+)<\/title>/i),A=H?H[1]:M.heading;m.push({id:P,type:"webpage",position:{x:n,y},data:{label:A,content:M.content,html:M.content,pageName:A,pageIndex:_+1}}),S&&i.push({id:`e_${S}_${P}`,source:S,target:P,type:"smoothstep",style:{strokeDasharray:"5,5"}}),S=P,n+=280+v}}t&&m.length>0&&i.push({id:`e_${t}_${m[0].id}`,source:t,target:m[0].id,animated:!0});const p=m.filter(n=>n.type!=="webpage");for(let n=0;n<p.length-1;n++)i.push({id:`e_${p[n].id}_${p[n+1].id}`,source:p[n].id,target:p[n+1].id});if(p.length>0&&h.length>0){const n=m.filter(y=>y.type==="webpage");n.length>0&&i.push({id:`e_${p[p.length-1].id}_${n[0].id}`,source:p[p.length-1].id,target:n[0].id,style:{strokeDasharray:"5,5"}})}return{nodes:m,edges:i}}const pe=`You are a visual AI assistant working on an infinite canvas. The user has drawn elements on the canvas and is asking you to analyze and respond.
135
-
136
- IMPORTANT: Structure your response using markdown headings so it can be rendered as visual blocks:
137
- - Use ## headings to separate major sections
138
- - Use ### Research: or ### Analysis: for research/analysis sections
139
- - Use ### Suggestions: or ### Ideas: for suggestion sections
140
- - Use > blockquotes for key insights or recommendations
141
- - Keep each section concise (2-4 sentences or bullet points)
142
- - Be visual and structured — your response will appear as blocks on the canvas
143
- - If asked to create web pages/websites, output each page as a separate \`\`\`html code block with a heading for the page name
144
-
145
- Here is the current canvas context:
146
-
147
- `,Dt=2e3;function Rt(o){return e.jsx(G,{id:o.id,nodeType:"research",data:o.data,selected:o.selected})}function _t(o){return e.jsx(G,{id:o.id,nodeType:"suggestion",data:o.data,selected:o.selected})}function Pt(o){return e.jsx(G,{id:o.id,nodeType:"summary",data:o.data,selected:o.selected})}const Mt={note:bt,prompt:vt,response:jt,research:Rt,suggestion:_t,pdf:Nt,summary:Pt,webpage:Et};let Wt=0;function Y(){return`n_${Date.now()}_${++Wt}`}function Bt(o){var t,x,m,i,b,h;const c=[],l=[];if(!Array.isArray(o)||o.length===0)return{nodes:c,edges:l};if(((x=(t=o[0])==null?void 0:t.position)==null?void 0:x.x)!==void 0)return{nodes:o.filter(s=>!s.source),edges:o.filter(s=>s.source)};if(o.length===1&&((m=o[0])!=null&&m.nodes)&&((i=o[0])!=null&&i.edges))return{nodes:o[0].nodes,edges:o[0].edges};for(const s of o)if(((b=s.customData)==null?void 0:b.blockType)==="context-link")l.push({id:`e_${s.customData.sourceId}_${s.customData.targetId}`,source:s.customData.sourceId,target:s.customData.targetId});else if((h=s.customData)!=null&&h.blockType&&s.type==="rectangle"){const u=s.customData.blockType,p=["note","prompt","response","research","suggestion","pdf","summary","webpage"];c.push({id:s.id,type:p.includes(u)?u:"note",position:{x:s.x||0,y:s.y||0},data:{label:s.customData.fileName||u,content:s.customData.content||s.customData.extractedText||s.customData.generatedContent||"",...s.customData.fileName&&{fileName:s.customData.fileName},...s.customData.pageCount&&{pageCount:s.customData.pageCount},...s.customData.extractedText&&{extractedText:s.customData.extractedText},...s.customData.thumbnail&&{thumbnail:s.customData.thumbnail}}})}return{nodes:c,edges:l}}function At({projectName:o,sendMessage:c,latestMessage:l,isFullScreen:t}){var we,je,ke,Ne;const{connectionState:x}=at(),{fitView:m,getViewport:i,setViewport:b}=Je(),[h,s,u]=Xe([]),[p,n,y]=Ze([]),[v,S]=a.useState(!1),[_,M]=a.useState("saved"),[P,H]=a.useState(!0),[A,J]=a.useState(!1),[V,N]=a.useState(""),[$,w]=a.useState([]),[L,j]=a.useState(null),[B,ee]=a.useState(null),[te,ie]=a.useState(!1),ne=a.useRef(null),le=a.useRef(""),oe=a.useRef(null),me=a.useRef(o);me.current=o;const O=a.useRef(""),z=a.useRef(null),ge=a.useRef(null),ce=a.useRef(null),T=a.useRef([]),F=a.useRef([]);T.current=h,F.current=p;const $e=a.useMemo(()=>L&&T.current.find(r=>r.id===L)||null,[L,h]),fe=a.useCallback(r=>{j(r)},[]),be=a.useCallback(r=>{ee(r)},[]),Te=a.useCallback((r,d)=>{s(f=>f.map(g=>g.id===r?{...g,data:{...g.data,html:d,content:d}}:g))},[s]),X=a.useMemo(()=>B&&T.current.find(r=>r.id===B)||null,[B,h]),De=a.useCallback(r=>{var E,k,D,I,R;const d=T.current.find(W=>W.id===r);if(!d)return;const f=Y(),g={id:f,type:d.type||"response",position:{x:(((E=d.position)==null?void 0:E.x)||0)+260,y:((k=d.position)==null?void 0:k.y)||0},data:{...d.data,label:`${((D=d.data)==null?void 0:D.label)||"Response"} (pinned)`,content:String(((I=d.data)==null?void 0:I.fullContent)||((R=d.data)==null?void 0:R.content)||""),compact:!1,summary:void 0,fullContent:void 0}},C={id:`e_pin_${r}_${f}`,source:r,target:f,style:{strokeDasharray:"5,5",stroke:"#a78bfa"},type:"smoothstep"};s(W=>[...W,g]),n(W=>[...W,C])},[s,n]),Re=a.useCallback(r=>{s(d=>d.filter(f=>f.id!==r)),n(d=>d.filter(f=>f.source!==r&&f.target!==r))},[s,n]),ye=a.useCallback((r,d)=>{if(!c||v)return;const f=F.current.filter(k=>k.source===r),g=new Set(f.map(k=>k.target));s(k=>k.filter(D=>!g.has(D.id))),n(k=>k.filter(D=>D.source!==r||!g.has(D.target))),z.current=r;const C=ue(T.current,F.current),E=pe+C+`
148
-
149
- User prompt: `+d;O.current="",S(!0),w(k=>[...k,{role:"user",text:`(rerun) ${d}`}]),c({type:"claude-command",command:E,options:{canvasMode:!0,blockId:r}})},[c,v,s,n]),_e=a.useMemo(()=>h.map(r=>({...r,data:{...r.data,onDelete:d=>s(f=>f.filter(g=>g.id!==d)),onRun:(d,f)=>he(f,d),onRerun:(d,f)=>ye(d,f),onBranch:d=>Ve(d),onNodeClick:fe,onWebPageClick:be,onEdit:d=>{}}})),[h,fe,be,ye]);a.useEffect(()=>{let r=!1;return H(!0),Q.canvas.load(o).then(async d=>{var f;if(!r){try{const g=await d.json(),C=g.elements||[],E=g.appState||{},{nodes:k,edges:D}=Bt(C);s(k),n(D),E.x!==void 0?b({x:E.x,y:E.y,zoom:E.zoom||1}):E.scrollX!==void 0&&b({x:E.scrollX||0,y:E.scrollY||0,zoom:((f=E.zoom)==null?void 0:f.value)||1}),le.current=JSON.stringify({nodes:k,edges:D})}catch{s([]),n([])}H(!1)}}).catch(()=>{r||(s([]),n([]),H(!1))}),()=>{r=!0}},[o]);const Pe=a.useCallback(()=>{ne.current&&clearTimeout(ne.current),M("unsaved"),ne.current=setTimeout(()=>{const r=T.current,d=F.current,f=JSON.stringify({nodes:r,edges:d});if(f===le.current){M("saved");return}if(!navigator.onLine){oe.current={nodes:r,edges:d,viewport:i()},M("unsaved");return}M("saving");const g=i();Q.canvas.save(me.current,[{nodes:r,edges:d}],g).then(()=>{le.current=f,oe.current=null,M("saved")}).catch(()=>{oe.current={nodes:r,edges:d,viewport:g},M("unsaved")})},Dt)},[i]);a.useEffect(()=>{Pe()},[h,p]),a.useEffect(()=>{if(x!=="connected")return;const r=oe.current;r&&(M("saving"),Q.canvas.save(me.current,[{nodes:r.nodes,edges:r.edges}],r.viewport).then(()=>{le.current=JSON.stringify({nodes:r.nodes,edges:r.edges}),oe.current=null,M("saved")}).catch(()=>M("unsaved")))},[x]),a.useEffect(()=>()=>{ne.current&&clearTimeout(ne.current)},[]);const Me=a.useCallback(r=>{n(d=>qe(r,d))},[n]),se=a.useRef(null);a.useEffect(()=>{if(!(!l||!v)){if(l.type==="claude-response"||l.type==="assistant"){const r=l.content||l.text||l.message||"";if(r){O.current+=r;const d=O.current,f=d.length>600?`...
150
- `+d.slice(-500):d;if(se.current)s(g=>g.map(C=>C.id===se.current?{...C,data:{...C.data,content:f,label:"AI Streaming..."}}:C));else{const g=Y();se.current=g;const C=U(T.current,z.current||void 0),E={id:g,type:"response",position:C,data:{label:"AI Streaming...",content:f,compact:!1,status:"running"}},k=[];z.current&&k.push({id:`e_${z.current}_${g}`,source:z.current,target:g,animated:!0}),s(D=>[...D,E]),n(D=>[...D,...k])}}}if(l.type==="claude-complete"||l.type==="message_stop"){const r=O.current.trim(),d=se.current;r&&(d&&(s(f=>f.filter(g=>g.id!==d)),n(f=>f.filter(g=>g.source!==d&&g.target!==d))),We(r),w(f=>[...f,{role:"ai",text:r.slice(0,200)+(r.length>200?"...":"")}])),S(!1),O.current="",se.current=null}}},[l,v]);const We=a.useCallback(r=>{const d=U(T.current,z.current||void 0),{nodes:f,edges:g}=Tt(r,d.x,d.y,z.current||void 0);s(C=>[...C,...f]),n(C=>[...C,...g]),setTimeout(()=>m({padding:.2,duration:400}),100)},[m,s,n]),Be=a.useCallback(()=>{const r=U(T.current),d={id:Y(),type:"note",position:r,data:{label:"Note",content:""}};s(f=>[...f,d])},[s]),Ae=a.useCallback(async r=>{try{const d=await Ue(()=>import("./pdf-CE_K4jFx.js"),[]);d.GlobalWorkerOptions.workerSrc=`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${d.version}/pdf.worker.min.mjs`;const f=await r.arrayBuffer(),g=await d.getDocument({data:f}).promise,C=Math.min(g.numPages,10);let E="";for(let R=1;R<=C;R++){const de=(await(await g.getPage(R)).getTextContent()).items.map(Oe=>Oe.str).join(" ");E+=`[Page ${R}]
151
- ${de}
152
-
153
- `}let k="";try{const R=await g.getPage(1),W=R.getViewport({scale:.5}),re=document.createElement("canvas");re.width=W.width,re.height=W.height;const de=re.getContext("2d");de&&(await R.render({canvasContext:de,viewport:W}).promise,k=re.toDataURL("image/jpeg",.6))}catch{}const D=U(T.current),I={id:Y(),type:"pdf",position:D,data:{label:r.name,content:E.slice(0,500),fileName:r.name,pageCount:g.numPages,extractedText:E,thumbnail:k}};s(R=>[...R,I])}catch{const d=U(T.current);s(f=>[...f,{id:Y(),type:"note",position:d,data:{label:r.name,content:`Failed to process PDF: ${r.name}`}}])}},[s]),He=a.useCallback(()=>{if(!c||v)return;const r=new Set(T.current.filter(W=>W.selected).map(W=>W.id)),d=Le(T.current,r,F.current),f=d||ue(T.current,F.current),g=!!d,C=g?"Analyzing selected elements...":"Analyzing canvas...",E=U(T.current),k=Y(),D={id:k,type:"prompt",position:E,data:{label:"Prompt",content:C}};s(W=>[...W,D]),z.current=k;const R=pe+`[${g?"Selected items context":"Full canvas context"}]
154
- `+f+`
155
-
156
- Analyze the canvas and provide a structured visual response.`;O.current="",S(!0),w(W=>[...W,{role:"user",text:C}]),c({type:"claude-command",command:R,options:{canvasMode:!0,blockId:k}})},[c,v,s]),Ie=a.useCallback(()=>{c&&c({type:"cancel-command"}),S(!1),O.current=""},[c]),ze=a.useCallback(()=>{const r=new Set(["response","research","suggestion","prompt","webpage"]);s(d=>d.filter(f=>!r.has(f.type||""))),n(d=>{const f=new Set(T.current.filter(g=>!r.has(g.type||"")).map(g=>g.id));return d.filter(g=>f.has(g.source)&&f.has(g.target))}),w([])},[s,n]),Fe=a.useCallback(()=>{const r=Lt(T.current,F.current);s(r),setTimeout(()=>m({padding:.2,duration:400}),50)},[s,m]),he=a.useCallback((r,d)=>{if(!c||v)return;const f=U(T.current,d),g=Y(),C={id:g,type:"prompt",position:f,data:{label:"Prompt",content:r}},E=[];d&&E.push({id:`e_${d}_${g}`,source:d,target:g}),s(I=>[...I,C]),n(I=>[...I,...E]),z.current=g;const k=ue(T.current,F.current),D=pe+k+`
157
-
158
- User prompt: `+r;O.current="",S(!0),w(I=>[...I,{role:"user",text:r}]),c({type:"claude-command",command:D,options:{canvasMode:!0,blockId:g}})},[c,v,s,n]),Ve=a.useCallback(r=>{var C;const d=T.current.find(E=>E.id===r);if(!d)return;const g=`Continue from: "${String(((C=d.data)==null?void 0:C.content)||"").slice(0,100)}"
159
-
160
- Provide more detail or explore a different angle.`;he(g,r)},[he]),ve=a.useCallback(()=>{const r=V.trim();if(!r||!c||v)return;const d=new Set(T.current.filter(R=>R.selected).map(R=>R.id)),f=Le(T.current,d,F.current),g=f||ue(T.current,F.current),C=f?"Selected items context":"Full canvas context",E=U(T.current),k=Y(),D={id:k,type:"prompt",position:E,data:{label:"Prompt",content:r}};s(R=>[...R,D]),z.current=k;const I=pe+`[${C}]
161
- `+g+`
162
-
163
- User message: `+r;O.current="",S(!0),w(R=>[...R,{role:"user",text:r}]),N(""),c({type:"claude-command",command:I,options:{canvasMode:!0,blockId:k}})},[V,c,v,s]);return a.useEffect(()=>{ce.current&&(ce.current.scrollTop=ce.current.scrollHeight)},[$]),P?e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-muted-foreground/30 border-t-muted-foreground rounded-full animate-spin"}),"Loading canvas..."]})}):e.jsxs("div",{className:"h-full w-full relative",children:[e.jsx(lt,{onAddNote:Be,onAddPdf:Ae,onRun:He,onStop:Ie,onClearAi:ze,onAutoLayout:Fe,onExport:()=>ie(!0),isRunning:v}),e.jsxs(Qe,{nodes:_e,edges:p,onNodesChange:u,onEdgesChange:y,onConnect:Me,nodeTypes:Mt,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:3,defaultEdgeOptions:{type:"smoothstep",animated:!1},proOptions:{hideAttribution:!0},children:[e.jsx(et,{variant:tt.Dots,gap:20,size:1,color:"#e5e7eb"}),e.jsx(nt,{position:"bottom-right",showInteractive:!1}),e.jsx(ot,{position:"bottom-right",style:{marginBottom:50},nodeStrokeWidth:3,pannable:!0,zoomable:!0})]}),e.jsx(ut,{node:$e,onClose:()=>j(null),onPin:De,onDelete:Re}),X&&e.jsx(ht,{html:String(((we=X.data)==null?void 0:we.html)||((je=X.data)==null?void 0:je.content)||""),pageName:String(((ke=X.data)==null?void 0:ke.pageName)||((Ne=X.data)==null?void 0:Ne.label)||"Page"),nodeId:X.id,onClose:()=>ee(null),onHtmlChange:Te,sendMessage:c,latestMessage:l}),te&&e.jsx(gt,{nodes:h,projectName:o,onClose:()=>ie(!1)}),e.jsxs("div",{className:"absolute top-4 right-4 z-20 flex items-center gap-2",children:[x!=="connected"&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] px-2 py-1 rounded-full border border-amber-500/20 bg-amber-500/5 text-amber-400",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-amber-400 rounded-full animate-pulse"}),x==="reconnecting"?"Reconnecting...":"Offline"]}),e.jsx("div",{className:`text-[10px] px-2 py-1 rounded-full border ${_==="saved"?"text-emerald-500 border-emerald-500/20 bg-emerald-500/5":_==="saving"?"text-amber-500 border-amber-500/20 bg-amber-500/5":"text-muted-foreground border-border/50 bg-muted/50"}`,children:_==="saved"?"Saved":_==="saving"?"Saving...":"Unsaved"})]}),v&&e.jsx("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 z-20",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-primary/10 border border-primary/20 rounded-full text-xs text-primary font-medium",children:[e.jsx("div",{className:"w-2 h-2 bg-primary rounded-full animate-pulse"}),"AI is analyzing canvas..."]})}),e.jsx("button",{onClick:()=>{J(!A),A||setTimeout(()=>{var r;return(r=ge.current)==null?void 0:r.focus()},100)},className:"absolute bottom-4 right-4 z-20 w-10 h-10 rounded-full bg-primary text-primary-foreground shadow-lg flex items-center justify-center hover:bg-primary/90 transition-colors",title:A?"Hide chat":"Chat with canvas",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:A?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),A&&e.jsx("div",{className:"absolute bottom-16 right-4 z-20 w-80 max-h-[50vh]",children:e.jsxs("div",{className:"bg-card/95 backdrop-blur-md border border-border/50 rounded-2xl shadow-xl flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-border/30 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Canvas Chat"}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground bg-muted/50",children:h.filter(r=>r.selected).length>0?`${h.filter(r=>r.selected).length} selected`:"full canvas"})]}),e.jsxs("div",{ref:ce,className:"flex-1 overflow-y-auto max-h-48 px-3 py-2 space-y-2",children:[$.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground/60 text-center py-4",children:"Ask AI about your canvas. Context is auto-attached."}),$.map((r,d)=>e.jsxs("div",{className:`text-xs px-2 py-1.5 rounded-lg ${r.role==="user"?"bg-primary/10 text-foreground ml-6":"bg-muted/50 text-foreground mr-6"}`,children:[e.jsx("span",{className:"font-medium text-[10px] text-muted-foreground block mb-0.5",children:r.role==="user"?"You":"AI"}),r.text]},d)),v&&e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1 px-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-primary rounded-full animate-pulse"}),"Thinking..."]})]}),e.jsx("div",{className:"p-2 border-t border-border/30",children:e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("textarea",{ref:ge,value:V,onChange:r=>N(r.target.value),onKeyDown:r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),ve())},placeholder:"Ask about your canvas...",rows:1,className:"flex-1 bg-muted/30 text-foreground text-xs placeholder-muted-foreground/50 resize-none outline-none px-3 py-2 rounded-lg max-h-16 overflow-y-auto border border-border/30 focus:border-primary/30"}),e.jsx("button",{onClick:ve,disabled:!V.trim()||v,className:"shrink-0 w-8 h-8 rounded-lg bg-primary text-primary-foreground flex items-center justify-center disabled:opacity-40 hover:bg-primary/90 transition-colors",children:v?e.jsx("div",{className:"w-3 h-3 border-2 border-primary-foreground/30 border-t-primary-foreground rounded-full animate-spin"}):e.jsx("svg",{className:"w-3.5 h-3.5 rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]})})]})})]})}function Ht(o){return e.jsx(Ge,{children:e.jsx(At,{...o})})}const Gt=Ye.memo(Ht);export{Gt as default};
@@ -1 +0,0 @@
1
- import{r as l,j as e}from"./vendor-react-96lCPsRK.js";import{d as C,I as j}from"./index-HaY-3pK1.js";import{u as M,a as T}from"./AppContent-CwrTP6TW.js";import{af as $,R as A,M as L,Z as I,bb as R,h as _,bk as D,t as U,av as E,aD as V,v as F,bl as O}from"./vendor-icons-GyYE35HP.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-i18n-DCFGyhQR.js";import"./LoginModal-CImJHRjX.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-canvas-DvHJ_Pn2.js";import"./vendor-mermaid-DucWyDEe.js";import"./vendor-codemirror-D2ALgpaX.js";function Y({onRefresh:t,threshold:r=80,maxPull:i=120,enabled:s=!0}){const d=l.useRef(0),[n,c]=l.useState(0),[m,f]=l.useState(!1),u=l.useRef(!1),w=l.useCallback(o=>{!s||m||(d.current=o.touches[0].clientY,u.current=!1)},[s,m]),p=l.useCallback(o=>{if(!s||m||o.currentTarget.scrollTop>0)return;const b=o.touches[0].clientY-d.current;b>0&&(u.current=!0,c(Math.min(b*.5,i)))},[s,m,i]),x=l.useCallback(async()=>{if(u.current){if(n>=r){f(!0);try{await t()}finally{f(!1)}}c(0),u.current=!1}},[n,r,t]);return{pullDistance:n,isRefreshing:m,handlers:{onTouchStart:w,onTouchMove:p,onTouchEnd:x}}}function S({className:t}){return e.jsx("div",{className:`animate-pulse rounded-md bg-muted/60 ${t||""}`})}function ee({selectedProject:t}){var k;const[r,i]=l.useState(null),[s,d]=l.useState(null),[n,c]=l.useState(!0),[m,f]=l.useState(null),{canPrompt:u,promptInstall:w}=M(),{isMobile:p}=T({trackPWA:!1}),x=l.useCallback(async()=>{c(!0),f(null);try{const a=await C("/api/dashboard/stats");if(a.ok){const h=await a.json();i(h)}}catch{}if(j)try{const a=await C("/api/vapi/usage");if(a.ok){const h=await a.json();d(h)}}catch{}c(!1)},[]),{pullDistance:o,isRefreshing:y,handlers:b}=Y({onRefresh:x,enabled:p});return l.useEffect(()=>{x()},[x]),e.jsxs("div",{className:"h-full overflow-y-auto p-4 sm:p-6 space-y-6","data-pull-refresh":!0,...p?b:{},style:o>0?{transform:`translateY(${o*.3}px)`}:void 0,children:[p&&(o>0||y)&&e.jsx("div",{className:"flex items-center justify-center py-2 -mt-2",children:y?e.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}):e.jsx("svg",{className:"w-5 h-5 text-muted-foreground transition-transform",style:{transform:`rotate(${Math.min(o/80*180,180)}deg)`},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5 text-blue-500"}),"Dashboard"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:t?`Project: ${t.displayName||t.name}`:"Overview"})]}),e.jsx("button",{onClick:x,disabled:n,className:"p-2 rounded-lg hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors",title:"Refresh stats",children:e.jsx(A,{className:`w-4 h-4 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(N,{icon:L,label:"Sessions",value:(r==null?void 0:r.total)??0,subtext:r!=null&&r.today?`${r.today} today`:void 0,color:"blue",loading:n}),e.jsx(N,{icon:I,label:"AI Providers",value:r!=null&&r.providers?Object.keys(r.providers).length:0,subtext:r!=null&&r.providers?Object.keys(r.providers).join(", "):void 0,color:"purple",loading:n}),j&&e.jsxs(e.Fragment,{children:[e.jsx(N,{icon:R,label:"Voice Calls",value:((k=s==null?void 0:s.allTime)==null?void 0:k.calls)??0,subtext:s!=null&&s.today?`${s.today.calls} today`:void 0,color:"amber",loading:n}),e.jsx(N,{icon:_,label:"Call Limit",value:(s==null?void 0:s.remaining)!=null?`${s.remaining} left`:0,subtext:s!=null&&s.limit?`of ${s.limit}/day`:void 0,color:"emerald",loading:n})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider",children:"Quick Actions"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:[e.jsx(v,{label:"Install CLI",description:"npm install -g @upfynai-code/app",onClick:()=>navigator.clipboard.writeText("npm install -g @upfynai-code/app")}),e.jsx(v,{label:"Connect Machine",description:"uc connect",onClick:()=>navigator.clipboard.writeText("uc connect")}),j&&e.jsx(v,{label:"View Pricing",description:"Upgrade your plan",href:"https://cli.upfyn.com/pricing"}),u&&e.jsx(v,{label:"Install App",description:"Add Upfyn to your home screen",onClick:w})]})]}),j&&(s==null?void 0:s.recentCalls)&&s.recentCalls.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider",children:"Recent Voice Calls"}),e.jsx("div",{className:"space-y-2",children:s.recentCalls.slice(0,5).map((a,h)=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/30 border border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(R,{className:"w-4 h-4 text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm text-foreground truncate",children:a.summary||`Voice call — ${Math.round(a.duration_seconds||0)}s`}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.created_at?new Date(a.created_at).toLocaleString():"Unknown time"})]})]}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${a.status==="completed"?"bg-emerald-500/10 text-emerald-400":a.status==="ended"?"bg-blue-500/10 text-blue-400":"bg-muted text-muted-foreground"}`,children:a.status||"unknown"})]},a.vapi_call_id||h))})]}),t&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider",children:"Project Info"}),e.jsxs("div",{className:"rounded-lg bg-muted/30 border border-border/50 p-4 space-y-2",children:[e.jsx(g,{label:"Name",value:t.displayName||t.name}),e.jsx(g,{label:"Path",value:t.fullPath||t.path||"—"}),t.sessions&&e.jsx(g,{label:"Claude Sessions",value:String(t.sessions.length)}),t.cursorSessions&&e.jsx(g,{label:"Cursor Sessions",value:String(t.cursorSessions.length)}),t.codexSessions&&e.jsx(g,{label:"Codex Sessions",value:String(t.codexSessions.length)})]})]}),!t&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider flex items-center gap-2",children:[e.jsx(D,{className:"w-3.5 h-3.5"}),"Getting Started"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(U,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"1. Install the CLI"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:["Install globally, then run ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"uc"})," to launch."]}),e.jsx("code",{className:"text-xs bg-muted/50 px-2 py-1 rounded block text-foreground/80",children:"npm install -g @upfynai-code/app"})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(I,{className:"w-4 h-4 text-yellow-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"2. Connect Your Machine"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Bridge your local dev environment to this web UI."}),e.jsx("code",{className:"text-xs bg-muted/50 px-2 py-1 rounded block text-foreground/80",children:"uc connect --key your_relay_token"})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(E,{className:"w-4 h-4 text-indigo-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"3. Use the Canvas"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Switch to the Canvas tab to create visual workspaces with code blocks, diagrams, and notes."})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(V,{className:"w-4 h-4 text-emerald-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"4. Chat with AI"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use the Chat tab to talk to Claude, Cursor, or Codex. Bring your own API keys in Settings."})]})]})]})]})}function N({icon:t,label:r,value:i,subtext:s,color:d,loading:n}){const c={blue:"text-blue-500 bg-blue-500/10",purple:"text-purple-500 bg-purple-500/10",amber:"text-amber-500 bg-amber-500/10",emerald:"text-emerald-500 bg-emerald-500/10"};return e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${c[d]}`,children:e.jsx(t,{className:"w-3.5 h-3.5"})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r})]}),n?e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"h-6 w-16 mb-1"}),e.jsx(S,{className:"h-3 w-20"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xl font-semibold text-foreground",children:i}),s&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s})]})]})}function v({label:t,description:r,onClick:i,href:s}){const d=s?"a":"button",n=s?{href:s,target:"_blank",rel:"noopener noreferrer"}:{onClick:i};return e.jsxs(d,{...n,className:"flex items-center justify-between p-3 rounded-lg border border-border/50 bg-card/50 hover:bg-muted/60 transition-colors text-left group",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),s?e.jsx(F,{className:"w-3.5 h-3.5 text-muted-foreground group-hover:text-foreground"}):e.jsx(O,{className:"w-3.5 h-3.5 text-muted-foreground group-hover:text-foreground"})]})}function g({label:t,value:r}){return e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("span",{className:"text-foreground font-mono text-xs truncate max-w-[60%] text-right",children:r})]})}export{ee as default};
@@ -1 +0,0 @@
1
- import{r as x,j as e,R as Ee}from"./vendor-react-96lCPsRK.js";import{B as V,I as Ie,S as Fe,c as h}from"./AppContent-CwrTP6TW.js";import{d as Te,b as Le}from"./index-HaY-3pK1.js";import{X as ye,aa as Me,E as ze,ay as Ae,e as xe,n as me,q as De,m as Re,az as y,aA as U,a3 as I,aB as J,aC as Y,aD as ee,S as a,aE as $,aF as F,aG as oe,aH as T,t as j,aI as te,y as w,aJ as G,aK as je,aL as C,aM as S,aN as A,aO as D,aP as E,aQ as Be,aR as b,aS as pe,aT as Oe,aU as ue,aV as R,aW as B,A as ge,aX as Ve,aY as Ue,aZ as O,a_ as fe,a$ as $e,b0 as Ge,ai as Z}from"./vendor-icons-GyYE35HP.js";import{u as qe}from"./LoginModal-CImJHRjX.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-codemirror-D2ALgpaX.js";import"./vendor-i18n-DCFGyhQR.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-canvas-DvHJ_Pn2.js";import"./vendor-mermaid-DucWyDEe.js";function _e({file:i,onClose:u}){const d=`/api/projects/${i.projectName}/files/content?path=${encodeURIComponent(i.path)}`,[s,p]=x.useState(null),[L,q]=x.useState(null),[N,g]=x.useState(!0);return x.useEffect(()=>{let f;const M=new AbortController;return(async()=>{try{g(!0),q(null),p(null);const m=await Te(d,{signal:M.signal});if(!m.ok)throw new Error(`Request failed with status ${m.status}`);const _=await m.blob();f=URL.createObjectURL(_),p(f)}catch(m){if(m.name==="AbortError")return;console.error("Error loading image:",m),q("Unable to load image")}finally{g(!1)}})(),()=>{M.abort(),f&&URL.revokeObjectURL(f)}},[d]),e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:i.name}),e.jsx(V,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:e.jsx(ye,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[N&&e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:"Loading image…"})}),!N&&s&&e.jsx("img",{src:s,alt:i.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md"}),!N&&!s&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("p",{children:L||"Unable to load image"}),e.jsx("p",{className:"text-sm mt-2 break-all",children:i.path})]})]}),e.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:i.path})})]})})}const He="w-4 h-4 flex-shrink-0",he={js:{icon:R,color:"text-yellow-500"},jsx:{icon:R,color:"text-yellow-500"},mjs:{icon:R,color:"text-yellow-500"},cjs:{icon:R,color:"text-yellow-500"},ts:{icon:B,color:"text-blue-500"},tsx:{icon:B,color:"text-blue-500"},mts:{icon:B,color:"text-blue-500"},py:{icon:Z,color:"text-emerald-500"},pyw:{icon:Z,color:"text-emerald-500"},pyi:{icon:Z,color:"text-emerald-400"},ipynb:{icon:Ge,color:"text-orange-500"},rs:{icon:$,color:"text-orange-600"},toml:{icon:a,color:"text-gray-500"},go:{icon:U,color:"text-cyan-500"},rb:{icon:te,color:"text-red-500"},erb:{icon:te,color:"text-red-400"},php:{icon:$e,color:"text-violet-500"},java:{icon:fe,color:"text-red-600"},jar:{icon:fe,color:"text-red-500"},kt:{icon:U,color:"text-violet-500"},kts:{icon:U,color:"text-violet-400"},c:{icon:O,color:"text-blue-600"},h:{icon:O,color:"text-blue-400"},cpp:{icon:O,color:"text-blue-700"},hpp:{icon:O,color:"text-blue-500"},cc:{icon:O,color:"text-blue-700"},cs:{icon:U,color:"text-purple-600"},swift:{icon:oe,color:"text-orange-500"},lua:{icon:Ue,color:"text-blue-500"},r:{icon:Ve,color:"text-blue-600"},html:{icon:ge,color:"text-orange-600"},htm:{icon:ge,color:"text-orange-600"},css:{icon:F,color:"text-blue-500"},scss:{icon:F,color:"text-pink-500"},sass:{icon:F,color:"text-pink-400"},less:{icon:F,color:"text-indigo-500"},vue:{icon:B,color:"text-emerald-500"},svelte:{icon:B,color:"text-orange-500"},json:{icon:T,color:"text-yellow-600"},jsonc:{icon:T,color:"text-yellow-500"},json5:{icon:T,color:"text-yellow-500"},yaml:{icon:a,color:"text-purple-400"},yml:{icon:a,color:"text-purple-400"},xml:{icon:R,color:"text-orange-500"},csv:{icon:ue,color:"text-green-600"},tsv:{icon:ue,color:"text-green-500"},sql:{icon:Oe,color:"text-blue-500"},graphql:{icon:pe,color:"text-pink-500"},gql:{icon:pe,color:"text-pink-500"},proto:{icon:G,color:"text-green-500"},env:{icon:w,color:"text-yellow-600"},md:{icon:ee,color:"text-blue-500"},mdx:{icon:ee,color:"text-blue-400"},txt:{icon:I,color:"text-gray-500"},doc:{icon:I,color:"text-blue-600"},docx:{icon:I,color:"text-blue-600"},pdf:{icon:Y,color:"text-red-600"},rtf:{icon:I,color:"text-gray-500"},tex:{icon:J,color:"text-teal-600"},rst:{icon:I,color:"text-gray-400"},sh:{icon:j,color:"text-green-500"},bash:{icon:j,color:"text-green-500"},zsh:{icon:j,color:"text-green-400"},fish:{icon:j,color:"text-green-400"},ps1:{icon:j,color:"text-blue-400"},bat:{icon:j,color:"text-gray-500"},cmd:{icon:j,color:"text-gray-500"},png:{icon:b,color:"text-purple-500"},jpg:{icon:b,color:"text-purple-500"},jpeg:{icon:b,color:"text-purple-500"},gif:{icon:b,color:"text-purple-400"},webp:{icon:b,color:"text-purple-400"},ico:{icon:b,color:"text-purple-400"},bmp:{icon:b,color:"text-purple-400"},tiff:{icon:b,color:"text-purple-400"},svg:{icon:Be,color:"text-amber-500"},mp3:{icon:E,color:"text-pink-500"},wav:{icon:E,color:"text-pink-500"},ogg:{icon:E,color:"text-pink-400"},flac:{icon:E,color:"text-pink-400"},aac:{icon:E,color:"text-pink-400"},m4a:{icon:E,color:"text-pink-400"},mp4:{icon:D,color:"text-rose-500"},mov:{icon:D,color:"text-rose-500"},avi:{icon:D,color:"text-rose-500"},webm:{icon:D,color:"text-rose-400"},mkv:{icon:D,color:"text-rose-400"},ttf:{icon:A,color:"text-red-500"},otf:{icon:A,color:"text-red-500"},woff:{icon:A,color:"text-red-400"},woff2:{icon:A,color:"text-red-400"},eot:{icon:A,color:"text-red-400"},zip:{icon:S,color:"text-amber-600"},tar:{icon:S,color:"text-amber-600"},gz:{icon:S,color:"text-amber-600"},bz2:{icon:S,color:"text-amber-600"},rar:{icon:S,color:"text-amber-500"},"7z":{icon:S,color:"text-amber-500"},lock:{icon:y,color:"text-gray-500"},exe:{icon:C,color:"text-gray-500"},bin:{icon:C,color:"text-gray-500"},dll:{icon:C,color:"text-gray-400"},so:{icon:C,color:"text-gray-400"},dylib:{icon:C,color:"text-gray-400"},wasm:{icon:C,color:"text-purple-500"},ini:{icon:a,color:"text-gray-500"},cfg:{icon:a,color:"text-gray-500"},conf:{icon:a,color:"text-gray-500"},log:{icon:J,color:"text-gray-400"},map:{icon:je,color:"text-gray-400"}},be={Dockerfile:{icon:G,color:"text-blue-500"},"docker-compose.yml":{icon:G,color:"text-blue-500"},"docker-compose.yaml":{icon:G,color:"text-blue-500"},".dockerignore":{icon:G,color:"text-gray-500"},".gitignore":{icon:a,color:"text-gray-500"},".gitmodules":{icon:a,color:"text-gray-500"},".gitattributes":{icon:a,color:"text-gray-500"},".editorconfig":{icon:a,color:"text-gray-500"},".prettierrc":{icon:a,color:"text-pink-400"},".prettierignore":{icon:a,color:"text-gray-500"},".eslintrc":{icon:a,color:"text-violet-500"},".eslintrc.js":{icon:a,color:"text-violet-500"},".eslintrc.json":{icon:a,color:"text-violet-500"},".eslintrc.cjs":{icon:a,color:"text-violet-500"},"eslint.config.js":{icon:a,color:"text-violet-500"},"eslint.config.mjs":{icon:a,color:"text-violet-500"},".env":{icon:w,color:"text-yellow-600"},".env.local":{icon:w,color:"text-yellow-600"},".env.development":{icon:w,color:"text-yellow-500"},".env.production":{icon:w,color:"text-yellow-600"},".env.example":{icon:w,color:"text-yellow-400"},"package.json":{icon:T,color:"text-green-500"},"package-lock.json":{icon:y,color:"text-gray-500"},"yarn.lock":{icon:y,color:"text-blue-400"},"pnpm-lock.yaml":{icon:y,color:"text-orange-400"},"bun.lockb":{icon:y,color:"text-gray-400"},"Cargo.toml":{icon:$,color:"text-orange-600"},"Cargo.lock":{icon:y,color:"text-orange-400"},Gemfile:{icon:te,color:"text-red-500"},"Gemfile.lock":{icon:y,color:"text-red-400"},Makefile:{icon:j,color:"text-gray-500"},"CMakeLists.txt":{icon:$,color:"text-blue-500"},"tsconfig.json":{icon:T,color:"text-blue-500"},"jsconfig.json":{icon:T,color:"text-yellow-500"},"vite.config.ts":{icon:oe,color:"text-purple-500"},"vite.config.js":{icon:oe,color:"text-purple-500"},"webpack.config.js":{icon:$,color:"text-blue-500"},"tailwind.config.js":{icon:F,color:"text-cyan-500"},"tailwind.config.ts":{icon:F,color:"text-cyan-500"},"postcss.config.js":{icon:$,color:"text-red-400"},"babel.config.js":{icon:a,color:"text-yellow-500"},".babelrc":{icon:a,color:"text-yellow-500"},"README.md":{icon:ee,color:"text-blue-500"},LICENSE:{icon:Y,color:"text-gray-500"},"LICENSE.md":{icon:Y,color:"text-gray-500"},"CHANGELOG.md":{icon:J,color:"text-blue-400"},"requirements.txt":{icon:I,color:"text-emerald-400"},"go.mod":{icon:U,color:"text-cyan-500"},"go.sum":{icon:y,color:"text-cyan-400"}};function We(i){var d;if(be[i])return be[i];if(i.startsWith(".env"))return{icon:w,color:"text-yellow-600"};const u=(d=i.split(".").pop())==null?void 0:d.toLowerCase();return u&&he[u]?he[u]:{icon:je,color:"text-muted-foreground"}}function no({selectedProject:i,onFileOpen:u,activeFilePath:d=null}){const{t:s}=qe(),[p,L]=x.useState([]),[q,N]=x.useState(!1),[g,f]=x.useState(new Set),[M,W]=x.useState(null),[m,_]=x.useState("detailed"),[v,re]=x.useState(""),[z,ce]=x.useState([]),H=Ee.useRef(null);x.useEffect(()=>{i&&we()},[i]),x.useEffect(()=>{const t=localStorage.getItem("file-tree-view-mode");t&&["simple","detailed","compact"].includes(t)&&_(t)},[]),x.useEffect(()=>{if(!d||p.length===0)return;const t=d.replace(/\\/g,"/"),c=(r,l,n=[])=>{for(const k of r){const ie=(k.path||"").replace(/\\/g,"/");if(k.type==="directory"&&k.children){const Se=[...n,k.path];if(t.startsWith(ie+"/")){const de=c(k.children,l,Se);if(de)return de}}if(k.type!=="directory"&&ie===t)return n}return null},o=c(p,t);o&&o.length>0&&f(r=>{const l=new Set(r);return o.forEach(n=>l.add(n)),l}),requestAnimationFrame(()=>{var r;(r=H.current)==null||r.scrollIntoView({block:"nearest",behavior:"smooth"})})},[d,p]),x.useEffect(()=>{if(!v.trim())ce(p);else{const t=ne(p,v.toLowerCase());ce(t);const c=o=>{o.forEach(r=>{r.type==="directory"&&r.children&&r.children.length>0&&(f(l=>new Set(l.add(r.path))),c(r.children))})};c(t)}},[p,v]);const ne=(t,c)=>t.reduce((o,r)=>{const l=r.name.toLowerCase().includes(c);let n=[];return r.type==="directory"&&r.children&&(n=ne(r.children,c)),(l||n.length>0)&&o.push({...r,children:n}),o},[]),we=async()=>{N(!0);try{const t=await Le.getFiles(i.name);if(!t.ok){const o=await t.text();console.error("❌ File fetch failed:",t.status,o),L([]);return}const c=await t.json();L(c)}catch(t){console.error("❌ Error fetching files:",t),L([])}finally{N(!1)}},Ne=t=>{const c=new Set(g);c.has(t)?c.delete(t):c.add(t),f(c)},P=t=>{_(t),localStorage.setItem("file-tree-view-mode",t)},Q=t=>{if(!t||t===0)return"0 B";const c=1024,o=["B","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(c));return parseFloat((t/Math.pow(c,r)).toFixed(1))+" "+o[r]},ve=t=>{if(!t)return"-";const c=new Date,o=new Date(t),r=Math.floor((c-o)/1e3);return r<60?s("fileTree.justNow"):r<3600?s("fileTree.minAgo",{count:Math.floor(r/60)}):r<86400?s("fileTree.hoursAgo",{count:Math.floor(r/3600)}):r<2592e3?s("fileTree.daysAgo",{count:Math.floor(r/86400)}):o.toLocaleDateString()},ke=t=>{var r;const c=(r=t.split(".").pop())==null?void 0:r.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(c)},Ce=t=>{const{icon:c,color:o}=We(t);return e.jsx(c,{className:h(He,o)})},X=t=>{t.type==="directory"?Ne(t.path):ke(t.name)?W({name:t.name,path:t.path,projectPath:i.path,projectName:i.name}):u&&u(t.path)},K=t=>{const c=t.type==="directory",o=g.has(t.path);return c?e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(De,{className:h("w-3.5 h-3.5 text-muted-foreground/70 transition-transform duration-150",o&&"rotate-90")}),o?e.jsx(Re,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):e.jsx(me,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})]}):e.jsx("span",{className:"flex items-center flex-shrink-0 ml-[18px]",children:Ce(t.name)})},se=(t,c=0)=>t.map(o=>{const r=o.type==="directory",l=r&&g.has(o.path),n=!r&&d&&(o.path||"").replace(/\\/g,"/")===d.replace(/\\/g,"/");return e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{ref:n?H:void 0,className:h("group flex items-center gap-1.5 py-[3px] pr-2 cursor-pointer rounded-sm","hover:bg-accent/60 transition-colors duration-100",n&&"bg-primary/10 border-l-2 !border-primary font-medium",!n&&r&&l&&"border-l-2 border-primary/30",!n&&r&&!l&&"border-l-2 border-transparent",!n&&!r&&"border-l-2 border-transparent"),style:{paddingLeft:`${c*16+4}px`},onClick:()=>X(o),children:[K(o),e.jsx("span",{className:h("text-[13px] leading-tight truncate",n?"font-medium text-primary":r?"font-medium text-foreground":"text-foreground/90"),children:o.name})]}),r&&l&&o.children&&o.children.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute top-0 bottom-0 border-l border-border/40",style:{left:`${c*16+14}px`},"aria-hidden":"true"}),se(o.children,c+1)]})]},o.path)}),le=(t,c=0)=>t.map(o=>{const r=o.type==="directory",l=r&&g.has(o.path),n=!r&&d&&(o.path||"").replace(/\\/g,"/")===d.replace(/\\/g,"/");return e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{ref:n?H:void 0,className:h("group grid grid-cols-1 sm:grid-cols-12 gap-0 sm:gap-2 py-[3px] pr-2 hover:bg-accent/60 cursor-pointer items-center rounded-sm transition-colors duration-100",n&&"bg-primary/10 border-l-2 !border-primary font-medium",!n&&r&&l&&"border-l-2 border-primary/30",!n&&r&&!l&&"border-l-2 border-transparent",!n&&!r&&"border-l-2 border-transparent"),style:{paddingLeft:`${c*16+4}px`},onClick:()=>X(o),children:[e.jsxs("div",{className:"sm:col-span-5 flex items-center gap-1.5 min-w-0",children:[K(o),e.jsx("span",{className:h("text-[13px] leading-tight truncate",n?"font-medium text-primary":r?"font-medium text-foreground":"text-foreground/90"),children:o.name}),o.type==="file"&&o.size!=null&&e.jsx("span",{className:"sm:hidden text-[10px] text-muted-foreground/60 ml-auto flex-shrink-0",children:Q(o.size)})]}),e.jsx("div",{className:"hidden sm:block sm:col-span-2 text-sm text-muted-foreground tabular-nums",children:o.type==="file"?Q(o.size):""}),e.jsx("div",{className:"hidden sm:block sm:col-span-3 text-sm text-muted-foreground",children:ve(o.modified)}),e.jsx("div",{className:"hidden sm:block sm:col-span-2 text-sm text-muted-foreground font-mono",children:o.permissionsRwx||""})]}),r&&l&&o.children&&e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute top-0 bottom-0 border-l border-border/40",style:{left:`${c*16+14}px`},"aria-hidden":"true"}),le(o.children,c+1)]})]},o.path)}),ae=(t,c=0)=>t.map(o=>{const r=o.type==="directory",l=r&&g.has(o.path),n=!r&&d&&(o.path||"").replace(/\\/g,"/")===d.replace(/\\/g,"/");return e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{ref:n?H:void 0,className:h("group flex items-center justify-between py-[3px] pr-2 hover:bg-accent/60 cursor-pointer rounded-sm transition-colors duration-100",n&&"bg-primary/10 border-l-2 !border-primary font-medium",!n&&r&&l&&"border-l-2 border-primary/30",!n&&r&&!l&&"border-l-2 border-transparent",!n&&!r&&"border-l-2 border-transparent"),style:{paddingLeft:`${c*16+4}px`},onClick:()=>X(o),children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[K(o),e.jsx("span",{className:h("text-[13px] leading-tight truncate",n?"font-medium text-primary":r?"font-medium text-foreground":"text-foreground/90"),children:o.name})]}),e.jsx("div",{className:"flex items-center gap-3 text-sm text-muted-foreground flex-shrink-0 ml-2",children:o.type==="file"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tabular-nums",children:Q(o.size)}),e.jsx("span",{className:"font-mono",children:o.permissionsRwx})]})})]}),r&&l&&o.children&&e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute top-0 bottom-0 border-l border-border/40",style:{left:`${c*16+14}px`},"aria-hidden":"true"}),ae(o.children,c+1)]})]},o.path)});return q?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("div",{className:"text-muted-foreground text-sm",children:s("fileTree.loading")})}):e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsxs("div",{className:"px-3 pt-3 pb-2 border-b border-border space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:s("fileTree.files")}),e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx(V,{variant:m==="simple"?"default":"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>P("simple"),title:s("fileTree.simpleView"),children:e.jsx(Me,{className:"w-3.5 h-3.5"})}),e.jsx(V,{variant:m==="compact"?"default":"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>P("compact"),title:s("fileTree.compactView"),children:e.jsx(ze,{className:"w-3.5 h-3.5"})}),e.jsx(V,{variant:m==="detailed"?"default":"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>P("detailed"),title:s("fileTree.detailedView"),children:e.jsx(Ae,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(xe,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx(Ie,{type:"text",placeholder:s("fileTree.searchPlaceholder"),value:v,onChange:t=>re(t.target.value),className:"pl-8 pr-8 h-8 text-sm"}),v&&e.jsx(V,{variant:"ghost",size:"sm",className:"absolute right-0.5 top-1/2 transform -translate-y-1/2 h-5 w-5 p-0 hover:bg-accent",onClick:()=>re(""),title:s("fileTree.clearSearch"),children:e.jsx(ye,{className:"w-3 h-3"})})]})]}),m==="detailed"&&z.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-1 border-b border-border",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-2 px-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:[e.jsx("div",{className:"sm:col-span-5",children:s("fileTree.name")}),e.jsx("div",{className:"hidden sm:block sm:col-span-2",children:s("fileTree.size")}),e.jsx("div",{className:"hidden sm:block sm:col-span-3",children:s("fileTree.modified")}),e.jsx("div",{className:"hidden sm:block sm:col-span-2",children:s("fileTree.permissions")})]})}),e.jsx(Fe,{className:"flex-1 px-2 py-1",children:p.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(me,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:s("fileTree.noFilesFound")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("fileTree.checkProjectPath")})]}):z.length===0&&v?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(xe,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:s("fileTree.noMatchesFound")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("fileTree.tryDifferentSearch")})]}):e.jsxs("div",{children:[m==="simple"&&se(z),m==="compact"&&ae(z),m==="detailed"&&le(z)]})}),M&&e.jsx(_e,{file:M,onClose:()=>W(null)})]})}export{no as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-mermaid-DucWyDEe.js","assets/vendor-canvas-DvHJ_Pn2.js","assets/vendor-react-96lCPsRK.js","assets/vendor-canvas-BZV40eAE.css","assets/vendor-syntax-LS_Nt30I.js","assets/vendor-markdown-CimbIo6Y.js"])))=>i.map(i=>d[i]);
2
- import{b}from"./vendor-syntax-LS_Nt30I.js";import{r as t,j as e}from"./vendor-react-96lCPsRK.js";import"./vendor-markdown-CimbIo6Y.js";let m=!1;async function h(){const r=await b(()=>import("./vendor-mermaid-DucWyDEe.js").then(s=>s.a7),__vite__mapDeps([0,1,2,3,4,5]));return m||(r.default.initialize({startOnLoad:!1,theme:"dark",themeVariables:{darkMode:!0,background:"#1e293b",primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",primaryBorderColor:"#475569",lineColor:"#64748b",secondaryColor:"#1e40af",tertiaryColor:"#0f172a",fontFamily:"ui-sans-serif, system-ui, sans-serif",fontSize:"14px"},flowchart:{htmlLabels:!0,curve:"basis"},sequence:{mirrorActors:!1}}),m=!0),r.default}function w({code:r}){const s=t.useRef(null),o=t.useId().replace(/:/g,"-"),[i,n]=t.useState(null),[u,d]=t.useState(null),[f,c]=t.useState(!1);t.useEffect(()=>{let l=!1;return(async()=>{try{const a=await h(),{svg:x}=await a.render(`mermaid${o}`,r.trim());l||(n(x),d(null))}catch(a){l||(d((a==null?void 0:a.message)||"Failed to render diagram"),n(null))}})(),()=>{l=!0}},[r,o]);const p=()=>{navigator.clipboard.writeText(r).then(()=>{c(!0),setTimeout(()=>c(!1),1500)}).catch(()=>{})};return u?e.jsxs("div",{className:"my-2 rounded-lg border border-red-500/30 bg-red-950/20 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("svg",{className:"w-4 h-4 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),e.jsx("span",{className:"text-xs font-medium text-red-400",children:"Mermaid diagram error"})]}),e.jsx("pre",{className:"text-xs text-red-300/70 whitespace-pre-wrap font-mono",children:r})]}):e.jsxs("div",{className:"relative group my-2 rounded-lg border border-slate-700 bg-slate-900/50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-slate-700/50 bg-slate-800/30",children:[e.jsx("span",{className:"text-xs text-slate-400 font-medium uppercase",children:"mermaid"}),e.jsx("button",{type:"button",onClick:p,className:"opacity-0 group-hover:opacity-100 transition-opacity text-xs px-2 py-0.5 rounded bg-slate-700/80 hover:bg-slate-700 text-slate-300 border border-slate-600",children:f?"Copied":"Copy source"})]}),e.jsx("div",{ref:s,className:"flex items-center justify-center p-4 min-h-[80px] overflow-x-auto [&_svg]:max-w-full",dangerouslySetInnerHTML:i?{__html:i}:void 0,children:!i&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),"Rendering diagram..."]})})]})}export{w as default};
@@ -1 +0,0 @@
1
- import{r,j as e}from"./vendor-react-96lCPsRK.js";import{L as We,b as ze,C as He,a as Ve}from"./LoginModal-CImJHRjX.js";import{I as Ze,i as Qe,c as Xe,d as p,b as ue,h as L}from"./index-HaY-3pK1.js";import{b as Ke,t as et,av as tt,Z as st,G as rt,aw as at,ax as ot,F as me,w as xe,n as he,X as ge,r as pe,L as G,P as nt,j as it,a8 as fe,q as lt}from"./vendor-icons-GyYE35HP.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-canvas-DvHJ_Pn2.js";import"./vendor-mermaid-DucWyDEe.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-i18n-DCFGyhQR.js";const jt=({onComplete:R})=>{const[o,be]=r.useState(0),[y,O]=r.useState(""),[f,q]=r.useState(""),[c,N]=r.useState(!1),[U,n]=r.useState(""),[je,_]=r.useState(!1),[ye,Ne]=r.useState("right"),[l,v]=r.useState(null),[ve]=r.useState({name:"default",fullPath:Ze?"/workspace":""}),[u,E]=r.useState([]),[M,I]=r.useState(!1),[m,we]=r.useState(""),[D,Y]=r.useState([]),[J,ke]=r.useState([]),[W,z]=r.useState(!1),[x,H]=r.useState(""),[V,Ce]=r.useState([]),[w,Z]=r.useState(""),[b,k]=r.useState(!1),[Q,C]=r.useState(""),[X,T]=r.useState({authenticated:!1,email:null,loading:!0,error:null}),[K,$]=r.useState({authenticated:!1,email:null,loading:!0,error:null}),[ee,B]=r.useState({authenticated:!1,email:null,loading:!0,error:null}),{user:S}=Qe(),{isRelayConnected:te,relayCwd:A,relayPlatform:se}=Xe(),re=r.useRef(void 0);r.useEffect(()=>{Se()},[]);const Se=async()=>{try{const t=await p("/api/user/git-config");if(t.ok){const s=await t.json();s.gitName&&O(s.gitName),s.gitEmail&&q(s.gitEmail)}}catch{}},h=r.useCallback(async t=>{z(!0);try{const a=await(await ue.browseFilesystem(t||null)).json();we(a.path||t||""),Y(a.suggestions||[]),a.drives&&ke(a.drives)}catch{Y([])}finally{z(!1)}},[]),Ae=r.useCallback(async()=>{I(!0),await h(A||"~")},[A,h]),ae=r.useCallback(async t=>{await h(t)},[h]),Fe=r.useCallback(async()=>{if(!m)return;const t=se==="win32"?"\\":"/",s=m.lastIndexOf(t);if(s<=0&&t==="/")await h("/");else if(s>=0){const a=m.substring(0,s)||(t==="/"?"/":"");await h(a)}},[m,se,h]),Pe=r.useCallback(async t=>{if(!u.some(s=>s.path===t)){k(!0);try{const s=await ue.createWorkspace({workspaceType:"existing",path:t});if(s.ok){const a=await s.json(),i=t.split(/[/\\]/).filter(Boolean).pop()||"project";E(P=>{var d;return[...P,{path:t,name:((d=a.project)==null?void 0:d.displayName)||i,type:"local"}]}),I(!1)}else{const a=await s.json();n(a.error||"Failed to add project")}}catch(s){n(s.message||"Failed to add project")}finally{k(!1)}}},[u]),Le=r.useCallback(async()=>{if(!x.trim())return;k(!0),C("Starting clone..."),n("");const t=x.trim().replace(/\.git$/,"").split("/").pop()||"repo",s=L?"":`/workspace/${t}`;try{const a=new URLSearchParams({path:s,githubUrl:x.trim()});w&&a.set("githubTokenId",w),await new Promise((i,P)=>{const d=new EventSource(`/api/projects/clone-progress?${a}`);d.onmessage=Ye=>{const g=JSON.parse(Ye.data);g.type==="progress"?C(g.message):g.type==="complete"?(d.close(),E(Je=>{var de,ce;return[...Je,{path:((de=g.project)==null?void 0:de.originalPath)||s,name:((ce=g.project)==null?void 0:ce.displayName)||t,type:"github",url:x.trim()}]}),H(""),C(""),i()):g.type==="error"&&(d.close(),P(new Error(g.message)))},d.onerror=()=>{d.close(),P(new Error("Connection lost during clone"))}})}catch(a){n(a.message||"Failed to clone repository"),C("")}finally{k(!1)}},[x,w]),Ge=r.useCallback(t=>{E(s=>s.filter((a,i)=>i!==t))},[]),Ee=r.useCallback(async()=>{try{const t=await p("/api/settings/credentials?type=github_token");if(t.ok){const s=await t.json();Ce(s.credentials||[]);const a=(s.credentials||[]).find(i=>i.is_active);a&&Z(a.id)}}catch{}},[]);r.useEffect(()=>{const t=re.current;re.current=l,(t===void 0||t!==null&&l===null)&&(oe(),ne(),ie())},[l]);const oe=async()=>{try{const t=await p("/api/cli/claude/status");if(t.ok){const s=await t.json();T({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else T({authenticated:!1,email:null,loading:!1,error:"Failed to check status"})}catch(t){T({authenticated:!1,email:null,loading:!1,error:t.message})}},ne=async()=>{try{const t=await p("/api/cli/cursor/status");if(t.ok){const s=await t.json();$({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else $({authenticated:!1,email:null,loading:!1,error:"Failed to check status"})}catch(t){$({authenticated:!1,email:null,loading:!1,error:t.message})}},ie=async()=>{try{const t=await p("/api/cli/codex/status");if(t.ok){const s=await t.json();B({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else B({authenticated:!1,email:null,loading:!1,error:"Failed to check status"})}catch(t){B({authenticated:!1,email:null,loading:!1,error:t.message})}},Ie=()=>v("claude"),Te=()=>v("cursor"),$e=()=>v("codex"),Be=t=>{t===0&&(l==="claude"?oe():l==="cursor"?ne():l==="codex"&&ie())},j=(t,s="right")=>{Ne(s),_(!0),setTimeout(()=>{be(t),_(!1)},200)},Re=async()=>{if(n(""),o===0){j(1,"right");return}if(o===1){if(!y.trim()||!f.trim()){n("Both git name and email are required");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(f)){n("Please enter a valid email address");return}N(!0);try{const s=await p("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:y,gitEmail:f})});if(!s.ok){const a=await s.json();throw new Error(a.error||"Failed to save git configuration")}Ee(),j(2,"right")}catch(s){n(s.message)}finally{N(!1)}return}if(o===2){j(3,"right");return}j(o+1,"right")},Oe=()=>{n(""),j(o-1,"left")},qe=async()=>{N(!0),n("");try{const t=await p("/api/user/complete-onboarding",{method:"POST"});if(!t.ok){const s=await t.json();throw new Error(s.error||"Failed to complete onboarding")}R&&R()}catch(t){n(t.message)}finally{N(!1)}},F=[{title:"Welcome",required:!1},{title:"Git Identity",required:!0},{title:"Projects",required:!1},{title:"Agents",required:!1}],Ue=()=>o===0?!0:o===1?y.trim()&&f.trim()&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(f):!0,le=[X,K,ee].filter(t=>t.authenticated).length,_e=[{icon:et,title:"AI Agents",desc:"Claude, Cursor & Codex — unified in one interface",gradient:"from-blue-500/10 to-blue-600/5",iconColor:"text-blue-500"},{icon:tt,title:"Canvas",desc:"Visual workspace with code blocks, diagrams & notes",gradient:"from-violet-500/10 to-violet-600/5",iconColor:"text-violet-500"},{icon:st,title:"Relay",desc:"Bridge your local machine to the web UI seamlessly",gradient:"from-amber-500/10 to-amber-600/5",iconColor:"text-amber-500"}],Me=[{name:"Claude Code",status:X,onLogin:Ie,logo:e.jsx(ze,{size:22}),accent:"blue"},{name:"Cursor",status:K,onLogin:Te,logo:e.jsx(He,{size:22}),accent:"violet"},{name:"OpenAI Codex",status:ee,onLogin:$e,logo:e.jsx(Ve,{className:"w-5 h-5"}),accent:"neutral"}],De=je?`opacity-0 ${ye==="right"?"translate-x-4":"-translate-x-4"}`:"opacity-100 translate-x-0";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4 sm:p-8",children:e.jsxs("div",{className:"w-full max-w-xl",children:[e.jsxs("div",{className:"mb-10",children:[e.jsx("div",{className:"flex items-center justify-between mb-3 px-1",children:F.map((t,s)=>e.jsxs("button",{onClick:()=>{s<o&&j(s,"left")},disabled:s>o,className:`text-xs font-medium tracking-wide uppercase transition-colors duration-300 ${s===o?"text-foreground":s<o?"text-primary cursor-pointer hover:text-primary/80":"text-muted-foreground/50"}`,children:[t.title,t.required&&s===o&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]},s))}),e.jsx("div",{className:"h-1 bg-muted/60 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-500 ease-out",style:{width:`${o/(F.length-1)*100}%`}})})]}),e.jsxs("div",{className:"bg-card rounded-2xl border border-border/60 shadow-xl shadow-black/[0.04] dark:shadow-black/[0.2] overflow-hidden",children:[e.jsxs("div",{className:`p-8 sm:p-10 transition-all duration-200 ease-out ${De}`,children:[o===0&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 text-primary text-xs font-medium mb-6",children:[e.jsx(Ke,{className:"w-3.5 h-3.5"}),"Quick setup — under a minute"]}),e.jsxs("h1",{className:"text-3xl sm:text-4xl font-bold text-foreground tracking-tight leading-tight",children:["Welcome to Upfyn",S!=null&&S.first_name?e.jsxs("span",{className:"text-primary",children:[", ",S.first_name]}):null]}),e.jsx("p",{className:"text-muted-foreground mt-3 text-base max-w-md mx-auto leading-relaxed",children:"Your visual AI coding interface. Connect your favorite agents, manage projects, and build faster."})]}),e.jsx("div",{className:"grid gap-3",children:_e.map((t,s)=>e.jsxs("div",{className:`group flex items-start gap-4 p-4 rounded-xl bg-gradient-to-r ${t.gradient} border border-border/40 hover:border-border/80 transition-all duration-200`,children:[e.jsx("div",{className:`mt-0.5 p-2 rounded-lg bg-background/80 ${t.iconColor} flex-shrink-0`,children:e.jsx(t.icon,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-foreground text-sm",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-sm mt-0.5",children:t.desc})]})]},s))})]}),o===1&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-5",children:e.jsx(rt,{className:"w-7 h-7 text-primary"})}),e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Git Identity"}),e.jsx("p",{className:"text-muted-foreground mt-2 text-sm max-w-sm mx-auto",children:"Set your name and email for commit attribution"})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"gitName",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[e.jsx(at,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Name"]}),e.jsx("input",{type:"text",id:"gitName",value:y,onChange:t=>O(t.target.value),className:"w-full px-4 py-3 border border-border/60 rounded-xl bg-background text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/40 transition-all duration-200",placeholder:"John Doe",required:!0,disabled:c})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"gitEmail",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[e.jsx(ot,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Email"]}),e.jsx("input",{type:"email",id:"gitEmail",value:f,onChange:t=>q(t.target.value),className:"w-full px-4 py-3 border border-border/60 rounded-xl bg-background text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/40 transition-all duration-200",placeholder:"john@example.com",required:!0,disabled:c})]}),e.jsxs("p",{className:"text-xs text-muted-foreground/70 text-center",children:["Applied as ",e.jsx("code",{className:"px-1 py-0.5 rounded bg-muted/60 text-xs",children:"git config --global"})," on your machine"]})]})]}),o===2&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-5",children:e.jsx(me,{className:"w-7 h-7 text-primary"})}),e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Add Projects"}),e.jsx("p",{className:"text-muted-foreground mt-2 text-sm max-w-sm mx-auto",children:L?"Select folders from your machine to work with":"Add GitHub repos or local folders as projects"})]}),u.length>0&&e.jsx("div",{className:"space-y-2",children:u.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-primary/5 border border-primary/20",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:t.type==="github"?e.jsx(xe,{className:"w-4 h-4 text-primary"}):e.jsx(he,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.url||t.path})]})]}),e.jsx("button",{onClick:()=>Ge(s),className:"p-1.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 rounded-lg transition-colors flex-shrink-0",children:e.jsx(ge,{className:"w-3.5 h-3.5"})})]},s))}),e.jsxs("div",{className:"space-y-3",children:[(L||te)&&!M&&e.jsxs("button",{onClick:Ae,disabled:b,className:"w-full flex items-center gap-3 p-4 rounded-xl border border-dashed border-border/60 hover:border-primary/40 hover:bg-primary/5 transition-all duration-200 text-left group",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-muted/60 group-hover:bg-primary/10 flex items-center justify-center flex-shrink-0 transition-colors",children:e.jsx(me,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary transition-colors"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Add Local Folder"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A?`Current: ${A}`:"Browse your filesystem"})]})]}),M&&e.jsxs("div",{className:"rounded-xl border border-border/60 bg-background overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/30 border-b border-border/40",children:[e.jsx("button",{onClick:Fe,disabled:W,className:"p-1 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors",title:"Go up",children:e.jsx(pe,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate flex-1",children:m}),e.jsx("button",{onClick:()=>Pe(m),disabled:b||!m,className:"px-2.5 py-1 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:opacity-90 disabled:opacity-50 transition-opacity",children:b?"Adding...":"Select This"}),e.jsx("button",{onClick:()=>I(!1),className:"p-1 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ge,{className:"w-3.5 h-3.5"})})]}),J.length>0&&e.jsx("div",{className:"flex gap-1 px-3 py-1.5 border-b border-border/30 bg-muted/10",children:J.map(t=>e.jsx("button",{onClick:()=>ae(t+"\\"),className:"px-2 py-0.5 text-[11px] font-mono rounded bg-muted/40 hover:bg-muted/70 text-muted-foreground hover:text-foreground transition-colors",children:t},t))}),e.jsx("div",{className:"max-h-48 overflow-y-auto",children:W?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(G,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):D.length===0?e.jsx("p",{className:"text-center text-xs text-muted-foreground py-6",children:"No folders found"}):D.map((t,s)=>e.jsxs("button",{onClick:()=>ae(t.path),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-muted/30 transition-colors text-left",children:[e.jsx(he,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-foreground truncate",children:t.name})]},s))})]}),!L&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-xl border border-border/60 bg-card",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-muted/60 flex items-center justify-center flex-shrink-0",children:e.jsx(xe,{className:"w-5 h-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-2",children:"Clone GitHub Repo"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:t=>H(t.target.value),placeholder:"https://github.com/user/repo",className:"flex-1 px-3 py-1.5 text-sm border border-border/60 rounded-lg bg-background text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-primary/30",disabled:b}),e.jsx("button",{onClick:Le,disabled:b||!x.trim(),className:"px-3 py-1.5 text-sm font-medium bg-foreground text-background rounded-lg hover:opacity-90 disabled:opacity-50 transition-opacity flex-shrink-0",children:b?e.jsx(G,{className:"w-4 h-4 animate-spin"}):e.jsx(nt,{className:"w-4 h-4"})})]}),V.length>0&&e.jsxs("select",{value:w,onChange:t=>Z(t.target.value),className:"mt-2 w-full px-2 py-1 text-xs border border-border/40 rounded-lg bg-background text-muted-foreground",children:[e.jsx("option",{value:"",children:"No token (public repos only)"}),V.map(t=>e.jsx("option",{value:t.id,children:t.credential_name},t.id))]}),Q&&e.jsx("p",{className:"mt-2 text-xs text-primary animate-pulse",children:Q})]})]}),!te&&e.jsxs("p",{className:"text-xs text-muted-foreground/60 text-center",children:["Connect your machine with ",e.jsx("code",{className:"px-1 py-0.5 rounded bg-muted/60 text-[11px]",children:"uc web connect"})," to add local folders"]})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground/60 text-center",children:u.length===0?"You can skip this and add projects later.":`${u.length} project${u.length>1?"s":""} added`})]}),o===3&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Connect Your Agents"}),e.jsxs("p",{className:"text-muted-foreground mt-2 text-sm max-w-sm mx-auto",children:["Optional — login to one or more AI assistants.",le>0&&e.jsxs("span",{className:"text-primary font-medium",children:[" ",le," connected"]})]})]}),e.jsx("div",{className:"space-y-3",children:Me.map((t,s)=>{const a=t.status.authenticated,i=t.status.loading;return e.jsxs("div",{className:`group flex items-center justify-between p-4 rounded-xl border transition-all duration-200 ${a?"bg-primary/5 border-primary/20":"bg-card border-border/50 hover:border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${a?"bg-primary/10":"bg-muted/60"}`,children:t.logo}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-sm text-foreground flex items-center gap-2",children:[t.name,a&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md bg-green-500/10 text-green-600 dark:text-green-400 text-[10px] font-semibold uppercase tracking-wider",children:[e.jsx(it,{className:"w-3 h-3"}),"Connected"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:i?"Checking...":a?t.status.email||"Ready to use":"Not connected"})]})]}),!a&&!i&&e.jsx("button",{onClick:t.onLogin,className:"px-4 py-2 text-sm font-medium rounded-lg bg-foreground text-background hover:opacity-90 transition-opacity flex-shrink-0",children:"Connect"})]},s)})}),e.jsx("p",{className:"text-xs text-muted-foreground/60 text-center",children:"You can always add or change these in Settings later."})]})]}),U&&e.jsx("div",{className:"mx-8 sm:mx-10 mb-2 p-3 rounded-xl bg-destructive/10 border border-destructive/20",children:e.jsx("p",{className:"text-sm text-destructive",children:U})}),e.jsxs("div",{className:"flex items-center justify-between px-8 sm:px-10 py-5 border-t border-border/40 bg-muted/20",children:[e.jsxs("button",{onClick:Oe,disabled:o===0||c,className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground disabled:opacity-0 disabled:pointer-events-none transition-all duration-200",children:[e.jsx(pe,{className:"w-4 h-4"}),"Back"]}),o<F.length-1?e.jsx("button",{onClick:Re,disabled:!Ue()||c,className:"flex items-center gap-2 px-6 py-2.5 bg-primary text-primary-foreground font-medium text-sm rounded-xl hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 shadow-sm",children:c?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):o===0?e.jsxs(e.Fragment,{children:["Get Started",e.jsx(fe,{className:"w-4 h-4"})]}):e.jsxs(e.Fragment,{children:["Continue",e.jsx(lt,{className:"w-4 h-4"})]})}):e.jsx("button",{onClick:qe,disabled:c,className:"flex items-center gap-2 px-6 py-2.5 bg-primary text-primary-foreground font-medium text-sm rounded-xl hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 shadow-sm",children:c?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 animate-spin"}),"Finishing..."]}):e.jsxs(e.Fragment,{children:["Start Building",e.jsx(fe,{className:"w-4 h-4"})]})})]})]}),e.jsxs("p",{className:"text-center text-xs text-muted-foreground/50 mt-6",children:["Step ",o+1," of ",F.length]})]})}),l&&e.jsx(We,{isOpen:!!l,onClose:()=>v(null),provider:l,project:ve,onComplete:Be,isOnboarding:!0})]})};export{jt as default};
@@ -1 +0,0 @@
1
- import{r as t,j as e}from"./vendor-react-96lCPsRK.js";import{i as y}from"./index-HaY-3pK1.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-icons-GyYE35HP.js";import"./vendor-i18n-DCFGyhQR.js";const E=()=>{const[a,f]=t.useState(""),[d,p]=t.useState(""),[l,x]=t.useState(""),[n,g]=t.useState(""),[u,h]=t.useState(""),[s,i]=t.useState(!1),[c,o]=t.useState(""),{register:j}=y(),N=async r=>{if(r.preventDefault(),o(""),n!==u){o("Passwords do not match");return}if(!a.trim()||a.trim().length<2){o("Name must be at least 2 characters");return}if(!d.trim()||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(d)){o("Please enter a valid email address");return}if(n.length<6){o("Password must be at least 6 characters");return}i(!0);const m=a.trim().split(" "),w=m[0]||a.trim(),v=m.slice(1).join(" ")||"",b=await j(w,v,n,d.trim(),l.trim()||null);b.success||o(b.error),i(!1)};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/logo.svg",alt:"UpfynAI",className:"w-16 h-16",onError:r=>{r.target.style.display="none"}})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Create Your Account"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign up to start using UpfynAI"})]}),e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:"Full Name"}),e.jsx("input",{type:"text",id:"name",value:a,onChange:r=>f(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Your full name",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"Email"}),e.jsx("input",{type:"email",id:"email",value:d,onChange:r=>p(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"you@example.com",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"phone",className:"block text-sm font-medium text-foreground mb-1",children:"Mobile Number"}),e.jsx("input",{type:"tel",id:"phone",value:l,onChange:r=>x(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"+91 9876543210",disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),e.jsx("input",{type:"password",id:"password",value:n,onChange:r=>g(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"At least 6 characters",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),e.jsx("input",{type:"password",id:"confirmPassword",value:u,onChange:r=>h(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:s})]}),c&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),e.jsx("button",{type:"submit",disabled:s,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:s?"Creating account...":"Create Account"})]})]})})})};export{E as default};