@codeyam/codeyam-cli 0.1.0-staging.4c0c3c9 → 0.1.0-staging.57cd50f

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 (630) 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 +22 -22
  4. package/analyzer-template/packages/ai/package.json +2 -2
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  6. package/analyzer-template/packages/ai/src/lib/completionCall.ts +114 -113
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +259 -5
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  10. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +15 -6
  11. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
  12. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +96 -33
  13. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +19 -7
  14. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  15. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  16. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
  17. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  18. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  19. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
  20. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
  21. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
  22. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +23 -4
  23. package/analyzer-template/packages/aws/package.json +10 -10
  24. package/analyzer-template/packages/database/index.ts +1 -0
  25. package/analyzer-template/packages/database/package.json +3 -3
  26. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
  27. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +82 -0
  28. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  29. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  30. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
  31. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  32. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  33. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  34. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  35. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  36. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  37. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  38. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  39. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  40. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  41. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
  42. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  43. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +24 -0
  44. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  45. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +65 -0
  46. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  47. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  48. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  49. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  50. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  51. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  52. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  53. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  54. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  55. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  56. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
  57. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  58. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  59. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  60. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  61. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  62. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  63. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  64. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  65. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  66. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  67. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  68. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  69. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  70. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  71. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  72. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js +2 -0
  73. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js.map +1 -1
  74. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  75. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  76. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  77. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  78. package/analyzer-template/packages/github/package.json +1 -1
  79. package/analyzer-template/packages/types/src/enums/ProjectFramework.ts +2 -0
  80. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  81. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  82. package/analyzer-template/packages/ui-components/package.json +1 -1
  83. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  84. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  85. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js +2 -0
  86. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js.map +1 -1
  87. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  88. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  89. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  90. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  91. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  92. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +6 -2
  93. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  94. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +14 -2
  95. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  96. package/analyzer-template/project/constructMockCode.ts +168 -48
  97. package/analyzer-template/project/orchestrateCapture.ts +4 -1
  98. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  99. package/analyzer-template/project/start.ts +3 -0
  100. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  101. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  102. package/analyzer-template/project/writeMockDataTsx.ts +17 -0
  103. package/analyzer-template/project/writeScenarioComponents.ts +110 -17
  104. package/analyzer-template/tsconfig.json +13 -1
  105. package/background/src/lib/virtualized/project/constructMockCode.js +143 -39
  106. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  107. package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
  108. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  109. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  110. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  111. package/background/src/lib/virtualized/project/start.js +2 -0
  112. package/background/src/lib/virtualized/project/start.js.map +1 -1
  113. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  114. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  115. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  116. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  117. package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
  118. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  119. package/background/src/lib/virtualized/project/writeScenarioComponents.js +83 -12
  120. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  121. package/codeyam-cli/scripts/apply-setup.js +208 -11
  122. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  123. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  124. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  125. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  126. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  127. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  128. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  129. package/codeyam-cli/src/cli.js +32 -25
  130. package/codeyam-cli/src/cli.js.map +1 -1
  131. package/codeyam-cli/src/commands/analyze.js +17 -7
  132. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  133. package/codeyam-cli/src/commands/default.js +14 -2
  134. package/codeyam-cli/src/commands/default.js.map +1 -1
  135. package/codeyam-cli/src/commands/editor.js +2868 -0
  136. package/codeyam-cli/src/commands/editor.js.map +1 -0
  137. package/codeyam-cli/src/commands/init.js +40 -11
  138. package/codeyam-cli/src/commands/init.js.map +1 -1
  139. package/codeyam-cli/src/commands/memory.js +89 -75
  140. package/codeyam-cli/src/commands/memory.js.map +1 -1
  141. package/codeyam-cli/src/data/techStacks.js +77 -0
  142. package/codeyam-cli/src/data/techStacks.js.map +1 -0
  143. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
  144. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
  145. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  146. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  147. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +127 -0
  148. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  149. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +635 -0
  150. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  151. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  152. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  153. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +304 -0
  154. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  155. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +121 -0
  156. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  157. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  158. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  159. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
  160. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  161. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +520 -0
  162. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  163. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  164. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  165. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  166. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  167. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +266 -0
  168. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  169. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +153 -0
  170. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -0
  171. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  172. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  173. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
  174. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  175. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +275 -0
  176. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  177. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +213 -0
  178. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  179. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1742 -0
  180. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  181. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  182. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  183. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
  184. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  185. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +26 -20
  186. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -1
  187. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +101 -0
  188. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  189. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  190. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  191. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  192. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  193. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +227 -0
  194. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
  195. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  196. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  197. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +246 -0
  198. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  199. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +50 -4
  200. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  201. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +51 -0
  202. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  203. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +142 -0
  204. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -0
  205. package/codeyam-cli/src/utils/backgroundServer.js +110 -12
  206. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  207. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  208. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  209. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  210. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  211. package/codeyam-cli/src/utils/devServerState.js +71 -0
  212. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  213. package/codeyam-cli/src/utils/editorApi.js +73 -0
  214. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  215. package/codeyam-cli/src/utils/editorAudit.js +159 -0
  216. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  217. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  218. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  219. package/codeyam-cli/src/utils/editorDevServer.js +197 -0
  220. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  221. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  222. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  223. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  224. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  225. package/codeyam-cli/src/utils/editorJournal.js +225 -0
  226. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  227. package/codeyam-cli/src/utils/editorLoaderHelpers.js +113 -0
  228. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  229. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  230. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  231. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  232. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  233. package/codeyam-cli/src/utils/editorPreview.js +106 -0
  234. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  235. package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
  236. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  237. package/codeyam-cli/src/utils/editorScenarios.js +126 -0
  238. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  239. package/codeyam-cli/src/utils/editorSeedAdapter.js +173 -0
  240. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  241. package/codeyam-cli/src/utils/entityChangeStatus.js +349 -0
  242. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  243. package/codeyam-cli/src/utils/entityChangeStatus.server.js +158 -0
  244. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  245. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  246. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  247. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  248. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  249. package/codeyam-cli/src/utils/git.js +103 -0
  250. package/codeyam-cli/src/utils/git.js.map +1 -1
  251. package/codeyam-cli/src/utils/install-skills.js +57 -15
  252. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  253. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  254. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  255. package/codeyam-cli/src/utils/npmVersionCheck.js +2 -2
  256. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -1
  257. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  258. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  259. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  260. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  261. package/codeyam-cli/src/utils/project.js +15 -5
  262. package/codeyam-cli/src/utils/project.js.map +1 -1
  263. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  264. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  265. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  266. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  267. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  268. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  269. package/codeyam-cli/src/utils/queue/job.js +70 -1
  270. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  271. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  272. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  273. package/codeyam-cli/src/utils/requireSimulations.js +1 -1
  274. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -1
  275. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +5 -6
  276. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -1
  277. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
  278. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
  279. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
  280. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
  281. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +2 -4
  282. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
  283. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +4 -6
  284. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
  285. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +1 -1
  286. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -1
  287. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  288. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  289. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  290. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  291. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  292. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  293. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  294. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  295. package/codeyam-cli/src/utils/rules/index.js +1 -0
  296. package/codeyam-cli/src/utils/rules/index.js.map +1 -1
  297. package/codeyam-cli/src/utils/rules/parser.js +14 -4
  298. package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
  299. package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
  300. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
  301. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  302. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  303. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  304. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  305. package/codeyam-cli/src/utils/scenarioCoverage.js +75 -0
  306. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
  307. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  308. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  309. package/codeyam-cli/src/utils/scenariosManifest.js +112 -0
  310. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  311. package/codeyam-cli/src/utils/serverState.js +57 -2
  312. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  313. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +82 -11
  314. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  315. package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
  316. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  317. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  318. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  319. package/codeyam-cli/src/utils/testRunner.js +158 -0
  320. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  321. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  322. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  323. package/codeyam-cli/src/utils/versionInfo.js +46 -0
  324. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  325. package/codeyam-cli/src/utils/webappDetection.js +35 -2
  326. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  327. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +31 -0
  328. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
  329. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +487 -0
  330. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -0
  331. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +65 -0
  332. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
  333. package/codeyam-cli/src/webserver/app/lib/database.js +41 -27
  334. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  335. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  336. package/codeyam-cli/src/webserver/app/lib/git.js +396 -0
  337. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  338. package/codeyam-cli/src/webserver/backgroundServer.js +118 -18
  339. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  340. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-jNYXRRNI.js → CopyButton-BPXZwM4t.js} +1 -1
  341. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-bwuHPyTa.js → EntityItem-BcgbViKV.js} +3 -3
  342. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CvzqMxcu.js → EntityTypeBadge-g3saevPb.js} +1 -1
  343. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BH0XDim7.js → EntityTypeIcon-CQIG2qda.js} +9 -9
  344. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  345. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-yjIHlOGa.js → InteractivePreview-DYFW3lDD.js} +3 -3
  346. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-Cq5o8jL4.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  347. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BvMu2i-g.js → LoadingDots-BU_OAEMP.js} +1 -1
  348. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-kgBTLoJD.js → LogViewer-ceAyBX-H.js} +1 -1
  349. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzPgx-xO.js → ReportIssueModal-BzHcG7SE.js} +3 -3
  350. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CwZrv-Ok.js → SafeScreenshot-BED4B6sP.js} +1 -1
  351. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-BX2Ny2Qj.js → ScenarioViewer-0DY_NKil.js} +3 -3
  352. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  353. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CDpEprKa.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  354. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +1 -0
  355. package/codeyam-cli/src/webserver/build/client/assets/{_index-BRx8ZGZo.js → _index-DLxKhri3.js} +3 -3
  356. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-4S4yPfFw.js → activity.(_tab)-BcY3q6nt.js} +6 -6
  357. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  358. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  359. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  360. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  361. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-Bni3iiUj.js +22 -0
  362. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  363. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  364. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  365. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  366. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  367. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  368. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  369. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  370. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  371. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  372. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  373. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  374. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  375. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  376. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  377. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  378. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  379. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  380. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
  381. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  382. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  383. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  384. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  385. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  386. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  387. package/codeyam-cli/src/webserver/build/client/assets/{book-open-D4IPYH_y.js → book-open-BYOypzCa.js} +2 -2
  388. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-CG65viiV.js → chevron-down-C_Pmso5S.js} +2 -2
  389. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-DB3aFuEO.js → chunk-JZWAC4HX-C4pqxYJB.js} +1 -1
  390. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-igfMr5DY.js → circle-check-BVMi9VA5.js} +2 -2
  391. package/codeyam-cli/src/webserver/build/client/assets/{copy-Coc4o_8c.js → copy-n2FB0_Sw.js} +3 -3
  392. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CC6AbExI.js +41 -0
  393. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Csi0_PMl.js +1 -0
  394. package/codeyam-cli/src/webserver/build/client/assets/editor-vgc8jrQL.js +10 -0
  395. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-BLQMSKZa.js +41 -0
  396. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-B0h9AqE6.js → entity._sha._-BF4oLwaE.js} +11 -11
  397. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-C7YX6r3H.js +6 -0
  398. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +6 -0
  399. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  400. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-PePWg17F.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  401. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-I-Wo99C_.js → entry.client-DTvKq3TY.js} +1 -1
  402. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-9sMMAiWJ.js → fileTableUtils-cPo8LiG3.js} +1 -1
  403. package/codeyam-cli/src/webserver/build/client/assets/{files-Co65J0s3.js → files-BZrlFE1F.js} +1 -1
  404. package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +1 -0
  405. package/codeyam-cli/src/webserver/build/client/assets/globals-BkWJ_UNc.css +1 -0
  406. package/codeyam-cli/src/webserver/build/client/assets/{index-CUM5iXwc.js → index-10oVnAAH.js} +1 -1
  407. package/codeyam-cli/src/webserver/build/client/assets/{index-_417gcQW.js → index-BcvgDzbZ.js} +1 -1
  408. package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
  409. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
  410. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-TzRHMVog.js → loader-circle-DaAZ_H2w.js} +2 -2
  411. package/codeyam-cli/src/webserver/build/client/assets/manifest-05e71e0b.js +1 -0
  412. package/codeyam-cli/src/webserver/build/client/assets/memory-Bl2rpw8u.js +96 -0
  413. package/codeyam-cli/src/webserver/build/client/assets/{pause-hjzB7t2z.js → pause-f5-1lKBt.js} +3 -3
  414. package/codeyam-cli/src/webserver/build/client/assets/root-ClvYBUSA.js +67 -0
  415. package/codeyam-cli/src/webserver/build/client/assets/{search-DcAwD_Ln.js → search-Di64LWVb.js} +2 -2
  416. package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +1 -0
  417. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DVNJVQgD.js → simulations-DWT-CvLy.js} +1 -1
  418. package/codeyam-cli/src/webserver/build/client/assets/{terminal-DbEAHMbA.js → terminal-Br7MOqts.js} +3 -3
  419. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CAD5b1o_.js → triangle-alert-BLdiCuG-.js} +2 -2
  420. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +1 -0
  421. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  422. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DZlYx2c4.js → useReportContext-O-jkvSPx.js} +1 -1
  423. package/codeyam-cli/src/webserver/build/client/assets/{useToast-ihdMtlf6.js → useToast-9FIWuYfK.js} +1 -1
  424. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  425. package/codeyam-cli/src/webserver/build/server/assets/index-B4lc-hKc.js +1 -0
  426. package/codeyam-cli/src/webserver/build/server/assets/server-build-BbkD6mNV.js +426 -0
  427. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  428. package/codeyam-cli/src/webserver/build-info.json +5 -5
  429. package/codeyam-cli/src/webserver/devServer.js +39 -5
  430. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  431. package/codeyam-cli/src/webserver/editorProxy.js +846 -0
  432. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  433. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
  434. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +230 -0
  435. package/codeyam-cli/src/webserver/server.js +258 -1
  436. package/codeyam-cli/src/webserver/server.js.map +1 -1
  437. package/codeyam-cli/src/webserver/terminalServer.js +726 -0
  438. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  439. package/codeyam-cli/templates/chrome-extension-react/EXTENSION_SETUP.md +75 -0
  440. package/codeyam-cli/templates/chrome-extension-react/gitignore +15 -0
  441. package/codeyam-cli/templates/chrome-extension-react/index.html +12 -0
  442. package/codeyam-cli/templates/chrome-extension-react/package.json +26 -0
  443. package/codeyam-cli/templates/chrome-extension-react/popup.html +12 -0
  444. package/codeyam-cli/templates/chrome-extension-react/public/manifest.json +15 -0
  445. package/codeyam-cli/templates/chrome-extension-react/src/background/service-worker.ts +7 -0
  446. package/codeyam-cli/templates/chrome-extension-react/src/globals.css +6 -0
  447. package/codeyam-cli/templates/chrome-extension-react/src/lib/storage.ts +37 -0
  448. package/codeyam-cli/templates/chrome-extension-react/src/popup/App.tsx +12 -0
  449. package/codeyam-cli/templates/chrome-extension-react/src/popup/main.tsx +10 -0
  450. package/codeyam-cli/templates/chrome-extension-react/tsconfig.json +24 -0
  451. package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +41 -0
  452. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  453. package/codeyam-cli/templates/editor-step-hook.py +231 -0
  454. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +89 -0
  455. package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +33 -0
  456. package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +12 -0
  457. package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +12 -0
  458. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +12 -0
  459. package/codeyam-cli/templates/expo-react-native/app.json +18 -0
  460. package/codeyam-cli/templates/expo-react-native/babel.config.js +9 -0
  461. package/codeyam-cli/templates/expo-react-native/gitignore +12 -0
  462. package/codeyam-cli/templates/expo-react-native/global.css +3 -0
  463. package/codeyam-cli/templates/expo-react-native/lib/storage.ts +32 -0
  464. package/codeyam-cli/templates/expo-react-native/metro.config.js +6 -0
  465. package/codeyam-cli/templates/expo-react-native/nativewind-env.d.ts +1 -0
  466. package/codeyam-cli/templates/expo-react-native/package.json +37 -0
  467. package/codeyam-cli/templates/expo-react-native/tailwind.config.js +10 -0
  468. package/codeyam-cli/templates/expo-react-native/tsconfig.json +10 -0
  469. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  470. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  471. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  472. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  473. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  474. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  475. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  476. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_PATTERNS.md +308 -0
  477. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_UPGRADE.md +304 -0
  478. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +126 -0
  479. package/codeyam-cli/templates/nextjs-prisma-sqlite/FEATURE_PATTERNS.md +37 -0
  480. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  481. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  482. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  483. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  484. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +24 -0
  485. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  486. package/codeyam-cli/templates/nextjs-prisma-sqlite/env +4 -0
  487. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  488. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
  489. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  490. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +38 -0
  491. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  492. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  493. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +40 -0
  494. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  495. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +92 -0
  496. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  497. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  498. package/codeyam-cli/templates/nextjs-prisma-supabase/SUPABASE_SETUP.md +104 -0
  499. package/codeyam-cli/templates/nextjs-prisma-supabase/app/api/todos/route.ts +17 -0
  500. package/codeyam-cli/templates/nextjs-prisma-supabase/app/globals.css +26 -0
  501. package/codeyam-cli/templates/nextjs-prisma-supabase/app/layout.tsx +34 -0
  502. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/prisma.ts +20 -0
  503. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/supabase.ts +12 -0
  504. package/codeyam-cli/templates/nextjs-prisma-supabase/app/page.tsx +10 -0
  505. package/codeyam-cli/templates/nextjs-prisma-supabase/env +9 -0
  506. package/codeyam-cli/templates/nextjs-prisma-supabase/eslint.config.mjs +11 -0
  507. package/codeyam-cli/templates/nextjs-prisma-supabase/gitignore +40 -0
  508. package/codeyam-cli/templates/nextjs-prisma-supabase/next.config.ts +11 -0
  509. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +36 -0
  510. package/codeyam-cli/templates/nextjs-prisma-supabase/postcss.config.mjs +7 -0
  511. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/schema.prisma +27 -0
  512. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/seed.ts +39 -0
  513. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma.config.ts +12 -0
  514. package/codeyam-cli/templates/nextjs-prisma-supabase/tsconfig.json +34 -0
  515. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  516. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  517. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  518. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  519. package/codeyam-cli/templates/rule-notification-hook.py +44 -17
  520. package/codeyam-cli/templates/rule-reflection-hook.py +25 -5
  521. package/codeyam-cli/templates/rules-instructions.md +34 -88
  522. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  523. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +148 -0
  524. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  525. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  526. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  527. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  528. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  529. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  530. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  531. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  532. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  533. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  534. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  535. package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -2
  536. package/package.json +21 -14
  537. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  538. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  539. package/packages/ai/src/lib/completionCall.js +10 -7
  540. package/packages/ai/src/lib/completionCall.js.map +1 -1
  541. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +234 -3
  542. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  543. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  544. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  545. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  546. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  547. package/packages/ai/src/lib/dataStructureChunking.js +9 -5
  548. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
  549. package/packages/ai/src/lib/generateEntityScenarioData.js +57 -2
  550. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  551. package/packages/ai/src/lib/generateExecutionFlows.js +81 -11
  552. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  553. package/packages/analyze/src/lib/ProjectAnalyzer.js +13 -4
  554. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  555. package/packages/analyze/src/lib/asts/index.js +4 -2
  556. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  557. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  558. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  559. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
  560. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  561. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  562. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  563. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  564. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  565. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
  566. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
  567. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
  568. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  569. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +0 -40
  570. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  571. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +18 -4
  572. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  573. package/packages/database/index.js +1 -0
  574. package/packages/database/index.js.map +1 -1
  575. package/packages/database/src/lib/kysely/db.js +5 -0
  576. package/packages/database/src/lib/kysely/db.js.map +1 -1
  577. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +65 -0
  578. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  579. package/packages/database/src/lib/loadCommits.js +23 -13
  580. package/packages/database/src/lib/loadCommits.js.map +1 -1
  581. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  582. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  583. package/packages/database/src/lib/updateCommitMetadata.js +100 -89
  584. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  585. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  586. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  587. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  588. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  589. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  590. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  591. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  592. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  593. package/packages/types/src/enums/ProjectFramework.js +2 -0
  594. package/packages/types/src/enums/ProjectFramework.js.map +1 -1
  595. package/packages/utils/src/lib/fs/rsyncCopy.js +6 -2
  596. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  597. package/scripts/npm-post-install.cjs +34 -0
  598. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -120
  599. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  600. package/codeyam-cli/src/commands/list.js +0 -31
  601. package/codeyam-cli/src/commands/list.js.map +0 -1
  602. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  603. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  604. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  605. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  606. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +0 -34
  607. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +0 -17
  608. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-D1zB-pYc.js +0 -21
  609. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-JTAjQ54M.js +0 -1
  610. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js +0 -6
  611. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CtYowLOt.js +0 -6
  612. package/codeyam-cli/src/webserver/build/client/assets/git-BdHOxVfg.js +0 -15
  613. package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.css +0 -1
  614. package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +0 -1
  615. package/codeyam-cli/src/webserver/build/client/assets/manifest-390cb8fa.js +0 -1
  616. package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +0 -78
  617. package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +0 -62
  618. package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +0 -1
  619. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BqgrAzs3.js +0 -1
  620. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DAFqfEDH.js +0 -2
  621. package/codeyam-cli/src/webserver/build/server/assets/index-CxaRxKVt.js +0 -1
  622. package/codeyam-cli/src/webserver/build/server/assets/server-build-D4DT0nM_.js +0 -259
  623. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  624. package/scripts/finalize-analyzer.cjs +0 -13
  625. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  626. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  627. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  628. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  629. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  630. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -0,0 +1,41 @@
1
+ import{r as s}from"./chunk-JZWAC4HX-C4pqxYJB.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const l=(...t)=>t.filter((e,r,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===r).join(" ").trim();/**
7
+ * @license lucide-react v0.577.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const C=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
12
+ * @license lucide-react v0.577.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const f=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,o)=>o?o.toUpperCase():r.toLowerCase());/**
17
+ * @license lucide-react v0.577.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const i=t=>{const e=f(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
22
+ * @license lucide-react v0.577.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */var w={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
27
+ * @license lucide-react v0.577.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const h=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
32
+ * @license lucide-react v0.577.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const g=s.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:n="",children:a,iconNode:u,...c},p)=>s.createElement("svg",{ref:p,...w,width:e,height:e,stroke:t,strokeWidth:o?Number(r)*24/Number(e):r,className:l("lucide",n),...!a&&!h(c)&&{"aria-hidden":"true"},...c},[...u.map(([m,d])=>s.createElement(m,d)),...Array.isArray(a)?a:[a]]));/**
37
+ * @license lucide-react v0.577.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const b=(t,e)=>{const r=s.forwardRef(({className:o,...n},a)=>s.createElement(g,{ref:a,iconNode:e,className:l(`lucide-${C(i(t))}`,`lucide-${t}`,o),...n}));return r.displayName=i(t),r};export{b as c};
@@ -0,0 +1 @@
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};
@@ -0,0 +1,10 @@
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 Le=(t,s,a)=>ht(t,typeof s!="symbol"?s+"":s,a);import{r as n,j as e,w as ut,u as ft,b as gt}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as jt,S as bt}from"./useCustomSizes-CrAK28Bc.js";import{s as Nt,g as ie,c as vt,b as yt,a as wt,T as St,D as kt}from"./editorPreview-BLQMSKZa.js";import{C as Ne}from"./CopyButton-BPXZwM4t.js";import{_ as Ct}from"./preload-helper-ckwbz45p.js";import{c as Mt}from"./cy-logo-cli-DcX-ZS3p.js";import{u as Pt,S as $e}from"./Spinner-Bb5uFQ5V.js";import"./copy-n2FB0_Sw.js";import"./createLucideIcon-CC6AbExI.js";import"./useLastLogLine-C14nCb1q.js";function ve(t){const[s,a]=n.useState(null),[c,g]=n.useState(!1),d=n.useCallback(()=>{t&&(g(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(t)}`).then(o=>o.json()).then(o=>{a(o),g(!1)}).catch(()=>{a({testFilePath:t,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),g(!1)}))},[t]);return n.useEffect(()=>{t&&d()},[t,d]),{results:s,isRunning:c,runTests:d}}function se(t){if(!t||t==="/")return"Home";const s=t.split("?")[0].replace(/^\//,"");if(!s)return"Home";const a=s.split("/")[0];return a.charAt(0).toUpperCase()+a.slice(1)}function ye(t){return t?t.includes("/isolated-components"):!1}function Et(t,s){return!s||Object.keys(s).length===0?t:t.filter(a=>s[a.name])}function ee({imgSrc:t,name:s,isActive:a,onSelect:c}){return e.jsxs("button",{onClick:c,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 je({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:g}=ve(t);if(c&&!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 d=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=d.length>0?d:a.testCases;if(o.length===0)return null;const h=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[o.map(m=>{var y;const S=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:S})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((w,v)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:w,children:w.split(`
3
+ `)[0]},v)))]},m.fullName)}),e.jsx("button",{onClick:g,disabled:c,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:c?"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 It({scenarios:t,projectRoot:s,activeScenarioId:a,onScenarioSelect:c,zoomComponent:g,onZoomChange:d,analyzedEntities:o=[],glossaryFunctions:h=[],activeAnalyzedScenarioId:m,onAnalyzedScenarioSelect:S,entityImports:y,pageFilePaths:w={}}){const{pageGroups:v,componentGroups:M}=n.useMemo(()=>{var u;const p=new Map,r=new Map;for(const f of t)if(f.componentName){const i=r.get(f.componentName)||[];i.push(f),r.set(f.componentName,i)}else if(ye(f.url)){const i=(u=f.url)==null?void 0:u.match(/[?&]c=([^&]+)/),N=i?decodeURIComponent(i[1]):"Isolated",E=r.get(N)||[];E.push(f),r.set(N,E)}else{const i=se(f.url),N=p.get(i)||[];N.push(f),p.set(i,N)}const x=new Map([...r.entries()].sort(([f],[i])=>f.localeCompare(i)));return{pageGroups:p,componentGroups:x}},[t]),j=n.useMemo(()=>{const p=new Set((o||[]).filter(x=>x.entityType==="visual").map(x=>x.name)),r=new Map;for(const[x,u]of M)p.has(x)||r.set(x,u);return r},[M,o]),{visualEntities:A,libraryEntities:B}=n.useMemo(()=>{const p=o.filter(x=>x.entityType==="visual").sort((x,u)=>x.name.localeCompare(u.name)),r=o.filter(x=>x.entityType==="library"||x.entityType==="functionCall").sort((x,u)=>x.name.localeCompare(u.name));return{visualEntities:p,libraryEntities:r}},[o]),P=n.useMemo(()=>{const p=new Set(B.map(r=>r.name));return h.filter(r=>!p.has(r.name)).sort((r,x)=>r.name.localeCompare(x.name))},[h,B]),R=o.some(p=>p.isAnalyzing),I=n.useRef(null),T=n.useRef(0),F=n.useCallback(()=>{I.current&&(T.current=I.current.scrollTop)},[]);if(n.useEffect(()=>{I.current&&T.current>0&&(I.current.scrollTop=T.current)}),t.length===0&&o.length===0&&P.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 p=M.get(g)||[],r=new Set((y==null?void 0:y[g])||[]),x=r.size>0,u=x?A.filter(i=>r.has(i.name)):[],f=x?B.filter(i=>r.has(i.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:()=>d(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:p.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):p.map(i=>e.jsx(ee,{imgSrc:i.screenshotPath?`/api/editor-scenario-image/${i.id}.png`:null,name:i.name,isActive:i.id===a,onSelect:()=>c(i)},i.id))}),u.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"})}),u.map(i=>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:()=>d(i.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:i.name})}),e.jsx(J,{filePath:i.filePath,projectRoot:s}),(i.scenarios.length>0||i.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:i.scenarios.map(N=>e.jsx(ee,{imgSrc:N.screenshotPath?`/api/screenshot/${N.screenshotPath}`:null,name:N.name,isActive:N.id===m,onSelect:()=>S==null?void 0:S({analysisId:i.analysisId,scenarioId:N.id,scenarioName:N.name,entitySha:i.sha,entityName:i.name})},N.id))})]},i.sha))]}),f.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"})}),f.map(i=>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:i.name})}),e.jsx(J,{filePath:i.filePath,projectRoot:s}),i.testFile&&e.jsx(je,{testFile:i.testFile,entityName:i.name})]},i.sha))]})]})})}return e.jsx("div",{ref:I,onScroll:F,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[v.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"})}),[...v.entries()].sort(([p],[r])=>p==="Home"?-1:r==="Home"?1:p.localeCompare(r)).map(([p,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:p})}),w[p]&&e.jsx(J,{filePath:w[p],projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:r.map(x=>e.jsx(ee,{imgSrc:x.screenshotPath?`/api/editor-scenario-image/${x.id}.png`:null,name:x.name,isActive:x.id===a&&!m,onSelect:()=>c(x)},x.id))})]},p))]}),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(([p,r])=>{var x;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:()=>d(p),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:p})}),((x=r[0])==null?void 0:x.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(u=>e.jsx(ee,{imgSrc:u.screenshotPath?`/api/editor-scenario-image/${u.id}.png`:null,name:u.name,isActive:u.id===a&&!m,onSelect:()=>c(u)},u.id))})]},p)})]}),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"}),R&&t.length===0&&o.every(p=>p.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),A.map(p=>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:()=>d(p.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:p.name}),p.isAnalyzing&&p.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:p.filePath,projectRoot:s}),(p.scenarios.length>0||p.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[p.scenarios.map(r=>e.jsx(ee,{imgSrc:r.screenshotPath?`/api/screenshot/${r.screenshotPath}`:null,name:r.name,isActive:r.id===m,onSelect:()=>S==null?void 0:S({analysisId:p.analysisId,scenarioId:r.id,scenarioName:r.name,entitySha:p.sha,entityName:p.name})},r.id)),p.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))]})]},p.sha))]}),(B.length>0||P.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"})}),B.map(p=>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:p.name}),p.isAnalyzing&&p.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:p.filePath,projectRoot:s}),p.testFile?e.jsx(je,{testFile:p.testFile,entityName:p.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},p.sha)),P.map(p=>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:p.name})}),e.jsx(J,{filePath:p.filePath,projectRoot:s}),e.jsx(je,{testFile:p.testFile,entityName:p.name})]},p.name))]})]})})}function Tt(t,s,a=new Date){const c={"1d":1,"3d":3,"7d":7,"30d":30}[s],g=new Date(a);g.setDate(g.getDate()-c);const d=g.toISOString().split("T")[0],o=t.filter(w=>w.date>=d),h=new Set(o.map(w=>w.commitSha).filter(Boolean)),m=new Map;for(const w of o)if(w.scenarioScreenshots)for(const v of w.scenarioScreenshots){m.has(v.name)||m.set(v.name,[]);const M=m.get(v.name);M.some(j=>j.path===v.path)||M.push({path:v.path,time:w.time})}for(const w of m.values())w.sort((v,M)=>v.time.localeCompare(M.time));const S=[],y=new Map;for(const[w,v]of m){const M=w.indexOf(" - ");if(M!==-1){const j=w.slice(0,M);y.has(j)||y.set(j,[]),y.get(j).push({name:w,screenshots:v})}else S.push({name:w,screenshots:v})}return{commitCount:h.size,entryCount:o.length,appScenarios:S,componentGroups:y,totalScenarios:m.size}}function Rt(t){const s=new Map;for(const a of[...t].reverse()){const c=s.get(a.date)||[];c.push(a),s.set(a.date,c)}return s}function Lt(t){const s=new Map;for(const a of t){let c;if("componentName"in a&&a.componentName)c=a.componentName;else if("componentName"in a&&a.componentName===null)c="App";else{const d=a.name.indexOf(" - ");c=d!==-1?a.name.slice(0,d):"App"}const g=s.get(c)||[];g.push(a),s.set(c,g)}return[...s.entries()].sort(([a],[c])=>a==="App"?-1:c==="App"?1:a.localeCompare(c))}const Be=120;function Ge({text:t,theme:s}){const[a,c]=n.useState(!1),g=t.length>Be,d=g&&!a?t.slice(0,Be)+"…":t,o=s==="light";return e.jsxs("div",{className:`px-4 py-2 ${o?"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 ${o?"text-gray-600":"text-gray-400"}`,children:[d,g&&e.jsx("button",{onClick:()=>c(!a),className:`ml-1 text-[11px] font-medium bg-transparent border-none p-0 cursor-pointer ${o?"text-blue-500 hover:text-blue-700":"text-[#00a0c4] hover:text-[#00c0e8]"}`,children:a?"Show less":"Read more…"})]})]})}function _e({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 $t({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:g}=ve(t);if(c&&!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 d=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=d.length>0?d:a.testCases;if(o.length===0)return null;const h=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[o.map(m=>{var y;const S=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:S})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((w,v)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400/70 truncate max-w-full",title:w,children:w.split(`
4
+ `)[0]},v)))]},m.fullName)}),e.jsx("button",{onClick:g,disabled:c,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:c?"Running...":"Re-run"})]})}const Bt={added:"text-green-400",untracked:"text-green-400",modified:"text-blue-400",renamed:"text-purple-400"};function _t({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 ${Bt[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 At={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 Dt(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 Ot=[{value:"1d",label:"1 Day"},{value:"3d",label:"3 Days"},{value:"7d",label:"1 Week"},{value:"30d",label:"1 Month"}];function zt({entries:t,onScreenshotClick:s}){const[a,c]=n.useState(!1),[g,d]=n.useState("7d"),o=n.useMemo(()=>Tt(t,g),[t,g]);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>c(!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:Ot.map(h=>e.jsx("button",{onClick:()=>d(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:o.commitCount})," ",o.commitCount===1?"commit":"commits"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:o.totalScenarios})," ",o.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:o.entryCount})," ",o.entryCount===1?"entry":"entries"]})]}),o.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:[o.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"}),o.appScenarios.map(h=>e.jsx(Ae,{scenario:h,onScreenshotClick:s},h.name))]}),o.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"}),[...o.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(S=>e.jsx(Ae,{scenario:S,onScreenshotClick:s},S.name))]},h))]})]})]})]})}function Ae({scenario:t,onScreenshotClick:s}){const a=t.name.indexOf(" - "),c=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:c}),e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto",children:t.screenshots.map((g,d)=>e.jsxs("div",{className:"flex items-center shrink-0",children:[d>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 Ut({isActive:t,onScreenshotClick:s,glossaryFunctions:a=[]}){const[c,g]=n.useState([]),[d,o]=n.useState(!0),[h,m]=n.useState(new Set),S=n.useCallback(v=>{m(M=>{const j=new Set(M);return j.has(v)?j.delete(v):j.add(v),j})},[]),y=n.useCallback(async()=>{try{const v=await fetch("/api/editor-journal");if(v.ok){const M=await v.json();g(M.entries||[])}}catch{}finally{o(!1)}},[]);if(n.useEffect(()=>{y()},[y]),n.useEffect(()=>{t&&y()},[t,y]),n.useEffect(()=>{if(!t)return;const v=setInterval(()=>void y(),5e3);return()=>clearInterval(v)},[t,y]),d)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(c.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 w=Rt(c);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsx(zt,{entries:c,onScreenshotClick:s}),[...w.entries()].map(([v,M])=>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(v)})}),e.jsx("div",{className:"space-y-2",children:M.map((j,A)=>{const B=At[j.type]||{label:j.type,color:"bg-gray-600"},P=`${j.time}-${A}`,R=h.has(P);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${R?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2 cursor-pointer",onClick:()=>S(P),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:`${B.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:B.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:Dt(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(Ge,{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 I=Lt(j.scenarioScreenshots),T=j.entityChangeStatus,F=I.filter(([f])=>f==="App").flatMap(([,f])=>f),p=I.filter(([f])=>f!=="App"),r=new Map;for(const f of F){const i=se(f.url??null),N=r.get(i)||[];N.push(f),r.set(i,N)}const x=[...r.entries()],u=f=>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/${f.path.replace("screenshots/","")}`,commitSha:j.commitSha,commitMessage:j.commitMessage,scenarioName:f.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${f.path.replace("screenshots/","")}`,alt:f.name,title:f.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},f.path);return e.jsxs("div",{className:"space-y-2",children:[x.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"}),x.map(([f,i])=>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:f}),(T==null?void 0:T[f])&&e.jsx(_e,{status:T[f]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:i.map(u)})]},f))]}),p.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"}),p.map(([f,i])=>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:f}),(T==null?void 0:T[f])&&e.jsx(_e,{status:T[f]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:i.map(u)})]},f))]})]})})(),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(I=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-200",children:I.name}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate block",children:I.filePath}),I.testFile?e.jsx($t,{testFile:I.testFile,entityName:I.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},I.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})]}),R&&j.modifiedFiles&&j.modifiedFiles.length>0&&e.jsx(_t,{files:j.modifiedFiles})]}),e.jsxs("button",{onClick:()=>S(P),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",R?"Collapse":"Expand"," ———"]})]},P)})})]},v))]})})}function te({imgSrc:t,name:s,isActive:a,onSelect:c}){return e.jsxs("button",{onClick:c,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 le({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 Wt({hasProject:t,scenarios:s,analyzedEntities:a,glossaryFunctions:c=[],projectRoot:g,activeScenarioId:d,onScenarioSelect:o,onAnalyzedScenarioSelect:h,onSwitchToBuild:m,zoomComponent:S,onZoomChange:y,entityImports:w,pageFilePaths:v={},projectTitle:M,projectDescription:j}){const{pageGroups:A,componentGroups:B}=n.useMemo(()=>{var f;const r=new Map,x=new Map;for(const i of s)if(i.componentName){const N=x.get(i.componentName)||[];N.push(i),x.set(i.componentName,N)}else if(ye(i.url)){const N=(f=i.url)==null?void 0:f.match(/[?&]c=([^&]+)/),E=N?decodeURIComponent(N[1]):"Isolated",U=x.get(E)||[];U.push(i),x.set(E,U)}else{const N=se(i.url),E=r.get(N)||[];E.push(i),r.set(N,E)}const u=new Map([...x.entries()].sort(([i],[N])=>i.localeCompare(N)));return{pageGroups:r,componentGroups:u}},[s]),P=n.useMemo(()=>a.filter(r=>r.entityType==="visual").sort((r,x)=>r.name.localeCompare(x.name)),[a]),R=n.useMemo(()=>{const r=new Map;for(const x of c)r.set(x.name,x);return r},[c]),I=n.useRef(null),T=n.useRef(0),F=n.useCallback(()=>{I.current&&(T.current=I.current.scrollTop)},[]);if(n.useEffect(()=>{I.current&&T.current>0&&(I.current.scrollTop=T.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||P.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:[M?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:M}),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(S){const r=A.get(S)||[],x=B.get(S)||[],u=P.find(b=>b.name===S),f=R.get(S),i=[...r,...x],N=new Set((w==null?void 0:w[S])||[]),E=N.size>0,U=E?[...B.entries()].filter(([b])=>N.has(b)):[],ae=E?P.filter(b=>N.has(b.name)&&!U.some(([L])=>L===b.name)):[],K=E?c.filter(b=>N.has(b.name)):[],W=U.length>0||ae.length>0,D=K.length>0,q=W||D;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("button",{onClick:()=>y(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:S}),f&&e.jsx(le,{filePath:f.filePath,projectRoot:g})]}),i.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:i.map(b=>e.jsx(te,{imgSrc:b.screenshotPath?`/api/editor-scenario-image/${b.id}.png`:null,name:b.name,isActive:b.id===d,onSelect:()=>o(b)},b.id))}),u&&(u.scenarios.length>0||u.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[u.scenarios.map(b=>e.jsx(te,{imgSrc:b.screenshotPath?`/api/screenshot/${b.screenshotPath}`:null,name:b.name,isActive:!1,onSelect:()=>h({analysisId:u.analysisId,scenarioId:b.id,scenarioName:b.name,entitySha:u.sha,entityName:u.name})},b.id)),u.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))]}),f&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-gray-500",children:"Tests:"}),e.jsx(le,{filePath:f.testFile,projectRoot:g})]}),i.length===0&&!u&&!f&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"}),q&&e.jsxs("div",{className:"pt-3 mt-2 border-t border-[#3d3d3d] space-y-3",children:[W&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),U.map(([b,L])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(b),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:b})}),L.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:L.map(O=>e.jsx(te,{imgSrc:O.screenshotPath?`/api/editor-scenario-image/${O.id}.png`:null,name:O.name,isActive:O.id===d,onSelect:()=>o(O)},O.id))})]},b)),ae.map(b=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(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(L=>e.jsx(te,{imgSrc:L.screenshotPath?`/api/screenshot/${L.screenshotPath}`:null,name:L.name,isActive:!1,onSelect:()=>h({analysisId:b.analysisId,scenarioId:L.id,scenarioName:L.name,entitySha:b.sha,entityName:b.name})},L.id)),b.pendingScenarios.map(L=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:L,children:L},L))]})]},b.sha))]}),D&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),K.map(b=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(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(le,{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:I,onScroll:F,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[M&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-white m-0 font-['IBM_Plex_Sans']",children:M}),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],[x])=>r==="Home"?-1:x==="Home"?1:r.localeCompare(x)).map(([r,x])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>y(r),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:r})}),v[r]&&e.jsx(le,{filePath:v[r],projectRoot:g}),e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:x.map(u=>e.jsx(te,{imgSrc:u.screenshotPath?`/api/editor-scenario-image/${u.id}.png`:null,name:u.name,isActive:u.id===d,onSelect:()=>o(u)},u.id))})]},r))]})]})})}const De={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],c=s&&(t.status==="edited"||t.status==="impacted");return e.jsx("button",{onClick:c?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 ${c?"cursor-pointer hover:opacity-80 transition-opacity":"cursor-default"}`,children:a.label})}function Oe({filePath:t}){const[s,a]=n.useState(null),[c,g]=n.useState(!0),[d,o]=n.useState(null);return n.useEffect(()=>{Ct(()=>import("./index-yHOVb4rc.js"),__vite__mapDeps([0,1])).then(h=>{o(()=>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]),c?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Loading diff..."}):!s||!d?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(d,{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 ze({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 Ue({scenarioId:t,name:s,isActive:a,onSelect:c}){const[g,d]=n.useState(!1);return n.useEffect(()=>{d(!1)},[t]),e.jsxs("button",{onClick:c,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:()=>d(!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 Gt({testFile:t,entityName:s}){const{results:a,isRunning:c,runTests:g}=ve(t);if(c&&!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 d=s?a.testCases.filter(m=>m.fullName.startsWith(s)):a.testCases,o=d.length>0?d:a.testCases;if(o.length===0)return null;const h=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[o.map(m=>{var y;const S=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:S})]}),m.status==="failed"&&((y=m.failureMessages)==null?void 0:y.map((w,v)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:w,children:w.split(`
5
+ `)[0]},v)))]},m.fullName)}),e.jsx("button",{onClick:g,disabled:c,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:c?"Running...":"Re-run"})]})}function We(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],[c])=>{var h,m;const g=((h=s[a])==null?void 0:h.status)||"impacted",d=((m=s[c])==null?void 0:m.status)||"impacted",o=(De[g]??2)-(De[d]??2);return o!==0?o:a.localeCompare(c)})}function Vt({scenarios:t,allScenarios:s=[],glossaryFunctions:a=[],projectRoot:c,activeScenarioId:g,onScenarioSelect:d,onClose:o,entityChangeStatus:h={},modifiedFiles:m=[],featureName:S,userPrompt:y}){const w=n.useMemo(()=>{if(s.length===0||Object.keys(h).length===0)return t;const r=new Set(t.map(u=>u.id)),x=s.filter(u=>{var i;if(r.has(u.id))return!1;const f=u.componentName||se(u.url);return((i=h[f])==null?void 0:i.status)==="impacted"});return x.length===0?t:[...t,...x]},[t,s,h]),v=n.useMemo(()=>Object.entries(h).filter(([,r])=>r.status==="new"||r.status==="edited").map(([r,x])=>({name:r,status:x.status})),[h]),[M,j]=n.useState(null),A=n.useCallback(r=>{j(x=>x===r?null:r)},[]),{pageGroups:B,componentGroups:P}=n.useMemo(()=>{var u;const r=new Map,x=new Map;for(const f of w)if(f.componentName){const i=x.get(f.componentName)||[];i.push(f),x.set(f.componentName,i)}else if(ye(f.url)){const i=(u=f.url)==null?void 0:u.match(/[?&]c=([^&]+)/),N=i?decodeURIComponent(i[1]):"Isolated",E=x.get(N)||[];E.push(f),x.set(N,E)}else{const i=se(f.url),N=r.get(i)||[];N.push(f),r.set(i,N)}return{pageGroups:r,componentGroups:x}},[w]),R=n.useMemo(()=>He([...B.entries()],h),[B,h]),I=n.useMemo(()=>He([...P.entries()],h),[P,h]),T=R,F=I,p=n.useMemo(()=>Et(a,h),[a,h]);return w.length===0&&a.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:o,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"}),S&&e.jsx("div",{className:"text-[11px] text-gray-400 truncate",title:S,children:S})]}),e.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none shrink-0",title:"Close results",children:"×"})]}),y&&e.jsx(Ge,{text:y,theme:"light"}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[T.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:T.map(([r,x])=>{var N;const u=h[r],f=M===r,i=(N=x[0])==null?void 0:N.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}),u&&e.jsx(Fe,{status:u,onClick:()=>A(r)})]}),f&&(u==null?void 0:u.status)==="edited"&&i&&e.jsx(Oe,{filePath:i}),f&&(u==null?void 0:u.status)==="impacted"&&e.jsx(ze,{impactedBy:u.impactedBy,changedEntities:v}),e.jsx("div",{className:"flex flex-wrap gap-3",children:x.map(E=>e.jsx(Ue,{scenarioId:E.id,name:We(E.name),isActive:E.id===g,onSelect:()=>d(E)},E.id))})]},r)})})]}),F.length>0&&e.jsxs("div",{className:T.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:F.map(([r,x])=>{var N;const u=h[r],f=M===r,i=(N=x[0])==null?void 0:N.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}),u&&e.jsx(Fe,{status:u,onClick:()=>A(r)})]}),f&&(u==null?void 0:u.status)==="edited"&&i&&e.jsx(Oe,{filePath:i}),f&&(u==null?void 0:u.status)==="impacted"&&e.jsx(ze,{impactedBy:u.impactedBy,changedEntities:v}),e.jsx("div",{className:"flex flex-wrap gap-3",children:x.map(E=>e.jsx(Ue,{scenarioId:E.id,name:We(E.name),isActive:E.id===g,onSelect:()=>d(E)},E.id))})]},r)})})]}),p.length>0&&e.jsxs("div",{className:T.length>0||F.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:p.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:c}),r.testFile?e.jsx(Gt,{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:T.length>0||F.length>0||p.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 Jt({items:t,onNavigate:s}){return t.length===0?null:e.jsx("nav",{className:"flex items-center gap-1 text-xs",children:t.map((a,c)=>{const g=c===t.length-1;return e.jsxs("span",{className:"flex items-center gap-1",children:[c>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 Yt=[{key:"app",label:"App"},{key:"build",label:"Build"},{key:"data",label:"Structure"},{key:"journal",label:"Journal"}];function Kt({activeTab:t,onTabChange:s,buildIdle:a,zoomComponent:c,breadcrumbItems:g,onBreadcrumbNavigate:d}){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:Mt,alt:"CodeYam",className:"h-5 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-xs whitespace-nowrap",children:"Codeyam Editor"}),c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-3.5 bg-gray-600"}),e.jsx(Jt,{items:g,onNavigate:d})]})]}),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:Yt.map(o=>e.jsxs("button",{onClick:()=>s(o.key),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors cursor-pointer ${t===o.key?"bg-[#7a4444] text-white":"text-gray-300 hover:text-white"}`,children:[o.label,o.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"})]},o.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(Qt,{commitSha:t.commitSha,onLoadCommit:a})})]})}function Qt({commitSha:t,onLoadCommit:s}){const[a,c]=n.useState(!1),[g,d]=n.useState(null);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{c(!0),d(null),s(t).then(o=>{o.success||d(o.error||"Failed to load commit")}).catch(o=>{d(o instanceof Error?o.message:"Network error")}).finally(()=>c(!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 Xt({analysisId:t,scenarioId:s,scenarioName:a,entityName:c,projectSlug:g,onStateChange:d}){const{interactiveServerUrl:o,isStarting:h,isLoading:m}=Pt({analysisId:t,scenarioId:s,scenarioName:a,entityName:c,projectSlug:g,enabled:!0});return n.useEffect(()=>{d(o,h||m)},[o,h,m,d]),null}function Zt(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 es(){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 d=!1,o=null;const h=async()=>{try{const m=await fetch("/api/editor-dev-server");if(d)return;const S=await m.json(),y=Zt(a.current,S),{shouldAutoStart:w,...v}=y;if(s(v),w)try{const M=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})});if(d)return;M.ok?s(j=>({...j,isStarting:!0})):s(j=>({...j,canStartServer:!1}))}catch{}}catch{}};return h(),o=setInterval(()=>void h(),2e3),()=>{d=!0,o&&clearInterval(o)}},[t.url]);const c=n.useCallback(()=>{s(d=>({...d,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(d=>({...d,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:c,startServer:g}}const ps=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}];class ts extends n.Component{constructor(){super(...arguments);Le(this,"state",{error:null,errorInfo:null})}static getDerivedStateFromError(a){return{error:a,errorInfo:null}}componentDidCatch(a,c){console.error("[EditorErrorBoundary] Error:",a.message),console.error("[EditorErrorBoundary] Component stack:",c.componentStack),console.error("[EditorErrorBoundary] Loader snapshot:",JSON.stringify(this.props.loaderSnapshot,null,2)),this.setState({errorInfo:c})}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 be=[{name:"Desktop",width:1440,height:900},{name:"Laptop",width:1024,height:768},{name:"Tablet",width:768,height:1024},{name:"Mobile",width:375,height:667}],hs=ut(function(){const{projectSlug:s,projectRoot:a,hasProject:c,scenarios:g,allScenarios:d,analyzedEntities:o,glossaryFunctions:h,entityImports:m,pageFilePaths:S,entityChangeStatus:y,modifiedFiles:w,featureName:v,userPrompt:M,projectTitle:j,projectDescription:A,defaultScreenSize:B}=ft(),[P,R]=gt(),I=n.useRef(null),T=n.useRef(null),F=n.useRef(null),p=P.get("zoom")||void 0,r=P.get("scenario")||void 0,x=n.useRef(null);n.useEffect(()=>{if(!Nt(r,x.current))return;const l=d.find(C=>C.id===r);if(!l)return;x.current=r;const k=ie(l.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:k,scenarioId:l.id,scenarioName:l.name,scenarioType:l.type})}).catch(()=>{})},[r,d]),n.useEffect(()=>{const l=new BroadcastChannel("codeyam-editor");return l.onmessage=k=>{var C;if(((C=k.data)==null?void 0:C.type)==="switch-scenario"&&k.data.scenarioId){const $=k.data.scenarioId,z=d.find(ge=>ge.id===$);if(!z)return;x.current=$;const fe=new URLSearchParams(P);fe.set("scenario",$),fe.delete("zoom"),R(fe),q(null),L(null),G(null),V(!0);const mt=ie(z.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:mt,scenarioId:$,scenarioType:z.type})}).then(()=>{Q(ge=>ge+1)}).catch(()=>{V(!1)})}},()=>l.close()},[P,R,d]),n.useEffect(()=>{if(P.get("ref")!=="link"||!r)return;const l=new BroadcastChannel("codeyam-editor");l.postMessage({type:"switch-scenario",scenarioId:r}),l.close(),window.close()},[]);const{devServerUrl:u,proxyUrl:f,isStarting:i,error:N,canStartServer:E,retryServer:U,startServer:ae}=es(),[K,W]=n.useState(!1),[D,q]=n.useState(null),[b,L]=n.useState(null),[O,we]=n.useState(!1),[oe,G]=n.useState(null),Ve=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&&(G(null),W(!1)),C},[]),Je=n.useCallback((l,k)=>{L(C=>(l&&l!==C&&W(!1),l)),!k&&l&&W(!0),we(k)},[]),Se=n.useCallback(l=>{G(null),q(C=>(C&&C.analysisId===l.analysisId||(L(null),Q(z=>z+1)),l)),we(!0),W(!1);const k=new URLSearchParams(P);k.delete("scenario"),k.delete("zoom"),R(k)},[P,R]),[_,re]=n.useState(B?{name:B.name,width:B.width,height:B.height}:{name:"Desktop",width:1440,height:900}),[Ye,ce]=n.useState(!1),[H,de]=n.useState("app"),Ke=n.useCallback(()=>{de("build"),xe(!0)},[]),[qe,xe]=n.useState(!1),[Qe,ke]=n.useState(!1),Xe=n.useCallback(l=>{ke(l)},[]),[me,Ce]=n.useState(!1),Ze=n.useCallback(()=>{Ce(!0),de("build"),xe(!0)},[]),Me=n.useCallback(()=>{Ce(!1)},[]),et=n.useCallback(l=>{re(l)},[]),[ne,pe]=n.useState(!1),tt=n.useCallback(()=>{if(ne){pe(!1);return}typeof Notification<"u"&&Notification.permission==="default"?Notification.requestPermission().then(l=>{l==="granted"&&pe(!0)}):pe(!0)},[ne]);n.useEffect(()=>{if(H==="build"){ke(!1);const l=setTimeout(()=>{var k,C;(k=I.current)==null||k.scrollToBottom(),(C=I.current)==null||C.focus()},50);return()=>clearTimeout(l)}},[H]);const[he,st]=n.useState(null);n.useEffect(()=>{const l=F.current;if(!l)return;const k=new ResizeObserver(C=>{const $=C[0];$&&st({width:$.contentRect.width,height:$.contentRect.height})});return k.observe(l),()=>k.disconnect()},[]);const Y=n.useMemo(()=>he?vt(he,_):1,[he,_]),[at,Q]=n.useState(0),[Pe,Ee]=n.useState(null),[Ie,V]=n.useState(!1),rt=n.useCallback((l,k)=>{if(Ee(l||null),k){const C=new URLSearchParams(P);C.set("scenario",k),x.current=k,R(C)}G(null),Q(C=>C+1)},[P,R]),{customSizes:Te,addCustomSize:nt}=jt(s);n.useMemo(()=>[...be,...Te],[Te]);const it=n.useMemo(()=>{const l=[{name:"App"}];return p&&l.push({name:p,componentName:p}),l},[p]),ue=n.useCallback(l=>{const k=new URLSearchParams(P);if(l){k.set("zoom",l);const C=d.find($=>$.componentName===l||$.componentName===null&&l==="Home");if(C){k.set("scenario",C.id),x.current=C.id,V(!0);const $=ie(C.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:C.id,scenarioType:C.type})}).then(()=>{Q(z=>z+1)}).catch(()=>{V(!1)})}else k.delete("scenario")}else k.delete("zoom"),k.delete("scenario");R(k)},[P,R,d]),X=n.useCallback(l=>{if(q(null),L(null),G(null),l.viewportWidth&&l.viewportHeight){const $=be.find(z=>z.width===l.viewportWidth&&z.height===l.viewportHeight);re({name:($==null?void 0:$.name)||"Custom",width:l.viewportWidth,height:l.viewportHeight})}x.current=l.id;const k=new URLSearchParams(P);k.set("scenario",l.id),R(k),V(!0);const C=ie(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($=>$+1)}).catch(()=>{V(!1)})},[P,R]),lt=n.useCallback(l=>{if(!l.commitSha){const k=d.find(C=>C.name===l.scenarioName);if(k){X(k);return}}G(l)},[d,X]),ot=l=>{re({name:l.name,width:l.width,height:l.height})},ct=l=>{nt(l,_.width,_.height??900),ce(!1),re(k=>({...k,name:l}))},dt=()=>{D||W(!0),V(!1)},Z=n.useMemo(()=>yt({activeAnalyzedScenario:!!D,analyzedPreviewUrl:b,activeScenarioId:r||null,scenarios:d,proxyUrl:f,devServerUrl:u,zoomComponent:p||null}),[f,u,p,r,d,D,b]),Re=n.useMemo(()=>wt(Z,Pe),[Z,Pe]),xt=n.useMemo(()=>({projectSlug:s,hasProject:c,scenarioCount:g==null?void 0:g.length,allScenarioCount:d==null?void 0:d.length,analyzedEntityCount:o==null?void 0:o.length,glossaryFunctionCount:h==null?void 0:h.length,entityChangeStatusKeys:y?Object.keys(y):[],featureName:v}),[s,c,g,d,o,h,y,v]);return e.jsx(ts,{loaderSnapshot:xt,children:e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[D&&e.jsx(Xt,{analysisId:D.analysisId,scenarioId:D.scenarioId,scenarioName:D.scenarioName,entityName:D.entityName,projectSlug:s,onStateChange:Je},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:[be.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:()=>ce(!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||Z;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:()=>G(null),onLoadCommit:Ve}):Z?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&&!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-[#2a2a2a] rounded-lg p-8 w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx($e,{})}),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"})]})]})}),Ie&&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:T,src:Re||Z,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:N?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:N}),e.jsx("button",{onClick:U,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"})]}):i||O?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx($e,{})}),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:O?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:O?"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(Kt,{activeTab:H,onTabChange:l=>{de(l),l==="build"&&xe(!0)},buildIdle:Qe,zoomComponent:p,breadcrumbItems:it,onBreadcrumbNavigate:ue}),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:H==="build"?"visible":"hidden"},children:[e.jsx("div",{className:me?"flex-1 min-h-0":"flex-1",style:me?{flex:"1 1 50%"}:void 0,children:e.jsx(St,{ref:I,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:rt,onShowResults:Ze,onHideResults:Me,onSetViewport:et,editorMode:!0,onIdleChange:Xe,notificationsEnabled:ne})}),me&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(Vt,{scenarios:g,allScenarios:d,glossaryFunctions:h,projectRoot:a,activeScenarioId:r,onScenarioSelect:X,onClose:Me,entityChangeStatus:y,modifiedFiles:w,featureName:v,userPrompt:M})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:H==="app"?"visible":"hidden"},children:e.jsx(Wt,{hasProject:c,scenarios:d,analyzedEntities:o,glossaryFunctions:h,projectRoot:a,activeScenarioId:r,onScenarioSelect:X,onAnalyzedScenarioSelect:Se,onSwitchToBuild:Ke,zoomComponent:p,onZoomChange:ue,entityImports:m,pageFilePaths:S,projectTitle:j,projectDescription:A})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:H==="data"?"visible":"hidden"},children:e.jsx(It,{scenarios:d,projectRoot:a,activeScenarioId:r,onScenarioSelect:X,zoomComponent:p,onZoomChange:ue,analyzedEntities:[],glossaryFunctions:h,activeAnalyzedScenarioId:D==null?void 0:D.scenarioId,onAnalyzedScenarioSelect:Se,entityImports:m,pageFilePaths:S})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:H==="journal"?"visible":"hidden"},children:e.jsx(Ut,{isActive:H==="journal",onScreenshotClick:lt,glossaryFunctions:h})})]}),e.jsx(kt,{serverUrl:u,isStarting:i,projectSlug:s,devServerError:N,onStartServer:E?ae:void 0,notificationsEnabled:ne,onToggleNotifications:tt})]})]}),Ye&&e.jsx(bt,{width:_.width,height:_.height??900,onSave:ct,onCancel:()=>ce(!1)})]})})});export{hs as default,ps as meta};
@@ -0,0 +1,41 @@
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 C}from"./preload-helper-ckwbz45p.js";function ie({serverUrl:r,isStarting:e,projectSlug:n,devServerError:o,onStartServer:l,notificationsEnabled:m,onToggleNotifications:w}){const[b,v]=d.useState(null),c=d.useRef(null);d.useEffect(()=>{if(!n)return;const j=new EventSource("/api/dev-mode-events");return j.onmessage=z=>{try{const A=JSON.parse(z.data);A.type==="file-synced"&&(v(A.fileName),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{v(null)},5e3))}catch{}},()=>{j.close(),c.current&&clearTimeout(c.current)}},[n]);let a;o?a="error":e?a="starting":r?a="running":a="stopped";const _={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},E={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 ${_[a]}`}),u.jsxs("span",{className:"text-gray-400",children:["Server:"," ",u.jsx("span",{className:"text-gray-300",children:E[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"}),w&&u.jsx("button",{onClick:w,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 ee(r,e){try{const{WebglAddon:o}=await C(async()=>{const{WebglAddon:m}=await import("./addon-webgl-DI8QOUvO.js").then(w=>w.a);return{WebglAddon:m}},[]),l=new o;return l.onContextLoss(()=>{e==null||e("webgl","canvas",new Error("WebGL context lost")),l.dispose(),X(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 X(r);return n||(e==null||e("canvas","dom",new Error("Canvas addon failed")),{type:"dom",dispose:()=>{}})}async function X(r){try{const{CanvasAddon:e}=await C(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 te=`
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 re(){if(document.getElementById("xterm-css"))return;const r=document.createElement("style");r.id="xterm-css",r.textContent=te,document.head.appendChild(r)}const ce=d.forwardRef(function({entityName:e,entityType:n,entitySha:o,entityFilePath:l,scenarioName:m,scenarioDescription:w,analysisId:b,projectSlug:v,onRefreshPreview:c,onShowResults:a,onHideResults:_,onSetViewport:E,editorMode:j,onIdleChange:z,notificationsEnabled:A},G){const M=d.useRef(null),R=d.useRef(null),B=d.useRef(null),S=d.useRef(null),W=d.useRef(null),P=d.useRef(!1),L=d.useRef(0),I=d.useRef(!1),N=d.useRef(z);N.current=z;const D=d.useRef(A);D.current=A;const V=d.useCallback(()=>{var f;(f=B.current)==null||f.focus()},[]);return d.useImperativeHandle(G,()=>({sendInput(f){const h=S.current;h&&h.readyState===WebSocket.OPEN&&(h.send(JSON.stringify({type:"input",data:f})),setTimeout(()=>{h.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var f;(f=B.current)==null||f.focus()},scrollToBottom(){var h;const f=(h=M.current)==null?void 0:h.querySelector(".xterm-viewport");f&&(f.scrollTop=f.scrollHeight)}})),d.useEffect(()=>{const f=M.current;if(!f)return;let h=!1;return re(),Promise.all([C(()=>import("./xterm-BqvuqXEL.js"),[]),C(()=>import("./addon-fit-YJmn1quW.js"),[]),C(()=>import("./addon-web-links-Duc5hnl7.js").then(T=>T.a),__vite__mapDeps([0,1]))]).then(([T,Z,K])=>{if(h)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),y=p.searchParams.get("scenario");if(y&&p.pathname==="/editor"){const g=new BroadcastChannel("codeyam-editor");g.postMessage({type:"switch-scenario",scenarioId:y}),g.close();return}}catch{}window.open(t,"_blank")}}}),$=new Z.FitAddon;s.loadAddon($),s.loadAddon(new K.WebLinksAddon),s.open(f);let k=null;ee(s,(i,t,p)=>{console.warn(`[Terminal] Renderer fallback: ${i} → ${t}`,p)}).then(i=>{if(h){i.dispose();return}console.log(`[Terminal] Using ${i.type} renderer`),k=i.dispose}),requestAnimationFrame(()=>{try{$.fit()}catch{}}),B.current=s,s.focus(),setTimeout(()=>s.focus(),100),setTimeout(()=>s.focus(),500);const Q=window.location.protocol==="https:"?"wss:":"ws:",Y=window.location.host;function F(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),w&&t.set("scenarioDescription",w),b&&t.set("analysisId",b),v&&t.set("projectSlug",v),j&&t.set("editorMode","true"),i&&t.set("reconnectId",i),`${Q}//${Y}/ws/terminal?${t.toString()}`}function J(i){const t=F(i),p=new WebSocket(t);S.current=p,p.onopen=()=>{L.current=0,I.current=!1,p.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows}))},p.onmessage=y=>{var g,H;try{const x=JSON.parse(y.data);if(x.type==="session-id"){W.current=x.sessionId;return}if(x.type==="refresh-preview"){c==null||c(x.path,x.scenarioId);return}if(x.type==="show-results"){a==null||a();return}if(x.type==="hide-results"){_==null||_();return}if(x.type==="set-viewport"){E==null||E({name:x.name,width:x.width,height:x.height});return}if(x.type==="claude-idle"){if(console.log("[Terminal] Received claude-idle, notifications:",D.current,"permission:",typeof Notification<"u"?Notification.permission:"N/A"),(g=N.current)==null||g.call(N,!0),D.current&&typeof Notification<"u"&&Notification.permission==="granted"){const q=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});q.onclick=()=>{window.focus(),q.close()}}return}x.type==="output"&&(s.write(x.data),(H=N.current)==null||H.call(N,!1))}catch{s.write(y.data)}},p.onclose=()=>{if(P.current){s.write(`\r
34
+ \x1B[90m[Terminal session ended]\x1B[0m\r
35
+ `);return}const y=L.current;if(y<5&&W.current){const g=1e3*Math.pow(2,Math.min(y,3));L.current=y+1,s.write(`\r
36
+ \x1B[33m[Reconnecting...]\x1B[0m\r
37
+ `),setTimeout(()=>{P.current||J(W.current)},g)}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
+ `),W.current=null,L.current=0,J())},p.onerror=()=>{}}J(),s.onData(i=>{const t=S.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify({type:"input",data:i}))});let O=null;const U=new ResizeObserver(()=>{O&&clearTimeout(O),O=setTimeout(()=>{let i;try{i=$.proposeDimensions()}catch{return}if(!i||i.cols===s.cols&&i.rows===s.rows)return;const t=f.querySelector(".xterm-viewport");let p,y=!0;t&&(p=t.scrollTop,y=t.scrollTop+t.clientHeight>=t.scrollHeight-10),$.fit(),t&&p!==void 0&&(y?t.scrollTop=t.scrollHeight:t.scrollTop=p);const g=S.current;g&&g.readyState===WebSocket.OPEN&&g.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows}))},150)});U.observe(f),R.current=()=>{var i;O&&clearTimeout(O),U.disconnect(),P.current=!0,(i=S.current)==null||i.close(),S.current=null,k==null||k(),s.dispose(),B.current=null}}),()=>{var T;h=!0,(T=R.current)==null||T.call(R),R.current=null}},[]),u.jsx("div",{ref:M,onClick:V,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});function ne(r){return r.replace(/[^a-zA-Z0-9_]+/g,"_")}function ae(r){const{activeAnalyzedScenario:e,analyzedPreviewUrl:n,activeScenarioId:o,scenarios:l,proxyUrl:m,devServerUrl:w,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||w;return a?c.url.startsWith("/")?`${a}${c.url}`:c.url:null}}const v=m||w;if(!v)return null;if(b&&o){const c=l.find(_=>_.id===o),a=c?ne(c.name):"Default";return`${v}/__codeyam__/${b}/${a}`}return v}function le(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 ue(r,e){return r?r!==e:!1}function de(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{ie as D,ce as T,le as a,ae as b,de as c,ne as g,ue as s};