@codeyam/codeyam-cli 0.1.0-staging.ad88eeb → 0.1.0-staging.b6c4c78

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 (279) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +2 -2
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/aws/package.json +1 -1
  6. package/analyzer-template/packages/database/package.json +1 -1
  7. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +72 -0
  8. package/analyzer-template/packages/database/src/lib/loadEntities.ts +0 -6
  9. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +0 -65
  10. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +6 -0
  11. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
  12. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +72 -0
  13. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  14. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  15. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +0 -6
  16. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  17. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  18. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +0 -25
  19. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  20. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +45 -0
  21. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
  22. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
  23. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  24. package/codeyam-cli/src/commands/editor.js +1810 -386
  25. package/codeyam-cli/src/commands/editor.js.map +1 -1
  26. package/codeyam-cli/src/commands/init.js +68 -34
  27. package/codeyam-cli/src/commands/init.js.map +1 -1
  28. package/codeyam-cli/src/data/techStacks.js +2 -7
  29. package/codeyam-cli/src/data/techStacks.js.map +1 -1
  30. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
  31. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
  32. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
  33. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
  34. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +18 -8
  35. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
  36. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +353 -1
  37. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  38. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
  39. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
  40. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +27 -2
  41. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -1
  42. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +6 -3
  43. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
  44. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +223 -0
  45. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
  46. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +163 -1
  47. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
  48. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +430 -0
  49. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
  50. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +88 -1
  51. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
  52. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +47 -1
  53. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
  54. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +968 -1
  55. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  56. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +67 -0
  57. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
  58. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
  59. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
  60. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
  61. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
  62. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +102 -10
  63. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
  64. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +30 -2
  65. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -1
  66. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
  67. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
  68. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +227 -0
  69. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
  70. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +426 -218
  71. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
  72. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +1 -0
  73. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  74. package/codeyam-cli/src/utils/analysisRunner.js +3 -1
  75. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  76. package/codeyam-cli/src/utils/analyzer.js +9 -0
  77. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  78. package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
  79. package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
  80. package/codeyam-cli/src/utils/backgroundServer.js +92 -16
  81. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  82. package/codeyam-cli/src/utils/database.js +37 -2
  83. package/codeyam-cli/src/utils/database.js.map +1 -1
  84. package/codeyam-cli/src/utils/editorApi.js +11 -5
  85. package/codeyam-cli/src/utils/editorApi.js.map +1 -1
  86. package/codeyam-cli/src/utils/editorAudit.js +51 -0
  87. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  88. package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
  89. package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
  90. package/codeyam-cli/src/utils/editorDevServer.js +5 -1
  91. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -1
  92. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +1 -1
  93. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
  94. package/codeyam-cli/src/utils/editorEntityHelpers.js +129 -0
  95. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
  96. package/codeyam-cli/src/utils/editorLoaderHelpers.js +60 -1
  97. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
  98. package/codeyam-cli/src/utils/editorMigration.js +224 -0
  99. package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
  100. package/codeyam-cli/src/utils/editorPreview.js +31 -0
  101. package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
  102. package/codeyam-cli/src/utils/editorScenarios.js +309 -0
  103. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  104. package/codeyam-cli/src/utils/editorSeedAdapter.js +183 -4
  105. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
  106. package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
  107. package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
  108. package/codeyam-cli/src/utils/entityChangeStatus.js +16 -3
  109. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
  110. package/codeyam-cli/src/utils/entityChangeStatus.server.js +41 -3
  111. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
  112. package/codeyam-cli/src/utils/install-skills.js +9 -0
  113. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  114. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -1
  115. package/codeyam-cli/src/utils/progress.js +2 -2
  116. package/codeyam-cli/src/utils/progress.js.map +1 -1
  117. package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
  118. package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
  119. package/codeyam-cli/src/utils/scenarioCoverage.js +74 -0
  120. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
  121. package/codeyam-cli/src/utils/scenariosManifest.js +207 -75
  122. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
  123. package/codeyam-cli/src/utils/serverState.js +30 -0
  124. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  125. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -0
  126. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  127. package/codeyam-cli/src/utils/simulationGateMiddleware.js +8 -1
  128. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
  129. package/codeyam-cli/src/utils/slugUtils.js +25 -0
  130. package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
  131. package/codeyam-cli/src/utils/syncMocksMiddleware.js +2 -2
  132. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  133. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +40 -0
  134. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
  135. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +389 -0
  136. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
  137. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +146 -0
  138. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
  139. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +65 -0
  140. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
  141. package/codeyam-cli/src/webserver/app/lib/git.js +3 -2
  142. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -1
  143. package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
  144. package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
  145. package/codeyam-cli/src/webserver/backgroundServer.js +18 -4
  146. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  147. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CzTDWkF2.js +1 -0
  148. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-BFbq6iFk.js} +3 -3
  149. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
  150. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-B6OMi58N.js} +1 -1
  151. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-DuYodzo1.js +1 -0
  152. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CXo9EeCl.js +25 -0
  153. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DYCNb2It.js +3 -0
  154. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
  155. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-CZgY3sxX.js} +3 -3
  156. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-CnYYwRDw.js} +2 -2
  157. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CDoF7ZpU.js +1 -0
  158. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-0DY_NKil.js → ScenarioViewer-DrnfvaLL.js} +3 -3
  159. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +34 -0
  160. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
  161. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-DRKR9T0U.js +1 -0
  162. package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-ClR-g3tY.js} +2 -2
  163. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-DTH6ydEA.js} +3 -3
  164. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-74hnHF59.js} +1 -1
  165. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-B8CYhCO9.js} +3 -3
  166. package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
  167. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
  168. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
  169. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
  170. package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
  171. package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-CLaoh4ac.js} +1 -1
  172. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-BZ2DZxbW.js} +1 -1
  173. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-C4pqxYJB.js → chunk-JZWAC4HX-BBXArFPl.js} +13 -21
  174. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-CT4unAk-.js} +1 -1
  175. package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-zK0B6Nu-.js} +1 -1
  176. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-DJB0YQJL.js} +1 -1
  177. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CkXFP_i-.js +1 -0
  178. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +1 -0
  179. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-y_5LB2iU.js +58 -0
  180. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DBa7T2FK.js +41 -0
  181. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BF4oLwaE.js → entity._sha._-BqAN7hyG.js} +2 -2
  182. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BOi8kpwd.js +6 -0
  183. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js +6 -0
  184. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CJX6kkkV.js +6 -0
  185. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-BhVjZhKg.js} +2 -2
  186. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-_gzKltPN.js} +6 -6
  187. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
  188. package/codeyam-cli/src/webserver/build/client/assets/files-CV_17tZS.js +1 -0
  189. package/codeyam-cli/src/webserver/build/client/assets/git-D-YXmMbR.js +1 -0
  190. package/codeyam-cli/src/webserver/build/client/assets/globals-BCTpZEY8.css +1 -0
  191. package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-Blo6EK8G.js} +1 -1
  192. package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-BsX0F-9C.js} +1 -1
  193. package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-CCrgCshv.js} +1 -1
  194. package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
  195. package/codeyam-cli/src/webserver/build/client/assets/labs-Byazq8Pv.js +1 -0
  196. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-DVQ0oHR7.js} +1 -1
  197. package/codeyam-cli/src/webserver/build/client/assets/manifest-5f1c29f5.js +1 -0
  198. package/codeyam-cli/src/webserver/build/client/assets/memory-b-VmA2Vj.js +101 -0
  199. package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-DGcndCAa.js} +1 -1
  200. package/codeyam-cli/src/webserver/build/client/assets/root-BBCQJ_ZM.js +67 -0
  201. package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-C0Uw0bcK.js} +1 -1
  202. package/codeyam-cli/src/webserver/build/client/assets/settings-OoNgHIfW.js +1 -0
  203. package/codeyam-cli/src/webserver/build/client/assets/simulations-Bcemfu8a.js +1 -0
  204. package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-BgMmG7R9.js} +1 -1
  205. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-Cs87hJYK.js} +1 -1
  206. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BR3Rs7JY.js +1 -0
  207. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-C14nCb1q.js → useLastLogLine-BxxP_XF9.js} +1 -1
  208. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BermyNU5.js +1 -0
  209. package/codeyam-cli/src/webserver/build/client/assets/useToast-a_QN_W9_.js +1 -0
  210. package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
  211. package/codeyam-cli/src/webserver/build/server/assets/index-BLKsJR3o.js +1 -0
  212. package/codeyam-cli/src/webserver/build/server/assets/init-C2iMAqYu.js +10 -0
  213. package/codeyam-cli/src/webserver/build/server/assets/server-build-DR42Xd5a.js +489 -0
  214. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  215. package/codeyam-cli/src/webserver/build-info.json +5 -5
  216. package/codeyam-cli/src/webserver/editorProxy.js +309 -13
  217. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  218. package/codeyam-cli/src/webserver/idleDetector.js +73 -0
  219. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
  220. package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
  221. package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
  222. package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
  223. package/codeyam-cli/src/webserver/server.js +55 -4
  224. package/codeyam-cli/src/webserver/server.js.map +1 -1
  225. package/codeyam-cli/src/webserver/terminalServer.js +153 -33
  226. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  227. package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
  228. package/codeyam-cli/templates/chrome-extension-react/package.json +1 -0
  229. package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +6 -0
  230. package/codeyam-cli/templates/codeyam-editor-claude.md +84 -5
  231. package/codeyam-cli/templates/editor-step-hook.py +107 -24
  232. package/codeyam-cli/templates/expo-react-native/README.md +41 -0
  233. package/codeyam-cli/templates/expo-react-native/package.json +1 -0
  234. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +14 -0
  235. package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
  236. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +1 -0
  237. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +42 -7
  238. package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
  239. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +1 -0
  240. package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
  241. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +1 -1
  242. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +76 -10
  243. package/package.json +1 -1
  244. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +72 -0
  245. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  246. package/packages/database/src/lib/loadEntities.js +0 -6
  247. package/packages/database/src/lib/loadEntities.js.map +1 -1
  248. package/packages/database/src/lib/updateCommitMetadata.js +0 -25
  249. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  250. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
  251. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
  252. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
  253. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
  254. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
  255. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
  256. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
  257. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
  259. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Csi0_PMl.js +0 -1
  260. package/codeyam-cli/src/webserver/build/client/assets/editor-BuT_Huj0.js +0 -10
  261. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-B7ztwLut.js +0 -41
  262. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D5rYBT5x.js +0 -6
  263. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +0 -6
  264. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
  265. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
  266. package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
  267. package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
  268. package/codeyam-cli/src/webserver/build/client/assets/globals-BkWJ_UNc.css +0 -1
  269. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
  270. package/codeyam-cli/src/webserver/build/client/assets/manifest-b0f1372e.js +0 -1
  271. package/codeyam-cli/src/webserver/build/client/assets/memory-Bl2rpw8u.js +0 -96
  272. package/codeyam-cli/src/webserver/build/client/assets/root-B_X8HS1x.js +0 -67
  273. package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
  274. package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
  275. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +0 -1
  276. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
  277. package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
  278. package/codeyam-cli/src/webserver/build/server/assets/index-CbF6h3dj.js +0 -1
  279. package/codeyam-cli/src/webserver/build/server/assets/server-build-DRFwTJqO.js +0 -367
@@ -1 +1 @@
1
- {"version":3,"file":"loadEntities.js","sourceRoot":"","sources":["../../../../../../packages/database/src/lib/loadEntities.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"loadEntities.js","sourceRoot":"","sources":["../../../../../../packages/database/src/lib/loadEntities.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAa1C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,YAAY,CAAC,EACzC,SAAS,EACT,QAAQ,EACR,OAAO,EACP,SAAS,EACT,KAAK,EACL,IAAI,EACJ,eAAe,GACE;IACjB,IACE,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;QAChC,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC;QACpC,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;QAC5B,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,EAC1B,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;YACpC,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC;gBACvC,SAAS;gBACT,QAAQ;gBACR,OAAO;gBACP,SAAS;gBACT,KAAK;gBACL,IAAI,EAAE,KAAK;gBACX,eAAe;aAChB,CAAC,CAAC;YAEH,IAAI,aAAa,EAAE,CAAC;gBAClB,WAAW,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,IAAI,CAAC;QACH,oFAAoF;QACpF,mEAAmE;QACnE,MAAM,SAAS,GAAG,eAAe;YAC/B,CAAC,CAAC,EAAE;iBACC,UAAU,CAAC,UAAU,CAAC;iBACtB,MAAM,CAAC;gBACN,qBAAqB;gBACrB,kBAAkB;gBAClB,oBAAoB;gBACpB,eAAe;gBACf,cAAc;gBACd,sBAAsB;gBACtB,oBAAoB;gBACpB,sBAAsB;gBACtB,wBAAwB;gBACxB,kBAAkB;gBAClB,qBAAqB;gBACrB,qBAAqB;aACtB,CAAC;YACN,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAEpD,MAAM,KAAK,GAAG,SAAS;aACpB,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CACtB,EAAE;aACC,SAAS,CACR,iBAAiB,EACjB,4BAA4B,EAC5B,cAAc,CACf;aACA,KAAK,CAAC,2BAA2B,EAAE,GAAG,EAAE,QAAQ,CAAC,CACrD;aACA,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;aACzE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;aACzD,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;aACzE,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;aAC5D,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QAEvE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAEvC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,KAAK,EAAE;YAClD,SAAS;YACT,OAAO;YACP,SAAS;YACT,IAAI;SACL,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -26,13 +26,6 @@ export default async function updateCommitMetadata({ commitId, commitSha, metada
26
26
  // if the convenience parameter for latest run was supplied, merge it in
27
27
  if (runStatusUpdate) {
28
28
  runStatusUpdate.lastUpdatedAt ?? (runStatusUpdate.lastUpdatedAt = new Date().toISOString());
29
- if (runStatusUpdate.currentEntityShas !== undefined) {
30
- console.log(`[updateCommitMetadata] Updating currentRun.currentEntityShas`);
31
- console.log(`[updateCommitMetadata] Commit SHA: ${commitSha}`);
32
- console.log(`[updateCommitMetadata] Previous entity SHAs:`, currentMetadata.currentRun?.currentEntityShas);
33
- console.log(`[updateCommitMetadata] New entity SHAs:`, runStatusUpdate.currentEntityShas);
34
- console.log(`[updateCommitMetadata] Archive flag:`, archiveCurrentRun);
35
- }
36
29
  metadataUpdate = deepMerge(metadataUpdate ?? {}, {
37
30
  currentRun: runStatusUpdate,
38
31
  });
@@ -46,32 +39,14 @@ export default async function updateCommitMetadata({ commitId, commitSha, metada
46
39
  : currentMetadata;
47
40
  // Archive current run if requested
48
41
  if (archiveCurrentRun && updatedMetadata.currentRun) {
49
- console.log(`[updateCommitMetadata] ========================================`);
50
- console.log(`[updateCommitMetadata] ARCHIVING CURRENT RUN`);
51
- console.log(`[updateCommitMetadata] Commit SHA: ${commitSha}`);
52
- console.log(`[updateCommitMetadata] Current run entity SHAs:`, updatedMetadata.currentRun.currentEntityShas);
53
- console.log(`[updateCommitMetadata] Current run PIDs: analyzer=${updatedMetadata.currentRun.analyzerPid}, capture=${updatedMetadata.currentRun.capturePid}`);
54
- console.log(`[updateCommitMetadata] Current run completed: analyses=${updatedMetadata.currentRun.analysesCompleted}, captures=${updatedMetadata.currentRun.capturesCompleted}`);
55
- console.log(`[updateCommitMetadata] Historical runs before archiving: ${updatedMetadata.historicalRuns?.length || 0}`);
56
42
  const runToArchive = {
57
43
  ...updatedMetadata.currentRun,
58
44
  archivedAt: new Date().toISOString(),
59
45
  };
60
- console.log(`[updateCommitMetadata] Run to archive:`, JSON.stringify(runToArchive, null, 2));
61
46
  updatedMetadata.historicalRuns = [
62
47
  ...(updatedMetadata.historicalRuns || []),
63
48
  runToArchive,
64
49
  ];
65
- console.log(`[updateCommitMetadata] Historical runs after archiving: ${updatedMetadata.historicalRuns.length}`);
66
- console.log(`[updateCommitMetadata] All historical runs:`, JSON.stringify(updatedMetadata.historicalRuns.map((r) => ({
67
- entityShas: r.currentEntityShas,
68
- archivedAt: r.archivedAt,
69
- completed: {
70
- analyses: r.analysesCompleted,
71
- captures: r.capturesCompleted,
72
- },
73
- })), null, 2));
74
- console.log(`[updateCommitMetadata] ========================================`);
75
50
  }
76
51
  // Allow callback to perform complex atomic updates
77
52
  if (updateCallback) {
@@ -1 +1 @@
1
- {"version":3,"file":"updateCommitMetadata.js","sourceRoot":"","sources":["../../../../../../packages/database/src/lib/updateCommitMetadata.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"updateCommitMetadata.js","sourceRoot":"","sources":["../../../../../../packages/database/src/lib/updateCommitMetadata.ts"],"names":[],"mappings":"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"}
@@ -1 +0,0 @@
1
- import{r as i,j as o}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{C as x,a as m}from"./copy-n2FB0_Sw.js";function y({content:a,label:l="Copy",copiedLabel:p="✓ Copied!",className:c="",duration:t=2e3,ariaLabel:C,icon:n=!1,iconSize:s=14}){const[e,r]=i.useState(!1),d=i.useCallback(()=>{navigator.clipboard.writeText(a).then(()=>{r(!0),setTimeout(()=>r(!1),t)}).catch(u=>{console.error("Failed to copy:",u)})},[a,t]);return o.jsx("button",{onClick:d,className:`cursor-pointer ${c}`,disabled:e,"aria-label":C||(e?"Copied to clipboard":"Copy to clipboard"),"aria-live":"polite",children:n?e?o.jsx(x,{size:s,className:"text-green-500"}):o.jsx(m,{size:s}):e?p:l})}export{y as C};
@@ -1 +0,0 @@
1
- import{j as o}from"./chunk-JZWAC4HX-C4pqxYJB.js";const l={visual:{label:"VISUAL",bgColor:"#f9f9f9",textColor:"#9040f5"},library:{label:"LIBRARY",bgColor:"#f9f9f9",textColor:"#06b6d5"},type:{label:"TYPE",bgColor:"#ffe1e1",textColor:"#db2627"},other:{label:"OTHER",bgColor:"#f9f9f9",textColor:"#646464"}};function n({type:t,className:r=""}){const e=l[t]||l.other;return o.jsx("div",{className:`inline-flex items-center justify-center px-[4px] rounded-[4px] ${r}`,style:{backgroundColor:e.bgColor,color:e.textColor,height:"15px"},children:o.jsx("span",{className:"text-[10px] font-['IBM_Plex_Sans'] font-semibold leading-[15px] uppercase",children:e.label})})}export{n as E};
@@ -1 +0,0 @@
1
- import{r as e,j as c}from"./chunk-JZWAC4HX-C4pqxYJB.js";const n=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],o=80;function i(){const[t,r]=e.useState(0);return e.useEffect(()=>{const s=setInterval(()=>{r(a=>(a+1)%n.length)},o);return()=>clearInterval(s)},[]),c.jsx("span",{className:"inline-block mr-2",children:n[t]})}export{i as I};
@@ -1,25 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BcvgDzbZ.js","assets/chunk-JZWAC4HX-C4pqxYJB.js","assets/index-10oVnAAH.js","assets/styles-CMKNK2uU.css"])))=>i.map(i=>d[i]);
2
- import{r as t,j as e}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as L}from"./preload-helper-ckwbz45p.js";import{u as Q}from"./useLastLogLine-C14nCb1q.js";import{S as P}from"./Spinner-Bb5uFQ5V.js";import{I as B}from"./InlineSpinner-Bu6c6aDe.js";const $=t.createContext({dimensions:{height:720,width:1200},updateDimensions:()=>{},iframeRef:{current:null},scale:1,updateScale:()=>{},maxWidth:1200,updateMaxWidth:()=>{}}),U=()=>{const o=t.useContext($);if(!o)throw new Error("useWebContainer must be used within a WebContainerProvider");return o},le=({children:o})=>{const[i,r]=t.useState({height:720,width:1200}),[d,f]=t.useState(1),[u,g]=t.useState(1200),x=t.useRef(null),h=t.useCallback(({height:l,width:j})=>{r(S=>({height:l??S.height,width:j??S.width}))},[]),v=t.useCallback(l=>{f(l)},[]),w=t.useCallback(l=>{g(l)},[]);return e.jsx($.Provider,{value:{dimensions:i,updateDimensions:h,iframeRef:x,scale:d,updateScale:v,maxWidth:u,updateMaxWidth:w},children:o})},X=typeof window<"u";function Z(){const[o,i]=t.useState(null);return t.useEffect(()=>{L(()=>import("./index-BcvgDzbZ.js").then(r=>r.i),__vite__mapDeps([0,1,2])).then(r=>{i(()=>r.ResizableBox)}),L(()=>Promise.resolve({}),__vite__mapDeps([3]))},[]),o}const ee=1200,te=720,H=30,se=({id:o,scenarioName:i,iframeUrl:r,defaultWidth:d=1440,defaultHeight:f=900,onDataOverride:u,onIframeLoad:g,onScaleChange:x,onDimensionChange:h})=>{const v=Z(),[w,l]=t.useState(!1),[j,S]=t.useState(!1),[c,A]=t.useState(ee),[_,D]=t.useState(te),[E,T]=t.useState(null),[M,I]=t.useState(null),{dimensions:a,updateDimensions:y,iframeRef:m,updateScale:N,updateMaxWidth:R}=U(),k=t.useMemo(()=>Math.min(1,c/a.width),[c,a.width]),p=M!==null?M:k;t.useEffect(()=>{w||(N(p),x==null||x(p))},[p,N,x,w]),t.useEffect(()=>{R(c)},[c,R]);const G=t.useCallback(()=>{l(!0),I(k)},[k]),O=t.useCallback(()=>{l(!1),I(null)},[]),V=t.useCallback((n,s)=>{const b=M!==null?M:1,z=Math.round(s.size.width/b);y({width:z}),h==null||h(z,a.height)},[y,M,h,a.height]),F=t.useCallback(()=>{setTimeout(()=>{S(!0)},100),g&&g()},[g]);t.useEffect(()=>{const n=s=>{if(s.data.type==="codeyam-resize"){if(i&&s.data.name!==i||a.height===s.data.height||s.data.height===0)return;y({height:s.data.height})}};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[m,i,d,a,y]),t.useEffect(()=>{j&&u&&u(m.current)},[j,u,m]),t.useEffect(()=>{if(!i)return;const n=setInterval(()=>{var s,b;(b=(s=m==null?void 0:m.current)==null?void 0:s.contentWindow)==null||b.postMessage({type:"codeyam-respond",name:i},"*")},1e3);return()=>clearInterval(n)},[i,m]),t.useEffect(()=>{const n=()=>{const s=document.getElementById("scenario-container");if(!s)return;const b=s.getBoundingClientRect(),z=s.clientWidth-H*2,q=window.innerHeight-b.top-H*2,J=Math.max(q,400),K=window.innerHeight-b.top;A(z),D(J),T(K)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t.useEffect(()=>{y({width:d,height:f})},[d,f,y]);const C=t.useMemo(()=>a.width*p,[a.width,p]),W=t.useMemo(()=>{const n=a.height,s=n*p;return n&&n!==720&&n!==900&&s<_?s:_},[a.height,_,p]),Y=t.useCallback(()=>{window.history.back()},[]);return!X||!v?e.jsx("div",{className:"relative bg-gray-100 w-full h-full flex items-center justify-center",children:e.jsx("p",{className:"text-gray-500",children:"Loading interactive view..."})}):e.jsxs("div",{id:"scenario-container",className:"relative bg-gray-100 w-full flex items-center justify-center",style:E?{height:`${E}px`}:{},children:[w&&e.jsx("div",{className:"fixed inset-0 z-50 bg-transparent"}),e.jsx("style",{children:`
3
- .react-resizable-handle-e {
4
- display: flex !important;
5
- align-items: center !important;
6
- justify-content: center !important;
7
- width: 6px !important;
8
- height: 48px !important;
9
- right: -8px !important;
10
- top: 50% !important;
11
- transform: translateY(-50%) !important;
12
- cursor: ew-resize !important;
13
- background: #d1d5db !important;
14
- border-radius: 3px !important;
15
- opacity: 0 !important;
16
- transition: all 0.2s ease !important;
17
- }
18
- .react-resizable-handle-e:hover {
19
- opacity: 0.8 !important;
20
- background: #9ca3af !important;
21
- }
22
- .react-resizable:hover .react-resizable-handle-e {
23
- opacity: 0.4 !important;
24
- }
25
- `}),e.jsx(v,{width:C,height:W,minConstraints:[300,200],maxConstraints:[c,_],className:"relative bg-white rounded-lg shadow-md",resizeHandles:["e"],onResizeStart:G,onResizeStop:O,onResize:V,children:e.jsx("div",{className:"overflow-auto",style:{width:`${C}px`,height:`${W}px`},children:e.jsx("div",{style:{width:`${a.width}px`,height:`${a.height}px`,transform:`scale(${p})`,transformOrigin:"top left"},children:r?e.jsx("iframe",{ref:m,className:"w-full h-full rounded-lg",src:r,onLoad:F,sandbox:"allow-scripts allow-same-origin"}):e.jsxs("p",{className:"w-full h-full flex flex-col gap-3 items-center justify-center",children:[e.jsx("span",{className:"text-xl font-light",children:"Oops! Looks like this scenario is not available yet. Please check back later."}),e.jsx("span",{className:"text-blue-600 cursor-pointer",onClick:Y,children:"Go back"})]})})})},`resizable-box-${o}`)]})};function ce({scenarioId:o,scenarioName:i,iframeUrl:r,isStarting:d,isLoading:f,showIframe:u,iframeKey:g,onIframeLoad:x,onScaleChange:h,onDimensionChange:v,projectSlug:w,defaultWidth:l=1440,defaultHeight:j=900,retryCount:S=0}){const{lastLine:c}=Q(w??null,d||f);return r?e.jsxs("div",{className:"flex-1 min-h-0 relative",style:{background:"transparent"},children:[e.jsx("div",{style:{opacity:u?1:0,background:"transparent"},children:e.jsx(se,{id:o,scenarioName:i,iframeUrl:r,defaultWidth:l,defaultHeight:j,onIframeLoad:x,onScaleChange:h,onDimensionChange:v},g)}),!u&&(d||f)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-white rounded-lg p-8 shadow-sm w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(P,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Starting Interactive Mode"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Setting up a sandboxed environment for your component"}),c&&e.jsxs("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 mt-3 font-['IBM_Plex_Mono'] uppercase",children:[e.jsx(B,{}),c]})]})]})})]}):e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-12 text-center",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 w-[500px] h-[300px] bg-white rounded-lg p-8 shadow-sm",children:[e.jsx("div",{className:"mb-4",children:e.jsx(P,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Starting Interactive Mode"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Setting up a sandboxed environment for your component"}),c&&e.jsxs("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 mt-3 font-['IBM_Plex_Mono'] uppercase",children:[e.jsx(B,{}),c]})]})]})})}export{ce as I,le as W,U as u};
@@ -1,3 +0,0 @@
1
- import{j as r,L as C}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{g as L}from"./scenarioStatus-B_8jpV3e.js";function M({scenario:s,entitySha:m,size:g="medium",showBorder:j=!0,isOutdated:E=!1}){var x,h,u,p,$,f;const t=L(s,void 0,void 0,m,void 0),e=(x=s.metadata)==null?void 0:x.executionResult,o=!!e,b=(((u=(h=s.metadata)==null?void 0:h.data)==null?void 0:u.argumentsData)||[]).length,c=(e==null?void 0:e.returnValue)!==void 0&&(e==null?void 0:e.returnValue)!==null,i=(($=(p=e==null?void 0:e.sideEffects)==null?void 0:p.consoleOutput)==null?void 0:$.length)||0,d=((f=e==null?void 0:e.timing)==null?void 0:f.duration)||0;let a=0;b>0&&a++,b>2&&a++,c&&a++,i>0&&a++,a=Math.min(3,a);const l=g==="small"?{width:"w-[50px]",height:"h-[38px]",iconSize:"text-base",textSize:"text-[8px]"}:{width:"w-20",height:"h-15",iconSize:"text-xl",textSize:"text-[10px]"},n=t.hasError?{border:"border-red-400",bg:"bg-red-50",icon:"text-red-600",badge:"bg-red-100 text-red-700"}:o?E?{border:"border-amber-500",bg:"bg-amber-50",icon:"text-amber-700",badge:"bg-amber-100 text-amber-700"}:{border:"border-blue-400",bg:"bg-blue-50",icon:"text-blue-600",badge:"bg-blue-100 text-blue-700"}:{border:"border-gray-300 border-dashed",bg:"bg-gray-50",icon:"text-gray-400",badge:"bg-gray-100 text-gray-600"},w=j?`border-2 ${n.border}`:"",S=Array.from({length:3},(v,y)=>r.jsx("div",{className:`w-1 h-1 rounded-full ${y<a?n.icon.replace("text-","bg-"):"bg-gray-300"}`},y)),N=t.hasError?`Error: ${t.errorMessage||"Unknown error"}`:o?`${s.name}
2
- ${b} args → ${c?"value":"void"}${i>0?` (${i} logs)`:""}
3
- ${d}ms`:`Not executed: ${s.name}`;return r.jsxs(C,{to:`/entity/${m}/scenarios/${s.id}`,className:`relative ${l.width} ${l.height} ${w} rounded ${n.bg} flex flex-col items-center justify-center gap-0.5 cursor-pointer transition-all hover:scale-105 hover:shadow-md`,title:N,onClick:v=>v.stopPropagation(),children:[r.jsx("div",{className:`${n.icon} ${l.iconSize} font-mono font-bold`,children:t.hasError?"⚠":o?"ƒ":"○"}),o&&!t.hasError&&r.jsxs("div",{className:`flex items-center gap-0.5 ${l.textSize} ${n.badge} px-1 rounded`,children:[r.jsx("span",{children:b}),r.jsx("span",{children:"→"}),r.jsx("span",{children:c?"✓":"∅"})]}),o&&!t.hasError&&g==="medium"&&r.jsx("div",{className:"flex gap-0.5 mt-0.5",children:S}),o&&!t.hasError&&d>100&&g==="medium"&&r.jsx("div",{className:`absolute top-0.5 right-0.5 ${l.textSize} ${n.badge} px-1 rounded`,children:d>1e3?`${Math.round(d/1e3)}s`:`${d}ms`}),o&&!t.hasError&&i>0&&g==="medium"&&r.jsxs("div",{className:"absolute bottom-0.5 left-0.5 text-[8px] text-gray-500",children:["📝",i]})]})}export{M as L};
@@ -1 +0,0 @@
1
- import{r as a,j as e}from"./chunk-JZWAC4HX-C4pqxYJB.js";function j({screenshotPath:l,cacheBuster:o,alt:x,className:f="",title:n}){const[i,s]=a.useState("loading"),[c,r]=a.useState(!1),d=a.useRef(null),u=o?`/api/screenshot/${l}?cb=${o}`:`/api/screenshot/${l}`,m=()=>{s("success"),r(!0)},h=()=>{s("error"),r(!1)};return a.useEffect(()=>{s("loading"),r(!1);const t=d.current;t!=null&&t.complete&&(t.naturalHeight!==0?(s("success"),r(!0)):(s("error"),r(!1)))},[u]),l?e.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",title:n,children:[e.jsx("img",{ref:d,src:u,alt:x,onLoad:m,onError:h,className:f||"max-w-full max-h-full object-contain",style:{visibility:c?"visible":"hidden",position:c?"relative":"absolute"}}),i==="loading"&&e.jsx("div",{className:"absolute inset-0 bg-gray-100 animate-pulse rounded flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),i==="error"&&e.jsxs("div",{className:"absolute inset-0 border-2 border-dashed border-gray-300 bg-gray-50 rounded flex flex-col items-center justify-center text-xs gap-1",children:[e.jsx("span",{className:"text-2xl text-gray-400",children:"📷"}),e.jsx("span",{className:"text-gray-400 whitespace-nowrap",children:"No Screenshot"})]})]}):e.jsx("div",{className:"w-full h-full border-2 border-dashed border-gray-300 bg-gray-50 rounded flex flex-col items-center justify-center text-xs gap-1",title:n,children:e.jsx("span",{className:"text-2xl text-gray-400",children:"📷"})})}export{j as S};
@@ -1,34 +0,0 @@
1
- import{d as P,r as t,j as y}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as _}from"./useLastLogLine-C14nCb1q.js";function R(s){const o=s.replace(/[^a-zA-Z0-9_]+/g,"_");return o.slice(0,1).toUpperCase()+o.slice(1)}function $({analysisId:s,scenarioId:o,scenarioName:i,entityName:c,projectSlug:m,enabled:x=!0,refreshTrigger:p=0}){const k=P(),[b,E]=t.useState(null),[q,U]=t.useState(!1),[z,u]=t.useState(!1),[A,f]=t.useState(!1),v=t.useRef(!1),I=t.useRef(null),g=t.useRef(null),h=t.useRef(null),[F,w]=t.useState(0),[j,M]=t.useState(0),r=t.useRef(null),l=t.useRef(!1),{interactiveUrl:L,resetLogs:T}=_(m,x),C=t.useRef(o),B=t.useRef(p);t.useEffect(()=>{B.current!==p&&(B.current=p,b&&(console.log("[useInteractiveMode] Manual refresh triggered"),u(!0),f(!1),w(0),M(e=>e+1),l.current=!1,r.current&&(clearTimeout(r.current),r.current=null)))},[p,b]),t.useEffect(()=>{if(C.current!==o&&(C.current=o,I.current&&g.current&&i)){let e=I.current;if(h.current&&c){const a=R(h.current),d=R(c);a!==d&&(e=e.replace(a,d),h.current=c)}const n=R(g.current),S=R(i);e=e.replace(n,S),g.current=i,E(e),u(!0),f(!1),w(0),M(a=>a+1),l.current=!1,r.current&&(clearTimeout(r.current),r.current=null);return}},[o,i,c]),t.useEffect(()=>{if(L){const e=L+"?width=600px";I.current=e,i&&(g.current=i),c&&(h.current=c),E(e),U(!1),u(!0)}},[L]),t.useEffect(()=>{const e=n=>{n.data.type==="codeyam-resize"&&(l.current||(l.current=!0,r.current&&(clearTimeout(r.current),r.current=null),w(0),f(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{u(!1)})})))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]);const D=()=>{l.current=!1,r.current&&clearTimeout(r.current);const e=300*Math.pow(2,F);r.current=setTimeout(()=>{l.current||(F<2?(w(n=>n+1),M(n=>n+1),u(!0)):(console.error("[useInteractiveMode] Interactive mode failed to load after 3 attempts - showing iframe anyway"),f(!0),u(!1)))},e)};return t.useEffect(()=>{x&&!v.current&&o&&s&&(v.current=!0,U(!0),f(!1),E(null),(async()=>{if(m)try{await fetch(`/api/logs/${m}`,{method:"DELETE"})}catch(n){console.error("[useInteractiveMode] Failed to clear log file:",n)}T(),k.submit({action:"start",analysisId:s,scenarioId:o},{method:"post",action:"/api/interactive-mode"})})())},[x,o,s,T,m]),t.useEffect(()=>{const e=s,n=()=>{if(v.current&&e){const a=new URLSearchParams({action:"stop",analysisId:e});console.log("[useInteractiveMode] Sending stop request via sendBeacon");const d=navigator.sendBeacon("/api/interactive-mode",a);console.log("[useInteractiveMode] sendBeacon result:",d),d||(console.log("[useInteractiveMode] sendBeacon failed, using fetch fallback"),fetch("/api/interactive-mode",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a,keepalive:!0}).catch(K=>console.error("Failed to stop interactive mode:",K)))}},S=()=>{n()};return window.addEventListener("beforeunload",S),()=>{window.removeEventListener("beforeunload",S),console.log("[useInteractiveMode] Cleanup running:",{hasStarted:v.current,analysisId:e}),n()}},[s]),{interactiveServerUrl:b,isStarting:q,isLoading:z,showIframe:A,iframeKey:j,onIframeLoad:D}}function G(){return y.jsxs("div",{className:"spinner-container",children:[y.jsx("span",{className:"loader"}),y.jsx("style",{children:`
2
- .loader {
3
- width: 48px;
4
- height: 48px;
5
- border: 3px solid rgba(0, 92, 117, 0.2);
6
- border-radius: 50%;
7
- display: inline-block;
8
- position: relative;
9
- box-sizing: border-box;
10
- animation: rotation 1s linear infinite;
11
- }
12
- .loader::after {
13
- content: '';
14
- box-sizing: border-box;
15
- position: absolute;
16
- left: 50%;
17
- top: 50%;
18
- transform: translate(-50%, -50%);
19
- width: 56px;
20
- height: 56px;
21
- border-radius: 50%;
22
- border: 3px solid;
23
- border-color: #005c75 transparent;
24
- }
25
-
26
- @keyframes rotation {
27
- 0% {
28
- transform: rotate(0deg);
29
- }
30
- 100% {
31
- transform: rotate(360deg);
32
- }
33
- }
34
- `})]})}export{G as S,$ as u};
@@ -1 +0,0 @@
1
- import{j as v}from"./chunk-JZWAC4HX-C4pqxYJB.js";function O({filePath:n,maxLength:x=60,className:f,style:u}){const o=((t,r)=>{if(t.length<=r)return t;const a="...",c=r-a.length,i=Math.ceil(c*.4),d=Math.floor(c*.6),e=t.slice(0,i),s=t.slice(-d),h=e.lastIndexOf("/"),l=s.indexOf("/"),g=h>i*.5?e.slice(0,h+1):e,m=l!==-1&&l<d*.5?s.slice(l):s;return`${g}${a}${m}`})(n,x),p=o!==n;return v.jsx("span",{className:f||"font-normal text-gray-900 text-[14px] select-text cursor-text",style:{...u,display:"inline-block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:p?n:void 0,children:o})}export{O as T};
@@ -1 +0,0 @@
1
- import{r as u,j as n}from"./chunk-JZWAC4HX-C4pqxYJB.js";const g=10,W=1024;function G({currentViewportWidth:m,currentPresetName:P,onDevicePresetClick:w,devicePresets:p,onHoverChange:c,hideLabel:E=!1,lightMode:d=!1}){const[l,v]=u.useState(null),x=u.useRef(null),j=u.useMemo(()=>[...p].sort((t,s)=>t.width-s.width),[p]),{fittingPresets:o,overflowPresets:i}=u.useMemo(()=>{const t=[],s=[];for(const e of j)e.width<=W?t.push(e):s.push(e);return s.sort((e,r)=>r.width-e.width),{fittingPresets:t,overflowPresets:s}},[j]),b=u.useCallback(t=>{if(!x.current)return null;const s=x.current.getBoundingClientRect(),e=t-s.left,r=s.width,h=r/2,y=(o.length>0?o[o.length-1].width:0)/2,S=h-y,X=h+y,$=i.length>0?(i.length-1)*g:0;if(i.length>0){if(e<S){if(e<=$){const a=Math.min(Math.floor(e/g),i.length-1);return i[a]}return i[i.length-1]}if(e>X){const a=r-e;if(a<=$){const f=Math.min(Math.floor(a/g),i.length-1);return i[f]}return i[i.length-1]}}const k=Math.abs(e-h);for(let a=o.length-1;a>=0;a--){const f=o[a],F=o[a-1],B=f.width/2,T=F?F.width/2:0;if(k<=B&&k>=T)return f}return o[0]||i[i.length-1]||null},[o,i]),I=u.useCallback(t=>{const s=b(t.clientX);v(s),c==null||c(s)},[b,c]),M=u.useCallback(()=>{v(null),c==null||c(null)},[c]),R=u.useCallback(t=>{const s=b(t.clientX);s&&w(s)},[b,w]),N=l||{name:P,width:m};return n.jsxs("div",{ref:x,className:"relative h-6 shrink-0 overflow-hidden cursor-pointer",onMouseMove:I,onMouseLeave:M,onClick:R,children:[l&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:n.jsx("div",{className:"h-full transition-all duration-100 bg-[#005C75]",style:{width:`${l.width}px`}})}),n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o.map(t=>{const s=t.width===m,e=(l==null?void 0:l.name)===t.name,r=t.width/2;return n.jsxs("div",{children:[n.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`calc(50% - ${r}px)`},children:n.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${s||e?d?"bg-gray-900":"bg-white":d?"bg-[rgba(0,0,0,0.2)]":"bg-[rgba(255,255,255,0.3)]"}`})}),n.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`calc(50% + ${r}px)`},children:n.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${s||e?d?"bg-gray-900":"bg-white":d?"bg-[rgba(0,0,0,0.2)]":"bg-[rgba(255,255,255,0.3)]"}`})})]},t.name)})}),n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:i.map((t,s)=>{const e=s*g,r=t.width===m,h=(l==null?void 0:l.name)===t.name;return n.jsxs("div",{children:[n.jsx("div",{className:"absolute top-0 bottom-0",style:{left:`${e}px`},children:n.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${r||h?d?"bg-gray-900":"bg-white":d?"bg-[rgba(0,0,0,0.2)]":"bg-[rgba(255,255,255,0.3)]"}`})}),n.jsx("div",{className:"absolute top-0 bottom-0",style:{right:`${e}px`},children:n.jsx("div",{className:`w-0.5 h-full transition-colors duration-75 ${r||h?d?"bg-gray-900":"bg-white":d?"bg-[rgba(0,0,0,0.2)]":"bg-[rgba(255,255,255,0.3)]"}`})})]},t.name)})}),!E&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:n.jsxs("div",{className:`text-[10px] px-2 py-0.5 rounded shadow-sm whitespace-nowrap transition-colors ${l?"bg-[#005c75] text-white":"bg-white/90 text-[#005c75] border border-[rgba(0,92,117,0.25)]"}`,children:[N.name," - ",N.width,"px"]})})]})}export{G as V};
@@ -1 +0,0 @@
1
- import{w as t,d as r,j as e}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{S as i}from"./ScenarioViewer-0DY_NKil.js";import{W as n}from"./InteractivePreview-DYFW3lDD.js";import"./ViewportInspectBar-oAf2Kqsf.js";import"./useCustomSizes-CrAK28Bc.js";import"./LogViewer-ceAyBX-H.js";import"./SafeScreenshot-BED4B6sP.js";import"./useLastLogLine-C14nCb1q.js";import"./Spinner-Bb5uFQ5V.js";import"./preload-helper-ckwbz45p.js";import"./ReportIssueModal-BzHcG7SE.js";import"./createLucideIcon-CC6AbExI.js";import"./circle-check-BVMi9VA5.js";import"./triangle-alert-BLdiCuG-.js";import"./copy-n2FB0_Sw.js";import"./scenarioStatus-B_8jpV3e.js";import"./InlineSpinner-Bu6c6aDe.js";const k=()=>[{title:"Empty State - CodeYam"},{name:"description",content:"Simulations empty state development view"}],S=t(function(){r();const s={sha:"mock-sha",name:"Dashboard",filePath:"codeyam-cli/src/webserver/app/routes/_index.tsx",entityType:"visual"};return e.jsx(n,{children:e.jsxs("div",{className:"h-screen bg-[#F8F7F6] flex flex-col overflow-hidden",children:[e.jsx("header",{className:"bg-white border-b border-gray-200 shrink-0 relative h-[54px]",children:e.jsxs("div",{className:"flex items-center h-full px-6 gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13 8.5H4M4 8.5L8.5 4M4 8.5L8.5 13",stroke:"#005c75",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("h1",{className:"text-lg font-semibold text-black m-0 leading-[26px] shrink-0",children:"Dashboard"}),e.jsx("span",{className:"text-xs text-[#626262] font-mono whitespace-nowrap overflow-hidden text-ellipsis min-w-0",children:"codeyam-cli/src/webserver/app/routes/_index.tsx"})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 px-[15px] py-0 h-[26px] bg-[#efefef] border border-[#e1e1e1] rounded",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-[#626262]"}),e.jsx("span",{className:"text-xs font-semibold text-[#626262]",children:"Not analyzed"})]}),e.jsx("button",{className:"px-[15px] py-0 h-[26px] bg-[#005c75] text-white rounded text-xs font-semibold border-none cursor-pointer hover:bg-[#004a5e] transition-colors",children:"Analyze"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-[#626262] ml-auto",children:[e.jsx("span",{className:"leading-[22px]",children:"Next Entity"}),e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M4 8.5H13M13 8.5L8.5 4M13 8.5L8.5 13",stroke:"#005c75",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})}),e.jsx("div",{className:"bg-[#efefef] border-b border-[#efefef] shrink-0",children:e.jsxs("div",{className:"flex items-center gap-3 h-11 px-[15px]",children:[e.jsxs("div",{className:"px-4 flex items-center justify-center gap-3 shrink-0 text-sm rounded bg-[#343434] text-[#efefef] font-semibold h-8",children:["Scenarios",e.jsx("span",{className:"px-2 py-0.5 rounded-[9px] text-xs font-semibold bg-[#cbf3fa] text-[#005c75] min-w-[25px] text-center",children:"0"})]}),e.jsxs("div",{className:"px-4 flex items-center justify-center gap-3 shrink-0 text-sm rounded-[9px] text-[#3e3e3e] font-normal",children:["Related Entities",e.jsx("span",{className:"px-2 py-0.5 rounded-[9px] text-xs font-semibold bg-[#e1e1e1] text-[#3e3e3e] min-w-[25px] text-center",children:"5"})]}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"Code"}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"Data Structure"}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"History"})]})}),e.jsxs("div",{className:"flex flex-1 gap-0 min-h-0",children:[e.jsx("div",{className:"w-[165px] bg-[#e1e1e1] border-r border-[#c7c7c7] flex items-center justify-center shrink-0",children:e.jsx("span",{className:"text-xs font-medium text-[#8e8e8e] leading-5",children:"No Scenarios"})}),e.jsx(i,{selectedScenario:null,analysis:void 0,entity:s,viewMode:"screenshot",cacheBuster:Date.now(),hasScenarios:!1,isAnalyzing:!1,projectSlug:null,hasAnApiKey:!0})]})]})})});export{S as default,k as meta};
@@ -1,10 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-yHOVb4rc.js","assets/chunk-JZWAC4HX-C4pqxYJB.js"])))=>i.map(i=>d[i]);
2
- var pt=Object.defineProperty;var ht=(t,s,a)=>s in t?pt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var $e=(t,s,a)=>ht(t,typeof s!="symbol"?s+"":s,a);import{r as n,j as e,w as ut,u as ft,f as gt,b as jt}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as bt,S as vt}from"./useCustomSizes-CrAK28Bc.js";import{s as Nt,g as ne,c as yt,b as wt,a as St,T as kt,D as Ct}from"./editorPreview-B7ztwLut.js";import{C as Ne}from"./CopyButton-BPXZwM4t.js";import{_ as Mt}from"./preload-helper-ckwbz45p.js";import{c as Pt}from"./cy-logo-cli-DcX-ZS3p.js";import{u as Et,S as Be}from"./Spinner-Bb5uFQ5V.js";import"./copy-n2FB0_Sw.js";import"./createLucideIcon-CC6AbExI.js";import"./useLastLogLine-C14nCb1q.js";function ye(t){const[s,a]=n.useState(null),[d,g]=n.useState(!1),x=n.useCallback(()=>{t&&(g(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(t)}`).then(c=>c.json()).then(c=>{a(c),g(!1)}).catch(()=>{a({testFilePath:t,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),g(!1)}))},[t]);return n.useEffect(()=>{t&&x()},[t,x]),{results:s,isRunning:d,runTests:x}}function te(t){if(!t||t==="/")return"Home";const a=t.split("?")[0].replace(/^\//,"").split("/")[0];return a.charAt(0).toUpperCase()+a.slice(1)}function we(t){return t?t.includes("/isolated-components"):!1}function It(t,s){return!s||Object.keys(s).length===0?t:t.filter(a=>s[a.name])}function Z({imgSrc:t,name:s,isActive:a,onSelect:d}){return e.jsxs("button",{onClick:d,className:"flex flex-col items-center gap-1 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${a?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:t?e.jsx("img",{src:t,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-32 ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function be({testFile:t,entityName:s}){const{results:a,isRunning:d,runTests:g}=ye(t);if(d&&!a)return e.jsxs("div",{className:"px-2 pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const x=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,c=x.length>0?x:a.testCases;if(c.length===0)return null;const h=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[c.map(m=>{var w;const k=h&&m.fullName.startsWith(h)?m.fullName.slice(h.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-400":m.status==="failed"?"text-red-400":"text-gray-500"}`,children:k})]}),m.status==="failed"&&((w=m.failureMessages)==null?void 0:w.map((S,N)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:S,children:S.split(`
3
- `)[0]},N)))]},m.fullName)}),e.jsx("button",{onClick:g,disabled:d,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:d?"Running...":"Re-run"})]})}function J({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(Ne,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Tt({scenarios:t,projectRoot:s,activeScenarioId:a,onScenarioSelect:d,zoomComponent:g,onZoomChange:x,analyzedEntities:c=[],glossaryFunctions:h=[],activeAnalyzedScenarioId:m,onAnalyzedScenarioSelect:k,entityImports:w,pageFilePaths:S={}}){const{pageGroups:N,componentGroups:P}=n.useMemo(()=>{var p;const f=new Map,r=new Map;for(const u of t)if(u.componentName){const o=r.get(u.componentName)||[];o.push(u),r.set(u.componentName,o)}else if(we(u.url)){const o=(p=u.url)==null?void 0:p.match(/[?&]c=([^&]+)/),v=o?decodeURIComponent(o[1]):"Isolated",E=r.get(v)||[];E.push(u),r.set(v,E)}else{const o=te(u.url),v=f.get(o)||[];v.push(u),f.set(o,v)}const i=new Map([...r.entries()].sort(([u],[o])=>u.localeCompare(o)));return{pageGroups:f,componentGroups:i}},[t]),j=n.useMemo(()=>{const f=new Set((c||[]).filter(i=>i.entityType==="visual").map(i=>i.name)),r=new Map;for(const[i,p]of P)f.has(i)||r.set(i,p);return r},[P,c]),{visualEntities:A,libraryEntities:R}=n.useMemo(()=>{const f=c.filter(i=>i.entityType==="visual").sort((i,p)=>i.name.localeCompare(p.name)),r=c.filter(i=>i.entityType==="library"||i.entityType==="functionCall").sort((i,p)=>i.name.localeCompare(p.name));return{visualEntities:f,libraryEntities:r}},[c]),$=n.useMemo(()=>{const f=new Set(R.map(r=>r.name));return h.filter(r=>!f.has(r.name)).sort((r,i)=>r.name.localeCompare(i.name))},[h,R]),T=c.some(f=>f.isAnalyzing),M=n.useRef(null),I=n.useRef(0),O=n.useCallback(()=>{M.current&&(I.current=M.current.scrollTop)},[]);if(n.useEffect(()=>{M.current&&I.current>0&&(M.current.scrollTop=I.current)}),t.length===0&&c.length===0&&$.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No scenarios yet"}),e.jsx("p",{className:"text-xs",children:"Scenarios will appear here as Claude creates them alongside your code. Each scenario represents a different state of your app's data."})]})});if(g){const f=P.get(g)||[],r=new Set((w==null?void 0:w[g])||[]),i=r.size>0,p=i?A.filter(o=>r.has(o.name)):[],u=i?R.filter(o=>r.has(o.name)):[];return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-1",children:[e.jsxs("button",{onClick:()=>x(void 0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All scenarios"]}),e.jsx("div",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-xs font-semibold text-white uppercase tracking-wider",children:g})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:f.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):f.map(o=>e.jsx(Z,{imgSrc:o.screenshotPath?`/api/editor-scenario-image/${o.id}.png`:null,name:o.name,isActive:o.id===a,onSelect:()=>d(o)},o.id))}),p.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),p.map(o=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center gap-2 px-2 py-1",children:e.jsx("button",{onClick:()=>x(o.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:o.name})}),e.jsx(J,{filePath:o.filePath,projectRoot:s}),(o.scenarios.length>0||o.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:o.scenarios.map(v=>e.jsx(Z,{imgSrc:v.screenshotPath?`/api/screenshot/${v.screenshotPath}`:null,name:v.name,isActive:v.id===m,onSelect:()=>k==null?void 0:k({analysisId:o.analysisId,scenarioId:v.id,scenarioName:v.name,entitySha:o.sha,entityName:o.name})},v.id))})]},o.sha))]}),u.length>0&&e.jsxs("div",{className:"pt-2 mt-1",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),u.map(o=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:o.name})}),e.jsx(J,{filePath:o.filePath,projectRoot:s}),o.testFile&&e.jsx(be,{testFile:o.testFile,entityName:o.name})]},o.sha))]})]})})}return e.jsx("div",{ref:M,onScroll:O,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[N.size>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),[...N.entries()].sort(([f],[r])=>f==="Home"?-1:r==="Home"?1:f.localeCompare(r)).map(([f,r])=>e.jsxs("div",{className:"px-2 pt-1",children:[e.jsx("div",{className:"py-0.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-400",children:f})}),S[f]&&e.jsx(J,{filePath:S[f],projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:r.map(i=>e.jsx(Z,{imgSrc:i.screenshotPath?`/api/editor-scenario-image/${i.id}.png`:null,name:i.name,isActive:i.id===a&&!m,onSelect:()=>d(i)},i.id))})]},f))]}),j.size>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...j.entries()].map(([f,r])=>{var i;return e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center justify-between px-2 py-1",children:e.jsx("button",{onClick:()=>x(f),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:f})}),((i=r[0])==null?void 0:i.componentPath)&&e.jsx(J,{filePath:r[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:r.map(p=>e.jsx(Z,{imgSrc:p.screenshotPath?`/api/editor-scenario-image/${p.id}.png`:null,name:p.name,isActive:p.id===a&&!m,onSelect:()=>d(p)},p.id))})]},f)})]}),A.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),T&&t.length===0&&c.every(f=>f.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),A.map(f=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx("button",{onClick:()=>x(f.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:f.name}),f.isAnalyzing&&f.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(J,{filePath:f.filePath,projectRoot:s}),(f.scenarios.length>0||f.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[f.scenarios.map(r=>e.jsx(Z,{imgSrc:r.screenshotPath?`/api/screenshot/${r.screenshotPath}`:null,name:r.name,isActive:r.id===m,onSelect:()=>k==null?void 0:k({analysisId:f.analysisId,scenarioId:r.id,scenarioName:r.name,entitySha:f.sha,entityName:f.name})},r.id)),f.pendingScenarios.map(r=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:r,children:r},r))]})]},f.sha))]}),(R.length>0||$.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${A.length>0?"":"border-t border-[#3d3d3d]"}`,children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),R.map(f=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:f.name}),f.isAnalyzing&&f.scenarioCount===0&&e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(J,{filePath:f.filePath,projectRoot:s}),f.testFile?e.jsx(be,{testFile:f.testFile,entityName:f.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},f.sha)),$.map(f=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:f.name})}),e.jsx(J,{filePath:f.filePath,projectRoot:s}),e.jsx(be,{testFile:f.testFile,entityName:f.name})]},f.name))]})]})})}function Lt(t,s,a=new Date){const d={"1d":1,"3d":3,"7d":7,"30d":30}[s],g=new Date(a);g.setDate(g.getDate()-d);const x=g.toISOString().split("T")[0],c=t.filter(S=>S.date>=x),h=new Set(c.map(S=>S.commitSha).filter(Boolean)),m=new Map;for(const S of c)if(S.scenarioScreenshots)for(const N of S.scenarioScreenshots){m.has(N.name)||m.set(N.name,[]);const P=m.get(N.name);P.some(j=>j.path===N.path)||P.push({path:N.path,time:S.time})}for(const S of m.values())S.sort((N,P)=>N.time.localeCompare(P.time));const k=[],w=new Map;for(const[S,N]of m){const P=S.indexOf(" - ");if(P!==-1){const j=S.slice(0,P);w.has(j)||w.set(j,[]),w.get(j).push({name:S,screenshots:N})}else k.push({name:S,screenshots:N})}return{commitCount:h.size,entryCount:c.length,appScenarios:k,componentGroups:w,totalScenarios:m.size}}function Rt(t){const s=new Map;for(const a of[...t].reverse()){const d=s.get(a.date)||[];d.push(a),s.set(a.date,d)}return s}function $t(t){const s=new Map;for(const a of t){let d;if("componentName"in a&&a.componentName)d=a.componentName;else if("componentName"in a&&a.componentName===null)d="App";else{const x=a.name.indexOf(" - ");d=x!==-1?a.name.slice(0,x):"App"}const g=s.get(d)||[];g.push(a),s.set(d,g)}return[...s.entries()].sort(([a],[d])=>a==="App"?-1:d==="App"?1:a.localeCompare(d))}const _e=120;function Ve({text:t,theme:s}){const[a,d]=n.useState(!1),g=t.length>_e,x=g&&!a?t.slice(0,_e)+"…":t,c=s==="light";return e.jsxs("div",{className:`px-4 py-2 ${c?"border-b border-gray-200 bg-gray-50":"border-b border-[#3d3d3d] bg-[#252525]"}`,children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-gray-500",children:"User Prompt"}),e.jsxs("p",{className:`text-[11px] mt-0.5 mb-0 leading-relaxed ${c?"text-gray-600":"text-gray-400"}`,children:[x,g&&e.jsx("button",{onClick:()=>d(!a),className:`ml-1 text-[11px] font-medium bg-transparent border-none p-0 cursor-pointer ${c?"text-blue-500 hover:text-blue-700":"text-[#00a0c4] hover:text-[#00c0e8]"}`,children:a?"Show less":"Read more…"})]})]})}function Ae({status:t}){const s={new:{label:"New",bg:"bg-green-900/40",text:"text-green-400",border:"border-green-700/50"},edited:{label:"Edited",bg:"bg-blue-900/40",text:"text-blue-400",border:"border-blue-700/50"},impacted:{label:"Impacted",bg:"bg-amber-900/40",text:"text-amber-400",border:"border-amber-700/50"}}[t.status];return e.jsx("span",{className:`${s.bg} ${s.text} ${s.border} border text-[8px] font-bold px-1 py-0 rounded-full uppercase tracking-wider`,children:s.label})}function Bt({testFile:t,entityName:s}){const{results:a,isRunning:d,runTests:g}=ye(t);if(d&&!a)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#00a0c4] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const x=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,c=x.length>0?x:a.testCases;if(c.length===0)return null;const h=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[c.map(m=>{var w;const k=h&&m.fullName.startsWith(h)?m.fullName.slice(h.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-400":m.status==="failed"?"text-red-400":"text-gray-500"}`,children:k})]}),m.status==="failed"&&((w=m.failureMessages)==null?void 0:w.map((S,N)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400/70 truncate max-w-full",title:S,children:S.split(`
4
- `)[0]},N)))]},m.fullName)}),e.jsx("button",{onClick:g,disabled:d,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:d?"Running...":"Re-run"})]})}const _t={added:"text-green-400",untracked:"text-green-400",modified:"text-blue-400",renamed:"text-purple-400"};function At({files:t}){return e.jsxs("div",{className:"border-t border-[#3d3d3d] pt-2 mt-1",children:[e.jsxs("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:["Modified Files (",t.length,")"]}),e.jsx("div",{className:"mt-1 space-y-0.5 max-h-[150px] overflow-auto",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase w-[14px] text-center ${_t[s.status]||"text-gray-500"}`,children:s.status==="added"||s.status==="untracked"?"A":s.status==="modified"?"M":s.status==="renamed"?"R":"?"}),e.jsx("span",{className:"text-[10px] text-gray-400 truncate font-mono",children:s.path})]},s.path))})]})}const Dt={feature:{label:"Feature",color:"bg-[#005c75]"},fix:{label:"Fix",color:"bg-amber-700"},refactor:{label:"Refactor",color:"bg-purple-700"},scaffold:{label:"Scaffold",color:"bg-green-700"},data:{label:"Data",color:"bg-blue-700"},milestone:{label:"Milestone",color:"bg-yellow-600"}};function Ot(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function Ft(t){try{return new Date(t+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return t}}const zt=[{value:"1d",label:"1 Day"},{value:"3d",label:"3 Days"},{value:"7d",label:"1 Week"},{value:"30d",label:"1 Month"}];function Ut({entries:t,onScreenshotClick:s}){const[a,d]=n.useState(!1),[g,x]=n.useState("7d"),c=n.useMemo(()=>Lt(t,g),[t,g]);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>d(!a),className:"w-full flex items-center justify-between px-3 py-2.5 cursor-pointer bg-transparent border-none text-left hover:bg-[#333] transition-colors",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider",children:"Timeframe Summary"}),e.jsx("span",{className:`text-gray-500 text-[10px] transition-transform ${a?"rotate-180":""}`,children:"▼"})]}),a&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"flex gap-1 pt-2.5",children:zt.map(h=>e.jsx("button",{onClick:()=>x(h.value),className:`px-2.5 py-1 text-[10px] font-medium rounded transition-colors cursor-pointer border ${g===h.value?"bg-[#005c75] text-white border-[#005c75]":"bg-transparent text-gray-400 border-[#4d4d4d] hover:text-white hover:border-[#005c75]"}`,children:h.label},h.value))}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.commitCount})," ",c.commitCount===1?"commit":"commits"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.totalScenarios})," ",c.totalScenarios===1?"scenario changed":"scenarios changed"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.entryCount})," ",c.entryCount===1?"entry":"entries"]})]}),c.totalScenarios===0?e.jsx("p",{className:"text-[11px] text-gray-500 italic m-0",children:"No scenario changes in this period."}):e.jsxs("div",{className:"space-y-3",children:[c.appScenarios.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),c.appScenarios.map(h=>e.jsx(De,{scenario:h,onScreenshotClick:s},h.name))]}),c.componentGroups.size>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),[...c.componentGroups.entries()].sort(([h],[m])=>h.localeCompare(m)).map(([h,m])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:h}),m.map(k=>e.jsx(De,{scenario:k,onScreenshotClick:s},k.name))]},h))]})]})]})]})}function De({scenario:t,onScreenshotClick:s}){const a=t.name.indexOf(" - "),d=a!==-1?t.name.slice(a+3):t.name;return e.jsxs("div",{className:"pl-2",children:[e.jsx("span",{className:"text-[10px] text-gray-500 block mb-1",children:d}),e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto",children:t.screenshots.map((g,x)=>e.jsxs("div",{className:"flex items-center shrink-0",children:[x>0&&e.jsx("span",{className:"text-[8px] text-gray-600 mx-0.5",children:"→"}),e.jsx("button",{type:"button",className:"w-16 h-16 rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",title:`${t.name} (${new Date(g.time).toLocaleDateString()})`,onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${g.path.replace("screenshots/","")}`,commitSha:null,commitMessage:null,scenarioName:t.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${g.path.replace("screenshots/","")}`,alt:t.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})})]},g.path))})]})}function Wt({isActive:t,onScreenshotClick:s,glossaryFunctions:a=[]}){const[d,g]=n.useState([]),[x,c]=n.useState(!0),[h,m]=n.useState(new Set),k=n.useCallback(N=>{m(P=>{const j=new Set(P);return j.has(N)?j.delete(N):j.add(N),j})},[]),w=n.useCallback(async()=>{try{const N=await fetch("/api/editor-journal");if(N.ok){const P=await N.json();g(P.entries||[])}}catch{}finally{c(!1)}},[]);if(n.useEffect(()=>{w()},[w]),n.useEffect(()=>{t&&w()},[t,w]),n.useEffect(()=>{const N=new EventSource("/api/events");return N.addEventListener("message",P=>{try{const j=JSON.parse(P.data);j.type==="db-change"&&j.changeType==="journal"&&w()}catch{}}),()=>N.close()},[w]),x)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Loading journal..."})});if(d.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No journal entries yet"}),e.jsx("p",{className:"text-xs",children:"Journal entries will appear as you build. Claude records features, screenshots, and commits as the project evolves."})]})});const S=Rt(d);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsx(Ut,{entries:d,onScreenshotClick:s}),[...S.entries()].map(([N,P])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1.5 sticky top-0 bg-[#1e1e1e] z-10",children:e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:Ft(N)})}),e.jsx("div",{className:"space-y-2",children:P.map((j,A)=>{const R=Dt[j.type]||{label:j.type,color:"bg-gray-600"},$=`${j.time}-${A}`,T=h.has($);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${T?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2 cursor-pointer",onClick:()=>k($),children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-white truncate",children:j.title}),e.jsx("span",{className:`${R.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:R.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:Ot(j.time)}),j.featureName&&e.jsx("span",{className:"text-[10px] text-gray-500 italic truncate",title:j.featureName,children:j.featureName})]})}),j.userPrompt&&e.jsx(Ve,{text:j.userPrompt,theme:"dark"}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:j.description}),j.screenshot&&e.jsx("button",{type:"button",className:"rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] flex items-center justify-center p-1 cursor-pointer transition-colors w-full",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${j.screenshot.replace("screenshots/","")}`,commitSha:j.commitSha,commitMessage:j.commitMessage,scenarioName:j.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${j.screenshot.replace("screenshots/","")}`,alt:j.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),j.scenarioScreenshots&&j.scenarioScreenshots.length>0&&(()=>{const M=$t(j.scenarioScreenshots),I=j.entityChangeStatus,O=M.filter(([u])=>u==="App").flatMap(([,u])=>u),f=M.filter(([u])=>u!=="App"),r=new Map;for(const u of O){const o=te(u.url??null),v=r.get(o)||[];v.push(u),r.set(o,v)}const i=[...r.entries()],p=u=>e.jsx("button",{type:"button",className:"w-[4.5rem] h-[4.5rem] rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${u.path.replace("screenshots/","")}`,commitSha:j.commitSha,commitMessage:j.commitMessage,scenarioName:u.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${u.path.replace("screenshots/","")}`,alt:u.name,title:u.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},u.path);return e.jsxs("div",{className:"space-y-2",children:[i.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),i.map(([u,o])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:u}),(I==null?void 0:I[u])&&e.jsx(Ae,{status:I[u]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:o.map(p)})]},u))]}),f.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),f.map(([u,o])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:u}),(I==null?void 0:I[u])&&e.jsx(Ae,{status:I[u]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:o.map(p)})]},u))]})]})})(),a.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),e.jsx("div",{className:"space-y-2",children:a.map(M=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-200",children:M.name}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate block",children:M.filePath}),M.testFile?e.jsx(Bt,{testFile:M.testFile,entityName:M.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},M.name))})]}),j.commitSha&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[e.jsx("span",{className:"font-mono text-[#00a0c4] bg-[#00a0c4]/10 px-1.5 py-0.5 rounded",children:j.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:j.commitMessage})]}),T&&j.modifiedFiles&&j.modifiedFiles.length>0&&e.jsx(At,{files:j.modifiedFiles})]}),e.jsxs("button",{onClick:()=>k($),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",T?"Collapse":"Expand"," ———"]})]},$)})})]},N))]})})}function ee({imgSrc:t,name:s,isActive:a,onSelect:d}){return e.jsxs("button",{onClick:d,className:"flex flex-col items-center gap-1 cursor-pointer group w-full",title:s,children:[e.jsx("div",{className:`w-full aspect-square rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${a?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:t?e.jsx("img",{src:t,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-full ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function ie({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(Ne,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Gt({hasProject:t,scenarios:s,analyzedEntities:a,glossaryFunctions:d=[],projectRoot:g,activeScenarioId:x,onScenarioSelect:c,onAnalyzedScenarioSelect:h,onSwitchToBuild:m,zoomComponent:k,onZoomChange:w,entityImports:S,pageFilePaths:N={},projectTitle:P,projectDescription:j}){const{pageGroups:A,componentGroups:R}=n.useMemo(()=>{var u;const r=new Map,i=new Map;for(const o of s)if(o.componentName){const v=i.get(o.componentName)||[];v.push(o),i.set(o.componentName,v)}else if(we(o.url)){const v=(u=o.url)==null?void 0:u.match(/[?&]c=([^&]+)/),E=v?decodeURIComponent(v[1]):"Isolated",U=i.get(E)||[];U.push(o),i.set(E,U)}else{const v=te(o.url),E=r.get(v)||[];E.push(o),r.set(v,E)}const p=new Map([...i.entries()].sort(([o],[v])=>o.localeCompare(v)));return{pageGroups:r,componentGroups:p}},[s]),$=n.useMemo(()=>a.filter(r=>r.entityType==="visual").sort((r,i)=>r.name.localeCompare(i.name)),[a]),T=n.useMemo(()=>{const r=new Map;for(const i of d)r.set(i.name,i);return r},[d]),M=n.useRef(null),I=n.useRef(0),O=n.useCallback(()=>{M.current&&(I.current=M.current.scrollTop)},[]);if(n.useEffect(()=>{M.current&&I.current>0&&(M.current.scrollTop=I.current)}),!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Ready to build something?"}),e.jsx("button",{onClick:m,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(!(s.length>0||$.length>0))return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 px-8 text-center",children:[P?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:P}),j&&e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:j})]}):e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Your project is ready"}),e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:m,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(k){const r=A.get(k)||[],i=R.get(k)||[],p=$.find(b=>b.name===k),u=T.get(k),o=[...r,...i],v=new Set((S==null?void 0:S[k])||[]),E=v.size>0,U=E?[...R.entries()].filter(([b])=>v.has(b)):[],se=E?$.filter(b=>v.has(b.name)&&!U.some(([B])=>B===b.name)):[],ae=E?d.filter(b=>v.has(b.name)):[],K=U.length>0||se.length>0,W=ae.length>0,D=K||W;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("button",{onClick:()=>w(void 0),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer bg-transparent border-none p-0",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All"]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:k}),u&&e.jsx(ie,{filePath:u.filePath,projectRoot:g})]}),o.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:o.map(b=>e.jsx(ee,{imgSrc:b.screenshotPath?`/api/editor-scenario-image/${b.id}.png`:null,name:b.name,isActive:b.id===x,onSelect:()=>c(b)},b.id))}),p&&(p.scenarios.length>0||p.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[p.scenarios.map(b=>e.jsx(ee,{imgSrc:b.screenshotPath?`/api/screenshot/${b.screenshotPath}`:null,name:b.name,isActive:!1,onSelect:()=>h({analysisId:p.analysisId,scenarioId:b.id,scenarioName:b.name,entitySha:p.sha,entityName:p.name})},b.id)),p.pendingScenarios.map(b=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:b,children:b},b))]}),u&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-gray-500",children:"Tests:"}),e.jsx(ie,{filePath:u.testFile,projectRoot:g})]}),o.length===0&&!p&&!u&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"}),D&&e.jsxs("div",{className:"pt-3 mt-2 border-t border-[#3d3d3d] space-y-3",children:[K&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),U.map(([b,B])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>w(b),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:b})}),B.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:B.map(F=>e.jsx(ee,{imgSrc:F.screenshotPath?`/api/editor-scenario-image/${F.id}.png`:null,name:F.name,isActive:F.id===x,onSelect:()=>c(F)},F.id))})]},b)),se.map(b=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>w(b.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:b.name})}),(b.scenarios.length>0||b.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-1",children:[b.scenarios.map(B=>e.jsx(ee,{imgSrc:B.screenshotPath?`/api/screenshot/${B.screenshotPath}`:null,name:B.name,isActive:!1,onSelect:()=>h({analysisId:b.analysisId,scenarioId:B.id,scenarioName:B.name,entitySha:b.sha,entityName:b.name})},B.id)),b.pendingScenarios.map(B=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:B,children:B},B))]})]},b.sha))]}),W&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),ae.map(b=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>w(b.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:b.name})}),e.jsx(ie,{filePath:b.filePath,projectRoot:g}),b.testFile&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-600",children:"test:"}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:b.testFile})]})]},b.name))]})]})]})})}return e.jsx("div",{ref:M,onScroll:O,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[P&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-white m-0 font-['IBM_Plex_Sans']",children:P}),j&&e.jsx("p",{className:"text-xs text-gray-400 m-0 mt-1 font-['IBM_Plex_Sans'] leading-relaxed",children:j})]}),A.size>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),e.jsx("button",{onClick:m,className:"px-2.5 py-1 text-[10px] font-medium text-gray-400 bg-[#2a2a2a] border border-[#4d4d4d] rounded hover:bg-[#333] hover:text-white hover:border-[#005c75] transition-colors cursor-pointer",children:"+ New Page"})]}),e.jsxs("p",{className:"text-[11px] text-gray-500 m-0 mt-1.5 font-['IBM_Plex_Sans'] leading-relaxed",children:["Select a page scenario below and switch to"," ",e.jsx("button",{onClick:m,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"Build"})," ","to change or enhance an existing page or"," ",e.jsx("button",{onClick:m,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"create a new page"})]}),[...A.entries()].sort(([r],[i])=>r==="Home"?-1:i==="Home"?1:r.localeCompare(i)).map(([r,i])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>w(r),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:r})}),N[r]&&e.jsx(ie,{filePath:N[r],projectRoot:g}),e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:i.map(p=>e.jsx(ee,{imgSrc:p.screenshotPath?`/api/editor-scenario-image/${p.id}.png`:null,name:p.name,isActive:p.id===x,onSelect:()=>c(p)},p.id))})]},r))]})]})})}const Oe={new:0,edited:1,impacted:2};function Fe({status:t,onClick:s}){const a={new:{label:"New",bg:"bg-green-100",text:"text-green-700",border:"border-green-200"},edited:{label:"Edited",bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-200"},impacted:{label:"Impacted",bg:"bg-amber-100",text:"text-amber-700",border:"border-amber-200"}}[t.status],d=s&&(t.status==="edited"||t.status==="impacted");return e.jsx("button",{onClick:d?s:void 0,className:`${a.bg} ${a.text} ${a.border} border text-[9px] font-bold px-1.5 py-0.5 rounded-full uppercase tracking-wider shrink-0 ${d?"cursor-pointer hover:opacity-80 transition-opacity":"cursor-default"}`,children:a.label})}function ze({filePath:t}){const[s,a]=n.useState(null),[d,g]=n.useState(!0),[x,c]=n.useState(null);return n.useEffect(()=>{Mt(()=>import("./index-yHOVb4rc.js"),__vite__mapDeps([0,1])).then(h=>{c(()=>h.default)})},[]),n.useEffect(()=>{g(!0),fetch(`/api/editor-file-diff?path=${encodeURIComponent(t)}`).then(h=>h.json()).then(h=>{a({oldContent:h.oldContent,newContent:h.newContent})}).catch(()=>{a(null)}).finally(()=>g(!1))},[t]),d?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Loading diff..."}):!s||!x?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Could not load diff"}):e.jsx("div",{className:"mt-2 border border-gray-200 rounded-lg overflow-hidden max-h-[300px] overflow-auto text-xs",children:e.jsx(x,{oldValue:s.oldContent,newValue:s.newContent,splitView:!1,useDarkTheme:!1,showDiffOnly:!0,styles:{contentText:{fontSize:"11px",lineHeight:"1.4"},line:{padding:"1px 8px",fontSize:"11px"}}})})}function Ue({impactedBy:t,changedEntities:s}){return e.jsx("div",{className:"mt-2 bg-amber-50 border border-amber-200 rounded-lg p-2.5",children:t&&t.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Re-captured because these dependencies changed"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.changeType==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.changeType==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name}),e.jsx("span",{className:"text-[9px] text-amber-500 truncate",children:a.filePath})]},a.filePath))})]}):s&&s.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Unchanged — these entities were modified in this session"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:s.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.status==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.status==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name})]},a.name))})]}):e.jsx("span",{className:"text-[10px] text-amber-600",children:"This component was re-captured because a dependency changed"})})}function We({scenarioId:t,name:s,isActive:a,onSelect:d}){const[g,x]=n.useState(!1);return n.useEffect(()=>{x(!1)},[t]),e.jsxs("button",{onClick:d,className:"flex flex-col items-center gap-1.5 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded-lg overflow-hidden border-2 transition-all ${a?"border-[#0ea5e9] ring-2 ring-[#0ea5e9]/40 shadow-lg shadow-[#0ea5e9]/20":"border-gray-200 hover:border-gray-400 shadow-sm"}`,children:g?e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center",children:e.jsx("span",{className:"text-[9px] text-gray-400",children:"No preview"})}):e.jsx("img",{src:`/api/editor-scenario-image/${t}.png`,alt:s,className:"w-full h-full object-contain bg-white",loading:"lazy",onError:()=>x(!0)})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${a?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:s})]})}function Ht({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-400 hover:text-gray-600 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsx(Ne,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors"})]}):null}function Vt({testFile:t,entityName:s}){const{results:a,isRunning:d,runTests:g}=ye(t);if(d&&!a)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0ea5e9] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:a.errorMessage})});const x=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,c=x.length>0?x:a.testCases;if(c.length===0)return null;const h=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[c.map(m=>{var w;const k=h&&m.fullName.startsWith(h)?m.fullName.slice(h.length):m.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[m.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):m.status==="failed"?e.jsx("span",{className:"text-red-500 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-400 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${m.status==="passed"?"text-green-600":m.status==="failed"?"text-red-500":"text-gray-400"}`,children:k})]}),m.status==="failed"&&((w=m.failureMessages)==null?void 0:w.map((S,N)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:S,children:S.split(`
5
- `)[0]},N)))]},m.fullName)}),e.jsx("button",{onClick:g,disabled:d,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:d?"Running...":"Re-run"})]})}function Ge(t){const s=t.indexOf(" - ");return s!==-1?t.slice(s+3):t}function He(t,s){return!s||Object.keys(s).length===0?t:[...t].sort(([a],[d])=>{var h,m;const g=((h=s[a])==null?void 0:h.status)||"impacted",x=((m=s[d])==null?void 0:m.status)||"impacted",c=(Oe[g]??2)-(Oe[x]??2);return c!==0?c:a.localeCompare(d)})}function Jt({scenarios:t,allScenarios:s=[],glossaryFunctions:a=[],projectRoot:d,activeScenarioId:g,onScenarioSelect:x,onClose:c,entityChangeStatus:h={},modifiedFiles:m=[],featureName:k,userPrompt:w}){const S=n.useMemo(()=>{if(s.length===0||Object.keys(h).length===0)return t;const r=new Set(t.map(p=>p.id)),i=s.filter(p=>{var o;if(r.has(p.id))return!1;const u=p.componentName||te(p.url);return((o=h[u])==null?void 0:o.status)==="impacted"});return i.length===0?t:[...t,...i]},[t,s,h]),N=n.useMemo(()=>Object.entries(h).filter(([,r])=>r.status==="new"||r.status==="edited").map(([r,i])=>({name:r,status:i.status})),[h]),[P,j]=n.useState(null),A=n.useCallback(r=>{j(i=>i===r?null:r)},[]),{pageGroups:R,componentGroups:$}=n.useMemo(()=>{var p;const r=new Map,i=new Map;for(const u of S)if(u.componentName){const o=i.get(u.componentName)||[];o.push(u),i.set(u.componentName,o)}else if(we(u.url)){const o=(p=u.url)==null?void 0:p.match(/[?&]c=([^&]+)/),v=o?decodeURIComponent(o[1]):"Isolated",E=i.get(v)||[];E.push(u),i.set(v,E)}else{const o=te(u.url),v=r.get(o)||[];v.push(u),r.set(o,v)}return{pageGroups:r,componentGroups:i}},[S]),T=n.useMemo(()=>He([...R.entries()],h),[R,h]),M=n.useMemo(()=>He([...$.entries()],h),[$,h]),I=T,O=M,f=n.useMemo(()=>It(a,h),[a,h]);return S.length===0&&a.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:c,className:"absolute top-2 right-3 text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"}),e.jsx("span",{className:"text-sm text-gray-400",children:"No scenarios registered yet"})]}):e.jsxs("div",{className:"h-full bg-white flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Working Session Results"}),k&&e.jsx("div",{className:"text-[11px] text-gray-400 truncate",title:k,children:k})]}),e.jsx("button",{onClick:c,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none shrink-0",title:"Close results",children:"×"})]}),w&&e.jsx(Ve,{text:w,theme:"light"}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[I.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),e.jsx("div",{className:"space-y-3 pl-1",children:I.map(([r,i])=>{var v;const p=h[r],u=P===r,o=(v=i[0])==null?void 0:v.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:r}),p&&e.jsx(Fe,{status:p,onClick:()=>A(r)})]}),u&&(p==null?void 0:p.status)==="edited"&&o&&e.jsx(ze,{filePath:o}),u&&(p==null?void 0:p.status)==="impacted"&&e.jsx(Ue,{impactedBy:p.impactedBy,changedEntities:N}),e.jsx("div",{className:"flex flex-wrap gap-3",children:i.map(E=>e.jsx(We,{scenarioId:E.id,name:Ge(E.name),isActive:E.id===g,onSelect:()=>x(E)},E.id))})]},r)})})]}),O.length>0&&e.jsxs("div",{className:I.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),e.jsx("div",{className:"space-y-3 pl-1",children:O.map(([r,i])=>{var v;const p=h[r],u=P===r,o=(v=i[0])==null?void 0:v.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:r}),p&&e.jsx(Fe,{status:p,onClick:()=>A(r)})]}),u&&(p==null?void 0:p.status)==="edited"&&o&&e.jsx(ze,{filePath:o}),u&&(p==null?void 0:p.status)==="impacted"&&e.jsx(Ue,{impactedBy:p.impactedBy,changedEntities:N}),e.jsx("div",{className:"flex flex-wrap gap-3",children:i.map(E=>e.jsx(We,{scenarioId:E.id,name:Ge(E.name),isActive:E.id===g,onSelect:()=>x(E)},E.id))})]},r)})})]}),f.length>0&&e.jsxs("div",{className:I.length>0||O.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),e.jsx("div",{className:"space-y-2 pl-1",children:f.map(r=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-700",children:r.name})}),e.jsx(Ht,{filePath:r.filePath,projectRoot:d}),r.testFile?e.jsx(Vt,{testFile:r.testFile,entityName:r.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},r.name))})]}),m.length>0&&e.jsxs("div",{className:I.length>0||O.length>0||f.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:["Modified Files (",m.length,")"]})}),e.jsx("div",{className:"space-y-0.5 pl-1 max-h-[200px] overflow-auto",children:m.map(r=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase w-[14px] text-center ${r.status==="added"||r.status==="untracked"?"text-green-600":r.status==="modified"?"text-blue-600":r.status==="renamed"?"text-purple-600":"text-gray-400"}`,children:r.status==="added"||r.status==="untracked"?"A":r.status==="modified"?"M":r.status==="renamed"?"R":"?"}),e.jsx("span",{className:"text-[10px] text-gray-500 truncate font-mono",children:r.path})]},r.path))})]})]})})]})}function Yt({items:t,onNavigate:s}){return t.length===0?null:e.jsx("nav",{className:"flex items-center gap-1 text-xs",children:t.map((a,d)=>{const g=d===t.length-1;return e.jsxs("span",{className:"flex items-center gap-1",children:[d>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500",children:e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),g?e.jsx("span",{className:"text-white font-medium",children:a.name}):e.jsx("button",{onClick:()=>s(a.componentName),className:"text-gray-400 hover:text-white transition-colors cursor-pointer",children:a.name})]},a.componentName||"app")})})}const Kt=[{key:"app",label:"App"},{key:"build",label:"Build"},{key:"data",label:"Structure"},{key:"journal",label:"Journal"}];function qt({activeTab:t,onTabChange:s,buildIdle:a,zoomComponent:d,breadcrumbItems:g,onBreadcrumbNavigate:x}){return e.jsxs("div",{className:"bg-[#3d3d3d] h-10 flex items-center px-3 gap-3 shrink-0 z-20 border-b border-[#2d2d2d]",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("img",{src:Pt,alt:"CodeYam",className:"h-5 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-xs whitespace-nowrap",children:"Codeyam Editor"}),d&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-3.5 bg-gray-600"}),e.jsx(Yt,{items:g,onNavigate:x})]})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex items-center gap-0.5 bg-[#4a3232] rounded-lg p-0.5 shrink-0",children:Kt.map(c=>e.jsxs("button",{onClick:()=>s(c.key),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors cursor-pointer ${t===c.key?"bg-[#7a4444] text-white":"text-gray-300 hover:text-white"}`,children:[c.label,c.key==="build"&&a&&t!=="build"&&e.jsx("span",{className:"ml-1 inline-block w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"})]},c.key))})]})}function Qt({preview:t,onDismiss:s,onLoadCommit:a}){return e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-[700px] w-full",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-[#333] m-0 font-['IBM_Plex_Sans']",children:"Journal Screenshot"}),e.jsx("p",{className:"text-sm text-[#888] mt-1 m-0 font-['IBM_Plex_Sans']",children:"This is a snapshot from a previous version — not a live preview"})]}),e.jsx("div",{className:"rounded-lg overflow-hidden border-2 border-[#ccc] shadow-md max-w-full w-fit",children:e.jsx("img",{src:t.screenshotUrl,alt:t.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[t.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:t.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[t.scenarioName,t.commitMessage&&` — ${t.commitMessage}`]})]}),e.jsx("div",{className:"flex items-center gap-3",children:t.commitSha&&a&&e.jsx(Xt,{commitSha:t.commitSha,onLoadCommit:a})})]})}function Xt({commitSha:t,onLoadCommit:s}){const[a,d]=n.useState(!1),[g,x]=n.useState(null);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{d(!0),x(null),s(t).then(c=>{c.success||x(c.error||"Failed to load commit")}).catch(c=>{x(c instanceof Error?c.message:"Network error")}).finally(()=>d(!1))},disabled:a,className:"bg-[#005c75] hover:bg-[#004d63] disabled:opacity-50 text-white text-sm font-medium px-4 py-1.5 rounded transition-colors cursor-pointer",children:a?"Reverting...":"Revert to this code and load this version"}),g&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded px-4 py-2 text-sm text-red-600 w-full text-center",children:g})]})}function Zt({analysisId:t,scenarioId:s,scenarioName:a,entityName:d,projectSlug:g,onStateChange:x}){const{interactiveServerUrl:c,isStarting:h,isLoading:m}=Et({analysisId:t,scenarioId:s,scenarioName:a,entityName:d,projectSlug:g,enabled:!0});return n.useEffect(()=>{x(c,h||m)},[c,h,m,x]),null}function es(t,s){return s.status==="error"?{url:null,proxyUrl:null,isStarting:!1,error:s.errorMessage||"Dev server crashed",canStartServer:t.canStartServer,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.url?{url:s.url,proxyUrl:s.proxyUrl||null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.status==="starting"?{...t,isStarting:!0,error:null,canStartServer:!0,shouldAutoStart:!1}:s.status==="stopped"?t.url?{...t,url:null,isStarting:!1,shouldAutoStart:!1}:t.autoStartAttempted?{...t,isStarting:!1,shouldAutoStart:!1}:{...t,autoStartAttempted:!0,shouldAutoStart:!0}:{...t,shouldAutoStart:!1}}function ts(){const[t,s]=n.useState({url:null,proxyUrl:null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:!1}),a=n.useRef(t);a.current=t,n.useEffect(()=>{let x=!1,c=null;const h=async()=>{try{const m=await fetch("/api/editor-dev-server");if(x)return;const k=await m.json(),w=es(a.current,k),{shouldAutoStart:S,...N}=w;if(s(N),S)try{const P=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})});if(x)return;P.ok?s(j=>({...j,isStarting:!0})):s(j=>({...j,canStartServer:!1}))}catch{}}catch{}};return h(),c=setInterval(()=>void h(),2e3),()=>{x=!0,c&&clearInterval(c)}},[t.url]);const d=n.useCallback(()=>{s(x=>({...x,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),g=n.useCallback(()=>{s(x=>({...x,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]);return{devServerUrl:t.url,proxyUrl:t.proxyUrl,isStarting:t.isStarting,error:t.error,canStartServer:t.canStartServer,retryServer:d,startServer:g}}const hs=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}];class ss extends n.Component{constructor(){super(...arguments);$e(this,"state",{error:null,errorInfo:null})}static getDerivedStateFromError(a){return{error:a,errorInfo:null}}componentDidCatch(a,d){console.error("[EditorErrorBoundary] Error:",a.message),console.error("[EditorErrorBoundary] Component stack:",d.componentStack),console.error("[EditorErrorBoundary] Loader snapshot:",JSON.stringify(this.props.loaderSnapshot,null,2)),this.setState({errorInfo:d})}render(){var a;return this.state.error?e.jsx("div",{className:"fixed inset-0 bg-[#1e1e1e] flex items-center justify-center p-8",children:e.jsxs("div",{className:"max-w-[600px] w-full space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-red-400 font-['IBM_Plex_Sans'] m-0",children:"Something went wrong"}),e.jsx("pre",{className:"text-xs text-gray-300 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[120px]",children:this.state.error.message}),((a=this.state.errorInfo)==null?void 0:a.componentStack)&&e.jsxs("details",{className:"text-xs text-gray-500",children:[e.jsx("summary",{className:"cursor-pointer hover:text-gray-300 transition-colors",children:"Component stack"}),e.jsx("pre",{className:"mt-2 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[200px] text-yellow-300",children:this.state.errorInfo.componentStack})]}),e.jsx("p",{className:"text-xs text-gray-500 m-0",children:"Full diagnostics are in the browser console."}),e.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-[#005c75] text-white text-sm rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Reload"})]})}):this.props.children}}const ve=[{name:"Desktop",width:1440,height:900},{name:"Laptop",width:1024,height:768},{name:"Tablet",width:768,height:1024},{name:"Mobile",width:375,height:667}],us=ut(function(){const{projectSlug:s,projectRoot:a,hasProject:d,scenarios:g,allScenarios:x,analyzedEntities:c,glossaryFunctions:h,entityImports:m,pageFilePaths:k,entityChangeStatus:w,modifiedFiles:S,featureName:N,userPrompt:P,projectTitle:j,projectDescription:A,defaultScreenSize:R}=ft(),$=gt(),[T,M]=jt(),I=n.useRef(null),O=n.useRef(null),f=n.useRef(null),r=T.get("zoom")||void 0,i=T.get("scenario")||void 0,p=n.useRef(null);n.useEffect(()=>{if(!Nt(i,p.current))return;const l=x.find(C=>C.id===i);if(!l)return;p.current=i;const y=ne(l.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:y,scenarioId:l.id,scenarioName:l.name,scenarioType:l.type})}).catch(()=>{})},[i,x]),n.useEffect(()=>{const l=new BroadcastChannel("codeyam-editor");return l.onmessage=y=>{var C;if(((C=y.data)==null?void 0:C.type)==="switch-scenario"&&y.data.scenarioId){const L=y.data.scenarioId,z=x.find(je=>je.id===L);if(!z)return;p.current=L;const ge=new URLSearchParams(T);ge.set("scenario",L),ge.delete("zoom"),M(ge),b(null),F(null),H(null),V(!0);const mt=ne(z.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:mt,scenarioId:L,scenarioType:z.type})}).then(()=>{q(je=>je+1)}).catch(()=>{V(!1)})}},()=>l.close()},[T,M,x]),n.useEffect(()=>{if(T.get("ref")!=="link"||!i)return;const l=new BroadcastChannel("codeyam-editor");l.postMessage({type:"switch-scenario",scenarioId:i}),l.close(),window.close()},[]);const{devServerUrl:u,proxyUrl:o,isStarting:v,error:E,canStartServer:U,retryServer:se,startServer:ae}=ts(),[K,W]=n.useState(!1),[D,b]=n.useState(null),[B,F]=n.useState(null),[le,Se]=n.useState(!1),[oe,H]=n.useState(null),Je=n.useCallback(async l=>{const C=await(await fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:l})})).json();return C.success&&(H(null),W(!1)),C},[]),Ye=n.useCallback((l,y)=>{F(C=>(l&&l!==C&&W(!1),l)),!y&&l&&W(!0),Se(y)},[]),ke=n.useCallback(l=>{H(null),b(C=>(C&&C.analysisId===l.analysisId||(F(null),q(z=>z+1)),l)),Se(!0),W(!1);const y=new URLSearchParams(T);y.delete("scenario"),y.delete("zoom"),M(y)},[T,M]),[_,ce]=n.useState(R?{name:R.name,width:R.width,height:R.height}:{name:"Desktop",width:1440,height:900}),[Ke,de]=n.useState(!1),[G,xe]=n.useState("app"),qe=n.useCallback(()=>{xe("build"),me(!0)},[]),[Qe,me]=n.useState(!1),[Xe,Ce]=n.useState(!1),Ze=n.useCallback(l=>{Ce(l)},[]),[pe,Me]=n.useState(!1),et=n.useCallback(()=>{Me(!0),xe("build"),me(!0)},[]),Pe=n.useCallback(()=>{Me(!1)},[]),[re,he]=n.useState(!1),tt=n.useCallback(()=>{if(re){he(!1);return}typeof Notification<"u"&&Notification.permission==="default"?Notification.requestPermission().then(l=>{l==="granted"&&he(!0)}):he(!0)},[re]);n.useEffect(()=>{if(G==="build"){Ce(!1);const l=setTimeout(()=>{var y,C;(y=I.current)==null||y.scrollToBottom(),(C=I.current)==null||C.focus()},50);return()=>clearTimeout(l)}},[G]);const[ue,st]=n.useState(null);n.useEffect(()=>{const l=f.current;if(!l)return;const y=new ResizeObserver(C=>{const L=C[0];L&&st({width:L.contentRect.width,height:L.contentRect.height})});return y.observe(l),()=>y.disconnect()},[]);const Y=n.useMemo(()=>ue?yt(ue,_):1,[ue,_]),[at,q]=n.useState(0),[Ee,Ie]=n.useState(null),[Te,V]=n.useState(!1),rt=n.useCallback((l,y)=>{if(Ie(l||null),y){const C=new URLSearchParams(T);C.set("scenario",y),p.current=y,M(C)}H(null),q(C=>C+1)},[T,M]),{customSizes:Le,addCustomSize:nt}=bt(s);n.useMemo(()=>[...ve,...Le],[Le]),n.useEffect(()=>{const l=new EventSource("/api/events");let y=null;return l.addEventListener("message",C=>{try{const L=JSON.parse(C.data);(L.type==="db-change"||L.type==="unknown")&&(y&&clearTimeout(y),y=setTimeout(()=>{$.revalidate()},2e3))}catch{}}),()=>{y&&clearTimeout(y),l.close()}},[$]);const it=n.useMemo(()=>{const l=[{name:"App"}];return r&&l.push({name:r,componentName:r}),l},[r]),fe=n.useCallback(l=>{const y=new URLSearchParams(T);if(l){y.set("zoom",l);const C=x.find(L=>L.componentName===l||L.componentName===null&&l==="Home");if(C){y.set("scenario",C.id),p.current=C.id,V(!0);const L=ne(C.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:L,scenarioId:C.id,scenarioType:C.type})}).then(()=>{q(z=>z+1)}).catch(()=>{V(!1)})}else y.delete("scenario")}else y.delete("zoom"),y.delete("scenario");M(y)},[T,M,x]),Q=n.useCallback(l=>{if(b(null),F(null),H(null),l.viewportWidth&&l.viewportHeight){const L=ve.find(z=>z.width===l.viewportWidth&&z.height===l.viewportHeight);ce({name:(L==null?void 0:L.name)||"Custom",width:l.viewportWidth,height:l.viewportHeight})}p.current=l.id;const y=new URLSearchParams(T);y.set("scenario",l.id),M(y),V(!0);const C=ne(l.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:C,scenarioId:l.id,scenarioType:l.type})}).then(()=>{q(L=>L+1)}).catch(()=>{V(!1)})},[T,M]),lt=n.useCallback(l=>{if(!l.commitSha){const y=x.find(C=>C.name===l.scenarioName);if(y){Q(y);return}}H(l)},[x,Q]),ot=l=>{ce({name:l.name,width:l.width,height:l.height})},ct=l=>{nt(l,_.width,_.height??900),de(!1),ce(y=>({...y,name:l}))},dt=()=>{D||W(!0),V(!1)},X=n.useMemo(()=>wt({activeAnalyzedScenario:!!D,analyzedPreviewUrl:B,activeScenarioId:i||null,scenarios:x,proxyUrl:o,devServerUrl:u,zoomComponent:r||null}),[o,u,r,i,x,D,B]),Re=n.useMemo(()=>St(X,Ee),[X,Ee]),xt=n.useMemo(()=>({projectSlug:s,hasProject:d,scenarioCount:g==null?void 0:g.length,allScenarioCount:x==null?void 0:x.length,analyzedEntityCount:c==null?void 0:c.length,glossaryFunctionCount:h==null?void 0:h.length,entityChangeStatusKeys:w?Object.keys(w):[],featureName:N}),[s,d,g,x,c,h,w,N]);return e.jsx(ss,{loaderSnapshot:xt,children:e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[D&&e.jsx(Zt,{analysisId:D.analysisId,scenarioId:D.scenarioId,scenarioName:D.scenarioName,entityName:D.entityName,projectSlug:s,onStateChange:Ye},D.analysisId),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsx("div",{className:"bg-[#2d2d2d] border-b border-[#3d3d3d] shrink-0 z-10 h-10 flex items-center px-4 gap-1",children:e.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1",children:[ve.map(l=>e.jsxs("button",{onClick:()=>ot(l),className:`p-1.5 rounded transition-colors cursor-pointer ${_.name===l.name?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:`${l.name} (${l.width}×${l.height})`,children:[l.name==="Desktop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8M12 17v4"})]}),l.name==="Laptop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8H4V6z"}),e.jsx("path",{d:"M2 18h20"})]}),l.name==="Tablet"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]}),l.name==="Mobile"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"7",y:"2",width:"10",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]})]},l.name)),e.jsx("button",{onClick:()=>de(!0),className:`p-1.5 rounded transition-colors cursor-pointer ${_.name==="Custom"?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:"Custom dimensions",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),e.jsx("div",{className:"w-px h-4 bg-[#3d3d3d] mx-1"}),e.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[_.width," × ",_.height??900]}),e.jsx("div",{className:"w-px h-4 bg-[#3d3d3d] mx-1"}),e.jsx("button",{onClick:()=>{const l=Re||X;l&&window.open(l,"_blank")},className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:"Open preview in new window",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})})]})}),e.jsx("div",{ref:f,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:oe?{backgroundColor:"#f5f0e8",backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 19px, #e8e0d0 19px, #e8e0d0 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, #e8e0d0 19px, #e8e0d0 20px)"}:{backgroundImage:`
6
- linear-gradient(45deg, #333 25%, transparent 25%),
7
- linear-gradient(-45deg, #333 25%, transparent 25%),
8
- linear-gradient(45deg, transparent 75%, #333 75%),
9
- linear-gradient(-45deg, transparent 75%, #333 75%)
10
- `,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#2d2d2d"},children:oe?e.jsx(Qt,{preview:oe,onDismiss:()=>H(null),onLoadCommit:Je}):X?e.jsx("div",{style:{width:`${_.width*Y}px`,height:`${(_.height??900)*Y}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${_.width}px`,height:`${_.height??900}px`,transform:Y<1?`scale(${Y})`:void 0},children:[!K&&!Te&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-[#2a2a2a] rounded-lg p-8 w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Be,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the app to render"})]})]})}),Te&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center",style:{backgroundColor:"rgba(0, 0, 0, 0.25)",backdropFilter:"blur(1px)",transition:"opacity 200ms ease-out"},children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx("svg",{className:"w-6 h-6 text-white/80 animate-spin",viewBox:"0 0 24 24",fill:"none",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"50 100"})}),e.jsx("span",{className:"text-white/70 text-xs font-['IBM_Plex_Sans']",children:"Switching scenario"})]})}),e.jsx("iframe",{ref:O,src:Re||X,className:"w-full h-full border-none",title:"Editor preview",onLoad:dt,style:{opacity:K?1:0}},at)]})}):e.jsx("div",{className:"bg-[#2a2a2a] rounded-lg flex flex-col items-center justify-center",style:{width:`${_.width*Y}px`,height:`${(_.height??900)*Y}px`},children:E?e.jsxs("div",{className:"flex flex-col gap-4 text-center px-8 max-w-[600px]",children:[e.jsx("h2",{className:"text-xl font-medium text-red-400 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Dev Server Failed"}),e.jsx("pre",{className:"text-xs text-left bg-[#1e1e1e] text-gray-300 p-4 rounded overflow-auto max-h-[300px] w-full font-mono whitespace-pre-wrap",children:E}),e.jsx("button",{onClick:se,className:"mx-auto px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Retry"})]}):v||le?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Be,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:le?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:le?"Loading component preview...":"Your dev server is starting up..."})]})]}):e.jsxs("div",{className:"flex flex-col gap-3 text-center px-8",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Live Preview"}),e.jsx("p",{className:"text-sm text-gray-500 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Describe what you want to build in the Build tab"})]})})})]}),e.jsxs("aside",{className:"w-[50%] min-w-[400px] max-w-[800px] bg-[#1e1e1e] border-r border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden order-first",children:[e.jsx(qt,{activeTab:G,onTabChange:l=>{xe(l),l==="build"&&me(!0)},buildIdle:Xe,zoomComponent:r,breadcrumbItems:it,onBreadcrumbNavigate:fe}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[Qe&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:G==="build"?"visible":"hidden"},children:[e.jsx("div",{className:pe?"flex-1 min-h-0":"flex-1",style:pe?{flex:"1 1 50%"}:void 0,children:e.jsx(kt,{ref:I,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:rt,onShowResults:et,onHideResults:Pe,editorMode:!0,onIdleChange:Ze,notificationsEnabled:re})}),pe&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(Jt,{scenarios:g,allScenarios:x,glossaryFunctions:h,projectRoot:a,activeScenarioId:i,onScenarioSelect:Q,onClose:Pe,entityChangeStatus:w,modifiedFiles:S,featureName:N,userPrompt:P})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:G==="app"?"visible":"hidden"},children:e.jsx(Gt,{hasProject:d,scenarios:x,analyzedEntities:c,glossaryFunctions:h,projectRoot:a,activeScenarioId:i,onScenarioSelect:Q,onAnalyzedScenarioSelect:ke,onSwitchToBuild:qe,zoomComponent:r,onZoomChange:fe,entityImports:m,pageFilePaths:k,projectTitle:j,projectDescription:A})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:G==="data"?"visible":"hidden"},children:e.jsx(Tt,{scenarios:x,projectRoot:a,activeScenarioId:i,onScenarioSelect:Q,zoomComponent:r,onZoomChange:fe,analyzedEntities:[],glossaryFunctions:h,activeAnalyzedScenarioId:D==null?void 0:D.scenarioId,onAnalyzedScenarioSelect:ke,entityImports:m,pageFilePaths:k})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:G==="journal"?"visible":"hidden"},children:e.jsx(Wt,{isActive:G==="journal",onScreenshotClick:lt,glossaryFunctions:h})})]}),e.jsx(Ct,{serverUrl:u,isStarting:v,projectSlug:s,devServerError:E,onStartServer:U?ae:void 0,notificationsEnabled:re,onToggleNotifications:tt})]})]}),Ke&&e.jsx(vt,{width:_.width,height:_.height??900,onSave:ct,onCancel:()=>de(!1)})]})})});export{us as default,hs as meta};
@@ -1,41 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/addon-web-links-Duc5hnl7.js","assets/chunk-JZWAC4HX-C4pqxYJB.js"])))=>i.map(i=>d[i]);
2
- import{r as d,j as u}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as O}from"./preload-helper-ckwbz45p.js";function se({serverUrl:r,isStarting:e,projectSlug:n,devServerError:o,onStartServer:l,notificationsEnabled:m,onToggleNotifications:y}){const[b,v]=d.useState(null),c=d.useRef(null);d.useEffect(()=>{if(!n)return;const E=new EventSource("/api/dev-mode-events");return E.onmessage=C=>{try{const j=JSON.parse(C.data);j.type==="file-synced"&&(v(j.fileName),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{v(null)},5e3))}catch{}},()=>{E.close(),c.current&&clearTimeout(c.current)}},[n]);let a;o?a="error":e?a="starting":r?a="running":a="stopped";const S={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},k={starting:"Starting...",running:r||"Running",stopped:"Stopped",error:"Error"};return u.jsxs("div",{className:"bg-[#1e1e1e] border-t border-[#3d3d3d] h-7 flex items-center px-4 gap-4 shrink-0 text-xs font-mono",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("div",{className:`w-2 h-2 rounded-full ${S[a]}`}),u.jsxs("span",{className:"text-gray-400",children:["Server:"," ",u.jsx("span",{className:"text-gray-300",children:k[a]})]}),(a==="stopped"||a==="error")&&l&&u.jsx("button",{onClick:l,className:"ml-1 px-2.5 py-0.5 bg-[#005c75] hover:bg-[#007a9a] text-white text-[11px] font-medium rounded transition-colors cursor-pointer border-none leading-tight",children:"Start Server"})]}),u.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"}),b&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4ade80",strokeWidth:"2",children:u.jsx("path",{d:"M20 6L9 17l-5-5"})}),u.jsxs("span",{className:"text-green-400",children:["Synced: ",b]})]}),u.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"})]}),u.jsx("div",{className:"flex-1"}),y&&u.jsx("button",{onClick:y,className:`text-[11px] rounded transition-colors cursor-pointer ${m?"text-green-400 hover:text-green-300":"text-gray-500 hover:text-gray-300"}`,title:m?"Click to turn off notifications":"Click to get notified when Claude finishes",children:m?"Notifications On":"Notifications Off"})]})}async function F(r,e){try{const{WebglAddon:o}=await O(async()=>{const{WebglAddon:m}=await import("./addon-webgl-DI8QOUvO.js").then(y=>y.a);return{WebglAddon:m}},[]),l=new o;return l.onContextLoss(()=>{e==null||e("webgl","canvas",new Error("WebGL context lost")),l.dispose(),q(r).then(m=>{m||e==null||e("canvas","dom",new Error("Canvas fallback failed after context loss"))})}),r.loadAddon(l),{type:"webgl",dispose:()=>l.dispose()}}catch(o){e==null||e("webgl","canvas",o)}const n=await q(r);return n||(e==null||e("canvas","dom",new Error("Canvas addon failed")),{type:"dom",dispose:()=>{}})}async function q(r){try{const{CanvasAddon:e}=await O(async()=>{const{CanvasAddon:o}=await import("./addon-canvas-DpzMmAy5.js").then(l=>l.a);return{CanvasAddon:o}},[]),n=new e;return r.loadAddon(n),{type:"canvas",dispose:()=>n.dispose()}}catch{return null}}const ee=`
3
- .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
4
- .xterm.focus, .xterm:focus { outline: none; }
5
- .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
6
- .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
7
- .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
8
- .xterm .composition-view.active { display: block; }
9
- .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
10
- .xterm .xterm-screen { position: relative; }
11
- .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
12
- .xterm .xterm-scroll-area { visibility: hidden; }
13
- .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
14
- .xterm.enable-mouse-events { cursor: default; }
15
- .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
16
- .xterm.column-select.focus { cursor: crosshair; }
17
- .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
18
- .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
19
- .xterm .xterm-accessibility-tree { user-select: text; white-space: pre; }
20
- .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
21
- .xterm-dim { opacity: 1 !important; }
22
- .xterm-underline-1 { text-decoration: underline; }
23
- .xterm-underline-2 { text-decoration: double underline; }
24
- .xterm-underline-3 { text-decoration: wavy underline; }
25
- .xterm-underline-4 { text-decoration: dotted underline; }
26
- .xterm-underline-5 { text-decoration: dashed underline; }
27
- .xterm-overline { text-decoration: overline; }
28
- .xterm-strikethrough { text-decoration: line-through; }
29
- .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
30
- .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
31
- .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
32
- .xterm-decoration-top { z-index: 2; position: relative; }
33
- `;function te(){if(document.getElementById("xterm-css"))return;const r=document.createElement("style");r.id="xterm-css",r.textContent=ee,document.head.appendChild(r)}const ie=d.forwardRef(function({entityName:e,entityType:n,entitySha:o,entityFilePath:l,scenarioName:m,scenarioDescription:y,analysisId:b,projectSlug:v,onRefreshPreview:c,onShowResults:a,onHideResults:S,editorMode:k,onIdleChange:E,notificationsEnabled:C},j){const M=d.useRef(null),A=d.useRef(null),z=d.useRef(null),N=d.useRef(null),B=d.useRef(null),P=d.useRef(!1),W=d.useRef(0),I=d.useRef(!1),_=d.useRef(E);_.current=E;const D=d.useRef(C);D.current=C;const X=d.useCallback(()=>{var f;(f=z.current)==null||f.focus()},[]);return d.useImperativeHandle(j,()=>({sendInput(f){const x=N.current;x&&x.readyState===WebSocket.OPEN&&(x.send(JSON.stringify({type:"input",data:f})),setTimeout(()=>{x.readyState===WebSocket.OPEN&&x.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var f;(f=z.current)==null||f.focus()},scrollToBottom(){var x;const f=(x=M.current)==null?void 0:x.querySelector(".xterm-viewport");f&&(f.scrollTop=f.scrollHeight)}})),d.useEffect(()=>{const f=M.current;if(!f)return;let x=!1;return te(),Promise.all([O(()=>import("./xterm-BqvuqXEL.js"),[]),O(()=>import("./addon-fit-YJmn1quW.js"),[]),O(()=>import("./addon-web-links-Duc5hnl7.js").then(T=>T.a),__vite__mapDeps([0,1]))]).then(([T,G,Z])=>{if(x)return;const s=new T.Terminal({cursorBlink:!0,scrollback:5e3,fontSize:13,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},linkHandler:{activate(i,t){try{const p=new URL(t),h=p.searchParams.get("scenario");if(h&&p.pathname==="/editor"){const w=new BroadcastChannel("codeyam-editor");w.postMessage({type:"switch-scenario",scenarioId:h}),w.close();return}}catch{}window.open(t,"_blank")}}}),L=new G.FitAddon;s.loadAddon(L),s.loadAddon(new Z.WebLinksAddon),s.open(f);let $=null;F(s,(i,t,p)=>{console.warn(`[Terminal] Renderer fallback: ${i} → ${t}`,p)}).then(i=>{if(x){i.dispose();return}console.log(`[Terminal] Using ${i.type} renderer`),$=i.dispose}),requestAnimationFrame(()=>{try{L.fit()}catch{}}),z.current=s,s.focus(),setTimeout(()=>s.focus(),100),setTimeout(()=>s.focus(),500);const K=window.location.protocol==="https:"?"wss:":"ws:",Q=window.location.host;function Y(i){const t=new URLSearchParams;return t.set("entityName",e),n&&t.set("entityType",n),o&&t.set("entitySha",o),l&&t.set("entityFilePath",l),m&&t.set("scenarioName",m),y&&t.set("scenarioDescription",y),b&&t.set("analysisId",b),v&&t.set("projectSlug",v),k&&t.set("editorMode","true"),i&&t.set("reconnectId",i),`${K}//${Q}/ws/terminal?${t.toString()}`}function J(i){const t=Y(i),p=new WebSocket(t);N.current=p,p.onopen=()=>{W.current=0,I.current=!1,p.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows}))},p.onmessage=h=>{var w,H;try{const g=JSON.parse(h.data);if(g.type==="session-id"){B.current=g.sessionId;return}if(g.type==="refresh-preview"){c==null||c(g.path,g.scenarioId);return}if(g.type==="show-results"){a==null||a();return}if(g.type==="hide-results"){S==null||S();return}if(g.type==="claude-idle"){if(console.log("[Terminal] Received claude-idle, notifications:",D.current,"permission:",typeof Notification<"u"?Notification.permission:"N/A"),(w=_.current)==null||w.call(_,!0),D.current&&typeof Notification<"u"&&Notification.permission==="granted"){const V=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});V.onclick=()=>{window.focus(),V.close()}}return}g.type==="output"&&(s.write(g.data),(H=_.current)==null||H.call(_,!1))}catch{s.write(h.data)}},p.onclose=()=>{if(P.current){s.write(`\r
34
- \x1B[90m[Terminal session ended]\x1B[0m\r
35
- `);return}const h=W.current;if(h<5&&B.current){const w=1e3*Math.pow(2,Math.min(h,3));W.current=h+1,s.write(`\r
36
- \x1B[33m[Reconnecting...]\x1B[0m\r
37
- `),setTimeout(()=>{P.current||J(B.current)},w)}else I.current?s.write(`\r
38
- \x1B[90m[Terminal session ended]\x1B[0m\r
39
- `):(I.current=!0,s.write(`\r
40
- \x1B[33m[Starting new session...]\x1B[0m\r
41
- `),B.current=null,W.current=0,J())},p.onerror=()=>{}}J(),s.onData(i=>{const t=N.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify({type:"input",data:i}))});let R=null;const U=new ResizeObserver(()=>{R&&clearTimeout(R),R=setTimeout(()=>{let i;try{i=L.proposeDimensions()}catch{return}if(!i||i.cols===s.cols&&i.rows===s.rows)return;const t=f.querySelector(".xterm-viewport");let p,h=!0;t&&(p=t.scrollTop,h=t.scrollTop+t.clientHeight>=t.scrollHeight-10),L.fit(),t&&p!==void 0&&(h?t.scrollTop=t.scrollHeight:t.scrollTop=p);const w=N.current;w&&w.readyState===WebSocket.OPEN&&w.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows}))},150)});U.observe(f),A.current=()=>{var i;R&&clearTimeout(R),U.disconnect(),P.current=!0,(i=N.current)==null||i.close(),N.current=null,$==null||$(),s.dispose(),z.current=null}}),()=>{var T;x=!0,(T=A.current)==null||T.call(A),A.current=null}},[]),u.jsx("div",{ref:M,onClick:X,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});function re(r){return r.replace(/[^a-zA-Z0-9_]+/g,"_")}function ce(r){const{activeAnalyzedScenario:e,analyzedPreviewUrl:n,activeScenarioId:o,scenarios:l,proxyUrl:m,devServerUrl:y,zoomComponent:b}=r;if(e&&n)return n;if(e&&!n)return null;if(o){const c=l.find(a=>a.id===o);if(c!=null&&c.url){const a=m||y;return a?c.url.startsWith("/")?`${a}${c.url}`:c.url:null}}const v=m||y;if(!v)return null;if(b&&o){const c=l.find(S=>S.id===o),a=c?re(c.name):"Default";return`${v}/__codeyam__/${b}/${a}`}return v}function ae(r,e){if(!r||!e)return r;try{const n=new URL(r),o=e.indexOf("?");return o>=0?(n.pathname=e.slice(0,o),n.search=e.slice(o)):(n.pathname=e,n.search=""),n.href}catch{return r}}function le(r,e){return r?r!==e:!1}function ue(r,e){const n=e.width,o=e.height??900,l=r.width,m=r.height;return n<=l&&o<=m?1:Math.min(l/n,m/o)}export{se as D,ie as T,ae as a,ce as b,ue as c,re as g,le as s};
@@ -1,6 +0,0 @@
1
- import{a as V,j as e,w as re,u as oe,r as i}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as le,S as W}from"./Spinner-Bb5uFQ5V.js";import{u as ce}from"./useLastLogLine-C14nCb1q.js";import{V as de}from"./ViewportInspectBar-oAf2Kqsf.js";import{u as he,S as xe}from"./useCustomSizes-CrAK28Bc.js";import{c as me}from"./cy-logo-cli-DcX-ZS3p.js";import{I as E}from"./InlineSpinner-Bu6c6aDe.js";import{a as ue,T as pe,D as ge}from"./editorPreview-B7ztwLut.js";import{S as fe}from"./SafeScreenshot-BED4B6sP.js";import"./preload-helper-ckwbz45p.js";function ve({scenarios:w,currentScenarioId:r,entitySha:s,cacheBuster:l}){const c=V();return w.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:e.jsx("p",{className:"text-gray-500 text-sm",children:"No scenarios found"})}):e.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:w.map(o=>{var j,u;const g=o.id===r,f=(u=(j=o.metadata)==null?void 0:j.screenshotPaths)==null?void 0:u[0];return e.jsxs("button",{onClick:()=>{c(`/entity/${s}/scenarios/${o.id}/dev`)},className:`w-full text-left rounded-lg overflow-hidden border transition-colors cursor-pointer flex ${g?"border-[#005c75] bg-[#1a3a44]":"border-[#3d3d3d] bg-[#252525] hover:border-[#555]"}`,children:[e.jsx("div",{className:"w-24 h-20 shrink-0 bg-[#1a1a1a]",children:e.jsx(fe,{screenshotPath:f,cacheBuster:l,alt:o.name,className:"w-full h-full object-cover object-top"})}),e.jsxs("div",{className:"p-2.5 min-w-0 flex-1",children:[e.jsxs("div",{className:"text-white text-sm font-medium truncate",children:[g&&e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-[#005c75] mr-1.5 relative top-[-1px]"}),o.name]}),o.description&&e.jsx("div",{className:"text-gray-400 text-xs mt-1 line-clamp-2",children:o.description})]})]},o.id)})})}const I=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}],Me=re(function(){const{entity:r,scenario:s,analysis:l,projectSlug:c}=oe(),o=V(),g=i.useRef(null),f=i.useRef(null),[j,u]=i.useState(null),[A,M]=i.useState(1440),[n,N]=i.useState({name:"Desktop",width:1440,height:900}),[H,y]=i.useState(!1),[S,U]=i.useState(null),[d,k]=i.useState("chat"),[F,q]=i.useState(0),[D,$]=i.useState(null),K=i.useCallback(t=>{$(t||null),q(a=>a+1)},[]),{customSizes:_,addCustomSize:Y}=he(c),v=i.useMemo(()=>[...I,..._],[_]),{interactiveServerUrl:h,isStarting:C,isLoading:z,showIframe:B,iframeKey:G,onIframeLoad:J}=le({analysisId:l==null?void 0:l.id,scenarioId:s==null?void 0:s.id,scenarioName:s==null?void 0:s.name,projectSlug:c,enabled:!0,refreshTrigger:F}),O=i.useMemo(()=>ue(h,D),[h,D]),{lastLine:b}=ce(c,C||z),Q=()=>{o(`/entity/${r.sha}`)},X=(t,a)=>{M(t);const m=v.find(T=>T.width===t&&T.height===a);u(m||null),N({name:(m==null?void 0:m.name)||"Custom",width:t,height:a})},R=t=>{u(t),M(t.width),N({name:t.name,width:t.width,height:t.height})},Z=t=>{Y(t,n.width,n.height??900),y(!1),N(a=>({...a,name:t}))},ee=()=>{var a;k("chat"),(a=f.current)==null||a.sendInput("Create a new scenario for this entity based on the work we've just done. Create a name and description that reflects what the live preview is showing. Use the scenario data you've changed to create a new scenario in the database. If the data structure was fixed in any way you need to update that in the database as well and backfill all existing scenarios, then save to the database and capture a screenshot. Remember the database is at `.codeyam/db.sqlite3`, the scenarios table has all scenarios and the analyses table contains the scenariosDataStructure is its metadata.")},x=((l==null?void 0:l.scenarios)||[]).filter(t=>{var a;return!((a=t.metadata)!=null&&a.sameAsDefault)}),p=x.findIndex(t=>t.id===(s==null?void 0:s.id)),te=p+1,se=x.length,L=p>0,P=p<x.length-1,ae=()=>{if(L){const t=x[p-1];o(`/entity/${r.sha}/scenarios/${t.id}/dev`)}},ne=()=>{if(P){const t=x[p+1];o(`/entity/${r.sha}/scenarios/${t.id}/dev`)}},ie=C||z||!B;return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[e.jsxs("div",{className:"bg-[#3d3d3d] h-12 flex items-center px-4 gap-4 shrink-0 z-20",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("img",{src:me,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:r.name}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:ae,disabled:!L,className:`${L?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Previous scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M12.5 15L7.5 10L12.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsxs("span",{className:"text-gray-400 text-sm",children:[te,"/",se]}),e.jsx("button",{onClick:ne,disabled:!P,className:`${P?"text-white hover:text-gray-300":"text-gray-600 cursor-not-allowed"} transition-colors`,"aria-label":"Next scenario",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M7.5 15L12.5 10L7.5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-2 min-w-0",children:[e.jsx("span",{className:"text-white font-semibold text-xs whitespace-nowrap shrink-0",children:s==null?void 0:s.name}),(s==null?void 0:s.description)&&e.jsxs("div",{className:"relative group min-w-0",children:[e.jsx("span",{className:"text-gray-400 text-xs truncate block",children:s.description}),e.jsx("div",{className:"absolute left-0 top-full mt-1 hidden group-hover:block z-50 bg-black text-white text-xs px-3 py-2 rounded shadow-lg max-w-md",children:s.description})]})]}),e.jsx("span",{className:"bg-[#005c75] text-white text-[10px] font-bold px-2 py-0.5 rounded uppercase tracking-wider ml-2",children:"Dev Mode"})]}),e.jsx("button",{onClick:Q,className:"text-white hover:text-gray-300 transition-colors ml-4","aria-label":"Close dev mode",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M15 5L5 15M5 5L15 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:"bg-[#e5e7eb] border-b border-[rgba(0,0,0,0.1)] shrink-0 z-10 h-6 flex items-center justify-center relative",children:[e.jsx("div",{className:"absolute inset-0 flex justify-center",children:e.jsx("div",{style:{maxWidth:`${I[I.length-1].width}px`,width:"100%"},children:e.jsx(de,{currentViewportWidth:A,currentPresetName:n.name,onDevicePresetClick:R,devicePresets:v,hideLabel:!0,onHoverChange:U,lightMode:!0})})}),e.jsxs("div",{className:"relative z-10 flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-28 h-5",children:[e.jsxs("div",{className:"absolute inset-0 bg-white text-gray-900 text-xs px-2 rounded flex items-center justify-between pointer-events-none border border-gray-300",children:[e.jsx("span",{className:"leading-none",children:(S==null?void 0:S.name)||n.name}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsxs("select",{value:n.name,onChange:t=>{const a=v.find(m=>m.name===t.target.value);a&&R(a)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[v.map(t=>e.jsx("option",{value:t.name,children:t.name},t.name)),n.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:n.width,onChange:t=>{const a=parseInt(t.target.value,10);!isNaN(a)&&a>0&&X(a,n.height??900)},className:"bg-white text-gray-900 text-xs px-1 rounded border border-gray-300 outline-none w-16 text-center h-5 leading-none",min:"200",max:"3840"}),e.jsx("span",{className:"text-gray-400 text-xs h-5 flex items-center leading-none",children:"x"}),e.jsx("span",{className:"bg-gray-100 text-gray-600 text-xs px-1 rounded w-14 text-center h-5 flex items-center justify-center leading-none",children:n.height??900}),n.name==="Custom"&&e.jsx("button",{onClick:()=>y(!0),className:"bg-white text-gray-900 text-xs px-2 rounded h-5 flex items-center leading-none border border-gray-300 hover:bg-gray-50 transition-colors",children:"Save"})]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center overflow-auto p-8",style:{backgroundImage:`
2
- linear-gradient(45deg, #ebebeb 25%, transparent 25%),
3
- linear-gradient(-45deg, #ebebeb 25%, transparent 25%),
4
- linear-gradient(45deg, transparent 75%, #ebebeb 75%),
5
- linear-gradient(-45deg, transparent 75%, #ebebeb 75%)
6
- `,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#fafafa"},children:h?e.jsxs("div",{className:"relative bg-white w-full h-full",style:{maxWidth:`${n.width}px`,maxHeight:`${n.height}px`},children:[ie&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-white rounded-lg p-8 shadow-sm w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(W,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the dev server to be ready"}),b&&e.jsxs("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 mt-3 font-['IBM_Plex_Mono'] uppercase",children:[e.jsx(E,{}),b]})]})]})}),e.jsx("iframe",{ref:g,src:O||h,className:"w-full h-full border-none",title:`Dev mode preview: ${s==null?void 0:s.name}`,onLoad:J,style:{opacity:B?1:0}},G)]}):e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 w-[500px] h-[300px] bg-white rounded-lg p-8 shadow-sm",children:[e.jsx("div",{className:"mb-4",children:e.jsx(W,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Starting Dev Mode"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Setting up a sandboxed environment with live preview"}),b&&e.jsxs("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 mt-3 font-['IBM_Plex_Mono'] uppercase",children:[e.jsx(E,{}),b]})]})]})})]}),e.jsxs("aside",{className:"w-[50%] min-w-[400px] max-w-[800px] bg-[#1e1e1e] border-l border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"border-b border-[#3d3d3d] px-4 shrink-0 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsxs("button",{onClick:()=>k("chat"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${d==="chat"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Chat",d==="chat"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>k("scenarios"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${d==="scenarios"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Scenarios",d==="scenarios"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]})]}),d==="chat"&&e.jsx("button",{onClick:ee,disabled:!h,className:"px-3 py-1 text-[11px] font-medium rounded bg-[#005c75] text-white hover:bg-[#004a5c] transition-colors disabled:bg-gray-600 disabled:text-gray-400 disabled:cursor-not-allowed cursor-pointer",children:"Save Scenario"})]}),e.jsx("div",{style:{display:d==="chat"?"flex":"none"},className:"flex-1 overflow-hidden flex-col",children:e.jsx(pe,{ref:f,entityName:r.name,entityType:r.entityType,entitySha:r.sha,entityFilePath:r.filePath||r.localFilePath,scenarioName:s==null?void 0:s.name,scenarioDescription:s==null?void 0:s.description,analysisId:l==null?void 0:l.id,projectSlug:c,onRefreshPreview:K})}),d==="scenarios"&&e.jsx(ve,{scenarios:x,currentScenarioId:s==null?void 0:s.id,entitySha:r.sha,cacheBuster:0})]})]}),e.jsx(ge,{serverUrl:h,isStarting:C,projectSlug:c}),H&&e.jsx(xe,{width:n.width,height:n.height??900,onSave:Z,onCancel:()=>y(!1)})]})});export{Me as default};